Missed from #16811.
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Sat May 25 22:51:20 EET DST 2002 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.org)
25
26 cat >c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat c1$$ c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f c1$$ c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 case "X${MACHTYPE:-nonesuchmach}" in
69                 *cygwin) ;;
70                 *) p_=\; ;;
71                 esac
72         fi
73 fi
74
75 : Proper PATH setting
76 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
77 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
78 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
79 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
80 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
81 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
82 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
83 paths="$paths /sbin /usr/sbin /usr/libexec"
84 paths="$paths /system/gnu_library/bin"
85
86 for p in $paths
87 do
88         case "$p_$PATH$p_" in
89         *$p_$p$p_*) ;;
90         *) test -d $p && PATH=$PATH$p_$p ;;
91         esac
92 done
93
94 PATH=.$p_$PATH
95 export PATH
96
97 : shall we be using ksh?
98 inksh=''
99 needksh=''
100 avoidksh=''
101 newsh=/bin/ksh
102 changesh=''
103 if (PATH=.; alias -x) >/dev/null 2>&1; then
104                 inksh=true
105 fi
106 if test -f /hp-ux -a -f /bin/ksh; then
107         needksh='to avoid sh bug in "here document" expansion'
108 fi
109 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
110         if test X`/usr/bin/uname -v` = X4; then
111                 avoidksh="to avoid AIX 4's /bin/sh"
112                 newsh=/usr/bin/bsh
113         fi
114 fi
115 if test -f /osf_boot -a -f /usr/sbin/setld; then
116         if test X`/usr/bin/uname -s` = XOSF1; then
117                 avoidksh="to avoid Digital UNIX' ksh"
118                 newsh=/bin/sh
119                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
120         fi
121 fi
122 case "$inksh/$needksh" in
123 /[a-z]*)
124                 ENV=''
125                 changesh=true
126                 reason="$needksh"
127         ;;
128 esac
129 case "$inksh/$avoidksh" in
130 true/[a-z]*)
131         changesh=true
132         reason="$avoidksh"
133         ;;
134 esac
135 case "$inksh/$needksh-$avoidksh-" in
136 true/--)
137                 cat <<EOM
138 (I see you are using the Korn shell.  Some ksh's blow up on $me,
139 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
140 EOM
141         ;;
142 esac
143 case "$changesh" in
144 true)
145         export newsh
146         echo "(Feeding myself to $newsh $reason.)"
147         case "$0" in
148         Configure|*/Configure) exec $newsh $0 "$@";;
149         *) exec $newsh Configure "$@";;
150         esac
151         ;;
152 esac
153
154 : if needed set CDPATH to a harmless value that is not chatty
155 : avoid bash 2.02 problems with empty CDPATH.
156 case "$CDPATH" in
157 '')     ;;
158 *)      case "$SHELL" in
159         *bash*) CDPATH='.' ;;
160         *)              CDPATH='' ;;
161         esac
162         ;;
163 esac
164 : Configure runs within the UU subdirectory
165 test -d UU || mkdir UU
166 cd UU && rm -f ./*
167
168
169 ccname=''
170 ccversion=''
171 ccsymbols=''
172 cppccsymbols=''
173 cppsymbols=''
174 from=''
175 run=''
176 targetarch=''
177 to=''
178 usecrosscompile=''
179 perllibs=''
180 dynamic_ext=''
181 extensions=''
182 known_extensions=''
183 nonxs_ext=''
184 static_ext=''
185 useopcode=''
186 useposix=''
187 extras=''
188 d_bsd=''
189 d_eunice=''
190 d_xenix=''
191 eunicefix=''
192 Mcc=''
193 ar=''
194 awk=''
195 bash=''
196 bison=''
197 byacc=''
198 cat=''
199 chgrp=''
200 chmod=''
201 chown=''
202 comm=''
203 compress=''
204 cp=''
205 cpio=''
206 cpp=''
207 csh=''
208 date=''
209 echo=''
210 egrep=''
211 emacs=''
212 expr=''
213 find=''
214 flex=''
215 gmake=''
216 grep=''
217 gzip=''
218 inews=''
219 ksh=''
220 less=''
221 line=''
222 lint=''
223 ln=''
224 lp=''
225 lpr=''
226 ls=''
227 mail=''
228 mailx=''
229 make=''
230 mkdir=''
231 more=''
232 mv=''
233 nm=''
234 nroff=''
235 perl=''
236 pg=''
237 pmake=''
238 pr=''
239 rm=''
240 rmail=''
241 sed=''
242 sendmail=''
243 shar=''
244 sleep=''
245 smail=''
246 sort=''
247 submit=''
248 tail=''
249 tar=''
250 tbl=''
251 tee=''
252 test=''
253 touch=''
254 tr=''
255 troff=''
256 uname=''
257 uniq=''
258 uuname=''
259 vi=''
260 zcat=''
261 zip=''
262 full_ar=''
263 full_sed=''
264 libswanted=''
265 hint=''
266 myuname=''
267 osname=''
268 osvers=''
269 Author=''
270 Date=''
271 Header=''
272 Id=''
273 Locker=''
274 Log=''
275 RCSfile=''
276 Revision=''
277 Source=''
278 State=''
279 _a=''
280 _exe=''
281 _o=''
282 archobjs=''
283 exe_ext=''
284 firstmakefile=''
285 lib_ext=''
286 obj_ext=''
287 path_sep=''
288 afs=''
289 afsroot=''
290 alignbytes=''
291 ansi2knr=''
292 archlib=''
293 archlibexp=''
294 d_archlib=''
295 installarchlib=''
296 archname=''
297 myarchname=''
298 d_atolf=''
299 d_atoll=''
300 baserev=''
301 bin=''
302 binexp=''
303 installbin=''
304 byteorder=''
305 cc=''
306 ccflags=''
307 cppflags=''
308 ldflags=''
309 lkflags=''
310 locincpth=''
311 optimize=''
312 cf_email=''
313 cf_by=''
314 cf_time=''
315 charsize=''
316 contains=''
317 cpp_stuff=''
318 cpplast=''
319 cppminus=''
320 cpprun=''
321 cppstdin=''
322 d__fwalk=''
323 d_access=''
324 d_accessx=''
325 d_alarm=''
326 asctime_r_proto=''
327 d_asctime_r=''
328 d_attribut=''
329 d_bcmp=''
330 d_bcopy=''
331 d_bzero=''
332 d_casti32=''
333 castflags=''
334 d_castneg=''
335 d_chown=''
336 d_chroot=''
337 d_chsize=''
338 d_class=''
339 d_closedir=''
340 d_void_closedir=''
341 d_cmsghdr_s=''
342 d_const=''
343 cryptlib=''
344 d_crypt=''
345 crypt_r_proto=''
346 d_crypt_r=''
347 d_csh=''
348 full_csh=''
349 ctermid_r_proto=''
350 d_ctermid_r=''
351 ctime_r_proto=''
352 d_ctime_r=''
353 d_cuserid=''
354 d_dbl_dig=''
355 d_dbminitproto=''
356 d_difftime=''
357 d_dirfd=''
358 d_dlerror=''
359 d_dlopen=''
360 d_dlsymun=''
361 d_dosuid=''
362 d_suidsafe=''
363 d_drand48_r=''
364 drand48_r_proto=''
365 d_drand48proto=''
366 d_dup2=''
367 d_eaccess=''
368 d_endgrent=''
369 d_endgrent_r=''
370 endgrent_r_proto=''
371 d_endhent=''
372 d_endhostent_r=''
373 endhostent_r_proto=''
374 d_endnent=''
375 d_endnetent_r=''
376 endnetent_r_proto=''
377 d_endpent=''
378 d_endprotoent_r=''
379 endprotoent_r_proto=''
380 d_endpwent=''
381 d_endpwent_r=''
382 endpwent_r_proto=''
383 d_endsent=''
384 d_endservent_r=''
385 endservent_r_proto=''
386 d_fchdir=''
387 d_fchmod=''
388 d_fchown=''
389 d_fcntl=''
390 d_fcntl_can_lock=''
391 d_fd_macros=''
392 d_fd_set=''
393 d_fds_bits=''
394 d_fgetpos=''
395 d_finite=''
396 d_finitel=''
397 d_flexfnam=''
398 d_flock=''
399 d_flockproto=''
400 d_fork=''
401 d_fp_class=''
402 d_fpclass=''
403 d_fpclassify=''
404 d_fpclassl=''
405 d_fpos64_t=''
406 d_frexpl=''
407 d_fs_data_s=''
408 d_fseeko=''
409 d_fsetpos=''
410 d_fstatfs=''
411 d_fsync=''
412 d_ftello=''
413 d_ftime=''
414 d_gettimeod=''
415 d_Gconvert=''
416 d_getcwd=''
417 d_getespwnam=''
418 d_getfsstat=''
419 d_getgrent=''
420 d_getgrent_r=''
421 getgrent_r_proto=''
422 d_getgrgid_r=''
423 getgrgid_r_proto=''
424 d_getgrnam_r=''
425 getgrnam_r_proto=''
426 d_getgrps=''
427 d_gethbyaddr=''
428 d_gethbyname=''
429 d_gethent=''
430 aphostname=''
431 d_gethname=''
432 d_phostname=''
433 d_uname=''
434 d_gethostbyaddr_r=''
435 gethostbyaddr_r_proto=''
436 d_gethostbyname_r=''
437 gethostbyname_r_proto=''
438 d_gethostent_r=''
439 gethostent_r_proto=''
440 d_gethostprotos=''
441 d_getitimer=''
442 d_getlogin=''
443 d_getlogin_r=''
444 getlogin_r_proto=''
445 d_getmnt=''
446 d_getmntent=''
447 d_getnbyaddr=''
448 d_getnbyname=''
449 d_getnent=''
450 d_getnetbyaddr_r=''
451 getnetbyaddr_r_proto=''
452 d_getnetbyname_r=''
453 getnetbyname_r_proto=''
454 d_getnetent_r=''
455 getnetent_r_proto=''
456 d_getnetprotos=''
457 d_getpagsz=''
458 d_getpent=''
459 d_getpgid=''
460 d_getpgrp2=''
461 d_bsdgetpgrp=''
462 d_getpgrp=''
463 d_getppid=''
464 d_getprior=''
465 d_getpbyname=''
466 d_getpbynumber=''
467 d_getprotobyname_r=''
468 getprotobyname_r_proto=''
469 d_getprotobynumber_r=''
470 getprotobynumber_r_proto=''
471 d_getprotoent_r=''
472 getprotoent_r_proto=''
473 d_getprotoprotos=''
474 d_getprpwnam=''
475 d_getpwent=''
476 d_getpwent_r=''
477 getpwent_r_proto=''
478 d_getpwnam_r=''
479 getpwnam_r_proto=''
480 d_getpwuid_r=''
481 getpwuid_r_proto=''
482 d_getsent=''
483 d_getservbyname_r=''
484 getservbyname_r_proto=''
485 d_getservbyport_r=''
486 getservbyport_r_proto=''
487 d_getservent_r=''
488 getservent_r_proto=''
489 d_getservprotos=''
490 d_getspnam=''
491 d_getspnam_r=''
492 getspnam_r_proto=''
493 d_getsbyname=''
494 d_getsbyport=''
495 d_gmtime_r=''
496 gmtime_r_proto=''
497 d_gnulibc=''
498 d_hasmntopt=''
499 d_htonl=''
500 d_inetaton=''
501 d_int64_t=''
502 d_isascii=''
503 d_isfinite=''
504 d_isinf=''
505 d_isnan=''
506 d_isnanl=''
507 d_killpg=''
508 d_lchown=''
509 d_ldbl_dig=''
510 d_link=''
511 d_localtime_r=''
512 localtime_r_proto=''
513 d_locconv=''
514 d_lockf=''
515 d_longdbl=''
516 longdblsize=''
517 d_longlong=''
518 longlongsize=''
519 d_lseekproto=''
520 d_lstat=''
521 d_madvise=''
522 d_mblen=''
523 d_mbstowcs=''
524 d_mbtowc=''
525 d_memchr=''
526 d_memcmp=''
527 d_memcpy=''
528 d_memmove=''
529 d_memset=''
530 d_mkdir=''
531 d_mkdtemp=''
532 d_mkfifo=''
533 d_mkstemp=''
534 d_mkstemps=''
535 d_mktime=''
536 d_mmap=''
537 mmaptype=''
538 d_modfl=''
539 d_modfl_pow32_bug=''
540 d_mprotect=''
541 d_msg=''
542 d_msgctl=''
543 d_msgget=''
544 d_msghdr_s=''
545 d_msgrcv=''
546 d_msgsnd=''
547 d_msync=''
548 d_munmap=''
549 d_nice=''
550 d_nl_langinfo=''
551 d_off64_t=''
552 d_open3=''
553 d_fpathconf=''
554 d_pathconf=''
555 d_pause=''
556 d_pipe=''
557 d_poll=''
558 d_portable=''
559 d_procselfexe=''
560 procselfexe=''
561 d_old_pthread_create_joinable=''
562 old_pthread_create_joinable=''
563 d_pthread_atfork=''
564 d_pthread_yield=''
565 d_sched_yield=''
566 sched_yield=''
567 d_qgcvt=''
568 d_random_r=''
569 random_r_proto=''
570 d_readdir64_r=''
571 readdir64_r_proto=''
572 d_readdir=''
573 d_rewinddir=''
574 d_seekdir=''
575 d_telldir=''
576 d_readdir_r=''
577 readdir_r_proto=''
578 d_readlink=''
579 d_readv=''
580 d_recvmsg=''
581 d_rename=''
582 d_rmdir=''
583 d_safebcpy=''
584 d_safemcpy=''
585 d_sanemcmp=''
586 d_sbrkproto=''
587 d_select=''
588 d_sem=''
589 d_semctl=''
590 d_semget=''
591 d_semop=''
592 d_sendmsg=''
593 d_setegid=''
594 d_seteuid=''
595 d_setgrent=''
596 d_setgrent_r=''
597 setgrent_r_proto=''
598 d_setgrps=''
599 d_sethent=''
600 d_sethostent_r=''
601 sethostent_r_proto=''
602 d_setitimer=''
603 d_setlinebuf=''
604 d_setlocale=''
605 d_setlocale_r=''
606 setlocale_r_proto=''
607 d_setnent=''
608 d_setnetent_r=''
609 setnetent_r_proto=''
610 d_setpent=''
611 d_setpgid=''
612 d_setpgrp2=''
613 d_bsdsetpgrp=''
614 d_setpgrp=''
615 d_setprior=''
616 d_setproctitle=''
617 d_setprotoent_r=''
618 setprotoent_r_proto=''
619 d_setpwent=''
620 d_setpwent_r=''
621 setpwent_r_proto=''
622 d_setregid=''
623 d_setresgid=''
624 d_setresuid=''
625 d_setreuid=''
626 d_setrgid=''
627 d_setruid=''
628 d_setsent=''
629 d_setservent_r=''
630 setservent_r_proto=''
631 d_setsid=''
632 d_setvbuf=''
633 d_sfio=''
634 usesfio=''
635 d_shm=''
636 d_shmat=''
637 d_shmatprototype=''
638 shmattype=''
639 d_shmctl=''
640 d_shmdt=''
641 d_shmget=''
642 d_sigaction=''
643 d_sigprocmask=''
644 d_sigsetjmp=''
645 d_sockatmark=''
646 d_sockatmarkproto=''
647 d_msg_ctrunc=''
648 d_msg_dontroute=''
649 d_msg_oob=''
650 d_msg_peek=''
651 d_msg_proxy=''
652 d_oldsock=''
653 d_scm_rights=''
654 d_socket=''
655 d_sockpair=''
656 sockethdr=''
657 socketlib=''
658 d_socklen_t=''
659 d_socks5_init=''
660 d_sqrtl=''
661 d_srand48_r=''
662 srand48_r_proto=''
663 d_srandom_r=''
664 srandom_r_proto=''
665 d_sresgproto=''
666 d_sresuproto=''
667 d_statblks=''
668 d_statfs_f_flags=''
669 d_statfs_s=''
670 d_fstatvfs=''
671 d_statvfs=''
672 d_stdio_cnt_lval=''
673 d_stdio_ptr_lval=''
674 d_stdio_ptr_lval_nochange_cnt=''
675 d_stdio_ptr_lval_sets_cnt=''
676 d_stdiobase=''
677 d_stdstdio=''
678 stdio_base=''
679 stdio_bufsiz=''
680 stdio_cnt=''
681 stdio_filbuf=''
682 stdio_ptr=''
683 d_index=''
684 d_strchr=''
685 d_strcoll=''
686 d_strctcpy=''
687 d_strerrm=''
688 d_strerror=''
689 d_sysernlst=''
690 d_syserrlst=''
691 d_strerror_r=''
692 strerror_r_proto=''
693 d_strftime=''
694 d_strtod=''
695 d_strtol=''
696 d_strtold=''
697 d_strtoll=''
698 d_strtoq=''
699 d_strtoul=''
700 d_strtoull=''
701 d_strtouq=''
702 d_strxfrm=''
703 d_symlink=''
704 d_syscall=''
705 d_syscallproto=''
706 d_sysconf=''
707 d_system=''
708 d_tcgetpgrp=''
709 d_tcsetpgrp=''
710 d_telldirproto=''
711 d_time=''
712 timetype=''
713 clocktype=''
714 d_times=''
715 d_tmpnam_r=''
716 tmpnam_r_proto=''
717 d_truncate=''
718 d_ttyname_r=''
719 ttyname_r_proto=''
720 d_tzname=''
721 d_u32align=''
722 d_ualarm=''
723 d_umask=''
724 d_semctl_semid_ds=''
725 d_semctl_semun=''
726 d_union_semun=''
727 d_unordered=''
728 d_usleep=''
729 d_usleepproto=''
730 d_ustat=''
731 d_vfork=''
732 usevfork=''
733 d_voidsig=''
734 signal_t=''
735 d_volatile=''
736 d_charvspr=''
737 d_vprintf=''
738 d_wait4=''
739 d_waitpid=''
740 d_wcstombs=''
741 d_wctomb=''
742 d_writev=''
743 dlext=''
744 cccdlflags=''
745 ccdlflags=''
746 dlsrc=''
747 ld=''
748 lddlflags=''
749 usedl=''
750 doublesize=''
751 ebcdic=''
752 fflushNULL=''
753 fflushall=''
754 fpossize=''
755 fpostype=''
756 gccosandvers=''
757 gccversion=''
758 gidformat=''
759 gidsign=''
760 gidsize=''
761 gidtype=''
762 groupstype=''
763 h_fcntl=''
764 h_sysfile=''
765 i_arpainet=''
766 i_crypt=''
767 db_hashtype=''
768 db_prefixtype=''
769 db_version_major=''
770 db_version_minor=''
771 db_version_patch=''
772 i_db=''
773 i_dbm=''
774 i_rpcsvcdbm=''
775 d_dirnamlen=''
776 direntrytype=''
777 i_dirent=''
778 i_dld=''
779 i_dlfcn=''
780 i_fcntl=''
781 i_float=''
782 i_fp=''
783 i_fp_class=''
784 i_gdbm=''
785 d_grpasswd=''
786 i_grp=''
787 i_ieeefp=''
788 i_inttypes=''
789 i_langinfo=''
790 i_libutil=''
791 i_limits=''
792 i_locale=''
793 i_machcthr=''
794 i_malloc=''
795 i_math=''
796 i_memory=''
797 i_mntent=''
798 i_ndbm=''
799 i_netdb=''
800 i_neterrno=''
801 i_netinettcp=''
802 i_niin=''
803 i_sysin=''
804 i_poll=''
805 i_prot=''
806 i_pthread=''
807 d_pwage=''
808 d_pwchange=''
809 d_pwclass=''
810 d_pwcomment=''
811 d_pwexpire=''
812 d_pwgecos=''
813 d_pwpasswd=''
814 d_pwquota=''
815 i_pwd=''
816 i_sfio=''
817 i_shadow=''
818 i_socks=''
819 i_stddef=''
820 i_stdlib=''
821 i_string=''
822 strings=''
823 i_sunmath=''
824 i_sysaccess=''
825 i_sysdir=''
826 i_sysfile=''
827 d_voidtty=''
828 i_bsdioctl=''
829 i_sysfilio=''
830 i_sysioctl=''
831 i_syssockio=''
832 i_syslog=''
833 i_sysmman=''
834 i_sysmode=''
835 i_sysmount=''
836 i_sysndir=''
837 i_sysparam=''
838 i_sysresrc=''
839 i_syssecrt=''
840 i_sysselct=''
841 i_sysstat=''
842 i_sysstatfs=''
843 i_sysstatvfs=''
844 i_systimes=''
845 i_systypes=''
846 i_sysuio=''
847 i_sysun=''
848 i_sysutsname=''
849 i_sysvfs=''
850 i_syswait=''
851 i_sgtty=''
852 i_termio=''
853 i_termios=''
854 d_tm_tm_gmtoff=''
855 d_tm_tm_zone=''
856 i_systime=''
857 i_systimek=''
858 i_time=''
859 timeincl=''
860 i_unistd=''
861 i_ustat=''
862 i_utime=''
863 i_values=''
864 i_stdarg=''
865 i_varargs=''
866 i_varhdr=''
867 i_vfork=''
868 inc_version_list=''
869 inc_version_list_init=''
870 installprefix=''
871 installprefixexp=''
872 installstyle=''
873 installusrbinperl=''
874 intsize=''
875 longsize=''
876 shortsize=''
877 issymlink=''
878 libc=''
879 ldlibpthname=''
880 libperl=''
881 shrpenv=''
882 useshrplib=''
883 glibpth=''
884 libpth=''
885 loclibpth=''
886 plibpth=''
887 xlibpth=''
888 ignore_versioned_solibs=''
889 libs=''
890 libsdirs=''
891 libsfiles=''
892 libsfound=''
893 libspath=''
894 lns=''
895 d_PRIEUldbl=''
896 d_PRIFUldbl=''
897 d_PRIGUldbl=''
898 d_PRIeldbl=''
899 d_PRIfldbl=''
900 d_PRIgldbl=''
901 d_SCNfldbl=''
902 sPRIEUldbl=''
903 sPRIFUldbl=''
904 sPRIGUldbl=''
905 sPRIeldbl=''
906 sPRIfldbl=''
907 sPRIgldbl=''
908 sSCNfldbl=''
909 lseeksize=''
910 lseektype=''
911 make_set_make=''
912 d_mymalloc=''
913 freetype=''
914 mallocobj=''
915 mallocsrc=''
916 malloctype=''
917 usemymalloc=''
918 installman1dir=''
919 man1dir=''
920 man1direxp=''
921 man1ext=''
922 installman3dir=''
923 man3dir=''
924 man3direxp=''
925 man3ext=''
926 modetype=''
927 multiarch=''
928 mydomain=''
929 myhostname=''
930 phostname=''
931 c=''
932 n=''
933 d_eofnblk=''
934 eagain=''
935 o_nonblock=''
936 rd_nodata=''
937 need_va_copy=''
938 netdb_hlen_type=''
939 netdb_host_type=''
940 netdb_name_type=''
941 netdb_net_type=''
942 groupcat=''
943 hostcat=''
944 passcat=''
945 orderlib=''
946 ranlib=''
947 d_perl_otherlibdirs=''
948 otherlibdirs=''
949 package=''
950 spackage=''
951 pager=''
952 api_revision=''
953 api_subversion=''
954 api_version=''
955 api_versionstring=''
956 patchlevel=''
957 perl_patchlevel=''
958 revision=''
959 subversion=''
960 version=''
961 version_patchlevel_string=''
962 perl5=''
963 perladmin=''
964 perlpath=''
965 d_nv_preserves_uv=''
966 i16size=''
967 i16type=''
968 i32size=''
969 i32type=''
970 i64size=''
971 i64type=''
972 i8size=''
973 i8type=''
974 ivsize=''
975 ivtype=''
976 nv_preserves_uv_bits=''
977 nvsize=''
978 nvtype=''
979 u16size=''
980 u16type=''
981 u32size=''
982 u32type=''
983 u64size=''
984 u64type=''
985 u8size=''
986 u8type=''
987 uvsize=''
988 uvtype=''
989 ivdformat=''
990 nvEUformat=''
991 nvFUformat=''
992 nvGUformat=''
993 nveformat=''
994 nvfformat=''
995 nvgformat=''
996 uvXUformat=''
997 uvoformat=''
998 uvuformat=''
999 uvxformat=''
1000 pidtype=''
1001 prefix=''
1002 prefixexp=''
1003 installprivlib=''
1004 privlib=''
1005 privlibexp=''
1006 prototype=''
1007 ptrsize=''
1008 d_PRIXU64=''
1009 d_PRId64=''
1010 d_PRIi64=''
1011 d_PRIo64=''
1012 d_PRIu64=''
1013 d_PRIx64=''
1014 sPRIXU64=''
1015 sPRId64=''
1016 sPRIi64=''
1017 sPRIo64=''
1018 sPRIu64=''
1019 sPRIx64=''
1020 d_quad=''
1021 quadkind=''
1022 quadtype=''
1023 uquadtype=''
1024 drand01=''
1025 randbits=''
1026 randfunc=''
1027 randseedtype=''
1028 seedfunc=''
1029 installscript=''
1030 scriptdir=''
1031 scriptdirexp=''
1032 selectminbits=''
1033 selecttype=''
1034 sh=''
1035 sig_count=''
1036 sig_name=''
1037 sig_name_init=''
1038 sig_num=''
1039 sig_num_init=''
1040 sig_size=''
1041 installsitearch=''
1042 sitearch=''
1043 sitearchexp=''
1044 installsitebin=''
1045 sitebin=''
1046 sitebinexp=''
1047 installsitelib=''
1048 sitelib=''
1049 sitelib_stem=''
1050 sitelibexp=''
1051 siteprefix=''
1052 siteprefixexp=''
1053 sizesize=''
1054 sizetype=''
1055 so=''
1056 socksizetype=''
1057 sharpbang=''
1058 shsharp=''
1059 spitshell=''
1060 src=''
1061 ssizetype=''
1062 startperl=''
1063 startsh=''
1064 stdchar=''
1065 d_stdio_stream_array=''
1066 stdio_stream_array=''
1067 sysman=''
1068 trnl=''
1069 uidformat=''
1070 uidsign=''
1071 uidsize=''
1072 uidtype=''
1073 archname64=''
1074 use64bitall=''
1075 use64bitint=''
1076 ccflags_uselargefiles=''
1077 ldflags_uselargefiles=''
1078 libswanted_uselargefiles=''
1079 uselargefiles=''
1080 uselongdouble=''
1081 usemorebits=''
1082 usemultiplicity=''
1083 nm_opt=''
1084 nm_so_opt=''
1085 runnm=''
1086 usenm=''
1087 useperlio=''
1088 usesocks=''
1089 d_oldpthreads=''
1090 use5005threads=''
1091 useithreads=''
1092 usereentrant=''
1093 usethreads=''
1094 incpath=''
1095 mips_type=''
1096 usrinc=''
1097 d_vendorarch=''
1098 installvendorarch=''
1099 vendorarch=''
1100 vendorarchexp=''
1101 d_vendorbin=''
1102 installvendorbin=''
1103 vendorbin=''
1104 vendorbinexp=''
1105 d_vendorlib=''
1106 installvendorlib=''
1107 vendorlib=''
1108 vendorlib_stem=''
1109 vendorlibexp=''
1110 usevendorprefix=''
1111 vendorprefix=''
1112 vendorprefixexp=''
1113 versiononly=''
1114 defvoidused=''
1115 voidflags=''
1116 pm_apiversion=''
1117 xs_apiversion=''
1118 yacc=''
1119 yaccflags=''
1120 CONFIG=''
1121
1122 define='define'
1123 undef='undef'
1124 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1125 rmlist=''
1126
1127 : We must find out about Eunice early
1128 eunicefix=':'
1129 if test -f /etc/unixtovms; then
1130         eunicefix=/etc/unixtovms
1131 fi
1132 if test -f /etc/unixtovms.exe; then
1133         eunicefix=/etc/unixtovms.exe
1134 fi
1135
1136 : Set executable suffix now -- needed before hints available
1137 if test -f "/libs/version.library"; then
1138 : Amiga OS
1139     _exe=""
1140 elif test -f "/system/gnu_library/bin/ar.pm"; then
1141 : Stratus VOS
1142     _exe=".pm"
1143 elif test -n "$DJGPP"; then
1144 : DOS DJGPP
1145     _exe=".exe"
1146 elif test -d c:/. ; then
1147 : OS/2 or cygwin
1148     _exe=".exe"
1149 fi
1150
1151 i_whoami=''
1152 ccname=''
1153 ccversion=''
1154 perllibs=''
1155 : set useposix=false in your hint file to disable the POSIX extension.
1156 useposix=true
1157 : set useopcode=false in your hint file to disable the Opcode extension.
1158 useopcode=true
1159 : Trailing extension.  Override this in a hint file, if needed.
1160 : Extra object files, if any, needed on this platform.
1161 archobjs=''
1162 archname=''
1163 : Possible local include directories to search.
1164 : Set locincpth to "" in a hint file to defeat local include searches.
1165 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1166 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1167 :
1168 : no include file wanted by default
1169 inclwanted=''
1170
1171 groupstype=''
1172 libnames=''
1173 : change the next line if compiling for Xenix/286 on Xenix/386
1174 xlibpth='/usr/lib/386 /lib/386'
1175 : Possible local library directories to search.
1176 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1177 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1178
1179 : general looking path for locating libraries
1180 glibpth="/lib /usr/lib $xlibpth"
1181 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1182 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1183 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1184
1185 : Private path used by Configure to find libraries.  Its value
1186 : is prepended to libpth. This variable takes care of special
1187 : machines, like the mips.  Usually, it should be empty.
1188 plibpth=''
1189
1190 : default library list
1191 libswanted=''
1192 : some systems want to use only the non-versioned libso:s
1193 ignore_versioned_solibs=''
1194 archname64=''
1195 ccflags_uselargefiles=''
1196 ldflags_uselargefiles=''
1197 libswanted_uselargefiles=''
1198 : set usemultiplicity on the Configure command line to enable multiplicity.
1199 : set usesocks on the Configure command line to enable socks.
1200 : set usethreads on the Configure command line to enable threads.
1201 usereentrant='undef'
1202 : full support for void wanted by default
1203 defvoidused=15
1204
1205 : List of libraries we want.
1206 : If anyone needs -lnet, put it in a hint file.
1207 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1208 libswanted="$libswanted dld ld sun m c cposix posix"
1209 libswanted="$libswanted ndir dir crypt sec"
1210 libswanted="$libswanted ucb bsd BSD PW x util"
1211 : We probably want to search /usr/shlib before most other libraries.
1212 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1213 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1214 glibpth="/usr/shlib $glibpth"
1215 : Do not use vfork unless overridden by a hint file.
1216 usevfork=false
1217
1218 : Find the basic shell for Bourne shell scripts
1219 case "$sh" in
1220 '')
1221         case "$SYSTYPE" in
1222         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1223         *) xxx='/bin/sh';;
1224         esac
1225         if test -f "$xxx"; then
1226                 sh="$xxx"
1227         else
1228                 : Build up a list and do a single loop so we can 'break' out.
1229                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1230                 for xxx in sh bash ksh pdksh ash; do
1231                         for p in $pth; do
1232                                 try="$try ${p}/${xxx}"
1233                         done
1234                 done
1235                 for xxx in $try; do
1236                         if test -f "$xxx"; then
1237                                 sh="$xxx";
1238                                 break
1239                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1240                                 sh="$xxx";
1241                                 break
1242                         elif test -f "$xxx.exe"; then
1243                                 sh="$xxx";
1244                                 break
1245                         fi
1246                 done
1247         fi
1248         ;;
1249 esac
1250
1251 case "$sh" in
1252 '')     cat >&2 <<EOM
1253 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1254
1255 Usually it's in /bin/sh.  How did you even get this far?
1256 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1257 we'll try to straighten this all out.
1258 EOM
1259         exit 1
1260         ;;
1261 esac
1262
1263 : see if sh knows # comments
1264 if `$sh -c '#' >/dev/null 2>&1`; then
1265         shsharp=true
1266         spitshell=cat
1267         xcat=/bin/cat
1268         test -f $xcat$_exe || xcat=/usr/bin/cat
1269         if test ! -f $xcat$_exe; then
1270                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1271                         if test -f $p/cat$_exe; then
1272                                 xcat=$p/cat
1273                                 break
1274                         fi
1275                 done
1276                 if test ! -f $xcat$_exe; then
1277                         echo "Can't find cat anywhere!"
1278                         exit 1
1279                 fi
1280         fi
1281         echo "#!$xcat" >sharp
1282         $eunicefix sharp
1283         chmod +x sharp
1284         ./sharp > today
1285         if test -s today; then
1286                 sharpbang='#!'
1287         else
1288                 echo "#! $xcat" > sharp
1289                 $eunicefix sharp
1290                 chmod +x sharp
1291                 ./sharp > today
1292                 if test -s today; then
1293                         sharpbang='#! '
1294                 else
1295                         sharpbang=': use '
1296                 fi
1297         fi
1298 else
1299         echo " "
1300         echo "Your $sh doesn't grok # comments--I will strip them later on."
1301         shsharp=false
1302         cd ..
1303         echo "exec grep -v '^[  ]*#'" >spitshell
1304         chmod +x spitshell
1305         $eunicefix spitshell
1306         spitshell=`pwd`/spitshell
1307         cd UU
1308         echo "I presume that if # doesn't work, #! won't work either!"
1309         sharpbang=': use '
1310 fi
1311 rm -f sharp today
1312
1313 : figure out how to guarantee sh startup
1314 case "$startsh" in
1315 '') startsh=${sharpbang}${sh} ;;
1316 *)
1317 esac
1318 cat >sharp <<EOSS
1319 $startsh
1320 set abc
1321 test "$?abc" != 1
1322 EOSS
1323
1324 chmod +x sharp
1325 $eunicefix sharp
1326 if ./sharp; then
1327         : echo "Yup, it does."
1328 else
1329         echo "Hmm... '$startsh' does not guarantee sh startup..."
1330         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1331 fi
1332 rm -f sharp
1333
1334
1335 : Save command line options in file UU/cmdline.opt for later use in
1336 : generating config.sh.
1337 cat > cmdline.opt <<EOSH
1338 # Configure command line arguments.
1339 config_arg0='$0'
1340 config_args='$*'
1341 config_argc=$#
1342 EOSH
1343 argn=1
1344 args_exp=''
1345 args_sep=''
1346 for arg in "$@"; do
1347         cat >>cmdline.opt <<EOSH
1348 config_arg$argn='$arg'
1349 EOSH
1350         # Extreme backslashitis: replace each ' by '"'"'
1351         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1352 $arg
1353 EOC
1354         arg_exp=`cat cmdl.opt`
1355         args_exp="$args_exp$args_sep'$arg_exp'"
1356         argn=`expr $argn + 1`
1357         args_sep=' '
1358 done
1359 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1360 # used by ./hints/os2.sh
1361 rm -f cmdl.opt
1362
1363 : produce awk script to parse command line options
1364 cat >options.awk <<'EOF'
1365 BEGIN {
1366         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1367
1368         len = length(optstr);
1369         for (i = 1; i <= len; i++) {
1370                 c = substr(optstr, i, 1);
1371                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1372                 if (a == ":") {
1373                         arg[c] = 1;
1374                         i++;
1375                 }
1376                 opt[c] = 1;
1377         }
1378 }
1379 {
1380         expect = 0;
1381         str = $0;
1382         if (substr(str, 1, 1) != "-") {
1383                 printf("'%s'\n", str);
1384                 next;
1385         }
1386         len = length($0);
1387         for (i = 2; i <= len; i++) {
1388                 c = substr(str, i, 1);
1389                 if (!opt[c]) {
1390                         printf("-%s\n", substr(str, i));
1391                         next;
1392                 }
1393                 printf("-%s\n", c);
1394                 if (arg[c]) {
1395                         if (i < len)
1396                                 printf("'%s'\n", substr(str, i + 1));
1397                         else
1398                                 expect = 1;
1399                         next;
1400                 }
1401         }
1402 }
1403 END {
1404         if (expect)
1405                 print "?";
1406 }
1407 EOF
1408
1409 : process the command line options
1410 set X `for arg in "$@"; do echo "X$arg"; done |
1411         sed -e s/X// | awk -f options.awk`
1412 eval "set $*"
1413 shift
1414 rm -f options.awk
1415
1416 : set up default values
1417 fastread=''
1418 reuseval=false
1419 config_sh=''
1420 alldone=''
1421 error=''
1422 silent=''
1423 extractsh=''
1424 override=''
1425 knowitall=''
1426 rm -f optdef.sh posthint.sh
1427 cat >optdef.sh <<EOS
1428 $startsh
1429 EOS
1430
1431
1432 : option parsing
1433 while test $# -gt 0; do
1434         case "$1" in
1435         -d) shift; fastread=yes;;
1436         -e) shift; alldone=cont;;
1437         -f)
1438                 shift
1439                 cd ..
1440                 if test -r "$1"; then
1441                         config_sh="$1"
1442                 else
1443                         echo "$me: cannot read config file $1." >&2
1444                         error=true
1445                 fi
1446                 cd UU
1447                 shift;;
1448         -h) shift; error=true;;
1449         -r) shift; reuseval=true;;
1450         -s) shift; silent=true; realsilent=true;;
1451         -E) shift; alldone=exit;;
1452         -K) shift; knowitall=true;;
1453         -O) shift; override=true;;
1454         -S) shift; silent=true; extractsh=true;;
1455         -D)
1456                 shift
1457                 case "$1" in
1458                 *=)
1459                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1460                         echo "$me: ignoring -D $1" >&2
1461                         ;;
1462                 *=*) echo "$1" | \
1463                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1464                 *) echo "$1='define'" >> optdef.sh;;
1465                 esac
1466                 shift
1467                 ;;
1468         -U)
1469                 shift
1470                 case "$1" in
1471                 *=) echo "$1" >> optdef.sh;;
1472                 *=*)
1473                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1474                         echo "$me: ignoring -U $1" >&2
1475                         ;;
1476                 *) echo "$1='undef'" >> optdef.sh;;
1477                 esac
1478                 shift
1479                 ;;
1480         -A)
1481             shift
1482             xxx=''
1483             yyy="$1"
1484             zzz=''
1485             uuu=undef
1486             case "$yyy" in
1487             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1488                  case "$zzz" in
1489                  *:*) zzz='' ;;
1490                  *)   xxx=append
1491                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1492                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1493                  esac
1494                  ;;
1495             esac
1496             case "$xxx" in
1497             '')  case "$yyy" in
1498                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1499                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1500                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1501                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1502                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1503                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1504                  esac
1505                  ;;       
1506             esac
1507             case "$xxx" in
1508             append)
1509                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1510             clear)
1511                 echo "$yyy=''"                  >> posthint.sh ;;
1512             define)
1513                 case "$zzz" in
1514                 '') zzz=define ;;
1515                 esac
1516                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1517             eval)
1518                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1519             prepend)
1520                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1521             undef)
1522                 case "$zzz" in
1523                 '') zzz="$uuu" ;;
1524                 esac
1525                 echo "$yyy=$zzz"                >> posthint.sh ;;
1526             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1527             esac
1528             shift
1529             ;;
1530         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1531             exit 0;;
1532         --) break;;
1533         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1534         *) break;;
1535         esac
1536 done
1537
1538 case "$error" in
1539 true)
1540         cat >&2 <<EOM
1541 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1542                  [-U symbol] [-U symbol=] [-A command:symbol...]
1543   -d : use defaults for all answers.
1544   -e : go on without questioning past the production of config.sh.
1545   -f : specify an alternate default configuration file.
1546   -h : print this help message and exit (with an error status).
1547   -r : reuse C symbols value if possible (skips costly nm extraction).
1548   -s : silent mode, only echoes questions and essential information.
1549   -D : define symbol to have some value:
1550          -D symbol         symbol gets the value 'define'
1551          -D symbol=value   symbol gets the value 'value'
1552   -E : stop at the end of questions, after having produced config.sh.
1553   -K : do not use unless you know what you are doing.
1554   -O : let -D and -U override definitions from loaded configuration file.
1555   -S : perform variable substitutions on all .SH files (can mix with -f)
1556   -U : undefine symbol:
1557          -U symbol    symbol gets the value 'undef'
1558          -U symbol=   symbol gets completely empty
1559   -A : manipulate symbol after the platform specific hints have been applied:
1560          -A symbol=value                append " "value to symbol
1561          -A append:symbol=value         append value to symbol
1562          -A define:symbol=value         define symbol to have value
1563          -A clear:symbol                define symbol to be ''
1564          -A define:symbol               define symbol to be 'define'
1565          -A eval:symbol=value           define symbol to be eval of value
1566          -A prepend:symbol=value        prepend value to symbol
1567          -A undef:symbol                define symbol to be 'undef'
1568          -A undef:symbol=               define symbol to be ''
1569   -V : print version number and exit (with a zero status).
1570 EOM
1571         exit 1
1572         ;;
1573 esac
1574
1575 : Sanity checks
1576 case "$fastread$alldone" in
1577 yescont|yesexit) ;;
1578 *)
1579         case "$extractsh" in
1580         true) ;;
1581         *)
1582                 if test ! -t 0; then
1583                         echo "Say 'sh Configure', not 'sh <Configure'"
1584                         exit 1
1585                 fi
1586                 ;;
1587         esac
1588         ;;
1589 esac
1590
1591 exec 4>&1
1592 case "$silent" in
1593 true) exec 1>/dev/null;;
1594 esac
1595
1596 : run the defines and the undefines, if any, but leave the file out there...
1597 touch optdef.sh
1598 . ./optdef.sh
1599 : create the posthint manipulation script and leave the file out there...
1600 touch posthint.sh
1601
1602 : set package name
1603 package=perl5
1604 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1605 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1606 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1607 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1608 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1609 esac
1610
1611 : Some greps do not return status, grrr.
1612 echo "grimblepritz" >grimble
1613 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1614         contains=contains
1615 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1616         contains=grep
1617 else
1618         contains=contains
1619 fi
1620 rm -f grimble
1621 : the following should work in any shell
1622 case "$contains" in
1623 contains*)
1624         echo " "
1625         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1626         cat >contains <<'EOSS'
1627 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1628 EOSS
1629 chmod +x contains
1630 esac
1631
1632 : Find the path to the source tree
1633 case "$src" in
1634 '') case "$0" in
1635     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1636          case "$src" in
1637          /*)    ;;
1638          .)     ;;
1639          *)     src=`cd ../$src && pwd` ;;
1640          esac
1641          ;;
1642     *)   src='.';;
1643     esac;;
1644 esac
1645 case "$src" in
1646 '')     src=/
1647         rsrc=/
1648         ;;
1649 /*) rsrc="$src";;
1650 *) rsrc="../$src";;
1651 esac
1652 if test -f $rsrc/Configure && \
1653         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1654 then
1655    : found it, so we are ok.
1656 else
1657         rsrc=''
1658         for src in . .. ../.. ../../.. ../../../..; do
1659                 if test -f ../$src/Configure && \
1660                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1661                 then
1662                         rsrc=../$src
1663                         break
1664                 fi
1665         done
1666 fi
1667 case "$rsrc" in
1668 '')
1669         cat <<EOM >&4
1670
1671 Sorry, I can't seem to locate the source dir for $package.  Please start
1672 Configure with an explicit path -- i.e. /some/path/Configure.
1673
1674 EOM
1675         exit 1
1676         ;;
1677 ../.)   rsrc='..';;
1678 *)
1679         echo " "
1680         echo "Sources for $package found in \"$src\"." >&4
1681         ;;
1682 esac
1683
1684 : script used to extract .SH files with variable substitutions
1685 cat >extract <<'EOS'
1686 PERL_CONFIG_SH=true
1687 echo "Doing variable substitutions on .SH files..."
1688 if test -f MANIFEST; then
1689         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1690 else
1691         echo "(Looking for .SH files under the source directory.)"
1692         set x `(cd "$src"; find . -name "*.SH" -print)`
1693 fi
1694 shift
1695 case $# in
1696 0) set x `(cd "$src"; echo *.SH)`; shift;;
1697 esac
1698 if test ! -f "$src/$1"; then
1699         shift
1700 fi
1701 mkdir_p='
1702 name=$1;
1703 create="";
1704 while test $name; do
1705         if test ! -d "$name"; then
1706                 create="$name $create";
1707                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1708                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1709         else
1710                 name="";
1711         fi;
1712 done;
1713 for file in $create; do
1714         mkdir $file;
1715 done
1716 '
1717 for file in $*; do
1718         case "$src" in
1719         ".")
1720                 case "$file" in
1721                 */*)
1722                         dir=`expr X$file : 'X\(.*\)/'`
1723                         file=`expr X$file : 'X.*/\(.*\)'`
1724                         (cd "$dir" && . ./$file)
1725                         ;;
1726                 *)
1727                         . ./$file
1728                         ;;
1729                 esac
1730                 ;;
1731         *)
1732                 case "$file" in
1733                 */*)
1734                         dir=`expr X$file : 'X\(.*\)/'`
1735                         file=`expr X$file : 'X.*/\(.*\)'`
1736                         (set x $dir; shift; eval $mkdir_p)
1737                         sh <"$src/$dir/$file"
1738                         ;;
1739                 *)
1740                         sh <"$src/$file"
1741                         ;;
1742                 esac
1743                 ;;
1744         esac
1745 done
1746 if test -f "$src/config_h.SH"; then
1747         if test ! -f config.h; then
1748         : oops, they left it out of MANIFEST, probably, so do it anyway.
1749         . "$src/config_h.SH"
1750         fi
1751 fi
1752 EOS
1753
1754 : extract files and exit if asked to do so
1755 case "$extractsh" in
1756 true)
1757         case "$realsilent" in
1758         true) ;;
1759         *) exec 1>&4;;
1760         esac
1761         case "$config_sh" in
1762         '') config_sh='config.sh';;
1763         esac
1764         echo " "
1765         echo "Fetching answers from $config_sh..."
1766         cd ..
1767         . $config_sh
1768         test "$override" && . ./optdef.sh
1769         echo " "
1770         . UU/extract
1771         rm -rf UU
1772         echo "Extraction done."
1773         exit 0
1774         ;;
1775 esac
1776
1777 : Eunice requires " " instead of "", can you believe it
1778 echo " "
1779 : Here we go...
1780 echo "Beginning of configuration questions for $package."
1781
1782 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1783
1784 : first determine how to suppress newline on echo command
1785 echo " "
1786 echo "Checking echo to see how to suppress newlines..."
1787 (echo "hi there\c" ; echo " ") >.echotmp
1788 if $contains c .echotmp >/dev/null 2>&1 ; then
1789         echo "...using -n."
1790         n='-n'
1791         c=''
1792 else
1793         cat <<'EOM'
1794 ...using \c
1795 EOM
1796         n=''
1797         c='\c'
1798 fi
1799 echo $n "The star should be here-->$c"
1800 echo '*'
1801 rm -f .echotmp
1802
1803 : Now test for existence of everything in MANIFEST
1804 echo " "
1805 if test -f "$rsrc/MANIFEST"; then
1806         echo "First let's make sure your kit is complete.  Checking..." >&4
1807         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1808         rm -f missing
1809         tmppwd=`pwd`
1810         for filelist in x??; do
1811                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1812         done
1813         if test -s missing; then
1814                 cat missing >&4
1815                 cat >&4 <<'EOM'
1816
1817 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1818
1819 You have the option of continuing the configuration process, despite the
1820 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1821 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1822 and contact the author (perlbug@perl.org).
1823
1824 EOM
1825                 echo $n "Continue? [n] $c" >&4
1826                 read ans
1827                 case "$ans" in
1828                 y*)
1829                         echo "Continuing..." >&4
1830                         rm -f missing
1831                         ;;
1832                 *)
1833                         echo "ABORTING..." >&4
1834                         kill $$
1835                         ;;
1836                 esac
1837         else
1838                 echo "Looks good..."
1839         fi
1840 else
1841         echo "There is no MANIFEST file.  I hope your kit is complete !"
1842 fi
1843 rm -f missing x??
1844
1845 echo " "
1846 : Find the appropriate value for a newline for tr
1847 if test -n "$DJGPP"; then
1848        trnl='\012'
1849 fi
1850 if test X"$trnl" = X; then
1851         case "`echo foo|tr '\n' x 2>/dev/null`" in
1852         foox) trnl='\n' ;;
1853         esac
1854 fi
1855 if test X"$trnl" = X; then
1856         case "`echo foo|tr '\012' x 2>/dev/null`" in
1857         foox) trnl='\012' ;;
1858         esac
1859 fi
1860 if test X"$trnl" = X; then
1861        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1862        fooxy) trnl='\n\r' ;;
1863        esac
1864 fi
1865 if test X"$trnl" = X; then
1866         cat <<EOM >&2
1867
1868 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1869
1870 EOM
1871         exit 1
1872 fi
1873
1874 : compute the number of columns on the terminal for proper question formatting
1875 case "$COLUMNS" in
1876 '') COLUMNS='80';;
1877 esac
1878
1879 : set up the echo used in my read
1880 myecho="case \"\$xxxm\" in
1881 '') echo $n \"\$rp $c\" >&4;;
1882 *) case \"\$rp\" in
1883         '') echo $n \"[\$xxxm] $c\";;
1884         *)
1885                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1886                         echo \"\$rp\" >&4
1887                         echo $n \"[\$xxxm] $c\" >&4
1888                 else
1889                         echo $n \"\$rp [\$xxxm] $c\" >&4
1890                 fi
1891                 ;;
1892         esac;;
1893 esac"
1894
1895 : now set up to do reads with possible shell escape and default assignment
1896 cat <<EOSC >myread
1897 $startsh
1898 xxxm=\$dflt
1899 $myecho
1900 ans='!'
1901 case "\$fastread" in
1902 yes) case "\$dflt" in
1903         '') ;;
1904         *) ans='';
1905                 case "\$silent-\$rp" in
1906                 true-) ;;
1907                 *) echo " " >&4;;
1908                 esac;;
1909         esac;;
1910 *) case "\$silent" in
1911         true) case "\$rp" in
1912                 '') ans='';;
1913                 esac;;
1914         esac;;
1915 esac
1916 while expr "X\$ans" : "X!" >/dev/null; do
1917         read answ
1918         set x \$xxxm
1919         shift
1920         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1921         case  "\$answ" in
1922         "!")
1923                 sh 1>&4
1924                 echo " "
1925                 $myecho
1926                 ;;
1927         !*)
1928                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1929                 shift
1930                 sh 1>&4 -c "\$*"
1931                 echo " "
1932                 $myecho
1933                 ;;
1934         "\$ans")
1935                 case "\$ans" in
1936                 \\&*)
1937                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1938                         shift
1939                         case "\$1" in
1940                         -d)
1941                                 fastread=yes
1942                                 echo "(OK, I'll run with -d after this question.)" >&4
1943                                 ;;
1944                         -*)
1945                                 echo "*** Sorry, \$1 not supported yet." >&4
1946                                 ;;
1947                         esac
1948                         $myecho
1949                         ans=!
1950                         ;;
1951                 esac;;
1952         *)
1953                 case "\$aok" in
1954                 y)
1955                         echo "*** Substitution done -- please confirm."
1956                         xxxm="\$ans"
1957                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1958                         xxxm="\$ans"
1959                         ans=!
1960                         ;;
1961                 *)
1962                         echo "*** Error -- try again."
1963                         ans=!
1964                         ;;
1965                 esac
1966                 $myecho
1967                 ;;
1968         esac
1969         case "\$ans\$xxxm\$nostick" in
1970         '')
1971                 ans=!
1972                 $myecho
1973                 ;;
1974         esac
1975 done
1976 case "\$ans" in
1977 '') ans="\$xxxm";;
1978 esac
1979 EOSC
1980
1981 : create .config dir to save info across Configure sessions
1982 test -d ../.config || mkdir ../.config
1983 cat >../.config/README <<EOF
1984 This directory created by Configure to save information that should
1985 persist across sessions for $package.
1986
1987 You may safely delete it if you wish.
1988 EOF
1989
1990 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1991 case "$usedevel" in
1992 $define|true|[yY]*) ;;
1993 *) case "$xversion" in
1994    *[13579])
1995         cat >&4 <<EOH
1996 *** WHOA THERE!!! ***
1997
1998     This is an UNSTABLE DEVELOPMENT release.
1999     The version of this $package distribution is $xversion, that is, odd,
2000     (as opposed to even) and that signifies a development release.
2001     If you want a maintenance release, you want an even-numbered version.
2002
2003     Do ***NOT*** install this into production use.
2004     Data corruption and crashes are possible.
2005
2006     It is most seriously suggested that you do not continue any further
2007     unless you want to help in developing and debugging Perl.
2008
2009     If you *still* want to build perl, you can answer 'y' now,
2010     or pass -Dusedevel to Configure.
2011
2012 EOH
2013         rp='Do you really want to continue?'
2014         dflt='n'
2015         . ./myread
2016         case "$ans" in
2017         [yY]) echo >&4 "Okay, continuing."
2018               usedevel="$define" ;;
2019         *) echo >&4 "Okay, bye."
2020            exit 1
2021            ;;
2022         esac
2023         ;;
2024     esac
2025     ;;
2026 esac
2027 case "$usedevel" in
2028 $define|true|[yY]*)
2029         case "$versiononly" in
2030         '') versiononly="$define" ;;
2031         esac
2032         case "$installusrbinperl" in
2033         '') installusrbinperl="$undef" ;;
2034         esac
2035         ;;
2036 esac
2037
2038 : general instructions
2039 needman=true
2040 firsttime=true
2041 user=`(logname) 2>/dev/null`
2042 case "$user" in
2043 '') user=`whoami 2>&1`;;
2044 esac
2045 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2046         firsttime=false
2047         echo " "
2048         rp='Would you like to see the instructions?'
2049         dflt=n
2050         . ./myread
2051         case "$ans" in
2052         [yY]*) ;;
2053         *) needman=false;;
2054         esac
2055 fi
2056 if $needman; then
2057         cat <<EOH
2058
2059 This installation shell script will examine your system and ask you questions
2060 to determine how the perl5 package should be installed. If you get
2061 stuck on a question, you may use a ! shell escape to start a subshell or
2062 execute a command.  Many of the questions will have default answers in square
2063 brackets; typing carriage return will give you the default.
2064
2065 On some of the questions which ask for file or directory names you are allowed
2066 to use the ~name construct to specify the login directory belonging to "name",
2067 even if you don't have a shell which knows about that.  Questions where this is
2068 allowed will be marked "(~name ok)".
2069
2070 EOH
2071         rp=''
2072         dflt='Type carriage return to continue'
2073         . ./myread
2074         cat <<'EOH'
2075
2076 The prompter used in this script allows you to use shell variables and
2077 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2078 in the default answer, as if the default line was a set of arguments given to a
2079 script shell.  This means you may also use $* to repeat the whole default line,
2080 so you do not have to re-type everything to add something to the default.
2081
2082 Everytime there is a substitution, you will have to confirm.  If there is an
2083 error (e.g. an unmatched backtick), the default answer will remain unchanged
2084 and you will be prompted again.
2085
2086 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2087 the questions and use the computed defaults (or the previous answers if there
2088 was already a config.sh file). Type 'Configure -h' for a list of options.
2089 You may also start interactively and then answer '& -d' at any prompt to turn
2090 on the non-interactive behaviour for the remainder of the execution.
2091
2092 EOH
2093         . ./myread
2094         cat <<EOH
2095
2096 Much effort has been expended to ensure that this shell script will run on any
2097 Unix system.  If despite that it blows up on yours, your best bet is to edit
2098 Configure and run it again.  If you can't run Configure for some reason,
2099 you'll have to generate a config.sh file by hand.  Whatever problems you
2100 have, let me (perlbug@perl.org) know how I blew it.
2101
2102 This installation script affects things in two ways:
2103
2104 1) it may do direct variable substitutions on some of the files included
2105    in this kit.
2106 2) it builds a config.h file for inclusion in C programs.  You may edit
2107    any of these files as the need arises after running this script.
2108
2109 If you make a mistake on a question, there is no easy way to back up to it
2110 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2111 files.  Configure will offer to let you do this before it runs the SH files.
2112
2113 EOH
2114         dflt='Type carriage return to continue'
2115         . ./myread
2116         case "$firsttime" in
2117         true) echo $user >>../.config/instruct;;
2118         esac
2119 fi
2120
2121 : find out where common programs are
2122 echo " "
2123 echo "Locating common programs..." >&4
2124 cat <<EOSC >loc
2125 $startsh
2126 case \$# in
2127 0) exit 1;;
2128 esac
2129 thing=\$1
2130 shift
2131 dflt=\$1
2132 shift
2133 for dir in \$*; do
2134         case "\$thing" in
2135         .)
2136         if test -d \$dir/\$thing; then
2137                 echo \$dir
2138                 exit 0
2139         fi
2140         ;;
2141         *)
2142         for thisthing in \$dir/\$thing; do
2143                 : just loop through to pick last item
2144         done
2145         if test -f \$thisthing; then
2146                 echo \$thisthing
2147                 exit 0
2148         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2149                 echo \$thisthing
2150                 exit 0
2151         elif test -f \$dir/\$thing.exe; then
2152                 if test -n "$DJGPP"; then
2153                         echo \$dir/\$thing.exe
2154                 else
2155                         : on Eunice apparently
2156                         echo \$dir/\$thing
2157                 fi
2158                 exit 0
2159         fi
2160         ;;
2161         esac
2162 done
2163 echo \$dflt
2164 exit 1
2165 EOSC
2166 chmod +x loc
2167 $eunicefix loc
2168 loclist="
2169 awk
2170 cat
2171 chmod
2172 comm
2173 cp
2174 echo
2175 expr
2176 grep
2177 ls
2178 mkdir
2179 rm
2180 sed
2181 sort
2182 touch
2183 tr
2184 uniq
2185 "
2186 trylist="
2187 Mcc
2188 ar
2189 bison
2190 byacc
2191 cpp
2192 csh
2193 date
2194 egrep
2195 gmake
2196 gzip
2197 less
2198 ln
2199 make
2200 more
2201 nm
2202 nroff
2203 pg
2204 test
2205 uname
2206 zip
2207 "
2208 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2209 pth="$pth /lib /usr/lib"
2210 for file in $loclist; do
2211         eval xxx=\$$file
2212         case "$xxx" in
2213         /*|?:[\\/]*)
2214                 if test -f "$xxx"; then
2215                         : ok
2216                 else
2217                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2218                         xxx=`./loc $file $file $pth`
2219                 fi
2220                 ;;
2221         '') xxx=`./loc $file $file $pth`;;
2222         *) xxx=`./loc $xxx $xxx $pth`;;
2223         esac
2224         eval $file=$xxx$_exe
2225         eval _$file=$xxx
2226         case "$xxx" in
2227         /*)
2228                 echo $file is in $xxx.
2229                 ;;
2230         ?:[\\/]*)
2231                 echo $file is in $xxx.
2232                 ;;
2233         *)
2234                 echo "I don't know where '$file' is, and my life depends on it." >&4
2235                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2236                 exit 1
2237                 ;;
2238         esac
2239 done
2240 echo " "
2241 echo "Don't worry if any of the following aren't found..."
2242 say=offhand
2243 for file in $trylist; do
2244         eval xxx=\$$file
2245         case "$xxx" in
2246         /*|?:[\\/]*)
2247                 if test -f "$xxx"; then
2248                         : ok
2249                 else
2250                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2251                         xxx=`./loc $file $file $pth`
2252                 fi
2253                 ;;
2254         '') xxx=`./loc $file $file $pth`;;
2255         *) xxx=`./loc $xxx $xxx $pth`;;
2256         esac
2257         eval $file=$xxx$_exe
2258         eval _$file=$xxx
2259         case "$xxx" in
2260         /*)
2261                 echo $file is in $xxx.
2262                 ;;
2263         ?:[\\/]*)
2264                 echo $file is in $xxx.
2265                 ;;
2266         *)
2267                 echo "I don't see $file out there, $say."
2268                 say=either
2269                 ;;
2270         esac
2271 done
2272 case "$egrep" in
2273 egrep)
2274         echo "Substituting grep for egrep."
2275         egrep=$grep
2276         _egrep=$grep
2277         ;;
2278 esac
2279 case "$ln" in
2280 ln)
2281         echo "Substituting cp for ln."
2282         ln=$cp
2283         _ln=$cp
2284         ;;
2285 esac
2286 case "$make" in
2287 make)   
2288         case "$gmake" in
2289         gmake)
2290         echo "I can't find make or gmake, and my life depends on it." >&4
2291         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2292         exit 1
2293         ;;
2294         esac
2295         ;;
2296 esac    
2297 case "$gmake" in
2298 gmake)  ;;
2299 *)      # We can't have osname yet.
2300         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2301                 # Assume that gmake, if found, is definitely GNU make
2302                 # and prefer it over the system make.
2303                 echo "Substituting gmake for make."
2304                 make=$gmake
2305                 _make=$gmake
2306         fi
2307         ;;
2308 esac
2309 case "$test" in
2310 test)
2311         echo "Hopefully test is built into your sh."
2312         ;;
2313 *)
2314         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2315                 echo "Using the test built into your sh."
2316                 test=test
2317                 _test=test
2318         fi
2319         ;;
2320 esac
2321 case "$echo" in
2322 echo)
2323         echo "Hopefully echo is built into your sh."
2324         ;;
2325 '') ;;
2326 *)
2327         echo " "
2328 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2329         $echo $n "hi there$c" >foo1
2330         echo $n "hi there$c" >foo2
2331         if cmp foo1 foo2 >/dev/null 2>&1; then
2332                 echo "They are compatible.  In fact, they may be identical."
2333         else
2334                 case "$n" in
2335                 '-n') n='' c='\c';;
2336                 *) n='-n' c='';;
2337                 esac
2338                 cat <<FOO
2339 They are not compatible!  You are probably running ksh on a non-USG system.
2340 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2341 have echo built in and we may have to run some Bourne shell scripts.  That
2342 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2343
2344 FOO
2345                 $echo $n "The star should be here-->$c"
2346                 $echo "*"
2347         fi
2348         $rm -f foo1 foo2
2349         ;;
2350 esac
2351
2352 cat <<EOS >trygcc
2353 $startsh
2354 EOS
2355 cat <<'EOSC' >>trygcc
2356 case "$cc" in
2357 '') ;;
2358 *)  $rm -f try try.*
2359     $cat >try.c <<EOM
2360 int main(int argc, char *argv[]) {
2361   return 0;
2362 }
2363 EOM
2364     if $cc -o try $ccflags $ldflags try.c; then
2365        :
2366     else
2367         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2368         despair=yes
2369         trygcc=yes
2370         case "$cc" in
2371         *gcc*) trygcc=no ;;
2372         esac
2373         case "`$cc -v -c try.c 2>&1`" in
2374         *gcc*) trygcc=no ;;
2375         esac
2376         if $test X"$trygcc" = Xyes; then
2377             if gcc -o try -c try.c; then
2378                 echo " "
2379                 echo "You seem to have a working gcc, though." >&4
2380                 rp="Would you like to use it?"
2381                 dflt=y
2382                 if $test -f myread; then
2383                     . ./myread
2384                 else
2385                     if $test -f UU/myread; then
2386                         . ./UU/myread
2387                     else
2388                         echo "Cannot find myread, sorry.  Aborting." >&2
2389                         exit 1
2390                     fi
2391                 fi  
2392                 case "$ans" in
2393                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2394                        if $test -f usethreads.cbu; then
2395                            $cat >&4 <<EOM 
2396
2397 *** However, any setting of the C compiler flags (e.g. for thread support)
2398 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2399 *** (together with e.g. -Dusethreads).
2400
2401 EOM
2402                        fi;;
2403                 esac
2404             fi
2405         fi
2406     fi
2407     $rm -f try try.*
2408     ;;
2409 esac
2410 EOSC
2411
2412 cat <<EOS >checkcc
2413 $startsh
2414 EOS
2415 cat <<'EOSC' >>checkcc
2416 case "$cc" in        
2417 '') ;;
2418 *)  $rm -f try try.*              
2419     $cat >try.c <<EOM
2420 int main(int argc, char *argv[]) {
2421   return 0;
2422 }
2423 EOM
2424     if $cc -o try $ccflags $ldflags try.c; then
2425        :
2426     else
2427         if $test X"$despair" = Xyes; then
2428            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2429         fi
2430         $cat >&4 <<EOM         
2431 You need to find a working C compiler.
2432 Either (purchase and) install the C compiler supplied by your OS vendor,
2433 or for a free C compiler try http://gcc.gnu.org/
2434 I cannot continue any further, aborting.
2435 EOM
2436         exit 1
2437     fi
2438     $rm -f try try.*
2439     ;;
2440 esac
2441 EOSC
2442
2443 : determine whether symbolic links are supported
2444 echo " "
2445 $touch blurfl
2446 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2447         echo "Symbolic links are supported." >&4
2448         lns="$ln -s"
2449 else
2450         echo "Symbolic links are NOT supported." >&4
2451         lns="$ln"
2452 fi
2453 $rm -f blurfl sym
2454
2455 : determine whether symbolic links are supported
2456 echo " "
2457 case "$lns" in
2458 *"ln"*" -s")
2459         echo "Checking how to test for symbolic links..." >&4
2460         $lns blurfl sym
2461         if $test "X$issymlink" = X; then
2462                 case "$newsh" in
2463                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2464                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2465                 esac
2466                 if test $? = 0; then
2467                         issymlink="test -h"
2468                 else
2469                         echo "Your builtin 'test -h' may be broken." >&4
2470                         case "$test" in
2471                         /*)     ;;
2472                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2473                                 for p in $pth
2474                                 do
2475                                         if test -f "$p/$test"; then
2476                                                 test="$p/$test"
2477                                                 break
2478                                         fi
2479                                 done
2480                                 ;;
2481                         esac
2482                         case "$test" in
2483                         /*)
2484                                 echo "Trying external '$test -h'." >&4
2485                                 issymlink="$test -h"
2486                                 if $test ! -h sym >/dev/null 2>&1; then
2487                                         echo "External '$test -h' is broken, too." >&4
2488                                         issymlink=''
2489                                 fi
2490                                 ;;
2491                         *)      issymlink='' ;;
2492                         esac
2493                 fi              
2494         fi
2495         if $test "X$issymlink" = X; then
2496                 if $test -L sym 2>/dev/null; then
2497                         issymlink="$test -L"
2498                         echo "The builtin '$test -L' worked." >&4
2499                 fi
2500         fi
2501         if $test "X$issymlink" != X; then
2502                 echo "You can test for symbolic links with '$issymlink'." >&4
2503         else
2504                 echo "I do not know how you can test for symbolic links." >&4
2505         fi
2506         $rm -f blurfl sym
2507         ;;
2508 *)      echo "No symbolic links, so not testing for their testing..." >&4
2509         ;;
2510 esac
2511 echo " "
2512
2513
2514 case "$mksymlinks" in
2515 $define|true|[yY]*)
2516         case "$src" in
2517         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2518                 exit 1
2519                 ;;
2520         *)      case "$lns:$issymlink" in
2521                 *"ln"*" -s:"*"test -"?)
2522                         echo "Creating the symbolic links..." >&4
2523                         echo "(First creating the subdirectories...)" >&4
2524                         cd ..
2525                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2526                                 read directory
2527                                 test -z "$directory" && break
2528                                 mkdir -p $directory
2529                         done
2530                         # Sanity check 1.
2531                         if test ! -d t/base; then
2532                                 echo "Failed to create the subdirectories.  Aborting." >&4
2533                                 exit 1
2534                         fi
2535                         echo "(Then creating the symlinks...)" >&4
2536                         awk '{print $1}' $src/MANIFEST | while true; do
2537                                 read filename
2538                                 test -z "$filename" && break
2539                                 if test -f $filename; then
2540                                         if $issymlink $filename; then
2541                                                 rm -f $filename
2542                                         fi
2543                                 fi
2544                                 if test -f $filename; then
2545                                         echo "$filename already exists, not symlinking."
2546                                 else
2547                                         ln -s $src/$filename $filename
2548                                 fi
2549                         done
2550                         # Sanity check 2.
2551                         if test ! -f t/base/lex.t; then
2552                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2553                                 exit 1
2554                         fi
2555                         cd UU
2556                         ;;
2557                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2558                         ;;
2559                 esac
2560                 ;;
2561         esac
2562         ;;
2563 esac
2564
2565
2566 case "$usecrosscompile" in
2567 $define|true|[yY]*)
2568         $echo "Cross-compiling..."
2569         croak=''
2570         case "$cc" in
2571         *-*-gcc) # A cross-compiling gcc, probably.
2572             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2573             ar=$targetarch-ar
2574             # leave out ld, choosing it is more complex
2575             nm=$targetarch-nm
2576             ranlib=$targetarch-ranlib
2577             $echo 'extern int foo;' > try.c
2578             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2579             shift
2580             if $test $# -gt 0; then
2581                 incpth="$incpth $*"
2582                 incpth="`$echo $incpth|$sed 's/^ //'`"
2583                 echo "Guessing incpth '$incpth'." >&4
2584                 for i in $*; do
2585                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2586                     if $test -d $j; then
2587                         libpth="$libpth $j"
2588                     fi
2589                 done   
2590                 libpth="`$echo $libpth|$sed 's/^ //'`"
2591                 echo "Guessing libpth '$libpth'." >&4
2592             fi
2593             $rm -f try.c
2594             ;;
2595         esac
2596         case "$targetarch" in
2597         '') echo "Targetarch not defined." >&4; croak=y ;;
2598         *)  echo "Using targetarch $targetarch." >&4 ;;
2599         esac
2600         case "$incpth" in
2601         '') echo "Incpth not defined." >&4; croak=y ;;
2602         *)  echo "Using incpth '$incpth'." >&4 ;;
2603         esac
2604         case "$libpth" in
2605         '') echo "Libpth not defined." >&4; croak=y ;;
2606         *)  echo "Using libpth '$libpth'." >&4 ;;
2607         esac
2608         case "$usrinc" in
2609         '') for i in $incpth; do
2610                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2611                     usrinc=$i
2612                     echo "Guessing usrinc $usrinc." >&4
2613                     break
2614                 fi
2615             done
2616             case "$usrinc" in
2617             '') echo "Usrinc not defined." >&4; croak=y ;;
2618             esac
2619             ;;
2620         *)  echo "Using usrinc $usrinc." >&4 ;;
2621         esac
2622         case "$targethost" in
2623         '') echo "Targethost not defined." >&4; croak=y ;;
2624         *)  echo "Using targethost $targethost." >&4
2625         esac
2626         locincpth=' '
2627         loclibpth=' '
2628         case "$croak" in
2629         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2630         esac
2631         case "$src" in
2632         /*) run=$src/Cross/run
2633             targetmkdir=$src/Cross/mkdir
2634             to=$src/Cross/to
2635             from=$src/Cross/from
2636             ;;
2637         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2638             run=$pwd/Cross/run
2639             targetmkdir=$pwd/Cross/mkdir
2640             to=$pwd/Cross/to
2641             from=$pwd/Cross/from
2642             ;;
2643         esac
2644         case "$targetrun" in
2645         '') targetrun=ssh ;;
2646         esac
2647         case "$targetto" in
2648         '') targetto=scp ;;
2649         esac
2650         case "$targetfrom" in
2651         '') targetfrom=scp ;;
2652         esac
2653         run=$run-$targetrun
2654         to=$to-$targetto
2655         from=$from-$targetfrom
2656         case "$targetdir" in
2657         '')  targetdir=/tmp
2658              echo "Guessing targetdir $targetdir." >&4
2659              ;;
2660         esac
2661         case "$targetuser" in
2662         '')  targetuser=root
2663              echo "Guessing targetuser $targetuser." >&4
2664              ;;
2665         esac
2666         case "$targetfrom" in
2667         scp)    q=-q ;;
2668         *)      q='' ;;
2669         esac
2670         case "$targetrun" in
2671         ssh|rsh)
2672             cat >$run <<EOF
2673 #!/bin/sh
2674 case "\$1" in
2675 -cwd)
2676   shift
2677   cwd=\$1
2678   shift
2679   ;;
2680 esac
2681 case "\$cwd" in
2682 '') cwd=$targetdir ;;
2683 esac
2684 exe=\$1
2685 shift
2686 if $test ! -f \$exe.xok; then
2687   $to \$exe
2688   $touch \$exe.xok
2689 fi
2690 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2691 EOF
2692             ;;
2693         *)  echo "Unknown targetrun '$targetrun'" >&4
2694             exit 1
2695             ;;
2696         esac
2697         case "$targetmkdir" in
2698         */Cross/mkdir)
2699             cat >$targetmkdir <<EOF
2700 #!/bin/sh
2701 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2702 EOF
2703             $chmod a+rx $targetmkdir
2704             ;;
2705         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2706             exit 1
2707             ;;
2708         esac
2709         case "$targetto" in
2710         scp|rcp)
2711             cat >$to <<EOF
2712 #!/bin/sh
2713 for f in \$@
2714 do
2715   case "\$f" in
2716   /*)
2717     $targetmkdir \`dirname \$f\`
2718     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2719     ;;
2720   *)
2721     $targetmkdir $targetdir/\`dirname \$f\`
2722     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2723     ;;
2724   esac
2725 done
2726 exit 0
2727 EOF
2728             ;;
2729         cp) cat >$to <<EOF
2730 #!/bin/sh
2731 for f in \$@
2732 do
2733   case "\$f" in
2734   /*)
2735     $mkdir -p $targetdir/\`dirname \$f\`
2736     $cp \$f $targetdir/\$f || exit 1
2737     ;;
2738   *)
2739     $targetmkdir $targetdir/\`dirname \$f\`
2740     $cp \$f $targetdir/\$f || exit 1
2741     ;;
2742   esac
2743 done
2744 exit 0
2745 EOF
2746             ;;
2747         *)  echo "Unknown targetto '$targetto'" >&4
2748             exit 1
2749             ;;
2750         esac
2751         case "$targetfrom" in
2752         scp|rcp)
2753           cat >$from <<EOF
2754 #!/bin/sh
2755 for f in \$@
2756 do
2757   $rm -f \$f
2758   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2759 done
2760 exit 0
2761 EOF
2762             ;;
2763         cp) cat >$from <<EOF
2764 #!/bin/sh
2765 for f in \$@
2766 do
2767   $rm -f \$f
2768   cp $targetdir/\$f . || exit 1
2769 done
2770 exit 0
2771 EOF
2772             ;;
2773         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2774             exit 1
2775             ;;
2776         esac
2777         if $test ! -f $run; then
2778             echo "Target 'run' script '$run' not found." >&4
2779         else
2780             $chmod a+rx $run
2781         fi
2782         if $test ! -f $to; then
2783             echo "Target 'to' script '$to' not found." >&4
2784         else
2785             $chmod a+rx $to
2786         fi
2787         if $test ! -f $from; then
2788             echo "Target 'from' script '$from' not found." >&4
2789         else
2790             $chmod a+rx $from
2791         fi
2792         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2793             exit 1
2794         fi
2795         cat >&4 <<EOF
2796 Using '$run' for remote execution,
2797 and '$from' and '$to'
2798 for remote file transfer.
2799 EOF
2800         ;;
2801 *)      run=''
2802         to=:
2803         from=:
2804         usecrosscompile='undef'
2805         targetarch=''
2806         ;;
2807 esac
2808
2809 : see whether [:lower:] and [:upper:] are supported character classes
2810 echo " "
2811 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2812 ABYZ)
2813         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2814         up='[:upper:]'
2815         low='[:lower:]'
2816         ;;
2817 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2818         # (0xc9 and 0xd1), therefore that is a nice testing point.
2819         if test "X$up" = X -o "X$low" = X; then
2820             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2821             ij) up='[A-Z]'
2822                 low='[a-z]'
2823                 ;;
2824             esac
2825         fi
2826         if test "X$up" = X -o "X$low" = X; then
2827             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2828             ij) up='A-Z'
2829                 low='a-z'
2830                 ;;
2831             esac
2832         fi
2833         if test "X$up" = X -o "X$low" = X; then
2834             case "`echo IJ | od -x 2>/dev/null`" in
2835             *C9D1*|*c9d1*)
2836                 echo "Hey, this might be EBCDIC." >&4
2837                 if test "X$up" = X -o "X$low" = X; then
2838                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2839                     ij) up='[A-IJ-RS-Z]'
2840                         low='[a-ij-rs-z]'
2841                         ;;
2842                     esac
2843                 fi
2844                 if test "X$up" = X -o "X$low" = X; then
2845                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2846                     ij) up='A-IJ-RS-Z'
2847                         low='a-ij-rs-z'
2848                         ;;
2849                     esac
2850                 fi
2851                 ;;
2852             esac
2853         fi
2854 esac
2855 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2856 ij)
2857     echo "Using $up and $low to convert case." >&4
2858     ;;
2859 *)
2860     echo "I don't know how to translate letters from upper to lower case." >&4
2861     echo "Your tr is not acting any way I know of." >&4
2862     exit 1
2863     ;;
2864 esac
2865 : set up the translation script tr, must be called with ./tr of course
2866 cat >tr <<EOSC
2867 $startsh
2868 case "\$1\$2" in
2869 '[A-Z][a-z]') exec $tr '$up' '$low';;
2870 '[a-z][A-Z]') exec $tr '$low' '$up';;
2871 esac
2872 exec $tr "\$@"
2873 EOSC
2874 chmod +x tr
2875 $eunicefix tr
2876
2877 : Try to determine whether config.sh was made on this system
2878 case "$config_sh" in
2879 '')
2880 myuname=`$uname -a 2>/dev/null`
2881 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2882 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2883 # because the A-Z/a-z are not consecutive.
2884 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2885         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2886 newmyuname="$myuname"
2887 dflt=n
2888 case "$knowitall" in
2889 '')
2890         if test -f ../config.sh; then
2891                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2892                         eval "`grep myuname= ../config.sh`"
2893                 fi
2894                 if test "X$myuname" = "X$newmyuname"; then
2895                         dflt=y
2896                 fi
2897         fi
2898         ;;
2899 *) dflt=y;;
2900 esac
2901
2902 : Get old answers from old config file if Configure was run on the
2903 : same system, otherwise use the hints.
2904 hint=default
2905 cd ..
2906 if test -f config.sh; then
2907         echo " "
2908         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2909         . UU/myread
2910         case "$ans" in
2911         n*|N*) echo "OK, I'll ignore it."
2912                 mv config.sh config.sh.old
2913                 myuname="$newmyuname"
2914                 ;;
2915         *)  echo "Fetching default answers from your old config.sh file..." >&4
2916                 tmp_n="$n"
2917                 tmp_c="$c"
2918                 tmp_sh="$sh"
2919                 . ./config.sh
2920                 cp config.sh UU
2921                 n="$tmp_n"
2922                 c="$tmp_c"
2923                 : Older versions did not always set $sh.  Catch re-use of such
2924                 : an old config.sh.
2925                 case "$sh" in
2926                 '') sh="$tmp_sh" ;;
2927                 esac
2928                 hint=previous
2929                 ;;
2930         esac
2931 fi
2932 . ./UU/checkcc
2933 if test ! -f config.sh; then
2934         $cat <<EOM
2935
2936 First time through, eh?  I have some defaults handy for some systems
2937 that need some extra help getting the Configure answers right:
2938
2939 EOM
2940         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2941         dflt=''
2942         : Half the following guesses are probably wrong... If you have better
2943         : tests or hints, please send them to perlbug@perl.org
2944         : The metaconfig authors would also appreciate a copy...
2945         $test -f /irix && osname=irix
2946         $test -f /xenix && osname=sco_xenix
2947         $test -f /dynix && osname=dynix
2948         $test -f /dnix && osname=dnix
2949         $test -f /lynx.os && osname=lynxos
2950         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2951         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2952         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2953         $test -f /bin/mips && /bin/mips && osname=mips
2954         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2955                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2956         $test -d /usr/apollo/bin && osname=apollo
2957         $test -f /etc/saf/_sactab && osname=svr4
2958         $test -d /usr/include/minix && osname=minix
2959         $test -f /system/gnu_library/bin/ar.pm && osname=vos
2960         if $test -d /MachTen -o -d /MachTen_Folder; then
2961                 osname=machten
2962                 if $test -x /sbin/version; then
2963                         osvers=`/sbin/version | $awk '{print $2}' |
2964                         $sed -e 's/[A-Za-z]$//'`
2965                 elif $test -x /usr/etc/version; then
2966                         osvers=`/usr/etc/version | $awk '{print $2}' |
2967                         $sed -e 's/[A-Za-z]$//'`
2968                 else
2969                         osvers="$2.$3"
2970                 fi
2971         fi
2972
2973         $test -f /sys/posix.dll &&
2974                 $test -f /usr/bin/what &&
2975                 set X `/usr/bin/what /sys/posix.dll` &&
2976                 $test "$3" = UWIN &&
2977                 osname=uwin &&
2978                 osvers="$5"
2979
2980         if $test -f $uname; then
2981                 set X $myuname
2982                 shift
2983
2984                 case "$5" in
2985                 fps*) osname=fps ;;
2986                 mips*)
2987                         case "$4" in
2988                         umips) osname=umips ;;
2989                         *) osname=mips ;;
2990                         esac;;
2991                 [23]100) osname=mips ;;
2992                 next*) osname=next ;;
2993                 i386*)
2994                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2995                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2996                                 osname='sco'
2997                                 osvers=$tmp
2998                         elif $test -f /etc/kconfig; then
2999                                 osname=isc
3000                                 if test "$lns" = "$ln -s"; then
3001                                         osvers=4
3002                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3003                                         osvers=3
3004                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3005                                         osvers=2
3006                                 fi
3007                         fi
3008                         tmp=''
3009                         ;;
3010                 pc*)
3011                         if test -n "$DJGPP"; then
3012                                 osname=dos
3013                                 osvers=djgpp
3014                         fi
3015                         ;;
3016                 esac
3017
3018                 case "$1" in
3019                 aix) osname=aix
3020                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3021                         case "$tmp" in
3022                         'not found') osvers="$4"."$3" ;;
3023                         '<3240'|'<>3240') osvers=3.2.0 ;;
3024                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3025                         '=3250'|'>3250') osvers=3.2.5 ;;
3026                         *) osvers=$tmp;;
3027                         esac
3028                         ;;
3029                 bsd386) osname=bsd386
3030                         osvers=`$uname -r`
3031                         ;;
3032                 cygwin*) osname=cygwin
3033                         osvers="$3"
3034                         ;;
3035                 *dc.osx) osname=dcosx
3036                         osvers="$3"
3037                         ;;
3038                 dnix) osname=dnix
3039                         osvers="$3"
3040                         ;;
3041                 domainos) osname=apollo
3042                         osvers="$3"
3043                         ;;
3044                 dgux) osname=dgux 
3045                         osvers="$3"
3046                         ;;
3047                 dynixptx*) osname=dynixptx
3048                         osvers=`echo "$4"|sed 's/^v//'`
3049                         ;;
3050                 freebsd) osname=freebsd 
3051                         osvers="$3" ;;
3052                 genix) osname=genix ;;
3053                 hp*) osname=hpux 
3054                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3055                         ;;
3056                 irix*) osname=irix
3057                         case "$3" in
3058                         4*) osvers=4 ;;
3059                         5*) osvers=5 ;;
3060                         *)      osvers="$3" ;;
3061                         esac
3062                         ;;
3063                 linux) osname=linux
3064                         case "$3" in
3065                         *)      osvers="$3" ;;
3066                         esac
3067                         ;;
3068                 MiNT) osname=mint
3069                         ;;
3070                 netbsd*) osname=netbsd
3071                         osvers="$3"
3072                         ;;
3073                 news-os) osvers="$3"
3074                         case "$3" in
3075                         4*) osname=newsos4 ;;
3076                         *) osname=newsos ;;
3077                         esac
3078                         ;;
3079                 next*) osname=next ;;
3080                 nonstop-ux) osname=nonstopux ;;
3081                 openbsd) osname=openbsd
3082                         osvers="$3"
3083                         ;;
3084                 POSIX-BC | posix-bc ) osname=posix-bc
3085                         osvers="$3"
3086                         ;;
3087                 powerux | power_ux | powermax_os | powermaxos | \
3088                 powerunix | power_unix) osname=powerux
3089                         osvers="$3"
3090                         ;;
3091                 qnx) osname=qnx
3092                         osvers="$4"
3093                         ;;
3094                 solaris) osname=solaris
3095                         case "$3" in
3096                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3097                         *)      osvers="$3" ;;
3098                         esac
3099                         ;;
3100                 sunos) osname=sunos
3101                         case "$3" in
3102                         5*) osname=solaris
3103                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3104                         *)      osvers="$3" ;;
3105                         esac
3106                         ;;
3107                 titanos) osname=titanos
3108                         case "$3" in
3109                         1*) osvers=1 ;;
3110                         2*) osvers=2 ;;
3111                         3*) osvers=3 ;;
3112                         4*) osvers=4 ;;
3113                         *)      osvers="$3" ;;
3114                         esac
3115                         ;;
3116                 ultrix) osname=ultrix
3117                         osvers="$3"
3118                         ;;
3119                 osf1|mls+)      case "$5" in
3120                                 alpha)
3121                                         osname=dec_osf
3122                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3123                                         case "$osvers" in
3124                                         [1-9].[0-9]*) ;;
3125                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3126                                         esac
3127                                         ;;
3128                         hp*)    osname=hp_osf1  ;;
3129                         mips)   osname=mips_osf1 ;;
3130                         esac
3131                         ;;
3132                 unixware) osname=svr5
3133                         osvers="$4"
3134                         ;;
3135                 uts)    osname=uts
3136                         osvers="$3"
3137                         ;;
3138                 vos) osvers="$3"
3139                         ;;
3140                 $2) case "$osname" in
3141                         *isc*) ;;
3142                         *freebsd*) ;;
3143                         svr*)
3144                                 : svr4.x or possibly later
3145                                 case "svr$3" in 
3146                                 ${osname}*)
3147                                         osname=svr$3
3148                                         osvers=$4
3149                                         ;;
3150                                 esac
3151                                 case "$osname" in
3152                                 svr4.0)
3153                                         : Check for ESIX
3154                                         if test -f /stand/boot ; then
3155                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3156                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3157                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3158                                                         if test -n "$isesix"; then
3159                                                                 osname=esix4
3160                                                         fi
3161                                                 fi
3162                                         fi
3163                                         ;;
3164                                 esac
3165                                 ;;
3166                         *)      if test -f /etc/systemid; then
3167                                         osname=sco
3168                                         set `echo $3 | $sed 's/\./ /g'` $4
3169                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3170                                                 osvers=$1.$2.$3
3171                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3172                                                 osvers=$1.$2
3173                                         elif $test -f $src/hints/sco_$1.sh; then
3174                                                 osvers=$1
3175                                         fi
3176                                 else
3177                                         case "$osname" in
3178                                         '') : Still unknown.  Probably a generic Sys V.
3179                                                 osname="sysv"
3180                                                 osvers="$3"
3181                                                 ;;
3182                                         esac
3183                                 fi
3184                                 ;;
3185                         esac
3186                         ;;
3187                 *)      case "$osname" in
3188                         '') : Still unknown.  Probably a generic BSD.
3189                                 osname="$1"
3190                                 osvers="$3"
3191                                 ;;
3192                         esac
3193                         ;;
3194                 esac
3195         else
3196                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3197                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3198                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3199                                 osname=news_os
3200                         fi
3201                         $rm -f UU/kernel.what
3202                 elif test -d c:/.; then
3203                         set X $myuname
3204                         osname=os2
3205                         osvers="$5"
3206                 fi
3207         fi
3208         
3209         case "$targetarch" in
3210         '') ;;
3211         *)  hostarch=$osname
3212             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3213             osvers=''
3214             ;;
3215         esac
3216
3217         : Now look for a hint file osname_osvers, unless one has been
3218         : specified already.
3219         case "$hintfile" in
3220         ''|' ')
3221                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3222                 : Also try without trailing minor version numbers.
3223                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3224                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3225                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3226                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3227                 case "$file" in
3228                 '') dflt=none ;;
3229                 *)  case "$osvers" in
3230                         '') dflt=$file
3231                                 ;;
3232                         *)  if $test -f $src/hints/$file.sh ; then
3233                                         dflt=$file
3234                                 elif $test -f $src/hints/$xfile.sh ; then
3235                                         dflt=$xfile
3236                                 elif $test -f $src/hints/$xxfile.sh ; then
3237                                         dflt=$xxfile
3238                                 elif $test -f $src/hints/$xxxfile.sh ; then
3239                                         dflt=$xxxfile
3240                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3241                                         dflt=$xxxxfile
3242                                 elif $test -f "$src/hints/${osname}.sh" ; then
3243                                         dflt="${osname}"
3244                                 else
3245                                         dflt=none
3246                                 fi
3247                                 ;;
3248                         esac
3249                         ;;
3250                 esac
3251                 if $test -f Policy.sh ; then
3252                         case "$dflt" in
3253                         *Policy*) ;;
3254                         none) dflt="Policy" ;;
3255                         *) dflt="Policy $dflt" ;;
3256                         esac
3257                 fi
3258                 ;;
3259         *)
3260                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3261                 ;;
3262         esac
3263
3264         if $test -f Policy.sh ; then
3265                 $cat <<EOM
3266
3267 There's also a Policy hint file available, which should make the
3268 site-specific (policy) questions easier to answer.
3269 EOM
3270
3271         fi
3272
3273         $cat <<EOM
3274
3275 You may give one or more space-separated answers, or "none" if appropriate.
3276 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3277 is a good thing.  DO NOT give a wrong version or a wrong OS.
3278
3279 EOM
3280
3281         rp="Which of these apply, if any?"
3282         . UU/myread
3283         tans=$ans
3284         for file in $tans; do
3285                 if $test X$file = XPolicy -a -f Policy.sh; then
3286                         . Policy.sh
3287                         $cat Policy.sh >> UU/config.sh
3288                 elif $test -f $src/hints/$file.sh; then
3289                         . $src/hints/$file.sh
3290                         $cat $src/hints/$file.sh >> UU/config.sh
3291                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3292                         : nothing
3293                 else
3294                         : Give one chance to correct a possible typo.
3295                         echo "$file.sh does not exist"
3296                         dflt=$file
3297                         rp="hint to use instead?"
3298                         . UU/myread
3299                         for file in $ans; do
3300                                 if $test -f "$src/hints/$file.sh"; then
3301                                         . $src/hints/$file.sh
3302                                         $cat $src/hints/$file.sh >> UU/config.sh
3303                                 elif $test X$ans = X -o X$ans = Xnone ; then
3304                                         : nothing
3305                                 else
3306                                         echo "$file.sh does not exist -- ignored."
3307                                 fi
3308                         done
3309                 fi
3310         done
3311
3312         hint=recommended
3313         : Remember our hint file for later.
3314         if $test -f "$src/hints/$file.sh" ; then
3315                 hintfile="$file"
3316         else
3317                 hintfile=''
3318         fi
3319 fi
3320 cd UU
3321 ;;
3322 *)
3323         echo " "
3324         echo "Fetching default answers from $config_sh..." >&4
3325         tmp_n="$n"
3326         tmp_c="$c"
3327         cd ..
3328         cp $config_sh config.sh 2>/dev/null
3329         chmod +w config.sh
3330         . ./config.sh
3331         cd UU
3332         cp ../config.sh .
3333         n="$tmp_n"
3334         c="$tmp_c"
3335         hint=previous
3336         ;;
3337 esac
3338 test "$override" && . ./optdef.sh
3339
3340 : Restore computed paths
3341 for file in $loclist $trylist; do
3342         eval $file="\$_$file"
3343 done
3344
3345 cat << EOM
3346
3347 Configure uses the operating system name and version to set some defaults.
3348 The default value is probably right if the name rings a bell. Otherwise,
3349 since spelling matters for me, either accept the default or answer "none"
3350 to leave it blank.
3351
3352 EOM
3353 case "$osname" in
3354         ''|' ')
3355                 case "$hintfile" in
3356                 ''|' '|none) dflt=none ;;
3357                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3358                 esac
3359                 ;;
3360         *) dflt="$osname" ;;
3361 esac
3362 rp="Operating system name?"
3363 . ./myread
3364 case "$ans" in
3365 none)  osname='' ;;
3366 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3367 esac
3368 echo " "
3369 case "$osvers" in
3370         ''|' ')
3371                 case "$hintfile" in
3372                 ''|' '|none) dflt=none ;;
3373                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3374                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3375                         case "$dflt" in
3376                         ''|' ') dflt=none ;;
3377                         esac
3378                         ;;
3379                 esac
3380                 ;;
3381         *) dflt="$osvers" ;;
3382 esac
3383 rp="Operating system version?"
3384 . ./myread
3385 case "$ans" in
3386 none)  osvers='' ;;
3387 *) osvers="$ans" ;;
3388 esac
3389
3390
3391 . ./posthint.sh
3392
3393 : who configured the system
3394 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3395 cf_by=`(logname) 2>/dev/null`
3396 case "$cf_by" in
3397 "")
3398         cf_by=`(whoami) 2>/dev/null`
3399         case "$cf_by" in
3400         "") cf_by=unknown ;;
3401         esac ;;
3402 esac
3403
3404 : set up the script used to warn in case of inconsistency
3405 cat <<EOS >whoa
3406 $startsh
3407 EOS
3408 cat <<'EOSC' >>whoa
3409 dflt=y
3410 echo " "
3411 echo "*** WHOA THERE!!! ***" >&4
3412 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3413 rp="    Keep the $hint value?"
3414 . ./myread
3415 case "$ans" in
3416 y) td=$was; tu=$was;;
3417 esac
3418 EOSC
3419
3420 : function used to set $1 to $val
3421 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3422 case "$val$was" in
3423 $define$undef) . ./whoa; eval "$var=\$td";;
3424 $undef$define) . ./whoa; eval "$var=\$tu";;
3425 *) eval "$var=$val";;
3426 esac'
3427
3428 case "$usethreads" in
3429 $define|true|[yY]*)     dflt='y';;
3430 *)     # Catch case where user specified ithreads or 5005threads but
3431        # forgot -Dusethreads (A.D. 4/2002)
3432        case "$useithreads$use5005threads" in
3433        *$define*)      dflt='y' ;;
3434        *)      dflt='n';;
3435        esac
3436        ;;
3437 esac
3438 cat <<EOM
3439
3440 Perl can be built to take advantage of threads on some systems.
3441 To do so, Configure can be run with -Dusethreads.
3442
3443 Note that Perl built with threading support runs slightly slower
3444 and uses more memory than plain Perl. The current implementation
3445 is believed to be stable, but it is fairly new, and so should be
3446 treated with caution.
3447
3448 If this doesn't make any sense to you, just accept the default '$dflt'.
3449 EOM
3450 rp='Build a threading Perl?'
3451 . ./myread
3452 case "$ans" in
3453 y|Y)    val="$define" ;;
3454 *)      val="$undef" ;;
3455 esac
3456 set usethreads
3457 eval $setvar
3458
3459 case "$usethreads" in
3460 $define)
3461         $cat <<EOM
3462
3463 Since release 5.6, Perl has had two different threading implementations,
3464 the newer interpreter-based version (ithreads) with one interpreter per
3465 thread, and the older 5.005 version (5005threads).
3466 The 5005threads version is effectively unmaintained and will probably be
3467 removed in Perl 5.10, so there should be no need to build a Perl using it
3468 unless needed for backwards compatibility with some existing 5.005threads
3469 code.
3470
3471 EOM
3472         : Default to ithreads unless overridden on command line or with
3473         : old config.sh
3474         dflt='y'
3475         case "$use5005threads" in
3476                 $define|true|[yY]*) dflt='n';;
3477         esac
3478         case "$useithreads" in
3479                 $undef|false|[nN]*) dflt='n';;
3480         esac
3481         rp='Use the newer interpreter-based ithreads?'
3482         . ./myread
3483         case "$ans" in
3484         y|Y)    val="$define" ;;
3485         *)      val="$undef" ;;
3486         esac
3487         set useithreads
3488         eval $setvar
3489         : Now set use5005threads to the opposite value.
3490         case "$useithreads" in
3491         $define) val="$undef" ;;
3492         *) val="$define" ;;
3493         esac
3494         set use5005threads
3495         eval $setvar
3496         ;;
3497 *)
3498         useithreads="$undef"
3499         use5005threads="$undef"
3500         ;;
3501 esac
3502
3503 case "$useithreads$use5005threads" in
3504 "$define$define")
3505         $cat >&4 <<EOM
3506
3507 You cannot have both the ithreads and the 5.005 threads enabled
3508 at the same time.  Disabling the 5.005 threads since they are
3509 much less stable than the ithreads.
3510
3511 EOM
3512         use5005threads="$undef"
3513         ;;
3514 esac
3515
3516 case "$d_oldpthreads" in
3517 '')     : Configure tests would be welcome here.  For now, assume undef.
3518         val="$undef" ;;
3519 *)      val="$d_oldpthreads" ;;
3520 esac
3521 set d_oldpthreads
3522 eval $setvar
3523
3524
3525 case "$usethreads" in
3526 "$define"|true|[yY]*)
3527 : Look for a hint-file generated 'call-back-unit'.  If the
3528 : user has specified that a threading perl is to be built,
3529 : we may need to set or change some other defaults.
3530         if $test -f usethreads.cbu; then
3531                 echo "Your platform has some specific hints for threaded builds, using them..."
3532                 . ./usethreads.cbu
3533         else
3534                 $cat <<EOM
3535 (Your platform doesn't have any specific hints for threaded builds.
3536  Assuming POSIX threads, then.)
3537 EOM
3538         fi
3539         ;;
3540 esac
3541
3542 cat <<EOM
3543
3544 Perl can be built so that multiple Perl interpreters can coexist
3545 within the same Perl executable.
3546 EOM
3547
3548 case "$useithreads" in
3549 $define)
3550         cat <<EOM
3551 This multiple interpreter support is required for interpreter-based threads.
3552 EOM
3553         val="$define"
3554         ;;
3555 *)      case "$usemultiplicity" in
3556         $define|true|[yY]*)     dflt='y';;
3557         *) dflt='n';;
3558         esac
3559         echo " "
3560         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3561         rp='Build Perl for multiplicity?'
3562         . ./myread
3563         case "$ans" in
3564         y|Y)    val="$define" ;;
3565         *)      val="$undef" ;;
3566         esac
3567         ;;
3568 esac
3569 set usemultiplicity
3570 eval $setvar
3571
3572
3573 case "$usemorebits" in
3574 "$define"|true|[yY]*)
3575         use64bitint="$define"
3576         uselongdouble="$define"
3577         usemorebits="$define"
3578         ;;
3579 *)      usemorebits="$undef"
3580         ;;
3581 esac
3582
3583 : make some quick guesses about what we are up against
3584 echo " "
3585 $echo $n "Hmm...  $c"
3586 echo exit 1 >bsd
3587 echo exit 1 >usg
3588 echo exit 1 >v7
3589 echo exit 1 >osf1
3590 echo exit 1 >eunice
3591 echo exit 1 >xenix
3592 echo exit 1 >venix
3593 echo exit 1 >os2
3594 d_bsd="$undef"
3595 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3596 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3597 then
3598         echo "Looks kind of like an OSF/1 system, but we'll see..."
3599         echo exit 0 >osf1
3600 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3601         xxx=`./loc addbib blurfl $pth`
3602         if $test -f $xxx; then
3603         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3604                 echo exit 0 >bsd
3605                 echo exit 0 >usg
3606         else
3607                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3608                         echo "Looks kind of like an extended USG system, but we'll see..."
3609                 else
3610                         echo "Looks kind of like a USG system, but we'll see..."
3611                 fi
3612                 echo exit 0 >usg
3613         fi
3614 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3615         echo "Looks kind of like a BSD system, but we'll see..."
3616         d_bsd="$define"
3617         echo exit 0 >bsd
3618 else
3619         echo "Looks kind of like a Version 7 system, but we'll see..."
3620         echo exit 0 >v7
3621 fi
3622 case "$eunicefix" in
3623 *unixtovms*)
3624         $cat <<'EOI'
3625 There is, however, a strange, musty smell in the air that reminds me of
3626 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3627 EOI
3628         echo exit 0 >eunice
3629         d_eunice="$define"
3630 : it so happens the Eunice I know will not run shell scripts in Unix format
3631         ;;
3632 *)
3633         echo " "
3634         echo "Congratulations.  You aren't running Eunice."
3635         d_eunice="$undef"
3636         ;;
3637 esac
3638 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3639 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3640 : semicolon as a patch separator
3641 case "$p_" in
3642 :) ;;
3643 *)
3644         $cat <<'EOI'
3645 I have the feeling something is not exactly right, however...don't tell me...
3646 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3647 (Or you may be running DOS with DJGPP.)
3648 EOI
3649         echo exit 0 >os2
3650         ;;
3651 esac
3652 if test -f /xenix; then
3653         echo "Actually, this looks more like a XENIX system..."
3654         echo exit 0 >xenix
3655         d_xenix="$define"
3656 else
3657         echo " "
3658         echo "It's not Xenix..."
3659         d_xenix="$undef"
3660 fi
3661 chmod +x xenix
3662 $eunicefix xenix
3663 if test -f /venix; then
3664         echo "Actually, this looks more like a VENIX system..."
3665         echo exit 0 >venix
3666 else
3667         echo " "
3668         if ./xenix; then
3669                 : null
3670         else
3671                 echo "Nor is it Venix..."
3672         fi
3673 fi
3674 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3675 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3676 $rm -f foo
3677
3678 case "$cc" in
3679 '') dflt=cc;;
3680 *) dflt="$cc";;
3681 esac
3682 rp="Use which C compiler?"
3683 . ./myread
3684 cc="$ans"
3685
3686 : See if they have not cc but they do have gcc
3687 . ./trygcc
3688 : Look for a hint-file generated 'call-back-unit'.  Now that the
3689 : user has specified the compiler, we may need to set or change some
3690 : other defaults.
3691 if $test -f cc.cbu; then
3692     . ./cc.cbu
3693 fi
3694 . ./checkcc
3695
3696 echo " "
3697 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3698 $cat >try.c <<EOM
3699 #include <stdio.h>
3700 int main() {
3701 #ifdef __GNUC__
3702 #ifdef __VERSION__
3703         printf("%s\n", __VERSION__);
3704 #else
3705         printf("%s\n", "1");
3706 #endif
3707 #endif
3708         exit(0);
3709 }
3710 EOM
3711 if $cc -o try $ccflags $ldflags try.c; then
3712         gccversion=`$run ./try`
3713         case "$gccversion" in
3714         '') echo "You are not using GNU cc." ;;
3715         *)  echo "You are using GNU cc $gccversion."
3716             ccname=gcc  
3717             ;;
3718         esac
3719 else
3720         echo " "
3721         echo "*** WHOA THERE!!! ***" >&4
3722         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3723         case "$knowitall" in
3724         '')
3725         echo "    You'd better start hunting for one and let me know about it." >&4
3726                 exit 1
3727                 ;;
3728         esac
3729 fi
3730 $rm -f try try.*
3731 case "$gccversion" in
3732 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3733 esac
3734 case "$gccversion" in
3735 '') gccosandvers='' ;;
3736 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3737    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3738    gccshortvers=''
3739    case "$gccosandvers" in
3740    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3741    $osname$osvers) ;; # looking good
3742    $osname*) cat <<EOM >&4
3743
3744 *** WHOA THERE!!! ***
3745
3746     Your gcc has not been compiled for the exact release of
3747     your operating system ($gccosandvers versus $osname$osvers).
3748
3749     In general it is a good idea to keep gcc synchronized with
3750     the operating system because otherwise serious problems
3751     may ensue when trying to compile software, like Perl.
3752
3753     I'm trying to be optimistic here, though, and will continue.
3754     If later during the configuration and build icky compilation
3755     problems appear (headerfile conflicts being the most common
3756     manifestation), I suggest reinstalling the gcc to match
3757     your operating system release.
3758
3759 EOM
3760       ;;
3761    *) gccosandvers='' ;; # failed to parse, better be silent
3762    esac
3763    ;;
3764 esac
3765 case "$ccname" in
3766 '') ccname="$cc" ;;
3767 esac
3768
3769
3770 : decide how portable to be.  Allow command line overrides.
3771 case "$d_portable" in
3772 "$undef") ;;
3773 *)      d_portable="$define" ;;
3774 esac
3775
3776 : set up shell script to do ~ expansion
3777 cat >filexp <<EOSS
3778 $startsh
3779 : expand filename
3780 case "\$1" in
3781  ~/*|~)
3782         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3783         ;;
3784  ~*)
3785         if $test -f /bin/csh; then
3786                 /bin/csh -f -c "glob \$1"
3787                 failed=\$?
3788                 echo ""
3789                 exit \$failed
3790         else
3791                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3792                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3793                 if $test ! -d "\$dir"; then
3794                         me=\`basename \$0\`
3795                         echo "\$me: can't locate home directory for: \$name" >&2
3796                         exit 1
3797                 fi
3798                 case "\$1" in
3799                 */*)
3800                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3801                         ;;
3802                 *)
3803                         echo \$dir
3804                         ;;
3805                 esac
3806         fi
3807         ;;
3808 *)
3809         echo \$1
3810         ;;
3811 esac
3812 EOSS
3813 chmod +x filexp
3814 $eunicefix filexp
3815
3816 : now set up to get a file name
3817 cat <<EOS >getfile
3818 $startsh
3819 EOS
3820 cat <<'EOSC' >>getfile
3821 tilde=''
3822 fullpath=''
3823 already=''
3824 skip=''
3825 none_ok=''
3826 exp_file=''
3827 nopath_ok=''
3828 orig_rp="$rp"
3829 orig_dflt="$dflt"
3830 case "$gfpth" in
3831 '') gfpth='.' ;;
3832 esac
3833
3834 case "$fn" in
3835 *\(*)
3836         : getfile will accept an answer from the comma-separated list
3837         : enclosed in parentheses even if it does not meet other criteria.
3838         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3839         fn=`echo $fn | sed 's/(.*)//'`
3840         ;;
3841 esac
3842
3843 case "$fn" in
3844 *:*)
3845         loc_file=`expr $fn : '.*:\(.*\)'`
3846         fn=`expr $fn : '\(.*\):.*'`
3847         ;;
3848 esac
3849
3850 case "$fn" in
3851 *~*) tilde=true;;
3852 esac
3853 case "$fn" in
3854 */*) fullpath=true;;
3855 esac
3856 case "$fn" in
3857 *+*) skip=true;;
3858 esac
3859 case "$fn" in
3860 *n*) none_ok=true;;
3861 esac
3862 case "$fn" in
3863 *e*) exp_file=true;;
3864 esac
3865 case "$fn" in
3866 *p*) nopath_ok=true;;
3867 esac
3868
3869 case "$fn" in
3870 *f*) type='File';;
3871 *d*) type='Directory';;
3872 *l*) type='Locate';;
3873 esac
3874
3875 what="$type"
3876 case "$what" in
3877 Locate) what='File';;
3878 esac
3879
3880 case "$exp_file" in
3881 '')
3882         case "$d_portable" in
3883         "$define") ;;
3884         *) exp_file=true;;
3885         esac
3886         ;;
3887 esac
3888
3889 cd ..
3890 while test "$type"; do
3891         redo=''
3892         rp="$orig_rp"
3893         dflt="$orig_dflt"
3894         case "$tilde" in
3895         true) rp="$rp (~name ok)";;
3896         esac
3897         . UU/myread
3898         if test -f UU/getfile.ok && \
3899                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3900         then
3901                 value="$ans"
3902                 ansexp="$ans"
3903                 break
3904         fi
3905         case "$ans" in
3906         none)
3907                 value=''
3908                 ansexp=''
3909                 case "$none_ok" in
3910                 true) type='';;
3911                 esac
3912                 ;;
3913         *)
3914                 case "$tilde" in
3915                 '') value="$ans"
3916                         ansexp="$ans";;
3917                 *)
3918                         value=`UU/filexp $ans`
3919                         case $? in
3920                         0)
3921                                 if test "$ans" != "$value"; then
3922                                         echo "(That expands to $value on this system.)"
3923                                 fi
3924                                 ;;
3925                         *) value="$ans";;
3926                         esac
3927                         ansexp="$value"
3928                         case "$exp_file" in
3929                         '') value="$ans";;
3930                         esac
3931                         ;;
3932                 esac
3933                 case "$fullpath" in
3934                 true)
3935                         case "$ansexp" in
3936                         /*) value="$ansexp" ;;
3937                         [a-zA-Z]:/*) value="$ansexp" ;;
3938                         *)
3939                                 redo=true
3940                                 case "$already" in
3941                                 true)
3942                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3943                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3944                                         ;;
3945                                 *)
3946                                 echo "Please give a full path name, starting with slash." >&4
3947                                         case "$tilde" in
3948                                         true)
3949                                 echo "Note that using ~name is ok provided it expands well." >&4
3950                                                 already=true
3951                                                 ;;
3952                                         esac
3953                                 esac
3954                                 ;;
3955                         esac
3956                         ;;
3957                 esac
3958                 case "$redo" in
3959                 '')
3960                         case "$type" in
3961                         File)
3962                                 for fp in $gfpth; do
3963                                         if test "X$fp" = X.; then
3964                                             pf="$ansexp"
3965                                         else    
3966                                             pf="$fp/$ansexp"
3967                                         fi
3968                                         if test -f "$pf"; then
3969                                                 type=''
3970                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3971                                         then
3972                                                 echo "($value is not a plain file, but that's ok.)"
3973                                                 type=''
3974                                         fi
3975                                         if test X"$type" = X; then
3976                                             value="$pf"
3977                                             break
3978                                         fi
3979                                 done
3980                                 ;;
3981                         Directory)
3982                                 for fp in $gfpth; do
3983                                         if test "X$fp" = X.; then
3984                                             dir="$ans"
3985                                             direxp="$ansexp"
3986                                         else    
3987                                             dir="$fp/$ansexp"
3988                                             direxp="$fp/$ansexp"
3989                                         fi
3990                                         if test -d "$direxp"; then
3991                                                 type=''
3992                                                 value="$dir"
3993                                                 break
3994                                         fi
3995                                 done
3996                                 ;;
3997                         Locate)
3998                                 if test -d "$ansexp"; then
3999                                         echo "(Looking for $loc_file in directory $value.)"
4000                                         value="$value/$loc_file"
4001                                         ansexp="$ansexp/$loc_file"
4002                                 fi
4003                                 if test -f "$ansexp"; then
4004                                         type=''
4005                                 fi
4006                                 case "$nopath_ok" in
4007                                 true)   case "$value" in
4008                                         */*) ;;
4009                                         *)      echo "Assuming $value will be in people's path."
4010                                                 type=''
4011                                                 ;;
4012                                         esac
4013                                         ;;
4014                                 esac
4015                                 ;;
4016                         esac
4017
4018                         case "$skip" in
4019                         true) type='';
4020                         esac
4021
4022                         case "$type" in
4023                         '') ;;
4024                         *)
4025                                 if test "$fastread" = yes; then
4026                                         dflt=y
4027                                 else
4028                                         dflt=n
4029                                 fi
4030                                 rp="$what $value doesn't exist.  Use that name anyway?"
4031                                 . UU/myread
4032                                 dflt=''
4033                                 case "$ans" in
4034                                 y*) type='';;
4035                                 *) echo " ";;
4036                                 esac
4037                                 ;;
4038                         esac
4039                         ;;
4040                 esac
4041                 ;;
4042         esac
4043 done
4044 cd UU
4045 ans="$value"
4046 rp="$orig_rp"
4047 dflt="$orig_dflt"
4048 rm -f getfile.ok
4049 test "X$gfpthkeep" != Xy && gfpth=""
4050 EOSC
4051
4052 : What should the include directory be ?
4053 echo " "
4054 $echo $n "Hmm...  $c"
4055 dflt='/usr/include'
4056 incpath=''
4057 mips_type=''
4058 if $test -f /bin/mips && /bin/mips; then
4059         echo "Looks like a MIPS system..."
4060         $cat >usr.c <<'EOCP'
4061 #ifdef SYSTYPE_BSD43
4062 /bsd43
4063 #endif
4064 EOCP
4065         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4066                 dflt='/bsd43/usr/include'
4067                 incpath='/bsd43'
4068                 mips_type='BSD 4.3'
4069         else
4070                 mips_type='System V'
4071         fi
4072         $rm -f usr.c usr.out
4073         echo "and you're compiling with the $mips_type compiler and libraries."
4074         xxx_prompt=y
4075         echo "exit 0" >mips
4076 else
4077         echo "Doesn't look like a MIPS system."
4078         xxx_prompt=n
4079         echo "exit 1" >mips
4080 fi
4081 chmod +x mips
4082 $eunicefix mips
4083 case "$usrinc" in
4084 '') ;;
4085 *) dflt="$usrinc";;
4086 esac
4087 case "$xxx_prompt" in
4088 y)      fn=d/
4089         echo " "
4090         rp='Where are the include files you want to use?'
4091         . ./getfile
4092         usrinc="$ans"
4093         ;;
4094 *)      usrinc="$dflt"
4095         ;;
4096 esac
4097
4098 : see how we invoke the C preprocessor
4099 echo " "
4100 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4101 cat <<'EOT' >testcpp.c
4102 #define ABC abc
4103 #define XYZ xyz
4104 ABC.XYZ
4105 EOT
4106 cd ..
4107 if test ! -f cppstdin; then
4108         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4109                 # AIX cc -E doesn't show the absolute headerfile
4110                 # locations but we'll cheat by using the -M flag.
4111                 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
4112         else
4113                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4114         fi
4115 else
4116         echo "Keeping your $hint cppstdin wrapper."
4117 fi
4118 chmod 755 cppstdin
4119 wrapper=`pwd`/cppstdin
4120 ok='false'
4121 cd UU
4122
4123 if $test "X$cppstdin" != "X" && \
4124         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4125         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4126 then
4127         echo "You used to use $cppstdin $cppminus so we'll use that again."
4128         case "$cpprun" in
4129         '') echo "But let's see if we can live without a wrapper..." ;;
4130         *)
4131                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4132                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4133                 then
4134                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4135                         ok='true'
4136                 else
4137                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4138                 fi
4139                 ;;
4140         esac
4141 else
4142         case "$cppstdin" in
4143         '') ;;
4144         *)
4145                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4146                 ;;
4147         esac
4148 fi
4149
4150 if $ok; then
4151         : nothing
4152 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4153         $cc -E <testcpp.c >testcpp.out 2>&1; \
4154         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4155         echo "Yup, it does."
4156         x_cpp="$cc -E"
4157         x_minus='';
4158 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4159         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4160         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4161         echo "Yup, it does."
4162         x_cpp="$cc -E"
4163         x_minus='-';
4164 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4165         $cc -P <testcpp.c >testcpp.out 2>&1; \
4166         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4167         echo "Yipee, that works!"
4168         x_cpp="$cc -P"
4169         x_minus='';
4170 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4171         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4172         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4173         echo "At long last!"
4174         x_cpp="$cc -P"
4175         x_minus='-';
4176 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4177         $cpp <testcpp.c >testcpp.out 2>&1; \
4178         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4179         echo "It works!"
4180         x_cpp="$cpp"
4181         x_minus='';
4182 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4183         $cpp - <testcpp.c >testcpp.out 2>&1; \
4184         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4185         echo "Hooray, it works!  I was beginning to wonder."
4186         x_cpp="$cpp"
4187         x_minus='-';
4188 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4189         $wrapper <testcpp.c >testcpp.out 2>&1; \
4190         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4191         x_cpp="$wrapper"
4192         x_minus=''
4193         echo "Eureka!"
4194 else
4195         dflt=''
4196         rp="No dice.  I can't find a C preprocessor.  Name one:"
4197         . ./myread
4198         x_cpp="$ans"
4199         x_minus=''
4200         $x_cpp <testcpp.c >testcpp.out 2>&1
4201         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4202                 echo "OK, that will do." >&4
4203         else
4204 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4205                 exit 1
4206         fi
4207 fi
4208
4209 case "$ok" in
4210 false)
4211         cppstdin="$x_cpp"
4212         cppminus="$x_minus"
4213         cpprun="$x_cpp"
4214         cpplast="$x_minus"
4215         set X $x_cpp
4216         shift
4217         case "$1" in
4218         "$cpp")
4219                 echo "Perhaps can we force $cc -E using a wrapper..."
4220                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4221                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4222                 then
4223                         echo "Yup, we can."
4224                         cppstdin="$wrapper"
4225                         cppminus='';
4226                 else
4227                         echo "Nope, we'll have to live without it..."
4228                 fi
4229                 ;;
4230         esac
4231         case "$cpprun" in
4232         "$wrapper")
4233                 cpprun=''
4234                 cpplast=''
4235                 ;;
4236         esac
4237         ;;
4238 esac
4239
4240 case "$cppstdin" in
4241 "$wrapper"|'cppstdin') ;;
4242 *) $rm -f $wrapper;;
4243 esac
4244 $rm -f testcpp.c testcpp.out
4245
4246 : Set private lib path
4247 case "$plibpth" in
4248 '') if ./mips; then
4249                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4250         fi;;
4251 esac
4252 case "$libpth" in
4253 ' ') dlist='';;
4254 '') dlist="$loclibpth $plibpth $glibpth";;
4255 *) dlist="$libpth";;
4256 esac
4257
4258 : Now check and see which directories actually exist, avoiding duplicates
4259 libpth=''
4260 for xxx in $dlist
4261 do
4262     if $test -d $xxx; then
4263                 case " $libpth " in
4264                 *" $xxx "*) ;;
4265                 *) libpth="$libpth $xxx";;
4266                 esac
4267     fi
4268 done
4269 $cat <<'EOM'
4270
4271 Some systems have incompatible or broken versions of libraries.  Among
4272 the directories listed in the question below, please remove any you
4273 know not to be holding relevant libraries, and add any that are needed.
4274 Say "none" for none.
4275
4276 EOM
4277 case "$libpth" in
4278 '') dflt='none';;
4279 *)
4280         set X $libpth
4281         shift
4282         dflt=${1+"$@"}
4283         ;;
4284 esac
4285 rp="Directories to use for library searches?"
4286 . ./myread
4287 case "$ans" in
4288 none) libpth=' ';;
4289 *) libpth="$ans";;
4290 esac
4291
4292 : compute shared library extension
4293 case "$so" in
4294 '')
4295         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4296                 dflt='sl'
4297         else
4298                 dflt='so'
4299         fi
4300         ;;
4301 *) dflt="$so";;
4302 esac
4303 $cat <<EOM
4304
4305 On some systems, shared libraries may be available.  Answer 'none' if
4306 you want to suppress searching of shared libraries for the remainder
4307 of this configuration.
4308
4309 EOM
4310 rp='What is the file extension used for shared libraries?'
4311 . ./myread
4312 so="$ans"
4313
4314 : Define several unixisms.
4315 : Hints files or command line option can be used to override them.
4316 : The convoluted testing is in case hints files set either the old
4317 : or the new name.
4318 case "$_exe" in
4319 '')     case "$exe_ext" in
4320         '')     ;;
4321         *)      _exe="$exe_ext" ;;
4322         esac
4323         ;;
4324 esac
4325 case "$_a" in
4326 '')     case "$lib_ext" in
4327     '') _a='.a';;
4328         *)      _a="$lib_ext" ;;
4329         esac
4330         ;;
4331 esac
4332 case "$_o" in
4333 '') case "$obj_ext" in
4334         '')     _o='.o';;
4335         *)      _o="$obj_ext";;
4336         esac
4337         ;;
4338 esac
4339 case "$p_" in
4340 '') case "$path_sep" in
4341         '')     p_=':';;
4342         *)      p_="$path_sep";;
4343         esac
4344         ;;
4345 esac
4346 exe_ext=$_exe
4347 lib_ext=$_a
4348 obj_ext=$_o
4349 path_sep=$p_
4350
4351 : Which makefile gets called first.  This is used by make depend.
4352 case "$firstmakefile" in
4353 '') firstmakefile='makefile';;
4354 esac
4355
4356 case "$usesocks" in
4357 $define|true|[yY]*)     dflt='y';;
4358 *) dflt='n';;
4359 esac
4360 cat <<EOM
4361
4362 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4363 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4364 to use the PerlIO abstraction layer, this will be implicitly selected.
4365
4366 If this doesn't make any sense to you, just accept the default '$dflt'.
4367 EOM
4368 rp='Build Perl for SOCKS?'
4369 . ./myread
4370 case "$ans" in
4371 y|Y)    val="$define" ;;     
4372 *)      val="$undef" ;;
4373 esac
4374 set usesocks
4375 eval $setvar
4376
4377 case "$usesocks" in
4378 $define|true|[yY]*) useperlio="$define";;
4379 esac
4380
4381 : Looking for optional libraries
4382 echo " "
4383 echo "Checking for optional libraries..." >&4
4384 case "$libs" in
4385 ' '|'') dflt='';;
4386 *) dflt="$libs";;
4387 esac
4388 case "$libswanted" in
4389 '') libswanted='c_s';;
4390 esac
4391 case "$usesocks" in
4392 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4393 esac
4394 libsfound=''
4395 libsfiles=''
4396 libsdirs=''
4397 libspath=''
4398 for thisdir in $libpth $xlibpth; do
4399   test -d $thisdir && libspath="$libspath $thisdir"
4400 done
4401 for thislib in $libswanted; do
4402         for thisdir in $libspath; do
4403             xxx=''
4404             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4405                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4406                 $test -f "$xxx" && eval $libscheck
4407                 $test -f "$xxx" && libstyle=shared
4408             fi
4409             if test ! -f "$xxx"; then
4410                 xxx=$thisdir/lib$thislib.$so
4411                 $test -f "$xxx" && eval $libscheck
4412                 $test -f "$xxx" && libstyle=shared
4413             fi  
4414             if test ! -f "$xxx"; then
4415                 xxx=$thisdir/lib$thislib$_a
4416                 $test -f "$xxx" && eval $libscheck
4417                 $test -f "$xxx" && libstyle=static
4418             fi
4419             if test ! -f "$xxx"; then
4420                 xxx=$thisdir/$thislib$_a
4421                 $test -f "$xxx" && eval $libscheck
4422                 $test -f "$xxx" && libstyle=static
4423             fi
4424             if test ! -f "$xxx"; then
4425                 xxx=$thisdir/lib${thislib}_s$_a
4426                 $test -f "$xxx" && eval $libscheck
4427                 $test -f "$xxx" && libstyle=static
4428                 $test -f "$xxx" && thislib=${thislib}_s
4429             fi
4430             if test ! -f "$xxx"; then
4431                 xxx=$thisdir/Slib$thislib$_a
4432                 $test -f "$xxx" && eval $libscheck
4433                 $test -f "$xxx" && libstyle=static
4434             fi
4435             if $test -f "$xxx"; then
4436                 case "$libstyle" in
4437                 shared) echo "Found -l$thislib (shared)." ;;
4438                 static) echo "Found -l$thislib." ;;
4439                 *)      echo "Found -l$thislib ($libstyle)." ;;
4440                 esac
4441                 case " $dflt " in
4442                 *"-l$thislib "*);;
4443                 *) dflt="$dflt -l$thislib"
4444                    libsfound="$libsfound $xxx"
4445                    yyy=`basename $xxx`
4446                    libsfiles="$libsfiles $yyy"
4447                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4448                    case " $libsdirs " in
4449                    *" $yyy "*) ;;
4450                    *) libsdirs="$libsdirs $yyy" ;;
4451                    esac
4452                    ;;
4453                 esac
4454                 break
4455             fi  
4456         done
4457         if $test ! -f "$xxx"; then
4458             echo "No -l$thislib."
4459         fi
4460 done
4461 set X $dflt
4462 shift
4463 dflt="$*"
4464 case "$libs" in
4465 '') dflt="$dflt";;
4466 *) dflt="$libs";;
4467 esac
4468 case "$dflt" in
4469 ' '|'') dflt='none';;
4470 esac
4471
4472 $cat <<EOM
4473
4474 In order to compile $package on your machine, a number of libraries
4475 are usually needed.  Include any other special libraries here as well.
4476 Say "none" for none.  The default list is almost always right.
4477 EOM
4478
4479 echo " "
4480 rp="What libraries to use?"
4481 . ./myread
4482 case "$ans" in
4483 none) libs=' ';;
4484 *) libs="$ans";;
4485 esac
4486
4487 : determine optimization, if desired, or use for debug flag also
4488 case "$optimize" in
4489 ' '|$undef) dflt='none';;
4490 '') dflt='-O';;
4491 *) dflt="$optimize";;
4492 esac
4493 $cat <<EOH
4494
4495 By default, $package compiles with the -O flag to use the optimizer.
4496 Alternately, you might want to use the symbolic debugger, which uses
4497 the -g flag (on traditional Unix systems).  Either flag can be
4498 specified here.  To use neither flag, specify the word "none".
4499
4500 EOH
4501 rp="What optimizer/debugger flag should be used?"
4502 . ./myread
4503 optimize="$ans"
4504 case "$optimize" in
4505 'none') optimize=" ";;
4506 esac
4507
4508 dflt=''
4509 : We will not override a previous value, but we might want to
4510 : augment a hint file
4511 case "$hint" in
4512 default|recommended)
4513         case "$gccversion" in
4514         1*) dflt='-fpcc-struct-return' ;;
4515         esac
4516         case "$optimize" in
4517         *-g*) dflt="$dflt -DDEBUGGING";;
4518         esac
4519         case "$gccversion" in
4520         2*) if test -d /etc/conf/kconfig.d &&
4521                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4522                 then
4523                         dflt="$dflt -posix"
4524                 fi
4525                 ;;
4526         esac
4527         case "$gccversion" in
4528         1*) ;;
4529         2.[0-8]*) ;;
4530         ?*)     echo " "
4531                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4532                 echo 'int main(void) { return 0; }' > gcctest.c
4533                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4534                         echo "Yes, it does." 2>&1
4535                         case "$ccflags" in
4536                         *strict-aliasing*) 
4537                                 echo "Leaving current flags $ccflags alone." 2>&1
4538                                 ;;
4539                         *) dflt="$dflt -fno-strict-aliasing" ;;
4540                         esac
4541                 else
4542                         echo "Nope, it doesn't, but that's ok." 2>&1
4543                 fi
4544                 ;;
4545         esac
4546         ;;
4547 esac
4548
4549 case "$mips_type" in
4550 *BSD*|'') inclwanted="$locincpth $usrinc";;
4551 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4552 esac
4553 for thisincl in $inclwanted; do
4554         if $test -d $thisincl; then
4555                 if $test x$thisincl != x$usrinc; then
4556                         case "$dflt" in
4557                         *" -I$thisincl "*);;
4558                         *) dflt="$dflt -I$thisincl ";;
4559                         esac
4560                 fi
4561         fi
4562 done
4563
4564 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4565         xxx=true;
4566 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4567         xxx=true;
4568 else
4569         xxx=false;
4570 fi;
4571 if $xxx; then
4572         case "$dflt" in
4573         *$2*);;
4574         *) dflt="$dflt -D$2";;
4575         esac;
4576 fi'
4577
4578 set signal.h LANGUAGE_C; eval $inctest
4579
4580 case "$usesocks" in
4581 $define)
4582         ccflags="$ccflags -DSOCKS"
4583         ;;
4584 esac
4585
4586 case "$hint" in
4587 default|recommended) dflt="$ccflags $dflt" ;;
4588 *) dflt="$ccflags";;
4589 esac
4590
4591 case "$dflt" in
4592 ''|' ') dflt=none;;
4593 esac
4594
4595 $cat <<EOH
4596
4597 Your C compiler may want other flags.  For this question you should include
4598 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4599 but you should NOT include libraries or ld flags like -lwhatever.  If you
4600 want $package to honor its debug switch, you should include -DDEBUGGING here.
4601 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4602
4603 To use no flags, specify the word "none".
4604
4605 EOH
4606 set X $dflt
4607 shift
4608 dflt=${1+"$@"}
4609 rp="Any additional cc flags?"
4610 . ./myread
4611 case "$ans" in
4612 none) ccflags='';;
4613 *) ccflags="$ans";;
4614 esac
4615
4616 : the following weeds options from ccflags that are of no interest to cpp
4617 case "$cppflags" in
4618 '') cppflags="$ccflags" ;;
4619 *)  cppflags="$cppflags $ccflags" ;;
4620 esac
4621 case "$gccversion" in
4622 1*) cppflags="$cppflags -D__GNUC__"
4623 esac
4624 case "$mips_type" in
4625 '');;
4626 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4627 esac
4628 case "$cppflags" in
4629 '');;
4630 *)
4631         echo " "
4632         echo "Let me guess what the preprocessor flags are..." >&4
4633         set X $cppflags
4634         shift
4635         cppflags=''
4636         $cat >cpp.c <<'EOM'
4637 #define BLURFL foo
4638
4639 BLURFL xx LFRULB
4640 EOM
4641         previous=''
4642         for flag in $*
4643         do
4644                 case "$flag" in
4645                 -*) ftry="$flag";;
4646                 *) ftry="$previous $flag";;
4647                 esac
4648                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4649                         >cpp1.out 2>/dev/null && \
4650                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4651                         >cpp2.out 2>/dev/null && \
4652                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4653                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4654                 then
4655                         cppflags="$cppflags $ftry"
4656                         previous=''
4657                 else
4658                         previous="$flag"
4659                 fi
4660         done
4661         set X $cppflags
4662         shift
4663         cppflags=${1+"$@"}
4664         case "$cppflags" in
4665         *-*)  echo "They appear to be: $cppflags";;
4666         esac
4667         $rm -f cpp.c cpp?.out
4668         ;;
4669 esac
4670
4671 : flags used in final linking phase
4672 case "$ldflags" in
4673 '') if ./venix; then
4674                 dflt='-i -z'
4675         else
4676                 dflt=''
4677         fi
4678         case "$ccflags" in
4679         *-posix*) dflt="$dflt -posix" ;;
4680         esac
4681         ;;
4682 *) dflt="$ldflags";;
4683 esac
4684
4685 : Try to guess additional flags to pick up local libraries.
4686 for thislibdir in $libpth; do
4687         case " $loclibpth " in
4688         *" $thislibdir "*)
4689                 case "$dflt " in 
4690                 *"-L$thislibdir "*) ;;
4691                 *)  dflt="$dflt -L$thislibdir" ;;
4692                 esac
4693                 ;;
4694         esac
4695 done
4696
4697 case "$dflt" in
4698 '') dflt='none' ;;
4699 esac
4700
4701 $cat <<EOH
4702
4703 Your C linker may need flags.  For this question you should
4704 include -L/whatever and any other flags used by the C linker, but you
4705 should NOT include libraries like -lwhatever.
4706
4707 Make sure you include the appropriate -L/path flags if your C linker
4708 does not normally search all of the directories you specified above,
4709 namely
4710         $libpth
4711 To use no flags, specify the word "none".
4712
4713 EOH
4714
4715 rp="Any additional ld flags (NOT including libraries)?"
4716 . ./myread
4717 case "$ans" in
4718 none) ldflags='';;
4719 *) ldflags="$ans";;
4720 esac
4721 rmlist="$rmlist pdp11"
4722
4723 : coherency check
4724 echo " "
4725 echo "Checking your choice of C compiler and flags for coherency..." >&4
4726 $cat > try.c <<'EOF'
4727 #include <stdio.h>
4728 int main() { printf("Ok\n"); exit(0); }
4729 EOF
4730 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4731 shift
4732 $cat >try.msg <<'EOM'
4733 I've tried to compile and run the following simple program:
4734
4735 EOM
4736 $cat try.c >> try.msg
4737
4738 $cat >> try.msg <<EOM
4739
4740 I used the command:
4741
4742         $*
4743         $run ./try
4744
4745 and I got the following output:
4746
4747 EOM
4748 dflt=y
4749 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4750         if $sh -c "$run ./try" >>try.msg 2>&1; then
4751                 xxx=`$run ./try`
4752                 case "$xxx" in
4753                 "Ok") dflt=n ;;
4754                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4755                         case " $libs " in
4756                         *" -lsfio "*)
4757                                 cat >> try.msg <<'EOQS'
4758 If $libs contains -lsfio, and sfio is mis-configured, then it
4759 sometimes (apparently) runs and exits with a 0 status, but with no
4760 output!  It may have to do with sfio's use of _exit vs. exit.
4761
4762 EOQS
4763                                 rp="You have a big problem.  Shall I abort Configure"
4764                                 dflt=y
4765                                 ;;
4766                         esac
4767                         ;;
4768                 esac
4769         else
4770                 echo "The program compiled OK, but exited with status $?." >>try.msg
4771                 rp="You have a problem.  Shall I abort Configure"
4772                 dflt=y
4773         fi
4774 else
4775         echo "I can't compile the test program." >>try.msg
4776         rp="You have a BIG problem.  Shall I abort Configure"
4777         dflt=y
4778 fi
4779 case "$dflt" in
4780 y)
4781         $cat try.msg >&4
4782         case "$knowitall" in
4783         '')
4784                 echo "(The supplied flags or libraries might be incorrect.)"
4785                 ;;
4786         *) dflt=n;;
4787         esac
4788         echo " "
4789         . ./myread
4790         case "$ans" in
4791         n*|N*) ;;
4792         *)      echo "Ok.  Stopping Configure." >&4
4793                 exit 1
4794                 ;;
4795         esac
4796         ;;
4797 n) echo "OK, that should do.";;
4798 esac
4799 $rm -f try try.* core
4800
4801 : define a shorthand compile call
4802 compile='
4803 mc_file=$1;
4804 shift;
4805 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4806 : define a shorthand compile call for compilations that should be ok.
4807 compile_ok='
4808 mc_file=$1;
4809 shift;
4810 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4811
4812 : check for lengths of integral types
4813 echo " "
4814 case "$intsize" in
4815 '')
4816         echo "Checking to see how big your integers are..." >&4
4817         $cat >try.c <<'EOCP'
4818 #include <stdio.h>
4819 int main()
4820 {
4821         printf("intsize=%d;\n", (int)sizeof(int));
4822         printf("longsize=%d;\n", (int)sizeof(long));
4823         printf("shortsize=%d;\n", (int)sizeof(short));
4824         exit(0);
4825 }
4826 EOCP
4827         set try
4828         if eval $compile_ok && $run ./try > /dev/null; then
4829                 eval `$run ./try`
4830                 echo "Your integers are $intsize bytes long."
4831                 echo "Your long integers are $longsize bytes long."
4832                 echo "Your short integers are $shortsize bytes long."
4833         else
4834                 $cat >&4 <<EOM
4835 !
4836 Help! I can't compile and run the intsize test program: please enlighten me!
4837 (This is probably a misconfiguration in your system or libraries, and
4838 you really ought to fix it.  Still, I'll try anyway.)
4839 !
4840 EOM
4841                 dflt=4
4842                 rp="What is the size of an integer (in bytes)?"
4843                 . ./myread
4844                 intsize="$ans"
4845                 dflt=$intsize
4846                 rp="What is the size of a long integer (in bytes)?"
4847                 . ./myread
4848                 longsize="$ans"
4849                 dflt=2
4850                 rp="What is the size of a short integer (in bytes)?"
4851                 . ./myread
4852                 shortsize="$ans"
4853         fi
4854         ;;
4855 esac
4856 $rm -f try try.*
4857
4858 : check for long long
4859 echo " "
4860 echo "Checking to see if you have long long..." >&4
4861 echo 'int main() { long long x = 7; return 0; }' > try.c
4862 set try
4863 if eval $compile; then
4864         val="$define"
4865         echo "You have long long."
4866 else
4867         val="$undef"
4868         echo "You do not have long long."
4869 fi
4870 $rm try.*
4871 set d_longlong
4872 eval $setvar
4873
4874 : check for length of long long
4875 case "${d_longlong}${longlongsize}" in
4876 $define)
4877         echo " "
4878         echo "Checking to see how big your long longs are..." >&4
4879         $cat >try.c <<'EOCP'
4880 #include <stdio.h>
4881 int main()
4882 {
4883     printf("%d\n", (int)sizeof(long long));
4884     return(0);
4885 }
4886 EOCP
4887         set try
4888         if eval $compile_ok; then
4889                 longlongsize=`$run ./try`
4890                 echo "Your long longs are $longlongsize bytes long."
4891         else
4892                 dflt='8'
4893                 echo " "
4894                 echo "(I can't seem to compile the test program.  Guessing...)"
4895                 rp="What is the size of a long long (in bytes)?"
4896                 . ./myread
4897                 longlongsize="$ans"
4898         fi
4899         if $test "X$longsize" = "X$longlongsize"; then
4900                 echo "(That isn't any different from an ordinary long.)"
4901         fi      
4902         ;;
4903 esac
4904 $rm -f try.* try
4905
4906 : determine filename position in cpp output
4907 echo " "
4908 echo "Computing filename position in cpp output for #include directives..." >&4
4909 case "$osname" in
4910 vos) testaccess=-e ;;
4911 *)   testaccess=-r ;;
4912 esac
4913 echo '#include <stdio.h>' > foo.c
4914 $cat >fieldn <<EOF
4915 $startsh
4916 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4917 $grep '^[       ]*#.*stdio\.h' | \
4918 while read cline; do
4919         pos=1
4920         set \$cline
4921         while $test \$# -gt 0; do
4922                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
4923                         echo "\$pos"
4924                         exit 0
4925                 fi
4926                 shift
4927                 pos=\`expr \$pos + 1\`
4928         done
4929 done
4930 EOF
4931 chmod +x fieldn
4932 fieldn=`./fieldn`
4933 $rm -f foo.c fieldn
4934 case $fieldn in
4935 '') pos='???';;
4936 1) pos=first;;
4937 2) pos=second;;
4938 3) pos=third;;
4939 *) pos="${fieldn}th";;
4940 esac
4941 echo "Your cpp writes the filename in the $pos field of the line."
4942
4943 case "$osname" in
4944 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4945 *)   cppfilter='' ;;
4946 esac
4947 : locate header file
4948 $cat >findhdr <<EOF
4949 $startsh
4950 wanted=\$1
4951 name=''
4952 for usrincdir in $usrinc
4953 do
4954         if test -f \$usrincdir/\$wanted; then
4955                 echo "\$usrincdir/\$wanted"
4956                 exit 0
4957         fi
4958 done
4959 awkprg='{ print \$$fieldn }'
4960 echo "#include <\$wanted>" > foo\$\$.c
4961 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4962 $cppfilter $grep "^[    ]*#.*\$wanted" | \
4963 while read cline; do
4964         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4965         case "\$name" in
4966         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4967         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4968         *) exit 2;;
4969         esac;
4970 done;
4971 #
4972 # status = 0: grep returned 0 lines, case statement not executed
4973 # status = 1: headerfile found
4974 # status = 2: while loop executed, no headerfile found
4975 #
4976 status=\$?
4977 $rm -f foo\$\$.c;
4978 if test \$status -eq 1; then
4979         exit 0;
4980 fi
4981 exit 1
4982 EOF
4983 chmod +x findhdr
4984
4985 : define an alternate in-header-list? function
4986 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4987 cont=true; xxf="echo \"<\$1> found.\" >&4";
4988 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4989 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4990 esac;
4991 case $# in 4) instead=instead;; *) instead="at last";; esac;
4992 while $test "$cont"; do
4993         xxx=`./findhdr $1`
4994         var=$2; eval "was=\$$2";
4995         if $test "$xxx" && $test -r "$xxx";
4996         then eval $xxf;
4997         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4998                 cont="";
4999         else eval $xxnf;
5000         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5001         set $yyy; shift; shift; yyy=$@;
5002         case $# in 0) cont="";;
5003         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5004                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5005         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5006                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5007         esac;
5008 done;
5009 while $test "$yyy";
5010 do set $yyy; var=$2; eval "was=\$$2";
5011         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5012         set $yyy; shift; shift; yyy=$@;
5013 done'
5014
5015 : see if inttypes.h is available
5016 : we want a real compile instead of Inhdr because some systems
5017 : have an inttypes.h which includes non-existent headers
5018 echo " "
5019 $cat >try.c <<EOCP
5020 #include <inttypes.h>
5021 int main() {
5022         static int32_t foo32 = 0x12345678;
5023 }
5024 EOCP
5025 set try
5026 if eval $compile; then
5027         echo "<inttypes.h> found." >&4
5028         val="$define"
5029 else
5030         echo "<inttypes.h> NOT found." >&4
5031         val="$undef"
5032 fi
5033 $rm -f try.c try
5034 set i_inttypes
5035 eval $setvar
5036
5037 : check for int64_t
5038 echo " "
5039 echo "Checking to see if you have int64_t..." >&4
5040 $cat >try.c <<EOCP
5041 #include <sys/types.h>
5042 #$i_inttypes I_INTTYPES
5043 #ifdef I_INTTYPES
5044 #include <inttypes.h>
5045 #endif
5046 int main() { int64_t x = 7; }
5047 EOCP
5048 set try
5049 if eval $compile; then
5050         val="$define"
5051         echo "You have int64_t."
5052 else
5053         val="$undef"
5054         echo "You do not have int64_t."
5055 fi
5056 $rm -f try try.*
5057 set d_int64_t
5058 eval $setvar
5059
5060
5061 echo " "
5062 echo "Checking which 64-bit integer type we could use..." >&4
5063
5064 case "$intsize" in
5065 8) val=int
5066    set quadtype
5067    eval $setvar
5068    val='"unsigned int"'
5069    set uquadtype
5070    eval $setvar
5071    quadkind=1
5072    ;;
5073 *) case "$longsize" in
5074    8) val=long
5075       set quadtype
5076       eval $setvar
5077       val='"unsigned long"'
5078       set uquadtype
5079       eval $setvar
5080       quadkind=2
5081       ;;
5082    *) case "$d_longlong:$longlongsize" in
5083       define:8)
5084         val='"long long"'
5085         set quadtype
5086         eval $setvar
5087         val='"unsigned long long"'
5088         set uquadtype
5089         eval $setvar
5090         quadkind=3
5091         ;;
5092       *) case "$d_int64_t" in
5093          define)
5094            val=int64_t
5095            set quadtype
5096            eval $setvar
5097            val=uint64_t
5098            set uquadtype
5099            eval $setvar
5100            quadkind=4
5101            ;;
5102          esac
5103          ;;
5104       esac
5105       ;;
5106    esac
5107    ;;
5108 esac
5109
5110 case "$quadtype" in
5111 '')     echo "Alas, no 64-bit integer types in sight." >&4
5112         d_quad="$undef"
5113         ;;
5114 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5115         d_quad="$define"
5116         ;;
5117 esac
5118
5119
5120 case "$uselonglong" in
5121 "$define"|true|[yY]*)
5122         cat <<EOM >&4
5123
5124 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5125 EOM
5126         use64bitint="$define"
5127         ;;
5128 esac                          
5129 case "$use64bits" in
5130 "$define"|true|[yY]*)
5131         cat <<EOM >&4
5132
5133 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5134 EOM
5135         use64bitint="$define"
5136         ;;
5137 esac                          
5138 case "$use64bitints" in
5139 "$define"|true|[yY]*)
5140         cat <<EOM >&4
5141
5142 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5143 EOM
5144         use64bitint="$define"
5145         ;;
5146 esac                          
5147 case "$use64bitsint" in
5148 "$define"|true|[yY]*)
5149         cat <<EOM >&4
5150
5151 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5152 EOM
5153         use64bitint="$define"
5154         ;;
5155 esac                          
5156 case "$uselonglongs" in
5157 "$define"|true|[yY]*)
5158         cat <<EOM >&4
5159
5160 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5161 EOM
5162         use64bitint="$define"
5163         ;;
5164 esac                          
5165 case "$use64bitsall" in
5166 "$define"|true|[yY]*)
5167         cat <<EOM >&4
5168
5169 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5170 EOM
5171         use64bitall="$define"
5172         ;;
5173 esac                          
5174
5175 case "$ccflags" in
5176 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5177 esac
5178 case "$use64bitall" in
5179 "$define"|true|[yY]*) use64bitint="$define" ;;
5180 esac
5181
5182 case "$longsize" in
5183 8) cat <<EOM
5184
5185 You have natively 64-bit long integers.
5186 EOM
5187    val="$define"
5188    ;;
5189 *) case "$use64bitint" in
5190    "$define"|true|[yY]*) dflt='y';;
5191    *) dflt='n';;
5192    esac
5193    case "$d_quad" in
5194    "$define") ;;
5195    *) dflt='n' ;;
5196    esac
5197    cat <<EOM
5198
5199 Perl can be built to take advantage of 64-bit integer types
5200 on some systems.  To do so, Configure can be run with -Duse64bitint.
5201 Choosing this option will most probably introduce binary incompatibilities.
5202
5203 If this doesn't make any sense to you, just accept the default '$dflt'.
5204 (The default has been chosen based on your configuration.)
5205 EOM
5206    rp='Try to use 64-bit integers, if available?'
5207    . ./myread
5208    case "$ans" in
5209    [yY]*) val="$define" ;;
5210    *)     val="$undef"  ;;
5211    esac
5212    ;;
5213 esac
5214 set use64bitint
5215 eval $setvar
5216
5217 case "$use64bitall" in
5218 "$define"|true|[yY]*) dflt='y' ;;
5219 *) case "$longsize" in
5220    8) dflt='y' ;;
5221    *) dflt='n' ;;
5222    esac
5223    ;;
5224 esac    
5225 cat <<EOM
5226
5227 You may also choose to try maximal 64-bitness.  It means using as much
5228 64-bitness as possible on the platform.  This in turn means even more
5229 binary incompatibilities.  On the other hand, your platform may not
5230 have any more 64-bitness available than what you already have chosen.
5231
5232 If this doesn't make any sense to you, just accept the default '$dflt'.
5233 (The default has been chosen based on your configuration.)
5234 EOM
5235 rp='Try to use maximal 64-bit support, if available?'
5236 . ./myread
5237 case "$ans" in
5238 [yY]*) val="$define" ;;
5239 *)     val="$undef"  ;;
5240 esac
5241 set use64bitall
5242 eval $setvar
5243 case "$use64bitall" in
5244 "$define")
5245         case "$use64bitint" in
5246         "$undef")
5247                 cat <<EOM
5248
5249 Since you have chosen a maximally 64-bit build, I'm also turning on
5250 the use of 64-bit integers.
5251 EOM
5252                 use64bitint="$define" ;;
5253         esac
5254         ;;
5255 esac
5256
5257 case "$use64bitint" in
5258 "$define"|true|[yY]*)
5259 : Look for a hint-file generated 'call-back-unit'.  If the
5260 : user has specified that a 64-bit perl is to be built,
5261 : we may need to set or change some other defaults.
5262         if $test -f use64bitint.cbu; then
5263                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5264                 . ./use64bitint.cbu
5265         fi
5266         case "$longsize" in
5267         4) case "$archname64" in
5268            '') archname64=64int ;;
5269            esac
5270            ;;
5271         esac
5272         ;;
5273 esac
5274
5275 case "$use64bitall" in
5276 "$define"|true|[yY]*)
5277 : Look for a hint-file generated 'call-back-unit'.  If the
5278 : user has specified that a maximally 64-bit perl is to be built,
5279 : we may need to set or change some other defaults.
5280         if $test -f use64bitall.cbu; then
5281                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5282                 . ./use64bitall.cbu
5283         fi
5284         case "$longsize" in
5285         4) case "$archname64" in
5286            ''|64int) archname64=64all ;;
5287            esac
5288            ;;
5289         esac
5290         ;;
5291 esac
5292
5293 echo " "
5294 echo "Checking for GNU C Library..." >&4
5295 cat >try.c <<EOM
5296 #include <stdio.h>
5297 int main()
5298 {
5299 #ifdef __GLIBC__
5300     exit(0);
5301 #else
5302     exit(1);
5303 #endif
5304 }
5305 EOM
5306 set try
5307 if eval $compile_ok && $run ./try; then
5308         val="$define"
5309         echo "You are using the GNU C Library"
5310 else
5311         val="$undef"
5312         echo "You are not using the GNU C Library"
5313 fi
5314 $rm -f try try.*
5315 set d_gnulibc
5316 eval $setvar
5317
5318 : see if nm is to be used to determine whether a symbol is defined or not
5319 case "$usenm" in
5320 '')
5321         dflt=''
5322         case "$d_gnulibc" in
5323         "$define")
5324                 echo " "
5325                 echo "nm probably won't work on the GNU C Library." >&4
5326                 dflt=n
5327                 ;;
5328         esac
5329         case "$dflt" in
5330         '') 
5331                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5332                         echo " "
5333                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5334                         echo "'nm' won't be sufficient on this sytem." >&4
5335                         dflt=n
5336                 fi
5337                 ;;
5338         esac
5339         case "$dflt" in
5340         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5341                 if $test $dflt -gt 20; then
5342                         dflt=y
5343                 else
5344                         dflt=n
5345                 fi
5346                 ;;
5347         esac
5348         ;;
5349 *)
5350         case "$usenm" in
5351         true|$define) dflt=y;;
5352         *) dflt=n;;
5353         esac
5354         ;;
5355 esac
5356 $cat <<EOM
5357
5358 I can use $nm to extract the symbols from your C libraries. This
5359 is a time consuming task which may generate huge output on the disk (up
5360 to 3 megabytes) but that should make the symbols extraction faster. The
5361 alternative is to skip the 'nm' extraction part and to compile a small
5362 test program instead to determine whether each symbol is present. If
5363 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5364 this may be the best solution.
5365
5366 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5367
5368 EOM
5369 rp="Shall I use $nm to extract C symbols from the libraries?"
5370 . ./myread
5371 case "$ans" in
5372 [Nn]*) usenm=false;;
5373 *) usenm=true;;
5374 esac
5375
5376 runnm=$usenm
5377 case "$reuseval" in
5378 true) runnm=false;;
5379 esac
5380
5381 : nm options which may be necessary
5382 case "$nm_opt" in
5383 '') if $test -f /mach_boot; then
5384                 nm_opt=''       # Mach
5385         elif $test -d /usr/ccs/lib; then
5386                 nm_opt='-p'     # Solaris (and SunOS?)
5387         elif $test -f /dgux; then
5388                 nm_opt='-p'     # DG-UX
5389         elif $test -f /lib64/rld; then
5390                 nm_opt='-p'     # 64-bit Irix
5391         else
5392                 nm_opt=''
5393         fi;;
5394 esac
5395
5396 : nm options which may be necessary for shared libraries but illegal
5397 : for archive libraries.  Thank you, Linux.
5398 case "$nm_so_opt" in
5399 '')     case "$myuname" in
5400         *linux*)
5401                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5402                         nm_so_opt='--dynamic'
5403                 fi
5404                 ;;
5405         esac
5406         ;;
5407 esac
5408
5409 case "$runnm" in
5410 true)
5411 : get list of predefined functions in a handy place
5412 echo " "
5413 case "$libc" in
5414 '') libc=unknown
5415         case "$libs" in
5416         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5417         esac
5418         ;;
5419 esac
5420 case "$libs" in
5421 '') ;;
5422 *)  for thislib in $libs; do
5423         case "$thislib" in
5424         -lc|-lc_s)
5425                 : Handle C library specially below.
5426                 ;;
5427         -l*)
5428                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5429                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5430                         :
5431                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5432                         :
5433                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5434                         :
5435                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5436                         :
5437                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5438                         :
5439                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5440                         :
5441                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5442                         :
5443                 else
5444                         try=''
5445                 fi
5446                 libnames="$libnames $try"
5447                 ;;
5448         *) libnames="$libnames $thislib" ;;
5449         esac
5450         done
5451         ;;
5452 esac
5453 xxx=normal
5454 case "$libc" in
5455 unknown)
5456         set /lib/libc.$so
5457         for xxx in $libpth; do
5458                 $test -r $1 || set $xxx/libc.$so
5459                 : The messy sed command sorts on library version numbers.
5460                 $test -r $1 || \
5461                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5462                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5463                                 h
5464                                 s/[0-9][0-9]*/0000&/g
5465                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5466                                 G
5467                                 s/\n/ /' | \
5468                          $sort | $sed -e 's/^.* //'`
5469                 eval set \$$#
5470         done
5471         $test -r $1 || set /usr/ccs/lib/libc.$so
5472         $test -r $1 || set /lib/libsys_s$_a
5473         ;;
5474 *)
5475         set blurfl
5476         ;;
5477 esac
5478 if $test -r "$1"; then
5479         echo "Your (shared) C library seems to be in $1."
5480         libc="$1"
5481 elif $test -r /lib/libc && $test -r /lib/clib; then
5482         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5483         xxx=apollo
5484         libc='/lib/clib /lib/libc'
5485         if $test -r /lib/syslib; then
5486                 echo "(Your math library is in /lib/syslib.)"
5487                 libc="$libc /lib/syslib"
5488         fi
5489 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5490         echo "Your C library seems to be in $libc, as you said before."
5491 elif $test -r $incpath/usr/lib/libc$_a; then
5492         libc=$incpath/usr/lib/libc$_a;
5493         echo "Your C library seems to be in $libc.  That's fine."
5494 elif $test -r /lib/libc$_a; then
5495         libc=/lib/libc$_a;
5496         echo "Your C library seems to be in $libc.  You're normal."
5497 else
5498         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5499                 :
5500         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5501                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5502         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5503                 :
5504         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5505                 :
5506         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5507                 :
5508         else
5509                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5510         fi
5511         if $test -r "$tans"; then
5512                 echo "Your C library seems to be in $tans, of all places."
5513                 libc=$tans
5514         else
5515                 libc='blurfl'
5516         fi
5517 fi
5518 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5519         dflt="$libc"
5520         cat <<EOM
5521
5522 If the guess above is wrong (which it might be if you're using a strange
5523 compiler, or your machine supports multiple models), you can override it here.
5524
5525 EOM
5526 else
5527         dflt=''
5528         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5529         cat >&4 <<EOM
5530 I can't seem to find your C library.  I've looked in the following places:
5531
5532 EOM
5533         $sed 's/^/      /' libpath
5534         cat <<EOM
5535
5536 None of these seems to contain your C library. I need to get its name...
5537
5538 EOM
5539 fi
5540 fn=f
5541 rp='Where is your C library?'
5542 . ./getfile
5543 libc="$ans"
5544
5545 echo " "
5546 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5547 set X `cat libnames`
5548 shift
5549 xxx=files
5550 case $# in 1) xxx=file; esac
5551 echo "Extracting names from the following $xxx for later perusal:" >&4
5552 echo " "
5553 $sed 's/^/      /' libnames >&4
5554 echo " "
5555 $echo $n "This may take a while...$c" >&4
5556
5557 for file in $*; do
5558         case $file in
5559         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5560         *) $nm $nm_opt $file 2>/dev/null;;
5561         esac
5562 done >libc.tmp
5563
5564 $echo $n ".$c"
5565 $grep fprintf libc.tmp > libc.ptf
5566 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5567 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
5568 xxx='[ADTSIW]'
5569 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5570         eval $xscan;\
5571         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5572                 eval $xrun
5573 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5574         eval $xscan;\
5575         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5576                 eval $xrun
5577 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5578         eval $xscan;\
5579         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5580                 eval $xrun
5581 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5582         eval $xscan;\
5583         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5584                 eval $xrun
5585 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5586         eval $xscan;\
5587         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5588                 eval $xrun
5589 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5590         eval $xscan;\
5591         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5592                 eval $xrun
5593 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5594                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5595         eval $xscan;\
5596         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5597                 eval $xrun
5598 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5599         eval $xscan;\
5600         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5601                 eval $xrun
5602 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5603         eval $xscan;\
5604         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5605                 eval $xrun
5606 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5607         eval $xscan;\
5608         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5609                 eval $xrun
5610 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5611         eval $xscan;\
5612         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5613                 eval $xrun
5614 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5615         eval $xscan;\
5616         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5617                 eval $xrun
5618 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5619         eval $xscan;\
5620         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5621                 eval $xrun
5622 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5623         eval $xscan;\
5624         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5625                 eval $xrun
5626 else
5627         $nm -p $* 2>/dev/null >libc.tmp
5628         $grep fprintf libc.tmp > libc.ptf
5629         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5630                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5631         then
5632                 nm_opt='-p'
5633                 eval $xrun
5634         else
5635                 echo " "
5636                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5637                 com=''
5638                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5639                         for thisname in $libnames $libc; do
5640                                 $ar t $thisname >>libc.tmp
5641                         done
5642                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5643                         echo "Ok." >&4
5644                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5645                         # Repeat libc to extract forwarders to DLL entries too
5646                         for thisname in $libnames $libc; do
5647                                 $ar tv $thisname >>libc.tmp
5648                                 # Revision 50 of EMX has bug in $ar.
5649                                 # it will not extract forwarders to DLL entries
5650                                 # Use emximp which will extract exactly them.
5651                                 emximp -o tmp.imp $thisname \
5652                                     2>/dev/null && \
5653                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5654                                     < tmp.imp >>libc.tmp
5655                                 $rm tmp.imp
5656                         done
5657                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5658                         echo "Ok." >&4
5659                 else
5660                         echo "$ar didn't seem to work right." >&4
5661                         echo "Maybe this is a Cray...trying bld instead..." >&4
5662                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5663                         then
5664                                 for thisname in $libnames; do
5665                                         bld t $libnames | \
5666                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5667                                         $ar t $thisname >>libc.tmp
5668                                 done
5669                                 echo "Ok." >&4
5670                         else
5671                                 echo "That didn't work either.  Giving up." >&4
5672                                 exit 1
5673                         fi
5674                 fi
5675         fi
5676 fi
5677 nm_extract="$com"
5678 if $test -f /lib/syscalls.exp; then
5679         echo " "
5680         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5681         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
5682 fi
5683 ;;
5684 esac
5685 $rm -f libnames libpath
5686
5687 : is a C symbol defined?
5688 csym='tlook=$1;
5689 case "$3" in
5690 -v) tf=libc.tmp; tc=""; tdc="";;
5691 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5692 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5693 esac;
5694 tx=yes;
5695 case "$reuseval-$4" in
5696 true-) ;;
5697 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5698 esac;
5699 case "$tx" in
5700 yes)
5701         case "$runnm" in
5702         true)
5703                 if $contains $tlook $tf >/dev/null 2>&1;
5704                 then tval=true;
5705                 else tval=false;
5706                 fi;;
5707         *)
5708                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5709                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5710                 then tval=true;
5711                 else tval=false;
5712                 fi;
5713                 $rm -f t t.c;;
5714         esac;;
5715 *)
5716         case "$tval" in
5717         $define) tval=true;;
5718         *) tval=false;;
5719         esac;;
5720 esac;
5721 eval "$2=$tval"'
5722
5723 : define an is-in-libc? function
5724 inlibc='echo " "; td=$define; tu=$undef;
5725 sym=$1; var=$2; eval "was=\$$2";
5726 tx=yes;
5727 case "$reuseval$was" in
5728 true) ;;
5729 true*) tx=no;;
5730 esac;
5731 case "$tx" in
5732 yes)
5733         set $sym tres -f;
5734         eval $csym;
5735         case "$tres" in
5736         true)
5737                 echo "$sym() found." >&4;
5738                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5739         *)
5740                 echo "$sym() NOT found." >&4;
5741                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5742         esac;;
5743 *)
5744         case "$was" in
5745         $define) echo "$sym() found." >&4;;
5746         *) echo "$sym() NOT found." >&4;;
5747         esac;;
5748 esac'
5749
5750 : see if sqrtl exists
5751 set sqrtl d_sqrtl
5752 eval $inlibc
5753
5754 : check for length of double
5755 echo " "
5756 case "$doublesize" in
5757 '')
5758         echo "Checking to see how big your double precision numbers are..." >&4
5759         $cat >try.c <<'EOCP'
5760 #include <stdio.h>
5761 int main()
5762 {
5763     printf("%d\n", (int)sizeof(double));
5764     exit(0);
5765 }
5766 EOCP
5767         set try
5768         if eval $compile_ok; then
5769                 doublesize=`$run ./try`
5770                 echo "Your double is $doublesize bytes long."
5771         else
5772                 dflt='8'
5773                 echo "(I can't seem to compile the test program.  Guessing...)"
5774                 rp="What is the size of a double precision number (in bytes)?"
5775                 . ./myread
5776                 doublesize="$ans"
5777         fi
5778         ;;
5779 esac
5780 $rm -f try.c try
5781
5782 : check for long doubles
5783 echo " "
5784 echo "Checking to see if you have long double..." >&4
5785 echo 'int main() { long double x = 7.0; }' > try.c
5786 set try
5787 if eval $compile; then
5788         val="$define"
5789         echo "You have long double."
5790 else
5791         val="$undef"
5792         echo "You do not have long double."
5793 fi
5794 $rm try.*
5795 set d_longdbl
5796 eval $setvar
5797
5798 : check for length of long double
5799 case "${d_longdbl}${longdblsize}" in
5800 $define)
5801         echo " "
5802         echo "Checking to see how big your long doubles are..." >&4
5803         $cat >try.c <<'EOCP'
5804 #include <stdio.h>
5805 int main()
5806 {
5807         printf("%d\n", sizeof(long double));
5808 }
5809 EOCP
5810         set try
5811         set try
5812         if eval $compile; then
5813                 longdblsize=`$run ./try`
5814                 echo "Your long doubles are $longdblsize bytes long."
5815         else
5816                 dflt='8'
5817                 echo " "
5818                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5819                 rp="What is the size of a long double (in bytes)?"
5820                 . ./myread
5821                 longdblsize="$ans"
5822         fi
5823         if $test "X$doublesize" = "X$longdblsize"; then
5824                 echo "(That isn't any different from an ordinary double.)"
5825         fi      
5826         ;;
5827 esac
5828 $rm -f try.* try
5829
5830 echo " "
5831
5832 if $test X"$d_longdbl" = X"$define"; then
5833
5834 echo "Checking how to print long doubles..." >&4
5835
5836 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
5837         $cat >try.c <<'EOCP'
5838 #include <sys/types.h>
5839 #include <stdio.h>
5840 int main() {
5841   double d = 123.456;
5842   printf("%.3f\n", d);
5843 }
5844 EOCP
5845         set try
5846         if eval $compile; then
5847                 yyy=`$run ./try`
5848                 case "$yyy" in
5849                 123.456)
5850                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
5851                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
5852                         echo "We will use %f."
5853                         ;;
5854                 esac
5855         fi
5856 fi
5857
5858 if $test X"$sPRIfldbl" = X; then
5859         $cat >try.c <<'EOCP'
5860 #include <sys/types.h>
5861 #include <stdio.h>
5862 int main() {
5863   long double d = 123.456;
5864   printf("%.3Lf\n", d);
5865 }
5866 EOCP
5867         set try
5868         if eval $compile; then
5869                 yyy=`$run ./try`
5870                 case "$yyy" in
5871                 123.456)
5872                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
5873                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
5874                         echo "We will use %Lf."
5875                         ;;
5876                 esac
5877         fi
5878 fi
5879
5880 if $test X"$sPRIfldbl" = X; then
5881         $cat >try.c <<'EOCP'
5882 #include <sys/types.h>
5883 #include <stdio.h>
5884 int main() {
5885   long double d = 123.456;
5886   printf("%.3llf\n", d);
5887 }
5888 EOCP
5889         set try
5890         if eval $compile; then
5891                 yyy=`$run ./try`
5892                 case "$yyy" in
5893                 123.456)
5894                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
5895                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
5896                         echo "We will use %llf."
5897                         ;;
5898                 esac
5899         fi
5900 fi
5901
5902 if $test X"$sPRIfldbl" = X; then
5903         $cat >try.c <<'EOCP'
5904 #include <sys/types.h>
5905 #include <stdio.h>
5906 int main() {
5907   long double d = 123.456;
5908   printf("%.3lf\n", d);
5909 }
5910 EOCP
5911         set try
5912         if eval $compile; then
5913                 yyy=`$run ./try`
5914                 case "$yyy" in
5915                 123.456)
5916                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
5917                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
5918                         echo "We will use %lf."
5919                         ;;
5920                 esac
5921         fi
5922 fi
5923
5924 if $test X"$sPRIfldbl" = X; then
5925         echo "Cannot figure out how to print long doubles." >&4
5926 else
5927         sSCNfldbl=$sPRIfldbl    # expect consistency
5928 fi
5929
5930 $rm -f try try.*
5931
5932 fi # d_longdbl
5933
5934 case "$sPRIfldbl" in
5935 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
5936         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
5937         d_SCNfldbl="$undef";
5938         ;;
5939 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
5940         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
5941         d_SCNfldbl="$define";
5942         ;;
5943 esac
5944
5945 : see if modfl exists
5946 set modfl d_modfl
5947 eval $inlibc
5948
5949 d_modfl_pow32_bug="$undef"
5950
5951 case "$d_longdbl$d_modfl" in
5952 $define$define)
5953         $cat <<EOM
5954 Checking to see whether your modfl() is okay for large values...
5955 EOM
5956 $cat >try.c <<EOCP
5957 #include <math.h> 
5958 #include <stdio.h>
5959 int main() {
5960     long double nv = 4294967303.15;
5961     long double v, w;
5962     v = modfl(nv, &w);         
5963 #ifdef __GLIBC__
5964     printf("glibc");
5965 #endif
5966     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
5967     return 0;
5968 }
5969 EOCP
5970         case "$osname:$gccversion" in
5971         aix:)   saveccflags="$ccflags"
5972                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
5973         esac
5974         set try
5975         if eval $compile; then
5976                 foo=`$run ./try`
5977                 case "$foo" in
5978                 *" 4294967303.150000 1.150000 4294967302.000000")
5979                         echo >&4 "Your modfl() is broken for large values."
5980                         d_modfl_pow32_bug="$define"
5981                         case "$foo" in
5982                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
5983                         ;;
5984                         esac
5985                         ;;
5986                 *" 4294967303.150000 0.150000 4294967303.000000")
5987                         echo >&4 "Your modfl() seems okay for large values."
5988                         ;;
5989                 *)      echo >&4 "I don't understand your modfl() at all."
5990                         d_modfl="$undef"
5991                         ;;
5992                 esac
5993                 $rm -f try.* try core core.try.*
5994         else
5995                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
5996                 d_modfl="$undef"
5997         fi
5998         case "$osname:$gccversion" in
5999         aix:)   ccflags="$saveccflags" ;; # restore
6000         esac
6001         ;;
6002 esac
6003
6004 case "$ccflags" in
6005 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6006 esac
6007
6008 case "$uselongdouble" in
6009 $define|true|[yY]*)     dflt='y';;
6010 *) dflt='n';;
6011 esac
6012 cat <<EOM
6013
6014 Perl can be built to take advantage of long doubles which
6015 (if available) may give more accuracy and range for floating point numbers.
6016
6017 If this doesn't make any sense to you, just accept the default '$dflt'.
6018 EOM
6019 rp='Try to use long doubles if available?'
6020 . ./myread
6021 case "$ans" in
6022 y|Y)    val="$define"   ;;
6023 *)      val="$undef"    ;;
6024 esac
6025 set uselongdouble
6026 eval $setvar
6027
6028 case "$uselongdouble" in
6029 true|[yY]*) uselongdouble="$define" ;;
6030 esac
6031
6032 case "$uselongdouble" in
6033 $define)
6034 : Look for a hint-file generated 'call-back-unit'.  If the
6035 : user has specified that long doubles should be used,
6036 : we may need to set or change some other defaults.
6037         if $test -f uselongdouble.cbu; then
6038                 echo "Your platform has some specific hints for long doubles, using them..."
6039                 . ./uselongdouble.cbu
6040         else
6041                 $cat <<EOM
6042 (Your platform doesn't have any specific hints for long doubles.)
6043 EOM
6044         fi
6045         ;;
6046 esac
6047
6048 message=X
6049 case "$uselongdouble:$d_sqrtl:$d_modfl" in
6050 $define:$define:$define)
6051         : You have both
6052         ;;
6053 $define:$define:$undef)
6054         message="I could not find modfl"
6055         ;;
6056 $define:$undef:$define)
6057         message="I could not find sqrtl"
6058         ;;
6059 $define:$undef:$undef)
6060         message="I found neither sqrtl nor modfl"
6061         ;;
6062 esac
6063
6064 if $test "$message" != X; then
6065         $cat <<EOM >&4
6066
6067 *** You requested the use of long doubles but you do not seem to have
6068 *** the mathematic functions for long doubles.
6069 *** ($message)
6070 *** I'm disabling the use of long doubles.
6071
6072 EOM
6073
6074         uselongdouble=$undef
6075 fi
6076
6077 case "$useperlio" in
6078 $define|true|[yY]*|'')  dflt='y';;
6079 *) dflt='n';;
6080 esac
6081 cat <<EOM
6082
6083 Previous version of $package used the standard IO mechanisms as
6084 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
6085 alternate IO mechanisms via the PerlIO abstraction layer, but the
6086 stdio mechanism is still available if needed.  The abstraction layer
6087 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
6088 Using PerlIO with sfio may cause problems with some extension modules.
6089
6090 If this doesn't make any sense to you, just accept the default '$dflt'.
6091 EOM
6092 rp='Use the PerlIO abstraction layer?'
6093 . ./myread
6094 case "$ans" in
6095 y|Y) 
6096         val="$define"
6097         ;;
6098 *)      
6099         echo "Ok, doing things the stdio way."
6100         val="$undef"
6101         ;;
6102 esac
6103 set useperlio
6104 eval $setvar 
6105
6106 case "$usesocks" in
6107 $define|true|[yY]*)
6108         case "$useperlio" in
6109         $define|true|[yY]*) ;;
6110         *)      cat >&4 <<EOM
6111
6112 You are using the SOCKS proxy protocol library which means that you
6113 should also use the PerlIO layer.  You may be headed for trouble.
6114
6115 EOM
6116                 ;;
6117         esac
6118         ;;
6119 esac
6120
6121         
6122 : determine the architecture name
6123 echo " "
6124 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6125         tarch=`arch`"-$osname"
6126 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6127         if uname -m > tmparch 2>&1 ; then
6128                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6129                         -e 's/$/'"-$osname/" tmparch`
6130         else
6131                 tarch="$osname"
6132         fi
6133         $rm -f tmparch
6134 else
6135         tarch="$osname"
6136 fi
6137 case "$myarchname" in
6138 ''|"$tarch") ;;
6139 *)
6140         echo "(Your architecture name used to be $myarchname.)"
6141         archname=''
6142         ;;
6143 esac
6144 case "$targetarch" in
6145 '') ;;
6146 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6147 esac
6148 myarchname="$tarch"
6149 case "$archname" in
6150 '') dflt="$tarch";;
6151 *) dflt="$archname";;
6152 esac
6153 rp='What is your architecture name'
6154 . ./myread
6155 archname="$ans"
6156 case "$usethreads" in
6157 $define)
6158         echo "Threads selected." >&4
6159         case "$archname" in
6160         *-thread*) echo "...and architecture name already has -thread." >&4
6161                 ;;
6162         *)      archname="$archname-thread"
6163                 echo "...setting architecture name to $archname." >&4
6164                 ;;
6165         esac
6166         ;;
6167 esac
6168 case "$usemultiplicity" in
6169 $define)
6170         echo "Multiplicity selected." >&4
6171         case "$archname" in
6172         *-multi*) echo "...and architecture name already has -multi." >&4
6173                 ;;
6174         *)      archname="$archname-multi"
6175                 echo "...setting architecture name to $archname." >&4
6176                 ;;
6177         esac
6178         ;;
6179 esac
6180 case "$use64bitint$use64bitall" in
6181 *"$define"*)
6182         case "$archname64" in
6183         '')
6184                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6185                 ;;
6186         *)
6187                 case "$use64bitint" in
6188                 "$define") echo "64 bit integers selected." >&4 ;;
6189                 esac
6190                 case "$use64bitall" in
6191                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6192                 esac
6193                 case "$archname" in
6194                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6195                         ;;
6196                 *)      archname="$archname-$archname64"
6197                         echo "...setting architecture name to $archname." >&4
6198                         ;;
6199                 esac
6200                 ;;
6201         esac
6202 esac
6203 case "$uselongdouble" in
6204 $define)
6205         echo "Long doubles selected." >&4
6206         case "$longdblsize" in
6207         $doublesize)
6208                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6209                 ;;
6210         *)
6211                 case "$archname" in
6212                 *-ld*) echo "...and architecture name already has -ld." >&4
6213                         ;;
6214                 *)      archname="$archname-ld"
6215                         echo "...setting architecture name to $archname." >&4
6216                         ;;
6217                 esac
6218                 ;;
6219         esac
6220         ;;
6221 esac
6222 case "$useperlio" in
6223 $define)
6224         echo "Perlio selected." >&4
6225         ;;
6226 *)
6227         echo "Perlio not selected, using stdio." >&4
6228         case "$archname" in
6229         *-stdio*) echo "...and architecture name already has -stdio." >&4
6230                 ;;
6231         *)      archname="$archname-stdio"
6232                 echo "...setting architecture name to $archname." >&4
6233                 ;;
6234         esac
6235         ;;
6236 esac
6237
6238 : determine root of directory hierarchy where package will be installed.
6239 case "$prefix" in
6240 '')
6241         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
6242         ;;
6243 *)
6244         dflt="$prefix"
6245         ;;
6246 esac
6247 $cat <<EOM
6248
6249 By default, $package will be installed in $dflt/bin, manual pages
6250 under $dflt/man, etc..., i.e. with $dflt as prefix for all
6251 installation directories. Typically this is something like /usr/local.
6252 If you wish to have binaries under /usr/bin but other parts of the
6253 installation under /usr/local, that's ok: you will be prompted
6254 separately for each of the installation directories, the prefix being
6255 only used to set the defaults.
6256
6257 EOM
6258 fn=d~
6259 rp='Installation prefix to use?'
6260 . ./getfile
6261 oldprefix=''
6262 case "$prefix" in
6263 '') ;;
6264 *)
6265         case "$ans" in
6266         "$prefix") ;;
6267         *) oldprefix="$prefix";;
6268         esac
6269         ;;
6270 esac
6271 prefix="$ans"
6272 prefixexp="$ansexp"
6273
6274 case "$afsroot" in
6275 '')     afsroot=/afs ;;
6276 *)      afsroot=$afsroot ;;
6277 esac
6278
6279 : is AFS running?
6280 echo " "
6281 case "$afs" in
6282 $define|true)   afs=true ;;
6283 $undef|false)   afs=false ;;
6284 *)      if test -d $afsroot; then
6285                 afs=true
6286         else
6287                 afs=false
6288         fi
6289         ;;
6290 esac
6291 if $afs; then
6292         echo "AFS may be running... I'll be extra cautious then..." >&4
6293 else
6294         echo "AFS does not seem to be running..." >&4
6295 fi
6296
6297 : determine installation prefix for where package is to be installed.
6298 if $afs; then 
6299 $cat <<EOM
6300
6301 Since you are running AFS, I need to distinguish the directory in which
6302 files will reside from the directory in which they are installed (and from
6303 which they are presumably copied to the former directory by occult means).
6304
6305 EOM
6306         case "$installprefix" in
6307         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6308         *) dflt="$installprefix";;
6309         esac
6310 else
6311 $cat <<EOM
6312
6313 In some special cases, particularly when building $package for distribution,
6314 it is convenient to distinguish between the directory in which files should 
6315 be installed from the directory ($prefix) in which they 
6316 will eventually reside.  For most users, these two directories are the same.
6317
6318 EOM
6319         case "$installprefix" in
6320         '') dflt=$prefix ;;
6321         *) dflt=$installprefix;;
6322         esac
6323 fi
6324 fn=d~
6325 rp='What installation prefix should I use for installing files?'
6326 . ./getfile
6327 installprefix="$ans"
6328 installprefixexp="$ansexp"
6329
6330 : set the prefixit variable, to compute a suitable default value
6331 prefixit='case "$3" in
6332 ""|none)
6333         case "$oldprefix" in
6334         "") eval "$1=\"\$$2\"";;
6335         *)
6336                 case "$3" in
6337                 "") eval "$1=";;
6338                 none)
6339                         eval "tp=\"\$$2\"";
6340                         case "$tp" in
6341                         ""|" ") eval "$1=\"\$$2\"";;
6342                         *) eval "$1=";;
6343                         esac;;
6344                 esac;;
6345         esac;;
6346 *)
6347         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6348         case "$tp" in
6349         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6350         /*-$oldprefix/*|\~*-$oldprefix/*)
6351                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6352         *) eval "$1=\"\$$2\"";;
6353         esac;;
6354 esac'
6355
6356 : get the patchlevel
6357 echo " "
6358 echo "Getting the current patchlevel..." >&4
6359 if $test -r $rsrc/patchlevel.h;then
6360         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6361         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6362         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6363         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6364         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6365         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6366        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6367 else
6368         revision=0
6369         patchlevel=0
6370         subversion=0
6371         api_revision=0
6372         api_version=0
6373         api_subversion=0
6374         perl_patchlevel=0
6375         $echo "(You do not have patchlevel.h.  Eek.)"
6376 fi
6377 if $test -r $rsrc/.patch ; then  
6378         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6379                 perl_patchlevel=`cat $rsrc/.patch`
6380         fi
6381 fi
6382 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
6383 version_patchlevel_string="version $patchlevel subversion $subversion"
6384 case "$perl_patchlevel" in
6385 0|'') ;;
6386 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
6387 esac
6388
6389 $echo "(You have $package $version_patchlevel_string.)"
6390
6391 case "$osname" in
6392 dos|vms)
6393         : XXX Should be a Configure test for double-dots in filenames.
6394         version=`echo $revision $patchlevel $subversion | \
6395                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6396         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6397                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6398         ;;
6399 *)
6400         version=`echo $revision $patchlevel $subversion | \
6401                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6402         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6403                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6404         ;;
6405 esac
6406 : Special case the 5.005_xx maintenance series, which used 5.005
6407 : without any subversion label as a subdirectory in $sitelib
6408 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6409         api_versionstring='5.005'
6410 fi
6411
6412 : determine installation style
6413 : For now, try to deduce it from prefix unless it is already set.
6414 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6415 case "$installstyle" in
6416 '')     case "$prefix" in
6417                 *perl*) dflt='lib';;
6418                 *) dflt='lib/perl5' ;;
6419         esac
6420         ;;
6421 *)      dflt="$installstyle" ;;
6422 esac
6423 : Probably not worth prompting for this since we prompt for all
6424 : the directories individually, and the prompt would be too long and
6425 : confusing anyway.
6426 installstyle=$dflt
6427
6428 : determine where private library files go
6429 : Usual default is /usr/local/lib/perl5/$version.
6430 : Also allow things like /opt/perl/lib/$version, since 
6431 : /opt/perl/lib/perl5... would be redundant.
6432 : The default "style" setting is made in installstyle.U
6433 case "$installstyle" in
6434 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6435 *)       set dflt privlib lib/$version ;;
6436 esac
6437 eval $prefixit
6438 $cat <<EOM
6439
6440 There are some auxiliary files for $package that need to be put into a
6441 private library directory that is accessible by everyone.
6442
6443 EOM
6444 fn=d~+
6445 rp='Pathname where the private library files will reside?'
6446 . ./getfile
6447 privlib="$ans"
6448 privlibexp="$ansexp"
6449 : Change installation prefix, if necessary.
6450 if $test X"$prefix" != X"$installprefix"; then
6451         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6452 else
6453         installprivlib="$privlibexp"
6454 fi
6455
6456 : set the prefixup variable, to restore leading tilda escape
6457 prefixup='case "$prefixexp" in
6458 "$prefix") ;;
6459 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6460 esac'
6461
6462 : determine where public architecture dependent libraries go
6463 set archlib archlib
6464 eval $prefixit
6465 : privlib default is /usr/local/lib/$package/$version
6466 : archlib default is /usr/local/lib/$package/$version/$archname
6467 : privlib may have an optional trailing /share.
6468 tdflt=`echo $privlib | $sed 's,/share$,,'`
6469 tdflt=$tdflt/$archname
6470 case "$archlib" in
6471 '')     dflt=$tdflt
6472         ;;
6473 *)      dflt="$archlib"
6474     ;;
6475 esac
6476 $cat <<EOM
6477
6478 $spackage contains architecture-dependent library files.  If you are
6479 sharing libraries in a heterogeneous environment, you might store
6480 these files in a separate location.  Otherwise, you can just include
6481 them with the rest of the public library files.
6482
6483 EOM
6484 fn=d+~
6485 rp='Where do you want to put the public architecture-dependent libraries?'
6486 . ./getfile
6487 archlib="$ans"
6488 archlibexp="$ansexp"
6489 if $test X"$archlib" = X"$privlib"; then
6490         d_archlib="$undef"
6491 else
6492         d_archlib="$define"
6493 fi
6494 : Change installation prefix, if necessary.
6495 if $test X"$prefix" != X"$installprefix"; then
6496         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6497 else
6498         installarchlib="$archlibexp"
6499 fi
6500
6501 : see if setuid scripts can be secure
6502 $cat <<EOM
6503
6504 Some kernels have a bug that prevents setuid #! scripts from being
6505 secure.  Some sites have disabled setuid #! scripts because of this.
6506
6507 First let's decide if your kernel supports secure setuid #! scripts.
6508 (If setuid #! scripts would be secure but have been disabled anyway,
6509 don't say that they are secure if asked.)
6510
6511 EOM
6512
6513 val="$undef"
6514 if $test -d /dev/fd; then
6515         echo "#!$ls" >reflect
6516         chmod +x,u+s reflect
6517         ./reflect >flect 2>&1
6518         if $contains "/dev/fd" flect >/dev/null; then
6519                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6520                 val="$define"
6521         else
6522                 $cat <<EOM
6523 If you are not sure if they are secure, I can check but I'll need a
6524 username and password different from the one you are using right now.
6525 If you don't have such a username or don't want me to test, simply
6526 enter 'none'.
6527
6528 EOM
6529                 rp='Other username to test security of setuid scripts with?'
6530                 dflt='none'
6531                 . ./myread
6532                 case "$ans" in
6533                 n|none)
6534                         case "$d_suidsafe" in
6535                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6536                                 dflt=n;;
6537                         "$undef")
6538                                 echo "Well, the $hint value is *not* secure." >&4
6539                                 dflt=n;;
6540                         *)      echo "Well, the $hint value *is* secure." >&4
6541                                 dflt=y;;
6542                         esac
6543                         ;;
6544                 *)
6545                         $rm -f reflect flect
6546                         echo "#!$ls" >reflect
6547                         chmod +x,u+s reflect
6548                         echo >flect
6549                         chmod a+w flect
6550                         echo '"su" will (probably) prompt you for '"$ans's password."
6551                         su $ans -c './reflect >flect'
6552                         if $contains "/dev/fd" flect >/dev/null; then
6553                                 echo "Okay, it looks like setuid scripts are secure." >&4
6554                                 dflt=y
6555                         else
6556                                 echo "I don't think setuid scripts are secure." >&4
6557                                 dflt=n
6558                         fi
6559                         ;;
6560                 esac
6561                 rp='Does your kernel have *secure* setuid scripts?'
6562                 . ./myread
6563                 case "$ans" in
6564                 [yY]*)  val="$define";;
6565                 *)      val="$undef";;
6566                 esac
6567         fi
6568 else
6569         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6570         echo "(That's for file descriptors, not floppy disks.)"
6571         val="$undef"
6572 fi
6573 set d_suidsafe
6574 eval $setvar
6575
6576 $rm -f reflect flect
6577
6578 : now see if they want to do setuid emulation
6579 echo " "
6580 val="$undef"
6581 case "$d_suidsafe" in
6582 "$define")
6583         val="$undef"
6584         echo "No need to emulate SUID scripts since they are secure here." >&4
6585         ;;
6586 *)
6587         $cat <<EOM
6588 Some systems have disabled setuid scripts, especially systems where
6589 setuid scripts cannot be secure.  On systems where setuid scripts have
6590 been disabled, the setuid/setgid bits on scripts are currently
6591 useless.  It is possible for $package to detect those bits and emulate
6592 setuid/setgid in a secure fashion.  This emulation will only work if
6593 setuid scripts have been disabled in your kernel.
6594
6595 EOM
6596         case "$d_dosuid" in
6597         "$define") dflt=y ;;
6598         *) dflt=n ;;
6599         esac
6600         rp="Do you want to do setuid/setgid emulation?"
6601         . ./myread
6602         case "$ans" in
6603         [yY]*)  val="$define";;
6604         *)      val="$undef";;
6605         esac
6606         ;;
6607 esac
6608 set d_dosuid
6609 eval $setvar
6610
6611 : see if this is a malloc.h system
6612 set malloc.h i_malloc
6613 eval $inhdr
6614
6615 : see if stdlib is available
6616 set stdlib.h i_stdlib
6617 eval $inhdr
6618
6619 : check for void type
6620 echo " "
6621 echo "Checking to see how well your C compiler groks the void type..." >&4
6622 case "$voidflags" in
6623 '')
6624         $cat >try.c <<'EOCP'
6625 #if TRY & 1
6626 void sub() {
6627 #else
6628 sub() {
6629 #endif
6630         extern void moo();      /* function returning void */
6631         void (*goo)();          /* ptr to func returning void */
6632 #if TRY & 8
6633         void *hue;              /* generic ptr */
6634 #endif
6635 #if TRY & 2
6636         void (*foo[10])();
6637 #endif
6638
6639 #if TRY & 4
6640         if(goo == moo) {
6641                 exit(0);
6642         }
6643 #endif
6644         exit(0);
6645 }
6646 int main() { sub(); }
6647 EOCP
6648         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6649                 voidflags=$defvoidused
6650         echo "Good.  It appears to support void to the level $package wants.">&4
6651                 if $contains warning .out >/dev/null 2>&1; then
6652                         echo "However, you might get some warnings that look like this:"
6653                         $cat .out
6654                 fi
6655         else
6656 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6657                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6658                         echo "It supports 1..."
6659                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6660                                 echo "It also supports 2..."
6661                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6662                                         voidflags=7
6663                                         echo "And it supports 4 but not 8 definitely."
6664                                 else
6665                                         echo "It doesn't support 4..."
6666                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6667                                                 voidflags=11
6668                                                 echo "But it supports 8."
6669                                         else
6670                                                 voidflags=3
6671                                                 echo "Neither does it support 8."
6672                                         fi
6673                                 fi
6674                         else
6675                                 echo "It does not support 2..."
6676                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6677                                         voidflags=13
6678                                         echo "But it supports 4 and 8."
6679                                 else
6680                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6681                                                 voidflags=5
6682                                                 echo "And it supports 4 but has not heard about 8."
6683                                         else
6684                                                 echo "However it supports 8 but not 4."
6685                                         fi
6686                                 fi
6687                         fi
6688                 else
6689                         echo "There is no support at all for void."
6690                         voidflags=0
6691                 fi
6692         fi
6693 esac
6694 case "$voidflags" in
6695 "$defvoidused") ;;
6696 *)      $cat >&4 <<'EOM'
6697   Support flag bits are:
6698     1: basic void declarations.
6699     2: arrays of pointers to functions returning void.
6700     4: operations between pointers to and addresses of void functions.
6701     8: generic void pointers.
6702 EOM
6703         dflt="$voidflags";
6704         rp="Your void support flags add up to what?"
6705         . ./myread
6706         voidflags="$ans"
6707         ;;
6708 esac
6709 $rm -f try.* .out
6710
6711 : check for length of pointer
6712 echo " "
6713 case "$ptrsize" in
6714 '')
6715         echo "Checking to see how big your pointers are..." >&4
6716         if test "$voidflags" -gt 7; then
6717                 echo '#define VOID_PTR char *' > try.c
6718         else
6719                 echo '#define VOID_PTR void *' > try.c
6720         fi
6721         $cat >>try.c <<'EOCP'
6722 #include <stdio.h>
6723 int main()
6724 {
6725     printf("%d\n", (int)sizeof(VOID_PTR));
6726     exit(0);
6727 }
6728 EOCP
6729         set try
6730         if eval $compile_ok; then
6731                 ptrsize=`$run ./try`
6732                 echo "Your pointers are $ptrsize bytes long."
6733         else
6734                 dflt='4'
6735                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6736                 rp="What is the size of a pointer (in bytes)?"
6737                 . ./myread
6738                 ptrsize="$ans"
6739         fi
6740         ;;
6741 esac
6742 $rm -f try.c try
6743 case "$use64bitall" in
6744 "$define"|true|[yY]*)
6745         case "$ptrsize" in
6746         4)      cat <<EOM >&4
6747
6748 *** You have chosen a maximally 64-bit build, but your pointers
6749 *** are only 4 bytes wide, disabling maximal 64-bitness.
6750
6751 EOM
6752                 use64bitall="$undef"
6753                 case "$use64bitint" in
6754                 "$define"|true|[yY]*) ;;
6755                 *)      cat <<EOM >&4
6756
6757 *** Downgrading from maximal 64-bitness to using 64-bit integers.
6758
6759 EOM
6760                         use64bitint="$define"
6761                         ;;
6762                 esac
6763                 ;;
6764         esac
6765         ;;
6766 esac
6767
6768
6769 : determine which malloc to compile in
6770 echo " "
6771 case "$usemymalloc" in
6772 [yY]*|true|$define)     dflt='y' ;;
6773 [nN]*|false|$undef)     dflt='n' ;;
6774 *)      case "$ptrsize" in
6775         4) dflt='y' ;;
6776         *) dflt='n' ;;
6777         esac
6778         ;;
6779 esac
6780 rp="Do you wish to attempt to use the malloc that comes with $package?"
6781 . ./myread
6782 usemymalloc="$ans"
6783 case "$ans" in
6784 y*|true)
6785         usemymalloc='y'
6786         mallocsrc='malloc.c'
6787         mallocobj="malloc$_o"
6788         d_mymalloc="$define"
6789         case "$libs" in
6790         *-lmalloc*)
6791                 : Remove malloc from list of libraries to use
6792                 echo "Removing unneeded -lmalloc from library list" >&4
6793                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6794                 shift
6795                 libs="$*"
6796                 echo "libs = $libs" >&4
6797                 ;;
6798         esac
6799         ;;
6800 *)
6801         usemymalloc='n'
6802         mallocsrc=''
6803         mallocobj=''
6804         d_mymalloc="$undef"
6805         ;;
6806 esac
6807
6808 : compute the return types of malloc and free
6809 echo " "
6810 $cat >malloc.c <<END
6811 #$i_malloc I_MALLOC
6812 #$i_stdlib I_STDLIB
6813 #include <stdio.h>
6814 #include <sys/types.h>
6815 #ifdef I_MALLOC
6816 #include <malloc.h>
6817 #endif
6818 #ifdef I_STDLIB
6819 #include <stdlib.h>
6820 #endif
6821 #ifdef TRY_MALLOC
6822 void *malloc();
6823 #endif
6824 #ifdef TRY_FREE
6825 void free();
6826 #endif
6827 END
6828 case "$malloctype" in
6829 '')
6830         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6831                 malloctype='void *'
6832         else
6833                 malloctype='char *'
6834         fi
6835         ;;
6836 esac
6837 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6838
6839 case "$freetype" in
6840 '')
6841         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6842                 freetype='void'
6843         else
6844                 freetype='int'
6845         fi
6846         ;;
6847 esac
6848 echo "Your system uses $freetype free(), it would seem." >&4
6849 $rm -f malloc.[co]
6850 $cat <<EOM
6851
6852 After $package is installed, you may wish to install various
6853 add-on modules and utilities.  Typically, these add-ons will
6854 be installed under $prefix with the rest
6855 of this package.  However, you may wish to install such add-ons
6856 elsewhere under a different prefix.
6857
6858 If you do not wish to put everything under a single prefix, that's
6859 ok.  You will be prompted for the individual locations; this siteprefix
6860 is only used to suggest the defaults.
6861
6862 The default should be fine for most people.
6863
6864 EOM
6865 fn=d~+
6866 rp='Installation prefix to use for add-on modules and utilities?'
6867 : XXX Here might be another good place for an installstyle setting.
6868 case "$siteprefix" in
6869 '') dflt=$prefix ;;
6870 *)  dflt=$siteprefix ;;
6871 esac
6872 . ./getfile
6873 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6874 oldsiteprefix=''
6875 case "$siteprefix" in
6876 '') ;;
6877 *)      case "$ans" in
6878         "$prefix") ;;
6879         *) oldsiteprefix="$prefix";;
6880         esac
6881         ;;
6882 esac
6883 siteprefix="$ans"
6884 siteprefixexp="$ansexp"
6885
6886 : determine where site specific libraries go.
6887 : Usual default is /usr/local/lib/perl5/site_perl/$version
6888 : The default "style" setting is made in installstyle.U
6889 : XXX No longer works with Prefixit stuff.
6890 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6891 case "$sitelib" in
6892 '') case "$installstyle" in
6893         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6894         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6895         esac
6896         ;;
6897 *)      dflt="$sitelib"
6898         ;;
6899 esac
6900 $cat <<EOM
6901
6902 The installation process will create a directory for
6903 site-specific extensions and modules.  Most users find it convenient
6904 to place all site-specific files in this directory rather than in the
6905 main distribution directory.
6906
6907 EOM
6908 fn=d~+
6909 rp='Pathname for the site-specific library files?'
6910 . ./getfile
6911 sitelib="$ans"
6912 sitelibexp="$ansexp"
6913 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6914 : Change installation prefix, if necessary.
6915 if $test X"$prefix" != X"$installprefix"; then
6916         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6917 else
6918         installsitelib="$sitelibexp"
6919 fi
6920
6921 : determine where site specific architecture-dependent libraries go.
6922 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6923 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6924 : sitelib may have an optional trailing /share.
6925 case "$sitearch" in
6926 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6927         dflt="$dflt/$archname"
6928         ;;
6929 *)      dflt="$sitearch"
6930         ;;
6931 esac
6932 set sitearch sitearch none
6933 eval $prefixit
6934 $cat <<EOM
6935
6936 The installation process will also create a directory for
6937 architecture-dependent site-specific extensions and modules.
6938
6939 EOM
6940 fn=d~+
6941 rp='Pathname for the site-specific architecture-dependent library files?'
6942 . ./getfile
6943 sitearch="$ans"
6944 sitearchexp="$ansexp"
6945 : Change installation prefix, if necessary.
6946 if $test X"$prefix" != X"$installprefix"; then
6947         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6948 else
6949         installsitearch="$sitearchexp"
6950 fi
6951
6952 $cat <<EOM
6953
6954 The installation process will also create a directory for
6955 vendor-supplied add-ons.  Vendors who supply perl with their system
6956 may find it convenient to place all vendor-supplied files in this
6957 directory rather than in the main distribution directory.  This will
6958 ease upgrades between binary-compatible maintenance versions of perl.
6959
6960 Of course you may also use these directories in whatever way you see
6961 fit.  For example, you might use them to access modules shared over a
6962 company-wide network.
6963
6964 The default answer should be fine for most people.
6965 This causes further questions about vendor add-ons to be skipped
6966 and no vendor-specific directories will be configured for perl.
6967
6968 EOM
6969 rp='Do you want to configure vendor-specific add-on directories?'
6970 case "$usevendorprefix" in
6971 define|true|[yY]*) dflt=y ;;
6972 *)      : User may have set vendorprefix directly on Configure command line.
6973         case "$vendorprefix" in
6974         ''|' ') dflt=n ;;
6975         *)      dflt=y ;;
6976         esac
6977         ;;
6978 esac
6979 . ./myread
6980 case "$ans" in
6981 [yY]*)  fn=d~+
6982         rp='Installation prefix to use for vendor-supplied add-ons?'
6983         case "$vendorprefix" in
6984         '') dflt='' ;;
6985         *)  dflt=$vendorprefix ;;
6986         esac
6987         . ./getfile
6988         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6989         oldvendorprefix=''
6990         case "$vendorprefix" in
6991         '') ;;
6992         *)      case "$ans" in
6993                 "$prefix") ;;
6994                 *) oldvendorprefix="$prefix";;
6995                 esac
6996                 ;;
6997         esac
6998         usevendorprefix="$define"
6999         vendorprefix="$ans"
7000         vendorprefixexp="$ansexp"
7001         ;;
7002 *)      usevendorprefix="$undef"
7003         vendorprefix=''
7004         vendorprefixexp=''
7005         ;;
7006 esac
7007
7008 case "$vendorprefix" in
7009 '')     d_vendorlib="$undef"
7010         vendorlib=''
7011         vendorlibexp=''
7012         ;;
7013 *)      d_vendorlib="$define"
7014         : determine where vendor-supplied modules go.
7015         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7016         case "$vendorlib" in
7017         '')
7018                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7019                 case "$installstyle" in
7020                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7021                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7022                 esac
7023                 ;;
7024         *)      dflt="$vendorlib"
7025                 ;;
7026         esac
7027         fn=d~+
7028         rp='Pathname for the vendor-supplied library files?'
7029         . ./getfile
7030         vendorlib="$ans"
7031         vendorlibexp="$ansexp"
7032         ;;
7033 esac
7034 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7035 : Change installation prefix, if necessary.
7036 if $test X"$prefix" != X"$installprefix"; then
7037         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
7038 else
7039         installvendorlib="$vendorlibexp"
7040 fi
7041
7042 case "$vendorprefix" in
7043 '')     d_vendorarch="$undef"
7044         vendorarch=''
7045         vendorarchexp=''
7046         ;;
7047 *)      d_vendorarch="$define"
7048         : determine where vendor-supplied architecture-dependent libraries go.
7049         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7050         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7051         : vendorlib may have an optional trailing /share.
7052         case "$vendorarch" in
7053         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7054                 dflt="$dflt/$archname"
7055                 ;;
7056         *)      dflt="$vendorarch" ;;
7057         esac
7058         fn=d~+
7059         rp='Pathname for vendor-supplied architecture-dependent files?'
7060         . ./getfile
7061         vendorarch="$ans"
7062         vendorarchexp="$ansexp"
7063         ;;
7064 esac
7065 : Change installation prefix, if necessary.
7066 if $test X"$prefix" != X"$installprefix"; then
7067         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
7068 else
7069         installvendorarch="$vendorarchexp"
7070 fi
7071
7072 : Final catch-all directories to search
7073 $cat <<EOM
7074
7075 Lastly, you can have perl look in other directories for extensions and
7076 modules in addition to those already specified.
7077 These directories will be searched after 
7078         $sitearch 
7079         $sitelib 
7080 EOM
7081 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7082 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7083 echo ' '
7084 case "$otherlibdirs" in
7085 ''|' ') dflt='none' ;;
7086 *)      dflt="$otherlibdirs" ;;
7087 esac
7088 $cat <<EOM
7089 Enter a colon-separated set of extra paths to include in perl's @INC
7090 search path, or enter 'none' for no extra paths.
7091
7092 EOM
7093
7094 rp='Colon-separated list of additional directories for perl to search?'
7095 . ./myread
7096 case "$ans" in
7097 ' '|''|none)    otherlibdirs=' ' ;;     
7098 *)      otherlibdirs="$ans" ;;
7099 esac
7100 case "$otherlibdirs" in
7101 ' ') val=$undef ;;
7102 *)      val=$define ;;
7103 esac
7104 set d_perl_otherlibdirs
7105 eval $setvar
7106
7107 : Cruising for prototypes
7108 echo " "
7109 echo "Checking out function prototypes..." >&4
7110 $cat >prototype.c <<'EOCP'
7111 int main(int argc, char *argv[]) {
7112         exit(0);}
7113 EOCP
7114 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7115         echo "Your C compiler appears to support function prototypes."
7116         val="$define"
7117 else
7118         echo "Your C compiler doesn't seem to understand function prototypes."
7119         val="$undef"
7120 fi
7121 set prototype
7122 eval $setvar
7123 $rm -f prototype*
7124
7125 case "$prototype" in
7126 "$define") ;;
7127 *)      ansi2knr='ansi2knr'
7128         echo " "
7129         cat <<EOM >&4
7130
7131 $me:  FATAL ERROR:
7132 This version of $package can only be compiled by a compiler that 
7133 understands function prototypes.  Unfortunately, your C compiler 
7134         $cc $ccflags
7135 doesn't seem to understand them.  Sorry about that.
7136
7137 If GNU cc is available for your system, perhaps you could try that instead.  
7138
7139 Eventually, we hope to support building Perl with pre-ANSI compilers.
7140 If you would like to help in that effort, please contact <perlbug@perl.org>.
7141
7142 Aborting Configure now.
7143 EOM
7144         exit 2
7145         ;;
7146 esac
7147
7148 : determine where public executables go
7149 echo " "
7150 set dflt bin bin
7151 eval $prefixit
7152 fn=d~
7153 rp='Pathname where the public executables will reside?'
7154 . ./getfile
7155 if $test "X$ansexp" != "X$binexp"; then
7156         installbin=''
7157 fi
7158 bin="$ans"
7159 binexp="$ansexp"
7160 : Change installation prefix, if necessary.
7161 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7162 if $test X"$prefix" != X"$installprefix"; then
7163         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
7164 else
7165         installbin="$binexp"
7166 fi
7167
7168 echo " "
7169 case "$extras" in
7170 '') dflt='n';;
7171 *) dflt='y';;
7172 esac
7173 cat <<EOM
7174 Perl can be built with extra modules or bundles of modules which
7175 will be fetched from the CPAN and installed alongside Perl.
7176
7177 Notice that you will need access to the CPAN; either via the Internet,
7178 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7179 be asked later to configure the CPAN.pm module which will in turn do
7180 the installation of the rest of the extra modules or bundles.)
7181
7182 Notice also that if the modules require any external software such as
7183 libraries and headers (the libz library and the zlib.h header for the
7184 Compress::Zlib module, for example) you MUST have any such software
7185 already installed, this configuration process will NOT install such
7186 things for you.
7187
7188 If this doesn't make any sense to you, just accept the default '$dflt'.
7189 EOM
7190 rp='Install any extra modules (y or n)?'
7191 . ./myread
7192 case "$ans" in
7193 y|Y)
7194         cat <<EOM
7195
7196 Please list any extra modules or bundles to be installed from CPAN,
7197 with spaces between the names.  The names can be in any format the
7198 'install' command of CPAN.pm will understand.  (Answer 'none',
7199 without the quotes, to install no extra modules or bundles.)
7200 EOM
7201         rp='Extras?'
7202         dflt="$extras"
7203         . ./myread
7204         extras="$ans"
7205 esac
7206 case "$extras" in
7207 ''|'none')
7208         val=''
7209         $rm -f ../extras.lst
7210         ;;
7211 *)      echo "(Saving the list of extras for later...)"
7212         echo "$extras" > ../extras.lst
7213         val="'$extras'"
7214         ;;
7215 esac
7216 set extras
7217 eval $setvar
7218 echo " "
7219
7220 : Find perl5.005 or later.
7221 echo "Looking for a previously installed perl5.005 or later... "
7222 case "$perl5" in
7223 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7224                 : Check if this perl is recent and can load a simple module
7225                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7226                         perl5=$tdir/perl
7227                         break;
7228                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7229                         perl5=$tdir/perl5
7230                         break;
7231                 fi
7232         done
7233         ;;
7234 *)      perl5="$perl5"
7235         ;;
7236 esac
7237 case "$perl5" in
7238 '')     echo "None found.  That's ok.";;
7239 *)      echo "Using $perl5." ;;
7240 esac
7241
7242 : Determine list of previous versions to include in @INC
7243 $cat > getverlist <<EOPL
7244 #!$perl5 -w
7245 use File::Basename;
7246 \$api_versionstring = "$api_versionstring";
7247 \$version = "$version";
7248 \$stem = "$sitelib_stem";
7249 \$archname = "$archname";
7250 EOPL
7251         $cat >> getverlist <<'EOPL'
7252 # Can't have leading @ because metaconfig interprets it as a command!
7253 ;@inc_version_list=();
7254 # XXX Redo to do opendir/readdir? 
7255 if (-d $stem) {
7256     chdir($stem);
7257     ;@candidates = glob("5.*");
7258 }
7259 else {
7260     ;@candidates = ();
7261 }
7262
7263 # XXX ToDo:  These comparisons must be reworked when two-digit
7264 # subversions come along, so that 5.7.10 compares as greater than
7265 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
7266 # widespread that we can use the built-in version vectors rather
7267 # than reinventing them here.  For 5.6.0, however, we must
7268 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
7269 foreach $d (@candidates) {
7270     if ($d lt $version) {
7271         if ($d ge $api_versionstring) {
7272             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
7273         }
7274         elsif ($d ge "5.005") {
7275             unshift(@inc_version_list, grep { -d } $d);
7276         }
7277     }
7278     else {
7279         # Skip newer version.  I.e. don't look in
7280         # 5.7.0 if we're installing 5.6.1.
7281     }
7282 }
7283
7284 if (@inc_version_list) {
7285     print join(' ', @inc_version_list);
7286 }
7287 else {
7288     # Blank space to preserve value for next Configure run.
7289     print " ";
7290 }
7291 EOPL
7292 chmod +x getverlist
7293 case "$inc_version_list" in
7294 '')     if test -x "$perl5$exe_ext"; then
7295                 dflt=`$perl5 getverlist`
7296         else
7297                 dflt='none'
7298         fi
7299         ;;
7300 $undef) dflt='none' ;;
7301 *)  eval dflt=\"$inc_version_list\" ;;
7302 esac
7303 case "$dflt" in
7304 ''|' ') dflt=none ;;
7305 esac
7306 case "$dflt" in
7307 5.005) dflt=none ;;
7308 esac
7309 $cat <<'EOM'
7310
7311 In order to ease the process of upgrading, this version of perl 
7312 can be configured to use modules built and installed with earlier 
7313 versions of perl that were installed under $prefix.  Specify here
7314 the list of earlier versions that this version of perl should check.
7315 If Configure detected no earlier versions of perl installed under
7316 $prefix, then the list will be empty.  Answer 'none' to tell perl
7317 to not search earlier versions.
7318
7319 The default should almost always be sensible, so if you're not sure,
7320 just accept the default.
7321 EOM
7322
7323 rp='List of earlier versions to include in @INC?'
7324 . ./myread
7325 case "$ans" in
7326 [Nn]one|''|' ') inc_version_list=' ' ;;
7327 *) inc_version_list="$ans" ;;
7328 esac
7329 case "$inc_version_list" in
7330 ''|' ') 
7331         inc_version_list_init='0';;
7332 *)      inc_version_list_init=`echo $inc_version_list |
7333                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7334         ;;
7335 esac
7336 $rm -f getverlist
7337
7338 : determine whether to install perl also as /usr/bin/perl
7339
7340 echo " "
7341 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7342         $cat <<EOM
7343 Many scripts expect perl to be installed as /usr/bin/perl.
7344 I can install the perl you are about to compile also as /usr/bin/perl
7345 (in addition to $installbin/perl).
7346 EOM
7347         case "$installusrbinperl" in
7348         "$undef"|[nN]*) dflt='n';;
7349         *)              dflt='y';;
7350         esac
7351         rp="Do you want to install perl as /usr/bin/perl?"
7352         . ./myread
7353         case "$ans" in
7354         [yY]*)  val="$define";;
7355         *)      val="$undef" ;;
7356         esac
7357 else
7358         val="$undef"
7359 fi
7360 set installusrbinperl
7361 eval $setvar
7362
7363 : see if dld is available
7364 set dld.h i_dld
7365 eval $inhdr
7366
7367 : see if dlopen exists
7368 xxx_runnm="$runnm"
7369 runnm=false
7370 set dlopen d_dlopen
7371 eval $inlibc
7372 runnm="$xxx_runnm"
7373
7374 : determine which dynamic loading, if any, to compile in
7375 echo " "
7376 dldir="ext/DynaLoader"
7377 case "$usedl" in
7378 $define|y|true)
7379         dflt='y'
7380         usedl="$define"
7381         ;;
7382 $undef|n|false)
7383         dflt='n'
7384         usedl="$undef"
7385         ;;
7386 *) 
7387         dflt='n'
7388         case "$d_dlopen" in
7389             $define) dflt='y' ;;
7390         esac
7391         case "$i_dld" in
7392             $define) dflt='y' ;;
7393         esac
7394         : Does a dl_xxx.xs file exist for this operating system
7395         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7396         ;;
7397 esac
7398 rp="Do you wish to use dynamic loading?"
7399 . ./myread
7400 usedl="$ans"
7401 case "$ans" in
7402 y*) usedl="$define"
7403         case "$dlsrc" in
7404         '')
7405                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7406                         dflt="$dldir/dl_${osname}.xs"
7407                 elif $test "$d_dlopen" = "$define" ; then
7408                         dflt="$dldir/dl_dlopen.xs"
7409                 elif $test "$i_dld" = "$define" ; then
7410                         dflt="$dldir/dl_dld.xs"
7411                 else
7412                         dflt=''
7413                 fi
7414                 ;;
7415         *)      dflt="$dldir/$dlsrc"
7416                 ;;
7417         esac
7418     echo "The following dynamic loading files are available:"
7419         : Can not go over to $dldir because getfile has path hard-coded in.
7420         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7421         rp="Source file to use for dynamic loading"
7422         fn="fne"
7423         gfpth="$src"
7424         . ./getfile
7425         usedl="$define"
7426         : emulate basename
7427         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7428
7429         $cat << EOM
7430
7431 Some systems may require passing special flags to $cc -c to
7432 compile modules that will be used to create a shared library.
7433 To use no flags, say "none".
7434
7435 EOM
7436     case "$cccdlflags" in
7437     '') case "$gccversion" in
7438                 '') case "$osname" in
7439                         hpux)   dflt='+z' ;;
7440                         next)   dflt='none' ;;
7441                         irix*)  dflt='-KPIC' ;;
7442                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7443                         sunos)  dflt='-pic' ;;
7444                         *)      dflt='none' ;;
7445                     esac
7446                         ;;
7447                 *)  case "$osname" in
7448                         darwin) dflt='none' ;;
7449                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7450                         *)      dflt='-fpic' ;;
7451                     esac ;;
7452             esac ;;
7453         ' ') dflt='none' ;;
7454     *)  dflt="$cccdlflags" ;;
7455     esac
7456     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7457     . ./myread
7458     case "$ans" in
7459     none) cccdlflags=' ' ;;
7460     *) cccdlflags="$ans" ;;
7461     esac
7462
7463     cat << EOM
7464
7465 Some systems use ld to create libraries that can be dynamically loaded,
7466 while other systems (such as those using ELF) use $cc.
7467
7468 EOM
7469         case "$ld" in
7470         '')     $cat >try.c <<'EOM'
7471 /* Test for whether ELF binaries are produced */
7472 #include <fcntl.h>
7473 #include <stdlib.h>
7474 int main() {
7475         char b[4];
7476         int i = open("a.out",O_RDONLY);
7477         if(i == -1) 
7478                 exit(1); /* fail */
7479         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7480                 exit(0); /* succeed (yes, it's ELF) */
7481         else
7482                 exit(1); /* fail */
7483 }
7484 EOM
7485                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7486                         cat <<EOM
7487 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7488 EOM
7489                         dflt="$cc"
7490                 else
7491                         echo "I'll use ld to build dynamic libraries."
7492                         dflt='ld'
7493                 fi
7494                 rm -f try.c a.out
7495                 ;;
7496         *)      dflt="$ld"
7497                 ;;
7498         esac
7499
7500     rp="What command should be used to create dynamic libraries?"
7501     . ./myread
7502         ld="$ans"
7503
7504     cat << EOM
7505
7506 Some systems may require passing special flags to $ld to create a
7507 library that can be dynamically loaded.  If your ld flags include
7508 -L/other/path options to locate libraries outside your loader's normal
7509 search path, you may need to specify those -L options here as well.  To
7510 use no flags, say "none".
7511
7512 EOM
7513     case "$lddlflags" in
7514     '') case "$osname" in
7515                         beos) dflt='-nostart' ;;
7516                         hpux) dflt='-b';
7517                               case "$gccversion" in
7518                               '') dflt="$dflt +vnocompatwarnings" ;;
7519                               esac
7520                               ;;        
7521                         linux|irix*)    dflt='-shared' ;;
7522                         next)  dflt='none' ;;
7523                         solaris) dflt='-G' ;;
7524                         sunos) dflt='-assert nodefinitions' ;;
7525                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7526                 *)     dflt='none' ;;
7527                         esac
7528                         ;;
7529     *) dflt="$lddlflags" ;;
7530     esac
7531
7532         : Try to guess additional flags to pick up local libraries.
7533         : Be careful not to append to a plain 'none'
7534         case "$dflt" in
7535         none) dflt='' ;;
7536         esac
7537         for thisflag in $ldflags; do
7538                 case "$thisflag" in
7539                 -L*|-R*|-Wl,-R*)
7540                         case " $dflt " in
7541                         *" $thisflag "*) ;;
7542                         *) dflt="$dflt $thisflag" ;;
7543                         esac
7544                         ;;
7545                 esac
7546         done
7547
7548         case "$dflt" in
7549         ''|' ') dflt='none' ;;
7550         esac
7551
7552     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7553     . ./myread
7554     case "$ans" in
7555     none) lddlflags=' ' ;;
7556     *) lddlflags="$ans" ;;
7557     esac
7558
7559         cat <<EOM
7560
7561 Some systems may require passing special flags to $cc to indicate that
7562 the resulting executable will use dynamic linking.  To use no flags,
7563 say "none".
7564
7565 EOM
7566     case "$ccdlflags" in
7567     '') case "$osname" in
7568                 hpux)   dflt='-Wl,-E' ;;
7569                 linux)  dflt='-rdynamic' ;;
7570                 next)   dflt='none' ;;
7571                 sunos)  dflt='none' ;;
7572                 *)      dflt='none' ;;
7573             esac ;;
7574     ' ')  dflt='none' ;;
7575     *)  dflt="$ccdlflags" ;;
7576     esac
7577     rp="Any special flags to pass to $cc to use dynamic linking?"
7578     . ./myread
7579     case "$ans" in
7580     none) ccdlflags=' ' ;;
7581     *) ccdlflags="$ans" ;;
7582     esac
7583     ;;
7584 *)  usedl="$undef"
7585         ld='ld'
7586     dlsrc='dl_none.xs'
7587     lddlflags=''
7588     ccdlflags=''
7589     ;;
7590 esac
7591
7592 also=''
7593 case "$usedl" in
7594 $undef)
7595         # No dynamic loading being used, so don't bother even to prompt.
7596         useshrplib='false'
7597         ;;
7598 *)      case "$useshrplib" in
7599         '')     case "$osname" in
7600                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7601                         dflt=y
7602                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7603                         ;;
7604                 next*)
7605                         case "$osvers" in
7606                         4*)     dflt=y
7607                                 also='Building a shared libperl is needed for MAB support.'
7608                                 ;;
7609                         *)      dflt=n
7610                                 ;;
7611                         esac
7612                         ;;
7613                 *)      dflt=n
7614                         ;;
7615                 esac
7616                 ;;
7617         $define|true|[Yy]*)
7618                 dflt=y
7619                 ;;
7620         *)      dflt=n
7621                 ;;
7622         esac
7623         $cat << EOM
7624
7625 The perl executable is normally obtained by linking perlmain.c with
7626 libperl${_a}, any static extensions (usually just DynaLoader), and
7627 any other libraries needed on this system (such as -lm, etc.).  Since
7628 your system supports dynamic loading, it is probably possible to build
7629 a shared libperl.$so.  If you will have more than one executable linked
7630 to libperl.$so, this will significantly reduce the size of each
7631 executable, but it may have a noticeable affect on performance.  The
7632 default is probably sensible for your system.
7633 $also
7634
7635 EOM
7636         rp="Build a shared libperl.$so (y/n)"
7637         . ./myread
7638         case "$ans" in
7639         true|$define|[Yy]*)
7640                 useshrplib='true'  ;;
7641         *)      useshrplib='false' ;;
7642         esac
7643         ;;
7644 esac
7645
7646 case "$useshrplib" in
7647 true)
7648         case "$libperl" in
7649         '')
7650                 # Figure out a good name for libperl.so.  Since it gets stored in
7651                 # a version-specific architecture-dependent library, the version
7652                 # number isn't really that important, except for making cc/ld happy.
7653                 #
7654                 # A name such as libperl.so.3.1
7655                 majmin="libperl.$so.$patchlevel.$subversion"
7656                 # A name such as libperl.so.301
7657                 majonly=`echo $patchlevel $subversion |
7658                         $awk '{printf "%d%02d", $1, $2}'`
7659                 majonly=libperl.$so.$majonly
7660                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7661                 # rely on figuring it out from the naming of libc.
7662                 case "${osname}${osvers}" in
7663                 next4*)
7664                         dflt=libperl.5.$so
7665                         # XXX How handle the --version stuff for MAB?
7666                         ;;
7667                 linux*)  # ld won't link with a bare -lperl otherwise.
7668                         dflt=libperl.$so
7669                         ;;
7670                 cygwin*) # ld links against an importlib
7671                         dflt=libperl$lib_ext
7672                         ;;
7673                 *)      # Try to guess based on whether libc has major.minor.
7674                         case "$libc" in
7675                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7676                         *libc.$so.[0-9]*) dflt=$majonly ;;
7677                         *)      dflt=libperl.$so ;;
7678                         esac
7679                         ;;
7680                 esac
7681                 ;;
7682         *)      dflt=$libperl
7683                 ;;
7684         esac
7685         cat << EOM
7686
7687 I need to select a good name for the shared libperl.  If your system uses
7688 library names with major and minor numbers, then you might want something
7689 like $majmin.  Alternatively, if your system uses a single version
7690 number for shared libraries, then you might want to use $majonly.
7691 Or, your system might be quite happy with a simple libperl.$so.
7692
7693 Since the shared libperl will get installed into a version-specific
7694 architecture-dependent directory, the version number of the shared perl
7695 library probably isn't important, so the default should be o.k.
7696
7697 EOM
7698         rp='What name do you want to give to the shared libperl?'
7699         . ./myread
7700         libperl=$ans
7701         echo "Ok, I'll use $libperl"
7702         ;;
7703 *)
7704         libperl="libperl${_a}"
7705         ;;
7706 esac
7707
7708 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7709 case "$shrpdir" in
7710 '') ;;
7711 *)      $cat >&4 <<EOM
7712 WARNING:  Use of the shrpdir variable for the installation location of
7713 the shared $libperl is not supported.  It was never documented and
7714 will not work in this version.  Let me (perlbug@perl.org)
7715 know of any problems this may cause.
7716
7717 EOM
7718         case "$shrpdir" in
7719         "$archlibexp/CORE")
7720                 $cat >&4 <<EOM
7721 But your current setting of $shrpdir is
7722 the default anyway, so it's harmless.
7723 EOM
7724                 ;;
7725         *)
7726                 $cat >&4 <<EOM
7727 Further, your current attempted setting of $shrpdir
7728 conflicts with the value of $archlibexp/CORE
7729 that installperl will use.
7730 EOM
7731                 ;;
7732         esac
7733         ;;
7734 esac
7735
7736 # How will the perl executable find the installed shared $libperl?
7737 # Add $xxx to ccdlflags.
7738 # If we can't figure out a command-line option, use $shrpenv to
7739 # set env LD_RUN_PATH.  The main perl makefile uses this.
7740 shrpdir=$archlibexp/CORE
7741 xxx=''
7742 tmp_shrpenv=''
7743 if "$useshrplib"; then
7744     case "$osname" in 
7745         aix)
7746                 # We'll set it in Makefile.SH...
7747                 ;;
7748         solaris)
7749                 xxx="-R $shrpdir"
7750                 ;;
7751         freebsd|netbsd)
7752                 xxx="-Wl,-R$shrpdir"
7753                 ;;
7754         bsdos|linux|irix*|dec_osf)
7755                 xxx="-Wl,-rpath,$shrpdir"
7756                 ;;
7757         next)
7758                 # next doesn't like the default...
7759                 ;;
7760         beos)
7761                 # beos doesn't like the default, either.
7762                 ;;
7763         hpux*)
7764                 # hpux doesn't like the default, either.
7765                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7766                 ;;
7767         *)
7768                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7769                 ;;
7770         esac
7771         case "$xxx" in
7772         '') ;;
7773         *)      
7774                 # Only add $xxx if it isn't already in ccdlflags.
7775                 case " $ccdlflags " in
7776                 *" $xxx "*)     ;;
7777                 *)      ccdlflags="$ccdlflags $xxx"
7778                         cat <<EOM >&4
7779
7780 Adding $xxx to the flags
7781 passed to $ld so that the perl executable will find the 
7782 installed shared $libperl.
7783
7784 EOM
7785                         ;;
7786                 esac
7787                 ;;
7788         esac
7789 fi
7790 # Fix ccdlflags in AIX for building external extensions.
7791 # (For building Perl itself bare -bE:perl.exp is needed,
7792 #  Makefile.SH takes care of this.)
7793 case "$osname" in
7794 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7795 esac
7796 # Respect a hint or command-line value.
7797 case "$shrpenv" in
7798 '') shrpenv="$tmp_shrpenv" ;;
7799 esac
7800 case "$ldlibpthname" in
7801 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7802 none)   ldlibpthname='' ;;
7803 esac
7804
7805 : determine where manual pages are on this system
7806 echo " "
7807 case "$sysman" in
7808 '') 
7809         syspath='/usr/share/man/man1 /usr/man/man1'
7810         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7811         syspath="$syspath /usr/man/u_man/man1"
7812         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7813         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7814         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7815         sysman=`./loc . /usr/man/man1 $syspath`
7816         ;;
7817 esac
7818 if $test -d "$sysman"; then
7819         echo "System manual is in $sysman." >&4
7820 else
7821         echo "Could not find manual pages in source form." >&4
7822 fi
7823
7824 : determine where manual pages go
7825 set man1dir man1dir none
7826 eval $prefixit
7827 $cat <<EOM
7828
7829 $spackage has manual pages available in source form.
7830 EOM
7831 case "$nroff" in
7832 nroff)
7833         echo "However, you don't have nroff, so they're probably useless to you."
7834         case "$man1dir" in
7835         '') man1dir="none";;
7836         esac;;
7837 esac
7838 echo "If you don't want the manual sources installed, answer 'none'."
7839 case "$man1dir" in
7840 ' ') dflt=none
7841         ;;
7842 '')
7843         lookpath="$prefixexp/share/man/man1"
7844         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7845         lookpath="$lookpath $prefixexp/man/p_man/man1"
7846         lookpath="$lookpath $prefixexp/man/u_man/man1"
7847         lookpath="$lookpath $prefixexp/man/man.1"
7848         case "$sysman" in
7849         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7850         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7851         esac
7852         set dflt
7853         eval $prefixup
7854         ;;
7855 *)  dflt="$man1dir"
7856         ;;
7857 esac
7858 echo " "
7859 fn=dn+~
7860 rp="Where do the main $spackage manual pages (source) go?"
7861 . ./getfile
7862 if $test "X$man1direxp" != "X$ansexp"; then
7863         installman1dir=''
7864 fi
7865 man1dir="$ans"
7866 man1direxp="$ansexp"
7867 case "$man1dir" in
7868 '')     man1dir=' '
7869         installman1dir='';;
7870 esac
7871
7872 : Change installation prefix, if necessary.
7873 if $test X"$prefix" != X"$installprefix"; then
7874         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7875 else
7876         installman1dir="$man1direxp"
7877 fi
7878
7879 : What suffix to use on installed man pages
7880
7881 case "$man1dir" in
7882 ' ')
7883         man1ext='0'
7884         ;;
7885 *)
7886         rp="What suffix should be used for the main $spackage man pages?"
7887         case "$man1ext" in
7888         '')     case "$man1dir" in
7889                 *1)  dflt=1 ;;
7890                 *1p) dflt=1p ;;
7891                 *1pm) dflt=1pm ;;
7892                 *l) dflt=l;;
7893                 *n) dflt=n;;
7894                 *o) dflt=o;;
7895                 *p) dflt=p;;
7896                 *C) dflt=C;;
7897                 *L) dflt=L;;
7898                 *L1) dflt=L1;;
7899                 *) dflt=1;;
7900                 esac
7901                 ;;
7902         *)      dflt="$man1ext";;
7903         esac
7904         . ./myread
7905         man1ext="$ans"
7906         ;;
7907 esac
7908
7909 : see if we can have long filenames
7910 echo " "
7911 first=123456789abcdef
7912 $rm -f $first
7913 if (echo hi >$first) 2>/dev/null; then
7914         if $test -f 123456789abcde; then
7915                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
7916                 val="$undef"
7917         else
7918                 echo 'You can have filenames longer than 14 characters.'>&4
7919                 val="$define"
7920         fi
7921 else
7922         $cat <<'EOM'
7923 You can't have filenames longer than 14 chars.
7924 You can't even think about them!
7925 EOM
7926         val="$undef"
7927 fi 
7928 set d_flexfnam
7929 eval $setvar
7930 $rm -rf 123456789abcde*
7931
7932 : determine where library module manual pages go
7933 set man3dir man3dir none
7934 eval $prefixit
7935 $cat <<EOM
7936
7937 $spackage has manual pages for many of the library modules.
7938 EOM
7939
7940 case "$nroff" in
7941 nroff)
7942         $cat <<'EOM'
7943 However, you don't have nroff, so they're probably useless to you.
7944 EOM
7945         case "$man3dir" in
7946         '') man3dir="none";;
7947         esac;;
7948 esac
7949
7950 case "$d_flexfnam" in
7951 undef)
7952         $cat <<'EOM'
7953 However, your system can't handle the long file names like File::Basename.3. 
7954 EOM
7955         case "$man3dir" in
7956         '') man3dir="none";;
7957         esac;;
7958 esac
7959
7960 echo "If you don't want the manual sources installed, answer 'none'."
7961 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7962 case "$man3dir" in
7963 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7964         if $test -d "$privlib/man/man3"; then
7965                 cat <<EOM >&4
7966
7967 WARNING:  Previous versions of perl installed man3 pages into
7968 $privlib/man/man3.  This version will suggest a 
7969 new default of $dflt.  
7970 EOM
7971                 tdflt=$dflt
7972                 dflt='n'
7973                 rp='Do you wish to preserve the old behavior?(y/n)'
7974                 . ./myread
7975                 case "$ans" in
7976                 y*) dflt="$privlib/man/man3" ;;
7977                 *)  dflt=$tdflt ;;
7978                 esac
7979     fi
7980         ;;
7981 *)      dflt="$man3dir" ;;
7982 esac
7983 case "$dflt" in
7984 ' ') dflt=none ;;
7985 esac
7986 echo " "
7987 fn=dn+~
7988 rp="Where do the $package library man pages (source) go?"
7989 . ./getfile
7990 man3dir="$ans"
7991 man3direxp="$ansexp"
7992 case "$man3dir" in
7993 '')     man3dir=' '
7994         installman3dir='';;
7995 esac
7996
7997 : Change installation prefix, if necessary.
7998 if $test X"$prefix" != X"$installprefix"; then
7999         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8000 else
8001         installman3dir="$man3direxp"
8002 fi
8003
8004 : What suffix to use on installed man pages
8005 case "$man3dir" in
8006 ' ')
8007         man3ext='0'
8008         ;;
8009 *)
8010         rp="What suffix should be used for the $package library man pages?"
8011         case "$man3ext" in
8012         '')     case "$man3dir" in
8013                 *3)  dflt=3 ;;
8014                 *3p) dflt=3p ;;
8015                 *3pm) dflt=3pm ;;
8016                 *l) dflt=l;;
8017                 *n) dflt=n;;
8018                 *o) dflt=o;;
8019                 *p) dflt=p;;
8020                 *C) dflt=C;;
8021                 *L) dflt=L;;
8022                 *L3) dflt=L3;;
8023                 *) dflt=3;;
8024                 esac
8025                 ;;
8026         *)      dflt="$man3ext";;
8027         esac
8028         . ./myread
8029         man3ext="$ans"
8030         ;;
8031 esac
8032
8033 : see if we have to deal with yellow pages, now NIS.
8034 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8035         if $test -f /usr/etc/nibindd; then
8036                 echo " "
8037                 echo "I'm fairly confident you're on a NeXT."
8038                 echo " "
8039                 rp='Do you get the hosts file via NetInfo?'
8040                 dflt=y
8041                 case "$hostcat" in
8042                 nidump*) ;;
8043                 '') ;;
8044                 *) dflt=n;;
8045                 esac
8046                 . ./myread
8047                 case "$ans" in
8048                 y*) hostcat='nidump hosts .';;
8049                 *)      case "$hostcat" in
8050                         nidump*) hostcat='';;
8051                         esac
8052                         ;;
8053                 esac
8054         fi
8055         case "$hostcat" in
8056         nidump*) ;;
8057         *)
8058                 case "$hostcat" in
8059                 *ypcat*) dflt=y;;
8060                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8061                                 dflt=y
8062                         else
8063                                 dflt=n
8064                         fi;;
8065                 *) dflt=n;;
8066                 esac
8067                 echo " "
8068                 rp='Are you getting the hosts file via yellow pages?'
8069                 . ./myread
8070                 case "$ans" in
8071                 y*) hostcat='ypcat hosts';;
8072                 *) hostcat='cat /etc/hosts';;
8073                 esac
8074                 ;;
8075         esac
8076 fi
8077 case "$hostcat" in
8078 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8079 esac
8080 case "$groupcat" in
8081 '') test -f /etc/group && groupcat='cat /etc/group';;
8082 esac
8083 case "$passcat" in
8084 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8085 esac
8086
8087 : now get the host name
8088 echo " "
8089 echo "Figuring out host name..." >&4
8090 case "$myhostname" in
8091 '') cont=true
8092         echo 'Maybe "hostname" will work...'
8093         if tans=`sh -c hostname 2>&1` ; then
8094                 myhostname=$tans
8095                 phostname=hostname
8096                 cont=''
8097         fi
8098         ;;
8099 *) cont='';;
8100 esac
8101 if $test "$cont"; then
8102         if ./xenix; then
8103                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8104                 if tans=`cat /etc/systemid 2>&1` ; then
8105                         myhostname=$tans
8106                         phostname='cat /etc/systemid'
8107                         echo "Whadyaknow.  Xenix always was a bit strange..."
8108                         cont=''
8109                 fi
8110         elif $test -r /etc/systemid; then
8111                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8112         fi
8113 fi
8114 if $test "$cont"; then
8115         echo 'No, maybe "uuname -l" will work...'
8116         if tans=`sh -c 'uuname -l' 2>&1` ; then
8117                 myhostname=$tans
8118                 phostname='uuname -l'
8119         else
8120                 echo 'Strange.  Maybe "uname -n" will work...'
8121                 if tans=`sh -c 'uname -n' 2>&1` ; then
8122                         myhostname=$tans
8123                         phostname='uname -n'
8124                 else
8125                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8126                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8127                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8128                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8129                         else
8130                                 case "$myhostname" in
8131                                 '') echo "Does this machine have an identity crisis or something?"
8132                                         phostname='';;
8133                                 *)
8134                                         echo "Well, you said $myhostname before..."
8135                                         phostname='echo $myhostname';;
8136                                 esac
8137                         fi
8138                 fi
8139         fi
8140 fi
8141 case "$myhostname" in
8142 '') myhostname=noname ;;
8143 esac
8144 : you do not want to know about this
8145 set $myhostname
8146 myhostname=$1
8147
8148 : verify guess
8149 if $test "$myhostname" ; then
8150         dflt=y
8151         rp='Your host name appears to be "'$myhostname'".'" Right?"
8152         . ./myread
8153         case "$ans" in
8154         y*) ;;
8155         *) myhostname='';;
8156         esac
8157 fi
8158
8159 : bad guess or no guess
8160 while $test "X$myhostname" = X ; do
8161         dflt=''
8162         rp="Please type the (one word) name of your host:"
8163         . ./myread
8164         myhostname="$ans"
8165 done
8166
8167 : translate upper to lower if necessary
8168 case "$myhostname" in
8169 *[A-Z]*)
8170         echo "(Normalizing case in your host name)"
8171         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8172         ;;
8173 esac
8174
8175 case "$myhostname" in
8176 *.*)
8177         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8178         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8179         echo "(Trimming domain name from host name--host name is now $myhostname)"
8180         ;;
8181 *) case "$mydomain" in
8182         '')
8183                 {
8184                         test "X$hostcat" = "Xypcat hosts" &&
8185                         ypmatch "$myhostname" hosts 2>/dev/null |\
8186                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8187                         $test -s hosts
8188                 } || {
8189                         test "X$hostcat" != "X" &&
8190                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8191                                         /[       ]$myhostname[  . ]/p" > hosts
8192                 }
8193                 tmp_re="[       . ]"
8194                 if $test -f hosts; then
8195                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8196                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8197                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8198                                 hosts | $sort | $uniq | \
8199                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8200                         case `$echo X$dflt` in
8201                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8202                                 dflt=.
8203                                 ;;
8204                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8205                                 ;;
8206                         esac
8207                 else
8208                         echo "(I cannot locate a hosts database anywhere)"
8209                         dflt=.
8210                 fi
8211                 case "$dflt" in
8212                 .)
8213                         tans=`./loc resolv.conf X /etc /usr/etc`
8214                         if $test -f "$tans"; then
8215                                 echo "(Attempting domain name extraction from $tans)"
8216                                 dflt=.`$sed -n -e 's/   / /g' \
8217                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8218                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8219                                 case "$dflt" in
8220                                 .) dflt=.`$sed -n -e 's/        / /g' \
8221                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8222                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8223                                         ;;
8224                                 esac
8225                         fi
8226                         ;;
8227                 esac
8228                 case "$dflt" in
8229                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8230                         dflt=.`sh -c domainname 2>/dev/null`
8231                         case "$dflt" in
8232                         '') dflt='.';;
8233                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8234                         esac
8235                         ;;
8236                 esac
8237                 case "$dflt$osname" in
8238                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8239                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8240                         ;;
8241                 esac
8242                 case "$dflt" in
8243                 .) echo "(Lost all hope -- silly guess then)"
8244                         dflt='.nonet'
8245                         ;;
8246                 esac
8247                 $rm -f hosts
8248                 ;;
8249         *) dflt="$mydomain";;
8250         esac;;
8251 esac
8252 echo " "
8253 rp="What is your domain name?"
8254 . ./myread
8255 tans="$ans"
8256 case "$ans" in
8257 '') ;;
8258 .*) ;;
8259 *) tans=".$tans";;
8260 esac
8261 mydomain="$tans"
8262
8263 : translate upper to lower if necessary
8264 case "$mydomain" in
8265 *[A-Z]*)
8266         echo "(Normalizing case in your domain name)"
8267         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8268         ;;
8269 esac
8270
8271 : a little sanity check here
8272 case "$phostname" in
8273 '') ;;
8274 *)
8275         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8276         $myhostname$mydomain|$myhostname) ;;
8277         *)
8278                 case "$phostname" in
8279                 sed*)
8280                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8281                         ;;
8282                 *)
8283                         echo "(That doesn't agree with your $phostname command, by the way.)"
8284                         ;;
8285                 esac
8286         ;;
8287         esac
8288         ;;
8289 esac
8290
8291 $cat <<EOM
8292
8293 I need to get your e-mail address in Internet format if possible, i.e.
8294 something like user@host.domain. Please answer accurately since I have
8295 no easy means to double check it. The default value provided below
8296 is most probably close to reality but may not be valid from outside
8297 your organization...
8298
8299 EOM
8300 cont=x
8301 while test "$cont"; do
8302         case "$cf_email" in
8303         '') dflt="$cf_by@$myhostname$mydomain";;
8304         *) dflt="$cf_email";;
8305         esac
8306         rp='What is your e-mail address?'
8307         . ./myread
8308         cf_email="$ans"
8309         case "$cf_email" in
8310         *@*.*) cont='' ;;
8311         *)
8312                 rp='Address does not look like an Internet one.  Use it anyway?'
8313                 case "$fastread" in
8314                 yes) dflt=y ;;
8315                 *) dflt=n ;;
8316                 esac
8317                 . ./myread
8318                 case "$ans" in
8319                 y*) cont='' ;;
8320                 *) echo " " ;;
8321                 esac
8322                 ;;
8323         esac
8324 done
8325
8326 $cat <<EOM
8327
8328 If you or somebody else will be maintaining perl at your site, please
8329 fill in the correct e-mail address here so that they may be contacted
8330 if necessary. Currently, the "perlbug" program included with perl
8331 will send mail to this address in addition to perlbug@perl.org. You may
8332 enter "none" for no administrator.
8333
8334 EOM
8335 case "$perladmin" in
8336 '') dflt="$cf_email";;
8337 *) dflt="$perladmin";;
8338 esac
8339 rp='Perl administrator e-mail address'
8340 . ./myread
8341 perladmin="$ans"
8342
8343 : determine whether to only install version-specific parts.
8344 echo " "
8345 $cat <<EOM
8346 Do you want to install only the version-specific parts of the perl
8347 distribution?  Usually you do *not* want to do this.
8348 EOM
8349 case "$versiononly" in
8350 "$define"|[Yy]*|true) dflt='y' ;;
8351 *) dflt='n';
8352 esac
8353 rp="Do you want to install only the version-specific parts of perl?"
8354 . ./myread
8355 case "$ans" in
8356 [yY]*)  val="$define";;
8357 *)      val="$undef" ;;
8358 esac
8359 set versiononly
8360 eval $setvar
8361
8362 case "$versiononly" in
8363 "$define") inc_version_list=''
8364            inc_version_list_init=0
8365            ;;
8366 esac
8367
8368 : figure out how to guarantee perl startup
8369 case "$startperl" in
8370 '')
8371         case "$sharpbang" in
8372         *!)
8373                 $cat <<EOH
8374
8375 I can use the #! construct to start perl on your system. This will
8376 make startup of perl scripts faster, but may cause problems if you
8377 want to share those scripts and perl is not in a standard place
8378 ($binexp/perl) on all your platforms. The alternative is to force
8379 a shell by starting the script with a single ':' character.
8380
8381 EOH
8382                 case "$versiononly" in
8383                 "$define")      dflt="$binexp/perl$version";;  
8384                 *)              dflt="$binexp/perl";;
8385                 esac
8386                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8387                 . ./myread
8388                 case "$ans" in
8389                 none)   startperl=": # use perl";;
8390                 *)      startperl="#!$ans"
8391                         if $test 30 -lt `echo "$ans" | wc -c`; then
8392                                 $cat >&4 <<EOM
8393
8394 WARNING:  Some systems limit the #! command to 32 characters.
8395 If you experience difficulty running Perl scripts with #!, try
8396 installing Perl in a directory with a shorter pathname.
8397
8398 EOM
8399                         fi ;;
8400                 esac
8401                 ;;
8402         *) startperl=": # use perl"
8403                 ;;
8404         esac
8405         ;;
8406 esac
8407 echo "I'll use $startperl to start perl scripts."
8408
8409 : figure best path for perl in scripts
8410 case "$perlpath" in
8411 '')
8412         case "$versiononly" in
8413         "$define")      perlpath="$binexp/perl$version";;
8414         *)              perlpath="$binexp/perl";;
8415         esac
8416         case "$startperl" in
8417         *!*) ;;
8418         *)
8419                 $cat <<EOH
8420
8421 I will use the "eval 'exec'" idiom to start Perl on your system.
8422 I can use the full path of your Perl binary for this purpose, but
8423 doing so may cause problems if you want to share those scripts and
8424 Perl is not always in a standard place ($binexp/perl).
8425
8426 EOH
8427                 dflt="$binexp/perl"
8428                 rp="What path shall I use in \"eval 'exec'\"?"
8429                 . ./myread
8430                 perlpath="$ans"
8431                 ;;
8432         esac
8433         ;;
8434 esac
8435 case "$startperl" in
8436 *!*)    ;;
8437 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8438 esac
8439
8440 : determine where public executable scripts go
8441 set scriptdir scriptdir
8442 eval $prefixit
8443 case "$scriptdir" in
8444 '')
8445         dflt="$bin"
8446         : guess some guesses
8447         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8448         $test -d /usr/share/bin     && dflt=/usr/share/bin
8449         $test -d /usr/local/script  && dflt=/usr/local/script
8450         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8451         $test -d $prefixexp/script  && dflt=$prefixexp/script
8452         set dflt
8453         eval $prefixup
8454         ;;
8455 *)  dflt="$scriptdir"
8456         ;;
8457 esac
8458 $cat <<EOM
8459  
8460 Some installations have a separate directory just for executable scripts so
8461 that they can mount it across multiple architectures but keep the scripts in
8462 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8463 Or you might just lump your scripts in with all your other executables.
8464  
8465 EOM
8466 fn=d~
8467 rp='Where do you keep publicly executable scripts?'
8468 . ./getfile
8469 if $test "X$ansexp" != "X$scriptdirexp"; then
8470         installscript=''
8471 fi
8472 scriptdir="$ans"
8473 scriptdirexp="$ansexp"
8474 : Change installation prefix, if necessary.
8475 if $test X"$prefix" != X"$installprefix"; then
8476         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8477 else
8478         installscript="$scriptdirexp"
8479 fi
8480
8481 : determine where add-on public executables go
8482 case "$sitebin" in
8483 '')     dflt=$siteprefix/bin ;;
8484 *)      dflt=$sitebin ;;
8485 esac
8486 fn=d~
8487 rp='Pathname where the add-on public executables should be installed?'
8488 . ./getfile
8489 sitebin="$ans"
8490 sitebinexp="$ansexp"
8491 : Change installation prefix, if necessary.
8492 if $test X"$prefix" != X"$installprefix"; then
8493         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8494 else
8495         installsitebin="$sitebinexp"
8496 fi
8497
8498 : define an is-a-typedef? function
8499 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8500 case "$inclist" in
8501 "") inclist="sys/types.h";;
8502 esac;
8503 eval "varval=\$$var";
8504 case "$varval" in
8505 "")
8506         $rm -f temp.c;
8507         for inc in $inclist; do
8508                 echo "#include <$inc>" >>temp.c;
8509         done;
8510         echo "#ifdef $type" >> temp.c;
8511         echo "printf(\"We have $type\");" >> temp.c;
8512         echo "#endif" >> temp.c;
8513         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8514         if $contains $type temp.E >/dev/null 2>&1; then
8515                 eval "$var=\$type";
8516         else
8517                 eval "$var=\$def";
8518         fi;
8519         $rm -f temp.?;;
8520 *) eval "$var=\$varval";;
8521 esac'
8522
8523 : define an is-a-typedef? function that prompts if the type is not available.
8524 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8525 case "$inclist" in
8526 "") inclist="sys/types.h";;
8527 esac;
8528 eval "varval=\$$var";
8529 case "$varval" in
8530 "")
8531         $rm -f temp.c;
8532         for inc in $inclist; do
8533                 echo "#include <$inc>" >>temp.c;
8534         done;
8535         echo "#ifdef $type" >> temp.c;
8536         echo "printf(\"We have $type\");" >> temp.c;
8537         echo "#endif" >> temp.c;
8538         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8539         echo " " ;
8540         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8541         if $contains $type temp.E >/dev/null 2>&1; then
8542                 echo "$type found." >&4;
8543                 eval "$var=\$type";
8544         else
8545                 echo "$type NOT found." >&4;
8546                 dflt="$def";
8547                 . ./myread ;
8548                 eval "$var=\$ans";
8549         fi;
8550         $rm -f temp.?;;
8551 *) eval "$var=\$varval";;
8552 esac'
8553
8554 : see what type lseek is declared as in the kernel
8555 rp="What is the type used for lseek's offset on this system?"
8556 set off_t lseektype long stdio.h sys/types.h
8557 eval $typedef_ask
8558
8559 echo " "
8560 echo "Checking to see how big your file offsets are..." >&4
8561 $cat >try.c <<EOCP
8562 #include <sys/types.h>
8563 #include <stdio.h>
8564 int main()
8565 {
8566     printf("%d\n", (int)sizeof($lseektype));
8567     return(0); 
8568 }
8569 EOCP
8570 set try
8571 if eval $compile_ok; then
8572         lseeksize=`$run ./try`
8573         echo "Your file offsets are $lseeksize bytes long."
8574 else
8575         dflt=$longsize
8576         echo " "
8577         echo "(I can't seem to compile the test program.  Guessing...)"
8578         rp="What is the size of your file offsets (in bytes)?"
8579         . ./myread
8580         lseeksize="$ans"
8581 fi
8582 $rm -f try.c try
8583
8584 : see what type file positions are declared as in the library
8585 rp="What is the type for file position used by fsetpos()?"
8586 set fpos_t fpostype long stdio.h sys/types.h
8587 eval $typedef_ask
8588
8589 echo " "
8590 case "$fpostype" in
8591 *_t) zzz="$fpostype"    ;;
8592 *)   zzz="fpos_t"       ;;
8593 esac
8594 echo "Checking the size of $zzz..." >&4 
8595 cat > try.c <<EOCP
8596 #include <sys/types.h>
8597 #include <stdio.h>
8598 int main() {
8599     printf("%d\n", (int)sizeof($fpostype));
8600     exit(0);
8601 }
8602 EOCP
8603 set try
8604 if eval $compile_ok; then
8605         yyy=`$run ./try`
8606         case "$yyy" in
8607         '')     fpossize=4
8608                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8609                 ;;
8610         *)      fpossize=$yyy
8611                 echo "Your $zzz is $fpossize bytes long."
8612                 ;;
8613         esac
8614 else
8615         dflt="$longsize"
8616         echo " " >&4
8617         echo "(I can't compile the test program.  Guessing...)" >&4
8618         rp="What is the size of your file positions (in bytes)?"
8619         . ./myread
8620         fpossize="$ans"
8621 fi
8622
8623
8624
8625 # Backward compatibility (uselfs is deprecated).
8626 case "$uselfs" in
8627 "$define"|true|[yY]*)
8628         cat <<EOM >&4
8629
8630 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8631 EOM
8632         uselargefiles="$define"
8633         ;;
8634 esac                          
8635
8636 case "$lseeksize:$fpossize" in
8637 8:8) cat <<EOM
8638
8639 You can have files larger than 2 gigabytes.
8640 EOM
8641    val="$define" ;;
8642 *)    case "$uselargefiles" in
8643    "$undef"|false|[nN]*) dflt='n' ;;
8644    *)   dflt='y' ;;
8645    esac
8646    cat <<EOM
8647
8648 Perl can be built to understand large files (files larger than 2 gigabytes)
8649 on some systems.  To do so, Configure can be run with -Duselargefiles.
8650
8651 If this doesn't make any sense to you, just accept the default '$dflt'.
8652 EOM
8653    rp='Try to understand large files, if available?'
8654    . ./myread
8655    case "$ans" in
8656    y|Y)         val="$define" ;;
8657    *)           val="$undef"  ;;
8658    esac
8659    ;;
8660 esac
8661 set uselargefiles
8662 eval $setvar
8663 case "$uselargefiles" in
8664 "$define")
8665 : Look for a hint-file generated 'call-back-unit'.  If the
8666 : user has specified that a large files perl is to be built,
8667 : we may need to set or change some other defaults.
8668         if $test -f uselargefiles.cbu; then
8669                 echo "Your platform has some specific hints for large file builds, using them..."
8670                 . ./uselargefiles.cbu
8671                 echo " "
8672                 echo "Rechecking to see how big your file offsets are..." >&4
8673                 $cat >try.c <<EOCP
8674 #include <sys/types.h>
8675 #include <stdio.h>
8676 int main()
8677 {
8678     printf("%d\n", (int)sizeof($lseektype));
8679     return(0); 
8680 }
8681 EOCP
8682                 set try
8683                 if eval $compile_ok; then
8684                         lseeksize=`$run ./try`
8685                         $echo "Your file offsets are now $lseeksize bytes long."
8686                 else
8687                         dflt="$lseeksize"
8688                         echo " "
8689                         echo "(I can't seem to compile the test program.  Guessing...)"
8690                         rp="What is the size of your file offsets (in bytes)?"
8691                         . ./myread
8692                         lseeksize="$ans"
8693                 fi
8694                 case "$fpostype" in
8695                 *_t) zzz="$fpostype"    ;;
8696                 *)   zzz="fpos_t"       ;;
8697                 esac
8698                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8699                 $cat > try.c <<EOCP
8700 #include <sys/types.h>
8701 #include <stdio.h>
8702 int main() {
8703     printf("%d\n", (int)sizeof($fpostype));
8704     exit(0);
8705 }
8706 EOCP
8707                 set try
8708                 if eval $compile_ok; then
8709                         yyy=`$run ./try`
8710                         dflt="$lseeksize"
8711                         case "$yyy" in
8712                         '')     echo " "
8713                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8714                                 ;;
8715                         *)      fpossize=$yyy
8716                                 echo " $fpossize bytes." >&4
8717                                 ;;
8718                         esac
8719                 else
8720                         dflt="$fpossize"
8721                         echo " "
8722                         echo "(I can't compile the test program.  Guessing...)" >&4
8723                         rp="What is the size of your file positions (in bytes)?"
8724                         . ./myread
8725                         fpossize="$ans"
8726                 fi
8727                 $rm -f try.c try
8728         fi
8729         ;;
8730 esac
8731
8732 case "$vendorprefix" in
8733 '')     d_vendorbin="$undef"
8734         vendorbin=''
8735         vendorbinexp=''
8736         ;;
8737 *)      d_vendorbin="$define"
8738         : determine where vendor-supplied executables go.
8739         case "$vendorbin" in
8740         '') dflt=$vendorprefix/bin ;;
8741         *)      dflt="$vendorbin" ;;
8742         esac
8743         fn=d~+
8744         rp='Pathname for the vendor-supplied executables directory?'
8745         . ./getfile
8746         vendorbin="$ans"
8747         vendorbinexp="$ansexp"
8748         ;;
8749 esac
8750 : Change installation prefix, if necessary.
8751 if $test X"$prefix" != X"$installprefix"; then
8752         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8753 else
8754         installvendorbin="$vendorbinexp"
8755 fi
8756
8757 : see if qgcvt exists
8758 set qgcvt d_qgcvt
8759 eval $inlibc
8760
8761 : Check how to convert floats to strings.
8762
8763 if test "X$d_Gconvert" = X; then
8764
8765 echo " "
8766 echo "Checking for an efficient way to convert floats to strings."
8767 echo " " > try.c
8768 case "$uselongdouble" in
8769 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8770 esac
8771 case "$d_longdbl" in
8772 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8773 esac
8774 case "$d_PRIgldbl" in
8775 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
8776 esac
8777 $cat >>try.c <<EOP
8778 #ifdef TRY_gconvert
8779 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8780 char *myname = "gconvert";
8781 #endif
8782 #ifdef TRY_gcvt
8783 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8784 char *myname = "gcvt";
8785 #endif
8786 #ifdef TRY_qgcvt
8787 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8788 char *myname = "qgcvt";
8789 #define DOUBLETYPE long double
8790 #endif
8791 #ifdef TRY_sprintf
8792 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8793 #ifdef HAS_PRIgldbl
8794 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8795 #else
8796 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
8797 #endif
8798 #else
8799 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8800 #endif
8801 char *myname = "sprintf";
8802 #endif
8803
8804 #ifndef DOUBLETYPE
8805 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8806 #define DOUBLETYPE long double
8807 #else
8808 #define DOUBLETYPE double
8809 #endif
8810 #endif
8811
8812 #include <stdio.h>
8813
8814 #define I_STDLIB $i_stdlib
8815 #ifdef I_STDLIB
8816 #include <stdlib.h>
8817 #endif
8818
8819 int
8820 checkit(expect, got)
8821 char *expect;
8822 char *got;
8823 {
8824     if (strcmp(expect, got)) {
8825                 printf("%s oddity:  Expected %s, got %s\n",
8826                         myname, expect, got);
8827                 exit(1);
8828         }
8829 }
8830
8831 int main()
8832
8833         char buf[64]; 
8834         buf[63] = '\0';
8835
8836         /* This must be 1st test on (which?) platform */
8837         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8838         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8839         checkit("0.1", buf);
8840
8841         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
8842         checkit("0.01", buf);
8843
8844         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
8845         checkit("0.001", buf);
8846
8847         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
8848         checkit("0.0001", buf);
8849
8850         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
8851         if (strlen(buf) > 5)
8852             checkit("9e-005", buf); /* for Microsoft ?? */
8853         else
8854             checkit("9e-05", buf);
8855
8856         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
8857         checkit("1", buf);
8858
8859         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
8860         checkit("1.1", buf);
8861
8862         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
8863         checkit("1.01", buf);
8864
8865         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
8866         checkit("1.001", buf);
8867
8868         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
8869         checkit("1.0001", buf);
8870
8871         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
8872         checkit("1.00001", buf);
8873
8874         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
8875         checkit("1.000001", buf);
8876
8877         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
8878         checkit("0", buf);
8879
8880         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
8881         checkit("-1", buf);
8882
8883         /* Some Linux gcvt's give 1.e+5 here. */
8884         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
8885         checkit("100000", buf);
8886         
8887         /* Some Linux gcvt's give -1.e+5 here. */
8888         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
8889         checkit("-100000", buf);
8890
8891         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
8892         checkit("123.456", buf);
8893
8894         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
8895         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
8896         /* 34 should be enough to scare even long double
8897          * places into using the e notation. */
8898         if (strlen(buf) > 5)
8899             checkit("1e+034", buf); /* for Microsoft */
8900         else
8901             checkit("1e+34", buf);
8902
8903         /* For Perl, if you add additional tests here, also add them to
8904          * t/base/num.t for benefit of platforms not using Configure or
8905          * overriding d_Gconvert */
8906
8907         exit(0);
8908 }
8909 EOP
8910 : first add preferred functions to our list
8911 xxx_list=""
8912 for xxx_convert in $gconvert_preference; do
8913     case $xxx_convert in
8914     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
8915     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
8916     esac 
8917 done
8918 : then add any others
8919 for xxx_convert in gconvert gcvt sprintf; do
8920     case "$xxx_list" in
8921     *$xxx_convert*) ;;
8922     *) xxx_list="$xxx_list $xxx_convert" ;;
8923     esac 
8924 done
8925
8926 case "$d_longdbl$uselongdouble" in
8927 "$define$define")
8928     : again, add prefered functions to our list first
8929     xxx_ld_list=""
8930     for xxx_convert in $gconvert_ld_preference; do
8931         case $xxx_convert in
8932         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
8933         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
8934         esac
8935     done
8936     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
8937     for xxx_convert in qgcvt sprintf $xxx_list; do
8938         case "$xxx_ld_list" in
8939         $xxx_convert*|*" $xxx_convert"*) ;;
8940         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
8941         esac
8942     done
8943     : if sprintf cannot do long doubles, move it to the end
8944     if test "$d_PRIgldbl" != "$define"; then
8945         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
8946     fi
8947     : if no qgcvt, remove it
8948     if test "$d_qgcvt" != "$define"; then
8949         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
8950     fi
8951     : use the ld_list
8952     xxx_list="$xxx_ld_list"
8953     ;;
8954 esac
8955
8956 for xxx_convert in $xxx_list; do
8957         echo "Trying $xxx_convert..."
8958         $rm -f try try$_o
8959         set try -DTRY_$xxx_convert
8960         if eval $compile; then
8961                 echo "$xxx_convert() found." >&4
8962                 if $run ./try; then
8963                         echo "I'll use $xxx_convert to convert floats into a string." >&4
8964                         break;
8965                 else
8966                         echo "...But $xxx_convert didn't work as I expected."
8967                         xxx_convert=''
8968                 fi
8969         else
8970                 echo "$xxx_convert NOT found." >&4
8971         fi
8972 done
8973
8974 if test X$xxx_convert = X; then
8975     echo "*** WHOA THERE!!! ***" >&4
8976     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
8977     xxx_convert=sprintf
8978 fi
8979
8980 case "$xxx_convert" in
8981 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
8982 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
8983 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
8984 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
8985    "$define$define$define")
8986       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
8987    "$define$define$undef")
8988       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
8989    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
8990    esac
8991    ;;  
8992 esac
8993
8994 fi
8995
8996 : see if _fwalk exists
8997 set fwalk d__fwalk
8998 eval $inlibc
8999
9000 : Initialize h_fcntl
9001 h_fcntl=false
9002
9003 : Initialize h_sysfile
9004 h_sysfile=false
9005
9006 : access call always available on UNIX
9007 set access d_access
9008 eval $inlibc
9009
9010 : locate the flags for 'access()'
9011 case "$d_access" in
9012 "$define")
9013         echo " "
9014         $cat >access.c <<'EOCP'
9015 #include <sys/types.h>
9016 #ifdef I_FCNTL
9017 #include <fcntl.h>
9018 #endif
9019 #ifdef I_SYS_FILE
9020 #include <sys/file.h>
9021 #endif
9022 #ifdef I_UNISTD
9023 #include <unistd.h>
9024 #endif
9025 int main() {
9026         exit(R_OK);
9027 }
9028 EOCP
9029         : check sys/file.h first, no particular reason here
9030         if $test `./findhdr sys/file.h` && \
9031                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9032                 h_sysfile=true;
9033                 echo "<sys/file.h> defines the *_OK access constants." >&4
9034         elif $test `./findhdr fcntl.h` && \
9035                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9036                 h_fcntl=true;
9037                 echo "<fcntl.h> defines the *_OK access constants." >&4
9038         elif $test `./findhdr unistd.h` && \
9039                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9040                 echo "<unistd.h> defines the *_OK access constants." >&4
9041         else
9042                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9043         fi
9044         ;;
9045 esac
9046 $rm -f access*
9047
9048 : see if accessx exists
9049 set accessx d_accessx
9050 eval $inlibc
9051
9052 : see if alarm exists
9053 set alarm d_alarm
9054 eval $inlibc
9055
9056 : see if POSIX threads are available
9057 set pthread.h i_pthread
9058 eval $inhdr
9059
9060 : define a fucntion to check prototypes
9061 $cat > protochk <<EOSH
9062 $startsh
9063 cc="$cc"
9064 optimize="$optimize"
9065 ccflags="$ccflags"
9066 prototype="$prototype"
9067 define="$define"
9068 rm=$rm
9069 usethreads=$usethreads
9070 i_pthread=$i_pthread
9071 pthread_h_first=$pthread_h_first
9072 EOSH
9073
9074 $cat >> protochk <<'EOSH'
9075
9076 $rm -f try.c
9077 foo="$1"
9078 shift
9079 while test $# -ge 2; do
9080         case "$1" in
9081                 $define) echo "#include <$2>" >> try.c ;;
9082                 literal) echo "$2" >> try.c ;;
9083         esac
9084     # Extra magic for the benefit of systems that need pthread.h
9085     # to be included early to correctly detect threadsafe functions.
9086     # Such functions must guarantee themselves, though, that the usethreads
9087     # and i_pthread have been defined, before calling protochk.
9088     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9089         echo "#include <pthread.h>" >> try.c
9090         pthread_h_done=yes
9091     fi
9092     shift 2
9093 done
9094 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9095 cat >> try.c <<'EOCP'
9096 #ifdef CAN_PROTOTYPE
9097 #define _(args) args
9098 #else
9099 #define _(args) ()
9100 #endif
9101 EOCP
9102 echo "$foo" >> try.c
9103 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9104 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9105 status=$?
9106 $rm -f try.[co]
9107 exit $status
9108 EOSH
9109 chmod +x protochk
9110 $eunicefix protochk
9111
9112 hasproto='varname=$1; func=$2; shift; shift;
9113 while $test $# -ge 2; do
9114         case "$1" in
9115         $define) echo "#include <$2>";;
9116         esac ;
9117     shift 2;
9118 done > try.c;
9119 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9120 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9121         echo "$func() prototype found.";
9122         val="$define";
9123 else
9124         echo "$func() prototype NOT found.";
9125         val="$undef";
9126 fi;
9127 set $varname;
9128 eval $setvar;
9129 $rm -f try.c tryout.c'
9130
9131 : see if sys/types.h has to be included
9132 set sys/types.h i_systypes
9133 eval $inhdr
9134
9135 : see if sys/select.h has to be included
9136 set sys/select.h i_sysselct
9137 eval $inhdr
9138
9139 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9140 while $test $# -ge 2; do
9141         case "$1" in
9142         $define) echo "#include <$2>";;
9143         esac ;
9144     shift 2;
9145 done > try.c;
9146 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9147 set try;
9148 if eval $compile; then
9149         val="$define";
9150 else
9151         val="$undef";
9152 fi;
9153 set $varname;
9154 eval $setvar;
9155 $rm -f try.c try.o'
9156
9157 : see if we should include time.h, sys/time.h, or both
9158 echo " "
9159 if test "X$timeincl" = X; then
9160         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9161         $echo $n "I'm now running the test program...$c"
9162         $cat >try.c <<'EOCP'
9163 #include <sys/types.h>
9164 #ifdef I_TIME
9165 #include <time.h>
9166 #endif
9167 #ifdef I_SYSTIME
9168 #ifdef SYSTIMEKERNEL
9169 #define KERNEL
9170 #endif
9171 #include <sys/time.h>
9172 #endif
9173 #ifdef I_SYSSELECT
9174 #include <sys/select.h>
9175 #endif
9176 int main()
9177 {
9178         struct tm foo;
9179 #ifdef S_TIMEVAL
9180         struct timeval bar;
9181 #endif
9182 #ifdef S_TIMEZONE
9183         struct timezone tzp;
9184 #endif
9185         if (foo.tm_sec == foo.tm_sec)
9186                 exit(0);
9187 #ifdef S_TIMEVAL
9188         if (bar.tv_sec == bar.tv_sec)
9189                 exit(0);
9190 #endif
9191         exit(1);
9192 }
9193 EOCP
9194         flags=''
9195         for s_timezone in '-DS_TIMEZONE' ''; do
9196         sysselect=''
9197         for s_timeval in '-DS_TIMEVAL' ''; do
9198         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9199         for i_time in '' '-DI_TIME'; do
9200         for i_systime in '-DI_SYSTIME' ''; do
9201                 case "$flags" in
9202                 '') $echo $n ".$c"
9203                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9204                         if eval $compile; then
9205                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9206                                 shift
9207                                 flags="$*"
9208                                 echo " "
9209                                 $echo $n "Succeeded with $flags$c"
9210                         fi
9211                         ;;
9212                 esac
9213         done
9214         done
9215         done
9216         done
9217         done
9218         timeincl=''
9219         echo " "
9220         case "$flags" in
9221         *SYSTIMEKERNEL*) i_systimek="$define"
9222                 timeincl=`./findhdr sys/time.h`
9223                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9224         *) i_systimek="$undef";;
9225         esac
9226         case "$flags" in
9227         *I_TIME*) i_time="$define"
9228                 timeincl=`./findhdr time.h`" $timeincl"
9229                 echo "We'll include <time.h>." >&4;;
9230         *) i_time="$undef";;
9231         esac
9232         case "$flags" in
9233         *I_SYSTIME*) i_systime="$define"
9234                 timeincl=`./findhdr sys/time.h`" $timeincl"
9235                 echo "We'll include <sys/time.h>." >&4;;
9236         *) i_systime="$undef";;
9237         esac
9238         $rm -f try.c try
9239 fi
9240 : see if struct tm knows about tm_zone
9241 case "$i_systime$i_time" in
9242 *$define*) 
9243         echo " "
9244         echo "Checking to see if your struct tm has tm_zone field..." >&4
9245         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9246         eval $hasfield
9247         ;;
9248 *)      val="$undef"
9249         set d_tm_tm_zone
9250         eval $setvar
9251         ;;
9252 esac
9253 case "$d_tm_tm_zone" in
9254 "$define")      echo "Yes, it does."   ;;
9255 *)              echo "No, it doesn't." ;;
9256 esac
9257 : see if struct tm knows about tm_gmtoff
9258 case "$i_systime$i_time" in
9259 *$define*) 
9260         echo " "
9261         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9262         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9263         eval $hasfield
9264         ;;
9265 *)      val="$undef"
9266         set d_tm_tm_gmtoff
9267         eval $setvar
9268         ;;
9269 esac
9270 case "$d_tm_tm_gmtoff" in
9271 "$define")      echo "Yes, it does."   ;;
9272 *)              echo "No, it doesn't." ;;
9273 esac
9274
9275 : see if asctime_r exists
9276 set asctime_r d_asctime_r
9277 eval $inlibc
9278 case "$d_asctime_r" in
9279 "$define")
9280         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9281         case "$d_asctime_r_proto:$usethreads" in
9282         ":define")      d_asctime_r_proto=define
9283                 set d_asctime_r_proto asctime_r $hdrs
9284                 eval $hasproto ;;
9285         *)      ;;
9286         esac
9287         case "$d_asctime_r_proto" in
9288         define)
9289         case "$asctime_r_proto" in
9290         ''|0) try='char* asctime_r(const struct tm*, char*);'
9291         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9292         esac
9293         case "$asctime_r_proto" in
9294         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9295         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9296         esac
9297         case "$asctime_r_proto" in
9298         ''|0) try='int asctime_r(const struct tm*, char*);'
9299         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9300         esac
9301         case "$asctime_r_proto" in
9302         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9303         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9304         esac
9305         case "$asctime_r_proto" in
9306         ''|0)   d_asctime_r=undef
9307                 asctime_r_proto=0
9308                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9309         * )     case "$asctime_r_proto" in
9310                 REENTRANT_PROTO*) ;;
9311                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9312                 esac
9313                 echo "Prototype: $try" ;;
9314         esac
9315         ;;
9316         *)      case "$usethreads" in
9317                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9318                 esac
9319                 d_asctime_r=undef
9320                 asctime_r_proto=0
9321                 ;;
9322         esac
9323         ;;
9324 *)      asctime_r_proto=0
9325         ;;
9326 esac
9327
9328 : see if atolf exists
9329 set atolf d_atolf
9330 eval $inlibc
9331
9332 : see if atoll exists
9333 set atoll d_atoll
9334 eval $inlibc
9335
9336 : Look for GNU-cc style attribute checking
9337 echo " "
9338 echo "Checking whether your compiler can handle __attribute__ ..." >&4
9339 $cat >attrib.c <<'EOCP'
9340 #include <stdio.h>
9341 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
9342 EOCP
9343 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9344         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9345                 echo "Your C compiler doesn't fully support __attribute__."
9346                 val="$undef"
9347         else
9348                 echo "Your C compiler supports __attribute__."
9349                 val="$define"
9350         fi
9351 else
9352         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9353         val="$undef"
9354 fi
9355 set d_attribut
9356 eval $setvar
9357 $rm -f attrib*
9358
9359 : see if bcmp exists
9360 set bcmp d_bcmp
9361 eval $inlibc
9362
9363 : see if bcopy exists
9364 set bcopy d_bcopy
9365 eval $inlibc
9366
9367 : see if this is a unistd.h system
9368 set unistd.h i_unistd
9369 eval $inhdr
9370
9371 : see if getpgrp exists
9372 set getpgrp d_getpgrp
9373 eval $inlibc
9374
9375 case "$d_getpgrp" in
9376 "$define")
9377         echo " "
9378         echo "Checking to see which flavor of getpgrp is in use..."
9379         $cat >try.c <<EOP
9380 #$i_unistd I_UNISTD
9381 #include <sys/types.h>
9382 #ifdef I_UNISTD
9383 #  include <unistd.h>
9384 #endif
9385 int main()
9386 {
9387         if (getuid() == 0) {
9388                 printf("(I see you are running Configure as super-user...)\n");
9389                 setuid(1);
9390         }
9391 #ifdef TRY_BSD_PGRP
9392         if (getpgrp(1) == 0)
9393                 exit(0);
9394 #else
9395         if (getpgrp() > 0)
9396                 exit(0);
9397 #endif
9398         exit(1);
9399 }
9400 EOP
9401         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9402                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
9403                 val="$define"
9404         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9405                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
9406                 val="$undef"
9407         else
9408                 echo "I can't seem to compile and run the test program."
9409                 if ./usg; then
9410                         xxx="a USG one, i.e. you use getpgrp()."
9411                 else
9412                         # SVR4 systems can appear rather BSD-ish.
9413                         case "$i_unistd" in
9414                         $undef)
9415                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
9416                                 val="$define"
9417                                 ;;
9418                         $define)
9419                                 xxx="probably a USG one, i.e. you use getpgrp()."
9420                                 val="$undef"
9421                                 ;;
9422                         esac
9423                 fi
9424                 echo "Assuming your getpgrp is $xxx" >&4
9425         fi
9426         ;;
9427 *) val="$undef";;
9428 esac
9429 set d_bsdgetpgrp
9430 eval $setvar
9431 $rm -f try try.*
9432
9433 : see if setpgrp exists
9434 set setpgrp d_setpgrp
9435 eval $inlibc
9436
9437 case "$d_setpgrp" in
9438 "$define")
9439         echo " "
9440         echo "Checking to see which flavor of setpgrp is in use..."
9441         $cat >try.c <<EOP
9442 #$i_unistd I_UNISTD
9443 #include <sys/types.h>
9444 #ifdef I_UNISTD
9445 #  include <unistd.h>
9446 #endif
9447 int main()
9448 {
9449         if (getuid() == 0) {
9450                 printf("(I see you are running Configure as super-user...)\n");
9451                 setuid(1);
9452         }
9453 #ifdef TRY_BSD_PGRP
9454         if (-1 == setpgrp(1, 1))
9455                 exit(0);
9456 #else
9457         if (setpgrp() != -1)
9458                 exit(0);
9459 #endif
9460         exit(1);
9461 }
9462 EOP
9463         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9464                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
9465                 val="$define"
9466         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9467                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
9468                 val="$undef"
9469         else
9470                 echo "(I can't seem to compile and run the test program.)"
9471                 if ./usg; then
9472                         xxx="a USG one, i.e. you use setpgrp()."
9473                 else
9474                         # SVR4 systems can appear rather BSD-ish.
9475                         case "$i_unistd" in
9476                         $undef)
9477                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
9478                                 val="$define"
9479                                 ;;
9480                         $define)
9481                                 xxx="probably a USG one, i.e. you use setpgrp()."
9482                                 val="$undef"
9483                                 ;;
9484                         esac
9485                 fi
9486                 echo "Assuming your setpgrp is $xxx" >&4
9487         fi
9488         ;;
9489 *) val="$undef";;
9490 esac
9491 set d_bsdsetpgrp
9492 eval $setvar
9493 $rm -f try try.*
9494 : see if bzero exists
9495 set bzero d_bzero
9496 eval $inlibc
9497
9498 : see if signal is declared as pointer to function returning int or void
9499 echo " "
9500 xxx=`./findhdr signal.h`
9501 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
9502 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
9503         echo "You have int (*signal())() instead of void." >&4
9504         val="$undef"
9505 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
9506         echo "You have void (*signal())()." >&4
9507         val="$define"
9508 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
9509         echo "You have int (*signal())() instead of void." >&4
9510         val="$undef"
9511 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
9512         echo "You have void (*signal())()." >&4
9513         val="$define"
9514 else
9515         case "$d_voidsig" in
9516         '')
9517         echo "I can't determine whether signal handler returns void or int..." >&4
9518                 dflt=void
9519                 rp="What type does your signal handler return?"
9520                 . ./myread
9521                 case "$ans" in
9522                 v*) val="$define";;
9523                 *) val="$undef";;
9524                 esac;;
9525         "$define")
9526                 echo "As you already told me, signal handler returns void." >&4
9527                 val="$define"
9528                 ;;
9529         *)      echo "As you already told me, signal handler returns int." >&4
9530                 val="$undef"
9531                 ;;
9532         esac
9533 fi
9534 set d_voidsig
9535 eval $setvar
9536 case "$d_voidsig" in
9537 "$define") signal_t="void";;
9538 *) signal_t="int";;
9539 esac
9540 $rm -f $$.tmp
9541
9542 : check for ability to cast large floats to 32-bit ints.
9543 echo " "
9544 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
9545 if $test "$intsize" -ge 4; then
9546         xxx=int
9547 else
9548         xxx=long
9549 fi
9550 $cat >try.c <<EOCP
9551 #include <stdio.h>
9552 #include <sys/types.h>
9553 #include <signal.h>
9554 $signal_t blech(s) int s; { exit(3); }
9555 int main()
9556 {
9557         $xxx i32;
9558         double f, g;
9559         int result = 0;
9560         char str[16];
9561         signal(SIGFPE, blech);
9562
9563         /* Don't let compiler optimize the test away.  Store the number 
9564            in a writable string for gcc to pass to sscanf under HP/UX.
9565         */
9566         sprintf(str, "2147483647");
9567         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
9568         g = 10 * f;
9569         i32  = ($xxx) g;
9570
9571         /* x86 processors will probably give 0x8000 0000, which is a
9572        sign change.  We don't want that.  We want to mimic SPARC
9573            behavior here, which is to preserve the sign and give
9574            back 0x7fff ffff.
9575         */
9576         if (i32 != ($xxx) f)
9577                 result |= 1;
9578         exit(result);
9579 }
9580 EOCP
9581 set try
9582 if eval $compile_ok; then
9583         $run ./try
9584         yyy=$?
9585 else
9586         echo "(I can't seem to compile the test program--assuming it can't)"
9587         yyy=1
9588 fi
9589 case "$yyy" in
9590 0)      val="$define"
9591         echo "Yup, it can."
9592         ;;
9593 *)      val="$undef"
9594         echo "Nope, it can't."
9595         ;;
9596 esac
9597 set d_casti32
9598 eval $setvar
9599 $rm -f try try.*
9600
9601 : check for ability to cast negative floats to unsigned
9602 echo " "
9603 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
9604 $cat >try.c <<EOCP
9605 #include <stdio.h>
9606 #include <sys/types.h>
9607 #include <signal.h>
9608 $signal_t blech(s) int s; { exit(7); }
9609 $signal_t blech_in_list(s) int s; { exit(4); }
9610 unsigned long dummy_long(p) unsigned long p; { return p; }
9611 unsigned int dummy_int(p) unsigned int p; { return p; }
9612 unsigned short dummy_short(p) unsigned short p; { return p; }
9613 int main()
9614 {
9615         double f;
9616         unsigned long along;
9617         unsigned int aint;
9618         unsigned short ashort;
9619         int result = 0;
9620         char str[16];
9621         
9622         /* Frustrate gcc-2.7.2's optimizer which failed this test with
9623            a direct f = -123. assignment.  gcc-2.8.0 reportedly
9624            optimized the whole file away
9625         */
9626         /* Store the number in a writable string for gcc to pass to 
9627            sscanf under HP/UX.
9628         */
9629         sprintf(str, "-123");
9630         sscanf(str, "%lf", &f);  /* f = -123.; */
9631
9632         signal(SIGFPE, blech);
9633         along = (unsigned long)f;
9634         aint = (unsigned int)f;
9635         ashort = (unsigned short)f;
9636         if (along != (unsigned long)-123)
9637                 result |= 1;
9638         if (aint != (unsigned int)-123)
9639                 result |= 1;
9640         if (ashort != (unsigned short)-123)
9641                 result |= 1;
9642         sprintf(str, "1073741824.");
9643         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
9644         f = f + f;
9645         along = 0;
9646         along = (unsigned long)f;
9647         if (along != 0x80000000)
9648                 result |= 2;
9649         f -= 1.;
9650         along = 0;
9651         along = (unsigned long)f;
9652         if (along != 0x7fffffff)
9653                 result |= 1;
9654         f += 2.;
9655         along = 0;
9656         along = (unsigned long)f;
9657         if (along != 0x80000001)
9658                 result |= 2;
9659         if (result)
9660                 exit(result);
9661         signal(SIGFPE, blech_in_list);
9662         sprintf(str, "123.");
9663         sscanf(str, "%lf", &f);  /* f = 123.; */
9664         along = dummy_long((unsigned long)f);
9665         aint = dummy_int((unsigned int)f);
9666         ashort = dummy_short((unsigned short)f);
9667         if (along != (unsigned long)123)
9668                 result |= 4;
9669         if (aint != (unsigned int)123)
9670                 result |= 4;
9671         if (ashort != (unsigned short)123)
9672                 result |= 4;
9673         exit(result);
9674
9675 }
9676 EOCP
9677 set try
9678 if eval $compile_ok; then
9679         $run ./try
9680         castflags=$?
9681 else
9682         echo "(I can't seem to compile the test program--assuming it can't)"
9683         castflags=7
9684 fi
9685 case "$castflags" in
9686 0)      val="$define"
9687         echo "Yup, it can."
9688         ;;
9689 *)      val="$undef"
9690         echo "Nope, it can't."
9691         ;;
9692 esac
9693 set d_castneg
9694 eval $setvar
9695 $rm -f try.*
9696
9697 : see if vprintf exists
9698 echo " "
9699 if set vprintf val -f d_vprintf; eval $csym; $val; then
9700         echo 'vprintf() found.' >&4
9701         val="$define"
9702         $cat >try.c <<'EOF'
9703 #include <varargs.h>
9704
9705 int main() { xxx("foo"); }
9706
9707 xxx(va_alist)
9708 va_dcl
9709 {
9710         va_list args;
9711         char buf[10];
9712
9713         va_start(args);
9714         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
9715 }
9716 EOF
9717         set try
9718         if eval $compile && $run ./try; then
9719                 echo "Your vsprintf() returns (int)." >&4
9720                 val2="$undef"
9721         else
9722                 echo "Your vsprintf() returns (char*)." >&4
9723                 val2="$define"
9724         fi
9725 else
9726         echo 'vprintf() NOT found.' >&4
9727                 val="$undef"
9728                 val2="$undef"
9729 fi
9730 $rm -f try try.*
9731 set d_vprintf
9732 eval $setvar
9733 val=$val2
9734 set d_charvspr
9735 eval $setvar
9736
9737 : see if chown exists
9738 set chown d_chown
9739 eval $inlibc
9740
9741 : see if chroot exists
9742 set chroot d_chroot
9743 eval $inlibc
9744
9745 : see if chsize exists
9746 set chsize d_chsize
9747 eval $inlibc
9748
9749 : see if class exists
9750 set class d_class
9751 eval $inlibc
9752
9753 hasstruct='varname=$1; struct=$2; shift; shift;
9754 while $test $# -ge 2; do
9755         case "$1" in
9756         $define) echo "#include <$2>";;
9757         esac ;
9758     shift 2;
9759 done > try.c;
9760 echo "int main () { struct $struct foo; }" >> try.c;
9761 set try;
9762 if eval $compile; then
9763         val="$define";
9764 else
9765         val="$undef";
9766 fi;
9767 set $varname;
9768 eval $setvar;
9769 $rm -f try.c try.o'
9770
9771 socketlib=''
9772 sockethdr=''
9773 : see whether socket exists
9774 echo " "
9775 $echo $n "Hmm... $c" >&4
9776 if set socket val -f d_socket; eval $csym; $val; then
9777         echo "Looks like you have Berkeley networking support." >&4
9778         d_socket="$define"
9779         if set setsockopt val -f; eval $csym; $val; then
9780                 d_oldsock="$undef"
9781         else
9782                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9783                 d_oldsock="$define"
9784         fi
9785 else
9786         if $contains socklib libc.list >/dev/null 2>&1; then
9787                 echo "Looks like you have Berkeley networking support." >&4
9788                 d_socket="$define"
9789                 : we will have to assume that it supports the 4.2 BSD interface
9790                 d_oldsock="$undef"
9791         else
9792                 echo "You don't have Berkeley networking in libc$_a..." >&4
9793                 if test "X$d_socket" = "X$define"; then
9794                    echo "...but you seem to believe that you have sockets." >&4
9795                 else
9796                         for net in net socket
9797                         do
9798                                 if test -f /usr/lib/lib$net$_a; then
9799                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9800                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9801                                         if $contains socket libc.list >/dev/null 2>&1; then
9802                                                 d_socket="$define"
9803                                                 socketlib="-l$net"
9804                                                 case "$net" in
9805                                                 net)
9806                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9807                                                         sockethdr="-I/usr/netinclude"
9808                                                         ;;
9809                                                 esac
9810                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
9811                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9812                                                         d_oldsock="$undef"
9813                                                 else
9814                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9815                                                         d_oldsock="$define"
9816                                                 fi
9817                                                 break
9818                                         fi
9819                                 fi
9820                         done
9821                         if test "X$d_socket" != "X$define"; then
9822                            echo "or anywhere else I see." >&4
9823                            d_socket="$undef"
9824                            d_oldsock="$undef"
9825                         fi
9826                 fi
9827         fi
9828 fi
9829
9830 : see if socketpair exists
9831 set socketpair d_sockpair
9832 eval $inlibc
9833
9834
9835 echo " "
9836 echo "Checking the availability of certain socket constants..." >&4
9837 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9838         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9839         $cat >try.c <<EOF
9840 #include <sys/types.h>
9841 #include <sys/socket.h>
9842 int main() {
9843     int i = $ENUM;
9844 }
9845 EOF
9846         val="$undef"
9847         set try; if eval $compile; then
9848                 val="$define"
9849         fi
9850         set d_${enum}; eval $setvar
9851         $rm -f try.c try
9852 done
9853
9854 : see if this is a sys/uio.h system
9855 set sys/uio.h i_sysuio
9856 eval $inhdr
9857
9858
9859 echo " "
9860 echo "Checking to see if your system supports struct cmsghdr..." >&4
9861 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
9862 eval $hasstruct
9863 case "$d_cmsghdr_s" in
9864 "$define")      echo "Yes, it does."   ;;
9865 *)              echo "No, it doesn't." ;;
9866 esac
9867
9868
9869 : check for const keyword
9870 echo " "
9871 echo 'Checking to see if your C compiler knows about "const"...' >&4
9872 $cat >const.c <<'EOCP'
9873 typedef struct spug { int drokk; } spug;
9874 int main()
9875 {
9876         const char *foo;
9877         const spug y;
9878 }
9879 EOCP
9880 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
9881         val="$define"
9882         echo "Yup, it does."
9883 else
9884         val="$undef"
9885         echo "Nope, it doesn't."
9886 fi
9887 set d_const
9888 eval $setvar
9889
9890 : see if crypt exists
9891 echo " "
9892 set crypt d_crypt
9893 eval $inlibc
9894 case "$d_crypt" in
9895 $define) cryptlib='' ;;
9896 *)      if set crypt val -f d_crypt; eval $csym; $val; then
9897                 echo 'crypt() found.' >&4
9898                 val="$define"
9899                 cryptlib=''
9900         else
9901                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
9902                 if $test -z "$cryptlib"; then
9903                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
9904                 else
9905                         cryptlib=-lcrypt
9906                 fi
9907                 if $test -z "$cryptlib"; then
9908                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
9909                 else
9910                         cryptlib=-lcrypt
9911                 fi
9912                 if $test -z "$cryptlib"; then
9913                         cryptlib=`./loc libcrypt$_a "" $libpth`
9914                 else
9915                         cryptlib=-lcrypt
9916                 fi
9917                 if $test -z "$cryptlib"; then
9918                         echo 'crypt() NOT found.' >&4
9919                         val="$undef"
9920                 else
9921                         val="$define"
9922                 fi
9923         fi
9924         set d_crypt
9925         eval $setvar
9926         ;;
9927 esac
9928
9929 : see if this is a crypt.h system
9930 set crypt.h i_crypt
9931 eval $inhdr
9932
9933 : see if crypt_r exists
9934 set crypt_r d_crypt_r
9935 eval $inlibc
9936 case "$d_crypt_r" in
9937 "$define")
9938         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
9939         case "$d_crypt_r_proto:$usethreads" in
9940         ":define")      d_crypt_r_proto=define
9941                 set d_crypt_r_proto crypt_r $hdrs
9942                 eval $hasproto ;;
9943         *)      ;;
9944         esac
9945         case "$d_crypt_r_proto" in
9946         define)
9947         case "$crypt_r_proto" in
9948         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
9949         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
9950         esac
9951         case "$crypt_r_proto" in
9952         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
9953         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
9954         esac
9955         case "$crypt_r_proto" in
9956         ''|0)   d_crypt_r=undef
9957                 crypt_r_proto=0
9958                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
9959         * )     case "$crypt_r_proto" in
9960                 REENTRANT_PROTO*) ;;
9961                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
9962                 esac
9963                 echo "Prototype: $try" ;;
9964         esac
9965         ;;
9966         *)      case "$usethreads" in
9967                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
9968                 esac
9969                 d_crypt_r=undef
9970                 crypt_r_proto=0
9971                 ;;
9972         esac
9973         ;;
9974 *)      crypt_r_proto=0
9975         ;;
9976 esac
9977
9978 : get csh whereabouts
9979 case "$csh" in
9980 'csh') val="$undef" ;;
9981 *) val="$define" ;;
9982 esac
9983 set d_csh
9984 eval $setvar
9985 : Respect a hint or command line value for full_csh.
9986 case "$full_csh" in
9987 '') full_csh=$csh ;;
9988 esac
9989
9990 : see if ctermid_r exists
9991 set ctermid_r d_ctermid_r
9992 eval $inlibc
9993 case "$d_ctermid_r" in
9994 "$define")
9995         hdrs="$i_systypes sys/types.h define stdio.h "
9996         case "$d_ctermid_r_proto:$usethreads" in
9997         ":define")      d_ctermid_r_proto=define
9998                 set d_ctermid_r_proto ctermid_r $hdrs
9999                 eval $hasproto ;;
10000         *)      ;;
10001         esac
10002         case "$d_ctermid_r_proto" in
10003         define)
10004         case "$ctermid_r_proto" in
10005         ''|0) try='char* ctermid_r(char*);'
10006         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10007         esac
10008         case "$ctermid_r_proto" in
10009         ''|0)   d_ctermid_r=undef
10010                 ctermid_r_proto=0
10011                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10012         * )     case "$ctermid_r_proto" in
10013                 REENTRANT_PROTO*) ;;
10014                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10015                 esac
10016                 echo "Prototype: $try" ;;
10017         esac
10018         ;;
10019         *)      case "$usethreads" in
10020                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10021                 esac
10022                 d_ctermid_r=undef
10023                 ctermid_r_proto=0
10024                 ;;
10025         esac
10026         ;;
10027 *)      ctermid_r_proto=0
10028         ;;
10029 esac
10030
10031 : see if ctime_r exists
10032 set ctime_r d_ctime_r
10033 eval $inlibc
10034 case "$d_ctime_r" in
10035 "$define")
10036         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10037         case "$d_ctime_r_proto:$usethreads" in
10038         ":define")      d_ctime_r_proto=define
10039                 set d_ctime_r_proto ctime_r $hdrs
10040                 eval $hasproto ;;
10041         *)      ;;
10042         esac
10043         case "$d_ctime_r_proto" in
10044         define)
10045         case "$ctime_r_proto" in
10046         ''|0) try='char* ctime_r(const time_t*, char*);'
10047         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10048         esac
10049         case "$ctime_r_proto" in
10050         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10051         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10052         esac
10053         case "$ctime_r_proto" in
10054         ''|0) try='int ctime_r(const time_t*, char*);'
10055         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10056         esac
10057         case "$ctime_r_proto" in
10058         ''|0) try='int ctime_r(const time_t*, char*, int);'
10059         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10060         esac
10061         case "$ctime_r_proto" in
10062         ''|0)   d_ctime_r=undef
10063                 ctime_r_proto=0
10064                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10065         * )     case "$ctime_r_proto" in
10066                 REENTRANT_PROTO*) ;;
10067                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10068                 esac
10069                 echo "Prototype: $try" ;;
10070         esac
10071         ;;
10072         *)      case "$usethreads" in
10073                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10074                 esac
10075                 d_ctime_r=undef
10076                 ctime_r_proto=0
10077                 ;;
10078         esac
10079         ;;
10080 *)      ctime_r_proto=0
10081         ;;
10082 esac
10083
10084 : see if cuserid exists
10085 set cuserid d_cuserid
10086 eval $inlibc
10087
10088 : see if this is a limits.h system
10089 set limits.h i_limits
10090 eval $inhdr
10091
10092 : see if this is a float.h system
10093 set float.h i_float
10094 eval $inhdr
10095
10096 : See if number of significant digits in a double precision number is known
10097 echo " "
10098 $cat >dbl_dig.c <<EOM
10099 #$i_limits I_LIMITS
10100 #$i_float I_FLOAT
10101 #ifdef I_LIMITS
10102 #include <limits.h>
10103 #endif
10104 #ifdef I_FLOAT
10105 #include <float.h>
10106 #endif
10107 #ifdef DBL_DIG
10108 printf("Contains DBL_DIG");
10109 #endif
10110 EOM
10111 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10112 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10113         echo "DBL_DIG found." >&4
10114         val="$define"
10115 else
10116         echo "DBL_DIG NOT found." >&4
10117         val="$undef"
10118 fi
10119 $rm -f dbl_dig.?
10120 set d_dbl_dig
10121 eval $setvar
10122
10123 : see if dbm.h is available
10124 : see if dbmclose exists
10125 set dbmclose d_dbmclose
10126 eval $inlibc
10127
10128 case "$d_dbmclose" in
10129 $define)
10130         set dbm.h i_dbm
10131         eval $inhdr
10132         case "$i_dbm" in
10133         $define)
10134                 val="$undef"
10135                 set i_rpcsvcdbm
10136                 eval $setvar
10137                 ;;
10138         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10139                 eval $inhdr
10140                 ;;
10141         esac
10142         ;;
10143 *)      echo "We won't be including <dbm.h>"
10144         val="$undef"
10145         set i_dbm
10146         eval $setvar
10147         val="$undef"
10148         set i_rpcsvcdbm
10149         eval $setvar
10150         ;;
10151 esac
10152
10153 : see if prototype for dbminit is available
10154 echo " "
10155 set d_dbminitproto dbminit $i_dbm dbm.h
10156 eval $hasproto
10157
10158 : see if difftime exists
10159 set difftime d_difftime
10160 eval $inlibc
10161
10162 : see if this is a dirent system
10163 echo " "
10164 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10165         val="$define"
10166         echo "<dirent.h> found." >&4
10167 else
10168         val="$undef"
10169         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10170                 echo "<sys/dir.h> found." >&4
10171                 echo " "
10172         else
10173                 xinc=`./findhdr sys/ndir.h`
10174         fi
10175         echo "<dirent.h> NOT found." >&4
10176 fi
10177 set i_dirent
10178 eval $setvar
10179
10180 : Look for type of directory structure.
10181 echo " "
10182 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10183
10184 case "$direntrytype" in
10185 ''|' ')
10186         case "$i_dirent" in
10187         $define) guess1='struct dirent' ;;
10188         *) guess1='struct direct'  ;;
10189         esac
10190         ;;
10191 *)      guess1="$direntrytype"
10192         ;;
10193 esac
10194
10195 case "$guess1" in
10196 'struct dirent') guess2='struct direct' ;;
10197 *) guess2='struct dirent' ;;
10198 esac
10199                 
10200 if $contains "$guess1" try.c >/dev/null 2>&1; then
10201         direntrytype="$guess1"
10202         echo "Your directory entries are $direntrytype." >&4
10203 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10204         direntrytype="$guess2"
10205         echo "Your directory entries seem to be $direntrytype." >&4
10206 else
10207         echo "I don't recognize your system's directory entries." >&4
10208         rp="What type is used for directory entries on this system?"
10209         dflt="$guess1"
10210         . ./myread
10211         direntrytype="$ans"
10212 fi
10213 $rm -f try.c
10214
10215
10216 : see if the directory entry stores field length
10217 echo " "
10218 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10219 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10220         echo "Good, your directory entry keeps length information in d_namlen." >&4
10221         val="$define"
10222 else
10223         echo "Your directory entry does not know about the d_namlen field." >&4
10224         val="$undef"
10225 fi
10226 set d_dirnamlen
10227 eval $setvar
10228 $rm -f try.c
10229
10230 : see if this is an sysdir system
10231 set sys/dir.h i_sysdir
10232 eval $inhdr
10233
10234 : see if this is an sysndir system
10235 set sys/ndir.h i_sysndir
10236 eval $inhdr
10237
10238 : Look for dirfd
10239 echo " "
10240 $cat >dirfd.c <<EOM
10241 #include <stdio.h>
10242 #$i_dirent I_DIRENT             /**/
10243 #$i_sysdir I_SYS_DIR            /**/
10244 #$i_sysndir I_SYS_NDIR          /**/
10245 #$i_systypes I_SYS_TYPES        /**/
10246 #if defined(I_SYS_TYPES)
10247 #include <sys/types.h>
10248 #endif
10249 #if defined(I_DIRENT)
10250 #include <dirent.h>
10251 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10252 #include <sys/dir.h>
10253 #endif
10254 #else
10255 #ifdef I_SYS_NDIR
10256 #include <sys/ndir.h>
10257 #else
10258 #ifdef I_SYS_DIR
10259 #ifdef hp9000s500
10260 #include <ndir.h>       /* may be wrong in the future */
10261 #else
10262 #include <sys/dir.h>
10263 #endif
10264 #endif
10265 #endif
10266 #endif 
10267 int main() {
10268         DIR *dirp = opendir(".");
10269         if (dirfd(dirp) >= 0)
10270                 exit(0);
10271         else
10272                 exit(1);
10273 }
10274 EOM
10275 set dirfd
10276 if eval $compile; then
10277         val="$define"
10278 fi
10279 case "$val" in
10280 $define)        echo "dirfd() found." >&4       ;;
10281 *)              echo "dirfd() NOT found." >&4   ;;
10282 esac
10283 set d_dirfd
10284 eval $setvar
10285 $rm -f dirfd*
10286
10287 : see if dlerror exists
10288 xxx_runnm="$runnm"
10289 runnm=false
10290 set dlerror d_dlerror
10291 eval $inlibc
10292 runnm="$xxx_runnm"
10293
10294 : see if dlfcn is available
10295 set dlfcn.h i_dlfcn
10296 eval $inhdr
10297
10298 case "$usedl" in
10299 $define|y|true)
10300         $cat << EOM
10301
10302 On a few systems, the dynamically loaded modules that perl generates and uses
10303 will need a different extension than shared libs. The default will probably
10304 be appropriate.
10305
10306 EOM
10307         case "$dlext" in
10308         '')     dflt="$so" ;;
10309         *)      dflt="$dlext" ;;
10310         esac
10311         rp='What is the extension of dynamically loaded modules'
10312         . ./myread
10313         dlext="$ans"
10314         ;;
10315 *)
10316         dlext="none"
10317         ;;
10318 esac
10319
10320 : Check if dlsym need a leading underscore
10321 echo " "
10322 val="$undef"
10323
10324 case "$dlsrc" in
10325 dl_dlopen.xs)
10326         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
10327         $cat >dyna.c <<'EOM'
10328 fred () { }
10329 EOM
10330
10331 $cat >fred.c<<EOM
10332
10333 #include <stdio.h>
10334 #$i_dlfcn I_DLFCN
10335 #ifdef I_DLFCN
10336 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
10337 #else
10338 #include <sys/types.h>
10339 #include <nlist.h>
10340 #include <link.h>
10341 #endif
10342
10343 extern int fred() ;
10344
10345 int main()
10346 {
10347     void * handle ;
10348     void * symbol ;
10349 #ifndef RTLD_LAZY
10350     int mode = 1 ;
10351 #else
10352     int mode = RTLD_LAZY ;
10353 #endif
10354     handle = dlopen("./dyna.$dlext", mode) ;
10355     if (handle == NULL) {
10356         printf ("1\n") ;
10357         fflush (stdout) ;
10358         exit(0);
10359     }
10360     symbol = dlsym(handle, "fred") ;
10361     if (symbol == NULL) {
10362         /* try putting a leading underscore */
10363         symbol = dlsym(handle, "_fred") ;
10364         if (symbol == NULL) {
10365             printf ("2\n") ;
10366             fflush (stdout) ;
10367             exit(0);
10368         }
10369         printf ("3\n") ;
10370     }
10371     else
10372         printf ("4\n") ;
10373     fflush (stdout) ;
10374     exit(0);
10375 }
10376 EOM
10377         : Call the object file tmp-dyna.o in case dlext=o.
10378         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
10379                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
10380                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
10381                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
10382                 xxx=`$run ./fred`
10383                 case $xxx in
10384                 1)      echo "Test program failed using dlopen." >&4
10385                         echo "Perhaps you should not use dynamic loading." >&4;;
10386                 2)      echo "Test program failed using dlsym." >&4
10387                         echo "Perhaps you should not use dynamic loading." >&4;;
10388                 3)      echo "dlsym needs a leading underscore" >&4
10389                         val="$define" ;;
10390                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
10391                 esac
10392         else
10393                 echo "I can't compile and run the test program." >&4
10394                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
10395         fi
10396         ;;
10397 esac
10398                 
10399 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
10400
10401 set d_dlsymun
10402 eval $setvar
10403
10404 : see if drand48_r exists
10405 set drand48_r d_drand48_r
10406 eval $inlibc
10407 case "$d_drand48_r" in
10408 "$define")
10409         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
10410         case "$d_drand48_r_proto:$usethreads" in
10411         ":define")      d_drand48_r_proto=define
10412                 set d_drand48_r_proto drand48_r $hdrs
10413                 eval $hasproto ;;
10414         *)      ;;
10415         esac
10416         case "$d_drand48_r_proto" in
10417         define)
10418         case "$drand48_r_proto" in
10419         ''|0) try='int drand48_r(struct drand48_data*, double*);'
10420         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
10421         esac
10422         case "$drand48_r_proto" in
10423         ''|0)   d_drand48_r=undef
10424                 drand48_r_proto=0
10425                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10426         * )     case "$drand48_r_proto" in
10427                 REENTRANT_PROTO*) ;;
10428                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
10429                 esac
10430                 echo "Prototype: $try" ;;
10431         esac
10432         ;;
10433         *)      case "$usethreads" in
10434                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
10435                 esac
10436                 d_drand48_r=undef
10437                 drand48_r_proto=0
10438                 ;;
10439         esac
10440         ;;
10441 *)      drand48_r_proto=0
10442         ;;
10443 esac
10444
10445 : see if prototype for drand48 is available
10446 echo " "
10447 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
10448 eval $hasproto
10449
10450 : see if dup2 exists
10451 set dup2 d_dup2
10452 eval $inlibc
10453
10454 : see if eaccess exists
10455 set eaccess d_eaccess
10456 eval $inlibc
10457
10458 : see if endgrent exists
10459 set endgrent d_endgrent
10460 eval $inlibc
10461
10462 : see if this is an grp system
10463 set grp.h i_grp
10464 eval $inhdr
10465
10466 case "$i_grp" in
10467 $define)
10468         xxx=`./findhdr grp.h`
10469         $cppstdin $cppflags $cppminus < $xxx >$$.h
10470
10471         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10472                 val="$define"
10473         else
10474                 val="$undef"
10475         fi
10476         set d_grpasswd
10477         eval $setvar
10478
10479         $rm -f $$.h
10480         ;;
10481 *)
10482         val="$undef";
10483         set d_grpasswd; eval $setvar
10484         ;;
10485 esac
10486
10487 : see if endgrent_r exists
10488 set endgrent_r d_endgrent_r
10489 eval $inlibc
10490 case "$d_endgrent_r" in
10491 "$define")
10492         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
10493         case "$d_endgrent_r_proto:$usethreads" in
10494         ":define")      d_endgrent_r_proto=define
10495                 set d_endgrent_r_proto endgrent_r $hdrs
10496                 eval $hasproto ;;
10497         *)      ;;
10498         esac
10499         case "$d_endgrent_r_proto" in
10500         define)
10501         case "$endgrent_r_proto" in
10502         ''|0) try='int endgrent_r(FILE**);'
10503         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
10504         esac
10505         case "$endgrent_r_proto" in
10506         ''|0) try='void endgrent_r(FILE**);'
10507         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
10508         esac
10509         case "$endgrent_r_proto" in
10510         ''|0)   d_endgrent_r=undef
10511                 endgrent_r_proto=0
10512                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10513         * )     case "$endgrent_r_proto" in
10514                 REENTRANT_PROTO*) ;;
10515                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
10516                 esac
10517                 echo "Prototype: $try" ;;
10518         esac
10519         ;;
10520         *)      case "$usethreads" in
10521                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
10522                 esac
10523                 d_endgrent_r=undef
10524                 endgrent_r_proto=0
10525                 ;;
10526         esac
10527         ;;
10528 *)      endgrent_r_proto=0
10529         ;;
10530 esac
10531
10532 : see if endhostent exists
10533 set endhostent d_endhent
10534 eval $inlibc
10535
10536 : see if this is a netdb.h system
10537 set netdb.h i_netdb
10538 eval $inhdr
10539
10540 : see if endhostent_r exists
10541 set endhostent_r d_endhostent_r
10542 eval $inlibc
10543 case "$d_endhostent_r" in
10544 "$define")
10545         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10546         case "$d_endhostent_r_proto:$usethreads" in
10547         ":define")      d_endhostent_r_proto=define
10548                 set d_endhostent_r_proto endhostent_r $hdrs
10549                 eval $hasproto ;;
10550         *)      ;;
10551         esac
10552         case "$d_endhostent_r_proto" in
10553         define)
10554         case "$endhostent_r_proto" in
10555         ''|0) try='int endhostent_r(struct hostent_data*);'
10556         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
10557         esac
10558         case "$endhostent_r_proto" in
10559         ''|0) try='void endhostent_r(struct hostent_data*);'
10560         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
10561         esac
10562         case "$endhostent_r_proto" in
10563         ''|0)   d_endhostent_r=undef
10564                 endhostent_r_proto=0
10565                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10566         * )     case "$endhostent_r_proto" in
10567                 REENTRANT_PROTO*) ;;
10568                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
10569                 esac
10570                 echo "Prototype: $try" ;;
10571         esac
10572         ;;
10573         *)      case "$usethreads" in
10574                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
10575                 esac
10576                 d_endhostent_r=undef
10577                 endhostent_r_proto=0
10578                 ;;
10579         esac
10580         ;;
10581 *)      endhostent_r_proto=0
10582         ;;
10583 esac
10584
10585 : see if endnetent exists
10586 set endnetent d_endnent
10587 eval $inlibc
10588
10589 : see if endnetent_r exists
10590 set endnetent_r d_endnetent_r
10591 eval $inlibc
10592 case "$d_endnetent_r" in
10593 "$define")
10594         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10595         case "$d_endnetent_r_proto:$usethreads" in
10596         ":define")      d_endnetent_r_proto=define
10597                 set d_endnetent_r_proto endnetent_r $hdrs
10598                 eval $hasproto ;;
10599         *)      ;;
10600         esac
10601         case "$d_endnetent_r_proto" in
10602         define)
10603         case "$endnetent_r_proto" in
10604         ''|0) try='int endnetent_r(struct netent_data*);'
10605         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
10606         esac
10607         case "$endnetent_r_proto" in
10608         ''|0) try='void endnetent_r(struct netent_data*);'
10609         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
10610         esac
10611         case "$endnetent_r_proto" in
10612         ''|0)   d_endnetent_r=undef
10613                 endnetent_r_proto=0
10614                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10615         * )     case "$endnetent_r_proto" in
10616                 REENTRANT_PROTO*) ;;
10617                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
10618                 esac
10619                 echo "Prototype: $try" ;;
10620         esac
10621         ;;
10622         *)      case "$usethreads" in
10623                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
10624                 esac
10625                 d_endnetent_r=undef
10626                 endnetent_r_proto=0
10627                 ;;
10628         esac
10629         ;;
10630 *)      endnetent_r_proto=0
10631         ;;
10632 esac
10633
10634 : see if endprotoent exists
10635 set endprotoent d_endpent
10636 eval $inlibc
10637
10638 : see if endprotoent_r exists
10639 set endprotoent_r d_endprotoent_r
10640 eval $inlibc
10641 case "$d_endprotoent_r" in
10642 "$define")
10643         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10644         case "$d_endprotoent_r_proto:$usethreads" in
10645         ":define")      d_endprotoent_r_proto=define
10646                 set d_endprotoent_r_proto endprotoent_r $hdrs
10647                 eval $hasproto ;;
10648         *)      ;;
10649         esac
10650         case "$d_endprotoent_r_proto" in
10651         define)
10652         case "$endprotoent_r_proto" in
10653         ''|0) try='int endprotoent_r(struct protoent_data*);'
10654         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
10655         esac
10656         case "$endprotoent_r_proto" in
10657         ''|0) try='void endprotoent_r(struct protoent_data*);'
10658         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
10659         esac
10660         case "$endprotoent_r_proto" in
10661         ''|0)   d_endprotoent_r=undef
10662                 endprotoent_r_proto=0
10663                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10664         * )     case "$endprotoent_r_proto" in
10665                 REENTRANT_PROTO*) ;;
10666                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
10667                 esac
10668                 echo "Prototype: $try" ;;
10669         esac
10670         ;;
10671         *)      case "$usethreads" in
10672                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
10673                 esac
10674                 d_endprotoent_r=undef
10675                 endprotoent_r_proto=0
10676                 ;;
10677         esac
10678         ;;
10679 *)      endprotoent_r_proto=0
10680         ;;
10681 esac
10682
10683 : see if endpwent exists
10684 set endpwent d_endpwent
10685 eval $inlibc
10686
10687 : see if this is a pwd.h system
10688 set pwd.h i_pwd
10689 eval $inhdr
10690
10691 case "$i_pwd" in
10692 $define)
10693         xxx=`./findhdr pwd.h`
10694         $cppstdin $cppflags $cppminus < $xxx >$$.h
10695
10696         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10697                 val="$define"
10698         else
10699                 val="$undef"
10700         fi
10701         set d_pwquota
10702         eval $setvar
10703
10704         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10705                 val="$define"
10706         else
10707                 val="$undef"
10708         fi
10709         set d_pwage
10710         eval $setvar
10711
10712         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10713                 val="$define"
10714         else
10715                 val="$undef"
10716         fi
10717         set d_pwchange
10718         eval $setvar
10719
10720         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10721                 val="$define"
10722         else
10723                 val="$undef"
10724         fi
10725         set d_pwclass
10726         eval $setvar
10727
10728         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10729                 val="$define"
10730         else
10731                 val="$undef"
10732         fi
10733         set d_pwexpire
10734         eval $setvar
10735
10736         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10737                 val="$define"
10738         else
10739                 val="$undef"
10740         fi
10741         set d_pwcomment
10742         eval $setvar
10743
10744         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10745                 val="$define"
10746         else
10747                 val="$undef"
10748         fi
10749         set d_pwgecos
10750         eval $setvar
10751
10752         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10753                 val="$define"
10754         else
10755                 val="$undef"
10756         fi
10757         set d_pwpasswd
10758         eval $setvar
10759
10760         $rm -f $$.h
10761         ;;
10762 *)
10763         val="$undef"; 
10764         set d_pwquota; eval $setvar
10765         set d_pwage; eval $setvar
10766         set d_pwchange; eval $setvar
10767         set d_pwclass; eval $setvar
10768         set d_pwexpire; eval $setvar
10769         set d_pwcomment; eval $setvar
10770         set d_pwgecos; eval $setvar
10771         set d_pwpasswd; eval $setvar
10772         ;;
10773 esac
10774
10775 : see if endpwent_r exists
10776 set endpwent_r d_endpwent_r
10777 eval $inlibc
10778 case "$d_endpwent_r" in
10779 "$define")
10780         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
10781         case "$d_endpwent_r_proto:$usethreads" in
10782         ":define")      d_endpwent_r_proto=define
10783                 set d_endpwent_r_proto endpwent_r $hdrs
10784                 eval $hasproto ;;
10785         *)      ;;
10786         esac
10787         case "$d_endpwent_r_proto" in
10788         define)
10789         case "$endpwent_r_proto" in
10790         ''|0) try='int endpwent_r(FILE**);'
10791         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
10792         esac
10793         case "$endpwent_r_proto" in
10794         ''|0) try='void endpwent_r(FILE**);'
10795         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
10796         esac
10797         case "$endpwent_r_proto" in
10798         ''|0)   d_endpwent_r=undef
10799                 endpwent_r_proto=0
10800                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10801         * )     case "$endpwent_r_proto" in
10802                 REENTRANT_PROTO*) ;;
10803                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
10804                 esac
10805                 echo "Prototype: $try" ;;
10806         esac
10807         ;;
10808         *)      case "$usethreads" in
10809                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
10810                 esac
10811                 d_endpwent_r=undef
10812                 endpwent_r_proto=0
10813                 ;;
10814         esac
10815         ;;
10816 *)      endpwent_r_proto=0
10817         ;;
10818 esac
10819
10820 : see if endservent exists
10821 set endservent d_endsent
10822 eval $inlibc
10823
10824 : see if endservent_r exists
10825 set endservent_r d_endservent_r
10826 eval $inlibc
10827 case "$d_endservent_r" in
10828 "$define")
10829         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10830         case "$d_endservent_r_proto:$usethreads" in
10831         ":define")      d_endservent_r_proto=define
10832                 set d_endservent_r_proto endservent_r $hdrs
10833                 eval $hasproto ;;
10834         *)      ;;
10835         esac
10836         case "$d_endservent_r_proto" in
10837         define)
10838         case "$endservent_r_proto" in
10839         ''|0) try='int endservent_r(struct servent_data*);'
10840         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
10841         esac
10842         case "$endservent_r_proto" in
10843         ''|0) try='void endservent_r(struct servent_data*);'
10844         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
10845         esac
10846         case "$endservent_r_proto" in
10847         ''|0)   d_endservent_r=undef
10848                 endservent_r_proto=0
10849                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10850         * )     case "$endservent_r_proto" in
10851                 REENTRANT_PROTO*) ;;
10852                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
10853                 esac
10854                 echo "Prototype: $try" ;;
10855         esac
10856         ;;
10857         *)      case "$usethreads" in
10858                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
10859                 esac
10860                 d_endservent_r=undef
10861                 endservent_r_proto=0
10862                 ;;
10863         esac
10864         ;;
10865 *)      endservent_r_proto=0
10866         ;;
10867 esac
10868
10869 : Locate the flags for 'open()'
10870 echo " "
10871 $cat >try.c <<'EOCP'
10872 #include <sys/types.h>
10873 #ifdef I_FCNTL
10874 #include <fcntl.h>
10875 #endif
10876 #ifdef I_SYS_FILE
10877 #include <sys/file.h>
10878 #endif
10879 int main() {
10880         if(O_RDONLY);
10881 #ifdef O_TRUNC
10882         exit(0);
10883 #else
10884         exit(1);
10885 #endif
10886 }
10887 EOCP
10888 : check sys/file.h first to get FREAD on Sun
10889 if $test `./findhdr sys/file.h` && \
10890                 set try -DI_SYS_FILE && eval $compile; then
10891         h_sysfile=true;
10892         echo "<sys/file.h> defines the O_* constants..." >&4
10893         if $run ./try; then
10894                 echo "and you have the 3 argument form of open()." >&4
10895                 val="$define"
10896         else
10897                 echo "but not the 3 argument form of open().  Oh, well." >&4
10898                 val="$undef"
10899         fi
10900 elif $test `./findhdr fcntl.h` && \
10901                 set try -DI_FCNTL && eval $compile; then
10902         h_fcntl=true;
10903         echo "<fcntl.h> defines the O_* constants..." >&4
10904         if $run ./try; then
10905                 echo "and you have the 3 argument form of open()." >&4
10906                 val="$define"
10907         else
10908                 echo "but not the 3 argument form of open().  Oh, well." >&4
10909                 val="$undef"
10910         fi
10911 else
10912         val="$undef"
10913         echo "I can't find the O_* constant definitions!  You got problems." >&4
10914 fi
10915 set d_open3
10916 eval $setvar
10917 $rm -f try try.*
10918
10919 : see which of string.h or strings.h is needed
10920 echo " "
10921 strings=`./findhdr string.h`
10922 if $test "$strings" && $test -r "$strings"; then
10923         echo "Using <string.h> instead of <strings.h>." >&4
10924         val="$define"
10925 else
10926         val="$undef"
10927         strings=`./findhdr strings.h`
10928         if $test "$strings" && $test -r "$strings"; then
10929                 echo "Using <strings.h> instead of <string.h>." >&4
10930         else
10931                 echo "No string header found -- You'll surely have problems." >&4
10932         fi
10933 fi
10934 set i_string
10935 eval $setvar
10936 case "$i_string" in
10937 "$undef") strings=`./findhdr strings.h`;;
10938 *)        strings=`./findhdr string.h`;;
10939 esac
10940
10941 : see if this is a sys/file.h system
10942 val=''
10943 set sys/file.h val
10944 eval $inhdr
10945
10946 : do we need to include sys/file.h ?
10947 case "$val" in
10948 "$define")
10949         echo " "
10950         if $h_sysfile; then
10951                 val="$define"
10952                 echo "We'll be including <sys/file.h>." >&4
10953         else
10954                 val="$undef"
10955                 echo "We won't be including <sys/file.h>." >&4
10956         fi
10957         ;;
10958 *)
10959         h_sysfile=false
10960         ;;
10961 esac
10962 set i_sysfile
10963 eval $setvar
10964
10965 : see if fcntl.h is there
10966 val=''
10967 set fcntl.h val
10968 eval $inhdr
10969
10970 : see if we can include fcntl.h
10971 case "$val" in
10972 "$define")
10973         echo " "
10974         if $h_fcntl; then
10975                 val="$define"
10976                 echo "We'll be including <fcntl.h>." >&4
10977         else
10978                 val="$undef"
10979                 if $h_sysfile; then
10980         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
10981                 else
10982                         echo "We won't be including <fcntl.h>." >&4
10983                 fi
10984         fi
10985         ;;
10986 *)
10987         h_fcntl=false
10988         val="$undef"
10989         ;;
10990 esac
10991 set i_fcntl
10992 eval $setvar
10993
10994 : check for non-blocking I/O stuff
10995 case "$h_sysfile" in
10996 true) echo "#include <sys/file.h>" > head.c;;
10997 *)
10998        case "$h_fcntl" in
10999        true) echo "#include <fcntl.h>" > head.c;;
11000        *) echo "#include <sys/fcntl.h>" > head.c;;
11001        esac
11002        ;;
11003 esac
11004 echo " "
11005 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11006 case "$o_nonblock" in
11007 '')
11008         $cat head.c > try.c
11009         $cat >>try.c <<EOCP
11010 #include <stdio.h>
11011 #include <stdlib.h>
11012 #$i_fcntl I_FCNTL
11013 #ifdef I_FCNTL
11014 #include <fcntl.h>
11015 #endif
11016 int main() {
11017 #ifdef O_NONBLOCK
11018         printf("O_NONBLOCK\n");
11019         exit(0);
11020 #endif
11021 #ifdef O_NDELAY
11022         printf("O_NDELAY\n");
11023         exit(0);
11024 #endif
11025 #ifdef FNDELAY
11026         printf("FNDELAY\n");
11027         exit(0);
11028 #endif
11029         exit(0);
11030 }
11031 EOCP
11032         set try
11033         if eval $compile_ok; then
11034                 o_nonblock=`$run ./try`
11035                 case "$o_nonblock" in
11036                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11037                 *) echo "Seems like we can use $o_nonblock.";;
11038                 esac
11039         else
11040                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11041         fi
11042         ;;
11043 *) echo "Using $hint value $o_nonblock.";;
11044 esac
11045 $rm -f try try.* .out core
11046
11047 echo " "
11048 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11049 case "$eagain" in
11050 '')
11051         $cat head.c > try.c
11052         $cat >>try.c <<EOCP
11053 #include <errno.h>
11054 #include <sys/types.h>
11055 #include <signal.h>
11056 #include <stdio.h> 
11057 #include <stdlib.h> 
11058 #$i_fcntl I_FCNTL
11059 #ifdef I_FCNTL
11060 #include <fcntl.h>
11061 #endif
11062 #define MY_O_NONBLOCK $o_nonblock
11063 #ifndef errno  /* XXX need better Configure test */
11064 extern int errno;
11065 #endif
11066 #$i_unistd I_UNISTD
11067 #ifdef I_UNISTD
11068 #include <unistd.h>
11069 #endif
11070 #$i_string I_STRING
11071 #ifdef I_STRING
11072 #include <string.h>
11073 #else
11074 #include <strings.h>
11075 #endif
11076 $signal_t blech(x) int x; { exit(3); }
11077 EOCP
11078         $cat >> try.c <<'EOCP'
11079 int main()
11080 {
11081         int pd[2];
11082         int pu[2];
11083         char buf[1];
11084         char string[100];
11085
11086         pipe(pd);       /* Down: child -> parent */
11087         pipe(pu);       /* Up: parent -> child */
11088         if (0 != fork()) {
11089                 int ret;
11090                 close(pd[1]);   /* Parent reads from pd[0] */
11091                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11092 #ifdef F_SETFL
11093                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11094                         exit(1);
11095 #else
11096                 exit(4);
11097 #endif
11098                 signal(SIGALRM, blech);
11099                 alarm(5);
11100                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11101                         exit(2);
11102                 sprintf(string, "%d\n", ret);
11103                 write(2, string, strlen(string));
11104                 alarm(0);
11105 #ifdef EAGAIN
11106                 if (errno == EAGAIN) {
11107                         printf("EAGAIN\n");
11108                         goto ok;
11109                 }
11110 #endif
11111 #ifdef EWOULDBLOCK
11112                 if (errno == EWOULDBLOCK)
11113                         printf("EWOULDBLOCK\n");
11114 #endif
11115         ok:
11116                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11117                 sleep(2);                               /* Give it time to close our pipe */
11118                 alarm(5);
11119                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11120                 alarm(0);
11121                 sprintf(string, "%d\n", ret);
11122                 write(4, string, strlen(string));
11123                 exit(0);
11124         }
11125
11126         close(pd[0]);                   /* We write to pd[1] */
11127         close(pu[1]);                   /* We read from pu[0] */
11128         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11129         close(pd[1]);                   /* Pipe pd is now fully closed! */
11130         exit(0);                                /* Bye bye, thank you for playing! */
11131 }
11132 EOCP
11133         set try
11134         if eval $compile_ok; then
11135                 echo "$startsh" >mtry
11136                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11137                 chmod +x mtry
11138                 ./mtry >/dev/null 2>&1
11139                 case $? in
11140                 0) eagain=`$cat try.out`;;
11141                 1) echo "Could not perform non-blocking setting!";;
11142                 2) echo "I did a successful read() for something that was not there!";;
11143                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11144                 4) echo "Could not find F_SETFL!";;
11145                 *) echo "Something terribly wrong happened during testing.";;
11146                 esac
11147                 rd_nodata=`$cat try.ret`
11148                 echo "A read() system call with no data present returns $rd_nodata."
11149                 case "$rd_nodata" in
11150                 0|-1) ;;
11151                 *)
11152                         echo "(That's peculiar, fixing that to be -1.)"
11153                         rd_nodata=-1
11154                         ;;
11155                 esac
11156                 case "$eagain" in
11157                 '')
11158                         echo "Forcing errno EAGAIN on read() with no data available."
11159                         eagain=EAGAIN
11160                         ;;
11161                 *)
11162                         echo "Your read() sets errno to $eagain when no data is available."
11163                         ;;
11164                 esac
11165                 status=`$cat try.err`
11166                 case "$status" in
11167                 0) echo "And it correctly returns 0 to signal EOF.";;
11168                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11169                 *) echo "However, your read() returns '$status' on EOF??";;
11170                 esac
11171                 val="$define"
11172                 if test "$status" = "$rd_nodata"; then
11173                         echo "WARNING: you can't distinguish between EOF and no data!"
11174                         val="$undef"
11175                 fi
11176         else
11177                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11178                 eagain=EAGAIN
11179         fi
11180         set d_eofnblk
11181         eval $setvar
11182         ;;
11183 *)
11184         echo "Using $hint value $eagain."
11185         echo "Your read() returns $rd_nodata when no data is present."
11186         case "$d_eofnblk" in
11187         "$define") echo "And you can see EOF because read() returns 0.";;
11188         "$undef") echo "But you can't see EOF status from read() returned value.";;
11189         *)
11190                 echo "(Assuming you can't see EOF status from read anyway.)"
11191                 d_eofnblk=$undef
11192                 ;;
11193         esac
11194         ;;
11195 esac
11196 $rm -f try try.* .out core head.c mtry
11197
11198 : see if fchdir exists
11199 set fchdir d_fchdir
11200 eval $inlibc
11201
11202 : see if fchmod exists
11203 set fchmod d_fchmod
11204 eval $inlibc
11205
11206 : see if fchown exists
11207 set fchown d_fchown
11208 eval $inlibc
11209
11210 : see if this is an fcntl system
11211 set fcntl d_fcntl
11212 eval $inlibc
11213
11214 echo " "
11215 : See if fcntl-based locking works.
11216 $cat >try.c <<EOCP
11217 #include <stdlib.h>
11218 #include <unistd.h>
11219 #include <fcntl.h>
11220 #include <signal.h>
11221 $signal_t blech(x) int x; { exit(3); }
11222 int main() {
11223 #if defined(F_SETLK) && defined(F_SETLKW)
11224      struct flock flock;
11225      int retval, fd;
11226      fd = open("try.c", O_RDONLY);
11227      flock.l_type = F_RDLCK;
11228      flock.l_whence = SEEK_SET;
11229      flock.l_start = flock.l_len = 0;
11230      signal(SIGALRM, blech);
11231      alarm(10);
11232      retval = fcntl(fd, F_SETLK, &flock);
11233      close(fd);
11234      (retval < 0 ? exit(2) : exit(0));
11235 #else
11236      exit(2);
11237 #endif
11238 }
11239 EOCP
11240 echo "Checking if fcntl-based file locking works... "
11241 case "$d_fcntl" in
11242 "$define")
11243         set try
11244         if eval $compile_ok; then
11245                 if $run ./try; then
11246                         echo "Yes, it seems to work."
11247                         val="$define"
11248                 else
11249                         echo "Nope, it didn't work."
11250                         val="$undef"
11251                         case "$?" in
11252                         3) $cat >&4 <<EOM
11253 ***
11254 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
11255 *** This is (almost) impossible.
11256 *** If your NFS lock daemons are not feeling well, something like
11257 *** this may happen, please investigate.  Cannot continue, aborting.
11258 ***
11259 EOM
11260                                 exit 1
11261                                 ;;
11262                         esac
11263                 fi
11264         else
11265                 echo "I'm unable to compile the test program, so I'll assume not."
11266                 val="$undef"
11267         fi
11268         ;;
11269 *) val="$undef";
11270         echo "Nope, since you don't even have fcntl()."
11271         ;;
11272 esac
11273 set d_fcntl_can_lock
11274 eval $setvar
11275 $rm -f try*
11276
11277
11278 : check for fd_set items
11279 $cat <<EOM
11280
11281 Checking to see how well your C compiler handles fd_set and friends ...
11282 EOM
11283 $cat >try.c <<EOCP
11284 #$i_systime I_SYS_TIME
11285 #$i_sysselct I_SYS_SELECT
11286 #$d_socket HAS_SOCKET
11287 #include <sys/types.h>
11288 #ifdef HAS_SOCKET
11289 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
11290 #endif
11291 #ifdef I_SYS_TIME
11292 #include <sys/time.h>
11293 #endif
11294 #ifdef I_SYS_SELECT
11295 #include <sys/select.h>
11296 #endif
11297 int main() {
11298         fd_set fds;
11299
11300 #ifdef TRYBITS
11301         if(fds.fds_bits);
11302 #endif
11303
11304 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
11305         exit(0);
11306 #else
11307         exit(1);
11308 #endif
11309 }
11310 EOCP
11311 set try -DTRYBITS
11312 if eval $compile; then
11313         d_fds_bits="$define"
11314         d_fd_set="$define"
11315         echo "Well, your system knows about the normal fd_set typedef..." >&4
11316         if $run ./try; then
11317                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
11318                 d_fd_macros="$define"
11319         else
11320                 $cat >&4 <<'EOM'
11321 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
11322 EOM
11323                 d_fd_macros="$undef"
11324         fi
11325 else
11326         $cat <<'EOM'
11327 Hmm, your compiler has some difficulty with fd_set.  Checking further...
11328 EOM
11329         set try
11330         if eval $compile; then
11331                 d_fds_bits="$undef"
11332                 d_fd_set="$define"
11333                 echo "Well, your system has some sort of fd_set available..." >&4
11334                 if $run ./try; then
11335                         echo "and you have the normal fd_set macros." >&4
11336                         d_fd_macros="$define"
11337                 else
11338                         $cat <<'EOM'
11339 but not the normal fd_set macros!  Gross!  More work for me...
11340 EOM
11341                         d_fd_macros="$undef"
11342                 fi
11343         else
11344         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
11345                 d_fd_set="$undef"
11346                 d_fds_bits="$undef"
11347                 d_fd_macros="$undef"
11348         fi
11349 fi
11350 $rm -f try try.*
11351
11352 : see if fgetpos exists
11353 set fgetpos d_fgetpos
11354 eval $inlibc
11355
11356 : see if finite exists
11357 set finite d_finite
11358 eval $inlibc
11359
11360 : see if finitel exists
11361 set finitel d_finitel
11362 eval $inlibc
11363
11364 : see if flock exists
11365 set flock d_flock
11366 eval $inlibc
11367
11368 : see if prototype for flock is available
11369 echo " "
11370 set d_flockproto flock $i_sysfile sys/file.h
11371 eval $hasproto
11372
11373 : see if fork exists
11374 set fork d_fork
11375 eval $inlibc
11376
11377 : see if fp_class exists
11378 set fp_class d_fp_class
11379 eval $inlibc
11380
11381 : see if pathconf exists
11382 set pathconf d_pathconf
11383 eval $inlibc
11384
11385 : see if fpathconf exists
11386 set fpathconf d_fpathconf
11387 eval $inlibc
11388
11389 : see if fpclass exists
11390 set fpclass d_fpclass
11391 eval $inlibc
11392
11393 : see if fpclassify exists
11394 set fpclassify d_fpclassify
11395 eval $inlibc
11396
11397 : see if fpclassl exists
11398 set fpclassl d_fpclassl
11399 eval $inlibc
11400
11401
11402 : check for fpos64_t
11403 echo " "
11404 echo "Checking to see if you have fpos64_t..." >&4
11405 $cat >try.c <<EOCP
11406 #include <stdio.h>
11407 int main() { fpos64_t x = 7; }
11408 EOCP
11409 set try
11410 if eval $compile; then
11411         val="$define"
11412         echo "You have fpos64_t."
11413 else
11414         val="$undef"
11415         echo "You do not have fpos64_t."
11416         case "$fpossize" in
11417         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
11418         esac
11419 fi
11420 $rm -f try.* try
11421 set d_fpos64_t
11422 eval $setvar
11423
11424 : see if frexpl exists
11425 set frexpl d_frexpl
11426 eval $inlibc
11427
11428 : see if this is a sys/param system
11429 set sys/param.h i_sysparam
11430 eval $inhdr
11431
11432 : see if this is a sys/mount.h system
11433 set sys/mount.h i_sysmount
11434 eval $inhdr
11435
11436
11437 echo " "
11438 echo "Checking to see if your system supports struct fs_data..." >&4
11439 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
11440 eval $hasstruct
11441 case "$d_fs_data_s" in
11442 "$define")      echo "Yes, it does."   ;;
11443 *)              echo "No, it doesn't." ;;
11444 esac
11445
11446 : see if fseeko exists
11447 set fseeko d_fseeko
11448 eval $inlibc
11449 case "$longsize" in
11450 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
11451 esac
11452
11453 : see if fsetpos exists
11454 set fsetpos d_fsetpos
11455 eval $inlibc
11456
11457
11458 : see if fstatfs exists
11459 set fstatfs d_fstatfs
11460 eval $inlibc
11461
11462
11463 : see if statvfs exists
11464 set statvfs d_statvfs
11465 eval $inlibc
11466
11467 : see if fstatvfs exists
11468 set fstatvfs d_fstatvfs
11469 eval $inlibc
11470
11471
11472 : see if fsync exists
11473 set fsync d_fsync
11474 eval $inlibc
11475
11476 : see if ftello exists
11477 set ftello d_ftello
11478 eval $inlibc
11479 case "$longsize" in
11480 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
11481 esac
11482
11483 : see if getcwd exists
11484 set getcwd d_getcwd
11485 eval $inlibc
11486
11487 : see if getespwnam exists
11488 set getespwnam d_getespwnam
11489 eval $inlibc
11490
11491
11492 : see if getfsstat exists
11493 set getfsstat d_getfsstat
11494 eval $inlibc
11495
11496 : see if getgrent exists
11497 set getgrent d_getgrent
11498 eval $inlibc
11499
11500 : see if getgrent_r exists
11501 set getgrent_r d_getgrent_r
11502 eval $inlibc
11503 case "$d_getgrent_r" in
11504 "$define")
11505         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11506         case "$d_getgrent_r_proto:$usethreads" in
11507         ":define")      d_getgrent_r_proto=define
11508                 set d_getgrent_r_proto getgrent_r $hdrs
11509                 eval $hasproto ;;
11510         *)      ;;
11511         esac
11512         case "$d_getgrent_r_proto" in
11513         define)
11514         case "$getgrent_r_proto" in
11515         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
11516         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
11517         esac
11518         case "$getgrent_r_proto" in
11519         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
11520         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
11521         esac
11522         case "$getgrent_r_proto" in
11523         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
11524         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
11525         esac
11526         case "$getgrent_r_proto" in
11527         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
11528         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
11529         esac
11530         case "$getgrent_r_proto" in
11531         ''|0) try='int getgrent_r(struct group*, char*, int);'
11532         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
11533         esac
11534         case "$getgrent_r_proto" in
11535         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
11536         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
11537         esac
11538         case "$getgrent_r_proto" in
11539         ''|0)   d_getgrent_r=undef
11540                 getgrent_r_proto=0
11541                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
11542         * )     case "$getgrent_r_proto" in
11543                 REENTRANT_PROTO*) ;;
11544                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
11545                 esac
11546                 echo "Prototype: $try" ;;
11547         esac
11548         ;;
11549         *)      case "$usethreads" in
11550                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
11551                 esac
11552                 d_getgrent_r=undef
11553                 getgrent_r_proto=0
11554                 ;;
11555         esac
11556         ;;
11557 *)      getgrent_r_proto=0
11558         ;;
11559 esac
11560
11561 : see if getgrgid_r exists
11562 set getgrgid_r d_getgrgid_r
11563 eval $inlibc
11564 case "$d_getgrgid_r" in
11565 "$define")
11566         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11567         case "$d_getgrgid_r_proto:$usethreads" in
11568         ":define")      d_getgrgid_r_proto=define
11569                 set d_getgrgid_r_proto getgrgid_r $hdrs
11570                 eval $hasproto ;;
11571         *)      ;;
11572         esac
11573         case "$d_getgrgid_r_proto" in
11574         define)
11575         case "$getgrgid_r_proto" in
11576         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
11577         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
11578         esac
11579         case "$getgrgid_r_proto" in
11580         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
11581         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
11582         esac
11583         case "$getgrgid_r_proto" in
11584         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
11585         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
11586         esac
11587         case "$getgrgid_r_proto" in
11588         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
11589         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
11590         esac
11591         case "$getgrgid_r_proto" in
11592         ''|0)   d_getgrgid_r=undef
11593                 getgrgid_r_proto=0
11594                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
11595         * )     case "$getgrgid_r_proto" in
11596                 REENTRANT_PROTO*) ;;
11597                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
11598                 esac
11599                 echo "Prototype: $try" ;;
11600         esac
11601         ;;
11602         *)      case "$usethreads" in
11603                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
11604                 esac
11605                 d_getgrgid_r=undef
11606                 getgrgid_r_proto=0
11607                 ;;
11608         esac
11609         ;;
11610 *)      getgrgid_r_proto=0
11611         ;;
11612 esac
11613
11614 : see if getgrnam_r exists
11615 set getgrnam_r d_getgrnam_r
11616 eval $inlibc
11617 case "$d_getgrnam_r" in
11618 "$define")
11619         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11620         case "$d_getgrnam_r_proto:$usethreads" in
11621         ":define")      d_getgrnam_r_proto=define
11622                 set d_getgrnam_r_proto getgrnam_r $hdrs
11623                 eval $hasproto ;;
11624         *)      ;;
11625         esac
11626         case "$d_getgrnam_r_proto" in
11627         define)
11628         case "$getgrnam_r_proto" in
11629         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
11630         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
11631         esac
11632         case "$getgrnam_r_proto" in
11633         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
11634         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
11635         esac
11636         case "$getgrnam_r_proto" in
11637         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
11638         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
11639         esac
11640         case "$getgrnam_r_proto" in
11641         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
11642         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
11643         esac
11644         case "$getgrnam_r_proto" in
11645         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
11646         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
11647         esac
11648         case "$getgrnam_r_proto" in
11649         ''|0)   d_getgrnam_r=undef
11650                 getgrnam_r_proto=0
11651                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
11652         * )     case "$getgrnam_r_proto" in
11653                 REENTRANT_PROTO*) ;;
11654                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
11655                 esac
11656                 echo "Prototype: $try" ;;
11657         esac
11658         ;;
11659         *)      case "$usethreads" in
11660                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
11661                 esac
11662                 d_getgrnam_r=undef
11663                 getgrnam_r_proto=0
11664                 ;;
11665         esac
11666         ;;
11667 *)      getgrnam_r_proto=0
11668         ;;
11669 esac
11670
11671 : see if gethostbyaddr exists
11672 set gethostbyaddr d_gethbyaddr
11673 eval $inlibc
11674
11675 : see if gethostbyname exists
11676 set gethostbyname d_gethbyname
11677 eval $inlibc
11678
11679 : see if gethostent exists
11680 set gethostent d_gethent
11681 eval $inlibc
11682
11683 : see how we will look up host name
11684 echo " "
11685 call=''
11686 if set gethostname val -f d_gethname; eval $csym; $val; then
11687         echo 'gethostname() found.' >&4
11688         d_gethname="$define"
11689         call=gethostname
11690 fi
11691 if set uname val -f d_uname; eval $csym; $val; then
11692         if ./xenix; then
11693                 $cat <<'EOM'
11694 uname() was found, but you're running xenix, and older versions of xenix
11695 have a broken uname(). If you don't really know whether your xenix is old
11696 enough to have a broken system call, use the default answer.
11697
11698 EOM
11699                 dflt=y
11700                 case "$d_uname" in
11701                 "$define") dflt=n;;
11702                 esac
11703                 rp='Is your uname() broken?'
11704                 . ./myread
11705                 case "$ans" in
11706                 n*) d_uname="$define"; call=uname;;
11707                 esac
11708         else
11709                 echo 'uname() found.' >&4
11710                 d_uname="$define"
11711                 case "$call" in
11712                 '') call=uname ;;
11713                 esac
11714         fi
11715 fi
11716 case "$d_gethname" in
11717 '') d_gethname="$undef";;
11718 esac
11719 case "$d_uname" in
11720 '') d_uname="$undef";;
11721 esac
11722 case "$d_uname$d_gethname" in
11723 *define*)
11724         dflt=n
11725         cat <<EOM
11726  
11727 Every now and then someone has a $call() that lies about the hostname
11728 but can't be fixed for political or economic reasons.  If you wish, I can
11729 pretend $call() isn't there and maybe compute hostname at run-time
11730 thanks to the '$phostname' command.
11731
11732 EOM
11733         rp="Shall I ignore $call() from now on?"
11734         . ./myread
11735         case "$ans" in
11736         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
11737         esac;;
11738 esac
11739 case "$phostname" in
11740 '') aphostname='';;
11741 *) case "$aphostname" in
11742         /*) ;;
11743         *) set X $phostname
11744                 shift
11745                 file=$1
11746                 shift
11747                 file=`./loc $file $file $pth`
11748                 aphostname=`echo $file $*`
11749                 ;;
11750         esac
11751         ;;
11752 esac
11753 case "$d_uname$d_gethname" in
11754 *define*) ;;
11755 *)
11756         case "$phostname" in
11757         '')
11758                 echo "There will be no way for $package to get your hostname." >&4;;
11759         *)
11760         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
11761                 ;;
11762         esac;;
11763 esac
11764 case "$d_phostname" in
11765 '') d_phostname="$undef";;
11766 esac
11767
11768 : see if gethostbyaddr_r exists
11769 set gethostbyaddr_r d_gethostbyaddr_r
11770 eval $inlibc
11771 case "$d_gethostbyaddr_r" in
11772 "$define")
11773         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11774         case "$d_gethostbyaddr_r_proto:$usethreads" in
11775         ":define")      d_gethostbyaddr_r_proto=define
11776                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
11777                 eval $hasproto ;;
11778         *)      ;;
11779         esac
11780         case "$d_gethostbyaddr_r_proto" in
11781         define)
11782         case "$gethostbyaddr_r_proto" in
11783         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
11784         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
11785         esac
11786         case "$gethostbyaddr_r_proto" in
11787         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
11788         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
11789         esac
11790         case "$gethostbyaddr_r_proto" in
11791         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
11792         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
11793         esac
11794         case "$gethostbyaddr_r_proto" in
11795         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
11796         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
11797         esac
11798         case "$gethostbyaddr_r_proto" in
11799         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
11800         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
11801         esac
11802         case "$gethostbyaddr_r_proto" in
11803         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
11804         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
11805         esac
11806         case "$gethostbyaddr_r_proto" in
11807         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
11808         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
11809         esac
11810         case "$gethostbyaddr_r_proto" in
11811         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
11812         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
11813         esac
11814         case "$gethostbyaddr_r_proto" in
11815         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
11816         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
11817         esac
11818         case "$gethostbyaddr_r_proto" in
11819         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
11820         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
11821         esac
11822         case "$gethostbyaddr_r_proto" in
11823         ''|0)   d_gethostbyaddr_r=undef
11824                 gethostbyaddr_r_proto=0
11825                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
11826         * )     case "$gethostbyaddr_r_proto" in
11827                 REENTRANT_PROTO*) ;;
11828                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
11829                 esac
11830                 echo "Prototype: $try" ;;
11831         esac
11832         ;;
11833         *)      case "$usethreads" in
11834                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
11835                 esac
11836                 d_gethostbyaddr_r=undef
11837                 gethostbyaddr_r_proto=0
11838                 ;;
11839         esac
11840         ;;
11841 *)      gethostbyaddr_r_proto=0
11842         ;;
11843 esac
11844
11845 : see if gethostbyname_r exists
11846 set gethostbyname_r d_gethostbyname_r
11847 eval $inlibc
11848 case "$d_gethostbyname_r" in
11849 "$define")
11850         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11851         case "$d_gethostbyname_r_proto:$usethreads" in
11852         ":define")      d_gethostbyname_r_proto=define
11853                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
11854                 eval $hasproto ;;
11855         *)      ;;
11856         esac
11857         case "$d_gethostbyname_r_proto" in
11858         define)
11859         case "$gethostbyname_r_proto" in
11860         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
11861         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
11862         esac
11863         case "$gethostbyname_r_proto" in
11864         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
11865         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
11866         esac
11867         case "$gethostbyname_r_proto" in
11868         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
11869         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
11870         esac
11871         case "$gethostbyname_r_proto" in
11872         ''|0)   d_gethostbyname_r=undef
11873                 gethostbyname_r_proto=0
11874                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
11875         * )     case "$gethostbyname_r_proto" in
11876                 REENTRANT_PROTO*) ;;
11877                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
11878                 esac
11879                 echo "Prototype: $try" ;;
11880         esac
11881         ;;
11882         *)      case "$usethreads" in
11883                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
11884                 esac
11885                 d_gethostbyname_r=undef
11886                 gethostbyname_r_proto=0
11887                 ;;
11888         esac
11889         ;;
11890 *)      gethostbyname_r_proto=0
11891         ;;
11892 esac
11893
11894 : see if gethostent_r exists
11895 set gethostent_r d_gethostent_r
11896 eval $inlibc
11897 case "$d_gethostent_r" in
11898 "$define")
11899         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11900         case "$d_gethostent_r_proto:$usethreads" in
11901         ":define")      d_gethostent_r_proto=define
11902                 set d_gethostent_r_proto gethostent_r $hdrs
11903                 eval $hasproto ;;
11904         *)      ;;
11905         esac
11906         case "$d_gethostent_r_proto" in
11907         define)
11908         case "$gethostent_r_proto" in
11909         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
11910         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
11911         esac
11912         case "$gethostent_r_proto" in
11913         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
11914         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
11915         esac
11916         case "$gethostent_r_proto" in
11917         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
11918         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
11919         esac
11920         case "$gethostent_r_proto" in
11921         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
11922         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
11923         esac
11924         case "$gethostent_r_proto" in
11925         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
11926         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
11927         esac
11928         case "$gethostent_r_proto" in
11929         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
11930         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
11931         esac
11932         case "$gethostent_r_proto" in
11933         ''|0)   d_gethostent_r=undef
11934                 gethostent_r_proto=0
11935                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
11936         * )     case "$gethostent_r_proto" in
11937                 REENTRANT_PROTO*) ;;
11938                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
11939                 esac
11940                 echo "Prototype: $try" ;;
11941         esac
11942         ;;
11943         *)      case "$usethreads" in
11944                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
11945                 esac
11946                 d_gethostent_r=undef
11947                 gethostent_r_proto=0
11948                 ;;
11949         esac
11950         ;;
11951 *)      gethostent_r_proto=0
11952         ;;
11953 esac
11954
11955 : see if prototypes for various gethostxxx netdb.h functions are available
11956 echo " "
11957 set d_gethostprotos gethostent $i_netdb netdb.h
11958 eval $hasproto
11959
11960 : see if getitimer exists
11961 set getitimer d_getitimer
11962 eval $inlibc
11963
11964 : see if getlogin exists
11965 set getlogin d_getlogin
11966 eval $inlibc
11967
11968 : see if getlogin_r exists
11969 set getlogin_r d_getlogin_r
11970 eval $inlibc
11971 case "$d_getlogin_r" in
11972 "$define")
11973         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
11974         case "$d_getlogin_r_proto:$usethreads" in
11975         ":define")      d_getlogin_r_proto=define
11976                 set d_getlogin_r_proto getlogin_r $hdrs
11977                 eval $hasproto ;;
11978         *)      ;;
11979         esac
11980         case "$d_getlogin_r_proto" in
11981         define)
11982         case "$getlogin_r_proto" in
11983         ''|0) try='int getlogin_r(char*, size_t);'
11984         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
11985         esac
11986         case "$getlogin_r_proto" in
11987         ''|0) try='int getlogin_r(char*, int);'
11988         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
11989         esac
11990         case "$getlogin_r_proto" in
11991         ''|0) try='char* getlogin_r(char*, size_t);'
11992         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
11993         esac
11994         case "$getlogin_r_proto" in
11995         ''|0) try='char* getlogin_r(char*, int);'
11996         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
11997         esac
11998         case "$getlogin_r_proto" in
11999         ''|0)   d_getlogin_r=undef
12000                 getlogin_r_proto=0
12001                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
12002         * )     case "$getlogin_r_proto" in
12003                 REENTRANT_PROTO*) ;;
12004                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
12005                 esac
12006                 echo "Prototype: $try" ;;
12007         esac
12008         ;;
12009         *)      case "$usethreads" in
12010                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
12011                 esac
12012                 d_getlogin_r=undef
12013                 getlogin_r_proto=0
12014                 ;;
12015         esac
12016         ;;
12017 *)      getlogin_r_proto=0
12018         ;;
12019 esac
12020
12021 : see if getmnt exists
12022 set getmnt d_getmnt
12023 eval $inlibc
12024
12025 : see if getmntent exists
12026 set getmntent d_getmntent
12027 eval $inlibc
12028
12029 : see if getnetbyaddr exists
12030 set getnetbyaddr d_getnbyaddr
12031 eval $inlibc
12032
12033 : see if getnetbyname exists
12034 set getnetbyname d_getnbyname
12035 eval $inlibc
12036
12037 : see if getnetent exists
12038 set getnetent d_getnent
12039 eval $inlibc
12040
12041 : see if getnetbyaddr_r exists
12042 set getnetbyaddr_r d_getnetbyaddr_r
12043 eval $inlibc
12044 case "$d_getnetbyaddr_r" in
12045 "$define")
12046         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12047         case "$d_getnetbyaddr_r_proto:$usethreads" in
12048         ":define")      d_getnetbyaddr_r_proto=define
12049                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
12050                 eval $hasproto ;;
12051         *)      ;;
12052         esac
12053         case "$d_getnetbyaddr_r_proto" in
12054         define)
12055         case "$getnetbyaddr_r_proto" in
12056         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
12057         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
12058         esac
12059         case "$getnetbyaddr_r_proto" in
12060         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
12061         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
12062         esac
12063         case "$getnetbyaddr_r_proto" in
12064         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
12065         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
12066         esac
12067         case "$getnetbyaddr_r_proto" in
12068         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
12069         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
12070         esac
12071         case "$getnetbyaddr_r_proto" in
12072         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
12073         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
12074         esac
12075         case "$getnetbyaddr_r_proto" in
12076         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
12077         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
12078         esac
12079         case "$getnetbyaddr_r_proto" in
12080         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
12081         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
12082         esac
12083         case "$getnetbyaddr_r_proto" in
12084         ''|0)   d_getnetbyaddr_r=undef
12085                 getnetbyaddr_r_proto=0
12086                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
12087         * )     case "$getnetbyaddr_r_proto" in
12088                 REENTRANT_PROTO*) ;;
12089                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
12090                 esac
12091                 echo "Prototype: $try" ;;
12092         esac
12093         ;;
12094         *)      case "$usethreads" in
12095                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
12096                 esac
12097                 d_getnetbyaddr_r=undef
12098                 getnetbyaddr_r_proto=0
12099                 ;;
12100         esac
12101         ;;
12102 *)      getnetbyaddr_r_proto=0
12103         ;;
12104 esac
12105
12106 : see if getnetbyname_r exists
12107 set getnetbyname_r d_getnetbyname_r
12108 eval $inlibc
12109 case "$d_getnetbyname_r" in
12110 "$define")
12111         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12112         case "$d_getnetbyname_r_proto:$usethreads" in
12113         ":define")      d_getnetbyname_r_proto=define
12114                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
12115                 eval $hasproto ;;
12116         *)      ;;
12117         esac
12118         case "$d_getnetbyname_r_proto" in
12119         define)
12120         case "$getnetbyname_r_proto" in
12121         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
12122         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
12123         esac
12124         case "$getnetbyname_r_proto" in
12125         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
12126         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
12127         esac
12128         case "$getnetbyname_r_proto" in
12129         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
12130         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
12131         esac
12132         case "$getnetbyname_r_proto" in
12133         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
12134         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
12135         esac
12136         case "$getnetbyname_r_proto" in
12137         ''|0)   d_getnetbyname_r=undef
12138                 getnetbyname_r_proto=0
12139                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
12140         * )     case "$getnetbyname_r_proto" in
12141                 REENTRANT_PROTO*) ;;
12142                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
12143                 esac
12144                 echo "Prototype: $try" ;;
12145         esac
12146         ;;
12147         *)      case "$usethreads" in
12148                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
12149                 esac
12150                 d_getnetbyname_r=undef
12151                 getnetbyname_r_proto=0
12152                 ;;
12153         esac
12154         ;;
12155 *)      getnetbyname_r_proto=0
12156         ;;
12157 esac
12158
12159 : see if getnetent_r exists
12160 set getnetent_r d_getnetent_r
12161 eval $inlibc
12162 case "$d_getnetent_r" in
12163 "$define")
12164         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12165         case "$d_getnetent_r_proto:$usethreads" in
12166         ":define")      d_getnetent_r_proto=define
12167                 set d_getnetent_r_proto getnetent_r $hdrs
12168                 eval $hasproto ;;
12169         *)      ;;
12170         esac
12171         case "$d_getnetent_r_proto" in
12172         define)
12173         case "$getnetent_r_proto" in
12174         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
12175         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
12176         esac
12177         case "$getnetent_r_proto" in
12178         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
12179         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
12180         esac
12181         case "$getnetent_r_proto" in
12182         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
12183         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
12184         esac
12185         case "$getnetent_r_proto" in
12186         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
12187         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
12188         esac
12189         case "$getnetent_r_proto" in
12190         ''|0) try='int getnetent_r(struct netent*, char*, int);'
12191         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
12192         esac
12193         case "$getnetent_r_proto" in
12194         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
12195         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
12196         esac
12197         case "$getnetent_r_proto" in
12198         ''|0)   d_getnetent_r=undef
12199                 getnetent_r_proto=0
12200                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
12201         * )     case "$getnetent_r_proto" in
12202                 REENTRANT_PROTO*) ;;
12203                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
12204                 esac
12205                 echo "Prototype: $try" ;;
12206         esac
12207         ;;
12208         *)      case "$usethreads" in
12209                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
12210                 esac
12211                 d_getnetent_r=undef
12212                 getnetent_r_proto=0
12213                 ;;
12214         esac
12215         ;;
12216 *)      getnetent_r_proto=0
12217         ;;
12218 esac
12219
12220 : see if prototypes for various getnetxxx netdb.h functions are available
12221 echo " "
12222 set d_getnetprotos getnetent $i_netdb netdb.h
12223 eval $hasproto
12224
12225 : see if getpagesize exists
12226 set getpagesize d_getpagsz
12227 eval $inlibc
12228
12229
12230 : see if getprotobyname exists
12231 set getprotobyname d_getpbyname
12232 eval $inlibc
12233
12234 : see if getprotobynumber exists
12235 set getprotobynumber d_getpbynumber
12236 eval $inlibc
12237
12238 : see if getprotoent exists
12239 set getprotoent d_getpent
12240 eval $inlibc
12241
12242 : see if getpgid exists
12243 set getpgid d_getpgid
12244 eval $inlibc
12245
12246 : see if getpgrp2 exists
12247 set getpgrp2 d_getpgrp2
12248 eval $inlibc
12249
12250 : see if getppid exists
12251 set getppid d_getppid
12252 eval $inlibc
12253
12254 : see if getpriority exists
12255 set getpriority d_getprior
12256 eval $inlibc
12257
12258 : see if getprotobyname_r exists
12259 set getprotobyname_r d_getprotobyname_r
12260 eval $inlibc
12261 case "$d_getprotobyname_r" in
12262 "$define")
12263         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12264         case "$d_getprotobyname_r_proto:$usethreads" in
12265         ":define")      d_getprotobyname_r_proto=define
12266                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
12267                 eval $hasproto ;;
12268         *)      ;;
12269         esac
12270         case "$d_getprotobyname_r_proto" in
12271         define)
12272         case "$getprotobyname_r_proto" in
12273         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
12274         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
12275         esac
12276         case "$getprotobyname_r_proto" in
12277         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
12278         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
12279         esac
12280         case "$getprotobyname_r_proto" in
12281         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
12282         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
12283         esac
12284         case "$getprotobyname_r_proto" in
12285         ''|0)   d_getprotobyname_r=undef
12286                 getprotobyname_r_proto=0
12287                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
12288         * )     case "$getprotobyname_r_proto" in
12289                 REENTRANT_PROTO*) ;;
12290                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
12291                 esac
12292                 echo "Prototype: $try" ;;
12293         esac
12294         ;;
12295         *)      case "$usethreads" in
12296                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
12297                 esac
12298                 d_getprotobyname_r=undef
12299                 getprotobyname_r_proto=0
12300                 ;;
12301         esac
12302         ;;
12303 *)      getprotobyname_r_proto=0
12304         ;;
12305 esac
12306
12307 : see if getprotobynumber_r exists
12308 set getprotobynumber_r d_getprotobynumber_r
12309 eval $inlibc
12310 case "$d_getprotobynumber_r" in
12311 "$define")
12312         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12313         case "$d_getprotobynumber_r_proto:$usethreads" in
12314         ":define")      d_getprotobynumber_r_proto=define
12315                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
12316                 eval $hasproto ;;
12317         *)      ;;
12318         esac
12319         case "$d_getprotobynumber_r_proto" in
12320         define)
12321         case "$getprotobynumber_r_proto" in
12322         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
12323         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
12324         esac
12325         case "$getprotobynumber_r_proto" in
12326         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
12327         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
12328         esac
12329         case "$getprotobynumber_r_proto" in
12330         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
12331         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
12332         esac
12333         case "$getprotobynumber_r_proto" in
12334         ''|0)   d_getprotobynumber_r=undef
12335                 getprotobynumber_r_proto=0
12336                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
12337         * )     case "$getprotobynumber_r_proto" in
12338                 REENTRANT_PROTO*) ;;
12339                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
12340                 esac
12341                 echo "Prototype: $try" ;;
12342         esac
12343         ;;
12344         *)      case "$usethreads" in
12345                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
12346                 esac
12347                 d_getprotobynumber_r=undef
12348                 getprotobynumber_r_proto=0
12349                 ;;
12350         esac
12351         ;;
12352 *)      getprotobynumber_r_proto=0
12353         ;;
12354 esac
12355
12356 : see if getprotoent_r exists
12357 set getprotoent_r d_getprotoent_r
12358 eval $inlibc
12359 case "$d_getprotoent_r" in
12360 "$define")
12361         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12362         case "$d_getprotoent_r_proto:$usethreads" in
12363         ":define")      d_getprotoent_r_proto=define
12364                 set d_getprotoent_r_proto getprotoent_r $hdrs
12365                 eval $hasproto ;;
12366         *)      ;;
12367         esac
12368         case "$d_getprotoent_r_proto" in
12369         define)
12370         case "$getprotoent_r_proto" in
12371         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
12372         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
12373         esac
12374         case "$getprotoent_r_proto" in
12375         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
12376         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
12377         esac
12378         case "$getprotoent_r_proto" in
12379         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
12380         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
12381         esac
12382         case "$getprotoent_r_proto" in
12383         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
12384         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
12385         esac
12386         case "$getprotoent_r_proto" in
12387         ''|0)   d_getprotoent_r=undef
12388                 getprotoent_r_proto=0
12389                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
12390         * )     case "$getprotoent_r_proto" in
12391                 REENTRANT_PROTO*) ;;
12392                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
12393                 esac
12394                 echo "Prototype: $try" ;;
12395         esac
12396         ;;
12397         *)      case "$usethreads" in
12398                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
12399                 esac
12400                 d_getprotoent_r=undef
12401                 getprotoent_r_proto=0
12402                 ;;
12403         esac
12404         ;;
12405 *)      getprotoent_r_proto=0
12406         ;;
12407 esac
12408
12409 : see if prototypes for various getprotoxxx netdb.h functions are available
12410 echo " "
12411 set d_getprotoprotos getprotoent $i_netdb netdb.h
12412 eval $hasproto
12413
12414 : see if getprpwnam exists
12415 set getprpwnam d_getprpwnam
12416 eval $inlibc
12417
12418 : see if getpwent exists
12419 set getpwent d_getpwent
12420 eval $inlibc
12421
12422 : see if getpwent_r exists
12423 set getpwent_r d_getpwent_r
12424 eval $inlibc
12425 case "$d_getpwent_r" in
12426 "$define")
12427         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12428         case "$d_getpwent_r_proto:$usethreads" in
12429         ":define")      d_getpwent_r_proto=define
12430                 set d_getpwent_r_proto getpwent_r $hdrs
12431                 eval $hasproto ;;
12432         *)      ;;
12433         esac
12434         case "$d_getpwent_r_proto" in
12435         define)
12436         case "$getpwent_r_proto" in
12437         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
12438         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
12439         esac
12440         case "$getpwent_r_proto" in
12441         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
12442         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
12443         esac
12444         case "$getpwent_r_proto" in
12445         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
12446         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
12447         esac
12448         case "$getpwent_r_proto" in
12449         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
12450         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
12451         esac
12452         case "$getpwent_r_proto" in
12453         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
12454         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
12455         esac
12456         case "$getpwent_r_proto" in
12457         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
12458         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
12459         esac
12460         case "$getpwent_r_proto" in
12461         ''|0)   d_getpwent_r=undef
12462                 getpwent_r_proto=0
12463                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
12464         * )     case "$getpwent_r_proto" in
12465                 REENTRANT_PROTO*) ;;
12466                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
12467                 esac
12468                 echo "Prototype: $try" ;;
12469         esac
12470         ;;
12471         *)      case "$usethreads" in
12472                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
12473                 esac
12474                 d_getpwent_r=undef
12475                 getpwent_r_proto=0
12476                 ;;
12477         esac
12478         ;;
12479 *)      getpwent_r_proto=0
12480         ;;
12481 esac
12482
12483 : see if getpwnam_r exists
12484 set getpwnam_r d_getpwnam_r
12485 eval $inlibc
12486 case "$d_getpwnam_r" in
12487 "$define")
12488         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12489         case "$d_getpwnam_r_proto:$usethreads" in
12490         ":define")      d_getpwnam_r_proto=define
12491                 set d_getpwnam_r_proto getpwnam_r $hdrs
12492                 eval $hasproto ;;
12493         *)      ;;
12494         esac
12495         case "$d_getpwnam_r_proto" in
12496         define)
12497         case "$getpwnam_r_proto" in
12498         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
12499         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
12500         esac
12501         case "$getpwnam_r_proto" in
12502         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
12503         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
12504         esac
12505         case "$getpwnam_r_proto" in
12506         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
12507         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
12508         esac
12509         case "$getpwnam_r_proto" in
12510         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
12511         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
12512         esac
12513         case "$getpwnam_r_proto" in
12514         ''|0)   d_getpwnam_r=undef
12515                 getpwnam_r_proto=0
12516                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
12517         * )     case "$getpwnam_r_proto" in
12518                 REENTRANT_PROTO*) ;;
12519                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
12520                 esac
12521                 echo "Prototype: $try" ;;
12522         esac
12523         ;;
12524         *)      case "$usethreads" in
12525                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
12526                 esac
12527                 d_getpwnam_r=undef
12528                 getpwnam_r_proto=0
12529                 ;;
12530         esac
12531         ;;
12532 *)      getpwnam_r_proto=0
12533         ;;
12534 esac
12535
12536 : see if getpwuid_r exists
12537 set getpwuid_r d_getpwuid_r
12538 eval $inlibc
12539 case "$d_getpwuid_r" in
12540 "$define")
12541         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12542         case "$d_getpwuid_r_proto:$usethreads" in
12543         ":define")      d_getpwuid_r_proto=define
12544                 set d_getpwuid_r_proto getpwuid_r $hdrs
12545                 eval $hasproto ;;
12546         *)      ;;
12547         esac
12548         case "$d_getpwuid_r_proto" in
12549         define)
12550         case "$getpwuid_r_proto" in
12551         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
12552         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
12553         esac
12554         case "$getpwuid_r_proto" in
12555         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
12556         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
12557         esac
12558         case "$getpwuid_r_proto" in
12559         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
12560         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
12561         esac
12562         case "$getpwuid_r_proto" in
12563         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
12564         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
12565         esac
12566         case "$getpwuid_r_proto" in
12567         ''|0)   d_getpwuid_r=undef
12568                 getpwuid_r_proto=0
12569                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
12570         * )     case "$getpwuid_r_proto" in
12571                 REENTRANT_PROTO*) ;;
12572                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
12573                 esac
12574                 echo "Prototype: $try" ;;
12575         esac
12576         ;;
12577         *)      case "$usethreads" in
12578                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
12579                 esac
12580                 d_getpwuid_r=undef
12581                 getpwuid_r_proto=0
12582                 ;;
12583         esac
12584         ;;
12585 *)      getpwuid_r_proto=0
12586         ;;
12587 esac
12588
12589
12590 : see if getservbyname exists
12591 set getservbyname d_getsbyname
12592 eval $inlibc
12593
12594 : see if getservbyport exists
12595 set getservbyport d_getsbyport
12596 eval $inlibc
12597
12598 : see if getservent exists
12599 set getservent d_getsent
12600 eval $inlibc
12601
12602 : see if getservbyname_r exists
12603 set getservbyname_r d_getservbyname_r
12604 eval $inlibc
12605 case "$d_getservbyname_r" in
12606 "$define")
12607         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12608         case "$d_getservbyname_r_proto:$usethreads" in
12609         ":define")      d_getservbyname_r_proto=define
12610                 set d_getservbyname_r_proto getservbyname_r $hdrs
12611                 eval $hasproto ;;
12612         *)      ;;
12613         esac
12614         case "$d_getservbyname_r_proto" in
12615         define)
12616         case "$getservbyname_r_proto" in
12617         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
12618         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
12619         esac
12620         case "$getservbyname_r_proto" in
12621         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
12622         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
12623         esac
12624         case "$getservbyname_r_proto" in
12625         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
12626         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
12627         esac
12628         case "$getservbyname_r_proto" in
12629         ''|0)   d_getservbyname_r=undef
12630                 getservbyname_r_proto=0
12631                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
12632         * )     case "$getservbyname_r_proto" in
12633                 REENTRANT_PROTO*) ;;
12634                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
12635                 esac
12636                 echo "Prototype: $try" ;;
12637         esac
12638         ;;
12639         *)      case "$usethreads" in
12640                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
12641                 esac
12642                 d_getservbyname_r=undef
12643                 getservbyname_r_proto=0
12644                 ;;
12645         esac
12646         ;;
12647 *)      getservbyname_r_proto=0
12648         ;;
12649 esac
12650
12651 : see if getservbyport_r exists
12652 set getservbyport_r d_getservbyport_r
12653 eval $inlibc
12654 case "$d_getservbyport_r" in
12655 "$define")
12656         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12657         case "$d_getservbyport_r_proto:$usethreads" in
12658         ":define")      d_getservbyport_r_proto=define
12659                 set d_getservbyport_r_proto getservbyport_r $hdrs
12660                 eval $hasproto ;;
12661         *)      ;;
12662         esac
12663         case "$d_getservbyport_r_proto" in
12664         define)
12665         case "$getservbyport_r_proto" in
12666         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
12667         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
12668         esac
12669         case "$getservbyport_r_proto" in
12670         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
12671         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
12672         esac
12673         case "$getservbyport_r_proto" in
12674         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
12675         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
12676         esac
12677         case "$getservbyport_r_proto" in
12678         ''|0)   d_getservbyport_r=undef
12679                 getservbyport_r_proto=0
12680                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
12681         * )     case "$getservbyport_r_proto" in
12682                 REENTRANT_PROTO*) ;;
12683                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
12684                 esac
12685                 echo "Prototype: $try" ;;
12686         esac
12687         ;;
12688         *)      case "$usethreads" in
12689                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
12690                 esac
12691                 d_getservbyport_r=undef
12692                 getservbyport_r_proto=0
12693                 ;;
12694         esac
12695         ;;
12696 *)      getservbyport_r_proto=0
12697         ;;
12698 esac
12699
12700 : see if getservent_r exists
12701 set getservent_r d_getservent_r
12702 eval $inlibc
12703 case "$d_getservent_r" in
12704 "$define")
12705         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12706         case "$d_getservent_r_proto:$usethreads" in
12707         ":define")      d_getservent_r_proto=define
12708                 set d_getservent_r_proto getservent_r $hdrs
12709                 eval $hasproto ;;
12710         *)      ;;
12711         esac
12712         case "$d_getservent_r_proto" in
12713         define)
12714         case "$getservent_r_proto" in
12715         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
12716         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
12717         esac
12718         case "$getservent_r_proto" in
12719         ''|0) try='int getservent_r(struct servent*, char*, int);'
12720         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
12721         esac
12722         case "$getservent_r_proto" in
12723         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
12724         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
12725         esac
12726         case "$getservent_r_proto" in
12727         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
12728         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
12729         esac
12730         case "$getservent_r_proto" in
12731         ''|0)   d_getservent_r=undef
12732                 getservent_r_proto=0
12733                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
12734         * )     case "$getservent_r_proto" in
12735                 REENTRANT_PROTO*) ;;
12736                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
12737                 esac
12738                 echo "Prototype: $try" ;;
12739         esac
12740         ;;
12741         *)      case "$usethreads" in
12742                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
12743                 esac
12744                 d_getservent_r=undef
12745                 getservent_r_proto=0
12746                 ;;
12747         esac
12748         ;;
12749 *)      getservent_r_proto=0
12750         ;;
12751 esac
12752
12753 : see if prototypes for various getservxxx netdb.h functions are available
12754 echo " "
12755 set d_getservprotos getservent $i_netdb netdb.h
12756 eval $hasproto
12757
12758 : see if getspnam exists
12759 set getspnam d_getspnam
12760 eval $inlibc
12761
12762 : see if this is a shadow.h system
12763 set shadow.h i_shadow
12764 eval $inhdr
12765
12766 : see if getspnam_r exists
12767 set getspnam_r d_getspnam_r
12768 eval $inlibc
12769 case "$d_getspnam_r" in
12770 "$define")
12771         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
12772         case "$d_getspnam_r_proto:$usethreads" in
12773         ":define")      d_getspnam_r_proto=define
12774                 set d_getspnam_r_proto getspnam_r $hdrs
12775                 eval $hasproto ;;
12776         *)      ;;
12777         esac
12778         case "$d_getspnam_r_proto" in
12779         define)
12780         case "$getspnam_r_proto" in
12781         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
12782         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
12783         esac
12784         case "$getspnam_r_proto" in
12785         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
12786         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
12787         esac
12788         case "$getspnam_r_proto" in
12789         ''|0)   d_getspnam_r=undef
12790                 getspnam_r_proto=0
12791                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
12792         * )     case "$getspnam_r_proto" in
12793                 REENTRANT_PROTO*) ;;
12794                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
12795                 esac
12796                 echo "Prototype: $try" ;;
12797         esac
12798         ;;
12799         *)      case "$usethreads" in
12800                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
12801                 esac
12802                 d_getspnam_r=undef
12803                 getspnam_r_proto=0
12804                 ;;
12805         esac
12806         ;;
12807 *)      getspnam_r_proto=0
12808         ;;
12809 esac
12810
12811 : see if gettimeofday or ftime exists
12812 set gettimeofday d_gettimeod
12813 eval $inlibc
12814 case "$d_gettimeod" in
12815 "$undef")
12816         set ftime d_ftime 
12817         eval $inlibc
12818         ;;
12819 *)
12820         val="$undef"; set d_ftime; eval $setvar
12821         ;;
12822 esac
12823 case "$d_gettimeod$d_ftime" in
12824 "$undef$undef")
12825         echo " "
12826         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
12827         ;;
12828 esac
12829
12830 : see if gmtime_r exists
12831 set gmtime_r d_gmtime_r
12832 eval $inlibc
12833 case "$d_gmtime_r" in
12834 "$define")
12835         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12836         case "$d_gmtime_r_proto:$usethreads" in
12837         ":define")      d_gmtime_r_proto=define
12838                 set d_gmtime_r_proto gmtime_r $hdrs
12839                 eval $hasproto ;;
12840         *)      ;;
12841         esac
12842         case "$d_gmtime_r_proto" in
12843         define)
12844         case "$gmtime_r_proto" in
12845         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
12846         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
12847         esac
12848         case "$gmtime_r_proto" in
12849         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
12850         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
12851         esac
12852         case "$gmtime_r_proto" in
12853         ''|0)   d_gmtime_r=undef
12854                 gmtime_r_proto=0
12855                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
12856         * )     case "$gmtime_r_proto" in
12857                 REENTRANT_PROTO*) ;;
12858                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
12859                 esac
12860                 echo "Prototype: $try" ;;
12861         esac
12862         ;;
12863         *)      case "$usethreads" in
12864                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
12865                 esac
12866                 d_gmtime_r=undef
12867                 gmtime_r_proto=0
12868                 ;;
12869         esac
12870         ;;
12871 *)      gmtime_r_proto=0
12872         ;;
12873 esac
12874
12875 : see if hasmntopt exists
12876 set hasmntopt d_hasmntopt
12877 eval $inlibc
12878
12879 : see if this is a netinet/in.h or sys/in.h system
12880 set netinet/in.h i_niin sys/in.h i_sysin
12881 eval $inhdr
12882
12883 : see if arpa/inet.h has to be included
12884 set arpa/inet.h i_arpainet
12885 eval $inhdr
12886
12887 : see if htonl --and friends-- exists
12888 val=''
12889 set htonl val
12890 eval $inlibc
12891
12892 : Maybe they are macros.
12893 case "$val" in
12894 $undef)
12895         $cat >htonl.c <<EOM
12896 #include <stdio.h>
12897 #include <sys/types.h>
12898 #$i_niin I_NETINET_IN
12899 #$i_sysin I_SYS_IN
12900 #$i_arpainet I_ARPA_INET
12901 #ifdef I_NETINET_IN
12902 #include <netinet/in.h>
12903 #endif
12904 #ifdef I_SYS_IN
12905 #include <sys/in.h>
12906 #endif
12907 #ifdef I_ARPA_INET
12908 #include <arpa/inet.h>
12909 #endif
12910 #ifdef htonl
12911 printf("Defined as a macro.");
12912 #endif
12913 EOM
12914         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
12915         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
12916                 val="$define"
12917                 echo "But it seems to be defined as a macro." >&4
12918         fi
12919         $rm -f htonl.?
12920         ;;
12921 esac
12922 set d_htonl
12923 eval $setvar
12924
12925 : index or strchr
12926 echo " "
12927 if set index val -f; eval $csym; $val; then
12928         if set strchr val -f d_strchr; eval $csym; $val; then
12929                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
12930                         val="$define"
12931                         vali="$undef"
12932                         echo "strchr() found." >&4
12933                 else
12934                         val="$undef"
12935                         vali="$define"
12936                         echo "index() found." >&4
12937                 fi
12938         else
12939                 val="$undef"
12940                 vali="$define"
12941                 echo "index() found." >&4
12942         fi
12943 else
12944         if set strchr val -f d_strchr; eval $csym; $val; then
12945                 val="$define"
12946                 vali="$undef"
12947                 echo "strchr() found." >&4
12948         else
12949                 echo "No index() or strchr() found!" >&4
12950                 val="$undef"
12951                 vali="$undef"
12952         fi
12953 fi
12954 set d_strchr; eval $setvar
12955 val="$vali"
12956 set d_index; eval $setvar
12957
12958 : check whether inet_aton exists
12959 set inet_aton d_inetaton
12960 eval $inlibc
12961
12962 : Look for isascii
12963 echo " "
12964 $cat >isascii.c <<'EOCP'
12965 #include <stdio.h>
12966 #include <ctype.h>
12967 int main() {
12968         int c = 'A';
12969         if (isascii(c))
12970                 exit(0);
12971         else
12972                 exit(1);
12973 }
12974 EOCP
12975 set isascii
12976 if eval $compile; then
12977         echo "isascii() found." >&4
12978         val="$define"
12979 else
12980         echo "isascii() NOT found." >&4
12981         val="$undef"
12982 fi
12983 set d_isascii
12984 eval $setvar
12985 $rm -f isascii*
12986
12987 : see if isfinite exists
12988 set isfinite d_isfinite
12989 eval $inlibc
12990
12991 : see if isinf exists
12992 set isinf d_isinf
12993 eval $inlibc
12994
12995 : see if isnan exists
12996 set isnan d_isnan
12997 eval $inlibc
12998
12999 : see if isnanl exists
13000 set isnanl d_isnanl
13001 eval $inlibc
13002
13003 : see if killpg exists
13004 set killpg d_killpg
13005 eval $inlibc
13006
13007 : see if lchown exists
13008 echo " "
13009 $cat > try.c <<'EOCP'
13010 /* System header to define __stub macros and hopefully few prototypes,
13011     which can conflict with char lchown(); below.  */
13012 #include <assert.h>
13013 /* Override any gcc2 internal prototype to avoid an error.  */
13014 /* We use char because int might match the return type of a gcc2
13015    builtin and then its argument prototype would still apply.  */
13016 char lchown();
13017 int main() {
13018     /*  The GNU C library defines this for functions which it implements
13019         to always fail with ENOSYS.  Some functions are actually named
13020         something starting with __ and the normal name is an alias.  */
13021 #if defined (__stub_lchown) || defined (__stub___lchown)
13022 choke me
13023 #else
13024 lchown();
13025 #endif
13026 ; return 0; }
13027 EOCP
13028 set try
13029 if eval $compile; then
13030     $echo "lchown() found." >&4
13031     val="$define"
13032 else
13033     $echo "lchown() NOT found." >&4
13034     val="$undef"
13035 fi
13036 set d_lchown
13037 eval $setvar
13038
13039 : See if number of significant digits in a double precision number is known
13040 echo " "
13041 $cat >ldbl_dig.c <<EOM
13042 #$i_limits I_LIMITS
13043 #$i_float I_FLOAT
13044 #ifdef I_LIMITS
13045 #include <limits.h>
13046 #endif
13047 #ifdef I_FLOAT
13048 #include <float.h>
13049 #endif
13050 #ifdef LDBL_DIG
13051 printf("Contains LDBL_DIG");
13052 #endif
13053 EOM
13054 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
13055 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
13056         echo "LDBL_DIG found." >&4
13057         val="$define"
13058 else
13059         echo "LDBL_DIG NOT found." >&4
13060         val="$undef"
13061 fi
13062 $rm -f ldbl_dig.?
13063 set d_ldbl_dig
13064 eval $setvar
13065
13066 : see if link exists
13067 set link d_link
13068 eval $inlibc
13069
13070 : see if localtime_r exists
13071 set localtime_r d_localtime_r
13072 eval $inlibc
13073 case "$d_localtime_r" in
13074 "$define")
13075         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13076         case "$d_localtime_r_proto:$usethreads" in
13077         ":define")      d_localtime_r_proto=define
13078                 set d_localtime_r_proto localtime_r $hdrs
13079                 eval $hasproto ;;
13080         *)      ;;
13081         esac
13082         case "$d_localtime_r_proto" in
13083         define)
13084         case "$localtime_r_proto" in
13085         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
13086         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
13087         esac
13088         case "$localtime_r_proto" in
13089         ''|0) try='int localtime_r(const time_t*, struct tm*);'
13090         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
13091         esac
13092         case "$localtime_r_proto" in
13093         ''|0)   d_localtime_r=undef
13094                 localtime_r_proto=0
13095                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
13096         * )     case "$localtime_r_proto" in
13097                 REENTRANT_PROTO*) ;;
13098                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
13099                 esac
13100                 echo "Prototype: $try" ;;
13101         esac
13102         ;;
13103         *)      case "$usethreads" in
13104                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
13105                 esac
13106                 d_localtime_r=undef
13107                 localtime_r_proto=0
13108                 ;;
13109         esac
13110         ;;
13111 *)      localtime_r_proto=0
13112         ;;
13113 esac
13114
13115 : see if localeconv exists
13116 set localeconv d_locconv
13117 eval $inlibc
13118
13119 : see if lockf exists
13120 set lockf d_lockf
13121 eval $inlibc
13122
13123 : see if prototype for lseek is available
13124 echo " "
13125 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
13126 eval $hasproto
13127
13128 : see if lstat exists
13129 set lstat d_lstat
13130 eval $inlibc
13131
13132 : see if madvise exists
13133 set madvise d_madvise
13134 eval $inlibc
13135
13136 : see if mblen exists
13137 set mblen d_mblen
13138 eval $inlibc
13139
13140 : see if mbstowcs exists
13141 set mbstowcs d_mbstowcs
13142 eval $inlibc
13143
13144 : see if mbtowc exists
13145 set mbtowc d_mbtowc
13146 eval $inlibc
13147
13148 : see if memchr exists
13149 set memchr d_memchr
13150 eval $inlibc
13151
13152 : see if memcmp exists
13153 set memcmp d_memcmp
13154 eval $inlibc
13155
13156 : see if memcpy exists
13157 set memcpy d_memcpy
13158 eval $inlibc
13159
13160 : see if memmove exists
13161 set memmove d_memmove
13162 eval $inlibc
13163
13164 : see if memset exists
13165 set memset d_memset
13166 eval $inlibc
13167
13168 : see if mkdir exists
13169 set mkdir d_mkdir
13170 eval $inlibc
13171
13172 : see if mkdtemp exists
13173 set mkdtemp d_mkdtemp
13174 eval $inlibc
13175
13176 : see if mkfifo exists
13177 set mkfifo d_mkfifo
13178 eval $inlibc
13179
13180 : see if mkstemp exists
13181 set mkstemp d_mkstemp
13182 eval $inlibc
13183
13184 : see if mkstemps exists
13185 set mkstemps d_mkstemps
13186 eval $inlibc
13187
13188 : see if mktime exists
13189 set mktime d_mktime
13190 eval $inlibc
13191
13192 : see if this is a sys/mman.h system
13193 set sys/mman.h i_sysmman
13194 eval $inhdr
13195
13196 : see if mmap exists
13197 set mmap d_mmap
13198 eval $inlibc
13199 : see what shmat returns
13200 : default to something harmless
13201 mmaptype='void *'
13202 case "$i_sysmman$d_mmap" in
13203 "$define$define")
13204         $cat >mmap.c <<'END'
13205 #include <sys/mman.h>
13206 void *mmap();
13207 END
13208         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
13209                 mmaptype='void *'
13210         else
13211                 mmaptype='caddr_t'
13212         fi
13213         echo "and it returns ($mmaptype)." >&4
13214         ;;
13215 esac
13216
13217
13218
13219 : see if mprotect exists
13220 set mprotect d_mprotect
13221 eval $inlibc
13222
13223 : see if msgctl exists
13224 set msgctl d_msgctl
13225 eval $inlibc
13226
13227 : see if msgget exists
13228 set msgget d_msgget
13229 eval $inlibc
13230
13231 : see if msgsnd exists
13232 set msgsnd d_msgsnd
13233 eval $inlibc
13234
13235 : see if msgrcv exists
13236 set msgrcv d_msgrcv
13237 eval $inlibc
13238
13239 : see how much of the 'msg*(2)' library is present.
13240 h_msg=true
13241 echo " "
13242 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
13243 *"$undef"*) h_msg=false;;
13244 esac
13245 case "$osname" in
13246 freebsd)
13247     case "`ipcs 2>&1`" in
13248     "SVID messages"*"not configured"*)
13249         echo "Your $osname does not have the msg*(2) configured." >&4
13250         h_msg=false
13251         val="$undef"
13252         set msgctl d_msgctl
13253         eval $setvar
13254         set msgget d_msgget
13255         eval $setvar
13256         set msgsnd d_msgsnd
13257         eval $setvar
13258         set msgrcv d_msgrcv
13259         eval $setvar
13260         ;;
13261     esac
13262     ;;
13263 esac
13264 : we could also check for sys/ipc.h ...
13265 if $h_msg && $test `./findhdr sys/msg.h`; then
13266         echo "You have the full msg*(2) library." >&4
13267         val="$define"
13268 else
13269         echo "You don't have the full msg*(2) library." >&4
13270         val="$undef"
13271 fi
13272 set d_msg
13273 eval $setvar
13274
13275
13276 echo " "
13277 echo "Checking to see if your system supports struct msghdr..." >&4
13278 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
13279 eval $hasstruct
13280 case "$d_msghdr_s" in
13281 "$define")      echo "Yes, it does."   ;;
13282 *)              echo "No, it doesn't." ;;
13283 esac
13284
13285
13286 : see if msync exists
13287 set msync d_msync
13288 eval $inlibc
13289
13290 : see if munmap exists
13291 set munmap d_munmap
13292 eval $inlibc
13293
13294 : see if nice exists
13295 set nice d_nice
13296 eval $inlibc
13297
13298 : see if this is a langinfo.h system
13299 set langinfo.h i_langinfo
13300 eval $inhdr
13301
13302 : see if nl_langinfo exists
13303 set nl_langinfo d_nl_langinfo
13304 eval $inlibc
13305
13306 : check for length of character
13307 echo " "
13308 case "$charsize" in
13309 '')
13310         echo "Checking to see how big your characters are (hey, you never know)..." >&4
13311         $cat >try.c <<'EOCP'
13312 #include <stdio.h>
13313 int main()
13314 {
13315     printf("%d\n", (int)sizeof(char));
13316     exit(0);
13317 }
13318 EOCP
13319         set try
13320         if eval $compile_ok; then
13321                 dflt=`$run ./try`
13322         else
13323                 dflt='1'
13324                 echo "(I can't seem to compile the test program.  Guessing...)"
13325         fi
13326         ;;
13327 *)
13328         dflt="$charsize"
13329         ;;
13330 esac
13331 rp="What is the size of a character (in bytes)?"
13332 . ./myread
13333 charsize="$ans"
13334 $rm -f try.c try
13335
13336 : check for volatile keyword
13337 echo " "
13338 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
13339 $cat >try.c <<'EOCP'
13340 int main()
13341 {
13342         typedef struct _goo_struct goo_struct;
13343         goo_struct * volatile goo = ((goo_struct *)0);
13344         struct _goo_struct {
13345                 long long_int;
13346                 int reg_int;
13347                 char char_var;
13348         };
13349         typedef unsigned short foo_t;
13350         char *volatile foo;
13351         volatile int bar;
13352         volatile foo_t blech;
13353         foo = foo;
13354 }
13355 EOCP
13356 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
13357         val="$define"
13358         echo "Yup, it does."
13359 else
13360         val="$undef"
13361         echo "Nope, it doesn't."
13362 fi
13363 set d_volatile
13364 eval $setvar
13365 $rm -f try.*
13366
13367
13368 echo " "
13369 $echo "Choosing the C types to be used for Perl's internal types..." >&4
13370
13371 case "$use64bitint:$d_quad:$quadtype" in
13372 define:define:?*)
13373         ivtype="$quadtype"
13374         uvtype="$uquadtype"
13375         ivsize=8
13376         uvsize=8
13377         ;;
13378 *)      ivtype="long"
13379         uvtype="unsigned long"
13380         ivsize=$longsize
13381         uvsize=$longsize
13382         ;;
13383 esac
13384
13385 case "$uselongdouble:$d_longdbl" in
13386 define:define)
13387         nvtype="long double"
13388         nvsize=$longdblsize
13389         ;;
13390 *)      nvtype=double
13391         nvsize=$doublesize
13392         ;;
13393 esac
13394
13395 $echo "(IV will be "$ivtype", $ivsize bytes)"
13396 $echo "(UV will be "$uvtype", $uvsize bytes)"
13397 $echo "(NV will be "$nvtype", $nvsize bytes)"
13398
13399 $cat >try.c <<EOCP
13400 #$i_inttypes I_INTTYPES
13401 #ifdef I_INTTYPES
13402 #include <inttypes.h>
13403 #endif
13404 #include <stdio.h>
13405 int main() {
13406 #ifdef INT8
13407    int8_t i =  INT8_MAX;
13408   uint8_t u = UINT8_MAX;
13409   printf("int8_t\n");
13410 #endif
13411 #ifdef INT16
13412    int16_t i =  INT16_MAX;
13413   uint16_t i = UINT16_MAX;
13414   printf("int16_t\n");
13415 #endif
13416 #ifdef INT32
13417    int32_t i =  INT32_MAX;
13418   uint32_t u = UINT32_MAX;
13419   printf("int32_t\n");
13420 #endif
13421 }
13422 EOCP
13423
13424 case "$i8type" in
13425 '')     case "$charsize" in
13426         1)      i8type=char
13427                 u8type="unsigned char"
13428                 i8size=$charsize
13429                 u8size=$charsize
13430                 ;;
13431         esac
13432         ;;
13433 esac
13434 case "$i8type" in
13435 '')     set try -DINT8
13436         if eval $compile; then
13437                 case "`$run ./try`" in
13438                 int8_t) i8type=int8_t
13439                         u8type=uint8_t
13440                         i8size=1
13441                         u8size=1
13442                         ;;
13443                 esac
13444         fi
13445         ;;
13446 esac
13447 case "$i8type" in
13448 '')     if $test $charsize -ge 1; then
13449                 i8type=char
13450                 u8type="unsigned char"
13451                 i8size=$charsize
13452                 u8size=$charsize
13453         fi
13454         ;;
13455 esac
13456
13457 case "$i16type" in
13458 '')     case "$shortsize" in
13459         2)      i16type=short
13460                 u16type="unsigned short"
13461                 i16size=$shortsize
13462                 u16size=$shortsize
13463                 ;;
13464         esac
13465         ;;
13466 esac
13467 case "$i16type" in
13468 '')     set try -DINT16
13469         if eval $compile; then
13470                 case "`$run ./try`" in
13471                 int16_t)
13472                         i16type=int16_t
13473                         u16type=uint16_t
13474                         i16size=2
13475                         u16size=2
13476                         ;;
13477                 esac
13478         fi
13479         ;;
13480 esac
13481 case "$i16type" in
13482 '')     if $test $shortsize -ge 2; then
13483                 i16type=short
13484                 u16type="unsigned short"
13485                 i16size=$shortsize
13486                 u16size=$shortsize
13487         fi
13488         ;;
13489 esac
13490
13491 case "$i32type" in
13492 '')     case "$longsize" in
13493         4)      i32type=long
13494                 u32type="unsigned long"
13495                 i32size=$longsize
13496                 u32size=$longsize
13497                 ;;
13498         *)      case "$intsize" in
13499                 4)      i32type=int
13500                         u32type="unsigned int"
13501                         i32size=$intsize
13502                         u32size=$intsize
13503                         ;;
13504                 esac
13505                 ;;
13506         esac
13507         ;;
13508 esac
13509 case "$i32type" in
13510 '')     set try -DINT32
13511         if eval $compile; then
13512                 case "`$run ./try`" in
13513                 int32_t)
13514                         i32type=int32_t
13515                         u32type=uint32_t
13516                         i32size=4
13517                         u32size=4
13518                         ;;
13519                 esac
13520         fi
13521         ;;
13522 esac
13523 case "$i32type" in
13524 '')     if $test $intsize -ge 4; then
13525                 i32type=int
13526                 u32type="unsigned int"
13527                 i32size=$intsize
13528                 u32size=$intsize
13529         fi
13530         ;;
13531 esac
13532
13533 case "$i64type" in
13534 '')     case "$d_quad:$quadtype" in
13535         define:?*)
13536                 i64type="$quadtype"
13537                 u64type="$uquadtype"
13538                 i64size=8
13539                 u64size=8
13540                 ;;
13541         esac
13542         ;;
13543 esac
13544
13545 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
13546 : volatile so that the compiler has to store it out to memory.
13547 if test X"$d_volatile" = X"$define"; then
13548         volatile=volatile
13549 fi
13550 $cat <<EOP >try.c
13551 #include <stdio.h>
13552 #include <sys/types.h>
13553 #include <signal.h>
13554 #ifdef SIGFPE
13555 $volatile int bletched = 0;
13556 $signal_t blech(s) int s; { bletched = 1; }
13557 #endif
13558 int main() {
13559     $uvtype u = 0;
13560     $nvtype d;
13561     int     n = 8 * $uvsize;
13562     int     i;
13563 #ifdef SIGFPE
13564     signal(SIGFPE, blech);
13565 #endif
13566
13567     for (i = 0; i < n; i++) {
13568       u = u << 1 | ($uvtype)1;
13569       d = ($nvtype)u;
13570       if (($uvtype)d != u)
13571         break;
13572       if (d <= 0)
13573         break;
13574       d = ($nvtype)(u - 1);
13575       if (($uvtype)d != (u - 1))
13576         break;
13577 #ifdef SIGFPE
13578       if (bletched) {
13579         break;
13580 #endif
13581       } 
13582     }
13583     printf("%d\n", ((i == n) ? -n : i));
13584     exit(0);
13585 }
13586 EOP
13587 set try
13588
13589 d_nv_preserves_uv="$undef"
13590 if eval $compile; then
13591         nv_preserves_uv_bits="`$run ./try`"
13592 fi
13593 case "$nv_preserves_uv_bits" in
13594 \-[1-9]*)       
13595         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
13596         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
13597         d_nv_preserves_uv="$define"
13598         ;;
13599 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
13600         d_nv_preserves_uv="$undef" ;;
13601 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
13602         nv_preserves_uv_bits="$undef" ;;
13603 esac
13604
13605 $rm -f try.* try
13606
13607
13608 : check for off64_t
13609 echo " "
13610 echo "Checking to see if you have off64_t..." >&4
13611 $cat >try.c <<EOCP
13612 #include <sys/types.h>
13613 #include <unistd.h>
13614 int main() { off64_t x = 7; }
13615 EOCP
13616 set try
13617 if eval $compile; then
13618         val="$define"
13619         echo "You have off64_t."
13620 else
13621         val="$undef"
13622         echo "You do not have off64_t."
13623         case "$lseeksize" in
13624         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
13625         esac
13626 fi
13627 $rm -f try.* try
13628 set d_off64_t
13629 eval $setvar
13630
13631 : how to create joinable pthreads
13632 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
13633         echo " "
13634         echo "Checking what constant to use for creating joinable pthreads..." >&4 
13635         $cat >try.c <<'EOCP'
13636 #include <pthread.h>
13637 int main() {
13638     int detachstate = JOINABLE;
13639 }
13640 EOCP
13641         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
13642         if eval $compile; then
13643                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
13644                 val="$undef" # Yes, undef.
13645                 set d_old_pthread_create_joinable
13646                 eval $setvar
13647                 val=""
13648                 set old_pthread_create_joinable
13649                 eval $setvar
13650         else
13651                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
13652                 if eval $compile; then
13653                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
13654                         val="$define"
13655                         set d_old_pthread_create_joinable
13656                         eval $setvar
13657                         val=PTHREAD_CREATE_UNDETACHED
13658                         set old_pthread_create_joinable
13659                         eval $setvar
13660                 else            
13661                         set try -DJOINABLE=__UNDETACHED
13662                         if eval $compile; then
13663                                 echo "You seem to use __UNDETACHED." >&4
13664                                 val="$define"
13665                                 set d_old_pthread_create_joinable
13666                                 eval $setvar
13667                                 val=__UNDETACHED
13668                                 set old_pthread_create_joinable
13669                                 eval $setvar
13670                         else
13671                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
13672                                 val="$define"
13673                                 set d_old_pthread_create_joinable
13674                                 eval $setvar
13675                                 val=0
13676                                 set old_pthread_create_joinable
13677                                 eval $setvar
13678                         fi
13679                 fi
13680         fi
13681         $rm -f try try.*
13682 else
13683     d_old_pthread_create_joinable="$undef"
13684     old_pthread_create_joinable=""
13685 fi
13686
13687 : see if pause exists
13688 set pause d_pause
13689 eval $inlibc
13690
13691 : see if pipe exists
13692 set pipe d_pipe
13693 eval $inlibc
13694
13695 : see if poll exists
13696 set poll d_poll
13697 eval $inlibc
13698
13699 : see if readlink exists
13700 set readlink d_readlink
13701 eval $inlibc
13702
13703 echo " "
13704 procselfexe=''
13705 val="$undef"
13706 case "$d_readlink" in
13707 "$define")
13708         if $issymlink /proc/self/exe ; then
13709                 $ls -l /proc/self/exe > reflect
13710                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13711                         echo "You have Linux-like /proc/self/exe."
13712                         procselfexe='"/proc/self/exe"'
13713                         val="$define"
13714                 fi
13715         fi
13716         if $issymlink /proc/curproc/file ; then
13717                 $ls -l /proc/curproc/file > reflect
13718                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13719                         echo "You have BSD-like /proc/curproc/file."
13720                         procselfexe='"/proc/curproc/file"'
13721                         val="$define"
13722                 fi
13723         fi
13724         ;;
13725 esac
13726 $rm -f reflect
13727 set d_procselfexe
13728 eval $setvar
13729
13730 : see whether the pthread_atfork exists
13731 $cat >try.c <<EOP
13732 #include <pthread.h>
13733 #include <stdio.h>
13734 int main() {
13735 #ifdef  PTHREAD_ATFORK
13736         pthread_atfork(NULL,NULL,NULL);
13737 #endif
13738 }
13739 EOP
13740
13741 : see if pthread_atfork exists
13742 set try -DPTHREAD_ATFORK
13743 if eval $compile; then
13744     val="$define"
13745 else
13746     val="$undef"
13747 fi
13748 case "$usethreads" in
13749 $define)
13750         case "$val" in
13751         $define) echo 'pthread_atfork found.' >&4        ;;
13752         *)       echo 'pthread_atfork NOT found.' >&4    ;;
13753         esac
13754 esac
13755 set d_pthread_atfork
13756 eval $setvar
13757
13758
13759 : see whether the various POSIXish _yields exist
13760 $cat >try.c <<EOP
13761 #include <pthread.h>
13762 #include <stdio.h>
13763 int main() {
13764 #ifdef SCHED_YIELD
13765         sched_yield();
13766 #else
13767 #ifdef PTHREAD_YIELD
13768         pthread_yield();
13769 #else
13770 #ifdef PTHREAD_YIELD_NULL
13771         pthread_yield(NULL);
13772 #endif
13773 #endif
13774 #endif
13775 }
13776 EOP
13777 : see if sched_yield exists
13778 set try -DSCHED_YIELD
13779 if eval $compile; then
13780     val="$define"
13781     sched_yield='sched_yield()'
13782 else
13783     val="$undef"
13784 fi
13785 case "$usethreads" in
13786 $define)
13787         case "$val" in
13788         $define) echo 'sched_yield() found.' >&4        ;;
13789         *)       echo 'sched_yield() NOT found.' >&4    ;;
13790         esac
13791 esac
13792 set d_sched_yield
13793 eval $setvar
13794
13795 : see if pthread_yield exists
13796 set try -DPTHREAD_YIELD
13797 if eval $compile; then
13798     val="$define"
13799     case "$sched_yield" in
13800     '') sched_yield='pthread_yield()' ;;
13801     esac
13802 else
13803     set try -DPTHREAD_YIELD_NULL
13804     if eval $compile; then
13805         val="$define"
13806         case "$sched_yield" in
13807         '') sched_yield='pthread_yield(NULL)' ;;
13808         esac
13809     else
13810         val="$undef"
13811     fi
13812 fi
13813 case "$usethreads" in
13814 $define)
13815         case "$val" in
13816         $define) echo 'pthread_yield() found.' >&4      ;;
13817         *)       echo 'pthread_yield() NOT found.' >&4  ;;
13818         esac
13819         ;;
13820 esac
13821 set d_pthread_yield
13822 eval $setvar
13823
13824 case "$sched_yield" in
13825 '') sched_yield=undef ;;
13826 esac
13827
13828 $rm -f try try.*
13829
13830 : see if random_r exists
13831 set random_r d_random_r
13832 eval $inlibc
13833 case "$d_random_r" in
13834 "$define")
13835         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
13836         case "$d_random_r_proto:$usethreads" in
13837         ":define")      d_random_r_proto=define
13838                 set d_random_r_proto random_r $hdrs
13839                 eval $hasproto ;;
13840         *)      ;;
13841         esac
13842         case "$d_random_r_proto" in
13843         define)
13844         case "$random_r_proto" in
13845         ''|0) try='int random_r(int*, struct random_data*);'
13846         ./protochk "extern $try" $hdrs && random_r_proto=I_TS ;;
13847         esac
13848         case "$random_r_proto" in
13849         ''|0)   d_random_r=undef
13850                 random_r_proto=0
13851                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
13852         * )     case "$random_r_proto" in
13853                 REENTRANT_PROTO*) ;;
13854                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
13855                 esac
13856                 echo "Prototype: $try" ;;
13857         esac
13858         ;;
13859         *)      case "$usethreads" in
13860                 define) echo "random_r has no prototype, not using it." >&4 ;;
13861                 esac
13862                 d_random_r=undef
13863                 random_r_proto=0
13864                 ;;
13865         esac
13866         ;;
13867 *)      random_r_proto=0
13868         ;;
13869 esac
13870
13871 : see if readdir and friends exist
13872 set readdir d_readdir
13873 eval $inlibc
13874 set seekdir d_seekdir
13875 eval $inlibc
13876 set telldir d_telldir
13877 eval $inlibc
13878 set rewinddir d_rewinddir
13879 eval $inlibc
13880
13881 : see if readdir64_r exists
13882 set readdir64_r d_readdir64_r
13883 eval $inlibc
13884 case "$d_readdir64_r" in
13885 "$define")
13886         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
13887         case "$d_readdir64_r_proto:$usethreads" in
13888         ":define")      d_readdir64_r_proto=define
13889                 set d_readdir64_r_proto readdir64_r $hdrs
13890                 eval $hasproto ;;
13891         *)      ;;
13892         esac
13893         case "$d_readdir64_r_proto" in
13894         define)
13895         case "$readdir64_r_proto" in
13896         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
13897         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
13898         esac
13899         case "$readdir64_r_proto" in
13900         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
13901         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
13902         esac
13903         case "$readdir64_r_proto" in
13904         ''|0)   d_readdir64_r=undef
13905                 readdir64_r_proto=0
13906                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
13907         * )     case "$readdir64_r_proto" in
13908                 REENTRANT_PROTO*) ;;
13909                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
13910                 esac
13911                 echo "Prototype: $try" ;;
13912         esac
13913         ;;
13914         *)      case "$usethreads" in
13915                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
13916                 esac
13917                 d_readdir64_r=undef
13918                 readdir64_r_proto=0
13919                 ;;
13920         esac
13921         ;;
13922 *)      readdir64_r_proto=0
13923         ;;
13924 esac
13925
13926 : see if readdir_r exists
13927 set readdir_r d_readdir_r
13928 eval $inlibc
13929 case "$d_readdir_r" in
13930 "$define")
13931         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
13932         case "$d_readdir_r_proto:$usethreads" in
13933         ":define")      d_readdir_r_proto=define
13934                 set d_readdir_r_proto readdir_r $hdrs
13935                 eval $hasproto ;;
13936         *)      ;;
13937         esac
13938         case "$d_readdir_r_proto" in
13939         define)
13940         case "$readdir_r_proto" in
13941         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
13942         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
13943         esac
13944         case "$readdir_r_proto" in
13945         ''|0) try='int readdir_r(DIR*, struct dirent*);'
13946         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
13947         esac
13948         case "$readdir_r_proto" in
13949         ''|0)   d_readdir_r=undef
13950                 readdir_r_proto=0
13951                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
13952         * )     case "$readdir_r_proto" in
13953                 REENTRANT_PROTO*) ;;
13954                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
13955                 esac
13956                 echo "Prototype: $try" ;;
13957         esac
13958         ;;
13959         *)      case "$usethreads" in
13960                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
13961                 esac
13962                 d_readdir_r=undef
13963                 readdir_r_proto=0
13964                 ;;
13965         esac
13966         ;;
13967 *)      readdir_r_proto=0
13968         ;;
13969 esac
13970
13971 : see if readv exists
13972 set readv d_readv
13973 eval $inlibc
13974
13975 : see if recvmsg exists
13976 set recvmsg d_recvmsg
13977 eval $inlibc
13978
13979 : see if rename exists
13980 set rename d_rename
13981 eval $inlibc
13982
13983 : see if rmdir exists
13984 set rmdir d_rmdir
13985 eval $inlibc
13986
13987 : see if memory.h is available.
13988 val=''
13989 set memory.h val
13990 eval $inhdr
13991
13992 : See if it conflicts with string.h
13993 case "$val" in
13994 $define)
13995         case "$strings" in
13996         '') ;;
13997         *)
13998                 $cppstdin $cppflags $cppminus < $strings > mem.h
13999                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
14000                         echo " "
14001                         echo "We won't be including <memory.h>."
14002                         val="$undef"
14003                 fi
14004                 $rm -f mem.h
14005                 ;;
14006         esac
14007 esac
14008 set i_memory
14009 eval $setvar
14010
14011 : can bcopy handle overlapping blocks?
14012 echo " "
14013 val="$undef"
14014 case "$d_memmove" in
14015 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
14016 *)      case "$d_bcopy" in
14017         "$define")
14018                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
14019                 $cat >try.c <<EOCP
14020 #$i_memory I_MEMORY
14021 #$i_stdlib I_STDLIB
14022 #$i_string I_STRING
14023 #$i_unistd I_UNISTD
14024 EOCP
14025         $cat >>try.c <<'EOCP'
14026 #include <stdio.h>
14027 #ifdef I_MEMORY
14028 #  include <memory.h>
14029 #endif
14030 #ifdef I_STDLIB
14031 #  include <stdlib.h>
14032 #endif
14033 #ifdef I_STRING
14034 #  include <string.h>
14035 #else
14036 #  include <strings.h>
14037 #endif
14038 #ifdef I_UNISTD
14039 #  include <unistd.h>  /* Needed for NetBSD */
14040 #endif
14041 int main()
14042 {
14043 char buf[128], abc[128];
14044 char *b;
14045 int len;
14046 int off;
14047 int align;
14048
14049 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14050    try to store the string in read-only memory. */
14051 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
14052
14053 for (align = 7; align >= 0; align--) {
14054         for (len = 36; len; len--) {
14055                 b = buf+align;
14056                 bcopy(abc, b, len);
14057                 for (off = 1; off <= len; off++) {
14058                         bcopy(b, b+off, len);
14059                         bcopy(b+off, b, len);
14060                         if (bcmp(b, abc, len))
14061                                 exit(1);
14062                 }
14063         }
14064 }
14065 exit(0);
14066 }
14067 EOCP
14068                 set try
14069                 if eval $compile_ok; then
14070                         if ./try 2>/dev/null; then
14071                                 echo "Yes, it can."
14072                                 val="$define"
14073                         else
14074                                 echo "It can't, sorry."
14075                         fi
14076                 else
14077                         echo "(I can't compile the test program, so we'll assume not...)"
14078                 fi
14079                 ;;
14080         esac
14081         $rm -f try.* try core
14082         ;;
14083 esac
14084 set d_safebcpy
14085 eval $setvar
14086
14087 : can memcpy handle overlapping blocks?
14088 echo " "
14089 val="$undef"
14090 case "$d_memmove" in
14091 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
14092 *)      case "$d_memcpy" in
14093         "$define")
14094                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
14095                 $cat >try.c <<EOCP
14096 #$i_memory I_MEMORY
14097 #$i_stdlib I_STDLIB
14098 #$i_string I_STRING
14099 #$i_unistd I_UNISTD
14100 EOCP
14101         $cat >>try.c <<'EOCP'
14102 #include <stdio.h>
14103 #ifdef I_MEMORY
14104 #  include <memory.h>
14105 #endif
14106 #ifdef I_STDLIB
14107 #  include <stdlib.h>
14108 #endif
14109 #ifdef I_STRING
14110 #  include <string.h>
14111 #else
14112 #  include <strings.h>
14113 #endif
14114 #ifdef I_UNISTD
14115 #  include <unistd.h>  /* Needed for NetBSD */
14116 #endif
14117 int main()
14118 {
14119 char buf[128], abc[128];
14120 char *b;
14121 int len;
14122 int off;
14123 int align;
14124
14125 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14126    try to store the string in read-only memory. */
14127 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
14128
14129 for (align = 7; align >= 0; align--) {
14130         for (len = 36; len; len--) {
14131                 b = buf+align;
14132                 memcpy(b, abc, len);
14133                 for (off = 1; off <= len; off++) {
14134                         memcpy(b+off, b, len);
14135                         memcpy(b, b+off, len);
14136                         if (memcmp(b, abc, len))
14137                                 exit(1);
14138                 }
14139         }
14140 }
14141 exit(0);
14142 }
14143 EOCP
14144                 set try
14145                 if eval $compile_ok; then
14146                         if ./try 2>/dev/null; then
14147                                 echo "Yes, it can."
14148                                 val="$define"
14149                         else
14150                                 echo "It can't, sorry."
14151                         fi
14152                 else
14153                         echo "(I can't compile the test program, so we'll assume not...)"
14154                 fi
14155                 ;;
14156         esac
14157         $rm -f try.* try core
14158         ;;
14159 esac
14160 set d_safemcpy
14161 eval $setvar
14162
14163 : can memcmp be trusted to compare relative magnitude?
14164 val="$undef"
14165 case "$d_memcmp" in
14166 "$define")
14167         echo " "
14168         echo "Checking if your memcmp() can compare relative magnitude..." >&4
14169         $cat >try.c <<EOCP
14170 #$i_memory I_MEMORY
14171 #$i_stdlib I_STDLIB
14172 #$i_string I_STRING
14173 #$i_unistd I_UNISTD
14174 EOCP
14175         $cat >>try.c <<'EOCP'
14176 #include <stdio.h>
14177 #ifdef I_MEMORY
14178 #  include <memory.h>
14179 #endif
14180 #ifdef I_STDLIB
14181 #  include <stdlib.h>
14182 #endif
14183 #ifdef I_STRING
14184 #  include <string.h>
14185 #else
14186 #  include <strings.h>
14187 #endif
14188 #ifdef I_UNISTD
14189 #  include <unistd.h>  /* Needed for NetBSD */
14190 #endif
14191 int main()
14192 {
14193 char a = -1;
14194 char b = 0;
14195 if ((a < b) && memcmp(&a, &b, 1) < 0)
14196         exit(1);
14197 exit(0);
14198 }
14199 EOCP
14200         set try
14201         if eval $compile_ok; then
14202                 if $run ./try 2>/dev/null; then
14203                         echo "Yes, it can."
14204                         val="$define"
14205                 else
14206                         echo "No, it can't (it uses signed chars)."
14207                 fi
14208         else
14209                 echo "(I can't compile the test program, so we'll assume not...)"
14210         fi
14211         ;;
14212 esac
14213 $rm -f try.* try core
14214 set d_sanemcmp
14215 eval $setvar
14216
14217 : see if prototype for sbrk is available
14218 echo " "
14219 set d_sbrkproto sbrk $i_unistd unistd.h
14220 eval $hasproto
14221
14222 : see if select exists
14223 set select d_select
14224 eval $inlibc
14225
14226 : see if semctl exists
14227 set semctl d_semctl
14228 eval $inlibc
14229
14230 : see if semget exists
14231 set semget d_semget
14232 eval $inlibc
14233
14234 : see if semop exists
14235 set semop d_semop
14236 eval $inlibc
14237
14238 : see how much of the 'sem*(2)' library is present.
14239 h_sem=true
14240 echo " "
14241 case "$d_semctl$d_semget$d_semop" in
14242 *"$undef"*) h_sem=false;;
14243 esac
14244 case "$osname" in
14245 freebsd)
14246     case "`ipcs 2>&1`" in
14247     "SVID messages"*"not configured"*)
14248         echo "Your $osname does not have the sem*(2) configured." >&4
14249         h_sem=false
14250         val="$undef"
14251         set semctl d_semctl
14252         eval $setvar
14253         set semget d_semget
14254         eval $setvar
14255         set semop d_semop
14256         eval $setvar
14257         ;;
14258     esac
14259     ;;
14260 esac
14261 : we could also check for sys/ipc.h ...
14262 if $h_sem && $test `./findhdr sys/sem.h`; then
14263         echo "You have the full sem*(2) library." >&4
14264         val="$define"
14265 else
14266         echo "You don't have the full sem*(2) library." >&4
14267         val="$undef"
14268 fi
14269 set d_sem
14270 eval $setvar
14271
14272 : see whether sys/sem.h defines union semun
14273 echo " "
14274 $cat > try.c <<'END'
14275 #include <sys/types.h>
14276 #include <sys/ipc.h>
14277 #include <sys/sem.h>
14278 int main () { union semun semun; semun.buf = 0; }
14279 END
14280 set try
14281 if eval $compile; then
14282     echo "You have union semun in <sys/sem.h>." >&4
14283     val="$define"
14284 else
14285     echo "You do not have union semun in <sys/sem.h>." >&4
14286     val="$undef"
14287 fi
14288 $rm -f try try.c try.h
14289 set d_union_semun
14290 eval $setvar
14291
14292 : see how to do semctl IPC_STAT
14293 case "$d_sem" in
14294 $define)
14295     : see whether semctl IPC_STAT can use union semun
14296     echo " "
14297     $cat > try.h <<END
14298 #ifndef S_IRUSR
14299 #   ifdef S_IREAD
14300 #       define S_IRUSR S_IREAD
14301 #       define S_IWUSR S_IWRITE
14302 #       define S_IXUSR S_IEXEC
14303 #   else
14304 #       define S_IRUSR 0400
14305 #       define S_IWUSR 0200
14306 #       define S_IXUSR 0100
14307 #   endif
14308 #   define S_IRGRP (S_IRUSR>>3)
14309 #   define S_IWGRP (S_IWUSR>>3)
14310 #   define S_IXGRP (S_IXUSR>>3)
14311 #   define S_IROTH (S_IRUSR>>6)
14312 #   define S_IWOTH (S_IWUSR>>6)
14313 #   define S_IXOTH (S_IXUSR>>6)
14314 #endif
14315 #ifndef S_IRWXU
14316 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
14317 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
14318 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
14319 #endif
14320 END
14321
14322     $cat > try.c <<END
14323 #include <sys/types.h>
14324 #include <sys/ipc.h>
14325 #include <sys/sem.h>
14326 #include <sys/stat.h>
14327 #include <stdio.h>
14328 #include <errno.h>
14329 #include "try.h"
14330 #ifndef errno
14331 extern int errno;
14332 #endif
14333 #$d_union_semun HAS_UNION_SEMUN
14334 int main() {
14335     union semun
14336 #ifndef HAS_UNION_SEMUN
14337     {
14338         int val;
14339         struct semid_ds *buf;
14340         unsigned short *array;
14341     }
14342 #endif
14343     arg;
14344     int sem, st;
14345
14346 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
14347     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14348     if (sem > -1) {
14349         struct semid_ds argbuf;
14350         arg.buf = &argbuf;
14351 #       ifdef IPC_STAT
14352         st = semctl(sem, 0, IPC_STAT, arg);
14353         if (st == 0)
14354             printf("semun\n");
14355         else
14356 #       endif /* IPC_STAT */
14357             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14358 #       ifdef IPC_RMID
14359         if (semctl(sem, 0, IPC_RMID, arg) != 0)
14360 #       endif /* IPC_RMID */
14361             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14362     } else
14363 #endif /* IPC_PRIVATE && ... */
14364         printf("semget failed: errno = %d\n", errno);
14365   return 0;
14366 }
14367 END
14368     val="$undef"
14369     set try
14370     if eval $compile; then
14371         xxx=`$run ./try`
14372         case "$xxx" in
14373         semun) val="$define" ;;
14374         esac
14375     fi
14376     $rm -f try try.c
14377     set d_semctl_semun
14378     eval $setvar
14379     case "$d_semctl_semun" in
14380     $define)
14381         echo "You can use union semun for semctl IPC_STAT." >&4
14382         also='also'
14383         ;;
14384     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
14385         also=''
14386         ;;
14387     esac
14388
14389     : see whether semctl IPC_STAT can use struct semid_ds pointer
14390     $cat > try.c <<'END'
14391 #include <sys/types.h>
14392 #include <sys/ipc.h>
14393 #include <sys/sem.h>
14394 #include <sys/stat.h>
14395 #include "try.h"
14396 #include <stdio.h>
14397 #include <errno.h>
14398 #ifndef errno
14399 extern int errno;
14400 #endif
14401 int main() {
14402     struct semid_ds arg;
14403     int sem, st;
14404
14405 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
14406     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14407     if (sem > -1) {
14408 #       ifdef IPC_STAT
14409         st = semctl(sem, 0, IPC_STAT, &arg);
14410         if (st == 0)
14411             printf("semid_ds\n");
14412         else
14413 #       endif /* IPC_STAT */
14414             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14415 #       ifdef IPC_RMID
14416         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
14417 #       endif /* IPC_RMID */
14418             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14419     } else
14420 #endif /* IPC_PRIVATE && ... */
14421         printf("semget failed: errno = %d\n", errno);
14422
14423     return 0;
14424 }
14425 END
14426     val="$undef"
14427     set try
14428     if eval $compile; then
14429         xxx=`$run ./try`
14430         case "$xxx" in
14431         semid_ds) val="$define" ;;
14432         esac
14433     fi
14434     $rm -f try try.c
14435     set d_semctl_semid_ds
14436     eval $setvar
14437     case "$d_semctl_semid_ds" in
14438     $define)
14439         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
14440         ;;
14441     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
14442         ;;
14443     esac
14444     $rm -f try.h
14445     ;;
14446 *)  val="$undef"
14447
14448     # We do not have the full sem*(2) library, so assume we can not
14449     # use either.
14450
14451     set d_semctl_semun
14452     eval $setvar
14453
14454     set d_semctl_semid_ds
14455     eval $setvar
14456     ;;
14457 esac
14458
14459 : see if sendmsg exists
14460 set sendmsg d_sendmsg
14461 eval $inlibc
14462
14463 : see if setegid exists
14464 set setegid d_setegid
14465 eval $inlibc
14466
14467 : see if seteuid exists
14468 set seteuid d_seteuid
14469 eval $inlibc
14470
14471 : see if setgrent exists
14472 set setgrent d_setgrent
14473 eval $inlibc
14474
14475 : see if setgrent_r exists
14476 set setgrent_r d_setgrent_r
14477 eval $inlibc
14478 case "$d_setgrent_r" in
14479 "$define")
14480         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14481         case "$d_setgrent_r_proto:$usethreads" in
14482         ":define")      d_setgrent_r_proto=define
14483                 set d_setgrent_r_proto setgrent_r $hdrs
14484                 eval $hasproto ;;
14485         *)      ;;
14486         esac
14487         case "$d_setgrent_r_proto" in
14488         define)
14489         case "$setgrent_r_proto" in
14490         ''|0) try='int setgrent_r(FILE**);'
14491         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
14492         esac
14493         case "$setgrent_r_proto" in
14494         ''|0) try='void setgrent_r(FILE**);'
14495         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
14496         esac
14497         case "$setgrent_r_proto" in
14498         ''|0)   d_setgrent_r=undef
14499                 setgrent_r_proto=0
14500                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
14501         * )     case "$setgrent_r_proto" in
14502                 REENTRANT_PROTO*) ;;
14503                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
14504                 esac
14505                 echo "Prototype: $try" ;;
14506         esac
14507         ;;
14508         *)      case "$usethreads" in
14509                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
14510                 esac
14511                 d_setgrent_r=undef
14512                 setgrent_r_proto=0
14513                 ;;
14514         esac
14515         ;;
14516 *)      setgrent_r_proto=0
14517         ;;
14518 esac
14519
14520 : see if sethostent exists
14521 set sethostent d_sethent
14522 eval $inlibc
14523
14524 : see if sethostent_r exists
14525 set sethostent_r d_sethostent_r
14526 eval $inlibc
14527 case "$d_sethostent_r" in
14528 "$define")
14529         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14530         case "$d_sethostent_r_proto:$usethreads" in
14531         ":define")      d_sethostent_r_proto=define
14532                 set d_sethostent_r_proto sethostent_r $hdrs
14533                 eval $hasproto ;;
14534         *)      ;;
14535         esac
14536         case "$d_sethostent_r_proto" in
14537         define)
14538         case "$sethostent_r_proto" in
14539         ''|0) try='int sethostent_r(int, struct hostent_data*);'
14540         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
14541         esac
14542         case "$sethostent_r_proto" in
14543         ''|0) try='void sethostent_r(int, struct hostent_data*);'
14544         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
14545         esac
14546         case "$sethostent_r_proto" in
14547         ''|0)   d_sethostent_r=undef
14548                 sethostent_r_proto=0
14549                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
14550         * )     case "$sethostent_r_proto" in
14551                 REENTRANT_PROTO*) ;;
14552                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
14553                 esac
14554                 echo "Prototype: $try" ;;
14555         esac
14556         ;;
14557         *)      case "$usethreads" in
14558                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
14559                 esac
14560                 d_sethostent_r=undef
14561                 sethostent_r_proto=0
14562                 ;;
14563         esac
14564         ;;
14565 *)      sethostent_r_proto=0
14566         ;;
14567 esac
14568
14569 : see if setitimer exists
14570 set setitimer d_setitimer
14571 eval $inlibc
14572
14573 : see if setlinebuf exists
14574 set setlinebuf d_setlinebuf
14575 eval $inlibc
14576
14577 : see if setlocale exists
14578 set setlocale d_setlocale
14579 eval $inlibc
14580
14581 : see if locale.h is available
14582 set locale.h i_locale
14583 eval $inhdr
14584
14585 : see if setlocale_r exists
14586 set setlocale_r d_setlocale_r
14587 eval $inlibc
14588 case "$d_setlocale_r" in
14589 "$define")
14590         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
14591         case "$d_setlocale_r_proto:$usethreads" in
14592         ":define")      d_setlocale_r_proto=define
14593                 set d_setlocale_r_proto setlocale_r $hdrs
14594                 eval $hasproto ;;
14595         *)      ;;
14596         esac
14597         case "$d_setlocale_r_proto" in
14598         define)
14599         case "$setlocale_r_proto" in
14600         ''|0) try='int setlocale_r(int, const char*, char*, int);'
14601         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
14602         esac
14603         case "$setlocale_r_proto" in
14604         ''|0)   d_setlocale_r=undef
14605                 setlocale_r_proto=0
14606                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
14607         * )     case "$setlocale_r_proto" in
14608                 REENTRANT_PROTO*) ;;
14609                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
14610                 esac
14611                 echo "Prototype: $try" ;;
14612         esac
14613         ;;
14614         *)      case "$usethreads" in
14615                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
14616                 esac
14617                 d_setlocale_r=undef
14618                 setlocale_r_proto=0
14619                 ;;
14620         esac
14621         ;;
14622 *)      setlocale_r_proto=0
14623         ;;
14624 esac
14625
14626 : see if setnetent exists
14627 set setnetent d_setnent
14628 eval $inlibc
14629
14630 : see if setnetent_r exists
14631 set setnetent_r d_setnetent_r
14632 eval $inlibc
14633 case "$d_setnetent_r" in
14634 "$define")
14635         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14636         case "$d_setnetent_r_proto:$usethreads" in
14637         ":define")      d_setnetent_r_proto=define
14638                 set d_setnetent_r_proto setnetent_r $hdrs
14639                 eval $hasproto ;;
14640         *)      ;;
14641         esac
14642         case "$d_setnetent_r_proto" in
14643         define)
14644         case "$setnetent_r_proto" in
14645         ''|0) try='int setnetent_r(int, struct netent_data*);'
14646         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
14647         esac
14648         case "$setnetent_r_proto" in
14649         ''|0) try='void setnetent_r(int, struct netent_data*);'
14650         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
14651         esac
14652         case "$setnetent_r_proto" in
14653         ''|0)   d_setnetent_r=undef
14654                 setnetent_r_proto=0
14655                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
14656         * )     case "$setnetent_r_proto" in
14657                 REENTRANT_PROTO*) ;;
14658                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
14659                 esac
14660                 echo "Prototype: $try" ;;
14661         esac
14662         ;;
14663         *)      case "$usethreads" in
14664                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
14665                 esac
14666                 d_setnetent_r=undef
14667                 setnetent_r_proto=0
14668                 ;;
14669         esac
14670         ;;
14671 *)      setnetent_r_proto=0
14672         ;;
14673 esac
14674
14675 : see if setprotoent exists
14676 set setprotoent d_setpent
14677 eval $inlibc
14678
14679 : see if setpgid exists
14680 set setpgid d_setpgid
14681 eval $inlibc
14682
14683 : see if setpgrp2 exists
14684 set setpgrp2 d_setpgrp2
14685 eval $inlibc
14686
14687 : see if setpriority exists
14688 set setpriority d_setprior
14689 eval $inlibc
14690
14691 : see if setproctitle exists
14692 set setproctitle d_setproctitle
14693 eval $inlibc
14694
14695 : see if setprotoent_r exists
14696 set setprotoent_r d_setprotoent_r
14697 eval $inlibc
14698 case "$d_setprotoent_r" in
14699 "$define")
14700         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14701         case "$d_setprotoent_r_proto:$usethreads" in
14702         ":define")      d_setprotoent_r_proto=define
14703                 set d_setprotoent_r_proto setprotoent_r $hdrs
14704                 eval $hasproto ;;
14705         *)      ;;
14706         esac
14707         case "$d_setprotoent_r_proto" in
14708         define)
14709         case "$setprotoent_r_proto" in
14710         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
14711         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
14712         esac
14713         case "$setprotoent_r_proto" in
14714         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
14715         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
14716         esac
14717         case "$setprotoent_r_proto" in
14718         ''|0)   d_setprotoent_r=undef
14719                 setprotoent_r_proto=0
14720                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
14721         * )     case "$setprotoent_r_proto" in
14722                 REENTRANT_PROTO*) ;;
14723                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
14724                 esac
14725                 echo "Prototype: $try" ;;
14726         esac
14727         ;;
14728         *)      case "$usethreads" in
14729                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
14730                 esac
14731                 d_setprotoent_r=undef
14732                 setprotoent_r_proto=0
14733                 ;;
14734         esac
14735         ;;
14736 *)      setprotoent_r_proto=0
14737         ;;
14738 esac
14739
14740 : see if setpwent exists
14741 set setpwent d_setpwent
14742 eval $inlibc
14743
14744 : see if setpwent_r exists
14745 set setpwent_r d_setpwent_r
14746 eval $inlibc
14747 case "$d_setpwent_r" in
14748 "$define")
14749         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14750         case "$d_setpwent_r_proto:$usethreads" in
14751         ":define")      d_setpwent_r_proto=define
14752                 set d_setpwent_r_proto setpwent_r $hdrs
14753                 eval $hasproto ;;
14754         *)      ;;
14755         esac
14756         case "$d_setpwent_r_proto" in
14757         define)
14758         case "$setpwent_r_proto" in
14759         ''|0) try='int setpwent_r(FILE**);'
14760         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
14761         esac
14762         case "$setpwent_r_proto" in
14763         ''|0) try='void setpwent_r(FILE**);'
14764         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
14765         esac
14766         case "$setpwent_r_proto" in
14767         ''|0)   d_setpwent_r=undef
14768                 setpwent_r_proto=0
14769                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
14770         * )     case "$setpwent_r_proto" in
14771                 REENTRANT_PROTO*) ;;
14772                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
14773                 esac
14774                 echo "Prototype: $try" ;;
14775         esac
14776         ;;
14777         *)      case "$usethreads" in
14778                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
14779                 esac
14780                 d_setpwent_r=undef
14781                 setpwent_r_proto=0
14782                 ;;
14783         esac
14784         ;;
14785 *)      setpwent_r_proto=0
14786         ;;
14787 esac
14788
14789 : see if setregid exists
14790 set setregid d_setregid
14791 eval $inlibc
14792 set setresgid d_setresgid
14793 eval $inlibc
14794
14795 : see if setreuid exists
14796 set setreuid d_setreuid
14797 eval $inlibc
14798 set setresuid d_setresuid
14799 eval $inlibc
14800
14801 : see if setrgid exists
14802 set setrgid d_setrgid
14803 eval $inlibc
14804
14805 : see if setruid exists
14806 set setruid d_setruid
14807 eval $inlibc
14808
14809 : see if setservent exists
14810 set setservent d_setsent
14811 eval $inlibc
14812
14813 : see if setservent_r exists
14814 set setservent_r d_setservent_r
14815 eval $inlibc
14816 case "$d_setservent_r" in
14817 "$define")
14818         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14819         case "$d_setservent_r_proto:$usethreads" in
14820         ":define")      d_setservent_r_proto=define
14821                 set d_setservent_r_proto setservent_r $hdrs
14822                 eval $hasproto ;;
14823         *)      ;;
14824         esac
14825         case "$d_setservent_r_proto" in
14826         define)
14827         case "$setservent_r_proto" in
14828         ''|0) try='int setservent_r(int, struct servent_data*);'
14829         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
14830         esac
14831         case "$setservent_r_proto" in
14832         ''|0) try='void setservent_r(int, struct servent_data*);'
14833         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
14834         esac
14835         case "$setservent_r_proto" in
14836         ''|0)   d_setservent_r=undef
14837                 setservent_r_proto=0
14838                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
14839         * )     case "$setservent_r_proto" in
14840                 REENTRANT_PROTO*) ;;
14841                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
14842                 esac
14843                 echo "Prototype: $try" ;;
14844         esac
14845         ;;
14846         *)      case "$usethreads" in
14847                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
14848                 esac
14849                 d_setservent_r=undef
14850                 setservent_r_proto=0
14851                 ;;
14852         esac
14853         ;;
14854 *)      setservent_r_proto=0
14855         ;;
14856 esac
14857
14858 : see if setsid exists
14859 set setsid d_setsid
14860 eval $inlibc
14861
14862 : see if setvbuf exists
14863 set setvbuf d_setvbuf
14864 eval $inlibc
14865
14866 : see if sfio.h is available
14867 set sfio.h i_sfio
14868 eval $inhdr
14869
14870
14871 : see if sfio library is available
14872 case "$i_sfio" in
14873 $define)
14874         val=''
14875         set sfreserve val
14876         eval $inlibc
14877         ;;
14878 *)
14879         val="$undef"
14880         ;;
14881 esac
14882 : Ok, but do we want to use it.
14883 case "$val" in
14884 $define)
14885         case "$usesfio" in
14886         true|$define|[yY]*) dflt='y';;
14887         *) dflt='n';;
14888         esac
14889         echo "$package can use the sfio library, but it is experimental."
14890         case "$useperlio" in
14891         "$undef")
14892             echo "For sfio also the PerlIO abstraction layer is needed."
14893             echo "Earlier you said you wouldn't want that."
14894             ;;
14895         esac
14896         rp="You seem to have sfio available, do you want to try using it?"
14897         . ./myread
14898         case "$ans" in
14899         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
14900                 useperlio="$define"
14901                 val="$define"
14902                 ;;
14903         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
14904                 val="$undef"
14905                 ;;
14906         esac
14907         ;;
14908 *)      case "$usesfio" in
14909         true|$define|[yY]*)
14910                 echo "Sorry, cannot find sfio on this machine." >&4
14911                 echo "Ignoring your setting of usesfio=$usesfio." >&4
14912                 val="$undef"
14913                 ;;
14914         esac
14915         ;;
14916 esac
14917 set d_sfio
14918 eval $setvar
14919 case "$d_sfio" in
14920 $define) usesfio='true';;
14921 *) usesfio='false';;
14922 esac
14923 case "$d_sfio" in
14924 $define) ;;
14925 *)      : Remove sfio from list of libraries to use
14926         case "$libs" in
14927         *-lsfio*)
14928                 echo "Removing unneeded -lsfio from library list" >&4
14929                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
14930                 shift
14931                 libs="$*"
14932                 echo "libs = $libs" >&4
14933                 ;;
14934         esac
14935 ;;
14936 esac
14937
14938
14939 : see if shmctl exists
14940 set shmctl d_shmctl
14941 eval $inlibc
14942
14943 : see if shmget exists
14944 set shmget d_shmget
14945 eval $inlibc
14946
14947 : see if shmat exists
14948 set shmat d_shmat
14949 eval $inlibc
14950 : see what shmat returns
14951 case "$d_shmat" in
14952 "$define")
14953         $cat >shmat.c <<'END'
14954 #include <sys/shm.h>
14955 void *shmat();
14956 END
14957         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
14958                 shmattype='void *'
14959         else
14960                 shmattype='char *'
14961         fi
14962         echo "and it returns ($shmattype)." >&4
14963         : see if a prototype for shmat is available
14964         xxx=`./findhdr sys/shm.h`
14965         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
14966         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
14967                 val="$define"
14968         else
14969                 val="$undef"
14970         fi
14971         $rm -f shmat.[co]
14972         ;;
14973 *)
14974         val="$undef"
14975         ;;
14976 esac
14977 set d_shmatprototype
14978 eval $setvar
14979
14980 : see if shmdt exists
14981 set shmdt d_shmdt
14982 eval $inlibc
14983
14984 : see how much of the 'shm*(2)' library is present.
14985 h_shm=true
14986 echo " "
14987 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
14988 *"$undef"*) h_shm=false;;
14989 esac
14990 case "$osname" in
14991 freebsd)
14992     case "`ipcs 2>&1`" in
14993     "SVID shared memory"*"not configured"*)
14994         echo "Your $osname does not have the shm*(2) configured." >&4
14995         h_shm=false
14996         val="$undef"
14997         set shmctl d_shmctl
14998         evat $setvar
14999         set shmget d_shmget
15000         evat $setvar
15001         set shmat d_shmat
15002         evat $setvar
15003         set shmdt d_shmdt
15004         evat $setvar
15005         ;;
15006     esac
15007     ;;
15008 esac
15009 : we could also check for sys/ipc.h ...
15010 if $h_shm && $test `./findhdr sys/shm.h`; then
15011         echo "You have the full shm*(2) library." >&4
15012         val="$define"
15013 else
15014         echo "You don't have the full shm*(2) library." >&4
15015         val="$undef"
15016 fi
15017 set d_shm
15018 eval $setvar
15019
15020 echo " "
15021 : see if we have sigaction
15022 if set sigaction val -f d_sigaction; eval $csym; $val; then
15023         echo 'sigaction() found.' >&4
15024         $cat > try.c <<'EOP'
15025 #include <stdio.h>
15026 #include <sys/types.h>
15027 #include <signal.h>
15028 int main()
15029 {
15030     struct sigaction act, oact;
15031     act.sa_flags = 0;
15032     oact.sa_handler = 0;
15033     /* so that act and oact are used */
15034     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
15035 }
15036 EOP
15037         set try
15038         if eval $compile_ok; then
15039                 val="$define"
15040         else
15041                 echo "But you don't seem to have a useable struct sigaction." >&4
15042                 val="$undef"
15043         fi
15044 else
15045         echo 'sigaction NOT found.' >&4
15046         val="$undef"
15047 fi
15048 set d_sigaction; eval $setvar
15049 $rm -f try try$_o try.c
15050
15051 : see if sigprocmask exists
15052 set sigprocmask d_sigprocmask
15053 eval $inlibc
15054
15055 : see if sigsetjmp exists
15056 echo " "
15057 case "$d_sigsetjmp" in
15058 '')
15059         $cat >try.c <<'EOP'
15060 #include <setjmp.h>
15061 sigjmp_buf env;
15062 int set = 1;
15063 int main()
15064 {
15065         if (sigsetjmp(env,1))
15066                 exit(set);
15067         set = 0;
15068         siglongjmp(env, 1);
15069         exit(1);
15070 }
15071 EOP
15072         set try
15073         if eval $compile; then
15074                 if $run ./try >/dev/null 2>&1; then
15075                         echo "POSIX sigsetjmp found." >&4
15076                         val="$define"
15077                 else
15078                         $cat >&4 <<EOM
15079 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
15080 I'll ignore them.
15081 EOM
15082                         val="$undef"
15083                 fi
15084         else
15085                 echo "sigsetjmp not found." >&4
15086                 val="$undef"
15087         fi
15088         ;;
15089 *) val="$d_sigsetjmp"
15090         case "$d_sigsetjmp" in
15091         $define) echo "POSIX sigsetjmp found." >&4;;
15092         $undef) echo "sigsetjmp not found." >&4;;
15093         esac
15094         ;;
15095 esac
15096 set d_sigsetjmp
15097 eval $setvar
15098 $rm -f try.c try
15099
15100 : see if sockatmark exists
15101 set sockatmark d_sockatmark
15102 eval $inlibc
15103
15104 : see if prototype for sockatmark is available
15105 echo " "
15106 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
15107 eval $hasproto
15108
15109 : see if socks5_init exists
15110 set socks5_init d_socks5_init
15111 eval $inlibc
15112
15113 : see if srand48_r exists
15114 set srand48_r d_srand48_r
15115 eval $inlibc
15116 case "$d_srand48_r" in
15117 "$define")
15118         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15119         case "$d_srand48_r_proto:$usethreads" in
15120         ":define")      d_srand48_r_proto=define
15121                 set d_srand48_r_proto srand48_r $hdrs
15122                 eval $hasproto ;;
15123         *)      ;;
15124         esac
15125         case "$d_srand48_r_proto" in
15126         define)
15127         case "$srand48_r_proto" in
15128         ''|0) try='int srand48_r(long, struct drand48_data*);'
15129         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
15130         esac
15131         case "$srand48_r_proto" in
15132         ''|0)   d_srand48_r=undef
15133                 srand48_r_proto=0
15134                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
15135         * )     case "$srand48_r_proto" in
15136                 REENTRANT_PROTO*) ;;
15137                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
15138                 esac
15139                 echo "Prototype: $try" ;;
15140         esac
15141         ;;
15142         *)      case "$usethreads" in
15143                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
15144                 esac
15145                 d_srand48_r=undef
15146                 srand48_r_proto=0
15147                 ;;
15148         esac
15149         ;;
15150 *)      srand48_r_proto=0
15151         ;;
15152 esac
15153
15154 : see if srandom_r exists
15155 set srandom_r d_srandom_r
15156 eval $inlibc
15157 case "$d_srandom_r" in
15158 "$define")
15159         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15160         case "$d_srandom_r_proto:$usethreads" in
15161         ":define")      d_srandom_r_proto=define
15162                 set d_srandom_r_proto srandom_r $hdrs
15163                 eval $hasproto ;;
15164         *)      ;;
15165         esac
15166         case "$d_srandom_r_proto" in
15167         define)
15168         case "$srandom_r_proto" in
15169         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
15170         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
15171         esac
15172         case "$srandom_r_proto" in
15173         ''|0)   d_srandom_r=undef
15174                 srandom_r_proto=0
15175                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
15176         * )     case "$srandom_r_proto" in
15177                 REENTRANT_PROTO*) ;;
15178                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
15179                 esac
15180                 echo "Prototype: $try" ;;
15181         esac
15182         ;;
15183         *)      case "$usethreads" in
15184                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
15185                 esac
15186                 d_srandom_r=undef
15187                 srandom_r_proto=0
15188                 ;;
15189         esac
15190         ;;
15191 *)      srandom_r_proto=0
15192         ;;
15193 esac
15194
15195 : see if prototype for setresgid is available
15196 echo " "
15197 set d_sresgproto setresgid $i_unistd unistd.h
15198 eval $hasproto
15199
15200 : see if prototype for setresuid is available
15201 echo " "
15202 set d_sresuproto setresuid $i_unistd unistd.h
15203 eval $hasproto
15204
15205 : see if sys/stat.h is available
15206 set sys/stat.h i_sysstat
15207 eval $inhdr
15208
15209
15210 : see if stat knows about block sizes
15211 echo " "
15212 echo "Checking to see if your struct stat has st_blocks field..." >&4
15213 set d_statblks stat st_blocks $i_sysstat sys/stat.h
15214 eval $hasfield
15215
15216
15217 : see if this is a sys/vfs.h system
15218 set sys/vfs.h i_sysvfs
15219 eval $inhdr
15220
15221
15222 : see if this is a sys/statfs.h system
15223 set sys/statfs.h i_sysstatfs
15224 eval $inhdr
15225
15226
15227 echo " "
15228 echo "Checking to see if your system supports struct statfs..." >&4
15229 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
15230 eval $hasstruct
15231 case "$d_statfs_s" in
15232 "$define")      echo "Yes, it does."   ;;
15233 *)              echo "No, it doesn't." ;;
15234 esac
15235
15236
15237
15238 : see if struct statfs knows about f_flags
15239 case "$d_statfs_s" in
15240 define) 
15241         echo " "
15242         echo "Checking to see if your struct statfs has f_flags field..." >&4
15243         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
15244         eval $hasfield
15245         ;;
15246 *)      val="$undef"
15247         set d_statfs_f_flags
15248         eval $setvar
15249         ;;
15250 esac
15251 case "$d_statfs_f_flags" in
15252 "$define")      echo "Yes, it does."   ;;
15253 *)              echo "No, it doesn't." ;;
15254 esac
15255
15256 : see if _ptr and _cnt from stdio act std
15257 echo " "
15258
15259 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
15260         echo "(Looks like you have stdio.h from BSD.)"
15261         case "$stdio_ptr" in
15262         '') stdio_ptr='((fp)->_p)'
15263                 ptr_lval=$define
15264                 ;;
15265         *)      ptr_lval=$d_stdio_ptr_lval;;
15266         esac
15267         case "$stdio_cnt" in
15268         '') stdio_cnt='((fp)->_r)'
15269                 cnt_lval=$define
15270                 ;;
15271         *)      cnt_lval=$d_stdio_cnt_lval;;
15272         esac
15273         case "$stdio_base" in
15274         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
15275         esac
15276         case "$stdio_bufsiz" in
15277         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
15278         esac
15279 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
15280         echo "(Looks like you have stdio.h from Linux.)"
15281         case "$stdio_ptr" in
15282         '') stdio_ptr='((fp)->_IO_read_ptr)'
15283                 ptr_lval=$define
15284                 ;;
15285         *)      ptr_lval=$d_stdio_ptr_lval;;
15286         esac
15287         case "$stdio_cnt" in
15288         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
15289                 cnt_lval=$undef
15290                 ;;
15291         *)      cnt_lval=$d_stdio_cnt_lval;;
15292         esac
15293         case "$stdio_base" in
15294         '') stdio_base='((fp)->_IO_read_base)';;
15295         esac
15296         case "$stdio_bufsiz" in
15297         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
15298         esac
15299 else
15300         case "$stdio_ptr" in
15301         '') stdio_ptr='((fp)->_ptr)'
15302                 ptr_lval=$define
15303                 ;;
15304         *)      ptr_lval=$d_stdio_ptr_lval;;
15305         esac
15306         case "$stdio_cnt" in
15307         '') stdio_cnt='((fp)->_cnt)'
15308                 cnt_lval=$define
15309                 ;;
15310         *)      cnt_lval=$d_stdio_cnt_lval;;
15311         esac
15312         case "$stdio_base" in
15313         '') stdio_base='((fp)->_base)';;
15314         esac
15315         case "$stdio_bufsiz" in
15316         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
15317         esac
15318 fi
15319
15320 : test whether _ptr and _cnt really work
15321 echo "Checking how std your stdio is..." >&4
15322 $cat >try.c <<EOP
15323 #include <stdio.h>
15324 #define FILE_ptr(fp)    $stdio_ptr
15325 #define FILE_cnt(fp)    $stdio_cnt
15326 int main() {
15327         FILE *fp = fopen("try.c", "r");
15328         char c = getc(fp);
15329         if (
15330                 18 <= FILE_cnt(fp) &&
15331                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15332         )
15333                 exit(0);
15334         exit(1);
15335 }
15336 EOP
15337 val="$undef"
15338 set try
15339 if eval $compile && $to try.c; then
15340         if $run ./try; then
15341                 echo "Your stdio acts pretty std."
15342                 val="$define"
15343         else
15344                 echo "Your stdio isn't very std."
15345         fi
15346 else
15347         echo "Your stdio doesn't appear very std."
15348 fi
15349 $rm -f try.c try
15350 set d_stdstdio
15351 eval $setvar
15352
15353 : Can _ptr be used as an lvalue?
15354 case "$d_stdstdio$ptr_lval" in
15355 $define$define) val=$define ;;
15356 *) val=$undef ;;
15357 esac
15358 set d_stdio_ptr_lval
15359 eval $setvar
15360
15361 : Can _cnt be used as an lvalue?
15362 case "$d_stdstdio$cnt_lval" in
15363 $define$define) val=$define ;;
15364 *) val=$undef ;;
15365 esac
15366 set d_stdio_cnt_lval
15367 eval $setvar
15368
15369
15370 : test whether setting _ptr sets _cnt as a side effect
15371 d_stdio_ptr_lval_sets_cnt="$undef"
15372 d_stdio_ptr_lval_nochange_cnt="$undef"
15373 case "$d_stdio_ptr_lval$d_stdstdio" in
15374 $define$define)
15375         echo "Checking to see what happens if we set the stdio ptr..." >&4
15376 $cat >try.c <<EOP
15377 #include <stdio.h>
15378 /* Can we scream? */
15379 /* Eat dust sed :-) */
15380 /* In the buffer space, no one can hear you scream. */
15381 #define FILE_ptr(fp)    $stdio_ptr
15382 #define FILE_cnt(fp)    $stdio_cnt
15383 #include <sys/types.h>
15384 int main() {
15385         FILE *fp = fopen("try.c", "r");
15386         int c;
15387         char *ptr;
15388         size_t cnt;
15389         if (!fp) {
15390             puts("Fail even to read");
15391             exit(1);
15392         }
15393         c = getc(fp); /* Read away the first # */
15394         if (c == EOF) {
15395             puts("Fail even to read");
15396             exit(1);
15397         }
15398         if (!(
15399                 18 <= FILE_cnt(fp) &&
15400                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15401         )) {
15402                 puts("Fail even to read");
15403                 exit (1);
15404         }
15405         ptr = (char*) FILE_ptr(fp);
15406         cnt = (size_t)FILE_cnt(fp);
15407
15408         FILE_ptr(fp) += 42;
15409
15410         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
15411                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
15412                 exit (1);
15413         }
15414         if (FILE_cnt(fp) <= 20) {
15415                 printf ("Fail (<20 chars to test)");
15416                 exit (1);
15417         }
15418         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
15419                 puts("Fail compare");
15420                 exit (1);
15421         }
15422         if (cnt == FILE_cnt(fp)) {
15423                 puts("Pass_unchanged");
15424                 exit (0);
15425         }       
15426         if (FILE_cnt(fp) == (cnt - 42)) {
15427                 puts("Pass_changed");
15428                 exit (0);
15429         }
15430         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
15431         return 1;
15432
15433 }
15434 EOP
15435         set try
15436         if eval $compile && $to try.c; then
15437                 case `$run ./try` in
15438                 Pass_changed)
15439                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
15440                         d_stdio_ptr_lval_sets_cnt="$define" ;;
15441                 Pass_unchanged)
15442                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
15443                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
15444                 Fail*)
15445                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
15446                 *)
15447                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
15448         esac
15449         else
15450                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
15451         fi
15452         $rm -f try.c try
15453         ;;
15454 esac
15455
15456 : see if _base is also standard
15457 val="$undef"
15458 case "$d_stdstdio" in
15459 $define)
15460         $cat >try.c <<EOP
15461 #include <stdio.h>
15462 #define FILE_base(fp)   $stdio_base
15463 #define FILE_bufsiz(fp) $stdio_bufsiz
15464 int main() {
15465         FILE *fp = fopen("try.c", "r");
15466         char c = getc(fp);
15467         if (
15468                 19 <= FILE_bufsiz(fp) &&
15469                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
15470         )
15471                 exit(0);
15472         exit(1);
15473 }
15474 EOP
15475         set try
15476         if eval $compile && $to try.c; then
15477                 if $run ./try; then
15478                         echo "And its _base field acts std."
15479                         val="$define"
15480                 else
15481                         echo "But its _base field isn't std."
15482                 fi
15483         else
15484                 echo "However, it seems to be lacking the _base field."
15485         fi
15486         $rm -f try.c try
15487         ;;
15488 esac
15489 set d_stdiobase
15490 eval $setvar
15491
15492 $cat >&4 <<EOM
15493 Checking how to access stdio streams by file descriptor number...
15494 EOM
15495 case "$stdio_stream_array" in
15496 '')     $cat >try.c <<EOCP
15497 #include <stdio.h>
15498 int main() {
15499   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
15500     printf("yes\n");
15501 }
15502 EOCP
15503         for s in _iob __iob __sF
15504         do
15505                 set try -DSTDIO_STREAM_ARRAY=$s
15506                 if eval $compile; then
15507                         case "`$run ./try`" in
15508                         yes)    stdio_stream_array=$s; break ;;
15509                         esac
15510                 fi
15511         done
15512         $rm -f try.* try$exe_ext
15513 esac
15514 case "$stdio_stream_array" in
15515 '')     $cat >&4 <<EOM
15516 I can't figure out how to access stdio streams by file descriptor number.
15517 EOM
15518         d_stdio_stream_array="$undef"
15519         ;;
15520 *)      $cat >&4 <<EOM
15521 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
15522 EOM
15523         d_stdio_stream_array="$define"
15524         ;;
15525 esac
15526
15527 : see if strcoll exists
15528 set strcoll d_strcoll
15529 eval $inlibc
15530
15531 : check for structure copying
15532 echo " "
15533 echo "Checking to see if your C compiler can copy structs..." >&4
15534 $cat >try.c <<'EOCP'
15535 int main()
15536 {
15537         struct blurfl {
15538                 int dyick;
15539         } foo, bar;
15540
15541         foo = bar;
15542 }
15543 EOCP
15544 if $cc -c try.c >/dev/null 2>&1 ; then
15545         val="$define"
15546         echo "Yup, it can."
15547 else
15548         val="$undef"
15549         echo "Nope, it can't."
15550 fi
15551 set d_strctcpy
15552 eval $setvar
15553 $rm -f try.*
15554
15555 : see if strerror and/or sys_errlist[] exist
15556 echo " "
15557 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
15558     if set strerror val -f d_strerror; eval $csym; $val; then
15559                 echo 'strerror() found.' >&4
15560                 d_strerror="$define"
15561                 d_strerrm='strerror(e)'
15562                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
15563                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
15564                         d_syserrlst="$define"
15565                 else
15566                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
15567                         d_syserrlst="$undef"
15568                 fi
15569     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
15570                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
15571                 echo 'strerror() found in string header.' >&4
15572                 d_strerror="$define"
15573                 d_strerrm='strerror(e)'
15574                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
15575                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
15576                                 d_syserrlst="$define"
15577                 else
15578                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
15579                         d_syserrlst="$undef"
15580                 fi
15581     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
15582                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
15583                 d_strerror="$undef"
15584                 d_syserrlst="$define"
15585                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
15586     else
15587                 echo 'strerror() and sys_errlist[] NOT found.' >&4
15588                 d_strerror="$undef"
15589                 d_syserrlst="$undef"
15590                 d_strerrm='"unknown"'
15591     fi
15592 fi
15593
15594 : see if strerror_r exists
15595 set strerror_r d_strerror_r
15596 eval $inlibc
15597 case "$d_strerror_r" in
15598 "$define")
15599         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
15600         case "$d_strerror_r_proto:$usethreads" in
15601         ":define")      d_strerror_r_proto=define
15602                 set d_strerror_r_proto strerror_r $hdrs
15603                 eval $hasproto ;;
15604         *)      ;;
15605         esac
15606         case "$d_strerror_r_proto" in
15607         define)
15608         case "$strerror_r_proto" in
15609         ''|0) try='int strerror_r(int, char*, size_t);'
15610         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
15611         esac
15612         case "$strerror_r_proto" in
15613         ''|0) try='int strerror_r(int, char*, int);'
15614         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
15615         esac
15616         case "$strerror_r_proto" in
15617         ''|0) try='char* strerror_r(int, char*, size_t);'
15618         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
15619         esac
15620         case "$strerror_r_proto" in
15621         ''|0)   d_strerror_r=undef
15622                 strerror_r_proto=0
15623                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
15624         * )     case "$strerror_r_proto" in
15625                 REENTRANT_PROTO*) ;;
15626                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
15627                 esac
15628                 echo "Prototype: $try" ;;
15629         esac
15630         ;;
15631         *)      case "$usethreads" in
15632                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
15633                 esac
15634                 d_strerror_r=undef
15635                 strerror_r_proto=0
15636                 ;;
15637         esac
15638         ;;
15639 *)      strerror_r_proto=0
15640         ;;
15641 esac
15642
15643 : see if strftime exists
15644 set strftime d_strftime
15645 eval $inlibc
15646
15647 : see if strtod exists
15648 set strtod d_strtod
15649 eval $inlibc
15650
15651 : see if strtol exists
15652 set strtol d_strtol
15653 eval $inlibc
15654
15655 : see if strtold exists
15656 set strtold d_strtold
15657 eval $inlibc
15658
15659 : see if strtoll exists
15660 set strtoll d_strtoll
15661 eval $inlibc
15662
15663 case "$d_longlong-$d_strtoll" in
15664 "$define-$define")
15665         $cat <<EOM
15666 Checking whether your strtoll() works okay...
15667 EOM
15668         $cat >try.c <<'EOCP'
15669 #include <errno.h>
15670 #ifdef __hpux
15671 #define strtoll __strtoll
15672 #endif
15673 #ifdef __EMX__
15674 #define strtoll _strtoll
15675 #endif
15676 #include <stdio.h>
15677 extern long long int strtoll(char *s, char **, int); 
15678 static int bad = 0;
15679 int check(char *s, long long ell, int een) {
15680         long long gll;
15681         errno = 0;
15682         gll = strtoll(s, 0, 10);
15683         if (!((gll == ell) && (errno == een)))
15684                 bad++;
15685 }
15686 int main() {
15687         check(" 1",                                      1LL, 0);
15688         check(" 0",                                      0LL, 0);
15689         check("-1",                                     -1LL, 0);
15690         check("-9223372036854775808", -9223372036854775808LL, 0);
15691         check("-9223372036854775808", -9223372036854775808LL, 0);
15692         check(" 9223372036854775807",  9223372036854775807LL, 0);
15693         check("-9223372036854775808", -9223372036854775808LL, 0);
15694         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
15695         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
15696         if (!bad)
15697                 printf("ok\n");
15698 }
15699 EOCP
15700         set try
15701         if eval $compile; then
15702                 yyy=`$run ./try`
15703                 case "$yyy" in
15704                 ok) echo "Your strtoll() seems to be working okay." ;;
15705                 *) cat <<EOM >&4
15706 Your strtoll() doesn't seem to be working okay.
15707 EOM
15708                    d_strtoll="$undef"
15709                    ;;
15710                 esac
15711         else
15712                 echo "(I can't seem to compile the test program--assuming it doesn't)"
15713                 d_strtoll="$undef"
15714         fi
15715         ;;
15716 esac
15717
15718 : see if strtoq exists
15719 set strtoq d_strtoq
15720 eval $inlibc
15721
15722 : see if strtoul exists
15723 set strtoul d_strtoul
15724 eval $inlibc
15725
15726 case "$d_strtoul" in
15727 "$define")
15728         $cat <<EOM
15729 Checking whether your strtoul() works okay...
15730 EOM
15731         $cat >try.c <<'EOCP'
15732 #include <errno.h>
15733 #include <stdio.h>
15734 extern unsigned long int strtoul(char *s, char **, int); 
15735 static int bad = 0;
15736 void check(char *s, unsigned long eul, int een) {
15737         unsigned long gul;
15738         errno = 0;
15739         gul = strtoul(s, 0, 10);
15740         if (!((gul == eul) && (errno == een)))
15741                 bad++;
15742 }
15743 int main() {
15744         check(" 1", 1L, 0);
15745         check(" 0", 0L, 0);
15746 EOCP
15747         case "$longsize" in
15748         8)
15749             $cat >>try.c <<'EOCP'
15750         check("18446744073709551615", 18446744073709551615UL, 0);
15751         check("18446744073709551616", 18446744073709551615UL, ERANGE);
15752 #if 0 /* strtoul() for /^-/ strings is undefined. */
15753         check("-1", 18446744073709551615UL, 0);
15754         check("-18446744073709551614", 2, 0);
15755         check("-18446744073709551615", 1, 0);
15756         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
15757         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
15758 #endif
15759 EOCP
15760                 ;;
15761         4)
15762                     $cat >>try.c <<'EOCP'
15763         check("4294967295", 4294967295UL, 0);
15764         check("4294967296", 4294967295UL, ERANGE);
15765 #if 0 /* strtoul() for /^-/ strings is undefined. */
15766         check("-1", 4294967295UL, 0);
15767         check("-4294967294", 2, 0);
15768         check("-4294967295", 1, 0);
15769         check("-4294967296", 4294967295UL, ERANGE);
15770         check("-4294967297", 4294967295UL, ERANGE);
15771 #endif
15772 EOCP
15773                 ;;
15774         *)
15775 : Should we write these tests to be more portable by sprintf-ing
15776 : ~0 and then manipulating that char string as input for strtol?
15777                 ;;
15778         esac
15779         $cat >>try.c <<'EOCP'
15780         if (!bad)
15781                 printf("ok\n");
15782         return 0;
15783 }
15784 EOCP
15785         set try
15786         if eval $compile; then
15787                 case "`$run ./try`" in
15788                 ok) echo "Your strtoul() seems to be working okay." ;;
15789                 *) cat <<EOM >&4
15790 Your strtoul() doesn't seem to be working okay.
15791 EOM
15792                    d_strtoul="$undef"
15793                    ;;
15794                 esac
15795         fi
15796         ;;
15797 esac
15798
15799 : see if strtoull exists
15800 set strtoull d_strtoull
15801 eval $inlibc
15802
15803 case "$d_longlong-$d_strtoull" in
15804 "$define-$define")
15805         $cat <<EOM
15806 Checking whether your strtoull() works okay...
15807 EOM
15808         $cat >try.c <<'EOCP'
15809 #include <errno.h>
15810 #ifdef __hpux
15811 #define strtoull __strtoull
15812 #endif
15813 #include <stdio.h>
15814 extern unsigned long long int strtoull(char *s, char **, int); 
15815 static int bad = 0;
15816 int check(char *s, long long eull, int een) {
15817         long long gull;
15818         errno = 0;
15819         gull = strtoull(s, 0, 10);
15820         if (!((gull == eull) && (errno == een)))
15821                 bad++;
15822 }
15823 int main() {
15824         check(" 1",                                        1LL, 0);
15825         check(" 0",                                        0LL, 0);
15826         check("18446744073709551615",  18446744073709551615ULL, 0);
15827         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
15828 #if 0 /* strtoull() for /^-/ strings is undefined. */
15829         check("-1",                    18446744073709551615ULL, 0);
15830         check("-18446744073709551614",                     2LL, 0);
15831         check("-18446744073709551615",                     1LL, 0);
15832         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
15833         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
15834 #endif
15835         if (!bad)
15836                 printf("ok\n");
15837 }
15838 EOCP
15839         set try
15840         if eval $compile; then
15841                 case "`$run ./try`" in
15842                 ok) echo "Your strtoull() seems to be working okay." ;;
15843                 *) cat <<EOM >&4
15844 Your strtoull() doesn't seem to be working okay.
15845 EOM
15846                    d_strtoull="$undef"
15847                    ;;
15848                 esac
15849         fi
15850         ;;
15851 esac
15852
15853 : see if strtouq exists
15854 set strtouq d_strtouq
15855 eval $inlibc
15856
15857 case "$d_strtouq" in
15858 "$define")
15859         $cat <<EOM
15860 Checking whether your strtouq() works okay...
15861 EOM
15862         $cat >try.c <<'EOCP'
15863 #include <errno.h>
15864 #include <stdio.h>
15865 extern unsigned long long int strtouq(char *s, char **, int); 
15866 static int bad = 0;
15867 void check(char *s, unsigned long long eull, int een) {
15868         unsigned long long gull;
15869         errno = 0;
15870         gull = strtouq(s, 0, 10);
15871         if (!((gull == eull) && (errno == een)))
15872                 bad++;
15873 }
15874 int main() {
15875         check(" 1",                                        1LL, 0);
15876         check(" 0",                                        0LL, 0);
15877         check("18446744073709551615",  18446744073709551615ULL, 0);
15878         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
15879 #if 0 /* strtouq() for /^-/ strings is undefined. */
15880         check("-1",                    18446744073709551615ULL, 0);
15881         check("-18446744073709551614",                     2LL, 0);
15882         check("-18446744073709551615",                     1LL, 0);
15883         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
15884         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
15885 #endif
15886         if (!bad)
15887                 printf("ok\n");
15888         return 0;
15889 }
15890 EOCP
15891         set try
15892         if eval $compile; then
15893                 case "`$run ./try`" in
15894                 ok) echo "Your strtouq() seems to be working okay." ;;
15895                 *) cat <<EOM >&4
15896 Your strtouq() doesn't seem to be working okay.
15897 EOM
15898                    d_strtouq="$undef"
15899                    ;;
15900                 esac
15901         fi
15902         ;;
15903 esac
15904
15905 : see if strxfrm exists
15906 set strxfrm d_strxfrm
15907 eval $inlibc
15908
15909 : see if symlink exists
15910 set symlink d_symlink
15911 eval $inlibc
15912
15913 : see if syscall exists
15914 set syscall d_syscall
15915 eval $inlibc
15916
15917 : see if prototype for syscall is available
15918 echo " "
15919 set d_syscallproto syscall $i_unistd unistd.h
15920 eval $hasproto
15921
15922 : see if sysconf exists
15923 set sysconf d_sysconf
15924 eval $inlibc
15925
15926 : see if system exists
15927 set system d_system
15928 eval $inlibc
15929
15930 : see if tcgetpgrp exists
15931 set tcgetpgrp d_tcgetpgrp
15932 eval $inlibc
15933
15934 : see if tcsetpgrp exists
15935 set tcsetpgrp d_tcsetpgrp
15936 eval $inlibc
15937
15938 : see if prototype for telldir is available
15939 echo " "
15940 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
15941 eval $hasproto
15942
15943 : see if time exists
15944 echo " "
15945 if test "X$d_time" = X -o X"$timetype" = X; then
15946     if set time val -f d_time; eval $csym; $val; then
15947                 echo 'time() found.' >&4
15948                 val="$define"
15949                 rp="What is the type returned by time() on this system?"
15950                 set time_t timetype long stdio.h sys/types.h
15951                 eval $typedef_ask
15952     else
15953                 echo 'time() not found, hope that will do.' >&4
15954                 val="$undef"
15955                 timetype='int';
15956     fi
15957     set d_time
15958     eval $setvar
15959 fi
15960
15961 : see if this is a sys/times.h system
15962 set sys/times.h i_systimes
15963 eval $inhdr
15964
15965 : see if times exists
15966 echo " "
15967 if set times val -f d_times; eval $csym; $val; then
15968         echo 'times() found.' >&4
15969         d_times="$define"
15970         inc=''
15971         case "$i_systimes" in
15972         "$define") inc='sys/times.h';;
15973         esac
15974         rp="What is the type returned by times() on this system?"
15975         set clock_t clocktype long stdio.h sys/types.h $inc
15976         eval $typedef_ask
15977 else
15978         echo 'times() NOT found, hope that will do.' >&4
15979         d_times="$undef"
15980         clocktype='int'
15981 fi
15982
15983 : see if tmpnam_r exists
15984 set tmpnam_r d_tmpnam_r
15985 eval $inlibc
15986 case "$d_tmpnam_r" in
15987 "$define")
15988         hdrs="$i_systypes sys/types.h define stdio.h "
15989         case "$d_tmpnam_r_proto:$usethreads" in
15990         ":define")      d_tmpnam_r_proto=define
15991                 set d_tmpnam_r_proto tmpnam_r $hdrs
15992                 eval $hasproto ;;
15993         *)      ;;
15994         esac
15995         case "$d_tmpnam_r_proto" in
15996         define)
15997         case "$tmpnam_r_proto" in
15998         ''|0) try='char* tmpnam_r(char*);'
15999         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
16000         esac
16001         case "$tmpnam_r_proto" in
16002         ''|0)   d_tmpnam_r=undef
16003                 tmpnam_r_proto=0
16004                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
16005         * )     case "$tmpnam_r_proto" in
16006                 REENTRANT_PROTO*) ;;
16007                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
16008                 esac
16009                 echo "Prototype: $try" ;;
16010         esac
16011         ;;
16012         *)      case "$usethreads" in
16013                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
16014                 esac
16015                 d_tmpnam_r=undef
16016                 tmpnam_r_proto=0
16017                 ;;
16018         esac
16019         ;;
16020 *)      tmpnam_r_proto=0
16021         ;;
16022 esac
16023
16024 : see if truncate exists
16025 set truncate d_truncate
16026 eval $inlibc
16027
16028 : see if ttyname_r exists
16029 set ttyname_r d_ttyname_r
16030 eval $inlibc
16031 case "$d_ttyname_r" in
16032 "$define")
16033         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
16034         case "$d_ttyname_r_proto:$usethreads" in
16035         ":define")      d_ttyname_r_proto=define
16036                 set d_ttyname_r_proto ttyname_r $hdrs
16037                 eval $hasproto ;;
16038         *)      ;;
16039         esac
16040         case "$d_ttyname_r_proto" in
16041         define)
16042         case "$ttyname_r_proto" in
16043         ''|0) try='int ttyname_r(int, char*, size_t);'
16044         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
16045         esac
16046         case "$ttyname_r_proto" in
16047         ''|0) try='int ttyname_r(int, char*, int);'
16048         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
16049         esac
16050         case "$ttyname_r_proto" in
16051         ''|0) try='char* ttyname_r(int, char*, int);'
16052         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
16053         esac
16054         case "$ttyname_r_proto" in
16055         ''|0)   d_ttyname_r=undef
16056                 ttyname_r_proto=0
16057                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
16058         * )     case "$ttyname_r_proto" in
16059                 REENTRANT_PROTO*) ;;
16060                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
16061                 esac
16062                 echo "Prototype: $try" ;;
16063         esac
16064         ;;
16065         *)      case "$usethreads" in
16066                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
16067                 esac
16068                 d_ttyname_r=undef
16069                 ttyname_r_proto=0
16070                 ;;
16071         esac
16072         ;;
16073 *)      ttyname_r_proto=0
16074         ;;
16075 esac
16076
16077 : see if tzname[] exists
16078 echo " "
16079 if set tzname val -a d_tzname; eval $csym; $val; then
16080         val="$define"
16081         echo 'tzname[] found.' >&4
16082 else
16083         val="$undef"
16084         echo 'tzname[] NOT found.' >&4
16085 fi
16086 set d_tzname
16087 eval $setvar
16088
16089 case "$osname" in
16090 next|rhapsody|darwin) multiarch="$define" ;;
16091 esac
16092 case "$multiarch" in
16093 ''|[nN]*) multiarch="$undef" ;;
16094 esac
16095
16096 : check for ordering of bytes in a UV
16097 echo " "
16098 case "$usecrosscompile$multiarch" in
16099 *$define*)
16100         $cat <<EOM
16101 You seem to be either cross-compiling or doing a multiarchitecture build,
16102 skipping the byteorder check.
16103
16104 EOM
16105         byteorder='ffff'
16106         ;;
16107 *)
16108         case "$byteorder" in
16109         '')
16110                 $cat <<'EOM'
16111 In the following, larger digits indicate more significance.  A big-endian
16112 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
16113 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
16114 machines may have weird orders like 3412.  A Cray will report 87654321,
16115 an Alpha will report 12345678. If the test program works the default is
16116 probably right.
16117 I'm now running the test program...
16118 EOM
16119                 $cat >try.c <<EOCP
16120 #include <stdio.h>
16121 #include <sys/types.h>
16122 typedef $uvtype UV;
16123 int main()
16124 {
16125         int i;
16126         union {
16127                 UV l;
16128                 char c[$uvsize];
16129         } u;
16130
16131         if ($uvsize > 4)
16132                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
16133         else
16134                 u.l = (UV)0x04030201;
16135         for (i = 0; i < $uvsize; i++)
16136                 printf("%c", u.c[i]+'0');
16137         printf("\n");
16138         exit(0);
16139 }
16140 EOCP
16141                 xxx_prompt=y
16142                 set try
16143                 if eval $compile && ./try > /dev/null; then
16144                         dflt=`$run ./try`
16145                         case "$dflt" in
16146                         [1-4][1-4][1-4][1-4]|12345678|87654321)
16147                                 echo "(The test program ran ok.)"
16148                                 echo "byteorder=$dflt"
16149                                 xxx_prompt=n
16150                         ;;
16151                         ????|????????) echo "(The test program ran ok.)" ;;
16152                         *) echo "(The test program didn't run right for some reason.)" ;;
16153                         esac
16154                 else
16155                         dflt='4321'
16156                         cat <<'EOM'
16157 (I can't seem to compile the test program.  Guessing big-endian...)
16158 EOM
16159                 fi
16160                 case "$xxx_prompt" in
16161                 y)
16162                         rp="What is the order of bytes in $uvtype?"
16163                         . ./myread
16164                         byteorder="$ans"
16165                         ;;
16166                 *)      byteorder=$dflt
16167                         ;;
16168                 esac
16169                 ;;
16170         esac
16171         $rm -f try.c try
16172         ;;
16173 esac
16174
16175
16176 $cat <<EOM
16177
16178 Checking to see whether you can access character data unalignedly...
16179 EOM
16180 case "$d_u32align" in
16181 '')   $cat >try.c <<EOCP
16182 #include <stdio.h>
16183 #define U32 $u32type
16184 #define BYTEORDER 0x$byteorder
16185 #define U8 $u8type
16186 #include <signal.h>
16187 #ifdef SIGBUS
16188 $signal_t bletch(s) int s; { exit(4); }
16189 #endif
16190 int main() {
16191 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
16192     U8 buf[8];
16193     U32 *up;
16194     int i;
16195
16196     if (sizeof(U32) != 4) {
16197         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
16198         exit(1);
16199     }
16200
16201     fflush(stdout);
16202
16203 #ifdef SIGBUS
16204     signal(SIGBUS, bletch);
16205 #endif
16206
16207     buf[0] = 0;
16208     buf[1] = 0;
16209     buf[2] = 0;
16210     buf[3] = 1;
16211     buf[5] = 0;
16212     buf[6] = 0;
16213     buf[7] = 0;
16214     buf[8] = 1;
16215
16216     for (i = 0; i < 4; i++) {
16217         up = (U32*)(buf + i);
16218         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
16219                (*up == 1 << (8*(3-i)))  /* little-endian */
16220               )
16221            )
16222         {
16223             printf("read failed (%x)\n", *up);
16224             exit(2);
16225         }
16226     }
16227
16228     /* write test */
16229     for (i = 0; i < 4; i++) {
16230         up = (U32*)(buf + i);
16231         *up = 0xBeef;
16232         if (*up != 0xBeef) {
16233             printf("write failed (%x)\n", *up);
16234             exit(3);
16235         }
16236     }
16237
16238     exit(0);
16239 #else
16240     printf("1\n");
16241     exit(1);
16242 #endif
16243     return 0;
16244 }
16245 EOCP
16246 set try
16247 if eval $compile_ok; then
16248         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
16249         $run ./try 2>&1 >/dev/null
16250         case "$?" in
16251         0)      cat >&4 <<EOM
16252 You can access character data pretty unalignedly.
16253 EOM
16254                 d_u32align="$undef"
16255                 ;;
16256         *)      cat >&4 <<EOM
16257 It seems that you must access character data in an aligned manner.
16258 EOM
16259                 d_u32align="$define"
16260                 ;;
16261         esac
16262 else
16263         rp='Can you access character data at unaligned addresses?'
16264         dflt='n'
16265         . ./myread
16266         case "$ans" in
16267         [yY]*)  d_u32align="$undef"  ;;
16268         *)      d_u32align="$define" ;;
16269         esac
16270 fi
16271 $rm -f core core.try.* try.core
16272 ;;
16273 esac
16274
16275 : see if ualarm exists
16276 set ualarm d_ualarm
16277 eval $inlibc
16278
16279 : see if umask exists
16280 set umask d_umask
16281 eval $inlibc
16282
16283 : see if unordered exists
16284 set unordered d_unordered
16285 eval $inlibc
16286
16287 : see if usleep exists
16288 set usleep d_usleep
16289 eval $inlibc
16290
16291 : see if prototype for usleep is available
16292 echo " "
16293 set d_usleepproto usleep $i_unistd unistd.h
16294 eval $hasproto
16295
16296 : see if ustat exists
16297 set ustat d_ustat
16298 eval $inlibc
16299
16300 : backward compatibility for d_hvfork
16301 if test X$d_hvfork != X; then
16302         d_vfork="$d_hvfork"
16303         d_hvfork=''
16304 fi
16305 : see if there is a vfork
16306 val=''
16307 set vfork val
16308 eval $inlibc
16309
16310 : Ok, but do we want to use it. vfork is reportedly unreliable in 
16311 : perl on Solaris 2.x, and probably elsewhere.
16312 case "$val" in
16313 $define)
16314         echo " "
16315         case "$usevfork" in
16316         false) dflt='n';;
16317         *) dflt='y';;
16318         esac
16319         cat <<'EOM'
16320  
16321 Perl can only use a vfork() that doesn't suffer from strict
16322 restrictions on calling functions or modifying global data in
16323 the child.  For example, glibc-2.1 contains such a vfork()
16324 that is unsuitable.  If your system provides a proper fork()
16325 call, chances are that you do NOT want perl to use vfork().
16326
16327 EOM
16328         rp="Do you still want to use vfork()?"
16329         . ./myread
16330         case "$ans" in
16331         y|Y) ;;
16332         *)
16333                 echo "Ok, we won't use vfork()."
16334                 val="$undef"
16335                 ;;
16336         esac
16337         ;;
16338 esac
16339 set d_vfork
16340 eval $setvar
16341 case "$d_vfork" in
16342 $define) usevfork='true';;
16343 *) usevfork='false';;
16344 esac
16345
16346 : see if closedir exists
16347 set closedir d_closedir
16348 eval $inlibc
16349
16350 case "$d_closedir" in
16351 "$define")
16352         echo " "
16353         echo "Checking whether closedir() returns a status..." >&4
16354         cat > try.c <<EOM
16355 #$i_dirent I_DIRENT             /**/
16356 #$i_sysdir I_SYS_DIR            /**/
16357 #$i_sysndir I_SYS_NDIR          /**/
16358 #$i_systypes I_SYS_TYPES        /**/
16359
16360 #if defined(I_SYS_TYPES)
16361 #include <sys/types.h>
16362 #endif
16363 #if defined(I_DIRENT)
16364 #include <dirent.h>
16365 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
16366 #include <sys/dir.h>
16367 #endif
16368 #else
16369 #ifdef I_SYS_NDIR
16370 #include <sys/ndir.h>
16371 #else
16372 #ifdef I_SYS_DIR
16373 #ifdef hp9000s500
16374 #include <ndir.h>       /* may be wrong in the future */
16375 #else
16376 #include <sys/dir.h>
16377 #endif
16378 #endif
16379 #endif
16380 #endif 
16381 int main() { return closedir(opendir(".")); }
16382 EOM
16383         set try
16384         if eval $compile_ok; then
16385                 if $run ./try > /dev/null 2>&1 ; then
16386                         echo "Yes, it does."
16387                         val="$undef"
16388                 else
16389                         echo "No, it doesn't."
16390                         val="$define"
16391                 fi
16392         else
16393                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16394                 val="$define"
16395         fi
16396         ;;
16397 *)
16398         val="$undef";
16399         ;;
16400 esac
16401 set d_void_closedir
16402 eval $setvar
16403 $rm -f try try.*
16404 : see if there is a wait4
16405 set wait4 d_wait4
16406 eval $inlibc
16407
16408 : see if waitpid exists
16409 set waitpid d_waitpid
16410 eval $inlibc
16411
16412 : see if wcstombs exists
16413 set wcstombs d_wcstombs
16414 eval $inlibc
16415
16416 : see if wctomb exists
16417 set wctomb d_wctomb
16418 eval $inlibc
16419
16420 : see if writev exists
16421 set writev d_writev
16422 eval $inlibc
16423
16424 : preserve RCS keywords in files with variable substitution, grrr
16425 Date='$Date'
16426 Id='$Id'
16427 Log='$Log'
16428 RCSfile='$RCSfile'
16429 Revision='$Revision'
16430
16431 : check for alignment requirements
16432 echo " "
16433 case "$usecrosscompile$multiarch" in
16434 *$define*)
16435         $cat <<EOM
16436 You seem to be either cross-compiling or doing a multiarchitecture build,
16437 skipping the memory alignment check.
16438
16439 EOM
16440         case "$alignbytes" in
16441         '') alignbytes=8 ;;
16442         esac
16443         ;;
16444 *)
16445         case "$alignbytes" in
16446         '') echo "Checking alignment constraints..." >&4
16447                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
16448                         $cat >try.c <<'EOCP'
16449 typedef long double NV;
16450 EOCP
16451                 else
16452                         $cat >try.c <<'EOCP'
16453 typedef double NV;
16454 EOCP
16455                 fi
16456                 $cat >>try.c <<'EOCP'
16457 #include <stdio.h>
16458 struct foobar {
16459         char foo;
16460         NV bar;
16461 } try_algn;
16462 int main()
16463 {
16464     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
16465     return(0);
16466 }
16467 EOCP
16468                 set try
16469                 if eval $compile_ok; then
16470                         dflt=`$run ./try`
16471                 else
16472                         dflt='8'
16473                         echo "(I can't seem to compile the test program...)"
16474                 fi
16475                 ;;
16476         *) dflt="$alignbytes"
16477                 ;;
16478         esac
16479         rp="Doubles must be aligned on a how-many-byte boundary?"
16480         . ./myread
16481         alignbytes="$ans"
16482         $rm -f try.c try
16483         ;;
16484 esac
16485
16486
16487 : set the base revision
16488 baserev=5.0
16489
16490 : how do we catenate cpp tokens here?
16491 echo " "
16492 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
16493 $cat >cpp_stuff.c <<'EOCP'
16494 #define RCAT(a,b)a/**/b
16495 #define ACAT(a,b)a ## b
16496 RCAT(Rei,ser)
16497 ACAT(Cir,cus)
16498 EOCP
16499 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
16500 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
16501         echo "Oh!  Smells like ANSI's been here." >&4
16502         echo "We can catify or stringify, separately or together!"
16503         cpp_stuff=42
16504 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
16505         echo "Ah, yes!  The good old days!" >&4
16506         echo "However, in the good old days we don't know how to stringify and"
16507         echo "catify at the same time."
16508         cpp_stuff=1
16509 else
16510         $cat >&4 <<EOM
16511 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
16512 to have to edit the values of CAT[2-5] in config.h...
16513 EOM
16514         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
16515 fi
16516 $rm -f cpp_stuff.*
16517
16518 : see if this is a db.h system
16519 set db.h i_db
16520 eval $inhdr
16521
16522 case "$i_db" in
16523 $define)
16524         : Check db version.
16525         echo " "
16526         echo "Checking Berkeley DB version ..." >&4
16527         $cat >try.c <<EOCP
16528 #$d_const HASCONST
16529 #ifndef HASCONST
16530 #define const
16531 #endif
16532 #include <sys/types.h>
16533 #include <stdio.h>
16534 #include <db.h>
16535 int main(int argc, char *argv[])
16536 {
16537 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
16538     int Major, Minor, Patch ;
16539     unsigned long Version ;
16540     (void)db_version(&Major, &Minor, &Patch) ;
16541     if (argc == 2) {
16542         printf("%d %d %d %d %d %d\n",
16543                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
16544                Major, Minor, Patch);
16545         exit(0);
16546     }
16547     printf("You have Berkeley DB Version 2 or greater.\n");
16548
16549     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
16550                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
16551     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
16552                 Major, Minor, Patch) ;
16553
16554     /* check that db.h & libdb are compatible */
16555     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
16556         printf("db.h and libdb are incompatible.\n") ;
16557         exit(3);        
16558     }
16559
16560     printf("db.h and libdb are compatible.\n") ;
16561
16562     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
16563                 + DB_VERSION_PATCH ;
16564
16565     /* needs to be >= 2.3.4 */
16566     if (Version < 2003004) {
16567     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
16568         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
16569         exit(2);        
16570     }
16571
16572     exit(0);
16573 #else
16574 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
16575     if (argc == 2) {
16576         printf("1 0 0\n");
16577         exit(0);
16578     }
16579     printf("You have Berkeley DB Version 1.\n");
16580     exit(0);    /* DB version < 2: the coast is clear. */
16581 #else
16582     exit(1);    /* <db.h> not Berkeley DB? */
16583 #endif
16584 #endif
16585 }
16586 EOCP
16587         set try
16588         if eval $compile_ok && $run ./try; then
16589                 echo 'Looks OK.' >&4
16590                 set `$run ./try 1`
16591                 db_version_major=$1
16592                 db_version_minor=$2
16593                 db_version_patch=$3
16594         else
16595                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
16596                 i_db=$undef
16597                 case " $libs " in
16598                 *"-ldb "*)
16599                         : Remove db from list of libraries to use
16600                         echo "Removing unusable -ldb from library list" >&4
16601                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
16602                         shift
16603                         libs="$*"
16604                         echo "libs = $libs" >&4
16605                         ;;
16606                 esac
16607         fi
16608         $rm -f try.*
16609         ;;
16610 esac
16611
16612 case "$i_db" in
16613 define)
16614         : Check the return type needed for hash 
16615         echo " "
16616         echo "Checking return type needed for hash for Berkeley DB ..." >&4
16617         $cat >try.c <<EOCP
16618 #$d_const HASCONST
16619 #ifndef HASCONST
16620 #define const
16621 #endif
16622 #include <sys/types.h>
16623 #include <db.h>
16624
16625 #ifndef DB_VERSION_MAJOR
16626 u_int32_t hash_cb (ptr, size)
16627 const void *ptr;
16628 size_t size;
16629 {
16630 }
16631 HASHINFO info;
16632 int main()
16633 {
16634         info.hash = hash_cb;
16635 }
16636 #endif
16637 EOCP
16638         if $cc $ccflags -c try.c >try.out 2>&1 ; then
16639                 if $contains warning try.out >>/dev/null 2>&1 ; then
16640                         db_hashtype='int'
16641                 else
16642                         db_hashtype='u_int32_t'
16643                 fi
16644         else
16645                 : XXX Maybe we should just give up here.
16646                 db_hashtype=u_int32_t
16647                 $cat try.out >&4
16648                 echo "Help:  I can't seem to compile the db test program." >&4
16649                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
16650         fi
16651         $rm -f try.*
16652         echo "Your version of Berkeley DB uses $db_hashtype for hash."
16653         ;;
16654 *)      db_hashtype=u_int32_t
16655         ;;
16656 esac
16657 case "$i_db" in
16658 define)
16659         : Check the return type needed for prefix 
16660         echo " "
16661         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
16662         cat >try.c <<EOCP
16663 #$d_const HASCONST
16664 #ifndef HASCONST
16665 #define const
16666 #endif
16667 #include <sys/types.h>
16668 #include <db.h>
16669
16670 #ifndef DB_VERSION_MAJOR
16671 size_t prefix_cb (key1, key2)
16672 const DBT *key1;
16673 const DBT *key2;
16674 {
16675 }
16676 BTREEINFO info;
16677 int main()
16678 {
16679         info.prefix = prefix_cb;
16680 }
16681 #endif
16682 EOCP
16683         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
16684                 if $contains warning try.out >>/dev/null 2>&1 ; then
16685                         db_prefixtype='int'
16686                 else
16687                         db_prefixtype='size_t'
16688                 fi
16689         else
16690                 db_prefixtype='size_t'
16691                 : XXX Maybe we should just give up here.
16692                 $cat try.out >&4
16693                 echo "Help:  I can't seem to compile the db test program." >&4
16694                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
16695         fi
16696         $rm -f try.*
16697         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
16698         ;;
16699 *)      db_prefixtype='size_t'
16700         ;;
16701 esac
16702
16703
16704 : How can we generate normalized random numbers ?
16705 echo " "
16706 echo "Looking for a random number function..." >&4
16707 case "$randfunc" in
16708 '')
16709         if set drand48 val -f; eval $csym; $val; then
16710                 dflt="drand48"
16711                 echo "Good, found drand48()." >&4
16712         elif set random val -f; eval $csym; $val; then
16713                 dflt="random"
16714                 echo "OK, found random()." >&4
16715         else
16716                 dflt="rand"
16717                 echo "Yick, looks like I have to use rand()." >&4
16718         fi
16719         echo " "
16720         ;;
16721 *)
16722         dflt="$randfunc"
16723         ;;
16724 esac
16725 cont=true
16726
16727 case "$ccflags" in
16728 *-Dmy_rand=*|*-Dmy_srand=*)
16729         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
16730         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
16731         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
16732         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
16733         ;;
16734 esac
16735
16736 while $test "$cont"; do
16737         rp="Use which function to generate random numbers?"
16738         . ./myread
16739         if $test "$ans" = "$dflt"; then
16740                 : null
16741         else
16742                 randbits=''
16743         fi
16744         randfunc="$ans"
16745         if set $ans val -f; eval $csym; $val; then
16746                 cont=''
16747         else
16748                 dflt=y
16749                 rp="I cannot find function $ans. Use that name anyway?"
16750                 . ./myread
16751                 dflt=rand
16752                 case "$ans" in
16753                         [yY]*) cont='';;
16754                 esac
16755         fi
16756         case "$cont" in
16757         '')
16758                 case "$randfunc" in
16759                 drand48)
16760                         drand01="drand48()"
16761                         seedfunc="srand48"
16762                         randbits=48
16763                         randseedtype=long
16764                         ;;
16765                 rand|random)
16766                         case "$randbits" in
16767                         '')
16768 echo "Checking to see how many bits your $randfunc() function produces..." >&4
16769                                 $cat >try.c <<EOCP
16770 #$i_unistd I_UNISTD
16771 #$i_stdlib I_STDLIB
16772 #include <stdio.h>
16773 #ifdef I_UNISTD
16774 #  include <unistd.h>
16775 #endif
16776 #ifdef I_STDLIB
16777 #  include <stdlib.h>
16778 #endif
16779 int main()
16780 {
16781         register int i;
16782         register unsigned long tmp;
16783         register unsigned long max = 0L;
16784
16785         for (i = 1000; i; i--) {
16786                 tmp = (unsigned long) $randfunc();
16787                 if (tmp > max) max = tmp;
16788         }
16789         for (i = 0; max; i++)
16790                 max /= 2;
16791         printf("%d\n",i);
16792 }
16793 EOCP
16794                                 set try
16795                                 if eval $compile_ok; then
16796                                         dflt=`try`
16797                                 else
16798                                         dflt='?'
16799                                         echo "(I can't seem to compile the test program...)"
16800                                 fi
16801                                 ;;
16802                         *)
16803                                 dflt="$randbits"
16804                                 ;;
16805                         esac
16806                         rp="How many bits does your $randfunc() function produce?"
16807                         . ./myread
16808                         randbits="$ans"
16809                         $rm -f try.c try
16810                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
16811                         seedfunc="s$randfunc"
16812                         randseedtype=unsigned
16813                         ;;
16814                 *)
16815                         dflt="31"
16816                         rp="How many bits does your $randfunc() function produce?"
16817                         . ./myread
16818                         randbits="$ans"
16819                         seedfunc="s$randfunc"
16820                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
16821                         if set $seedfunc val -f; eval $csym; $val; then
16822                                 echo "(Using $seedfunc() to seed random generator)"
16823                         else
16824                                 echo "(Warning: no $seedfunc() to seed random generator)"
16825                                 seedfunc=rand
16826                         fi
16827                         randseedtype=unsigned
16828                         ;;
16829                 esac
16830                 ;;
16831         esac
16832 done
16833
16834 echo " "
16835 echo "Determining whether or not we are on an EBCDIC system..." >&4
16836 $cat >try.c <<'EOM'
16837 int main()
16838 {
16839   if ('M'==0xd4) return 0;
16840   return 1;
16841 }
16842 EOM
16843
16844 val=$undef
16845 set try
16846 if eval $compile_ok; then
16847         if $run ./try; then
16848                 echo "You seem to speak EBCDIC." >&4
16849                 val="$define"
16850         else
16851                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
16852         fi
16853 else
16854         echo "I'm unable to compile the test program." >&4
16855         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
16856 fi
16857 $rm -f try try.*
16858 set ebcdic
16859 eval $setvar
16860
16861 echo " "
16862 $cat >&4 <<EOM
16863 Checking how to flush all pending stdio output...
16864 EOM
16865 # I only know how to find the first 32 possibly open files on SunOS.
16866 # See also hints/sunos_4_1.sh and util.c  --AD
16867 case "$osname" in
16868 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
16869 esac
16870 $cat >>try.c <<EOCP
16871 #include <stdio.h>
16872 #$i_unistd I_UNISTD
16873 #ifdef I_UNISTD
16874 # include <unistd.h>
16875 #endif
16876 #$d_sysconf HAS_SYSCONF
16877 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
16878 #ifdef HAS_STDIO_STREAM_ARRAY
16879 # define STDIO_STREAM_ARRAY $stdio_stream_array
16880 #endif
16881 int main() {
16882   FILE* p;
16883   unlink("try.out");
16884   p = fopen("try.out", "w");
16885 #ifdef TRY_FPUTC
16886   fputc('x', p);
16887 #else
16888 # ifdef TRY_FPRINTF
16889   fprintf(p, "x");
16890 # endif
16891 #endif
16892 #ifdef TRY_FFLUSH_NULL
16893   fflush(NULL);
16894 #endif
16895 #ifdef TRY_FFLUSH_ALL
16896   {
16897     long open_max = -1;
16898 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
16899     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
16900 # else
16901 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
16902     open_max = sysconf(_SC_OPEN_MAX);
16903 #  else
16904 #   ifdef FOPEN_MAX
16905     open_max = FOPEN_MAX;
16906 #   else
16907 #    ifdef OPEN_MAX
16908     open_max = OPEN_MAX;
16909 #    else
16910 #     ifdef _NFILE
16911     open_max = _NFILE;
16912 #     endif
16913 #    endif
16914 #   endif
16915 #  endif
16916 # endif 
16917 # ifdef HAS_STDIO_STREAM_ARRAY
16918     if (open_max > 0) {
16919       long i;
16920       for (i = 0; i < open_max; i++)
16921             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
16922                 STDIO_STREAM_ARRAY[i]._file < open_max &&
16923                 STDIO_STREAM_ARRAY[i]._flag)
16924                 fflush(&STDIO_STREAM_ARRAY[i]);
16925     }   
16926   }
16927 # endif
16928 #endif
16929   _exit(42);
16930 }
16931 EOCP
16932 : first we have to find out how _not_ to flush
16933 $to try.c
16934 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
16935     output=''
16936     set try -DTRY_FPUTC
16937     if eval $compile; then
16938             $run ./try 2>/dev/null
16939             code="$?"
16940             $from try.out
16941             if $test ! -s try.out -a "X$code" = X42; then
16942                 output=-DTRY_FPUTC
16943             fi
16944     fi
16945     case "$output" in
16946     '')
16947             set try -DTRY_FPRINTF
16948             if eval $compile; then
16949                     $run ./try 2>/dev/null
16950                     code="$?"
16951                     $from try.out
16952                     if $test ! -s try.out -a "X$code" = X42; then
16953                         output=-DTRY_FPRINTF
16954                     fi
16955             fi
16956         ;;
16957     esac
16958 fi
16959 : check for fflush NULL behaviour
16960 case "$fflushNULL" in
16961 '')     set try -DTRY_FFLUSH_NULL $output
16962         if eval $compile; then
16963                 $run ./try 2>/dev/null
16964                 code="$?"
16965                 $from try.out
16966                 if $test -s try.out -a "X$code" = X42; then
16967                         fflushNULL="`$cat try.out`"
16968                 else
16969                         if $test "X$code" != X42; then
16970                                 $cat >&4 <<EOM
16971 (If this test failed, don't worry, we'll try another method shortly.)
16972 EOM
16973                         fi
16974                 fi
16975         fi
16976         $rm -f core try.core core.try.*
16977         case "$fflushNULL" in
16978         x)      $cat >&4 <<EOM
16979 Your fflush(NULL) works okay for output streams.
16980 Let's see if it clobbers input pipes...
16981 EOM
16982 # As of mid-March 2000 all versions of Solaris appear to have a stdio
16983 # bug that improperly flushes the input end of pipes.  So we avoid the
16984 # autoflush on fork/system/exec support for now. :-(
16985 $cat >tryp.c <<EOCP
16986 #include <stdio.h>
16987 int
16988 main(int argc, char **argv)
16989 {
16990     char buf[1024];
16991     int i;
16992     char *bp = buf;
16993     while (1) {
16994         while ((i = getc(stdin)) != -1
16995                && (*bp++ = i) != '\n'
16996                && bp < &buf[1024])
16997         /* DO NOTHING */ ;
16998         *bp = '\0';
16999         fprintf(stdout, "%s", buf);
17000         fflush(NULL);
17001         if (i == -1)
17002             return 0;
17003         bp = buf;
17004     }
17005 }
17006 EOCP
17007                 fflushNULL="$define"
17008                 set tryp
17009                 if eval $compile; then
17010                     $rm -f tryp.out
17011                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17012                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
17013                        $cat >&4 <<EOM
17014 fflush(NULL) seems to behave okay with input streams.
17015 EOM
17016                         fflushNULL="$define"
17017                     else
17018                         $cat >&4 <<EOM
17019 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
17020 EOM
17021                         fflushNULL="$undef"
17022                     fi
17023                 fi
17024                 $rm -f core tryp.c tryp.core core.tryp.*
17025                 ;;
17026         '')     $cat >&4 <<EOM
17027 Your fflush(NULL) isn't working (contrary to ANSI C).
17028 EOM
17029                 fflushNULL="$undef"
17030                 ;;
17031         *)      $cat >&4 <<EOM
17032 Cannot figure out whether your fflush(NULL) works or not.
17033 I'm assuming it doesn't (contrary to ANSI C).
17034 EOM
17035                 fflushNULL="$undef"
17036                 ;;
17037         esac
17038         ;;
17039 $define|true|[yY]*)
17040         fflushNULL="$define"
17041         ;;
17042 *)
17043         fflushNULL="$undef"
17044         ;;
17045 esac
17046 : check explicit looping only if NULL did not work, and if the pipe
17047 : bug does not show up on an explicit flush too
17048 case "$fflushNULL" in
17049 "$undef")
17050         $cat >tryp.c <<EOCP
17051 #include <stdio.h>
17052 int
17053 main(int argc, char **argv)
17054 {
17055     char buf[1024];
17056     int i;
17057     char *bp = buf;
17058     while (1) {
17059         while ((i = getc(stdin)) != -1
17060                && (*bp++ = i) != '\n'
17061                && bp < &buf[1024])
17062         /* DO NOTHING */ ;
17063         *bp = '\0';
17064         fprintf(stdout, "%s", buf);
17065         fflush(stdin);
17066         if (i == -1)
17067             return 0;
17068         bp = buf;
17069     }
17070 }
17071 EOCP
17072         set tryp
17073         if eval $compile; then
17074             $rm -f tryp.out
17075             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17076             if cmp tryp.c tryp.out >/dev/null 2>&1; then
17077                $cat >&4 <<EOM
17078 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
17079 EOM
17080                 : now check for fflushall behaviour
17081                 case "$fflushall" in
17082                 '')     set try -DTRY_FFLUSH_ALL $output
17083                         if eval $compile; then
17084                                 $cat >&4 <<EOM
17085 (Now testing the other method--but note that this also may fail.)
17086 EOM
17087                                 $run ./try 2>/dev/null
17088                                 code=$?
17089                                 $from try.out
17090                                 if $test -s try.out -a "X$code" = X42; then
17091                                         fflushall="`$cat try.out`"
17092                                 fi
17093                         fi
17094                         $rm -f core try.core core.try.*
17095                         case "$fflushall" in
17096                         x)      $cat >&4 <<EOM
17097 Whew. Flushing explicitly all the stdio streams works.
17098 EOM
17099                                 fflushall="$define"
17100                                 ;;
17101                         '')     $cat >&4 <<EOM
17102 Sigh. Flushing explicitly all the stdio streams doesn't work.
17103 EOM
17104                                 fflushall="$undef"
17105                                 ;;
17106                         *)      $cat >&4 <<EOM
17107 Cannot figure out whether flushing stdio streams explicitly works or not.
17108 I'm assuming it doesn't.
17109 EOM
17110                                 fflushall="$undef"
17111                                 ;;
17112                         esac
17113                         ;;
17114                 "$define"|true|[yY]*)
17115                         fflushall="$define"
17116                         ;;
17117                 *)
17118                         fflushall="$undef"
17119                         ;;
17120                 esac
17121             else
17122                 $cat >&4 <<EOM
17123 All is futile.  Even fflush(stdin) clobbers input pipes!
17124 EOM
17125                 fflushall="$undef"
17126             fi
17127         else
17128             fflushall="$undef"
17129         fi
17130         $rm -f core tryp.c tryp.core core.tryp.*
17131         ;;
17132 *)      fflushall="$undef"
17133         ;;
17134 esac
17135
17136 case "$fflushNULL$fflushall" in
17137 undefundef)
17138         $cat <<EOM
17139 OK, I give up.  I cannot figure out how to flush pending stdio output.
17140 We won't be flushing handles at all before fork/exec/popen.
17141 EOM
17142         ;;
17143 esac
17144 $rm -f try.* try$exe_ext
17145
17146 : Store the full pathname to the ar program for use in the C program
17147 : Respect a hint or command line value for full_ar.
17148 case "$full_ar" in
17149 '') full_ar=$ar ;;
17150 esac
17151
17152 : Store the full pathname to the sed program for use in the C program
17153 full_sed=$sed
17154
17155 : see what type gids are declared as in the kernel
17156 echo " "
17157 echo "Looking for the type for group ids returned by getgid()."
17158 set gid_t gidtype xxx stdio.h sys/types.h
17159 eval $typedef
17160 case "$gidtype" in
17161 xxx)
17162         xxx=`./findhdr sys/user.h`
17163         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
17164         case $1 in
17165         unsigned) dflt="$1 $2" ;;
17166         *) dflt="$1" ;;
17167         esac
17168         ;;
17169 *) dflt="$gidtype";;
17170 esac
17171 case "$gidtype" in
17172 gid_t) echo "gid_t found." ;;
17173 *)      rp="What is the type for group ids returned by getgid()?"
17174         . ./myread
17175         gidtype="$ans"
17176         ;;
17177 esac
17178
17179 echo " "
17180 case "$gidtype" in
17181 *_t) zzz="$gidtype"     ;;
17182 *)   zzz="gid"          ;;
17183 esac
17184 echo "Checking the size of $zzz..." >&4 
17185 cat > try.c <<EOCP
17186 #include <sys/types.h>
17187 #include <stdio.h>
17188 int main() {
17189     printf("%d\n", (int)sizeof($gidtype));
17190     exit(0);
17191 }
17192 EOCP
17193 set try
17194 if eval $compile_ok; then
17195         yyy=`$run ./try`
17196         case "$yyy" in
17197         '')     gidsize=4
17198                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
17199                 ;;
17200         *)      gidsize=$yyy
17201                 echo "Your $zzz is $gidsize bytes long."
17202                 ;;
17203         esac
17204 else
17205         gidsize=4
17206         echo "(I can't compile the test program--guessing $gidsize.)" >&4
17207 fi
17208
17209
17210 echo " "
17211 case "$gidtype" in
17212 *_t) zzz="$gidtype"     ;;
17213 *)   zzz="gid"          ;;
17214 esac
17215 echo "Checking the sign of $zzz..." >&4 
17216 cat > try.c <<EOCP
17217 #include <sys/types.h>
17218 #include <stdio.h>
17219 int main() {
17220         $gidtype foo = -1;
17221         if (foo < 0)
17222                 printf("-1\n");
17223         else
17224                 printf("1\n");
17225 }
17226 EOCP
17227 set try
17228 if eval $compile; then
17229         yyy=`$run ./try`
17230         case "$yyy" in
17231         '')     gidsign=1
17232                 echo "(I can't execute the test program--guessing unsigned.)" >&4
17233                 ;;
17234         *)      gidsign=$yyy
17235                 case "$gidsign" in
17236                  1) echo "Your $zzz is unsigned." ;;
17237                 -1) echo "Your $zzz is signed."   ;;
17238                 esac
17239                 ;;
17240         esac
17241 else
17242         gidsign=1
17243         echo "(I can't compile the test program--guessing unsigned.)" >&4
17244 fi
17245
17246
17247 echo " "
17248
17249 if $test X"$quadtype" != X; then
17250
17251 echo "Checking how to print 64-bit integers..." >&4
17252
17253 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
17254         $cat >try.c <<'EOCP'
17255 #include <sys/types.h>
17256 #include <stdio.h>
17257 int main() {
17258   int q = 12345678901;
17259   printf("%ld\n", q);
17260 }
17261 EOCP
17262         set try
17263         if eval $compile; then
17264                 yyy=`$run ./try`
17265                 case "$yyy" in
17266                 12345678901)
17267                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
17268                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
17269                         echo "We will use %d."
17270                         ;;
17271                 esac
17272         fi
17273 fi
17274
17275 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
17276         $cat >try.c <<'EOCP'
17277 #include <sys/types.h>
17278 #include <stdio.h>
17279 int main() {
17280   long q = 12345678901;
17281   printf("%ld\n", q);
17282 }
17283 EOCP
17284         set try
17285         if eval $compile; then
17286                 yyy=`$run ./try`
17287                 case "$yyy" in
17288                 12345678901)
17289                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
17290                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
17291                         echo "We will use %ld."
17292                         ;;
17293                 esac
17294         fi
17295 fi
17296
17297 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
17298         $cat >try.c <<'EOCP'
17299 #include <sys/types.h>
17300 #include <inttypes.h>
17301 #include <stdio.h>
17302 int main() {
17303   int64_t q = 12345678901;
17304   printf("%" PRId64 "\n", q);
17305 }
17306 EOCP
17307         set try
17308         if eval $compile; then
17309                 yyy=`$run ./try`
17310                 case "$yyy" in
17311                 12345678901)
17312                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
17313                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
17314                         echo "We will use the C9X style."
17315                         ;;
17316                 esac
17317         fi
17318 fi
17319
17320 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17321         $cat >try.c <<EOCP
17322 #include <sys/types.h>
17323 #include <stdio.h>
17324 int main() {
17325   $quadtype q = 12345678901;
17326   printf("%Ld\n", q);
17327 }
17328 EOCP
17329         set try
17330         if eval $compile; then
17331                 yyy=`$run ./try`
17332                 case "$yyy" in
17333                 12345678901)
17334                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
17335                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
17336                         echo "We will use %Ld."
17337                         ;;
17338                 esac
17339         fi
17340 fi
17341
17342 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
17343         $cat >try.c <<'EOCP'
17344 #include <sys/types.h>
17345 #include <stdio.h>
17346 int main() {
17347   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
17348   printf("%lld\n", q);
17349 }
17350 EOCP
17351         set try
17352         if eval $compile; then
17353                 yyy=`$run ./try`
17354                 case "$yyy" in
17355                 12345678901)
17356                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
17357                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
17358                         echo "We will use the %lld style."
17359                         ;;
17360                 esac
17361         fi
17362 fi
17363
17364 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17365         $cat >try.c <<EOCP
17366 #include <sys/types.h>
17367 #include <stdio.h>
17368 int main() {
17369   $quadtype q = 12345678901;
17370   printf("%qd\n", q);
17371 }
17372 EOCP
17373         set try
17374         if eval $compile; then
17375                 yyy=`$run ./try`
17376                 case "$yyy" in
17377                 12345678901)
17378                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
17379                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
17380                         echo "We will use %qd."
17381                         ;;
17382                 esac
17383         fi
17384 fi
17385
17386 if $test X"$sPRId64" = X; then
17387         echo "Cannot figure out how to print 64-bit integers." >&4
17388 fi
17389
17390 $rm -f try try.*
17391
17392 fi
17393
17394 case "$sPRId64" in
17395 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
17396         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
17397         ;;
17398 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
17399         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
17400         ;;
17401 esac
17402
17403
17404 echo " "
17405 $echo "Checking the format strings to be used for Perl's internal types..." >&4
17406
17407 if $test X"$ivsize" = X8; then
17408         ivdformat="$sPRId64"
17409         uvuformat="$sPRIu64"
17410         uvoformat="$sPRIo64"
17411         uvxformat="$sPRIx64"
17412         uvXUformat="$sPRIXU64"
17413 else
17414         if $test X"$ivsize" = X"$longsize"; then
17415                 ivdformat='"ld"'
17416                 uvuformat='"lu"'
17417                 uvoformat='"lo"'
17418                 uvxformat='"lx"'
17419                 uvXUformat='"lX"'
17420         else
17421                 if $test X"$ivsize" = X"$intsize"; then
17422                         ivdformat='"d"'
17423                         uvuformat='"u"'
17424                         uvoformat='"o"'
17425                         uvxformat='"x"'
17426                         uvXUformat='"X"'
17427                 else
17428                         : far out
17429                         if $test X"$ivsize" = X"$shortsize"; then
17430                                 ivdformat='"hd"'
17431                                 uvuformat='"hu"'
17432                                 uvoformat='"ho"'
17433                                 uvxformat='"hx"'
17434                                 uvXUformat='"hX"'
17435                         fi
17436                 fi
17437         fi
17438 fi
17439
17440 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
17441         nveformat="$sPRIeldbl"
17442         nvfformat="$sPRIfldbl"
17443         nvgformat="$sPRIgldbl"
17444         nvEUformat="$sPRIEUldbl"
17445         nvFUformat="$sPRIFUldbl"
17446         nvGUformat="$sPRIGUldbl"
17447 else
17448         nveformat='"e"'
17449         nvfformat='"f"'
17450         nvgformat='"g"'
17451         nvEUformat='"E"'
17452         nvFUformat='"F"'
17453         nvGUformat='"G"'
17454 fi
17455
17456 case "$ivdformat" in
17457 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
17458     exit 1
17459     ;;
17460 esac
17461
17462
17463 echo " "
17464 $echo "Checking the format string to be used for gids..." >&4
17465
17466 case "$gidsign" in
17467 -1)     if $test X"$gidsize" = X"$ivsize"; then
17468                 gidformat="$ivdformat"
17469         else
17470                 if $test X"$gidsize" = X"$longsize"; then
17471                         gidformat='"ld"'
17472                 else
17473                         if $test X"$gidsize" = X"$intsize"; then
17474                                 gidformat='"d"'
17475                         else
17476                                 if $test X"$gidsize" = X"$shortsize"; then
17477                                         gidformat='"hd"'
17478                                 fi
17479                         fi
17480                 fi
17481         fi
17482         ;;
17483 *)      if $test X"$gidsize" = X"$uvsize"; then
17484                 gidformat="$uvuformat"
17485         else
17486                 if $test X"$gidsize" = X"$longsize"; then
17487                         gidformat='"lu"'
17488                 else
17489                         if $test X"$gidsize" = X"$intsize"; then
17490                                 gidformat='"u"'
17491                         else
17492                                 if $test X"$gidsize" = X"$shortsize"; then
17493                                         gidformat='"hu"'
17494                                 fi
17495                         fi
17496                 fi
17497         fi
17498         ;;
17499 esac
17500
17501 : see if getgroups exists
17502 set getgroups d_getgrps
17503 eval $inlibc
17504
17505 : see if setgroups exists
17506 set setgroups d_setgrps
17507 eval $inlibc
17508
17509
17510 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
17511 echo " "
17512 case "$d_getgrps$d_setgrps" in
17513 *define*)
17514         case "$groupstype" in
17515         '') dflt="$gidtype" ;;
17516         *)  dflt="$groupstype" ;;
17517         esac
17518         $cat <<EOM
17519 What type of pointer is the second argument to getgroups() and setgroups()?
17520 Usually this is the same as group ids, $gidtype, but not always.
17521
17522 EOM
17523         rp='What type pointer is the second argument to getgroups() and setgroups()?'
17524         . ./myread
17525         groupstype="$ans"
17526         ;;
17527 *)  groupstype="$gidtype";;
17528 esac
17529
17530 echo " "
17531 echo "Checking if your $make program sets \$(MAKE)..." >&4
17532 case "$make_set_make" in
17533 '')
17534         $sed 's/^X //' > testmake.mak << 'EOF'
17535 Xall:
17536 X       @echo 'maketemp="$(MAKE)"'
17537 EOF
17538         case "`$make -f testmake.mak 2>/dev/null`" in
17539         *maketemp=*) make_set_make='#' ;;
17540         *)      make_set_make="MAKE=$make" ;;
17541         esac
17542         $rm -f testmake.mak
17543         ;;
17544 esac
17545 case "$make_set_make" in
17546 '#') echo "Yup, it does.";;
17547 *) echo "Nope, it doesn't.";;
17548 esac
17549
17550 : see what type is used for mode_t
17551 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
17552 set mode_t modetype int stdio.h sys/types.h
17553 eval $typedef_ask
17554
17555 : see if stdarg is available
17556 echo " "
17557 if $test `./findhdr stdarg.h`; then
17558         echo "<stdarg.h> found." >&4
17559         valstd="$define"
17560 else
17561         echo "<stdarg.h> NOT found." >&4
17562         valstd="$undef"
17563 fi
17564
17565 : see if varags is available
17566 echo " "
17567 if $test `./findhdr varargs.h`; then
17568         echo "<varargs.h> found." >&4
17569 else
17570         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
17571 fi
17572
17573 : set up the varargs testing programs
17574 $cat > varargs.c <<EOP
17575 #ifdef I_STDARG
17576 #include <stdarg.h>
17577 #endif
17578 #ifdef I_VARARGS
17579 #include <varargs.h>
17580 #endif
17581
17582 #ifdef I_STDARG
17583 int f(char *p, ...)
17584 #else
17585 int f(va_alist)
17586 va_dcl
17587 #endif
17588 {
17589         va_list ap;
17590 #ifndef I_STDARG
17591         char *p;
17592 #endif
17593 #ifdef I_STDARG
17594         va_start(ap,p);
17595 #else
17596         va_start(ap);
17597         p = va_arg(ap, char *);
17598 #endif
17599         va_end(ap);
17600 }
17601 EOP
17602 $cat > varargs <<EOP
17603 $startsh
17604 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
17605         echo "true"
17606 else
17607         echo "false"
17608 fi
17609 $rm -f varargs$_o
17610 EOP
17611 chmod +x varargs
17612
17613 : now check which varargs header should be included
17614 echo " "
17615 i_varhdr=''
17616 case "$valstd" in
17617 "$define")
17618         if `./varargs I_STDARG`; then
17619                 val='stdarg.h'
17620         elif `./varargs I_VARARGS`; then
17621                 val='varargs.h'
17622         fi
17623         ;;
17624 *)
17625         if `./varargs I_VARARGS`; then
17626                 val='varargs.h'
17627         fi
17628         ;;
17629 esac
17630 case "$val" in
17631 '')
17632 echo "I could not find the definition for va_dcl... You have problems..." >&4
17633         val="$undef"; set i_stdarg; eval $setvar
17634         val="$undef"; set i_varargs; eval $setvar
17635         ;;
17636 *) 
17637         set i_varhdr
17638         eval $setvar
17639         case "$i_varhdr" in
17640         stdarg.h)
17641                 val="$define"; set i_stdarg; eval $setvar
17642                 val="$undef"; set i_varargs; eval $setvar
17643                 ;;
17644         varargs.h)
17645                 val="$undef"; set i_stdarg; eval $setvar
17646                 val="$define"; set i_varargs; eval $setvar
17647                 ;;
17648         esac
17649         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
17650 esac
17651 $rm -f varargs*
17652
17653 : see if we need va_copy
17654 echo " "
17655 case "$i_stdarg" in
17656 "$define")
17657         $cat >try.c <<EOCP
17658 #include <stdarg.h>
17659 #include <stdio.h>
17660 #$i_stdlib I_STDLIB
17661 #ifdef I_STDLIB
17662 #include <stdlib.h>
17663 #endif
17664 #include <signal.h>
17665
17666 int
17667 ivfprintf(FILE *f, const char *fmt, va_list *valp)
17668 {
17669   return vfprintf(f, fmt, *valp);
17670 }
17671  
17672 int    
17673 myvfprintf(FILE *f, const  char *fmt, va_list val)
17674 {
17675   return ivfprintf(f, fmt, &val);
17676 }
17677       
17678 int
17679 myprintf(char *fmt, ...) 
17680 {
17681   va_list val;
17682   va_start(val, fmt);
17683   return myvfprintf(stdout, fmt, val); 
17684 }         
17685
17686 int
17687 main(int ac, char **av)
17688 {
17689   signal(SIGSEGV, exit);
17690
17691   myprintf("%s%cs all right, then\n", "that", '\'');                            
17692   exit(0);      
17693 }
17694 EOCP
17695         set try
17696         if eval $compile && $run ./try 2>&1 >/dev/null; then
17697                 case "`$run ./try`" in
17698                 "that's all right, then")
17699                         okay=yes
17700                         ;;
17701                 esac
17702         fi
17703         case "$okay" in
17704         yes)    echo "It seems that you don't need va_copy()." >&4
17705                 need_va_copy="$undef"
17706                 ;;
17707         *)      echo "It seems that va_copy() or similar will be needed." >&4
17708                 need_va_copy="$define"
17709                 ;;
17710         esac
17711         $rm -f try.* core core.* *.core *.core.*
17712         ;;
17713 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
17714         ;;
17715 esac
17716
17717 : see what type is used for size_t
17718 rp="What is the type used for the length parameter for string functions?"
17719 set size_t sizetype 'unsigned int' stdio.h sys/types.h
17720 eval $typedef_ask
17721
17722 : check for type of arguments to gethostbyaddr. 
17723 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
17724         case "$d_gethbyaddr" in
17725         $define)
17726                 $cat <<EOM
17727
17728 Checking to see what type of arguments are accepted by gethostbyaddr().
17729 EOM
17730                 hdrs="$define sys/types.h
17731                         $d_socket sys/socket.h 
17732                         $i_niin netinet/in.h 
17733                         $i_netdb netdb.h
17734                         $i_unistd unistd.h"
17735                 : The first arg can 'char *' or 'void *'
17736                 : The second arg is some of integral type
17737                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
17738                         for yyy in size_t long int; do
17739                                 case "$netdb_host_type" in
17740                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
17741                                         if ./protochk "$try" $hdrs; then
17742                                                 echo "Your system accepts $xxx for the first arg."
17743                                                 echo "...and $yyy for the second arg."
17744                                                 netdb_host_type="$xxx"
17745                                                 netdb_hlen_type="$yyy"
17746                                         fi
17747                                         ;;
17748                                 esac
17749                         done
17750                 done
17751                 : In case none of those worked, prompt the user.
17752                 case "$netdb_host_type" in
17753                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
17754                         dflt='char *'
17755                         . ./myread
17756                         netdb_host_type=$ans
17757                         rp='What is the type for the 2nd argument to gethostbyaddr?'
17758                         dflt="$sizetype"
17759                         . ./myread
17760                         netdb_hlen_type=$ans
17761                         ;;
17762                 esac
17763                 ;;
17764         *)      : no gethostbyaddr, so pick harmless defaults
17765                 netdb_host_type='char *'
17766                 netdb_hlen_type="$sizetype"
17767                 ;;
17768         esac
17769         # Remove the "const" if needed. -- but then we'll have a 
17770         # prototype clash!
17771         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
17772 fi
17773
17774 : check for type of argument to gethostbyname. 
17775 if test "X$netdb_name_type" = X ; then
17776         case "$d_gethbyname" in
17777         $define)
17778                 $cat <<EOM
17779
17780 Checking to see what type of argument is accepted by gethostbyname().
17781 EOM
17782                 hdrs="$define sys/types.h
17783                         $d_socket sys/socket.h 
17784                         $i_niin netinet/in.h 
17785                         $i_netdb netdb.h
17786                         $i_unistd unistd.h"
17787                 for xxx in "const char *" "char *"; do
17788                         case "$netdb_name_type" in
17789                         '')     try="extern struct hostent *gethostbyname($xxx);"
17790                                 if ./protochk "$try" $hdrs; then
17791                                         echo "Your system accepts $xxx."
17792                                         netdb_name_type="$xxx"
17793                                 fi
17794                                 ;;
17795                         esac
17796                 done
17797                 : In case none of those worked, prompt the user.
17798                 case "$netdb_name_type" in
17799                 '')     rp='What is the type for the 1st argument to gethostbyname?'
17800                         dflt='char *'
17801                         . ./myread
17802                         netdb_name_type=$ans
17803                         ;;
17804                 esac
17805                 ;;
17806         *)      : no gethostbyname, so pick harmless default
17807                 netdb_name_type='char *'
17808                 ;;
17809         esac
17810 fi
17811
17812 : check for type of 1st argument to getnetbyaddr. 
17813 if test "X$netdb_net_type" = X ; then
17814         case "$d_getnbyaddr" in
17815         $define)
17816                 $cat <<EOM
17817
17818 Checking to see what type of 1st argument is accepted by getnetbyaddr().
17819 EOM
17820                 hdrs="$define sys/types.h
17821                         $d_socket sys/socket.h 
17822                         $i_niin netinet/in.h 
17823                         $i_netdb netdb.h
17824                         $i_unistd unistd.h"
17825                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
17826                         case "$netdb_net_type" in
17827                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
17828                                 if ./protochk "$try" $hdrs; then
17829                                         echo "Your system accepts $xxx."
17830                                         netdb_net_type="$xxx"
17831                                 fi
17832                                 ;;
17833                         esac
17834                 done
17835                 : In case none of those worked, prompt the user.
17836                 case "$netdb_net_type" in
17837                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
17838                         dflt='long'
17839                         . ./myread
17840                         netdb_net_type=$ans
17841                         ;;
17842                 esac
17843                 ;;
17844         *)      : no getnetbyaddr, so pick harmless default
17845                 netdb_net_type='long'
17846                 ;;
17847         esac
17848 fi
17849 : locate the preferred pager for this system
17850 fn=f/
17851 case "$pager" in
17852 '')
17853         dflt=''
17854         case "$pg" in
17855         /*) dflt=$pg;;
17856         [a-zA-Z]:/*) dflt=$pg;;
17857         esac
17858         case "$more" in
17859         /*) dflt=$more;;
17860         [a-zA-Z]:/*) dflt=$more;;
17861         esac
17862         case "$less" in
17863         /*) dflt=$less;;
17864         [a-zA-Z]:/*) dflt=$less;;
17865         esac
17866         case "$dflt" in
17867         '') dflt=/usr/ucb/more;;
17868         esac
17869         ;;
17870 *)      dflt="$pager"
17871         : Instruct ./getfile to trust the hinted or previous pager value,
17872         : even if it does not begin with a slash.  For example, on os2,
17873         : pager might be cmd /c more.  See comments in UU/getfile.
17874         fn="f/($pager)"
17875         ;;
17876 esac
17877 echo " "
17878 rp='What pager is used on your system?'
17879 . ./getfile
17880 pager="$ans"
17881
17882 : see what type pids are declared as in the kernel
17883 rp="What is the type of process ids on this system?"
17884 set pid_t pidtype int stdio.h sys/types.h
17885 eval $typedef_ask
17886
17887 : Find earliest binary compatible site_perl subdirectory perl can use.
17888 xs_apiversion=$version # The current site_perl version.
17889 : Find earliest pure perl site_perl subdirectory perl can use.
17890 : The versioned directories started at 5.005.
17891 pm_apiversion='5.005'
17892
17893 : see if ar generates random libraries by itself
17894 echo " "
17895 echo "Checking how to generate random libraries on your machine..." >&4
17896 echo 'int bar1() { return bar2(); }' > bar1.c
17897 echo 'int bar2() { return 2; }' > bar2.c
17898 $cat > foo.c <<'EOP'
17899 int main() { printf("%d\n", bar1()); exit(0); }
17900 EOP
17901 $cc $ccflags -c bar1.c >/dev/null 2>&1
17902 $cc $ccflags -c bar2.c >/dev/null 2>&1
17903 $cc $ccflags -c foo.c >/dev/null 2>&1
17904 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
17905 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
17906         $run ./foobar >/dev/null 2>&1; then
17907         echo "$ar appears to generate random libraries itself."
17908         orderlib=false
17909         ranlib=":"
17910 elif $ar ts bar$_a >/dev/null 2>&1 &&
17911         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
17912         $run ./foobar >/dev/null 2>&1; then
17913                 echo "a table of contents needs to be added with '$ar ts'."
17914                 orderlib=false
17915                 ranlib="$ar ts"
17916 else
17917         case "$ranlib" in
17918         :) ranlib='';;
17919         '')
17920                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
17921                 $test -f $ranlib || ranlib=''
17922                 ;;
17923         esac
17924         if $test -n "$ranlib"; then
17925                 echo "your system has '$ranlib'; we'll use that."
17926                 orderlib=false
17927         else
17928                 echo "your system doesn't seem to support random libraries"
17929                 echo "so we'll use lorder and tsort to order the libraries."
17930                 orderlib=true
17931                 ranlib=":"
17932         fi
17933 fi
17934 $rm -f foo* bar* 
17935
17936 : check for type of arguments to select. 
17937 case "$selecttype" in
17938 '') case "$d_select" in
17939         $define)
17940                 echo " "
17941                 $cat <<EOM
17942 Checking to see what type of arguments are accepted by select().
17943 EOM
17944                 hdrs="$define sys/types.h
17945                         $i_systime sys/time.h 
17946                         $i_sysselct sys/select.h
17947                         $d_socket sys/socket.h"
17948                 : The first arg can be int, unsigned, or size_t
17949                 : The last arg may or may not be 'const'
17950                 val=''
17951                 : void pointer has been seen but using that
17952                 : breaks the selectminbits test
17953                 for xxx in 'fd_set *' 'int *'; do
17954                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
17955                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
17956                                         case "$val" in
17957                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
17958                                                 if ./protochk "$try" $hdrs; then
17959                                                         echo "Your system accepts $xxx."
17960                                                         val="$xxx"
17961                                                 fi
17962                                                 ;;
17963                                         esac
17964                                 done
17965                         done
17966                 done
17967                 case "$val" in
17968                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
17969                         case "$d_fd_set" in
17970                                 $define) dflt="fd_set *" ;;
17971                                 *)              dflt="int *" ;;
17972                         esac
17973                         . ./myread
17974                         val=$ans
17975                         ;;
17976                 esac
17977                 selecttype="$val"
17978                 ;;
17979         *)      : no select, so pick a harmless default
17980                 selecttype='int *'
17981                 ;;
17982         esac
17983         ;;
17984 esac
17985
17986 : check for the select 'width'
17987 case "$selectminbits" in
17988 '') case "$d_select" in
17989         $define)
17990                 $cat <<EOM
17991
17992 Checking to see on how many bits at a time your select() operates...
17993 EOM
17994                 $cat >try.c <<EOCP
17995 #include <sys/types.h>
17996 #$i_time I_TIME
17997 #$i_systime I_SYS_TIME
17998 #$i_systimek I_SYS_TIME_KERNEL
17999 #ifdef I_TIME
18000 #   include <time.h>
18001 #endif
18002 #ifdef I_SYS_TIME
18003 #   ifdef I_SYS_TIME_KERNEL
18004 #       define KERNEL
18005 #   endif
18006 #   include <sys/time.h>
18007 #   ifdef I_SYS_TIME_KERNEL
18008 #       undef KERNEL
18009 #   endif
18010 #endif
18011 #$i_sysselct I_SYS_SELECT
18012 #ifdef I_SYS_SELECT
18013 #include <sys/select.h>
18014 #endif
18015 #$d_socket HAS_SOCKET
18016 #ifdef HAS_SOCKET
18017 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
18018 #endif
18019 #include <stdio.h>
18020 $selecttype b;
18021 #define S sizeof(*(b))
18022 #define MINBITS 64
18023 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
18024 #define NBITS  (NBYTES * 8)
18025 int main() {
18026     char s[NBYTES];
18027     struct timeval t;
18028     int i;
18029     FILE* fp;
18030     int fd;
18031
18032     fclose(stdin);
18033     fp = fopen("try.c", "r");
18034     if (fp == 0)
18035       exit(1);
18036     fd = fileno(fp);
18037     if (fd < 0)
18038       exit(2);
18039     b = ($selecttype)s;
18040     for (i = 0; i < NBITS; i++)
18041         FD_SET(i, b);
18042     t.tv_sec  = 0;
18043     t.tv_usec = 0;
18044     select(fd + 1, b, 0, 0, &t);
18045     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
18046     printf("%d\n", i + 1);
18047     return 0;
18048 }
18049 EOCP
18050                 set try
18051                 if eval $compile_ok; then
18052                         selectminbits=`$run ./try`
18053                         case "$selectminbits" in
18054                         '')     cat >&4 <<EOM
18055 Cannot figure out on how many bits at a time your select() operates.
18056 I'll play safe and guess it is 32 bits.
18057 EOM
18058                                 selectminbits=32
18059                                 bits="32 bits"
18060                                 ;;
18061                         1)      bits="1 bit" ;;
18062                         *)      bits="$selectminbits bits" ;;
18063                         esac
18064                         echo "Your select() operates on $bits at a time." >&4
18065                 else
18066                         rp='What is the minimum number of bits your select() operates on?'
18067                         case "$byteorder" in
18068                         1234|12345678)  dflt=32 ;;
18069                         *)              dflt=1  ;;
18070                         esac
18071                         . ./myread
18072                         val=$ans
18073                         selectminbits="$val"
18074                 fi
18075                 $rm -f try.* try
18076                 ;;
18077         *)      : no select, so pick a harmless default
18078                 selectminbits='32'
18079                 ;;
18080         esac
18081         ;;
18082 esac
18083
18084 : Trace out the files included by signal.h, then look for SIGxxx names.
18085 : Remove SIGARRAYSIZE used by HPUX.
18086 : Remove SIGSTKSIZE used by Linux.
18087 : Remove SIGSTKSZ used by Posix.
18088 : Remove SIGTYP void lines used by OS2.
18089 : Some cpps, like os390, dont give the file name anywhere
18090 if [ "X$fieldn" = X ]; then
18091         : Just make some guesses.  We check them later.
18092         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
18093 else
18094         xxx=`echo '#include <signal.h>' |
18095         $cppstdin $cppminus $cppflags 2>/dev/null |
18096         $grep '^[       ]*#.*include' | 
18097         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
18098 fi
18099 : Check this list of files to be sure we have parsed the cpp output ok.
18100 : This will also avoid potentially non-existent files, such 
18101 : as ../foo/bar.h
18102 xxxfiles=''
18103 for xx in $xxx /dev/null ; do
18104         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
18105 done
18106 : If we have found no files, at least try signal.h
18107 case "$xxxfiles" in
18108 '')     xxxfiles=`./findhdr signal.h` ;;
18109 esac
18110 xxx=`awk '
18111 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
18112         print substr($2, 4, 20)
18113 }
18114 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
18115         print substr($3, 4, 20)
18116 }' $xxxfiles`
18117 : Append some common names just in case the awk scan failed.
18118 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
18119 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
18120 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
18121 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
18122 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
18123
18124 : generate a few handy files for later
18125 $cat > signal.c <<'EOCP'
18126 #include <sys/types.h>
18127 #include <signal.h>
18128 #include <stdio.h>
18129 int main() {
18130
18131 /* Strange style to avoid deeply-nested #if/#else/#endif */
18132 #ifndef NSIG
18133 #  ifdef _NSIG
18134 #    define NSIG (_NSIG)
18135 #  endif
18136 #endif
18137
18138 #ifndef NSIG
18139 #  ifdef SIGMAX
18140 #    define NSIG (SIGMAX+1)
18141 #  endif
18142 #endif
18143
18144 #ifndef NSIG
18145 #  ifdef SIG_MAX
18146 #    define NSIG (SIG_MAX+1)
18147 #  endif
18148 #endif
18149
18150 #ifndef NSIG
18151 #  ifdef MAXSIG
18152 #    define NSIG (MAXSIG+1)
18153 #  endif
18154 #endif
18155
18156 #ifndef NSIG
18157 #  ifdef MAX_SIG
18158 #    define NSIG (MAX_SIG+1)
18159 #  endif
18160 #endif
18161
18162 #ifndef NSIG
18163 #  ifdef SIGARRAYSIZE
18164 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
18165 #  endif
18166 #endif
18167
18168 #ifndef NSIG
18169 #  ifdef _sys_nsig
18170 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
18171 #  endif
18172 #endif
18173
18174 /* Default to some arbitrary number that's big enough to get most
18175    of the common signals.
18176 */
18177 #ifndef NSIG
18178 #    define NSIG 50
18179 #endif
18180
18181 printf("NSIG %d\n", NSIG);
18182
18183 #ifndef JUST_NSIG
18184
18185 EOCP
18186
18187 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
18188 {
18189         printf "#ifdef SIG"; printf $1; printf "\n"
18190         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
18191         printf $1; printf ");\n"
18192         printf "#endif\n"
18193 }
18194 END {
18195         printf "#endif /* JUST_NSIG */\n";
18196         printf "exit(0);\n}\n";
18197 }
18198 ' >>signal.c
18199 $cat >signal.awk <<'EOP'
18200 BEGIN { ndups = 0 }
18201 $1 ~ /^NSIG$/ { nsig = $2 }
18202 ($1 !~ /^NSIG$/) && (NF == 2) {
18203     if ($2 > maxsig) { maxsig = $2 }
18204     if (sig_name[$2]) {
18205         dup_name[ndups] = $1
18206         dup_num[ndups] = $2
18207         ndups++ 
18208     }
18209     else {
18210         sig_name[$2] = $1
18211         sig_num[$2] = $2
18212     }
18213 }
18214 END { 
18215     if (nsig == 0) {
18216         nsig = maxsig + 1
18217     }
18218     printf("NSIG %d\n", nsig);
18219     for (n = 1; n < nsig; n++) {
18220         if (sig_name[n]) {
18221             printf("%s %d\n", sig_name[n], sig_num[n])
18222         }
18223         else {
18224             printf("NUM%d %d\n", n, n) 
18225         }
18226     }
18227     for (n = 0; n < ndups; n++) {
18228         printf("%s %d\n", dup_name[n], dup_num[n])
18229     }
18230 }
18231 EOP
18232 $cat >signal_cmd <<EOS
18233 $startsh
18234 if $test -s signal.lst; then
18235     echo "Using your existing signal.lst file"
18236         exit 0
18237 fi
18238 xxx="$xxx"
18239 EOS
18240 $cat >>signal_cmd <<'EOS'
18241
18242 set signal
18243 if eval $compile_ok; then
18244         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
18245 else
18246         echo "(I can't seem be able to compile the whole test program)" >&4
18247         echo "(I'll try it in little pieces.)" >&4
18248         set signal -DJUST_NSIG
18249         if eval $compile_ok; then
18250                 $run ./signal$_exe > signal.nsg
18251                 $cat signal.nsg
18252         else
18253                 echo "I can't seem to figure out how many signals you have." >&4
18254                 echo "Guessing 50." >&4
18255                 echo 'NSIG 50' > signal.nsg
18256         fi
18257         : Now look at all the signal names, one at a time.
18258         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
18259                 $cat > signal.c <<EOCP
18260 #include <sys/types.h>
18261 #include <signal.h>
18262 #include <stdio.h>
18263 int main() {
18264 printf("$xx %d\n", SIG${xx});
18265 return 0;
18266 }
18267 EOCP
18268                 set signal
18269                 if eval $compile; then
18270                         echo "SIG${xx} found."
18271                         $run ./signal$_exe  >> signal.ls1
18272                 else
18273                         echo "SIG${xx} NOT found."
18274                 fi
18275         done
18276         if $test -s signal.ls1; then
18277                 $cat signal.nsg signal.ls1 |
18278                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
18279         fi
18280
18281 fi
18282 if $test -s signal.lst; then
18283         :
18284 else
18285         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
18286         echo 'kill -l' >signal
18287         set X `csh -f <signal`
18288         $rm -f signal
18289         shift
18290         case $# in
18291         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
18292         esac
18293         echo $@ | $tr ' ' $trnl | \
18294             $awk '{ printf "%s %d\n", $1, ++s; }
18295                   END { printf "NSIG %d\n", ++s }' >signal.lst
18296 fi
18297 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
18298 EOS
18299 chmod a+x signal_cmd
18300 $eunicefix signal_cmd
18301
18302 : generate list of signal names
18303 echo " "
18304 case "$sig_name_init" in
18305 '') doinit=yes ;;
18306 *)  case "$sig_num_init" in
18307     ''|*,*) doinit=yes ;;
18308     esac ;;
18309 esac
18310 case "$doinit" in
18311 yes)
18312         echo "Generating a list of signal names and numbers..." >&4
18313         . ./signal_cmd
18314         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
18315         sig_name=`$awk 'BEGIN { printf "ZERO " }
18316                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
18317         sig_num=`$awk  'BEGIN { printf "0 " }
18318                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
18319         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
18320                              !/^NSIG/   { printf "\"%s\", ", $1 }
18321                              END        { printf "0\n" }' signal.lst`
18322         sig_num_init=`$awk  'BEGIN      { printf "0, " }
18323                              !/^NSIG/   { printf "%d, ", $2}
18324                              END        { printf "0\n"}' signal.lst`
18325         ;;
18326 esac
18327 echo "The following $sig_count signals are available:"
18328 echo " "
18329 echo $sig_name | $awk \
18330 'BEGIN { linelen = 0 }
18331 {
18332         for (i = 1; i <= NF; i++) {
18333                 name = "SIG" $i " "
18334                 linelen = linelen + length(name)
18335                 if (linelen > 70) {
18336                         printf "\n"
18337                         linelen = length(name)
18338                 }
18339                 printf "%s", name
18340         }
18341         printf "\n"
18342 }'
18343 sig_size=`echo $sig_name | awk '{print NF}'`
18344 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
18345
18346 echo " "
18347 case "$sizetype" in
18348 *_t) zzz="$sizetype"    ;;
18349 *)   zzz="filesize"     ;;
18350 esac
18351 echo "Checking the size of $zzz..." >&4 
18352 cat > try.c <<EOCP
18353 #include <sys/types.h>
18354 #include <stdio.h>
18355 int main() {
18356     printf("%d\n", (int)sizeof($sizetype));
18357     exit(0);
18358 }
18359 EOCP
18360 set try
18361 if eval $compile_ok; then
18362         yyy=`$run ./try`
18363         case "$yyy" in
18364         '')     sizesize=4
18365                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
18366                 ;;
18367         *)      sizesize=$yyy
18368                 echo "Your $zzz size is $sizesize bytes."
18369                 ;;
18370         esac
18371 else
18372         sizesize=4
18373         echo "(I can't compile the test program--guessing $sizesize.)" >&4
18374 fi
18375
18376
18377 : check for socklen_t
18378 echo " "
18379 echo "Checking to see if you have socklen_t..." >&4
18380 $cat >try.c <<EOCP
18381 #include <sys/types.h>
18382 #$d_socket HAS_SOCKET
18383 #ifdef HAS_SOCKET
18384 #include <sys/socket.h>
18385 #endif
18386 int main() { socklen_t x = 16; }
18387 EOCP
18388 set try
18389 if eval $compile; then
18390         val="$define"
18391         echo "You have socklen_t."
18392 else
18393         val="$undef"
18394         echo "You do not have socklen_t."
18395         case "$sizetype" in
18396         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
18397         esac
18398 fi
18399 $rm -f try try.*
18400 set d_socklen_t
18401 eval $setvar
18402
18403 : see if this is a socks.h system
18404 set socks.h i_socks
18405 eval $inhdr
18406
18407 : check for type of the size argument to socket calls
18408 case "$d_socket" in
18409 "$define")
18410         $cat <<EOM
18411
18412 Checking to see what type is the last argument of accept().
18413 EOM
18414         yyy=''
18415         case "$d_socklen_t" in
18416         "$define") yyy="$yyy socklen_t"
18417         esac
18418         yyy="$yyy $sizetype int long unsigned"
18419         for xxx in $yyy; do
18420                 case "$socksizetype" in
18421                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
18422                         case "$usesocks" in
18423                         "$define")
18424                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
18425                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18426                                         socksizetype="$xxx"
18427                                 fi
18428                                 ;;
18429                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
18430                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18431                                         socksizetype="$xxx"
18432                                 fi
18433                                 ;;
18434                         esac
18435                         ;;
18436                 esac
18437         done
18438 : In case none of those worked, prompt the user.
18439         case "$socksizetype" in
18440         '')     rp='What is the type for socket address structure sizes?'
18441                 dflt='int'
18442                 . ./myread
18443                 socksizetype=$ans
18444                 ;;
18445         esac
18446         ;;
18447 *)      : no sockets, so pick relatively harmless default
18448         socksizetype='int'
18449         ;;
18450 esac
18451
18452 : see what type is used for signed size_t
18453 set ssize_t ssizetype int stdio.h sys/types.h
18454 eval $typedef
18455 dflt="$ssizetype"
18456 $cat > try.c <<EOM
18457 #include <stdio.h>
18458 #include <sys/types.h>
18459 #define Size_t $sizetype
18460 #define SSize_t $dflt
18461 int main()
18462 {
18463         if (sizeof(Size_t) == sizeof(SSize_t))
18464                 printf("$dflt\n");
18465         else if (sizeof(Size_t) == sizeof(int))
18466                 printf("int\n");
18467         else 
18468                 printf("long\n");
18469         exit(0);
18470 }
18471 EOM
18472 echo " "
18473 set try
18474 if eval $compile_ok && $run ./try > /dev/null; then
18475         ssizetype=`$run ./try`
18476         echo "I'll be using $ssizetype for functions returning a byte count." >&4
18477 else
18478         $cat >&4 <<EOM
18479 Help! I can't compile and run the ssize_t test program: please enlighten me!
18480 (This is probably a misconfiguration in your system or libraries, and
18481 you really ought to fix it.  Still, I'll try anyway.)
18482
18483 I need a type that is the same size as $sizetype, but is guaranteed to
18484 be signed.  Common values are ssize_t, int and long.
18485
18486 EOM
18487         rp="What signed type is the same size as $sizetype?"
18488         . ./myread
18489         ssizetype="$ans"
18490 fi
18491 $rm -f try try.*
18492
18493 : see what type of char stdio uses.
18494 echo " "
18495 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
18496 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
18497         echo "Your stdio uses unsigned chars." >&4
18498         stdchar="unsigned char"
18499 else
18500         echo "Your stdio uses signed chars." >&4
18501         stdchar="char"
18502 fi
18503 $rm -f stdioh
18504
18505
18506
18507 : see what type uids are declared as in the kernel
18508 echo " "
18509 echo "Looking for the type for user ids returned by getuid()."
18510 set uid_t uidtype xxx stdio.h sys/types.h
18511 eval $typedef
18512 case "$uidtype" in
18513 xxx)
18514         xxx=`./findhdr sys/user.h`
18515         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18516         case $1 in
18517         unsigned) dflt="$1 $2" ;;
18518         *) dflt="$1" ;;
18519         esac
18520         ;;
18521 *) dflt="$uidtype";;
18522 esac
18523 case "$uidtype" in
18524 uid_t)  echo "uid_t found." ;;
18525 *)      rp="What is the type for user ids returned by getuid()?"
18526         . ./myread
18527         uidtype="$ans"
18528         ;;
18529 esac
18530
18531 echo " "
18532 case "$uidtype" in
18533 *_t) zzz="$uidtype"     ;;
18534 *)   zzz="uid"          ;;
18535 esac
18536 echo "Checking the size of $zzz..." >&4 
18537 cat > try.c <<EOCP
18538 #include <sys/types.h>
18539 #include <stdio.h>
18540 int main() {
18541     printf("%d\n", (int)sizeof($uidtype));
18542     exit(0);
18543 }
18544 EOCP
18545 set try
18546 if eval $compile_ok; then
18547         yyy=`$run ./try`
18548         case "$yyy" in
18549         '')     uidsize=4
18550                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
18551                 ;;
18552         *)      uidsize=$yyy
18553                 echo "Your $zzz is $uidsize bytes long."
18554                 ;;
18555         esac
18556 else
18557         uidsize=4
18558         echo "(I can't compile the test program--guessing $uidsize.)" >&4
18559 fi
18560
18561 echo " "
18562 case "$uidtype" in
18563 *_t) zzz="$uidtype"     ;;
18564 *)   zzz="uid"          ;;
18565 esac
18566 echo "Checking the sign of $zzz..." >&4
18567 cat > try.c <<EOCP
18568 #include <sys/types.h>
18569 #include <stdio.h>
18570 int main() {
18571         $uidtype foo = -1;
18572         if (foo < 0)
18573                 printf("-1\n");
18574         else
18575                 printf("1\n");
18576 }
18577 EOCP
18578 set try
18579 if eval $compile; then
18580         yyy=`$run ./try`
18581         case "$yyy" in
18582         '')     uidsign=1
18583                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18584                 ;;
18585         *)      uidsign=$yyy
18586                 case "$uidsign" in
18587                  1) echo "Your $zzz is unsigned." ;;
18588                 -1) echo "Your $zzz is signed."   ;;
18589                 esac
18590                 ;;
18591         esac
18592 else
18593         uidsign=1
18594         echo "(I can't compile the test program--guessing unsigned.)" >&4
18595 fi
18596
18597
18598
18599 echo " "
18600 $echo "Checking the format string to be used for uids..." >&4
18601
18602 case "$uidsign" in
18603 -1)     if $test X"$uidsize" = X"$ivsize"; then
18604                 uidformat="$ivdformat"
18605         else
18606                 if $test X"$uidsize" = X"$longsize"; then
18607                         uidformat='"ld"'
18608                 else
18609                         if $test X"$uidsize" = X"$intsize"; then
18610                                 uidformat='"d"'
18611                         else
18612                                 if $test X"$uidsize" = X"$shortsize"; then
18613                                         uidformat='"hd"'
18614                                 fi
18615                         fi
18616                 fi
18617         fi
18618         ;;
18619 *)      if $test X"$uidsize" = X"$uvsize"; then
18620                 uidformat="$uvuformat"
18621         else
18622                 if $test X"$uidsize" = X"$longsize"; then
18623                         uidformat='"lu"'
18624                 else
18625                         if $test X"$uidsize" = X"$intsize"; then
18626                                 uidformat='"u"'
18627                         else
18628                                 if $test X"$uidsize" = X"$shortsize"; then
18629                                         uidformat='"hu"'
18630                                 fi
18631                         fi
18632                 fi
18633         fi
18634         ;;
18635 esac
18636
18637 : determine compiler compiler
18638 case "$yacc" in
18639 '')
18640         dflt=yacc;;
18641 *)
18642         dflt="$yacc";;
18643 esac
18644 echo " "
18645 comp='yacc'
18646 if $test -f "$byacc$_exe"; then
18647         dflt="$byacc"
18648         comp="byacc or $comp"
18649 fi
18650 if $test -f "$bison$_exe"; then
18651         comp="$comp or bison -y"
18652 fi
18653 rp="Which compiler compiler ($comp) shall I use?"
18654 . ./myread
18655 yacc="$ans"
18656 case "$yacc" in
18657 *bis*)
18658         case "$yacc" in
18659         *-y*) ;;
18660         *)
18661                 yacc="$yacc -y"
18662                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
18663                 ;;
18664         esac
18665         ;;
18666 esac
18667
18668 : see if this is a fp.h system
18669 set fp.h i_fp
18670 eval $inhdr
18671
18672 : see if this is a fp_class.h system
18673 set fp_class.h i_fp_class
18674 eval $inhdr
18675
18676 : see if this is a ieeefp.h system
18677 case "$i_ieeefp" in
18678 '' ) set ieeefp.h i_ieeefp
18679      eval $inhdr
18680      ;;
18681 esac
18682
18683 : see if this is a libutil.h system
18684 set libutil.h i_libutil
18685 eval $inhdr
18686
18687 : see if mach cthreads are available
18688 if test "X$usethreads" = "X$define"; then
18689         set mach/cthreads.h i_machcthr
18690         eval $inhdr
18691 else
18692         i_machcthr="$undef"
18693 fi
18694
18695
18696
18697 : see if this is a math.h system
18698 set math.h i_math
18699 eval $inhdr
18700
18701 : see if this is a mntent.h system
18702 set mntent.h i_mntent
18703 eval $inhdr
18704
18705 : see if ndbm.h is available
18706 set ndbm.h t_ndbm
18707 eval $inhdr
18708
18709 case "$t_ndbm" in
18710 $undef)
18711     # Some Linux distributions such as RedHat 7.1 put the
18712     # ndbm.h header in /usr/include/gdbm/ndbm.h.
18713     if $test -f /usr/include/gdbm/ndbm.h; then
18714         echo '<gdbm/ndbm.h> found.'
18715         ccflags="$ccflags -I/usr/include/gdbm"
18716         cppflags="$cppflags -I/usr/include/gdbm"
18717         t_ndbm=$define
18718     fi
18719     ;;
18720 esac
18721
18722 case "$t_ndbm" in
18723 $define)
18724         : see if dbm_open exists
18725         set dbm_open d_dbm_open
18726         eval $inlibc
18727         case "$d_dbm_open" in
18728         $undef)
18729                 t_ndbm="$undef"
18730                 echo "We won't be including <ndbm.h>"
18731                 ;;
18732         esac
18733         ;;
18734 esac
18735 val="$t_ndbm"
18736 set i_ndbm
18737 eval $setvar
18738
18739 : see if net/errno.h is available
18740 val=''
18741 set net/errno.h val
18742 eval $inhdr
18743
18744 : Unfortunately, it causes problems on some systems.  Arrgh.
18745 case "$val" in
18746 $define)
18747         cat > try.c <<'EOM'
18748 #include <stdio.h>
18749 #include <errno.h>
18750 #include <net/errno.h>
18751 int func()
18752 {
18753         return ENOTSOCK;
18754 }
18755 EOM
18756         if $cc $ccflags -c try.c >/dev/null 2>&1; then
18757                 echo "We'll be including <net/errno.h>." >&4
18758         else
18759                 echo "We won't be including <net/errno.h>." >&4
18760                 val="$undef"
18761         fi
18762         $rm -f try.* try
18763         ;;
18764 esac
18765 set i_neterrno
18766 eval $setvar
18767
18768 : see if netinet/tcp.h is available
18769 set netinet/tcp.h i_netinettcp
18770 eval $inhdr
18771
18772 : see if this is a poll.h system
18773 set poll.h i_poll
18774 eval $inhdr
18775
18776 : see if this is a prot.h system
18777 set prot.h i_prot
18778 eval $inhdr
18779
18780 echo " "
18781 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
18782 $cat <<'EOSH' > Cppsym.know
18783 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
18784 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
18785 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
18786 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
18787 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
18788 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
18789 bull c cadmus clipper CMU COFF COMPILER_VERSION
18790 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
18791 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
18792 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
18793 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
18794 GLIBC GLIBC_MINOR
18795 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
18796 H3050R H3050RX hbullx20 hcx host_mips
18797 hp200 hp300 hp700 HP700 hp800 hp9000
18798 hp9000s200 hp9000s300 hp9000s400 hp9000s500
18799 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
18800 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
18801 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
18802 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
18803 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
18804 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
18805 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
18806 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
18807 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
18808 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
18809 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
18810 MATH_HAS_NO_SIDE_EFFECTS
18811 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
18812 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
18813 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
18814 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
18815 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
18816 NetBSD news1500 news1700 news1800 news1900 news3700
18817 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
18818 ns32016 ns32332 ns32k nsc32000
18819 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
18820 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
18821 pc532 pdp11 PGC PIC plexus PORTAR posix
18822 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
18823 POSIX_C_SOURCE POSIX_SOURCE POWER
18824 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
18825 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
18826 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
18827 sony sony_news sonyrisc sparc sparclite spectrum
18828 stardent stdc STDC_EXT stratos sun sun3 sun386
18829 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
18830 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
18831 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
18832 sysV68 sysV88 Tek4132 Tek4300 titan
18833 TM3200 TM5400 TM5600
18834 tower tower32 tower32_200 tower32_600 tower32_700
18835 tower32_800 tower32_850 tss
18836 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
18837 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
18838 unix UNIX95 UNIX99 unixpc unos
18839 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
18840 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
18841 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
18842 USGr4 USGr4_2
18843 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
18844 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
18845 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
18846 z8000
18847 EOSH
18848 # Maybe put other stuff here too.
18849 cat <<EOSH >>Cppsym.know
18850 $osname
18851 EOSH
18852 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
18853 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
18854 $cat Cppsym.know > Cppsym.c
18855 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
18856 $rm -f Cppsym.a Cppsym.b Cppsym.c
18857 cat <<EOSH > Cppsym
18858 $startsh
18859 if $test \$# -gt 0; then
18860     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
18861     if $test -s Cppsym.got; then
18862         $rm -f Cppsym.got
18863         exit 0
18864     fi
18865     $rm -f Cppsym.got
18866     exit 1
18867 else
18868     $tr " " "$trnl" | ./Cppsym.try
18869     exit 0
18870 fi
18871 EOSH
18872 chmod +x Cppsym
18873 $eunicefix Cppsym
18874 cat <<EOSH > Cppsym.try
18875 $startsh
18876 cat <<'EOCP' > try.c
18877 #include <stdio.h>
18878 int main() {
18879 EOCP
18880 $awk \\
18881 EOSH
18882 cat <<'EOSH' >> Cppsym.try
18883 'length($1) > 0 {
18884     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
18885     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
18886     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
18887     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
18888 }'       >> try.c
18889 echo 'return 0;}' >> try.c
18890 EOSH
18891 cat <<EOSH >> Cppsym.try
18892 ccflags="$ccflags"
18893 case "$osname-$gccversion" in
18894 irix-) ccflags="\$ccflags -woff 1178" ;;
18895 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
18896 esac
18897 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
18898 EOSH
18899 chmod +x Cppsym.try
18900 $eunicefix Cppsym.try
18901 ./Cppsym < Cppsym.know > Cppsym.true
18902 : now check the C compiler for additional symbols
18903 postprocess_cc_v=''
18904 case "$osname" in
18905 aix) postprocess_cc_v="|$tr , ' '" ;;
18906 esac
18907 $cat >ccsym <<EOS
18908 $startsh
18909 $cat >tmp.c <<EOF
18910 extern int foo;
18911 EOF
18912 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
18913 do
18914         case "\$i" in
18915         -D*) echo "\$i" | $sed 's/^-D//';;
18916         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
18917         esac
18918 done
18919 $rm -f try.c
18920 EOS
18921 postprocess_cc_v=''
18922 chmod +x ccsym
18923 $eunicefix ccsym
18924 ./ccsym > ccsym1.raw
18925 if $test -s ccsym1.raw; then
18926        $sort ccsym1.raw | $uniq >ccsym.raw
18927 else
18928        mv ccsym1.raw ccsym.raw
18929 fi
18930
18931 $awk '/\=/ { print $0; next }
18932         { print $0"=1" }' ccsym.raw >ccsym.list
18933 $awk '/\=/ { print $0; next }
18934         { print $0"=1" }' Cppsym.true >ccsym.true
18935 $comm -13 ccsym.true ccsym.list >ccsym.own
18936 $comm -12 ccsym.true ccsym.list >ccsym.com
18937 $comm -23 ccsym.true ccsym.list >ccsym.cpp
18938 also=''
18939 if $test -z ccsym.raw; then
18940         echo "Your C compiler doesn't seem to define any symbols!" >&4
18941         echo " "
18942         echo "However, your C preprocessor defines the following symbols:"
18943         $cat Cppsym.true
18944         ccsymbols=''
18945         cppsymbols=`$cat Cppsym.true`
18946         cppsymbols=`echo $cppsymbols`
18947         cppccsymbols="$cppsymbols"
18948 else
18949         if $test -s ccsym.com; then
18950                 echo "Your C compiler and pre-processor define these symbols:"
18951                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
18952                 also='also '
18953                 symbols='ones'
18954                 cppccsymbols=`$cat ccsym.com`
18955                 cppccsymbols=`echo $cppccsymbols`
18956                 $test "$silent" || sleep 1
18957         fi
18958         if $test -s ccsym.cpp; then
18959                 $test "$also" && echo " "
18960                 echo "Your C pre-processor ${also}defines the following symbols:"
18961                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
18962                 also='further '
18963                 cppsymbols=`$cat ccsym.cpp`
18964                 cppsymbols=`echo $cppsymbols`
18965                 $test "$silent" || sleep 1
18966         fi
18967         if $test -s ccsym.own; then
18968                 $test "$also" && echo " "
18969                 echo "Your C compiler ${also}defines the following cpp symbols:"
18970                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
18971                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
18972                 ccsymbols=`$cat ccsym.own`
18973                 ccsymbols=`echo $ccsymbols`
18974                 $test "$silent" || sleep 1
18975         fi
18976 fi
18977
18978 : see if this is a termio system
18979 val="$undef"
18980 val2="$undef"
18981 val3="$undef"
18982 if $test `./findhdr termios.h`; then
18983         set tcsetattr i_termios
18984         eval $inlibc
18985         val3="$i_termios"
18986 fi
18987 echo " "
18988 case "$val3" in
18989 "$define") echo "You have POSIX termios.h... good!" >&4;;
18990 *) if ./Cppsym pyr; then
18991                 case "`/bin/universe`" in
18992                 ucb) if $test `./findhdr sgtty.h`; then
18993                                 val2="$define"
18994                                 echo "<sgtty.h> found." >&4
18995                         else
18996                                 echo "System is pyramid with BSD universe."
18997                                 echo "<sgtty.h> not found--you could have problems." >&4
18998                         fi;;
18999                 *) if $test `./findhdr termio.h`; then
19000                                 val="$define"
19001                                 echo "<termio.h> found." >&4
19002                         else
19003                                 echo "System is pyramid with USG universe."
19004                                 echo "<termio.h> not found--you could have problems." >&4
19005                         fi;;
19006                 esac
19007         elif ./usg; then
19008                 if $test `./findhdr termio.h`; then
19009                         echo "<termio.h> found." >&4
19010                         val="$define"
19011                 elif $test `./findhdr sgtty.h`; then
19012                         echo "<sgtty.h> found." >&4
19013                         val2="$define"
19014                 else
19015 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
19016                 fi
19017         else
19018                 if $test `./findhdr sgtty.h`; then
19019                         echo "<sgtty.h> found." >&4
19020                         val2="$define"
19021                 elif $test `./findhdr termio.h`; then
19022                         echo "<termio.h> found." >&4
19023                         val="$define"
19024                 else
19025 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
19026                 fi
19027         fi;;
19028 esac
19029 set i_termio; eval $setvar
19030 val=$val2; set i_sgtty; eval $setvar
19031 val=$val3; set i_termios; eval $setvar
19032
19033 : see if stddef is available
19034 set stddef.h i_stddef
19035 eval $inhdr
19036
19037 : see if this is a sunmath.h system
19038 set sunmath.h i_sunmath
19039 eval $inhdr
19040
19041 : see if sys/access.h is available
19042 set sys/access.h i_sysaccess
19043 eval $inhdr
19044
19045 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
19046 set sys/filio.h i_sysfilio
19047 eval $inhdr
19048 echo " "
19049 if $test `./findhdr sys/ioctl.h`; then
19050         val="$define"
19051         echo '<sys/ioctl.h> found.' >&4
19052 else
19053         val="$undef"
19054         if $test $i_sysfilio = "$define"; then
19055             echo '<sys/ioctl.h> NOT found.' >&4
19056         else
19057                 $test $i_sgtty = "$define" && xxx="sgtty.h"
19058                 $test $i_termio = "$define" && xxx="termio.h"
19059                 $test $i_termios = "$define" && xxx="termios.h"
19060 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
19061         fi
19062 fi
19063 set i_sysioctl
19064 eval $setvar
19065
19066 : see if socket ioctl defs are in sys/sockio.h
19067 echo " "
19068 xxx=`./findhdr sys/sockio.h`
19069 if $test "$xxx"; then
19070         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
19071                 val="$define"
19072                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
19073         else
19074                 val="$undef"
19075                 echo "No socket ioctls found in <sys/sockio.h>." >&4
19076         fi
19077 else
19078         val="$undef"
19079         $cat <<EOM
19080 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
19081 EOM
19082 fi
19083 set i_syssockio
19084 eval $setvar
19085
19086
19087 : see if this is a syslog.h system
19088 set syslog.h i_syslog
19089 eval $inhdr
19090
19091
19092 : see if this is a sys/mode.h system
19093 set sys/mode.h i_sysmode
19094 eval $inhdr
19095
19096 : see if sys/resource.h has to be included
19097 set sys/resource.h i_sysresrc
19098 eval $inhdr
19099
19100 : see if sys/security.h is available
19101 set sys/security.h i_syssecrt
19102 eval $inhdr
19103
19104 : see if this is a sys/statvfs.h system
19105 set sys/statvfs.h i_sysstatvfs
19106 eval $inhdr
19107
19108 : see if this is a sys/un.h system
19109 set sys/un.h i_sysun
19110 eval $inhdr
19111
19112
19113 : see if this is a sys/utsname.h system
19114 set sys/utsname.h i_sysutsname
19115 eval $inhdr
19116
19117 : see if this is a syswait system
19118 set sys/wait.h i_syswait
19119 eval $inhdr
19120
19121 : see if this is a ustat.h system
19122 set ustat.h i_ustat
19123 eval $inhdr
19124
19125 : see if this is an utime system
19126 set utime.h i_utime
19127 eval $inhdr
19128
19129 : see if this is a values.h system
19130 set values.h i_values
19131 eval $inhdr
19132
19133 : see if this is a vfork system
19134 case "$d_vfork" in
19135 "$define")
19136         set vfork.h i_vfork
19137         eval $inhdr
19138         ;;
19139 *)
19140         i_vfork="$undef"
19141         ;;
19142 esac
19143
19144 : see if gdbm.h is available
19145 set gdbm.h t_gdbm
19146 eval $inhdr
19147 case "$t_gdbm" in
19148 $define)
19149         : see if gdbm_open exists
19150         set gdbm_open d_gdbm_open
19151         eval $inlibc
19152         case "$d_gdbm_open" in
19153         $undef)
19154                 t_gdbm="$undef"
19155                 echo "We won't be including <gdbm.h>"
19156                 ;;
19157         esac
19158         ;;
19159 esac
19160 val="$t_gdbm"
19161 set i_gdbm
19162 eval $setvar
19163
19164 echo " "
19165 echo "Looking for extensions..." >&4
19166 : If we are using the old config.sh, known_extensions may contain
19167 : old or inaccurate or duplicate values.
19168 known_extensions=''
19169 nonxs_extensions=''
19170 : We do not use find because it might not be available.
19171 : We do not just use MANIFEST because the user may have dropped
19172 : some additional extensions into the source tree and expect them
19173 : to be built.
19174
19175 : Function to recursively find available extensions, ignoring DynaLoader
19176 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
19177 find_extensions='
19178     for xxx in *; do
19179        case "$xxx" in
19180            DynaLoader|dynaload) ;;
19181            *)
19182            if $test -f $xxx/$xxx.xs; then
19183                known_extensions="$known_extensions $1$xxx";
19184            elif $test -f $xxx/Makefile.PL; then
19185                nonxs_extensions="$nonxs_extensions $1$xxx";
19186            else
19187                if $test -d $xxx -a $# -lt 10; then
19188                    set $1$xxx/ $*;
19189                    cd "$xxx";
19190                    eval $find_extensions;
19191                    cd ..;
19192                    shift;
19193                fi;
19194            fi
19195            ;;
19196        esac;
19197     done'
19198 tdir=`pwd`
19199 cd "$rsrc/ext"
19200 set X
19201 shift
19202 eval $find_extensions
19203 # Special case:  Add in threads/shared since it is not picked up by the
19204 # recursive find above (and adding in general recursive finding breaks
19205 # SDBM_File/sdbm).  A.D.  10/25/2001.
19206 known_extensions="$known_extensions threads/shared"
19207 set X $nonxs_extensions
19208 shift
19209 nonxs_extensions="$*"
19210 set X $known_extensions
19211 shift
19212 known_extensions="$*"
19213 cd "$tdir"
19214
19215 : Now see which are supported on this system.
19216 avail_ext=''
19217 for xxx in $known_extensions ; do
19218         case "$xxx" in
19219         DB_File|db_file)
19220                 case "$i_db" in
19221                 $define) avail_ext="$avail_ext $xxx" ;;
19222                 esac
19223                 ;;
19224         GDBM_File|gdbm_fil)
19225                 case "$i_gdbm" in 
19226                 $define) avail_ext="$avail_ext $xxx" ;;
19227                 esac
19228                 ;;
19229         I18N/Langinfo|i18n_lan)
19230                 case "$i_langinfo$d_nl_langinfo" in 
19231                 $define$define) avail_ext="$avail_ext $xxx" ;;
19232                 esac
19233                 ;;
19234         NDBM_File|ndbm_fil)
19235                 case "$i_ndbm" in
19236                 $define)
19237                     case "$osname-$use64bitint" in
19238                     cygwin-*|hpux-define)
19239                         case "$libs" in
19240                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
19241                         esac
19242                         ;;
19243                     *) avail_ext="$avail_ext $xxx" ;;
19244                     esac
19245                     ;;
19246                 esac
19247                 ;;
19248         ODBM_File|odbm_fil) 
19249                 case "${i_dbm}${i_rpcsvcdbm}" in
19250                 *"${define}"*)
19251                     case "$osname-$use64bitint" in
19252                     cygwin-*|hpux-define)
19253                         case "$libs" in
19254                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
19255                         esac
19256                         ;;
19257                     *) avail_ext="$avail_ext $xxx" ;;
19258                     esac
19259                     ;;
19260                 esac
19261                 ;;
19262         POSIX|posix)
19263                 case "$useposix" in
19264                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19265                 esac
19266                 ;;
19267         Opcode|opcode)
19268                 case "$useopcode" in
19269                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19270                 esac
19271                 ;;
19272         Socket|socket)
19273                 case "$d_socket" in 
19274                 true|$define|y)
19275                     case "$osname" in
19276                     beos) ;; # not unless BONE
19277                     *) avail_ext="$avail_ext $xxx" ;;
19278                     esac
19279                     ;;
19280                 esac
19281                 ;;
19282         Sys/Syslog|sys/syslog)
19283                 : XXX syslog requires socket
19284                 case "$d_socket" in 
19285                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
19286                 esac
19287                 ;;
19288         Thread|thread)
19289                 case "$usethreads" in
19290                 true|$define|y)
19291                         case "$useithreads" in
19292                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
19293                         esac
19294                 esac
19295                 ;;
19296         threads|threads/shared)
19297                 # threads and threads::shared are special cases.
19298                 # To stop people from asking "Perl 5.8.0 was supposed
19299                 # to have this new fancy threads implementation but my
19300                 # perl doesn't have it" and from people trying to
19301                 # (re)install the threads module using CPAN.pm and
19302                 # CPAN.pm then offering to reinstall Perl 5.8.0,
19303                 # the threads.pm and threads/shared.pm will always be
19304                 # there, croaking informatively ("you need to rebuild
19305                 # all of Perl with threads, sorry") when threads haven't
19306                 # been compiled in.
19307                 # --jhi
19308                 avail_ext="$avail_ext $xxx"
19309                 ;;
19310         IPC/SysV|ipc/sysv)
19311                 : XXX Do we need a useipcsysv variable here
19312                 case "${d_msg}${d_sem}${d_shm}" in 
19313                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
19314                 esac
19315                 ;;
19316         *)      avail_ext="$avail_ext $xxx"
19317                 ;;
19318         esac
19319 done
19320
19321 set X $avail_ext
19322 shift
19323 avail_ext="$*"
19324
19325 : Now see which nonxs extensions are supported on this system.
19326 : For now assume all are.
19327 nonxs_ext=''
19328 for xxx in $nonxs_extensions ; do
19329         case "$xxx" in
19330         *)      nonxs_ext="$nonxs_ext $xxx"
19331                 ;;
19332         esac
19333 done
19334
19335 set X $nonxs_ext
19336 shift
19337 nonxs_ext="$*"
19338
19339 case $usedl in
19340 $define)
19341         $cat <<EOM
19342 A number of extensions are supplied with $package.  You may choose to
19343 compile these extensions for dynamic loading (the default), compile
19344 them into the $package executable (static loading), or not include
19345 them at all.  Answer "none" to include no extensions.
19346 Note that DynaLoader is always built and need not be mentioned here.
19347
19348 EOM
19349         case "$dynamic_ext" in
19350         '') dflt="$avail_ext" ;;
19351         *)      dflt="$dynamic_ext"
19352                 # Perhaps we are reusing an old out-of-date config.sh.
19353                 case "$hint" in
19354                 previous)
19355                         if test X"$dynamic_ext" != X"$avail_ext"; then
19356                                 $cat <<EOM
19357 NOTICE:  Your previous config.sh list may be incorrect. 
19358 The extensions now available to you are 
19359         ${avail_ext}
19360 but the default list from your previous config.sh is
19361         ${dynamic_ext} 
19362
19363 EOM
19364                         fi
19365                         ;;
19366                 esac
19367                 ;;
19368         esac
19369         case "$dflt" in
19370         '')     dflt=none;;
19371         esac
19372         rp="What extensions do you wish to load dynamically?"
19373         . ./myread
19374         case "$ans" in
19375         none) dynamic_ext=' ' ;;
19376         *) dynamic_ext="$ans" ;;
19377         esac
19378
19379         case "$static_ext" in
19380         '')
19381                 : Exclude those already listed in dynamic linking
19382                 dflt=''
19383                 for xxx in $avail_ext; do
19384                         case " $dynamic_ext " in
19385                         *" $xxx "*) ;;
19386                         *) dflt="$dflt $xxx" ;;
19387                         esac
19388                 done
19389                 set X $dflt
19390                 shift
19391                 dflt="$*"
19392                 ;;
19393         *)  dflt="$static_ext" 
19394                 ;;
19395         esac
19396
19397         case "$dflt" in
19398         '')     dflt=none;;
19399         esac
19400         rp="What extensions do you wish to load statically?"
19401         . ./myread
19402         case "$ans" in
19403         none) static_ext=' ' ;;
19404         *) static_ext="$ans" ;;
19405         esac
19406         ;;
19407 *)
19408         $cat <<EOM
19409 A number of extensions are supplied with $package.  Answer "none" 
19410 to include no extensions. 
19411 Note that DynaLoader is always built and need not be mentioned here.
19412
19413 EOM
19414         case "$static_ext" in
19415         '') dflt="$avail_ext" ;;
19416         *)      dflt="$static_ext"
19417                 # Perhaps we are reusing an old out-of-date config.sh.
19418                 case "$hint" in
19419                 previous)
19420                         if test X"$static_ext" != X"$avail_ext"; then
19421                                 $cat <<EOM
19422 NOTICE:  Your previous config.sh list may be incorrect. 
19423 The extensions now available to you are 
19424         ${avail_ext}
19425 but the default list from your previous config.sh is
19426         ${static_ext} 
19427
19428 EOM
19429                         fi
19430                         ;;
19431                 esac
19432                 ;;
19433         esac
19434         : Exclude those that are not xs extensions
19435         case "$dflt" in
19436         '')     dflt=none;;
19437         esac
19438         rp="What extensions do you wish to include?"
19439         . ./myread
19440         case "$ans" in
19441         none) static_ext=' ' ;;
19442         *) static_ext="$ans" ;;
19443         esac
19444         ;;
19445 esac
19446 #        
19447 # Encode is a special case.  If we are building Encode as a static
19448 # extension, we need to explicitly list its subextensions as well.
19449 # For other nested extensions, this is handled automatically by
19450 # the appropriate Makefile.PL.
19451 case " $static_ext " in
19452         *" Encode "*) # Add the subextensions of Encode
19453         cd "$rsrc/ext"
19454         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
19455                 static_ext="$static_ext Encode/$xxx"
19456         done
19457         cd "$tdir"
19458         ;;
19459 esac
19460
19461 set X $dynamic_ext $static_ext $nonxs_ext
19462 shift
19463 extensions="$*"
19464
19465 : Remove libraries needed only for extensions
19466 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
19467 : The exception is SunOS 4.x, which needs them.
19468 case "${osname}X${osvers}" in
19469 sunos*X4*)
19470     perllibs="$libs"
19471     ;;
19472 *) case "$usedl" in
19473     $define|true|[yY]*)
19474             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
19475             shift
19476             perllibs="$*"
19477             ;;
19478     *)  perllibs="$libs"
19479             ;;
19480     esac
19481     ;;
19482 esac
19483
19484 : Remove build directory name from cppstdin so it can be used from
19485 : either the present location or the final installed location.
19486 echo " "
19487 : Get out of the UU directory to get correct path name.
19488 cd ..
19489 case "$cppstdin" in
19490 `pwd`/cppstdin)
19491         echo "Stripping down cppstdin path name"
19492         cppstdin=cppstdin
19493         ;;
19494 esac
19495 cd UU
19496
19497 : end of configuration questions
19498 echo " "
19499 echo "End of configuration questions."
19500 echo " "
19501
19502 : back to where it started
19503 if test -d ../UU; then
19504         cd ..
19505 fi
19506
19507 : configuration may be patched via a 'config.arch' file
19508 if $test -f config.arch; then
19509         echo "I see a config.arch file, loading it."
19510         . ./config.arch
19511 fi
19512
19513 : configuration may be patched via a 'config.over' file
19514 if $test -f config.over; then
19515         echo " "
19516         dflt=y
19517         rp='I see a config.over file.  Do you wish to load it?'
19518         . UU/myread
19519         case "$ans" in
19520         n*) echo "OK, I'll ignore it.";;
19521         *)      . ./config.over
19522                 echo "Configuration override changes have been loaded."
19523                 ;;
19524         esac
19525 fi
19526
19527 : in case they want portability, strip down executable paths
19528 case "$d_portable" in
19529 "$define")
19530         echo " "
19531         echo "Stripping down executable paths..." >&4
19532         for file in $loclist $trylist; do
19533                 eval temp=\$$file
19534                 eval $file=`basename $temp`
19535         done
19536         ;;
19537 esac
19538
19539 : create config.sh file
19540 echo " "
19541 echo "Creating config.sh..." >&4
19542 $spitshell <<EOT >config.sh
19543 $startsh
19544 #
19545 # This file was produced by running the Configure script. It holds all the
19546 # definitions figured out by Configure. Should you modify one of these values,
19547 # do not forget to propagate your changes by running "Configure -der". You may
19548 # instead choose to run each of the .SH files by yourself, or "Configure -S".
19549 #
19550
19551 # Package name      : $package
19552 # Source directory  : $src
19553 # Configuration time: $cf_time
19554 # Configured by     : $cf_by
19555 # Target system     : $myuname
19556
19557 Author='$Author'
19558 Date='$Date'
19559 Header='$Header'
19560 Id='$Id'
19561 Locker='$Locker'
19562 Log='$Log'
19563 Mcc='$Mcc'
19564 RCSfile='$RCSfile'
19565 Revision='$Revision'
19566 Source='$Source'
19567 State='$State'
19568 _a='$_a'
19569 _exe='$_exe'
19570 _o='$_o'
19571 afs='$afs'
19572 afsroot='$afsroot'
19573 alignbytes='$alignbytes'
19574 ansi2knr='$ansi2knr'
19575 aphostname='$aphostname'
19576 api_revision='$api_revision'
19577 api_subversion='$api_subversion'
19578 api_version='$api_version'
19579 api_versionstring='$api_versionstring'
19580 ar='$ar'
19581 archlib='$archlib'
19582 archlibexp='$archlibexp'
19583 archname64='$archname64'
19584 archname='$archname'
19585 archobjs='$archobjs'
19586 asctime_r_proto='$asctime_r_proto'
19587 awk='$awk'
19588 baserev='$baserev'
19589 bash='$bash'
19590 bin='$bin'
19591 binexp='$binexp'
19592 bison='$bison'
19593 byacc='$byacc'
19594 byteorder='$byteorder'
19595 c='$c'
19596 castflags='$castflags'
19597 cat='$cat'
19598 cc='$cc'
19599 cccdlflags='$cccdlflags'
19600 ccdlflags='$ccdlflags'
19601 ccflags='$ccflags'
19602 ccflags_uselargefiles='$ccflags_uselargefiles'
19603 ccname='$ccname'
19604 ccsymbols='$ccsymbols'
19605 ccversion='$ccversion'
19606 cf_by='$cf_by'
19607 cf_email='$cf_email'
19608 cf_time='$cf_time'
19609 charsize='$charsize'
19610 chgrp='$chgrp'
19611 chmod='$chmod'
19612 chown='$chown'
19613 clocktype='$clocktype'
19614 comm='$comm'
19615 compress='$compress'
19616 contains='$contains'
19617 cp='$cp'
19618 cpio='$cpio'
19619 cpp='$cpp'
19620 cpp_stuff='$cpp_stuff'
19621 cppccsymbols='$cppccsymbols'
19622 cppflags='$cppflags'
19623 cpplast='$cpplast'
19624 cppminus='$cppminus'
19625 cpprun='$cpprun'
19626 cppstdin='$cppstdin'
19627 cppsymbols='$cppsymbols'
19628 crypt_r_proto='$crypt_r_proto'
19629 cryptlib='$cryptlib'
19630 csh='$csh'
19631 ctermid_r_proto='$ctermid_r_proto'
19632 ctime_r_proto='$ctime_r_proto'
19633 d_Gconvert='$d_Gconvert'
19634 d_PRIEUldbl='$d_PRIEUldbl'
19635 d_PRIFUldbl='$d_PRIFUldbl'
19636 d_PRIGUldbl='$d_PRIGUldbl'
19637 d_PRIXU64='$d_PRIXU64'
19638 d_PRId64='$d_PRId64'
19639 d_PRIeldbl='$d_PRIeldbl'
19640 d_PRIfldbl='$d_PRIfldbl'
19641 d_PRIgldbl='$d_PRIgldbl'
19642 d_PRIi64='$d_PRIi64'
19643 d_PRIo64='$d_PRIo64'
19644 d_PRIu64='$d_PRIu64'
19645 d_PRIx64='$d_PRIx64'
19646 d_SCNfldbl='$d_SCNfldbl'
19647 d__fwalk='$d__fwalk'
19648 d_access='$d_access'
19649 d_accessx='$d_accessx'
19650 d_alarm='$d_alarm'
19651 d_archlib='$d_archlib'
19652 d_asctime_r='$d_asctime_r'
19653 d_atolf='$d_atolf'
19654 d_atoll='$d_atoll'
19655 d_attribut='$d_attribut'
19656 d_bcmp='$d_bcmp'
19657 d_bcopy='$d_bcopy'
19658 d_bsd='$d_bsd'
19659 d_bsdgetpgrp='$d_bsdgetpgrp'
19660 d_bsdsetpgrp='$d_bsdsetpgrp'
19661 d_bzero='$d_bzero'
19662 d_casti32='$d_casti32'
19663 d_castneg='$d_castneg'
19664 d_charvspr='$d_charvspr'
19665 d_chown='$d_chown'
19666 d_chroot='$d_chroot'
19667 d_chsize='$d_chsize'
19668 d_class='$d_class'
19669 d_closedir='$d_closedir'
19670 d_cmsghdr_s='$d_cmsghdr_s'
19671 d_const='$d_const'
19672 d_crypt='$d_crypt'
19673 d_crypt_r='$d_crypt_r'
19674 d_csh='$d_csh'
19675 d_ctermid_r='$d_ctermid_r'
19676 d_ctime_r='$d_ctime_r'
19677 d_cuserid='$d_cuserid'
19678 d_dbl_dig='$d_dbl_dig'
19679 d_dbminitproto='$d_dbminitproto'
19680 d_difftime='$d_difftime'
19681 d_dirfd='$d_dirfd'
19682 d_dirnamlen='$d_dirnamlen'
19683 d_dlerror='$d_dlerror'
19684 d_dlopen='$d_dlopen'
19685 d_dlsymun='$d_dlsymun'
19686 d_dosuid='$d_dosuid'
19687 d_drand48_r='$d_drand48_r'
19688 d_drand48proto='$d_drand48proto'
19689 d_dup2='$d_dup2'
19690 d_eaccess='$d_eaccess'
19691 d_endgrent='$d_endgrent'
19692 d_endgrent_r='$d_endgrent_r'
19693 d_endhent='$d_endhent'
19694 d_endhostent_r='$d_endhostent_r'
19695 d_endnent='$d_endnent'
19696 d_endnetent_r='$d_endnetent_r'
19697 d_endpent='$d_endpent'
19698 d_endprotoent_r='$d_endprotoent_r'
19699 d_endpwent='$d_endpwent'
19700 d_endpwent_r='$d_endpwent_r'
19701 d_endsent='$d_endsent'
19702 d_endservent_r='$d_endservent_r'
19703 d_eofnblk='$d_eofnblk'
19704 d_eunice='$d_eunice'
19705 d_fchdir='$d_fchdir'
19706 d_fchmod='$d_fchmod'
19707 d_fchown='$d_fchown'
19708 d_fcntl='$d_fcntl'
19709 d_fcntl_can_lock='$d_fcntl_can_lock'
19710 d_fd_macros='$d_fd_macros'
19711 d_fd_set='$d_fd_set'
19712 d_fds_bits='$d_fds_bits'
19713 d_fgetpos='$d_fgetpos'
19714 d_finite='$d_finite'
19715 d_finitel='$d_finitel'
19716 d_flexfnam='$d_flexfnam'
19717 d_flock='$d_flock'
19718 d_flockproto='$d_flockproto'
19719 d_fork='$d_fork'
19720 d_fp_class='$d_fp_class'
19721 d_fpathconf='$d_fpathconf'
19722 d_fpclass='$d_fpclass'
19723 d_fpclassify='$d_fpclassify'
19724 d_fpclassl='$d_fpclassl'
19725 d_fpos64_t='$d_fpos64_t'
19726 d_frexpl='$d_frexpl'
19727 d_fs_data_s='$d_fs_data_s'
19728 d_fseeko='$d_fseeko'
19729 d_fsetpos='$d_fsetpos'
19730 d_fstatfs='$d_fstatfs'
19731 d_fstatvfs='$d_fstatvfs'
19732 d_fsync='$d_fsync'
19733 d_ftello='$d_ftello'
19734 d_ftime='$d_ftime'
19735 d_getcwd='$d_getcwd'
19736 d_getespwnam='$d_getespwnam'
19737 d_getfsstat='$d_getfsstat'
19738 d_getgrent='$d_getgrent'
19739 d_getgrent_r='$d_getgrent_r'
19740 d_getgrgid_r='$d_getgrgid_r'
19741 d_getgrnam_r='$d_getgrnam_r'
19742 d_getgrps='$d_getgrps'
19743 d_gethbyaddr='$d_gethbyaddr'
19744 d_gethbyname='$d_gethbyname'
19745 d_gethent='$d_gethent'
19746 d_gethname='$d_gethname'
19747 d_gethostbyaddr_r='$d_gethostbyaddr_r'
19748 d_gethostbyname_r='$d_gethostbyname_r'
19749 d_gethostent_r='$d_gethostent_r'
19750 d_gethostprotos='$d_gethostprotos'
19751 d_getitimer='$d_getitimer'
19752 d_getlogin='$d_getlogin'
19753 d_getlogin_r='$d_getlogin_r'
19754 d_getmnt='$d_getmnt'
19755 d_getmntent='$d_getmntent'
19756 d_getnbyaddr='$d_getnbyaddr'
19757 d_getnbyname='$d_getnbyname'
19758 d_getnent='$d_getnent'
19759 d_getnetbyaddr_r='$d_getnetbyaddr_r'
19760 d_getnetbyname_r='$d_getnetbyname_r'
19761 d_getnetent_r='$d_getnetent_r'
19762 d_getnetprotos='$d_getnetprotos'
19763 d_getpagsz='$d_getpagsz'
19764 d_getpbyname='$d_getpbyname'
19765 d_getpbynumber='$d_getpbynumber'
19766 d_getpent='$d_getpent'
19767 d_getpgid='$d_getpgid'
19768 d_getpgrp2='$d_getpgrp2'
19769 d_getpgrp='$d_getpgrp'
19770 d_getppid='$d_getppid'
19771 d_getprior='$d_getprior'
19772 d_getprotobyname_r='$d_getprotobyname_r'
19773 d_getprotobynumber_r='$d_getprotobynumber_r'
19774 d_getprotoent_r='$d_getprotoent_r'
19775 d_getprotoprotos='$d_getprotoprotos'
19776 d_getprpwnam='$d_getprpwnam'
19777 d_getpwent='$d_getpwent'
19778 d_getpwent_r='$d_getpwent_r'
19779 d_getpwnam_r='$d_getpwnam_r'
19780 d_getpwuid_r='$d_getpwuid_r'
19781 d_getsbyname='$d_getsbyname'
19782 d_getsbyport='$d_getsbyport'
19783 d_getsent='$d_getsent'
19784 d_getservbyname_r='$d_getservbyname_r'
19785 d_getservbyport_r='$d_getservbyport_r'
19786 d_getservent_r='$d_getservent_r'
19787 d_getservprotos='$d_getservprotos'
19788 d_getspnam='$d_getspnam'
19789 d_getspnam_r='$d_getspnam_r'
19790 d_gettimeod='$d_gettimeod'
19791 d_gmtime_r='$d_gmtime_r'
19792 d_gnulibc='$d_gnulibc'
19793 d_grpasswd='$d_grpasswd'
19794 d_hasmntopt='$d_hasmntopt'
19795 d_htonl='$d_htonl'
19796 d_index='$d_index'
19797 d_inetaton='$d_inetaton'
19798 d_int64_t='$d_int64_t'
19799 d_isascii='$d_isascii'
19800 d_isfinite='$d_isfinite'
19801 d_isinf='$d_isinf'
19802 d_isnan='$d_isnan'
19803 d_isnanl='$d_isnanl'
19804 d_killpg='$d_killpg'
19805 d_lchown='$d_lchown'
19806 d_ldbl_dig='$d_ldbl_dig'
19807 d_link='$d_link'
19808 d_localtime_r='$d_localtime_r'
19809 d_locconv='$d_locconv'
19810 d_lockf='$d_lockf'
19811 d_longdbl='$d_longdbl'
19812 d_longlong='$d_longlong'
19813 d_lseekproto='$d_lseekproto'
19814 d_lstat='$d_lstat'
19815 d_madvise='$d_madvise'
19816 d_mblen='$d_mblen'
19817 d_mbstowcs='$d_mbstowcs'
19818 d_mbtowc='$d_mbtowc'
19819 d_memchr='$d_memchr'
19820 d_memcmp='$d_memcmp'
19821 d_memcpy='$d_memcpy'
19822 d_memmove='$d_memmove'
19823 d_memset='$d_memset'
19824 d_mkdir='$d_mkdir'
19825 d_mkdtemp='$d_mkdtemp'
19826 d_mkfifo='$d_mkfifo'
19827 d_mkstemp='$d_mkstemp'
19828 d_mkstemps='$d_mkstemps'
19829 d_mktime='$d_mktime'
19830 d_mmap='$d_mmap'
19831 d_modfl='$d_modfl'
19832 d_modfl_pow32_bug='$d_modfl_pow32_bug'
19833 d_mprotect='$d_mprotect'
19834 d_msg='$d_msg'
19835 d_msg_ctrunc='$d_msg_ctrunc'
19836 d_msg_dontroute='$d_msg_dontroute'
19837 d_msg_oob='$d_msg_oob'
19838 d_msg_peek='$d_msg_peek'
19839 d_msg_proxy='$d_msg_proxy'
19840 d_msgctl='$d_msgctl'
19841 d_msgget='$d_msgget'
19842 d_msghdr_s='$d_msghdr_s'
19843 d_msgrcv='$d_msgrcv'
19844 d_msgsnd='$d_msgsnd'
19845 d_msync='$d_msync'
19846 d_munmap='$d_munmap'
19847 d_mymalloc='$d_mymalloc'
19848 d_nice='$d_nice'
19849 d_nl_langinfo='$d_nl_langinfo'
19850 d_nv_preserves_uv='$d_nv_preserves_uv'
19851 d_off64_t='$d_off64_t'
19852 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
19853 d_oldpthreads='$d_oldpthreads'
19854 d_oldsock='$d_oldsock'
19855 d_open3='$d_open3'
19856 d_pathconf='$d_pathconf'
19857 d_pause='$d_pause'
19858 d_perl_otherlibdirs='$d_perl_otherlibdirs'
19859 d_phostname='$d_phostname'
19860 d_pipe='$d_pipe'
19861 d_poll='$d_poll'
19862 d_portable='$d_portable'
19863 d_procselfexe='$d_procselfexe'
19864 d_pthread_atfork='$d_pthread_atfork'
19865 d_pthread_yield='$d_pthread_yield'
19866 d_pwage='$d_pwage'
19867 d_pwchange='$d_pwchange'
19868 d_pwclass='$d_pwclass'
19869 d_pwcomment='$d_pwcomment'
19870 d_pwexpire='$d_pwexpire'
19871 d_pwgecos='$d_pwgecos'
19872 d_pwpasswd='$d_pwpasswd'
19873 d_pwquota='$d_pwquota'
19874 d_qgcvt='$d_qgcvt'
19875 d_quad='$d_quad'
19876 d_random_r='$d_random_r'
19877 d_readdir64_r='$d_readdir64_r'
19878 d_readdir='$d_readdir'
19879 d_readdir_r='$d_readdir_r'
19880 d_readlink='$d_readlink'
19881 d_readv='$d_readv'
19882 d_recvmsg='$d_recvmsg'
19883 d_rename='$d_rename'
19884 d_rewinddir='$d_rewinddir'
19885 d_rmdir='$d_rmdir'
19886 d_safebcpy='$d_safebcpy'
19887 d_safemcpy='$d_safemcpy'
19888 d_sanemcmp='$d_sanemcmp'
19889 d_sbrkproto='$d_sbrkproto'
19890 d_sched_yield='$d_sched_yield'
19891 d_scm_rights='$d_scm_rights'
19892 d_seekdir='$d_seekdir'
19893 d_select='$d_select'
19894 d_sem='$d_sem'
19895 d_semctl='$d_semctl'
19896 d_semctl_semid_ds='$d_semctl_semid_ds'
19897 d_semctl_semun='$d_semctl_semun'
19898 d_semget='$d_semget'
19899 d_semop='$d_semop'
19900 d_sendmsg='$d_sendmsg'
19901 d_setegid='$d_setegid'
19902 d_seteuid='$d_seteuid'
19903 d_setgrent='$d_setgrent'
19904 d_setgrent_r='$d_setgrent_r'
19905 d_setgrps='$d_setgrps'
19906 d_sethent='$d_sethent'
19907 d_sethostent_r='$d_sethostent_r'
19908 d_setitimer='$d_setitimer'
19909 d_setlinebuf='$d_setlinebuf'
19910 d_setlocale='$d_setlocale'
19911 d_setlocale_r='$d_setlocale_r'
19912 d_setnent='$d_setnent'
19913 d_setnetent_r='$d_setnetent_r'
19914 d_setpent='$d_setpent'
19915 d_setpgid='$d_setpgid'
19916 d_setpgrp2='$d_setpgrp2'
19917 d_setpgrp='$d_setpgrp'
19918 d_setprior='$d_setprior'
19919 d_setproctitle='$d_setproctitle'
19920 d_setprotoent_r='$d_setprotoent_r'
19921 d_setpwent='$d_setpwent'
19922 d_setpwent_r='$d_setpwent_r'
19923 d_setregid='$d_setregid'
19924 d_setresgid='$d_setresgid'
19925 d_setresuid='$d_setresuid'
19926 d_setreuid='$d_setreuid'
19927 d_setrgid='$d_setrgid'
19928 d_setruid='$d_setruid'
19929 d_setsent='$d_setsent'
19930 d_setservent_r='$d_setservent_r'
19931 d_setsid='$d_setsid'
19932 d_setvbuf='$d_setvbuf'
19933 d_sfio='$d_sfio'
19934 d_shm='$d_shm'
19935 d_shmat='$d_shmat'
19936 d_shmatprototype='$d_shmatprototype'
19937 d_shmctl='$d_shmctl'
19938 d_shmdt='$d_shmdt'
19939 d_shmget='$d_shmget'
19940 d_sigaction='$d_sigaction'
19941 d_sigprocmask='$d_sigprocmask'
19942 d_sigsetjmp='$d_sigsetjmp'
19943 d_sockatmark='$d_sockatmark'
19944 d_sockatmarkproto='$d_sockatmarkproto'
19945 d_socket='$d_socket'
19946 d_socklen_t='$d_socklen_t'
19947 d_sockpair='$d_sockpair'
19948 d_socks5_init='$d_socks5_init'
19949 d_sqrtl='$d_sqrtl'
19950 d_srand48_r='$d_srand48_r'
19951 d_srandom_r='$d_srandom_r'
19952 d_sresgproto='$d_sresgproto'
19953 d_sresuproto='$d_sresuproto'
19954 d_statblks='$d_statblks'
19955 d_statfs_f_flags='$d_statfs_f_flags'
19956 d_statfs_s='$d_statfs_s'
19957 d_statvfs='$d_statvfs'
19958 d_stdio_cnt_lval='$d_stdio_cnt_lval'
19959 d_stdio_ptr_lval='$d_stdio_ptr_lval'
19960 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
19961 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
19962 d_stdio_stream_array='$d_stdio_stream_array'
19963 d_stdiobase='$d_stdiobase'
19964 d_stdstdio='$d_stdstdio'
19965 d_strchr='$d_strchr'
19966 d_strcoll='$d_strcoll'
19967 d_strctcpy='$d_strctcpy'
19968 d_strerrm='$d_strerrm'
19969 d_strerror='$d_strerror'
19970 d_strerror_r='$d_strerror_r'
19971 d_strftime='$d_strftime'
19972 d_strtod='$d_strtod'
19973 d_strtol='$d_strtol'
19974 d_strtold='$d_strtold'
19975 d_strtoll='$d_strtoll'
19976 d_strtoq='$d_strtoq'
19977 d_strtoul='$d_strtoul'
19978 d_strtoull='$d_strtoull'
19979 d_strtouq='$d_strtouq'
19980 d_strxfrm='$d_strxfrm'
19981 d_suidsafe='$d_suidsafe'
19982 d_symlink='$d_symlink'
19983 d_syscall='$d_syscall'
19984 d_syscallproto='$d_syscallproto'
19985 d_sysconf='$d_sysconf'
19986 d_sysernlst='$d_sysernlst'
19987 d_syserrlst='$d_syserrlst'
19988 d_system='$d_system'
19989 d_tcgetpgrp='$d_tcgetpgrp'
19990 d_tcsetpgrp='$d_tcsetpgrp'
19991 d_telldir='$d_telldir'
19992 d_telldirproto='$d_telldirproto'
19993 d_time='$d_time'
19994 d_times='$d_times'
19995 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
19996 d_tm_tm_zone='$d_tm_tm_zone'
19997 d_tmpnam_r='$d_tmpnam_r'
19998 d_truncate='$d_truncate'
19999 d_ttyname_r='$d_ttyname_r'
20000 d_tzname='$d_tzname'
20001 d_u32align='$d_u32align'
20002 d_ualarm='$d_ualarm'
20003 d_umask='$d_umask'
20004 d_uname='$d_uname'
20005 d_union_semun='$d_union_semun'
20006 d_unordered='$d_unordered'
20007 d_usleep='$d_usleep'
20008 d_usleepproto='$d_usleepproto'
20009 d_ustat='$d_ustat'
20010 d_vendorarch='$d_vendorarch'
20011 d_vendorbin='$d_vendorbin'
20012 d_vendorlib='$d_vendorlib'
20013 d_vfork='$d_vfork'
20014 d_void_closedir='$d_void_closedir'
20015 d_voidsig='$d_voidsig'
20016 d_voidtty='$d_voidtty'
20017 d_volatile='$d_volatile'
20018 d_vprintf='$d_vprintf'
20019 d_wait4='$d_wait4'
20020 d_waitpid='$d_waitpid'
20021 d_wcstombs='$d_wcstombs'
20022 d_wctomb='$d_wctomb'
20023 d_writev='$d_writev'
20024 d_xenix='$d_xenix'
20025 date='$date'
20026 db_hashtype='$db_hashtype'
20027 db_prefixtype='$db_prefixtype'
20028 db_version_major='$db_version_major'
20029 db_version_minor='$db_version_minor'
20030 db_version_patch='$db_version_patch'
20031 defvoidused='$defvoidused'
20032 direntrytype='$direntrytype'
20033 dlext='$dlext'
20034 dlsrc='$dlsrc'
20035 doublesize='$doublesize'
20036 drand01='$drand01'
20037 drand48_r_proto='$drand48_r_proto'
20038 dynamic_ext='$dynamic_ext'
20039 eagain='$eagain'
20040 ebcdic='$ebcdic'
20041 echo='$echo'
20042 egrep='$egrep'
20043 emacs='$emacs'
20044 endgrent_r_proto='$endgrent_r_proto'
20045 endhostent_r_proto='$endhostent_r_proto'
20046 endnetent_r_proto='$endnetent_r_proto'
20047 endprotoent_r_proto='$endprotoent_r_proto'
20048 endpwent_r_proto='$endpwent_r_proto'
20049 endservent_r_proto='$endservent_r_proto'
20050 eunicefix='$eunicefix'
20051 exe_ext='$exe_ext'
20052 expr='$expr'
20053 extensions='$extensions'
20054 extras='$extras'
20055 fflushNULL='$fflushNULL'
20056 fflushall='$fflushall'
20057 find='$find'
20058 firstmakefile='$firstmakefile'
20059 flex='$flex'
20060 fpossize='$fpossize'
20061 fpostype='$fpostype'
20062 freetype='$freetype'
20063 from='$from'
20064 full_ar='$full_ar'
20065 full_csh='$full_csh'
20066 full_sed='$full_sed'
20067 gccosandvers='$gccosandvers'
20068 gccversion='$gccversion'
20069 getgrent_r_proto='$getgrent_r_proto'
20070 getgrgid_r_proto='$getgrgid_r_proto'
20071 getgrnam_r_proto='$getgrnam_r_proto'
20072 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
20073 gethostbyname_r_proto='$gethostbyname_r_proto'
20074 gethostent_r_proto='$gethostent_r_proto'
20075 getlogin_r_proto='$getlogin_r_proto'
20076 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
20077 getnetbyname_r_proto='$getnetbyname_r_proto'
20078 getnetent_r_proto='$getnetent_r_proto'
20079 getprotobyname_r_proto='$getprotobyname_r_proto'
20080 getprotobynumber_r_proto='$getprotobynumber_r_proto'
20081 getprotoent_r_proto='$getprotoent_r_proto'
20082 getpwent_r_proto='$getpwent_r_proto'
20083 getpwnam_r_proto='$getpwnam_r_proto'
20084 getpwuid_r_proto='$getpwuid_r_proto'
20085 getservbyname_r_proto='$getservbyname_r_proto'
20086 getservbyport_r_proto='$getservbyport_r_proto'
20087 getservent_r_proto='$getservent_r_proto'
20088 getspnam_r_proto='$getspnam_r_proto'
20089 gidformat='$gidformat'
20090 gidsign='$gidsign'
20091 gidsize='$gidsize'
20092 gidtype='$gidtype'
20093 glibpth='$glibpth'
20094 gmake='$gmake'
20095 gmtime_r_proto='$gmtime_r_proto'
20096 grep='$grep'
20097 groupcat='$groupcat'
20098 groupstype='$groupstype'
20099 gzip='$gzip'
20100 h_fcntl='$h_fcntl'
20101 h_sysfile='$h_sysfile'
20102 hint='$hint'
20103 hostcat='$hostcat'
20104 i16size='$i16size'
20105 i16type='$i16type'
20106 i32size='$i32size'
20107 i32type='$i32type'
20108 i64size='$i64size'
20109 i64type='$i64type'
20110 i8size='$i8size'
20111 i8type='$i8type'
20112 i_arpainet='$i_arpainet'
20113 i_bsdioctl='$i_bsdioctl'
20114 i_crypt='$i_crypt'
20115 i_db='$i_db'
20116 i_dbm='$i_dbm'
20117 i_dirent='$i_dirent'
20118 i_dld='$i_dld'
20119 i_dlfcn='$i_dlfcn'
20120 i_fcntl='$i_fcntl'
20121 i_float='$i_float'
20122 i_fp='$i_fp'
20123 i_fp_class='$i_fp_class'
20124 i_gdbm='$i_gdbm'
20125 i_grp='$i_grp'
20126 i_ieeefp='$i_ieeefp'
20127 i_inttypes='$i_inttypes'
20128 i_langinfo='$i_langinfo'
20129 i_libutil='$i_libutil'
20130 i_limits='$i_limits'
20131 i_locale='$i_locale'
20132 i_machcthr='$i_machcthr'
20133 i_malloc='$i_malloc'
20134 i_math='$i_math'
20135 i_memory='$i_memory'
20136 i_mntent='$i_mntent'
20137 i_ndbm='$i_ndbm'
20138 i_netdb='$i_netdb'
20139 i_neterrno='$i_neterrno'
20140 i_netinettcp='$i_netinettcp'
20141 i_niin='$i_niin'
20142 i_poll='$i_poll'
20143 i_prot='$i_prot'
20144 i_pthread='$i_pthread'
20145 i_pwd='$i_pwd'
20146 i_rpcsvcdbm='$i_rpcsvcdbm'
20147 i_sfio='$i_sfio'
20148 i_sgtty='$i_sgtty'
20149 i_shadow='$i_shadow'
20150 i_socks='$i_socks'
20151 i_stdarg='$i_stdarg'
20152 i_stddef='$i_stddef'
20153 i_stdlib='$i_stdlib'
20154 i_string='$i_string'
20155 i_sunmath='$i_sunmath'
20156 i_sysaccess='$i_sysaccess'
20157 i_sysdir='$i_sysdir'
20158 i_sysfile='$i_sysfile'
20159 i_sysfilio='$i_sysfilio'
20160 i_sysin='$i_sysin'
20161 i_sysioctl='$i_sysioctl'
20162 i_syslog='$i_syslog'
20163 i_sysmman='$i_sysmman'
20164 i_sysmode='$i_sysmode'
20165 i_sysmount='$i_sysmount'
20166 i_sysndir='$i_sysndir'
20167 i_sysparam='$i_sysparam'
20168 i_sysresrc='$i_sysresrc'
20169 i_syssecrt='$i_syssecrt'
20170 i_sysselct='$i_sysselct'
20171 i_syssockio='$i_syssockio'
20172 i_sysstat='$i_sysstat'
20173 i_sysstatfs='$i_sysstatfs'
20174 i_sysstatvfs='$i_sysstatvfs'
20175 i_systime='$i_systime'
20176 i_systimek='$i_systimek'
20177 i_systimes='$i_systimes'
20178 i_systypes='$i_systypes'
20179 i_sysuio='$i_sysuio'
20180 i_sysun='$i_sysun'
20181 i_sysutsname='$i_sysutsname'
20182 i_sysvfs='$i_sysvfs'
20183 i_syswait='$i_syswait'
20184 i_termio='$i_termio'
20185 i_termios='$i_termios'
20186 i_time='$i_time'
20187 i_unistd='$i_unistd'
20188 i_ustat='$i_ustat'
20189 i_utime='$i_utime'
20190 i_values='$i_values'
20191 i_varargs='$i_varargs'
20192 i_varhdr='$i_varhdr'
20193 i_vfork='$i_vfork'
20194 ignore_versioned_solibs='$ignore_versioned_solibs'
20195 inc_version_list='$inc_version_list'
20196 inc_version_list_init='$inc_version_list_init'
20197 incpath='$incpath'
20198 inews='$inews'
20199 installarchlib='$installarchlib'
20200 installbin='$installbin'
20201 installman1dir='$installman1dir'
20202 installman3dir='$installman3dir'
20203 installprefix='$installprefix'
20204 installprefixexp='$installprefixexp'
20205 installprivlib='$installprivlib'
20206 installscript='$installscript'
20207 installsitearch='$installsitearch'
20208 installsitebin='$installsitebin'
20209 installsitelib='$installsitelib'
20210 installstyle='$installstyle'
20211 installusrbinperl='$installusrbinperl'
20212 installvendorarch='$installvendorarch'
20213 installvendorbin='$installvendorbin'
20214 installvendorlib='$installvendorlib'
20215 intsize='$intsize'
20216 issymlink='$issymlink'
20217 ivdformat='$ivdformat'
20218 ivsize='$ivsize'
20219 ivtype='$ivtype'
20220 known_extensions='$known_extensions'
20221 ksh='$ksh'
20222 ld='$ld'
20223 lddlflags='$lddlflags'
20224 ldflags='$ldflags'
20225 ldflags_uselargefiles='$ldflags_uselargefiles'
20226 ldlibpthname='$ldlibpthname'
20227 less='$less'
20228 lib_ext='$lib_ext'
20229 libc='$libc'
20230 libperl='$libperl'
20231 libpth='$libpth'
20232 libs='$libs'
20233 libsdirs='$libsdirs'
20234 libsfiles='$libsfiles'
20235 libsfound='$libsfound'
20236 libspath='$libspath'
20237 libswanted='$libswanted'
20238 libswanted_uselargefiles='$libswanted_uselargefiles'
20239 line='$line'
20240 lint='$lint'
20241 lkflags='$lkflags'
20242 ln='$ln'
20243 lns='$lns'
20244 localtime_r_proto='$localtime_r_proto'
20245 locincpth='$locincpth'
20246 loclibpth='$loclibpth'
20247 longdblsize='$longdblsize'
20248 longlongsize='$longlongsize'
20249 longsize='$longsize'
20250 lp='$lp'
20251 lpr='$lpr'
20252 ls='$ls'
20253 lseeksize='$lseeksize'
20254 lseektype='$lseektype'
20255 mail='$mail'
20256 mailx='$mailx'
20257 make='$make'
20258 make_set_make='$make_set_make'
20259 mallocobj='$mallocobj'
20260 mallocsrc='$mallocsrc'
20261 malloctype='$malloctype'
20262 man1dir='$man1dir'
20263 man1direxp='$man1direxp'
20264 man1ext='$man1ext'
20265 man3dir='$man3dir'
20266 man3direxp='$man3direxp'
20267 man3ext='$man3ext'
20268 mips_type='$mips_type'
20269 mkdir='$mkdir'
20270 mmaptype='$mmaptype'
20271 modetype='$modetype'
20272 more='$more'
20273 multiarch='$multiarch'
20274 mv='$mv'
20275 myarchname='$myarchname'
20276 mydomain='$mydomain'
20277 myhostname='$myhostname'
20278 myuname='$myuname'
20279 n='$n'
20280 need_va_copy='$need_va_copy'
20281 netdb_hlen_type='$netdb_hlen_type'
20282 netdb_host_type='$netdb_host_type'
20283 netdb_name_type='$netdb_name_type'
20284 netdb_net_type='$netdb_net_type'
20285 nm='$nm'
20286 nm_opt='$nm_opt'
20287 nm_so_opt='$nm_so_opt'
20288 nonxs_ext='$nonxs_ext'
20289 nroff='$nroff'
20290 nvEUformat='$nvEUformat'
20291 nvFUformat='$nvFUformat'
20292 nvGUformat='$nvGUformat'
20293 nv_preserves_uv_bits='$nv_preserves_uv_bits'
20294 nveformat='$nveformat'
20295 nvfformat='$nvfformat'
20296 nvgformat='$nvgformat'
20297 nvsize='$nvsize'
20298 nvtype='$nvtype'
20299 o_nonblock='$o_nonblock'
20300 obj_ext='$obj_ext'
20301 old_pthread_create_joinable='$old_pthread_create_joinable'
20302 optimize='$optimize'
20303 orderlib='$orderlib'
20304 osname='$osname'
20305 osvers='$osvers'
20306 otherlibdirs='$otherlibdirs'
20307 package='$package'
20308 pager='$pager'
20309 passcat='$passcat'
20310 patchlevel='$patchlevel'
20311 path_sep='$path_sep'
20312 perl5='$perl5'
20313 perl='$perl'
20314 perl_patchlevel='$perl_patchlevel'
20315 perladmin='$perladmin'
20316 perllibs='$perllibs'
20317 perlpath='$perlpath'
20318 pg='$pg'
20319 phostname='$phostname'
20320 pidtype='$pidtype'
20321 plibpth='$plibpth'
20322 pm_apiversion='$pm_apiversion'
20323 pmake='$pmake'
20324 pr='$pr'
20325 prefix='$prefix'
20326 prefixexp='$prefixexp'
20327 privlib='$privlib'
20328 privlibexp='$privlibexp'
20329 procselfexe='$procselfexe'
20330 prototype='$prototype'
20331 ptrsize='$ptrsize'
20332 quadkind='$quadkind'
20333 quadtype='$quadtype'
20334 randbits='$randbits'
20335 randfunc='$randfunc'
20336 random_r_proto='$random_r_proto'
20337 randseedtype='$randseedtype'
20338 ranlib='$ranlib'
20339 rd_nodata='$rd_nodata'
20340 readdir64_r_proto='$readdir64_r_proto'
20341 readdir_r_proto='$readdir_r_proto'
20342 revision='$revision'
20343 rm='$rm'
20344 rmail='$rmail'
20345 run='$run'
20346 runnm='$runnm'
20347 sPRIEUldbl='$sPRIEUldbl'
20348 sPRIFUldbl='$sPRIFUldbl'
20349 sPRIGUldbl='$sPRIGUldbl'
20350 sPRIXU64='$sPRIXU64'
20351 sPRId64='$sPRId64'
20352 sPRIeldbl='$sPRIeldbl'
20353 sPRIfldbl='$sPRIfldbl'
20354 sPRIgldbl='$sPRIgldbl'
20355 sPRIi64='$sPRIi64'
20356 sPRIo64='$sPRIo64'
20357 sPRIu64='$sPRIu64'
20358 sPRIx64='$sPRIx64'
20359 sSCNfldbl='$sSCNfldbl'
20360 sched_yield='$sched_yield'
20361 scriptdir='$scriptdir'
20362 scriptdirexp='$scriptdirexp'
20363 sed='$sed'
20364 seedfunc='$seedfunc'
20365 selectminbits='$selectminbits'
20366 selecttype='$selecttype'
20367 sendmail='$sendmail'
20368 setgrent_r_proto='$setgrent_r_proto'
20369 sethostent_r_proto='$sethostent_r_proto'
20370 setlocale_r_proto='$setlocale_r_proto'
20371 setnetent_r_proto='$setnetent_r_proto'
20372 setprotoent_r_proto='$setprotoent_r_proto'
20373 setpwent_r_proto='$setpwent_r_proto'
20374 setservent_r_proto='$setservent_r_proto'
20375 sh='$sh'
20376 shar='$shar'
20377 sharpbang='$sharpbang'
20378 shmattype='$shmattype'
20379 shortsize='$shortsize'
20380 shrpenv='$shrpenv'
20381 shsharp='$shsharp'
20382 sig_count='$sig_count'
20383 sig_name='$sig_name'
20384 sig_name_init='$sig_name_init'
20385 sig_num='$sig_num'
20386 sig_num_init='$sig_num_init'
20387 sig_size='$sig_size'
20388 signal_t='$signal_t'
20389 sitearch='$sitearch'
20390 sitearchexp='$sitearchexp'
20391 sitebin='$sitebin'
20392 sitebinexp='$sitebinexp'
20393 sitelib='$sitelib'
20394 sitelib_stem='$sitelib_stem'
20395 sitelibexp='$sitelibexp'
20396 siteprefix='$siteprefix'
20397 siteprefixexp='$siteprefixexp'
20398 sizesize='$sizesize'
20399 sizetype='$sizetype'
20400 sleep='$sleep'
20401 smail='$smail'
20402 so='$so'
20403 sockethdr='$sockethdr'
20404 socketlib='$socketlib'
20405 socksizetype='$socksizetype'
20406 sort='$sort'
20407 spackage='$spackage'
20408 spitshell='$spitshell'
20409 srand48_r_proto='$srand48_r_proto'
20410 srandom_r_proto='$srandom_r_proto'
20411 src='$src'
20412 ssizetype='$ssizetype'
20413 startperl='$startperl'
20414 startsh='$startsh'
20415 static_ext='$static_ext'
20416 stdchar='$stdchar'
20417 stdio_base='$stdio_base'
20418 stdio_bufsiz='$stdio_bufsiz'
20419 stdio_cnt='$stdio_cnt'
20420 stdio_filbuf='$stdio_filbuf'
20421 stdio_ptr='$stdio_ptr'
20422 stdio_stream_array='$stdio_stream_array'
20423 strerror_r_proto='$strerror_r_proto'
20424 strings='$strings'
20425 submit='$submit'
20426 subversion='$subversion'
20427 sysman='$sysman'
20428 tail='$tail'
20429 tar='$tar'
20430 targetarch='$targetarch'
20431 tbl='$tbl'
20432 tee='$tee'
20433 test='$test'
20434 timeincl='$timeincl'
20435 timetype='$timetype'
20436 tmpnam_r_proto='$tmpnam_r_proto'
20437 to='$to'
20438 touch='$touch'
20439 tr='$tr'
20440 trnl='$trnl'
20441 troff='$troff'
20442 ttyname_r_proto='$ttyname_r_proto'
20443 u16size='$u16size'
20444 u16type='$u16type'
20445 u32size='$u32size'
20446 u32type='$u32type'
20447 u64size='$u64size'
20448 u64type='$u64type'
20449 u8size='$u8size'
20450 u8type='$u8type'
20451 uidformat='$uidformat'
20452 uidsign='$uidsign'
20453 uidsize='$uidsize'
20454 uidtype='$uidtype'
20455 uname='$uname'
20456 uniq='$uniq'
20457 uquadtype='$uquadtype'
20458 use5005threads='$use5005threads'
20459 use64bitall='$use64bitall'
20460 use64bitint='$use64bitint'
20461 usecrosscompile='$usecrosscompile'
20462 usedl='$usedl'
20463 useithreads='$useithreads'
20464 uselargefiles='$uselargefiles'
20465 uselongdouble='$uselongdouble'
20466 usemorebits='$usemorebits'
20467 usemultiplicity='$usemultiplicity'
20468 usemymalloc='$usemymalloc'
20469 usenm='$usenm'
20470 useopcode='$useopcode'
20471 useperlio='$useperlio'
20472 useposix='$useposix'
20473 usereentrant='$usereentrant'
20474 usesfio='$usesfio'
20475 useshrplib='$useshrplib'
20476 usesocks='$usesocks'
20477 usethreads='$usethreads'
20478 usevendorprefix='$usevendorprefix'
20479 usevfork='$usevfork'
20480 usrinc='$usrinc'
20481 uuname='$uuname'
20482 uvXUformat='$uvXUformat'
20483 uvoformat='$uvoformat'
20484 uvsize='$uvsize'
20485 uvtype='$uvtype'
20486 uvuformat='$uvuformat'
20487 uvxformat='$uvxformat'
20488 vendorarch='$vendorarch'
20489 vendorarchexp='$vendorarchexp'
20490 vendorbin='$vendorbin'
20491 vendorbinexp='$vendorbinexp'
20492 vendorlib='$vendorlib'
20493 vendorlib_stem='$vendorlib_stem'
20494 vendorlibexp='$vendorlibexp'
20495 vendorprefix='$vendorprefix'
20496 vendorprefixexp='$vendorprefixexp'
20497 version='$version'
20498 version_patchlevel_string='$version_patchlevel_string'
20499 versiononly='$versiononly'
20500 vi='$vi'
20501 voidflags='$voidflags'
20502 xlibpth='$xlibpth'
20503 xs_apiversion='$xs_apiversion'
20504 yacc='$yacc'
20505 yaccflags='$yaccflags'
20506 zcat='$zcat'
20507 zip='$zip'
20508 EOT
20509
20510 : Add in command line options if available
20511 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
20512
20513 : add special variables
20514 $test -f $src/patchlevel.h && \
20515 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
20516 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
20517 echo "PERL_CONFIG_SH=true" >>config.sh
20518
20519 : propagate old symbols
20520 if $test -f UU/config.sh; then
20521         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
20522         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
20523         $sort | $uniq -u >UU/oldsyms
20524         set X `cat UU/oldsyms`
20525         shift
20526         case $# in
20527         0) ;;
20528         *)
20529                 cat <<EOM
20530 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
20531 EOM
20532                 echo "# Variables propagated from previous config.sh file." >>config.sh
20533                 for sym in `cat UU/oldsyms`; do
20534                         echo "    Propagating $hint variable "'$'"$sym..."
20535                         eval 'tmp="$'"${sym}"'"'
20536                         echo "$tmp" | \
20537                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
20538                 done
20539                 ;;
20540         esac
20541 fi
20542
20543 : Finish up by extracting the .SH files
20544 case "$alldone" in
20545 exit)
20546         $rm -rf UU
20547         echo "Extraction done."
20548         exit 0
20549         ;;
20550 cont)
20551         ;;
20552 '')
20553         dflt=''
20554         nostick=true
20555         $cat <<EOM
20556
20557 If you'd like to make any changes to the config.sh file before I begin
20558 to configure things, do it as a shell escape now (e.g. !vi config.sh).
20559
20560 EOM
20561         rp="Press return or use a shell escape to edit config.sh:"
20562         . UU/myread
20563         nostick=''
20564         case "$ans" in
20565         '') ;;
20566         *) : in case they cannot read
20567                 sh 1>&4 -c "$ans";;
20568         esac
20569         ;;
20570 esac
20571
20572 : if this fails, just run all the .SH files by hand
20573 . ./config.sh
20574
20575 echo " "
20576 exec 1>&4
20577 pwd=`pwd`
20578 . ./UU/extract
20579 cd "$pwd"
20580
20581 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
20582         dflt=y
20583         case "$silent" in
20584         true) ;;
20585         *)
20586                 $cat <<EOM
20587
20588 Now you need to generate make dependencies by running "$make depend".
20589 You might prefer to run it in background: "$make depend > makedepend.out &"
20590 It can take a while, so you might not want to run it right now.
20591
20592 EOM
20593                 ;;
20594         esac
20595         rp="Run $make depend now?"
20596         . UU/myread
20597         case "$ans" in
20598         y*)
20599                 $make depend && echo "Now you must run '$make'."
20600                 ;;
20601         *)
20602                 echo "You must run '$make depend' then '$make'."
20603                 ;;
20604         esac
20605 elif test -f [Mm]akefile; then
20606         echo " "
20607         echo "Now you must run a $make."
20608 else
20609         echo "Configure done."
20610 fi
20611
20612 if $test -f Policy.sh; then
20613     $cat <<EOM
20614
20615 If you compile $package on a different machine or from a different object
20616 directory, copy the Policy.sh file from this object directory to the
20617 new one before you run Configure -- this will help you with most of
20618 the policy defaults.
20619
20620 EOM
20621 fi
20622 if $test -f config.msg; then
20623     echo "Hmm.  I also noted the following information while running:"
20624     echo " "
20625     $cat config.msg >&4
20626     $rm -f config.msg
20627 fi
20628 $rm -f kit*isdone ark*isdone
20629 $rm -rf UU
20630
20631 : End of Configure
20632