This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
EBCDIC: make t/op/pat #242 and 243 finally succeed.
[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 Sat May 11 22:27:01 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         cat <<EOM >&2
1862
1863 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1864
1865 EOM
1866         exit 1
1867 fi
1868
1869 : compute the number of columns on the terminal for proper question formatting
1870 case "$COLUMNS" in
1871 '') COLUMNS='80';;
1872 esac
1873
1874 : set up the echo used in my read
1875 myecho="case \"\$xxxm\" in
1876 '') echo $n \"\$rp $c\" >&4;;
1877 *) case \"\$rp\" in
1878         '') echo $n \"[\$xxxm] $c\";;
1879         *)
1880                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1881                         echo \"\$rp\" >&4
1882                         echo $n \"[\$xxxm] $c\" >&4
1883                 else
1884                         echo $n \"\$rp [\$xxxm] $c\" >&4
1885                 fi
1886                 ;;
1887         esac;;
1888 esac"
1889
1890 : now set up to do reads with possible shell escape and default assignment
1891 cat <<EOSC >myread
1892 $startsh
1893 xxxm=\$dflt
1894 $myecho
1895 ans='!'
1896 case "\$fastread" in
1897 yes) case "\$dflt" in
1898         '') ;;
1899         *) ans='';
1900                 case "\$silent-\$rp" in
1901                 true-) ;;
1902                 *) echo " " >&4;;
1903                 esac;;
1904         esac;;
1905 *) case "\$silent" in
1906         true) case "\$rp" in
1907                 '') ans='';;
1908                 esac;;
1909         esac;;
1910 esac
1911 while expr "X\$ans" : "X!" >/dev/null; do
1912         read answ
1913         set x \$xxxm
1914         shift
1915         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1916         case  "\$answ" in
1917         "!")
1918                 sh 1>&4
1919                 echo " "
1920                 $myecho
1921                 ;;
1922         !*)
1923                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1924                 shift
1925                 sh 1>&4 -c "\$*"
1926                 echo " "
1927                 $myecho
1928                 ;;
1929         "\$ans")
1930                 case "\$ans" in
1931                 \\&*)
1932                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1933                         shift
1934                         case "\$1" in
1935                         -d)
1936                                 fastread=yes
1937                                 echo "(OK, I'll run with -d after this question.)" >&4
1938                                 ;;
1939                         -*)
1940                                 echo "*** Sorry, \$1 not supported yet." >&4
1941                                 ;;
1942                         esac
1943                         $myecho
1944                         ans=!
1945                         ;;
1946                 esac;;
1947         *)
1948                 case "\$aok" in
1949                 y)
1950                         echo "*** Substitution done -- please confirm."
1951                         xxxm="\$ans"
1952                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1953                         xxxm="\$ans"
1954                         ans=!
1955                         ;;
1956                 *)
1957                         echo "*** Error -- try again."
1958                         ans=!
1959                         ;;
1960                 esac
1961                 $myecho
1962                 ;;
1963         esac
1964         case "\$ans\$xxxm\$nostick" in
1965         '')
1966                 ans=!
1967                 $myecho
1968                 ;;
1969         esac
1970 done
1971 case "\$ans" in
1972 '') ans="\$xxxm";;
1973 esac
1974 EOSC
1975
1976 : create .config dir to save info across Configure sessions
1977 test -d ../.config || mkdir ../.config
1978 cat >../.config/README <<EOF
1979 This directory created by Configure to save information that should
1980 persist across sessions for $package.
1981
1982 You may safely delete it if you wish.
1983 EOF
1984
1985 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1986 case "$usedevel" in
1987 $define|true|[yY]*) ;;
1988 *) case "$xversion" in
1989    *[13579])
1990         cat >&4 <<EOH
1991 *** WHOA THERE!!! ***
1992
1993     This is an UNSTABLE DEVELOPMENT release.
1994     The version of this $package distribution is $xversion, that is, odd,
1995     (as opposed to even) and that signifies a development release.
1996     If you want a maintenance release, you want an even-numbered version.
1997
1998     Do ***NOT*** install this into production use.
1999     Data corruption and crashes are possible.
2000
2001     It is most seriously suggested that you do not continue any further
2002     unless you want to help in developing and debugging Perl.
2003
2004     If you *still* want to build perl, you can answer 'y' now,
2005     or pass -Dusedevel to Configure.
2006
2007 EOH
2008         rp='Do you really want to continue?'
2009         dflt='n'
2010         . ./myread
2011         case "$ans" in
2012         [yY]) echo >&4 "Okay, continuing."
2013               usedevel="$define" ;;
2014         *) echo >&4 "Okay, bye."
2015            exit 1
2016            ;;
2017         esac
2018         ;;
2019     esac
2020     ;;
2021 esac
2022 case "$usedevel" in
2023 $define|true|[yY]*)
2024         case "$versiononly" in
2025         '') versiononly="$define" ;;
2026         esac
2027         case "$installusrbinperl" in
2028         '') installusrbinperl="$undef" ;;
2029         esac
2030         ;;
2031 esac
2032
2033 : general instructions
2034 needman=true
2035 firsttime=true
2036 user=`(logname) 2>/dev/null`
2037 case "$user" in
2038 '') user=`whoami 2>&1`;;
2039 esac
2040 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2041         firsttime=false
2042         echo " "
2043         rp='Would you like to see the instructions?'
2044         dflt=n
2045         . ./myread
2046         case "$ans" in
2047         [yY]*) ;;
2048         *) needman=false;;
2049         esac
2050 fi
2051 if $needman; then
2052         cat <<EOH
2053
2054 This installation shell script will examine your system and ask you questions
2055 to determine how the perl5 package should be installed. If you get
2056 stuck on a question, you may use a ! shell escape to start a subshell or
2057 execute a command.  Many of the questions will have default answers in square
2058 brackets; typing carriage return will give you the default.
2059
2060 On some of the questions which ask for file or directory names you are allowed
2061 to use the ~name construct to specify the login directory belonging to "name",
2062 even if you don't have a shell which knows about that.  Questions where this is
2063 allowed will be marked "(~name ok)".
2064
2065 EOH
2066         rp=''
2067         dflt='Type carriage return to continue'
2068         . ./myread
2069         cat <<'EOH'
2070
2071 The prompter used in this script allows you to use shell variables and
2072 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2073 in the default answer, as if the default line was a set of arguments given to a
2074 script shell.  This means you may also use $* to repeat the whole default line,
2075 so you do not have to re-type everything to add something to the default.
2076
2077 Everytime there is a substitution, you will have to confirm.  If there is an
2078 error (e.g. an unmatched backtick), the default answer will remain unchanged
2079 and you will be prompted again.
2080
2081 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2082 the questions and use the computed defaults (or the previous answers if there
2083 was already a config.sh file). Type 'Configure -h' for a list of options.
2084 You may also start interactively and then answer '& -d' at any prompt to turn
2085 on the non-interactive behaviour for the remainder of the execution.
2086
2087 EOH
2088         . ./myread
2089         cat <<EOH
2090
2091 Much effort has been expended to ensure that this shell script will run on any
2092 Unix system.  If despite that it blows up on yours, your best bet is to edit
2093 Configure and run it again.  If you can't run Configure for some reason,
2094 you'll have to generate a config.sh file by hand.  Whatever problems you
2095 have, let me (perlbug@perl.org) know how I blew it.
2096
2097 This installation script affects things in two ways:
2098
2099 1) it may do direct variable substitutions on some of the files included
2100    in this kit.
2101 2) it builds a config.h file for inclusion in C programs.  You may edit
2102    any of these files as the need arises after running this script.
2103
2104 If you make a mistake on a question, there is no easy way to back up to it
2105 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2106 files.  Configure will offer to let you do this before it runs the SH files.
2107
2108 EOH
2109         dflt='Type carriage return to continue'
2110         . ./myread
2111         case "$firsttime" in
2112         true) echo $user >>../.config/instruct;;
2113         esac
2114 fi
2115
2116 : find out where common programs are
2117 echo " "
2118 echo "Locating common programs..." >&4
2119 cat <<EOSC >loc
2120 $startsh
2121 case \$# in
2122 0) exit 1;;
2123 esac
2124 thing=\$1
2125 shift
2126 dflt=\$1
2127 shift
2128 for dir in \$*; do
2129         case "\$thing" in
2130         .)
2131         if test -d \$dir/\$thing; then
2132                 echo \$dir
2133                 exit 0
2134         fi
2135         ;;
2136         *)
2137         for thisthing in \$dir/\$thing; do
2138                 : just loop through to pick last item
2139         done
2140         if test -f \$thisthing; then
2141                 echo \$thisthing
2142                 exit 0
2143         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2144                 echo \$thisthing
2145                 exit 0
2146         elif test -f \$dir/\$thing.exe; then
2147                 if test -n "$DJGPP"; then
2148                         echo \$dir/\$thing.exe
2149                 else
2150                         : on Eunice apparently
2151                         echo \$dir/\$thing
2152                 fi
2153                 exit 0
2154         fi
2155         ;;
2156         esac
2157 done
2158 echo \$dflt
2159 exit 1
2160 EOSC
2161 chmod +x loc
2162 $eunicefix loc
2163 loclist="
2164 awk
2165 cat
2166 chmod
2167 comm
2168 cp
2169 echo
2170 expr
2171 grep
2172 ls
2173 mkdir
2174 rm
2175 sed
2176 sort
2177 touch
2178 tr
2179 uniq
2180 "
2181 trylist="
2182 Mcc
2183 ar
2184 bison
2185 byacc
2186 cpp
2187 csh
2188 date
2189 egrep
2190 gmake
2191 gzip
2192 less
2193 ln
2194 make
2195 more
2196 nm
2197 nroff
2198 pg
2199 test
2200 uname
2201 zip
2202 "
2203 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2204 pth="$pth /lib /usr/lib"
2205 for file in $loclist; do
2206         eval xxx=\$$file
2207         case "$xxx" in
2208         /*|?:[\\/]*)
2209                 if test -f "$xxx"; then
2210                         : ok
2211                 else
2212                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2213                         xxx=`./loc $file $file $pth`
2214                 fi
2215                 ;;
2216         '') xxx=`./loc $file $file $pth`;;
2217         *) xxx=`./loc $xxx $xxx $pth`;;
2218         esac
2219         eval $file=$xxx$_exe
2220         eval _$file=$xxx
2221         case "$xxx" in
2222         /*)
2223                 echo $file is in $xxx.
2224                 ;;
2225         ?:[\\/]*)
2226                 echo $file is in $xxx.
2227                 ;;
2228         *)
2229                 echo "I don't know where '$file' is, and my life depends on it." >&4
2230                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2231                 exit 1
2232                 ;;
2233         esac
2234 done
2235 echo " "
2236 echo "Don't worry if any of the following aren't found..."
2237 say=offhand
2238 for file in $trylist; do
2239         eval xxx=\$$file
2240         case "$xxx" in
2241         /*|?:[\\/]*)
2242                 if test -f "$xxx"; then
2243                         : ok
2244                 else
2245                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2246                         xxx=`./loc $file $file $pth`
2247                 fi
2248                 ;;
2249         '') xxx=`./loc $file $file $pth`;;
2250         *) xxx=`./loc $xxx $xxx $pth`;;
2251         esac
2252         eval $file=$xxx$_exe
2253         eval _$file=$xxx
2254         case "$xxx" in
2255         /*)
2256                 echo $file is in $xxx.
2257                 ;;
2258         ?:[\\/]*)
2259                 echo $file is in $xxx.
2260                 ;;
2261         *)
2262                 echo "I don't see $file out there, $say."
2263                 say=either
2264                 ;;
2265         esac
2266 done
2267 case "$egrep" in
2268 egrep)
2269         echo "Substituting grep for egrep."
2270         egrep=$grep
2271         _egrep=$grep
2272         ;;
2273 esac
2274 case "$ln" in
2275 ln)
2276         echo "Substituting cp for ln."
2277         ln=$cp
2278         _ln=$cp
2279         ;;
2280 esac
2281 case "$make" in
2282 make)   
2283         case "$gmake" in
2284         gmake)
2285         echo "I can't find make or gmake, and my life depends on it." >&4
2286         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2287         exit 1
2288         ;;
2289         esac
2290         ;;
2291 esac    
2292 case "$gmake" in
2293 gmake)  ;;
2294 *)      # We can't have osname yet.
2295         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2296                 # Assume that gmake, if found, is definitely GNU make
2297                 # and prefer it over the system make.
2298                 echo "Substituting gmake for make."
2299                 make=$gmake
2300                 _make=$gmake
2301         fi
2302         ;;
2303 esac
2304 case "$test" in
2305 test)
2306         echo "Hopefully test is built into your sh."
2307         ;;
2308 *)
2309         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2310                 echo "Using the test built into your sh."
2311                 test=test
2312                 _test=test
2313         fi
2314         ;;
2315 esac
2316 case "$echo" in
2317 echo)
2318         echo "Hopefully echo is built into your sh."
2319         ;;
2320 '') ;;
2321 *)
2322         echo " "
2323 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2324         $echo $n "hi there$c" >foo1
2325         echo $n "hi there$c" >foo2
2326         if cmp foo1 foo2 >/dev/null 2>&1; then
2327                 echo "They are compatible.  In fact, they may be identical."
2328         else
2329                 case "$n" in
2330                 '-n') n='' c='\c';;
2331                 *) n='-n' c='';;
2332                 esac
2333                 cat <<FOO
2334 They are not compatible!  You are probably running ksh on a non-USG system.
2335 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2336 have echo built in and we may have to run some Bourne shell scripts.  That
2337 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2338
2339 FOO
2340                 $echo $n "The star should be here-->$c"
2341                 $echo "*"
2342         fi
2343         $rm -f foo1 foo2
2344         ;;
2345 esac
2346
2347 cat <<EOS >trygcc
2348 $startsh
2349 EOS
2350 cat <<'EOSC' >>trygcc
2351 case "$cc" in
2352 '') ;;
2353 *)  $rm -f try try.*
2354     $cat >try.c <<EOM
2355 int main(int argc, char *argv[]) {
2356   return 0;
2357 }
2358 EOM
2359     if $cc -o try $ccflags $ldflags try.c; then
2360        :
2361     else
2362         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2363         despair=yes
2364         trygcc=yes
2365         case "$cc" in
2366         *gcc*) trygcc=no ;;
2367         esac
2368         case "`$cc -v -c try.c 2>&1`" in
2369         *gcc*) trygcc=no ;;
2370         esac
2371         if $test X"$trygcc" = Xyes; then
2372             if gcc -o try -c try.c; then
2373                 echo " "
2374                 echo "You seem to have a working gcc, though." >&4
2375                 rp="Would you like to use it?"
2376                 dflt=y
2377                 if $test -f myread; then
2378                     . ./myread
2379                 else
2380                     if $test -f UU/myread; then
2381                         . ./UU/myread
2382                     else
2383                         echo "Cannot find myread, sorry.  Aborting." >&2
2384                         exit 1
2385                     fi
2386                 fi  
2387                 case "$ans" in
2388                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2389                        if $test -f usethreads.cbu; then
2390                            $cat >&4 <<EOM 
2391
2392 *** However, any setting of the C compiler flags (e.g. for thread support)
2393 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2394 *** (together with e.g. -Dusethreads).
2395
2396 EOM
2397                        fi;;
2398                 esac
2399             fi
2400         fi
2401     fi
2402     $rm -f try try.*
2403     ;;
2404 esac
2405 EOSC
2406
2407 cat <<EOS >checkcc
2408 $startsh
2409 EOS
2410 cat <<'EOSC' >>checkcc
2411 case "$cc" in        
2412 '') ;;
2413 *)  $rm -f try try.*              
2414     $cat >try.c <<EOM
2415 int main(int argc, char *argv[]) {
2416   return 0;
2417 }
2418 EOM
2419     if $cc -o try $ccflags $ldflags try.c; then
2420        :
2421     else
2422         if $test X"$despair" = Xyes; then
2423            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2424         fi
2425         $cat >&4 <<EOM         
2426 You need to find a working C compiler.
2427 Either (purchase and) install the C compiler supplied by your OS vendor,
2428 or for a free C compiler try http://gcc.gnu.org/
2429 I cannot continue any further, aborting.
2430 EOM
2431         exit 1
2432     fi
2433     $rm -f try try.*
2434     ;;
2435 esac
2436 EOSC
2437
2438 : determine whether symbolic links are supported
2439 echo " "
2440 $touch blurfl
2441 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2442         echo "Symbolic links are supported." >&4
2443         lns="$ln -s"
2444 else
2445         echo "Symbolic links are NOT supported." >&4
2446         lns="$ln"
2447 fi
2448 $rm -f blurfl sym
2449
2450 : determine whether symbolic links are supported
2451 echo " "
2452 case "$lns" in
2453 *"ln"*" -s")
2454         echo "Checking how to test for symbolic links..." >&4
2455         $lns blurfl sym
2456         if $test "X$issymlink" = X; then
2457                 case "$newsh" in
2458                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2459                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2460                 esac
2461                 if test $? = 0; then
2462                         issymlink="test -h"
2463                 else
2464                         echo "Your builtin 'test -h' may be broken." >&4
2465                         case "$test" in
2466                         /*)     ;;
2467                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2468                                 for p in $pth
2469                                 do
2470                                         if test -f "$p/$test"; then
2471                                                 test="$p/$test"
2472                                                 break
2473                                         fi
2474                                 done
2475                                 ;;
2476                         esac
2477                         case "$test" in
2478                         /*)
2479                                 echo "Trying external '$test -h'." >&4
2480                                 issymlink="$test -h"
2481                                 if $test ! -h sym >/dev/null 2>&1; then
2482                                         echo "External '$test -h' is broken, too." >&4
2483                                         issymlink=''
2484                                 fi
2485                                 ;;
2486                         *)      issymlink='' ;;
2487                         esac
2488                 fi              
2489         fi
2490         if $test "X$issymlink" = X; then
2491                 if $test -L sym 2>/dev/null; then
2492                         issymlink="$test -L"
2493                         echo "The builtin '$test -L' worked." >&4
2494                 fi
2495         fi
2496         if $test "X$issymlink" != X; then
2497                 echo "You can test for symbolic links with '$issymlink'." >&4
2498         else
2499                 echo "I do not know how you can test for symbolic links." >&4
2500         fi
2501         $rm -f blurfl sym
2502         ;;
2503 *)      echo "No symbolic links, so not testing for their testing..." >&4
2504         ;;
2505 esac
2506 echo " "
2507
2508
2509 case "$mksymlinks" in
2510 $define|true|[yY]*)
2511         case "$src" in
2512         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2513                 exit 1
2514                 ;;
2515         *)      case "$lns:$issymlink" in
2516                 *"ln"*" -s:"*"test -"?)
2517                         echo "Creating the symbolic links..." >&4
2518                         echo "(First creating the subdirectories...)" >&4
2519                         cd ..
2520                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2521                                 read directory
2522                                 test -z "$directory" && break
2523                                 mkdir -p $directory
2524                         done
2525                         # Sanity check 1.
2526                         if test ! -d t/base; then
2527                                 echo "Failed to create the subdirectories.  Aborting." >&4
2528                                 exit 1
2529                         fi
2530                         echo "(Then creating the symlinks...)" >&4
2531                         awk '{print $1}' $src/MANIFEST | while true; do
2532                                 read filename
2533                                 test -z "$filename" && break
2534                                 if test -f $filename; then
2535                                         if $issymlink $filename; then
2536                                                 rm -f $filename
2537                                         fi
2538                                 fi
2539                                 if test -f $filename; then
2540                                         echo "$filename already exists, not symlinking."
2541                                 else
2542                                         ln -s $src/$filename $filename
2543                                 fi
2544                         done
2545                         # Sanity check 2.
2546                         if test ! -f t/base/lex.t; then
2547                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2548                                 exit 1
2549                         fi
2550                         cd UU
2551                         ;;
2552                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2553                         ;;
2554                 esac
2555                 ;;
2556         esac
2557         ;;
2558 esac
2559
2560
2561 case "$usecrosscompile" in
2562 $define|true|[yY]*)
2563         $echo "Cross-compiling..."
2564         croak=''
2565         case "$cc" in
2566         *-*-gcc) # A cross-compiling gcc, probably.
2567             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2568             ar=$targetarch-ar
2569             # leave out ld, choosing it is more complex
2570             nm=$targetarch-nm
2571             ranlib=$targetarch-ranlib
2572             $echo 'extern int foo;' > try.c
2573             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2574             shift
2575             if $test $# -gt 0; then
2576                 incpth="$incpth $*"
2577                 incpth="`$echo $incpth|$sed 's/^ //'`"
2578                 echo "Guessing incpth '$incpth'." >&4
2579                 for i in $*; do
2580                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2581                     if $test -d $j; then
2582                         libpth="$libpth $j"
2583                     fi
2584                 done   
2585                 libpth="`$echo $libpth|$sed 's/^ //'`"
2586                 echo "Guessing libpth '$libpth'." >&4
2587             fi
2588             $rm -f try.c
2589             ;;
2590         esac
2591         case "$targetarch" in
2592         '') echo "Targetarch not defined." >&4; croak=y ;;
2593         *)  echo "Using targetarch $targetarch." >&4 ;;
2594         esac
2595         case "$incpth" in
2596         '') echo "Incpth not defined." >&4; croak=y ;;
2597         *)  echo "Using incpth '$incpth'." >&4 ;;
2598         esac
2599         case "$libpth" in
2600         '') echo "Libpth not defined." >&4; croak=y ;;
2601         *)  echo "Using libpth '$libpth'." >&4 ;;
2602         esac
2603         case "$usrinc" in
2604         '') for i in $incpth; do
2605                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2606                     usrinc=$i
2607                     echo "Guessing usrinc $usrinc." >&4
2608                     break
2609                 fi
2610             done
2611             case "$usrinc" in
2612             '') echo "Usrinc not defined." >&4; croak=y ;;
2613             esac
2614             ;;
2615         *)  echo "Using usrinc $usrinc." >&4 ;;
2616         esac
2617         case "$targethost" in
2618         '') echo "Targethost not defined." >&4; croak=y ;;
2619         *)  echo "Using targethost $targethost." >&4
2620         esac
2621         locincpth=' '
2622         loclibpth=' '
2623         case "$croak" in
2624         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2625         esac
2626         case "$src" in
2627         /*) run=$src/Cross/run
2628             targetmkdir=$src/Cross/mkdir
2629             to=$src/Cross/to
2630             from=$src/Cross/from
2631             ;;
2632         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2633             run=$pwd/Cross/run
2634             targetmkdir=$pwd/Cross/mkdir
2635             to=$pwd/Cross/to
2636             from=$pwd/Cross/from
2637             ;;
2638         esac
2639         case "$targetrun" in
2640         '') targetrun=ssh ;;
2641         esac
2642         case "$targetto" in
2643         '') targetto=scp ;;
2644         esac
2645         case "$targetfrom" in
2646         '') targetfrom=scp ;;
2647         esac
2648         run=$run-$targetrun
2649         to=$to-$targetto
2650         from=$from-$targetfrom
2651         case "$targetdir" in
2652         '')  targetdir=/tmp
2653              echo "Guessing targetdir $targetdir." >&4
2654              ;;
2655         esac
2656         case "$targetuser" in
2657         '')  targetuser=root
2658              echo "Guessing targetuser $targetuser." >&4
2659              ;;
2660         esac
2661         case "$targetfrom" in
2662         scp)    q=-q ;;
2663         *)      q='' ;;
2664         esac
2665         case "$targetrun" in
2666         ssh|rsh)
2667             cat >$run <<EOF
2668 #!/bin/sh
2669 case "\$1" in
2670 -cwd)
2671   shift
2672   cwd=\$1
2673   shift
2674   ;;
2675 esac
2676 case "\$cwd" in
2677 '') cwd=$targetdir ;;
2678 esac
2679 exe=\$1
2680 shift
2681 if $test ! -f \$exe.xok; then
2682   $to \$exe
2683   $touch \$exe.xok
2684 fi
2685 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2686 EOF
2687             ;;
2688         *)  echo "Unknown targetrun '$targetrun'" >&4
2689             exit 1
2690             ;;
2691         esac
2692         case "$targetmkdir" in
2693         */Cross/mkdir)
2694             cat >$targetmkdir <<EOF
2695 #!/bin/sh
2696 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2697 EOF
2698             $chmod a+rx $targetmkdir
2699             ;;
2700         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2701             exit 1
2702             ;;
2703         esac
2704         case "$targetto" in
2705         scp|rcp)
2706             cat >$to <<EOF
2707 #!/bin/sh
2708 for f in \$@
2709 do
2710   case "\$f" in
2711   /*)
2712     $targetmkdir \`dirname \$f\`
2713     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2714     ;;
2715   *)
2716     $targetmkdir $targetdir/\`dirname \$f\`
2717     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2718     ;;
2719   esac
2720 done
2721 exit 0
2722 EOF
2723             ;;
2724         cp) cat >$to <<EOF
2725 #!/bin/sh
2726 for f in \$@
2727 do
2728   case "\$f" in
2729   /*)
2730     $mkdir -p $targetdir/\`dirname \$f\`
2731     $cp \$f $targetdir/\$f || exit 1
2732     ;;
2733   *)
2734     $targetmkdir $targetdir/\`dirname \$f\`
2735     $cp \$f $targetdir/\$f || exit 1
2736     ;;
2737   esac
2738 done
2739 exit 0
2740 EOF
2741             ;;
2742         *)  echo "Unknown targetto '$targetto'" >&4
2743             exit 1
2744             ;;
2745         esac
2746         case "$targetfrom" in
2747         scp|rcp)
2748           cat >$from <<EOF
2749 #!/bin/sh
2750 for f in \$@
2751 do
2752   $rm -f \$f
2753   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2754 done
2755 exit 0
2756 EOF
2757             ;;
2758         cp) cat >$from <<EOF
2759 #!/bin/sh
2760 for f in \$@
2761 do
2762   $rm -f \$f
2763   cp $targetdir/\$f . || exit 1
2764 done
2765 exit 0
2766 EOF
2767             ;;
2768         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2769             exit 1
2770             ;;
2771         esac
2772         if $test ! -f $run; then
2773             echo "Target 'run' script '$run' not found." >&4
2774         else
2775             $chmod a+rx $run
2776         fi
2777         if $test ! -f $to; then
2778             echo "Target 'to' script '$to' not found." >&4
2779         else
2780             $chmod a+rx $to
2781         fi
2782         if $test ! -f $from; then
2783             echo "Target 'from' script '$from' not found." >&4
2784         else
2785             $chmod a+rx $from
2786         fi
2787         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2788             exit 1
2789         fi
2790         cat >&4 <<EOF
2791 Using '$run' for remote execution,
2792 and '$from' and '$to'
2793 for remote file transfer.
2794 EOF
2795         ;;
2796 *)      run=''
2797         to=:
2798         from=:
2799         usecrosscompile='undef'
2800         targetarch=''
2801         ;;
2802 esac
2803
2804 : see whether [:lower:] and [:upper:] are supported character classes
2805 echo " "
2806 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2807 ABYZ)
2808         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2809         up='[:upper:]'
2810         low='[:lower:]'
2811         ;;
2812 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2813         # (0xc9 and 0xd1), therefore that is a nice testing point.
2814         if test "X$up" = X -o "X$low" = X; then
2815             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2816             ij) up='[A-Z]'
2817                 low='[a-z]'
2818                 ;;
2819             esac
2820         fi
2821         if test "X$up" = X -o "X$low" = X; then
2822             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2823             ij) up='A-Z'
2824                 low='a-z'
2825                 ;;
2826             esac
2827         fi
2828         if test "X$up" = X -o "X$low" = X; then
2829             case "`echo IJ | od -x 2>/dev/null`" in
2830             *C9D1*|*c9d1*)
2831                 echo "Hey, this might be EBCDIC." >&4
2832                 if test "X$up" = X -o "X$low" = X; then
2833                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2834                     ij) up='[A-IJ-RS-Z]'
2835                         low='[a-ij-rs-z]'
2836                         ;;
2837                     esac
2838                 fi
2839                 if test "X$up" = X -o "X$low" = X; then
2840                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2841                     ij) up='A-IJ-RS-Z'
2842                         low='a-ij-rs-z'
2843                         ;;
2844                     esac
2845                 fi
2846                 ;;
2847             esac
2848         fi
2849 esac
2850 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2851 ij)
2852     echo "Using $up and $low to convert case." >&4
2853     ;;
2854 *)
2855     echo "I don't know how to translate letters from upper to lower case." >&4
2856     echo "Your tr is not acting any way I know of." >&4
2857     exit 1
2858     ;;
2859 esac
2860 : set up the translation script tr, must be called with ./tr of course
2861 cat >tr <<EOSC
2862 $startsh
2863 case "\$1\$2" in
2864 '[A-Z][a-z]') exec $tr '$up' '$low';;
2865 '[a-z][A-Z]') exec $tr '$low' '$up';;
2866 esac
2867 exec $tr "\$@"
2868 EOSC
2869 chmod +x tr
2870 $eunicefix tr
2871
2872 : Try to determine whether config.sh was made on this system
2873 case "$config_sh" in
2874 '')
2875 myuname=`$uname -a 2>/dev/null`
2876 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2877 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2878 # because the A-Z/a-z are not consecutive.
2879 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2880         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2881 newmyuname="$myuname"
2882 dflt=n
2883 case "$knowitall" in
2884 '')
2885         if test -f ../config.sh; then
2886                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2887                         eval "`grep myuname= ../config.sh`"
2888                 fi
2889                 if test "X$myuname" = "X$newmyuname"; then
2890                         dflt=y
2891                 fi
2892         fi
2893         ;;
2894 *) dflt=y;;
2895 esac
2896
2897 : Get old answers from old config file if Configure was run on the
2898 : same system, otherwise use the hints.
2899 hint=default
2900 cd ..
2901 if test -f config.sh; then
2902         echo " "
2903         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2904         . UU/myread
2905         case "$ans" in
2906         n*|N*) echo "OK, I'll ignore it."
2907                 mv config.sh config.sh.old
2908                 myuname="$newmyuname"
2909                 ;;
2910         *)  echo "Fetching default answers from your old config.sh file..." >&4
2911                 tmp_n="$n"
2912                 tmp_c="$c"
2913                 tmp_sh="$sh"
2914                 . ./config.sh
2915                 cp config.sh UU
2916                 n="$tmp_n"
2917                 c="$tmp_c"
2918                 : Older versions did not always set $sh.  Catch re-use of such
2919                 : an old config.sh.
2920                 case "$sh" in
2921                 '') sh="$tmp_sh" ;;
2922                 esac
2923                 hint=previous
2924                 ;;
2925         esac
2926 fi
2927 . ./UU/checkcc
2928 if test ! -f config.sh; then
2929         $cat <<EOM
2930
2931 First time through, eh?  I have some defaults handy for some systems
2932 that need some extra help getting the Configure answers right:
2933
2934 EOM
2935         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2936         dflt=''
2937         : Half the following guesses are probably wrong... If you have better
2938         : tests or hints, please send them to perlbug@perl.org
2939         : The metaconfig authors would also appreciate a copy...
2940         $test -f /irix && osname=irix
2941         $test -f /xenix && osname=sco_xenix
2942         $test -f /dynix && osname=dynix
2943         $test -f /dnix && osname=dnix
2944         $test -f /lynx.os && osname=lynxos
2945         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2946         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2947         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2948         $test -f /bin/mips && /bin/mips && osname=mips
2949         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2950                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2951         $test -d /usr/apollo/bin && osname=apollo
2952         $test -f /etc/saf/_sactab && osname=svr4
2953         $test -d /usr/include/minix && osname=minix
2954         $test -f /system/gnu_library/bin/ar.pm && osname=vos
2955         if $test -d /MachTen -o -d /MachTen_Folder; then
2956                 osname=machten
2957                 if $test -x /sbin/version; then
2958                         osvers=`/sbin/version | $awk '{print $2}' |
2959                         $sed -e 's/[A-Za-z]$//'`
2960                 elif $test -x /usr/etc/version; then
2961                         osvers=`/usr/etc/version | $awk '{print $2}' |
2962                         $sed -e 's/[A-Za-z]$//'`
2963                 else
2964                         osvers="$2.$3"
2965                 fi
2966         fi
2967
2968         $test -f /sys/posix.dll &&
2969                 $test -f /usr/bin/what &&
2970                 set X `/usr/bin/what /sys/posix.dll` &&
2971                 $test "$3" = UWIN &&
2972                 osname=uwin &&
2973                 osvers="$5"
2974
2975         if $test -f $uname; then
2976                 set X $myuname
2977                 shift
2978
2979                 case "$5" in
2980                 fps*) osname=fps ;;
2981                 mips*)
2982                         case "$4" in
2983                         umips) osname=umips ;;
2984                         *) osname=mips ;;
2985                         esac;;
2986                 [23]100) osname=mips ;;
2987                 next*) osname=next ;;
2988                 i386*)
2989                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2990                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2991                                 osname='sco'
2992                                 osvers=$tmp
2993                         elif $test -f /etc/kconfig; then
2994                                 osname=isc
2995                                 if test "$lns" = "$ln -s"; then
2996                                         osvers=4
2997                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2998                                         osvers=3
2999                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3000                                         osvers=2
3001                                 fi
3002                         fi
3003                         tmp=''
3004                         ;;
3005                 pc*)
3006                         if test -n "$DJGPP"; then
3007                                 osname=dos
3008                                 osvers=djgpp
3009                         fi
3010                         ;;
3011                 esac
3012
3013                 case "$1" in
3014                 aix) osname=aix
3015                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3016                         case "$tmp" in
3017                         'not found') osvers="$4"."$3" ;;
3018                         '<3240'|'<>3240') osvers=3.2.0 ;;
3019                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3020                         '=3250'|'>3250') osvers=3.2.5 ;;
3021                         *) osvers=$tmp;;
3022                         esac
3023                         ;;
3024                 bsd386) osname=bsd386
3025                         osvers=`$uname -r`
3026                         ;;
3027                 cygwin*) osname=cygwin
3028                         osvers="$3"
3029                         ;;
3030                 *dc.osx) osname=dcosx
3031                         osvers="$3"
3032                         ;;
3033                 dnix) osname=dnix
3034                         osvers="$3"
3035                         ;;
3036                 domainos) osname=apollo
3037                         osvers="$3"
3038                         ;;
3039                 dgux) osname=dgux 
3040                         osvers="$3"
3041                         ;;
3042                 dynixptx*) osname=dynixptx
3043                         osvers=`echo "$4"|sed 's/^v//'`
3044                         ;;
3045                 freebsd) osname=freebsd 
3046                         osvers="$3" ;;
3047                 genix) osname=genix ;;
3048                 hp*) osname=hpux 
3049                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3050                         ;;
3051                 irix*) osname=irix
3052                         case "$3" in
3053                         4*) osvers=4 ;;
3054                         5*) osvers=5 ;;
3055                         *)      osvers="$3" ;;
3056                         esac
3057                         ;;
3058                 linux) osname=linux
3059                         case "$3" in
3060                         *)      osvers="$3" ;;
3061                         esac
3062                         ;;
3063                 MiNT) osname=mint
3064                         ;;
3065                 netbsd*) osname=netbsd
3066                         osvers="$3"
3067                         ;;
3068                 news-os) osvers="$3"
3069                         case "$3" in
3070                         4*) osname=newsos4 ;;
3071                         *) osname=newsos ;;
3072                         esac
3073                         ;;
3074                 next*) osname=next ;;
3075                 nonstop-ux) osname=nonstopux ;;
3076                 openbsd) osname=openbsd
3077                         osvers="$3"
3078                         ;;
3079                 POSIX-BC | posix-bc ) osname=posix-bc
3080                         osvers="$3"
3081                         ;;
3082                 powerux | power_ux | powermax_os | powermaxos | \
3083                 powerunix | power_unix) osname=powerux
3084                         osvers="$3"
3085                         ;;
3086                 qnx) osname=qnx
3087                         osvers="$4"
3088                         ;;
3089                 solaris) osname=solaris
3090                         case "$3" in
3091                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3092                         *)      osvers="$3" ;;
3093                         esac
3094                         ;;
3095                 sunos) osname=sunos
3096                         case "$3" in
3097                         5*) osname=solaris
3098                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3099                         *)      osvers="$3" ;;
3100                         esac
3101                         ;;
3102                 titanos) osname=titanos
3103                         case "$3" in
3104                         1*) osvers=1 ;;
3105                         2*) osvers=2 ;;
3106                         3*) osvers=3 ;;
3107                         4*) osvers=4 ;;
3108                         *)      osvers="$3" ;;
3109                         esac
3110                         ;;
3111                 ultrix) osname=ultrix
3112                         osvers="$3"
3113                         ;;
3114                 osf1|mls+)      case "$5" in
3115                                 alpha)
3116                                         osname=dec_osf
3117                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3118                                         case "$osvers" in
3119                                         [1-9].[0-9]*) ;;
3120                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3121                                         esac
3122                                         ;;
3123                         hp*)    osname=hp_osf1  ;;
3124                         mips)   osname=mips_osf1 ;;
3125                         esac
3126                         ;;
3127                 unixware) osname=svr5
3128                         osvers="$4"
3129                         ;;
3130                 uts)    osname=uts
3131                         osvers="$3"
3132                         ;;
3133                 vos) osvers="$3"
3134                         ;;
3135                 $2) case "$osname" in
3136                         *isc*) ;;
3137                         *freebsd*) ;;
3138                         svr*)
3139                                 : svr4.x or possibly later
3140                                 case "svr$3" in 
3141                                 ${osname}*)
3142                                         osname=svr$3
3143                                         osvers=$4
3144                                         ;;
3145                                 esac
3146                                 case "$osname" in
3147                                 svr4.0)
3148                                         : Check for ESIX
3149                                         if test -f /stand/boot ; then
3150                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3151                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3152                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3153                                                         if test -n "$isesix"; then
3154                                                                 osname=esix4
3155                                                         fi
3156                                                 fi
3157                                         fi
3158                                         ;;
3159                                 esac
3160                                 ;;
3161                         *)      if test -f /etc/systemid; then
3162                                         osname=sco
3163                                         set `echo $3 | $sed 's/\./ /g'` $4
3164                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3165                                                 osvers=$1.$2.$3
3166                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3167                                                 osvers=$1.$2
3168                                         elif $test -f $src/hints/sco_$1.sh; then
3169                                                 osvers=$1
3170                                         fi
3171                                 else
3172                                         case "$osname" in
3173                                         '') : Still unknown.  Probably a generic Sys V.
3174                                                 osname="sysv"
3175                                                 osvers="$3"
3176                                                 ;;
3177                                         esac
3178                                 fi
3179                                 ;;
3180                         esac
3181                         ;;
3182                 *)      case "$osname" in
3183                         '') : Still unknown.  Probably a generic BSD.
3184                                 osname="$1"
3185                                 osvers="$3"
3186                                 ;;
3187                         esac
3188                         ;;
3189                 esac
3190         else
3191                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3192                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3193                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3194                                 osname=news_os
3195                         fi
3196                         $rm -f UU/kernel.what
3197                 elif test -d c:/.; then
3198                         set X $myuname
3199                         osname=os2
3200                         osvers="$5"
3201                 fi
3202         fi
3203         
3204         case "$targetarch" in
3205         '') ;;
3206         *)  hostarch=$osname
3207             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3208             osvers=''
3209             ;;
3210         esac
3211
3212         : Now look for a hint file osname_osvers, unless one has been
3213         : specified already.
3214         case "$hintfile" in
3215         ''|' ')
3216                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3217                 : Also try without trailing minor version numbers.
3218                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3219                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3220                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3221                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3222                 case "$file" in
3223                 '') dflt=none ;;
3224                 *)  case "$osvers" in
3225                         '') dflt=$file
3226                                 ;;
3227                         *)  if $test -f $src/hints/$file.sh ; then
3228                                         dflt=$file
3229                                 elif $test -f $src/hints/$xfile.sh ; then
3230                                         dflt=$xfile
3231                                 elif $test -f $src/hints/$xxfile.sh ; then
3232                                         dflt=$xxfile
3233                                 elif $test -f $src/hints/$xxxfile.sh ; then
3234                                         dflt=$xxxfile
3235                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3236                                         dflt=$xxxxfile
3237                                 elif $test -f "$src/hints/${osname}.sh" ; then
3238                                         dflt="${osname}"
3239                                 else
3240                                         dflt=none
3241                                 fi
3242                                 ;;
3243                         esac
3244                         ;;
3245                 esac
3246                 if $test -f Policy.sh ; then
3247                         case "$dflt" in
3248                         *Policy*) ;;
3249                         none) dflt="Policy" ;;
3250                         *) dflt="Policy $dflt" ;;
3251                         esac
3252                 fi
3253                 ;;
3254         *)
3255                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3256                 ;;
3257         esac
3258
3259         if $test -f Policy.sh ; then
3260                 $cat <<EOM
3261
3262 There's also a Policy hint file available, which should make the
3263 site-specific (policy) questions easier to answer.
3264 EOM
3265
3266         fi
3267
3268         $cat <<EOM
3269
3270 You may give one or more space-separated answers, or "none" if appropriate.
3271 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3272 is a good thing.  DO NOT give a wrong version or a wrong OS.
3273
3274 EOM
3275
3276         rp="Which of these apply, if any?"
3277         . UU/myread
3278         tans=$ans
3279         for file in $tans; do
3280                 if $test X$file = XPolicy -a -f Policy.sh; then
3281                         . Policy.sh
3282                         $cat Policy.sh >> UU/config.sh
3283                 elif $test -f $src/hints/$file.sh; then
3284                         . $src/hints/$file.sh
3285                         $cat $src/hints/$file.sh >> UU/config.sh
3286                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3287                         : nothing
3288                 else
3289                         : Give one chance to correct a possible typo.
3290                         echo "$file.sh does not exist"
3291                         dflt=$file
3292                         rp="hint to use instead?"
3293                         . UU/myread
3294                         for file in $ans; do
3295                                 if $test -f "$src/hints/$file.sh"; then
3296                                         . $src/hints/$file.sh
3297                                         $cat $src/hints/$file.sh >> UU/config.sh
3298                                 elif $test X$ans = X -o X$ans = Xnone ; then
3299                                         : nothing
3300                                 else
3301                                         echo "$file.sh does not exist -- ignored."
3302                                 fi
3303                         done
3304                 fi
3305         done
3306
3307         hint=recommended
3308         : Remember our hint file for later.
3309         if $test -f "$src/hints/$file.sh" ; then
3310                 hintfile="$file"
3311         else
3312                 hintfile=''
3313         fi
3314 fi
3315 cd UU
3316 ;;
3317 *)
3318         echo " "
3319         echo "Fetching default answers from $config_sh..." >&4
3320         tmp_n="$n"
3321         tmp_c="$c"
3322         cd ..
3323         cp $config_sh config.sh 2>/dev/null
3324         chmod +w config.sh
3325         . ./config.sh
3326         cd UU
3327         cp ../config.sh .
3328         n="$tmp_n"
3329         c="$tmp_c"
3330         hint=previous
3331         ;;
3332 esac
3333 test "$override" && . ./optdef.sh
3334
3335 : Restore computed paths
3336 for file in $loclist $trylist; do
3337         eval $file="\$_$file"
3338 done
3339
3340 cat << EOM
3341
3342 Configure uses the operating system name and version to set some defaults.
3343 The default value is probably right if the name rings a bell. Otherwise,
3344 since spelling matters for me, either accept the default or answer "none"
3345 to leave it blank.
3346
3347 EOM
3348 case "$osname" in
3349         ''|' ')
3350                 case "$hintfile" in
3351                 ''|' '|none) dflt=none ;;
3352                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3353                 esac
3354                 ;;
3355         *) dflt="$osname" ;;
3356 esac
3357 rp="Operating system name?"
3358 . ./myread
3359 case "$ans" in
3360 none)  osname='' ;;
3361 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3362 esac
3363 echo " "
3364 case "$osvers" in
3365         ''|' ')
3366                 case "$hintfile" in
3367                 ''|' '|none) dflt=none ;;
3368                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3369                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3370                         case "$dflt" in
3371                         ''|' ') dflt=none ;;
3372                         esac
3373                         ;;
3374                 esac
3375                 ;;
3376         *) dflt="$osvers" ;;
3377 esac
3378 rp="Operating system version?"
3379 . ./myread
3380 case "$ans" in
3381 none)  osvers='' ;;
3382 *) osvers="$ans" ;;
3383 esac
3384
3385
3386 . ./posthint.sh
3387
3388 : who configured the system
3389 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3390 cf_by=`(logname) 2>/dev/null`
3391 case "$cf_by" in
3392 "")
3393         cf_by=`(whoami) 2>/dev/null`
3394         case "$cf_by" in
3395         "") cf_by=unknown ;;
3396         esac ;;
3397 esac
3398
3399 : set up the script used to warn in case of inconsistency
3400 cat <<EOS >whoa
3401 $startsh
3402 EOS
3403 cat <<'EOSC' >>whoa
3404 dflt=y
3405 echo " "
3406 echo "*** WHOA THERE!!! ***" >&4
3407 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3408 rp="    Keep the $hint value?"
3409 . ./myread
3410 case "$ans" in
3411 y) td=$was; tu=$was;;
3412 esac
3413 EOSC
3414
3415 : function used to set $1 to $val
3416 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3417 case "$val$was" in
3418 $define$undef) . ./whoa; eval "$var=\$td";;
3419 $undef$define) . ./whoa; eval "$var=\$tu";;
3420 *) eval "$var=$val";;
3421 esac'
3422
3423 case "$usethreads" in
3424 $define|true|[yY]*)     dflt='y';;
3425 *)     # Catch case where user specified ithreads or 5005threads but
3426        # forgot -Dusethreads (A.D. 4/2002)
3427        case "$useithreads$use5005threads" in
3428        *$define*)      dflt='y' ;;
3429        *)      dflt='n';;
3430        esac
3431        ;;
3432 esac
3433 cat <<EOM
3434
3435 Perl can be built to take advantage of threads on some systems.
3436 To do so, Configure can be run with -Dusethreads.
3437
3438 Note that Perl built with threading support runs slightly slower
3439 and uses more memory than plain Perl. The current implementation
3440 is believed to be stable, but it is fairly new, and so should be
3441 treated with caution.
3442
3443 If this doesn't make any sense to you, just accept the default '$dflt'.
3444 EOM
3445 rp='Build a threading Perl?'
3446 . ./myread
3447 case "$ans" in
3448 y|Y)    val="$define" ;;
3449 *)      val="$undef" ;;
3450 esac
3451 set usethreads
3452 eval $setvar
3453
3454 case "$usethreads" in
3455 $define)
3456         $cat <<EOM
3457
3458 Since release 5.6, Perl has had two different threading implementations,
3459 the newer interpreter-based version (ithreads) with one interpreter per
3460 thread, and the older 5.005 version (5005threads).
3461 The 5005threads version is effectively unmaintained and will probably be
3462 removed in Perl 5.10, so there should be no need to build a Perl using it
3463 unless needed for backwards compatibility with some existing 5.005threads
3464 code.
3465
3466 EOM
3467         : Default to ithreads unless overridden on command line or with
3468         : old config.sh
3469         dflt='y'
3470         case "$use5005threads" in
3471                 $define|true|[yY]*) dflt='n';;
3472         esac
3473         case "$useithreads" in
3474                 $undef|false|[nN]*) dflt='n';;
3475         esac
3476         rp='Use the newer interpreter-based ithreads?'
3477         . ./myread
3478         case "$ans" in
3479         y|Y)    val="$define" ;;
3480         *)      val="$undef" ;;
3481         esac
3482         set useithreads
3483         eval $setvar
3484         : Now set use5005threads to the opposite value.
3485         case "$useithreads" in
3486         $define) val="$undef" ;;
3487         *) val="$define" ;;
3488         esac
3489         set use5005threads
3490         eval $setvar
3491         ;;
3492 *)
3493         useithreads="$undef"
3494         use5005threads="$undef"
3495         ;;
3496 esac
3497
3498 case "$useithreads$use5005threads" in
3499 "$define$define")
3500         $cat >&4 <<EOM
3501
3502 You cannot have both the ithreads and the 5.005 threads enabled
3503 at the same time.  Disabling the 5.005 threads since they are
3504 much less stable than the ithreads.
3505
3506 EOM
3507         use5005threads="$undef"
3508         ;;
3509 esac
3510
3511 case "$d_oldpthreads" in
3512 '')     : Configure tests would be welcome here.  For now, assume undef.
3513         val="$undef" ;;
3514 *)      val="$d_oldpthreads" ;;
3515 esac
3516 set d_oldpthreads
3517 eval $setvar
3518
3519
3520 case "$usethreads" in
3521 "$define"|true|[yY]*)
3522 : Look for a hint-file generated 'call-back-unit'.  If the
3523 : user has specified that a threading perl is to be built,
3524 : we may need to set or change some other defaults.
3525         if $test -f usethreads.cbu; then
3526                 echo "Your platform has some specific hints for threaded builds, using them..."
3527                 . ./usethreads.cbu
3528         else
3529                 $cat <<EOM
3530 (Your platform doesn't have any specific hints for threaded builds.
3531  Assuming POSIX threads, then.)
3532 EOM
3533         fi
3534         ;;
3535 esac
3536
3537 cat <<EOM
3538
3539 Perl can be built so that multiple Perl interpreters can coexist
3540 within the same Perl executable.
3541 EOM
3542
3543 case "$useithreads" in
3544 $define)
3545         cat <<EOM
3546 This multiple interpreter support is required for interpreter-based threads.
3547 EOM
3548         val="$define"
3549         ;;
3550 *)      case "$usemultiplicity" in
3551         $define|true|[yY]*)     dflt='y';;
3552         *) dflt='n';;
3553         esac
3554         echo " "
3555         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3556         rp='Build Perl for multiplicity?'
3557         . ./myread
3558         case "$ans" in
3559         y|Y)    val="$define" ;;
3560         *)      val="$undef" ;;
3561         esac
3562         ;;
3563 esac
3564 set usemultiplicity
3565 eval $setvar
3566
3567
3568 case "$usemorebits" in
3569 "$define"|true|[yY]*)
3570         use64bitint="$define"
3571         uselongdouble="$define"
3572         usemorebits="$define"
3573         ;;
3574 *)      usemorebits="$undef"
3575         ;;
3576 esac
3577
3578 : make some quick guesses about what we are up against
3579 echo " "
3580 $echo $n "Hmm...  $c"
3581 echo exit 1 >bsd
3582 echo exit 1 >usg
3583 echo exit 1 >v7
3584 echo exit 1 >osf1
3585 echo exit 1 >eunice
3586 echo exit 1 >xenix
3587 echo exit 1 >venix
3588 echo exit 1 >os2
3589 d_bsd="$undef"
3590 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3591 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3592 then
3593         echo "Looks kind of like an OSF/1 system, but we'll see..."
3594         echo exit 0 >osf1
3595 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3596         xxx=`./loc addbib blurfl $pth`
3597         if $test -f $xxx; then
3598         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3599                 echo exit 0 >bsd
3600                 echo exit 0 >usg
3601         else
3602                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3603                         echo "Looks kind of like an extended USG system, but we'll see..."
3604                 else
3605                         echo "Looks kind of like a USG system, but we'll see..."
3606                 fi
3607                 echo exit 0 >usg
3608         fi
3609 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3610         echo "Looks kind of like a BSD system, but we'll see..."
3611         d_bsd="$define"
3612         echo exit 0 >bsd
3613 else
3614         echo "Looks kind of like a Version 7 system, but we'll see..."
3615         echo exit 0 >v7
3616 fi
3617 case "$eunicefix" in
3618 *unixtovms*)
3619         $cat <<'EOI'
3620 There is, however, a strange, musty smell in the air that reminds me of
3621 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3622 EOI
3623         echo exit 0 >eunice
3624         d_eunice="$define"
3625 : it so happens the Eunice I know will not run shell scripts in Unix format
3626         ;;
3627 *)
3628         echo " "
3629         echo "Congratulations.  You aren't running Eunice."
3630         d_eunice="$undef"
3631         ;;
3632 esac
3633 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3634 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3635 : semicolon as a patch separator
3636 case "$p_" in
3637 :) ;;
3638 *)
3639         $cat <<'EOI'
3640 I have the feeling something is not exactly right, however...don't tell me...
3641 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3642 (Or you may be running DOS with DJGPP.)
3643 EOI
3644         echo exit 0 >os2
3645         ;;
3646 esac
3647 if test -f /xenix; then
3648         echo "Actually, this looks more like a XENIX system..."
3649         echo exit 0 >xenix
3650         d_xenix="$define"
3651 else
3652         echo " "
3653         echo "It's not Xenix..."
3654         d_xenix="$undef"
3655 fi
3656 chmod +x xenix
3657 $eunicefix xenix
3658 if test -f /venix; then
3659         echo "Actually, this looks more like a VENIX system..."
3660         echo exit 0 >venix
3661 else
3662         echo " "
3663         if ./xenix; then
3664                 : null
3665         else
3666                 echo "Nor is it Venix..."
3667         fi
3668 fi
3669 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3670 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3671 $rm -f foo
3672
3673 case "$cc" in
3674 '') dflt=cc;;
3675 *) dflt="$cc";;
3676 esac
3677 rp="Use which C compiler?"
3678 . ./myread
3679 cc="$ans"
3680
3681 : See if they have not cc but they do have gcc
3682 . ./trygcc
3683 : Look for a hint-file generated 'call-back-unit'.  Now that the
3684 : user has specified the compiler, we may need to set or change some
3685 : other defaults.
3686 if $test -f cc.cbu; then
3687     . ./cc.cbu
3688 fi
3689 . ./checkcc
3690
3691 echo " "
3692 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3693 $cat >try.c <<EOM
3694 #include <stdio.h>
3695 int main() {
3696 #ifdef __GNUC__
3697 #ifdef __VERSION__
3698         printf("%s\n", __VERSION__);
3699 #else
3700         printf("%s\n", "1");
3701 #endif
3702 #endif
3703         exit(0);
3704 }
3705 EOM
3706 if $cc -o try $ccflags $ldflags try.c; then
3707         gccversion=`$run ./try`
3708         case "$gccversion" in
3709         '') echo "You are not using GNU cc." ;;
3710         *)  echo "You are using GNU cc $gccversion."
3711             ccname=gcc  
3712             ;;
3713         esac
3714 else
3715         echo " "
3716         echo "*** WHOA THERE!!! ***" >&4
3717         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3718         case "$knowitall" in
3719         '')
3720         echo "    You'd better start hunting for one and let me know about it." >&4
3721                 exit 1
3722                 ;;
3723         esac
3724 fi
3725 $rm -f try try.*
3726 case "$gccversion" in
3727 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3728 esac
3729 case "$gccversion" in
3730 '') gccosandvers='' ;;
3731 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3732    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3733    gccshortvers=''
3734    case "$gccosandvers" in
3735    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3736    $osname$osvers) ;; # looking good
3737    $osname*) cat <<EOM >&4
3738
3739 *** WHOA THERE!!! ***
3740
3741     Your gcc has not been compiled for the exact release of
3742     your operating system ($gccosandvers versus $osname$osvers).
3743
3744     In general it is a good idea to keep gcc synchronized with
3745     the operating system because otherwise serious problems
3746     may ensue when trying to compile software, like Perl.
3747
3748     I'm trying to be optimistic here, though, and will continue.
3749     If later during the configuration and build icky compilation
3750     problems appear (headerfile conflicts being the most common
3751     manifestation), I suggest reinstalling the gcc to match
3752     your operating system release.
3753
3754 EOM
3755       ;;
3756    *) gccosandvers='' ;; # failed to parse, better be silent
3757    esac
3758    ;;
3759 esac
3760 case "$ccname" in
3761 '') ccname="$cc" ;;
3762 esac
3763
3764
3765 : decide how portable to be.  Allow command line overrides.
3766 case "$d_portable" in
3767 "$undef") ;;
3768 *)      d_portable="$define" ;;
3769 esac
3770
3771 : set up shell script to do ~ expansion
3772 cat >filexp <<EOSS
3773 $startsh
3774 : expand filename
3775 case "\$1" in
3776  ~/*|~)
3777         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3778         ;;
3779  ~*)
3780         if $test -f /bin/csh; then
3781                 /bin/csh -f -c "glob \$1"
3782                 failed=\$?
3783                 echo ""
3784                 exit \$failed
3785         else
3786                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3787                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3788                 if $test ! -d "\$dir"; then
3789                         me=\`basename \$0\`
3790                         echo "\$me: can't locate home directory for: \$name" >&2
3791                         exit 1
3792                 fi
3793                 case "\$1" in
3794                 */*)
3795                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3796                         ;;
3797                 *)
3798                         echo \$dir
3799                         ;;
3800                 esac
3801         fi
3802         ;;
3803 *)
3804         echo \$1
3805         ;;
3806 esac
3807 EOSS
3808 chmod +x filexp
3809 $eunicefix filexp
3810
3811 : now set up to get a file name
3812 cat <<EOS >getfile
3813 $startsh
3814 EOS
3815 cat <<'EOSC' >>getfile
3816 tilde=''
3817 fullpath=''
3818 already=''
3819 skip=''
3820 none_ok=''
3821 exp_file=''
3822 nopath_ok=''
3823 orig_rp="$rp"
3824 orig_dflt="$dflt"
3825 case "$gfpth" in
3826 '') gfpth='.' ;;
3827 esac
3828
3829 case "$fn" in
3830 *\(*)
3831         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3832         fn=`echo $fn | sed 's/(.*)//'`
3833         ;;
3834 esac
3835
3836 case "$fn" in
3837 *:*)
3838         loc_file=`expr $fn : '.*:\(.*\)'`
3839         fn=`expr $fn : '\(.*\):.*'`
3840         ;;
3841 esac
3842
3843 case "$fn" in
3844 *~*) tilde=true;;
3845 esac
3846 case "$fn" in
3847 */*) fullpath=true;;
3848 esac
3849 case "$fn" in
3850 *+*) skip=true;;
3851 esac
3852 case "$fn" in
3853 *n*) none_ok=true;;
3854 esac
3855 case "$fn" in
3856 *e*) exp_file=true;;
3857 esac
3858 case "$fn" in
3859 *p*) nopath_ok=true;;
3860 esac
3861
3862 case "$fn" in
3863 *f*) type='File';;
3864 *d*) type='Directory';;
3865 *l*) type='Locate';;
3866 esac
3867
3868 what="$type"
3869 case "$what" in
3870 Locate) what='File';;
3871 esac
3872
3873 case "$exp_file" in
3874 '')
3875         case "$d_portable" in
3876         "$define") ;;
3877         *) exp_file=true;;
3878         esac
3879         ;;
3880 esac
3881
3882 cd ..
3883 while test "$type"; do
3884         redo=''
3885         rp="$orig_rp"
3886         dflt="$orig_dflt"
3887         case "$tilde" in
3888         true) rp="$rp (~name ok)";;
3889         esac
3890         . UU/myread
3891         if test -f UU/getfile.ok && \
3892                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3893         then
3894                 value="$ans"
3895                 ansexp="$ans"
3896                 break
3897         fi
3898         case "$ans" in
3899         none)
3900                 value=''
3901                 ansexp=''
3902                 case "$none_ok" in
3903                 true) type='';;
3904                 esac
3905                 ;;
3906         *)
3907                 case "$tilde" in
3908                 '') value="$ans"
3909                         ansexp="$ans";;
3910                 *)
3911                         value=`UU/filexp $ans`
3912                         case $? in
3913                         0)
3914                                 if test "$ans" != "$value"; then
3915                                         echo "(That expands to $value on this system.)"
3916                                 fi
3917                                 ;;
3918                         *) value="$ans";;
3919                         esac
3920                         ansexp="$value"
3921                         case "$exp_file" in
3922                         '') value="$ans";;
3923                         esac
3924                         ;;
3925                 esac
3926                 case "$fullpath" in
3927                 true)
3928                         case "$ansexp" in
3929                         /*) value="$ansexp" ;;
3930                         [a-zA-Z]:/*) value="$ansexp" ;;
3931                         *)
3932                                 redo=true
3933                                 case "$already" in
3934                                 true)
3935                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3936                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3937                                         ;;
3938                                 *)
3939                                 echo "Please give a full path name, starting with slash." >&4
3940                                         case "$tilde" in
3941                                         true)
3942                                 echo "Note that using ~name is ok provided it expands well." >&4
3943                                                 already=true
3944                                                 ;;
3945                                         esac
3946                                 esac
3947                                 ;;
3948                         esac
3949                         ;;
3950                 esac
3951                 case "$redo" in
3952                 '')
3953                         case "$type" in
3954                         File)
3955                                 for fp in $gfpth; do
3956                                         if test "X$fp" = X.; then
3957                                             pf="$ansexp"
3958                                         else    
3959                                             pf="$fp/$ansexp"
3960                                         fi
3961                                         if test -f "$pf"; then
3962                                                 type=''
3963                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3964                                         then
3965                                                 echo "($value is not a plain file, but that's ok.)"
3966                                                 type=''
3967                                         fi
3968                                         if test X"$type" = X; then
3969                                             value="$pf"
3970                                             break
3971                                         fi
3972                                 done
3973                                 ;;
3974                         Directory)
3975                                 for fp in $gfpth; do
3976                                         if test "X$fp" = X.; then
3977                                             dir="$ans"
3978                                             direxp="$ansexp"
3979                                         else    
3980                                             dir="$fp/$ansexp"
3981                                             direxp="$fp/$ansexp"
3982                                         fi
3983                                         if test -d "$direxp"; then
3984                                                 type=''
3985                                                 value="$dir"
3986                                                 break
3987                                         fi
3988                                 done
3989                                 ;;
3990                         Locate)
3991                                 if test -d "$ansexp"; then
3992                                         echo "(Looking for $loc_file in directory $value.)"
3993                                         value="$value/$loc_file"
3994                                         ansexp="$ansexp/$loc_file"
3995                                 fi
3996                                 if test -f "$ansexp"; then
3997                                         type=''
3998                                 fi
3999                                 case "$nopath_ok" in
4000                                 true)   case "$value" in
4001                                         */*) ;;
4002                                         *)      echo "Assuming $value will be in people's path."
4003                                                 type=''
4004                                                 ;;
4005                                         esac
4006                                         ;;
4007                                 esac
4008                                 ;;
4009                         esac
4010
4011                         case "$skip" in
4012                         true) type='';
4013                         esac
4014
4015                         case "$type" in
4016                         '') ;;
4017                         *)
4018                                 if test "$fastread" = yes; then
4019                                         dflt=y
4020                                 else
4021                                         dflt=n
4022                                 fi
4023                                 rp="$what $value doesn't exist.  Use that name anyway?"
4024                                 . UU/myread
4025                                 dflt=''
4026                                 case "$ans" in
4027                                 y*) type='';;
4028                                 *) echo " ";;
4029                                 esac
4030                                 ;;
4031                         esac
4032                         ;;
4033                 esac
4034                 ;;
4035         esac
4036 done
4037 cd UU
4038 ans="$value"
4039 rp="$orig_rp"
4040 dflt="$orig_dflt"
4041 rm -f getfile.ok
4042 test "X$gfpthkeep" != Xy && gfpth=""
4043 EOSC
4044
4045 : What should the include directory be ?
4046 echo " "
4047 $echo $n "Hmm...  $c"
4048 dflt='/usr/include'
4049 incpath=''
4050 mips_type=''
4051 if $test -f /bin/mips && /bin/mips; then
4052         echo "Looks like a MIPS system..."
4053         $cat >usr.c <<'EOCP'
4054 #ifdef SYSTYPE_BSD43
4055 /bsd43
4056 #endif
4057 EOCP
4058         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4059                 dflt='/bsd43/usr/include'
4060                 incpath='/bsd43'
4061                 mips_type='BSD 4.3'
4062         else
4063                 mips_type='System V'
4064         fi
4065         $rm -f usr.c usr.out
4066         echo "and you're compiling with the $mips_type compiler and libraries."
4067         xxx_prompt=y
4068         echo "exit 0" >mips
4069 else
4070         echo "Doesn't look like a MIPS system."
4071         xxx_prompt=n
4072         echo "exit 1" >mips
4073 fi
4074 chmod +x mips
4075 $eunicefix mips
4076 case "$usrinc" in
4077 '') ;;
4078 *) dflt="$usrinc";;
4079 esac
4080 case "$xxx_prompt" in
4081 y)      fn=d/
4082         echo " "
4083         rp='Where are the include files you want to use?'
4084         . ./getfile
4085         usrinc="$ans"
4086         ;;
4087 *)      usrinc="$dflt"
4088         ;;
4089 esac
4090
4091 : see how we invoke the C preprocessor
4092 echo " "
4093 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4094 cat <<'EOT' >testcpp.c
4095 #define ABC abc
4096 #define XYZ xyz
4097 ABC.XYZ
4098 EOT
4099 cd ..
4100 if test ! -f cppstdin; then
4101         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4102                 # AIX cc -E doesn't show the absolute headerfile
4103                 # locations but we'll cheat by using the -M flag.
4104                 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
4105         else
4106                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4107         fi
4108 else
4109         echo "Keeping your $hint cppstdin wrapper."
4110 fi
4111 chmod 755 cppstdin
4112 wrapper=`pwd`/cppstdin
4113 ok='false'
4114 cd UU
4115
4116 if $test "X$cppstdin" != "X" && \
4117         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4118         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4119 then
4120         echo "You used to use $cppstdin $cppminus so we'll use that again."
4121         case "$cpprun" in
4122         '') echo "But let's see if we can live without a wrapper..." ;;
4123         *)
4124                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4125                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4126                 then
4127                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4128                         ok='true'
4129                 else
4130                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4131                 fi
4132                 ;;
4133         esac
4134 else
4135         case "$cppstdin" in
4136         '') ;;
4137         *)
4138                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4139                 ;;
4140         esac
4141 fi
4142
4143 if $ok; then
4144         : nothing
4145 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4146         $cc -E <testcpp.c >testcpp.out 2>&1; \
4147         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4148         echo "Yup, it does."
4149         x_cpp="$cc -E"
4150         x_minus='';
4151 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4152         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4153         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4154         echo "Yup, it does."
4155         x_cpp="$cc -E"
4156         x_minus='-';
4157 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4158         $cc -P <testcpp.c >testcpp.out 2>&1; \
4159         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4160         echo "Yipee, that works!"
4161         x_cpp="$cc -P"
4162         x_minus='';
4163 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4164         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4165         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4166         echo "At long last!"
4167         x_cpp="$cc -P"
4168         x_minus='-';
4169 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4170         $cpp <testcpp.c >testcpp.out 2>&1; \
4171         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4172         echo "It works!"
4173         x_cpp="$cpp"
4174         x_minus='';
4175 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4176         $cpp - <testcpp.c >testcpp.out 2>&1; \
4177         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4178         echo "Hooray, it works!  I was beginning to wonder."
4179         x_cpp="$cpp"
4180         x_minus='-';
4181 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4182         $wrapper <testcpp.c >testcpp.out 2>&1; \
4183         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4184         x_cpp="$wrapper"
4185         x_minus=''
4186         echo "Eureka!"
4187 else
4188         dflt=''
4189         rp="No dice.  I can't find a C preprocessor.  Name one:"
4190         . ./myread
4191         x_cpp="$ans"
4192         x_minus=''
4193         $x_cpp <testcpp.c >testcpp.out 2>&1
4194         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4195                 echo "OK, that will do." >&4
4196         else
4197 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4198                 exit 1
4199         fi
4200 fi
4201
4202 case "$ok" in
4203 false)
4204         cppstdin="$x_cpp"
4205         cppminus="$x_minus"
4206         cpprun="$x_cpp"
4207         cpplast="$x_minus"
4208         set X $x_cpp
4209         shift
4210         case "$1" in
4211         "$cpp")
4212                 echo "Perhaps can we force $cc -E using a wrapper..."
4213                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4214                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4215                 then
4216                         echo "Yup, we can."
4217                         cppstdin="$wrapper"
4218                         cppminus='';
4219                 else
4220                         echo "Nope, we'll have to live without it..."
4221                 fi
4222                 ;;
4223         esac
4224         case "$cpprun" in
4225         "$wrapper")
4226                 cpprun=''
4227                 cpplast=''
4228                 ;;
4229         esac
4230         ;;
4231 esac
4232
4233 case "$cppstdin" in
4234 "$wrapper"|'cppstdin') ;;
4235 *) $rm -f $wrapper;;
4236 esac
4237 $rm -f testcpp.c testcpp.out
4238
4239 : Set private lib path
4240 case "$plibpth" in
4241 '') if ./mips; then
4242                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4243         fi;;
4244 esac
4245 case "$libpth" in
4246 ' ') dlist='';;
4247 '') dlist="$loclibpth $plibpth $glibpth";;
4248 *) dlist="$libpth";;
4249 esac
4250
4251 : Now check and see which directories actually exist, avoiding duplicates
4252 libpth=''
4253 for xxx in $dlist
4254 do
4255     if $test -d $xxx; then
4256                 case " $libpth " in
4257                 *" $xxx "*) ;;
4258                 *) libpth="$libpth $xxx";;
4259                 esac
4260     fi
4261 done
4262 $cat <<'EOM'
4263
4264 Some systems have incompatible or broken versions of libraries.  Among
4265 the directories listed in the question below, please remove any you
4266 know not to be holding relevant libraries, and add any that are needed.
4267 Say "none" for none.
4268
4269 EOM
4270 case "$libpth" in
4271 '') dflt='none';;
4272 *)
4273         set X $libpth
4274         shift
4275         dflt=${1+"$@"}
4276         ;;
4277 esac
4278 rp="Directories to use for library searches?"
4279 . ./myread
4280 case "$ans" in
4281 none) libpth=' ';;
4282 *) libpth="$ans";;
4283 esac
4284
4285 : compute shared library extension
4286 case "$so" in
4287 '')
4288         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4289                 dflt='sl'
4290         else
4291                 dflt='so'
4292         fi
4293         ;;
4294 *) dflt="$so";;
4295 esac
4296 $cat <<EOM
4297
4298 On some systems, shared libraries may be available.  Answer 'none' if
4299 you want to suppress searching of shared libraries for the remainder
4300 of this configuration.
4301
4302 EOM
4303 rp='What is the file extension used for shared libraries?'
4304 . ./myread
4305 so="$ans"
4306
4307 : Define several unixisms.
4308 : Hints files or command line option can be used to override them.
4309 : The convoluted testing is in case hints files set either the old
4310 : or the new name.
4311 case "$_exe" in
4312 '')     case "$exe_ext" in
4313         '')     ;;
4314         *)      _exe="$exe_ext" ;;
4315         esac
4316         ;;
4317 esac
4318 case "$_a" in
4319 '')     case "$lib_ext" in
4320     '') _a='.a';;
4321         *)      _a="$lib_ext" ;;
4322         esac
4323         ;;
4324 esac
4325 case "$_o" in
4326 '') case "$obj_ext" in
4327         '')     _o='.o';;
4328         *)      _o="$obj_ext";;
4329         esac
4330         ;;
4331 esac
4332 case "$p_" in
4333 '') case "$path_sep" in
4334         '')     p_=':';;
4335         *)      p_="$path_sep";;
4336         esac
4337         ;;
4338 esac
4339 exe_ext=$_exe
4340 lib_ext=$_a
4341 obj_ext=$_o
4342 path_sep=$p_
4343
4344 : Which makefile gets called first.  This is used by make depend.
4345 case "$firstmakefile" in
4346 '') firstmakefile='makefile';;
4347 esac
4348
4349 case "$usesocks" in
4350 $define|true|[yY]*)     dflt='y';;
4351 *) dflt='n';;
4352 esac
4353 cat <<EOM
4354
4355 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4356 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4357 to use the PerlIO abstraction layer, this will be implicitly selected.
4358
4359 If this doesn't make any sense to you, just accept the default '$dflt'.
4360 EOM
4361 rp='Build Perl for SOCKS?'
4362 . ./myread
4363 case "$ans" in
4364 y|Y)    val="$define" ;;     
4365 *)      val="$undef" ;;
4366 esac
4367 set usesocks
4368 eval $setvar
4369
4370 case "$usesocks" in
4371 $define|true|[yY]*) useperlio="$define";;
4372 esac
4373
4374 : Looking for optional libraries
4375 echo " "
4376 echo "Checking for optional libraries..." >&4
4377 case "$libs" in
4378 ' '|'') dflt='';;
4379 *) dflt="$libs";;
4380 esac
4381 case "$libswanted" in
4382 '') libswanted='c_s';;
4383 esac
4384 case "$usesocks" in
4385 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4386 esac
4387 libsfound=''
4388 libsfiles=''
4389 libsdirs=''
4390 libspath=''
4391 for thisdir in $libpth $xlibpth; do
4392   test -d $thisdir && libspath="$libspath $thisdir"
4393 done
4394 for thislib in $libswanted; do
4395         for thisdir in $libspath; do
4396             xxx=''
4397             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4398                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4399                 $test -f "$xxx" && eval $libscheck
4400                 $test -f "$xxx" && libstyle=shared
4401             fi
4402             if test ! -f "$xxx"; then
4403                 xxx=$thisdir/lib$thislib.$so
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$_a
4409                 $test -f "$xxx" && eval $libscheck
4410                 $test -f "$xxx" && libstyle=static
4411             fi
4412             if test ! -f "$xxx"; then
4413                 xxx=$thisdir/$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/lib${thislib}_s$_a
4419                 $test -f "$xxx" && eval $libscheck
4420                 $test -f "$xxx" && libstyle=static
4421                 $test -f "$xxx" && thislib=${thislib}_s
4422             fi
4423             if test ! -f "$xxx"; then
4424                 xxx=$thisdir/Slib$thislib$_a
4425                 $test -f "$xxx" && eval $libscheck
4426                 $test -f "$xxx" && libstyle=static
4427             fi
4428             if $test -f "$xxx"; then
4429                 case "$libstyle" in
4430                 shared) echo "Found -l$thislib (shared)." ;;
4431                 static) echo "Found -l$thislib." ;;
4432                 *)      echo "Found -l$thislib ($libstyle)." ;;
4433                 esac
4434                 case " $dflt " in
4435                 *"-l$thislib "*);;
4436                 *) dflt="$dflt -l$thislib"
4437                    libsfound="$libsfound $xxx"
4438                    yyy=`basename $xxx`
4439                    libsfiles="$libsfiles $yyy"
4440                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4441                    case " $libsdirs " in
4442                    *" $yyy "*) ;;
4443                    *) libsdirs="$libsdirs $yyy" ;;
4444                    esac
4445                    ;;
4446                 esac
4447                 break
4448             fi  
4449         done
4450         if $test ! -f "$xxx"; then
4451             echo "No -l$thislib."
4452         fi
4453 done
4454 set X $dflt
4455 shift
4456 dflt="$*"
4457 case "$libs" in
4458 '') dflt="$dflt";;
4459 *) dflt="$libs";;
4460 esac
4461 case "$dflt" in
4462 ' '|'') dflt='none';;
4463 esac
4464
4465 $cat <<EOM
4466
4467 In order to compile $package on your machine, a number of libraries
4468 are usually needed.  Include any other special libraries here as well.
4469 Say "none" for none.  The default list is almost always right.
4470 EOM
4471
4472 echo " "
4473 rp="What libraries to use?"
4474 . ./myread
4475 case "$ans" in
4476 none) libs=' ';;
4477 *) libs="$ans";;
4478 esac
4479
4480 : determine optimization, if desired, or use for debug flag also
4481 case "$optimize" in
4482 ' '|$undef) dflt='none';;
4483 '') dflt='-O';;
4484 *) dflt="$optimize";;
4485 esac
4486 $cat <<EOH
4487
4488 By default, $package compiles with the -O flag to use the optimizer.
4489 Alternately, you might want to use the symbolic debugger, which uses
4490 the -g flag (on traditional Unix systems).  Either flag can be
4491 specified here.  To use neither flag, specify the word "none".
4492
4493 EOH
4494 rp="What optimizer/debugger flag should be used?"
4495 . ./myread
4496 optimize="$ans"
4497 case "$optimize" in
4498 'none') optimize=" ";;
4499 esac
4500
4501 dflt=''
4502 : We will not override a previous value, but we might want to
4503 : augment a hint file
4504 case "$hint" in
4505 default|recommended)
4506         case "$gccversion" in
4507         1*) dflt='-fpcc-struct-return' ;;
4508         esac
4509         case "$optimize" in
4510         *-g*) dflt="$dflt -DDEBUGGING";;
4511         esac
4512         case "$gccversion" in
4513         2*) if test -d /etc/conf/kconfig.d &&
4514                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4515                 then
4516                         dflt="$dflt -posix"
4517                 fi
4518                 ;;
4519         esac
4520         case "$gccversion" in
4521         1*) ;;
4522         2.[0-8]*) ;;
4523         ?*)     echo " "
4524                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4525                 echo 'int main(void) { return 0; }' > gcctest.c
4526                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4527                         echo "Yes, it does." 2>&1
4528                         case "$ccflags" in
4529                         *strict-aliasing*) 
4530                                 echo "Leaving current flags $ccflags alone." 2>&1
4531                                 ;;
4532                         *) dflt="$dflt -fno-strict-aliasing" ;;
4533                         esac
4534                 else
4535                         echo "Nope, it doesn't, but that's ok." 2>&1
4536                 fi
4537                 ;;
4538         esac
4539         ;;
4540 esac
4541
4542 case "$mips_type" in
4543 *BSD*|'') inclwanted="$locincpth $usrinc";;
4544 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4545 esac
4546 for thisincl in $inclwanted; do
4547         if $test -d $thisincl; then
4548                 if $test x$thisincl != x$usrinc; then
4549                         case "$dflt" in
4550                         *" -I$thisincl "*);;
4551                         *) dflt="$dflt -I$thisincl ";;
4552                         esac
4553                 fi
4554         fi
4555 done
4556
4557 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4558         xxx=true;
4559 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4560         xxx=true;
4561 else
4562         xxx=false;
4563 fi;
4564 if $xxx; then
4565         case "$dflt" in
4566         *$2*);;
4567         *) dflt="$dflt -D$2";;
4568         esac;
4569 fi'
4570
4571 set signal.h LANGUAGE_C; eval $inctest
4572
4573 case "$usesocks" in
4574 $define)
4575         ccflags="$ccflags -DSOCKS"
4576         ;;
4577 esac
4578
4579 case "$hint" in
4580 default|recommended) dflt="$ccflags $dflt" ;;
4581 *) dflt="$ccflags";;
4582 esac
4583
4584 case "$dflt" in
4585 ''|' ') dflt=none;;
4586 esac
4587
4588 $cat <<EOH
4589
4590 Your C compiler may want other flags.  For this question you should include
4591 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4592 but you should NOT include libraries or ld flags like -lwhatever.  If you
4593 want $package to honor its debug switch, you should include -DDEBUGGING here.
4594 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4595
4596 To use no flags, specify the word "none".
4597
4598 EOH
4599 set X $dflt
4600 shift
4601 dflt=${1+"$@"}
4602 rp="Any additional cc flags?"
4603 . ./myread
4604 case "$ans" in
4605 none) ccflags='';;
4606 *) ccflags="$ans";;
4607 esac
4608
4609 : the following weeds options from ccflags that are of no interest to cpp
4610 case "$cppflags" in
4611 '') cppflags="$ccflags" ;;
4612 *)  cppflags="$cppflags $ccflags" ;;
4613 esac
4614 case "$gccversion" in
4615 1*) cppflags="$cppflags -D__GNUC__"
4616 esac
4617 case "$mips_type" in
4618 '');;
4619 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4620 esac
4621 case "$cppflags" in
4622 '');;
4623 *)
4624         echo " "
4625         echo "Let me guess what the preprocessor flags are..." >&4
4626         set X $cppflags
4627         shift
4628         cppflags=''
4629         $cat >cpp.c <<'EOM'
4630 #define BLURFL foo
4631
4632 BLURFL xx LFRULB
4633 EOM
4634         previous=''
4635         for flag in $*
4636         do
4637                 case "$flag" in
4638                 -*) ftry="$flag";;
4639                 *) ftry="$previous $flag";;
4640                 esac
4641                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4642                         >cpp1.out 2>/dev/null && \
4643                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4644                         >cpp2.out 2>/dev/null && \
4645                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4646                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4647                 then
4648                         cppflags="$cppflags $ftry"
4649                         previous=''
4650                 else
4651                         previous="$flag"
4652                 fi
4653         done
4654         set X $cppflags
4655         shift
4656         cppflags=${1+"$@"}
4657         case "$cppflags" in
4658         *-*)  echo "They appear to be: $cppflags";;
4659         esac
4660         $rm -f cpp.c cpp?.out
4661         ;;
4662 esac
4663
4664 : flags used in final linking phase
4665 case "$ldflags" in
4666 '') if ./venix; then
4667                 dflt='-i -z'
4668         else
4669                 dflt=''
4670         fi
4671         case "$ccflags" in
4672         *-posix*) dflt="$dflt -posix" ;;
4673         esac
4674         ;;
4675 *) dflt="$ldflags";;
4676 esac
4677
4678 : Try to guess additional flags to pick up local libraries.
4679 for thislibdir in $libpth; do
4680         case " $loclibpth " in
4681         *" $thislibdir "*)
4682                 case "$dflt " in 
4683                 *"-L$thislibdir "*) ;;
4684                 *)  dflt="$dflt -L$thislibdir" ;;
4685                 esac
4686                 ;;
4687         esac
4688 done
4689
4690 case "$dflt" in
4691 '') dflt='none' ;;
4692 esac
4693
4694 $cat <<EOH
4695
4696 Your C linker may need flags.  For this question you should
4697 include -L/whatever and any other flags used by the C linker, but you
4698 should NOT include libraries like -lwhatever.
4699
4700 Make sure you include the appropriate -L/path flags if your C linker
4701 does not normally search all of the directories you specified above,
4702 namely
4703         $libpth
4704 To use no flags, specify the word "none".
4705
4706 EOH
4707
4708 rp="Any additional ld flags (NOT including libraries)?"
4709 . ./myread
4710 case "$ans" in
4711 none) ldflags='';;
4712 *) ldflags="$ans";;
4713 esac
4714 rmlist="$rmlist pdp11"
4715
4716 : coherency check
4717 echo " "
4718 echo "Checking your choice of C compiler and flags for coherency..." >&4
4719 $cat > try.c <<'EOF'
4720 #include <stdio.h>
4721 int main() { printf("Ok\n"); exit(0); }
4722 EOF
4723 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4724 shift
4725 $cat >try.msg <<'EOM'
4726 I've tried to compile and run the following simple program:
4727
4728 EOM
4729 $cat try.c >> try.msg
4730
4731 $cat >> try.msg <<EOM
4732
4733 I used the command:
4734
4735         $*
4736         $run ./try
4737
4738 and I got the following output:
4739
4740 EOM
4741 dflt=y
4742 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4743         if $sh -c "$run ./try" >>try.msg 2>&1; then
4744                 xxx=`$run ./try`
4745                 case "$xxx" in
4746                 "Ok") dflt=n ;;
4747                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4748                         case " $libs " in
4749                         *" -lsfio "*)
4750                                 cat >> try.msg <<'EOQS'
4751 If $libs contains -lsfio, and sfio is mis-configured, then it
4752 sometimes (apparently) runs and exits with a 0 status, but with no
4753 output!  It may have to do with sfio's use of _exit vs. exit.
4754
4755 EOQS
4756                                 rp="You have a big problem.  Shall I abort Configure"
4757                                 dflt=y
4758                                 ;;
4759                         esac
4760                         ;;
4761                 esac
4762         else
4763                 echo "The program compiled OK, but exited with status $?." >>try.msg
4764                 rp="You have a problem.  Shall I abort Configure"
4765                 dflt=y
4766         fi
4767 else
4768         echo "I can't compile the test program." >>try.msg
4769         rp="You have a BIG problem.  Shall I abort Configure"
4770         dflt=y
4771 fi
4772 case "$dflt" in
4773 y)
4774         $cat try.msg >&4
4775         case "$knowitall" in
4776         '')
4777                 echo "(The supplied flags or libraries might be incorrect.)"
4778                 ;;
4779         *) dflt=n;;
4780         esac
4781         echo " "
4782         . ./myread
4783         case "$ans" in
4784         n*|N*) ;;
4785         *)      echo "Ok.  Stopping Configure." >&4
4786                 exit 1
4787                 ;;
4788         esac
4789         ;;
4790 n) echo "OK, that should do.";;
4791 esac
4792 $rm -f try try.* core
4793
4794 : define a shorthand compile call
4795 compile='
4796 mc_file=$1;
4797 shift;
4798 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4799 : define a shorthand compile call for compilations that should be ok.
4800 compile_ok='
4801 mc_file=$1;
4802 shift;
4803 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4804
4805 : check for lengths of integral types
4806 echo " "
4807 case "$intsize" in
4808 '')
4809         echo "Checking to see how big your integers are..." >&4
4810         $cat >try.c <<'EOCP'
4811 #include <stdio.h>
4812 int main()
4813 {
4814         printf("intsize=%d;\n", (int)sizeof(int));
4815         printf("longsize=%d;\n", (int)sizeof(long));
4816         printf("shortsize=%d;\n", (int)sizeof(short));
4817         exit(0);
4818 }
4819 EOCP
4820         set try
4821         if eval $compile_ok && $run ./try > /dev/null; then
4822                 eval `$run ./try`
4823                 echo "Your integers are $intsize bytes long."
4824                 echo "Your long integers are $longsize bytes long."
4825                 echo "Your short integers are $shortsize bytes long."
4826         else
4827                 $cat >&4 <<EOM
4828 !
4829 Help! I can't compile and run the intsize test program: please enlighten me!
4830 (This is probably a misconfiguration in your system or libraries, and
4831 you really ought to fix it.  Still, I'll try anyway.)
4832 !
4833 EOM
4834                 dflt=4
4835                 rp="What is the size of an integer (in bytes)?"
4836                 . ./myread
4837                 intsize="$ans"
4838                 dflt=$intsize
4839                 rp="What is the size of a long integer (in bytes)?"
4840                 . ./myread
4841                 longsize="$ans"
4842                 dflt=2
4843                 rp="What is the size of a short integer (in bytes)?"
4844                 . ./myread
4845                 shortsize="$ans"
4846         fi
4847         ;;
4848 esac
4849 $rm -f try try.*
4850
4851 : check for long long
4852 echo " "
4853 echo "Checking to see if you have long long..." >&4
4854 echo 'int main() { long long x = 7; return 0; }' > try.c
4855 set try
4856 if eval $compile; then
4857         val="$define"
4858         echo "You have long long."
4859 else
4860         val="$undef"
4861         echo "You do not have long long."
4862 fi
4863 $rm try.*
4864 set d_longlong
4865 eval $setvar
4866
4867 : check for length of long long
4868 case "${d_longlong}${longlongsize}" in
4869 $define)
4870         echo " "
4871         echo "Checking to see how big your long longs are..." >&4
4872         $cat >try.c <<'EOCP'
4873 #include <stdio.h>
4874 int main()
4875 {
4876     printf("%d\n", (int)sizeof(long long));
4877     return(0);
4878 }
4879 EOCP
4880         set try
4881         if eval $compile_ok; then
4882                 longlongsize=`$run ./try`
4883                 echo "Your long longs are $longlongsize bytes long."
4884         else
4885                 dflt='8'
4886                 echo " "
4887                 echo "(I can't seem to compile the test program.  Guessing...)"
4888                 rp="What is the size of a long long (in bytes)?"
4889                 . ./myread
4890                 longlongsize="$ans"
4891         fi
4892         if $test "X$longsize" = "X$longlongsize"; then
4893                 echo "(That isn't any different from an ordinary long.)"
4894         fi      
4895         ;;
4896 esac
4897 $rm -f try.* try
4898
4899 : determine filename position in cpp output
4900 echo " "
4901 echo "Computing filename position in cpp output for #include directives..." >&4
4902 case "$osname" in
4903 vos) testaccess=-e ;;
4904 *)   testaccess=-r ;;
4905 esac
4906 echo '#include <stdio.h>' > foo.c
4907 $cat >fieldn <<EOF
4908 $startsh
4909 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4910 $grep '^[       ]*#.*stdio\.h' | \
4911 while read cline; do
4912         pos=1
4913         set \$cline
4914         while $test \$# -gt 0; do
4915                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
4916                         echo "\$pos"
4917                         exit 0
4918                 fi
4919                 shift
4920                 pos=\`expr \$pos + 1\`
4921         done
4922 done
4923 EOF
4924 chmod +x fieldn
4925 fieldn=`./fieldn`
4926 $rm -f foo.c fieldn
4927 case $fieldn in
4928 '') pos='???';;
4929 1) pos=first;;
4930 2) pos=second;;
4931 3) pos=third;;
4932 *) pos="${fieldn}th";;
4933 esac
4934 echo "Your cpp writes the filename in the $pos field of the line."
4935
4936 case "$osname" in
4937 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4938 *)   cppfilter='' ;;
4939 esac
4940 : locate header file
4941 $cat >findhdr <<EOF
4942 $startsh
4943 wanted=\$1
4944 name=''
4945 for usrincdir in $usrinc
4946 do
4947         if test -f \$usrincdir/\$wanted; then
4948                 echo "\$usrincdir/\$wanted"
4949                 exit 0
4950         fi
4951 done
4952 awkprg='{ print \$$fieldn }'
4953 echo "#include <\$wanted>" > foo\$\$.c
4954 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4955 $cppfilter $grep "^[    ]*#.*\$wanted" | \
4956 while read cline; do
4957         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4958         case "\$name" in
4959         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4960         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4961         *) exit 2;;
4962         esac;
4963 done;
4964 #
4965 # status = 0: grep returned 0 lines, case statement not executed
4966 # status = 1: headerfile found
4967 # status = 2: while loop executed, no headerfile found
4968 #
4969 status=\$?
4970 $rm -f foo\$\$.c;
4971 if test \$status -eq 1; then
4972         exit 0;
4973 fi
4974 exit 1
4975 EOF
4976 chmod +x findhdr
4977
4978 : define an alternate in-header-list? function
4979 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4980 cont=true; xxf="echo \"<\$1> found.\" >&4";
4981 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4982 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4983 esac;
4984 case $# in 4) instead=instead;; *) instead="at last";; esac;
4985 while $test "$cont"; do
4986         xxx=`./findhdr $1`
4987         var=$2; eval "was=\$$2";
4988         if $test "$xxx" && $test -r "$xxx";
4989         then eval $xxf;
4990         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4991                 cont="";
4992         else eval $xxnf;
4993         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4994         set $yyy; shift; shift; yyy=$@;
4995         case $# in 0) cont="";;
4996         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4997                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4998         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4999                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5000         esac;
5001 done;
5002 while $test "$yyy";
5003 do set $yyy; var=$2; eval "was=\$$2";
5004         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5005         set $yyy; shift; shift; yyy=$@;
5006 done'
5007
5008 : see if inttypes.h is available
5009 : we want a real compile instead of Inhdr because some systems
5010 : have an inttypes.h which includes non-existent headers
5011 echo " "
5012 $cat >try.c <<EOCP
5013 #include <inttypes.h>
5014 int main() {
5015         static int32_t foo32 = 0x12345678;
5016 }
5017 EOCP
5018 set try
5019 if eval $compile; then
5020         echo "<inttypes.h> found." >&4
5021         val="$define"
5022 else
5023         echo "<inttypes.h> NOT found." >&4
5024         val="$undef"
5025 fi
5026 $rm -f try.c try
5027 set i_inttypes
5028 eval $setvar
5029
5030 : check for int64_t
5031 echo " "
5032 echo "Checking to see if you have int64_t..." >&4
5033 $cat >try.c <<EOCP
5034 #include <sys/types.h>
5035 #$i_inttypes I_INTTYPES
5036 #ifdef I_INTTYPES
5037 #include <inttypes.h>
5038 #endif
5039 int main() { int64_t x = 7; }
5040 EOCP
5041 set try
5042 if eval $compile; then
5043         val="$define"
5044         echo "You have int64_t."
5045 else
5046         val="$undef"
5047         echo "You do not have int64_t."
5048 fi
5049 $rm -f try try.*
5050 set d_int64_t
5051 eval $setvar
5052
5053
5054 echo " "
5055 echo "Checking which 64-bit integer type we could use..." >&4
5056
5057 case "$intsize" in
5058 8) val=int
5059    set quadtype
5060    eval $setvar
5061    val='"unsigned int"'
5062    set uquadtype
5063    eval $setvar
5064    quadkind=1
5065    ;;
5066 *) case "$longsize" in
5067    8) val=long
5068       set quadtype
5069       eval $setvar
5070       val='"unsigned long"'
5071       set uquadtype
5072       eval $setvar
5073       quadkind=2
5074       ;;
5075    *) case "$d_longlong:$longlongsize" in
5076       define:8)
5077         val='"long long"'
5078         set quadtype
5079         eval $setvar
5080         val='"unsigned long long"'
5081         set uquadtype
5082         eval $setvar
5083         quadkind=3
5084         ;;
5085       *) case "$d_int64_t" in
5086          define)
5087            val=int64_t
5088            set quadtype
5089            eval $setvar
5090            val=uint64_t
5091            set uquadtype
5092            eval $setvar
5093            quadkind=4
5094            ;;
5095          esac
5096          ;;
5097       esac
5098       ;;
5099    esac
5100    ;;
5101 esac
5102
5103 case "$quadtype" in
5104 '')     echo "Alas, no 64-bit integer types in sight." >&4
5105         d_quad="$undef"
5106         ;;
5107 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5108         d_quad="$define"
5109         ;;
5110 esac
5111
5112
5113 case "$uselonglong" in
5114 "$define"|true|[yY]*)
5115         cat <<EOM >&4
5116
5117 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5118 EOM
5119         use64bitint="$define"
5120         ;;
5121 esac                          
5122 case "$use64bits" in
5123 "$define"|true|[yY]*)
5124         cat <<EOM >&4
5125
5126 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5127 EOM
5128         use64bitint="$define"
5129         ;;
5130 esac                          
5131 case "$use64bitints" in
5132 "$define"|true|[yY]*)
5133         cat <<EOM >&4
5134
5135 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5136 EOM
5137         use64bitint="$define"
5138         ;;
5139 esac                          
5140 case "$use64bitsint" in
5141 "$define"|true|[yY]*)
5142         cat <<EOM >&4
5143
5144 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5145 EOM
5146         use64bitint="$define"
5147         ;;
5148 esac                          
5149 case "$uselonglongs" in
5150 "$define"|true|[yY]*)
5151         cat <<EOM >&4
5152
5153 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5154 EOM
5155         use64bitint="$define"
5156         ;;
5157 esac                          
5158 case "$use64bitsall" in
5159 "$define"|true|[yY]*)
5160         cat <<EOM >&4
5161
5162 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5163 EOM
5164         use64bitall="$define"
5165         ;;
5166 esac                          
5167
5168 case "$ccflags" in
5169 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5170 esac
5171 case "$use64bitall" in
5172 "$define"|true|[yY]*) use64bitint="$define" ;;
5173 esac
5174
5175 case "$longsize" in
5176 8) cat <<EOM
5177
5178 You have natively 64-bit long integers.
5179 EOM
5180    val="$define"
5181    ;;
5182 *) case "$use64bitint" in
5183    "$define"|true|[yY]*) dflt='y';;
5184    *) dflt='n';;
5185    esac
5186    case "$d_quad" in
5187    "$define") ;;
5188    *) dflt='n' ;;
5189    esac
5190    cat <<EOM
5191
5192 Perl can be built to take advantage of 64-bit integer types
5193 on some systems.  To do so, Configure can be run with -Duse64bitint.
5194 Choosing this option will most probably introduce binary incompatibilities.
5195
5196 If this doesn't make any sense to you, just accept the default '$dflt'.
5197 (The default has been chosen based on your configuration.)
5198 EOM
5199    rp='Try to use 64-bit integers, if available?'
5200    . ./myread
5201    case "$ans" in
5202    [yY]*) val="$define" ;;
5203    *)     val="$undef"  ;;
5204    esac
5205    ;;
5206 esac
5207 set use64bitint
5208 eval $setvar
5209
5210 case "$use64bitall" in
5211 "$define"|true|[yY]*) dflt='y' ;;
5212 *) case "$longsize" in
5213    8) dflt='y' ;;
5214    *) dflt='n' ;;
5215    esac
5216    ;;
5217 esac    
5218 cat <<EOM
5219
5220 You may also choose to try maximal 64-bitness.  It means using as much
5221 64-bitness as possible on the platform.  This in turn means even more
5222 binary incompatibilities.  On the other hand, your platform may not
5223 have any more 64-bitness available than what you already have chosen.
5224
5225 If this doesn't make any sense to you, just accept the default '$dflt'.
5226 (The default has been chosen based on your configuration.)
5227 EOM
5228 rp='Try to use maximal 64-bit support, if available?'
5229 . ./myread
5230 case "$ans" in
5231 [yY]*) val="$define" ;;
5232 *)     val="$undef"  ;;
5233 esac
5234 set use64bitall
5235 eval $setvar
5236 case "$use64bitall" in
5237 "$define")
5238         case "$use64bitint" in
5239         "$undef")
5240                 cat <<EOM
5241
5242 Since you have chosen a maximally 64-bit build, I'm also turning on
5243 the use of 64-bit integers.
5244 EOM
5245                 use64bitint="$define" ;;
5246         esac
5247         ;;
5248 esac
5249
5250 case "$use64bitint" in
5251 "$define"|true|[yY]*)
5252 : Look for a hint-file generated 'call-back-unit'.  If the
5253 : user has specified that a 64-bit perl is to be built,
5254 : we may need to set or change some other defaults.
5255         if $test -f use64bitint.cbu; then
5256                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5257                 . ./use64bitint.cbu
5258         fi
5259         case "$longsize" in
5260         4) case "$archname64" in
5261            '') archname64=64int ;;
5262            esac
5263            ;;
5264         esac
5265         ;;
5266 esac
5267
5268 case "$use64bitall" in
5269 "$define"|true|[yY]*)
5270 : Look for a hint-file generated 'call-back-unit'.  If the
5271 : user has specified that a maximally 64-bit perl is to be built,
5272 : we may need to set or change some other defaults.
5273         if $test -f use64bitall.cbu; then
5274                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5275                 . ./use64bitall.cbu
5276         fi
5277         case "$longsize" in
5278         4) case "$archname64" in
5279            ''|64int) archname64=64all ;;
5280            esac
5281            ;;
5282         esac
5283         ;;
5284 esac
5285
5286 echo " "
5287 echo "Checking for GNU C Library..." >&4
5288 cat >try.c <<EOM
5289 #include <stdio.h>
5290 int main()
5291 {
5292 #ifdef __GLIBC__
5293     exit(0);
5294 #else
5295     exit(1);
5296 #endif
5297 }
5298 EOM
5299 set try
5300 if eval $compile_ok && $run ./try; then
5301         val="$define"
5302         echo "You are using the GNU C Library"
5303 else
5304         val="$undef"
5305         echo "You are not using the GNU C Library"
5306 fi
5307 $rm -f try try.*
5308 set d_gnulibc
5309 eval $setvar
5310
5311 : see if nm is to be used to determine whether a symbol is defined or not
5312 case "$usenm" in
5313 '')
5314         dflt=''
5315         case "$d_gnulibc" in
5316         "$define")
5317                 echo " "
5318                 echo "nm probably won't work on the GNU C Library." >&4
5319                 dflt=n
5320                 ;;
5321         esac
5322         case "$dflt" in
5323         '') 
5324                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5325                         echo " "
5326                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5327                         echo "'nm' won't be sufficient on this sytem." >&4
5328                         dflt=n
5329                 fi
5330                 ;;
5331         esac
5332         case "$dflt" in
5333         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5334                 if $test $dflt -gt 20; then
5335                         dflt=y
5336                 else
5337                         dflt=n
5338                 fi
5339                 ;;
5340         esac
5341         ;;
5342 *)
5343         case "$usenm" in
5344         true|$define) dflt=y;;
5345         *) dflt=n;;
5346         esac
5347         ;;
5348 esac
5349 $cat <<EOM
5350
5351 I can use $nm to extract the symbols from your C libraries. This
5352 is a time consuming task which may generate huge output on the disk (up
5353 to 3 megabytes) but that should make the symbols extraction faster. The
5354 alternative is to skip the 'nm' extraction part and to compile a small
5355 test program instead to determine whether each symbol is present. If
5356 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5357 this may be the best solution.
5358
5359 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5360
5361 EOM
5362 rp="Shall I use $nm to extract C symbols from the libraries?"
5363 . ./myread
5364 case "$ans" in
5365 [Nn]*) usenm=false;;
5366 *) usenm=true;;
5367 esac
5368
5369 runnm=$usenm
5370 case "$reuseval" in
5371 true) runnm=false;;
5372 esac
5373
5374 : nm options which may be necessary
5375 case "$nm_opt" in
5376 '') if $test -f /mach_boot; then
5377                 nm_opt=''       # Mach
5378         elif $test -d /usr/ccs/lib; then
5379                 nm_opt='-p'     # Solaris (and SunOS?)
5380         elif $test -f /dgux; then
5381                 nm_opt='-p'     # DG-UX
5382         elif $test -f /lib64/rld; then
5383                 nm_opt='-p'     # 64-bit Irix
5384         else
5385                 nm_opt=''
5386         fi;;
5387 esac
5388
5389 : nm options which may be necessary for shared libraries but illegal
5390 : for archive libraries.  Thank you, Linux.
5391 case "$nm_so_opt" in
5392 '')     case "$myuname" in
5393         *linux*)
5394                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5395                         nm_so_opt='--dynamic'
5396                 fi
5397                 ;;
5398         esac
5399         ;;
5400 esac
5401
5402 case "$runnm" in
5403 true)
5404 : get list of predefined functions in a handy place
5405 echo " "
5406 case "$libc" in
5407 '') libc=unknown
5408         case "$libs" in
5409         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5410         esac
5411         ;;
5412 esac
5413 case "$libs" in
5414 '') ;;
5415 *)  for thislib in $libs; do
5416         case "$thislib" in
5417         -lc|-lc_s)
5418                 : Handle C library specially below.
5419                 ;;
5420         -l*)
5421                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5422                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5423                         :
5424                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5425                         :
5426                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5427                         :
5428                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5429                         :
5430                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5431                         :
5432                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5433                         :
5434                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5435                         :
5436                 else
5437                         try=''
5438                 fi
5439                 libnames="$libnames $try"
5440                 ;;
5441         *) libnames="$libnames $thislib" ;;
5442         esac
5443         done
5444         ;;
5445 esac
5446 xxx=normal
5447 case "$libc" in
5448 unknown)
5449         set /lib/libc.$so
5450         for xxx in $libpth; do
5451                 $test -r $1 || set $xxx/libc.$so
5452                 : The messy sed command sorts on library version numbers.
5453                 $test -r $1 || \
5454                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5455                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5456                                 h
5457                                 s/[0-9][0-9]*/0000&/g
5458                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5459                                 G
5460                                 s/\n/ /' | \
5461                          $sort | $sed -e 's/^.* //'`
5462                 eval set \$$#
5463         done
5464         $test -r $1 || set /usr/ccs/lib/libc.$so
5465         $test -r $1 || set /lib/libsys_s$_a
5466         ;;
5467 *)
5468         set blurfl
5469         ;;
5470 esac
5471 if $test -r "$1"; then
5472         echo "Your (shared) C library seems to be in $1."
5473         libc="$1"
5474 elif $test -r /lib/libc && $test -r /lib/clib; then
5475         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5476         xxx=apollo
5477         libc='/lib/clib /lib/libc'
5478         if $test -r /lib/syslib; then
5479                 echo "(Your math library is in /lib/syslib.)"
5480                 libc="$libc /lib/syslib"
5481         fi
5482 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5483         echo "Your C library seems to be in $libc, as you said before."
5484 elif $test -r $incpath/usr/lib/libc$_a; then
5485         libc=$incpath/usr/lib/libc$_a;
5486         echo "Your C library seems to be in $libc.  That's fine."
5487 elif $test -r /lib/libc$_a; then
5488         libc=/lib/libc$_a;
5489         echo "Your C library seems to be in $libc.  You're normal."
5490 else
5491         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5492                 :
5493         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5494                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5495         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5496                 :
5497         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5498                 :
5499         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5500                 :
5501         else
5502                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5503         fi
5504         if $test -r "$tans"; then
5505                 echo "Your C library seems to be in $tans, of all places."
5506                 libc=$tans
5507         else
5508                 libc='blurfl'
5509         fi
5510 fi
5511 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5512         dflt="$libc"
5513         cat <<EOM
5514
5515 If the guess above is wrong (which it might be if you're using a strange
5516 compiler, or your machine supports multiple models), you can override it here.
5517
5518 EOM
5519 else
5520         dflt=''
5521         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5522         cat >&4 <<EOM
5523 I can't seem to find your C library.  I've looked in the following places:
5524
5525 EOM
5526         $sed 's/^/      /' libpath
5527         cat <<EOM
5528
5529 None of these seems to contain your C library. I need to get its name...
5530
5531 EOM
5532 fi
5533 fn=f
5534 rp='Where is your C library?'
5535 . ./getfile
5536 libc="$ans"
5537
5538 echo " "
5539 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5540 set X `cat libnames`
5541 shift
5542 xxx=files
5543 case $# in 1) xxx=file; esac
5544 echo "Extracting names from the following $xxx for later perusal:" >&4
5545 echo " "
5546 $sed 's/^/      /' libnames >&4
5547 echo " "
5548 $echo $n "This may take a while...$c" >&4
5549
5550 for file in $*; do
5551         case $file in
5552         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5553         *) $nm $nm_opt $file 2>/dev/null;;
5554         esac
5555 done >libc.tmp
5556
5557 $echo $n ".$c"
5558 $grep fprintf libc.tmp > libc.ptf
5559 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5560 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
5561 xxx='[ADTSIW]'
5562 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5563         eval $xscan;\
5564         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5565                 eval $xrun
5566 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5567         eval $xscan;\
5568         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5569                 eval $xrun
5570 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5571         eval $xscan;\
5572         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5573                 eval $xrun
5574 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5575         eval $xscan;\
5576         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5577                 eval $xrun
5578 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5579         eval $xscan;\
5580         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5581                 eval $xrun
5582 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5583         eval $xscan;\
5584         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5585                 eval $xrun
5586 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5587                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5588         eval $xscan;\
5589         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5590                 eval $xrun
5591 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5592         eval $xscan;\
5593         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5594                 eval $xrun
5595 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5596         eval $xscan;\
5597         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5598                 eval $xrun
5599 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5600         eval $xscan;\
5601         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5602                 eval $xrun
5603 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5604         eval $xscan;\
5605         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5606                 eval $xrun
5607 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5608         eval $xscan;\
5609         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5610                 eval $xrun
5611 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5612         eval $xscan;\
5613         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5614                 eval $xrun
5615 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5616         eval $xscan;\
5617         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5618                 eval $xrun
5619 else
5620         $nm -p $* 2>/dev/null >libc.tmp
5621         $grep fprintf libc.tmp > libc.ptf
5622         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5623                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5624         then
5625                 nm_opt='-p'
5626                 eval $xrun
5627         else
5628                 echo " "
5629                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5630                 com=''
5631                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5632                         for thisname in $libnames $libc; do
5633                                 $ar t $thisname >>libc.tmp
5634                         done
5635                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5636                         echo "Ok." >&4
5637                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5638                         # Repeat libc to extract forwarders to DLL entries too
5639                         for thisname in $libnames $libc; do
5640                                 $ar tv $thisname >>libc.tmp
5641                                 # Revision 50 of EMX has bug in $ar.
5642                                 # it will not extract forwarders to DLL entries
5643                                 # Use emximp which will extract exactly them.
5644                                 emximp -o tmp.imp $thisname \
5645                                     2>/dev/null && \
5646                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5647                                     < tmp.imp >>libc.tmp
5648                                 $rm tmp.imp
5649                         done
5650                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5651                         echo "Ok." >&4
5652                 else
5653                         echo "$ar didn't seem to work right." >&4
5654                         echo "Maybe this is a Cray...trying bld instead..." >&4
5655                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5656                         then
5657                                 for thisname in $libnames; do
5658                                         bld t $libnames | \
5659                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5660                                         $ar t $thisname >>libc.tmp
5661                                 done
5662                                 echo "Ok." >&4
5663                         else
5664                                 echo "That didn't work either.  Giving up." >&4
5665                                 exit 1
5666                         fi
5667                 fi
5668         fi
5669 fi
5670 nm_extract="$com"
5671 if $test -f /lib/syscalls.exp; then
5672         echo " "
5673         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5674         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
5675 fi
5676 ;;
5677 esac
5678 $rm -f libnames libpath
5679
5680 : is a C symbol defined?
5681 csym='tlook=$1;
5682 case "$3" in
5683 -v) tf=libc.tmp; tc=""; tdc="";;
5684 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5685 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5686 esac;
5687 tx=yes;
5688 case "$reuseval-$4" in
5689 true-) ;;
5690 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5691 esac;
5692 case "$tx" in
5693 yes)
5694         case "$runnm" in
5695         true)
5696                 if $contains $tlook $tf >/dev/null 2>&1;
5697                 then tval=true;
5698                 else tval=false;
5699                 fi;;
5700         *)
5701                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5702                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5703                 then tval=true;
5704                 else tval=false;
5705                 fi;
5706                 $rm -f t t.c;;
5707         esac;;
5708 *)
5709         case "$tval" in
5710         $define) tval=true;;
5711         *) tval=false;;
5712         esac;;
5713 esac;
5714 eval "$2=$tval"'
5715
5716 : define an is-in-libc? function
5717 inlibc='echo " "; td=$define; tu=$undef;
5718 sym=$1; var=$2; eval "was=\$$2";
5719 tx=yes;
5720 case "$reuseval$was" in
5721 true) ;;
5722 true*) tx=no;;
5723 esac;
5724 case "$tx" in
5725 yes)
5726         set $sym tres -f;
5727         eval $csym;
5728         case "$tres" in
5729         true)
5730                 echo "$sym() found." >&4;
5731                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5732         *)
5733                 echo "$sym() NOT found." >&4;
5734                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5735         esac;;
5736 *)
5737         case "$was" in
5738         $define) echo "$sym() found." >&4;;
5739         *) echo "$sym() NOT found." >&4;;
5740         esac;;
5741 esac'
5742
5743 : see if sqrtl exists
5744 set sqrtl d_sqrtl
5745 eval $inlibc
5746
5747 : check for length of double
5748 echo " "
5749 case "$doublesize" in
5750 '')
5751         echo "Checking to see how big your double precision numbers are..." >&4
5752         $cat >try.c <<'EOCP'
5753 #include <stdio.h>
5754 int main()
5755 {
5756     printf("%d\n", (int)sizeof(double));
5757     exit(0);
5758 }
5759 EOCP
5760         set try
5761         if eval $compile_ok; then
5762                 doublesize=`$run ./try`
5763                 echo "Your double is $doublesize bytes long."
5764         else
5765                 dflt='8'
5766                 echo "(I can't seem to compile the test program.  Guessing...)"
5767                 rp="What is the size of a double precision number (in bytes)?"
5768                 . ./myread
5769                 doublesize="$ans"
5770         fi
5771         ;;
5772 esac
5773 $rm -f try.c try
5774
5775 : check for long doubles
5776 echo " "
5777 echo "Checking to see if you have long double..." >&4
5778 echo 'int main() { long double x = 7.0; }' > try.c
5779 set try
5780 if eval $compile; then
5781         val="$define"
5782         echo "You have long double."
5783 else
5784         val="$undef"
5785         echo "You do not have long double."
5786 fi
5787 $rm try.*
5788 set d_longdbl
5789 eval $setvar
5790
5791 : check for length of long double
5792 case "${d_longdbl}${longdblsize}" in
5793 $define)
5794         echo " "
5795         echo "Checking to see how big your long doubles are..." >&4
5796         $cat >try.c <<'EOCP'
5797 #include <stdio.h>
5798 int main()
5799 {
5800         printf("%d\n", sizeof(long double));
5801 }
5802 EOCP
5803         set try
5804         set try
5805         if eval $compile; then
5806                 longdblsize=`$run ./try`
5807                 echo "Your long doubles are $longdblsize bytes long."
5808         else
5809                 dflt='8'
5810                 echo " "
5811                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5812                 rp="What is the size of a long double (in bytes)?"
5813                 . ./myread
5814                 longdblsize="$ans"
5815         fi
5816         if $test "X$doublesize" = "X$longdblsize"; then
5817                 echo "(That isn't any different from an ordinary double.)"
5818         fi      
5819         ;;
5820 esac
5821 $rm -f try.* try
5822
5823 echo " "
5824
5825 if $test X"$d_longdbl" = X"$define"; then
5826
5827 echo "Checking how to print long doubles..." >&4
5828
5829 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
5830         $cat >try.c <<'EOCP'
5831 #include <sys/types.h>
5832 #include <stdio.h>
5833 int main() {
5834   double d = 123.456;
5835   printf("%.3f\n", d);
5836 }
5837 EOCP
5838         set try
5839         if eval $compile; then
5840                 yyy=`$run ./try`
5841                 case "$yyy" in
5842                 123.456)
5843                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
5844                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
5845                         echo "We will use %f."
5846                         ;;
5847                 esac
5848         fi
5849 fi
5850
5851 if $test X"$sPRIfldbl" = X; then
5852         $cat >try.c <<'EOCP'
5853 #include <sys/types.h>
5854 #include <stdio.h>
5855 int main() {
5856   long double d = 123.456;
5857   printf("%.3Lf\n", d);
5858 }
5859 EOCP
5860         set try
5861         if eval $compile; then
5862                 yyy=`$run ./try`
5863                 case "$yyy" in
5864                 123.456)
5865                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
5866                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
5867                         echo "We will use %Lf."
5868                         ;;
5869                 esac
5870         fi
5871 fi
5872
5873 if $test X"$sPRIfldbl" = X; then
5874         $cat >try.c <<'EOCP'
5875 #include <sys/types.h>
5876 #include <stdio.h>
5877 int main() {
5878   long double d = 123.456;
5879   printf("%.3llf\n", d);
5880 }
5881 EOCP
5882         set try
5883         if eval $compile; then
5884                 yyy=`$run ./try`
5885                 case "$yyy" in
5886                 123.456)
5887                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
5888                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
5889                         echo "We will use %llf."
5890                         ;;
5891                 esac
5892         fi
5893 fi
5894
5895 if $test X"$sPRIfldbl" = X; then
5896         $cat >try.c <<'EOCP'
5897 #include <sys/types.h>
5898 #include <stdio.h>
5899 int main() {
5900   long double d = 123.456;
5901   printf("%.3lf\n", d);
5902 }
5903 EOCP
5904         set try
5905         if eval $compile; then
5906                 yyy=`$run ./try`
5907                 case "$yyy" in
5908                 123.456)
5909                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
5910                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
5911                         echo "We will use %lf."
5912                         ;;
5913                 esac
5914         fi
5915 fi
5916
5917 if $test X"$sPRIfldbl" = X; then
5918         echo "Cannot figure out how to print long doubles." >&4
5919 else
5920         sSCNfldbl=$sPRIfldbl    # expect consistency
5921 fi
5922
5923 $rm -f try try.*
5924
5925 fi # d_longdbl
5926
5927 case "$sPRIfldbl" in
5928 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
5929         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
5930         d_SCNfldbl="$undef";
5931         ;;
5932 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
5933         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
5934         d_SCNfldbl="$define";
5935         ;;
5936 esac
5937
5938 : see if modfl exists
5939 set modfl d_modfl
5940 eval $inlibc
5941
5942 d_modfl_pow32_bug="$undef"
5943
5944 case "$d_longdbl$d_modfl" in
5945 $define$define)
5946         $cat <<EOM
5947 Checking to see whether your modfl() is okay for large values...
5948 EOM
5949 $cat >try.c <<EOCP
5950 #include <math.h> 
5951 #include <stdio.h>
5952 int main() {
5953     long double nv = 4294967303.15;
5954     long double v, w;
5955     v = modfl(nv, &w);         
5956 #ifdef __GLIBC__
5957     printf("glibc");
5958 #endif
5959     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
5960     return 0;
5961 }
5962 EOCP
5963         case "$osname:$gccversion" in
5964         aix:)   saveccflags="$ccflags"
5965                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
5966         esac
5967         set try
5968         if eval $compile; then
5969                 foo=`$run ./try`
5970                 case "$foo" in
5971                 *" 4294967303.150000 1.150000 4294967302.000000")
5972                         echo >&4 "Your modfl() is broken for large values."
5973                         d_modfl_pow32_bug="$define"
5974                         case "$foo" in
5975                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
5976                         ;;
5977                         esac
5978                         ;;
5979                 *" 4294967303.150000 0.150000 4294967303.000000")
5980                         echo >&4 "Your modfl() seems okay for large values."
5981                         ;;
5982                 *)      echo >&4 "I don't understand your modfl() at all."
5983                         d_modfl="$undef"
5984                         ;;
5985                 esac
5986                 $rm -f try.* try core core.try.*
5987         else
5988                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
5989                 d_modfl="$undef"
5990         fi
5991         case "$osname:$gccversion" in
5992         aix:)   ccflags="$saveccflags" ;; # restore
5993         esac
5994         ;;
5995 esac
5996
5997 case "$ccflags" in
5998 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5999 esac
6000
6001 case "$uselongdouble" in
6002 $define|true|[yY]*)     dflt='y';;
6003 *) dflt='n';;
6004 esac
6005 cat <<EOM
6006
6007 Perl can be built to take advantage of long doubles which
6008 (if available) may give more accuracy and range for floating point numbers.
6009
6010 If this doesn't make any sense to you, just accept the default '$dflt'.
6011 EOM
6012 rp='Try to use long doubles if available?'
6013 . ./myread
6014 case "$ans" in
6015 y|Y)    val="$define"   ;;
6016 *)      val="$undef"    ;;
6017 esac
6018 set uselongdouble
6019 eval $setvar
6020
6021 case "$uselongdouble" in
6022 true|[yY]*) uselongdouble="$define" ;;
6023 esac
6024
6025 case "$uselongdouble" in
6026 $define)
6027 : Look for a hint-file generated 'call-back-unit'.  If the
6028 : user has specified that long doubles should be used,
6029 : we may need to set or change some other defaults.
6030         if $test -f uselongdouble.cbu; then
6031                 echo "Your platform has some specific hints for long doubles, using them..."
6032                 . ./uselongdouble.cbu
6033         else
6034                 $cat <<EOM
6035 (Your platform doesn't have any specific hints for long doubles.)
6036 EOM
6037         fi
6038         ;;
6039 esac
6040
6041 message=X
6042 case "$uselongdouble:$d_sqrtl:$d_modfl" in
6043 $define:$define:$define)
6044         : You have both
6045         ;;
6046 $define:$define:$undef)
6047         message="I could not find modfl"
6048         ;;
6049 $define:$undef:$define)
6050         message="I could not find sqrtl"
6051         ;;
6052 $define:$undef:$undef)
6053         message="I found neither sqrtl nor modfl"
6054         ;;
6055 esac
6056
6057 if $test "$message" != X; then
6058         $cat <<EOM >&4
6059
6060 *** You requested the use of long doubles but you do not seem to have
6061 *** the mathematic functions for long doubles.
6062 *** ($message)
6063 *** I'm disabling the use of long doubles.
6064
6065 EOM
6066
6067         uselongdouble=$undef
6068 fi
6069
6070 case "$useperlio" in
6071 $define|true|[yY]*|'')  dflt='y';;
6072 *) dflt='n';;
6073 esac
6074 cat <<EOM
6075
6076 Previous version of $package used the standard IO mechanisms as
6077 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
6078 alternate IO mechanisms via the PerlIO abstraction layer, but the
6079 stdio mechanism is still available if needed.  The abstraction layer
6080 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
6081 Using PerlIO with sfio may cause problems with some extension modules.
6082
6083 If this doesn't make any sense to you, just accept the default '$dflt'.
6084 EOM
6085 rp='Use the PerlIO abstraction layer?'
6086 . ./myread
6087 case "$ans" in
6088 y|Y) 
6089         val="$define"
6090         ;;
6091 *)      
6092         echo "Ok, doing things the stdio way."
6093         val="$undef"
6094         ;;
6095 esac
6096 set useperlio
6097 eval $setvar 
6098
6099 case "$usesocks" in
6100 $define|true|[yY]*)
6101         case "$useperlio" in
6102         $define|true|[yY]*) ;;
6103         *)      cat >&4 <<EOM
6104
6105 You are using the SOCKS proxy protocol library which means that you
6106 should also use the PerlIO layer.  You may be headed for trouble.
6107
6108 EOM
6109                 ;;
6110         esac
6111         ;;
6112 esac
6113
6114         
6115 : determine the architecture name
6116 echo " "
6117 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6118         tarch=`arch`"-$osname"
6119 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6120         if uname -m > tmparch 2>&1 ; then
6121                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6122                         -e 's/$/'"-$osname/" tmparch`
6123         else
6124                 tarch="$osname"
6125         fi
6126         $rm -f tmparch
6127 else
6128         tarch="$osname"
6129 fi
6130 case "$myarchname" in
6131 ''|"$tarch") ;;
6132 *)
6133         echo "(Your architecture name used to be $myarchname.)"
6134         archname=''
6135         ;;
6136 esac
6137 case "$targetarch" in
6138 '') ;;
6139 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6140 esac
6141 myarchname="$tarch"
6142 case "$archname" in
6143 '') dflt="$tarch";;
6144 *) dflt="$archname";;
6145 esac
6146 rp='What is your architecture name'
6147 . ./myread
6148 archname="$ans"
6149 case "$usethreads" in
6150 $define)
6151         echo "Threads selected." >&4
6152         case "$archname" in
6153         *-thread*) echo "...and architecture name already has -thread." >&4
6154                 ;;
6155         *)      archname="$archname-thread"
6156                 echo "...setting architecture name to $archname." >&4
6157                 ;;
6158         esac
6159         ;;
6160 esac
6161 case "$usemultiplicity" in
6162 $define)
6163         echo "Multiplicity selected." >&4
6164         case "$archname" in
6165         *-multi*) echo "...and architecture name already has -multi." >&4
6166                 ;;
6167         *)      archname="$archname-multi"
6168                 echo "...setting architecture name to $archname." >&4
6169                 ;;
6170         esac
6171         ;;
6172 esac
6173 case "$use64bitint$use64bitall" in
6174 *"$define"*)
6175         case "$archname64" in
6176         '')
6177                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6178                 ;;
6179         *)
6180                 case "$use64bitint" in
6181                 "$define") echo "64 bit integers selected." >&4 ;;
6182                 esac
6183                 case "$use64bitall" in
6184                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6185                 esac
6186                 case "$archname" in
6187                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6188                         ;;
6189                 *)      archname="$archname-$archname64"
6190                         echo "...setting architecture name to $archname." >&4
6191                         ;;
6192                 esac
6193                 ;;
6194         esac
6195 esac
6196 case "$uselongdouble" in
6197 $define)
6198         echo "Long doubles selected." >&4
6199         case "$longdblsize" in
6200         $doublesize)
6201                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6202                 ;;
6203         *)
6204                 case "$archname" in
6205                 *-ld*) echo "...and architecture name already has -ld." >&4
6206                         ;;
6207                 *)      archname="$archname-ld"
6208                         echo "...setting architecture name to $archname." >&4
6209                         ;;
6210                 esac
6211                 ;;
6212         esac
6213         ;;
6214 esac
6215 case "$useperlio" in
6216 $define)
6217         echo "Perlio selected." >&4
6218         ;;
6219 *)
6220         echo "Perlio not selected, using stdio." >&4
6221         case "$archname" in
6222         *-stdio*) echo "...and architecture name already has -stdio." >&4
6223                 ;;
6224         *)      archname="$archname-stdio"
6225                 echo "...setting architecture name to $archname." >&4
6226                 ;;
6227         esac
6228         ;;
6229 esac
6230
6231 : determine root of directory hierarchy where package will be installed.
6232 case "$prefix" in
6233 '')
6234         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
6235         ;;
6236 *)
6237         dflt="$prefix"
6238         ;;
6239 esac
6240 $cat <<EOM
6241
6242 By default, $package will be installed in $dflt/bin, manual pages
6243 under $dflt/man, etc..., i.e. with $dflt as prefix for all
6244 installation directories. Typically this is something like /usr/local.
6245 If you wish to have binaries under /usr/bin but other parts of the
6246 installation under /usr/local, that's ok: you will be prompted
6247 separately for each of the installation directories, the prefix being
6248 only used to set the defaults.
6249
6250 EOM
6251 fn=d~
6252 rp='Installation prefix to use?'
6253 . ./getfile
6254 oldprefix=''
6255 case "$prefix" in
6256 '') ;;
6257 *)
6258         case "$ans" in
6259         "$prefix") ;;
6260         *) oldprefix="$prefix";;
6261         esac
6262         ;;
6263 esac
6264 prefix="$ans"
6265 prefixexp="$ansexp"
6266
6267 case "$afsroot" in
6268 '')     afsroot=/afs ;;
6269 *)      afsroot=$afsroot ;;
6270 esac
6271
6272 : is AFS running?
6273 echo " "
6274 case "$afs" in
6275 $define|true)   afs=true ;;
6276 $undef|false)   afs=false ;;
6277 *)      if test -d $afsroot; then
6278                 afs=true
6279         else
6280                 afs=false
6281         fi
6282         ;;
6283 esac
6284 if $afs; then
6285         echo "AFS may be running... I'll be extra cautious then..." >&4
6286 else
6287         echo "AFS does not seem to be running..." >&4
6288 fi
6289
6290 : determine installation prefix for where package is to be installed.
6291 if $afs; then 
6292 $cat <<EOM
6293
6294 Since you are running AFS, I need to distinguish the directory in which
6295 files will reside from the directory in which they are installed (and from
6296 which they are presumably copied to the former directory by occult means).
6297
6298 EOM
6299         case "$installprefix" in
6300         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6301         *) dflt="$installprefix";;
6302         esac
6303 else
6304 $cat <<EOM
6305
6306 In some special cases, particularly when building $package for distribution,
6307 it is convenient to distinguish between the directory in which files should 
6308 be installed from the directory ($prefix) in which they 
6309 will eventually reside.  For most users, these two directories are the same.
6310
6311 EOM
6312         case "$installprefix" in
6313         '') dflt=$prefix ;;
6314         *) dflt=$installprefix;;
6315         esac
6316 fi
6317 fn=d~
6318 rp='What installation prefix should I use for installing files?'
6319 . ./getfile
6320 installprefix="$ans"
6321 installprefixexp="$ansexp"
6322
6323 : set the prefixit variable, to compute a suitable default value
6324 prefixit='case "$3" in
6325 ""|none)
6326         case "$oldprefix" in
6327         "") eval "$1=\"\$$2\"";;
6328         *)
6329                 case "$3" in
6330                 "") eval "$1=";;
6331                 none)
6332                         eval "tp=\"\$$2\"";
6333                         case "$tp" in
6334                         ""|" ") eval "$1=\"\$$2\"";;
6335                         *) eval "$1=";;
6336                         esac;;
6337                 esac;;
6338         esac;;
6339 *)
6340         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6341         case "$tp" in
6342         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6343         /*-$oldprefix/*|\~*-$oldprefix/*)
6344                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6345         *) eval "$1=\"\$$2\"";;
6346         esac;;
6347 esac'
6348
6349 : get the patchlevel
6350 echo " "
6351 echo "Getting the current patchlevel..." >&4
6352 if $test -r $rsrc/patchlevel.h;then
6353         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6354         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6355         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6356         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6357         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6358         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6359        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6360 else
6361         revision=0
6362         patchlevel=0
6363         subversion=0
6364         api_revision=0
6365         api_version=0
6366         api_subversion=0
6367         perl_patchlevel=0
6368         $echo "(You do not have patchlevel.h.  Eek.)"
6369 fi
6370 if $test -r $rsrc/.patch ; then  
6371         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6372                 perl_patchlevel=`cat $rsrc/.patch`
6373         fi
6374 fi
6375 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
6376 version_patchlevel_string="version $patchlevel subversion $subversion"
6377 case "$perl_patchlevel" in
6378 0|'') ;;
6379 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
6380 esac
6381
6382 $echo "(You have $package $version_patchlevel_string.)"
6383
6384 case "$osname" in
6385 dos|vms)
6386         : XXX Should be a Configure test for double-dots in filenames.
6387         version=`echo $revision $patchlevel $subversion | \
6388                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6389         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6390                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6391         ;;
6392 *)
6393         version=`echo $revision $patchlevel $subversion | \
6394                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6395         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6396                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6397         ;;
6398 esac
6399 : Special case the 5.005_xx maintenance series, which used 5.005
6400 : without any subversion label as a subdirectory in $sitelib
6401 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6402         api_versionstring='5.005'
6403 fi
6404
6405 : determine installation style
6406 : For now, try to deduce it from prefix unless it is already set.
6407 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6408 case "$installstyle" in
6409 '')     case "$prefix" in
6410                 *perl*) dflt='lib';;
6411                 *) dflt='lib/perl5' ;;
6412         esac
6413         ;;
6414 *)      dflt="$installstyle" ;;
6415 esac
6416 : Probably not worth prompting for this since we prompt for all
6417 : the directories individually, and the prompt would be too long and
6418 : confusing anyway.
6419 installstyle=$dflt
6420
6421 : determine where private library files go
6422 : Usual default is /usr/local/lib/perl5/$version.
6423 : Also allow things like /opt/perl/lib/$version, since 
6424 : /opt/perl/lib/perl5... would be redundant.
6425 : The default "style" setting is made in installstyle.U
6426 case "$installstyle" in
6427 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6428 *)       set dflt privlib lib/$version ;;
6429 esac
6430 eval $prefixit
6431 $cat <<EOM
6432
6433 There are some auxiliary files for $package that need to be put into a
6434 private library directory that is accessible by everyone.
6435
6436 EOM
6437 fn=d~+
6438 rp='Pathname where the private library files will reside?'
6439 . ./getfile
6440 privlib="$ans"
6441 privlibexp="$ansexp"
6442 : Change installation prefix, if necessary.
6443 if $test X"$prefix" != X"$installprefix"; then
6444         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6445 else
6446         installprivlib="$privlibexp"
6447 fi
6448
6449 : set the prefixup variable, to restore leading tilda escape
6450 prefixup='case "$prefixexp" in
6451 "$prefix") ;;
6452 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6453 esac'
6454
6455 : determine where public architecture dependent libraries go
6456 set archlib archlib
6457 eval $prefixit
6458 : privlib default is /usr/local/lib/$package/$version
6459 : archlib default is /usr/local/lib/$package/$version/$archname
6460 : privlib may have an optional trailing /share.
6461 tdflt=`echo $privlib | $sed 's,/share$,,'`
6462 tdflt=$tdflt/$archname
6463 case "$archlib" in
6464 '')     dflt=$tdflt
6465         ;;
6466 *)      dflt="$archlib"
6467     ;;
6468 esac
6469 $cat <<EOM
6470
6471 $spackage contains architecture-dependent library files.  If you are
6472 sharing libraries in a heterogeneous environment, you might store
6473 these files in a separate location.  Otherwise, you can just include
6474 them with the rest of the public library files.
6475
6476 EOM
6477 fn=d+~
6478 rp='Where do you want to put the public architecture-dependent libraries?'
6479 . ./getfile
6480 archlib="$ans"
6481 archlibexp="$ansexp"
6482 if $test X"$archlib" = X"$privlib"; then
6483         d_archlib="$undef"
6484 else
6485         d_archlib="$define"
6486 fi
6487 : Change installation prefix, if necessary.
6488 if $test X"$prefix" != X"$installprefix"; then
6489         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6490 else
6491         installarchlib="$archlibexp"
6492 fi
6493
6494 : see if setuid scripts can be secure
6495 $cat <<EOM
6496
6497 Some kernels have a bug that prevents setuid #! scripts from being
6498 secure.  Some sites have disabled setuid #! scripts because of this.
6499
6500 First let's decide if your kernel supports secure setuid #! scripts.
6501 (If setuid #! scripts would be secure but have been disabled anyway,
6502 don't say that they are secure if asked.)
6503
6504 EOM
6505
6506 val="$undef"
6507 if $test -d /dev/fd; then
6508         echo "#!$ls" >reflect
6509         chmod +x,u+s reflect
6510         ./reflect >flect 2>&1
6511         if $contains "/dev/fd" flect >/dev/null; then
6512                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6513                 val="$define"
6514         else
6515                 $cat <<EOM
6516 If you are not sure if they are secure, I can check but I'll need a
6517 username and password different from the one you are using right now.
6518 If you don't have such a username or don't want me to test, simply
6519 enter 'none'.
6520
6521 EOM
6522                 rp='Other username to test security of setuid scripts with?'
6523                 dflt='none'
6524                 . ./myread
6525                 case "$ans" in
6526                 n|none)
6527                         case "$d_suidsafe" in
6528                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6529                                 dflt=n;;
6530                         "$undef")
6531                                 echo "Well, the $hint value is *not* secure." >&4
6532                                 dflt=n;;
6533                         *)      echo "Well, the $hint value *is* secure." >&4
6534                                 dflt=y;;
6535                         esac
6536                         ;;
6537                 *)
6538                         $rm -f reflect flect
6539                         echo "#!$ls" >reflect
6540                         chmod +x,u+s reflect
6541                         echo >flect
6542                         chmod a+w flect
6543                         echo '"su" will (probably) prompt you for '"$ans's password."
6544                         su $ans -c './reflect >flect'
6545                         if $contains "/dev/fd" flect >/dev/null; then
6546                                 echo "Okay, it looks like setuid scripts are secure." >&4
6547                                 dflt=y
6548                         else
6549                                 echo "I don't think setuid scripts are secure." >&4
6550                                 dflt=n
6551                         fi
6552                         ;;
6553                 esac
6554                 rp='Does your kernel have *secure* setuid scripts?'
6555                 . ./myread
6556                 case "$ans" in
6557                 [yY]*)  val="$define";;
6558                 *)      val="$undef";;
6559                 esac
6560         fi
6561 else
6562         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6563         echo "(That's for file descriptors, not floppy disks.)"
6564         val="$undef"
6565 fi
6566 set d_suidsafe
6567 eval $setvar
6568
6569 $rm -f reflect flect
6570
6571 : now see if they want to do setuid emulation
6572 echo " "
6573 val="$undef"
6574 case "$d_suidsafe" in
6575 "$define")
6576         val="$undef"
6577         echo "No need to emulate SUID scripts since they are secure here." >&4
6578         ;;
6579 *)
6580         $cat <<EOM
6581 Some systems have disabled setuid scripts, especially systems where
6582 setuid scripts cannot be secure.  On systems where setuid scripts have
6583 been disabled, the setuid/setgid bits on scripts are currently
6584 useless.  It is possible for $package to detect those bits and emulate
6585 setuid/setgid in a secure fashion.  This emulation will only work if
6586 setuid scripts have been disabled in your kernel.
6587
6588 EOM
6589         case "$d_dosuid" in
6590         "$define") dflt=y ;;
6591         *) dflt=n ;;
6592         esac
6593         rp="Do you want to do setuid/setgid emulation?"
6594         . ./myread
6595         case "$ans" in
6596         [yY]*)  val="$define";;
6597         *)      val="$undef";;
6598         esac
6599         ;;
6600 esac
6601 set d_dosuid
6602 eval $setvar
6603
6604 : see if this is a malloc.h system
6605 set malloc.h i_malloc
6606 eval $inhdr
6607
6608 : see if stdlib is available
6609 set stdlib.h i_stdlib
6610 eval $inhdr
6611
6612 : check for void type
6613 echo " "
6614 echo "Checking to see how well your C compiler groks the void type..." >&4
6615 case "$voidflags" in
6616 '')
6617         $cat >try.c <<'EOCP'
6618 #if TRY & 1
6619 void sub() {
6620 #else
6621 sub() {
6622 #endif
6623         extern void moo();      /* function returning void */
6624         void (*goo)();          /* ptr to func returning void */
6625 #if TRY & 8
6626         void *hue;              /* generic ptr */
6627 #endif
6628 #if TRY & 2
6629         void (*foo[10])();
6630 #endif
6631
6632 #if TRY & 4
6633         if(goo == moo) {
6634                 exit(0);
6635         }
6636 #endif
6637         exit(0);
6638 }
6639 int main() { sub(); }
6640 EOCP
6641         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6642                 voidflags=$defvoidused
6643         echo "Good.  It appears to support void to the level $package wants.">&4
6644                 if $contains warning .out >/dev/null 2>&1; then
6645                         echo "However, you might get some warnings that look like this:"
6646                         $cat .out
6647                 fi
6648         else
6649 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6650                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6651                         echo "It supports 1..."
6652                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6653                                 echo "It also supports 2..."
6654                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6655                                         voidflags=7
6656                                         echo "And it supports 4 but not 8 definitely."
6657                                 else
6658                                         echo "It doesn't support 4..."
6659                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6660                                                 voidflags=11
6661                                                 echo "But it supports 8."
6662                                         else
6663                                                 voidflags=3
6664                                                 echo "Neither does it support 8."
6665                                         fi
6666                                 fi
6667                         else
6668                                 echo "It does not support 2..."
6669                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6670                                         voidflags=13
6671                                         echo "But it supports 4 and 8."
6672                                 else
6673                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6674                                                 voidflags=5
6675                                                 echo "And it supports 4 but has not heard about 8."
6676                                         else
6677                                                 echo "However it supports 8 but not 4."
6678                                         fi
6679                                 fi
6680                         fi
6681                 else
6682                         echo "There is no support at all for void."
6683                         voidflags=0
6684                 fi
6685         fi
6686 esac
6687 case "$voidflags" in
6688 "$defvoidused") ;;
6689 *)      $cat >&4 <<'EOM'
6690   Support flag bits are:
6691     1: basic void declarations.
6692     2: arrays of pointers to functions returning void.
6693     4: operations between pointers to and addresses of void functions.
6694     8: generic void pointers.
6695 EOM
6696         dflt="$voidflags";
6697         rp="Your void support flags add up to what?"
6698         . ./myread
6699         voidflags="$ans"
6700         ;;
6701 esac
6702 $rm -f try.* .out
6703
6704 : check for length of pointer
6705 echo " "
6706 case "$ptrsize" in
6707 '')
6708         echo "Checking to see how big your pointers are..." >&4
6709         if test "$voidflags" -gt 7; then
6710                 echo '#define VOID_PTR char *' > try.c
6711         else
6712                 echo '#define VOID_PTR void *' > try.c
6713         fi
6714         $cat >>try.c <<'EOCP'
6715 #include <stdio.h>
6716 int main()
6717 {
6718     printf("%d\n", (int)sizeof(VOID_PTR));
6719     exit(0);
6720 }
6721 EOCP
6722         set try
6723         if eval $compile_ok; then
6724                 ptrsize=`$run ./try`
6725                 echo "Your pointers are $ptrsize bytes long."
6726         else
6727                 dflt='4'
6728                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6729                 rp="What is the size of a pointer (in bytes)?"
6730                 . ./myread
6731                 ptrsize="$ans"
6732         fi
6733         ;;
6734 esac
6735 $rm -f try.c try
6736 case "$use64bitall" in
6737 "$define"|true|[yY]*)
6738         case "$ptrsize" in
6739         4)      cat <<EOM >&4
6740
6741 *** You have chosen a maximally 64-bit build, but your pointers
6742 *** are only 4 bytes wide, disabling maximal 64-bitness.
6743
6744 EOM
6745                 use64bitall="$undef"
6746                 case "$use64bitint" in
6747                 "$define"|true|[yY]*) ;;
6748                 *)      cat <<EOM >&4
6749
6750 *** Downgrading from maximal 64-bitness to using 64-bit integers.
6751
6752 EOM
6753                         use64bitint="$define"
6754                         ;;
6755                 esac
6756                 ;;
6757         esac
6758         ;;
6759 esac
6760
6761
6762 : determine which malloc to compile in
6763 echo " "
6764 case "$usemymalloc" in
6765 [yY]*|true|$define)     dflt='y' ;;
6766 [nN]*|false|$undef)     dflt='n' ;;
6767 *)      case "$ptrsize" in
6768         4) dflt='y' ;;
6769         *) dflt='n' ;;
6770         esac
6771         ;;
6772 esac
6773 rp="Do you wish to attempt to use the malloc that comes with $package?"
6774 . ./myread
6775 usemymalloc="$ans"
6776 case "$ans" in
6777 y*|true)
6778         usemymalloc='y'
6779         mallocsrc='malloc.c'
6780         mallocobj="malloc$_o"
6781         d_mymalloc="$define"
6782         case "$libs" in
6783         *-lmalloc*)
6784                 : Remove malloc from list of libraries to use
6785                 echo "Removing unneeded -lmalloc from library list" >&4
6786                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6787                 shift
6788                 libs="$*"
6789                 echo "libs = $libs" >&4
6790                 ;;
6791         esac
6792         ;;
6793 *)
6794         usemymalloc='n'
6795         mallocsrc=''
6796         mallocobj=''
6797         d_mymalloc="$undef"
6798         ;;
6799 esac
6800
6801 : compute the return types of malloc and free
6802 echo " "
6803 $cat >malloc.c <<END
6804 #$i_malloc I_MALLOC
6805 #$i_stdlib I_STDLIB
6806 #include <stdio.h>
6807 #include <sys/types.h>
6808 #ifdef I_MALLOC
6809 #include <malloc.h>
6810 #endif
6811 #ifdef I_STDLIB
6812 #include <stdlib.h>
6813 #endif
6814 #ifdef TRY_MALLOC
6815 void *malloc();
6816 #endif
6817 #ifdef TRY_FREE
6818 void free();
6819 #endif
6820 END
6821 case "$malloctype" in
6822 '')
6823         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6824                 malloctype='void *'
6825         else
6826                 malloctype='char *'
6827         fi
6828         ;;
6829 esac
6830 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6831
6832 case "$freetype" in
6833 '')
6834         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6835                 freetype='void'
6836         else
6837                 freetype='int'
6838         fi
6839         ;;
6840 esac
6841 echo "Your system uses $freetype free(), it would seem." >&4
6842 $rm -f malloc.[co]
6843 $cat <<EOM
6844
6845 After $package is installed, you may wish to install various
6846 add-on modules and utilities.  Typically, these add-ons will
6847 be installed under $prefix with the rest
6848 of this package.  However, you may wish to install such add-ons
6849 elsewhere under a different prefix.
6850
6851 If you do not wish to put everything under a single prefix, that's
6852 ok.  You will be prompted for the individual locations; this siteprefix
6853 is only used to suggest the defaults.
6854
6855 The default should be fine for most people.
6856
6857 EOM
6858 fn=d~+
6859 rp='Installation prefix to use for add-on modules and utilities?'
6860 : XXX Here might be another good place for an installstyle setting.
6861 case "$siteprefix" in
6862 '') dflt=$prefix ;;
6863 *)  dflt=$siteprefix ;;
6864 esac
6865 . ./getfile
6866 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6867 oldsiteprefix=''
6868 case "$siteprefix" in
6869 '') ;;
6870 *)      case "$ans" in
6871         "$prefix") ;;
6872         *) oldsiteprefix="$prefix";;
6873         esac
6874         ;;
6875 esac
6876 siteprefix="$ans"
6877 siteprefixexp="$ansexp"
6878
6879 : determine where site specific libraries go.
6880 : Usual default is /usr/local/lib/perl5/site_perl/$version
6881 : The default "style" setting is made in installstyle.U
6882 : XXX No longer works with Prefixit stuff.
6883 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6884 case "$sitelib" in
6885 '') case "$installstyle" in
6886         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6887         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6888         esac
6889         ;;
6890 *)      dflt="$sitelib"
6891         ;;
6892 esac
6893 $cat <<EOM
6894
6895 The installation process will create a directory for
6896 site-specific extensions and modules.  Most users find it convenient
6897 to place all site-specific files in this directory rather than in the
6898 main distribution directory.
6899
6900 EOM
6901 fn=d~+
6902 rp='Pathname for the site-specific library files?'
6903 . ./getfile
6904 sitelib="$ans"
6905 sitelibexp="$ansexp"
6906 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6907 : Change installation prefix, if necessary.
6908 if $test X"$prefix" != X"$installprefix"; then
6909         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6910 else
6911         installsitelib="$sitelibexp"
6912 fi
6913
6914 : determine where site specific architecture-dependent libraries go.
6915 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6916 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6917 : sitelib may have an optional trailing /share.
6918 case "$sitearch" in
6919 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6920         dflt="$dflt/$archname"
6921         ;;
6922 *)      dflt="$sitearch"
6923         ;;
6924 esac
6925 set sitearch sitearch none
6926 eval $prefixit
6927 $cat <<EOM
6928
6929 The installation process will also create a directory for
6930 architecture-dependent site-specific extensions and modules.
6931
6932 EOM
6933 fn=d~+
6934 rp='Pathname for the site-specific architecture-dependent library files?'
6935 . ./getfile
6936 sitearch="$ans"
6937 sitearchexp="$ansexp"
6938 : Change installation prefix, if necessary.
6939 if $test X"$prefix" != X"$installprefix"; then
6940         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6941 else
6942         installsitearch="$sitearchexp"
6943 fi
6944
6945 $cat <<EOM
6946
6947 The installation process will also create a directory for
6948 vendor-supplied add-ons.  Vendors who supply perl with their system
6949 may find it convenient to place all vendor-supplied files in this
6950 directory rather than in the main distribution directory.  This will
6951 ease upgrades between binary-compatible maintenance versions of perl.
6952
6953 Of course you may also use these directories in whatever way you see
6954 fit.  For example, you might use them to access modules shared over a
6955 company-wide network.
6956
6957 The default answer should be fine for most people.
6958 This causes further questions about vendor add-ons to be skipped
6959 and no vendor-specific directories will be configured for perl.
6960
6961 EOM
6962 rp='Do you want to configure vendor-specific add-on directories?'
6963 case "$usevendorprefix" in
6964 define|true|[yY]*) dflt=y ;;
6965 *)      : User may have set vendorprefix directly on Configure command line.
6966         case "$vendorprefix" in
6967         ''|' ') dflt=n ;;
6968         *)      dflt=y ;;
6969         esac
6970         ;;
6971 esac
6972 . ./myread
6973 case "$ans" in
6974 [yY]*)  fn=d~+
6975         rp='Installation prefix to use for vendor-supplied add-ons?'
6976         case "$vendorprefix" in
6977         '') dflt='' ;;
6978         *)  dflt=$vendorprefix ;;
6979         esac
6980         . ./getfile
6981         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6982         oldvendorprefix=''
6983         case "$vendorprefix" in
6984         '') ;;
6985         *)      case "$ans" in
6986                 "$prefix") ;;
6987                 *) oldvendorprefix="$prefix";;
6988                 esac
6989                 ;;
6990         esac
6991         usevendorprefix="$define"
6992         vendorprefix="$ans"
6993         vendorprefixexp="$ansexp"
6994         ;;
6995 *)      usevendorprefix="$undef"
6996         vendorprefix=''
6997         vendorprefixexp=''
6998         ;;
6999 esac
7000
7001 case "$vendorprefix" in
7002 '')     d_vendorlib="$undef"
7003         vendorlib=''
7004         vendorlibexp=''
7005         ;;
7006 *)      d_vendorlib="$define"
7007         : determine where vendor-supplied modules go.
7008         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7009         case "$vendorlib" in
7010         '')
7011                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7012                 case "$installstyle" in
7013                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7014                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7015                 esac
7016                 ;;
7017         *)      dflt="$vendorlib"
7018                 ;;
7019         esac
7020         fn=d~+
7021         rp='Pathname for the vendor-supplied library files?'
7022         . ./getfile
7023         vendorlib="$ans"
7024         vendorlibexp="$ansexp"
7025         ;;
7026 esac
7027 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7028 : Change installation prefix, if necessary.
7029 if $test X"$prefix" != X"$installprefix"; then
7030         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
7031 else
7032         installvendorlib="$vendorlibexp"
7033 fi
7034
7035 case "$vendorprefix" in
7036 '')     d_vendorarch="$undef"
7037         vendorarch=''
7038         vendorarchexp=''
7039         ;;
7040 *)      d_vendorarch="$define"
7041         : determine where vendor-supplied architecture-dependent libraries go.
7042         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7043         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7044         : vendorlib may have an optional trailing /share.
7045         case "$vendorarch" in
7046         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7047                 dflt="$dflt/$archname"
7048                 ;;
7049         *)      dflt="$vendorarch" ;;
7050         esac
7051         fn=d~+
7052         rp='Pathname for vendor-supplied architecture-dependent files?'
7053         . ./getfile
7054         vendorarch="$ans"
7055         vendorarchexp="$ansexp"
7056         ;;
7057 esac
7058 : Change installation prefix, if necessary.
7059 if $test X"$prefix" != X"$installprefix"; then
7060         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
7061 else
7062         installvendorarch="$vendorarchexp"
7063 fi
7064
7065 : Final catch-all directories to search
7066 $cat <<EOM
7067
7068 Lastly, you can have perl look in other directories for extensions and
7069 modules in addition to those already specified.
7070 These directories will be searched after 
7071         $sitearch 
7072         $sitelib 
7073 EOM
7074 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7075 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7076 echo ' '
7077 case "$otherlibdirs" in
7078 ''|' ') dflt='none' ;;
7079 *)      dflt="$otherlibdirs" ;;
7080 esac
7081 $cat <<EOM
7082 Enter a colon-separated set of extra paths to include in perl's @INC
7083 search path, or enter 'none' for no extra paths.
7084
7085 EOM
7086
7087 rp='Colon-separated list of additional directories for perl to search?'
7088 . ./myread
7089 case "$ans" in
7090 ' '|''|none)    otherlibdirs=' ' ;;     
7091 *)      otherlibdirs="$ans" ;;
7092 esac
7093 case "$otherlibdirs" in
7094 ' ') val=$undef ;;
7095 *)      val=$define ;;
7096 esac
7097 set d_perl_otherlibdirs
7098 eval $setvar
7099
7100 : Cruising for prototypes
7101 echo " "
7102 echo "Checking out function prototypes..." >&4
7103 $cat >prototype.c <<'EOCP'
7104 int main(int argc, char *argv[]) {
7105         exit(0);}
7106 EOCP
7107 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7108         echo "Your C compiler appears to support function prototypes."
7109         val="$define"
7110 else
7111         echo "Your C compiler doesn't seem to understand function prototypes."
7112         val="$undef"
7113 fi
7114 set prototype
7115 eval $setvar
7116 $rm -f prototype*
7117
7118 case "$prototype" in
7119 "$define") ;;
7120 *)      ansi2knr='ansi2knr'
7121         echo " "
7122         cat <<EOM >&4
7123
7124 $me:  FATAL ERROR:
7125 This version of $package can only be compiled by a compiler that 
7126 understands function prototypes.  Unfortunately, your C compiler 
7127         $cc $ccflags
7128 doesn't seem to understand them.  Sorry about that.
7129
7130 If GNU cc is available for your system, perhaps you could try that instead.  
7131
7132 Eventually, we hope to support building Perl with pre-ANSI compilers.
7133 If you would like to help in that effort, please contact <perlbug@perl.org>.
7134
7135 Aborting Configure now.
7136 EOM
7137         exit 2
7138         ;;
7139 esac
7140
7141 : determine where public executables go
7142 echo " "
7143 set dflt bin bin
7144 eval $prefixit
7145 fn=d~
7146 rp='Pathname where the public executables will reside?'
7147 . ./getfile
7148 if $test "X$ansexp" != "X$binexp"; then
7149         installbin=''
7150 fi
7151 bin="$ans"
7152 binexp="$ansexp"
7153 : Change installation prefix, if necessary.
7154 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7155 if $test X"$prefix" != X"$installprefix"; then
7156         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
7157 else
7158         installbin="$binexp"
7159 fi
7160
7161 echo " "
7162 case "$extras" in
7163 '') dflt='n';;
7164 *) dflt='y';;
7165 esac
7166 cat <<EOM
7167 Perl can be built with extra modules or bundles of modules which
7168 will be fetched from the CPAN and installed alongside Perl.
7169
7170 Notice that you will need access to the CPAN; either via the Internet,
7171 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7172 be asked later to configure the CPAN.pm module which will in turn do
7173 the installation of the rest of the extra modules or bundles.)
7174
7175 Notice also that if the modules require any external software such as
7176 libraries and headers (the libz library and the zlib.h header for the
7177 Compress::Zlib module, for example) you MUST have any such software
7178 already installed, this configuration process will NOT install such
7179 things for you.
7180
7181 If this doesn't make any sense to you, just accept the default '$dflt'.
7182 EOM
7183 rp='Install any extra modules (y or n)?'
7184 . ./myread
7185 case "$ans" in
7186 y|Y)
7187         cat <<EOM
7188
7189 Please list any extra modules or bundles to be installed from CPAN,
7190 with spaces between the names.  The names can be in any format the
7191 'install' command of CPAN.pm will understand.  (Answer 'none',
7192 without the quotes, to install no extra modules or bundles.)
7193 EOM
7194         rp='Extras?'
7195         dflt="$extras"
7196         . ./myread
7197         extras="$ans"
7198 esac
7199 case "$extras" in
7200 ''|'none')
7201         val=''
7202         $rm -f ../extras.lst
7203         ;;
7204 *)      echo "(Saving the list of extras for later...)"
7205         echo "$extras" > ../extras.lst
7206         val="'$extras'"
7207         ;;
7208 esac
7209 set extras
7210 eval $setvar
7211 echo " "
7212
7213 : Find perl5.005 or later.
7214 echo "Looking for a previously installed perl5.005 or later... "
7215 case "$perl5" in
7216 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7217                 : Check if this perl is recent and can load a simple module
7218                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7219                         perl5=$tdir/perl
7220                         break;
7221                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7222                         perl5=$tdir/perl5
7223                         break;
7224                 fi
7225         done
7226         ;;
7227 *)      perl5="$perl5"
7228         ;;
7229 esac
7230 case "$perl5" in
7231 '')     echo "None found.  That's ok.";;
7232 *)      echo "Using $perl5." ;;
7233 esac
7234
7235 : Determine list of previous versions to include in @INC
7236 $cat > getverlist <<EOPL
7237 #!$perl5 -w
7238 use File::Basename;
7239 \$api_versionstring = "$api_versionstring";
7240 \$version = "$version";
7241 \$stem = "$sitelib_stem";
7242 \$archname = "$archname";
7243 EOPL
7244         $cat >> getverlist <<'EOPL'
7245 # Can't have leading @ because metaconfig interprets it as a command!
7246 ;@inc_version_list=();
7247 # XXX Redo to do opendir/readdir? 
7248 if (-d $stem) {
7249     chdir($stem);
7250     ;@candidates = glob("5.*");
7251 }
7252 else {
7253     ;@candidates = ();
7254 }
7255
7256 # XXX ToDo:  These comparisons must be reworked when two-digit
7257 # subversions come along, so that 5.7.10 compares as greater than
7258 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
7259 # widespread that we can use the built-in version vectors rather
7260 # than reinventing them here.  For 5.6.0, however, we must
7261 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
7262 foreach $d (@candidates) {
7263     if ($d lt $version) {
7264         if ($d ge $api_versionstring) {
7265             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
7266         }
7267         elsif ($d ge "5.005") {
7268             unshift(@inc_version_list, grep { -d } $d);
7269         }
7270     }
7271     else {
7272         # Skip newer version.  I.e. don't look in
7273         # 5.7.0 if we're installing 5.6.1.
7274     }
7275 }
7276
7277 if (@inc_version_list) {
7278     print join(' ', @inc_version_list);
7279 }
7280 else {
7281     # Blank space to preserve value for next Configure run.
7282     print " ";
7283 }
7284 EOPL
7285 chmod +x getverlist
7286 case "$inc_version_list" in
7287 '')     if test -x "$perl5$exe_ext"; then
7288                 dflt=`$perl5 getverlist`
7289         else
7290                 dflt='none'
7291         fi
7292         ;;
7293 $undef) dflt='none' ;;
7294 *)  eval dflt=\"$inc_version_list\" ;;
7295 esac
7296 case "$dflt" in
7297 ''|' ') dflt=none ;;
7298 esac
7299 case "$dflt" in
7300 5.005) dflt=none ;;
7301 esac
7302 $cat <<'EOM'
7303
7304 In order to ease the process of upgrading, this version of perl 
7305 can be configured to use modules built and installed with earlier 
7306 versions of perl that were installed under $prefix.  Specify here
7307 the list of earlier versions that this version of perl should check.
7308 If Configure detected no earlier versions of perl installed under
7309 $prefix, then the list will be empty.  Answer 'none' to tell perl
7310 to not search earlier versions.
7311
7312 The default should almost always be sensible, so if you're not sure,
7313 just accept the default.
7314 EOM
7315
7316 rp='List of earlier versions to include in @INC?'
7317 . ./myread
7318 case "$ans" in
7319 [Nn]one|''|' ') inc_version_list=' ' ;;
7320 *) inc_version_list="$ans" ;;
7321 esac
7322 case "$inc_version_list" in
7323 ''|' ') 
7324         inc_version_list_init='0';;
7325 *)      inc_version_list_init=`echo $inc_version_list |
7326                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7327         ;;
7328 esac
7329 $rm -f getverlist
7330
7331 : determine whether to install perl also as /usr/bin/perl
7332
7333 echo " "
7334 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7335         $cat <<EOM
7336 Many scripts expect perl to be installed as /usr/bin/perl.
7337 I can install the perl you are about to compile also as /usr/bin/perl
7338 (in addition to $installbin/perl).
7339 EOM
7340         case "$installusrbinperl" in
7341         "$undef"|[nN]*) dflt='n';;
7342         *)              dflt='y';;
7343         esac
7344         rp="Do you want to install perl as /usr/bin/perl?"
7345         . ./myread
7346         case "$ans" in
7347         [yY]*)  val="$define";;
7348         *)      val="$undef" ;;
7349         esac
7350 else
7351         val="$undef"
7352 fi
7353 set installusrbinperl
7354 eval $setvar
7355
7356 : see if dld is available
7357 set dld.h i_dld
7358 eval $inhdr
7359
7360 : see if dlopen exists
7361 xxx_runnm="$runnm"
7362 runnm=false
7363 set dlopen d_dlopen
7364 eval $inlibc
7365 runnm="$xxx_runnm"
7366
7367 : determine which dynamic loading, if any, to compile in
7368 echo " "
7369 dldir="ext/DynaLoader"
7370 case "$usedl" in
7371 $define|y|true)
7372         dflt='y'
7373         usedl="$define"
7374         ;;
7375 $undef|n|false)
7376         dflt='n'
7377         usedl="$undef"
7378         ;;
7379 *) 
7380         dflt='n'
7381         case "$d_dlopen" in
7382             $define) dflt='y' ;;
7383         esac
7384         case "$i_dld" in
7385             $define) dflt='y' ;;
7386         esac
7387         : Does a dl_xxx.xs file exist for this operating system
7388         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7389         ;;
7390 esac
7391 rp="Do you wish to use dynamic loading?"
7392 . ./myread
7393 usedl="$ans"
7394 case "$ans" in
7395 y*) usedl="$define"
7396         case "$dlsrc" in
7397         '')
7398                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7399                         dflt="$dldir/dl_${osname}.xs"
7400                 elif $test "$d_dlopen" = "$define" ; then
7401                         dflt="$dldir/dl_dlopen.xs"
7402                 elif $test "$i_dld" = "$define" ; then
7403                         dflt="$dldir/dl_dld.xs"
7404                 else
7405                         dflt=''
7406                 fi
7407                 ;;
7408         *)      dflt="$dldir/$dlsrc"
7409                 ;;
7410         esac
7411     echo "The following dynamic loading files are available:"
7412         : Can not go over to $dldir because getfile has path hard-coded in.
7413         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7414         rp="Source file to use for dynamic loading"
7415         fn="fne"
7416         gfpth="$src"
7417         . ./getfile
7418         usedl="$define"
7419         : emulate basename
7420         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7421
7422         $cat << EOM
7423
7424 Some systems may require passing special flags to $cc -c to
7425 compile modules that will be used to create a shared library.
7426 To use no flags, say "none".
7427
7428 EOM
7429     case "$cccdlflags" in
7430     '') case "$gccversion" in
7431                 '') case "$osname" in
7432                         hpux)   dflt='+z' ;;
7433                         next)   dflt='none' ;;
7434                         irix*)  dflt='-KPIC' ;;
7435                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7436                         sunos)  dflt='-pic' ;;
7437                         *)      dflt='none' ;;
7438                     esac
7439                         ;;
7440                 *)  case "$osname" in
7441                         darwin) dflt='none' ;;
7442                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7443                         *)      dflt='-fpic' ;;
7444                     esac ;;
7445             esac ;;
7446         ' ') dflt='none' ;;
7447     *)  dflt="$cccdlflags" ;;
7448     esac
7449     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7450     . ./myread
7451     case "$ans" in
7452     none) cccdlflags=' ' ;;
7453     *) cccdlflags="$ans" ;;
7454     esac
7455
7456     cat << EOM
7457
7458 Some systems use ld to create libraries that can be dynamically loaded,
7459 while other systems (such as those using ELF) use $cc.
7460
7461 EOM
7462         case "$ld" in
7463         '')     $cat >try.c <<'EOM'
7464 /* Test for whether ELF binaries are produced */
7465 #include <fcntl.h>
7466 #include <stdlib.h>
7467 int main() {
7468         char b[4];
7469         int i = open("a.out",O_RDONLY);
7470         if(i == -1) 
7471                 exit(1); /* fail */
7472         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7473                 exit(0); /* succeed (yes, it's ELF) */
7474         else
7475                 exit(1); /* fail */
7476 }
7477 EOM
7478                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7479                         cat <<EOM
7480 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7481 EOM
7482                         dflt="$cc"
7483                 else
7484                         echo "I'll use ld to build dynamic libraries."
7485                         dflt='ld'
7486                 fi
7487                 rm -f try.c a.out
7488                 ;;
7489         *)      dflt="$ld"
7490                 ;;
7491         esac
7492
7493     rp="What command should be used to create dynamic libraries?"
7494     . ./myread
7495         ld="$ans"
7496
7497     cat << EOM
7498
7499 Some systems may require passing special flags to $ld to create a
7500 library that can be dynamically loaded.  If your ld flags include
7501 -L/other/path options to locate libraries outside your loader's normal
7502 search path, you may need to specify those -L options here as well.  To
7503 use no flags, say "none".
7504
7505 EOM
7506     case "$lddlflags" in
7507     '') case "$osname" in
7508                         beos) dflt='-nostart' ;;
7509                         hpux) dflt='-b';
7510                               case "$gccversion" in
7511                               '') dflt="$dflt +vnocompatwarnings" ;;
7512                               esac
7513                               ;;        
7514                         linux|irix*)    dflt='-shared' ;;
7515                         next)  dflt='none' ;;
7516                         solaris) dflt='-G' ;;
7517                         sunos) dflt='-assert nodefinitions' ;;
7518                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7519                 *)     dflt='none' ;;
7520                         esac
7521                         ;;
7522     *) dflt="$lddlflags" ;;
7523     esac
7524
7525         : Try to guess additional flags to pick up local libraries.
7526         : Be careful not to append to a plain 'none'
7527         case "$dflt" in
7528         none) dflt='' ;;
7529         esac
7530         for thisflag in $ldflags; do
7531                 case "$thisflag" in
7532                 -L*|-R*|-Wl,-R*)
7533                         case " $dflt " in
7534                         *" $thisflag "*) ;;
7535                         *) dflt="$dflt $thisflag" ;;
7536                         esac
7537                         ;;
7538                 esac
7539         done
7540
7541         case "$dflt" in
7542         ''|' ') dflt='none' ;;
7543         esac
7544
7545     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7546     . ./myread
7547     case "$ans" in
7548     none) lddlflags=' ' ;;
7549     *) lddlflags="$ans" ;;
7550     esac
7551
7552         cat <<EOM
7553
7554 Some systems may require passing special flags to $cc to indicate that
7555 the resulting executable will use dynamic linking.  To use no flags,
7556 say "none".
7557
7558 EOM
7559     case "$ccdlflags" in
7560     '') case "$osname" in
7561                 hpux)   dflt='-Wl,-E' ;;
7562                 linux)  dflt='-rdynamic' ;;
7563                 next)   dflt='none' ;;
7564                 sunos)  dflt='none' ;;
7565                 *)      dflt='none' ;;
7566             esac ;;
7567     ' ')  dflt='none' ;;
7568     *)  dflt="$ccdlflags" ;;
7569     esac
7570     rp="Any special flags to pass to $cc to use dynamic linking?"
7571     . ./myread
7572     case "$ans" in
7573     none) ccdlflags=' ' ;;
7574     *) ccdlflags="$ans" ;;
7575     esac
7576     ;;
7577 *)  usedl="$undef"
7578         ld='ld'
7579     dlsrc='dl_none.xs'
7580     lddlflags=''
7581     ccdlflags=''
7582     ;;
7583 esac
7584
7585 also=''
7586 case "$usedl" in
7587 $undef)
7588         # No dynamic loading being used, so don't bother even to prompt.
7589         useshrplib='false'
7590         ;;
7591 *)      case "$useshrplib" in
7592         '')     case "$osname" in
7593                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7594                         dflt=y
7595                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7596                         ;;
7597                 next*)
7598                         case "$osvers" in
7599                         4*)     dflt=y
7600                                 also='Building a shared libperl is needed for MAB support.'
7601                                 ;;
7602                         *)      dflt=n
7603                                 ;;
7604                         esac
7605                         ;;
7606                 *)      dflt=n
7607                         ;;
7608                 esac
7609                 ;;
7610         $define|true|[Yy]*)
7611                 dflt=y
7612                 ;;
7613         *)      dflt=n
7614                 ;;
7615         esac
7616         $cat << EOM
7617
7618 The perl executable is normally obtained by linking perlmain.c with
7619 libperl${_a}, any static extensions (usually just DynaLoader), and
7620 any other libraries needed on this system (such as -lm, etc.).  Since
7621 your system supports dynamic loading, it is probably possible to build
7622 a shared libperl.$so.  If you will have more than one executable linked
7623 to libperl.$so, this will significantly reduce the size of each
7624 executable, but it may have a noticeable affect on performance.  The
7625 default is probably sensible for your system.
7626 $also
7627
7628 EOM
7629         rp="Build a shared libperl.$so (y/n)"
7630         . ./myread
7631         case "$ans" in
7632         true|$define|[Yy]*)
7633                 useshrplib='true'  ;;
7634         *)      useshrplib='false' ;;
7635         esac
7636         ;;
7637 esac
7638
7639 case "$useshrplib" in
7640 true)
7641         case "$libperl" in
7642         '')
7643                 # Figure out a good name for libperl.so.  Since it gets stored in
7644                 # a version-specific architecture-dependent library, the version
7645                 # number isn't really that important, except for making cc/ld happy.
7646                 #
7647                 # A name such as libperl.so.3.1
7648                 majmin="libperl.$so.$patchlevel.$subversion"
7649                 # A name such as libperl.so.301
7650                 majonly=`echo $patchlevel $subversion |
7651                         $awk '{printf "%d%02d", $1, $2}'`
7652                 majonly=libperl.$so.$majonly
7653                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7654                 # rely on figuring it out from the naming of libc.
7655                 case "${osname}${osvers}" in
7656                 next4*)
7657                         dflt=libperl.5.$so
7658                         # XXX How handle the --version stuff for MAB?
7659                         ;;
7660                 linux*)  # ld won't link with a bare -lperl otherwise.
7661                         dflt=libperl.$so
7662                         ;;
7663                 cygwin*) # ld links against an importlib
7664                         dflt=libperl$lib_ext
7665                         ;;
7666                 *)      # Try to guess based on whether libc has major.minor.
7667                         case "$libc" in
7668                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7669                         *libc.$so.[0-9]*) dflt=$majonly ;;
7670                         *)      dflt=libperl.$so ;;
7671                         esac
7672                         ;;
7673                 esac
7674                 ;;
7675         *)      dflt=$libperl
7676                 ;;
7677         esac
7678         cat << EOM
7679
7680 I need to select a good name for the shared libperl.  If your system uses
7681 library names with major and minor numbers, then you might want something
7682 like $majmin.  Alternatively, if your system uses a single version
7683 number for shared libraries, then you might want to use $majonly.
7684 Or, your system might be quite happy with a simple libperl.$so.
7685
7686 Since the shared libperl will get installed into a version-specific
7687 architecture-dependent directory, the version number of the shared perl
7688 library probably isn't important, so the default should be o.k.
7689
7690 EOM
7691         rp='What name do you want to give to the shared libperl?'
7692         . ./myread
7693         libperl=$ans
7694         echo "Ok, I'll use $libperl"
7695         ;;
7696 *)
7697         libperl="libperl${_a}"
7698         ;;
7699 esac
7700
7701 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7702 case "$shrpdir" in
7703 '') ;;
7704 *)      $cat >&4 <<EOM
7705 WARNING:  Use of the shrpdir variable for the installation location of
7706 the shared $libperl is not supported.  It was never documented and
7707 will not work in this version.  Let me (perlbug@perl.org)
7708 know of any problems this may cause.
7709
7710 EOM
7711         case "$shrpdir" in
7712         "$archlibexp/CORE")
7713                 $cat >&4 <<EOM
7714 But your current setting of $shrpdir is
7715 the default anyway, so it's harmless.
7716 EOM
7717                 ;;
7718         *)
7719                 $cat >&4 <<EOM
7720 Further, your current attempted setting of $shrpdir
7721 conflicts with the value of $archlibexp/CORE
7722 that installperl will use.
7723 EOM
7724                 ;;
7725         esac
7726         ;;
7727 esac
7728
7729 # How will the perl executable find the installed shared $libperl?
7730 # Add $xxx to ccdlflags.
7731 # If we can't figure out a command-line option, use $shrpenv to
7732 # set env LD_RUN_PATH.  The main perl makefile uses this.
7733 shrpdir=$archlibexp/CORE
7734 xxx=''
7735 tmp_shrpenv=''
7736 if "$useshrplib"; then
7737     case "$osname" in 
7738         aix)
7739                 # We'll set it in Makefile.SH...
7740                 ;;
7741         solaris)
7742                 xxx="-R $shrpdir"
7743                 ;;
7744         freebsd|netbsd)
7745                 xxx="-Wl,-R$shrpdir"
7746                 ;;
7747         bsdos|linux|irix*|dec_osf)
7748                 xxx="-Wl,-rpath,$shrpdir"
7749                 ;;
7750         next)
7751                 # next doesn't like the default...
7752                 ;;
7753         beos)
7754                 # beos doesn't like the default, either.
7755                 ;;
7756         hpux*)
7757                 # hpux doesn't like the default, either.
7758                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7759                 ;;
7760         *)
7761                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7762                 ;;
7763         esac
7764         case "$xxx" in
7765         '') ;;
7766         *)      
7767                 # Only add $xxx if it isn't already in ccdlflags.
7768                 case " $ccdlflags " in
7769                 *" $xxx "*)     ;;
7770                 *)      ccdlflags="$ccdlflags $xxx"
7771                         cat <<EOM >&4
7772
7773 Adding $xxx to the flags
7774 passed to $ld so that the perl executable will find the 
7775 installed shared $libperl.
7776
7777 EOM
7778                         ;;
7779                 esac
7780                 ;;
7781         esac
7782 fi
7783 # Fix ccdlflags in AIX for building external extensions.
7784 # (For building Perl itself bare -bE:perl.exp is needed,
7785 #  Makefile.SH takes care of this.)
7786 case "$osname" in
7787 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7788 esac
7789 # Respect a hint or command-line value.
7790 case "$shrpenv" in
7791 '') shrpenv="$tmp_shrpenv" ;;
7792 esac
7793 case "$ldlibpthname" in
7794 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7795 none)   ldlibpthname='' ;;
7796 esac
7797
7798 : determine where manual pages are on this system
7799 echo " "
7800 case "$sysman" in
7801 '') 
7802         syspath='/usr/share/man/man1 /usr/man/man1'
7803         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7804         syspath="$syspath /usr/man/u_man/man1"
7805         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7806         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7807         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7808         sysman=`./loc . /usr/man/man1 $syspath`
7809         ;;
7810 esac
7811 if $test -d "$sysman"; then
7812         echo "System manual is in $sysman." >&4
7813 else
7814         echo "Could not find manual pages in source form." >&4
7815 fi
7816
7817 : determine where manual pages go
7818 set man1dir man1dir none
7819 eval $prefixit
7820 $cat <<EOM
7821
7822 $spackage has manual pages available in source form.
7823 EOM
7824 case "$nroff" in
7825 nroff)
7826         echo "However, you don't have nroff, so they're probably useless to you."
7827         case "$man1dir" in
7828         '') man1dir="none";;
7829         esac;;
7830 esac
7831 echo "If you don't want the manual sources installed, answer 'none'."
7832 case "$man1dir" in
7833 ' ') dflt=none
7834         ;;
7835 '')
7836         lookpath="$prefixexp/share/man/man1"
7837         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7838         lookpath="$lookpath $prefixexp/man/p_man/man1"
7839         lookpath="$lookpath $prefixexp/man/u_man/man1"
7840         lookpath="$lookpath $prefixexp/man/man.1"
7841         case "$sysman" in
7842         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7843         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7844         esac
7845         set dflt
7846         eval $prefixup
7847         ;;
7848 *)  dflt="$man1dir"
7849         ;;
7850 esac
7851 echo " "
7852 fn=dn+~
7853 rp="Where do the main $spackage manual pages (source) go?"
7854 . ./getfile
7855 if $test "X$man1direxp" != "X$ansexp"; then
7856         installman1dir=''
7857 fi
7858 man1dir="$ans"
7859 man1direxp="$ansexp"
7860 case "$man1dir" in
7861 '')     man1dir=' '
7862         installman1dir='';;
7863 esac
7864
7865 : Change installation prefix, if necessary.
7866 if $test X"$prefix" != X"$installprefix"; then
7867         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7868 else
7869         installman1dir="$man1direxp"
7870 fi
7871
7872 : What suffix to use on installed man pages
7873
7874 case "$man1dir" in
7875 ' ')
7876         man1ext='0'
7877         ;;
7878 *)
7879         rp="What suffix should be used for the main $spackage man pages?"
7880         case "$man1ext" in
7881         '')     case "$man1dir" in
7882                 *1)  dflt=1 ;;
7883                 *1p) dflt=1p ;;
7884                 *1pm) dflt=1pm ;;
7885                 *l) dflt=l;;
7886                 *n) dflt=n;;
7887                 *o) dflt=o;;
7888                 *p) dflt=p;;
7889                 *C) dflt=C;;
7890                 *L) dflt=L;;
7891                 *L1) dflt=L1;;
7892                 *) dflt=1;;
7893                 esac
7894                 ;;
7895         *)      dflt="$man1ext";;
7896         esac
7897         . ./myread
7898         man1ext="$ans"
7899         ;;
7900 esac
7901
7902 : see if we can have long filenames
7903 echo " "
7904 first=123456789abcdef
7905 $rm -f $first
7906 if (echo hi >$first) 2>/dev/null; then
7907         if $test -f 123456789abcde; then
7908                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
7909                 val="$undef"
7910         else
7911                 echo 'You can have filenames longer than 14 characters.'>&4
7912                 val="$define"
7913         fi
7914 else
7915         $cat <<'EOM'
7916 You can't have filenames longer than 14 chars.
7917 You can't even think about them!
7918 EOM
7919         val="$undef"
7920 fi 
7921 set d_flexfnam
7922 eval $setvar
7923 $rm -rf 123456789abcde*
7924
7925 : determine where library module manual pages go
7926 set man3dir man3dir none
7927 eval $prefixit
7928 $cat <<EOM
7929
7930 $spackage has manual pages for many of the library modules.
7931 EOM
7932
7933 case "$nroff" in
7934 nroff)
7935         $cat <<'EOM'
7936 However, you don't have nroff, so they're probably useless to you.
7937 EOM
7938         case "$man3dir" in
7939         '') man3dir="none";;
7940         esac;;
7941 esac
7942
7943 case "$d_flexfnam" in
7944 undef)
7945         $cat <<'EOM'
7946 However, your system can't handle the long file names like File::Basename.3. 
7947 EOM
7948         case "$man3dir" in
7949         '') man3dir="none";;
7950         esac;;
7951 esac
7952
7953 echo "If you don't want the manual sources installed, answer 'none'."
7954 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7955 case "$man3dir" in
7956 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7957         if $test -d "$privlib/man/man3"; then
7958                 cat <<EOM >&4
7959
7960 WARNING:  Previous versions of perl installed man3 pages into
7961 $privlib/man/man3.  This version will suggest a 
7962 new default of $dflt.  
7963 EOM
7964                 tdflt=$dflt
7965                 dflt='n'
7966                 rp='Do you wish to preserve the old behavior?(y/n)'
7967                 . ./myread
7968                 case "$ans" in
7969                 y*) dflt="$privlib/man/man3" ;;
7970                 *)  dflt=$tdflt ;;
7971                 esac
7972     fi
7973         ;;
7974 *)      dflt="$man3dir" ;;
7975 esac
7976 case "$dflt" in
7977 ' ') dflt=none ;;
7978 esac
7979 echo " "
7980 fn=dn+~
7981 rp="Where do the $package library man pages (source) go?"
7982 . ./getfile
7983 man3dir="$ans"
7984 man3direxp="$ansexp"
7985 case "$man3dir" in
7986 '')     man3dir=' '
7987         installman3dir='';;
7988 esac
7989
7990 : Change installation prefix, if necessary.
7991 if $test X"$prefix" != X"$installprefix"; then
7992         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7993 else
7994         installman3dir="$man3direxp"
7995 fi
7996
7997 : What suffix to use on installed man pages
7998 case "$man3dir" in
7999 ' ')
8000         man3ext='0'
8001         ;;
8002 *)
8003         rp="What suffix should be used for the $package library man pages?"
8004         case "$man3ext" in
8005         '')     case "$man3dir" in
8006                 *3)  dflt=3 ;;
8007                 *3p) dflt=3p ;;
8008                 *3pm) dflt=3pm ;;
8009                 *l) dflt=l;;
8010                 *n) dflt=n;;
8011                 *o) dflt=o;;
8012                 *p) dflt=p;;
8013                 *C) dflt=C;;
8014                 *L) dflt=L;;
8015                 *L3) dflt=L3;;
8016                 *) dflt=3;;
8017                 esac
8018                 ;;
8019         *)      dflt="$man3ext";;
8020         esac
8021         . ./myread
8022         man3ext="$ans"
8023         ;;
8024 esac
8025
8026 : see if we have to deal with yellow pages, now NIS.
8027 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8028         if $test -f /usr/etc/nibindd; then
8029                 echo " "
8030                 echo "I'm fairly confident you're on a NeXT."
8031                 echo " "
8032                 rp='Do you get the hosts file via NetInfo?'
8033                 dflt=y
8034                 case "$hostcat" in
8035                 nidump*) ;;
8036                 '') ;;
8037                 *) dflt=n;;
8038                 esac
8039                 . ./myread
8040                 case "$ans" in
8041                 y*) hostcat='nidump hosts .';;
8042                 *)      case "$hostcat" in
8043                         nidump*) hostcat='';;
8044                         esac
8045                         ;;
8046                 esac
8047         fi
8048         case "$hostcat" in
8049         nidump*) ;;
8050         *)
8051                 case "$hostcat" in
8052                 *ypcat*) dflt=y;;
8053                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8054                                 dflt=y
8055                         else
8056                                 dflt=n
8057                         fi;;
8058                 *) dflt=n;;
8059                 esac
8060                 echo " "
8061                 rp='Are you getting the hosts file via yellow pages?'
8062                 . ./myread
8063                 case "$ans" in
8064                 y*) hostcat='ypcat hosts';;
8065                 *) hostcat='cat /etc/hosts';;
8066                 esac
8067                 ;;
8068         esac
8069 fi
8070 case "$hostcat" in
8071 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8072 esac
8073 case "$groupcat" in
8074 '') test -f /etc/group && groupcat='cat /etc/group';;
8075 esac
8076 case "$passcat" in
8077 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8078 esac
8079
8080 : now get the host name
8081 echo " "
8082 echo "Figuring out host name..." >&4
8083 case "$myhostname" in
8084 '') cont=true
8085         echo 'Maybe "hostname" will work...'
8086         if tans=`sh -c hostname 2>&1` ; then
8087                 myhostname=$tans
8088                 phostname=hostname
8089                 cont=''
8090         fi
8091         ;;
8092 *) cont='';;
8093 esac
8094 if $test "$cont"; then
8095         if ./xenix; then
8096                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8097                 if tans=`cat /etc/systemid 2>&1` ; then
8098                         myhostname=$tans
8099                         phostname='cat /etc/systemid'
8100                         echo "Whadyaknow.  Xenix always was a bit strange..."
8101                         cont=''
8102                 fi
8103         elif $test -r /etc/systemid; then
8104                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8105         fi
8106 fi
8107 if $test "$cont"; then
8108         echo 'No, maybe "uuname -l" will work...'
8109         if tans=`sh -c 'uuname -l' 2>&1` ; then
8110                 myhostname=$tans
8111                 phostname='uuname -l'
8112         else
8113                 echo 'Strange.  Maybe "uname -n" will work...'
8114                 if tans=`sh -c 'uname -n' 2>&1` ; then
8115                         myhostname=$tans
8116                         phostname='uname -n'
8117                 else
8118                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8119                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8120                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8121                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8122                         else
8123                                 case "$myhostname" in
8124                                 '') echo "Does this machine have an identity crisis or something?"
8125                                         phostname='';;
8126                                 *)
8127                                         echo "Well, you said $myhostname before..."
8128                                         phostname='echo $myhostname';;
8129                                 esac
8130                         fi
8131                 fi
8132         fi
8133 fi
8134 case "$myhostname" in
8135 '') myhostname=noname ;;
8136 esac
8137 : you do not want to know about this
8138 set $myhostname
8139 myhostname=$1
8140
8141 : verify guess
8142 if $test "$myhostname" ; then
8143         dflt=y
8144         rp='Your host name appears to be "'$myhostname'".'" Right?"
8145         . ./myread
8146         case "$ans" in
8147         y*) ;;
8148         *) myhostname='';;
8149         esac
8150 fi
8151
8152 : bad guess or no guess
8153 while $test "X$myhostname" = X ; do
8154         dflt=''
8155         rp="Please type the (one word) name of your host:"
8156         . ./myread
8157         myhostname="$ans"
8158 done
8159
8160 : translate upper to lower if necessary
8161 case "$myhostname" in
8162 *[A-Z]*)
8163         echo "(Normalizing case in your host name)"
8164         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8165         ;;
8166 esac
8167
8168 case "$myhostname" in
8169 *.*)
8170         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8171         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8172         echo "(Trimming domain name from host name--host name is now $myhostname)"
8173         ;;
8174 *) case "$mydomain" in
8175         '')
8176                 {
8177                         test "X$hostcat" = "Xypcat hosts" &&
8178                         ypmatch "$myhostname" hosts 2>/dev/null |\
8179                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8180                         $test -s hosts
8181                 } || {
8182                         test "X$hostcat" != "X" &&
8183                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8184                                         /[       ]$myhostname[  . ]/p" > hosts
8185                 }
8186                 tmp_re="[       . ]"
8187                 if $test -f hosts; then
8188                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8189                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8190                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8191                                 hosts | $sort | $uniq | \
8192                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8193                         case `$echo X$dflt` in
8194                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8195                                 dflt=.
8196                                 ;;
8197                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8198                                 ;;
8199                         esac
8200                 else
8201                         echo "(I cannot locate a hosts database anywhere)"
8202                         dflt=.
8203                 fi
8204                 case "$dflt" in
8205                 .)
8206                         tans=`./loc resolv.conf X /etc /usr/etc`
8207                         if $test -f "$tans"; then
8208                                 echo "(Attempting domain name extraction from $tans)"
8209                                 dflt=.`$sed -n -e 's/   / /g' \
8210                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8211                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8212                                 case "$dflt" in
8213                                 .) dflt=.`$sed -n -e 's/        / /g' \
8214                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8215                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8216                                         ;;
8217                                 esac
8218                         fi
8219                         ;;
8220                 esac
8221                 case "$dflt" in
8222                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8223                         dflt=.`sh -c domainname 2>/dev/null`
8224                         case "$dflt" in
8225                         '') dflt='.';;
8226                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8227                         esac
8228                         ;;
8229                 esac
8230                 case "$dflt$osname" in
8231                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8232                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8233                         ;;
8234                 esac
8235                 case "$dflt" in
8236                 .) echo "(Lost all hope -- silly guess then)"
8237                         dflt='.nonet'
8238                         ;;
8239                 esac
8240                 $rm -f hosts
8241                 ;;
8242         *) dflt="$mydomain";;
8243         esac;;
8244 esac
8245 echo " "
8246 rp="What is your domain name?"
8247 . ./myread
8248 tans="$ans"
8249 case "$ans" in
8250 '') ;;
8251 .*) ;;
8252 *) tans=".$tans";;
8253 esac
8254 mydomain="$tans"
8255
8256 : translate upper to lower if necessary
8257 case "$mydomain" in
8258 *[A-Z]*)
8259         echo "(Normalizing case in your domain name)"
8260         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8261         ;;
8262 esac
8263
8264 : a little sanity check here
8265 case "$phostname" in
8266 '') ;;
8267 *)
8268         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8269         $myhostname$mydomain|$myhostname) ;;
8270         *)
8271                 case "$phostname" in
8272                 sed*)
8273                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8274                         ;;
8275                 *)
8276                         echo "(That doesn't agree with your $phostname command, by the way.)"
8277                         ;;
8278                 esac
8279         ;;
8280         esac
8281         ;;
8282 esac
8283
8284 $cat <<EOM
8285
8286 I need to get your e-mail address in Internet format if possible, i.e.
8287 something like user@host.domain. Please answer accurately since I have
8288 no easy means to double check it. The default value provided below
8289 is most probably close to reality but may not be valid from outside
8290 your organization...
8291
8292 EOM
8293 cont=x
8294 while test "$cont"; do
8295         case "$cf_email" in
8296         '') dflt="$cf_by@$myhostname$mydomain";;
8297         *) dflt="$cf_email";;
8298         esac
8299         rp='What is your e-mail address?'
8300         . ./myread
8301         cf_email="$ans"
8302         case "$cf_email" in
8303         *@*.*) cont='' ;;
8304         *)
8305                 rp='Address does not look like an Internet one.  Use it anyway?'
8306                 case "$fastread" in
8307                 yes) dflt=y ;;
8308                 *) dflt=n ;;
8309                 esac
8310                 . ./myread
8311                 case "$ans" in
8312                 y*) cont='' ;;
8313                 *) echo " " ;;
8314                 esac
8315                 ;;
8316         esac
8317 done
8318
8319 $cat <<EOM
8320
8321 If you or somebody else will be maintaining perl at your site, please
8322 fill in the correct e-mail address here so that they may be contacted
8323 if necessary. Currently, the "perlbug" program included with perl
8324 will send mail to this address in addition to perlbug@perl.org. You may
8325 enter "none" for no administrator.
8326
8327 EOM
8328 case "$perladmin" in
8329 '') dflt="$cf_email";;
8330 *) dflt="$perladmin";;
8331 esac
8332 rp='Perl administrator e-mail address'
8333 . ./myread
8334 perladmin="$ans"
8335
8336 : determine whether to only install version-specific parts.
8337 echo " "
8338 $cat <<EOM
8339 Do you want to install only the version-specific parts of the perl
8340 distribution?  Usually you do *not* want to do this.
8341 EOM
8342 case "$versiononly" in
8343 "$define"|[Yy]*|true) dflt='y' ;;
8344 *) dflt='n';
8345 esac
8346 rp="Do you want to install only the version-specific parts of perl?"
8347 . ./myread
8348 case "$ans" in
8349 [yY]*)  val="$define";;
8350 *)      val="$undef" ;;
8351 esac
8352 set versiononly
8353 eval $setvar
8354
8355 case "$versiononly" in
8356 "$define") inc_version_list=''
8357            inc_version_list_init=0
8358            ;;
8359 esac
8360
8361 : figure out how to guarantee perl startup
8362 case "$startperl" in
8363 '')
8364         case "$sharpbang" in
8365         *!)
8366                 $cat <<EOH
8367
8368 I can use the #! construct to start perl on your system. This will
8369 make startup of perl scripts faster, but may cause problems if you
8370 want to share those scripts and perl is not in a standard place
8371 ($binexp/perl) on all your platforms. The alternative is to force
8372 a shell by starting the script with a single ':' character.
8373
8374 EOH
8375                 case "$versiononly" in
8376                 "$define")      dflt="$binexp/perl$version";;  
8377                 *)              dflt="$binexp/perl";;
8378                 esac
8379                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8380                 . ./myread
8381                 case "$ans" in
8382                 none)   startperl=": # use perl";;
8383                 *)      startperl="#!$ans"
8384                         if $test 30 -lt `echo "$ans" | wc -c`; then
8385                                 $cat >&4 <<EOM
8386
8387 WARNING:  Some systems limit the #! command to 32 characters.
8388 If you experience difficulty running Perl scripts with #!, try
8389 installing Perl in a directory with a shorter pathname.
8390
8391 EOM
8392                         fi ;;
8393                 esac
8394                 ;;
8395         *) startperl=": # use perl"
8396                 ;;
8397         esac
8398         ;;
8399 esac
8400 echo "I'll use $startperl to start perl scripts."
8401
8402 : figure best path for perl in scripts
8403 case "$perlpath" in
8404 '')
8405         case "$versiononly" in
8406         "$define")      perlpath="$binexp/perl$version";;
8407         *)              perlpath="$binexp/perl";;
8408         esac
8409         case "$startperl" in
8410         *!*) ;;
8411         *)
8412                 $cat <<EOH
8413
8414 I will use the "eval 'exec'" idiom to start Perl on your system.
8415 I can use the full path of your Perl binary for this purpose, but
8416 doing so may cause problems if you want to share those scripts and
8417 Perl is not always in a standard place ($binexp/perl).
8418
8419 EOH
8420                 dflt="$binexp/perl"
8421                 rp="What path shall I use in \"eval 'exec'\"?"
8422                 . ./myread
8423                 perlpath="$ans"
8424                 ;;
8425         esac
8426         ;;
8427 esac
8428 case "$startperl" in
8429 *!*)    ;;
8430 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8431 esac
8432
8433 : determine where public executable scripts go
8434 set scriptdir scriptdir
8435 eval $prefixit
8436 case "$scriptdir" in
8437 '')
8438         dflt="$bin"
8439         : guess some guesses
8440         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8441         $test -d /usr/share/bin     && dflt=/usr/share/bin
8442         $test -d /usr/local/script  && dflt=/usr/local/script
8443         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8444         $test -d $prefixexp/script  && dflt=$prefixexp/script
8445         set dflt
8446         eval $prefixup
8447         ;;
8448 *)  dflt="$scriptdir"
8449         ;;
8450 esac
8451 $cat <<EOM
8452  
8453 Some installations have a separate directory just for executable scripts so
8454 that they can mount it across multiple architectures but keep the scripts in
8455 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8456 Or you might just lump your scripts in with all your other executables.
8457  
8458 EOM
8459 fn=d~
8460 rp='Where do you keep publicly executable scripts?'
8461 . ./getfile
8462 if $test "X$ansexp" != "X$scriptdirexp"; then
8463         installscript=''
8464 fi
8465 scriptdir="$ans"
8466 scriptdirexp="$ansexp"
8467 : Change installation prefix, if necessary.
8468 if $test X"$prefix" != X"$installprefix"; then
8469         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8470 else
8471         installscript="$scriptdirexp"
8472 fi
8473
8474 : determine where add-on public executables go
8475 case "$sitebin" in
8476 '')     dflt=$siteprefix/bin ;;
8477 *)      dflt=$sitebin ;;
8478 esac
8479 fn=d~
8480 rp='Pathname where the add-on public executables should be installed?'
8481 . ./getfile
8482 sitebin="$ans"
8483 sitebinexp="$ansexp"
8484 : Change installation prefix, if necessary.
8485 if $test X"$prefix" != X"$installprefix"; then
8486         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8487 else
8488         installsitebin="$sitebinexp"
8489 fi
8490
8491 : define an is-a-typedef? function
8492 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8493 case "$inclist" in
8494 "") inclist="sys/types.h";;
8495 esac;
8496 eval "varval=\$$var";
8497 case "$varval" in
8498 "")
8499         $rm -f temp.c;
8500         for inc in $inclist; do
8501                 echo "#include <$inc>" >>temp.c;
8502         done;
8503         echo "#ifdef $type" >> temp.c;
8504         echo "printf(\"We have $type\");" >> temp.c;
8505         echo "#endif" >> temp.c;
8506         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8507         if $contains $type temp.E >/dev/null 2>&1; then
8508                 eval "$var=\$type";
8509         else
8510                 eval "$var=\$def";
8511         fi;
8512         $rm -f temp.?;;
8513 *) eval "$var=\$varval";;
8514 esac'
8515
8516 : define an is-a-typedef? function that prompts if the type is not available.
8517 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8518 case "$inclist" in
8519 "") inclist="sys/types.h";;
8520 esac;
8521 eval "varval=\$$var";
8522 case "$varval" in
8523 "")
8524         $rm -f temp.c;
8525         for inc in $inclist; do
8526                 echo "#include <$inc>" >>temp.c;
8527         done;
8528         echo "#ifdef $type" >> temp.c;
8529         echo "printf(\"We have $type\");" >> temp.c;
8530         echo "#endif" >> temp.c;
8531         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8532         echo " " ;
8533         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8534         if $contains $type temp.E >/dev/null 2>&1; then
8535                 echo "$type found." >&4;
8536                 eval "$var=\$type";
8537         else
8538                 echo "$type NOT found." >&4;
8539                 dflt="$def";
8540                 . ./myread ;
8541                 eval "$var=\$ans";
8542         fi;
8543         $rm -f temp.?;;
8544 *) eval "$var=\$varval";;
8545 esac'
8546
8547 : see what type lseek is declared as in the kernel
8548 rp="What is the type used for lseek's offset on this system?"
8549 set off_t lseektype long stdio.h sys/types.h
8550 eval $typedef_ask
8551
8552 echo " "
8553 echo "Checking to see how big your file offsets are..." >&4
8554 $cat >try.c <<EOCP
8555 #include <sys/types.h>
8556 #include <stdio.h>
8557 int main()
8558 {
8559     printf("%d\n", (int)sizeof($lseektype));
8560     return(0); 
8561 }
8562 EOCP
8563 set try
8564 if eval $compile_ok; then
8565         lseeksize=`$run ./try`
8566         echo "Your file offsets are $lseeksize bytes long."
8567 else
8568         dflt=$longsize
8569         echo " "
8570         echo "(I can't seem to compile the test program.  Guessing...)"
8571         rp="What is the size of your file offsets (in bytes)?"
8572         . ./myread
8573         lseeksize="$ans"
8574 fi
8575 $rm -f try.c try
8576
8577 : see what type file positions are declared as in the library
8578 rp="What is the type for file position used by fsetpos()?"
8579 set fpos_t fpostype long stdio.h sys/types.h
8580 eval $typedef_ask
8581
8582 echo " "
8583 case "$fpostype" in
8584 *_t) zzz="$fpostype"    ;;
8585 *)   zzz="fpos_t"       ;;
8586 esac
8587 echo "Checking the size of $zzz..." >&4 
8588 cat > try.c <<EOCP
8589 #include <sys/types.h>
8590 #include <stdio.h>
8591 int main() {
8592     printf("%d\n", (int)sizeof($fpostype));
8593     exit(0);
8594 }
8595 EOCP
8596 set try
8597 if eval $compile_ok; then
8598         yyy=`$run ./try`
8599         case "$yyy" in
8600         '')     fpossize=4
8601                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8602                 ;;
8603         *)      fpossize=$yyy
8604                 echo "Your $zzz is $fpossize bytes long."
8605                 ;;
8606         esac
8607 else
8608         dflt="$longsize"
8609         echo " " >&4
8610         echo "(I can't compile the test program.  Guessing...)" >&4
8611         rp="What is the size of your file positions (in bytes)?"
8612         . ./myread
8613         fpossize="$ans"
8614 fi
8615
8616
8617
8618 # Backward compatibility (uselfs is deprecated).
8619 case "$uselfs" in
8620 "$define"|true|[yY]*)
8621         cat <<EOM >&4
8622
8623 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8624 EOM
8625         uselargefiles="$define"
8626         ;;
8627 esac                          
8628
8629 case "$lseeksize:$fpossize" in
8630 8:8) cat <<EOM
8631
8632 You can have files larger than 2 gigabytes.
8633 EOM
8634    val="$define" ;;
8635 *)    case "$uselargefiles" in
8636    "$undef"|false|[nN]*) dflt='n' ;;
8637    *)   dflt='y' ;;
8638    esac
8639    cat <<EOM
8640
8641 Perl can be built to understand large files (files larger than 2 gigabytes)
8642 on some systems.  To do so, Configure can be run with -Duselargefiles.
8643
8644 If this doesn't make any sense to you, just accept the default '$dflt'.
8645 EOM
8646    rp='Try to understand large files, if available?'
8647    . ./myread
8648    case "$ans" in
8649    y|Y)         val="$define" ;;
8650    *)           val="$undef"  ;;
8651    esac
8652    ;;
8653 esac
8654 set uselargefiles
8655 eval $setvar
8656 case "$uselargefiles" in
8657 "$define")
8658 : Look for a hint-file generated 'call-back-unit'.  If the
8659 : user has specified that a large files perl is to be built,
8660 : we may need to set or change some other defaults.
8661         if $test -f uselargefiles.cbu; then
8662                 echo "Your platform has some specific hints for large file builds, using them..."
8663                 . ./uselargefiles.cbu
8664                 echo " "
8665                 echo "Rechecking to see how big your file offsets are..." >&4
8666                 $cat >try.c <<EOCP
8667 #include <sys/types.h>
8668 #include <stdio.h>
8669 int main()
8670 {
8671     printf("%d\n", (int)sizeof($lseektype));
8672     return(0); 
8673 }
8674 EOCP
8675                 set try
8676                 if eval $compile_ok; then
8677                         lseeksize=`$run ./try`
8678                         $echo "Your file offsets are now $lseeksize bytes long."
8679                 else
8680                         dflt="$lseeksize"
8681                         echo " "
8682                         echo "(I can't seem to compile the test program.  Guessing...)"
8683                         rp="What is the size of your file offsets (in bytes)?"
8684                         . ./myread
8685                         lseeksize="$ans"
8686                 fi
8687                 case "$fpostype" in
8688                 *_t) zzz="$fpostype"    ;;
8689                 *)   zzz="fpos_t"       ;;
8690                 esac
8691                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8692                 $cat > try.c <<EOCP
8693 #include <sys/types.h>
8694 #include <stdio.h>
8695 int main() {
8696     printf("%d\n", (int)sizeof($fpostype));
8697     exit(0);
8698 }
8699 EOCP
8700                 set try
8701                 if eval $compile_ok; then
8702                         yyy=`$run ./try`
8703                         dflt="$lseeksize"
8704                         case "$yyy" in
8705                         '')     echo " "
8706                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8707                                 ;;
8708                         *)      fpossize=$yyy
8709                                 echo " $fpossize bytes." >&4
8710                                 ;;
8711                         esac
8712                 else
8713                         dflt="$fpossize"
8714                         echo " "
8715                         echo "(I can't compile the test program.  Guessing...)" >&4
8716                         rp="What is the size of your file positions (in bytes)?"
8717                         . ./myread
8718                         fpossize="$ans"
8719                 fi
8720                 $rm -f try.c try
8721         fi
8722         ;;
8723 esac
8724
8725 case "$vendorprefix" in
8726 '')     d_vendorbin="$undef"
8727         vendorbin=''
8728         vendorbinexp=''
8729         ;;
8730 *)      d_vendorbin="$define"
8731         : determine where vendor-supplied executables go.
8732         case "$vendorbin" in
8733         '') dflt=$vendorprefix/bin ;;
8734         *)      dflt="$vendorbin" ;;
8735         esac
8736         fn=d~+
8737         rp='Pathname for the vendor-supplied executables directory?'
8738         . ./getfile
8739         vendorbin="$ans"
8740         vendorbinexp="$ansexp"
8741         ;;
8742 esac
8743 : Change installation prefix, if necessary.
8744 if $test X"$prefix" != X"$installprefix"; then
8745         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8746 else
8747         installvendorbin="$vendorbinexp"
8748 fi
8749
8750 : see if qgcvt exists
8751 set qgcvt d_qgcvt
8752 eval $inlibc
8753
8754 : Check how to convert floats to strings.
8755
8756 if test "X$d_Gconvert" = X; then
8757
8758 echo " "
8759 echo "Checking for an efficient way to convert floats to strings."
8760 echo " " > try.c
8761 case "$uselongdouble" in
8762 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8763 esac
8764 case "$d_longdbl" in
8765 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8766 esac
8767 case "$d_PRIgldbl" in
8768 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
8769 esac
8770 $cat >>try.c <<EOP
8771 #ifdef TRY_gconvert
8772 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8773 char *myname = "gconvert";
8774 #endif
8775 #ifdef TRY_gcvt
8776 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8777 char *myname = "gcvt";
8778 #endif
8779 #ifdef TRY_qgcvt
8780 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8781 char *myname = "qgcvt";
8782 #define DOUBLETYPE long double
8783 #endif
8784 #ifdef TRY_sprintf
8785 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8786 #ifdef HAS_PRIgldbl
8787 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8788 #else
8789 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
8790 #endif
8791 #else
8792 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8793 #endif
8794 char *myname = "sprintf";
8795 #endif
8796
8797 #ifndef DOUBLETYPE
8798 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8799 #define DOUBLETYPE long double
8800 #else
8801 #define DOUBLETYPE double
8802 #endif
8803 #endif
8804
8805 #include <stdio.h>
8806
8807 #define I_STDLIB $i_stdlib
8808 #ifdef I_STDLIB
8809 #include <stdlib.h>
8810 #endif
8811
8812 int
8813 checkit(expect, got)
8814 char *expect;
8815 char *got;
8816 {
8817     if (strcmp(expect, got)) {
8818                 printf("%s oddity:  Expected %s, got %s\n",
8819                         myname, expect, got);
8820                 exit(1);
8821         }
8822 }
8823
8824 int main()
8825
8826         char buf[64]; 
8827         buf[63] = '\0';
8828
8829         /* This must be 1st test on (which?) platform */
8830         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8831         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8832         checkit("0.1", buf);
8833
8834         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
8835         checkit("0.01", buf);
8836
8837         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
8838         checkit("0.001", buf);
8839
8840         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
8841         checkit("0.0001", buf);
8842
8843         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
8844         if (strlen(buf) > 5)
8845             checkit("9e-005", buf); /* for Microsoft ?? */
8846         else
8847             checkit("9e-05", buf);
8848
8849         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
8850         checkit("1", buf);
8851
8852         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
8853         checkit("1.1", buf);
8854
8855         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
8856         checkit("1.01", buf);
8857
8858         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
8859         checkit("1.001", buf);
8860
8861         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
8862         checkit("1.0001", buf);
8863
8864         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
8865         checkit("1.00001", buf);
8866
8867         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
8868         checkit("1.000001", buf);
8869
8870         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
8871         checkit("0", buf);
8872
8873         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
8874         checkit("-1", buf);
8875
8876         /* Some Linux gcvt's give 1.e+5 here. */
8877         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
8878         checkit("100000", buf);
8879         
8880         /* Some Linux gcvt's give -1.e+5 here. */
8881         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
8882         checkit("-100000", buf);
8883
8884         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
8885         checkit("123.456", buf);
8886
8887         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
8888         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
8889         /* 34 should be enough to scare even long double
8890          * places into using the e notation. */
8891         if (strlen(buf) > 5)
8892             checkit("1e+034", buf); /* for Microsoft */
8893         else
8894             checkit("1e+34", buf);
8895
8896         /* For Perl, if you add additional tests here, also add them to
8897          * t/base/num.t for benefit of platforms not using Configure or
8898          * overriding d_Gconvert */
8899
8900         exit(0);
8901 }
8902 EOP
8903 : first add preferred functions to our list
8904 xxx_list=""
8905 for xxx_convert in $gconvert_preference; do
8906     case $xxx_convert in
8907     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
8908     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
8909     esac 
8910 done
8911 : then add any others
8912 for xxx_convert in gconvert gcvt sprintf; do
8913     case "$xxx_list" in
8914     *$xxx_convert*) ;;
8915     *) xxx_list="$xxx_list $xxx_convert" ;;
8916     esac 
8917 done
8918
8919 case "$d_longdbl$uselongdouble" in
8920 "$define$define")
8921     : again, add prefered functions to our list first
8922     xxx_ld_list=""
8923     for xxx_convert in $gconvert_ld_preference; do
8924         case $xxx_convert in
8925         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
8926         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
8927         esac
8928     done
8929     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
8930     for xxx_convert in qgcvt sprintf $xxx_list; do
8931         case "$xxx_ld_list" in
8932         $xxx_convert*|*" $xxx_convert"*) ;;
8933         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
8934         esac
8935     done
8936     : if sprintf cannot do long doubles, move it to the end
8937     if test "$d_PRIgldbl" != "$define"; then
8938         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
8939     fi
8940     : if no qgcvt, remove it
8941     if test "$d_qgcvt" != "$define"; then
8942         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
8943     fi
8944     : use the ld_list
8945     xxx_list="$xxx_ld_list"
8946     ;;
8947 esac
8948
8949 for xxx_convert in $xxx_list; do
8950         echo "Trying $xxx_convert..."
8951         $rm -f try try$_o
8952         set try -DTRY_$xxx_convert
8953         if eval $compile; then
8954                 echo "$xxx_convert() found." >&4
8955                 if $run ./try; then
8956                         echo "I'll use $xxx_convert to convert floats into a string." >&4
8957                         break;
8958                 else
8959                         echo "...But $xxx_convert didn't work as I expected."
8960                         xxx_convert=''
8961                 fi
8962         else
8963                 echo "$xxx_convert NOT found." >&4
8964         fi
8965 done
8966
8967 if test X$xxx_convert = X; then
8968     echo "*** WHOA THERE!!! ***" >&4
8969     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
8970     xxx_convert=sprintf
8971 fi
8972
8973 case "$xxx_convert" in
8974 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
8975 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
8976 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
8977 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
8978    "$define$define$define")
8979       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
8980    "$define$define$undef")
8981       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
8982    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
8983    esac
8984    ;;  
8985 esac
8986
8987 fi
8988
8989 : see if _fwalk exists
8990 set fwalk d__fwalk
8991 eval $inlibc
8992
8993 : Initialize h_fcntl
8994 h_fcntl=false
8995
8996 : Initialize h_sysfile
8997 h_sysfile=false
8998
8999 : access call always available on UNIX
9000 set access d_access
9001 eval $inlibc
9002
9003 : locate the flags for 'access()'
9004 case "$d_access" in
9005 "$define")
9006         echo " "
9007         $cat >access.c <<'EOCP'
9008 #include <sys/types.h>
9009 #ifdef I_FCNTL
9010 #include <fcntl.h>
9011 #endif
9012 #ifdef I_SYS_FILE
9013 #include <sys/file.h>
9014 #endif
9015 #ifdef I_UNISTD
9016 #include <unistd.h>
9017 #endif
9018 int main() {
9019         exit(R_OK);
9020 }
9021 EOCP
9022         : check sys/file.h first, no particular reason here
9023         if $test `./findhdr sys/file.h` && \
9024                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9025                 h_sysfile=true;
9026                 echo "<sys/file.h> defines the *_OK access constants." >&4
9027         elif $test `./findhdr fcntl.h` && \
9028                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9029                 h_fcntl=true;
9030                 echo "<fcntl.h> defines the *_OK access constants." >&4
9031         elif $test `./findhdr unistd.h` && \
9032                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9033                 echo "<unistd.h> defines the *_OK access constants." >&4
9034         else
9035                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9036         fi
9037         ;;
9038 esac
9039 $rm -f access*
9040
9041 : see if accessx exists
9042 set accessx d_accessx
9043 eval $inlibc
9044
9045 : see if alarm exists
9046 set alarm d_alarm
9047 eval $inlibc
9048
9049 : see if POSIX threads are available
9050 set pthread.h i_pthread
9051 eval $inhdr
9052
9053 : define a fucntion to check prototypes
9054 $cat > protochk <<EOSH
9055 $startsh
9056 cc="$cc"
9057 optimize="$optimize"
9058 ccflags="$ccflags"
9059 prototype="$prototype"
9060 define="$define"
9061 rm=$rm
9062 usethreads=$usethreads
9063 i_pthread=$i_pthread
9064 pthread_h_first=$pthread_h_first
9065 EOSH
9066
9067 $cat >> protochk <<'EOSH'
9068
9069 $rm -f try.c
9070 foo="$1"
9071 shift
9072 while test $# -ge 2; do
9073         case "$1" in
9074                 $define) echo "#include <$2>" >> try.c ;;
9075                 literal) echo "$2" >> try.c ;;
9076         esac
9077     # Extra magic for the benefit of systems that need pthread.h
9078     # to be included early to correctly detect threadsafe functions.
9079     # Such functions must guarantee themselves, though, that the usethreads
9080     # and i_pthread have been defined, before calling protochk.
9081     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9082         echo "#include <pthread.h>" >> try.c
9083         pthread_h_done=yes
9084     fi
9085     shift 2
9086 done
9087 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9088 cat >> try.c <<'EOCP'
9089 #ifdef CAN_PROTOTYPE
9090 #define _(args) args
9091 #else
9092 #define _(args) ()
9093 #endif
9094 EOCP
9095 echo "$foo" >> try.c
9096 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9097 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9098 status=$?
9099 $rm -f try.[co]
9100 exit $status
9101 EOSH
9102 chmod +x protochk
9103 $eunicefix protochk
9104
9105 hasproto='varname=$1; func=$2; shift; shift;
9106 while $test $# -ge 2; do
9107         case "$1" in
9108         $define) echo "#include <$2>";;
9109         esac ;
9110     shift 2;
9111 done > try.c;
9112 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9113 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9114         echo "$func() prototype found.";
9115         val="$define";
9116 else
9117         echo "$func() prototype NOT found.";
9118         val="$undef";
9119 fi;
9120 set $varname;
9121 eval $setvar;
9122 $rm -f try.c tryout.c'
9123
9124 : see if sys/types.h has to be included
9125 set sys/types.h i_systypes
9126 eval $inhdr
9127
9128 : see if sys/select.h has to be included
9129 set sys/select.h i_sysselct
9130 eval $inhdr
9131
9132 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9133 while $test $# -ge 2; do
9134         case "$1" in
9135         $define) echo "#include <$2>";;
9136         esac ;
9137     shift 2;
9138 done > try.c;
9139 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9140 set try;
9141 if eval $compile; then
9142         val="$define";
9143 else
9144         val="$undef";
9145 fi;
9146 set $varname;
9147 eval $setvar;
9148 $rm -f try.c try.o'
9149
9150 : see if we should include time.h, sys/time.h, or both
9151 echo " "
9152 if test "X$timeincl" = X; then
9153         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9154         $echo $n "I'm now running the test program...$c"
9155         $cat >try.c <<'EOCP'
9156 #include <sys/types.h>
9157 #ifdef I_TIME
9158 #include <time.h>
9159 #endif
9160 #ifdef I_SYSTIME
9161 #ifdef SYSTIMEKERNEL
9162 #define KERNEL
9163 #endif
9164 #include <sys/time.h>
9165 #endif
9166 #ifdef I_SYSSELECT
9167 #include <sys/select.h>
9168 #endif
9169 int main()
9170 {
9171         struct tm foo;
9172 #ifdef S_TIMEVAL
9173         struct timeval bar;
9174 #endif
9175 #ifdef S_TIMEZONE
9176         struct timezone tzp;
9177 #endif
9178         if (foo.tm_sec == foo.tm_sec)
9179                 exit(0);
9180 #ifdef S_TIMEVAL
9181         if (bar.tv_sec == bar.tv_sec)
9182                 exit(0);
9183 #endif
9184         exit(1);
9185 }
9186 EOCP
9187         flags=''
9188         for s_timezone in '-DS_TIMEZONE' ''; do
9189         sysselect=''
9190         for s_timeval in '-DS_TIMEVAL' ''; do
9191         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9192         for i_time in '' '-DI_TIME'; do
9193         for i_systime in '-DI_SYSTIME' ''; do
9194                 case "$flags" in
9195                 '') $echo $n ".$c"
9196                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9197                         if eval $compile; then
9198                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9199                                 shift
9200                                 flags="$*"
9201                                 echo " "
9202                                 $echo $n "Succeeded with $flags$c"
9203                         fi
9204                         ;;
9205                 esac
9206         done
9207         done
9208         done
9209         done
9210         done
9211         timeincl=''
9212         echo " "
9213         case "$flags" in
9214         *SYSTIMEKERNEL*) i_systimek="$define"
9215                 timeincl=`./findhdr sys/time.h`
9216                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9217         *) i_systimek="$undef";;
9218         esac
9219         case "$flags" in
9220         *I_TIME*) i_time="$define"
9221                 timeincl=`./findhdr time.h`" $timeincl"
9222                 echo "We'll include <time.h>." >&4;;
9223         *) i_time="$undef";;
9224         esac
9225         case "$flags" in
9226         *I_SYSTIME*) i_systime="$define"
9227                 timeincl=`./findhdr sys/time.h`" $timeincl"
9228                 echo "We'll include <sys/time.h>." >&4;;
9229         *) i_systime="$undef";;
9230         esac
9231         $rm -f try.c try
9232 fi
9233 : see if struct tm knows about tm_zone
9234 case "$i_systime$i_time" in
9235 *$define*) 
9236         echo " "
9237         echo "Checking to see if your struct tm has tm_zone field..." >&4
9238         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9239         eval $hasfield
9240         ;;
9241 *)      val="$undef"
9242         set d_tm_tm_zone
9243         eval $setvar
9244         ;;
9245 esac
9246 case "$d_tm_tm_zone" in
9247 "$define")      echo "Yes, it does."   ;;
9248 *)              echo "No, it doesn't." ;;
9249 esac
9250 : see if struct tm knows about tm_gmtoff
9251 case "$i_systime$i_time" in
9252 *$define*) 
9253         echo " "
9254         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9255         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9256         eval $hasfield
9257         ;;
9258 *)      val="$undef"
9259         set d_tm_tm_gmtoff
9260         eval $setvar
9261         ;;
9262 esac
9263 case "$d_tm_tm_gmtoff" in
9264 "$define")      echo "Yes, it does."   ;;
9265 *)              echo "No, it doesn't." ;;
9266 esac
9267
9268 : see if asctime_r exists
9269 set asctime_r d_asctime_r
9270 eval $inlibc
9271 case "$d_asctime_r" in
9272 "$define")
9273         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9274         case "$d_asctime_r_proto:$usethreads" in
9275         ":define")      d_asctime_r_proto=define
9276                 set d_asctime_r_proto asctime_r $hdrs
9277                 eval $hasproto ;;
9278         *)      ;;
9279         esac
9280         case "$d_asctime_r_proto" in
9281         define)
9282         case "$asctime_r_proto" in
9283         ''|0) try='char* asctime_r(const struct tm*, char*);'
9284         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9285         esac
9286         case "$asctime_r_proto" in
9287         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9288         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9289         esac
9290         case "$asctime_r_proto" in
9291         ''|0) try='int asctime_r(const struct tm*, char*);'
9292         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9293         esac
9294         case "$asctime_r_proto" in
9295         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9296         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9297         esac
9298         case "$asctime_r_proto" in
9299         ''|0)   d_asctime_r=undef
9300                 asctime_r_proto=0
9301                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9302         * )     case "$asctime_r_proto" in
9303                 REENTRANT_PROTO*) ;;
9304                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9305                 esac
9306                 echo "Prototype: $try" ;;
9307         esac
9308         ;;
9309         *)      case "$usethreads" in
9310                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9311                 esac
9312                 d_asctime_r=undef
9313                 asctime_r_proto=0
9314                 ;;
9315         esac
9316         ;;
9317 *)      asctime_r_proto=0
9318         ;;
9319 esac
9320
9321 : see if atolf exists
9322 set atolf d_atolf
9323 eval $inlibc
9324
9325 : see if atoll exists
9326 set atoll d_atoll
9327 eval $inlibc
9328
9329 : Look for GNU-cc style attribute checking
9330 echo " "
9331 echo "Checking whether your compiler can handle __attribute__ ..." >&4
9332 $cat >attrib.c <<'EOCP'
9333 #include <stdio.h>
9334 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
9335 EOCP
9336 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9337         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9338                 echo "Your C compiler doesn't fully support __attribute__."
9339                 val="$undef"
9340         else
9341                 echo "Your C compiler supports __attribute__."
9342                 val="$define"
9343         fi
9344 else
9345         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9346         val="$undef"
9347 fi
9348 set d_attribut
9349 eval $setvar
9350 $rm -f attrib*
9351
9352 : see if bcmp exists
9353 set bcmp d_bcmp
9354 eval $inlibc
9355
9356 : see if bcopy exists
9357 set bcopy d_bcopy
9358 eval $inlibc
9359
9360 : see if this is a unistd.h system
9361 set unistd.h i_unistd
9362 eval $inhdr
9363
9364 : see if getpgrp exists
9365 set getpgrp d_getpgrp
9366 eval $inlibc
9367
9368 case "$d_getpgrp" in
9369 "$define")
9370         echo " "
9371         echo "Checking to see which flavor of getpgrp is in use..."
9372         $cat >try.c <<EOP
9373 #$i_unistd I_UNISTD
9374 #include <sys/types.h>
9375 #ifdef I_UNISTD
9376 #  include <unistd.h>
9377 #endif
9378 int main()
9379 {
9380         if (getuid() == 0) {
9381                 printf("(I see you are running Configure as super-user...)\n");
9382                 setuid(1);
9383         }
9384 #ifdef TRY_BSD_PGRP
9385         if (getpgrp(1) == 0)
9386                 exit(0);
9387 #else
9388         if (getpgrp() > 0)
9389                 exit(0);
9390 #endif
9391         exit(1);
9392 }
9393 EOP
9394         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9395                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
9396                 val="$define"
9397         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9398                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
9399                 val="$undef"
9400         else
9401                 echo "I can't seem to compile and run the test program."
9402                 if ./usg; then
9403                         xxx="a USG one, i.e. you use getpgrp()."
9404                 else
9405                         # SVR4 systems can appear rather BSD-ish.
9406                         case "$i_unistd" in
9407                         $undef)
9408                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
9409                                 val="$define"
9410                                 ;;
9411                         $define)
9412                                 xxx="probably a USG one, i.e. you use getpgrp()."
9413                                 val="$undef"
9414                                 ;;
9415                         esac
9416                 fi
9417                 echo "Assuming your getpgrp is $xxx" >&4
9418         fi
9419         ;;
9420 *) val="$undef";;
9421 esac
9422 set d_bsdgetpgrp
9423 eval $setvar
9424 $rm -f try try.*
9425
9426 : see if setpgrp exists
9427 set setpgrp d_setpgrp
9428 eval $inlibc
9429
9430 case "$d_setpgrp" in
9431 "$define")
9432         echo " "
9433         echo "Checking to see which flavor of setpgrp is in use..."
9434         $cat >try.c <<EOP
9435 #$i_unistd I_UNISTD
9436 #include <sys/types.h>
9437 #ifdef I_UNISTD
9438 #  include <unistd.h>
9439 #endif
9440 int main()
9441 {
9442         if (getuid() == 0) {
9443                 printf("(I see you are running Configure as super-user...)\n");
9444                 setuid(1);
9445         }
9446 #ifdef TRY_BSD_PGRP
9447         if (-1 == setpgrp(1, 1))
9448                 exit(0);
9449 #else
9450         if (setpgrp() != -1)
9451                 exit(0);
9452 #endif
9453         exit(1);
9454 }
9455 EOP
9456         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9457                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
9458                 val="$define"
9459         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9460                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
9461                 val="$undef"
9462         else
9463                 echo "(I can't seem to compile and run the test program.)"
9464                 if ./usg; then
9465                         xxx="a USG one, i.e. you use setpgrp()."
9466                 else
9467                         # SVR4 systems can appear rather BSD-ish.
9468                         case "$i_unistd" in
9469                         $undef)
9470                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
9471                                 val="$define"
9472                                 ;;
9473                         $define)
9474                                 xxx="probably a USG one, i.e. you use setpgrp()."
9475                                 val="$undef"
9476                                 ;;
9477                         esac
9478                 fi
9479                 echo "Assuming your setpgrp is $xxx" >&4
9480         fi
9481         ;;
9482 *) val="$undef";;
9483 esac
9484 set d_bsdsetpgrp
9485 eval $setvar
9486 $rm -f try try.*
9487 : see if bzero exists
9488 set bzero d_bzero
9489 eval $inlibc
9490
9491 : see if signal is declared as pointer to function returning int or void
9492 echo " "
9493 xxx=`./findhdr signal.h`
9494 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
9495 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
9496         echo "You have int (*signal())() instead of void." >&4
9497         val="$undef"
9498 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
9499         echo "You have void (*signal())()." >&4
9500         val="$define"
9501 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
9502         echo "You have int (*signal())() instead of void." >&4
9503         val="$undef"
9504 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
9505         echo "You have void (*signal())()." >&4
9506         val="$define"
9507 else
9508         case "$d_voidsig" in
9509         '')
9510         echo "I can't determine whether signal handler returns void or int..." >&4
9511                 dflt=void
9512                 rp="What type does your signal handler return?"
9513                 . ./myread
9514                 case "$ans" in
9515                 v*) val="$define";;
9516                 *) val="$undef";;
9517                 esac;;
9518         "$define")
9519                 echo "As you already told me, signal handler returns void." >&4
9520                 val="$define"
9521                 ;;
9522         *)      echo "As you already told me, signal handler returns int." >&4
9523                 val="$undef"
9524                 ;;
9525         esac
9526 fi
9527 set d_voidsig
9528 eval $setvar
9529 case "$d_voidsig" in
9530 "$define") signal_t="void";;
9531 *) signal_t="int";;
9532 esac
9533 $rm -f $$.tmp
9534
9535 : check for ability to cast large floats to 32-bit ints.
9536 echo " "
9537 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
9538 if $test "$intsize" -ge 4; then
9539         xxx=int
9540 else
9541         xxx=long
9542 fi
9543 $cat >try.c <<EOCP
9544 #include <stdio.h>
9545 #include <sys/types.h>
9546 #include <signal.h>
9547 $signal_t blech(s) int s; { exit(3); }
9548 int main()
9549 {
9550         $xxx i32;
9551         double f, g;
9552         int result = 0;
9553         char str[16];
9554         signal(SIGFPE, blech);
9555
9556         /* Don't let compiler optimize the test away.  Store the number 
9557            in a writable string for gcc to pass to sscanf under HP/UX.
9558         */
9559         sprintf(str, "2147483647");
9560         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
9561         g = 10 * f;
9562         i32  = ($xxx) g;
9563
9564         /* x86 processors will probably give 0x8000 0000, which is a
9565        sign change.  We don't want that.  We want to mimic SPARC
9566            behavior here, which is to preserve the sign and give
9567            back 0x7fff ffff.
9568         */
9569         if (i32 != ($xxx) f)
9570                 result |= 1;
9571         exit(result);
9572 }
9573 EOCP
9574 set try
9575 if eval $compile_ok; then
9576         $run ./try
9577         yyy=$?
9578 else
9579         echo "(I can't seem to compile the test program--assuming it can't)"
9580         yyy=1
9581 fi
9582 case "$yyy" in
9583 0)      val="$define"
9584         echo "Yup, it can."
9585         ;;
9586 *)      val="$undef"
9587         echo "Nope, it can't."
9588         ;;
9589 esac
9590 set d_casti32
9591 eval $setvar
9592 $rm -f try try.*
9593
9594 : check for ability to cast negative floats to unsigned
9595 echo " "
9596 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
9597 $cat >try.c <<EOCP
9598 #include <stdio.h>
9599 #include <sys/types.h>
9600 #include <signal.h>
9601 $signal_t blech(s) int s; { exit(7); }
9602 $signal_t blech_in_list(s) int s; { exit(4); }
9603 unsigned long dummy_long(p) unsigned long p; { return p; }
9604 unsigned int dummy_int(p) unsigned int p; { return p; }
9605 unsigned short dummy_short(p) unsigned short p; { return p; }
9606 int main()
9607 {
9608         double f;
9609         unsigned long along;
9610         unsigned int aint;
9611         unsigned short ashort;
9612         int result = 0;
9613         char str[16];
9614         
9615         /* Frustrate gcc-2.7.2's optimizer which failed this test with
9616            a direct f = -123. assignment.  gcc-2.8.0 reportedly
9617            optimized the whole file away
9618         */
9619         /* Store the number in a writable string for gcc to pass to 
9620            sscanf under HP/UX.
9621         */
9622         sprintf(str, "-123");
9623         sscanf(str, "%lf", &f);  /* f = -123.; */
9624
9625         signal(SIGFPE, blech);
9626         along = (unsigned long)f;
9627         aint = (unsigned int)f;
9628         ashort = (unsigned short)f;
9629         if (along != (unsigned long)-123)
9630                 result |= 1;
9631         if (aint != (unsigned int)-123)
9632                 result |= 1;
9633         if (ashort != (unsigned short)-123)
9634                 result |= 1;
9635         sprintf(str, "1073741824.");
9636         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
9637         f = f + f;
9638         along = 0;
9639         along = (unsigned long)f;
9640         if (along != 0x80000000)
9641                 result |= 2;
9642         f -= 1.;
9643         along = 0;
9644         along = (unsigned long)f;
9645         if (along != 0x7fffffff)
9646                 result |= 1;
9647         f += 2.;
9648         along = 0;
9649         along = (unsigned long)f;
9650         if (along != 0x80000001)
9651                 result |= 2;
9652         if (result)
9653                 exit(result);
9654         signal(SIGFPE, blech_in_list);
9655         sprintf(str, "123.");
9656         sscanf(str, "%lf", &f);  /* f = 123.; */
9657         along = dummy_long((unsigned long)f);
9658         aint = dummy_int((unsigned int)f);
9659         ashort = dummy_short((unsigned short)f);
9660         if (along != (unsigned long)123)
9661                 result |= 4;
9662         if (aint != (unsigned int)123)
9663                 result |= 4;
9664         if (ashort != (unsigned short)123)
9665                 result |= 4;
9666         exit(result);
9667
9668 }
9669 EOCP
9670 set try
9671 if eval $compile_ok; then
9672         $run ./try
9673         castflags=$?
9674 else
9675         echo "(I can't seem to compile the test program--assuming it can't)"
9676         castflags=7
9677 fi
9678 case "$castflags" in
9679 0)      val="$define"
9680         echo "Yup, it can."
9681         ;;
9682 *)      val="$undef"
9683         echo "Nope, it can't."
9684         ;;
9685 esac
9686 set d_castneg
9687 eval $setvar
9688 $rm -f try.*
9689
9690 : see if vprintf exists
9691 echo " "
9692 if set vprintf val -f d_vprintf; eval $csym; $val; then
9693         echo 'vprintf() found.' >&4
9694         val="$define"
9695         $cat >try.c <<'EOF'
9696 #include <varargs.h>
9697
9698 int main() { xxx("foo"); }
9699
9700 xxx(va_alist)
9701 va_dcl
9702 {
9703         va_list args;
9704         char buf[10];
9705
9706         va_start(args);
9707         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
9708 }
9709 EOF
9710         set try
9711         if eval $compile && $run ./try; then
9712                 echo "Your vsprintf() returns (int)." >&4
9713                 val2="$undef"
9714         else
9715                 echo "Your vsprintf() returns (char*)." >&4
9716                 val2="$define"
9717         fi
9718 else
9719         echo 'vprintf() NOT found.' >&4
9720                 val="$undef"
9721                 val2="$undef"
9722 fi
9723 $rm -f try try.*
9724 set d_vprintf
9725 eval $setvar
9726 val=$val2
9727 set d_charvspr
9728 eval $setvar
9729
9730 : see if chown exists
9731 set chown d_chown
9732 eval $inlibc
9733
9734 : see if chroot exists
9735 set chroot d_chroot
9736 eval $inlibc
9737
9738 : see if chsize exists
9739 set chsize d_chsize
9740 eval $inlibc
9741
9742 : see if class exists
9743 set class d_class
9744 eval $inlibc
9745
9746 hasstruct='varname=$1; struct=$2; shift; shift;
9747 while $test $# -ge 2; do
9748         case "$1" in
9749         $define) echo "#include <$2>";;
9750         esac ;
9751     shift 2;
9752 done > try.c;
9753 echo "int main () { struct $struct foo; }" >> try.c;
9754 set try;
9755 if eval $compile; then
9756         val="$define";
9757 else
9758         val="$undef";
9759 fi;
9760 set $varname;
9761 eval $setvar;
9762 $rm -f try.c try.o'
9763
9764 socketlib=''
9765 sockethdr=''
9766 : see whether socket exists
9767 echo " "
9768 $echo $n "Hmm... $c" >&4
9769 if set socket val -f d_socket; eval $csym; $val; then
9770         echo "Looks like you have Berkeley networking support." >&4
9771         d_socket="$define"
9772         if set setsockopt val -f; eval $csym; $val; then
9773                 d_oldsock="$undef"
9774         else
9775                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9776                 d_oldsock="$define"
9777         fi
9778 else
9779         if $contains socklib libc.list >/dev/null 2>&1; then
9780                 echo "Looks like you have Berkeley networking support." >&4
9781                 d_socket="$define"
9782                 : we will have to assume that it supports the 4.2 BSD interface
9783                 d_oldsock="$undef"
9784         else
9785                 echo "You don't have Berkeley networking in libc$_a..." >&4
9786                 if test "X$d_socket" = "X$define"; then
9787                    echo "...but you seem to believe that you have sockets." >&4
9788                 else
9789                         for net in net socket
9790                         do
9791                                 if test -f /usr/lib/lib$net$_a; then
9792                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9793                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9794                                         if $contains socket libc.list >/dev/null 2>&1; then
9795                                                 d_socket="$define"
9796                                                 socketlib="-l$net"
9797                                                 case "$net" in
9798                                                 net)
9799                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9800                                                         sockethdr="-I/usr/netinclude"
9801                                                         ;;
9802                                                 esac
9803                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
9804                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9805                                                         d_oldsock="$undef"
9806                                                 else
9807                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9808                                                         d_oldsock="$define"
9809                                                 fi
9810                                                 break
9811                                         fi
9812                                 fi
9813                         done
9814                         if test "X$d_socket" != "X$define"; then
9815                            echo "or anywhere else I see." >&4
9816                            d_socket="$undef"
9817                            d_oldsock="$undef"
9818                         fi
9819                 fi
9820         fi
9821 fi
9822
9823 : see if socketpair exists
9824 set socketpair d_sockpair
9825 eval $inlibc
9826
9827
9828 echo " "
9829 echo "Checking the availability of certain socket constants..." >&4
9830 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9831         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9832         $cat >try.c <<EOF
9833 #include <sys/types.h>
9834 #include <sys/socket.h>
9835 int main() {
9836     int i = $ENUM;
9837 }
9838 EOF
9839         val="$undef"
9840         set try; if eval $compile; then
9841                 val="$define"
9842         fi
9843         set d_${enum}; eval $setvar
9844         $rm -f try.c try
9845 done
9846
9847 : see if this is a sys/uio.h system
9848 set sys/uio.h i_sysuio
9849 eval $inhdr
9850
9851
9852 echo " "
9853 echo "Checking to see if your system supports struct cmsghdr..." >&4
9854 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
9855 eval $hasstruct
9856 case "$d_cmsghdr_s" in
9857 "$define")      echo "Yes, it does."   ;;
9858 *)              echo "No, it doesn't." ;;
9859 esac
9860
9861
9862 : check for const keyword
9863 echo " "
9864 echo 'Checking to see if your C compiler knows about "const"...' >&4
9865 $cat >const.c <<'EOCP'
9866 typedef struct spug { int drokk; } spug;
9867 int main()
9868 {
9869         const char *foo;
9870         const spug y;
9871 }
9872 EOCP
9873 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
9874         val="$define"
9875         echo "Yup, it does."
9876 else
9877         val="$undef"
9878         echo "Nope, it doesn't."
9879 fi
9880 set d_const
9881 eval $setvar
9882
9883 : see if crypt exists
9884 echo " "
9885 set crypt d_crypt
9886 eval $inlibc
9887 case "$d_crypt" in
9888 $define) cryptlib='' ;;
9889 *)      if set crypt val -f d_crypt; eval $csym; $val; then
9890                 echo 'crypt() found.' >&4
9891                 val="$define"
9892                 cryptlib=''
9893         else
9894                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
9895                 if $test -z "$cryptlib"; then
9896                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
9897                 else
9898                         cryptlib=-lcrypt
9899                 fi
9900                 if $test -z "$cryptlib"; then
9901                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
9902                 else
9903                         cryptlib=-lcrypt
9904                 fi
9905                 if $test -z "$cryptlib"; then
9906                         cryptlib=`./loc libcrypt$_a "" $libpth`
9907                 else
9908                         cryptlib=-lcrypt
9909                 fi
9910                 if $test -z "$cryptlib"; then
9911                         echo 'crypt() NOT found.' >&4
9912                         val="$undef"
9913                 else
9914                         val="$define"
9915                 fi
9916         fi
9917         set d_crypt
9918         eval $setvar
9919         ;;
9920 esac
9921
9922 : see if this is a crypt.h system
9923 set crypt.h i_crypt
9924 eval $inhdr
9925
9926 : see if crypt_r exists
9927 set crypt_r d_crypt_r
9928 eval $inlibc
9929 case "$d_crypt_r" in
9930 "$define")
9931         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
9932         case "$d_crypt_r_proto:$usethreads" in
9933         ":define")      d_crypt_r_proto=define
9934                 set d_crypt_r_proto crypt_r $hdrs
9935                 eval $hasproto ;;
9936         *)      ;;
9937         esac
9938         case "$d_crypt_r_proto" in
9939         define)
9940         case "$crypt_r_proto" in
9941         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
9942         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
9943         esac
9944         case "$crypt_r_proto" in
9945         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
9946         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
9947         esac
9948         case "$crypt_r_proto" in
9949         ''|0)   d_crypt_r=undef
9950                 crypt_r_proto=0
9951                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
9952         * )     case "$crypt_r_proto" in
9953                 REENTRANT_PROTO*) ;;
9954                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
9955                 esac
9956                 echo "Prototype: $try" ;;
9957         esac
9958         ;;
9959         *)      case "$usethreads" in
9960                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
9961                 esac
9962                 d_crypt_r=undef
9963                 crypt_r_proto=0
9964                 ;;
9965         esac
9966         ;;
9967 *)      crypt_r_proto=0
9968         ;;
9969 esac
9970
9971 : get csh whereabouts
9972 case "$csh" in
9973 'csh') val="$undef" ;;
9974 *) val="$define" ;;
9975 esac
9976 set d_csh
9977 eval $setvar
9978 : Respect a hint or command line value for full_csh.
9979 case "$full_csh" in
9980 '') full_csh=$csh ;;
9981 esac
9982
9983 : see if ctermid_r exists
9984 set ctermid_r d_ctermid_r
9985 eval $inlibc
9986 case "$d_ctermid_r" in
9987 "$define")
9988         hdrs="$i_systypes sys/types.h define stdio.h "
9989         case "$d_ctermid_r_proto:$usethreads" in
9990         ":define")      d_ctermid_r_proto=define
9991                 set d_ctermid_r_proto ctermid_r $hdrs
9992                 eval $hasproto ;;
9993         *)      ;;
9994         esac
9995         case "$d_ctermid_r_proto" in
9996         define)
9997         case "$ctermid_r_proto" in
9998         ''|0) try='char* ctermid_r(char*);'
9999         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10000         esac
10001         case "$ctermid_r_proto" in
10002         ''|0)   d_ctermid_r=undef
10003                 ctermid_r_proto=0
10004                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10005         * )     case "$ctermid_r_proto" in
10006                 REENTRANT_PROTO*) ;;
10007                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10008                 esac
10009                 echo "Prototype: $try" ;;
10010         esac
10011         ;;
10012         *)      case "$usethreads" in
10013                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10014                 esac
10015                 d_ctermid_r=undef
10016                 ctermid_r_proto=0
10017                 ;;
10018         esac
10019         ;;
10020 *)      ctermid_r_proto=0
10021         ;;
10022 esac
10023
10024 : see if ctime_r exists
10025 set ctime_r d_ctime_r
10026 eval $inlibc
10027 case "$d_ctime_r" in
10028 "$define")
10029         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10030         case "$d_ctime_r_proto:$usethreads" in
10031         ":define")      d_ctime_r_proto=define
10032                 set d_ctime_r_proto ctime_r $hdrs
10033                 eval $hasproto ;;
10034         *)      ;;
10035         esac
10036         case "$d_ctime_r_proto" in
10037         define)
10038         case "$ctime_r_proto" in
10039         ''|0) try='char* ctime_r(const time_t*, char*);'
10040         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10041         esac
10042         case "$ctime_r_proto" in
10043         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10044         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10045         esac
10046         case "$ctime_r_proto" in
10047         ''|0) try='int ctime_r(const time_t*, char*);'
10048         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10049         esac
10050         case "$ctime_r_proto" in
10051         ''|0) try='int ctime_r(const time_t*, char*, int);'
10052         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10053         esac
10054         case "$ctime_r_proto" in
10055         ''|0)   d_ctime_r=undef
10056                 ctime_r_proto=0
10057                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10058         * )     case "$ctime_r_proto" in
10059                 REENTRANT_PROTO*) ;;
10060                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10061                 esac
10062                 echo "Prototype: $try" ;;
10063         esac
10064         ;;
10065         *)      case "$usethreads" in
10066                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10067                 esac
10068                 d_ctime_r=undef
10069                 ctime_r_proto=0
10070                 ;;
10071         esac
10072         ;;
10073 *)      ctime_r_proto=0
10074         ;;
10075 esac
10076
10077 : see if cuserid exists
10078 set cuserid d_cuserid
10079 eval $inlibc
10080
10081 : see if this is a limits.h system
10082 set limits.h i_limits
10083 eval $inhdr
10084
10085 : see if this is a float.h system
10086 set float.h i_float
10087 eval $inhdr
10088
10089 : See if number of significant digits in a double precision number is known
10090 echo " "
10091 $cat >dbl_dig.c <<EOM
10092 #$i_limits I_LIMITS
10093 #$i_float I_FLOAT
10094 #ifdef I_LIMITS
10095 #include <limits.h>
10096 #endif
10097 #ifdef I_FLOAT
10098 #include <float.h>
10099 #endif
10100 #ifdef DBL_DIG
10101 printf("Contains DBL_DIG");
10102 #endif
10103 EOM
10104 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10105 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10106         echo "DBL_DIG found." >&4
10107         val="$define"
10108 else
10109         echo "DBL_DIG NOT found." >&4
10110         val="$undef"
10111 fi
10112 $rm -f dbl_dig.?
10113 set d_dbl_dig
10114 eval $setvar
10115
10116 : see if dbm.h is available
10117 : see if dbmclose exists
10118 set dbmclose d_dbmclose
10119 eval $inlibc
10120
10121 case "$d_dbmclose" in
10122 $define)
10123         set dbm.h i_dbm
10124         eval $inhdr
10125         case "$i_dbm" in
10126         $define)
10127                 val="$undef"
10128                 set i_rpcsvcdbm
10129                 eval $setvar
10130                 ;;
10131         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10132                 eval $inhdr
10133                 ;;
10134         esac
10135         ;;
10136 *)      echo "We won't be including <dbm.h>"
10137         val="$undef"
10138         set i_dbm
10139         eval $setvar
10140         val="$undef"
10141         set i_rpcsvcdbm
10142         eval $setvar
10143         ;;
10144 esac
10145
10146 : see if prototype for dbminit is available
10147 echo " "
10148 set d_dbminitproto dbminit $i_dbm dbm.h
10149 eval $hasproto
10150
10151 : see if difftime exists
10152 set difftime d_difftime
10153 eval $inlibc
10154
10155 : see if this is a dirent system
10156 echo " "
10157 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10158         val="$define"
10159         echo "<dirent.h> found." >&4
10160 else
10161         val="$undef"
10162         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10163                 echo "<sys/dir.h> found." >&4
10164                 echo " "
10165         else
10166                 xinc=`./findhdr sys/ndir.h`
10167         fi
10168         echo "<dirent.h> NOT found." >&4
10169 fi
10170 set i_dirent
10171 eval $setvar
10172
10173 : Look for type of directory structure.
10174 echo " "
10175 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10176
10177 case "$direntrytype" in
10178 ''|' ')
10179         case "$i_dirent" in
10180         $define) guess1='struct dirent' ;;
10181         *) guess1='struct direct'  ;;
10182         esac
10183         ;;
10184 *)      guess1="$direntrytype"
10185         ;;
10186 esac
10187
10188 case "$guess1" in
10189 'struct dirent') guess2='struct direct' ;;
10190 *) guess2='struct dirent' ;;
10191 esac
10192                 
10193 if $contains "$guess1" try.c >/dev/null 2>&1; then
10194         direntrytype="$guess1"
10195         echo "Your directory entries are $direntrytype." >&4
10196 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10197         direntrytype="$guess2"
10198         echo "Your directory entries seem to be $direntrytype." >&4
10199 else
10200         echo "I don't recognize your system's directory entries." >&4
10201         rp="What type is used for directory entries on this system?"
10202         dflt="$guess1"
10203         . ./myread
10204         direntrytype="$ans"
10205 fi
10206 $rm -f try.c
10207
10208
10209 : see if the directory entry stores field length
10210 echo " "
10211 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10212 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10213         echo "Good, your directory entry keeps length information in d_namlen." >&4
10214         val="$define"
10215 else
10216         echo "Your directory entry does not know about the d_namlen field." >&4
10217         val="$undef"
10218 fi
10219 set d_dirnamlen
10220 eval $setvar
10221 $rm -f try.c
10222
10223 : see if this is an sysdir system
10224 set sys/dir.h i_sysdir
10225 eval $inhdr
10226
10227 : see if this is an sysndir system
10228 set sys/ndir.h i_sysndir
10229 eval $inhdr
10230
10231 : Look for dirfd
10232 echo " "
10233 $cat >dirfd.c <<EOM
10234 #include <stdio.h>
10235 #$i_dirent I_DIRENT             /**/
10236 #$i_sysdir I_SYS_DIR            /**/
10237 #$i_sysndir I_SYS_NDIR          /**/
10238 #$i_systypes I_SYS_TYPES        /**/
10239 #if defined(I_SYS_TYPES)
10240 #include <sys/types.h>
10241 #endif
10242 #if defined(I_DIRENT)
10243 #include <dirent.h>
10244 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10245 #include <sys/dir.h>
10246 #endif
10247 #else
10248 #ifdef I_SYS_NDIR
10249 #include <sys/ndir.h>
10250 #else
10251 #ifdef I_SYS_DIR
10252 #ifdef hp9000s500
10253 #include <ndir.h>       /* may be wrong in the future */
10254 #else
10255 #include <sys/dir.h>
10256 #endif
10257 #endif
10258 #endif
10259 #endif 
10260 int main() {
10261         DIR *dirp = opendir(".");
10262         if (dirfd(dirp) >= 0)
10263                 exit(0);
10264         else
10265                 exit(1);
10266 }
10267 EOM
10268 set dirfd
10269 if eval $compile; then
10270         val="$define"
10271 fi
10272 case "$val" in
10273 $define)        echo "dirfd() found." >&4       ;;
10274 *)              echo "dirfd() NOT found." >&4   ;;
10275 esac
10276 set d_dirfd
10277 eval $setvar
10278 $rm -f dirfd*
10279
10280 : see if dlerror exists
10281 xxx_runnm="$runnm"
10282 runnm=false
10283 set dlerror d_dlerror
10284 eval $inlibc
10285 runnm="$xxx_runnm"
10286
10287 : see if dlfcn is available
10288 set dlfcn.h i_dlfcn
10289 eval $inhdr
10290
10291 case "$usedl" in
10292 $define|y|true)
10293         $cat << EOM
10294
10295 On a few systems, the dynamically loaded modules that perl generates and uses
10296 will need a different extension than shared libs. The default will probably
10297 be appropriate.
10298
10299 EOM
10300         case "$dlext" in
10301         '')     dflt="$so" ;;
10302         *)      dflt="$dlext" ;;
10303         esac
10304         rp='What is the extension of dynamically loaded modules'
10305         . ./myread
10306         dlext="$ans"
10307         ;;
10308 *)
10309         dlext="none"
10310         ;;
10311 esac
10312
10313 : Check if dlsym need a leading underscore
10314 echo " "
10315 val="$undef"
10316
10317 case "$dlsrc" in
10318 dl_dlopen.xs)
10319         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
10320         $cat >dyna.c <<'EOM'
10321 fred () { }
10322 EOM
10323
10324 $cat >fred.c<<EOM
10325
10326 #include <stdio.h>
10327 #$i_dlfcn I_DLFCN
10328 #ifdef I_DLFCN
10329 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
10330 #else
10331 #include <sys/types.h>
10332 #include <nlist.h>
10333 #include <link.h>
10334 #endif
10335
10336 extern int fred() ;
10337
10338 int main()
10339 {
10340     void * handle ;
10341     void * symbol ;
10342 #ifndef RTLD_LAZY
10343     int mode = 1 ;
10344 #else
10345     int mode = RTLD_LAZY ;
10346 #endif
10347     handle = dlopen("./dyna.$dlext", mode) ;
10348     if (handle == NULL) {
10349         printf ("1\n") ;
10350         fflush (stdout) ;
10351         exit(0);
10352     }
10353     symbol = dlsym(handle, "fred") ;
10354     if (symbol == NULL) {
10355         /* try putting a leading underscore */
10356         symbol = dlsym(handle, "_fred") ;
10357         if (symbol == NULL) {
10358             printf ("2\n") ;
10359             fflush (stdout) ;
10360             exit(0);
10361         }
10362         printf ("3\n") ;
10363     }
10364     else
10365         printf ("4\n") ;
10366     fflush (stdout) ;
10367     exit(0);
10368 }
10369 EOM
10370         : Call the object file tmp-dyna.o in case dlext=o.
10371         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
10372                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
10373                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
10374                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
10375                 xxx=`$run ./fred`
10376                 case $xxx in
10377                 1)      echo "Test program failed using dlopen." >&4
10378                         echo "Perhaps you should not use dynamic loading." >&4;;
10379                 2)      echo "Test program failed using dlsym." >&4
10380                         echo "Perhaps you should not use dynamic loading." >&4;;
10381                 3)      echo "dlsym needs a leading underscore" >&4
10382                         val="$define" ;;
10383                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
10384                 esac
10385         else
10386                 echo "I can't compile and run the test program." >&4
10387                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
10388         fi
10389         ;;
10390 esac
10391                 
10392 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
10393
10394 set d_dlsymun
10395 eval $setvar
10396
10397 : see if drand48_r exists
10398 set drand48_r d_drand48_r
10399 eval $inlibc
10400 case "$d_drand48_r" in
10401 "$define")
10402         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
10403         case "$d_drand48_r_proto:$usethreads" in
10404         ":define")      d_drand48_r_proto=define
10405                 set d_drand48_r_proto drand48_r $hdrs
10406                 eval $hasproto ;;
10407         *)      ;;
10408         esac
10409         case "$d_drand48_r_proto" in
10410         define)
10411         case "$drand48_r_proto" in
10412         ''|0) try='int drand48_r(struct drand48_data*, double*);'
10413         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
10414         esac
10415         case "$drand48_r_proto" in
10416         ''|0)   d_drand48_r=undef
10417                 drand48_r_proto=0
10418                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10419         * )     case "$drand48_r_proto" in
10420                 REENTRANT_PROTO*) ;;
10421                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
10422                 esac
10423                 echo "Prototype: $try" ;;
10424         esac
10425         ;;
10426         *)      case "$usethreads" in
10427                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
10428                 esac
10429                 d_drand48_r=undef
10430                 drand48_r_proto=0
10431                 ;;
10432         esac
10433         ;;
10434 *)      drand48_r_proto=0
10435         ;;
10436 esac
10437
10438 : see if prototype for drand48 is available
10439 echo " "
10440 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
10441 eval $hasproto
10442
10443 : see if dup2 exists
10444 set dup2 d_dup2
10445 eval $inlibc
10446
10447 : see if eaccess exists
10448 set eaccess d_eaccess
10449 eval $inlibc
10450
10451 : see if endgrent exists
10452 set endgrent d_endgrent
10453 eval $inlibc
10454
10455 : see if this is an grp system
10456 set grp.h i_grp
10457 eval $inhdr
10458
10459 case "$i_grp" in
10460 $define)
10461         xxx=`./findhdr grp.h`
10462         $cppstdin $cppflags $cppminus < $xxx >$$.h
10463
10464         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10465                 val="$define"
10466         else
10467                 val="$undef"
10468         fi
10469         set d_grpasswd
10470         eval $setvar
10471
10472         $rm -f $$.h
10473         ;;
10474 *)
10475         val="$undef";
10476         set d_grpasswd; eval $setvar
10477         ;;
10478 esac
10479
10480 : see if endgrent_r exists
10481 set endgrent_r d_endgrent_r
10482 eval $inlibc
10483 case "$d_endgrent_r" in
10484 "$define")
10485         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
10486         case "$d_endgrent_r_proto:$usethreads" in
10487         ":define")      d_endgrent_r_proto=define
10488                 set d_endgrent_r_proto endgrent_r $hdrs
10489                 eval $hasproto ;;
10490         *)      ;;
10491         esac
10492         case "$d_endgrent_r_proto" in
10493         define)
10494         case "$endgrent_r_proto" in
10495         ''|0) try='int endgrent_r(FILE**);'
10496         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
10497         esac
10498         case "$endgrent_r_proto" in
10499         ''|0) try='void endgrent_r(FILE**);'
10500         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
10501         esac
10502         case "$endgrent_r_proto" in
10503         ''|0)   d_endgrent_r=undef
10504                 endgrent_r_proto=0
10505                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10506         * )     case "$endgrent_r_proto" in
10507                 REENTRANT_PROTO*) ;;
10508                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
10509                 esac
10510                 echo "Prototype: $try" ;;
10511         esac
10512         ;;
10513         *)      case "$usethreads" in
10514                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
10515                 esac
10516                 d_endgrent_r=undef
10517                 endgrent_r_proto=0
10518                 ;;
10519         esac
10520         ;;
10521 *)      endgrent_r_proto=0
10522         ;;
10523 esac
10524
10525 : see if endhostent exists
10526 set endhostent d_endhent
10527 eval $inlibc
10528
10529 : see if this is a netdb.h system
10530 set netdb.h i_netdb
10531 eval $inhdr
10532
10533 : see if endhostent_r exists
10534 set endhostent_r d_endhostent_r
10535 eval $inlibc
10536 case "$d_endhostent_r" in
10537 "$define")
10538         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10539         case "$d_endhostent_r_proto:$usethreads" in
10540         ":define")      d_endhostent_r_proto=define
10541                 set d_endhostent_r_proto endhostent_r $hdrs
10542                 eval $hasproto ;;
10543         *)      ;;
10544         esac
10545         case "$d_endhostent_r_proto" in
10546         define)
10547         case "$endhostent_r_proto" in
10548         ''|0) try='int endhostent_r(struct hostent_data*);'
10549         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
10550         esac
10551         case "$endhostent_r_proto" in
10552         ''|0) try='void endhostent_r(struct hostent_data*);'
10553         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
10554         esac
10555         case "$endhostent_r_proto" in
10556         ''|0)   d_endhostent_r=undef
10557                 endhostent_r_proto=0
10558                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10559         * )     case "$endhostent_r_proto" in
10560                 REENTRANT_PROTO*) ;;
10561                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
10562                 esac
10563                 echo "Prototype: $try" ;;
10564         esac
10565         ;;
10566         *)      case "$usethreads" in
10567                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
10568                 esac
10569                 d_endhostent_r=undef
10570                 endhostent_r_proto=0
10571                 ;;
10572         esac
10573         ;;
10574 *)      endhostent_r_proto=0
10575         ;;
10576 esac
10577
10578 : see if endnetent exists
10579 set endnetent d_endnent
10580 eval $inlibc
10581
10582 : see if endnetent_r exists
10583 set endnetent_r d_endnetent_r
10584 eval $inlibc
10585 case "$d_endnetent_r" in
10586 "$define")
10587         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10588         case "$d_endnetent_r_proto:$usethreads" in
10589         ":define")      d_endnetent_r_proto=define
10590                 set d_endnetent_r_proto endnetent_r $hdrs
10591                 eval $hasproto ;;
10592         *)      ;;
10593         esac
10594         case "$d_endnetent_r_proto" in
10595         define)
10596         case "$endnetent_r_proto" in
10597         ''|0) try='int endnetent_r(struct netent_data*);'
10598         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
10599         esac
10600         case "$endnetent_r_proto" in
10601         ''|0) try='void endnetent_r(struct netent_data*);'
10602         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
10603         esac
10604         case "$endnetent_r_proto" in
10605         ''|0)   d_endnetent_r=undef
10606                 endnetent_r_proto=0
10607                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10608         * )     case "$endnetent_r_proto" in
10609                 REENTRANT_PROTO*) ;;
10610                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
10611                 esac
10612                 echo "Prototype: $try" ;;
10613         esac
10614         ;;
10615         *)      case "$usethreads" in
10616                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
10617                 esac
10618                 d_endnetent_r=undef
10619                 endnetent_r_proto=0
10620                 ;;
10621         esac
10622         ;;
10623 *)      endnetent_r_proto=0
10624         ;;
10625 esac
10626
10627 : see if endprotoent exists
10628 set endprotoent d_endpent
10629 eval $inlibc
10630
10631 : see if endprotoent_r exists
10632 set endprotoent_r d_endprotoent_r
10633 eval $inlibc
10634 case "$d_endprotoent_r" in
10635 "$define")
10636         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10637         case "$d_endprotoent_r_proto:$usethreads" in
10638         ":define")      d_endprotoent_r_proto=define
10639                 set d_endprotoent_r_proto endprotoent_r $hdrs
10640                 eval $hasproto ;;
10641         *)      ;;
10642         esac
10643         case "$d_endprotoent_r_proto" in
10644         define)
10645         case "$endprotoent_r_proto" in
10646         ''|0) try='int endprotoent_r(struct protoent_data*);'
10647         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
10648         esac
10649         case "$endprotoent_r_proto" in
10650         ''|0) try='void endprotoent_r(struct protoent_data*);'
10651         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
10652         esac
10653         case "$endprotoent_r_proto" in
10654         ''|0)   d_endprotoent_r=undef
10655                 endprotoent_r_proto=0
10656                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10657         * )     case "$endprotoent_r_proto" in
10658                 REENTRANT_PROTO*) ;;
10659                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
10660                 esac
10661                 echo "Prototype: $try" ;;
10662         esac
10663         ;;
10664         *)      case "$usethreads" in
10665                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
10666                 esac
10667                 d_endprotoent_r=undef
10668                 endprotoent_r_proto=0
10669                 ;;
10670         esac
10671         ;;
10672 *)      endprotoent_r_proto=0
10673         ;;
10674 esac
10675
10676 : see if endpwent exists
10677 set endpwent d_endpwent
10678 eval $inlibc
10679
10680 : see if this is a pwd.h system
10681 set pwd.h i_pwd
10682 eval $inhdr
10683
10684 case "$i_pwd" in
10685 $define)
10686         xxx=`./findhdr pwd.h`
10687         $cppstdin $cppflags $cppminus < $xxx >$$.h
10688
10689         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10690                 val="$define"
10691         else
10692                 val="$undef"
10693         fi
10694         set d_pwquota
10695         eval $setvar
10696
10697         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10698                 val="$define"
10699         else
10700                 val="$undef"
10701         fi
10702         set d_pwage
10703         eval $setvar
10704
10705         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10706                 val="$define"
10707         else
10708                 val="$undef"
10709         fi
10710         set d_pwchange
10711         eval $setvar
10712
10713         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10714                 val="$define"
10715         else
10716                 val="$undef"
10717         fi
10718         set d_pwclass
10719         eval $setvar
10720
10721         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10722                 val="$define"
10723         else
10724                 val="$undef"
10725         fi
10726         set d_pwexpire
10727         eval $setvar
10728
10729         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10730                 val="$define"
10731         else
10732                 val="$undef"
10733         fi
10734         set d_pwcomment
10735         eval $setvar
10736
10737         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10738                 val="$define"
10739         else
10740                 val="$undef"
10741         fi
10742         set d_pwgecos
10743         eval $setvar
10744
10745         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10746                 val="$define"
10747         else
10748                 val="$undef"
10749         fi
10750         set d_pwpasswd
10751         eval $setvar
10752
10753         $rm -f $$.h
10754         ;;
10755 *)
10756         val="$undef"; 
10757         set d_pwquota; eval $setvar
10758         set d_pwage; eval $setvar
10759         set d_pwchange; eval $setvar
10760         set d_pwclass; eval $setvar
10761         set d_pwexpire; eval $setvar
10762         set d_pwcomment; eval $setvar
10763         set d_pwgecos; eval $setvar
10764         set d_pwpasswd; eval $setvar
10765         ;;
10766 esac
10767
10768 : see if endpwent_r exists
10769 set endpwent_r d_endpwent_r
10770 eval $inlibc
10771 case "$d_endpwent_r" in
10772 "$define")
10773         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
10774         case "$d_endpwent_r_proto:$usethreads" in
10775         ":define")      d_endpwent_r_proto=define
10776                 set d_endpwent_r_proto endpwent_r $hdrs
10777                 eval $hasproto ;;
10778         *)      ;;
10779         esac
10780         case "$d_endpwent_r_proto" in
10781         define)
10782         case "$endpwent_r_proto" in
10783         ''|0) try='int endpwent_r(FILE**);'
10784         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
10785         esac
10786         case "$endpwent_r_proto" in
10787         ''|0) try='void endpwent_r(FILE**);'
10788         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
10789         esac
10790         case "$endpwent_r_proto" in
10791         ''|0)   d_endpwent_r=undef
10792                 endpwent_r_proto=0
10793                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10794         * )     case "$endpwent_r_proto" in
10795                 REENTRANT_PROTO*) ;;
10796                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
10797                 esac
10798                 echo "Prototype: $try" ;;
10799         esac
10800         ;;
10801         *)      case "$usethreads" in
10802                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
10803                 esac
10804                 d_endpwent_r=undef
10805                 endpwent_r_proto=0
10806                 ;;
10807         esac
10808         ;;
10809 *)      endpwent_r_proto=0
10810         ;;
10811 esac
10812
10813 : see if endservent exists
10814 set endservent d_endsent
10815 eval $inlibc
10816
10817 : see if endservent_r exists
10818 set endservent_r d_endservent_r
10819 eval $inlibc
10820 case "$d_endservent_r" in
10821 "$define")
10822         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10823         case "$d_endservent_r_proto:$usethreads" in
10824         ":define")      d_endservent_r_proto=define
10825                 set d_endservent_r_proto endservent_r $hdrs
10826                 eval $hasproto ;;
10827         *)      ;;
10828         esac
10829         case "$d_endservent_r_proto" in
10830         define)
10831         case "$endservent_r_proto" in
10832         ''|0) try='int endservent_r(struct servent_data*);'
10833         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
10834         esac
10835         case "$endservent_r_proto" in
10836         ''|0) try='void endservent_r(struct servent_data*);'
10837         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
10838         esac
10839         case "$endservent_r_proto" in
10840         ''|0)   d_endservent_r=undef
10841                 endservent_r_proto=0
10842                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10843         * )     case "$endservent_r_proto" in
10844                 REENTRANT_PROTO*) ;;
10845                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
10846                 esac
10847                 echo "Prototype: $try" ;;
10848         esac
10849         ;;
10850         *)      case "$usethreads" in
10851                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
10852                 esac
10853                 d_endservent_r=undef
10854                 endservent_r_proto=0
10855                 ;;
10856         esac
10857         ;;
10858 *)      endservent_r_proto=0
10859         ;;
10860 esac
10861
10862 : Locate the flags for 'open()'
10863 echo " "
10864 $cat >try.c <<'EOCP'
10865 #include <sys/types.h>
10866 #ifdef I_FCNTL
10867 #include <fcntl.h>
10868 #endif
10869 #ifdef I_SYS_FILE
10870 #include <sys/file.h>
10871 #endif
10872 int main() {
10873         if(O_RDONLY);
10874 #ifdef O_TRUNC
10875         exit(0);
10876 #else
10877         exit(1);
10878 #endif
10879 }
10880 EOCP
10881 : check sys/file.h first to get FREAD on Sun
10882 if $test `./findhdr sys/file.h` && \
10883                 set try -DI_SYS_FILE && eval $compile; then
10884         h_sysfile=true;
10885         echo "<sys/file.h> defines the O_* constants..." >&4
10886         if $run ./try; then
10887                 echo "and you have the 3 argument form of open()." >&4
10888                 val="$define"
10889         else
10890                 echo "but not the 3 argument form of open().  Oh, well." >&4
10891                 val="$undef"
10892         fi
10893 elif $test `./findhdr fcntl.h` && \
10894                 set try -DI_FCNTL && eval $compile; then
10895         h_fcntl=true;
10896         echo "<fcntl.h> defines the O_* constants..." >&4
10897         if $run ./try; then
10898                 echo "and you have the 3 argument form of open()." >&4
10899                 val="$define"
10900         else
10901                 echo "but not the 3 argument form of open().  Oh, well." >&4
10902                 val="$undef"
10903         fi
10904 else
10905         val="$undef"
10906         echo "I can't find the O_* constant definitions!  You got problems." >&4
10907 fi
10908 set d_open3
10909 eval $setvar
10910 $rm -f try try.*
10911
10912 : see which of string.h or strings.h is needed
10913 echo " "
10914 strings=`./findhdr string.h`
10915 if $test "$strings" && $test -r "$strings"; then
10916         echo "Using <string.h> instead of <strings.h>." >&4
10917         val="$define"
10918 else
10919         val="$undef"
10920         strings=`./findhdr strings.h`
10921         if $test "$strings" && $test -r "$strings"; then
10922                 echo "Using <strings.h> instead of <string.h>." >&4
10923         else
10924                 echo "No string header found -- You'll surely have problems." >&4
10925         fi
10926 fi
10927 set i_string
10928 eval $setvar
10929 case "$i_string" in
10930 "$undef") strings=`./findhdr strings.h`;;
10931 *)        strings=`./findhdr string.h`;;
10932 esac
10933
10934 : see if this is a sys/file.h system
10935 val=''
10936 set sys/file.h val
10937 eval $inhdr
10938
10939 : do we need to include sys/file.h ?
10940 case "$val" in
10941 "$define")
10942         echo " "
10943         if $h_sysfile; then
10944                 val="$define"
10945                 echo "We'll be including <sys/file.h>." >&4
10946         else
10947                 val="$undef"
10948                 echo "We won't be including <sys/file.h>." >&4
10949         fi
10950         ;;
10951 *)
10952         h_sysfile=false
10953         ;;
10954 esac
10955 set i_sysfile
10956 eval $setvar
10957
10958 : see if fcntl.h is there
10959 val=''
10960 set fcntl.h val
10961 eval $inhdr
10962
10963 : see if we can include fcntl.h
10964 case "$val" in
10965 "$define")
10966         echo " "
10967         if $h_fcntl; then
10968                 val="$define"
10969                 echo "We'll be including <fcntl.h>." >&4
10970         else
10971                 val="$undef"
10972                 if $h_sysfile; then
10973         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
10974                 else
10975                         echo "We won't be including <fcntl.h>." >&4
10976                 fi
10977         fi
10978         ;;
10979 *)
10980         h_fcntl=false
10981         val="$undef"
10982         ;;
10983 esac
10984 set i_fcntl
10985 eval $setvar
10986
10987 : check for non-blocking I/O stuff
10988 case "$h_sysfile" in
10989 true) echo "#include <sys/file.h>" > head.c;;
10990 *)
10991        case "$h_fcntl" in
10992        true) echo "#include <fcntl.h>" > head.c;;
10993        *) echo "#include <sys/fcntl.h>" > head.c;;
10994        esac
10995        ;;
10996 esac
10997 echo " "
10998 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
10999 case "$o_nonblock" in
11000 '')
11001         $cat head.c > try.c
11002         $cat >>try.c <<EOCP
11003 #include <stdio.h>
11004 #include <stdlib.h>
11005 #$i_fcntl I_FCNTL
11006 #ifdef I_FCNTL
11007 #include <fcntl.h>
11008 #endif
11009 int main() {
11010 #ifdef O_NONBLOCK
11011         printf("O_NONBLOCK\n");
11012         exit(0);
11013 #endif
11014 #ifdef O_NDELAY
11015         printf("O_NDELAY\n");
11016         exit(0);
11017 #endif
11018 #ifdef FNDELAY
11019         printf("FNDELAY\n");
11020         exit(0);
11021 #endif
11022         exit(0);
11023 }
11024 EOCP
11025         set try
11026         if eval $compile_ok; then
11027                 o_nonblock=`$run ./try`
11028                 case "$o_nonblock" in
11029                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11030                 *) echo "Seems like we can use $o_nonblock.";;
11031                 esac
11032         else
11033                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11034         fi
11035         ;;
11036 *) echo "Using $hint value $o_nonblock.";;
11037 esac
11038 $rm -f try try.* .out core
11039
11040 echo " "
11041 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11042 case "$eagain" in
11043 '')
11044         $cat head.c > try.c
11045         $cat >>try.c <<EOCP
11046 #include <errno.h>
11047 #include <sys/types.h>
11048 #include <signal.h>
11049 #include <stdio.h> 
11050 #include <stdlib.h> 
11051 #$i_fcntl I_FCNTL
11052 #ifdef I_FCNTL
11053 #include <fcntl.h>
11054 #endif
11055 #define MY_O_NONBLOCK $o_nonblock
11056 #ifndef errno  /* XXX need better Configure test */
11057 extern int errno;
11058 #endif
11059 #$i_unistd I_UNISTD
11060 #ifdef I_UNISTD
11061 #include <unistd.h>
11062 #endif
11063 #$i_string I_STRING
11064 #ifdef I_STRING
11065 #include <string.h>
11066 #else
11067 #include <strings.h>
11068 #endif
11069 $signal_t blech(x) int x; { exit(3); }
11070 EOCP
11071         $cat >> try.c <<'EOCP'
11072 int main()
11073 {
11074         int pd[2];
11075         int pu[2];
11076         char buf[1];
11077         char string[100];
11078
11079         pipe(pd);       /* Down: child -> parent */
11080         pipe(pu);       /* Up: parent -> child */
11081         if (0 != fork()) {
11082                 int ret;
11083                 close(pd[1]);   /* Parent reads from pd[0] */
11084                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11085 #ifdef F_SETFL
11086                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11087                         exit(1);
11088 #else
11089                 exit(4);
11090 #endif
11091                 signal(SIGALRM, blech);
11092                 alarm(5);
11093                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11094                         exit(2);
11095                 sprintf(string, "%d\n", ret);
11096                 write(2, string, strlen(string));
11097                 alarm(0);
11098 #ifdef EAGAIN
11099                 if (errno == EAGAIN) {
11100                         printf("EAGAIN\n");
11101                         goto ok;
11102                 }
11103 #endif
11104 #ifdef EWOULDBLOCK
11105                 if (errno == EWOULDBLOCK)
11106                         printf("EWOULDBLOCK\n");
11107 #endif
11108         ok:
11109                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11110                 sleep(2);                               /* Give it time to close our pipe */
11111                 alarm(5);
11112                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11113                 alarm(0);
11114                 sprintf(string, "%d\n", ret);
11115                 write(4, string, strlen(string));
11116                 exit(0);
11117         }
11118
11119         close(pd[0]);                   /* We write to pd[1] */
11120         close(pu[1]);                   /* We read from pu[0] */
11121         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11122         close(pd[1]);                   /* Pipe pd is now fully closed! */
11123         exit(0);                                /* Bye bye, thank you for playing! */
11124 }
11125 EOCP
11126         set try
11127         if eval $compile_ok; then
11128                 echo "$startsh" >mtry
11129                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11130                 chmod +x mtry
11131                 ./mtry >/dev/null 2>&1
11132                 case $? in
11133                 0) eagain=`$cat try.out`;;
11134                 1) echo "Could not perform non-blocking setting!";;
11135                 2) echo "I did a successful read() for something that was not there!";;
11136                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11137                 4) echo "Could not find F_SETFL!";;
11138                 *) echo "Something terribly wrong happened during testing.";;
11139                 esac
11140                 rd_nodata=`$cat try.ret`
11141                 echo "A read() system call with no data present returns $rd_nodata."
11142                 case "$rd_nodata" in
11143                 0|-1) ;;
11144                 *)
11145                         echo "(That's peculiar, fixing that to be -1.)"
11146                         rd_nodata=-1
11147                         ;;
11148                 esac
11149                 case "$eagain" in
11150                 '')
11151                         echo "Forcing errno EAGAIN on read() with no data available."
11152                         eagain=EAGAIN
11153                         ;;
11154                 *)
11155                         echo "Your read() sets errno to $eagain when no data is available."
11156                         ;;
11157                 esac
11158                 status=`$cat try.err`
11159                 case "$status" in
11160                 0) echo "And it correctly returns 0 to signal EOF.";;
11161                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11162                 *) echo "However, your read() returns '$status' on EOF??";;
11163                 esac
11164                 val="$define"
11165                 if test "$status" = "$rd_nodata"; then
11166                         echo "WARNING: you can't distinguish between EOF and no data!"
11167                         val="$undef"
11168                 fi
11169         else
11170                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11171                 eagain=EAGAIN
11172         fi
11173         set d_eofnblk
11174         eval $setvar
11175         ;;
11176 *)
11177         echo "Using $hint value $eagain."
11178         echo "Your read() returns $rd_nodata when no data is present."
11179         case "$d_eofnblk" in
11180         "$define") echo "And you can see EOF because read() returns 0.";;
11181         "$undef") echo "But you can't see EOF status from read() returned value.";;
11182         *)
11183                 echo "(Assuming you can't see EOF status from read anyway.)"
11184                 d_eofnblk=$undef
11185                 ;;
11186         esac
11187         ;;
11188 esac
11189 $rm -f try try.* .out core head.c mtry
11190
11191 : see if fchdir exists
11192 set fchdir d_fchdir
11193 eval $inlibc
11194
11195 : see if fchmod exists
11196 set fchmod d_fchmod
11197 eval $inlibc
11198
11199 : see if fchown exists
11200 set fchown d_fchown
11201 eval $inlibc
11202
11203 : see if this is an fcntl system
11204 set fcntl d_fcntl
11205 eval $inlibc
11206
11207 echo " "
11208 : See if fcntl-based locking works.
11209 $cat >try.c <<EOCP
11210 #include <stdlib.h>
11211 #include <unistd.h>
11212 #include <fcntl.h>
11213 #include <signal.h>
11214 $signal_t blech(x) int x; { exit(3); }
11215 int main() {
11216 #if defined(F_SETLK) && defined(F_SETLKW)
11217      struct flock flock;
11218      int retval, fd;
11219      fd = open("try.c", O_RDONLY);
11220      flock.l_type = F_RDLCK;
11221      flock.l_whence = SEEK_SET;
11222      flock.l_start = flock.l_len = 0;
11223      signal(SIGALRM, blech);
11224      alarm(10);
11225      retval = fcntl(fd, F_SETLK, &flock);
11226      close(fd);
11227      (retval < 0 ? exit(2) : exit(0));
11228 #else
11229      exit(2);
11230 #endif
11231 }
11232 EOCP
11233 echo "Checking if fcntl-based file locking works... "
11234 case "$d_fcntl" in
11235 "$define")
11236         set try
11237         if eval $compile_ok; then
11238                 if $run ./try; then
11239                         echo "Yes, it seems to work."
11240                         val="$define"
11241                 else
11242                         echo "Nope, it didn't work."
11243                         val="$undef"
11244                         case "$?" in
11245                         3) $cat >&4 <<EOM
11246 ***
11247 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
11248 *** This is (almost) impossible.
11249 *** If your NFS lock daemons are not feeling well, something like
11250 *** this may happen, please investigate.  Cannot continue, aborting.
11251 ***
11252 EOM
11253                                 exit 1
11254                                 ;;
11255                         esac
11256                 fi
11257         else
11258                 echo "I'm unable to compile the test program, so I'll assume not."
11259                 val="$undef"
11260         fi
11261         ;;
11262 *) val="$undef";
11263         echo "Nope, since you don't even have fcntl()."
11264         ;;
11265 esac
11266 set d_fcntl_can_lock
11267 eval $setvar
11268 $rm -f try*
11269
11270
11271 : check for fd_set items
11272 $cat <<EOM
11273
11274 Checking to see how well your C compiler handles fd_set and friends ...
11275 EOM
11276 $cat >try.c <<EOCP
11277 #$i_systime I_SYS_TIME
11278 #$i_sysselct I_SYS_SELECT
11279 #$d_socket HAS_SOCKET
11280 #include <sys/types.h>
11281 #ifdef HAS_SOCKET
11282 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
11283 #endif
11284 #ifdef I_SYS_TIME
11285 #include <sys/time.h>
11286 #endif
11287 #ifdef I_SYS_SELECT
11288 #include <sys/select.h>
11289 #endif
11290 int main() {
11291         fd_set fds;
11292
11293 #ifdef TRYBITS
11294         if(fds.fds_bits);
11295 #endif
11296
11297 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
11298         exit(0);
11299 #else
11300         exit(1);
11301 #endif
11302 }
11303 EOCP
11304 set try -DTRYBITS
11305 if eval $compile; then
11306         d_fds_bits="$define"
11307         d_fd_set="$define"
11308         echo "Well, your system knows about the normal fd_set typedef..." >&4
11309         if $run ./try; then
11310                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
11311                 d_fd_macros="$define"
11312         else
11313                 $cat >&4 <<'EOM'
11314 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
11315 EOM
11316                 d_fd_macros="$undef"
11317         fi
11318 else
11319         $cat <<'EOM'
11320 Hmm, your compiler has some difficulty with fd_set.  Checking further...
11321 EOM
11322         set try
11323         if eval $compile; then
11324                 d_fds_bits="$undef"
11325                 d_fd_set="$define"
11326                 echo "Well, your system has some sort of fd_set available..." >&4
11327                 if $run ./try; then
11328                         echo "and you have the normal fd_set macros." >&4
11329                         d_fd_macros="$define"
11330                 else
11331                         $cat <<'EOM'
11332 but not the normal fd_set macros!  Gross!  More work for me...
11333 EOM
11334                         d_fd_macros="$undef"
11335                 fi
11336         else
11337         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
11338                 d_fd_set="$undef"
11339                 d_fds_bits="$undef"
11340                 d_fd_macros="$undef"
11341         fi
11342 fi
11343 $rm -f try try.*
11344
11345 : see if fgetpos exists
11346 set fgetpos d_fgetpos
11347 eval $inlibc
11348
11349 : see if finite exists
11350 set finite d_finite
11351 eval $inlibc
11352
11353 : see if finitel exists
11354 set finitel d_finitel
11355 eval $inlibc
11356
11357 : see if flock exists
11358 set flock d_flock
11359 eval $inlibc
11360
11361 : see if prototype for flock is available
11362 echo " "
11363 set d_flockproto flock $i_sysfile sys/file.h
11364 eval $hasproto
11365
11366 : see if fork exists
11367 set fork d_fork
11368 eval $inlibc
11369
11370 : see if fp_class exists
11371 set fp_class d_fp_class
11372 eval $inlibc
11373
11374 : see if pathconf exists
11375 set pathconf d_pathconf
11376 eval $inlibc
11377
11378 : see if fpathconf exists
11379 set fpathconf d_fpathconf
11380 eval $inlibc
11381
11382 : see if fpclass exists
11383 set fpclass d_fpclass
11384 eval $inlibc
11385
11386 : see if fpclassify exists
11387 set fpclassify d_fpclassify
11388 eval $inlibc
11389
11390 : see if fpclassl exists
11391 set fpclassl d_fpclassl
11392 eval $inlibc
11393
11394
11395 : check for fpos64_t
11396 echo " "
11397 echo "Checking to see if you have fpos64_t..." >&4
11398 $cat >try.c <<EOCP
11399 #include <stdio.h>
11400 int main() { fpos64_t x = 7; }
11401 EOCP
11402 set try
11403 if eval $compile; then
11404         val="$define"
11405         echo "You have fpos64_t."
11406 else
11407         val="$undef"
11408         echo "You do not have fpos64_t."
11409         case "$fpossize" in
11410         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
11411         esac
11412 fi
11413 $rm -f try.* try
11414 set d_fpos64_t
11415 eval $setvar
11416
11417 : see if frexpl exists
11418 set frexpl d_frexpl
11419 eval $inlibc
11420
11421 : see if this is a sys/param system
11422 set sys/param.h i_sysparam
11423 eval $inhdr
11424
11425 : see if this is a sys/mount.h system
11426 set sys/mount.h i_sysmount
11427 eval $inhdr
11428
11429
11430 echo " "
11431 echo "Checking to see if your system supports struct fs_data..." >&4
11432 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
11433 eval $hasstruct
11434 case "$d_fs_data_s" in
11435 "$define")      echo "Yes, it does."   ;;
11436 *)              echo "No, it doesn't." ;;
11437 esac
11438
11439 : see if fseeko exists
11440 set fseeko d_fseeko
11441 eval $inlibc
11442 case "$longsize" in
11443 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
11444 esac
11445
11446 : see if fsetpos exists
11447 set fsetpos d_fsetpos
11448 eval $inlibc
11449
11450
11451 : see if fstatfs exists
11452 set fstatfs d_fstatfs
11453 eval $inlibc
11454
11455
11456 : see if statvfs exists
11457 set statvfs d_statvfs
11458 eval $inlibc
11459
11460 : see if fstatvfs exists
11461 set fstatvfs d_fstatvfs
11462 eval $inlibc
11463
11464
11465 : see if fsync exists
11466 set fsync d_fsync
11467 eval $inlibc
11468
11469 : see if ftello exists
11470 set ftello d_ftello
11471 eval $inlibc
11472 case "$longsize" in
11473 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
11474 esac
11475
11476 : see if getcwd exists
11477 set getcwd d_getcwd
11478 eval $inlibc
11479
11480 : see if getespwnam exists
11481 set getespwnam d_getespwnam
11482 eval $inlibc
11483
11484
11485 : see if getfsstat exists
11486 set getfsstat d_getfsstat
11487 eval $inlibc
11488
11489 : see if getgrent exists
11490 set getgrent d_getgrent
11491 eval $inlibc
11492
11493 : see if getgrent_r exists
11494 set getgrent_r d_getgrent_r
11495 eval $inlibc
11496 case "$d_getgrent_r" in
11497 "$define")
11498         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11499         case "$d_getgrent_r_proto:$usethreads" in
11500         ":define")      d_getgrent_r_proto=define
11501                 set d_getgrent_r_proto getgrent_r $hdrs
11502                 eval $hasproto ;;
11503         *)      ;;
11504         esac
11505         case "$d_getgrent_r_proto" in
11506         define)
11507         case "$getgrent_r_proto" in
11508         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
11509         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
11510         esac
11511         case "$getgrent_r_proto" in
11512         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
11513         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
11514         esac
11515         case "$getgrent_r_proto" in
11516         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
11517         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
11518         esac
11519         case "$getgrent_r_proto" in
11520         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
11521         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
11522         esac
11523         case "$getgrent_r_proto" in
11524         ''|0) try='int getgrent_r(struct group*, char*, int);'
11525         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
11526         esac
11527         case "$getgrent_r_proto" in
11528         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
11529         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
11530         esac
11531         case "$getgrent_r_proto" in
11532         ''|0)   d_getgrent_r=undef
11533                 getgrent_r_proto=0
11534                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
11535         * )     case "$getgrent_r_proto" in
11536                 REENTRANT_PROTO*) ;;
11537                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
11538                 esac
11539                 echo "Prototype: $try" ;;
11540         esac
11541         ;;
11542         *)      case "$usethreads" in
11543                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
11544                 esac
11545                 d_getgrent_r=undef
11546                 getgrent_r_proto=0
11547                 ;;
11548         esac
11549         ;;
11550 *)      getgrent_r_proto=0
11551         ;;
11552 esac
11553
11554 : see if getgrgid_r exists
11555 set getgrgid_r d_getgrgid_r
11556 eval $inlibc
11557 case "$d_getgrgid_r" in
11558 "$define")
11559         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11560         case "$d_getgrgid_r_proto:$usethreads" in
11561         ":define")      d_getgrgid_r_proto=define
11562                 set d_getgrgid_r_proto getgrgid_r $hdrs
11563                 eval $hasproto ;;
11564         *)      ;;
11565         esac
11566         case "$d_getgrgid_r_proto" in
11567         define)
11568         case "$getgrgid_r_proto" in
11569         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
11570         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
11571         esac
11572         case "$getgrgid_r_proto" in
11573         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
11574         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
11575         esac
11576         case "$getgrgid_r_proto" in
11577         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
11578         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
11579         esac
11580         case "$getgrgid_r_proto" in
11581         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
11582         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
11583         esac
11584         case "$getgrgid_r_proto" in
11585         ''|0)   d_getgrgid_r=undef
11586                 getgrgid_r_proto=0
11587                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
11588         * )     case "$getgrgid_r_proto" in
11589                 REENTRANT_PROTO*) ;;
11590                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
11591                 esac
11592                 echo "Prototype: $try" ;;
11593         esac
11594         ;;
11595         *)      case "$usethreads" in
11596                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
11597                 esac
11598                 d_getgrgid_r=undef
11599                 getgrgid_r_proto=0
11600                 ;;
11601         esac
11602         ;;
11603 *)      getgrgid_r_proto=0
11604         ;;
11605 esac
11606
11607 : see if getgrnam_r exists
11608 set getgrnam_r d_getgrnam_r
11609 eval $inlibc
11610 case "$d_getgrnam_r" in
11611 "$define")
11612         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11613         case "$d_getgrnam_r_proto:$usethreads" in
11614         ":define")      d_getgrnam_r_proto=define
11615                 set d_getgrnam_r_proto getgrnam_r $hdrs
11616                 eval $hasproto ;;
11617         *)      ;;
11618         esac
11619         case "$d_getgrnam_r_proto" in
11620         define)
11621         case "$getgrnam_r_proto" in
11622         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
11623         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
11624         esac
11625         case "$getgrnam_r_proto" in
11626         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
11627         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
11628         esac
11629         case "$getgrnam_r_proto" in
11630         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
11631         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
11632         esac
11633         case "$getgrnam_r_proto" in
11634         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
11635         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
11636         esac
11637         case "$getgrnam_r_proto" in
11638         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
11639         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
11640         esac
11641         case "$getgrnam_r_proto" in
11642         ''|0)   d_getgrnam_r=undef
11643                 getgrnam_r_proto=0
11644                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
11645         * )     case "$getgrnam_r_proto" in
11646                 REENTRANT_PROTO*) ;;
11647                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
11648                 esac
11649                 echo "Prototype: $try" ;;
11650         esac
11651         ;;
11652         *)      case "$usethreads" in
11653                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
11654                 esac
11655                 d_getgrnam_r=undef
11656                 getgrnam_r_proto=0
11657                 ;;
11658         esac
11659         ;;
11660 *)      getgrnam_r_proto=0
11661         ;;
11662 esac
11663
11664 : see if gethostbyaddr exists
11665 set gethostbyaddr d_gethbyaddr
11666 eval $inlibc
11667
11668 : see if gethostbyname exists
11669 set gethostbyname d_gethbyname
11670 eval $inlibc
11671
11672 : see if gethostent exists
11673 set gethostent d_gethent
11674 eval $inlibc
11675
11676 : see how we will look up host name
11677 echo " "
11678 call=''
11679 if set gethostname val -f d_gethname; eval $csym; $val; then
11680         echo 'gethostname() found.' >&4
11681         d_gethname="$define"
11682         call=gethostname
11683 fi
11684 if set uname val -f d_uname; eval $csym; $val; then
11685         if ./xenix; then
11686                 $cat <<'EOM'
11687 uname() was found, but you're running xenix, and older versions of xenix
11688 have a broken uname(). If you don't really know whether your xenix is old
11689 enough to have a broken system call, use the default answer.
11690
11691 EOM
11692                 dflt=y
11693                 case "$d_uname" in
11694                 "$define") dflt=n;;
11695                 esac
11696                 rp='Is your uname() broken?'
11697                 . ./myread
11698                 case "$ans" in
11699                 n*) d_uname="$define"; call=uname;;
11700                 esac
11701         else
11702                 echo 'uname() found.' >&4
11703                 d_uname="$define"
11704                 case "$call" in
11705                 '') call=uname ;;
11706                 esac
11707         fi
11708 fi
11709 case "$d_gethname" in
11710 '') d_gethname="$undef";;
11711 esac
11712 case "$d_uname" in
11713 '') d_uname="$undef";;
11714 esac
11715 case "$d_uname$d_gethname" in
11716 *define*)
11717         dflt=n
11718         cat <<EOM
11719  
11720 Every now and then someone has a $call() that lies about the hostname
11721 but can't be fixed for political or economic reasons.  If you wish, I can
11722 pretend $call() isn't there and maybe compute hostname at run-time
11723 thanks to the '$phostname' command.
11724
11725 EOM
11726         rp="Shall I ignore $call() from now on?"
11727         . ./myread
11728         case "$ans" in
11729         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
11730         esac;;
11731 esac
11732 case "$phostname" in
11733 '') aphostname='';;
11734 *) case "$aphostname" in
11735         /*) ;;
11736         *) set X $phostname
11737                 shift
11738                 file=$1
11739                 shift
11740                 file=`./loc $file $file $pth`
11741                 aphostname=`echo $file $*`
11742                 ;;
11743         esac
11744         ;;
11745 esac
11746 case "$d_uname$d_gethname" in
11747 *define*) ;;
11748 *)
11749         case "$phostname" in
11750         '')
11751                 echo "There will be no way for $package to get your hostname." >&4;;
11752         *)
11753         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
11754                 ;;
11755         esac;;
11756 esac
11757 case "$d_phostname" in
11758 '') d_phostname="$undef";;
11759 esac
11760
11761 : see if gethostbyaddr_r exists
11762 set gethostbyaddr_r d_gethostbyaddr_r
11763 eval $inlibc
11764 case "$d_gethostbyaddr_r" in
11765 "$define")
11766         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11767         case "$d_gethostbyaddr_r_proto:$usethreads" in
11768         ":define")      d_gethostbyaddr_r_proto=define
11769                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
11770                 eval $hasproto ;;
11771         *)      ;;
11772         esac
11773         case "$d_gethostbyaddr_r_proto" in
11774         define)
11775         case "$gethostbyaddr_r_proto" in
11776         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
11777         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
11778         esac
11779         case "$gethostbyaddr_r_proto" in
11780         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
11781         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
11782         esac
11783         case "$gethostbyaddr_r_proto" in
11784         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
11785         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
11786         esac
11787         case "$gethostbyaddr_r_proto" in
11788         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
11789         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
11790         esac
11791         case "$gethostbyaddr_r_proto" in
11792         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
11793         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
11794         esac
11795         case "$gethostbyaddr_r_proto" in
11796         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
11797         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
11798         esac
11799         case "$gethostbyaddr_r_proto" in
11800         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
11801         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
11802         esac
11803         case "$gethostbyaddr_r_proto" in
11804         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
11805         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
11806         esac
11807         case "$gethostbyaddr_r_proto" in
11808         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
11809         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
11810         esac
11811         case "$gethostbyaddr_r_proto" in
11812         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
11813         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
11814         esac
11815         case "$gethostbyaddr_r_proto" in
11816         ''|0)   d_gethostbyaddr_r=undef
11817                 gethostbyaddr_r_proto=0
11818                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
11819         * )     case "$gethostbyaddr_r_proto" in
11820                 REENTRANT_PROTO*) ;;
11821                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
11822                 esac
11823                 echo "Prototype: $try" ;;
11824         esac
11825         ;;
11826         *)      case "$usethreads" in
11827                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
11828                 esac
11829                 d_gethostbyaddr_r=undef
11830                 gethostbyaddr_r_proto=0
11831                 ;;
11832         esac
11833         ;;
11834 *)      gethostbyaddr_r_proto=0
11835         ;;
11836 esac
11837
11838 : see if gethostbyname_r exists
11839 set gethostbyname_r d_gethostbyname_r
11840 eval $inlibc
11841 case "$d_gethostbyname_r" in
11842 "$define")
11843         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11844         case "$d_gethostbyname_r_proto:$usethreads" in
11845         ":define")      d_gethostbyname_r_proto=define
11846                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
11847                 eval $hasproto ;;
11848         *)      ;;
11849         esac
11850         case "$d_gethostbyname_r_proto" in
11851         define)
11852         case "$gethostbyname_r_proto" in
11853         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
11854         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
11855         esac
11856         case "$gethostbyname_r_proto" in
11857         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
11858         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
11859         esac
11860         case "$gethostbyname_r_proto" in
11861         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
11862         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
11863         esac
11864         case "$gethostbyname_r_proto" in
11865         ''|0)   d_gethostbyname_r=undef
11866                 gethostbyname_r_proto=0
11867                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
11868         * )     case "$gethostbyname_r_proto" in
11869                 REENTRANT_PROTO*) ;;
11870                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
11871                 esac
11872                 echo "Prototype: $try" ;;
11873         esac
11874         ;;
11875         *)      case "$usethreads" in
11876                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
11877                 esac
11878                 d_gethostbyname_r=undef
11879                 gethostbyname_r_proto=0
11880                 ;;
11881         esac
11882         ;;
11883 *)      gethostbyname_r_proto=0
11884         ;;
11885 esac
11886
11887 : see if gethostent_r exists
11888 set gethostent_r d_gethostent_r
11889 eval $inlibc
11890 case "$d_gethostent_r" in
11891 "$define")
11892         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11893         case "$d_gethostent_r_proto:$usethreads" in
11894         ":define")      d_gethostent_r_proto=define
11895                 set d_gethostent_r_proto gethostent_r $hdrs
11896                 eval $hasproto ;;
11897         *)      ;;
11898         esac
11899         case "$d_gethostent_r_proto" in
11900         define)
11901         case "$gethostent_r_proto" in
11902         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
11903         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
11904         esac
11905         case "$gethostent_r_proto" in
11906         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
11907         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
11908         esac
11909         case "$gethostent_r_proto" in
11910         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
11911         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
11912         esac
11913         case "$gethostent_r_proto" in
11914         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
11915         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
11916         esac
11917         case "$gethostent_r_proto" in
11918         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
11919         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
11920         esac
11921         case "$gethostent_r_proto" in
11922         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
11923         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
11924         esac
11925         case "$gethostent_r_proto" in
11926         ''|0)   d_gethostent_r=undef
11927                 gethostent_r_proto=0
11928                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
11929         * )     case "$gethostent_r_proto" in
11930                 REENTRANT_PROTO*) ;;
11931                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
11932                 esac
11933                 echo "Prototype: $try" ;;
11934         esac
11935         ;;
11936         *)      case "$usethreads" in
11937                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
11938                 esac
11939                 d_gethostent_r=undef
11940                 gethostent_r_proto=0
11941                 ;;
11942         esac
11943         ;;
11944 *)      gethostent_r_proto=0
11945         ;;
11946 esac
11947
11948 : see if prototypes for various gethostxxx netdb.h functions are available
11949 echo " "
11950 set d_gethostprotos gethostent $i_netdb netdb.h
11951 eval $hasproto
11952
11953 : see if getitimer exists
11954 set getitimer d_getitimer
11955 eval $inlibc
11956
11957 : see if getlogin exists
11958 set getlogin d_getlogin
11959 eval $inlibc
11960
11961 : see if getlogin_r exists
11962 set getlogin_r d_getlogin_r
11963 eval $inlibc
11964 case "$d_getlogin_r" in
11965 "$define")
11966         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
11967         case "$d_getlogin_r_proto:$usethreads" in
11968         ":define")      d_getlogin_r_proto=define
11969                 set d_getlogin_r_proto getlogin_r $hdrs
11970                 eval $hasproto ;;
11971         *)      ;;
11972         esac
11973         case "$d_getlogin_r_proto" in
11974         define)
11975         case "$getlogin_r_proto" in
11976         ''|0) try='int getlogin_r(char*, size_t);'
11977         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
11978         esac
11979         case "$getlogin_r_proto" in
11980         ''|0) try='int getlogin_r(char*, int);'
11981         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
11982         esac
11983         case "$getlogin_r_proto" in
11984         ''|0) try='char* getlogin_r(char*, size_t);'
11985         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
11986         esac
11987         case "$getlogin_r_proto" in
11988         ''|0) try='char* getlogin_r(char*, int);'
11989         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
11990         esac
11991         case "$getlogin_r_proto" in
11992         ''|0)   d_getlogin_r=undef
11993                 getlogin_r_proto=0
11994                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
11995         * )     case "$getlogin_r_proto" in
11996                 REENTRANT_PROTO*) ;;
11997                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
11998                 esac
11999                 echo "Prototype: $try" ;;
12000         esac
12001         ;;
12002         *)      case "$usethreads" in
12003                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
12004                 esac
12005                 d_getlogin_r=undef
12006                 getlogin_r_proto=0
12007                 ;;
12008         esac
12009         ;;
12010 *)      getlogin_r_proto=0
12011         ;;
12012 esac
12013
12014 : see if getmnt exists
12015 set getmnt d_getmnt
12016 eval $inlibc
12017
12018 : see if getmntent exists
12019 set getmntent d_getmntent
12020 eval $inlibc
12021
12022 : see if getnetbyaddr exists
12023 set getnetbyaddr d_getnbyaddr
12024 eval $inlibc
12025
12026 : see if getnetbyname exists
12027 set getnetbyname d_getnbyname
12028 eval $inlibc
12029
12030 : see if getnetent exists
12031 set getnetent d_getnent
12032 eval $inlibc
12033
12034 : see if getnetbyaddr_r exists
12035 set getnetbyaddr_r d_getnetbyaddr_r
12036 eval $inlibc
12037 case "$d_getnetbyaddr_r" in
12038 "$define")
12039         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12040         case "$d_getnetbyaddr_r_proto:$usethreads" in
12041         ":define")      d_getnetbyaddr_r_proto=define
12042                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
12043                 eval $hasproto ;;
12044         *)      ;;
12045         esac
12046         case "$d_getnetbyaddr_r_proto" in
12047         define)
12048         case "$getnetbyaddr_r_proto" in
12049         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
12050         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
12051         esac
12052         case "$getnetbyaddr_r_proto" in
12053         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
12054         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
12055         esac
12056         case "$getnetbyaddr_r_proto" in
12057         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
12058         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
12059         esac
12060         case "$getnetbyaddr_r_proto" in
12061         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
12062         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
12063         esac
12064         case "$getnetbyaddr_r_proto" in
12065         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
12066         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
12067         esac
12068         case "$getnetbyaddr_r_proto" in
12069         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
12070         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
12071         esac
12072         case "$getnetbyaddr_r_proto" in
12073         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
12074         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
12075         esac
12076         case "$getnetbyaddr_r_proto" in
12077         ''|0)   d_getnetbyaddr_r=undef
12078                 getnetbyaddr_r_proto=0
12079                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
12080         * )     case "$getnetbyaddr_r_proto" in
12081                 REENTRANT_PROTO*) ;;
12082                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
12083                 esac
12084                 echo "Prototype: $try" ;;
12085         esac
12086         ;;
12087         *)      case "$usethreads" in
12088                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
12089                 esac
12090                 d_getnetbyaddr_r=undef
12091                 getnetbyaddr_r_proto=0
12092                 ;;
12093         esac
12094         ;;
12095 *)      getnetbyaddr_r_proto=0
12096         ;;
12097 esac
12098
12099 : see if getnetbyname_r exists
12100 set getnetbyname_r d_getnetbyname_r
12101 eval $inlibc
12102 case "$d_getnetbyname_r" in
12103 "$define")
12104         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12105         case "$d_getnetbyname_r_proto:$usethreads" in
12106         ":define")      d_getnetbyname_r_proto=define
12107                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
12108                 eval $hasproto ;;
12109         *)      ;;
12110         esac
12111         case "$d_getnetbyname_r_proto" in
12112         define)
12113         case "$getnetbyname_r_proto" in
12114         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
12115         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
12116         esac
12117         case "$getnetbyname_r_proto" in
12118         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
12119         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
12120         esac
12121         case "$getnetbyname_r_proto" in
12122         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
12123         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
12124         esac
12125         case "$getnetbyname_r_proto" in
12126         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
12127         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
12128         esac
12129         case "$getnetbyname_r_proto" in
12130         ''|0)   d_getnetbyname_r=undef
12131                 getnetbyname_r_proto=0
12132                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
12133         * )     case "$getnetbyname_r_proto" in
12134                 REENTRANT_PROTO*) ;;
12135                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
12136                 esac
12137                 echo "Prototype: $try" ;;
12138         esac
12139         ;;
12140         *)      case "$usethreads" in
12141                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
12142                 esac
12143                 d_getnetbyname_r=undef
12144                 getnetbyname_r_proto=0
12145                 ;;
12146         esac
12147         ;;
12148 *)      getnetbyname_r_proto=0
12149         ;;
12150 esac
12151
12152 : see if getnetent_r exists
12153 set getnetent_r d_getnetent_r
12154 eval $inlibc
12155 case "$d_getnetent_r" in
12156 "$define")
12157         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12158         case "$d_getnetent_r_proto:$usethreads" in
12159         ":define")      d_getnetent_r_proto=define
12160                 set d_getnetent_r_proto getnetent_r $hdrs
12161                 eval $hasproto ;;
12162         *)      ;;
12163         esac
12164         case "$d_getnetent_r_proto" in
12165         define)
12166         case "$getnetent_r_proto" in
12167         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
12168         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
12169         esac
12170         case "$getnetent_r_proto" in
12171         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
12172         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
12173         esac
12174         case "$getnetent_r_proto" in
12175         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
12176         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
12177         esac
12178         case "$getnetent_r_proto" in
12179         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
12180         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
12181         esac
12182         case "$getnetent_r_proto" in
12183         ''|0) try='int getnetent_r(struct netent*, char*, int);'
12184         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
12185         esac
12186         case "$getnetent_r_proto" in
12187         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
12188         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
12189         esac
12190         case "$getnetent_r_proto" in
12191         ''|0)   d_getnetent_r=undef
12192                 getnetent_r_proto=0
12193                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
12194         * )     case "$getnetent_r_proto" in
12195                 REENTRANT_PROTO*) ;;
12196                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
12197                 esac
12198                 echo "Prototype: $try" ;;
12199         esac
12200         ;;
12201         *)      case "$usethreads" in
12202                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
12203                 esac
12204                 d_getnetent_r=undef
12205                 getnetent_r_proto=0
12206                 ;;
12207         esac
12208         ;;
12209 *)      getnetent_r_proto=0
12210         ;;
12211 esac
12212
12213 : see if prototypes for various getnetxxx netdb.h functions are available
12214 echo " "
12215 set d_getnetprotos getnetent $i_netdb netdb.h
12216 eval $hasproto
12217
12218 : see if getpagesize exists
12219 set getpagesize d_getpagsz
12220 eval $inlibc
12221
12222
12223 : see if getprotobyname exists
12224 set getprotobyname d_getpbyname
12225 eval $inlibc
12226
12227 : see if getprotobynumber exists
12228 set getprotobynumber d_getpbynumber
12229 eval $inlibc
12230
12231 : see if getprotoent exists
12232 set getprotoent d_getpent
12233 eval $inlibc
12234
12235 : see if getpgid exists
12236 set getpgid d_getpgid
12237 eval $inlibc
12238
12239 : see if getpgrp2 exists
12240 set getpgrp2 d_getpgrp2
12241 eval $inlibc
12242
12243 : see if getppid exists
12244 set getppid d_getppid
12245 eval $inlibc
12246
12247 : see if getpriority exists
12248 set getpriority d_getprior
12249 eval $inlibc
12250
12251 : see if getprotobyname_r exists
12252 set getprotobyname_r d_getprotobyname_r
12253 eval $inlibc
12254 case "$d_getprotobyname_r" in
12255 "$define")
12256         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12257         case "$d_getprotobyname_r_proto:$usethreads" in
12258         ":define")      d_getprotobyname_r_proto=define
12259                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
12260                 eval $hasproto ;;
12261         *)      ;;
12262         esac
12263         case "$d_getprotobyname_r_proto" in
12264         define)
12265         case "$getprotobyname_r_proto" in
12266         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
12267         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
12268         esac
12269         case "$getprotobyname_r_proto" in
12270         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
12271         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
12272         esac
12273         case "$getprotobyname_r_proto" in
12274         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
12275         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
12276         esac
12277         case "$getprotobyname_r_proto" in
12278         ''|0)   d_getprotobyname_r=undef
12279                 getprotobyname_r_proto=0
12280                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
12281         * )     case "$getprotobyname_r_proto" in
12282                 REENTRANT_PROTO*) ;;
12283                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
12284                 esac
12285                 echo "Prototype: $try" ;;
12286         esac
12287         ;;
12288         *)      case "$usethreads" in
12289                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
12290                 esac
12291                 d_getprotobyname_r=undef
12292                 getprotobyname_r_proto=0
12293                 ;;
12294         esac
12295         ;;
12296 *)      getprotobyname_r_proto=0
12297         ;;
12298 esac
12299
12300 : see if getprotobynumber_r exists
12301 set getprotobynumber_r d_getprotobynumber_r
12302 eval $inlibc
12303 case "$d_getprotobynumber_r" in
12304 "$define")
12305         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12306         case "$d_getprotobynumber_r_proto:$usethreads" in
12307         ":define")      d_getprotobynumber_r_proto=define
12308                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
12309                 eval $hasproto ;;
12310         *)      ;;
12311         esac
12312         case "$d_getprotobynumber_r_proto" in
12313         define)
12314         case "$getprotobynumber_r_proto" in
12315         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
12316         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
12317         esac
12318         case "$getprotobynumber_r_proto" in
12319         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
12320         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
12321         esac
12322         case "$getprotobynumber_r_proto" in
12323         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
12324         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
12325         esac
12326         case "$getprotobynumber_r_proto" in
12327         ''|0)   d_getprotobynumber_r=undef
12328                 getprotobynumber_r_proto=0
12329                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
12330         * )     case "$getprotobynumber_r_proto" in
12331                 REENTRANT_PROTO*) ;;
12332                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
12333                 esac
12334                 echo "Prototype: $try" ;;
12335         esac
12336         ;;
12337         *)      case "$usethreads" in
12338                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
12339                 esac
12340                 d_getprotobynumber_r=undef
12341                 getprotobynumber_r_proto=0
12342                 ;;
12343         esac
12344         ;;
12345 *)      getprotobynumber_r_proto=0
12346         ;;
12347 esac
12348
12349 : see if getprotoent_r exists
12350 set getprotoent_r d_getprotoent_r
12351 eval $inlibc
12352 case "$d_getprotoent_r" in
12353 "$define")
12354         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12355         case "$d_getprotoent_r_proto:$usethreads" in
12356         ":define")      d_getprotoent_r_proto=define
12357                 set d_getprotoent_r_proto getprotoent_r $hdrs
12358                 eval $hasproto ;;
12359         *)      ;;
12360         esac
12361         case "$d_getprotoent_r_proto" in
12362         define)
12363         case "$getprotoent_r_proto" in
12364         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
12365         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
12366         esac
12367         case "$getprotoent_r_proto" in
12368         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
12369         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
12370         esac
12371         case "$getprotoent_r_proto" in
12372         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
12373         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
12374         esac
12375         case "$getprotoent_r_proto" in
12376         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
12377         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
12378         esac
12379         case "$getprotoent_r_proto" in
12380         ''|0)   d_getprotoent_r=undef
12381                 getprotoent_r_proto=0
12382                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
12383         * )     case "$getprotoent_r_proto" in
12384                 REENTRANT_PROTO*) ;;
12385                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
12386                 esac
12387                 echo "Prototype: $try" ;;
12388         esac
12389         ;;
12390         *)      case "$usethreads" in
12391                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
12392                 esac
12393                 d_getprotoent_r=undef
12394                 getprotoent_r_proto=0
12395                 ;;
12396         esac
12397         ;;
12398 *)      getprotoent_r_proto=0
12399         ;;
12400 esac
12401
12402 : see if prototypes for various getprotoxxx netdb.h functions are available
12403 echo " "
12404 set d_getprotoprotos getprotoent $i_netdb netdb.h
12405 eval $hasproto
12406
12407 : see if getprpwnam exists
12408 set getprpwnam d_getprpwnam
12409 eval $inlibc
12410
12411 : see if getpwent exists
12412 set getpwent d_getpwent
12413 eval $inlibc
12414
12415 : see if getpwent_r exists
12416 set getpwent_r d_getpwent_r
12417 eval $inlibc
12418 case "$d_getpwent_r" in
12419 "$define")
12420         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12421         case "$d_getpwent_r_proto:$usethreads" in
12422         ":define")      d_getpwent_r_proto=define
12423                 set d_getpwent_r_proto getpwent_r $hdrs
12424                 eval $hasproto ;;
12425         *)      ;;
12426         esac
12427         case "$d_getpwent_r_proto" in
12428         define)
12429         case "$getpwent_r_proto" in
12430         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
12431         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
12432         esac
12433         case "$getpwent_r_proto" in
12434         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
12435         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
12436         esac
12437         case "$getpwent_r_proto" in
12438         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
12439         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
12440         esac
12441         case "$getpwent_r_proto" in
12442         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
12443         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
12444         esac
12445         case "$getpwent_r_proto" in
12446         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
12447         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
12448         esac
12449         case "$getpwent_r_proto" in
12450         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
12451         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
12452         esac
12453         case "$getpwent_r_proto" in
12454         ''|0)   d_getpwent_r=undef
12455                 getpwent_r_proto=0
12456                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
12457         * )     case "$getpwent_r_proto" in
12458                 REENTRANT_PROTO*) ;;
12459                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
12460                 esac
12461                 echo "Prototype: $try" ;;
12462         esac
12463         ;;
12464         *)      case "$usethreads" in
12465                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
12466                 esac
12467                 d_getpwent_r=undef
12468                 getpwent_r_proto=0
12469                 ;;
12470         esac
12471         ;;
12472 *)      getpwent_r_proto=0
12473         ;;
12474 esac
12475
12476 : see if getpwnam_r exists
12477 set getpwnam_r d_getpwnam_r
12478 eval $inlibc
12479 case "$d_getpwnam_r" in
12480 "$define")
12481         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12482         case "$d_getpwnam_r_proto:$usethreads" in
12483         ":define")      d_getpwnam_r_proto=define
12484                 set d_getpwnam_r_proto getpwnam_r $hdrs
12485                 eval $hasproto ;;
12486         *)      ;;
12487         esac
12488         case "$d_getpwnam_r_proto" in
12489         define)
12490         case "$getpwnam_r_proto" in
12491         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
12492         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
12493         esac
12494         case "$getpwnam_r_proto" in
12495         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
12496         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
12497         esac
12498         case "$getpwnam_r_proto" in
12499         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
12500         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
12501         esac
12502         case "$getpwnam_r_proto" in
12503         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
12504         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
12505         esac
12506         case "$getpwnam_r_proto" in
12507         ''|0)   d_getpwnam_r=undef
12508                 getpwnam_r_proto=0
12509                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
12510         * )     case "$getpwnam_r_proto" in
12511                 REENTRANT_PROTO*) ;;
12512                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
12513                 esac
12514                 echo "Prototype: $try" ;;
12515         esac
12516         ;;
12517         *)      case "$usethreads" in
12518                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
12519                 esac
12520                 d_getpwnam_r=undef
12521                 getpwnam_r_proto=0
12522                 ;;
12523         esac
12524         ;;
12525 *)      getpwnam_r_proto=0
12526         ;;
12527 esac
12528
12529 : see if getpwuid_r exists
12530 set getpwuid_r d_getpwuid_r
12531 eval $inlibc
12532 case "$d_getpwuid_r" in
12533 "$define")
12534         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12535         case "$d_getpwuid_r_proto:$usethreads" in
12536         ":define")      d_getpwuid_r_proto=define
12537                 set d_getpwuid_r_proto getpwuid_r $hdrs
12538                 eval $hasproto ;;
12539         *)      ;;
12540         esac
12541         case "$d_getpwuid_r_proto" in
12542         define)
12543         case "$getpwuid_r_proto" in
12544         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
12545         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
12546         esac
12547         case "$getpwuid_r_proto" in
12548         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
12549         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
12550         esac
12551         case "$getpwuid_r_proto" in
12552         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
12553         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
12554         esac
12555         case "$getpwuid_r_proto" in
12556         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
12557         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
12558         esac
12559         case "$getpwuid_r_proto" in
12560         ''|0)   d_getpwuid_r=undef
12561                 getpwuid_r_proto=0
12562                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
12563         * )     case "$getpwuid_r_proto" in
12564                 REENTRANT_PROTO*) ;;
12565                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
12566                 esac
12567                 echo "Prototype: $try" ;;
12568         esac
12569         ;;
12570         *)      case "$usethreads" in
12571                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
12572                 esac
12573                 d_getpwuid_r=undef
12574                 getpwuid_r_proto=0
12575                 ;;
12576         esac
12577         ;;
12578 *)      getpwuid_r_proto=0
12579         ;;
12580 esac
12581
12582
12583 : see if getservbyname exists
12584 set getservbyname d_getsbyname
12585 eval $inlibc
12586
12587 : see if getservbyport exists
12588 set getservbyport d_getsbyport
12589 eval $inlibc
12590
12591 : see if getservent exists
12592 set getservent d_getsent
12593 eval $inlibc
12594
12595 : see if getservbyname_r exists
12596 set getservbyname_r d_getservbyname_r
12597 eval $inlibc
12598 case "$d_getservbyname_r" in
12599 "$define")
12600         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12601         case "$d_getservbyname_r_proto:$usethreads" in
12602         ":define")      d_getservbyname_r_proto=define
12603                 set d_getservbyname_r_proto getservbyname_r $hdrs
12604                 eval $hasproto ;;
12605         *)      ;;
12606         esac
12607         case "$d_getservbyname_r_proto" in
12608         define)
12609         case "$getservbyname_r_proto" in
12610         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
12611         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
12612         esac
12613         case "$getservbyname_r_proto" in
12614         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
12615         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
12616         esac
12617         case "$getservbyname_r_proto" in
12618         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
12619         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
12620         esac
12621         case "$getservbyname_r_proto" in
12622         ''|0)   d_getservbyname_r=undef
12623                 getservbyname_r_proto=0
12624                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
12625         * )     case "$getservbyname_r_proto" in
12626                 REENTRANT_PROTO*) ;;
12627                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
12628                 esac
12629                 echo "Prototype: $try" ;;
12630         esac
12631         ;;
12632         *)      case "$usethreads" in
12633                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
12634                 esac
12635                 d_getservbyname_r=undef
12636                 getservbyname_r_proto=0
12637                 ;;
12638         esac
12639         ;;
12640 *)      getservbyname_r_proto=0
12641         ;;
12642 esac
12643
12644 : see if getservbyport_r exists
12645 set getservbyport_r d_getservbyport_r
12646 eval $inlibc
12647 case "$d_getservbyport_r" in
12648 "$define")
12649         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12650         case "$d_getservbyport_r_proto:$usethreads" in
12651         ":define")      d_getservbyport_r_proto=define
12652                 set d_getservbyport_r_proto getservbyport_r $hdrs
12653                 eval $hasproto ;;
12654         *)      ;;
12655         esac
12656         case "$d_getservbyport_r_proto" in
12657         define)
12658         case "$getservbyport_r_proto" in
12659         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
12660         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
12661         esac
12662         case "$getservbyport_r_proto" in
12663         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
12664         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
12665         esac
12666         case "$getservbyport_r_proto" in
12667         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
12668         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
12669         esac
12670         case "$getservbyport_r_proto" in
12671         ''|0)   d_getservbyport_r=undef
12672                 getservbyport_r_proto=0
12673                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
12674         * )     case "$getservbyport_r_proto" in
12675                 REENTRANT_PROTO*) ;;
12676                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
12677                 esac
12678                 echo "Prototype: $try" ;;
12679         esac
12680         ;;
12681         *)      case "$usethreads" in
12682                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
12683                 esac
12684                 d_getservbyport_r=undef
12685                 getservbyport_r_proto=0
12686                 ;;
12687         esac
12688         ;;
12689 *)      getservbyport_r_proto=0
12690         ;;
12691 esac
12692
12693 : see if getservent_r exists
12694 set getservent_r d_getservent_r
12695 eval $inlibc
12696 case "$d_getservent_r" in
12697 "$define")
12698         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12699         case "$d_getservent_r_proto:$usethreads" in
12700         ":define")      d_getservent_r_proto=define
12701                 set d_getservent_r_proto getservent_r $hdrs
12702                 eval $hasproto ;;
12703         *)      ;;
12704         esac
12705         case "$d_getservent_r_proto" in
12706         define)
12707         case "$getservent_r_proto" in
12708         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
12709         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
12710         esac
12711         case "$getservent_r_proto" in
12712         ''|0) try='int getservent_r(struct servent*, char*, int);'
12713         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
12714         esac
12715         case "$getservent_r_proto" in
12716         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
12717         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
12718         esac
12719         case "$getservent_r_proto" in
12720         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
12721         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
12722         esac
12723         case "$getservent_r_proto" in
12724         ''|0)   d_getservent_r=undef
12725                 getservent_r_proto=0
12726                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
12727         * )     case "$getservent_r_proto" in
12728                 REENTRANT_PROTO*) ;;
12729                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
12730                 esac
12731                 echo "Prototype: $try" ;;
12732         esac
12733         ;;
12734         *)      case "$usethreads" in
12735                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
12736                 esac
12737                 d_getservent_r=undef
12738                 getservent_r_proto=0
12739                 ;;
12740         esac
12741         ;;
12742 *)      getservent_r_proto=0
12743         ;;
12744 esac
12745
12746 : see if prototypes for various getservxxx netdb.h functions are available
12747 echo " "
12748 set d_getservprotos getservent $i_netdb netdb.h
12749 eval $hasproto
12750
12751 : see if getspnam exists
12752 set getspnam d_getspnam
12753 eval $inlibc
12754
12755 : see if this is a shadow.h system
12756 set shadow.h i_shadow
12757 eval $inhdr
12758
12759 : see if getspnam_r exists
12760 set getspnam_r d_getspnam_r
12761 eval $inlibc
12762 case "$d_getspnam_r" in
12763 "$define")
12764         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
12765         case "$d_getspnam_r_proto:$usethreads" in
12766         ":define")      d_getspnam_r_proto=define
12767                 set d_getspnam_r_proto getspnam_r $hdrs
12768                 eval $hasproto ;;
12769         *)      ;;
12770         esac
12771         case "$d_getspnam_r_proto" in
12772         define)
12773         case "$getspnam_r_proto" in
12774         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
12775         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
12776         esac
12777         case "$getspnam_r_proto" in
12778         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
12779         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
12780         esac
12781         case "$getspnam_r_proto" in
12782         ''|0)   d_getspnam_r=undef
12783                 getspnam_r_proto=0
12784                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
12785         * )     case "$getspnam_r_proto" in
12786                 REENTRANT_PROTO*) ;;
12787                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
12788                 esac
12789                 echo "Prototype: $try" ;;
12790         esac
12791         ;;
12792         *)      case "$usethreads" in
12793                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
12794                 esac
12795                 d_getspnam_r=undef
12796                 getspnam_r_proto=0
12797                 ;;
12798         esac
12799         ;;
12800 *)      getspnam_r_proto=0
12801         ;;
12802 esac
12803
12804 : see if gettimeofday or ftime exists
12805 set gettimeofday d_gettimeod
12806 eval $inlibc
12807 case "$d_gettimeod" in
12808 "$undef")
12809         set ftime d_ftime 
12810         eval $inlibc
12811         ;;
12812 *)
12813         val="$undef"; set d_ftime; eval $setvar
12814         ;;
12815 esac
12816 case "$d_gettimeod$d_ftime" in
12817 "$undef$undef")
12818         echo " "
12819         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
12820         ;;
12821 esac
12822
12823 : see if gmtime_r exists
12824 set gmtime_r d_gmtime_r
12825 eval $inlibc
12826 case "$d_gmtime_r" in
12827 "$define")
12828         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12829         case "$d_gmtime_r_proto:$usethreads" in
12830         ":define")      d_gmtime_r_proto=define
12831                 set d_gmtime_r_proto gmtime_r $hdrs
12832                 eval $hasproto ;;
12833         *)      ;;
12834         esac
12835         case "$d_gmtime_r_proto" in
12836         define)
12837         case "$gmtime_r_proto" in
12838         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
12839         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
12840         esac
12841         case "$gmtime_r_proto" in
12842         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
12843         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
12844         esac
12845         case "$gmtime_r_proto" in
12846         ''|0)   d_gmtime_r=undef
12847                 gmtime_r_proto=0
12848                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
12849         * )     case "$gmtime_r_proto" in
12850                 REENTRANT_PROTO*) ;;
12851                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
12852                 esac
12853                 echo "Prototype: $try" ;;
12854         esac
12855         ;;
12856         *)      case "$usethreads" in
12857                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
12858                 esac
12859                 d_gmtime_r=undef
12860                 gmtime_r_proto=0
12861                 ;;
12862         esac
12863         ;;
12864 *)      gmtime_r_proto=0
12865         ;;
12866 esac
12867
12868 : see if hasmntopt exists
12869 set hasmntopt d_hasmntopt
12870 eval $inlibc
12871
12872 : see if this is a netinet/in.h or sys/in.h system
12873 set netinet/in.h i_niin sys/in.h i_sysin
12874 eval $inhdr
12875
12876 : see if arpa/inet.h has to be included
12877 set arpa/inet.h i_arpainet
12878 eval $inhdr
12879
12880 : see if htonl --and friends-- exists
12881 val=''
12882 set htonl val
12883 eval $inlibc
12884
12885 : Maybe they are macros.
12886 case "$val" in
12887 $undef)
12888         $cat >htonl.c <<EOM
12889 #include <stdio.h>
12890 #include <sys/types.h>
12891 #$i_niin I_NETINET_IN
12892 #$i_sysin I_SYS_IN
12893 #$i_arpainet I_ARPA_INET
12894 #ifdef I_NETINET_IN
12895 #include <netinet/in.h>
12896 #endif
12897 #ifdef I_SYS_IN
12898 #include <sys/in.h>
12899 #endif
12900 #ifdef I_ARPA_INET
12901 #include <arpa/inet.h>
12902 #endif
12903 #ifdef htonl
12904 printf("Defined as a macro.");
12905 #endif
12906 EOM
12907         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
12908         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
12909                 val="$define"
12910                 echo "But it seems to be defined as a macro." >&4
12911         fi
12912         $rm -f htonl.?
12913         ;;
12914 esac
12915 set d_htonl
12916 eval $setvar
12917
12918 : index or strchr
12919 echo " "
12920 if set index val -f; eval $csym; $val; then
12921         if set strchr val -f d_strchr; eval $csym; $val; then
12922                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
12923                         val="$define"
12924                         vali="$undef"
12925                         echo "strchr() found." >&4
12926                 else
12927                         val="$undef"
12928                         vali="$define"
12929                         echo "index() found." >&4
12930                 fi
12931         else
12932                 val="$undef"
12933                 vali="$define"
12934                 echo "index() found." >&4
12935         fi
12936 else
12937         if set strchr val -f d_strchr; eval $csym; $val; then
12938                 val="$define"
12939                 vali="$undef"
12940                 echo "strchr() found." >&4
12941         else
12942                 echo "No index() or strchr() found!" >&4
12943                 val="$undef"
12944                 vali="$undef"
12945         fi
12946 fi
12947 set d_strchr; eval $setvar
12948 val="$vali"
12949 set d_index; eval $setvar
12950
12951 : check whether inet_aton exists
12952 set inet_aton d_inetaton
12953 eval $inlibc
12954
12955 : Look for isascii
12956 echo " "
12957 $cat >isascii.c <<'EOCP'
12958 #include <stdio.h>
12959 #include <ctype.h>
12960 int main() {
12961         int c = 'A';
12962         if (isascii(c))
12963                 exit(0);
12964         else
12965                 exit(1);
12966 }
12967 EOCP
12968 set isascii
12969 if eval $compile; then
12970         echo "isascii() found." >&4
12971         val="$define"
12972 else
12973         echo "isascii() NOT found." >&4
12974         val="$undef"
12975 fi
12976 set d_isascii
12977 eval $setvar
12978 $rm -f isascii*
12979
12980 : see if isfinite exists
12981 set isfinite d_isfinite
12982 eval $inlibc
12983
12984 : see if isinf exists
12985 set isinf d_isinf
12986 eval $inlibc
12987
12988 : see if isnan exists
12989 set isnan d_isnan
12990 eval $inlibc
12991
12992 : see if isnanl exists
12993 set isnanl d_isnanl
12994 eval $inlibc
12995
12996 : see if killpg exists
12997 set killpg d_killpg
12998 eval $inlibc
12999
13000 : see if lchown exists
13001 echo " "
13002 $cat > try.c <<'EOCP'
13003 /* System header to define __stub macros and hopefully few prototypes,
13004     which can conflict with char lchown(); below.  */
13005 #include <assert.h>
13006 /* Override any gcc2 internal prototype to avoid an error.  */
13007 /* We use char because int might match the return type of a gcc2
13008    builtin and then its argument prototype would still apply.  */
13009 char lchown();
13010 int main() {
13011     /*  The GNU C library defines this for functions which it implements
13012         to always fail with ENOSYS.  Some functions are actually named
13013         something starting with __ and the normal name is an alias.  */
13014 #if defined (__stub_lchown) || defined (__stub___lchown)
13015 choke me
13016 #else
13017 lchown();
13018 #endif
13019 ; return 0; }
13020 EOCP
13021 set try
13022 if eval $compile; then
13023     $echo "lchown() found." >&4
13024     val="$define"
13025 else
13026     $echo "lchown() NOT found." >&4
13027     val="$undef"
13028 fi
13029 set d_lchown
13030 eval $setvar
13031
13032 : See if number of significant digits in a double precision number is known
13033 echo " "
13034 $cat >ldbl_dig.c <<EOM
13035 #$i_limits I_LIMITS
13036 #$i_float I_FLOAT
13037 #ifdef I_LIMITS
13038 #include <limits.h>
13039 #endif
13040 #ifdef I_FLOAT
13041 #include <float.h>
13042 #endif
13043 #ifdef LDBL_DIG
13044 printf("Contains LDBL_DIG");
13045 #endif
13046 EOM
13047 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
13048 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
13049         echo "LDBL_DIG found." >&4
13050         val="$define"
13051 else
13052         echo "LDBL_DIG NOT found." >&4
13053         val="$undef"
13054 fi
13055 $rm -f ldbl_dig.?
13056 set d_ldbl_dig
13057 eval $setvar
13058
13059 : see if link exists
13060 set link d_link
13061 eval $inlibc
13062
13063 : see if localtime_r exists
13064 set localtime_r d_localtime_r
13065 eval $inlibc
13066 case "$d_localtime_r" in
13067 "$define")
13068         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13069         case "$d_localtime_r_proto:$usethreads" in
13070         ":define")      d_localtime_r_proto=define
13071                 set d_localtime_r_proto localtime_r $hdrs
13072                 eval $hasproto ;;
13073         *)      ;;
13074         esac
13075         case "$d_localtime_r_proto" in
13076         define)
13077         case "$localtime_r_proto" in
13078         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
13079         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
13080         esac
13081         case "$localtime_r_proto" in
13082         ''|0) try='int localtime_r(const time_t*, struct tm*);'
13083         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
13084         esac
13085         case "$localtime_r_proto" in
13086         ''|0)   d_localtime_r=undef
13087                 localtime_r_proto=0
13088                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
13089         * )     case "$localtime_r_proto" in
13090                 REENTRANT_PROTO*) ;;
13091                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
13092                 esac
13093                 echo "Prototype: $try" ;;
13094         esac
13095         ;;
13096         *)      case "$usethreads" in
13097                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
13098                 esac
13099                 d_localtime_r=undef
13100                 localtime_r_proto=0
13101                 ;;
13102         esac
13103         ;;
13104 *)      localtime_r_proto=0
13105         ;;
13106 esac
13107
13108 : see if localeconv exists
13109 set localeconv d_locconv
13110 eval $inlibc
13111
13112 : see if lockf exists
13113 set lockf d_lockf
13114 eval $inlibc
13115
13116 : see if prototype for lseek is available
13117 echo " "
13118 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
13119 eval $hasproto
13120
13121 : see if lstat exists
13122 set lstat d_lstat
13123 eval $inlibc
13124
13125 : see if madvise exists
13126 set madvise d_madvise
13127 eval $inlibc
13128
13129 : see if mblen exists
13130 set mblen d_mblen
13131 eval $inlibc
13132
13133 : see if mbstowcs exists
13134 set mbstowcs d_mbstowcs
13135 eval $inlibc
13136
13137 : see if mbtowc exists
13138 set mbtowc d_mbtowc
13139 eval $inlibc
13140
13141 : see if memchr exists
13142 set memchr d_memchr
13143 eval $inlibc
13144
13145 : see if memcmp exists
13146 set memcmp d_memcmp
13147 eval $inlibc
13148
13149 : see if memcpy exists
13150 set memcpy d_memcpy
13151 eval $inlibc
13152
13153 : see if memmove exists
13154 set memmove d_memmove
13155 eval $inlibc
13156
13157 : see if memset exists
13158 set memset d_memset
13159 eval $inlibc
13160
13161 : see if mkdir exists
13162 set mkdir d_mkdir
13163 eval $inlibc
13164
13165 : see if mkdtemp exists
13166 set mkdtemp d_mkdtemp
13167 eval $inlibc
13168
13169 : see if mkfifo exists
13170 set mkfifo d_mkfifo
13171 eval $inlibc
13172
13173 : see if mkstemp exists
13174 set mkstemp d_mkstemp
13175 eval $inlibc
13176
13177 : see if mkstemps exists
13178 set mkstemps d_mkstemps
13179 eval $inlibc
13180
13181 : see if mktime exists
13182 set mktime d_mktime
13183 eval $inlibc
13184
13185 : see if this is a sys/mman.h system
13186 set sys/mman.h i_sysmman
13187 eval $inhdr
13188
13189 : see if mmap exists
13190 set mmap d_mmap
13191 eval $inlibc
13192 : see what shmat returns
13193 : default to something harmless
13194 mmaptype='void *'
13195 case "$i_sysmman$d_mmap" in
13196 "$define$define")
13197         $cat >mmap.c <<'END'
13198 #include <sys/mman.h>
13199 void *mmap();
13200 END
13201         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
13202                 mmaptype='void *'
13203         else
13204                 mmaptype='caddr_t'
13205         fi
13206         echo "and it returns ($mmaptype)." >&4
13207         ;;
13208 esac
13209
13210
13211
13212 : see if mprotect exists
13213 set mprotect d_mprotect
13214 eval $inlibc
13215
13216 : see if msgctl exists
13217 set msgctl d_msgctl
13218 eval $inlibc
13219
13220 : see if msgget exists
13221 set msgget d_msgget
13222 eval $inlibc
13223
13224 : see if msgsnd exists
13225 set msgsnd d_msgsnd
13226 eval $inlibc
13227
13228 : see if msgrcv exists
13229 set msgrcv d_msgrcv
13230 eval $inlibc
13231
13232 : see how much of the 'msg*(2)' library is present.
13233 h_msg=true
13234 echo " "
13235 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
13236 *"$undef"*) h_msg=false;;
13237 esac
13238 case "$osname" in
13239 freebsd)
13240     case "`ipcs 2>&1`" in
13241     "SVID messages"*"not configured"*)
13242         echo "Your $osname does not have the msg*(2) configured." >&4
13243         h_msg=false
13244         val="$undef"
13245         set msgctl d_msgctl
13246         eval $setvar
13247         set msgget d_msgget
13248         eval $setvar
13249         set msgsnd d_msgsnd
13250         eval $setvar
13251         set msgrcv d_msgrcv
13252         eval $setvar
13253         ;;
13254     esac
13255     ;;
13256 esac
13257 : we could also check for sys/ipc.h ...
13258 if $h_msg && $test `./findhdr sys/msg.h`; then
13259         echo "You have the full msg*(2) library." >&4
13260         val="$define"
13261 else
13262         echo "You don't have the full msg*(2) library." >&4
13263         val="$undef"
13264 fi
13265 set d_msg
13266 eval $setvar
13267
13268
13269 echo " "
13270 echo "Checking to see if your system supports struct msghdr..." >&4
13271 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
13272 eval $hasstruct
13273 case "$d_msghdr_s" in
13274 "$define")      echo "Yes, it does."   ;;
13275 *)              echo "No, it doesn't." ;;
13276 esac
13277
13278
13279 : see if msync exists
13280 set msync d_msync
13281 eval $inlibc
13282
13283 : see if munmap exists
13284 set munmap d_munmap
13285 eval $inlibc
13286
13287 : see if nice exists
13288 set nice d_nice
13289 eval $inlibc
13290
13291 : see if this is a langinfo.h system
13292 set langinfo.h i_langinfo
13293 eval $inhdr
13294
13295 : see if nl_langinfo exists
13296 set nl_langinfo d_nl_langinfo
13297 eval $inlibc
13298
13299 : check for length of character
13300 echo " "
13301 case "$charsize" in
13302 '')
13303         echo "Checking to see how big your characters are (hey, you never know)..." >&4
13304         $cat >try.c <<'EOCP'
13305 #include <stdio.h>
13306 int main()
13307 {
13308     printf("%d\n", (int)sizeof(char));
13309     exit(0);
13310 }
13311 EOCP
13312         set try
13313         if eval $compile_ok; then
13314                 dflt=`$run ./try`
13315         else
13316                 dflt='1'
13317                 echo "(I can't seem to compile the test program.  Guessing...)"
13318         fi
13319         ;;
13320 *)
13321         dflt="$charsize"
13322         ;;
13323 esac
13324 rp="What is the size of a character (in bytes)?"
13325 . ./myread
13326 charsize="$ans"
13327 $rm -f try.c try
13328
13329 : check for volatile keyword
13330 echo " "
13331 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
13332 $cat >try.c <<'EOCP'
13333 int main()
13334 {
13335         typedef struct _goo_struct goo_struct;
13336         goo_struct * volatile goo = ((goo_struct *)0);
13337         struct _goo_struct {
13338                 long long_int;
13339                 int reg_int;
13340                 char char_var;
13341         };
13342         typedef unsigned short foo_t;
13343         char *volatile foo;
13344         volatile int bar;
13345         volatile foo_t blech;
13346         foo = foo;
13347 }
13348 EOCP
13349 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
13350         val="$define"
13351         echo "Yup, it does."
13352 else
13353         val="$undef"
13354         echo "Nope, it doesn't."
13355 fi
13356 set d_volatile
13357 eval $setvar
13358 $rm -f try.*
13359
13360
13361 echo " "
13362 $echo "Choosing the C types to be used for Perl's internal types..." >&4
13363
13364 case "$use64bitint:$d_quad:$quadtype" in
13365 define:define:?*)
13366         ivtype="$quadtype"
13367         uvtype="$uquadtype"
13368         ivsize=8
13369         uvsize=8
13370         ;;
13371 *)      ivtype="long"
13372         uvtype="unsigned long"
13373         ivsize=$longsize
13374         uvsize=$longsize
13375         ;;
13376 esac
13377
13378 case "$uselongdouble:$d_longdbl" in
13379 define:define)
13380         nvtype="long double"
13381         nvsize=$longdblsize
13382         ;;
13383 *)      nvtype=double
13384         nvsize=$doublesize
13385         ;;
13386 esac
13387
13388 $echo "(IV will be "$ivtype", $ivsize bytes)"
13389 $echo "(UV will be "$uvtype", $uvsize bytes)"
13390 $echo "(NV will be "$nvtype", $nvsize bytes)"
13391
13392 $cat >try.c <<EOCP
13393 #$i_inttypes I_INTTYPES
13394 #ifdef I_INTTYPES
13395 #include <inttypes.h>
13396 #endif
13397 #include <stdio.h>
13398 int main() {
13399 #ifdef INT8
13400    int8_t i =  INT8_MAX;
13401   uint8_t u = UINT8_MAX;
13402   printf("int8_t\n");
13403 #endif
13404 #ifdef INT16
13405    int16_t i =  INT16_MAX;
13406   uint16_t i = UINT16_MAX;
13407   printf("int16_t\n");
13408 #endif
13409 #ifdef INT32
13410    int32_t i =  INT32_MAX;
13411   uint32_t u = UINT32_MAX;
13412   printf("int32_t\n");
13413 #endif
13414 }
13415 EOCP
13416
13417 case "$i8type" in
13418 '')     case "$charsize" in
13419         1)      i8type=char
13420                 u8type="unsigned char"
13421                 i8size=$charsize
13422                 u8size=$charsize
13423                 ;;
13424         esac
13425         ;;
13426 esac
13427 case "$i8type" in
13428 '')     set try -DINT8
13429         if eval $compile; then
13430                 case "`$run ./try`" in
13431                 int8_t) i8type=int8_t
13432                         u8type=uint8_t
13433                         i8size=1
13434                         u8size=1
13435                         ;;
13436                 esac
13437         fi
13438         ;;
13439 esac
13440 case "$i8type" in
13441 '')     if $test $charsize -ge 1; then
13442                 i8type=char
13443                 u8type="unsigned char"
13444                 i8size=$charsize
13445                 u8size=$charsize
13446         fi
13447         ;;
13448 esac
13449
13450 case "$i16type" in
13451 '')     case "$shortsize" in
13452         2)      i16type=short
13453                 u16type="unsigned short"
13454                 i16size=$shortsize
13455                 u16size=$shortsize
13456                 ;;
13457         esac
13458         ;;
13459 esac
13460 case "$i16type" in
13461 '')     set try -DINT16
13462         if eval $compile; then
13463                 case "`$run ./try`" in
13464                 int16_t)
13465                         i16type=int16_t
13466                         u16type=uint16_t
13467                         i16size=2
13468                         u16size=2
13469                         ;;
13470                 esac
13471         fi
13472         ;;
13473 esac
13474 case "$i16type" in
13475 '')     if $test $shortsize -ge 2; then
13476                 i16type=short
13477                 u16type="unsigned short"
13478                 i16size=$shortsize
13479                 u16size=$shortsize
13480         fi
13481         ;;
13482 esac
13483
13484 case "$i32type" in
13485 '')     case "$longsize" in
13486         4)      i32type=long
13487                 u32type="unsigned long"
13488                 i32size=$longsize
13489                 u32size=$longsize
13490                 ;;
13491         *)      case "$intsize" in
13492                 4)      i32type=int
13493                         u32type="unsigned int"
13494                         i32size=$intsize
13495                         u32size=$intsize
13496                         ;;
13497                 esac
13498                 ;;
13499         esac
13500         ;;
13501 esac
13502 case "$i32type" in
13503 '')     set try -DINT32
13504         if eval $compile; then
13505                 case "`$run ./try`" in
13506                 int32_t)
13507                         i32type=int32_t
13508                         u32type=uint32_t
13509                         i32size=4
13510                         u32size=4
13511                         ;;
13512                 esac
13513         fi
13514         ;;
13515 esac
13516 case "$i32type" in
13517 '')     if $test $intsize -ge 4; then
13518                 i32type=int
13519                 u32type="unsigned int"
13520                 i32size=$intsize
13521                 u32size=$intsize
13522         fi
13523         ;;
13524 esac
13525
13526 case "$i64type" in
13527 '')     case "$d_quad:$quadtype" in
13528         define:?*)
13529                 i64type="$quadtype"
13530                 u64type="$uquadtype"
13531                 i64size=8
13532                 u64size=8
13533                 ;;
13534         esac
13535         ;;
13536 esac
13537
13538 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
13539 : volatile so that the compiler has to store it out to memory.
13540 if test X"$d_volatile" = X"$define"; then
13541         volatile=volatile
13542 fi
13543 $cat <<EOP >try.c
13544 #include <stdio.h>
13545 #include <sys/types.h>
13546 #include <signal.h>
13547 #ifdef SIGFPE
13548 $volatile int bletched = 0;
13549 $signal_t blech(s) int s; { bletched = 1; }
13550 #endif
13551 int main() {
13552     $uvtype u = 0;
13553     $nvtype d;
13554     int     n = 8 * $uvsize;
13555     int     i;
13556 #ifdef SIGFPE
13557     signal(SIGFPE, blech);
13558 #endif
13559
13560     for (i = 0; i < n; i++) {
13561       u = u << 1 | ($uvtype)1;
13562       d = ($nvtype)u;
13563       if (($uvtype)d != u)
13564         break;
13565       if (d <= 0)
13566         break;
13567       d = ($nvtype)(u - 1);
13568       if (($uvtype)d != (u - 1))
13569         break;
13570 #ifdef SIGFPE
13571       if (bletched) {
13572         break;
13573 #endif
13574       } 
13575     }
13576     printf("%d\n", ((i == n) ? -n : i));
13577     exit(0);
13578 }
13579 EOP
13580 set try
13581
13582 d_nv_preserves_uv="$undef"
13583 if eval $compile; then
13584         nv_preserves_uv_bits="`$run ./try`"
13585 fi
13586 case "$nv_preserves_uv_bits" in
13587 \-[1-9]*)       
13588         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
13589         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
13590         d_nv_preserves_uv="$define"
13591         ;;
13592 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
13593         d_nv_preserves_uv="$undef" ;;
13594 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
13595         nv_preserves_uv_bits="$undef" ;;
13596 esac
13597
13598 $rm -f try.* try
13599
13600
13601 : check for off64_t
13602 echo " "
13603 echo "Checking to see if you have off64_t..." >&4
13604 $cat >try.c <<EOCP
13605 #include <sys/types.h>
13606 #include <unistd.h>
13607 int main() { off64_t x = 7; }
13608 EOCP
13609 set try
13610 if eval $compile; then
13611         val="$define"
13612         echo "You have off64_t."
13613 else
13614         val="$undef"
13615         echo "You do not have off64_t."
13616         case "$lseeksize" in
13617         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
13618         esac
13619 fi
13620 $rm -f try.* try
13621 set d_off64_t
13622 eval $setvar
13623
13624 : how to create joinable pthreads
13625 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
13626         echo " "
13627         echo "Checking what constant to use for creating joinable pthreads..." >&4 
13628         $cat >try.c <<'EOCP'
13629 #include <pthread.h>
13630 int main() {
13631     int detachstate = JOINABLE;
13632 }
13633 EOCP
13634         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
13635         if eval $compile; then
13636                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
13637                 val="$undef" # Yes, undef.
13638                 set d_old_pthread_create_joinable
13639                 eval $setvar
13640                 val=""
13641                 set old_pthread_create_joinable
13642                 eval $setvar
13643         else
13644                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
13645                 if eval $compile; then
13646                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
13647                         val="$define"
13648                         set d_old_pthread_create_joinable
13649                         eval $setvar
13650                         val=PTHREAD_CREATE_UNDETACHED
13651                         set old_pthread_create_joinable
13652                         eval $setvar
13653                 else            
13654                         set try -DJOINABLE=__UNDETACHED
13655                         if eval $compile; then
13656                                 echo "You seem to use __UNDETACHED." >&4
13657                                 val="$define"
13658                                 set d_old_pthread_create_joinable
13659                                 eval $setvar
13660                                 val=__UNDETACHED
13661                                 set old_pthread_create_joinable
13662                                 eval $setvar
13663                         else
13664                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
13665                                 val="$define"
13666                                 set d_old_pthread_create_joinable
13667                                 eval $setvar
13668                                 val=0
13669                                 set old_pthread_create_joinable
13670                                 eval $setvar
13671                         fi
13672                 fi
13673         fi
13674         $rm -f try try.*
13675 else
13676     d_old_pthread_create_joinable="$undef"
13677     old_pthread_create_joinable=""
13678 fi
13679
13680 : see if pause exists
13681 set pause d_pause
13682 eval $inlibc
13683
13684 : see if pipe exists
13685 set pipe d_pipe
13686 eval $inlibc
13687
13688 : see if poll exists
13689 set poll d_poll
13690 eval $inlibc
13691
13692 : see if readlink exists
13693 set readlink d_readlink
13694 eval $inlibc
13695
13696 echo " "
13697 procselfexe=''
13698 val="$undef"
13699 case "$d_readlink" in
13700 "$define")
13701         if $issymlink /proc/self/exe ; then
13702                 $ls -l /proc/self/exe > reflect
13703                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13704                         echo "You have Linux-like /proc/self/exe."
13705                         procselfexe='"/proc/self/exe"'
13706                         val="$define"
13707                 fi
13708         fi
13709         if $issymlink /proc/curproc/file ; then
13710                 $ls -l /proc/curproc/file > reflect
13711                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13712                         echo "You have BSD-like /proc/curproc/file."
13713                         procselfexe='"/proc/curproc/file"'
13714                         val="$define"
13715                 fi
13716         fi
13717         ;;
13718 esac
13719 $rm -f reflect
13720 set d_procselfexe
13721 eval $setvar
13722
13723 : see whether the pthread_atfork exists
13724 $cat >try.c <<EOP
13725 #include <pthread.h>
13726 #include <stdio.h>
13727 int main() {
13728 #ifdef  PTHREAD_ATFORK
13729         pthread_atfork(NULL,NULL,NULL);
13730 #endif
13731 }
13732 EOP
13733
13734 : see if pthread_atfork exists
13735 set try -DPTHREAD_ATFORK
13736 if eval $compile; then
13737     val="$define"
13738 else
13739     val="$undef"
13740 fi
13741 case "$usethreads" in
13742 $define)
13743         case "$val" in
13744         $define) echo 'pthread_atfork found.' >&4        ;;
13745         *)       echo 'pthread_atfork NOT found.' >&4    ;;
13746         esac
13747 esac
13748 set d_pthread_atfork
13749 eval $setvar
13750
13751
13752 : see whether the various POSIXish _yields exist
13753 $cat >try.c <<EOP
13754 #include <pthread.h>
13755 #include <stdio.h>
13756 int main() {
13757 #ifdef SCHED_YIELD
13758         sched_yield();
13759 #else
13760 #ifdef PTHREAD_YIELD
13761         pthread_yield();
13762 #else
13763 #ifdef PTHREAD_YIELD_NULL
13764         pthread_yield(NULL);
13765 #endif
13766 #endif
13767 #endif
13768 }
13769 EOP
13770 : see if sched_yield exists
13771 set try -DSCHED_YIELD
13772 if eval $compile; then
13773     val="$define"
13774     sched_yield='sched_yield()'
13775 else
13776     val="$undef"
13777 fi
13778 case "$usethreads" in
13779 $define)
13780         case "$val" in
13781         $define) echo 'sched_yield() found.' >&4        ;;
13782         *)       echo 'sched_yield() NOT found.' >&4    ;;
13783         esac
13784 esac
13785 set d_sched_yield
13786 eval $setvar
13787
13788 : see if pthread_yield exists
13789 set try -DPTHREAD_YIELD
13790 if eval $compile; then
13791     val="$define"
13792     case "$sched_yield" in
13793     '') sched_yield='pthread_yield()' ;;
13794     esac
13795 else
13796     set try -DPTHREAD_YIELD_NULL
13797     if eval $compile; then
13798         val="$define"
13799         case "$sched_yield" in
13800         '') sched_yield='pthread_yield(NULL)' ;;
13801         esac
13802     else
13803         val="$undef"
13804     fi
13805 fi
13806 case "$usethreads" in
13807 $define)
13808         case "$val" in
13809         $define) echo 'pthread_yield() found.' >&4      ;;
13810         *)       echo 'pthread_yield() NOT found.' >&4  ;;
13811         esac
13812         ;;
13813 esac
13814 set d_pthread_yield
13815 eval $setvar
13816
13817 case "$sched_yield" in
13818 '') sched_yield=undef ;;
13819 esac
13820
13821 $rm -f try try.*
13822
13823 : see if random_r exists
13824 set random_r d_random_r
13825 eval $inlibc
13826 case "$d_random_r" in
13827 "$define")
13828         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
13829         case "$d_random_r_proto:$usethreads" in
13830         ":define")      d_random_r_proto=define
13831                 set d_random_r_proto random_r $hdrs
13832                 eval $hasproto ;;
13833         *)      ;;
13834         esac
13835         case "$d_random_r_proto" in
13836         define)
13837         case "$random_r_proto" in
13838         ''|0) try='int random_r(int*, struct random_data*);'
13839         ./protochk "extern $try" $hdrs && random_r_proto=I_TS ;;
13840         esac
13841         case "$random_r_proto" in
13842         ''|0)   d_random_r=undef
13843                 random_r_proto=0
13844                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
13845         * )     case "$random_r_proto" in
13846                 REENTRANT_PROTO*) ;;
13847                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
13848                 esac
13849                 echo "Prototype: $try" ;;
13850         esac
13851         ;;
13852         *)      case "$usethreads" in
13853                 define) echo "random_r has no prototype, not using it." >&4 ;;
13854                 esac
13855                 d_random_r=undef
13856                 random_r_proto=0
13857                 ;;
13858         esac
13859         ;;
13860 *)      random_r_proto=0
13861         ;;
13862 esac
13863
13864 : see if readdir and friends exist
13865 set readdir d_readdir
13866 eval $inlibc
13867 set seekdir d_seekdir
13868 eval $inlibc
13869 set telldir d_telldir
13870 eval $inlibc
13871 set rewinddir d_rewinddir
13872 eval $inlibc
13873
13874 : see if readdir64_r exists
13875 set readdir64_r d_readdir64_r
13876 eval $inlibc
13877 case "$d_readdir64_r" in
13878 "$define")
13879         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
13880         case "$d_readdir64_r_proto:$usethreads" in
13881         ":define")      d_readdir64_r_proto=define
13882                 set d_readdir64_r_proto readdir64_r $hdrs
13883                 eval $hasproto ;;
13884         *)      ;;
13885         esac
13886         case "$d_readdir64_r_proto" in
13887         define)
13888         case "$readdir64_r_proto" in
13889         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
13890         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
13891         esac
13892         case "$readdir64_r_proto" in
13893         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
13894         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
13895         esac
13896         case "$readdir64_r_proto" in
13897         ''|0)   d_readdir64_r=undef
13898                 readdir64_r_proto=0
13899                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
13900         * )     case "$readdir64_r_proto" in
13901                 REENTRANT_PROTO*) ;;
13902                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
13903                 esac
13904                 echo "Prototype: $try" ;;
13905         esac
13906         ;;
13907         *)      case "$usethreads" in
13908                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
13909                 esac
13910                 d_readdir64_r=undef
13911                 readdir64_r_proto=0
13912                 ;;
13913         esac
13914         ;;
13915 *)      readdir64_r_proto=0
13916         ;;
13917 esac
13918
13919 : see if readdir_r exists
13920 set readdir_r d_readdir_r
13921 eval $inlibc
13922 case "$d_readdir_r" in
13923 "$define")
13924         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
13925         case "$d_readdir_r_proto:$usethreads" in
13926         ":define")      d_readdir_r_proto=define
13927                 set d_readdir_r_proto readdir_r $hdrs
13928                 eval $hasproto ;;
13929         *)      ;;
13930         esac
13931         case "$d_readdir_r_proto" in
13932         define)
13933         case "$readdir_r_proto" in
13934         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
13935         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
13936         esac
13937         case "$readdir_r_proto" in
13938         ''|0) try='int readdir_r(DIR*, struct dirent*);'
13939         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
13940         esac
13941         case "$readdir_r_proto" in
13942         ''|0)   d_readdir_r=undef
13943                 readdir_r_proto=0
13944                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
13945         * )     case "$readdir_r_proto" in
13946                 REENTRANT_PROTO*) ;;
13947                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
13948                 esac
13949                 echo "Prototype: $try" ;;
13950         esac
13951         ;;
13952         *)      case "$usethreads" in
13953                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
13954                 esac
13955                 d_readdir_r=undef
13956                 readdir_r_proto=0
13957                 ;;
13958         esac
13959         ;;
13960 *)      readdir_r_proto=0
13961         ;;
13962 esac
13963
13964 : see if readv exists
13965 set readv d_readv
13966 eval $inlibc
13967
13968 : see if recvmsg exists
13969 set recvmsg d_recvmsg
13970 eval $inlibc
13971
13972 : see if rename exists
13973 set rename d_rename
13974 eval $inlibc
13975
13976 : see if rmdir exists
13977 set rmdir d_rmdir
13978 eval $inlibc
13979
13980 : see if memory.h is available.
13981 val=''
13982 set memory.h val
13983 eval $inhdr
13984
13985 : See if it conflicts with string.h
13986 case "$val" in
13987 $define)
13988         case "$strings" in
13989         '') ;;
13990         *)
13991                 $cppstdin $cppflags $cppminus < $strings > mem.h
13992                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
13993                         echo " "
13994                         echo "We won't be including <memory.h>."
13995                         val="$undef"
13996                 fi
13997                 $rm -f mem.h
13998                 ;;
13999         esac
14000 esac
14001 set i_memory
14002 eval $setvar
14003
14004 : can bcopy handle overlapping blocks?
14005 echo " "
14006 val="$undef"
14007 case "$d_memmove" in
14008 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
14009 *)      case "$d_bcopy" in
14010         "$define")
14011                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
14012                 $cat >try.c <<EOCP
14013 #$i_memory I_MEMORY
14014 #$i_stdlib I_STDLIB
14015 #$i_string I_STRING
14016 #$i_unistd I_UNISTD
14017 EOCP
14018         $cat >>try.c <<'EOCP'
14019 #include <stdio.h>
14020 #ifdef I_MEMORY
14021 #  include <memory.h>
14022 #endif
14023 #ifdef I_STDLIB
14024 #  include <stdlib.h>
14025 #endif
14026 #ifdef I_STRING
14027 #  include <string.h>
14028 #else
14029 #  include <strings.h>
14030 #endif
14031 #ifdef I_UNISTD
14032 #  include <unistd.h>  /* Needed for NetBSD */
14033 #endif
14034 int main()
14035 {
14036 char buf[128], abc[128];
14037 char *b;
14038 int len;
14039 int off;
14040 int align;
14041
14042 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14043    try to store the string in read-only memory. */
14044 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
14045
14046 for (align = 7; align >= 0; align--) {
14047         for (len = 36; len; len--) {
14048                 b = buf+align;
14049                 bcopy(abc, b, len);
14050                 for (off = 1; off <= len; off++) {
14051                         bcopy(b, b+off, len);
14052                         bcopy(b+off, b, len);
14053                         if (bcmp(b, abc, len))
14054                                 exit(1);
14055                 }
14056         }
14057 }
14058 exit(0);
14059 }
14060 EOCP
14061                 set try
14062                 if eval $compile_ok; then
14063                         if ./try 2>/dev/null; then
14064                                 echo "Yes, it can."
14065                                 val="$define"
14066                         else
14067                                 echo "It can't, sorry."
14068                         fi
14069                 else
14070                         echo "(I can't compile the test program, so we'll assume not...)"
14071                 fi
14072                 ;;
14073         esac
14074         $rm -f try.* try core
14075         ;;
14076 esac
14077 set d_safebcpy
14078 eval $setvar
14079
14080 : can memcpy handle overlapping blocks?
14081 echo " "
14082 val="$undef"
14083 case "$d_memmove" in
14084 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
14085 *)      case "$d_memcpy" in
14086         "$define")
14087                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
14088                 $cat >try.c <<EOCP
14089 #$i_memory I_MEMORY
14090 #$i_stdlib I_STDLIB
14091 #$i_string I_STRING
14092 #$i_unistd I_UNISTD
14093 EOCP
14094         $cat >>try.c <<'EOCP'
14095 #include <stdio.h>
14096 #ifdef I_MEMORY
14097 #  include <memory.h>
14098 #endif
14099 #ifdef I_STDLIB
14100 #  include <stdlib.h>
14101 #endif
14102 #ifdef I_STRING
14103 #  include <string.h>
14104 #else
14105 #  include <strings.h>
14106 #endif
14107 #ifdef I_UNISTD
14108 #  include <unistd.h>  /* Needed for NetBSD */
14109 #endif
14110 int main()
14111 {
14112 char buf[128], abc[128];
14113 char *b;
14114 int len;
14115 int off;
14116 int align;
14117
14118 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14119    try to store the string in read-only memory. */
14120 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
14121
14122 for (align = 7; align >= 0; align--) {
14123         for (len = 36; len; len--) {
14124                 b = buf+align;
14125                 memcpy(b, abc, len);
14126                 for (off = 1; off <= len; off++) {
14127                         memcpy(b+off, b, len);
14128                         memcpy(b, b+off, len);
14129                         if (memcmp(b, abc, len))
14130                                 exit(1);
14131                 }
14132         }
14133 }
14134 exit(0);
14135 }
14136 EOCP
14137                 set try
14138                 if eval $compile_ok; then
14139                         if ./try 2>/dev/null; then
14140                                 echo "Yes, it can."
14141                                 val="$define"
14142                         else
14143                                 echo "It can't, sorry."
14144                         fi
14145                 else
14146                         echo "(I can't compile the test program, so we'll assume not...)"
14147                 fi
14148                 ;;
14149         esac
14150         $rm -f try.* try core
14151         ;;
14152 esac
14153 set d_safemcpy
14154 eval $setvar
14155
14156 : can memcmp be trusted to compare relative magnitude?
14157 val="$undef"
14158 case "$d_memcmp" in
14159 "$define")
14160         echo " "
14161         echo "Checking if your memcmp() can compare relative magnitude..." >&4
14162         $cat >try.c <<EOCP
14163 #$i_memory I_MEMORY
14164 #$i_stdlib I_STDLIB
14165 #$i_string I_STRING
14166 #$i_unistd I_UNISTD
14167 EOCP
14168         $cat >>try.c <<'EOCP'
14169 #include <stdio.h>
14170 #ifdef I_MEMORY
14171 #  include <memory.h>
14172 #endif
14173 #ifdef I_STDLIB
14174 #  include <stdlib.h>
14175 #endif
14176 #ifdef I_STRING
14177 #  include <string.h>
14178 #else
14179 #  include <strings.h>
14180 #endif
14181 #ifdef I_UNISTD
14182 #  include <unistd.h>  /* Needed for NetBSD */
14183 #endif
14184 int main()
14185 {
14186 char a = -1;
14187 char b = 0;
14188 if ((a < b) && memcmp(&a, &b, 1) < 0)
14189         exit(1);
14190 exit(0);
14191 }
14192 EOCP
14193         set try
14194         if eval $compile_ok; then
14195                 if $run ./try 2>/dev/null; then
14196                         echo "Yes, it can."
14197                         val="$define"
14198                 else
14199                         echo "No, it can't (it uses signed chars)."
14200                 fi
14201         else
14202                 echo "(I can't compile the test program, so we'll assume not...)"
14203         fi
14204         ;;
14205 esac
14206 $rm -f try.* try core
14207 set d_sanemcmp
14208 eval $setvar
14209
14210 : see if prototype for sbrk is available
14211 echo " "
14212 set d_sbrkproto sbrk $i_unistd unistd.h
14213 eval $hasproto
14214
14215 : see if select exists
14216 set select d_select
14217 eval $inlibc
14218
14219 : see if semctl exists
14220 set semctl d_semctl
14221 eval $inlibc
14222
14223 : see if semget exists
14224 set semget d_semget
14225 eval $inlibc
14226
14227 : see if semop exists
14228 set semop d_semop
14229 eval $inlibc
14230
14231 : see how much of the 'sem*(2)' library is present.
14232 h_sem=true
14233 echo " "
14234 case "$d_semctl$d_semget$d_semop" in
14235 *"$undef"*) h_sem=false;;
14236 esac
14237 case "$osname" in
14238 freebsd)
14239     case "`ipcs 2>&1`" in
14240     "SVID messages"*"not configured"*)
14241         echo "Your $osname does not have the sem*(2) configured." >&4
14242         h_sem=false
14243         val="$undef"
14244         set semctl d_semctl
14245         eval $setvar
14246         set semget d_semget
14247         eval $setvar
14248         set semop d_semop
14249         eval $setvar
14250         ;;
14251     esac
14252     ;;
14253 esac
14254 : we could also check for sys/ipc.h ...
14255 if $h_sem && $test `./findhdr sys/sem.h`; then
14256         echo "You have the full sem*(2) library." >&4
14257         val="$define"
14258 else
14259         echo "You don't have the full sem*(2) library." >&4
14260         val="$undef"
14261 fi
14262 set d_sem
14263 eval $setvar
14264
14265 : see whether sys/sem.h defines union semun
14266 echo " "
14267 $cat > try.c <<'END'
14268 #include <sys/types.h>
14269 #include <sys/ipc.h>
14270 #include <sys/sem.h>
14271 int main () { union semun semun; semun.buf = 0; }
14272 END
14273 set try
14274 if eval $compile; then
14275     echo "You have union semun in <sys/sem.h>." >&4
14276     val="$define"
14277 else
14278     echo "You do not have union semun in <sys/sem.h>." >&4
14279     val="$undef"
14280 fi
14281 $rm -f try try.c try.h
14282 set d_union_semun
14283 eval $setvar
14284
14285 : see how to do semctl IPC_STAT
14286 case "$d_sem" in
14287 $define)
14288     : see whether semctl IPC_STAT can use union semun
14289     echo " "
14290     $cat > try.h <<END
14291 #ifndef S_IRUSR
14292 #   ifdef S_IREAD
14293 #       define S_IRUSR S_IREAD
14294 #       define S_IWUSR S_IWRITE
14295 #       define S_IXUSR S_IEXEC
14296 #   else
14297 #       define S_IRUSR 0400
14298 #       define S_IWUSR 0200
14299 #       define S_IXUSR 0100
14300 #   endif
14301 #   define S_IRGRP (S_IRUSR>>3)
14302 #   define S_IWGRP (S_IWUSR>>3)
14303 #   define S_IXGRP (S_IXUSR>>3)
14304 #   define S_IROTH (S_IRUSR>>6)
14305 #   define S_IWOTH (S_IWUSR>>6)
14306 #   define S_IXOTH (S_IXUSR>>6)
14307 #endif
14308 #ifndef S_IRWXU
14309 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
14310 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
14311 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
14312 #endif
14313 END
14314
14315     $cat > try.c <<END
14316 #include <sys/types.h>
14317 #include <sys/ipc.h>
14318 #include <sys/sem.h>
14319 #include <sys/stat.h>
14320 #include <stdio.h>
14321 #include <errno.h>
14322 #include "try.h"
14323 #ifndef errno
14324 extern int errno;
14325 #endif
14326 #$d_union_semun HAS_UNION_SEMUN
14327 int main() {
14328     union semun
14329 #ifndef HAS_UNION_SEMUN
14330     {
14331         int val;
14332         struct semid_ds *buf;
14333         unsigned short *array;
14334     }
14335 #endif
14336     arg;
14337     int sem, st;
14338
14339 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
14340     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14341     if (sem > -1) {
14342         struct semid_ds argbuf;
14343         arg.buf = &argbuf;
14344 #       ifdef IPC_STAT
14345         st = semctl(sem, 0, IPC_STAT, arg);
14346         if (st == 0)
14347             printf("semun\n");
14348         else
14349 #       endif /* IPC_STAT */
14350             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14351 #       ifdef IPC_RMID
14352         if (semctl(sem, 0, IPC_RMID, arg) != 0)
14353 #       endif /* IPC_RMID */
14354             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14355     } else
14356 #endif /* IPC_PRIVATE && ... */
14357         printf("semget failed: errno = %d\n", errno);
14358   return 0;
14359 }
14360 END
14361     val="$undef"
14362     set try
14363     if eval $compile; then
14364         xxx=`$run ./try`
14365         case "$xxx" in
14366         semun) val="$define" ;;
14367         esac
14368     fi
14369     $rm -f try try.c
14370     set d_semctl_semun
14371     eval $setvar
14372     case "$d_semctl_semun" in
14373     $define)
14374         echo "You can use union semun for semctl IPC_STAT." >&4
14375         also='also'
14376         ;;
14377     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
14378         also=''
14379         ;;
14380     esac
14381
14382     : see whether semctl IPC_STAT can use struct semid_ds pointer
14383     $cat > try.c <<'END'
14384 #include <sys/types.h>
14385 #include <sys/ipc.h>
14386 #include <sys/sem.h>
14387 #include <sys/stat.h>
14388 #include "try.h"
14389 #include <stdio.h>
14390 #include <errno.h>
14391 #ifndef errno
14392 extern int errno;
14393 #endif
14394 int main() {
14395     struct semid_ds arg;
14396     int sem, st;
14397
14398 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
14399     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14400     if (sem > -1) {
14401 #       ifdef IPC_STAT
14402         st = semctl(sem, 0, IPC_STAT, &arg);
14403         if (st == 0)
14404             printf("semid_ds\n");
14405         else
14406 #       endif /* IPC_STAT */
14407             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14408 #       ifdef IPC_RMID
14409         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
14410 #       endif /* IPC_RMID */
14411             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14412     } else
14413 #endif /* IPC_PRIVATE && ... */
14414         printf("semget failed: errno = %d\n", errno);
14415
14416     return 0;
14417 }
14418 END
14419     val="$undef"
14420     set try
14421     if eval $compile; then
14422         xxx=`$run ./try`
14423         case "$xxx" in
14424         semid_ds) val="$define" ;;
14425         esac
14426     fi
14427     $rm -f try try.c
14428     set d_semctl_semid_ds
14429     eval $setvar
14430     case "$d_semctl_semid_ds" in
14431     $define)
14432         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
14433         ;;
14434     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
14435         ;;
14436     esac
14437     $rm -f try.h
14438     ;;
14439 *)  val="$undef"
14440
14441     # We do not have the full sem*(2) library, so assume we can not
14442     # use either.
14443
14444     set d_semctl_semun
14445     eval $setvar
14446
14447     set d_semctl_semid_ds
14448     eval $setvar
14449     ;;
14450 esac
14451
14452 : see if sendmsg exists
14453 set sendmsg d_sendmsg
14454 eval $inlibc
14455
14456 : see if setegid exists
14457 set setegid d_setegid
14458 eval $inlibc
14459
14460 : see if seteuid exists
14461 set seteuid d_seteuid
14462 eval $inlibc
14463
14464 : see if setgrent exists
14465 set setgrent d_setgrent
14466 eval $inlibc
14467
14468 : see if setgrent_r exists
14469 set setgrent_r d_setgrent_r
14470 eval $inlibc
14471 case "$d_setgrent_r" in
14472 "$define")
14473         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14474         case "$d_setgrent_r_proto:$usethreads" in
14475         ":define")      d_setgrent_r_proto=define
14476                 set d_setgrent_r_proto setgrent_r $hdrs
14477                 eval $hasproto ;;
14478         *)      ;;
14479         esac
14480         case "$d_setgrent_r_proto" in
14481         define)
14482         case "$setgrent_r_proto" in
14483         ''|0) try='int setgrent_r(FILE**);'
14484         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
14485         esac
14486         case "$setgrent_r_proto" in
14487         ''|0) try='void setgrent_r(FILE**);'
14488         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
14489         esac
14490         case "$setgrent_r_proto" in
14491         ''|0)   d_setgrent_r=undef
14492                 setgrent_r_proto=0
14493                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
14494         * )     case "$setgrent_r_proto" in
14495                 REENTRANT_PROTO*) ;;
14496                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
14497                 esac
14498                 echo "Prototype: $try" ;;
14499         esac
14500         ;;
14501         *)      case "$usethreads" in
14502                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
14503                 esac
14504                 d_setgrent_r=undef
14505                 setgrent_r_proto=0
14506                 ;;
14507         esac
14508         ;;
14509 *)      setgrent_r_proto=0
14510         ;;
14511 esac
14512
14513 : see if sethostent exists
14514 set sethostent d_sethent
14515 eval $inlibc
14516
14517 : see if sethostent_r exists
14518 set sethostent_r d_sethostent_r
14519 eval $inlibc
14520 case "$d_sethostent_r" in
14521 "$define")
14522         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14523         case "$d_sethostent_r_proto:$usethreads" in
14524         ":define")      d_sethostent_r_proto=define
14525                 set d_sethostent_r_proto sethostent_r $hdrs
14526                 eval $hasproto ;;
14527         *)      ;;
14528         esac
14529         case "$d_sethostent_r_proto" in
14530         define)
14531         case "$sethostent_r_proto" in
14532         ''|0) try='int sethostent_r(int, struct hostent_data*);'
14533         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
14534         esac
14535         case "$sethostent_r_proto" in
14536         ''|0) try='void sethostent_r(int, struct hostent_data*);'
14537         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
14538         esac
14539         case "$sethostent_r_proto" in
14540         ''|0)   d_sethostent_r=undef
14541                 sethostent_r_proto=0
14542                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
14543         * )     case "$sethostent_r_proto" in
14544                 REENTRANT_PROTO*) ;;
14545                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
14546                 esac
14547                 echo "Prototype: $try" ;;
14548         esac
14549         ;;
14550         *)      case "$usethreads" in
14551                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
14552                 esac
14553                 d_sethostent_r=undef
14554                 sethostent_r_proto=0
14555                 ;;
14556         esac
14557         ;;
14558 *)      sethostent_r_proto=0
14559         ;;
14560 esac
14561
14562 : see if setitimer exists
14563 set setitimer d_setitimer
14564 eval $inlibc
14565
14566 : see if setlinebuf exists
14567 set setlinebuf d_setlinebuf
14568 eval $inlibc
14569
14570 : see if setlocale exists
14571 set setlocale d_setlocale
14572 eval $inlibc
14573
14574 : see if locale.h is available
14575 set locale.h i_locale
14576 eval $inhdr
14577
14578 : see if setlocale_r exists
14579 set setlocale_r d_setlocale_r
14580 eval $inlibc
14581 case "$d_setlocale_r" in
14582 "$define")
14583         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
14584         case "$d_setlocale_r_proto:$usethreads" in
14585         ":define")      d_setlocale_r_proto=define
14586                 set d_setlocale_r_proto setlocale_r $hdrs
14587                 eval $hasproto ;;
14588         *)      ;;
14589         esac
14590         case "$d_setlocale_r_proto" in
14591         define)
14592         case "$setlocale_r_proto" in
14593         ''|0) try='int setlocale_r(int, const char*, char*, int);'
14594         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
14595         esac
14596         case "$setlocale_r_proto" in
14597         ''|0)   d_setlocale_r=undef
14598                 setlocale_r_proto=0
14599                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
14600         * )     case "$setlocale_r_proto" in
14601                 REENTRANT_PROTO*) ;;
14602                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
14603                 esac
14604                 echo "Prototype: $try" ;;
14605         esac
14606         ;;
14607         *)      case "$usethreads" in
14608                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
14609                 esac
14610                 d_setlocale_r=undef
14611                 setlocale_r_proto=0
14612                 ;;
14613         esac
14614         ;;
14615 *)      setlocale_r_proto=0
14616         ;;
14617 esac
14618
14619 : see if setnetent exists
14620 set setnetent d_setnent
14621 eval $inlibc
14622
14623 : see if setnetent_r exists
14624 set setnetent_r d_setnetent_r
14625 eval $inlibc
14626 case "$d_setnetent_r" in
14627 "$define")
14628         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14629         case "$d_setnetent_r_proto:$usethreads" in
14630         ":define")      d_setnetent_r_proto=define
14631                 set d_setnetent_r_proto setnetent_r $hdrs
14632                 eval $hasproto ;;
14633         *)      ;;
14634         esac
14635         case "$d_setnetent_r_proto" in
14636         define)
14637         case "$setnetent_r_proto" in
14638         ''|0) try='int setnetent_r(int, struct netent_data*);'
14639         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
14640         esac
14641         case "$setnetent_r_proto" in
14642         ''|0) try='void setnetent_r(int, struct netent_data*);'
14643         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
14644         esac
14645         case "$setnetent_r_proto" in
14646         ''|0)   d_setnetent_r=undef
14647                 setnetent_r_proto=0
14648                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
14649         * )     case "$setnetent_r_proto" in
14650                 REENTRANT_PROTO*) ;;
14651                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
14652                 esac
14653                 echo "Prototype: $try" ;;
14654         esac
14655         ;;
14656         *)      case "$usethreads" in
14657                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
14658                 esac
14659                 d_setnetent_r=undef
14660                 setnetent_r_proto=0
14661                 ;;
14662         esac
14663         ;;
14664 *)      setnetent_r_proto=0
14665         ;;
14666 esac
14667
14668 : see if setprotoent exists
14669 set setprotoent d_setpent
14670 eval $inlibc
14671
14672 : see if setpgid exists
14673 set setpgid d_setpgid
14674 eval $inlibc
14675
14676 : see if setpgrp2 exists
14677 set setpgrp2 d_setpgrp2
14678 eval $inlibc
14679
14680 : see if setpriority exists
14681 set setpriority d_setprior
14682 eval $inlibc
14683
14684 : see if setproctitle exists
14685 set setproctitle d_setproctitle
14686 eval $inlibc
14687
14688 : see if setprotoent_r exists
14689 set setprotoent_r d_setprotoent_r
14690 eval $inlibc
14691 case "$d_setprotoent_r" in
14692 "$define")
14693         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14694         case "$d_setprotoent_r_proto:$usethreads" in
14695         ":define")      d_setprotoent_r_proto=define
14696                 set d_setprotoent_r_proto setprotoent_r $hdrs
14697                 eval $hasproto ;;
14698         *)      ;;
14699         esac
14700         case "$d_setprotoent_r_proto" in
14701         define)
14702         case "$setprotoent_r_proto" in
14703         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
14704         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
14705         esac
14706         case "$setprotoent_r_proto" in
14707         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
14708         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
14709         esac
14710         case "$setprotoent_r_proto" in
14711         ''|0)   d_setprotoent_r=undef
14712                 setprotoent_r_proto=0
14713                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
14714         * )     case "$setprotoent_r_proto" in
14715                 REENTRANT_PROTO*) ;;
14716                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
14717                 esac
14718                 echo "Prototype: $try" ;;
14719         esac
14720         ;;
14721         *)      case "$usethreads" in
14722                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
14723                 esac
14724                 d_setprotoent_r=undef
14725                 setprotoent_r_proto=0
14726                 ;;
14727         esac
14728         ;;
14729 *)      setprotoent_r_proto=0
14730         ;;
14731 esac
14732
14733 : see if setpwent exists
14734 set setpwent d_setpwent
14735 eval $inlibc
14736
14737 : see if setpwent_r exists
14738 set setpwent_r d_setpwent_r
14739 eval $inlibc
14740 case "$d_setpwent_r" in
14741 "$define")
14742         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14743         case "$d_setpwent_r_proto:$usethreads" in
14744         ":define")      d_setpwent_r_proto=define
14745                 set d_setpwent_r_proto setpwent_r $hdrs
14746                 eval $hasproto ;;
14747         *)      ;;
14748         esac
14749         case "$d_setpwent_r_proto" in
14750         define)
14751         case "$setpwent_r_proto" in
14752         ''|0) try='int setpwent_r(FILE**);'
14753         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
14754         esac
14755         case "$setpwent_r_proto" in
14756         ''|0) try='void setpwent_r(FILE**);'
14757         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
14758         esac
14759         case "$setpwent_r_proto" in
14760         ''|0)   d_setpwent_r=undef
14761                 setpwent_r_proto=0
14762                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
14763         * )     case "$setpwent_r_proto" in
14764                 REENTRANT_PROTO*) ;;
14765                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
14766                 esac
14767                 echo "Prototype: $try" ;;
14768         esac
14769         ;;
14770         *)      case "$usethreads" in
14771                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
14772                 esac
14773                 d_setpwent_r=undef
14774                 setpwent_r_proto=0
14775                 ;;
14776         esac
14777         ;;
14778 *)      setpwent_r_proto=0
14779         ;;
14780 esac
14781
14782 : see if setregid exists
14783 set setregid d_setregid
14784 eval $inlibc
14785 set setresgid d_setresgid
14786 eval $inlibc
14787
14788 : see if setreuid exists
14789 set setreuid d_setreuid
14790 eval $inlibc
14791 set setresuid d_setresuid
14792 eval $inlibc
14793
14794 : see if setrgid exists
14795 set setrgid d_setrgid
14796 eval $inlibc
14797
14798 : see if setruid exists
14799 set setruid d_setruid
14800 eval $inlibc
14801
14802 : see if setservent exists
14803 set setservent d_setsent
14804 eval $inlibc
14805
14806 : see if setservent_r exists
14807 set setservent_r d_setservent_r
14808 eval $inlibc
14809 case "$d_setservent_r" in
14810 "$define")
14811         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14812         case "$d_setservent_r_proto:$usethreads" in
14813         ":define")      d_setservent_r_proto=define
14814                 set d_setservent_r_proto setservent_r $hdrs
14815                 eval $hasproto ;;
14816         *)      ;;
14817         esac
14818         case "$d_setservent_r_proto" in
14819         define)
14820         case "$setservent_r_proto" in
14821         ''|0) try='int setservent_r(int, struct servent_data*);'
14822         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
14823         esac
14824         case "$setservent_r_proto" in
14825         ''|0) try='void setservent_r(int, struct servent_data*);'
14826         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
14827         esac
14828         case "$setservent_r_proto" in
14829         ''|0)   d_setservent_r=undef
14830                 setservent_r_proto=0
14831                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
14832         * )     case "$setservent_r_proto" in
14833                 REENTRANT_PROTO*) ;;
14834                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
14835                 esac
14836                 echo "Prototype: $try" ;;
14837         esac
14838         ;;
14839         *)      case "$usethreads" in
14840                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
14841                 esac
14842                 d_setservent_r=undef
14843                 setservent_r_proto=0
14844                 ;;
14845         esac
14846         ;;
14847 *)      setservent_r_proto=0
14848         ;;
14849 esac
14850
14851 : see if setsid exists
14852 set setsid d_setsid
14853 eval $inlibc
14854
14855 : see if setvbuf exists
14856 set setvbuf d_setvbuf
14857 eval $inlibc
14858
14859 : see if sfio.h is available
14860 set sfio.h i_sfio
14861 eval $inhdr
14862
14863
14864 : see if sfio library is available
14865 case "$i_sfio" in
14866 $define)
14867         val=''
14868         set sfreserve val
14869         eval $inlibc
14870         ;;
14871 *)
14872         val="$undef"
14873         ;;
14874 esac
14875 : Ok, but do we want to use it.
14876 case "$val" in
14877 $define)
14878         case "$usesfio" in
14879         true|$define|[yY]*) dflt='y';;
14880         *) dflt='n';;
14881         esac
14882         echo "$package can use the sfio library, but it is experimental."
14883         case "$useperlio" in
14884         "$undef")
14885             echo "For sfio also the PerlIO abstraction layer is needed."
14886             echo "Earlier you said you wouldn't want that."
14887             ;;
14888         esac
14889         rp="You seem to have sfio available, do you want to try using it?"
14890         . ./myread
14891         case "$ans" in
14892         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
14893                 useperlio="$define"
14894                 val="$define"
14895                 ;;
14896         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
14897                 val="$undef"
14898                 ;;
14899         esac
14900         ;;
14901 *)      case "$usesfio" in
14902         true|$define|[yY]*)
14903                 echo "Sorry, cannot find sfio on this machine." >&4
14904                 echo "Ignoring your setting of usesfio=$usesfio." >&4
14905                 val="$undef"
14906                 ;;
14907         esac
14908         ;;
14909 esac
14910 set d_sfio
14911 eval $setvar
14912 case "$d_sfio" in
14913 $define) usesfio='true';;
14914 *) usesfio='false';;
14915 esac
14916 case "$d_sfio" in
14917 $define) ;;
14918 *)      : Remove sfio from list of libraries to use
14919         case "$libs" in
14920         *-lsfio*)
14921                 echo "Removing unneeded -lsfio from library list" >&4
14922                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
14923                 shift
14924                 libs="$*"
14925                 echo "libs = $libs" >&4
14926                 ;;
14927         esac
14928 ;;
14929 esac
14930
14931
14932 : see if shmctl exists
14933 set shmctl d_shmctl
14934 eval $inlibc
14935
14936 : see if shmget exists
14937 set shmget d_shmget
14938 eval $inlibc
14939
14940 : see if shmat exists
14941 set shmat d_shmat
14942 eval $inlibc
14943 : see what shmat returns
14944 case "$d_shmat" in
14945 "$define")
14946         $cat >shmat.c <<'END'
14947 #include <sys/shm.h>
14948 void *shmat();
14949 END
14950         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
14951                 shmattype='void *'
14952         else
14953                 shmattype='char *'
14954         fi
14955         echo "and it returns ($shmattype)." >&4
14956         : see if a prototype for shmat is available
14957         xxx=`./findhdr sys/shm.h`
14958         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
14959         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
14960                 val="$define"
14961         else
14962                 val="$undef"
14963         fi
14964         $rm -f shmat.[co]
14965         ;;
14966 *)
14967         val="$undef"
14968         ;;
14969 esac
14970 set d_shmatprototype
14971 eval $setvar
14972
14973 : see if shmdt exists
14974 set shmdt d_shmdt
14975 eval $inlibc
14976
14977 : see how much of the 'shm*(2)' library is present.
14978 h_shm=true
14979 echo " "
14980 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
14981 *"$undef"*) h_shm=false;;
14982 esac
14983 case "$osname" in
14984 freebsd)
14985     case "`ipcs 2>&1`" in
14986     "SVID shared memory"*"not configured"*)
14987         echo "Your $osname does not have the shm*(2) configured." >&4
14988         h_shm=false
14989         val="$undef"
14990         set shmctl d_shmctl
14991         evat $setvar
14992         set shmget d_shmget
14993         evat $setvar
14994         set shmat d_shmat
14995         evat $setvar
14996         set shmdt d_shmdt
14997         evat $setvar
14998         ;;
14999     esac
15000     ;;
15001 esac
15002 : we could also check for sys/ipc.h ...
15003 if $h_shm && $test `./findhdr sys/shm.h`; then
15004         echo "You have the full shm*(2) library." >&4
15005         val="$define"
15006 else
15007         echo "You don't have the full shm*(2) library." >&4
15008         val="$undef"
15009 fi
15010 set d_shm
15011 eval $setvar
15012
15013 echo " "
15014 : see if we have sigaction
15015 if set sigaction val -f d_sigaction; eval $csym; $val; then
15016         echo 'sigaction() found.' >&4
15017         $cat > try.c <<'EOP'
15018 #include <stdio.h>
15019 #include <sys/types.h>
15020 #include <signal.h>
15021 int main()
15022 {
15023     struct sigaction act, oact;
15024     act.sa_flags = 0;
15025     oact.sa_handler = 0;
15026     /* so that act and oact are used */
15027     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
15028 }
15029 EOP
15030         set try
15031         if eval $compile_ok; then
15032                 val="$define"
15033         else
15034                 echo "But you don't seem to have a useable struct sigaction." >&4
15035                 val="$undef"
15036         fi
15037 else
15038         echo 'sigaction NOT found.' >&4
15039         val="$undef"
15040 fi
15041 set d_sigaction; eval $setvar
15042 $rm -f try try$_o try.c
15043
15044 : see if sigprocmask exists
15045 set sigprocmask d_sigprocmask
15046 eval $inlibc
15047
15048 : see if sigsetjmp exists
15049 echo " "
15050 case "$d_sigsetjmp" in
15051 '')
15052         $cat >try.c <<'EOP'
15053 #include <setjmp.h>
15054 sigjmp_buf env;
15055 int set = 1;
15056 int main()
15057 {
15058         if (sigsetjmp(env,1))
15059                 exit(set);
15060         set = 0;
15061         siglongjmp(env, 1);
15062         exit(1);
15063 }
15064 EOP
15065         set try
15066         if eval $compile; then
15067                 if $run ./try >/dev/null 2>&1; then
15068                         echo "POSIX sigsetjmp found." >&4
15069                         val="$define"
15070                 else
15071                         $cat >&4 <<EOM
15072 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
15073 I'll ignore them.
15074 EOM
15075                         val="$undef"
15076                 fi
15077         else
15078                 echo "sigsetjmp not found." >&4
15079                 val="$undef"
15080         fi
15081         ;;
15082 *) val="$d_sigsetjmp"
15083         case "$d_sigsetjmp" in
15084         $define) echo "POSIX sigsetjmp found." >&4;;
15085         $undef) echo "sigsetjmp not found." >&4;;
15086         esac
15087         ;;
15088 esac
15089 set d_sigsetjmp
15090 eval $setvar
15091 $rm -f try.c try
15092
15093 : see if sockatmark exists
15094 set sockatmark d_sockatmark
15095 eval $inlibc
15096
15097 : see if prototype for sockatmark is available
15098 echo " "
15099 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
15100 eval $hasproto
15101
15102 : see if socks5_init exists
15103 set socks5_init d_socks5_init
15104 eval $inlibc
15105
15106 : see if srand48_r exists
15107 set srand48_r d_srand48_r
15108 eval $inlibc
15109 case "$d_srand48_r" in
15110 "$define")
15111         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15112         case "$d_srand48_r_proto:$usethreads" in
15113         ":define")      d_srand48_r_proto=define
15114                 set d_srand48_r_proto srand48_r $hdrs
15115                 eval $hasproto ;;
15116         *)      ;;
15117         esac
15118         case "$d_srand48_r_proto" in
15119         define)
15120         case "$srand48_r_proto" in
15121         ''|0) try='int srand48_r(long, struct drand48_data*);'
15122         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
15123         esac
15124         case "$srand48_r_proto" in
15125         ''|0)   d_srand48_r=undef
15126                 srand48_r_proto=0
15127                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
15128         * )     case "$srand48_r_proto" in
15129                 REENTRANT_PROTO*) ;;
15130                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
15131                 esac
15132                 echo "Prototype: $try" ;;
15133         esac
15134         ;;
15135         *)      case "$usethreads" in
15136                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
15137                 esac
15138                 d_srand48_r=undef
15139                 srand48_r_proto=0
15140                 ;;
15141         esac
15142         ;;
15143 *)      srand48_r_proto=0
15144         ;;
15145 esac
15146
15147 : see if srandom_r exists
15148 set srandom_r d_srandom_r
15149 eval $inlibc
15150 case "$d_srandom_r" in
15151 "$define")
15152         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15153         case "$d_srandom_r_proto:$usethreads" in
15154         ":define")      d_srandom_r_proto=define
15155                 set d_srandom_r_proto srandom_r $hdrs
15156                 eval $hasproto ;;
15157         *)      ;;
15158         esac
15159         case "$d_srandom_r_proto" in
15160         define)
15161         case "$srandom_r_proto" in
15162         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
15163         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
15164         esac
15165         case "$srandom_r_proto" in
15166         ''|0)   d_srandom_r=undef
15167                 srandom_r_proto=0
15168                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
15169         * )     case "$srandom_r_proto" in
15170                 REENTRANT_PROTO*) ;;
15171                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
15172                 esac
15173                 echo "Prototype: $try" ;;
15174         esac
15175         ;;
15176         *)      case "$usethreads" in
15177                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
15178                 esac
15179                 d_srandom_r=undef
15180                 srandom_r_proto=0
15181                 ;;
15182         esac
15183         ;;
15184 *)      srandom_r_proto=0
15185         ;;
15186 esac
15187
15188 : see if prototype for setresgid is available
15189 echo " "
15190 set d_sresgproto setresgid $i_unistd unistd.h
15191 eval $hasproto
15192
15193 : see if prototype for setresuid is available
15194 echo " "
15195 set d_sresuproto setresuid $i_unistd unistd.h
15196 eval $hasproto
15197
15198 : see if sys/stat.h is available
15199 set sys/stat.h i_sysstat
15200 eval $inhdr
15201
15202
15203 : see if stat knows about block sizes
15204 echo " "
15205 echo "Checking to see if your struct stat has st_blocks field..." >&4
15206 set d_statblks stat st_blocks $i_sysstat sys/stat.h
15207 eval $hasfield
15208
15209
15210 : see if this is a sys/vfs.h system
15211 set sys/vfs.h i_sysvfs
15212 eval $inhdr
15213
15214
15215 : see if this is a sys/statfs.h system
15216 set sys/statfs.h i_sysstatfs
15217 eval $inhdr
15218
15219
15220 echo " "
15221 echo "Checking to see if your system supports struct statfs..." >&4
15222 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
15223 eval $hasstruct
15224 case "$d_statfs_s" in
15225 "$define")      echo "Yes, it does."   ;;
15226 *)              echo "No, it doesn't." ;;
15227 esac
15228
15229
15230
15231 : see if struct statfs knows about f_flags
15232 case "$d_statfs_s" in
15233 define) 
15234         echo " "
15235         echo "Checking to see if your struct statfs has f_flags field..." >&4
15236         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
15237         eval $hasfield
15238         ;;
15239 *)      val="$undef"
15240         set d_statfs_f_flags
15241         eval $setvar
15242         ;;
15243 esac
15244 case "$d_statfs_f_flags" in
15245 "$define")      echo "Yes, it does."   ;;
15246 *)              echo "No, it doesn't." ;;
15247 esac
15248
15249 : see if _ptr and _cnt from stdio act std
15250 echo " "
15251
15252 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
15253         echo "(Looks like you have stdio.h from BSD.)"
15254         case "$stdio_ptr" in
15255         '') stdio_ptr='((fp)->_p)'
15256                 ptr_lval=$define
15257                 ;;
15258         *)      ptr_lval=$d_stdio_ptr_lval;;
15259         esac
15260         case "$stdio_cnt" in
15261         '') stdio_cnt='((fp)->_r)'
15262                 cnt_lval=$define
15263                 ;;
15264         *)      cnt_lval=$d_stdio_cnt_lval;;
15265         esac
15266         case "$stdio_base" in
15267         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
15268         esac
15269         case "$stdio_bufsiz" in
15270         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
15271         esac
15272 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
15273         echo "(Looks like you have stdio.h from Linux.)"
15274         case "$stdio_ptr" in
15275         '') stdio_ptr='((fp)->_IO_read_ptr)'
15276                 ptr_lval=$define
15277                 ;;
15278         *)      ptr_lval=$d_stdio_ptr_lval;;
15279         esac
15280         case "$stdio_cnt" in
15281         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
15282                 cnt_lval=$undef
15283                 ;;
15284         *)      cnt_lval=$d_stdio_cnt_lval;;
15285         esac
15286         case "$stdio_base" in
15287         '') stdio_base='((fp)->_IO_read_base)';;
15288         esac
15289         case "$stdio_bufsiz" in
15290         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
15291         esac
15292 else
15293         case "$stdio_ptr" in
15294         '') stdio_ptr='((fp)->_ptr)'
15295                 ptr_lval=$define
15296                 ;;
15297         *)      ptr_lval=$d_stdio_ptr_lval;;
15298         esac
15299         case "$stdio_cnt" in
15300         '') stdio_cnt='((fp)->_cnt)'
15301                 cnt_lval=$define
15302                 ;;
15303         *)      cnt_lval=$d_stdio_cnt_lval;;
15304         esac
15305         case "$stdio_base" in
15306         '') stdio_base='((fp)->_base)';;
15307         esac
15308         case "$stdio_bufsiz" in
15309         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
15310         esac
15311 fi
15312
15313 : test whether _ptr and _cnt really work
15314 echo "Checking how std your stdio is..." >&4
15315 $cat >try.c <<EOP
15316 #include <stdio.h>
15317 #define FILE_ptr(fp)    $stdio_ptr
15318 #define FILE_cnt(fp)    $stdio_cnt
15319 int main() {
15320         FILE *fp = fopen("try.c", "r");
15321         char c = getc(fp);
15322         if (
15323                 18 <= FILE_cnt(fp) &&
15324                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15325         )
15326                 exit(0);
15327         exit(1);
15328 }
15329 EOP
15330 val="$undef"
15331 set try
15332 if eval $compile && $to try.c; then
15333         if $run ./try; then
15334                 echo "Your stdio acts pretty std."
15335                 val="$define"
15336         else
15337                 echo "Your stdio isn't very std."
15338         fi
15339 else
15340         echo "Your stdio doesn't appear very std."
15341 fi
15342 $rm -f try.c try
15343 set d_stdstdio
15344 eval $setvar
15345
15346 : Can _ptr be used as an lvalue?
15347 case "$d_stdstdio$ptr_lval" in
15348 $define$define) val=$define ;;
15349 *) val=$undef ;;
15350 esac
15351 set d_stdio_ptr_lval
15352 eval $setvar
15353
15354 : Can _cnt be used as an lvalue?
15355 case "$d_stdstdio$cnt_lval" in
15356 $define$define) val=$define ;;
15357 *) val=$undef ;;
15358 esac
15359 set d_stdio_cnt_lval
15360 eval $setvar
15361
15362
15363 : test whether setting _ptr sets _cnt as a side effect
15364 d_stdio_ptr_lval_sets_cnt="$undef"
15365 d_stdio_ptr_lval_nochange_cnt="$undef"
15366 case "$d_stdio_ptr_lval$d_stdstdio" in
15367 $define$define)
15368         echo "Checking to see what happens if we set the stdio ptr..." >&4
15369 $cat >try.c <<EOP
15370 #include <stdio.h>
15371 /* Can we scream? */
15372 /* Eat dust sed :-) */
15373 /* In the buffer space, no one can hear you scream. */
15374 #define FILE_ptr(fp)    $stdio_ptr
15375 #define FILE_cnt(fp)    $stdio_cnt
15376 #include <sys/types.h>
15377 int main() {
15378         FILE *fp = fopen("try.c", "r");
15379         int c;
15380         char *ptr;
15381         size_t cnt;
15382         if (!fp) {
15383             puts("Fail even to read");
15384             exit(1);
15385         }
15386         c = getc(fp); /* Read away the first # */
15387         if (c == EOF) {
15388             puts("Fail even to read");
15389             exit(1);
15390         }
15391         if (!(
15392                 18 <= FILE_cnt(fp) &&
15393                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15394         )) {
15395                 puts("Fail even to read");
15396                 exit (1);
15397         }
15398         ptr = (char*) FILE_ptr(fp);
15399         cnt = (size_t)FILE_cnt(fp);
15400
15401         FILE_ptr(fp) += 42;
15402
15403         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
15404                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
15405                 exit (1);
15406         }
15407         if (FILE_cnt(fp) <= 20) {
15408                 printf ("Fail (<20 chars to test)");
15409                 exit (1);
15410         }
15411         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
15412                 puts("Fail compare");
15413                 exit (1);
15414         }
15415         if (cnt == FILE_cnt(fp)) {
15416                 puts("Pass_unchanged");
15417                 exit (0);
15418         }       
15419         if (FILE_cnt(fp) == (cnt - 42)) {
15420                 puts("Pass_changed");
15421                 exit (0);
15422         }
15423         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
15424         return 1;
15425
15426 }
15427 EOP
15428         set try
15429         if eval $compile && $to try.c; then
15430                 case `$run ./try` in
15431                 Pass_changed)
15432                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
15433                         d_stdio_ptr_lval_sets_cnt="$define" ;;
15434                 Pass_unchanged)
15435                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
15436                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
15437                 Fail*)
15438                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
15439                 *)
15440                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
15441         esac
15442         else
15443                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
15444         fi
15445         $rm -f try.c try
15446         ;;
15447 esac
15448
15449 : see if _base is also standard
15450 val="$undef"
15451 case "$d_stdstdio" in
15452 $define)
15453         $cat >try.c <<EOP
15454 #include <stdio.h>
15455 #define FILE_base(fp)   $stdio_base
15456 #define FILE_bufsiz(fp) $stdio_bufsiz
15457 int main() {
15458         FILE *fp = fopen("try.c", "r");
15459         char c = getc(fp);
15460         if (
15461                 19 <= FILE_bufsiz(fp) &&
15462                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
15463         )
15464                 exit(0);
15465         exit(1);
15466 }
15467 EOP
15468         set try
15469         if eval $compile && $to try.c; then
15470                 if $run ./try; then
15471                         echo "And its _base field acts std."
15472                         val="$define"
15473                 else
15474                         echo "But its _base field isn't std."
15475                 fi
15476         else
15477                 echo "However, it seems to be lacking the _base field."
15478         fi
15479         $rm -f try.c try
15480         ;;
15481 esac
15482 set d_stdiobase
15483 eval $setvar
15484
15485 $cat >&4 <<EOM
15486 Checking how to access stdio streams by file descriptor number...
15487 EOM
15488 case "$stdio_stream_array" in
15489 '')     $cat >try.c <<EOCP
15490 #include <stdio.h>
15491 int main() {
15492   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
15493     printf("yes\n");
15494 }
15495 EOCP
15496         for s in _iob __iob __sF
15497         do
15498                 set try -DSTDIO_STREAM_ARRAY=$s
15499                 if eval $compile; then
15500                         case "`$run ./try`" in
15501                         yes)    stdio_stream_array=$s; break ;;
15502                         esac
15503                 fi
15504         done
15505         $rm -f try.* try$exe_ext
15506 esac
15507 case "$stdio_stream_array" in
15508 '')     $cat >&4 <<EOM
15509 I can't figure out how to access stdio streams by file descriptor number.
15510 EOM
15511         d_stdio_stream_array="$undef"
15512         ;;
15513 *)      $cat >&4 <<EOM
15514 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
15515 EOM
15516         d_stdio_stream_array="$define"
15517         ;;
15518 esac
15519
15520 : see if strcoll exists
15521 set strcoll d_strcoll
15522 eval $inlibc
15523
15524 : check for structure copying
15525 echo " "
15526 echo "Checking to see if your C compiler can copy structs..." >&4
15527 $cat >try.c <<'EOCP'
15528 int main()
15529 {
15530         struct blurfl {
15531                 int dyick;
15532         } foo, bar;
15533
15534         foo = bar;
15535 }
15536 EOCP
15537 if $cc -c try.c >/dev/null 2>&1 ; then
15538         val="$define"
15539         echo "Yup, it can."
15540 else
15541         val="$undef"
15542         echo "Nope, it can't."
15543 fi
15544 set d_strctcpy
15545 eval $setvar
15546 $rm -f try.*
15547
15548 : see if strerror and/or sys_errlist[] exist
15549 echo " "
15550 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
15551     if set strerror val -f d_strerror; eval $csym; $val; then
15552                 echo 'strerror() found.' >&4
15553                 d_strerror="$define"
15554                 d_strerrm='strerror(e)'
15555                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
15556                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
15557                         d_syserrlst="$define"
15558                 else
15559                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
15560                         d_syserrlst="$undef"
15561                 fi
15562     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
15563                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
15564                 echo 'strerror() found in string header.' >&4
15565                 d_strerror="$define"
15566                 d_strerrm='strerror(e)'
15567                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
15568                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
15569                                 d_syserrlst="$define"
15570                 else
15571                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
15572                         d_syserrlst="$undef"
15573                 fi
15574     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
15575                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
15576                 d_strerror="$undef"
15577                 d_syserrlst="$define"
15578                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
15579     else
15580                 echo 'strerror() and sys_errlist[] NOT found.' >&4
15581                 d_strerror="$undef"
15582                 d_syserrlst="$undef"
15583                 d_strerrm='"unknown"'
15584     fi
15585 fi
15586
15587 : see if strerror_r exists
15588 set strerror_r d_strerror_r
15589 eval $inlibc
15590 case "$d_strerror_r" in
15591 "$define")
15592         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
15593         case "$d_strerror_r_proto:$usethreads" in
15594         ":define")      d_strerror_r_proto=define
15595                 set d_strerror_r_proto strerror_r $hdrs
15596                 eval $hasproto ;;
15597         *)      ;;
15598         esac
15599         case "$d_strerror_r_proto" in
15600         define)
15601         case "$strerror_r_proto" in
15602         ''|0) try='int strerror_r(int, char*, size_t);'
15603         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
15604         esac
15605         case "$strerror_r_proto" in
15606         ''|0) try='int strerror_r(int, char*, int);'
15607         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
15608         esac
15609         case "$strerror_r_proto" in
15610         ''|0) try='char* strerror_r(int, char*, size_t);'
15611         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
15612         esac
15613         case "$strerror_r_proto" in
15614         ''|0)   d_strerror_r=undef
15615                 strerror_r_proto=0
15616                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
15617         * )     case "$strerror_r_proto" in
15618                 REENTRANT_PROTO*) ;;
15619                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
15620                 esac
15621                 echo "Prototype: $try" ;;
15622         esac
15623         ;;
15624         *)      case "$usethreads" in
15625                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
15626                 esac
15627                 d_strerror_r=undef
15628                 strerror_r_proto=0
15629                 ;;
15630         esac
15631         ;;
15632 *)      strerror_r_proto=0
15633         ;;
15634 esac
15635
15636 : see if strftime exists
15637 set strftime d_strftime
15638 eval $inlibc
15639
15640 : see if strtod exists
15641 set strtod d_strtod
15642 eval $inlibc
15643
15644 : see if strtol exists
15645 set strtol d_strtol
15646 eval $inlibc
15647
15648 : see if strtold exists
15649 set strtold d_strtold
15650 eval $inlibc
15651
15652 : see if strtoll exists
15653 set strtoll d_strtoll
15654 eval $inlibc
15655
15656 case "$d_longlong-$d_strtoll" in
15657 "$define-$define")
15658         $cat <<EOM
15659 Checking whether your strtoll() works okay...
15660 EOM
15661         $cat >try.c <<'EOCP'
15662 #include <errno.h>
15663 #ifdef __hpux
15664 #define strtoll __strtoll
15665 #endif
15666 #ifdef __EMX__
15667 #define strtoll _strtoll
15668 #endif
15669 #include <stdio.h>
15670 extern long long int strtoll(char *s, char **, int); 
15671 static int bad = 0;
15672 int check(char *s, long long ell, int een) {
15673         long long gll;
15674         errno = 0;
15675         gll = strtoll(s, 0, 10);
15676         if (!((gll == ell) && (errno == een)))
15677                 bad++;
15678 }
15679 int main() {
15680         check(" 1",                                      1LL, 0);
15681         check(" 0",                                      0LL, 0);
15682         check("-1",                                     -1LL, 0);
15683         check("-9223372036854775808", -9223372036854775808LL, 0);
15684         check("-9223372036854775808", -9223372036854775808LL, 0);
15685         check(" 9223372036854775807",  9223372036854775807LL, 0);
15686         check("-9223372036854775808", -9223372036854775808LL, 0);
15687         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
15688         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
15689         if (!bad)
15690                 printf("ok\n");
15691 }
15692 EOCP
15693         set try
15694         if eval $compile; then
15695                 yyy=`$run ./try`
15696                 case "$yyy" in
15697                 ok) echo "Your strtoll() seems to be working okay." ;;
15698                 *) cat <<EOM >&4
15699 Your strtoll() doesn't seem to be working okay.
15700 EOM
15701                    d_strtoll="$undef"
15702                    ;;
15703                 esac
15704         else
15705                 echo "(I can't seem to compile the test program--assuming it doesn't)"
15706                 d_strtoll="$undef"
15707         fi
15708         ;;
15709 esac
15710
15711 : see if strtoq exists
15712 set strtoq d_strtoq
15713 eval $inlibc
15714
15715 : see if strtoul exists
15716 set strtoul d_strtoul
15717 eval $inlibc
15718
15719 case "$d_strtoul" in
15720 "$define")
15721         $cat <<EOM
15722 Checking whether your strtoul() works okay...
15723 EOM
15724         $cat >try.c <<'EOCP'
15725 #include <errno.h>
15726 #include <stdio.h>
15727 extern unsigned long int strtoul(char *s, char **, int); 
15728 static int bad = 0;
15729 void check(char *s, unsigned long eul, int een) {
15730         unsigned long gul;
15731         errno = 0;
15732         gul = strtoul(s, 0, 10);
15733         if (!((gul == eul) && (errno == een)))
15734                 bad++;
15735 }
15736 int main() {
15737         check(" 1", 1L, 0);
15738         check(" 0", 0L, 0);
15739 EOCP
15740         case "$longsize" in
15741         8)
15742             $cat >>try.c <<'EOCP'
15743         check("18446744073709551615", 18446744073709551615UL, 0);
15744         check("18446744073709551616", 18446744073709551615UL, ERANGE);
15745 #if 0 /* strtoul() for /^-/ strings is undefined. */
15746         check("-1", 18446744073709551615UL, 0);
15747         check("-18446744073709551614", 2, 0);
15748         check("-18446744073709551615", 1, 0);
15749         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
15750         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
15751 #endif
15752 EOCP
15753                 ;;
15754         4)
15755                     $cat >>try.c <<'EOCP'
15756         check("4294967295", 4294967295UL, 0);
15757         check("4294967296", 4294967295UL, ERANGE);
15758 #if 0 /* strtoul() for /^-/ strings is undefined. */
15759         check("-1", 4294967295UL, 0);
15760         check("-4294967294", 2, 0);
15761         check("-4294967295", 1, 0);
15762         check("-4294967296", 4294967295UL, ERANGE);
15763         check("-4294967297", 4294967295UL, ERANGE);
15764 #endif
15765 EOCP
15766                 ;;
15767         *)
15768 : Should we write these tests to be more portable by sprintf-ing
15769 : ~0 and then manipulating that char string as input for strtol?
15770                 ;;
15771         esac
15772         $cat >>try.c <<'EOCP'
15773         if (!bad)
15774                 printf("ok\n");
15775         return 0;
15776 }
15777 EOCP
15778         set try
15779         if eval $compile; then
15780                 case "`$run ./try`" in
15781                 ok) echo "Your strtoul() seems to be working okay." ;;
15782                 *) cat <<EOM >&4
15783 Your strtoul() doesn't seem to be working okay.
15784 EOM
15785                    d_strtoul="$undef"
15786                    ;;
15787                 esac
15788         fi
15789         ;;
15790 esac
15791
15792 : see if strtoull exists
15793 set strtoull d_strtoull
15794 eval $inlibc
15795
15796 case "$d_longlong-$d_strtoull" in
15797 "$define-$define")
15798         $cat <<EOM
15799 Checking whether your strtoull() works okay...
15800 EOM
15801         $cat >try.c <<'EOCP'
15802 #include <errno.h>
15803 #ifdef __hpux
15804 #define strtoull __strtoull
15805 #endif
15806 #include <stdio.h>
15807 extern unsigned long long int strtoull(char *s, char **, int); 
15808 static int bad = 0;
15809 int check(char *s, long long eull, int een) {
15810         long long gull;
15811         errno = 0;
15812         gull = strtoull(s, 0, 10);
15813         if (!((gull == eull) && (errno == een)))
15814                 bad++;
15815 }
15816 int main() {
15817         check(" 1",                                        1LL, 0);
15818         check(" 0",                                        0LL, 0);
15819         check("18446744073709551615",  18446744073709551615ULL, 0);
15820         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
15821 #if 0 /* strtoull() for /^-/ strings is undefined. */
15822         check("-1",                    18446744073709551615ULL, 0);
15823         check("-18446744073709551614",                     2LL, 0);
15824         check("-18446744073709551615",                     1LL, 0);
15825         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
15826         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
15827 #endif
15828         if (!bad)
15829                 printf("ok\n");
15830 }
15831 EOCP
15832         set try
15833         if eval $compile; then
15834                 case "`$run ./try`" in
15835                 ok) echo "Your strtoull() seems to be working okay." ;;
15836                 *) cat <<EOM >&4
15837 Your strtoull() doesn't seem to be working okay.
15838 EOM
15839                    d_strtoull="$undef"
15840                    ;;
15841                 esac
15842         fi
15843         ;;
15844 esac
15845
15846 : see if strtouq exists
15847 set strtouq d_strtouq
15848 eval $inlibc
15849
15850 case "$d_strtouq" in
15851 "$define")
15852         $cat <<EOM
15853 Checking whether your strtouq() works okay...
15854 EOM
15855         $cat >try.c <<'EOCP'
15856 #include <errno.h>
15857 #include <stdio.h>
15858 extern unsigned long long int strtouq(char *s, char **, int); 
15859 static int bad = 0;
15860 void check(char *s, unsigned long long eull, int een) {
15861         unsigned long long gull;
15862         errno = 0;
15863         gull = strtouq(s, 0, 10);
15864         if (!((gull == eull) && (errno == een)))
15865                 bad++;
15866 }
15867 int main() {
15868         check(" 1",                                        1LL, 0);
15869         check(" 0",                                        0LL, 0);
15870         check("18446744073709551615",  18446744073709551615ULL, 0);
15871         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
15872 #if 0 /* strtouq() for /^-/ strings is undefined. */
15873         check("-1",                    18446744073709551615ULL, 0);
15874         check("-18446744073709551614",                     2LL, 0);
15875         check("-18446744073709551615",                     1LL, 0);
15876         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
15877         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
15878 #endif
15879         if (!bad)
15880                 printf("ok\n");
15881         return 0;
15882 }
15883 EOCP
15884         set try
15885         if eval $compile; then
15886                 case "`$run ./try`" in
15887                 ok) echo "Your strtouq() seems to be working okay." ;;
15888                 *) cat <<EOM >&4
15889 Your strtouq() doesn't seem to be working okay.
15890 EOM
15891                    d_strtouq="$undef"
15892                    ;;
15893                 esac
15894         fi
15895         ;;
15896 esac
15897
15898 : see if strxfrm exists
15899 set strxfrm d_strxfrm
15900 eval $inlibc
15901
15902 : see if symlink exists
15903 set symlink d_symlink
15904 eval $inlibc
15905
15906 : see if syscall exists
15907 set syscall d_syscall
15908 eval $inlibc
15909
15910 : see if prototype for syscall is available
15911 echo " "
15912 set d_syscallproto syscall $i_unistd unistd.h
15913 eval $hasproto
15914
15915 : see if sysconf exists
15916 set sysconf d_sysconf
15917 eval $inlibc
15918
15919 : see if system exists
15920 set system d_system
15921 eval $inlibc
15922
15923 : see if tcgetpgrp exists
15924 set tcgetpgrp d_tcgetpgrp
15925 eval $inlibc
15926
15927 : see if tcsetpgrp exists
15928 set tcsetpgrp d_tcsetpgrp
15929 eval $inlibc
15930
15931 : see if prototype for telldir is available
15932 echo " "
15933 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
15934 eval $hasproto
15935
15936 : see if time exists
15937 echo " "
15938 if test "X$d_time" = X -o X"$timetype" = X; then
15939     if set time val -f d_time; eval $csym; $val; then
15940                 echo 'time() found.' >&4
15941                 val="$define"
15942                 rp="What is the type returned by time() on this system?"
15943                 set time_t timetype long stdio.h sys/types.h
15944                 eval $typedef_ask
15945     else
15946                 echo 'time() not found, hope that will do.' >&4
15947                 val="$undef"
15948                 timetype='int';
15949     fi
15950     set d_time
15951     eval $setvar
15952 fi
15953
15954 : see if this is a sys/times.h system
15955 set sys/times.h i_systimes
15956 eval $inhdr
15957
15958 : see if times exists
15959 echo " "
15960 if set times val -f d_times; eval $csym; $val; then
15961         echo 'times() found.' >&4
15962         d_times="$define"
15963         inc=''
15964         case "$i_systimes" in
15965         "$define") inc='sys/times.h';;
15966         esac
15967         rp="What is the type returned by times() on this system?"
15968         set clock_t clocktype long stdio.h sys/types.h $inc
15969         eval $typedef_ask
15970 else
15971         echo 'times() NOT found, hope that will do.' >&4
15972         d_times="$undef"
15973         clocktype='int'
15974 fi
15975
15976 : see if tmpnam_r exists
15977 set tmpnam_r d_tmpnam_r
15978 eval $inlibc
15979 case "$d_tmpnam_r" in
15980 "$define")
15981         hdrs="$i_systypes sys/types.h define stdio.h "
15982         case "$d_tmpnam_r_proto:$usethreads" in
15983         ":define")      d_tmpnam_r_proto=define
15984                 set d_tmpnam_r_proto tmpnam_r $hdrs
15985                 eval $hasproto ;;
15986         *)      ;;
15987         esac
15988         case "$d_tmpnam_r_proto" in
15989         define)
15990         case "$tmpnam_r_proto" in
15991         ''|0) try='char* tmpnam_r(char*);'
15992         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
15993         esac
15994         case "$tmpnam_r_proto" in
15995         ''|0)   d_tmpnam_r=undef
15996                 tmpnam_r_proto=0
15997                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
15998         * )     case "$tmpnam_r_proto" in
15999                 REENTRANT_PROTO*) ;;
16000                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
16001                 esac
16002                 echo "Prototype: $try" ;;
16003         esac
16004         ;;
16005         *)      case "$usethreads" in
16006                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
16007                 esac
16008                 d_tmpnam_r=undef
16009                 tmpnam_r_proto=0
16010                 ;;
16011         esac
16012         ;;
16013 *)      tmpnam_r_proto=0
16014         ;;
16015 esac
16016
16017 : see if truncate exists
16018 set truncate d_truncate
16019 eval $inlibc
16020
16021 : see if ttyname_r exists
16022 set ttyname_r d_ttyname_r
16023 eval $inlibc
16024 case "$d_ttyname_r" in
16025 "$define")
16026         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
16027         case "$d_ttyname_r_proto:$usethreads" in
16028         ":define")      d_ttyname_r_proto=define
16029                 set d_ttyname_r_proto ttyname_r $hdrs
16030                 eval $hasproto ;;
16031         *)      ;;
16032         esac
16033         case "$d_ttyname_r_proto" in
16034         define)
16035         case "$ttyname_r_proto" in
16036         ''|0) try='int ttyname_r(int, char*, size_t);'
16037         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
16038         esac
16039         case "$ttyname_r_proto" in
16040         ''|0) try='int ttyname_r(int, char*, int);'
16041         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
16042         esac
16043         case "$ttyname_r_proto" in
16044         ''|0) try='char* ttyname_r(int, char*, int);'
16045         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
16046         esac
16047         case "$ttyname_r_proto" in
16048         ''|0)   d_ttyname_r=undef
16049                 ttyname_r_proto=0
16050                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
16051         * )     case "$ttyname_r_proto" in
16052                 REENTRANT_PROTO*) ;;
16053                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
16054                 esac
16055                 echo "Prototype: $try" ;;
16056         esac
16057         ;;
16058         *)      case "$usethreads" in
16059                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
16060                 esac
16061                 d_ttyname_r=undef
16062                 ttyname_r_proto=0
16063                 ;;
16064         esac
16065         ;;
16066 *)      ttyname_r_proto=0
16067         ;;
16068 esac
16069
16070 : see if tzname[] exists
16071 echo " "
16072 if set tzname val -a d_tzname; eval $csym; $val; then
16073         val="$define"
16074         echo 'tzname[] found.' >&4
16075 else
16076         val="$undef"
16077         echo 'tzname[] NOT found.' >&4
16078 fi
16079 set d_tzname
16080 eval $setvar
16081
16082 case "$osname" in
16083 next|rhapsody|darwin) multiarch="$define" ;;
16084 esac
16085 case "$multiarch" in
16086 ''|[nN]*) multiarch="$undef" ;;
16087 esac
16088
16089 : check for ordering of bytes in a UV
16090 echo " "
16091 case "$usecrosscompile$multiarch" in
16092 *$define*)
16093         $cat <<EOM
16094 You seem to be either cross-compiling or doing a multiarchitecture build,
16095 skipping the byteorder check.
16096
16097 EOM
16098         byteorder='ffff'
16099         ;;
16100 *)
16101         case "$byteorder" in
16102         '')
16103                 $cat <<'EOM'
16104 In the following, larger digits indicate more significance.  A big-endian
16105 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
16106 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
16107 machines may have weird orders like 3412.  A Cray will report 87654321,
16108 an Alpha will report 12345678. If the test program works the default is
16109 probably right.
16110 I'm now running the test program...
16111 EOM
16112                 $cat >try.c <<EOCP
16113 #include <stdio.h>
16114 #include <sys/types.h>
16115 typedef $uvtype UV;
16116 int main()
16117 {
16118         int i;
16119         union {
16120                 UV l;
16121                 char c[$uvsize];
16122         } u;
16123
16124         if ($uvsize > 4)
16125                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
16126         else
16127                 u.l = (UV)0x04030201;
16128         for (i = 0; i < $uvsize; i++)
16129                 printf("%c", u.c[i]+'0');
16130         printf("\n");
16131         exit(0);
16132 }
16133 EOCP
16134                 xxx_prompt=y
16135                 set try
16136                 if eval $compile && ./try > /dev/null; then
16137                         dflt=`$run ./try`
16138                         case "$dflt" in
16139                         [1-4][1-4][1-4][1-4]|12345678|87654321)
16140                                 echo "(The test program ran ok.)"
16141                                 echo "byteorder=$dflt"
16142                                 xxx_prompt=n
16143                         ;;
16144                         ????|????????) echo "(The test program ran ok.)" ;;
16145                         *) echo "(The test program didn't run right for some reason.)" ;;
16146                         esac
16147                 else
16148                         dflt='4321'
16149                         cat <<'EOM'
16150 (I can't seem to compile the test program.  Guessing big-endian...)
16151 EOM
16152                 fi
16153                 case "$xxx_prompt" in
16154                 y)
16155                         rp="What is the order of bytes in $uvtype?"
16156                         . ./myread
16157                         byteorder="$ans"
16158                         ;;
16159                 *)      byteorder=$dflt
16160                         ;;
16161                 esac
16162                 ;;
16163         esac
16164         $rm -f try.c try
16165         ;;
16166 esac
16167
16168
16169 $cat <<EOM
16170
16171 Checking to see whether you can access character data unalignedly...
16172 EOM
16173 case "$d_u32align" in
16174 '')   $cat >try.c <<EOCP
16175 #include <stdio.h>
16176 #define U32 $u32type
16177 #define BYTEORDER 0x$byteorder
16178 #define U8 $u8type
16179 #include <signal.h>
16180 #ifdef SIGBUS
16181 $signal_t bletch(s) int s; { exit(4); }
16182 #endif
16183 int main() {
16184 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
16185     U8 buf[8];
16186     U32 *up;
16187     int i;
16188
16189     if (sizeof(U32) != 4) {
16190         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
16191         exit(1);
16192     }
16193
16194     fflush(stdout);
16195
16196 #ifdef SIGBUS
16197     signal(SIGBUS, bletch);
16198 #endif
16199
16200     buf[0] = 0;
16201     buf[1] = 0;
16202     buf[2] = 0;
16203     buf[3] = 1;
16204     buf[5] = 0;
16205     buf[6] = 0;
16206     buf[7] = 0;
16207     buf[8] = 1;
16208
16209     for (i = 0; i < 4; i++) {
16210         up = (U32*)(buf + i);
16211         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
16212                (*up == 1 << (8*(3-i)))  /* little-endian */
16213               )
16214            )
16215         {
16216             printf("read failed (%x)\n", *up);
16217             exit(2);
16218         }
16219     }
16220
16221     /* write test */
16222     for (i = 0; i < 4; i++) {
16223         up = (U32*)(buf + i);
16224         *up = 0xBeef;
16225         if (*up != 0xBeef) {
16226             printf("write failed (%x)\n", *up);
16227             exit(3);
16228         }
16229     }
16230
16231     exit(0);
16232 #else
16233     printf("1\n");
16234     exit(1);
16235 #endif
16236     return 0;
16237 }
16238 EOCP
16239 set try
16240 if eval $compile_ok; then
16241         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
16242         $run ./try 2>&1 >/dev/null
16243         case "$?" in
16244         0)      cat >&4 <<EOM
16245 You can access character data pretty unalignedly.
16246 EOM
16247                 d_u32align="$undef"
16248                 ;;
16249         *)      cat >&4 <<EOM
16250 It seems that you must access character data in an aligned manner.
16251 EOM
16252                 d_u32align="$define"
16253                 ;;
16254         esac
16255 else
16256         rp='Can you access character data at unaligned addresses?'
16257         dflt='n'
16258         . ./myread
16259         case "$ans" in
16260         [yY]*)  d_u32align="$undef"  ;;
16261         *)      d_u32align="$define" ;;
16262         esac
16263 fi
16264 $rm -f core core.try.* try.core
16265 ;;
16266 esac
16267
16268 : see if ualarm exists
16269 set ualarm d_ualarm
16270 eval $inlibc
16271
16272 : see if umask exists
16273 set umask d_umask
16274 eval $inlibc
16275
16276 : see if unordered exists
16277 set unordered d_unordered
16278 eval $inlibc
16279
16280 : see if usleep exists
16281 set usleep d_usleep
16282 eval $inlibc
16283
16284 : see if prototype for usleep is available
16285 echo " "
16286 set d_usleepproto usleep $i_unistd unistd.h
16287 eval $hasproto
16288
16289 : see if ustat exists
16290 set ustat d_ustat
16291 eval $inlibc
16292
16293 : backward compatibility for d_hvfork
16294 if test X$d_hvfork != X; then
16295         d_vfork="$d_hvfork"
16296         d_hvfork=''
16297 fi
16298 : see if there is a vfork
16299 val=''
16300 set vfork val
16301 eval $inlibc
16302
16303 : Ok, but do we want to use it. vfork is reportedly unreliable in 
16304 : perl on Solaris 2.x, and probably elsewhere.
16305 case "$val" in
16306 $define)
16307         echo " "
16308         case "$usevfork" in
16309         false) dflt='n';;
16310         *) dflt='y';;
16311         esac
16312         cat <<'EOM'
16313  
16314 Perl can only use a vfork() that doesn't suffer from strict
16315 restrictions on calling functions or modifying global data in
16316 the child.  For example, glibc-2.1 contains such a vfork()
16317 that is unsuitable.  If your system provides a proper fork()
16318 call, chances are that you do NOT want perl to use vfork().
16319
16320 EOM
16321         rp="Do you still want to use vfork()?"
16322         . ./myread
16323         case "$ans" in
16324         y|Y) ;;
16325         *)
16326                 echo "Ok, we won't use vfork()."
16327                 val="$undef"
16328                 ;;
16329         esac
16330         ;;
16331 esac
16332 set d_vfork
16333 eval $setvar
16334 case "$d_vfork" in
16335 $define) usevfork='true';;
16336 *) usevfork='false';;
16337 esac
16338
16339 : see if closedir exists
16340 set closedir d_closedir
16341 eval $inlibc
16342
16343 case "$d_closedir" in
16344 "$define")
16345         echo " "
16346         echo "Checking whether closedir() returns a status..." >&4
16347         cat > try.c <<EOM
16348 #$i_dirent I_DIRENT             /**/
16349 #$i_sysdir I_SYS_DIR            /**/
16350 #$i_sysndir I_SYS_NDIR          /**/
16351 #$i_systypes I_SYS_TYPES        /**/
16352
16353 #if defined(I_SYS_TYPES)
16354 #include <sys/types.h>
16355 #endif
16356 #if defined(I_DIRENT)
16357 #include <dirent.h>
16358 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
16359 #include <sys/dir.h>
16360 #endif
16361 #else
16362 #ifdef I_SYS_NDIR
16363 #include <sys/ndir.h>
16364 #else
16365 #ifdef I_SYS_DIR
16366 #ifdef hp9000s500
16367 #include <ndir.h>       /* may be wrong in the future */
16368 #else
16369 #include <sys/dir.h>
16370 #endif
16371 #endif
16372 #endif
16373 #endif 
16374 int main() { return closedir(opendir(".")); }
16375 EOM
16376         set try
16377         if eval $compile_ok; then
16378                 if $run ./try > /dev/null 2>&1 ; then
16379                         echo "Yes, it does."
16380                         val="$undef"
16381                 else
16382                         echo "No, it doesn't."
16383                         val="$define"
16384                 fi
16385         else
16386                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16387                 val="$define"
16388         fi
16389         ;;
16390 *)
16391         val="$undef";
16392         ;;
16393 esac
16394 set d_void_closedir
16395 eval $setvar
16396 $rm -f try try.*
16397 : see if there is a wait4
16398 set wait4 d_wait4
16399 eval $inlibc
16400
16401 : see if waitpid exists
16402 set waitpid d_waitpid
16403 eval $inlibc
16404
16405 : see if wcstombs exists
16406 set wcstombs d_wcstombs
16407 eval $inlibc
16408
16409 : see if wctomb exists
16410 set wctomb d_wctomb
16411 eval $inlibc
16412
16413 : see if writev exists
16414 set writev d_writev
16415 eval $inlibc
16416
16417 : preserve RCS keywords in files with variable substitution, grrr
16418 Date='$Date'
16419 Id='$Id'
16420 Log='$Log'
16421 RCSfile='$RCSfile'
16422 Revision='$Revision'
16423
16424 : check for alignment requirements
16425 echo " "
16426 case "$usecrosscompile$multiarch" in
16427 *$define*)
16428         $cat <<EOM
16429 You seem to be either cross-compiling or doing a multiarchitecture build,
16430 skipping the memory alignment check.
16431
16432 EOM
16433         case "$alignbytes" in
16434         '') alignbytes=8 ;;
16435         esac
16436         ;;
16437 *)
16438         case "$alignbytes" in
16439         '') echo "Checking alignment constraints..." >&4
16440                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
16441                         $cat >try.c <<'EOCP'
16442 typedef long double NV;
16443 EOCP
16444                 else
16445                         $cat >try.c <<'EOCP'
16446 typedef double NV;
16447 EOCP
16448                 fi
16449                 $cat >>try.c <<'EOCP'
16450 #include <stdio.h>
16451 struct foobar {
16452         char foo;
16453         NV bar;
16454 } try_algn;
16455 int main()
16456 {
16457     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
16458     return(0);
16459 }
16460 EOCP
16461                 set try
16462                 if eval $compile_ok; then
16463                         dflt=`$run ./try`
16464                 else
16465                         dflt='8'
16466                         echo "(I can't seem to compile the test program...)"
16467                 fi
16468                 ;;
16469         *) dflt="$alignbytes"
16470                 ;;
16471         esac
16472         rp="Doubles must be aligned on a how-many-byte boundary?"
16473         . ./myread
16474         alignbytes="$ans"
16475         $rm -f try.c try
16476         ;;
16477 esac
16478
16479
16480 : set the base revision
16481 baserev=5.0
16482
16483 : how do we catenate cpp tokens here?
16484 echo " "
16485 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
16486 $cat >cpp_stuff.c <<'EOCP'
16487 #define RCAT(a,b)a/**/b
16488 #define ACAT(a,b)a ## b
16489 RCAT(Rei,ser)
16490 ACAT(Cir,cus)
16491 EOCP
16492 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
16493 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
16494         echo "Oh!  Smells like ANSI's been here." >&4
16495         echo "We can catify or stringify, separately or together!"
16496         cpp_stuff=42
16497 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
16498         echo "Ah, yes!  The good old days!" >&4
16499         echo "However, in the good old days we don't know how to stringify and"
16500         echo "catify at the same time."
16501         cpp_stuff=1
16502 else
16503         $cat >&4 <<EOM
16504 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
16505 to have to edit the values of CAT[2-5] in config.h...
16506 EOM
16507         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
16508 fi
16509 $rm -f cpp_stuff.*
16510
16511 : see if this is a db.h system
16512 set db.h i_db
16513 eval $inhdr
16514
16515 case "$i_db" in
16516 $define)
16517         : Check db version.
16518         echo " "
16519         echo "Checking Berkeley DB version ..." >&4
16520         $cat >try.c <<EOCP
16521 #$d_const HASCONST
16522 #ifndef HASCONST
16523 #define const
16524 #endif
16525 #include <sys/types.h>
16526 #include <stdio.h>
16527 #include <db.h>
16528 int main(int argc, char *argv[])
16529 {
16530 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
16531     int Major, Minor, Patch ;
16532     unsigned long Version ;
16533     (void)db_version(&Major, &Minor, &Patch) ;
16534     if (argc == 2) {
16535         printf("%d %d %d %d %d %d\n",
16536                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
16537                Major, Minor, Patch);
16538         exit(0);
16539     }
16540     printf("You have Berkeley DB Version 2 or greater.\n");
16541
16542     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
16543                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
16544     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
16545                 Major, Minor, Patch) ;
16546
16547     /* check that db.h & libdb are compatible */
16548     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
16549         printf("db.h and libdb are incompatible.\n") ;
16550         exit(3);        
16551     }
16552
16553     printf("db.h and libdb are compatible.\n") ;
16554
16555     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
16556                 + DB_VERSION_PATCH ;
16557
16558     /* needs to be >= 2.3.4 */
16559     if (Version < 2003004) {
16560     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
16561         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
16562         exit(2);        
16563     }
16564
16565     exit(0);
16566 #else
16567 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
16568     if (argc == 2) {
16569         printf("1 0 0\n");
16570         exit(0);
16571     }
16572     printf("You have Berkeley DB Version 1.\n");
16573     exit(0);    /* DB version < 2: the coast is clear. */
16574 #else
16575     exit(1);    /* <db.h> not Berkeley DB? */
16576 #endif
16577 #endif
16578 }
16579 EOCP
16580         set try
16581         if eval $compile_ok && $run ./try; then
16582                 echo 'Looks OK.' >&4
16583                 set `$run ./try 1`
16584                 db_version_major=$1
16585                 db_version_minor=$2
16586                 db_version_patch=$3
16587         else
16588                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
16589                 i_db=$undef
16590                 case " $libs " in
16591                 *"-ldb "*)
16592                         : Remove db from list of libraries to use
16593                         echo "Removing unusable -ldb from library list" >&4
16594                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
16595                         shift
16596                         libs="$*"
16597                         echo "libs = $libs" >&4
16598                         ;;
16599                 esac
16600         fi
16601         $rm -f try.*
16602         ;;
16603 esac
16604
16605 case "$i_db" in
16606 define)
16607         : Check the return type needed for hash 
16608         echo " "
16609         echo "Checking return type needed for hash for Berkeley DB ..." >&4
16610         $cat >try.c <<EOCP
16611 #$d_const HASCONST
16612 #ifndef HASCONST
16613 #define const
16614 #endif
16615 #include <sys/types.h>
16616 #include <db.h>
16617
16618 #ifndef DB_VERSION_MAJOR
16619 u_int32_t hash_cb (ptr, size)
16620 const void *ptr;
16621 size_t size;
16622 {
16623 }
16624 HASHINFO info;
16625 int main()
16626 {
16627         info.hash = hash_cb;
16628 }
16629 #endif
16630 EOCP
16631         if $cc $ccflags -c try.c >try.out 2>&1 ; then
16632                 if $contains warning try.out >>/dev/null 2>&1 ; then
16633                         db_hashtype='int'
16634                 else
16635                         db_hashtype='u_int32_t'
16636                 fi
16637         else
16638                 : XXX Maybe we should just give up here.
16639                 db_hashtype=u_int32_t
16640                 $cat try.out >&4
16641                 echo "Help:  I can't seem to compile the db test program." >&4
16642                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
16643         fi
16644         $rm -f try.*
16645         echo "Your version of Berkeley DB uses $db_hashtype for hash."
16646         ;;
16647 *)      db_hashtype=u_int32_t
16648         ;;
16649 esac
16650 case "$i_db" in
16651 define)
16652         : Check the return type needed for prefix 
16653         echo " "
16654         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
16655         cat >try.c <<EOCP
16656 #$d_const HASCONST
16657 #ifndef HASCONST
16658 #define const
16659 #endif
16660 #include <sys/types.h>
16661 #include <db.h>
16662
16663 #ifndef DB_VERSION_MAJOR
16664 size_t prefix_cb (key1, key2)
16665 const DBT *key1;
16666 const DBT *key2;
16667 {
16668 }
16669 BTREEINFO info;
16670 int main()
16671 {
16672         info.prefix = prefix_cb;
16673 }
16674 #endif
16675 EOCP
16676         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
16677                 if $contains warning try.out >>/dev/null 2>&1 ; then
16678                         db_prefixtype='int'
16679                 else
16680                         db_prefixtype='size_t'
16681                 fi
16682         else
16683                 db_prefixtype='size_t'
16684                 : XXX Maybe we should just give up here.
16685                 $cat try.out >&4
16686                 echo "Help:  I can't seem to compile the db test program." >&4
16687                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
16688         fi
16689         $rm -f try.*
16690         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
16691         ;;
16692 *)      db_prefixtype='size_t'
16693         ;;
16694 esac
16695
16696
16697 : How can we generate normalized random numbers ?
16698 echo " "
16699 echo "Looking for a random number function..." >&4
16700 case "$randfunc" in
16701 '')
16702         if set drand48 val -f; eval $csym; $val; then
16703                 dflt="drand48"
16704                 echo "Good, found drand48()." >&4
16705         elif set random val -f; eval $csym; $val; then
16706                 dflt="random"
16707                 echo "OK, found random()." >&4
16708         else
16709                 dflt="rand"
16710                 echo "Yick, looks like I have to use rand()." >&4
16711         fi
16712         echo " "
16713         ;;
16714 *)
16715         dflt="$randfunc"
16716         ;;
16717 esac
16718 cont=true
16719
16720 case "$ccflags" in
16721 *-Dmy_rand=*|*-Dmy_srand=*)
16722         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
16723         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
16724         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
16725         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
16726         ;;
16727 esac
16728
16729 while $test "$cont"; do
16730         rp="Use which function to generate random numbers?"
16731         . ./myread
16732         if $test "$ans" = "$dflt"; then
16733                 : null
16734         else
16735                 randbits=''
16736         fi
16737         randfunc="$ans"
16738         if set $ans val -f; eval $csym; $val; then
16739                 cont=''
16740         else
16741                 dflt=y
16742                 rp="I cannot find function $ans. Use that name anyway?"
16743                 . ./myread
16744                 dflt=rand
16745                 case "$ans" in
16746                         [yY]*) cont='';;
16747                 esac
16748         fi
16749         case "$cont" in
16750         '')
16751                 case "$randfunc" in
16752                 drand48)
16753                         drand01="drand48()"
16754                         seedfunc="srand48"
16755                         randbits=48
16756                         randseedtype=long
16757                         ;;
16758                 rand|random)
16759                         case "$randbits" in
16760                         '')
16761 echo "Checking to see how many bits your $randfunc() function produces..." >&4
16762                                 $cat >try.c <<EOCP
16763 #$i_unistd I_UNISTD
16764 #$i_stdlib I_STDLIB
16765 #include <stdio.h>
16766 #ifdef I_UNISTD
16767 #  include <unistd.h>
16768 #endif
16769 #ifdef I_STDLIB
16770 #  include <stdlib.h>
16771 #endif
16772 int main()
16773 {
16774         register int i;
16775         register unsigned long tmp;
16776         register unsigned long max = 0L;
16777
16778         for (i = 1000; i; i--) {
16779                 tmp = (unsigned long) $randfunc();
16780                 if (tmp > max) max = tmp;
16781         }
16782         for (i = 0; max; i++)
16783                 max /= 2;
16784         printf("%d\n",i);
16785 }
16786 EOCP
16787                                 set try
16788                                 if eval $compile_ok; then
16789                                         dflt=`try`
16790                                 else
16791                                         dflt='?'
16792                                         echo "(I can't seem to compile the test program...)"
16793                                 fi
16794                                 ;;
16795                         *)
16796                                 dflt="$randbits"
16797                                 ;;
16798                         esac
16799                         rp="How many bits does your $randfunc() function produce?"
16800                         . ./myread
16801                         randbits="$ans"
16802                         $rm -f try.c try
16803                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
16804                         seedfunc="s$randfunc"
16805                         randseedtype=unsigned
16806                         ;;
16807                 *)
16808                         dflt="31"
16809                         rp="How many bits does your $randfunc() function produce?"
16810                         . ./myread
16811                         randbits="$ans"
16812                         seedfunc="s$randfunc"
16813                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
16814                         if set $seedfunc val -f; eval $csym; $val; then
16815                                 echo "(Using $seedfunc() to seed random generator)"
16816                         else
16817                                 echo "(Warning: no $seedfunc() to seed random generator)"
16818                                 seedfunc=rand
16819                         fi
16820                         randseedtype=unsigned
16821                         ;;
16822                 esac
16823                 ;;
16824         esac
16825 done
16826
16827 echo " "
16828 echo "Determining whether or not we are on an EBCDIC system..." >&4
16829 $cat >try.c <<'EOM'
16830 int main()
16831 {
16832   if ('M'==0xd4) return 0;
16833   return 1;
16834 }
16835 EOM
16836
16837 val=$undef
16838 set try
16839 if eval $compile_ok; then
16840         if $run ./try; then
16841                 echo "You seem to speak EBCDIC." >&4
16842                 val="$define"
16843         else
16844                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
16845         fi
16846 else
16847         echo "I'm unable to compile the test program." >&4
16848         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
16849 fi
16850 $rm -f try try.*
16851 set ebcdic
16852 eval $setvar
16853
16854 echo " "
16855 $cat >&4 <<EOM
16856 Checking how to flush all pending stdio output...
16857 EOM
16858 # I only know how to find the first 32 possibly open files on SunOS.
16859 # See also hints/sunos_4_1.sh and util.c  --AD
16860 case "$osname" in
16861 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
16862 esac
16863 $cat >>try.c <<EOCP
16864 #include <stdio.h>
16865 #$i_unistd I_UNISTD
16866 #ifdef I_UNISTD
16867 # include <unistd.h>
16868 #endif
16869 #$d_sysconf HAS_SYSCONF
16870 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
16871 #ifdef HAS_STDIO_STREAM_ARRAY
16872 # define STDIO_STREAM_ARRAY $stdio_stream_array
16873 #endif
16874 int main() {
16875   FILE* p;
16876   unlink("try.out");
16877   p = fopen("try.out", "w");
16878 #ifdef TRY_FPUTC
16879   fputc('x', p);
16880 #else
16881 # ifdef TRY_FPRINTF
16882   fprintf(p, "x");
16883 # endif
16884 #endif
16885 #ifdef TRY_FFLUSH_NULL
16886   fflush(NULL);
16887 #endif
16888 #ifdef TRY_FFLUSH_ALL
16889   {
16890     long open_max = -1;
16891 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
16892     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
16893 # else
16894 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
16895     open_max = sysconf(_SC_OPEN_MAX);
16896 #  else
16897 #   ifdef FOPEN_MAX
16898     open_max = FOPEN_MAX;
16899 #   else
16900 #    ifdef OPEN_MAX
16901     open_max = OPEN_MAX;
16902 #    else
16903 #     ifdef _NFILE
16904     open_max = _NFILE;
16905 #     endif
16906 #    endif
16907 #   endif
16908 #  endif
16909 # endif 
16910 # ifdef HAS_STDIO_STREAM_ARRAY
16911     if (open_max > 0) {
16912       long i;
16913       for (i = 0; i < open_max; i++)
16914             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
16915                 STDIO_STREAM_ARRAY[i]._file < open_max &&
16916                 STDIO_STREAM_ARRAY[i]._flag)
16917                 fflush(&STDIO_STREAM_ARRAY[i]);
16918     }   
16919   }
16920 # endif
16921 #endif
16922   _exit(42);
16923 }
16924 EOCP
16925 : first we have to find out how _not_ to flush
16926 $to try.c
16927 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
16928     output=''
16929     set try -DTRY_FPUTC
16930     if eval $compile; then
16931             $run ./try 2>/dev/null
16932             code="$?"
16933             $from try.out
16934             if $test ! -s try.out -a "X$code" = X42; then
16935                 output=-DTRY_FPUTC
16936             fi
16937     fi
16938     case "$output" in
16939     '')
16940             set try -DTRY_FPRINTF
16941             if eval $compile; then
16942                     $run ./try 2>/dev/null
16943                     code="$?"
16944                     $from try.out
16945                     if $test ! -s try.out -a "X$code" = X42; then
16946                         output=-DTRY_FPRINTF
16947                     fi
16948             fi
16949         ;;
16950     esac
16951 fi
16952 : check for fflush NULL behaviour
16953 case "$fflushNULL" in
16954 '')     set try -DTRY_FFLUSH_NULL $output
16955         if eval $compile; then
16956                 $run ./try 2>/dev/null
16957                 code="$?"
16958                 $from try.out
16959                 if $test -s try.out -a "X$code" = X42; then
16960                         fflushNULL="`$cat try.out`"
16961                 else
16962                         if $test "X$code" != X42; then
16963                                 $cat >&4 <<EOM
16964 (If this test failed, don't worry, we'll try another method shortly.)
16965 EOM
16966                         fi
16967                 fi
16968         fi
16969         $rm -f core try.core core.try.*
16970         case "$fflushNULL" in
16971         x)      $cat >&4 <<EOM
16972 Your fflush(NULL) works okay for output streams.
16973 Let's see if it clobbers input pipes...
16974 EOM
16975 # As of mid-March 2000 all versions of Solaris appear to have a stdio
16976 # bug that improperly flushes the input end of pipes.  So we avoid the
16977 # autoflush on fork/system/exec support for now. :-(
16978 $cat >tryp.c <<EOCP
16979 #include <stdio.h>
16980 int
16981 main(int argc, char **argv)
16982 {
16983     char buf[1024];
16984     int i;
16985     char *bp = buf;
16986     while (1) {
16987         while ((i = getc(stdin)) != -1
16988                && (*bp++ = i) != '\n'
16989                && bp < &buf[1024])
16990         /* DO NOTHING */ ;
16991         *bp = '\0';
16992         fprintf(stdout, "%s", buf);
16993         fflush(NULL);
16994         if (i == -1)
16995             return 0;
16996         bp = buf;
16997     }
16998 }
16999 EOCP
17000                 fflushNULL="$define"
17001                 set tryp
17002                 if eval $compile; then
17003                     $rm -f tryp.out
17004                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17005                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
17006                        $cat >&4 <<EOM
17007 fflush(NULL) seems to behave okay with input streams.
17008 EOM
17009                         fflushNULL="$define"
17010                     else
17011                         $cat >&4 <<EOM
17012 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
17013 EOM
17014                         fflushNULL="$undef"
17015                     fi
17016                 fi
17017                 $rm -f core tryp.c tryp.core core.tryp.*
17018                 ;;
17019         '')     $cat >&4 <<EOM
17020 Your fflush(NULL) isn't working (contrary to ANSI C).
17021 EOM
17022                 fflushNULL="$undef"
17023                 ;;
17024         *)      $cat >&4 <<EOM
17025 Cannot figure out whether your fflush(NULL) works or not.
17026 I'm assuming it doesn't (contrary to ANSI C).
17027 EOM
17028                 fflushNULL="$undef"
17029                 ;;
17030         esac
17031         ;;
17032 $define|true|[yY]*)
17033         fflushNULL="$define"
17034         ;;
17035 *)
17036         fflushNULL="$undef"
17037         ;;
17038 esac
17039 : check explicit looping only if NULL did not work, and if the pipe
17040 : bug does not show up on an explicit flush too
17041 case "$fflushNULL" in
17042 "$undef")
17043         $cat >tryp.c <<EOCP
17044 #include <stdio.h>
17045 int
17046 main(int argc, char **argv)
17047 {
17048     char buf[1024];
17049     int i;
17050     char *bp = buf;
17051     while (1) {
17052         while ((i = getc(stdin)) != -1
17053                && (*bp++ = i) != '\n'
17054                && bp < &buf[1024])
17055         /* DO NOTHING */ ;
17056         *bp = '\0';
17057         fprintf(stdout, "%s", buf);
17058         fflush(stdin);
17059         if (i == -1)
17060             return 0;
17061         bp = buf;
17062     }
17063 }
17064 EOCP
17065         set tryp
17066         if eval $compile; then
17067             $rm -f tryp.out
17068             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17069             if cmp tryp.c tryp.out >/dev/null 2>&1; then
17070                $cat >&4 <<EOM
17071 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
17072 EOM
17073                 : now check for fflushall behaviour
17074                 case "$fflushall" in
17075                 '')     set try -DTRY_FFLUSH_ALL $output
17076                         if eval $compile; then
17077                                 $cat >&4 <<EOM
17078 (Now testing the other method--but note that this also may fail.)
17079 EOM
17080                                 $run ./try 2>/dev/null
17081                                 code=$?
17082                                 $from try.out
17083                                 if $test -s try.out -a "X$code" = X42; then
17084                                         fflushall="`$cat try.out`"
17085                                 fi
17086                         fi
17087                         $rm -f core try.core core.try.*
17088                         case "$fflushall" in
17089                         x)      $cat >&4 <<EOM
17090 Whew. Flushing explicitly all the stdio streams works.
17091 EOM
17092                                 fflushall="$define"
17093                                 ;;
17094                         '')     $cat >&4 <<EOM
17095 Sigh. Flushing explicitly all the stdio streams doesn't work.
17096 EOM
17097                                 fflushall="$undef"
17098                                 ;;
17099                         *)      $cat >&4 <<EOM
17100 Cannot figure out whether flushing stdio streams explicitly works or not.
17101 I'm assuming it doesn't.
17102 EOM
17103                                 fflushall="$undef"
17104                                 ;;
17105                         esac
17106                         ;;
17107                 "$define"|true|[yY]*)
17108                         fflushall="$define"
17109                         ;;
17110                 *)
17111                         fflushall="$undef"
17112                         ;;
17113                 esac
17114             else
17115                 $cat >&4 <<EOM
17116 All is futile.  Even fflush(stdin) clobbers input pipes!
17117 EOM
17118                 fflushall="$undef"
17119             fi
17120         else
17121             fflushall="$undef"
17122         fi
17123         $rm -f core tryp.c tryp.core core.tryp.*
17124         ;;
17125 *)      fflushall="$undef"
17126         ;;
17127 esac
17128
17129 case "$fflushNULL$fflushall" in
17130 undefundef)
17131         $cat <<EOM
17132 OK, I give up.  I cannot figure out how to flush pending stdio output.
17133 We won't be flushing handles at all before fork/exec/popen.
17134 EOM
17135         ;;
17136 esac
17137 $rm -f try.* try$exe_ext
17138
17139 : Store the full pathname to the ar program for use in the C program
17140 : Respect a hint or command line value for full_ar.
17141 case "$full_ar" in
17142 '') full_ar=$ar ;;
17143 esac
17144
17145 : Store the full pathname to the sed program for use in the C program
17146 full_sed=$sed
17147
17148 : see what type gids are declared as in the kernel
17149 echo " "
17150 echo "Looking for the type for group ids returned by getgid()."
17151 set gid_t gidtype xxx stdio.h sys/types.h
17152 eval $typedef
17153 case "$gidtype" in
17154 xxx)
17155         xxx=`./findhdr sys/user.h`
17156         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
17157         case $1 in
17158         unsigned) dflt="$1 $2" ;;
17159         *) dflt="$1" ;;
17160         esac
17161         ;;
17162 *) dflt="$gidtype";;
17163 esac
17164 case "$gidtype" in
17165 gid_t) echo "gid_t found." ;;
17166 *)      rp="What is the type for group ids returned by getgid()?"
17167         . ./myread
17168         gidtype="$ans"
17169         ;;
17170 esac
17171
17172 echo " "
17173 case "$gidtype" in
17174 *_t) zzz="$gidtype"     ;;
17175 *)   zzz="gid"          ;;
17176 esac
17177 echo "Checking the size of $zzz..." >&4 
17178 cat > try.c <<EOCP
17179 #include <sys/types.h>
17180 #include <stdio.h>
17181 int main() {
17182     printf("%d\n", (int)sizeof($gidtype));
17183     exit(0);
17184 }
17185 EOCP
17186 set try
17187 if eval $compile_ok; then
17188         yyy=`$run ./try`
17189         case "$yyy" in
17190         '')     gidsize=4
17191                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
17192                 ;;
17193         *)      gidsize=$yyy
17194                 echo "Your $zzz is $gidsize bytes long."
17195                 ;;
17196         esac
17197 else
17198         gidsize=4
17199         echo "(I can't compile the test program--guessing $gidsize.)" >&4
17200 fi
17201
17202
17203 echo " "
17204 case "$gidtype" in
17205 *_t) zzz="$gidtype"     ;;
17206 *)   zzz="gid"          ;;
17207 esac
17208 echo "Checking the sign of $zzz..." >&4 
17209 cat > try.c <<EOCP
17210 #include <sys/types.h>
17211 #include <stdio.h>
17212 int main() {
17213         $gidtype foo = -1;
17214         if (foo < 0)
17215                 printf("-1\n");
17216         else
17217                 printf("1\n");
17218 }
17219 EOCP
17220 set try
17221 if eval $compile; then
17222         yyy=`$run ./try`
17223         case "$yyy" in
17224         '')     gidsign=1
17225                 echo "(I can't execute the test program--guessing unsigned.)" >&4
17226                 ;;
17227         *)      gidsign=$yyy
17228                 case "$gidsign" in
17229                  1) echo "Your $zzz is unsigned." ;;
17230                 -1) echo "Your $zzz is signed."   ;;
17231                 esac
17232                 ;;
17233         esac
17234 else
17235         gidsign=1
17236         echo "(I can't compile the test program--guessing unsigned.)" >&4
17237 fi
17238
17239
17240 echo " "
17241
17242 if $test X"$quadtype" != X; then
17243
17244 echo "Checking how to print 64-bit integers..." >&4
17245
17246 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
17247         $cat >try.c <<'EOCP'
17248 #include <sys/types.h>
17249 #include <stdio.h>
17250 int main() {
17251   int q = 12345678901;
17252   printf("%ld\n", q);
17253 }
17254 EOCP
17255         set try
17256         if eval $compile; then
17257                 yyy=`$run ./try`
17258                 case "$yyy" in
17259                 12345678901)
17260                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
17261                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
17262                         echo "We will use %d."
17263                         ;;
17264                 esac
17265         fi
17266 fi
17267
17268 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
17269         $cat >try.c <<'EOCP'
17270 #include <sys/types.h>
17271 #include <stdio.h>
17272 int main() {
17273   long q = 12345678901;
17274   printf("%ld\n", q);
17275 }
17276 EOCP
17277         set try
17278         if eval $compile; then
17279                 yyy=`$run ./try`
17280                 case "$yyy" in
17281                 12345678901)
17282                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
17283                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
17284                         echo "We will use %ld."
17285                         ;;
17286                 esac
17287         fi
17288 fi
17289
17290 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
17291         $cat >try.c <<'EOCP'
17292 #include <sys/types.h>
17293 #include <inttypes.h>
17294 #include <stdio.h>
17295 int main() {
17296   int64_t q = 12345678901;
17297   printf("%" PRId64 "\n", q);
17298 }
17299 EOCP
17300         set try
17301         if eval $compile; then
17302                 yyy=`$run ./try`
17303                 case "$yyy" in
17304                 12345678901)
17305                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
17306                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
17307                         echo "We will use the C9X style."
17308                         ;;
17309                 esac
17310         fi
17311 fi
17312
17313 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17314         $cat >try.c <<EOCP
17315 #include <sys/types.h>
17316 #include <stdio.h>
17317 int main() {
17318   $quadtype q = 12345678901;
17319   printf("%Ld\n", q);
17320 }
17321 EOCP
17322         set try
17323         if eval $compile; then
17324                 yyy=`$run ./try`
17325                 case "$yyy" in
17326                 12345678901)
17327                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
17328                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
17329                         echo "We will use %Ld."
17330                         ;;
17331                 esac
17332         fi
17333 fi
17334
17335 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
17336         $cat >try.c <<'EOCP'
17337 #include <sys/types.h>
17338 #include <stdio.h>
17339 int main() {
17340   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
17341   printf("%lld\n", q);
17342 }
17343 EOCP
17344         set try
17345         if eval $compile; then
17346                 yyy=`$run ./try`
17347                 case "$yyy" in
17348                 12345678901)
17349                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
17350                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
17351                         echo "We will use the %lld style."
17352                         ;;
17353                 esac
17354         fi
17355 fi
17356
17357 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17358         $cat >try.c <<EOCP
17359 #include <sys/types.h>
17360 #include <stdio.h>
17361 int main() {
17362   $quadtype q = 12345678901;
17363   printf("%qd\n", q);
17364 }
17365 EOCP
17366         set try
17367         if eval $compile; then
17368                 yyy=`$run ./try`
17369                 case "$yyy" in
17370                 12345678901)
17371                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
17372                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
17373                         echo "We will use %qd."
17374                         ;;
17375                 esac
17376         fi
17377 fi
17378
17379 if $test X"$sPRId64" = X; then
17380         echo "Cannot figure out how to print 64-bit integers." >&4
17381 fi
17382
17383 $rm -f try try.*
17384
17385 fi
17386
17387 case "$sPRId64" in
17388 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
17389         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
17390         ;;
17391 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
17392         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
17393         ;;
17394 esac
17395
17396
17397 echo " "
17398 $echo "Checking the format strings to be used for Perl's internal types..." >&4
17399
17400 if $test X"$ivsize" = X8; then
17401         ivdformat="$sPRId64"
17402         uvuformat="$sPRIu64"
17403         uvoformat="$sPRIo64"
17404         uvxformat="$sPRIx64"
17405         uvXUformat="$sPRIXU64"
17406 else
17407         if $test X"$ivsize" = X"$longsize"; then
17408                 ivdformat='"ld"'
17409                 uvuformat='"lu"'
17410                 uvoformat='"lo"'
17411                 uvxformat='"lx"'
17412                 uvXUformat='"lX"'
17413         else
17414                 if $test X"$ivsize" = X"$intsize"; then
17415                         ivdformat='"d"'
17416                         uvuformat='"u"'
17417                         uvoformat='"o"'
17418                         uvxformat='"x"'
17419                         uvXUformat='"X"'
17420                 else
17421                         : far out
17422                         if $test X"$ivsize" = X"$shortsize"; then
17423                                 ivdformat='"hd"'
17424                                 uvuformat='"hu"'
17425                                 uvoformat='"ho"'
17426                                 uvxformat='"hx"'
17427                                 uvXUformat='"hX"'
17428                         fi
17429                 fi
17430         fi
17431 fi
17432
17433 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
17434         nveformat="$sPRIeldbl"
17435         nvfformat="$sPRIfldbl"
17436         nvgformat="$sPRIgldbl"
17437         nvEUformat="$sPRIEUldbl"
17438         nvFUformat="$sPRIFUldbl"
17439         nvGUformat="$sPRIGUldbl"
17440 else
17441         nveformat='"e"'
17442         nvfformat='"f"'
17443         nvgformat='"g"'
17444         nvEUformat='"E"'
17445         nvFUformat='"F"'
17446         nvGUformat='"G"'
17447 fi
17448
17449 case "$ivdformat" in
17450 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
17451     exit 1
17452     ;;
17453 esac
17454
17455
17456 echo " "
17457 $echo "Checking the format string to be used for gids..." >&4
17458
17459 case "$gidsign" in
17460 -1)     if $test X"$gidsize" = X"$ivsize"; then
17461                 gidformat="$ivdformat"
17462         else
17463                 if $test X"$gidsize" = X"$longsize"; then
17464                         gidformat='"ld"'
17465                 else
17466                         if $test X"$gidsize" = X"$intsize"; then
17467                                 gidformat='"d"'
17468                         else
17469                                 if $test X"$gidsize" = X"$shortsize"; then
17470                                         gidformat='"hd"'
17471                                 fi
17472                         fi
17473                 fi
17474         fi
17475         ;;
17476 *)      if $test X"$gidsize" = X"$uvsize"; then
17477                 gidformat="$uvuformat"
17478         else
17479                 if $test X"$gidsize" = X"$longsize"; then
17480                         gidformat='"lu"'
17481                 else
17482                         if $test X"$gidsize" = X"$intsize"; then
17483                                 gidformat='"u"'
17484                         else
17485                                 if $test X"$gidsize" = X"$shortsize"; then
17486                                         gidformat='"hu"'
17487                                 fi
17488                         fi
17489                 fi
17490         fi
17491         ;;
17492 esac
17493
17494 : see if getgroups exists
17495 set getgroups d_getgrps
17496 eval $inlibc
17497
17498 : see if setgroups exists
17499 set setgroups d_setgrps
17500 eval $inlibc
17501
17502
17503 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
17504 echo " "
17505 case "$d_getgrps$d_setgrps" in
17506 *define*)
17507         case "$groupstype" in
17508         '') dflt="$gidtype" ;;
17509         *)  dflt="$groupstype" ;;
17510         esac
17511         $cat <<EOM
17512 What type of pointer is the second argument to getgroups() and setgroups()?
17513 Usually this is the same as group ids, $gidtype, but not always.
17514
17515 EOM
17516         rp='What type pointer is the second argument to getgroups() and setgroups()?'
17517         . ./myread
17518         groupstype="$ans"
17519         ;;
17520 *)  groupstype="$gidtype";;
17521 esac
17522
17523 echo " "
17524 echo "Checking if your $make program sets \$(MAKE)..." >&4
17525 case "$make_set_make" in
17526 '')
17527         $sed 's/^X //' > testmake.mak << 'EOF'
17528 Xall:
17529 X       @echo 'maketemp="$(MAKE)"'
17530 EOF
17531         case "`$make -f testmake.mak 2>/dev/null`" in
17532         *maketemp=*) make_set_make='#' ;;
17533         *)      make_set_make="MAKE=$make" ;;
17534         esac
17535         $rm -f testmake.mak
17536         ;;
17537 esac
17538 case "$make_set_make" in
17539 '#') echo "Yup, it does.";;
17540 *) echo "Nope, it doesn't.";;
17541 esac
17542
17543 : see what type is used for mode_t
17544 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
17545 set mode_t modetype int stdio.h sys/types.h
17546 eval $typedef_ask
17547
17548 : see if stdarg is available
17549 echo " "
17550 if $test `./findhdr stdarg.h`; then
17551         echo "<stdarg.h> found." >&4
17552         valstd="$define"
17553 else
17554         echo "<stdarg.h> NOT found." >&4
17555         valstd="$undef"
17556 fi
17557
17558 : see if varags is available
17559 echo " "
17560 if $test `./findhdr varargs.h`; then
17561         echo "<varargs.h> found." >&4
17562 else
17563         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
17564 fi
17565
17566 : set up the varargs testing programs
17567 $cat > varargs.c <<EOP
17568 #ifdef I_STDARG
17569 #include <stdarg.h>
17570 #endif
17571 #ifdef I_VARARGS
17572 #include <varargs.h>
17573 #endif
17574
17575 #ifdef I_STDARG
17576 int f(char *p, ...)
17577 #else
17578 int f(va_alist)
17579 va_dcl
17580 #endif
17581 {
17582         va_list ap;
17583 #ifndef I_STDARG
17584         char *p;
17585 #endif
17586 #ifdef I_STDARG
17587         va_start(ap,p);
17588 #else
17589         va_start(ap);
17590         p = va_arg(ap, char *);
17591 #endif
17592         va_end(ap);
17593 }
17594 EOP
17595 $cat > varargs <<EOP
17596 $startsh
17597 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
17598         echo "true"
17599 else
17600         echo "false"
17601 fi
17602 $rm -f varargs$_o
17603 EOP
17604 chmod +x varargs
17605
17606 : now check which varargs header should be included
17607 echo " "
17608 i_varhdr=''
17609 case "$valstd" in
17610 "$define")
17611         if `./varargs I_STDARG`; then
17612                 val='stdarg.h'
17613         elif `./varargs I_VARARGS`; then
17614                 val='varargs.h'
17615         fi
17616         ;;
17617 *)
17618         if `./varargs I_VARARGS`; then
17619                 val='varargs.h'
17620         fi
17621         ;;
17622 esac
17623 case "$val" in
17624 '')
17625 echo "I could not find the definition for va_dcl... You have problems..." >&4
17626         val="$undef"; set i_stdarg; eval $setvar
17627         val="$undef"; set i_varargs; eval $setvar
17628         ;;
17629 *) 
17630         set i_varhdr
17631         eval $setvar
17632         case "$i_varhdr" in
17633         stdarg.h)
17634                 val="$define"; set i_stdarg; eval $setvar
17635                 val="$undef"; set i_varargs; eval $setvar
17636                 ;;
17637         varargs.h)
17638                 val="$undef"; set i_stdarg; eval $setvar
17639                 val="$define"; set i_varargs; eval $setvar
17640                 ;;
17641         esac
17642         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
17643 esac
17644 $rm -f varargs*
17645
17646 : see if we need va_copy
17647 echo " "
17648 case "$i_stdarg" in
17649 "$define")
17650         $cat >try.c <<EOCP
17651 #include <stdarg.h>
17652 #include <stdio.h>
17653 #$i_stdlib I_STDLIB
17654 #ifdef I_STDLIB
17655 #include <stdlib.h>
17656 #endif
17657 #include <signal.h>
17658
17659 int
17660 ivfprintf(FILE *f, const char *fmt, va_list *valp)
17661 {
17662   return vfprintf(f, fmt, *valp);
17663 }
17664  
17665 int    
17666 myvfprintf(FILE *f, const  char *fmt, va_list val)
17667 {
17668   return ivfprintf(f, fmt, &val);
17669 }
17670       
17671 int
17672 myprintf(char *fmt, ...) 
17673 {
17674   va_list val;
17675   va_start(val, fmt);
17676   return myvfprintf(stdout, fmt, val); 
17677 }         
17678
17679 int
17680 main(int ac, char **av)
17681 {
17682   signal(SIGSEGV, exit);
17683
17684   myprintf("%s%cs all right, then\n", "that", '\'');                            
17685   exit(0);      
17686 }
17687 EOCP
17688         set try
17689         if eval $compile && $run ./try 2>&1 >/dev/null; then
17690                 case "`$run ./try`" in
17691                 "that's all right, then")
17692                         okay=yes
17693                         ;;
17694                 esac
17695         fi
17696         case "$okay" in
17697         yes)    echo "It seems that you don't need va_copy()." >&4
17698                 need_va_copy="$undef"
17699                 ;;
17700         *)      echo "It seems that va_copy() or similar will be needed." >&4
17701                 need_va_copy="$define"
17702                 ;;
17703         esac
17704         $rm -f try.* core core.* *.core *.core.*
17705         ;;
17706 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
17707         ;;
17708 esac
17709
17710 : see what type is used for size_t
17711 rp="What is the type used for the length parameter for string functions?"
17712 set size_t sizetype 'unsigned int' stdio.h sys/types.h
17713 eval $typedef_ask
17714
17715 : check for type of arguments to gethostbyaddr. 
17716 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
17717         case "$d_gethbyaddr" in
17718         $define)
17719                 $cat <<EOM
17720
17721 Checking to see what type of arguments are accepted by gethostbyaddr().
17722 EOM
17723                 hdrs="$define sys/types.h
17724                         $d_socket sys/socket.h 
17725                         $i_niin netinet/in.h 
17726                         $i_netdb netdb.h
17727                         $i_unistd unistd.h"
17728                 : The first arg can 'char *' or 'void *'
17729                 : The second arg is some of integral type
17730                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
17731                         for yyy in size_t long int; do
17732                                 case "$netdb_host_type" in
17733                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
17734                                         if ./protochk "$try" $hdrs; then
17735                                                 echo "Your system accepts $xxx for the first arg."
17736                                                 echo "...and $yyy for the second arg."
17737                                                 netdb_host_type="$xxx"
17738                                                 netdb_hlen_type="$yyy"
17739                                         fi
17740                                         ;;
17741                                 esac
17742                         done
17743                 done
17744                 : In case none of those worked, prompt the user.
17745                 case "$netdb_host_type" in
17746                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
17747                         dflt='char *'
17748                         . ./myread
17749                         netdb_host_type=$ans
17750                         rp='What is the type for the 2nd argument to gethostbyaddr?'
17751                         dflt="$sizetype"
17752                         . ./myread
17753                         netdb_hlen_type=$ans
17754                         ;;
17755                 esac
17756                 ;;
17757         *)      : no gethostbyaddr, so pick harmless defaults
17758                 netdb_host_type='char *'
17759                 netdb_hlen_type="$sizetype"
17760                 ;;
17761         esac
17762         # Remove the "const" if needed. -- but then we'll have a 
17763         # prototype clash!
17764         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
17765 fi
17766
17767 : check for type of argument to gethostbyname. 
17768 if test "X$netdb_name_type" = X ; then
17769         case "$d_gethbyname" in
17770         $define)
17771                 $cat <<EOM
17772
17773 Checking to see what type of argument is accepted by gethostbyname().
17774 EOM
17775                 hdrs="$define sys/types.h
17776                         $d_socket sys/socket.h 
17777                         $i_niin netinet/in.h 
17778                         $i_netdb netdb.h
17779                         $i_unistd unistd.h"
17780                 for xxx in "const char *" "char *"; do
17781                         case "$netdb_name_type" in
17782                         '')     try="extern struct hostent *gethostbyname($xxx);"
17783                                 if ./protochk "$try" $hdrs; then
17784                                         echo "Your system accepts $xxx."
17785                                         netdb_name_type="$xxx"
17786                                 fi
17787                                 ;;
17788                         esac
17789                 done
17790                 : In case none of those worked, prompt the user.
17791                 case "$netdb_name_type" in
17792                 '')     rp='What is the type for the 1st argument to gethostbyname?'
17793                         dflt='char *'
17794                         . ./myread
17795                         netdb_name_type=$ans
17796                         ;;
17797                 esac
17798                 ;;
17799         *)      : no gethostbyname, so pick harmless default
17800                 netdb_name_type='char *'
17801                 ;;
17802         esac
17803 fi
17804
17805 : check for type of 1st argument to getnetbyaddr. 
17806 if test "X$netdb_net_type" = X ; then
17807         case "$d_getnbyaddr" in
17808         $define)
17809                 $cat <<EOM
17810
17811 Checking to see what type of 1st argument is accepted by getnetbyaddr().
17812 EOM
17813                 hdrs="$define sys/types.h
17814                         $d_socket sys/socket.h 
17815                         $i_niin netinet/in.h 
17816                         $i_netdb netdb.h
17817                         $i_unistd unistd.h"
17818                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
17819                         case "$netdb_net_type" in
17820                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
17821                                 if ./protochk "$try" $hdrs; then
17822                                         echo "Your system accepts $xxx."
17823                                         netdb_net_type="$xxx"
17824                                 fi
17825                                 ;;
17826                         esac
17827                 done
17828                 : In case none of those worked, prompt the user.
17829                 case "$netdb_net_type" in
17830                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
17831                         dflt='long'
17832                         . ./myread
17833                         netdb_net_type=$ans
17834                         ;;
17835                 esac
17836                 ;;
17837         *)      : no getnetbyaddr, so pick harmless default
17838                 netdb_net_type='long'
17839                 ;;
17840         esac
17841 fi
17842 : locate the preferred pager for this system
17843 case "$pager" in
17844 '')
17845         dflt=''
17846         case "$pg" in
17847         /*) dflt=$pg;;
17848         [a-zA-Z]:/*) dflt=$pg;;
17849         esac
17850         case "$more" in
17851         /*) dflt=$more;;
17852         [a-zA-Z]:/*) dflt=$more;;
17853         esac
17854         case "$less" in
17855         /*) dflt=$less;;
17856         [a-zA-Z]:/*) dflt=$less;;
17857         esac
17858         case "$dflt" in
17859         '') dflt=/usr/ucb/more;;
17860         esac
17861         ;;
17862 *) dflt="$pager";;
17863 esac
17864 echo " "
17865 fn=f/
17866 rp='What pager is used on your system?'
17867 . ./getfile
17868 pager="$ans"
17869
17870 : see what type pids are declared as in the kernel
17871 rp="What is the type of process ids on this system?"
17872 set pid_t pidtype int stdio.h sys/types.h
17873 eval $typedef_ask
17874
17875 : Find earliest binary compatible site_perl subdirectory perl can use.
17876 xs_apiversion=$version # The current site_perl version.
17877 : Find earliest pure perl site_perl subdirectory perl can use.
17878 : The versioned directories started at 5.005.
17879 pm_apiversion='5.005'
17880
17881 : see if ar generates random libraries by itself
17882 echo " "
17883 echo "Checking how to generate random libraries on your machine..." >&4
17884 echo 'int bar1() { return bar2(); }' > bar1.c
17885 echo 'int bar2() { return 2; }' > bar2.c
17886 $cat > foo.c <<'EOP'
17887 int main() { printf("%d\n", bar1()); exit(0); }
17888 EOP
17889 $cc $ccflags -c bar1.c >/dev/null 2>&1
17890 $cc $ccflags -c bar2.c >/dev/null 2>&1
17891 $cc $ccflags -c foo.c >/dev/null 2>&1
17892 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
17893 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
17894         $run ./foobar >/dev/null 2>&1; then
17895         echo "$ar appears to generate random libraries itself."
17896         orderlib=false
17897         ranlib=":"
17898 elif $ar ts bar$_a >/dev/null 2>&1 &&
17899         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
17900         $run ./foobar >/dev/null 2>&1; then
17901                 echo "a table of contents needs to be added with '$ar ts'."
17902                 orderlib=false
17903                 ranlib="$ar ts"
17904 else
17905         case "$ranlib" in
17906         :) ranlib='';;
17907         '')
17908                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
17909                 $test -f $ranlib || ranlib=''
17910                 ;;
17911         esac
17912         if $test -n "$ranlib"; then
17913                 echo "your system has '$ranlib'; we'll use that."
17914                 orderlib=false
17915         else
17916                 echo "your system doesn't seem to support random libraries"
17917                 echo "so we'll use lorder and tsort to order the libraries."
17918                 orderlib=true
17919                 ranlib=":"
17920         fi
17921 fi
17922 $rm -f foo* bar* 
17923
17924 : check for type of arguments to select. 
17925 case "$selecttype" in
17926 '') case "$d_select" in
17927         $define)
17928                 echo " "
17929                 $cat <<EOM
17930 Checking to see what type of arguments are accepted by select().
17931 EOM
17932                 hdrs="$define sys/types.h
17933                         $i_systime sys/time.h 
17934                         $i_sysselct sys/select.h
17935                         $d_socket sys/socket.h"
17936                 : The first arg can be int, unsigned, or size_t
17937                 : The last arg may or may not be 'const'
17938                 val=''
17939                 : void pointer has been seen but using that
17940                 : breaks the selectminbits test
17941                 for xxx in 'fd_set *' 'int *'; do
17942                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
17943                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
17944                                         case "$val" in
17945                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
17946                                                 if ./protochk "$try" $hdrs; then
17947                                                         echo "Your system accepts $xxx."
17948                                                         val="$xxx"
17949                                                 fi
17950                                                 ;;
17951                                         esac
17952                                 done
17953                         done
17954                 done
17955                 case "$val" in
17956                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
17957                         case "$d_fd_set" in
17958                                 $define) dflt="fd_set *" ;;
17959                                 *)              dflt="int *" ;;
17960                         esac
17961                         . ./myread
17962                         val=$ans
17963                         ;;
17964                 esac
17965                 selecttype="$val"
17966                 ;;
17967         *)      : no select, so pick a harmless default
17968                 selecttype='int *'
17969                 ;;
17970         esac
17971         ;;
17972 esac
17973
17974 : check for the select 'width'
17975 case "$selectminbits" in
17976 '') case "$d_select" in
17977         $define)
17978                 $cat <<EOM
17979
17980 Checking to see on how many bits at a time your select() operates...
17981 EOM
17982                 $cat >try.c <<EOCP
17983 #include <sys/types.h>
17984 #$i_time I_TIME
17985 #$i_systime I_SYS_TIME
17986 #$i_systimek I_SYS_TIME_KERNEL
17987 #ifdef I_TIME
17988 #   include <time.h>
17989 #endif
17990 #ifdef I_SYS_TIME
17991 #   ifdef I_SYS_TIME_KERNEL
17992 #       define KERNEL
17993 #   endif
17994 #   include <sys/time.h>
17995 #   ifdef I_SYS_TIME_KERNEL
17996 #       undef KERNEL
17997 #   endif
17998 #endif
17999 #$i_sysselct I_SYS_SELECT
18000 #ifdef I_SYS_SELECT
18001 #include <sys/select.h>
18002 #endif
18003 #$d_socket HAS_SOCKET
18004 #ifdef HAS_SOCKET
18005 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
18006 #endif
18007 #include <stdio.h>
18008 $selecttype b;
18009 #define S sizeof(*(b))
18010 #define MINBITS 64
18011 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
18012 #define NBITS  (NBYTES * 8)
18013 int main() {
18014     char s[NBYTES];
18015     struct timeval t;
18016     int i;
18017     FILE* fp;
18018     int fd;
18019
18020     fclose(stdin);
18021     fp = fopen("try.c", "r");
18022     if (fp == 0)
18023       exit(1);
18024     fd = fileno(fp);
18025     if (fd < 0)
18026       exit(2);
18027     b = ($selecttype)s;
18028     for (i = 0; i < NBITS; i++)
18029         FD_SET(i, b);
18030     t.tv_sec  = 0;
18031     t.tv_usec = 0;
18032     select(fd + 1, b, 0, 0, &t);
18033     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
18034     printf("%d\n", i + 1);
18035     return 0;
18036 }
18037 EOCP
18038                 set try
18039                 if eval $compile_ok; then
18040                         selectminbits=`$run ./try`
18041                         case "$selectminbits" in
18042                         '')     cat >&4 <<EOM
18043 Cannot figure out on how many bits at a time your select() operates.
18044 I'll play safe and guess it is 32 bits.
18045 EOM
18046                                 selectminbits=32
18047                                 bits="32 bits"
18048                                 ;;
18049                         1)      bits="1 bit" ;;
18050                         *)      bits="$selectminbits bits" ;;
18051                         esac
18052                         echo "Your select() operates on $bits at a time." >&4
18053                 else
18054                         rp='What is the minimum number of bits your select() operates on?'
18055                         case "$byteorder" in
18056                         1234|12345678)  dflt=32 ;;
18057                         *)              dflt=1  ;;
18058                         esac
18059                         . ./myread
18060                         val=$ans
18061                         selectminbits="$val"
18062                 fi
18063                 $rm -f try.* try
18064                 ;;
18065         *)      : no select, so pick a harmless default
18066                 selectminbits='32'
18067                 ;;
18068         esac
18069         ;;
18070 esac
18071
18072 : Trace out the files included by signal.h, then look for SIGxxx names.
18073 : Remove SIGARRAYSIZE used by HPUX.
18074 : Remove SIGSTKSIZE used by Linux.
18075 : Remove SIGSTKSZ used by Posix.
18076 : Remove SIGTYP void lines used by OS2.
18077 : Some cpps, like os390, dont give the file name anywhere
18078 if [ "X$fieldn" = X ]; then
18079         : Just make some guesses.  We check them later.
18080         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
18081 else
18082         xxx=`echo '#include <signal.h>' |
18083         $cppstdin $cppminus $cppflags 2>/dev/null |
18084         $grep '^[       ]*#.*include' | 
18085         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
18086 fi
18087 : Check this list of files to be sure we have parsed the cpp output ok.
18088 : This will also avoid potentially non-existent files, such 
18089 : as ../foo/bar.h
18090 xxxfiles=''
18091 for xx in $xxx /dev/null ; do
18092         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
18093 done
18094 : If we have found no files, at least try signal.h
18095 case "$xxxfiles" in
18096 '')     xxxfiles=`./findhdr signal.h` ;;
18097 esac
18098 xxx=`awk '
18099 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
18100         print substr($2, 4, 20)
18101 }
18102 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
18103         print substr($3, 4, 20)
18104 }' $xxxfiles`
18105 : Append some common names just in case the awk scan failed.
18106 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
18107 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
18108 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
18109 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
18110 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
18111
18112 : generate a few handy files for later
18113 $cat > signal.c <<'EOCP'
18114 #include <sys/types.h>
18115 #include <signal.h>
18116 #include <stdio.h>
18117 int main() {
18118
18119 /* Strange style to avoid deeply-nested #if/#else/#endif */
18120 #ifndef NSIG
18121 #  ifdef _NSIG
18122 #    define NSIG (_NSIG)
18123 #  endif
18124 #endif
18125
18126 #ifndef NSIG
18127 #  ifdef SIGMAX
18128 #    define NSIG (SIGMAX+1)
18129 #  endif
18130 #endif
18131
18132 #ifndef NSIG
18133 #  ifdef SIG_MAX
18134 #    define NSIG (SIG_MAX+1)
18135 #  endif
18136 #endif
18137
18138 #ifndef NSIG
18139 #  ifdef MAXSIG
18140 #    define NSIG (MAXSIG+1)
18141 #  endif
18142 #endif
18143
18144 #ifndef NSIG
18145 #  ifdef MAX_SIG
18146 #    define NSIG (MAX_SIG+1)
18147 #  endif
18148 #endif
18149
18150 #ifndef NSIG
18151 #  ifdef SIGARRAYSIZE
18152 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
18153 #  endif
18154 #endif
18155
18156 #ifndef NSIG
18157 #  ifdef _sys_nsig
18158 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
18159 #  endif
18160 #endif
18161
18162 /* Default to some arbitrary number that's big enough to get most
18163    of the common signals.
18164 */
18165 #ifndef NSIG
18166 #    define NSIG 50
18167 #endif
18168
18169 printf("NSIG %d\n", NSIG);
18170
18171 #ifndef JUST_NSIG
18172
18173 EOCP
18174
18175 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
18176 {
18177         printf "#ifdef SIG"; printf $1; printf "\n"
18178         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
18179         printf $1; printf ");\n"
18180         printf "#endif\n"
18181 }
18182 END {
18183         printf "#endif /* JUST_NSIG */\n";
18184         printf "exit(0);\n}\n";
18185 }
18186 ' >>signal.c
18187 $cat >signal.awk <<'EOP'
18188 BEGIN { ndups = 0 }
18189 $1 ~ /^NSIG$/ { nsig = $2 }
18190 ($1 !~ /^NSIG$/) && (NF == 2) {
18191     if ($2 > maxsig) { maxsig = $2 }
18192     if (sig_name[$2]) {
18193         dup_name[ndups] = $1
18194         dup_num[ndups] = $2
18195         ndups++ 
18196     }
18197     else {
18198         sig_name[$2] = $1
18199         sig_num[$2] = $2
18200     }
18201 }
18202 END { 
18203     if (nsig == 0) {
18204         nsig = maxsig + 1
18205     }
18206     printf("NSIG %d\n", nsig);
18207     for (n = 1; n < nsig; n++) {
18208         if (sig_name[n]) {
18209             printf("%s %d\n", sig_name[n], sig_num[n])
18210         }
18211         else {
18212             printf("NUM%d %d\n", n, n) 
18213         }
18214     }
18215     for (n = 0; n < ndups; n++) {
18216         printf("%s %d\n", dup_name[n], dup_num[n])
18217     }
18218 }
18219 EOP
18220 $cat >signal_cmd <<EOS
18221 $startsh
18222 if $test -s signal.lst; then
18223     echo "Using your existing signal.lst file"
18224         exit 0
18225 fi
18226 xxx="$xxx"
18227 EOS
18228 $cat >>signal_cmd <<'EOS'
18229
18230 set signal
18231 if eval $compile_ok; then
18232         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
18233 else
18234         echo "(I can't seem be able to compile the whole test program)" >&4
18235         echo "(I'll try it in little pieces.)" >&4
18236         set signal -DJUST_NSIG
18237         if eval $compile_ok; then
18238                 $run ./signal$_exe > signal.nsg
18239                 $cat signal.nsg
18240         else
18241                 echo "I can't seem to figure out how many signals you have." >&4
18242                 echo "Guessing 50." >&4
18243                 echo 'NSIG 50' > signal.nsg
18244         fi
18245         : Now look at all the signal names, one at a time.
18246         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
18247                 $cat > signal.c <<EOCP
18248 #include <sys/types.h>
18249 #include <signal.h>
18250 #include <stdio.h>
18251 int main() {
18252 printf("$xx %d\n", SIG${xx});
18253 return 0;
18254 }
18255 EOCP
18256                 set signal
18257                 if eval $compile; then
18258                         echo "SIG${xx} found."
18259                         $run ./signal$_exe  >> signal.ls1
18260                 else
18261                         echo "SIG${xx} NOT found."
18262                 fi
18263         done
18264         if $test -s signal.ls1; then
18265                 $cat signal.nsg signal.ls1 |
18266                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
18267         fi
18268
18269 fi
18270 if $test -s signal.lst; then
18271         :
18272 else
18273         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
18274         echo 'kill -l' >signal
18275         set X `csh -f <signal`
18276         $rm -f signal
18277         shift
18278         case $# in
18279         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
18280         esac
18281         echo $@ | $tr ' ' $trnl | \
18282             $awk '{ printf "%s %d\n", $1, ++s; }
18283                   END { printf "NSIG %d\n", ++s }' >signal.lst
18284 fi
18285 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
18286 EOS
18287 chmod a+x signal_cmd
18288 $eunicefix signal_cmd
18289
18290 : generate list of signal names
18291 echo " "
18292 case "$sig_name_init" in
18293 '') doinit=yes ;;
18294 *)  case "$sig_num_init" in
18295     ''|*,*) doinit=yes ;;
18296     esac ;;
18297 esac
18298 case "$doinit" in
18299 yes)
18300         echo "Generating a list of signal names and numbers..." >&4
18301         . ./signal_cmd
18302         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
18303         sig_name=`$awk 'BEGIN { printf "ZERO " }
18304                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
18305         sig_num=`$awk  'BEGIN { printf "0 " }
18306                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
18307         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
18308                              !/^NSIG/   { printf "\"%s\", ", $1 }
18309                              END        { printf "0\n" }' signal.lst`
18310         sig_num_init=`$awk  'BEGIN      { printf "0, " }
18311                              !/^NSIG/   { printf "%d, ", $2}
18312                              END        { printf "0\n"}' signal.lst`
18313         ;;
18314 esac
18315 echo "The following $sig_count signals are available:"
18316 echo " "
18317 echo $sig_name | $awk \
18318 'BEGIN { linelen = 0 }
18319 {
18320         for (i = 1; i <= NF; i++) {
18321                 name = "SIG" $i " "
18322                 linelen = linelen + length(name)
18323                 if (linelen > 70) {
18324                         printf "\n"
18325                         linelen = length(name)
18326                 }
18327                 printf "%s", name
18328         }
18329         printf "\n"
18330 }'
18331 sig_size=`echo $sig_name | awk '{print NF}'`
18332 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
18333
18334 echo " "
18335 case "$sizetype" in
18336 *_t) zzz="$sizetype"    ;;
18337 *)   zzz="filesize"     ;;
18338 esac
18339 echo "Checking the size of $zzz..." >&4 
18340 cat > try.c <<EOCP
18341 #include <sys/types.h>
18342 #include <stdio.h>
18343 int main() {
18344     printf("%d\n", (int)sizeof($sizetype));
18345     exit(0);
18346 }
18347 EOCP
18348 set try
18349 if eval $compile_ok; then
18350         yyy=`$run ./try`
18351         case "$yyy" in
18352         '')     sizesize=4
18353                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
18354                 ;;
18355         *)      sizesize=$yyy
18356                 echo "Your $zzz size is $sizesize bytes."
18357                 ;;
18358         esac
18359 else
18360         sizesize=4
18361         echo "(I can't compile the test program--guessing $sizesize.)" >&4
18362 fi
18363
18364
18365 : check for socklen_t
18366 echo " "
18367 echo "Checking to see if you have socklen_t..." >&4
18368 $cat >try.c <<EOCP
18369 #include <sys/types.h>
18370 #$d_socket HAS_SOCKET
18371 #ifdef HAS_SOCKET
18372 #include <sys/socket.h>
18373 #endif
18374 int main() { socklen_t x = 16; }
18375 EOCP
18376 set try
18377 if eval $compile; then
18378         val="$define"
18379         echo "You have socklen_t."
18380 else
18381         val="$undef"
18382         echo "You do not have socklen_t."
18383         case "$sizetype" in
18384         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
18385         esac
18386 fi
18387 $rm -f try try.*
18388 set d_socklen_t
18389 eval $setvar
18390
18391 : see if this is a socks.h system
18392 set socks.h i_socks
18393 eval $inhdr
18394
18395 : check for type of the size argument to socket calls
18396 case "$d_socket" in
18397 "$define")
18398         $cat <<EOM
18399
18400 Checking to see what type is the last argument of accept().
18401 EOM
18402         yyy=''
18403         case "$d_socklen_t" in
18404         "$define") yyy="$yyy socklen_t"
18405         esac
18406         yyy="$yyy $sizetype int long unsigned"
18407         for xxx in $yyy; do
18408                 case "$socksizetype" in
18409                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
18410                         case "$usesocks" in
18411                         "$define")
18412                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
18413                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18414                                         socksizetype="$xxx"
18415                                 fi
18416                                 ;;
18417                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
18418                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18419                                         socksizetype="$xxx"
18420                                 fi
18421                                 ;;
18422                         esac
18423                         ;;
18424                 esac
18425         done
18426 : In case none of those worked, prompt the user.
18427         case "$socksizetype" in
18428         '')     rp='What is the type for socket address structure sizes?'
18429                 dflt='int'
18430                 . ./myread
18431                 socksizetype=$ans
18432                 ;;
18433         esac
18434         ;;
18435 *)      : no sockets, so pick relatively harmless default
18436         socksizetype='int'
18437         ;;
18438 esac
18439
18440 : see what type is used for signed size_t
18441 set ssize_t ssizetype int stdio.h sys/types.h
18442 eval $typedef
18443 dflt="$ssizetype"
18444 $cat > try.c <<EOM
18445 #include <stdio.h>
18446 #include <sys/types.h>
18447 #define Size_t $sizetype
18448 #define SSize_t $dflt
18449 int main()
18450 {
18451         if (sizeof(Size_t) == sizeof(SSize_t))
18452                 printf("$dflt\n");
18453         else if (sizeof(Size_t) == sizeof(int))
18454                 printf("int\n");
18455         else 
18456                 printf("long\n");
18457         exit(0);
18458 }
18459 EOM
18460 echo " "
18461 set try
18462 if eval $compile_ok && $run ./try > /dev/null; then
18463         ssizetype=`$run ./try`
18464         echo "I'll be using $ssizetype for functions returning a byte count." >&4
18465 else
18466         $cat >&4 <<EOM
18467 Help! I can't compile and run the ssize_t test program: please enlighten me!
18468 (This is probably a misconfiguration in your system or libraries, and
18469 you really ought to fix it.  Still, I'll try anyway.)
18470
18471 I need a type that is the same size as $sizetype, but is guaranteed to
18472 be signed.  Common values are ssize_t, int and long.
18473
18474 EOM
18475         rp="What signed type is the same size as $sizetype?"
18476         . ./myread
18477         ssizetype="$ans"
18478 fi
18479 $rm -f try try.*
18480
18481 : see what type of char stdio uses.
18482 echo " "
18483 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
18484 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
18485         echo "Your stdio uses unsigned chars." >&4
18486         stdchar="unsigned char"
18487 else
18488         echo "Your stdio uses signed chars." >&4
18489         stdchar="char"
18490 fi
18491 $rm -f stdioh
18492
18493
18494
18495 : see what type uids are declared as in the kernel
18496 echo " "
18497 echo "Looking for the type for user ids returned by getuid()."
18498 set uid_t uidtype xxx stdio.h sys/types.h
18499 eval $typedef
18500 case "$uidtype" in
18501 xxx)
18502         xxx=`./findhdr sys/user.h`
18503         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18504         case $1 in
18505         unsigned) dflt="$1 $2" ;;
18506         *) dflt="$1" ;;
18507         esac
18508         ;;
18509 *) dflt="$uidtype";;
18510 esac
18511 case "$uidtype" in
18512 uid_t)  echo "uid_t found." ;;
18513 *)      rp="What is the type for user ids returned by getuid()?"
18514         . ./myread
18515         uidtype="$ans"
18516         ;;
18517 esac
18518
18519 echo " "
18520 case "$uidtype" in
18521 *_t) zzz="$uidtype"     ;;
18522 *)   zzz="uid"          ;;
18523 esac
18524 echo "Checking the size of $zzz..." >&4 
18525 cat > try.c <<EOCP
18526 #include <sys/types.h>
18527 #include <stdio.h>
18528 int main() {
18529     printf("%d\n", (int)sizeof($uidtype));
18530     exit(0);
18531 }
18532 EOCP
18533 set try
18534 if eval $compile_ok; then
18535         yyy=`$run ./try`
18536         case "$yyy" in
18537         '')     uidsize=4
18538                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
18539                 ;;
18540         *)      uidsize=$yyy
18541                 echo "Your $zzz is $uidsize bytes long."
18542                 ;;
18543         esac
18544 else
18545         uidsize=4
18546         echo "(I can't compile the test program--guessing $uidsize.)" >&4
18547 fi
18548
18549 echo " "
18550 case "$uidtype" in
18551 *_t) zzz="$uidtype"     ;;
18552 *)   zzz="uid"          ;;
18553 esac
18554 echo "Checking the sign of $zzz..." >&4
18555 cat > try.c <<EOCP
18556 #include <sys/types.h>
18557 #include <stdio.h>
18558 int main() {
18559         $uidtype foo = -1;
18560         if (foo < 0)
18561                 printf("-1\n");
18562         else
18563                 printf("1\n");
18564 }
18565 EOCP
18566 set try
18567 if eval $compile; then
18568         yyy=`$run ./try`
18569         case "$yyy" in
18570         '')     uidsign=1
18571                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18572                 ;;
18573         *)      uidsign=$yyy
18574                 case "$uidsign" in
18575                  1) echo "Your $zzz is unsigned." ;;
18576                 -1) echo "Your $zzz is signed."   ;;
18577                 esac
18578                 ;;
18579         esac
18580 else
18581         uidsign=1
18582         echo "(I can't compile the test program--guessing unsigned.)" >&4
18583 fi
18584
18585
18586
18587 echo " "
18588 $echo "Checking the format string to be used for uids..." >&4
18589
18590 case "$uidsign" in
18591 -1)     if $test X"$uidsize" = X"$ivsize"; then
18592                 uidformat="$ivdformat"
18593         else
18594                 if $test X"$uidsize" = X"$longsize"; then
18595                         uidformat='"ld"'
18596                 else
18597                         if $test X"$uidsize" = X"$intsize"; then
18598                                 uidformat='"d"'
18599                         else
18600                                 if $test X"$uidsize" = X"$shortsize"; then
18601                                         uidformat='"hd"'
18602                                 fi
18603                         fi
18604                 fi
18605         fi
18606         ;;
18607 *)      if $test X"$uidsize" = X"$uvsize"; then
18608                 uidformat="$uvuformat"
18609         else
18610                 if $test X"$uidsize" = X"$longsize"; then
18611                         uidformat='"lu"'
18612                 else
18613                         if $test X"$uidsize" = X"$intsize"; then
18614                                 uidformat='"u"'
18615                         else
18616                                 if $test X"$uidsize" = X"$shortsize"; then
18617                                         uidformat='"hu"'
18618                                 fi
18619                         fi
18620                 fi
18621         fi
18622         ;;
18623 esac
18624
18625 : determine compiler compiler
18626 case "$yacc" in
18627 '')
18628         dflt=yacc;;
18629 *)
18630         dflt="$yacc";;
18631 esac
18632 echo " "
18633 comp='yacc'
18634 if $test -f "$byacc$_exe"; then
18635         dflt="$byacc"
18636         comp="byacc or $comp"
18637 fi
18638 if $test -f "$bison$_exe"; then
18639         comp="$comp or bison -y"
18640 fi
18641 rp="Which compiler compiler ($comp) shall I use?"
18642 . ./myread
18643 yacc="$ans"
18644 case "$yacc" in
18645 *bis*)
18646         case "$yacc" in
18647         *-y*) ;;
18648         *)
18649                 yacc="$yacc -y"
18650                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
18651                 ;;
18652         esac
18653         ;;
18654 esac
18655
18656 : see if this is a fp.h system
18657 set fp.h i_fp
18658 eval $inhdr
18659
18660 : see if this is a fp_class.h system
18661 set fp_class.h i_fp_class
18662 eval $inhdr
18663
18664 : see if this is a ieeefp.h system
18665 case "$i_ieeefp" in
18666 '' ) set ieeefp.h i_ieeefp
18667      eval $inhdr
18668      ;;
18669 esac
18670
18671 : see if this is a libutil.h system
18672 set libutil.h i_libutil
18673 eval $inhdr
18674
18675 : see if mach cthreads are available
18676 if test "X$usethreads" = "X$define"; then
18677         set mach/cthreads.h i_machcthr
18678         eval $inhdr
18679 else
18680         i_machcthr="$undef"
18681 fi
18682
18683
18684
18685 : see if this is a math.h system
18686 set math.h i_math
18687 eval $inhdr
18688
18689 : see if this is a mntent.h system
18690 set mntent.h i_mntent
18691 eval $inhdr
18692
18693 : see if ndbm.h is available
18694 set ndbm.h t_ndbm
18695 eval $inhdr
18696
18697 case "$t_ndbm" in
18698 $undef)
18699     # Some Linux distributions such as RedHat 7.1 put the
18700     # ndbm.h header in /usr/include/gdbm/ndbm.h.
18701     if $test -f /usr/include/gdbm/ndbm.h; then
18702         echo '<gdbm/ndbm.h> found.'
18703         ccflags="$ccflags -I/usr/include/gdbm"
18704         cppflags="$cppflags -I/usr/include/gdbm"
18705         t_ndbm=$define
18706     fi
18707     ;;
18708 esac
18709
18710 case "$t_ndbm" in
18711 $define)
18712         : see if dbm_open exists
18713         set dbm_open d_dbm_open
18714         eval $inlibc
18715         case "$d_dbm_open" in
18716         $undef)
18717                 t_ndbm="$undef"
18718                 echo "We won't be including <ndbm.h>"
18719                 ;;
18720         esac
18721         ;;
18722 esac
18723 val="$t_ndbm"
18724 set i_ndbm
18725 eval $setvar
18726
18727 : see if net/errno.h is available
18728 val=''
18729 set net/errno.h val
18730 eval $inhdr
18731
18732 : Unfortunately, it causes problems on some systems.  Arrgh.
18733 case "$val" in
18734 $define)
18735         cat > try.c <<'EOM'
18736 #include <stdio.h>
18737 #include <errno.h>
18738 #include <net/errno.h>
18739 int func()
18740 {
18741         return ENOTSOCK;
18742 }
18743 EOM
18744         if $cc $ccflags -c try.c >/dev/null 2>&1; then
18745                 echo "We'll be including <net/errno.h>." >&4
18746         else
18747                 echo "We won't be including <net/errno.h>." >&4
18748                 val="$undef"
18749         fi
18750         $rm -f try.* try
18751         ;;
18752 esac
18753 set i_neterrno
18754 eval $setvar
18755
18756 : see if netinet/tcp.h is available
18757 set netinet/tcp.h i_netinettcp
18758 eval $inhdr
18759
18760 : see if this is a poll.h system
18761 set poll.h i_poll
18762 eval $inhdr
18763
18764 : see if this is a prot.h system
18765 set prot.h i_prot
18766 eval $inhdr
18767
18768 echo " "
18769 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
18770 $cat <<'EOSH' > Cppsym.know
18771 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
18772 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
18773 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
18774 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
18775 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
18776 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
18777 bull c cadmus clipper CMU COFF COMPILER_VERSION
18778 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
18779 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
18780 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
18781 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
18782 GLIBC GLIBC_MINOR
18783 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
18784 H3050R H3050RX hbullx20 hcx host_mips
18785 hp200 hp300 hp700 HP700 hp800 hp9000
18786 hp9000s200 hp9000s300 hp9000s400 hp9000s500
18787 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
18788 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
18789 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
18790 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
18791 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
18792 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
18793 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
18794 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
18795 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
18796 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
18797 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
18798 MATH_HAS_NO_SIDE_EFFECTS
18799 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
18800 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
18801 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
18802 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
18803 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
18804 NetBSD news1500 news1700 news1800 news1900 news3700
18805 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
18806 ns32016 ns32332 ns32k nsc32000
18807 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
18808 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
18809 pc532 pdp11 PGC PIC plexus PORTAR posix
18810 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
18811 POSIX_C_SOURCE POSIX_SOURCE POWER
18812 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
18813 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
18814 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
18815 sony sony_news sonyrisc sparc sparclite spectrum
18816 stardent stdc STDC_EXT stratos sun sun3 sun386
18817 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
18818 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
18819 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
18820 sysV68 sysV88 Tek4132 Tek4300 titan
18821 TM3200 TM5400 TM5600
18822 tower tower32 tower32_200 tower32_600 tower32_700
18823 tower32_800 tower32_850 tss
18824 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
18825 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
18826 unix UNIX95 UNIX99 unixpc unos
18827 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
18828 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
18829 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
18830 USGr4 USGr4_2
18831 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
18832 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
18833 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
18834 z8000
18835 EOSH
18836 # Maybe put other stuff here too.
18837 cat <<EOSH >>Cppsym.know
18838 $osname
18839 EOSH
18840 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
18841 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
18842 $cat Cppsym.know > Cppsym.c
18843 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
18844 $rm -f Cppsym.a Cppsym.b Cppsym.c
18845 cat <<EOSH > Cppsym
18846 $startsh
18847 if $test \$# -gt 0; then
18848     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
18849     if $test -s Cppsym.got; then
18850         $rm -f Cppsym.got
18851         exit 0
18852     fi
18853     $rm -f Cppsym.got
18854     exit 1
18855 else
18856     $tr " " "$trnl" | ./Cppsym.try
18857     exit 0
18858 fi
18859 EOSH
18860 chmod +x Cppsym
18861 $eunicefix Cppsym
18862 cat <<EOSH > Cppsym.try
18863 $startsh
18864 cat <<'EOCP' > try.c
18865 #include <stdio.h>
18866 int main() {
18867 EOCP
18868 $awk \\
18869 EOSH
18870 cat <<'EOSH' >> Cppsym.try
18871 'length($1) > 0 {
18872     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
18873     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
18874     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
18875     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
18876 }'       >> try.c
18877 echo 'return 0;}' >> try.c
18878 EOSH
18879 cat <<EOSH >> Cppsym.try
18880 ccflags="$ccflags"
18881 case "$osname-$gccversion" in
18882 irix-) ccflags="\$ccflags -woff 1178" ;;
18883 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
18884 esac
18885 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
18886 EOSH
18887 chmod +x Cppsym.try
18888 $eunicefix Cppsym.try
18889 ./Cppsym < Cppsym.know > Cppsym.true
18890 : now check the C compiler for additional symbols
18891 postprocess_cc_v=''
18892 case "$osname" in
18893 aix) postprocess_cc_v="|$tr , ' '" ;;
18894 esac
18895 $cat >ccsym <<EOS
18896 $startsh
18897 $cat >tmp.c <<EOF
18898 extern int foo;
18899 EOF
18900 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
18901 do
18902         case "\$i" in
18903         -D*) echo "\$i" | $sed 's/^-D//';;
18904         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
18905         esac
18906 done
18907 $rm -f try.c
18908 EOS
18909 postprocess_cc_v=''
18910 chmod +x ccsym
18911 $eunicefix ccsym
18912 ./ccsym > ccsym1.raw
18913 if $test -s ccsym1.raw; then
18914        $sort ccsym1.raw | $uniq >ccsym.raw
18915 else
18916        mv ccsym1.raw ccsym.raw
18917 fi
18918
18919 $awk '/\=/ { print $0; next }
18920         { print $0"=1" }' ccsym.raw >ccsym.list
18921 $awk '/\=/ { print $0; next }
18922         { print $0"=1" }' Cppsym.true >ccsym.true
18923 $comm -13 ccsym.true ccsym.list >ccsym.own
18924 $comm -12 ccsym.true ccsym.list >ccsym.com
18925 $comm -23 ccsym.true ccsym.list >ccsym.cpp
18926 also=''
18927 if $test -z ccsym.raw; then
18928         echo "Your C compiler doesn't seem to define any symbols!" >&4
18929         echo " "
18930         echo "However, your C preprocessor defines the following symbols:"
18931         $cat Cppsym.true
18932         ccsymbols=''
18933         cppsymbols=`$cat Cppsym.true`
18934         cppsymbols=`echo $cppsymbols`
18935         cppccsymbols="$cppsymbols"
18936 else
18937         if $test -s ccsym.com; then
18938                 echo "Your C compiler and pre-processor define these symbols:"
18939                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
18940                 also='also '
18941                 symbols='ones'
18942                 cppccsymbols=`$cat ccsym.com`
18943                 cppccsymbols=`echo $cppccsymbols`
18944                 $test "$silent" || sleep 1
18945         fi
18946         if $test -s ccsym.cpp; then
18947                 $test "$also" && echo " "
18948                 echo "Your C pre-processor ${also}defines the following symbols:"
18949                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
18950                 also='further '
18951                 cppsymbols=`$cat ccsym.cpp`
18952                 cppsymbols=`echo $cppsymbols`
18953                 $test "$silent" || sleep 1
18954         fi
18955         if $test -s ccsym.own; then
18956                 $test "$also" && echo " "
18957                 echo "Your C compiler ${also}defines the following cpp symbols:"
18958                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
18959                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
18960                 ccsymbols=`$cat ccsym.own`
18961                 ccsymbols=`echo $ccsymbols`
18962                 $test "$silent" || sleep 1
18963         fi
18964 fi
18965
18966 : see if this is a termio system
18967 val="$undef"
18968 val2="$undef"
18969 val3="$undef"
18970 if $test `./findhdr termios.h`; then
18971         set tcsetattr i_termios
18972         eval $inlibc
18973         val3="$i_termios"
18974 fi
18975 echo " "
18976 case "$val3" in
18977 "$define") echo "You have POSIX termios.h... good!" >&4;;
18978 *) if ./Cppsym pyr; then
18979                 case "`/bin/universe`" in
18980                 ucb) if $test `./findhdr sgtty.h`; then
18981                                 val2="$define"
18982                                 echo "<sgtty.h> found." >&4
18983                         else
18984                                 echo "System is pyramid with BSD universe."
18985                                 echo "<sgtty.h> not found--you could have problems." >&4
18986                         fi;;
18987                 *) if $test `./findhdr termio.h`; then
18988                                 val="$define"
18989                                 echo "<termio.h> found." >&4
18990                         else
18991                                 echo "System is pyramid with USG universe."
18992                                 echo "<termio.h> not found--you could have problems." >&4
18993                         fi;;
18994                 esac
18995         elif ./usg; then
18996                 if $test `./findhdr termio.h`; then
18997                         echo "<termio.h> found." >&4
18998                         val="$define"
18999                 elif $test `./findhdr sgtty.h`; then
19000                         echo "<sgtty.h> found." >&4
19001                         val2="$define"
19002                 else
19003 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
19004                 fi
19005         else
19006                 if $test `./findhdr sgtty.h`; then
19007                         echo "<sgtty.h> found." >&4
19008                         val2="$define"
19009                 elif $test `./findhdr termio.h`; then
19010                         echo "<termio.h> found." >&4
19011                         val="$define"
19012                 else
19013 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
19014                 fi
19015         fi;;
19016 esac
19017 set i_termio; eval $setvar
19018 val=$val2; set i_sgtty; eval $setvar
19019 val=$val3; set i_termios; eval $setvar
19020
19021 : see if stddef is available
19022 set stddef.h i_stddef
19023 eval $inhdr
19024
19025 : see if this is a sunmath.h system
19026 set sunmath.h i_sunmath
19027 eval $inhdr
19028
19029 : see if sys/access.h is available
19030 set sys/access.h i_sysaccess
19031 eval $inhdr
19032
19033 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
19034 set sys/filio.h i_sysfilio
19035 eval $inhdr
19036 echo " "
19037 if $test `./findhdr sys/ioctl.h`; then
19038         val="$define"
19039         echo '<sys/ioctl.h> found.' >&4
19040 else
19041         val="$undef"
19042         if $test $i_sysfilio = "$define"; then
19043             echo '<sys/ioctl.h> NOT found.' >&4
19044         else
19045                 $test $i_sgtty = "$define" && xxx="sgtty.h"
19046                 $test $i_termio = "$define" && xxx="termio.h"
19047                 $test $i_termios = "$define" && xxx="termios.h"
19048 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
19049         fi
19050 fi
19051 set i_sysioctl
19052 eval $setvar
19053
19054 : see if socket ioctl defs are in sys/sockio.h
19055 echo " "
19056 xxx=`./findhdr sys/sockio.h`
19057 if $test "$xxx"; then
19058         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
19059                 val="$define"
19060                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
19061         else
19062                 val="$undef"
19063                 echo "No socket ioctls found in <sys/sockio.h>." >&4
19064         fi
19065 else
19066         val="$undef"
19067         $cat <<EOM
19068 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
19069 EOM
19070 fi
19071 set i_syssockio
19072 eval $setvar
19073
19074
19075 : see if this is a syslog.h system
19076 set syslog.h i_syslog
19077 eval $inhdr
19078
19079
19080 : see if this is a sys/mode.h system
19081 set sys/mode.h i_sysmode
19082 eval $inhdr
19083
19084 : see if sys/resource.h has to be included
19085 set sys/resource.h i_sysresrc
19086 eval $inhdr
19087
19088 : see if sys/security.h is available
19089 set sys/security.h i_syssecrt
19090 eval $inhdr
19091
19092 : see if this is a sys/statvfs.h system
19093 set sys/statvfs.h i_sysstatvfs
19094 eval $inhdr
19095
19096 : see if this is a sys/un.h system
19097 set sys/un.h i_sysun
19098 eval $inhdr
19099
19100
19101 : see if this is a sys/utsname.h system
19102 set sys/utsname.h i_sysutsname
19103 eval $inhdr
19104
19105 : see if this is a syswait system
19106 set sys/wait.h i_syswait
19107 eval $inhdr
19108
19109 : see if this is a ustat.h system
19110 set ustat.h i_ustat
19111 eval $inhdr
19112
19113 : see if this is an utime system
19114 set utime.h i_utime
19115 eval $inhdr
19116
19117 : see if this is a values.h system
19118 set values.h i_values
19119 eval $inhdr
19120
19121 : see if this is a vfork system
19122 case "$d_vfork" in
19123 "$define")
19124         set vfork.h i_vfork
19125         eval $inhdr
19126         ;;
19127 *)
19128         i_vfork="$undef"
19129         ;;
19130 esac
19131
19132 : see if gdbm.h is available
19133 set gdbm.h t_gdbm
19134 eval $inhdr
19135 case "$t_gdbm" in
19136 $define)
19137         : see if gdbm_open exists
19138         set gdbm_open d_gdbm_open
19139         eval $inlibc
19140         case "$d_gdbm_open" in
19141         $undef)
19142                 t_gdbm="$undef"
19143                 echo "We won't be including <gdbm.h>"
19144                 ;;
19145         esac
19146         ;;
19147 esac
19148 val="$t_gdbm"
19149 set i_gdbm
19150 eval $setvar
19151
19152 echo " "
19153 echo "Looking for extensions..." >&4
19154 : If we are using the old config.sh, known_extensions may contain
19155 : old or inaccurate or duplicate values.
19156 known_extensions=''
19157 nonxs_extensions=''
19158 : We do not use find because it might not be available.
19159 : We do not just use MANIFEST because the user may have dropped
19160 : some additional extensions into the source tree and expect them
19161 : to be built.
19162
19163 : Function to recursively find available extensions, ignoring DynaLoader
19164 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
19165 find_extensions='
19166     for xxx in *; do
19167        case "$xxx" in
19168            DynaLoader|dynaload) ;;
19169            *)
19170            if $test -f $xxx/$xxx.xs; then
19171                known_extensions="$known_extensions $1$xxx";
19172            elif $test -f $xxx/Makefile.PL; then
19173                nonxs_extensions="$nonxs_extensions $1$xxx";
19174            else
19175                if $test -d $xxx -a $# -lt 10; then
19176                    set $1$xxx/ $*;
19177                    cd "$xxx";
19178                    eval $find_extensions;
19179                    cd ..;
19180                    shift;
19181                fi;
19182            fi
19183            ;;
19184        esac;
19185     done'
19186 tdir=`pwd`
19187 cd "$rsrc/ext"
19188 set X
19189 shift
19190 eval $find_extensions
19191 # Special case:  Add in threads/shared since it is not picked up by the
19192 # recursive find above (and adding in general recursive finding breaks
19193 # SDBM_File/sdbm).  A.D.  10/25/2001.
19194 known_extensions="$known_extensions threads/shared"
19195 set X $nonxs_extensions
19196 shift
19197 nonxs_extensions="$*"
19198 set X $known_extensions
19199 shift
19200 known_extensions="$*"
19201 cd "$tdir"
19202
19203 : Now see which are supported on this system.
19204 avail_ext=''
19205 for xxx in $known_extensions ; do
19206         case "$xxx" in
19207         DB_File|db_file)
19208                 case "$i_db" in
19209                 $define) avail_ext="$avail_ext $xxx" ;;
19210                 esac
19211                 ;;
19212         GDBM_File|gdbm_fil)
19213                 case "$i_gdbm" in 
19214                 $define) avail_ext="$avail_ext $xxx" ;;
19215                 esac
19216                 ;;
19217         I18N/Langinfo|i18n_lan)
19218                 case "$i_langinfo$d_nl_langinfo" in 
19219                 $define$define) avail_ext="$avail_ext $xxx" ;;
19220                 esac
19221                 ;;
19222         NDBM_File|ndbm_fil)
19223                 case "$i_ndbm" in
19224                 $define)
19225                     case "$osname-$use64bitint" in
19226                     cygwin-*|hpux-define)
19227                         case "$libs" in
19228                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
19229                         esac
19230                         ;;
19231                     *) avail_ext="$avail_ext $xxx" ;;
19232                     esac
19233                     ;;
19234                 esac
19235                 ;;
19236         ODBM_File|odbm_fil) 
19237                 case "${i_dbm}${i_rpcsvcdbm}" in
19238                 *"${define}"*)
19239                     case "$osname-$use64bitint" in
19240                     cygwin-*|hpux-define)
19241                         case "$libs" in
19242                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
19243                         esac
19244                         ;;
19245                     *) avail_ext="$avail_ext $xxx" ;;
19246                     esac
19247                     ;;
19248                 esac
19249                 ;;
19250         POSIX|posix)
19251                 case "$useposix" in
19252                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19253                 esac
19254                 ;;
19255         Opcode|opcode)
19256                 case "$useopcode" in
19257                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19258                 esac
19259                 ;;
19260         Socket|socket)
19261                 case "$d_socket" in 
19262                 true|$define|y)
19263                     case "$osname" in
19264                     beos) ;; # not unless BONE
19265                     *) avail_ext="$avail_ext $xxx" ;;
19266                     esac
19267                     ;;
19268                 esac
19269                 ;;
19270         Sys/Syslog|sys/syslog)
19271                 : XXX syslog requires socket
19272                 case "$d_socket" in 
19273                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
19274                 esac
19275                 ;;
19276         Thread|thread)
19277                 case "$usethreads" in
19278                 true|$define|y)
19279                         case "$useithreads" in
19280                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
19281                         esac
19282                 esac
19283                 ;;
19284         threads|threads/shared)
19285                 # threads and threads::shared are special cases.
19286                 # To stop people from asking "Perl 5.8.0 was supposed
19287                 # to have this new fancy threads implementation but my
19288                 # perl doesn't have it" and from people trying to
19289                 # (re)install the threads module using CPAN.pm and
19290                 # CPAN.pm then offering to reinstall Perl 5.8.0,
19291                 # the threads.pm and threads/shared.pm will always be
19292                 # there, croaking informatively ("you need to rebuild
19293                 # all of Perl with threads, sorry") when threads haven't
19294                 # been compiled in.
19295                 # --jhi
19296                 avail_ext="$avail_ext $xxx"
19297                 ;;
19298         IPC/SysV|ipc/sysv)
19299                 : XXX Do we need a useipcsysv variable here
19300                 case "${d_msg}${d_sem}${d_shm}" in 
19301                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
19302                 esac
19303                 ;;
19304         *)      avail_ext="$avail_ext $xxx"
19305                 ;;
19306         esac
19307 done
19308
19309 set X $avail_ext
19310 shift
19311 avail_ext="$*"
19312
19313 : Now see which nonxs extensions are supported on this system.
19314 : For now assume all are.
19315 nonxs_ext=''
19316 for xxx in $nonxs_extensions ; do
19317         case "$xxx" in
19318         *)      nonxs_ext="$nonxs_ext $xxx"
19319                 ;;
19320         esac
19321 done
19322
19323 set X $nonxs_ext
19324 shift
19325 nonxs_ext="$*"
19326
19327 case $usedl in
19328 $define)
19329         $cat <<EOM
19330 A number of extensions are supplied with $package.  You may choose to
19331 compile these extensions for dynamic loading (the default), compile
19332 them into the $package executable (static loading), or not include
19333 them at all.  Answer "none" to include no extensions.
19334 Note that DynaLoader is always built and need not be mentioned here.
19335
19336 EOM
19337         case "$dynamic_ext" in
19338         '') dflt="$avail_ext" ;;
19339         *)      dflt="$dynamic_ext"
19340                 # Perhaps we are reusing an old out-of-date config.sh.
19341                 case "$hint" in
19342                 previous)
19343                         if test X"$dynamic_ext" != X"$avail_ext"; then
19344                                 $cat <<EOM
19345 NOTICE:  Your previous config.sh list may be incorrect. 
19346 The extensions now available to you are 
19347         ${avail_ext}
19348 but the default list from your previous config.sh is
19349         ${dynamic_ext} 
19350
19351 EOM
19352                         fi
19353                         ;;
19354                 esac
19355                 ;;
19356         esac
19357         case "$dflt" in
19358         '')     dflt=none;;
19359         esac
19360         rp="What extensions do you wish to load dynamically?"
19361         . ./myread
19362         case "$ans" in
19363         none) dynamic_ext=' ' ;;
19364         *) dynamic_ext="$ans" ;;
19365         esac
19366
19367         case "$static_ext" in
19368         '')
19369                 : Exclude those already listed in dynamic linking
19370                 dflt=''
19371                 for xxx in $avail_ext; do
19372                         case " $dynamic_ext " in
19373                         *" $xxx "*) ;;
19374                         *) dflt="$dflt $xxx" ;;
19375                         esac
19376                 done
19377                 set X $dflt
19378                 shift
19379                 dflt="$*"
19380                 ;;
19381         *)  dflt="$static_ext" 
19382                 ;;
19383         esac
19384
19385         case "$dflt" in
19386         '')     dflt=none;;
19387         esac
19388         rp="What extensions do you wish to load statically?"
19389         . ./myread
19390         case "$ans" in
19391         none) static_ext=' ' ;;
19392         *) static_ext="$ans" ;;
19393         esac
19394         ;;
19395 *)
19396         $cat <<EOM
19397 A number of extensions are supplied with $package.  Answer "none" 
19398 to include no extensions. 
19399 Note that DynaLoader is always built and need not be mentioned here.
19400
19401 EOM
19402         case "$static_ext" in
19403         '') dflt="$avail_ext" ;;
19404         *)      dflt="$static_ext"
19405                 # Perhaps we are reusing an old out-of-date config.sh.
19406                 case "$hint" in
19407                 previous)
19408                         if test X"$static_ext" != X"$avail_ext"; then
19409                                 $cat <<EOM
19410 NOTICE:  Your previous config.sh list may be incorrect. 
19411 The extensions now available to you are 
19412         ${avail_ext}
19413 but the default list from your previous config.sh is
19414         ${static_ext} 
19415
19416 EOM
19417                         fi
19418                         ;;
19419                 esac
19420                 ;;
19421         esac
19422         : Exclude those that are not xs extensions
19423         case "$dflt" in
19424         '')     dflt=none;;
19425         esac
19426         rp="What extensions do you wish to include?"
19427         . ./myread
19428         case "$ans" in
19429         none) static_ext=' ' ;;
19430         *) static_ext="$ans" ;;
19431         esac
19432         ;;
19433 esac
19434 #        
19435 # Encode is a special case.  If we are building Encode as a static
19436 # extension, we need to explicitly list its subextensions as well.
19437 # For other nested extensions, this is handled automatically by
19438 # the appropriate Makefile.PL.
19439 case " $static_ext " in
19440         *" Encode "*) # Add the subextensions of Encode
19441         cd "$rsrc/ext"
19442         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
19443                 static_ext="$static_ext Encode/$xxx"
19444         done
19445         cd "$tdir"
19446         ;;
19447 esac
19448
19449 set X $dynamic_ext $static_ext $nonxs_ext
19450 shift
19451 extensions="$*"
19452
19453 : Remove libraries needed only for extensions
19454 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
19455 : The exception is SunOS 4.x, which needs them.
19456 case "${osname}X${osvers}" in
19457 sunos*X4*)
19458     perllibs="$libs"
19459     ;;
19460 *) case "$usedl" in
19461     $define|true|[yY]*)
19462             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
19463             shift
19464             perllibs="$*"
19465             ;;
19466     *)  perllibs="$libs"
19467             ;;
19468     esac
19469     ;;
19470 esac
19471
19472 : Remove build directory name from cppstdin so it can be used from
19473 : either the present location or the final installed location.
19474 echo " "
19475 : Get out of the UU directory to get correct path name.
19476 cd ..
19477 case "$cppstdin" in
19478 `pwd`/cppstdin)
19479         echo "Stripping down cppstdin path name"
19480         cppstdin=cppstdin
19481         ;;
19482 esac
19483 cd UU
19484
19485 : end of configuration questions
19486 echo " "
19487 echo "End of configuration questions."
19488 echo " "
19489
19490 : back to where it started
19491 if test -d ../UU; then
19492         cd ..
19493 fi
19494
19495 : configuration may be patched via a 'config.arch' file
19496 if $test -f config.arch; then
19497         echo "I see a config.arch file, loading it."
19498         . ./config.arch
19499 fi
19500
19501 : configuration may be patched via a 'config.over' file
19502 if $test -f config.over; then
19503         echo " "
19504         dflt=y
19505         rp='I see a config.over file.  Do you wish to load it?'
19506         . UU/myread
19507         case "$ans" in
19508         n*) echo "OK, I'll ignore it.";;
19509         *)      . ./config.over
19510                 echo "Configuration override changes have been loaded."
19511                 ;;
19512         esac
19513 fi
19514
19515 : in case they want portability, strip down executable paths
19516 case "$d_portable" in
19517 "$define")
19518         echo " "
19519         echo "Stripping down executable paths..." >&4
19520         for file in $loclist $trylist; do
19521                 eval temp=\$$file
19522                 eval $file=`basename $temp`
19523         done
19524         ;;
19525 esac
19526
19527 : create config.sh file
19528 echo " "
19529 echo "Creating config.sh..." >&4
19530 $spitshell <<EOT >config.sh
19531 $startsh
19532 #
19533 # This file was produced by running the Configure script. It holds all the
19534 # definitions figured out by Configure. Should you modify one of these values,
19535 # do not forget to propagate your changes by running "Configure -der". You may
19536 # instead choose to run each of the .SH files by yourself, or "Configure -S".
19537 #
19538
19539 # Package name      : $package
19540 # Source directory  : $src
19541 # Configuration time: $cf_time
19542 # Configured by     : $cf_by
19543 # Target system     : $myuname
19544
19545 Author='$Author'
19546 Date='$Date'
19547 Header='$Header'
19548 Id='$Id'
19549 Locker='$Locker'
19550 Log='$Log'
19551 Mcc='$Mcc'
19552 RCSfile='$RCSfile'
19553 Revision='$Revision'
19554 Source='$Source'
19555 State='$State'
19556 _a='$_a'
19557 _exe='$_exe'
19558 _o='$_o'
19559 afs='$afs'
19560 afsroot='$afsroot'
19561 alignbytes='$alignbytes'
19562 ansi2knr='$ansi2knr'
19563 aphostname='$aphostname'
19564 api_revision='$api_revision'
19565 api_subversion='$api_subversion'
19566 api_version='$api_version'
19567 api_versionstring='$api_versionstring'
19568 ar='$ar'
19569 archlib='$archlib'
19570 archlibexp='$archlibexp'
19571 archname64='$archname64'
19572 archname='$archname'
19573 archobjs='$archobjs'
19574 asctime_r_proto='$asctime_r_proto'
19575 awk='$awk'
19576 baserev='$baserev'
19577 bash='$bash'
19578 bin='$bin'
19579 binexp='$binexp'
19580 bison='$bison'
19581 byacc='$byacc'
19582 byteorder='$byteorder'
19583 c='$c'
19584 castflags='$castflags'
19585 cat='$cat'
19586 cc='$cc'
19587 cccdlflags='$cccdlflags'
19588 ccdlflags='$ccdlflags'
19589 ccflags='$ccflags'
19590 ccflags_uselargefiles='$ccflags_uselargefiles'
19591 ccname='$ccname'
19592 ccsymbols='$ccsymbols'
19593 ccversion='$ccversion'
19594 cf_by='$cf_by'
19595 cf_email='$cf_email'
19596 cf_time='$cf_time'
19597 charsize='$charsize'
19598 chgrp='$chgrp'
19599 chmod='$chmod'
19600 chown='$chown'
19601 clocktype='$clocktype'
19602 comm='$comm'
19603 compress='$compress'
19604 contains='$contains'
19605 cp='$cp'
19606 cpio='$cpio'
19607 cpp='$cpp'
19608 cpp_stuff='$cpp_stuff'
19609 cppccsymbols='$cppccsymbols'
19610 cppflags='$cppflags'
19611 cpplast='$cpplast'
19612 cppminus='$cppminus'
19613 cpprun='$cpprun'
19614 cppstdin='$cppstdin'
19615 cppsymbols='$cppsymbols'
19616 crypt_r_proto='$crypt_r_proto'
19617 cryptlib='$cryptlib'
19618 csh='$csh'
19619 ctermid_r_proto='$ctermid_r_proto'
19620 ctime_r_proto='$ctime_r_proto'
19621 d_Gconvert='$d_Gconvert'
19622 d_PRIEUldbl='$d_PRIEUldbl'
19623 d_PRIFUldbl='$d_PRIFUldbl'
19624 d_PRIGUldbl='$d_PRIGUldbl'
19625 d_PRIXU64='$d_PRIXU64'
19626 d_PRId64='$d_PRId64'
19627 d_PRIeldbl='$d_PRIeldbl'
19628 d_PRIfldbl='$d_PRIfldbl'
19629 d_PRIgldbl='$d_PRIgldbl'
19630 d_PRIi64='$d_PRIi64'
19631 d_PRIo64='$d_PRIo64'
19632 d_PRIu64='$d_PRIu64'
19633 d_PRIx64='$d_PRIx64'
19634 d_SCNfldbl='$d_SCNfldbl'
19635 d__fwalk='$d__fwalk'
19636 d_access='$d_access'
19637 d_accessx='$d_accessx'
19638 d_alarm='$d_alarm'
19639 d_archlib='$d_archlib'
19640 d_asctime_r='$d_asctime_r'
19641 d_atolf='$d_atolf'
19642 d_atoll='$d_atoll'
19643 d_attribut='$d_attribut'
19644 d_bcmp='$d_bcmp'
19645 d_bcopy='$d_bcopy'
19646 d_bsd='$d_bsd'
19647 d_bsdgetpgrp='$d_bsdgetpgrp'
19648 d_bsdsetpgrp='$d_bsdsetpgrp'
19649 d_bzero='$d_bzero'
19650 d_casti32='$d_casti32'
19651 d_castneg='$d_castneg'
19652 d_charvspr='$d_charvspr'
19653 d_chown='$d_chown'
19654 d_chroot='$d_chroot'
19655 d_chsize='$d_chsize'
19656 d_class='$d_class'
19657 d_closedir='$d_closedir'
19658 d_cmsghdr_s='$d_cmsghdr_s'
19659 d_const='$d_const'
19660 d_crypt='$d_crypt'
19661 d_crypt_r='$d_crypt_r'
19662 d_csh='$d_csh'
19663 d_ctermid_r='$d_ctermid_r'
19664 d_ctime_r='$d_ctime_r'
19665 d_cuserid='$d_cuserid'
19666 d_dbl_dig='$d_dbl_dig'
19667 d_dbminitproto='$d_dbminitproto'
19668 d_difftime='$d_difftime'
19669 d_dirfd='$d_dirfd'
19670 d_dirnamlen='$d_dirnamlen'
19671 d_dlerror='$d_dlerror'
19672 d_dlopen='$d_dlopen'
19673 d_dlsymun='$d_dlsymun'
19674 d_dosuid='$d_dosuid'
19675 d_drand48_r='$d_drand48_r'
19676 d_drand48proto='$d_drand48proto'
19677 d_dup2='$d_dup2'
19678 d_eaccess='$d_eaccess'
19679 d_endgrent='$d_endgrent'
19680 d_endgrent_r='$d_endgrent_r'
19681 d_endhent='$d_endhent'
19682 d_endhostent_r='$d_endhostent_r'
19683 d_endnent='$d_endnent'
19684 d_endnetent_r='$d_endnetent_r'
19685 d_endpent='$d_endpent'
19686 d_endprotoent_r='$d_endprotoent_r'
19687 d_endpwent='$d_endpwent'
19688 d_endpwent_r='$d_endpwent_r'
19689 d_endsent='$d_endsent'
19690 d_endservent_r='$d_endservent_r'
19691 d_eofnblk='$d_eofnblk'
19692 d_eunice='$d_eunice'
19693 d_fchdir='$d_fchdir'
19694 d_fchmod='$d_fchmod'
19695 d_fchown='$d_fchown'
19696 d_fcntl='$d_fcntl'
19697 d_fcntl_can_lock='$d_fcntl_can_lock'
19698 d_fd_macros='$d_fd_macros'
19699 d_fd_set='$d_fd_set'
19700 d_fds_bits='$d_fds_bits'
19701 d_fgetpos='$d_fgetpos'
19702 d_finite='$d_finite'
19703 d_finitel='$d_finitel'
19704 d_flexfnam='$d_flexfnam'
19705 d_flock='$d_flock'
19706 d_flockproto='$d_flockproto'
19707 d_fork='$d_fork'
19708 d_fp_class='$d_fp_class'
19709 d_fpathconf='$d_fpathconf'
19710 d_fpclass='$d_fpclass'
19711 d_fpclassify='$d_fpclassify'
19712 d_fpclassl='$d_fpclassl'
19713 d_fpos64_t='$d_fpos64_t'
19714 d_frexpl='$d_frexpl'
19715 d_fs_data_s='$d_fs_data_s'
19716 d_fseeko='$d_fseeko'
19717 d_fsetpos='$d_fsetpos'
19718 d_fstatfs='$d_fstatfs'
19719 d_fstatvfs='$d_fstatvfs'
19720 d_fsync='$d_fsync'
19721 d_ftello='$d_ftello'
19722 d_ftime='$d_ftime'
19723 d_getcwd='$d_getcwd'
19724 d_getespwnam='$d_getespwnam'
19725 d_getfsstat='$d_getfsstat'
19726 d_getgrent='$d_getgrent'
19727 d_getgrent_r='$d_getgrent_r'
19728 d_getgrgid_r='$d_getgrgid_r'
19729 d_getgrnam_r='$d_getgrnam_r'
19730 d_getgrps='$d_getgrps'
19731 d_gethbyaddr='$d_gethbyaddr'
19732 d_gethbyname='$d_gethbyname'
19733 d_gethent='$d_gethent'
19734 d_gethname='$d_gethname'
19735 d_gethostbyaddr_r='$d_gethostbyaddr_r'
19736 d_gethostbyname_r='$d_gethostbyname_r'
19737 d_gethostent_r='$d_gethostent_r'
19738 d_gethostprotos='$d_gethostprotos'
19739 d_getitimer='$d_getitimer'
19740 d_getlogin='$d_getlogin'
19741 d_getlogin_r='$d_getlogin_r'
19742 d_getmnt='$d_getmnt'
19743 d_getmntent='$d_getmntent'
19744 d_getnbyaddr='$d_getnbyaddr'
19745 d_getnbyname='$d_getnbyname'
19746 d_getnent='$d_getnent'
19747 d_getnetbyaddr_r='$d_getnetbyaddr_r'
19748 d_getnetbyname_r='$d_getnetbyname_r'
19749 d_getnetent_r='$d_getnetent_r'
19750 d_getnetprotos='$d_getnetprotos'
19751 d_getpagsz='$d_getpagsz'
19752 d_getpbyname='$d_getpbyname'
19753 d_getpbynumber='$d_getpbynumber'
19754 d_getpent='$d_getpent'
19755 d_getpgid='$d_getpgid'
19756 d_getpgrp2='$d_getpgrp2'
19757 d_getpgrp='$d_getpgrp'
19758 d_getppid='$d_getppid'
19759 d_getprior='$d_getprior'
19760 d_getprotobyname_r='$d_getprotobyname_r'
19761 d_getprotobynumber_r='$d_getprotobynumber_r'
19762 d_getprotoent_r='$d_getprotoent_r'
19763 d_getprotoprotos='$d_getprotoprotos'
19764 d_getprpwnam='$d_getprpwnam'
19765 d_getpwent='$d_getpwent'
19766 d_getpwent_r='$d_getpwent_r'
19767 d_getpwnam_r='$d_getpwnam_r'
19768 d_getpwuid_r='$d_getpwuid_r'
19769 d_getsbyname='$d_getsbyname'
19770 d_getsbyport='$d_getsbyport'
19771 d_getsent='$d_getsent'
19772 d_getservbyname_r='$d_getservbyname_r'
19773 d_getservbyport_r='$d_getservbyport_r'
19774 d_getservent_r='$d_getservent_r'
19775 d_getservprotos='$d_getservprotos'
19776 d_getspnam='$d_getspnam'
19777 d_getspnam_r='$d_getspnam_r'
19778 d_gettimeod='$d_gettimeod'
19779 d_gmtime_r='$d_gmtime_r'
19780 d_gnulibc='$d_gnulibc'
19781 d_grpasswd='$d_grpasswd'
19782 d_hasmntopt='$d_hasmntopt'
19783 d_htonl='$d_htonl'
19784 d_index='$d_index'
19785 d_inetaton='$d_inetaton'
19786 d_int64_t='$d_int64_t'
19787 d_isascii='$d_isascii'
19788 d_isfinite='$d_isfinite'
19789 d_isinf='$d_isinf'
19790 d_isnan='$d_isnan'
19791 d_isnanl='$d_isnanl'
19792 d_killpg='$d_killpg'
19793 d_lchown='$d_lchown'
19794 d_ldbl_dig='$d_ldbl_dig'
19795 d_link='$d_link'
19796 d_localtime_r='$d_localtime_r'
19797 d_locconv='$d_locconv'
19798 d_lockf='$d_lockf'
19799 d_longdbl='$d_longdbl'
19800 d_longlong='$d_longlong'
19801 d_lseekproto='$d_lseekproto'
19802 d_lstat='$d_lstat'
19803 d_madvise='$d_madvise'
19804 d_mblen='$d_mblen'
19805 d_mbstowcs='$d_mbstowcs'
19806 d_mbtowc='$d_mbtowc'
19807 d_memchr='$d_memchr'
19808 d_memcmp='$d_memcmp'
19809 d_memcpy='$d_memcpy'
19810 d_memmove='$d_memmove'
19811 d_memset='$d_memset'
19812 d_mkdir='$d_mkdir'
19813 d_mkdtemp='$d_mkdtemp'
19814 d_mkfifo='$d_mkfifo'
19815 d_mkstemp='$d_mkstemp'
19816 d_mkstemps='$d_mkstemps'
19817 d_mktime='$d_mktime'
19818 d_mmap='$d_mmap'
19819 d_modfl='$d_modfl'
19820 d_modfl_pow32_bug='$d_modfl_pow32_bug'
19821 d_mprotect='$d_mprotect'
19822 d_msg='$d_msg'
19823 d_msg_ctrunc='$d_msg_ctrunc'
19824 d_msg_dontroute='$d_msg_dontroute'
19825 d_msg_oob='$d_msg_oob'
19826 d_msg_peek='$d_msg_peek'
19827 d_msg_proxy='$d_msg_proxy'
19828 d_msgctl='$d_msgctl'
19829 d_msgget='$d_msgget'
19830 d_msghdr_s='$d_msghdr_s'
19831 d_msgrcv='$d_msgrcv'
19832 d_msgsnd='$d_msgsnd'
19833 d_msync='$d_msync'
19834 d_munmap='$d_munmap'
19835 d_mymalloc='$d_mymalloc'
19836 d_nice='$d_nice'
19837 d_nl_langinfo='$d_nl_langinfo'
19838 d_nv_preserves_uv='$d_nv_preserves_uv'
19839 d_off64_t='$d_off64_t'
19840 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
19841 d_oldpthreads='$d_oldpthreads'
19842 d_oldsock='$d_oldsock'
19843 d_open3='$d_open3'
19844 d_pathconf='$d_pathconf'
19845 d_pause='$d_pause'
19846 d_perl_otherlibdirs='$d_perl_otherlibdirs'
19847 d_phostname='$d_phostname'
19848 d_pipe='$d_pipe'
19849 d_poll='$d_poll'
19850 d_portable='$d_portable'
19851 d_procselfexe='$d_procselfexe'
19852 d_pthread_atfork='$d_pthread_atfork'
19853 d_pthread_yield='$d_pthread_yield'
19854 d_pwage='$d_pwage'
19855 d_pwchange='$d_pwchange'
19856 d_pwclass='$d_pwclass'
19857 d_pwcomment='$d_pwcomment'
19858 d_pwexpire='$d_pwexpire'
19859 d_pwgecos='$d_pwgecos'
19860 d_pwpasswd='$d_pwpasswd'
19861 d_pwquota='$d_pwquota'
19862 d_qgcvt='$d_qgcvt'
19863 d_quad='$d_quad'
19864 d_random_r='$d_random_r'
19865 d_readdir64_r='$d_readdir64_r'
19866 d_readdir='$d_readdir'
19867 d_readdir_r='$d_readdir_r'
19868 d_readlink='$d_readlink'
19869 d_readv='$d_readv'
19870 d_recvmsg='$d_recvmsg'
19871 d_rename='$d_rename'
19872 d_rewinddir='$d_rewinddir'
19873 d_rmdir='$d_rmdir'
19874 d_safebcpy='$d_safebcpy'
19875 d_safemcpy='$d_safemcpy'
19876 d_sanemcmp='$d_sanemcmp'
19877 d_sbrkproto='$d_sbrkproto'
19878 d_sched_yield='$d_sched_yield'
19879 d_scm_rights='$d_scm_rights'
19880 d_seekdir='$d_seekdir'
19881 d_select='$d_select'
19882 d_sem='$d_sem'
19883 d_semctl='$d_semctl'
19884 d_semctl_semid_ds='$d_semctl_semid_ds'
19885 d_semctl_semun='$d_semctl_semun'
19886 d_semget='$d_semget'
19887 d_semop='$d_semop'
19888 d_sendmsg='$d_sendmsg'
19889 d_setegid='$d_setegid'
19890 d_seteuid='$d_seteuid'
19891 d_setgrent='$d_setgrent'
19892 d_setgrent_r='$d_setgrent_r'
19893 d_setgrps='$d_setgrps'
19894 d_sethent='$d_sethent'
19895 d_sethostent_r='$d_sethostent_r'
19896 d_setitimer='$d_setitimer'
19897 d_setlinebuf='$d_setlinebuf'
19898 d_setlocale='$d_setlocale'
19899 d_setlocale_r='$d_setlocale_r'
19900 d_setnent='$d_setnent'
19901 d_setnetent_r='$d_setnetent_r'
19902 d_setpent='$d_setpent'
19903 d_setpgid='$d_setpgid'
19904 d_setpgrp2='$d_setpgrp2'
19905 d_setpgrp='$d_setpgrp'
19906 d_setprior='$d_setprior'
19907 d_setproctitle='$d_setproctitle'
19908 d_setprotoent_r='$d_setprotoent_r'
19909 d_setpwent='$d_setpwent'
19910 d_setpwent_r='$d_setpwent_r'
19911 d_setregid='$d_setregid'
19912 d_setresgid='$d_setresgid'
19913 d_setresuid='$d_setresuid'
19914 d_setreuid='$d_setreuid'
19915 d_setrgid='$d_setrgid'
19916 d_setruid='$d_setruid'
19917 d_setsent='$d_setsent'
19918 d_setservent_r='$d_setservent_r'
19919 d_setsid='$d_setsid'
19920 d_setvbuf='$d_setvbuf'
19921 d_sfio='$d_sfio'
19922 d_shm='$d_shm'
19923 d_shmat='$d_shmat'
19924 d_shmatprototype='$d_shmatprototype'
19925 d_shmctl='$d_shmctl'
19926 d_shmdt='$d_shmdt'
19927 d_shmget='$d_shmget'
19928 d_sigaction='$d_sigaction'
19929 d_sigprocmask='$d_sigprocmask'
19930 d_sigsetjmp='$d_sigsetjmp'
19931 d_sockatmark='$d_sockatmark'
19932 d_sockatmarkproto='$d_sockatmarkproto'
19933 d_socket='$d_socket'
19934 d_socklen_t='$d_socklen_t'
19935 d_sockpair='$d_sockpair'
19936 d_socks5_init='$d_socks5_init'
19937 d_sqrtl='$d_sqrtl'
19938 d_srand48_r='$d_srand48_r'
19939 d_srandom_r='$d_srandom_r'
19940 d_sresgproto='$d_sresgproto'
19941 d_sresuproto='$d_sresuproto'
19942 d_statblks='$d_statblks'
19943 d_statfs_f_flags='$d_statfs_f_flags'
19944 d_statfs_s='$d_statfs_s'
19945 d_statvfs='$d_statvfs'
19946 d_stdio_cnt_lval='$d_stdio_cnt_lval'
19947 d_stdio_ptr_lval='$d_stdio_ptr_lval'
19948 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
19949 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
19950 d_stdio_stream_array='$d_stdio_stream_array'
19951 d_stdiobase='$d_stdiobase'
19952 d_stdstdio='$d_stdstdio'
19953 d_strchr='$d_strchr'
19954 d_strcoll='$d_strcoll'
19955 d_strctcpy='$d_strctcpy'
19956 d_strerrm='$d_strerrm'
19957 d_strerror='$d_strerror'
19958 d_strerror_r='$d_strerror_r'
19959 d_strftime='$d_strftime'
19960 d_strtod='$d_strtod'
19961 d_strtol='$d_strtol'
19962 d_strtold='$d_strtold'
19963 d_strtoll='$d_strtoll'
19964 d_strtoq='$d_strtoq'
19965 d_strtoul='$d_strtoul'
19966 d_strtoull='$d_strtoull'
19967 d_strtouq='$d_strtouq'
19968 d_strxfrm='$d_strxfrm'
19969 d_suidsafe='$d_suidsafe'
19970 d_symlink='$d_symlink'
19971 d_syscall='$d_syscall'
19972 d_syscallproto='$d_syscallproto'
19973 d_sysconf='$d_sysconf'
19974 d_sysernlst='$d_sysernlst'
19975 d_syserrlst='$d_syserrlst'
19976 d_system='$d_system'
19977 d_tcgetpgrp='$d_tcgetpgrp'
19978 d_tcsetpgrp='$d_tcsetpgrp'
19979 d_telldir='$d_telldir'
19980 d_telldirproto='$d_telldirproto'
19981 d_time='$d_time'
19982 d_times='$d_times'
19983 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
19984 d_tm_tm_zone='$d_tm_tm_zone'
19985 d_tmpnam_r='$d_tmpnam_r'
19986 d_truncate='$d_truncate'
19987 d_ttyname_r='$d_ttyname_r'
19988 d_tzname='$d_tzname'
19989 d_u32align='$d_u32align'
19990 d_ualarm='$d_ualarm'
19991 d_umask='$d_umask'
19992 d_uname='$d_uname'
19993 d_union_semun='$d_union_semun'
19994 d_unordered='$d_unordered'
19995 d_usleep='$d_usleep'
19996 d_usleepproto='$d_usleepproto'
19997 d_ustat='$d_ustat'
19998 d_vendorarch='$d_vendorarch'
19999 d_vendorbin='$d_vendorbin'
20000 d_vendorlib='$d_vendorlib'
20001 d_vfork='$d_vfork'
20002 d_void_closedir='$d_void_closedir'
20003 d_voidsig='$d_voidsig'
20004 d_voidtty='$d_voidtty'
20005 d_volatile='$d_volatile'
20006 d_vprintf='$d_vprintf'
20007 d_wait4='$d_wait4'
20008 d_waitpid='$d_waitpid'
20009 d_wcstombs='$d_wcstombs'
20010 d_wctomb='$d_wctomb'
20011 d_writev='$d_writev'
20012 d_xenix='$d_xenix'
20013 date='$date'
20014 db_hashtype='$db_hashtype'
20015 db_prefixtype='$db_prefixtype'
20016 db_version_major='$db_version_major'
20017 db_version_minor='$db_version_minor'
20018 db_version_patch='$db_version_patch'
20019 defvoidused='$defvoidused'
20020 direntrytype='$direntrytype'
20021 dlext='$dlext'
20022 dlsrc='$dlsrc'
20023 doublesize='$doublesize'
20024 drand01='$drand01'
20025 drand48_r_proto='$drand48_r_proto'
20026 dynamic_ext='$dynamic_ext'
20027 eagain='$eagain'
20028 ebcdic='$ebcdic'
20029 echo='$echo'
20030 egrep='$egrep'
20031 emacs='$emacs'
20032 endgrent_r_proto='$endgrent_r_proto'
20033 endhostent_r_proto='$endhostent_r_proto'
20034 endnetent_r_proto='$endnetent_r_proto'
20035 endprotoent_r_proto='$endprotoent_r_proto'
20036 endpwent_r_proto='$endpwent_r_proto'
20037 endservent_r_proto='$endservent_r_proto'
20038 eunicefix='$eunicefix'
20039 exe_ext='$exe_ext'
20040 expr='$expr'
20041 extensions='$extensions'
20042 extras='$extras'
20043 fflushNULL='$fflushNULL'
20044 fflushall='$fflushall'
20045 find='$find'
20046 firstmakefile='$firstmakefile'
20047 flex='$flex'
20048 fpossize='$fpossize'
20049 fpostype='$fpostype'
20050 freetype='$freetype'
20051 from='$from'
20052 full_ar='$full_ar'
20053 full_csh='$full_csh'
20054 full_sed='$full_sed'
20055 gccosandvers='$gccosandvers'
20056 gccversion='$gccversion'
20057 getgrent_r_proto='$getgrent_r_proto'
20058 getgrgid_r_proto='$getgrgid_r_proto'
20059 getgrnam_r_proto='$getgrnam_r_proto'
20060 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
20061 gethostbyname_r_proto='$gethostbyname_r_proto'
20062 gethostent_r_proto='$gethostent_r_proto'
20063 getlogin_r_proto='$getlogin_r_proto'
20064 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
20065 getnetbyname_r_proto='$getnetbyname_r_proto'
20066 getnetent_r_proto='$getnetent_r_proto'
20067 getprotobyname_r_proto='$getprotobyname_r_proto'
20068 getprotobynumber_r_proto='$getprotobynumber_r_proto'
20069 getprotoent_r_proto='$getprotoent_r_proto'
20070 getpwent_r_proto='$getpwent_r_proto'
20071 getpwnam_r_proto='$getpwnam_r_proto'
20072 getpwuid_r_proto='$getpwuid_r_proto'
20073 getservbyname_r_proto='$getservbyname_r_proto'
20074 getservbyport_r_proto='$getservbyport_r_proto'
20075 getservent_r_proto='$getservent_r_proto'
20076 getspnam_r_proto='$getspnam_r_proto'
20077 gidformat='$gidformat'
20078 gidsign='$gidsign'
20079 gidsize='$gidsize'
20080 gidtype='$gidtype'
20081 glibpth='$glibpth'
20082 gmake='$gmake'
20083 gmtime_r_proto='$gmtime_r_proto'
20084 grep='$grep'
20085 groupcat='$groupcat'
20086 groupstype='$groupstype'
20087 gzip='$gzip'
20088 h_fcntl='$h_fcntl'
20089 h_sysfile='$h_sysfile'
20090 hint='$hint'
20091 hostcat='$hostcat'
20092 i16size='$i16size'
20093 i16type='$i16type'
20094 i32size='$i32size'
20095 i32type='$i32type'
20096 i64size='$i64size'
20097 i64type='$i64type'
20098 i8size='$i8size'
20099 i8type='$i8type'
20100 i_arpainet='$i_arpainet'
20101 i_bsdioctl='$i_bsdioctl'
20102 i_crypt='$i_crypt'
20103 i_db='$i_db'
20104 i_dbm='$i_dbm'
20105 i_dirent='$i_dirent'
20106 i_dld='$i_dld'
20107 i_dlfcn='$i_dlfcn'
20108 i_fcntl='$i_fcntl'
20109 i_float='$i_float'
20110 i_fp='$i_fp'
20111 i_fp_class='$i_fp_class'
20112 i_gdbm='$i_gdbm'
20113 i_grp='$i_grp'
20114 i_ieeefp='$i_ieeefp'
20115 i_inttypes='$i_inttypes'
20116 i_langinfo='$i_langinfo'
20117 i_libutil='$i_libutil'
20118 i_limits='$i_limits'
20119 i_locale='$i_locale'
20120 i_machcthr='$i_machcthr'
20121 i_malloc='$i_malloc'
20122 i_math='$i_math'
20123 i_memory='$i_memory'
20124 i_mntent='$i_mntent'
20125 i_ndbm='$i_ndbm'
20126 i_netdb='$i_netdb'
20127 i_neterrno='$i_neterrno'
20128 i_netinettcp='$i_netinettcp'
20129 i_niin='$i_niin'
20130 i_poll='$i_poll'
20131 i_prot='$i_prot'
20132 i_pthread='$i_pthread'
20133 i_pwd='$i_pwd'
20134 i_rpcsvcdbm='$i_rpcsvcdbm'
20135 i_sfio='$i_sfio'
20136 i_sgtty='$i_sgtty'
20137 i_shadow='$i_shadow'
20138 i_socks='$i_socks'
20139 i_stdarg='$i_stdarg'
20140 i_stddef='$i_stddef'
20141 i_stdlib='$i_stdlib'
20142 i_string='$i_string'
20143 i_sunmath='$i_sunmath'
20144 i_sysaccess='$i_sysaccess'
20145 i_sysdir='$i_sysdir'
20146 i_sysfile='$i_sysfile'
20147 i_sysfilio='$i_sysfilio'
20148 i_sysin='$i_sysin'
20149 i_sysioctl='$i_sysioctl'
20150 i_syslog='$i_syslog'
20151 i_sysmman='$i_sysmman'
20152 i_sysmode='$i_sysmode'
20153 i_sysmount='$i_sysmount'
20154 i_sysndir='$i_sysndir'
20155 i_sysparam='$i_sysparam'
20156 i_sysresrc='$i_sysresrc'
20157 i_syssecrt='$i_syssecrt'
20158 i_sysselct='$i_sysselct'
20159 i_syssockio='$i_syssockio'
20160 i_sysstat='$i_sysstat'
20161 i_sysstatfs='$i_sysstatfs'
20162 i_sysstatvfs='$i_sysstatvfs'
20163 i_systime='$i_systime'
20164 i_systimek='$i_systimek'
20165 i_systimes='$i_systimes'
20166 i_systypes='$i_systypes'
20167 i_sysuio='$i_sysuio'
20168 i_sysun='$i_sysun'
20169 i_sysutsname='$i_sysutsname'
20170 i_sysvfs='$i_sysvfs'
20171 i_syswait='$i_syswait'
20172 i_termio='$i_termio'
20173 i_termios='$i_termios'
20174 i_time='$i_time'
20175 i_unistd='$i_unistd'
20176 i_ustat='$i_ustat'
20177 i_utime='$i_utime'
20178 i_values='$i_values'
20179 i_varargs='$i_varargs'
20180 i_varhdr='$i_varhdr'
20181 i_vfork='$i_vfork'
20182 ignore_versioned_solibs='$ignore_versioned_solibs'
20183 inc_version_list='$inc_version_list'
20184 inc_version_list_init='$inc_version_list_init'
20185 incpath='$incpath'
20186 inews='$inews'
20187 installarchlib='$installarchlib'
20188 installbin='$installbin'
20189 installman1dir='$installman1dir'
20190 installman3dir='$installman3dir'
20191 installprefix='$installprefix'
20192 installprefixexp='$installprefixexp'
20193 installprivlib='$installprivlib'
20194 installscript='$installscript'
20195 installsitearch='$installsitearch'
20196 installsitebin='$installsitebin'
20197 installsitelib='$installsitelib'
20198 installstyle='$installstyle'
20199 installusrbinperl='$installusrbinperl'
20200 installvendorarch='$installvendorarch'
20201 installvendorbin='$installvendorbin'
20202 installvendorlib='$installvendorlib'
20203 intsize='$intsize'
20204 issymlink='$issymlink'
20205 ivdformat='$ivdformat'
20206 ivsize='$ivsize'
20207 ivtype='$ivtype'
20208 known_extensions='$known_extensions'
20209 ksh='$ksh'
20210 ld='$ld'
20211 lddlflags='$lddlflags'
20212 ldflags='$ldflags'
20213 ldflags_uselargefiles='$ldflags_uselargefiles'
20214 ldlibpthname='$ldlibpthname'
20215 less='$less'
20216 lib_ext='$lib_ext'
20217 libc='$libc'
20218 libperl='$libperl'
20219 libpth='$libpth'
20220 libs='$libs'
20221 libsdirs='$libsdirs'
20222 libsfiles='$libsfiles'
20223 libsfound='$libsfound'
20224 libspath='$libspath'
20225 libswanted='$libswanted'
20226 libswanted_uselargefiles='$libswanted_uselargefiles'
20227 line='$line'
20228 lint='$lint'
20229 lkflags='$lkflags'
20230 ln='$ln'
20231 lns='$lns'
20232 localtime_r_proto='$localtime_r_proto'
20233 locincpth='$locincpth'
20234 loclibpth='$loclibpth'
20235 longdblsize='$longdblsize'
20236 longlongsize='$longlongsize'
20237 longsize='$longsize'
20238 lp='$lp'
20239 lpr='$lpr'
20240 ls='$ls'
20241 lseeksize='$lseeksize'
20242 lseektype='$lseektype'
20243 mail='$mail'
20244 mailx='$mailx'
20245 make='$make'
20246 make_set_make='$make_set_make'
20247 mallocobj='$mallocobj'
20248 mallocsrc='$mallocsrc'
20249 malloctype='$malloctype'
20250 man1dir='$man1dir'
20251 man1direxp='$man1direxp'
20252 man1ext='$man1ext'
20253 man3dir='$man3dir'
20254 man3direxp='$man3direxp'
20255 man3ext='$man3ext'
20256 mips_type='$mips_type'
20257 mkdir='$mkdir'
20258 mmaptype='$mmaptype'
20259 modetype='$modetype'
20260 more='$more'
20261 multiarch='$multiarch'
20262 mv='$mv'
20263 myarchname='$myarchname'
20264 mydomain='$mydomain'
20265 myhostname='$myhostname'
20266 myuname='$myuname'
20267 n='$n'
20268 need_va_copy='$need_va_copy'
20269 netdb_hlen_type='$netdb_hlen_type'
20270 netdb_host_type='$netdb_host_type'
20271 netdb_name_type='$netdb_name_type'
20272 netdb_net_type='$netdb_net_type'
20273 nm='$nm'
20274 nm_opt='$nm_opt'
20275 nm_so_opt='$nm_so_opt'
20276 nonxs_ext='$nonxs_ext'
20277 nroff='$nroff'
20278 nvEUformat='$nvEUformat'
20279 nvFUformat='$nvFUformat'
20280 nvGUformat='$nvGUformat'
20281 nv_preserves_uv_bits='$nv_preserves_uv_bits'
20282 nveformat='$nveformat'
20283 nvfformat='$nvfformat'
20284 nvgformat='$nvgformat'
20285 nvsize='$nvsize'
20286 nvtype='$nvtype'
20287 o_nonblock='$o_nonblock'
20288 obj_ext='$obj_ext'
20289 old_pthread_create_joinable='$old_pthread_create_joinable'
20290 optimize='$optimize'
20291 orderlib='$orderlib'
20292 osname='$osname'
20293 osvers='$osvers'
20294 otherlibdirs='$otherlibdirs'
20295 package='$package'
20296 pager='$pager'
20297 passcat='$passcat'
20298 patchlevel='$patchlevel'
20299 path_sep='$path_sep'
20300 perl5='$perl5'
20301 perl='$perl'
20302 perl_patchlevel='$perl_patchlevel'
20303 perladmin='$perladmin'
20304 perllibs='$perllibs'
20305 perlpath='$perlpath'
20306 pg='$pg'
20307 phostname='$phostname'
20308 pidtype='$pidtype'
20309 plibpth='$plibpth'
20310 pm_apiversion='$pm_apiversion'
20311 pmake='$pmake'
20312 pr='$pr'
20313 prefix='$prefix'
20314 prefixexp='$prefixexp'
20315 privlib='$privlib'
20316 privlibexp='$privlibexp'
20317 procselfexe='$procselfexe'
20318 prototype='$prototype'
20319 ptrsize='$ptrsize'
20320 quadkind='$quadkind'
20321 quadtype='$quadtype'
20322 randbits='$randbits'
20323 randfunc='$randfunc'
20324 random_r_proto='$random_r_proto'
20325 randseedtype='$randseedtype'
20326 ranlib='$ranlib'
20327 rd_nodata='$rd_nodata'
20328 readdir64_r_proto='$readdir64_r_proto'
20329 readdir_r_proto='$readdir_r_proto'
20330 revision='$revision'
20331 rm='$rm'
20332 rmail='$rmail'
20333 run='$run'
20334 runnm='$runnm'
20335 sPRIEUldbl='$sPRIEUldbl'
20336 sPRIFUldbl='$sPRIFUldbl'
20337 sPRIGUldbl='$sPRIGUldbl'
20338 sPRIXU64='$sPRIXU64'
20339 sPRId64='$sPRId64'
20340 sPRIeldbl='$sPRIeldbl'
20341 sPRIfldbl='$sPRIfldbl'
20342 sPRIgldbl='$sPRIgldbl'
20343 sPRIi64='$sPRIi64'
20344 sPRIo64='$sPRIo64'
20345 sPRIu64='$sPRIu64'
20346 sPRIx64='$sPRIx64'
20347 sSCNfldbl='$sSCNfldbl'
20348 sched_yield='$sched_yield'
20349 scriptdir='$scriptdir'
20350 scriptdirexp='$scriptdirexp'
20351 sed='$sed'
20352 seedfunc='$seedfunc'
20353 selectminbits='$selectminbits'
20354 selecttype='$selecttype'
20355 sendmail='$sendmail'
20356 setgrent_r_proto='$setgrent_r_proto'
20357 sethostent_r_proto='$sethostent_r_proto'
20358 setlocale_r_proto='$setlocale_r_proto'
20359 setnetent_r_proto='$setnetent_r_proto'
20360 setprotoent_r_proto='$setprotoent_r_proto'
20361 setpwent_r_proto='$setpwent_r_proto'
20362 setservent_r_proto='$setservent_r_proto'
20363 sh='$sh'
20364 shar='$shar'
20365 sharpbang='$sharpbang'
20366 shmattype='$shmattype'
20367 shortsize='$shortsize'
20368 shrpenv='$shrpenv'
20369 shsharp='$shsharp'
20370 sig_count='$sig_count'
20371 sig_name='$sig_name'
20372 sig_name_init='$sig_name_init'
20373 sig_num='$sig_num'
20374 sig_num_init='$sig_num_init'
20375 sig_size='$sig_size'
20376 signal_t='$signal_t'
20377 sitearch='$sitearch'
20378 sitearchexp='$sitearchexp'
20379 sitebin='$sitebin'
20380 sitebinexp='$sitebinexp'
20381 sitelib='$sitelib'
20382 sitelib_stem='$sitelib_stem'
20383 sitelibexp='$sitelibexp'
20384 siteprefix='$siteprefix'
20385 siteprefixexp='$siteprefixexp'
20386 sizesize='$sizesize'
20387 sizetype='$sizetype'
20388 sleep='$sleep'
20389 smail='$smail'
20390 so='$so'
20391 sockethdr='$sockethdr'
20392 socketlib='$socketlib'
20393 socksizetype='$socksizetype'
20394 sort='$sort'
20395 spackage='$spackage'
20396 spitshell='$spitshell'
20397 srand48_r_proto='$srand48_r_proto'
20398 srandom_r_proto='$srandom_r_proto'
20399 src='$src'
20400 ssizetype='$ssizetype'
20401 startperl='$startperl'
20402 startsh='$startsh'
20403 static_ext='$static_ext'
20404 stdchar='$stdchar'
20405 stdio_base='$stdio_base'
20406 stdio_bufsiz='$stdio_bufsiz'
20407 stdio_cnt='$stdio_cnt'
20408 stdio_filbuf='$stdio_filbuf'
20409 stdio_ptr='$stdio_ptr'
20410 stdio_stream_array='$stdio_stream_array'
20411 strerror_r_proto='$strerror_r_proto'
20412 strings='$strings'
20413 submit='$submit'
20414 subversion='$subversion'
20415 sysman='$sysman'
20416 tail='$tail'
20417 tar='$tar'
20418 targetarch='$targetarch'
20419 tbl='$tbl'
20420 tee='$tee'
20421 test='$test'
20422 timeincl='$timeincl'
20423 timetype='$timetype'
20424 tmpnam_r_proto='$tmpnam_r_proto'
20425 to='$to'
20426 touch='$touch'
20427 tr='$tr'
20428 trnl='$trnl'
20429 troff='$troff'
20430 ttyname_r_proto='$ttyname_r_proto'
20431 u16size='$u16size'
20432 u16type='$u16type'
20433 u32size='$u32size'
20434 u32type='$u32type'
20435 u64size='$u64size'
20436 u64type='$u64type'
20437 u8size='$u8size'
20438 u8type='$u8type'
20439 uidformat='$uidformat'
20440 uidsign='$uidsign'
20441 uidsize='$uidsize'
20442 uidtype='$uidtype'
20443 uname='$uname'
20444 uniq='$uniq'
20445 uquadtype='$uquadtype'
20446 use5005threads='$use5005threads'
20447 use64bitall='$use64bitall'
20448 use64bitint='$use64bitint'
20449 usecrosscompile='$usecrosscompile'
20450 usedl='$usedl'
20451 useithreads='$useithreads'
20452 uselargefiles='$uselargefiles'
20453 uselongdouble='$uselongdouble'
20454 usemorebits='$usemorebits'
20455 usemultiplicity='$usemultiplicity'
20456 usemymalloc='$usemymalloc'
20457 usenm='$usenm'
20458 useopcode='$useopcode'
20459 useperlio='$useperlio'
20460 useposix='$useposix'
20461 usereentrant='$usereentrant'
20462 usesfio='$usesfio'
20463 useshrplib='$useshrplib'
20464 usesocks='$usesocks'
20465 usethreads='$usethreads'
20466 usevendorprefix='$usevendorprefix'
20467 usevfork='$usevfork'
20468 usrinc='$usrinc'
20469 uuname='$uuname'
20470 uvXUformat='$uvXUformat'
20471 uvoformat='$uvoformat'
20472 uvsize='$uvsize'
20473 uvtype='$uvtype'
20474 uvuformat='$uvuformat'
20475 uvxformat='$uvxformat'
20476 vendorarch='$vendorarch'
20477 vendorarchexp='$vendorarchexp'
20478 vendorbin='$vendorbin'
20479 vendorbinexp='$vendorbinexp'
20480 vendorlib='$vendorlib'
20481 vendorlib_stem='$vendorlib_stem'
20482 vendorlibexp='$vendorlibexp'
20483 vendorprefix='$vendorprefix'
20484 vendorprefixexp='$vendorprefixexp'
20485 version='$version'
20486 version_patchlevel_string='$version_patchlevel_string'
20487 versiononly='$versiononly'
20488 vi='$vi'
20489 voidflags='$voidflags'
20490 xlibpth='$xlibpth'
20491 xs_apiversion='$xs_apiversion'
20492 yacc='$yacc'
20493 yaccflags='$yaccflags'
20494 zcat='$zcat'
20495 zip='$zip'
20496 EOT
20497
20498 : Add in command line options if available
20499 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
20500
20501 : add special variables
20502 $test -f $src/patchlevel.h && \
20503 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
20504 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
20505 echo "PERL_CONFIG_SH=true" >>config.sh
20506
20507 : propagate old symbols
20508 if $test -f UU/config.sh; then
20509         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
20510         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
20511         $sort | $uniq -u >UU/oldsyms
20512         set X `cat UU/oldsyms`
20513         shift
20514         case $# in
20515         0) ;;
20516         *)
20517                 cat <<EOM
20518 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
20519 EOM
20520                 echo "# Variables propagated from previous config.sh file." >>config.sh
20521                 for sym in `cat UU/oldsyms`; do
20522                         echo "    Propagating $hint variable "'$'"$sym..."
20523                         eval 'tmp="$'"${sym}"'"'
20524                         echo "$tmp" | \
20525                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
20526                 done
20527                 ;;
20528         esac
20529 fi
20530
20531 : Finish up by extracting the .SH files
20532 case "$alldone" in
20533 exit)
20534         $rm -rf UU
20535         echo "Extraction done."
20536         exit 0
20537         ;;
20538 cont)
20539         ;;
20540 '')
20541         dflt=''
20542         nostick=true
20543         $cat <<EOM
20544
20545 If you'd like to make any changes to the config.sh file before I begin
20546 to configure things, do it as a shell escape now (e.g. !vi config.sh).
20547
20548 EOM
20549         rp="Press return or use a shell escape to edit config.sh:"
20550         . UU/myread
20551         nostick=''
20552         case "$ans" in
20553         '') ;;
20554         *) : in case they cannot read
20555                 sh 1>&4 -c "$ans";;
20556         esac
20557         ;;
20558 esac
20559
20560 : if this fails, just run all the .SH files by hand
20561 . ./config.sh
20562
20563 echo " "
20564 exec 1>&4
20565 pwd=`pwd`
20566 . ./UU/extract
20567 cd "$pwd"
20568
20569 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
20570         dflt=y
20571         case "$silent" in
20572         true) ;;
20573         *)
20574                 $cat <<EOM
20575
20576 Now you need to generate make dependencies by running "$make depend".
20577 You might prefer to run it in background: "$make depend > makedepend.out &"
20578 It can take a while, so you might not want to run it right now.
20579
20580 EOM
20581                 ;;
20582         esac
20583         rp="Run $make depend now?"
20584         . UU/myread
20585         case "$ans" in
20586         y*)
20587                 $make depend && echo "Now you must run '$make'."
20588                 ;;
20589         *)
20590                 echo "You must run '$make depend' then '$make'."
20591                 ;;
20592         esac
20593 elif test -f [Mm]akefile; then
20594         echo " "
20595         echo "Now you must run a $make."
20596 else
20597         echo "Configure done."
20598 fi
20599
20600 if $test -f Policy.sh; then
20601     $cat <<EOM
20602
20603 If you compile $package on a different machine or from a different object
20604 directory, copy the Policy.sh file from this object directory to the
20605 new one before you run Configure -- this will help you with most of
20606 the policy defaults.
20607
20608 EOM
20609 fi
20610 if $test -f config.msg; then
20611     echo "Hmm.  I also noted the following information while running:"
20612     echo " "
20613     $cat config.msg >&4
20614     $rm -f config.msg
20615 fi
20616 $rm -f kit*isdone ark*isdone
20617 $rm -rf UU
20618
20619 : End of Configure
20620