ac27e5f895580b099b384ff1ab136509b8e82ace
[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 Tue May 28 23:03:39 EET DST 2002 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.org)
25
26 cat >c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat c1$$ c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f c1$$ c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 case "X${MACHTYPE:-nonesuchmach}" in
69                 *cygwin) ;;
70                 *) p_=\; ;;
71                 esac
72         fi
73 fi
74
75 : Proper PATH setting
76 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
77 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
78 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
79 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
80 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
81 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
82 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
83 paths="$paths /sbin /usr/sbin /usr/libexec"
84 paths="$paths /system/gnu_library/bin"
85
86 for p in $paths
87 do
88         case "$p_$PATH$p_" in
89         *$p_$p$p_*) ;;
90         *) test -d $p && PATH=$PATH$p_$p ;;
91         esac
92 done
93
94 PATH=.$p_$PATH
95 export PATH
96
97 : shall we be using ksh?
98 inksh=''
99 needksh=''
100 avoidksh=''
101 newsh=/bin/ksh
102 changesh=''
103 if (PATH=.; alias -x) >/dev/null 2>&1; then
104                 inksh=true
105 fi
106 if test -f /hp-ux -a -f /bin/ksh; then
107         needksh='to avoid sh bug in "here document" expansion'
108 fi
109 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
110         if test X`/usr/bin/uname -v` = X4; then
111                 avoidksh="to avoid AIX 4's /bin/sh"
112                 newsh=/usr/bin/bsh
113         fi
114 fi
115 if test -f /osf_boot -a -f /usr/sbin/setld; then
116         if test X`/usr/bin/uname -s` = XOSF1; then
117                 avoidksh="to avoid Digital UNIX' ksh"
118                 newsh=/bin/sh
119                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
120         fi
121 fi
122 case "$inksh/$needksh" in
123 /[a-z]*)
124                 ENV=''
125                 changesh=true
126                 reason="$needksh"
127         ;;
128 esac
129 case "$inksh/$avoidksh" in
130 true/[a-z]*)
131         changesh=true
132         reason="$avoidksh"
133         ;;
134 esac
135 case "$inksh/$needksh-$avoidksh-" in
136 true/--)
137                 cat <<EOM
138 (I see you are using the Korn shell.  Some ksh's blow up on $me,
139 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
140 EOM
141         ;;
142 esac
143 case "$changesh" in
144 true)
145         export newsh
146         echo "(Feeding myself to $newsh $reason.)"
147         case "$0" in
148         Configure|*/Configure) exec $newsh $0 "$@";;
149         *) exec $newsh Configure "$@";;
150         esac
151         ;;
152 esac
153
154 : if needed set CDPATH to a harmless value that is not chatty
155 : avoid bash 2.02 problems with empty CDPATH.
156 case "$CDPATH" in
157 '')     ;;
158 *)      case "$SHELL" in
159         *bash*) CDPATH='.' ;;
160         *)              CDPATH='' ;;
161         esac
162         ;;
163 esac
164 : Configure runs within the UU subdirectory
165 test -d UU || mkdir UU
166 cd UU && rm -f ./*
167
168
169 ccname=''
170 ccversion=''
171 ccsymbols=''
172 cppccsymbols=''
173 cppsymbols=''
174 from=''
175 run=''
176 targetarch=''
177 to=''
178 usecrosscompile=''
179 perllibs=''
180 dynamic_ext=''
181 extensions=''
182 known_extensions=''
183 nonxs_ext=''
184 static_ext=''
185 useopcode=''
186 useposix=''
187 extras=''
188 d_bsd=''
189 d_eunice=''
190 d_xenix=''
191 eunicefix=''
192 Mcc=''
193 ar=''
194 awk=''
195 bash=''
196 bison=''
197 byacc=''
198 cat=''
199 chgrp=''
200 chmod=''
201 chown=''
202 comm=''
203 compress=''
204 cp=''
205 cpio=''
206 cpp=''
207 csh=''
208 date=''
209 echo=''
210 egrep=''
211 emacs=''
212 expr=''
213 find=''
214 flex=''
215 gmake=''
216 grep=''
217 gzip=''
218 inews=''
219 ksh=''
220 less=''
221 line=''
222 lint=''
223 ln=''
224 lp=''
225 lpr=''
226 ls=''
227 mail=''
228 mailx=''
229 make=''
230 mkdir=''
231 more=''
232 mv=''
233 nm=''
234 nroff=''
235 perl=''
236 pg=''
237 pmake=''
238 pr=''
239 rm=''
240 rmail=''
241 sed=''
242 sendmail=''
243 shar=''
244 sleep=''
245 smail=''
246 sort=''
247 submit=''
248 tail=''
249 tar=''
250 tbl=''
251 tee=''
252 test=''
253 touch=''
254 tr=''
255 troff=''
256 uname=''
257 uniq=''
258 uuname=''
259 vi=''
260 zcat=''
261 zip=''
262 full_ar=''
263 full_sed=''
264 libswanted=''
265 hint=''
266 myuname=''
267 osname=''
268 osvers=''
269 Author=''
270 Date=''
271 Header=''
272 Id=''
273 Locker=''
274 Log=''
275 RCSfile=''
276 Revision=''
277 Source=''
278 State=''
279 _a=''
280 _exe=''
281 _o=''
282 archobjs=''
283 exe_ext=''
284 firstmakefile=''
285 lib_ext=''
286 obj_ext=''
287 path_sep=''
288 afs=''
289 afsroot=''
290 alignbytes=''
291 ansi2knr=''
292 archlib=''
293 archlibexp=''
294 d_archlib=''
295 installarchlib=''
296 archname=''
297 myarchname=''
298 d_atolf=''
299 d_atoll=''
300 baserev=''
301 bin=''
302 binexp=''
303 installbin=''
304 byteorder=''
305 cc=''
306 ccflags=''
307 cppflags=''
308 ldflags=''
309 lkflags=''
310 locincpth=''
311 optimize=''
312 cf_email=''
313 cf_by=''
314 cf_time=''
315 charsize=''
316 contains=''
317 cpp_stuff=''
318 cpplast=''
319 cppminus=''
320 cpprun=''
321 cppstdin=''
322 d__fwalk=''
323 d_access=''
324 d_accessx=''
325 d_alarm=''
326 asctime_r_proto=''
327 d_asctime_r=''
328 d_attribut=''
329 d_bcmp=''
330 d_bcopy=''
331 d_bzero=''
332 d_casti32=''
333 castflags=''
334 d_castneg=''
335 d_chown=''
336 d_chroot=''
337 d_chsize=''
338 d_class=''
339 d_closedir=''
340 d_void_closedir=''
341 d_cmsghdr_s=''
342 d_const=''
343 cryptlib=''
344 d_crypt=''
345 crypt_r_proto=''
346 d_crypt_r=''
347 d_csh=''
348 full_csh=''
349 ctermid_r_proto=''
350 d_ctermid_r=''
351 ctime_r_proto=''
352 d_ctime_r=''
353 d_cuserid=''
354 d_dbl_dig=''
355 d_dbminitproto=''
356 d_difftime=''
357 d_dirfd=''
358 d_dlerror=''
359 d_dlopen=''
360 d_dlsymun=''
361 d_dosuid=''
362 d_suidsafe=''
363 d_drand48_r=''
364 drand48_r_proto=''
365 d_drand48proto=''
366 d_dup2=''
367 d_eaccess=''
368 d_endgrent=''
369 d_endgrent_r=''
370 endgrent_r_proto=''
371 d_endhent=''
372 d_endhostent_r=''
373 endhostent_r_proto=''
374 d_endnent=''
375 d_endnetent_r=''
376 endnetent_r_proto=''
377 d_endpent=''
378 d_endprotoent_r=''
379 endprotoent_r_proto=''
380 d_endpwent=''
381 d_endpwent_r=''
382 endpwent_r_proto=''
383 d_endsent=''
384 d_endservent_r=''
385 endservent_r_proto=''
386 d_fchdir=''
387 d_fchmod=''
388 d_fchown=''
389 d_fcntl=''
390 d_fcntl_can_lock=''
391 d_fd_macros=''
392 d_fd_set=''
393 d_fds_bits=''
394 d_fgetpos=''
395 d_finite=''
396 d_finitel=''
397 d_flexfnam=''
398 d_flock=''
399 d_flockproto=''
400 d_fork=''
401 d_fp_class=''
402 d_fpclass=''
403 d_fpclassify=''
404 d_fpclassl=''
405 d_fpos64_t=''
406 d_frexpl=''
407 d_fs_data_s=''
408 d_fseeko=''
409 d_fsetpos=''
410 d_fstatfs=''
411 d_fsync=''
412 d_ftello=''
413 d_ftime=''
414 d_gettimeod=''
415 d_Gconvert=''
416 d_getcwd=''
417 d_getespwnam=''
418 d_getfsstat=''
419 d_getgrent=''
420 d_getgrent_r=''
421 getgrent_r_proto=''
422 d_getgrgid_r=''
423 getgrgid_r_proto=''
424 d_getgrnam_r=''
425 getgrnam_r_proto=''
426 d_getgrps=''
427 d_gethbyaddr=''
428 d_gethbyname=''
429 d_gethent=''
430 aphostname=''
431 d_gethname=''
432 d_phostname=''
433 d_uname=''
434 d_gethostbyaddr_r=''
435 gethostbyaddr_r_proto=''
436 d_gethostbyname_r=''
437 gethostbyname_r_proto=''
438 d_gethostent_r=''
439 gethostent_r_proto=''
440 d_gethostprotos=''
441 d_getitimer=''
442 d_getlogin=''
443 d_getlogin_r=''
444 getlogin_r_proto=''
445 d_getmnt=''
446 d_getmntent=''
447 d_getnbyaddr=''
448 d_getnbyname=''
449 d_getnent=''
450 d_getnetbyaddr_r=''
451 getnetbyaddr_r_proto=''
452 d_getnetbyname_r=''
453 getnetbyname_r_proto=''
454 d_getnetent_r=''
455 getnetent_r_proto=''
456 d_getnetprotos=''
457 d_getpagsz=''
458 d_getpent=''
459 d_getpgid=''
460 d_getpgrp2=''
461 d_bsdgetpgrp=''
462 d_getpgrp=''
463 d_getppid=''
464 d_getprior=''
465 d_getpbyname=''
466 d_getpbynumber=''
467 d_getprotobyname_r=''
468 getprotobyname_r_proto=''
469 d_getprotobynumber_r=''
470 getprotobynumber_r_proto=''
471 d_getprotoent_r=''
472 getprotoent_r_proto=''
473 d_getprotoprotos=''
474 d_getprpwnam=''
475 d_getpwent=''
476 d_getpwent_r=''
477 getpwent_r_proto=''
478 d_getpwnam_r=''
479 getpwnam_r_proto=''
480 d_getpwuid_r=''
481 getpwuid_r_proto=''
482 d_getsent=''
483 d_getservbyname_r=''
484 getservbyname_r_proto=''
485 d_getservbyport_r=''
486 getservbyport_r_proto=''
487 d_getservent_r=''
488 getservent_r_proto=''
489 d_getservprotos=''
490 d_getspnam=''
491 d_getspnam_r=''
492 getspnam_r_proto=''
493 d_getsbyname=''
494 d_getsbyport=''
495 d_gmtime_r=''
496 gmtime_r_proto=''
497 d_gnulibc=''
498 d_hasmntopt=''
499 d_htonl=''
500 d_inetaton=''
501 d_int64_t=''
502 d_isascii=''
503 d_isfinite=''
504 d_isinf=''
505 d_isnan=''
506 d_isnanl=''
507 d_killpg=''
508 d_lchown=''
509 d_ldbl_dig=''
510 d_link=''
511 d_localtime_r=''
512 localtime_r_proto=''
513 d_locconv=''
514 d_lockf=''
515 d_longdbl=''
516 longdblsize=''
517 d_longlong=''
518 longlongsize=''
519 d_lseekproto=''
520 d_lstat=''
521 d_madvise=''
522 d_mblen=''
523 d_mbstowcs=''
524 d_mbtowc=''
525 d_memchr=''
526 d_memcmp=''
527 d_memcpy=''
528 d_memmove=''
529 d_memset=''
530 d_mkdir=''
531 d_mkdtemp=''
532 d_mkfifo=''
533 d_mkstemp=''
534 d_mkstemps=''
535 d_mktime=''
536 d_mmap=''
537 mmaptype=''
538 d_modfl=''
539 d_modfl_pow32_bug=''
540 d_mprotect=''
541 d_msg=''
542 d_msgctl=''
543 d_msgget=''
544 d_msghdr_s=''
545 d_msgrcv=''
546 d_msgsnd=''
547 d_msync=''
548 d_munmap=''
549 d_nice=''
550 d_nl_langinfo=''
551 d_off64_t=''
552 d_open3=''
553 d_fpathconf=''
554 d_pathconf=''
555 d_pause=''
556 d_pipe=''
557 d_poll=''
558 d_portable=''
559 d_procselfexe=''
560 procselfexe=''
561 d_old_pthread_create_joinable=''
562 old_pthread_create_joinable=''
563 d_pthread_atfork=''
564 d_pthread_yield=''
565 d_sched_yield=''
566 sched_yield=''
567 d_qgcvt=''
568 d_random_r=''
569 random_r_proto=''
570 d_readdir64_r=''
571 readdir64_r_proto=''
572 d_readdir=''
573 d_rewinddir=''
574 d_seekdir=''
575 d_telldir=''
576 d_readdir_r=''
577 readdir_r_proto=''
578 d_readlink=''
579 d_readv=''
580 d_recvmsg=''
581 d_rename=''
582 d_rmdir=''
583 d_safebcpy=''
584 d_safemcpy=''
585 d_sanemcmp=''
586 d_sbrkproto=''
587 d_select=''
588 d_sem=''
589 d_semctl=''
590 d_semget=''
591 d_semop=''
592 d_sendmsg=''
593 d_setegid=''
594 d_seteuid=''
595 d_setgrent=''
596 d_setgrent_r=''
597 setgrent_r_proto=''
598 d_setgrps=''
599 d_sethent=''
600 d_sethostent_r=''
601 sethostent_r_proto=''
602 d_setitimer=''
603 d_setlinebuf=''
604 d_setlocale=''
605 d_setlocale_r=''
606 setlocale_r_proto=''
607 d_setnent=''
608 d_setnetent_r=''
609 setnetent_r_proto=''
610 d_setpent=''
611 d_setpgid=''
612 d_setpgrp2=''
613 d_bsdsetpgrp=''
614 d_setpgrp=''
615 d_setprior=''
616 d_setproctitle=''
617 d_setprotoent_r=''
618 setprotoent_r_proto=''
619 d_setpwent=''
620 d_setpwent_r=''
621 setpwent_r_proto=''
622 d_setregid=''
623 d_setresgid=''
624 d_setresuid=''
625 d_setreuid=''
626 d_setrgid=''
627 d_setruid=''
628 d_setsent=''
629 d_setservent_r=''
630 setservent_r_proto=''
631 d_setsid=''
632 d_setvbuf=''
633 d_sfio=''
634 usesfio=''
635 d_shm=''
636 d_shmat=''
637 d_shmatprototype=''
638 shmattype=''
639 d_shmctl=''
640 d_shmdt=''
641 d_shmget=''
642 d_sigaction=''
643 d_sigprocmask=''
644 d_sigsetjmp=''
645 d_sockatmark=''
646 d_sockatmarkproto=''
647 d_msg_ctrunc=''
648 d_msg_dontroute=''
649 d_msg_oob=''
650 d_msg_peek=''
651 d_msg_proxy=''
652 d_oldsock=''
653 d_scm_rights=''
654 d_socket=''
655 d_sockpair=''
656 sockethdr=''
657 socketlib=''
658 d_socklen_t=''
659 d_socks5_init=''
660 d_sqrtl=''
661 d_srand48_r=''
662 srand48_r_proto=''
663 d_srandom_r=''
664 srandom_r_proto=''
665 d_sresgproto=''
666 d_sresuproto=''
667 d_statblks=''
668 d_statfs_f_flags=''
669 d_statfs_s=''
670 d_fstatvfs=''
671 d_statvfs=''
672 d_stdio_cnt_lval=''
673 d_stdio_ptr_lval=''
674 d_stdio_ptr_lval_nochange_cnt=''
675 d_stdio_ptr_lval_sets_cnt=''
676 d_stdiobase=''
677 d_stdstdio=''
678 stdio_base=''
679 stdio_bufsiz=''
680 stdio_cnt=''
681 stdio_filbuf=''
682 stdio_ptr=''
683 d_index=''
684 d_strchr=''
685 d_strcoll=''
686 d_strctcpy=''
687 d_strerrm=''
688 d_strerror=''
689 d_sysernlst=''
690 d_syserrlst=''
691 d_strerror_r=''
692 strerror_r_proto=''
693 d_strftime=''
694 d_strtod=''
695 d_strtol=''
696 d_strtold=''
697 d_strtoll=''
698 d_strtoq=''
699 d_strtoul=''
700 d_strtoull=''
701 d_strtouq=''
702 d_strxfrm=''
703 d_symlink=''
704 d_syscall=''
705 d_syscallproto=''
706 d_sysconf=''
707 d_system=''
708 d_tcgetpgrp=''
709 d_tcsetpgrp=''
710 d_telldirproto=''
711 d_time=''
712 timetype=''
713 clocktype=''
714 d_times=''
715 d_tmpnam_r=''
716 tmpnam_r_proto=''
717 d_truncate=''
718 d_ttyname_r=''
719 ttyname_r_proto=''
720 d_tzname=''
721 d_u32align=''
722 d_ualarm=''
723 d_umask=''
724 d_semctl_semid_ds=''
725 d_semctl_semun=''
726 d_union_semun=''
727 d_unordered=''
728 d_usleep=''
729 d_usleepproto=''
730 d_ustat=''
731 d_vfork=''
732 usevfork=''
733 d_voidsig=''
734 signal_t=''
735 d_volatile=''
736 d_charvspr=''
737 d_vprintf=''
738 d_wait4=''
739 d_waitpid=''
740 d_wcstombs=''
741 d_wctomb=''
742 d_writev=''
743 dlext=''
744 cccdlflags=''
745 ccdlflags=''
746 dlsrc=''
747 ld=''
748 lddlflags=''
749 usedl=''
750 doublesize=''
751 ebcdic=''
752 fflushNULL=''
753 fflushall=''
754 fpossize=''
755 fpostype=''
756 gccosandvers=''
757 gccversion=''
758 gidformat=''
759 gidsign=''
760 gidsize=''
761 gidtype=''
762 groupstype=''
763 h_fcntl=''
764 h_sysfile=''
765 i_arpainet=''
766 i_crypt=''
767 db_hashtype=''
768 db_prefixtype=''
769 db_version_major=''
770 db_version_minor=''
771 db_version_patch=''
772 i_db=''
773 i_dbm=''
774 i_rpcsvcdbm=''
775 d_dirnamlen=''
776 direntrytype=''
777 i_dirent=''
778 i_dld=''
779 i_dlfcn=''
780 i_fcntl=''
781 i_float=''
782 i_fp=''
783 i_fp_class=''
784 i_gdbm=''
785 d_grpasswd=''
786 i_grp=''
787 i_ieeefp=''
788 i_inttypes=''
789 i_langinfo=''
790 i_libutil=''
791 i_limits=''
792 i_locale=''
793 i_machcthr=''
794 i_malloc=''
795 i_math=''
796 i_memory=''
797 i_mntent=''
798 i_ndbm=''
799 i_netdb=''
800 i_neterrno=''
801 i_netinettcp=''
802 i_niin=''
803 i_sysin=''
804 i_poll=''
805 i_prot=''
806 i_pthread=''
807 d_pwage=''
808 d_pwchange=''
809 d_pwclass=''
810 d_pwcomment=''
811 d_pwexpire=''
812 d_pwgecos=''
813 d_pwpasswd=''
814 d_pwquota=''
815 i_pwd=''
816 i_sfio=''
817 i_shadow=''
818 i_socks=''
819 i_stddef=''
820 i_stdlib=''
821 i_string=''
822 strings=''
823 i_sunmath=''
824 i_sysaccess=''
825 i_sysdir=''
826 i_sysfile=''
827 d_voidtty=''
828 i_bsdioctl=''
829 i_sysfilio=''
830 i_sysioctl=''
831 i_syssockio=''
832 i_syslog=''
833 i_sysmman=''
834 i_sysmode=''
835 i_sysmount=''
836 i_sysndir=''
837 i_sysparam=''
838 i_sysresrc=''
839 i_syssecrt=''
840 i_sysselct=''
841 i_sysstat=''
842 i_sysstatfs=''
843 i_sysstatvfs=''
844 i_systimes=''
845 i_systypes=''
846 i_sysuio=''
847 i_sysun=''
848 i_sysutsname=''
849 i_sysvfs=''
850 i_syswait=''
851 i_sgtty=''
852 i_termio=''
853 i_termios=''
854 d_tm_tm_gmtoff=''
855 d_tm_tm_zone=''
856 i_systime=''
857 i_systimek=''
858 i_time=''
859 timeincl=''
860 i_unistd=''
861 i_ustat=''
862 i_utime=''
863 i_values=''
864 i_stdarg=''
865 i_varargs=''
866 i_varhdr=''
867 i_vfork=''
868 inc_version_list=''
869 inc_version_list_init=''
870 installprefix=''
871 installprefixexp=''
872 installstyle=''
873 installusrbinperl=''
874 intsize=''
875 longsize=''
876 shortsize=''
877 issymlink=''
878 libc=''
879 ldlibpthname=''
880 libperl=''
881 shrpenv=''
882 useshrplib=''
883 glibpth=''
884 libpth=''
885 loclibpth=''
886 plibpth=''
887 xlibpth=''
888 ignore_versioned_solibs=''
889 libs=''
890 libsdirs=''
891 libsfiles=''
892 libsfound=''
893 libspath=''
894 lns=''
895 d_PRIEUldbl=''
896 d_PRIFUldbl=''
897 d_PRIGUldbl=''
898 d_PRIeldbl=''
899 d_PRIfldbl=''
900 d_PRIgldbl=''
901 d_SCNfldbl=''
902 sPRIEUldbl=''
903 sPRIFUldbl=''
904 sPRIGUldbl=''
905 sPRIeldbl=''
906 sPRIfldbl=''
907 sPRIgldbl=''
908 sSCNfldbl=''
909 lseeksize=''
910 lseektype=''
911 make_set_make=''
912 d_mymalloc=''
913 freetype=''
914 mallocobj=''
915 mallocsrc=''
916 malloctype=''
917 usemymalloc=''
918 installman1dir=''
919 man1dir=''
920 man1direxp=''
921 man1ext=''
922 installman3dir=''
923 man3dir=''
924 man3direxp=''
925 man3ext=''
926 modetype=''
927 multiarch=''
928 mydomain=''
929 myhostname=''
930 phostname=''
931 c=''
932 n=''
933 d_eofnblk=''
934 eagain=''
935 o_nonblock=''
936 rd_nodata=''
937 need_va_copy=''
938 netdb_hlen_type=''
939 netdb_host_type=''
940 netdb_name_type=''
941 netdb_net_type=''
942 groupcat=''
943 hostcat=''
944 passcat=''
945 orderlib=''
946 ranlib=''
947 d_perl_otherlibdirs=''
948 otherlibdirs=''
949 package=''
950 spackage=''
951 pager=''
952 api_revision=''
953 api_subversion=''
954 api_version=''
955 api_versionstring=''
956 patchlevel=''
957 perl_patchlevel=''
958 revision=''
959 subversion=''
960 version=''
961 version_patchlevel_string=''
962 perl5=''
963 perladmin=''
964 perlpath=''
965 d_nv_preserves_uv=''
966 i16size=''
967 i16type=''
968 i32size=''
969 i32type=''
970 i64size=''
971 i64type=''
972 i8size=''
973 i8type=''
974 ivsize=''
975 ivtype=''
976 nv_preserves_uv_bits=''
977 nvsize=''
978 nvtype=''
979 u16size=''
980 u16type=''
981 u32size=''
982 u32type=''
983 u64size=''
984 u64type=''
985 u8size=''
986 u8type=''
987 uvsize=''
988 uvtype=''
989 ivdformat=''
990 nvEUformat=''
991 nvFUformat=''
992 nvGUformat=''
993 nveformat=''
994 nvfformat=''
995 nvgformat=''
996 uvXUformat=''
997 uvoformat=''
998 uvuformat=''
999 uvxformat=''
1000 pidtype=''
1001 prefix=''
1002 prefixexp=''
1003 installprivlib=''
1004 privlib=''
1005 privlibexp=''
1006 prototype=''
1007 ptrsize=''
1008 d_PRIXU64=''
1009 d_PRId64=''
1010 d_PRIi64=''
1011 d_PRIo64=''
1012 d_PRIu64=''
1013 d_PRIx64=''
1014 sPRIXU64=''
1015 sPRId64=''
1016 sPRIi64=''
1017 sPRIo64=''
1018 sPRIu64=''
1019 sPRIx64=''
1020 d_quad=''
1021 quadkind=''
1022 quadtype=''
1023 uquadtype=''
1024 drand01=''
1025 randbits=''
1026 randfunc=''
1027 randseedtype=''
1028 seedfunc=''
1029 installscript=''
1030 scriptdir=''
1031 scriptdirexp=''
1032 selectminbits=''
1033 selecttype=''
1034 sh=''
1035 sig_count=''
1036 sig_name=''
1037 sig_name_init=''
1038 sig_num=''
1039 sig_num_init=''
1040 sig_size=''
1041 installsitearch=''
1042 sitearch=''
1043 sitearchexp=''
1044 installsitebin=''
1045 sitebin=''
1046 sitebinexp=''
1047 installsitelib=''
1048 sitelib=''
1049 sitelib_stem=''
1050 sitelibexp=''
1051 siteprefix=''
1052 siteprefixexp=''
1053 sizesize=''
1054 sizetype=''
1055 so=''
1056 socksizetype=''
1057 sharpbang=''
1058 shsharp=''
1059 spitshell=''
1060 src=''
1061 ssizetype=''
1062 startperl=''
1063 startsh=''
1064 stdchar=''
1065 d_stdio_stream_array=''
1066 stdio_stream_array=''
1067 sysman=''
1068 trnl=''
1069 uidformat=''
1070 uidsign=''
1071 uidsize=''
1072 uidtype=''
1073 archname64=''
1074 use64bitall=''
1075 use64bitint=''
1076 ccflags_uselargefiles=''
1077 ldflags_uselargefiles=''
1078 libswanted_uselargefiles=''
1079 uselargefiles=''
1080 uselongdouble=''
1081 usemorebits=''
1082 usemultiplicity=''
1083 nm_opt=''
1084 nm_so_opt=''
1085 runnm=''
1086 usenm=''
1087 useperlio=''
1088 usesocks=''
1089 d_oldpthreads=''
1090 use5005threads=''
1091 useithreads=''
1092 usereentrant=''
1093 usethreads=''
1094 incpath=''
1095 mips_type=''
1096 usrinc=''
1097 d_vendorarch=''
1098 installvendorarch=''
1099 vendorarch=''
1100 vendorarchexp=''
1101 d_vendorbin=''
1102 installvendorbin=''
1103 vendorbin=''
1104 vendorbinexp=''
1105 d_vendorlib=''
1106 installvendorlib=''
1107 vendorlib=''
1108 vendorlib_stem=''
1109 vendorlibexp=''
1110 usevendorprefix=''
1111 vendorprefix=''
1112 vendorprefixexp=''
1113 versiononly=''
1114 defvoidused=''
1115 voidflags=''
1116 pm_apiversion=''
1117 xs_apiversion=''
1118 yacc=''
1119 yaccflags=''
1120 CONFIG=''
1121
1122 define='define'
1123 undef='undef'
1124 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1125 rmlist=''
1126
1127 : We must find out about Eunice early
1128 eunicefix=':'
1129 if test -f /etc/unixtovms; then
1130         eunicefix=/etc/unixtovms
1131 fi
1132 if test -f /etc/unixtovms.exe; then
1133         eunicefix=/etc/unixtovms.exe
1134 fi
1135
1136 : Set executable suffix now -- needed before hints available
1137 if test -f "/libs/version.library"; then
1138 : Amiga OS
1139     _exe=""
1140 elif test -f "/system/gnu_library/bin/ar.pm"; then
1141 : Stratus VOS
1142     _exe=".pm"
1143 elif test -n "$DJGPP"; then
1144 : DOS DJGPP
1145     _exe=".exe"
1146 elif test -d c:/. ; then
1147 : OS/2 or cygwin
1148     _exe=".exe"
1149 fi
1150
1151 i_whoami=''
1152 ccname=''
1153 ccversion=''
1154 perllibs=''
1155 : set useposix=false in your hint file to disable the POSIX extension.
1156 useposix=true
1157 : set useopcode=false in your hint file to disable the Opcode extension.
1158 useopcode=true
1159 : Trailing extension.  Override this in a hint file, if needed.
1160 : Extra object files, if any, needed on this platform.
1161 archobjs=''
1162 archname=''
1163 : Possible local include directories to search.
1164 : Set locincpth to "" in a hint file to defeat local include searches.
1165 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1166 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1167 :
1168 : no include file wanted by default
1169 inclwanted=''
1170
1171 groupstype=''
1172 libnames=''
1173 : change the next line if compiling for Xenix/286 on Xenix/386
1174 xlibpth='/usr/lib/386 /lib/386'
1175 : Possible local library directories to search.
1176 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1177 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1178
1179 : general looking path for locating libraries
1180 glibpth="/lib /usr/lib $xlibpth"
1181 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1182 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1183 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1184
1185 : Private path used by Configure to find libraries.  Its value
1186 : is prepended to libpth. This variable takes care of special
1187 : machines, like the mips.  Usually, it should be empty.
1188 plibpth=''
1189
1190 : default library list
1191 libswanted=''
1192 : some systems want to use only the non-versioned libso:s
1193 ignore_versioned_solibs=''
1194 archname64=''
1195 ccflags_uselargefiles=''
1196 ldflags_uselargefiles=''
1197 libswanted_uselargefiles=''
1198 : set usemultiplicity on the Configure command line to enable multiplicity.
1199 : set usesocks on the Configure command line to enable socks.
1200 : set usethreads on the Configure command line to enable threads.
1201 usereentrant='undef'
1202 : full support for void wanted by default
1203 defvoidused=15
1204
1205 : List of libraries we want.
1206 : If anyone needs -lnet, put it in a hint file.
1207 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1208 libswanted="$libswanted dld ld sun m c cposix posix"
1209 libswanted="$libswanted ndir dir crypt sec"
1210 libswanted="$libswanted ucb bsd BSD PW x util"
1211 : We probably want to search /usr/shlib before most other libraries.
1212 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1213 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1214 glibpth="/usr/shlib $glibpth"
1215 : Do not use vfork unless overridden by a hint file.
1216 usevfork=false
1217
1218 : Find the basic shell for Bourne shell scripts
1219 case "$sh" in
1220 '')
1221         case "$SYSTYPE" in
1222         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1223         *) xxx='/bin/sh';;
1224         esac
1225         if test -f "$xxx"; then
1226                 sh="$xxx"
1227         else
1228                 : Build up a list and do a single loop so we can 'break' out.
1229                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1230                 for xxx in sh bash ksh pdksh ash; do
1231                         for p in $pth; do
1232                                 try="$try ${p}/${xxx}"
1233                         done
1234                 done
1235                 for xxx in $try; do
1236                         if test -f "$xxx"; then
1237                                 sh="$xxx";
1238                                 break
1239                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1240                                 sh="$xxx";
1241                                 break
1242                         elif test -f "$xxx.exe"; then
1243                                 sh="$xxx";
1244                                 break
1245                         fi
1246                 done
1247         fi
1248         ;;
1249 esac
1250
1251 case "$sh" in
1252 '')     cat >&2 <<EOM
1253 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1254
1255 Usually it's in /bin/sh.  How did you even get this far?
1256 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1257 we'll try to straighten this all out.
1258 EOM
1259         exit 1
1260         ;;
1261 esac
1262
1263 : see if sh knows # comments
1264 if `$sh -c '#' >/dev/null 2>&1`; then
1265         shsharp=true
1266         spitshell=cat
1267         xcat=/bin/cat
1268         test -f $xcat$_exe || xcat=/usr/bin/cat
1269         if test ! -f $xcat$_exe; then
1270                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1271                         if test -f $p/cat$_exe; then
1272                                 xcat=$p/cat
1273                                 break
1274                         fi
1275                 done
1276                 if test ! -f $xcat$_exe; then
1277                         echo "Can't find cat anywhere!"
1278                         exit 1
1279                 fi
1280         fi
1281         echo "#!$xcat" >sharp
1282         $eunicefix sharp
1283         chmod +x sharp
1284         ./sharp > today
1285         if test -s today; then
1286                 sharpbang='#!'
1287         else
1288                 echo "#! $xcat" > sharp
1289                 $eunicefix sharp
1290                 chmod +x sharp
1291                 ./sharp > today
1292                 if test -s today; then
1293                         sharpbang='#! '
1294                 else
1295                         sharpbang=': use '
1296                 fi
1297         fi
1298 else
1299         echo " "
1300         echo "Your $sh doesn't grok # comments--I will strip them later on."
1301         shsharp=false
1302         cd ..
1303         echo "exec grep -v '^[  ]*#'" >spitshell
1304         chmod +x spitshell
1305         $eunicefix spitshell
1306         spitshell=`pwd`/spitshell
1307         cd UU
1308         echo "I presume that if # doesn't work, #! won't work either!"
1309         sharpbang=': use '
1310 fi
1311 rm -f sharp today
1312
1313 : figure out how to guarantee sh startup
1314 case "$startsh" in
1315 '') startsh=${sharpbang}${sh} ;;
1316 *)
1317 esac
1318 cat >sharp <<EOSS
1319 $startsh
1320 set abc
1321 test "$?abc" != 1
1322 EOSS
1323
1324 chmod +x sharp
1325 $eunicefix sharp
1326 if ./sharp; then
1327         : echo "Yup, it does."
1328 else
1329         echo "Hmm... '$startsh' does not guarantee sh startup..."
1330         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1331 fi
1332 rm -f sharp
1333
1334
1335 : Save command line options in file UU/cmdline.opt for later use in
1336 : generating config.sh.
1337 cat > cmdline.opt <<EOSH
1338 # Configure command line arguments.
1339 config_arg0='$0'
1340 config_args='$*'
1341 config_argc=$#
1342 EOSH
1343 argn=1
1344 args_exp=''
1345 args_sep=''
1346 for arg in "$@"; do
1347         cat >>cmdline.opt <<EOSH
1348 config_arg$argn='$arg'
1349 EOSH
1350         # Extreme backslashitis: replace each ' by '"'"'
1351         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1352 $arg
1353 EOC
1354         arg_exp=`cat cmdl.opt`
1355         args_exp="$args_exp$args_sep'$arg_exp'"
1356         argn=`expr $argn + 1`
1357         args_sep=' '
1358 done
1359 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1360 # used by ./hints/os2.sh
1361 rm -f cmdl.opt
1362
1363 : produce awk script to parse command line options
1364 cat >options.awk <<'EOF'
1365 BEGIN {
1366         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1367
1368         len = length(optstr);
1369         for (i = 1; i <= len; i++) {
1370                 c = substr(optstr, i, 1);
1371                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1372                 if (a == ":") {
1373                         arg[c] = 1;
1374                         i++;
1375                 }
1376                 opt[c] = 1;
1377         }
1378 }
1379 {
1380         expect = 0;
1381         str = $0;
1382         if (substr(str, 1, 1) != "-") {
1383                 printf("'%s'\n", str);
1384                 next;
1385         }
1386         len = length($0);
1387         for (i = 2; i <= len; i++) {
1388                 c = substr(str, i, 1);
1389                 if (!opt[c]) {
1390                         printf("-%s\n", substr(str, i));
1391                         next;
1392                 }
1393                 printf("-%s\n", c);
1394                 if (arg[c]) {
1395                         if (i < len)
1396                                 printf("'%s'\n", substr(str, i + 1));
1397                         else
1398                                 expect = 1;
1399                         next;
1400                 }
1401         }
1402 }
1403 END {
1404         if (expect)
1405                 print "?";
1406 }
1407 EOF
1408
1409 : process the command line options
1410 set X `for arg in "$@"; do echo "X$arg"; done |
1411         sed -e s/X// | awk -f options.awk`
1412 eval "set $*"
1413 shift
1414 rm -f options.awk
1415
1416 : set up default values
1417 fastread=''
1418 reuseval=false
1419 config_sh=''
1420 alldone=''
1421 error=''
1422 silent=''
1423 extractsh=''
1424 override=''
1425 knowitall=''
1426 rm -f optdef.sh posthint.sh
1427 cat >optdef.sh <<EOS
1428 $startsh
1429 EOS
1430
1431
1432 : option parsing
1433 while test $# -gt 0; do
1434         case "$1" in
1435         -d) shift; fastread=yes;;
1436         -e) shift; alldone=cont;;
1437         -f)
1438                 shift
1439                 cd ..
1440                 if test -r "$1"; then
1441                         config_sh="$1"
1442                 else
1443                         echo "$me: cannot read config file $1." >&2
1444                         error=true
1445                 fi
1446                 cd UU
1447                 shift;;
1448         -h) shift; error=true;;
1449         -r) shift; reuseval=true;;
1450         -s) shift; silent=true; realsilent=true;;
1451         -E) shift; alldone=exit;;
1452         -K) shift; knowitall=true;;
1453         -O) shift; override=true;;
1454         -S) shift; silent=true; extractsh=true;;
1455         -D)
1456                 shift
1457                 case "$1" in
1458                 *=)
1459                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1460                         echo "$me: ignoring -D $1" >&2
1461                         ;;
1462                 *=*) echo "$1" | \
1463                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1464                 *) echo "$1='define'" >> optdef.sh;;
1465                 esac
1466                 shift
1467                 ;;
1468         -U)
1469                 shift
1470                 case "$1" in
1471                 *=) echo "$1" >> optdef.sh;;
1472                 *=*)
1473                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1474                         echo "$me: ignoring -U $1" >&2
1475                         ;;
1476                 *) echo "$1='undef'" >> optdef.sh;;
1477                 esac
1478                 shift
1479                 ;;
1480         -A)
1481             shift
1482             xxx=''
1483             yyy="$1"
1484             zzz=''
1485             uuu=undef
1486             case "$yyy" in
1487             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1488                  case "$zzz" in
1489                  *:*) zzz='' ;;
1490                  *)   xxx=append
1491                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1492                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1493                  esac
1494                  ;;
1495             esac
1496             case "$xxx" in
1497             '')  case "$yyy" in
1498                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1499                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1500                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1501                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1502                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1503                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1504                  esac
1505                  ;;       
1506             esac
1507             case "$xxx" in
1508             append)
1509                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1510             clear)
1511                 echo "$yyy=''"                  >> posthint.sh ;;
1512             define)
1513                 case "$zzz" in
1514                 '') zzz=define ;;
1515                 esac
1516                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1517             eval)
1518                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1519             prepend)
1520                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1521             undef)
1522                 case "$zzz" in
1523                 '') zzz="$uuu" ;;
1524                 esac
1525                 echo "$yyy=$zzz"                >> posthint.sh ;;
1526             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1527             esac
1528             shift
1529             ;;
1530         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1531             exit 0;;
1532         --) break;;
1533         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1534         *) break;;
1535         esac
1536 done
1537
1538 case "$error" in
1539 true)
1540         cat >&2 <<EOM
1541 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1542                  [-U symbol] [-U symbol=] [-A command:symbol...]
1543   -d : use defaults for all answers.
1544   -e : go on without questioning past the production of config.sh.
1545   -f : specify an alternate default configuration file.
1546   -h : print this help message and exit (with an error status).
1547   -r : reuse C symbols value if possible (skips costly nm extraction).
1548   -s : silent mode, only echoes questions and essential information.
1549   -D : define symbol to have some value:
1550          -D symbol         symbol gets the value 'define'
1551          -D symbol=value   symbol gets the value 'value'
1552   -E : stop at the end of questions, after having produced config.sh.
1553   -K : do not use unless you know what you are doing.
1554   -O : let -D and -U override definitions from loaded configuration file.
1555   -S : perform variable substitutions on all .SH files (can mix with -f)
1556   -U : undefine symbol:
1557          -U symbol    symbol gets the value 'undef'
1558          -U symbol=   symbol gets completely empty
1559   -A : manipulate symbol after the platform specific hints have been applied:
1560          -A symbol=value                append " "value to symbol
1561          -A append:symbol=value         append value to symbol
1562          -A define:symbol=value         define symbol to have value
1563          -A clear:symbol                define symbol to be ''
1564          -A define:symbol               define symbol to be 'define'
1565          -A eval:symbol=value           define symbol to be eval of value
1566          -A prepend:symbol=value        prepend value to symbol
1567          -A undef:symbol                define symbol to be 'undef'
1568          -A undef:symbol=               define symbol to be ''
1569   -V : print version number and exit (with a zero status).
1570 EOM
1571         exit 1
1572         ;;
1573 esac
1574
1575 : Sanity checks
1576 case "$fastread$alldone" in
1577 yescont|yesexit) ;;
1578 *)
1579         case "$extractsh" in
1580         true) ;;
1581         *)
1582                 if test ! -t 0; then
1583                         echo "Say 'sh Configure', not 'sh <Configure'"
1584                         exit 1
1585                 fi
1586                 ;;
1587         esac
1588         ;;
1589 esac
1590
1591 exec 4>&1
1592 case "$silent" in
1593 true) exec 1>/dev/null;;
1594 esac
1595
1596 : run the defines and the undefines, if any, but leave the file out there...
1597 touch optdef.sh
1598 . ./optdef.sh
1599 : create the posthint manipulation script and leave the file out there...
1600 touch posthint.sh
1601
1602 : set package name
1603 package=perl5
1604 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1605 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1606 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1607 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1608 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1609 esac
1610
1611 : Some greps do not return status, grrr.
1612 echo "grimblepritz" >grimble
1613 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1614         contains=contains
1615 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1616         contains=grep
1617 else
1618         contains=contains
1619 fi
1620 rm -f grimble
1621 : the following should work in any shell
1622 case "$contains" in
1623 contains*)
1624         echo " "
1625         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1626         cat >contains <<'EOSS'
1627 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1628 EOSS
1629 chmod +x contains
1630 esac
1631
1632 : Find the path to the source tree
1633 case "$src" in
1634 '') case "$0" in
1635     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1636          case "$src" in
1637          /*)    ;;
1638          .)     ;;
1639          *)     src=`cd ../$src && pwd` ;;
1640          esac
1641          ;;
1642     *)   src='.';;
1643     esac;;
1644 esac
1645 case "$src" in
1646 '')     src=/
1647         rsrc=/
1648         ;;
1649 /*) rsrc="$src";;
1650 *) rsrc="../$src";;
1651 esac
1652 if test -f $rsrc/Configure && \
1653         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1654 then
1655    : found it, so we are ok.
1656 else
1657         rsrc=''
1658         for src in . .. ../.. ../../.. ../../../..; do
1659                 if test -f ../$src/Configure && \
1660                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1661                 then
1662                         rsrc=../$src
1663                         break
1664                 fi
1665         done
1666 fi
1667 case "$rsrc" in
1668 '')
1669         cat <<EOM >&4
1670
1671 Sorry, I can't seem to locate the source dir for $package.  Please start
1672 Configure with an explicit path -- i.e. /some/path/Configure.
1673
1674 EOM
1675         exit 1
1676         ;;
1677 ../.)   rsrc='..';;
1678 *)
1679         echo " "
1680         echo "Sources for $package found in \"$src\"." >&4
1681         ;;
1682 esac
1683
1684 : script used to extract .SH files with variable substitutions
1685 cat >extract <<'EOS'
1686 PERL_CONFIG_SH=true
1687 echo "Doing variable substitutions on .SH files..."
1688 if test -f MANIFEST; then
1689         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1690 else
1691         echo "(Looking for .SH files under the source directory.)"
1692         set x `(cd "$src"; find . -name "*.SH" -print)`
1693 fi
1694 shift
1695 case $# in
1696 0) set x `(cd "$src"; echo *.SH)`; shift;;
1697 esac
1698 if test ! -f "$src/$1"; then
1699         shift
1700 fi
1701 mkdir_p='
1702 name=$1;
1703 create="";
1704 while test $name; do
1705         if test ! -d "$name"; then
1706                 create="$name $create";
1707                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1708                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1709         else
1710                 name="";
1711         fi;
1712 done;
1713 for file in $create; do
1714         mkdir $file;
1715 done
1716 '
1717 for file in $*; do
1718         case "$src" in
1719         ".")
1720                 case "$file" in
1721                 */*)
1722                         dir=`expr X$file : 'X\(.*\)/'`
1723                         file=`expr X$file : 'X.*/\(.*\)'`
1724                         (cd "$dir" && . ./$file)
1725                         ;;
1726                 *)
1727                         . ./$file
1728                         ;;
1729                 esac
1730                 ;;
1731         *)
1732                 case "$file" in
1733                 */*)
1734                         dir=`expr X$file : 'X\(.*\)/'`
1735                         file=`expr X$file : 'X.*/\(.*\)'`
1736                         (set x $dir; shift; eval $mkdir_p)
1737                         sh <"$src/$dir/$file"
1738                         ;;
1739                 *)
1740                         sh <"$src/$file"
1741                         ;;
1742                 esac
1743                 ;;
1744         esac
1745 done
1746 if test -f "$src/config_h.SH"; then
1747         if test ! -f config.h; then
1748         : oops, they left it out of MANIFEST, probably, so do it anyway.
1749         . "$src/config_h.SH"
1750         fi
1751 fi
1752 EOS
1753
1754 : extract files and exit if asked to do so
1755 case "$extractsh" in
1756 true)
1757         case "$realsilent" in
1758         true) ;;
1759         *) exec 1>&4;;
1760         esac
1761         case "$config_sh" in
1762         '') config_sh='config.sh';;
1763         esac
1764         echo " "
1765         echo "Fetching answers from $config_sh..."
1766         cd ..
1767         . $config_sh
1768         test "$override" && . ./optdef.sh
1769         echo " "
1770         . UU/extract
1771         rm -rf UU
1772         echo "Extraction done."
1773         exit 0
1774         ;;
1775 esac
1776
1777 : Eunice requires " " instead of "", can you believe it
1778 echo " "
1779 : Here we go...
1780 echo "Beginning of configuration questions for $package."
1781
1782 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1783
1784 : first determine how to suppress newline on echo command
1785 echo " "
1786 echo "Checking echo to see how to suppress newlines..."
1787 (echo "hi there\c" ; echo " ") >.echotmp
1788 if $contains c .echotmp >/dev/null 2>&1 ; then
1789         echo "...using -n."
1790         n='-n'
1791         c=''
1792 else
1793         cat <<'EOM'
1794 ...using \c
1795 EOM
1796         n=''
1797         c='\c'
1798 fi
1799 echo $n "The star should be here-->$c"
1800 echo '*'
1801 rm -f .echotmp
1802
1803 : Now test for existence of everything in MANIFEST
1804 echo " "
1805 if test -f "$rsrc/MANIFEST"; then
1806         echo "First let's make sure your kit is complete.  Checking..." >&4
1807         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1808         rm -f missing
1809         tmppwd=`pwd`
1810         for filelist in x??; do
1811                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1812         done
1813         if test -s missing; then
1814                 cat missing >&4
1815                 cat >&4 <<'EOM'
1816
1817 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1818
1819 You have the option of continuing the configuration process, despite the
1820 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1821 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1822 and contact the author (perlbug@perl.org).
1823
1824 EOM
1825                 echo $n "Continue? [n] $c" >&4
1826                 read ans
1827                 case "$ans" in
1828                 y*)
1829                         echo "Continuing..." >&4
1830                         rm -f missing
1831                         ;;
1832                 *)
1833                         echo "ABORTING..." >&4
1834                         kill $$
1835                         ;;
1836                 esac
1837         else
1838                 echo "Looks good..."
1839         fi
1840 else
1841         echo "There is no MANIFEST file.  I hope your kit is complete !"
1842 fi
1843 rm -f missing x??
1844
1845 echo " "
1846 : Find the appropriate value for a newline for tr
1847 if test -n "$DJGPP"; then
1848        trnl='\012'
1849 fi
1850 if test X"$trnl" = X; then
1851         case "`echo foo|tr '\n' x 2>/dev/null`" in
1852         foox) trnl='\n' ;;
1853         esac
1854 fi
1855 if test X"$trnl" = X; then
1856         case "`echo foo|tr '\012' x 2>/dev/null`" in
1857         foox) trnl='\012' ;;
1858         esac
1859 fi
1860 if test X"$trnl" = X; then
1861        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1862        fooxy) trnl='\n\r' ;;
1863        esac
1864 fi
1865 if test X"$trnl" = X; then
1866         cat <<EOM >&2
1867
1868 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1869
1870 EOM
1871         exit 1
1872 fi
1873
1874 : compute the number of columns on the terminal for proper question formatting
1875 case "$COLUMNS" in
1876 '') COLUMNS='80';;
1877 esac
1878
1879 : set up the echo used in my read
1880 myecho="case \"\$xxxm\" in
1881 '') echo $n \"\$rp $c\" >&4;;
1882 *) case \"\$rp\" in
1883         '') echo $n \"[\$xxxm] $c\";;
1884         *)
1885                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1886                         echo \"\$rp\" >&4
1887                         echo $n \"[\$xxxm] $c\" >&4
1888                 else
1889                         echo $n \"\$rp [\$xxxm] $c\" >&4
1890                 fi
1891                 ;;
1892         esac;;
1893 esac"
1894
1895 : now set up to do reads with possible shell escape and default assignment
1896 cat <<EOSC >myread
1897 $startsh
1898 xxxm=\$dflt
1899 $myecho
1900 ans='!'
1901 case "\$fastread" in
1902 yes) case "\$dflt" in
1903         '') ;;
1904         *) ans='';
1905                 case "\$silent-\$rp" in
1906                 true-) ;;
1907                 *) echo " " >&4;;
1908                 esac;;
1909         esac;;
1910 *) case "\$silent" in
1911         true) case "\$rp" in
1912                 '') ans='';;
1913                 esac;;
1914         esac;;
1915 esac
1916 while expr "X\$ans" : "X!" >/dev/null; do
1917         read answ
1918         set x \$xxxm
1919         shift
1920         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1921         case  "\$answ" in
1922         "!")
1923                 sh 1>&4
1924                 echo " "
1925                 $myecho
1926                 ;;
1927         !*)
1928                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1929                 shift
1930                 sh 1>&4 -c "\$*"
1931                 echo " "
1932                 $myecho
1933                 ;;
1934         "\$ans")
1935                 case "\$ans" in
1936                 \\&*)
1937                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1938                         shift
1939                         case "\$1" in
1940                         -d)
1941                                 fastread=yes
1942                                 echo "(OK, I'll run with -d after this question.)" >&4
1943                                 ;;
1944                         -*)
1945                                 echo "*** Sorry, \$1 not supported yet." >&4
1946                                 ;;
1947                         esac
1948                         $myecho
1949                         ans=!
1950                         ;;
1951                 esac;;
1952         *)
1953                 case "\$aok" in
1954                 y)
1955                         echo "*** Substitution done -- please confirm."
1956                         xxxm="\$ans"
1957                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1958                         xxxm="\$ans"
1959                         ans=!
1960                         ;;
1961                 *)
1962                         echo "*** Error -- try again."
1963                         ans=!
1964                         ;;
1965                 esac
1966                 $myecho
1967                 ;;
1968         esac
1969         case "\$ans\$xxxm\$nostick" in
1970         '')
1971                 ans=!
1972                 $myecho
1973                 ;;
1974         esac
1975 done
1976 case "\$ans" in
1977 '') ans="\$xxxm";;
1978 esac
1979 EOSC
1980
1981 : create .config dir to save info across Configure sessions
1982 test -d ../.config || mkdir ../.config
1983 cat >../.config/README <<EOF
1984 This directory created by Configure to save information that should
1985 persist across sessions for $package.
1986
1987 You may safely delete it if you wish.
1988 EOF
1989
1990 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1991 case "$usedevel" in
1992 $define|true|[yY]*) ;;
1993 *) case "$xversion" in
1994    *[13579])
1995         cat >&4 <<EOH
1996 *** WHOA THERE!!! ***
1997
1998     This is an UNSTABLE DEVELOPMENT release.
1999     The version of this $package distribution is $xversion, that is, odd,
2000     (as opposed to even) and that signifies a development release.
2001     If you want a maintenance release, you want an even-numbered version.
2002
2003     Do ***NOT*** install this into production use.
2004     Data corruption and crashes are possible.
2005
2006     It is most seriously suggested that you do not continue any further
2007     unless you want to help in developing and debugging Perl.
2008
2009     If you *still* want to build perl, you can answer 'y' now,
2010     or pass -Dusedevel to Configure.
2011
2012 EOH
2013         rp='Do you really want to continue?'
2014         dflt='n'
2015         . ./myread
2016         case "$ans" in
2017         [yY]) echo >&4 "Okay, continuing."
2018               usedevel="$define" ;;
2019         *) echo >&4 "Okay, bye."
2020            exit 1
2021            ;;
2022         esac
2023         ;;
2024     esac
2025     ;;
2026 esac
2027 case "$usedevel" in
2028 $define|true|[yY]*)
2029         case "$versiononly" in
2030         '') versiononly="$define" ;;
2031         esac
2032         case "$installusrbinperl" in
2033         '') installusrbinperl="$undef" ;;
2034         esac
2035         ;;
2036 esac
2037
2038 : general instructions
2039 needman=true
2040 firsttime=true
2041 user=`(logname) 2>/dev/null`
2042 case "$user" in
2043 '') user=`whoami 2>&1`;;
2044 esac
2045 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2046         firsttime=false
2047         echo " "
2048         rp='Would you like to see the instructions?'
2049         dflt=n
2050         . ./myread
2051         case "$ans" in
2052         [yY]*) ;;
2053         *) needman=false;;
2054         esac
2055 fi
2056 if $needman; then
2057         cat <<EOH
2058
2059 This installation shell script will examine your system and ask you questions
2060 to determine how the perl5 package should be installed. If you get
2061 stuck on a question, you may use a ! shell escape to start a subshell or
2062 execute a command.  Many of the questions will have default answers in square
2063 brackets; typing carriage return will give you the default.
2064
2065 On some of the questions which ask for file or directory names you are allowed
2066 to use the ~name construct to specify the login directory belonging to "name",
2067 even if you don't have a shell which knows about that.  Questions where this is
2068 allowed will be marked "(~name ok)".
2069
2070 EOH
2071         rp=''
2072         dflt='Type carriage return to continue'
2073         . ./myread
2074         cat <<'EOH'
2075
2076 The prompter used in this script allows you to use shell variables and
2077 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2078 in the default answer, as if the default line was a set of arguments given to a
2079 script shell.  This means you may also use $* to repeat the whole default line,
2080 so you do not have to re-type everything to add something to the default.
2081
2082 Everytime there is a substitution, you will have to confirm.  If there is an
2083 error (e.g. an unmatched backtick), the default answer will remain unchanged
2084 and you will be prompted again.
2085
2086 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2087 the questions and use the computed defaults (or the previous answers if there
2088 was already a config.sh file). Type 'Configure -h' for a list of options.
2089 You may also start interactively and then answer '& -d' at any prompt to turn
2090 on the non-interactive behaviour for the remainder of the execution.
2091
2092 EOH
2093         . ./myread
2094         cat <<EOH
2095
2096 Much effort has been expended to ensure that this shell script will run on any
2097 Unix system.  If despite that it blows up on yours, your best bet is to edit
2098 Configure and run it again.  If you can't run Configure for some reason,
2099 you'll have to generate a config.sh file by hand.  Whatever problems you
2100 have, let me (perlbug@perl.org) know how I blew it.
2101
2102 This installation script affects things in two ways:
2103
2104 1) it may do direct variable substitutions on some of the files included
2105    in this kit.
2106 2) it builds a config.h file for inclusion in C programs.  You may edit
2107    any of these files as the need arises after running this script.
2108
2109 If you make a mistake on a question, there is no easy way to back up to it
2110 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2111 files.  Configure will offer to let you do this before it runs the SH files.
2112
2113 EOH
2114         dflt='Type carriage return to continue'
2115         . ./myread
2116         case "$firsttime" in
2117         true) echo $user >>../.config/instruct;;
2118         esac
2119 fi
2120
2121 : find out where common programs are
2122 echo " "
2123 echo "Locating common programs..." >&4
2124 cat <<EOSC >loc
2125 $startsh
2126 case \$# in
2127 0) exit 1;;
2128 esac
2129 thing=\$1
2130 shift
2131 dflt=\$1
2132 shift
2133 for dir in \$*; do
2134         case "\$thing" in
2135         .)
2136         if test -d \$dir/\$thing; then
2137                 echo \$dir
2138                 exit 0
2139         fi
2140         ;;
2141         *)
2142         for thisthing in \$dir/\$thing; do
2143                 : just loop through to pick last item
2144         done
2145         if test -f \$thisthing; then
2146                 echo \$thisthing
2147                 exit 0
2148         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2149                 echo \$thisthing
2150                 exit 0
2151         elif test -f \$dir/\$thing.exe; then
2152                 if test -n "$DJGPP"; then
2153                         echo \$dir/\$thing.exe
2154                 else
2155                         : on Eunice apparently
2156                         echo \$dir/\$thing
2157                 fi
2158                 exit 0
2159         fi
2160         ;;
2161         esac
2162 done
2163 echo \$dflt
2164 exit 1
2165 EOSC
2166 chmod +x loc
2167 $eunicefix loc
2168 loclist="
2169 awk
2170 cat
2171 chmod
2172 comm
2173 cp
2174 echo
2175 expr
2176 grep
2177 ls
2178 mkdir
2179 rm
2180 sed
2181 sort
2182 touch
2183 tr
2184 uniq
2185 "
2186 trylist="
2187 Mcc
2188 ar
2189 bison
2190 byacc
2191 cpp
2192 csh
2193 date
2194 egrep
2195 gmake
2196 gzip
2197 less
2198 ln
2199 make
2200 more
2201 nm
2202 nroff
2203 pg
2204 test
2205 uname
2206 zip
2207 "
2208 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2209 pth="$pth /lib /usr/lib"
2210 for file in $loclist; do
2211         eval xxx=\$$file
2212         case "$xxx" in
2213         /*|?:[\\/]*)
2214                 if test -f "$xxx"; then
2215                         : ok
2216                 else
2217                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2218                         xxx=`./loc $file $file $pth`
2219                 fi
2220                 ;;
2221         '') xxx=`./loc $file $file $pth`;;
2222         *) xxx=`./loc $xxx $xxx $pth`;;
2223         esac
2224         eval $file=$xxx$_exe
2225         eval _$file=$xxx
2226         case "$xxx" in
2227         /*)
2228                 echo $file is in $xxx.
2229                 ;;
2230         ?:[\\/]*)
2231                 echo $file is in $xxx.
2232                 ;;
2233         *)
2234                 echo "I don't know where '$file' is, and my life depends on it." >&4
2235                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2236                 exit 1
2237                 ;;
2238         esac
2239 done
2240 echo " "
2241 echo "Don't worry if any of the following aren't found..."
2242 say=offhand
2243 for file in $trylist; do
2244         eval xxx=\$$file
2245         case "$xxx" in
2246         /*|?:[\\/]*)
2247                 if test -f "$xxx"; then
2248                         : ok
2249                 else
2250                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2251                         xxx=`./loc $file $file $pth`
2252                 fi
2253                 ;;
2254         '') xxx=`./loc $file $file $pth`;;
2255         *) xxx=`./loc $xxx $xxx $pth`;;
2256         esac
2257         eval $file=$xxx$_exe
2258         eval _$file=$xxx
2259         case "$xxx" in
2260         /*)
2261                 echo $file is in $xxx.
2262                 ;;
2263         ?:[\\/]*)
2264                 echo $file is in $xxx.
2265                 ;;
2266         *)
2267                 echo "I don't see $file out there, $say."
2268                 say=either
2269                 ;;
2270         esac
2271 done
2272 case "$egrep" in
2273 egrep)
2274         echo "Substituting grep for egrep."
2275         egrep=$grep
2276         _egrep=$grep
2277         ;;
2278 esac
2279 case "$ln" in
2280 ln)
2281         echo "Substituting cp for ln."
2282         ln=$cp
2283         _ln=$cp
2284         ;;
2285 esac
2286 case "$make" in
2287 make)   
2288         case "$gmake" in
2289         gmake)
2290         echo "I can't find make or gmake, and my life depends on it." >&4
2291         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2292         exit 1
2293         ;;
2294         esac
2295         ;;
2296 esac    
2297 case "$gmake" in
2298 gmake)  ;;
2299 *)      # We can't have osname yet.
2300         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2301                 # Assume that gmake, if found, is definitely GNU make
2302                 # and prefer it over the system make.
2303                 echo "Substituting gmake for make."
2304                 make=$gmake
2305                 _make=$gmake
2306         fi
2307         ;;
2308 esac
2309 case "$test" in
2310 test)
2311         echo "Hopefully test is built into your sh."
2312         ;;
2313 *)
2314         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2315                 echo "Using the test built into your sh."
2316                 test=test
2317                 _test=test
2318         fi
2319         ;;
2320 esac
2321 case "$echo" in
2322 echo)
2323         echo "Hopefully echo is built into your sh."
2324         ;;
2325 '') ;;
2326 *)
2327         echo " "
2328 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2329         $echo $n "hi there$c" >foo1
2330         echo $n "hi there$c" >foo2
2331         if cmp foo1 foo2 >/dev/null 2>&1; then
2332                 echo "They are compatible.  In fact, they may be identical."
2333         else
2334                 case "$n" in
2335                 '-n') n='' c='\c';;
2336                 *) n='-n' c='';;
2337                 esac
2338                 cat <<FOO
2339 They are not compatible!  You are probably running ksh on a non-USG system.
2340 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2341 have echo built in and we may have to run some Bourne shell scripts.  That
2342 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2343
2344 FOO
2345                 $echo $n "The star should be here-->$c"
2346                 $echo "*"
2347         fi
2348         $rm -f foo1 foo2
2349         ;;
2350 esac
2351
2352 cat <<EOS >trygcc
2353 $startsh
2354 EOS
2355 cat <<'EOSC' >>trygcc
2356 case "$cc" in
2357 '') ;;
2358 *)  $rm -f try try.*
2359     $cat >try.c <<EOM
2360 int main(int argc, char *argv[]) {
2361   return 0;
2362 }
2363 EOM
2364     if $cc -o try $ccflags $ldflags try.c; then
2365        :
2366     else
2367         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2368         despair=yes
2369         trygcc=yes
2370         case "$cc" in
2371         *gcc*) trygcc=no ;;
2372         esac
2373         case "`$cc -v -c try.c 2>&1`" in
2374         *gcc*) trygcc=no ;;
2375         esac
2376         if $test X"$trygcc" = Xyes; then
2377             if gcc -o try -c try.c; then
2378                 echo " "
2379                 echo "You seem to have a working gcc, though." >&4
2380                 rp="Would you like to use it?"
2381                 dflt=y
2382                 if $test -f myread; then
2383                     . ./myread
2384                 else
2385                     if $test -f UU/myread; then
2386                         . ./UU/myread
2387                     else
2388                         echo "Cannot find myread, sorry.  Aborting." >&2
2389                         exit 1
2390                     fi
2391                 fi  
2392                 case "$ans" in
2393                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2394                        if $test -f usethreads.cbu; then
2395                            $cat >&4 <<EOM 
2396
2397 *** However, any setting of the C compiler flags (e.g. for thread support)
2398 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2399 *** (together with e.g. -Dusethreads).
2400
2401 EOM
2402                        fi;;
2403                 esac
2404             fi
2405         fi
2406     fi
2407     $rm -f try try.*
2408     ;;
2409 esac
2410 EOSC
2411
2412 cat <<EOS >checkcc
2413 $startsh
2414 EOS
2415 cat <<'EOSC' >>checkcc
2416 case "$cc" in        
2417 '') ;;
2418 *)  $rm -f try try.*              
2419     $cat >try.c <<EOM
2420 int main(int argc, char *argv[]) {
2421   return 0;
2422 }
2423 EOM
2424     if $cc -o try $ccflags $ldflags try.c; then
2425        :
2426     else
2427         if $test X"$despair" = Xyes; then
2428            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2429         fi
2430         $cat >&4 <<EOM         
2431 You need to find a working C compiler.
2432 Either (purchase and) install the C compiler supplied by your OS vendor,
2433 or for a free C compiler try http://gcc.gnu.org/
2434 I cannot continue any further, aborting.
2435 EOM
2436         exit 1
2437     fi
2438     $rm -f try try.*
2439     ;;
2440 esac
2441 EOSC
2442
2443 : determine whether symbolic links are supported
2444 echo " "
2445 $touch blurfl
2446 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2447         echo "Symbolic links are supported." >&4
2448         lns="$ln -s"
2449 else
2450         echo "Symbolic links are NOT supported." >&4
2451         lns="$ln"
2452 fi
2453 $rm -f blurfl sym
2454
2455 : determine whether symbolic links are supported
2456 echo " "
2457 case "$lns" in
2458 *"ln"*" -s")
2459         echo "Checking how to test for symbolic links..." >&4
2460         $lns blurfl sym
2461         if $test "X$issymlink" = X; then
2462                 case "$newsh" in
2463                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2464                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2465                 esac
2466                 if test $? = 0; then
2467                         issymlink="test -h"
2468                 else
2469                         echo "Your builtin 'test -h' may be broken." >&4
2470                         case "$test" in
2471                         /*)     ;;
2472                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2473                                 for p in $pth
2474                                 do
2475                                         if test -f "$p/$test"; then
2476                                                 test="$p/$test"
2477                                                 break
2478                                         fi
2479                                 done
2480                                 ;;
2481                         esac
2482                         case "$test" in
2483                         /*)
2484                                 echo "Trying external '$test -h'." >&4
2485                                 issymlink="$test -h"
2486                                 if $test ! -h sym >/dev/null 2>&1; then
2487                                         echo "External '$test -h' is broken, too." >&4
2488                                         issymlink=''
2489                                 fi
2490                                 ;;
2491                         *)      issymlink='' ;;
2492                         esac
2493                 fi              
2494         fi
2495         if $test "X$issymlink" = X; then
2496                 if $test -L sym 2>/dev/null; then
2497                         issymlink="$test -L"
2498                         echo "The builtin '$test -L' worked." >&4
2499                 fi
2500         fi
2501         if $test "X$issymlink" != X; then
2502                 echo "You can test for symbolic links with '$issymlink'." >&4
2503         else
2504                 echo "I do not know how you can test for symbolic links." >&4
2505         fi
2506         $rm -f blurfl sym
2507         ;;
2508 *)      echo "No symbolic links, so not testing for their testing..." >&4
2509         ;;
2510 esac
2511 echo " "
2512
2513
2514 case "$mksymlinks" in
2515 $define|true|[yY]*)
2516         case "$src" in
2517         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2518                 exit 1
2519                 ;;
2520         *)      case "$lns:$issymlink" in
2521                 *"ln"*" -s:"*"test -"?)
2522                         echo "Creating the symbolic links..." >&4
2523                         echo "(First creating the subdirectories...)" >&4
2524                         cd ..
2525                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2526                                 read directory
2527                                 test -z "$directory" && break
2528                                 mkdir -p $directory
2529                         done
2530                         # Sanity check 1.
2531                         if test ! -d t/base; then
2532                                 echo "Failed to create the subdirectories.  Aborting." >&4
2533                                 exit 1
2534                         fi
2535                         echo "(Then creating the symlinks...)" >&4
2536                         awk '{print $1}' $src/MANIFEST | while true; do
2537                                 read filename
2538                                 test -z "$filename" && break
2539                                 if test -f $filename; then
2540                                         if $issymlink $filename; then
2541                                                 rm -f $filename
2542                                         fi
2543                                 fi
2544                                 if test -f $filename; then
2545                                         echo "$filename already exists, not symlinking."
2546                                 else
2547                                         ln -s $src/$filename $filename
2548                                 fi
2549                         done
2550                         # Sanity check 2.
2551                         if test ! -f t/base/lex.t; then
2552                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2553                                 exit 1
2554                         fi
2555                         cd UU
2556                         ;;
2557                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2558                         ;;
2559                 esac
2560                 ;;
2561         esac
2562         ;;
2563 esac
2564
2565
2566 case "$usecrosscompile" in
2567 $define|true|[yY]*)
2568         $echo "Cross-compiling..."
2569         croak=''
2570         case "$cc" in
2571         *-*-gcc) # A cross-compiling gcc, probably.
2572             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2573             ar=$targetarch-ar
2574             # leave out ld, choosing it is more complex
2575             nm=$targetarch-nm
2576             ranlib=$targetarch-ranlib
2577             $echo 'extern int foo;' > try.c
2578             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2579             shift
2580             if $test $# -gt 0; then
2581                 incpth="$incpth $*"
2582                 incpth="`$echo $incpth|$sed 's/^ //'`"
2583                 echo "Guessing incpth '$incpth'." >&4
2584                 for i in $*; do
2585                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2586                     if $test -d $j; then
2587                         libpth="$libpth $j"
2588                     fi
2589                 done   
2590                 libpth="`$echo $libpth|$sed 's/^ //'`"
2591                 echo "Guessing libpth '$libpth'." >&4
2592             fi
2593             $rm -f try.c
2594             ;;
2595         esac
2596         case "$targetarch" in
2597         '') echo "Targetarch not defined." >&4; croak=y ;;
2598         *)  echo "Using targetarch $targetarch." >&4 ;;
2599         esac
2600         case "$incpth" in
2601         '') echo "Incpth not defined." >&4; croak=y ;;
2602         *)  echo "Using incpth '$incpth'." >&4 ;;
2603         esac
2604         case "$libpth" in
2605         '') echo "Libpth not defined." >&4; croak=y ;;
2606         *)  echo "Using libpth '$libpth'." >&4 ;;
2607         esac
2608         case "$usrinc" in
2609         '') for i in $incpth; do
2610                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2611                     usrinc=$i
2612                     echo "Guessing usrinc $usrinc." >&4
2613                     break
2614                 fi
2615             done
2616             case "$usrinc" in
2617             '') echo "Usrinc not defined." >&4; croak=y ;;
2618             esac
2619             ;;
2620         *)  echo "Using usrinc $usrinc." >&4 ;;
2621         esac
2622         case "$targethost" in
2623         '') echo "Targethost not defined." >&4; croak=y ;;
2624         *)  echo "Using targethost $targethost." >&4
2625         esac
2626         locincpth=' '
2627         loclibpth=' '
2628         case "$croak" in
2629         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2630         esac
2631         case "$src" in
2632         /*) run=$src/Cross/run
2633             targetmkdir=$src/Cross/mkdir
2634             to=$src/Cross/to
2635             from=$src/Cross/from
2636             ;;
2637         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2638             run=$pwd/Cross/run
2639             targetmkdir=$pwd/Cross/mkdir
2640             to=$pwd/Cross/to
2641             from=$pwd/Cross/from
2642             ;;
2643         esac
2644         case "$targetrun" in
2645         '') targetrun=ssh ;;
2646         esac
2647         case "$targetto" in
2648         '') targetto=scp ;;
2649         esac
2650         case "$targetfrom" in
2651         '') targetfrom=scp ;;
2652         esac
2653         run=$run-$targetrun
2654         to=$to-$targetto
2655         from=$from-$targetfrom
2656         case "$targetdir" in
2657         '')  targetdir=/tmp
2658              echo "Guessing targetdir $targetdir." >&4
2659              ;;
2660         esac
2661         case "$targetuser" in
2662         '')  targetuser=root
2663              echo "Guessing targetuser $targetuser." >&4
2664              ;;
2665         esac
2666         case "$targetfrom" in
2667         scp)    q=-q ;;
2668         *)      q='' ;;
2669         esac
2670         case "$targetrun" in
2671         ssh|rsh)
2672             cat >$run <<EOF
2673 #!/bin/sh
2674 case "\$1" in
2675 -cwd)
2676   shift
2677   cwd=\$1
2678   shift
2679   ;;
2680 esac
2681 case "\$cwd" in
2682 '') cwd=$targetdir ;;
2683 esac
2684 exe=\$1
2685 shift
2686 if $test ! -f \$exe.xok; then
2687   $to \$exe
2688   $touch \$exe.xok
2689 fi
2690 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2691 EOF
2692             ;;
2693         *)  echo "Unknown targetrun '$targetrun'" >&4
2694             exit 1
2695             ;;
2696         esac
2697         case "$targetmkdir" in
2698         */Cross/mkdir)
2699             cat >$targetmkdir <<EOF
2700 #!/bin/sh
2701 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2702 EOF
2703             $chmod a+rx $targetmkdir
2704             ;;
2705         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2706             exit 1
2707             ;;
2708         esac
2709         case "$targetto" in
2710         scp|rcp)
2711             cat >$to <<EOF
2712 #!/bin/sh
2713 for f in \$@
2714 do
2715   case "\$f" in
2716   /*)
2717     $targetmkdir \`dirname \$f\`
2718     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2719     ;;
2720   *)
2721     $targetmkdir $targetdir/\`dirname \$f\`
2722     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2723     ;;
2724   esac
2725 done
2726 exit 0
2727 EOF
2728             ;;
2729         cp) cat >$to <<EOF
2730 #!/bin/sh
2731 for f in \$@
2732 do
2733   case "\$f" in
2734   /*)
2735     $mkdir -p $targetdir/\`dirname \$f\`
2736     $cp \$f $targetdir/\$f || exit 1
2737     ;;
2738   *)
2739     $targetmkdir $targetdir/\`dirname \$f\`
2740     $cp \$f $targetdir/\$f || exit 1
2741     ;;
2742   esac
2743 done
2744 exit 0
2745 EOF
2746             ;;
2747         *)  echo "Unknown targetto '$targetto'" >&4
2748             exit 1
2749             ;;
2750         esac
2751         case "$targetfrom" in
2752         scp|rcp)
2753           cat >$from <<EOF
2754 #!/bin/sh
2755 for f in \$@
2756 do
2757   $rm -f \$f
2758   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2759 done
2760 exit 0
2761 EOF
2762             ;;
2763         cp) cat >$from <<EOF
2764 #!/bin/sh
2765 for f in \$@
2766 do
2767   $rm -f \$f
2768   cp $targetdir/\$f . || exit 1
2769 done
2770 exit 0
2771 EOF
2772             ;;
2773         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2774             exit 1
2775             ;;
2776         esac
2777         if $test ! -f $run; then
2778             echo "Target 'run' script '$run' not found." >&4
2779         else
2780             $chmod a+rx $run
2781         fi
2782         if $test ! -f $to; then
2783             echo "Target 'to' script '$to' not found." >&4
2784         else
2785             $chmod a+rx $to
2786         fi
2787         if $test ! -f $from; then
2788             echo "Target 'from' script '$from' not found." >&4
2789         else
2790             $chmod a+rx $from
2791         fi
2792         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2793             exit 1
2794         fi
2795         cat >&4 <<EOF
2796 Using '$run' for remote execution,
2797 and '$from' and '$to'
2798 for remote file transfer.
2799 EOF
2800         ;;
2801 *)      run=''
2802         to=:
2803         from=:
2804         usecrosscompile='undef'
2805         targetarch=''
2806         ;;
2807 esac
2808
2809 : see whether [:lower:] and [:upper:] are supported character classes
2810 echo " "
2811 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2812 ABYZ)
2813         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2814         up='[:upper:]'
2815         low='[:lower:]'
2816         ;;
2817 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2818         # (0xc9 and 0xd1), therefore that is a nice testing point.
2819         if test "X$up" = X -o "X$low" = X; then
2820             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2821             ij) up='[A-Z]'
2822                 low='[a-z]'
2823                 ;;
2824             esac
2825         fi
2826         if test "X$up" = X -o "X$low" = X; then
2827             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2828             ij) up='A-Z'
2829                 low='a-z'
2830                 ;;
2831             esac
2832         fi
2833         if test "X$up" = X -o "X$low" = X; then
2834             case "`echo IJ | od -x 2>/dev/null`" in
2835             *C9D1*|*c9d1*)
2836                 echo "Hey, this might be EBCDIC." >&4
2837                 if test "X$up" = X -o "X$low" = X; then
2838                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2839                     ij) up='[A-IJ-RS-Z]'
2840                         low='[a-ij-rs-z]'
2841                         ;;
2842                     esac
2843                 fi
2844                 if test "X$up" = X -o "X$low" = X; then
2845                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2846                     ij) up='A-IJ-RS-Z'
2847                         low='a-ij-rs-z'
2848                         ;;
2849                     esac
2850                 fi
2851                 ;;
2852             esac
2853         fi
2854 esac
2855 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2856 ij)
2857     echo "Using $up and $low to convert case." >&4
2858     ;;
2859 *)
2860     echo "I don't know how to translate letters from upper to lower case." >&4
2861     echo "Your tr is not acting any way I know of." >&4
2862     exit 1
2863     ;;
2864 esac
2865 : set up the translation script tr, must be called with ./tr of course
2866 cat >tr <<EOSC
2867 $startsh
2868 case "\$1\$2" in
2869 '[A-Z][a-z]') exec $tr '$up' '$low';;
2870 '[a-z][A-Z]') exec $tr '$low' '$up';;
2871 esac
2872 exec $tr "\$@"
2873 EOSC
2874 chmod +x tr
2875 $eunicefix tr
2876
2877 : Try to determine whether config.sh was made on this system
2878 case "$config_sh" in
2879 '')
2880 myuname=`$uname -a 2>/dev/null`
2881 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2882 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2883 # because the A-Z/a-z are not consecutive.
2884 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2885         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2886 newmyuname="$myuname"
2887 dflt=n
2888 case "$knowitall" in
2889 '')
2890         if test -f ../config.sh; then
2891                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2892                         eval "`grep myuname= ../config.sh`"
2893                 fi
2894                 if test "X$myuname" = "X$newmyuname"; then
2895                         dflt=y
2896                 fi
2897         fi
2898         ;;
2899 *) dflt=y;;
2900 esac
2901
2902 : Get old answers from old config file if Configure was run on the
2903 : same system, otherwise use the hints.
2904 hint=default
2905 cd ..
2906 if test -f config.sh; then
2907         echo " "
2908         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2909         . UU/myread
2910         case "$ans" in
2911         n*|N*) echo "OK, I'll ignore it."
2912                 mv config.sh config.sh.old
2913                 myuname="$newmyuname"
2914                 ;;
2915         *)  echo "Fetching default answers from your old config.sh file..." >&4
2916                 tmp_n="$n"
2917                 tmp_c="$c"
2918                 tmp_sh="$sh"
2919                 . ./config.sh
2920                 cp config.sh UU
2921                 n="$tmp_n"
2922                 c="$tmp_c"
2923                 : Older versions did not always set $sh.  Catch re-use of such
2924                 : an old config.sh.
2925                 case "$sh" in
2926                 '') sh="$tmp_sh" ;;
2927                 esac
2928                 hint=previous
2929                 ;;
2930         esac
2931 fi
2932 . ./UU/checkcc
2933 if test ! -f config.sh; then
2934         $cat <<EOM
2935
2936 First time through, eh?  I have some defaults handy for some systems
2937 that need some extra help getting the Configure answers right:
2938
2939 EOM
2940         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2941         dflt=''
2942         : Half the following guesses are probably wrong... If you have better
2943         : tests or hints, please send them to perlbug@perl.org
2944         : The metaconfig authors would also appreciate a copy...
2945         $test -f /irix && osname=irix
2946         $test -f /xenix && osname=sco_xenix
2947         $test -f /dynix && osname=dynix
2948         $test -f /dnix && osname=dnix
2949         $test -f /lynx.os && osname=lynxos
2950         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2951         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2952         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2953         $test -f /bin/mips && /bin/mips && osname=mips
2954         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2955                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2956         $test -d /usr/apollo/bin && osname=apollo
2957         $test -f /etc/saf/_sactab && osname=svr4
2958         $test -d /usr/include/minix && osname=minix
2959         $test -f /system/gnu_library/bin/ar.pm && osname=vos
2960         if $test -d /MachTen -o -d /MachTen_Folder; then
2961                 osname=machten
2962                 if $test -x /sbin/version; then
2963                         osvers=`/sbin/version | $awk '{print $2}' |
2964                         $sed -e 's/[A-Za-z]$//'`
2965                 elif $test -x /usr/etc/version; then
2966                         osvers=`/usr/etc/version | $awk '{print $2}' |
2967                         $sed -e 's/[A-Za-z]$//'`
2968                 else
2969                         osvers="$2.$3"
2970                 fi
2971         fi
2972
2973         $test -f /sys/posix.dll &&
2974                 $test -f /usr/bin/what &&
2975                 set X `/usr/bin/what /sys/posix.dll` &&
2976                 $test "$3" = UWIN &&
2977                 osname=uwin &&
2978                 osvers="$5"
2979
2980         if $test -f $uname; then
2981                 set X $myuname
2982                 shift
2983
2984                 case "$5" in
2985                 fps*) osname=fps ;;
2986                 mips*)
2987                         case "$4" in
2988                         umips) osname=umips ;;
2989                         *) osname=mips ;;
2990                         esac;;
2991                 [23]100) osname=mips ;;
2992                 next*) osname=next ;;
2993                 i386*)
2994                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2995                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2996                                 osname='sco'
2997                                 osvers=$tmp
2998                         elif $test -f /etc/kconfig; then
2999                                 osname=isc
3000                                 if test "$lns" = "$ln -s"; then
3001                                         osvers=4
3002                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3003                                         osvers=3
3004                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3005                                         osvers=2
3006                                 fi
3007                         fi
3008                         tmp=''
3009                         ;;
3010                 pc*)
3011                         if test -n "$DJGPP"; then
3012                                 osname=dos
3013                                 osvers=djgpp
3014                         fi
3015                         ;;
3016                 esac
3017
3018                 case "$1" in
3019                 aix) osname=aix
3020                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3021                         case "$tmp" in
3022                         'not found') osvers="$4"."$3" ;;
3023                         '<3240'|'<>3240') osvers=3.2.0 ;;
3024                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3025                         '=3250'|'>3250') osvers=3.2.5 ;;
3026                         *) osvers=$tmp;;
3027                         esac
3028                         ;;
3029                 bsd386) osname=bsd386
3030                         osvers=`$uname -r`
3031                         ;;
3032                 cygwin*) osname=cygwin
3033                         osvers="$3"
3034                         ;;
3035                 *dc.osx) osname=dcosx
3036                         osvers="$3"
3037                         ;;
3038                 dnix) osname=dnix
3039                         osvers="$3"
3040                         ;;
3041                 domainos) osname=apollo
3042                         osvers="$3"
3043                         ;;
3044                 dgux) osname=dgux 
3045                         osvers="$3"
3046                         ;;
3047                 dynixptx*) osname=dynixptx
3048                         osvers=`echo "$4"|sed 's/^v//'`
3049                         ;;
3050                 freebsd) osname=freebsd 
3051                         osvers="$3" ;;
3052                 genix) osname=genix ;;
3053                 hp*) osname=hpux 
3054                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3055                         ;;
3056                 irix*) osname=irix
3057                         case "$3" in
3058                         4*) osvers=4 ;;
3059                         5*) osvers=5 ;;
3060                         *)      osvers="$3" ;;
3061                         esac
3062                         ;;
3063                 linux) osname=linux
3064                         case "$3" in
3065                         *)      osvers="$3" ;;
3066                         esac
3067                         ;;
3068                 MiNT) osname=mint
3069                         ;;
3070                 netbsd*) osname=netbsd
3071                         osvers="$3"
3072                         ;;
3073                 news-os) osvers="$3"
3074                         case "$3" in
3075                         4*) osname=newsos4 ;;
3076                         *) osname=newsos ;;
3077                         esac
3078                         ;;
3079                 next*) osname=next ;;
3080                 nonstop-ux) osname=nonstopux ;;
3081                 openbsd) osname=openbsd
3082                         osvers="$3"
3083                         ;;
3084                 POSIX-BC | posix-bc ) osname=posix-bc
3085                         osvers="$3"
3086                         ;;
3087                 powerux | power_ux | powermax_os | powermaxos | \
3088                 powerunix | power_unix) osname=powerux
3089                         osvers="$3"
3090                         ;;
3091                 qnx) osname=qnx
3092                         osvers="$4"
3093                         ;;
3094                 solaris) osname=solaris
3095                         case "$3" in
3096                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3097                         *)      osvers="$3" ;;
3098                         esac
3099                         ;;
3100                 sunos) osname=sunos
3101                         case "$3" in
3102                         5*) osname=solaris
3103                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3104                         *)      osvers="$3" ;;
3105                         esac
3106                         ;;
3107                 titanos) osname=titanos
3108                         case "$3" in
3109                         1*) osvers=1 ;;
3110                         2*) osvers=2 ;;
3111                         3*) osvers=3 ;;
3112                         4*) osvers=4 ;;
3113                         *)      osvers="$3" ;;
3114                         esac
3115                         ;;
3116                 ultrix) osname=ultrix
3117                         osvers="$3"
3118                         ;;
3119                 osf1|mls+)      case "$5" in
3120                                 alpha)
3121                                         osname=dec_osf
3122                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3123                                         case "$osvers" in
3124                                         [1-9].[0-9]*) ;;
3125                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3126                                         esac
3127                                         ;;
3128                         hp*)    osname=hp_osf1  ;;
3129                         mips)   osname=mips_osf1 ;;
3130                         esac
3131                         ;;
3132                 unixware) osname=svr5
3133                         osvers="$4"
3134                         ;;
3135                 uts)    osname=uts
3136                         osvers="$3"
3137                         ;;
3138                 vos) osvers="$3"
3139                         ;;
3140                 $2) case "$osname" in
3141                         *isc*) ;;
3142                         *freebsd*) ;;
3143                         svr*)
3144                                 : svr4.x or possibly later
3145                                 case "svr$3" in 
3146                                 ${osname}*)
3147                                         osname=svr$3
3148                                         osvers=$4
3149                                         ;;
3150                                 esac
3151                                 case "$osname" in
3152                                 svr4.0)
3153                                         : Check for ESIX
3154                                         if test -f /stand/boot ; then
3155                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3156                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3157                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3158                                                         if test -n "$isesix"; then
3159                                                                 osname=esix4
3160                                                         fi
3161                                                 fi
3162                                         fi
3163                                         ;;
3164                                 esac
3165                                 ;;
3166                         *)      if test -f /etc/systemid; then
3167                                         osname=sco
3168                                         set `echo $3 | $sed 's/\./ /g'` $4
3169                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3170                                                 osvers=$1.$2.$3
3171                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3172                                                 osvers=$1.$2
3173                                         elif $test -f $src/hints/sco_$1.sh; then
3174                                                 osvers=$1
3175                                         fi
3176                                 else
3177                                         case "$osname" in
3178                                         '') : Still unknown.  Probably a generic Sys V.
3179                                                 osname="sysv"
3180                                                 osvers="$3"
3181                                                 ;;
3182                                         esac
3183                                 fi
3184                                 ;;
3185                         esac
3186                         ;;
3187                 *)      case "$osname" in
3188                         '') : Still unknown.  Probably a generic BSD.
3189                                 osname="$1"
3190                                 osvers="$3"
3191                                 ;;
3192                         esac
3193                         ;;
3194                 esac
3195         else
3196                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3197                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3198                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3199                                 osname=news_os
3200                         fi
3201                         $rm -f UU/kernel.what
3202                 elif test -d c:/.; then
3203                         set X $myuname
3204                         osname=os2
3205                         osvers="$5"
3206                 fi
3207         fi
3208         
3209         case "$targetarch" in
3210         '') ;;
3211         *)  hostarch=$osname
3212             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3213             osvers=''
3214             ;;
3215         esac
3216
3217         : Now look for a hint file osname_osvers, unless one has been
3218         : specified already.
3219         case "$hintfile" in
3220         ''|' ')
3221                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3222                 : Also try without trailing minor version numbers.
3223                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3224                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3225                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3226                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3227                 case "$file" in
3228                 '') dflt=none ;;
3229                 *)  case "$osvers" in
3230                         '') dflt=$file
3231                                 ;;
3232                         *)  if $test -f $src/hints/$file.sh ; then
3233                                         dflt=$file
3234                                 elif $test -f $src/hints/$xfile.sh ; then
3235                                         dflt=$xfile
3236                                 elif $test -f $src/hints/$xxfile.sh ; then
3237                                         dflt=$xxfile
3238                                 elif $test -f $src/hints/$xxxfile.sh ; then
3239                                         dflt=$xxxfile
3240                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3241                                         dflt=$xxxxfile
3242                                 elif $test -f "$src/hints/${osname}.sh" ; then
3243                                         dflt="${osname}"
3244                                 else
3245                                         dflt=none
3246                                 fi
3247                                 ;;
3248                         esac
3249                         ;;
3250                 esac
3251                 if $test -f Policy.sh ; then
3252                         case "$dflt" in
3253                         *Policy*) ;;
3254                         none) dflt="Policy" ;;
3255                         *) dflt="Policy $dflt" ;;
3256                         esac
3257                 fi
3258                 ;;
3259         *)
3260                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3261                 ;;
3262         esac
3263
3264         if $test -f Policy.sh ; then
3265                 $cat <<EOM
3266
3267 There's also a Policy hint file available, which should make the
3268 site-specific (policy) questions easier to answer.
3269 EOM
3270
3271         fi
3272
3273         $cat <<EOM
3274
3275 You may give one or more space-separated answers, or "none" if appropriate.
3276 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3277 is a good thing.  DO NOT give a wrong version or a wrong OS.
3278
3279 EOM
3280
3281         rp="Which of these apply, if any?"
3282         . UU/myread
3283         tans=$ans
3284         for file in $tans; do
3285                 if $test X$file = XPolicy -a -f Policy.sh; then
3286                         . Policy.sh
3287                         $cat Policy.sh >> UU/config.sh
3288                 elif $test -f $src/hints/$file.sh; then
3289                         . $src/hints/$file.sh
3290                         $cat $src/hints/$file.sh >> UU/config.sh
3291                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3292                         : nothing
3293                 else
3294                         : Give one chance to correct a possible typo.
3295                         echo "$file.sh does not exist"
3296                         dflt=$file
3297                         rp="hint to use instead?"
3298                         . UU/myread
3299                         for file in $ans; do
3300                                 if $test -f "$src/hints/$file.sh"; then
3301                                         . $src/hints/$file.sh
3302                                         $cat $src/hints/$file.sh >> UU/config.sh
3303                                 elif $test X$ans = X -o X$ans = Xnone ; then
3304                                         : nothing
3305                                 else
3306                                         echo "$file.sh does not exist -- ignored."
3307                                 fi
3308                         done
3309                 fi
3310         done
3311
3312         hint=recommended
3313         : Remember our hint file for later.
3314         if $test -f "$src/hints/$file.sh" ; then
3315                 hintfile="$file"
3316         else
3317                 hintfile=''
3318         fi
3319 fi
3320 cd UU
3321 ;;
3322 *)
3323         echo " "
3324         echo "Fetching default answers from $config_sh..." >&4
3325         tmp_n="$n"
3326         tmp_c="$c"
3327         cd ..
3328         cp $config_sh config.sh 2>/dev/null
3329         chmod +w config.sh
3330         . ./config.sh
3331         cd UU
3332         cp ../config.sh .
3333         n="$tmp_n"
3334         c="$tmp_c"
3335         hint=previous
3336         ;;
3337 esac
3338 test "$override" && . ./optdef.sh
3339
3340 : Restore computed paths
3341 for file in $loclist $trylist; do
3342         eval $file="\$_$file"
3343 done
3344
3345 cat << EOM
3346
3347 Configure uses the operating system name and version to set some defaults.
3348 The default value is probably right if the name rings a bell. Otherwise,
3349 since spelling matters for me, either accept the default or answer "none"
3350 to leave it blank.
3351
3352 EOM
3353 case "$osname" in
3354         ''|' ')
3355                 case "$hintfile" in
3356                 ''|' '|none) dflt=none ;;
3357                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3358                 esac
3359                 ;;
3360         *) dflt="$osname" ;;
3361 esac
3362 rp="Operating system name?"
3363 . ./myread
3364 case "$ans" in
3365 none)  osname='' ;;
3366 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3367 esac
3368 echo " "
3369 case "$osvers" in
3370         ''|' ')
3371                 case "$hintfile" in
3372                 ''|' '|none) dflt=none ;;
3373                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3374                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3375                         case "$dflt" in
3376                         ''|' ') dflt=none ;;
3377                         esac
3378                         ;;
3379                 esac
3380                 ;;
3381         *) dflt="$osvers" ;;
3382 esac
3383 rp="Operating system version?"
3384 . ./myread
3385 case "$ans" in
3386 none)  osvers='' ;;
3387 *) osvers="$ans" ;;
3388 esac
3389
3390
3391 . ./posthint.sh
3392
3393 : who configured the system
3394 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3395 cf_by=`(logname) 2>/dev/null`
3396 case "$cf_by" in
3397 "")
3398         cf_by=`(whoami) 2>/dev/null`
3399         case "$cf_by" in
3400         "") cf_by=unknown ;;
3401         esac ;;
3402 esac
3403
3404 : set up the script used to warn in case of inconsistency
3405 cat <<EOS >whoa
3406 $startsh
3407 EOS
3408 cat <<'EOSC' >>whoa
3409 dflt=y
3410 echo " "
3411 echo "*** WHOA THERE!!! ***" >&4
3412 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3413 rp="    Keep the $hint value?"
3414 . ./myread
3415 case "$ans" in
3416 y) td=$was; tu=$was;;
3417 esac
3418 EOSC
3419
3420 : function used to set $1 to $val
3421 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3422 case "$val$was" in
3423 $define$undef) . ./whoa; eval "$var=\$td";;
3424 $undef$define) . ./whoa; eval "$var=\$tu";;
3425 *) eval "$var=$val";;
3426 esac'
3427
3428 case "$usethreads" in
3429 $define|true|[yY]*)     dflt='y';;
3430 *)     # Catch case where user specified ithreads or 5005threads but
3431        # forgot -Dusethreads (A.D. 4/2002)
3432        case "$useithreads$use5005threads" in
3433        *$define*)      dflt='y' ;;
3434        *)      dflt='n';;
3435        esac
3436        ;;
3437 esac
3438 cat <<EOM
3439
3440 Perl can be built to take advantage of threads on some systems.
3441 To do so, Configure can be run with -Dusethreads.
3442
3443 Note that Perl built with threading support runs slightly slower
3444 and uses more memory than plain Perl. The current implementation
3445 is believed to be stable, but it is fairly new, and so should be
3446 treated with caution.
3447
3448 If this doesn't make any sense to you, just accept the default '$dflt'.
3449 EOM
3450 rp='Build a threading Perl?'
3451 . ./myread
3452 case "$ans" in
3453 y|Y)    val="$define" ;;
3454 *)      val="$undef" ;;
3455 esac
3456 set usethreads
3457 eval $setvar
3458
3459 case "$usethreads" in
3460 $define)
3461         $cat <<EOM
3462
3463 Since release 5.6, Perl has had two different threading implementations,
3464 the newer interpreter-based version (ithreads) with one interpreter per
3465 thread, and the older 5.005 version (5005threads).
3466 The 5005threads version is effectively unmaintained and will probably be
3467 removed in Perl 5.10, so there should be no need to build a Perl using it
3468 unless needed for backwards compatibility with some existing 5.005threads
3469 code.
3470
3471 EOM
3472         : Default to ithreads unless overridden on command line or with
3473         : old config.sh
3474         dflt='y'
3475         case "$use5005threads" in
3476                 $define|true|[yY]*) dflt='n';;
3477         esac
3478         case "$useithreads" in
3479                 $undef|false|[nN]*) dflt='n';;
3480         esac
3481         rp='Use the newer interpreter-based ithreads?'
3482         . ./myread
3483         case "$ans" in
3484         y|Y)    val="$define" ;;
3485         *)      val="$undef" ;;
3486         esac
3487         set useithreads
3488         eval $setvar
3489         : Now set use5005threads to the opposite value.
3490         case "$useithreads" in
3491         $define) val="$undef" ;;
3492         *) val="$define" ;;
3493         esac
3494         set use5005threads
3495         eval $setvar
3496         ;;
3497 *)
3498         useithreads="$undef"
3499         use5005threads="$undef"
3500         ;;
3501 esac
3502
3503 case "$useithreads$use5005threads" in
3504 "$define$define")
3505         $cat >&4 <<EOM
3506
3507 You cannot have both the ithreads and the 5.005 threads enabled
3508 at the same time.  Disabling the 5.005 threads since they are
3509 much less stable than the ithreads.
3510
3511 EOM
3512         use5005threads="$undef"
3513         ;;
3514 esac
3515
3516 case "$d_oldpthreads" in
3517 '')     : Configure tests would be welcome here.  For now, assume undef.
3518         val="$undef" ;;
3519 *)      val="$d_oldpthreads" ;;
3520 esac
3521 set d_oldpthreads
3522 eval $setvar
3523
3524
3525 case "$usethreads" in
3526 "$define"|true|[yY]*)
3527 : Look for a hint-file generated 'call-back-unit'.  If the
3528 : user has specified that a threading perl is to be built,
3529 : we may need to set or change some other defaults.
3530         if $test -f usethreads.cbu; then
3531                 echo "Your platform has some specific hints for threaded builds, using them..."
3532                 . ./usethreads.cbu
3533         else
3534                 $cat <<EOM
3535 (Your platform doesn't have any specific hints for threaded builds.
3536  Assuming POSIX threads, then.)
3537 EOM
3538         fi
3539         ;;
3540 esac
3541
3542 cat <<EOM
3543
3544 Perl can be built so that multiple Perl interpreters can coexist
3545 within the same Perl executable.
3546 EOM
3547
3548 case "$useithreads" in
3549 $define)
3550         cat <<EOM
3551 This multiple interpreter support is required for interpreter-based threads.
3552 EOM
3553         val="$define"
3554         ;;
3555 *)      case "$usemultiplicity" in
3556         $define|true|[yY]*)     dflt='y';;
3557         *) dflt='n';;
3558         esac
3559         echo " "
3560         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3561         rp='Build Perl for multiplicity?'
3562         . ./myread
3563         case "$ans" in
3564         y|Y)    val="$define" ;;
3565         *)      val="$undef" ;;
3566         esac
3567         ;;
3568 esac
3569 set usemultiplicity
3570 eval $setvar
3571
3572
3573 case "$usemorebits" in
3574 "$define"|true|[yY]*)
3575         use64bitint="$define"
3576         uselongdouble="$define"
3577         usemorebits="$define"
3578         ;;
3579 *)      usemorebits="$undef"
3580         ;;
3581 esac
3582
3583 : make some quick guesses about what we are up against
3584 echo " "
3585 $echo $n "Hmm...  $c"
3586 echo exit 1 >bsd
3587 echo exit 1 >usg
3588 echo exit 1 >v7
3589 echo exit 1 >osf1
3590 echo exit 1 >eunice
3591 echo exit 1 >xenix
3592 echo exit 1 >venix
3593 echo exit 1 >os2
3594 d_bsd="$undef"
3595 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3596 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3597 then
3598         echo "Looks kind of like an OSF/1 system, but we'll see..."
3599         echo exit 0 >osf1
3600 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3601         xxx=`./loc addbib blurfl $pth`
3602         if $test -f $xxx; then
3603         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3604                 echo exit 0 >bsd
3605                 echo exit 0 >usg
3606         else
3607                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3608                         echo "Looks kind of like an extended USG system, but we'll see..."
3609                 else
3610                         echo "Looks kind of like a USG system, but we'll see..."
3611                 fi
3612                 echo exit 0 >usg
3613         fi
3614 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3615         echo "Looks kind of like a BSD system, but we'll see..."
3616         d_bsd="$define"
3617         echo exit 0 >bsd
3618 else
3619         echo "Looks kind of like a Version 7 system, but we'll see..."
3620         echo exit 0 >v7
3621 fi
3622 case "$eunicefix" in
3623 *unixtovms*)
3624         $cat <<'EOI'
3625 There is, however, a strange, musty smell in the air that reminds me of
3626 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3627 EOI
3628         echo exit 0 >eunice
3629         d_eunice="$define"
3630 : it so happens the Eunice I know will not run shell scripts in Unix format
3631         ;;
3632 *)
3633         echo " "
3634         echo "Congratulations.  You aren't running Eunice."
3635         d_eunice="$undef"
3636         ;;
3637 esac
3638 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3639 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3640 : semicolon as a patch separator
3641 case "$p_" in
3642 :) ;;
3643 *)
3644         $cat <<'EOI'
3645 I have the feeling something is not exactly right, however...don't tell me...
3646 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3647 (Or you may be running DOS with DJGPP.)
3648 EOI
3649         echo exit 0 >os2
3650         ;;
3651 esac
3652 if test -f /xenix; then
3653         echo "Actually, this looks more like a XENIX system..."
3654         echo exit 0 >xenix
3655         d_xenix="$define"
3656 else
3657         echo " "
3658         echo "It's not Xenix..."
3659         d_xenix="$undef"
3660 fi
3661 chmod +x xenix
3662 $eunicefix xenix
3663 if test -f /venix; then
3664         echo "Actually, this looks more like a VENIX system..."
3665         echo exit 0 >venix
3666 else
3667         echo " "
3668         if ./xenix; then
3669                 : null
3670         else
3671                 echo "Nor is it Venix..."
3672         fi
3673 fi
3674 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3675 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3676 $rm -f foo
3677
3678 case "$cc" in
3679 '') dflt=cc;;
3680 *) dflt="$cc";;
3681 esac
3682 rp="Use which C compiler?"
3683 . ./myread
3684 cc="$ans"
3685
3686 : See if they have not cc but they do have gcc
3687 . ./trygcc
3688 : Look for a hint-file generated 'call-back-unit'.  Now that the
3689 : user has specified the compiler, we may need to set or change some
3690 : other defaults.
3691 if $test -f cc.cbu; then
3692     . ./cc.cbu
3693 fi
3694 . ./checkcc
3695
3696 echo " "
3697 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3698 $cat >try.c <<EOM
3699 #include <stdio.h>
3700 int main() {
3701 #ifdef __GNUC__
3702 #ifdef __VERSION__
3703         printf("%s\n", __VERSION__);
3704 #else
3705         printf("%s\n", "1");
3706 #endif
3707 #endif
3708         exit(0);
3709 }
3710 EOM
3711 if $cc -o try $ccflags $ldflags try.c; then
3712         gccversion=`$run ./try`
3713         case "$gccversion" in
3714         '') echo "You are not using GNU cc." ;;
3715         *)  echo "You are using GNU cc $gccversion."
3716             ccname=gcc  
3717             ;;
3718         esac
3719 else
3720         echo " "
3721         echo "*** WHOA THERE!!! ***" >&4
3722         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3723         case "$knowitall" in
3724         '')
3725         echo "    You'd better start hunting for one and let me know about it." >&4
3726                 exit 1
3727                 ;;
3728         esac
3729 fi
3730 $rm -f try try.*
3731 case "$gccversion" in
3732 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3733 esac
3734 case "$gccversion" in
3735 '') gccosandvers='' ;;
3736 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3737    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3738    gccshortvers=''
3739    case "$gccosandvers" in
3740    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3741    $osname$osvers) ;; # looking good
3742    $osname*) cat <<EOM >&4
3743
3744 *** WHOA THERE!!! ***
3745
3746     Your gcc has not been compiled for the exact release of
3747     your operating system ($gccosandvers versus $osname$osvers).
3748
3749     In general it is a good idea to keep gcc synchronized with
3750     the operating system because otherwise serious problems
3751     may ensue when trying to compile software, like Perl.
3752
3753     I'm trying to be optimistic here, though, and will continue.
3754     If later during the configuration and build icky compilation
3755     problems appear (headerfile conflicts being the most common
3756     manifestation), I suggest reinstalling the gcc to match
3757     your operating system release.
3758
3759 EOM
3760       ;;
3761    *) gccosandvers='' ;; # failed to parse, better be silent
3762    esac
3763    ;;
3764 esac
3765 case "$ccname" in
3766 '') ccname="$cc" ;;
3767 esac
3768
3769 # gcc 3.1 complains about adding -Idirectories that it already knows about,
3770 # so we will take those off from locincpth.
3771 case "$gccversion" in
3772 3*)
3773     echo "main(){}">try.c
3774     for incdir in `$cc -v -c try.c 2>&1 | \
3775        sed '1,/^#include <\.\.\.>/d;/^End of search list/,$d;s/^ //'` ; do
3776        locincpth=`echo $locincpth | sed s!$incdir!!`
3777     done
3778     $rm -f try try.*
3779 esac
3780
3781 : decide how portable to be.  Allow command line overrides.
3782 case "$d_portable" in
3783 "$undef") ;;
3784 *)      d_portable="$define" ;;
3785 esac
3786
3787 : set up shell script to do ~ expansion
3788 cat >filexp <<EOSS
3789 $startsh
3790 : expand filename
3791 case "\$1" in
3792  ~/*|~)
3793         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3794         ;;
3795  ~*)
3796         if $test -f /bin/csh; then
3797                 /bin/csh -f -c "glob \$1"
3798                 failed=\$?
3799                 echo ""
3800                 exit \$failed
3801         else
3802                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3803                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3804                 if $test ! -d "\$dir"; then
3805                         me=\`basename \$0\`
3806                         echo "\$me: can't locate home directory for: \$name" >&2
3807                         exit 1
3808                 fi
3809                 case "\$1" in
3810                 */*)
3811                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3812                         ;;
3813                 *)
3814                         echo \$dir
3815                         ;;
3816                 esac
3817         fi
3818         ;;
3819 *)
3820         echo \$1
3821         ;;
3822 esac
3823 EOSS
3824 chmod +x filexp
3825 $eunicefix filexp
3826
3827 : now set up to get a file name
3828 cat <<EOS >getfile
3829 $startsh
3830 EOS
3831 cat <<'EOSC' >>getfile
3832 tilde=''
3833 fullpath=''
3834 already=''
3835 skip=''
3836 none_ok=''
3837 exp_file=''
3838 nopath_ok=''
3839 orig_rp="$rp"
3840 orig_dflt="$dflt"
3841 case "$gfpth" in
3842 '') gfpth='.' ;;
3843 esac
3844
3845 case "$fn" in
3846 *\(*)
3847         : getfile will accept an answer from the comma-separated list
3848         : enclosed in parentheses even if it does not meet other criteria.
3849         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3850         fn=`echo $fn | sed 's/(.*)//'`
3851         ;;
3852 esac
3853
3854 case "$fn" in
3855 *:*)
3856         loc_file=`expr $fn : '.*:\(.*\)'`
3857         fn=`expr $fn : '\(.*\):.*'`
3858         ;;
3859 esac
3860
3861 case "$fn" in
3862 *~*) tilde=true;;
3863 esac
3864 case "$fn" in
3865 */*) fullpath=true;;
3866 esac
3867 case "$fn" in
3868 *+*) skip=true;;
3869 esac
3870 case "$fn" in
3871 *n*) none_ok=true;;
3872 esac
3873 case "$fn" in
3874 *e*) exp_file=true;;
3875 esac
3876 case "$fn" in
3877 *p*) nopath_ok=true;;
3878 esac
3879
3880 case "$fn" in
3881 *f*) type='File';;
3882 *d*) type='Directory';;
3883 *l*) type='Locate';;
3884 esac
3885
3886 what="$type"
3887 case "$what" in
3888 Locate) what='File';;
3889 esac
3890
3891 case "$exp_file" in
3892 '')
3893         case "$d_portable" in
3894         "$define") ;;
3895         *) exp_file=true;;
3896         esac
3897         ;;
3898 esac
3899
3900 cd ..
3901 while test "$type"; do
3902         redo=''
3903         rp="$orig_rp"
3904         dflt="$orig_dflt"
3905         case "$tilde" in
3906         true) rp="$rp (~name ok)";;
3907         esac
3908         . UU/myread
3909         if test -f UU/getfile.ok && \
3910                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3911         then
3912                 value="$ans"
3913                 ansexp="$ans"
3914                 break
3915         fi
3916         case "$ans" in
3917         none)
3918                 value=''
3919                 ansexp=''
3920                 case "$none_ok" in
3921                 true) type='';;
3922                 esac
3923                 ;;
3924         *)
3925                 case "$tilde" in
3926                 '') value="$ans"
3927                         ansexp="$ans";;
3928                 *)
3929                         value=`UU/filexp $ans`
3930                         case $? in
3931                         0)
3932                                 if test "$ans" != "$value"; then
3933                                         echo "(That expands to $value on this system.)"
3934                                 fi
3935                                 ;;
3936                         *) value="$ans";;
3937                         esac
3938                         ansexp="$value"
3939                         case "$exp_file" in
3940                         '') value="$ans";;
3941                         esac
3942                         ;;
3943                 esac
3944                 case "$fullpath" in
3945                 true)
3946                         case "$ansexp" in
3947                         /*) value="$ansexp" ;;
3948                         [a-zA-Z]:/*) value="$ansexp" ;;
3949                         *)
3950                                 redo=true
3951                                 case "$already" in
3952                                 true)
3953                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3954                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3955                                         ;;
3956                                 *)
3957                                 echo "Please give a full path name, starting with slash." >&4
3958                                         case "$tilde" in
3959                                         true)
3960                                 echo "Note that using ~name is ok provided it expands well." >&4
3961                                                 already=true
3962                                                 ;;
3963                                         esac
3964                                 esac
3965                                 ;;
3966                         esac
3967                         ;;
3968                 esac
3969                 case "$redo" in
3970                 '')
3971                         case "$type" in
3972                         File)
3973                                 for fp in $gfpth; do
3974                                         if test "X$fp" = X.; then
3975                                             pf="$ansexp"
3976                                         else    
3977                                             pf="$fp/$ansexp"
3978                                         fi
3979                                         if test -f "$pf"; then
3980                                                 type=''
3981                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3982                                         then
3983                                                 echo "($value is not a plain file, but that's ok.)"
3984                                                 type=''
3985                                         fi
3986                                         if test X"$type" = X; then
3987                                             value="$pf"
3988                                             break
3989                                         fi
3990                                 done
3991                                 ;;
3992                         Directory)
3993                                 for fp in $gfpth; do
3994                                         if test "X$fp" = X.; then
3995                                             dir="$ans"
3996                                             direxp="$ansexp"
3997                                         else    
3998                                             dir="$fp/$ansexp"
3999                                             direxp="$fp/$ansexp"
4000                                         fi
4001                                         if test -d "$direxp"; then
4002                                                 type=''
4003                                                 value="$dir"
4004                                                 break
4005                                         fi
4006                                 done
4007                                 ;;
4008                         Locate)
4009                                 if test -d "$ansexp"; then
4010                                         echo "(Looking for $loc_file in directory $value.)"
4011                                         value="$value/$loc_file"
4012                                         ansexp="$ansexp/$loc_file"
4013                                 fi
4014                                 if test -f "$ansexp"; then
4015                                         type=''
4016                                 fi
4017                                 case "$nopath_ok" in
4018                                 true)   case "$value" in
4019                                         */*) ;;
4020                                         *)      echo "Assuming $value will be in people's path."
4021                                                 type=''
4022                                                 ;;
4023                                         esac
4024                                         ;;
4025                                 esac
4026                                 ;;
4027                         esac
4028
4029                         case "$skip" in
4030                         true) type='';
4031                         esac
4032
4033                         case "$type" in
4034                         '') ;;
4035                         *)
4036                                 if test "$fastread" = yes; then
4037                                         dflt=y
4038                                 else
4039                                         dflt=n
4040                                 fi
4041                                 rp="$what $value doesn't exist.  Use that name anyway?"
4042                                 . UU/myread
4043                                 dflt=''
4044                                 case "$ans" in
4045                                 y*) type='';;
4046                                 *) echo " ";;
4047                                 esac
4048                                 ;;
4049                         esac
4050                         ;;
4051                 esac
4052                 ;;
4053         esac
4054 done
4055 cd UU
4056 ans="$value"
4057 rp="$orig_rp"
4058 dflt="$orig_dflt"
4059 rm -f getfile.ok
4060 test "X$gfpthkeep" != Xy && gfpth=""
4061 EOSC
4062
4063 : What should the include directory be ?
4064 echo " "
4065 $echo $n "Hmm...  $c"
4066 dflt='/usr/include'
4067 incpath=''
4068 mips_type=''
4069 if $test -f /bin/mips && /bin/mips; then
4070         echo "Looks like a MIPS system..."
4071         $cat >usr.c <<'EOCP'
4072 #ifdef SYSTYPE_BSD43
4073 /bsd43
4074 #endif
4075 EOCP
4076         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4077                 dflt='/bsd43/usr/include'
4078                 incpath='/bsd43'
4079                 mips_type='BSD 4.3'
4080         else
4081                 mips_type='System V'
4082         fi
4083         $rm -f usr.c usr.out
4084         echo "and you're compiling with the $mips_type compiler and libraries."
4085         xxx_prompt=y
4086         echo "exit 0" >mips
4087 else
4088         echo "Doesn't look like a MIPS system."
4089         xxx_prompt=n
4090         echo "exit 1" >mips
4091 fi
4092 chmod +x mips
4093 $eunicefix mips
4094 case "$usrinc" in
4095 '') ;;
4096 *) dflt="$usrinc";;
4097 esac
4098 case "$xxx_prompt" in
4099 y)      fn=d/
4100         echo " "
4101         rp='Where are the include files you want to use?'
4102         . ./getfile
4103         usrinc="$ans"
4104         ;;
4105 *)      usrinc="$dflt"
4106         ;;
4107 esac
4108
4109 : see how we invoke the C preprocessor
4110 echo " "
4111 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4112 cat <<'EOT' >testcpp.c
4113 #define ABC abc
4114 #define XYZ xyz
4115 ABC.XYZ
4116 EOT
4117 cd ..
4118 if test ! -f cppstdin; then
4119         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4120                 # AIX cc -E doesn't show the absolute headerfile
4121                 # locations but we'll cheat by using the -M flag.
4122                 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
4123         else
4124                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4125         fi
4126 else
4127         echo "Keeping your $hint cppstdin wrapper."
4128 fi
4129 chmod 755 cppstdin
4130 wrapper=`pwd`/cppstdin
4131 ok='false'
4132 cd UU
4133
4134 if $test "X$cppstdin" != "X" && \
4135         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4136         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4137 then
4138         echo "You used to use $cppstdin $cppminus so we'll use that again."
4139         case "$cpprun" in
4140         '') echo "But let's see if we can live without a wrapper..." ;;
4141         *)
4142                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4143                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4144                 then
4145                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4146                         ok='true'
4147                 else
4148                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4149                 fi
4150                 ;;
4151         esac
4152 else
4153         case "$cppstdin" in
4154         '') ;;
4155         *)
4156                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4157                 ;;
4158         esac
4159 fi
4160
4161 if $ok; then
4162         : nothing
4163 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4164         $cc -E <testcpp.c >testcpp.out 2>&1; \
4165         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4166         echo "Yup, it does."
4167         x_cpp="$cc -E"
4168         x_minus='';
4169 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4170         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4171         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4172         echo "Yup, it does."
4173         x_cpp="$cc -E"
4174         x_minus='-';
4175 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4176         $cc -P <testcpp.c >testcpp.out 2>&1; \
4177         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4178         echo "Yipee, that works!"
4179         x_cpp="$cc -P"
4180         x_minus='';
4181 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4182         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4183         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4184         echo "At long last!"
4185         x_cpp="$cc -P"
4186         x_minus='-';
4187 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4188         $cpp <testcpp.c >testcpp.out 2>&1; \
4189         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4190         echo "It works!"
4191         x_cpp="$cpp"
4192         x_minus='';
4193 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4194         $cpp - <testcpp.c >testcpp.out 2>&1; \
4195         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4196         echo "Hooray, it works!  I was beginning to wonder."
4197         x_cpp="$cpp"
4198         x_minus='-';
4199 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4200         $wrapper <testcpp.c >testcpp.out 2>&1; \
4201         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4202         x_cpp="$wrapper"
4203         x_minus=''
4204         echo "Eureka!"
4205 else
4206         dflt=''
4207         rp="No dice.  I can't find a C preprocessor.  Name one:"
4208         . ./myread
4209         x_cpp="$ans"
4210         x_minus=''
4211         $x_cpp <testcpp.c >testcpp.out 2>&1
4212         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4213                 echo "OK, that will do." >&4
4214         else
4215 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4216                 exit 1
4217         fi
4218 fi
4219
4220 case "$ok" in
4221 false)
4222         cppstdin="$x_cpp"
4223         cppminus="$x_minus"
4224         cpprun="$x_cpp"
4225         cpplast="$x_minus"
4226         set X $x_cpp
4227         shift
4228         case "$1" in
4229         "$cpp")
4230                 echo "Perhaps can we force $cc -E using a wrapper..."
4231                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4232                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4233                 then
4234                         echo "Yup, we can."
4235                         cppstdin="$wrapper"
4236                         cppminus='';
4237                 else
4238                         echo "Nope, we'll have to live without it..."
4239                 fi
4240                 ;;
4241         esac
4242         case "$cpprun" in
4243         "$wrapper")
4244                 cpprun=''
4245                 cpplast=''
4246                 ;;
4247         esac
4248         ;;
4249 esac
4250
4251 case "$cppstdin" in
4252 "$wrapper"|'cppstdin') ;;
4253 *) $rm -f $wrapper;;
4254 esac
4255 $rm -f testcpp.c testcpp.out
4256
4257 : Set private lib path
4258 case "$plibpth" in
4259 '') if ./mips; then
4260                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4261         fi;;
4262 esac
4263 case "$libpth" in
4264 ' ') dlist='';;
4265 '') dlist="$loclibpth $plibpth $glibpth";;
4266 *) dlist="$libpth";;
4267 esac
4268
4269 : Now check and see which directories actually exist, avoiding duplicates
4270 libpth=''
4271 for xxx in $dlist
4272 do
4273     if $test -d $xxx; then
4274                 case " $libpth " in
4275                 *" $xxx "*) ;;
4276                 *) libpth="$libpth $xxx";;
4277                 esac
4278     fi
4279 done
4280 $cat <<'EOM'
4281
4282 Some systems have incompatible or broken versions of libraries.  Among
4283 the directories listed in the question below, please remove any you
4284 know not to be holding relevant libraries, and add any that are needed.
4285 Say "none" for none.
4286
4287 EOM
4288 case "$libpth" in
4289 '') dflt='none';;
4290 *)
4291         set X $libpth
4292         shift
4293         dflt=${1+"$@"}
4294         ;;
4295 esac
4296 rp="Directories to use for library searches?"
4297 . ./myread
4298 case "$ans" in
4299 none) libpth=' ';;
4300 *) libpth="$ans";;
4301 esac
4302
4303 : compute shared library extension
4304 case "$so" in
4305 '')
4306         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4307                 dflt='sl'
4308         else
4309                 dflt='so'
4310         fi
4311         ;;
4312 *) dflt="$so";;
4313 esac
4314 $cat <<EOM
4315
4316 On some systems, shared libraries may be available.  Answer 'none' if
4317 you want to suppress searching of shared libraries for the remainder
4318 of this configuration.
4319
4320 EOM
4321 rp='What is the file extension used for shared libraries?'
4322 . ./myread
4323 so="$ans"
4324
4325 : Define several unixisms.
4326 : Hints files or command line option can be used to override them.
4327 : The convoluted testing is in case hints files set either the old
4328 : or the new name.
4329 case "$_exe" in
4330 '')     case "$exe_ext" in
4331         '')     ;;
4332         *)      _exe="$exe_ext" ;;
4333         esac
4334         ;;
4335 esac
4336 case "$_a" in
4337 '')     case "$lib_ext" in
4338     '') _a='.a';;
4339         *)      _a="$lib_ext" ;;
4340         esac
4341         ;;
4342 esac
4343 case "$_o" in
4344 '') case "$obj_ext" in
4345         '')     _o='.o';;
4346         *)      _o="$obj_ext";;
4347         esac
4348         ;;
4349 esac
4350 case "$p_" in
4351 '') case "$path_sep" in
4352         '')     p_=':';;
4353         *)      p_="$path_sep";;
4354         esac
4355         ;;
4356 esac
4357 exe_ext=$_exe
4358 lib_ext=$_a
4359 obj_ext=$_o
4360 path_sep=$p_
4361
4362 : Which makefile gets called first.  This is used by make depend.
4363 case "$firstmakefile" in
4364 '') firstmakefile='makefile';;
4365 esac
4366
4367 case "$usesocks" in
4368 $define|true|[yY]*)     dflt='y';;
4369 *) dflt='n';;
4370 esac
4371 cat <<EOM
4372
4373 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4374 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4375 to use the PerlIO abstraction layer, this will be implicitly selected.
4376
4377 If this doesn't make any sense to you, just accept the default '$dflt'.
4378 EOM
4379 rp='Build Perl for SOCKS?'
4380 . ./myread
4381 case "$ans" in
4382 y|Y)    val="$define" ;;     
4383 *)      val="$undef" ;;
4384 esac
4385 set usesocks
4386 eval $setvar
4387
4388 case "$usesocks" in
4389 $define|true|[yY]*) useperlio="$define";;
4390 esac
4391
4392 : Looking for optional libraries
4393 echo " "
4394 echo "Checking for optional libraries..." >&4
4395 case "$libs" in
4396 ' '|'') dflt='';;
4397 *) dflt="$libs";;
4398 esac
4399 case "$libswanted" in
4400 '') libswanted='c_s';;
4401 esac
4402 case "$usesocks" in
4403 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4404 esac
4405 libsfound=''
4406 libsfiles=''
4407 libsdirs=''
4408 libspath=''
4409 for thisdir in $libpth $xlibpth; do
4410   test -d $thisdir && libspath="$libspath $thisdir"
4411 done
4412 for thislib in $libswanted; do
4413         for thisdir in $libspath; do
4414             xxx=''
4415             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4416                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4417                 $test -f "$xxx" && eval $libscheck
4418                 $test -f "$xxx" && libstyle=shared
4419             fi
4420             if test ! -f "$xxx"; then
4421                 xxx=$thisdir/lib$thislib.$so
4422                 $test -f "$xxx" && eval $libscheck
4423                 $test -f "$xxx" && libstyle=shared
4424             fi  
4425             if test ! -f "$xxx"; then
4426                 xxx=$thisdir/lib$thislib$_a
4427                 $test -f "$xxx" && eval $libscheck
4428                 $test -f "$xxx" && libstyle=static
4429             fi
4430             if test ! -f "$xxx"; then
4431                 xxx=$thisdir/$thislib$_a
4432                 $test -f "$xxx" && eval $libscheck
4433                 $test -f "$xxx" && libstyle=static
4434             fi
4435             if test ! -f "$xxx"; then
4436                 xxx=$thisdir/lib${thislib}_s$_a
4437                 $test -f "$xxx" && eval $libscheck
4438                 $test -f "$xxx" && libstyle=static
4439                 $test -f "$xxx" && thislib=${thislib}_s
4440             fi
4441             if test ! -f "$xxx"; then
4442                 xxx=$thisdir/Slib$thislib$_a
4443                 $test -f "$xxx" && eval $libscheck
4444                 $test -f "$xxx" && libstyle=static
4445             fi
4446             if $test -f "$xxx"; then
4447                 case "$libstyle" in
4448                 shared) echo "Found -l$thislib (shared)." ;;
4449                 static) echo "Found -l$thislib." ;;
4450                 *)      echo "Found -l$thislib ($libstyle)." ;;
4451                 esac
4452                 case " $dflt " in
4453                 *"-l$thislib "*);;
4454                 *) dflt="$dflt -l$thislib"
4455                    libsfound="$libsfound $xxx"
4456                    yyy=`basename $xxx`
4457                    libsfiles="$libsfiles $yyy"
4458                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4459                    case " $libsdirs " in
4460                    *" $yyy "*) ;;
4461                    *) libsdirs="$libsdirs $yyy" ;;
4462                    esac
4463                    ;;
4464                 esac
4465                 break
4466             fi  
4467         done
4468         if $test ! -f "$xxx"; then
4469             echo "No -l$thislib."
4470         fi
4471 done
4472 set X $dflt
4473 shift
4474 dflt="$*"
4475 case "$libs" in
4476 '') dflt="$dflt";;
4477 *) dflt="$libs";;
4478 esac
4479 case "$dflt" in
4480 ' '|'') dflt='none';;
4481 esac
4482
4483 $cat <<EOM
4484
4485 In order to compile $package on your machine, a number of libraries
4486 are usually needed.  Include any other special libraries here as well.
4487 Say "none" for none.  The default list is almost always right.
4488 EOM
4489
4490 echo " "
4491 rp="What libraries to use?"
4492 . ./myread
4493 case "$ans" in
4494 none) libs=' ';;
4495 *) libs="$ans";;
4496 esac
4497
4498 : determine optimization, if desired, or use for debug flag also
4499 case "$optimize" in
4500 ' '|$undef) dflt='none';;
4501 '') dflt='-O';;
4502 *) dflt="$optimize";;
4503 esac
4504 $cat <<EOH
4505
4506 By default, $package compiles with the -O flag to use the optimizer.
4507 Alternately, you might want to use the symbolic debugger, which uses
4508 the -g flag (on traditional Unix systems).  Either flag can be
4509 specified here.  To use neither flag, specify the word "none".
4510
4511 EOH
4512 rp="What optimizer/debugger flag should be used?"
4513 . ./myread
4514 optimize="$ans"
4515 case "$optimize" in
4516 'none') optimize=" ";;
4517 esac
4518
4519 dflt=''
4520 : We will not override a previous value, but we might want to
4521 : augment a hint file
4522 case "$hint" in
4523 default|recommended)
4524         case "$gccversion" in
4525         1*) dflt='-fpcc-struct-return' ;;
4526         esac
4527         case "$optimize" in
4528         *-g*) dflt="$dflt -DDEBUGGING";;
4529         esac
4530         case "$gccversion" in
4531         2*) if test -d /etc/conf/kconfig.d &&
4532                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4533                 then
4534                         dflt="$dflt -posix"
4535                 fi
4536                 ;;
4537         esac
4538         case "$gccversion" in
4539         1*) ;;
4540         2.[0-8]*) ;;
4541         ?*)     echo " "
4542                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4543                 echo 'int main(void) { return 0; }' > gcctest.c
4544                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4545                         echo "Yes, it does." 2>&1
4546                         case "$ccflags" in
4547                         *strict-aliasing*) 
4548                                 echo "Leaving current flags $ccflags alone." 2>&1
4549                                 ;;
4550                         *) dflt="$dflt -fno-strict-aliasing" ;;
4551                         esac
4552                 else
4553                         echo "Nope, it doesn't, but that's ok." 2>&1
4554                 fi
4555                 ;;
4556         esac
4557         ;;
4558 esac
4559
4560 case "$mips_type" in
4561 *BSD*|'') inclwanted="$locincpth $usrinc";;
4562 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4563 esac
4564 for thisincl in $inclwanted; do
4565         if $test -d $thisincl; then
4566                 if $test x$thisincl != x$usrinc; then
4567                         case "$dflt" in
4568                         *" -I$thisincl "*);;
4569                         *) dflt="$dflt -I$thisincl ";;
4570                         esac
4571                 fi
4572         fi
4573 done
4574
4575 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4576         xxx=true;
4577 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4578         xxx=true;
4579 else
4580         xxx=false;
4581 fi;
4582 if $xxx; then
4583         case "$dflt" in
4584         *$2*);;
4585         *) dflt="$dflt -D$2";;
4586         esac;
4587 fi'
4588
4589 set signal.h LANGUAGE_C; eval $inctest
4590
4591 case "$usesocks" in
4592 $define)
4593         ccflags="$ccflags -DSOCKS"
4594         ;;
4595 esac
4596
4597 case "$hint" in
4598 default|recommended) dflt="$ccflags $dflt" ;;
4599 *) dflt="$ccflags";;
4600 esac
4601
4602 case "$dflt" in
4603 ''|' ') dflt=none;;
4604 esac
4605
4606 $cat <<EOH
4607
4608 Your C compiler may want other flags.  For this question you should include
4609 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4610 but you should NOT include libraries or ld flags like -lwhatever.  If you
4611 want $package to honor its debug switch, you should include -DDEBUGGING here.
4612 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4613
4614 To use no flags, specify the word "none".
4615
4616 EOH
4617 set X $dflt
4618 shift
4619 dflt=${1+"$@"}
4620 rp="Any additional cc flags?"
4621 . ./myread
4622 case "$ans" in
4623 none) ccflags='';;
4624 *) ccflags="$ans";;
4625 esac
4626
4627 : the following weeds options from ccflags that are of no interest to cpp
4628 case "$cppflags" in
4629 '') cppflags="$ccflags" ;;
4630 *)  cppflags="$cppflags $ccflags" ;;
4631 esac
4632 case "$gccversion" in
4633 1*) cppflags="$cppflags -D__GNUC__"
4634 esac
4635 case "$mips_type" in
4636 '');;
4637 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4638 esac
4639 case "$cppflags" in
4640 '');;
4641 *)
4642         echo " "
4643         echo "Let me guess what the preprocessor flags are..." >&4
4644         set X $cppflags
4645         shift
4646         cppflags=''
4647         $cat >cpp.c <<'EOM'
4648 #define BLURFL foo
4649
4650 BLURFL xx LFRULB
4651 EOM
4652         previous=''
4653         for flag in $*
4654         do
4655                 case "$flag" in
4656                 -*) ftry="$flag";;
4657                 *) ftry="$previous $flag";;
4658                 esac
4659                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4660                         >cpp1.out 2>/dev/null && \
4661                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4662                         >cpp2.out 2>/dev/null && \
4663                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4664                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4665                 then
4666                         cppflags="$cppflags $ftry"
4667                         previous=''
4668                 else
4669                         previous="$flag"
4670                 fi
4671         done
4672         set X $cppflags
4673         shift
4674         cppflags=${1+"$@"}
4675         case "$cppflags" in
4676         *-*)  echo "They appear to be: $cppflags";;
4677         esac
4678         $rm -f cpp.c cpp?.out
4679         ;;
4680 esac
4681
4682 : flags used in final linking phase
4683 case "$ldflags" in
4684 '') if ./venix; then
4685                 dflt='-i -z'
4686         else
4687                 dflt=''
4688         fi
4689         case "$ccflags" in
4690         *-posix*) dflt="$dflt -posix" ;;
4691         esac
4692         ;;
4693 *) dflt="$ldflags";;
4694 esac
4695
4696 : Try to guess additional flags to pick up local libraries.
4697 for thislibdir in $libpth; do
4698         case " $loclibpth " in
4699         *" $thislibdir "*)
4700                 case "$dflt " in 
4701                 *"-L$thislibdir "*) ;;
4702                 *)  dflt="$dflt -L$thislibdir" ;;
4703                 esac
4704                 ;;
4705         esac
4706 done
4707
4708 case "$dflt" in
4709 '') dflt='none' ;;
4710 esac
4711
4712 $cat <<EOH
4713
4714 Your C linker may need flags.  For this question you should
4715 include -L/whatever and any other flags used by the C linker, but you
4716 should NOT include libraries like -lwhatever.
4717
4718 Make sure you include the appropriate -L/path flags if your C linker
4719 does not normally search all of the directories you specified above,
4720 namely
4721         $libpth
4722 To use no flags, specify the word "none".
4723
4724 EOH
4725
4726 rp="Any additional ld flags (NOT including libraries)?"
4727 . ./myread
4728 case "$ans" in
4729 none) ldflags='';;
4730 *) ldflags="$ans";;
4731 esac
4732 rmlist="$rmlist pdp11"
4733
4734 : coherency check
4735 echo " "
4736 echo "Checking your choice of C compiler and flags for coherency..." >&4
4737 $cat > try.c <<'EOF'
4738 #include <stdio.h>
4739 int main() { printf("Ok\n"); exit(0); }
4740 EOF
4741 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4742 shift
4743 $cat >try.msg <<'EOM'
4744 I've tried to compile and run the following simple program:
4745
4746 EOM
4747 $cat try.c >> try.msg
4748
4749 $cat >> try.msg <<EOM
4750
4751 I used the command:
4752
4753         $*
4754         $run ./try
4755
4756 and I got the following output:
4757
4758 EOM
4759 dflt=y
4760 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4761         if $sh -c "$run ./try" >>try.msg 2>&1; then
4762                 xxx=`$run ./try`
4763                 case "$xxx" in
4764                 "Ok") dflt=n ;;
4765                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4766                         case " $libs " in
4767                         *" -lsfio "*)
4768                                 cat >> try.msg <<'EOQS'
4769 If $libs contains -lsfio, and sfio is mis-configured, then it
4770 sometimes (apparently) runs and exits with a 0 status, but with no
4771 output!  It may have to do with sfio's use of _exit vs. exit.
4772
4773 EOQS
4774                                 rp="You have a big problem.  Shall I abort Configure"
4775                                 dflt=y
4776                                 ;;
4777                         esac
4778                         ;;
4779                 esac
4780         else
4781                 echo "The program compiled OK, but exited with status $?." >>try.msg
4782                 rp="You have a problem.  Shall I abort Configure"
4783                 dflt=y
4784         fi
4785 else
4786         echo "I can't compile the test program." >>try.msg
4787         rp="You have a BIG problem.  Shall I abort Configure"
4788         dflt=y
4789 fi
4790 case "$dflt" in
4791 y)
4792         $cat try.msg >&4
4793         case "$knowitall" in
4794         '')
4795                 echo "(The supplied flags or libraries might be incorrect.)"
4796                 ;;
4797         *) dflt=n;;
4798         esac
4799         echo " "
4800         . ./myread
4801         case "$ans" in
4802         n*|N*) ;;
4803         *)      echo "Ok.  Stopping Configure." >&4
4804                 exit 1
4805                 ;;
4806         esac
4807         ;;
4808 n) echo "OK, that should do.";;
4809 esac
4810 $rm -f try try.* core
4811
4812 : define a shorthand compile call
4813 compile='
4814 mc_file=$1;
4815 shift;
4816 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4817 : define a shorthand compile call for compilations that should be ok.
4818 compile_ok='
4819 mc_file=$1;
4820 shift;
4821 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4822
4823 : check for lengths of integral types
4824 echo " "
4825 case "$intsize" in
4826 '')
4827         echo "Checking to see how big your integers are..." >&4
4828         $cat >try.c <<'EOCP'
4829 #include <stdio.h>
4830 int main()
4831 {
4832         printf("intsize=%d;\n", (int)sizeof(int));
4833         printf("longsize=%d;\n", (int)sizeof(long));
4834         printf("shortsize=%d;\n", (int)sizeof(short));
4835         exit(0);
4836 }
4837 EOCP
4838         set try
4839         if eval $compile_ok && $run ./try > /dev/null; then
4840                 eval `$run ./try`
4841                 echo "Your integers are $intsize bytes long."
4842                 echo "Your long integers are $longsize bytes long."
4843                 echo "Your short integers are $shortsize bytes long."
4844         else
4845                 $cat >&4 <<EOM
4846 !
4847 Help! I can't compile and run the intsize test program: please enlighten me!
4848 (This is probably a misconfiguration in your system or libraries, and
4849 you really ought to fix it.  Still, I'll try anyway.)
4850 !
4851 EOM
4852                 dflt=4
4853                 rp="What is the size of an integer (in bytes)?"
4854                 . ./myread
4855                 intsize="$ans"
4856                 dflt=$intsize
4857                 rp="What is the size of a long integer (in bytes)?"
4858                 . ./myread
4859                 longsize="$ans"
4860                 dflt=2
4861                 rp="What is the size of a short integer (in bytes)?"
4862                 . ./myread
4863                 shortsize="$ans"
4864         fi
4865         ;;
4866 esac
4867 $rm -f try try.*
4868
4869 : check for long long
4870 echo " "
4871 echo "Checking to see if you have long long..." >&4
4872 echo 'int main() { long long x = 7; return 0; }' > try.c
4873 set try
4874 if eval $compile; then
4875         val="$define"
4876         echo "You have long long."
4877 else
4878         val="$undef"
4879         echo "You do not have long long."
4880 fi
4881 $rm try.*
4882 set d_longlong
4883 eval $setvar
4884
4885 : check for length of long long
4886 case "${d_longlong}${longlongsize}" in
4887 $define)
4888         echo " "
4889         echo "Checking to see how big your long longs are..." >&4
4890         $cat >try.c <<'EOCP'
4891 #include <stdio.h>
4892 int main()
4893 {
4894     printf("%d\n", (int)sizeof(long long));
4895     return(0);
4896 }
4897 EOCP
4898         set try
4899         if eval $compile_ok; then
4900                 longlongsize=`$run ./try`
4901                 echo "Your long longs are $longlongsize bytes long."
4902         else
4903                 dflt='8'
4904                 echo " "
4905                 echo "(I can't seem to compile the test program.  Guessing...)"
4906                 rp="What is the size of a long long (in bytes)?"
4907                 . ./myread
4908                 longlongsize="$ans"
4909         fi
4910         if $test "X$longsize" = "X$longlongsize"; then
4911                 echo "(That isn't any different from an ordinary long.)"
4912         fi      
4913         ;;
4914 esac
4915 $rm -f try.* try
4916
4917 : determine filename position in cpp output
4918 echo " "
4919 echo "Computing filename position in cpp output for #include directives..." >&4
4920 case "$osname" in
4921 vos) testaccess=-e ;;
4922 *)   testaccess=-r ;;
4923 esac
4924 echo '#include <stdio.h>' > foo.c
4925 $cat >fieldn <<EOF
4926 $startsh
4927 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4928 $grep '^[       ]*#.*stdio\.h' | \
4929 while read cline; do
4930         pos=1
4931         set \$cline
4932         while $test \$# -gt 0; do
4933                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
4934                         echo "\$pos"
4935                         exit 0
4936                 fi
4937                 shift
4938                 pos=\`expr \$pos + 1\`
4939         done
4940 done
4941 EOF
4942 chmod +x fieldn
4943 fieldn=`./fieldn`
4944 $rm -f foo.c fieldn
4945 case $fieldn in
4946 '') pos='???';;
4947 1) pos=first;;
4948 2) pos=second;;
4949 3) pos=third;;
4950 *) pos="${fieldn}th";;
4951 esac
4952 echo "Your cpp writes the filename in the $pos field of the line."
4953
4954 case "$osname" in
4955 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4956 *)   cppfilter='' ;;
4957 esac
4958 : locate header file
4959 $cat >findhdr <<EOF
4960 $startsh
4961 wanted=\$1
4962 name=''
4963 for usrincdir in $usrinc
4964 do
4965         if test -f \$usrincdir/\$wanted; then
4966                 echo "\$usrincdir/\$wanted"
4967                 exit 0
4968         fi
4969 done
4970 awkprg='{ print \$$fieldn }'
4971 echo "#include <\$wanted>" > foo\$\$.c
4972 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4973 $cppfilter $grep "^[    ]*#.*\$wanted" | \
4974 while read cline; do
4975         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4976         case "\$name" in
4977         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4978         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4979         *) exit 2;;
4980         esac;
4981 done;
4982 #
4983 # status = 0: grep returned 0 lines, case statement not executed
4984 # status = 1: headerfile found
4985 # status = 2: while loop executed, no headerfile found
4986 #
4987 status=\$?
4988 $rm -f foo\$\$.c;
4989 if test \$status -eq 1; then
4990         exit 0;
4991 fi
4992 exit 1
4993 EOF
4994 chmod +x findhdr
4995
4996 : define an alternate in-header-list? function
4997 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4998 cont=true; xxf="echo \"<\$1> found.\" >&4";
4999 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5000 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5001 esac;
5002 case $# in 4) instead=instead;; *) instead="at last";; esac;
5003 while $test "$cont"; do
5004         xxx=`./findhdr $1`
5005         var=$2; eval "was=\$$2";
5006         if $test "$xxx" && $test -r "$xxx";
5007         then eval $xxf;
5008         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5009                 cont="";
5010         else eval $xxnf;
5011         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5012         set $yyy; shift; shift; yyy=$@;
5013         case $# in 0) cont="";;
5014         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5015                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5016         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5017                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5018         esac;
5019 done;
5020 while $test "$yyy";
5021 do set $yyy; var=$2; eval "was=\$$2";
5022         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5023         set $yyy; shift; shift; yyy=$@;
5024 done'
5025
5026 : see if inttypes.h is available
5027 : we want a real compile instead of Inhdr because some systems
5028 : have an inttypes.h which includes non-existent headers
5029 echo " "
5030 $cat >try.c <<EOCP
5031 #include <inttypes.h>
5032 int main() {
5033         static int32_t foo32 = 0x12345678;
5034 }
5035 EOCP
5036 set try
5037 if eval $compile; then
5038         echo "<inttypes.h> found." >&4
5039         val="$define"
5040 else
5041         echo "<inttypes.h> NOT found." >&4
5042         val="$undef"
5043 fi
5044 $rm -f try.c try
5045 set i_inttypes
5046 eval $setvar
5047
5048 : check for int64_t
5049 echo " "
5050 echo "Checking to see if you have int64_t..." >&4
5051 $cat >try.c <<EOCP
5052 #include <sys/types.h>
5053 #$i_inttypes I_INTTYPES
5054 #ifdef I_INTTYPES
5055 #include <inttypes.h>
5056 #endif
5057 int main() { int64_t x = 7; }
5058 EOCP
5059 set try
5060 if eval $compile; then
5061         val="$define"
5062         echo "You have int64_t."
5063 else
5064         val="$undef"
5065         echo "You do not have int64_t."
5066 fi
5067 $rm -f try try.*
5068 set d_int64_t
5069 eval $setvar
5070
5071
5072 echo " "
5073 echo "Checking which 64-bit integer type we could use..." >&4
5074
5075 case "$intsize" in
5076 8) val=int
5077    set quadtype
5078    eval $setvar
5079    val='"unsigned int"'
5080    set uquadtype
5081    eval $setvar
5082    quadkind=1
5083    ;;
5084 *) case "$longsize" in
5085    8) val=long
5086       set quadtype
5087       eval $setvar
5088       val='"unsigned long"'
5089       set uquadtype
5090       eval $setvar
5091       quadkind=2
5092       ;;
5093    *) case "$d_longlong:$longlongsize" in
5094       define:8)
5095         val='"long long"'
5096         set quadtype
5097         eval $setvar
5098         val='"unsigned long long"'
5099         set uquadtype
5100         eval $setvar
5101         quadkind=3
5102         ;;
5103       *) case "$d_int64_t" in
5104          define)
5105            val=int64_t
5106            set quadtype
5107            eval $setvar
5108            val=uint64_t
5109            set uquadtype
5110            eval $setvar
5111            quadkind=4
5112            ;;
5113          esac
5114          ;;
5115       esac
5116       ;;
5117    esac
5118    ;;
5119 esac
5120
5121 case "$quadtype" in
5122 '')     echo "Alas, no 64-bit integer types in sight." >&4
5123         d_quad="$undef"
5124         ;;
5125 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5126         d_quad="$define"
5127         ;;
5128 esac
5129
5130
5131 case "$uselonglong" in
5132 "$define"|true|[yY]*)
5133         cat <<EOM >&4
5134
5135 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5136 EOM
5137         use64bitint="$define"
5138         ;;
5139 esac                          
5140 case "$use64bits" in
5141 "$define"|true|[yY]*)
5142         cat <<EOM >&4
5143
5144 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5145 EOM
5146         use64bitint="$define"
5147         ;;
5148 esac                          
5149 case "$use64bitints" in
5150 "$define"|true|[yY]*)
5151         cat <<EOM >&4
5152
5153 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5154 EOM
5155         use64bitint="$define"
5156         ;;
5157 esac                          
5158 case "$use64bitsint" in
5159 "$define"|true|[yY]*)
5160         cat <<EOM >&4
5161
5162 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5163 EOM
5164         use64bitint="$define"
5165         ;;
5166 esac                          
5167 case "$uselonglongs" in
5168 "$define"|true|[yY]*)
5169         cat <<EOM >&4
5170
5171 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5172 EOM
5173         use64bitint="$define"
5174         ;;
5175 esac                          
5176 case "$use64bitsall" in
5177 "$define"|true|[yY]*)
5178         cat <<EOM >&4
5179
5180 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5181 EOM
5182         use64bitall="$define"
5183         ;;
5184 esac                          
5185
5186 case "$ccflags" in
5187 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5188 esac
5189 case "$use64bitall" in
5190 "$define"|true|[yY]*) use64bitint="$define" ;;
5191 esac
5192
5193 case "$longsize" in
5194 8) cat <<EOM
5195
5196 You have natively 64-bit long integers.
5197 EOM
5198    val="$define"
5199    ;;
5200 *) case "$use64bitint" in
5201    "$define"|true|[yY]*) dflt='y';;
5202    *) dflt='n';;
5203    esac
5204    case "$d_quad" in
5205    "$define") ;;
5206    *) dflt='n' ;;
5207    esac
5208    cat <<EOM
5209
5210 Perl can be built to take advantage of 64-bit integer types
5211 on some systems.  To do so, Configure can be run with -Duse64bitint.
5212 Choosing this option will most probably introduce binary incompatibilities.
5213
5214 If this doesn't make any sense to you, just accept the default '$dflt'.
5215 (The default has been chosen based on your configuration.)
5216 EOM
5217    rp='Try to use 64-bit integers, if available?'
5218    . ./myread
5219    case "$ans" in
5220    [yY]*) val="$define" ;;
5221    *)     val="$undef"  ;;
5222    esac
5223    ;;
5224 esac
5225 set use64bitint
5226 eval $setvar
5227
5228 case "$use64bitall" in
5229 "$define"|true|[yY]*) dflt='y' ;;
5230 *) case "$longsize" in
5231    8) dflt='y' ;;
5232    *) dflt='n' ;;
5233    esac
5234    ;;
5235 esac    
5236 cat <<EOM
5237
5238 You may also choose to try maximal 64-bitness.  It means using as much
5239 64-bitness as possible on the platform.  This in turn means even more
5240 binary incompatibilities.  On the other hand, your platform may not
5241 have any more 64-bitness available than what you already have chosen.
5242
5243 If this doesn't make any sense to you, just accept the default '$dflt'.
5244 (The default has been chosen based on your configuration.)
5245 EOM
5246 rp='Try to use maximal 64-bit support, if available?'
5247 . ./myread
5248 case "$ans" in
5249 [yY]*) val="$define" ;;
5250 *)     val="$undef"  ;;
5251 esac
5252 set use64bitall
5253 eval $setvar
5254 case "$use64bitall" in
5255 "$define")
5256         case "$use64bitint" in
5257         "$undef")
5258                 cat <<EOM
5259
5260 Since you have chosen a maximally 64-bit build, I'm also turning on
5261 the use of 64-bit integers.
5262 EOM
5263                 use64bitint="$define" ;;
5264         esac
5265         ;;
5266 esac
5267
5268 case "$use64bitint" in
5269 "$define"|true|[yY]*)
5270 : Look for a hint-file generated 'call-back-unit'.  If the
5271 : user has specified that a 64-bit perl is to be built,
5272 : we may need to set or change some other defaults.
5273         if $test -f use64bitint.cbu; then
5274                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5275                 . ./use64bitint.cbu
5276         fi
5277         case "$longsize" in
5278         4) case "$archname64" in
5279            '') archname64=64int ;;
5280            esac
5281            ;;
5282         esac
5283         ;;
5284 esac
5285
5286 case "$use64bitall" in
5287 "$define"|true|[yY]*)
5288 : Look for a hint-file generated 'call-back-unit'.  If the
5289 : user has specified that a maximally 64-bit perl is to be built,
5290 : we may need to set or change some other defaults.
5291         if $test -f use64bitall.cbu; then
5292                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5293                 . ./use64bitall.cbu
5294         fi
5295         case "$longsize" in
5296         4) case "$archname64" in
5297            ''|64int) archname64=64all ;;
5298            esac
5299            ;;
5300         esac
5301         ;;
5302 esac
5303
5304 echo " "
5305 echo "Checking for GNU C Library..." >&4
5306 cat >try.c <<EOM
5307 #include <stdio.h>
5308 int main()
5309 {
5310 #ifdef __GLIBC__
5311     exit(0);
5312 #else
5313     exit(1);
5314 #endif
5315 }
5316 EOM
5317 set try
5318 if eval $compile_ok && $run ./try; then
5319         val="$define"
5320         echo "You are using the GNU C Library"
5321 else
5322         val="$undef"
5323         echo "You are not using the GNU C Library"
5324 fi
5325 $rm -f try try.*
5326 set d_gnulibc
5327 eval $setvar
5328
5329 : see if nm is to be used to determine whether a symbol is defined or not
5330 case "$usenm" in
5331 '')
5332         dflt=''
5333         case "$d_gnulibc" in
5334         "$define")
5335                 echo " "
5336                 echo "nm probably won't work on the GNU C Library." >&4
5337                 dflt=n
5338                 ;;
5339         esac
5340         case "$dflt" in
5341         '') 
5342                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5343                         echo " "
5344                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5345                         echo "'nm' won't be sufficient on this sytem." >&4
5346                         dflt=n
5347                 fi
5348                 ;;
5349         esac
5350         case "$dflt" in
5351         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5352                 if $test $dflt -gt 20; then
5353                         dflt=y
5354                 else
5355                         dflt=n
5356                 fi
5357                 ;;
5358         esac
5359         ;;
5360 *)
5361         case "$usenm" in
5362         true|$define) dflt=y;;
5363         *) dflt=n;;
5364         esac
5365         ;;
5366 esac
5367 $cat <<EOM
5368
5369 I can use $nm to extract the symbols from your C libraries. This
5370 is a time consuming task which may generate huge output on the disk (up
5371 to 3 megabytes) but that should make the symbols extraction faster. The
5372 alternative is to skip the 'nm' extraction part and to compile a small
5373 test program instead to determine whether each symbol is present. If
5374 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5375 this may be the best solution.
5376
5377 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5378
5379 EOM
5380 rp="Shall I use $nm to extract C symbols from the libraries?"
5381 . ./myread
5382 case "$ans" in
5383 [Nn]*) usenm=false;;
5384 *) usenm=true;;
5385 esac
5386
5387 runnm=$usenm
5388 case "$reuseval" in
5389 true) runnm=false;;
5390 esac
5391
5392 : nm options which may be necessary
5393 case "$nm_opt" in
5394 '') if $test -f /mach_boot; then
5395                 nm_opt=''       # Mach
5396         elif $test -d /usr/ccs/lib; then
5397                 nm_opt='-p'     # Solaris (and SunOS?)
5398         elif $test -f /dgux; then
5399                 nm_opt='-p'     # DG-UX
5400         elif $test -f /lib64/rld; then
5401                 nm_opt='-p'     # 64-bit Irix
5402         else
5403                 nm_opt=''
5404         fi;;
5405 esac
5406
5407 : nm options which may be necessary for shared libraries but illegal
5408 : for archive libraries.  Thank you, Linux.
5409 case "$nm_so_opt" in
5410 '')     case "$myuname" in
5411         *linux*)
5412                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5413                         nm_so_opt='--dynamic'
5414                 fi
5415                 ;;
5416         esac
5417         ;;
5418 esac
5419
5420 case "$runnm" in
5421 true)
5422 : get list of predefined functions in a handy place
5423 echo " "
5424 case "$libc" in
5425 '') libc=unknown
5426         case "$libs" in
5427         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5428         esac
5429         ;;
5430 esac
5431 case "$libs" in
5432 '') ;;
5433 *)  for thislib in $libs; do
5434         case "$thislib" in
5435         -lc|-lc_s)
5436                 : Handle C library specially below.
5437                 ;;
5438         -l*)
5439                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5440                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5441                         :
5442                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5443                         :
5444                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5445                         :
5446                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5447                         :
5448                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5449                         :
5450                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5451                         :
5452                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5453                         :
5454                 else
5455                         try=''
5456                 fi
5457                 libnames="$libnames $try"
5458                 ;;
5459         *) libnames="$libnames $thislib" ;;
5460         esac
5461         done
5462         ;;
5463 esac
5464 xxx=normal
5465 case "$libc" in
5466 unknown)
5467         set /lib/libc.$so
5468         for xxx in $libpth; do
5469                 $test -r $1 || set $xxx/libc.$so
5470                 : The messy sed command sorts on library version numbers.
5471                 $test -r $1 || \
5472                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5473                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5474                                 h
5475                                 s/[0-9][0-9]*/0000&/g
5476                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5477                                 G
5478                                 s/\n/ /' | \
5479                          $sort | $sed -e 's/^.* //'`
5480                 eval set \$$#
5481         done
5482         $test -r $1 || set /usr/ccs/lib/libc.$so
5483         $test -r $1 || set /lib/libsys_s$_a
5484         ;;
5485 *)
5486         set blurfl
5487         ;;
5488 esac
5489 if $test -r "$1"; then
5490         echo "Your (shared) C library seems to be in $1."
5491         libc="$1"
5492 elif $test -r /lib/libc && $test -r /lib/clib; then
5493         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5494         xxx=apollo
5495         libc='/lib/clib /lib/libc'
5496         if $test -r /lib/syslib; then
5497                 echo "(Your math library is in /lib/syslib.)"
5498                 libc="$libc /lib/syslib"
5499         fi
5500 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5501         echo "Your C library seems to be in $libc, as you said before."
5502 elif $test -r $incpath/usr/lib/libc$_a; then
5503         libc=$incpath/usr/lib/libc$_a;
5504         echo "Your C library seems to be in $libc.  That's fine."
5505 elif $test -r /lib/libc$_a; then
5506         libc=/lib/libc$_a;
5507         echo "Your C library seems to be in $libc.  You're normal."
5508 else
5509         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5510                 :
5511         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5512                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5513         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5514                 :
5515         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5516                 :
5517         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5518                 :
5519         else
5520                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5521         fi
5522         if $test -r "$tans"; then
5523                 echo "Your C library seems to be in $tans, of all places."
5524                 libc=$tans
5525         else
5526                 libc='blurfl'
5527         fi
5528 fi
5529 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5530         dflt="$libc"
5531         cat <<EOM
5532
5533 If the guess above is wrong (which it might be if you're using a strange
5534 compiler, or your machine supports multiple models), you can override it here.
5535
5536 EOM
5537 else
5538         dflt=''
5539         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5540         cat >&4 <<EOM
5541 I can't seem to find your C library.  I've looked in the following places:
5542
5543 EOM
5544         $sed 's/^/      /' libpath
5545         cat <<EOM
5546
5547 None of these seems to contain your C library. I need to get its name...
5548
5549 EOM
5550 fi
5551 fn=f
5552 rp='Where is your C library?'
5553 . ./getfile
5554 libc="$ans"
5555
5556 echo " "
5557 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5558 set X `cat libnames`
5559 shift
5560 xxx=files
5561 case $# in 1) xxx=file; esac
5562 echo "Extracting names from the following $xxx for later perusal:" >&4
5563 echo " "
5564 $sed 's/^/      /' libnames >&4
5565 echo " "
5566 $echo $n "This may take a while...$c" >&4
5567
5568 for file in $*; do
5569         case $file in
5570         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5571         *) $nm $nm_opt $file 2>/dev/null;;
5572         esac
5573 done >libc.tmp
5574
5575 $echo $n ".$c"
5576 $grep fprintf libc.tmp > libc.ptf
5577 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5578 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
5579 xxx='[ADTSIW]'
5580 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5581         eval $xscan;\
5582         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5583                 eval $xrun
5584 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5585         eval $xscan;\
5586         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5587                 eval $xrun
5588 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5589         eval $xscan;\
5590         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5591                 eval $xrun
5592 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5593         eval $xscan;\
5594         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5595                 eval $xrun
5596 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5597         eval $xscan;\
5598         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5599                 eval $xrun
5600 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5601         eval $xscan;\
5602         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5603                 eval $xrun
5604 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5605                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5606         eval $xscan;\
5607         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5608                 eval $xrun
5609 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5610         eval $xscan;\
5611         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5612                 eval $xrun
5613 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5614         eval $xscan;\
5615         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5616                 eval $xrun
5617 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5618         eval $xscan;\
5619         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5620                 eval $xrun
5621 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5622         eval $xscan;\
5623         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5624                 eval $xrun
5625 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5626         eval $xscan;\
5627         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5628                 eval $xrun
5629 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5630         eval $xscan;\
5631         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5632                 eval $xrun
5633 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5634         eval $xscan;\
5635         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5636                 eval $xrun
5637 else
5638         $nm -p $* 2>/dev/null >libc.tmp
5639         $grep fprintf libc.tmp > libc.ptf
5640         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5641                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5642         then
5643                 nm_opt='-p'
5644                 eval $xrun
5645         else
5646                 echo " "
5647                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5648                 com=''
5649                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5650                         for thisname in $libnames $libc; do
5651                                 $ar t $thisname >>libc.tmp
5652                         done
5653                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5654                         echo "Ok." >&4
5655                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5656                         # Repeat libc to extract forwarders to DLL entries too
5657                         for thisname in $libnames $libc; do
5658                                 $ar tv $thisname >>libc.tmp
5659                                 # Revision 50 of EMX has bug in $ar.
5660                                 # it will not extract forwarders to DLL entries
5661                                 # Use emximp which will extract exactly them.
5662                                 emximp -o tmp.imp $thisname \
5663                                     2>/dev/null && \
5664                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5665                                     < tmp.imp >>libc.tmp
5666                                 $rm tmp.imp
5667                         done
5668                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5669                         echo "Ok." >&4
5670                 else
5671                         echo "$ar didn't seem to work right." >&4
5672                         echo "Maybe this is a Cray...trying bld instead..." >&4
5673                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5674                         then
5675                                 for thisname in $libnames; do
5676                                         bld t $libnames | \
5677                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5678                                         $ar t $thisname >>libc.tmp
5679                                 done
5680                                 echo "Ok." >&4
5681                         else
5682                                 echo "That didn't work either.  Giving up." >&4
5683                                 exit 1
5684                         fi
5685                 fi
5686         fi
5687 fi
5688 nm_extract="$com"
5689 if $test -f /lib/syscalls.exp; then
5690         echo " "
5691         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5692         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
5693 fi
5694 ;;
5695 esac
5696 $rm -f libnames libpath
5697
5698 : is a C symbol defined?
5699 csym='tlook=$1;
5700 case "$3" in
5701 -v) tf=libc.tmp; tc=""; tdc="";;
5702 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5703 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5704 esac;
5705 tx=yes;
5706 case "$reuseval-$4" in
5707 true-) ;;
5708 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5709 esac;
5710 case "$tx" in
5711 yes)
5712         case "$runnm" in
5713         true)
5714                 if $contains $tlook $tf >/dev/null 2>&1;
5715                 then tval=true;
5716                 else tval=false;
5717                 fi;;
5718         *)
5719                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5720                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5721                 then tval=true;
5722                 else tval=false;
5723                 fi;
5724                 $rm -f t t.c;;
5725         esac;;
5726 *)
5727         case "$tval" in
5728         $define) tval=true;;
5729         *) tval=false;;
5730         esac;;
5731 esac;
5732 eval "$2=$tval"'
5733
5734 : define an is-in-libc? function
5735 inlibc='echo " "; td=$define; tu=$undef;
5736 sym=$1; var=$2; eval "was=\$$2";
5737 tx=yes;
5738 case "$reuseval$was" in
5739 true) ;;
5740 true*) tx=no;;
5741 esac;
5742 case "$tx" in
5743 yes)
5744         set $sym tres -f;
5745         eval $csym;
5746         case "$tres" in
5747         true)
5748                 echo "$sym() found." >&4;
5749                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5750         *)
5751                 echo "$sym() NOT found." >&4;
5752                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5753         esac;;
5754 *)
5755         case "$was" in
5756         $define) echo "$sym() found." >&4;;
5757         *) echo "$sym() NOT found." >&4;;
5758         esac;;
5759 esac'
5760
5761 : see if sqrtl exists
5762 set sqrtl d_sqrtl
5763 eval $inlibc
5764
5765 : check for length of double
5766 echo " "
5767 case "$doublesize" in
5768 '')
5769         echo "Checking to see how big your double precision numbers are..." >&4
5770         $cat >try.c <<'EOCP'
5771 #include <stdio.h>
5772 int main()
5773 {
5774     printf("%d\n", (int)sizeof(double));
5775     exit(0);
5776 }
5777 EOCP
5778         set try
5779         if eval $compile_ok; then
5780                 doublesize=`$run ./try`
5781                 echo "Your double is $doublesize bytes long."
5782         else
5783                 dflt='8'
5784                 echo "(I can't seem to compile the test program.  Guessing...)"
5785                 rp="What is the size of a double precision number (in bytes)?"
5786                 . ./myread
5787                 doublesize="$ans"
5788         fi
5789         ;;
5790 esac
5791 $rm -f try.c try
5792
5793 : check for long doubles
5794 echo " "
5795 echo "Checking to see if you have long double..." >&4
5796 echo 'int main() { long double x = 7.0; }' > try.c
5797 set try
5798 if eval $compile; then
5799         val="$define"
5800         echo "You have long double."
5801 else
5802         val="$undef"
5803         echo "You do not have long double."
5804 fi
5805 $rm try.*
5806 set d_longdbl
5807 eval $setvar
5808
5809 : check for length of long double
5810 case "${d_longdbl}${longdblsize}" in
5811 $define)
5812         echo " "
5813         echo "Checking to see how big your long doubles are..." >&4
5814         $cat >try.c <<'EOCP'
5815 #include <stdio.h>
5816 int main()
5817 {
5818         printf("%d\n", sizeof(long double));
5819 }
5820 EOCP
5821         set try
5822         set try
5823         if eval $compile; then
5824                 longdblsize=`$run ./try`
5825                 echo "Your long doubles are $longdblsize bytes long."
5826         else
5827                 dflt='8'
5828                 echo " "
5829                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5830                 rp="What is the size of a long double (in bytes)?"
5831                 . ./myread
5832                 longdblsize="$ans"
5833         fi
5834         if $test "X$doublesize" = "X$longdblsize"; then
5835                 echo "(That isn't any different from an ordinary double.)"
5836         fi      
5837         ;;
5838 esac
5839 $rm -f try.* try
5840
5841 echo " "
5842
5843 if $test X"$d_longdbl" = X"$define"; then
5844
5845 echo "Checking how to print long doubles..." >&4
5846
5847 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
5848         $cat >try.c <<'EOCP'
5849 #include <sys/types.h>
5850 #include <stdio.h>
5851 int main() {
5852   double d = 123.456;
5853   printf("%.3f\n", d);
5854 }
5855 EOCP
5856         set try
5857         if eval $compile; then
5858                 yyy=`$run ./try`
5859                 case "$yyy" in
5860                 123.456)
5861                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
5862                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
5863                         echo "We will use %f."
5864                         ;;
5865                 esac
5866         fi
5867 fi
5868
5869 if $test X"$sPRIfldbl" = X; then
5870         $cat >try.c <<'EOCP'
5871 #include <sys/types.h>
5872 #include <stdio.h>
5873 int main() {
5874   long double d = 123.456;
5875   printf("%.3Lf\n", d);
5876 }
5877 EOCP
5878         set try
5879         if eval $compile; then
5880                 yyy=`$run ./try`
5881                 case "$yyy" in
5882                 123.456)
5883                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
5884                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
5885                         echo "We will use %Lf."
5886                         ;;
5887                 esac
5888         fi
5889 fi
5890
5891 if $test X"$sPRIfldbl" = X; then
5892         $cat >try.c <<'EOCP'
5893 #include <sys/types.h>
5894 #include <stdio.h>
5895 int main() {
5896   long double d = 123.456;
5897   printf("%.3llf\n", d);
5898 }
5899 EOCP
5900         set try
5901         if eval $compile; then
5902                 yyy=`$run ./try`
5903                 case "$yyy" in
5904                 123.456)
5905                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
5906                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
5907                         echo "We will use %llf."
5908                         ;;
5909                 esac
5910         fi
5911 fi
5912
5913 if $test X"$sPRIfldbl" = X; then
5914         $cat >try.c <<'EOCP'
5915 #include <sys/types.h>
5916 #include <stdio.h>
5917 int main() {
5918   long double d = 123.456;
5919   printf("%.3lf\n", d);
5920 }
5921 EOCP
5922         set try
5923         if eval $compile; then
5924                 yyy=`$run ./try`
5925                 case "$yyy" in
5926                 123.456)
5927                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
5928                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
5929                         echo "We will use %lf."
5930                         ;;
5931                 esac
5932         fi
5933 fi
5934
5935 if $test X"$sPRIfldbl" = X; then
5936         echo "Cannot figure out how to print long doubles." >&4
5937 else
5938         sSCNfldbl=$sPRIfldbl    # expect consistency
5939 fi
5940
5941 $rm -f try try.*
5942
5943 fi # d_longdbl
5944
5945 case "$sPRIfldbl" in
5946 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
5947         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
5948         d_SCNfldbl="$undef";
5949         ;;
5950 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
5951         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
5952         d_SCNfldbl="$define";
5953         ;;
5954 esac
5955
5956 : see if modfl exists
5957 set modfl d_modfl
5958 eval $inlibc
5959
5960 d_modfl_pow32_bug="$undef"
5961
5962 case "$d_longdbl$d_modfl" in
5963 $define$define)
5964         $cat <<EOM
5965 Checking to see whether your modfl() is okay for large values...
5966 EOM
5967 $cat >try.c <<EOCP
5968 #include <math.h> 
5969 #include <stdio.h>
5970 int main() {
5971     long double nv = 4294967303.15;
5972     long double v, w;
5973     v = modfl(nv, &w);         
5974 #ifdef __GLIBC__
5975     printf("glibc");
5976 #endif
5977     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
5978     return 0;
5979 }
5980 EOCP
5981         case "$osname:$gccversion" in
5982         aix:)   saveccflags="$ccflags"
5983                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
5984         esac
5985         set try
5986         if eval $compile; then
5987                 foo=`$run ./try`
5988                 case "$foo" in
5989                 *" 4294967303.150000 1.150000 4294967302.000000")
5990                         echo >&4 "Your modfl() is broken for large values."
5991                         d_modfl_pow32_bug="$define"
5992                         case "$foo" in
5993                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
5994                         ;;
5995                         esac
5996                         ;;
5997                 *" 4294967303.150000 0.150000 4294967303.000000")
5998                         echo >&4 "Your modfl() seems okay for large values."
5999                         ;;
6000                 *)      echo >&4 "I don't understand your modfl() at all."
6001                         d_modfl="$undef"
6002                         ;;
6003                 esac
6004                 $rm -f try.* try core core.try.*
6005         else
6006                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
6007                 d_modfl="$undef"
6008         fi
6009         case "$osname:$gccversion" in
6010         aix:)   ccflags="$saveccflags" ;; # restore
6011         esac
6012         ;;
6013 esac
6014
6015 case "$ccflags" in
6016 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6017 esac
6018
6019 case "$uselongdouble" in
6020 $define|true|[yY]*)     dflt='y';;
6021 *) dflt='n';;
6022 esac
6023 cat <<EOM
6024
6025 Perl can be built to take advantage of long doubles which
6026 (if available) may give more accuracy and range for floating point numbers.
6027
6028 If this doesn't make any sense to you, just accept the default '$dflt'.
6029 EOM
6030 rp='Try to use long doubles if available?'
6031 . ./myread
6032 case "$ans" in
6033 y|Y)    val="$define"   ;;
6034 *)      val="$undef"    ;;
6035 esac
6036 set uselongdouble
6037 eval $setvar
6038
6039 case "$uselongdouble" in
6040 true|[yY]*) uselongdouble="$define" ;;
6041 esac
6042
6043 case "$uselongdouble" in
6044 $define)
6045 : Look for a hint-file generated 'call-back-unit'.  If the
6046 : user has specified that long doubles should be used,
6047 : we may need to set or change some other defaults.
6048         if $test -f uselongdouble.cbu; then
6049                 echo "Your platform has some specific hints for long doubles, using them..."
6050                 . ./uselongdouble.cbu
6051         else
6052                 $cat <<EOM
6053 (Your platform doesn't have any specific hints for long doubles.)
6054 EOM
6055         fi
6056         ;;
6057 esac
6058
6059 message=X
6060 case "$uselongdouble:$d_sqrtl:$d_modfl" in
6061 $define:$define:$define)
6062         : You have both
6063         ;;
6064 $define:$define:$undef)
6065         message="I could not find modfl"
6066         ;;
6067 $define:$undef:$define)
6068         message="I could not find sqrtl"
6069         ;;
6070 $define:$undef:$undef)
6071         message="I found neither sqrtl nor modfl"
6072         ;;
6073 esac
6074
6075 if $test "$message" != X; then
6076         $cat <<EOM >&4
6077
6078 *** You requested the use of long doubles but you do not seem to have
6079 *** the mathematic functions for long doubles.
6080 *** ($message)
6081 *** I'm disabling the use of long doubles.
6082
6083 EOM
6084
6085         uselongdouble=$undef
6086 fi
6087
6088 case "$useperlio" in
6089 $define|true|[yY]*|'')  dflt='y';;
6090 *) dflt='n';;
6091 esac
6092 cat <<EOM
6093
6094 Previous version of $package used the standard IO mechanisms as
6095 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
6096 alternate IO mechanisms via the PerlIO abstraction layer, but the
6097 stdio mechanism is still available if needed.  The abstraction layer
6098 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
6099 Using PerlIO with sfio may cause problems with some extension modules.
6100
6101 If this doesn't make any sense to you, just accept the default '$dflt'.
6102 EOM
6103 rp='Use the PerlIO abstraction layer?'
6104 . ./myread
6105 case "$ans" in
6106 y|Y) 
6107         val="$define"
6108         ;;
6109 *)      
6110         echo "Ok, doing things the stdio way."
6111         val="$undef"
6112         ;;
6113 esac
6114 set useperlio
6115 eval $setvar 
6116
6117 case "$usesocks" in
6118 $define|true|[yY]*)
6119         case "$useperlio" in
6120         $define|true|[yY]*) ;;
6121         *)      cat >&4 <<EOM
6122
6123 You are using the SOCKS proxy protocol library which means that you
6124 should also use the PerlIO layer.  You may be headed for trouble.
6125
6126 EOM
6127                 ;;
6128         esac
6129         ;;
6130 esac
6131
6132         
6133 : determine the architecture name
6134 echo " "
6135 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6136         tarch=`arch`"-$osname"
6137 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6138         if uname -m > tmparch 2>&1 ; then
6139                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6140                         -e 's/$/'"-$osname/" tmparch`
6141         else
6142                 tarch="$osname"
6143         fi
6144         $rm -f tmparch
6145 else
6146         tarch="$osname"
6147 fi
6148 case "$myarchname" in
6149 ''|"$tarch") ;;
6150 *)
6151         echo "(Your architecture name used to be $myarchname.)"
6152         archname=''
6153         ;;
6154 esac
6155 case "$targetarch" in
6156 '') ;;
6157 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6158 esac
6159 myarchname="$tarch"
6160 case "$archname" in
6161 '') dflt="$tarch";;
6162 *) dflt="$archname";;
6163 esac
6164 rp='What is your architecture name'
6165 . ./myread
6166 archname="$ans"
6167 case "$usethreads" in
6168 $define)
6169         echo "Threads selected." >&4
6170         case "$archname" in
6171         *-thread*) echo "...and architecture name already has -thread." >&4
6172                 ;;
6173         *)      archname="$archname-thread"
6174                 echo "...setting architecture name to $archname." >&4
6175                 ;;
6176         esac
6177         ;;
6178 esac
6179 case "$usemultiplicity" in
6180 $define)
6181         echo "Multiplicity selected." >&4
6182         case "$archname" in
6183         *-multi*) echo "...and architecture name already has -multi." >&4
6184                 ;;
6185         *)      archname="$archname-multi"
6186                 echo "...setting architecture name to $archname." >&4
6187                 ;;
6188         esac
6189         ;;
6190 esac
6191 case "$use64bitint$use64bitall" in
6192 *"$define"*)
6193         case "$archname64" in
6194         '')
6195                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6196                 ;;
6197         *)
6198                 case "$use64bitint" in
6199                 "$define") echo "64 bit integers selected." >&4 ;;
6200                 esac
6201                 case "$use64bitall" in
6202                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6203                 esac
6204                 case "$archname" in
6205                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6206                         ;;
6207                 *)      archname="$archname-$archname64"
6208                         echo "...setting architecture name to $archname." >&4
6209                         ;;
6210                 esac
6211                 ;;
6212         esac
6213 esac
6214 case "$uselongdouble" in
6215 $define)
6216         echo "Long doubles selected." >&4
6217         case "$longdblsize" in
6218         $doublesize)
6219                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6220                 ;;
6221         *)
6222                 case "$archname" in
6223                 *-ld*) echo "...and architecture name already has -ld." >&4
6224                         ;;
6225                 *)      archname="$archname-ld"
6226                         echo "...setting architecture name to $archname." >&4
6227                         ;;
6228                 esac
6229                 ;;
6230         esac
6231         ;;
6232 esac
6233 case "$useperlio" in
6234 $define)
6235         echo "Perlio selected." >&4
6236         ;;
6237 *)
6238         echo "Perlio not selected, using stdio." >&4
6239         case "$archname" in
6240         *-stdio*) echo "...and architecture name already has -stdio." >&4
6241                 ;;
6242         *)      archname="$archname-stdio"
6243                 echo "...setting architecture name to $archname." >&4
6244                 ;;
6245         esac
6246         ;;
6247 esac
6248
6249 : determine root of directory hierarchy where package will be installed.
6250 case "$prefix" in
6251 '')
6252         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
6253         ;;
6254 *)
6255         dflt="$prefix"
6256         ;;
6257 esac
6258 $cat <<EOM
6259
6260 By default, $package will be installed in $dflt/bin, manual pages
6261 under $dflt/man, etc..., i.e. with $dflt as prefix for all
6262 installation directories. Typically this is something like /usr/local.
6263 If you wish to have binaries under /usr/bin but other parts of the
6264 installation under /usr/local, that's ok: you will be prompted
6265 separately for each of the installation directories, the prefix being
6266 only used to set the defaults.
6267
6268 EOM
6269 fn=d~
6270 rp='Installation prefix to use?'
6271 . ./getfile
6272 oldprefix=''
6273 case "$prefix" in
6274 '') ;;
6275 *)
6276         case "$ans" in
6277         "$prefix") ;;
6278         *) oldprefix="$prefix";;
6279         esac
6280         ;;
6281 esac
6282 prefix="$ans"
6283 prefixexp="$ansexp"
6284
6285 case "$afsroot" in
6286 '')     afsroot=/afs ;;
6287 *)      afsroot=$afsroot ;;
6288 esac
6289
6290 : is AFS running?
6291 echo " "
6292 case "$afs" in
6293 $define|true)   afs=true ;;
6294 $undef|false)   afs=false ;;
6295 *)      if test -d $afsroot; then
6296                 afs=true
6297         else
6298                 afs=false
6299         fi
6300         ;;
6301 esac
6302 if $afs; then
6303         echo "AFS may be running... I'll be extra cautious then..." >&4
6304 else
6305         echo "AFS does not seem to be running..." >&4
6306 fi
6307
6308 : determine installation prefix for where package is to be installed.
6309 if $afs; then 
6310 $cat <<EOM
6311
6312 Since you are running AFS, I need to distinguish the directory in which
6313 files will reside from the directory in which they are installed (and from
6314 which they are presumably copied to the former directory by occult means).
6315
6316 EOM
6317         case "$installprefix" in
6318         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6319         *) dflt="$installprefix";;
6320         esac
6321 else
6322 $cat <<EOM
6323
6324 In some special cases, particularly when building $package for distribution,
6325 it is convenient to distinguish between the directory in which files should 
6326 be installed from the directory ($prefix) in which they 
6327 will eventually reside.  For most users, these two directories are the same.
6328
6329 EOM
6330         case "$installprefix" in
6331         '') dflt=$prefix ;;
6332         *) dflt=$installprefix;;
6333         esac
6334 fi
6335 fn=d~
6336 rp='What installation prefix should I use for installing files?'
6337 . ./getfile
6338 installprefix="$ans"
6339 installprefixexp="$ansexp"
6340
6341 : set the prefixit variable, to compute a suitable default value
6342 prefixit='case "$3" in
6343 ""|none)
6344         case "$oldprefix" in
6345         "") eval "$1=\"\$$2\"";;
6346         *)
6347                 case "$3" in
6348                 "") eval "$1=";;
6349                 none)
6350                         eval "tp=\"\$$2\"";
6351                         case "$tp" in
6352                         ""|" ") eval "$1=\"\$$2\"";;
6353                         *) eval "$1=";;
6354                         esac;;
6355                 esac;;
6356         esac;;
6357 *)
6358         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6359         case "$tp" in
6360         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6361         /*-$oldprefix/*|\~*-$oldprefix/*)
6362                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6363         *) eval "$1=\"\$$2\"";;
6364         esac;;
6365 esac'
6366
6367 : get the patchlevel
6368 echo " "
6369 echo "Getting the current patchlevel..." >&4
6370 if $test -r $rsrc/patchlevel.h;then
6371         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6372         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6373         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6374         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6375         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6376         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6377        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6378 else
6379         revision=0
6380         patchlevel=0
6381         subversion=0
6382         api_revision=0
6383         api_version=0
6384         api_subversion=0
6385         perl_patchlevel=0
6386         $echo "(You do not have patchlevel.h.  Eek.)"
6387 fi
6388 if $test -r $rsrc/.patch ; then  
6389         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6390                 perl_patchlevel=`cat $rsrc/.patch`
6391         fi
6392 fi
6393 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
6394 version_patchlevel_string="version $patchlevel subversion $subversion"
6395 case "$perl_patchlevel" in
6396 0|'') ;;
6397 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
6398 esac
6399
6400 $echo "(You have $package $version_patchlevel_string.)"
6401
6402 case "$osname" in
6403 dos|vms)
6404         : XXX Should be a Configure test for double-dots in filenames.
6405         version=`echo $revision $patchlevel $subversion | \
6406                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6407         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6408                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6409         ;;
6410 *)
6411         version=`echo $revision $patchlevel $subversion | \
6412                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6413         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6414                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6415         ;;
6416 esac
6417 : Special case the 5.005_xx maintenance series, which used 5.005
6418 : without any subversion label as a subdirectory in $sitelib
6419 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6420         api_versionstring='5.005'
6421 fi
6422
6423 : determine installation style
6424 : For now, try to deduce it from prefix unless it is already set.
6425 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6426 case "$installstyle" in
6427 '')     case "$prefix" in
6428                 *perl*) dflt='lib';;
6429                 *) dflt='lib/perl5' ;;
6430         esac
6431         ;;
6432 *)      dflt="$installstyle" ;;
6433 esac
6434 : Probably not worth prompting for this since we prompt for all
6435 : the directories individually, and the prompt would be too long and
6436 : confusing anyway.
6437 installstyle=$dflt
6438
6439 : determine where private library files go
6440 : Usual default is /usr/local/lib/perl5/$version.
6441 : Also allow things like /opt/perl/lib/$version, since 
6442 : /opt/perl/lib/perl5... would be redundant.
6443 : The default "style" setting is made in installstyle.U
6444 case "$installstyle" in
6445 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6446 *)       set dflt privlib lib/$version ;;
6447 esac
6448 eval $prefixit
6449 $cat <<EOM
6450
6451 There are some auxiliary files for $package that need to be put into a
6452 private library directory that is accessible by everyone.
6453
6454 EOM
6455 fn=d~+
6456 rp='Pathname where the private library files will reside?'
6457 . ./getfile
6458 privlib="$ans"
6459 privlibexp="$ansexp"
6460 : Change installation prefix, if necessary.
6461 if $test X"$prefix" != X"$installprefix"; then
6462         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6463 else
6464         installprivlib="$privlibexp"
6465 fi
6466
6467 : set the prefixup variable, to restore leading tilda escape
6468 prefixup='case "$prefixexp" in
6469 "$prefix") ;;
6470 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6471 esac'
6472
6473 : determine where public architecture dependent libraries go
6474 set archlib archlib
6475 eval $prefixit
6476 : privlib default is /usr/local/lib/$package/$version
6477 : archlib default is /usr/local/lib/$package/$version/$archname
6478 : privlib may have an optional trailing /share.
6479 tdflt=`echo $privlib | $sed 's,/share$,,'`
6480 tdflt=$tdflt/$archname
6481 case "$archlib" in
6482 '')     dflt=$tdflt
6483         ;;
6484 *)      dflt="$archlib"
6485     ;;
6486 esac
6487 $cat <<EOM
6488
6489 $spackage contains architecture-dependent library files.  If you are
6490 sharing libraries in a heterogeneous environment, you might store
6491 these files in a separate location.  Otherwise, you can just include
6492 them with the rest of the public library files.
6493
6494 EOM
6495 fn=d+~
6496 rp='Where do you want to put the public architecture-dependent libraries?'
6497 . ./getfile
6498 archlib="$ans"
6499 archlibexp="$ansexp"
6500 if $test X"$archlib" = X"$privlib"; then
6501         d_archlib="$undef"
6502 else
6503         d_archlib="$define"
6504 fi
6505 : Change installation prefix, if necessary.
6506 if $test X"$prefix" != X"$installprefix"; then
6507         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6508 else
6509         installarchlib="$archlibexp"
6510 fi
6511
6512 : see if setuid scripts can be secure
6513 $cat <<EOM
6514
6515 Some kernels have a bug that prevents setuid #! scripts from being
6516 secure.  Some sites have disabled setuid #! scripts because of this.
6517
6518 First let's decide if your kernel supports secure setuid #! scripts.
6519 (If setuid #! scripts would be secure but have been disabled anyway,
6520 don't say that they are secure if asked.)
6521
6522 EOM
6523
6524 val="$undef"
6525 if $test -d /dev/fd; then
6526         echo "#!$ls" >reflect
6527         chmod +x,u+s reflect
6528         ./reflect >flect 2>&1
6529         if $contains "/dev/fd" flect >/dev/null; then
6530                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6531                 val="$define"
6532         else
6533                 $cat <<EOM
6534 If you are not sure if they are secure, I can check but I'll need a
6535 username and password different from the one you are using right now.
6536 If you don't have such a username or don't want me to test, simply
6537 enter 'none'.
6538
6539 EOM
6540                 rp='Other username to test security of setuid scripts with?'
6541                 dflt='none'
6542                 . ./myread
6543                 case "$ans" in
6544                 n|none)
6545                         case "$d_suidsafe" in
6546                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6547                                 dflt=n;;
6548                         "$undef")
6549                                 echo "Well, the $hint value is *not* secure." >&4
6550                                 dflt=n;;
6551                         *)      echo "Well, the $hint value *is* secure." >&4
6552                                 dflt=y;;
6553                         esac
6554                         ;;
6555                 *)
6556                         $rm -f reflect flect
6557                         echo "#!$ls" >reflect
6558                         chmod +x,u+s reflect
6559                         echo >flect
6560                         chmod a+w flect
6561                         echo '"su" will (probably) prompt you for '"$ans's password."
6562                         su $ans -c './reflect >flect'
6563                         if $contains "/dev/fd" flect >/dev/null; then
6564                                 echo "Okay, it looks like setuid scripts are secure." >&4
6565                                 dflt=y
6566                         else
6567                                 echo "I don't think setuid scripts are secure." >&4
6568                                 dflt=n
6569                         fi
6570                         ;;
6571                 esac
6572                 rp='Does your kernel have *secure* setuid scripts?'
6573                 . ./myread
6574                 case "$ans" in
6575                 [yY]*)  val="$define";;
6576                 *)      val="$undef";;
6577                 esac
6578         fi
6579 else
6580         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6581         echo "(That's for file descriptors, not floppy disks.)"
6582         val="$undef"
6583 fi
6584 set d_suidsafe
6585 eval $setvar
6586
6587 $rm -f reflect flect
6588
6589 : now see if they want to do setuid emulation
6590 echo " "
6591 val="$undef"
6592 case "$d_suidsafe" in
6593 "$define")
6594         val="$undef"
6595         echo "No need to emulate SUID scripts since they are secure here." >&4
6596         ;;
6597 *)
6598         $cat <<EOM
6599 Some systems have disabled setuid scripts, especially systems where
6600 setuid scripts cannot be secure.  On systems where setuid scripts have
6601 been disabled, the setuid/setgid bits on scripts are currently
6602 useless.  It is possible for $package to detect those bits and emulate
6603 setuid/setgid in a secure fashion.  This emulation will only work if
6604 setuid scripts have been disabled in your kernel.
6605
6606 EOM
6607         case "$d_dosuid" in
6608         "$define") dflt=y ;;
6609         *) dflt=n ;;
6610         esac
6611         rp="Do you want to do setuid/setgid emulation?"
6612         . ./myread
6613         case "$ans" in
6614         [yY]*)  val="$define";;
6615         *)      val="$undef";;
6616         esac
6617         ;;
6618 esac
6619 set d_dosuid
6620 eval $setvar
6621
6622 : see if this is a malloc.h system
6623 set malloc.h i_malloc
6624 eval $inhdr
6625
6626 : see if stdlib is available
6627 set stdlib.h i_stdlib
6628 eval $inhdr
6629
6630 : check for void type
6631 echo " "
6632 echo "Checking to see how well your C compiler groks the void type..." >&4
6633 case "$voidflags" in
6634 '')
6635         $cat >try.c <<'EOCP'
6636 #if TRY & 1
6637 void sub() {
6638 #else
6639 sub() {
6640 #endif
6641         extern void moo();      /* function returning void */
6642         void (*goo)();          /* ptr to func returning void */
6643 #if TRY & 8
6644         void *hue;              /* generic ptr */
6645 #endif
6646 #if TRY & 2
6647         void (*foo[10])();
6648 #endif
6649
6650 #if TRY & 4
6651         if(goo == moo) {
6652                 exit(0);
6653         }
6654 #endif
6655         exit(0);
6656 }
6657 int main() { sub(); }
6658 EOCP
6659         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6660                 voidflags=$defvoidused
6661         echo "Good.  It appears to support void to the level $package wants.">&4
6662                 if $contains warning .out >/dev/null 2>&1; then
6663                         echo "However, you might get some warnings that look like this:"
6664                         $cat .out
6665                 fi
6666         else
6667 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6668                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6669                         echo "It supports 1..."
6670                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6671                                 echo "It also supports 2..."
6672                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6673                                         voidflags=7
6674                                         echo "And it supports 4 but not 8 definitely."
6675                                 else
6676                                         echo "It doesn't support 4..."
6677                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6678                                                 voidflags=11
6679                                                 echo "But it supports 8."
6680                                         else
6681                                                 voidflags=3
6682                                                 echo "Neither does it support 8."
6683                                         fi
6684                                 fi
6685                         else
6686                                 echo "It does not support 2..."
6687                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6688                                         voidflags=13
6689                                         echo "But it supports 4 and 8."
6690                                 else
6691                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6692                                                 voidflags=5
6693                                                 echo "And it supports 4 but has not heard about 8."
6694                                         else
6695                                                 echo "However it supports 8 but not 4."
6696                                         fi
6697                                 fi
6698                         fi
6699                 else
6700                         echo "There is no support at all for void."
6701                         voidflags=0
6702                 fi
6703         fi
6704 esac
6705 case "$voidflags" in
6706 "$defvoidused") ;;
6707 *)      $cat >&4 <<'EOM'
6708   Support flag bits are:
6709     1: basic void declarations.
6710     2: arrays of pointers to functions returning void.
6711     4: operations between pointers to and addresses of void functions.
6712     8: generic void pointers.
6713 EOM
6714         dflt="$voidflags";
6715         rp="Your void support flags add up to what?"
6716         . ./myread
6717         voidflags="$ans"
6718         ;;
6719 esac
6720 $rm -f try.* .out
6721
6722 : check for length of pointer
6723 echo " "
6724 case "$ptrsize" in
6725 '')
6726         echo "Checking to see how big your pointers are..." >&4
6727         if test "$voidflags" -gt 7; then
6728                 echo '#define VOID_PTR char *' > try.c
6729         else
6730                 echo '#define VOID_PTR void *' > try.c
6731         fi
6732         $cat >>try.c <<'EOCP'
6733 #include <stdio.h>
6734 int main()
6735 {
6736     printf("%d\n", (int)sizeof(VOID_PTR));
6737     exit(0);
6738 }
6739 EOCP
6740         set try
6741         if eval $compile_ok; then
6742                 ptrsize=`$run ./try`
6743                 echo "Your pointers are $ptrsize bytes long."
6744         else
6745                 dflt='4'
6746                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6747                 rp="What is the size of a pointer (in bytes)?"
6748                 . ./myread
6749                 ptrsize="$ans"
6750         fi
6751         ;;
6752 esac
6753 $rm -f try.c try
6754 case "$use64bitall" in
6755 "$define"|true|[yY]*)
6756         case "$ptrsize" in
6757         4)      cat <<EOM >&4
6758
6759 *** You have chosen a maximally 64-bit build, but your pointers
6760 *** are only 4 bytes wide, disabling maximal 64-bitness.
6761
6762 EOM
6763                 use64bitall="$undef"
6764                 case "$use64bitint" in
6765                 "$define"|true|[yY]*) ;;
6766                 *)      cat <<EOM >&4
6767
6768 *** Downgrading from maximal 64-bitness to using 64-bit integers.
6769
6770 EOM
6771                         use64bitint="$define"
6772                         ;;
6773                 esac
6774                 ;;
6775         esac
6776         ;;
6777 esac
6778
6779
6780 : determine which malloc to compile in
6781 echo " "
6782 case "$usemymalloc" in
6783 [yY]*|true|$define)     dflt='y' ;;
6784 [nN]*|false|$undef)     dflt='n' ;;
6785 *)      case "$ptrsize" in
6786         4) dflt='y' ;;
6787         *) dflt='n' ;;
6788         esac
6789         ;;
6790 esac
6791 rp="Do you wish to attempt to use the malloc that comes with $package?"
6792 . ./myread
6793 usemymalloc="$ans"
6794 case "$ans" in
6795 y*|true)
6796         usemymalloc='y'
6797         mallocsrc='malloc.c'
6798         mallocobj="malloc$_o"
6799         d_mymalloc="$define"
6800         case "$libs" in
6801         *-lmalloc*)
6802                 : Remove malloc from list of libraries to use
6803                 echo "Removing unneeded -lmalloc from library list" >&4
6804                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6805                 shift
6806                 libs="$*"
6807                 echo "libs = $libs" >&4
6808                 ;;
6809         esac
6810         ;;
6811 *)
6812         usemymalloc='n'
6813         mallocsrc=''
6814         mallocobj=''
6815         d_mymalloc="$undef"
6816         ;;
6817 esac
6818
6819 : compute the return types of malloc and free
6820 echo " "
6821 $cat >malloc.c <<END
6822 #$i_malloc I_MALLOC
6823 #$i_stdlib I_STDLIB
6824 #include <stdio.h>
6825 #include <sys/types.h>
6826 #ifdef I_MALLOC
6827 #include <malloc.h>
6828 #endif
6829 #ifdef I_STDLIB
6830 #include <stdlib.h>
6831 #endif
6832 #ifdef TRY_MALLOC
6833 void *malloc();
6834 #endif
6835 #ifdef TRY_FREE
6836 void free();
6837 #endif
6838 END
6839 case "$malloctype" in
6840 '')
6841         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6842                 malloctype='void *'
6843         else
6844                 malloctype='char *'
6845         fi
6846         ;;
6847 esac
6848 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6849
6850 case "$freetype" in
6851 '')
6852         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6853                 freetype='void'
6854         else
6855                 freetype='int'
6856         fi
6857         ;;
6858 esac
6859 echo "Your system uses $freetype free(), it would seem." >&4
6860 $rm -f malloc.[co]
6861 $cat <<EOM
6862
6863 After $package is installed, you may wish to install various
6864 add-on modules and utilities.  Typically, these add-ons will
6865 be installed under $prefix with the rest
6866 of this package.  However, you may wish to install such add-ons
6867 elsewhere under a different prefix.
6868
6869 If you do not wish to put everything under a single prefix, that's
6870 ok.  You will be prompted for the individual locations; this siteprefix
6871 is only used to suggest the defaults.
6872
6873 The default should be fine for most people.
6874
6875 EOM
6876 fn=d~+
6877 rp='Installation prefix to use for add-on modules and utilities?'
6878 : XXX Here might be another good place for an installstyle setting.
6879 case "$siteprefix" in
6880 '') dflt=$prefix ;;
6881 *)  dflt=$siteprefix ;;
6882 esac
6883 . ./getfile
6884 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6885 oldsiteprefix=''
6886 case "$siteprefix" in
6887 '') ;;
6888 *)      case "$ans" in
6889         "$prefix") ;;
6890         *) oldsiteprefix="$prefix";;
6891         esac
6892         ;;
6893 esac
6894 siteprefix="$ans"
6895 siteprefixexp="$ansexp"
6896
6897 : determine where site specific libraries go.
6898 : Usual default is /usr/local/lib/perl5/site_perl/$version
6899 : The default "style" setting is made in installstyle.U
6900 : XXX No longer works with Prefixit stuff.
6901 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6902 case "$sitelib" in
6903 '') case "$installstyle" in
6904         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6905         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6906         esac
6907         ;;
6908 *)      dflt="$sitelib"
6909         ;;
6910 esac
6911 $cat <<EOM
6912
6913 The installation process will create a directory for
6914 site-specific extensions and modules.  Most users find it convenient
6915 to place all site-specific files in this directory rather than in the
6916 main distribution directory.
6917
6918 EOM
6919 fn=d~+
6920 rp='Pathname for the site-specific library files?'
6921 . ./getfile
6922 sitelib="$ans"
6923 sitelibexp="$ansexp"
6924 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6925 : Change installation prefix, if necessary.
6926 if $test X"$prefix" != X"$installprefix"; then
6927         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6928 else
6929         installsitelib="$sitelibexp"
6930 fi
6931
6932 : determine where site specific architecture-dependent libraries go.
6933 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6934 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6935 : sitelib may have an optional trailing /share.
6936 case "$sitearch" in
6937 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6938         dflt="$dflt/$archname"
6939         ;;
6940 *)      dflt="$sitearch"
6941         ;;
6942 esac
6943 set sitearch sitearch none
6944 eval $prefixit
6945 $cat <<EOM
6946
6947 The installation process will also create a directory for
6948 architecture-dependent site-specific extensions and modules.
6949
6950 EOM
6951 fn=d~+
6952 rp='Pathname for the site-specific architecture-dependent library files?'
6953 . ./getfile
6954 sitearch="$ans"
6955 sitearchexp="$ansexp"
6956 : Change installation prefix, if necessary.
6957 if $test X"$prefix" != X"$installprefix"; then
6958         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6959 else
6960         installsitearch="$sitearchexp"
6961 fi
6962
6963 $cat <<EOM
6964
6965 The installation process will also create a directory for
6966 vendor-supplied add-ons.  Vendors who supply perl with their system
6967 may find it convenient to place all vendor-supplied files in this
6968 directory rather than in the main distribution directory.  This will
6969 ease upgrades between binary-compatible maintenance versions of perl.
6970
6971 Of course you may also use these directories in whatever way you see
6972 fit.  For example, you might use them to access modules shared over a
6973 company-wide network.
6974
6975 The default answer should be fine for most people.
6976 This causes further questions about vendor add-ons to be skipped
6977 and no vendor-specific directories will be configured for perl.
6978
6979 EOM
6980 rp='Do you want to configure vendor-specific add-on directories?'
6981 case "$usevendorprefix" in
6982 define|true|[yY]*) dflt=y ;;
6983 *)      : User may have set vendorprefix directly on Configure command line.
6984         case "$vendorprefix" in
6985         ''|' ') dflt=n ;;
6986         *)      dflt=y ;;
6987         esac
6988         ;;
6989 esac
6990 . ./myread
6991 case "$ans" in
6992 [yY]*)  fn=d~+
6993         rp='Installation prefix to use for vendor-supplied add-ons?'
6994         case "$vendorprefix" in
6995         '') dflt='' ;;
6996         *)  dflt=$vendorprefix ;;
6997         esac
6998         . ./getfile
6999         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7000         oldvendorprefix=''
7001         case "$vendorprefix" in
7002         '') ;;
7003         *)      case "$ans" in
7004                 "$prefix") ;;
7005                 *) oldvendorprefix="$prefix";;
7006                 esac
7007                 ;;
7008         esac
7009         usevendorprefix="$define"
7010         vendorprefix="$ans"
7011         vendorprefixexp="$ansexp"
7012         ;;
7013 *)      usevendorprefix="$undef"
7014         vendorprefix=''
7015         vendorprefixexp=''
7016         ;;
7017 esac
7018
7019 case "$vendorprefix" in
7020 '')     d_vendorlib="$undef"
7021         vendorlib=''
7022         vendorlibexp=''
7023         ;;
7024 *)      d_vendorlib="$define"
7025         : determine where vendor-supplied modules go.
7026         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7027         case "$vendorlib" in
7028         '')
7029                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7030                 case "$installstyle" in
7031                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7032                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7033                 esac
7034                 ;;
7035         *)      dflt="$vendorlib"
7036                 ;;
7037         esac
7038         fn=d~+
7039         rp='Pathname for the vendor-supplied library files?'
7040         . ./getfile
7041         vendorlib="$ans"
7042         vendorlibexp="$ansexp"
7043         ;;
7044 esac
7045 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7046 : Change installation prefix, if necessary.
7047 if $test X"$prefix" != X"$installprefix"; then
7048         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
7049 else
7050         installvendorlib="$vendorlibexp"
7051 fi
7052
7053 case "$vendorprefix" in
7054 '')     d_vendorarch="$undef"
7055         vendorarch=''
7056         vendorarchexp=''
7057         ;;
7058 *)      d_vendorarch="$define"
7059         : determine where vendor-supplied architecture-dependent libraries go.
7060         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7061         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7062         : vendorlib may have an optional trailing /share.
7063         case "$vendorarch" in
7064         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7065                 dflt="$dflt/$archname"
7066                 ;;
7067         *)      dflt="$vendorarch" ;;
7068         esac
7069         fn=d~+
7070         rp='Pathname for vendor-supplied architecture-dependent files?'
7071         . ./getfile
7072         vendorarch="$ans"
7073         vendorarchexp="$ansexp"
7074         ;;
7075 esac
7076 : Change installation prefix, if necessary.
7077 if $test X"$prefix" != X"$installprefix"; then
7078         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
7079 else
7080         installvendorarch="$vendorarchexp"
7081 fi
7082
7083 : Final catch-all directories to search
7084 $cat <<EOM
7085
7086 Lastly, you can have perl look in other directories for extensions and
7087 modules in addition to those already specified.
7088 These directories will be searched after 
7089         $sitearch 
7090         $sitelib 
7091 EOM
7092 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7093 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7094 echo ' '
7095 case "$otherlibdirs" in
7096 ''|' ') dflt='none' ;;
7097 *)      dflt="$otherlibdirs" ;;
7098 esac
7099 $cat <<EOM
7100 Enter a colon-separated set of extra paths to include in perl's @INC
7101 search path, or enter 'none' for no extra paths.
7102
7103 EOM
7104
7105 rp='Colon-separated list of additional directories for perl to search?'
7106 . ./myread
7107 case "$ans" in
7108 ' '|''|none)    otherlibdirs=' ' ;;     
7109 *)      otherlibdirs="$ans" ;;
7110 esac
7111 case "$otherlibdirs" in
7112 ' ') val=$undef ;;
7113 *)      val=$define ;;
7114 esac
7115 set d_perl_otherlibdirs
7116 eval $setvar
7117
7118 : Cruising for prototypes
7119 echo " "
7120 echo "Checking out function prototypes..." >&4
7121 $cat >prototype.c <<'EOCP'
7122 int main(int argc, char *argv[]) {
7123         exit(0);}
7124 EOCP
7125 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7126         echo "Your C compiler appears to support function prototypes."
7127         val="$define"
7128 else
7129         echo "Your C compiler doesn't seem to understand function prototypes."
7130         val="$undef"
7131 fi
7132 set prototype
7133 eval $setvar
7134 $rm -f prototype*
7135
7136 case "$prototype" in
7137 "$define") ;;
7138 *)      ansi2knr='ansi2knr'
7139         echo " "
7140         cat <<EOM >&4
7141
7142 $me:  FATAL ERROR:
7143 This version of $package can only be compiled by a compiler that 
7144 understands function prototypes.  Unfortunately, your C compiler 
7145         $cc $ccflags
7146 doesn't seem to understand them.  Sorry about that.
7147
7148 If GNU cc is available for your system, perhaps you could try that instead.  
7149
7150 Eventually, we hope to support building Perl with pre-ANSI compilers.
7151 If you would like to help in that effort, please contact <perlbug@perl.org>.
7152
7153 Aborting Configure now.
7154 EOM
7155         exit 2
7156         ;;
7157 esac
7158
7159 : determine where public executables go
7160 echo " "
7161 set dflt bin bin
7162 eval $prefixit
7163 fn=d~
7164 rp='Pathname where the public executables will reside?'
7165 . ./getfile
7166 if $test "X$ansexp" != "X$binexp"; then
7167         installbin=''
7168 fi
7169 bin="$ans"
7170 binexp="$ansexp"
7171 : Change installation prefix, if necessary.
7172 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7173 if $test X"$prefix" != X"$installprefix"; then
7174         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
7175 else
7176         installbin="$binexp"
7177 fi
7178
7179 echo " "
7180 case "$extras" in
7181 '') dflt='n';;
7182 *) dflt='y';;
7183 esac
7184 cat <<EOM
7185 Perl can be built with extra modules or bundles of modules which
7186 will be fetched from the CPAN and installed alongside Perl.
7187
7188 Notice that you will need access to the CPAN; either via the Internet,
7189 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7190 be asked later to configure the CPAN.pm module which will in turn do
7191 the installation of the rest of the extra modules or bundles.)
7192
7193 Notice also that if the modules require any external software such as
7194 libraries and headers (the libz library and the zlib.h header for the
7195 Compress::Zlib module, for example) you MUST have any such software
7196 already installed, this configuration process will NOT install such
7197 things for you.
7198
7199 If this doesn't make any sense to you, just accept the default '$dflt'.
7200 EOM
7201 rp='Install any extra modules (y or n)?'
7202 . ./myread
7203 case "$ans" in
7204 y|Y)
7205         cat <<EOM
7206
7207 Please list any extra modules or bundles to be installed from CPAN,
7208 with spaces between the names.  The names can be in any format the
7209 'install' command of CPAN.pm will understand.  (Answer 'none',
7210 without the quotes, to install no extra modules or bundles.)
7211 EOM
7212         rp='Extras?'
7213         dflt="$extras"
7214         . ./myread
7215         extras="$ans"
7216 esac
7217 case "$extras" in
7218 ''|'none')
7219         val=''
7220         $rm -f ../extras.lst
7221         ;;
7222 *)      echo "(Saving the list of extras for later...)"
7223         echo "$extras" > ../extras.lst
7224         val="'$extras'"
7225         ;;
7226 esac
7227 set extras
7228 eval $setvar
7229 echo " "
7230
7231 : Find perl5.005 or later.
7232 echo "Looking for a previously installed perl5.005 or later... "
7233 case "$perl5" in
7234 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7235                 : Check if this perl is recent and can load a simple module
7236                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7237                         perl5=$tdir/perl
7238                         break;
7239                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7240                         perl5=$tdir/perl5
7241                         break;
7242                 fi
7243         done
7244         ;;
7245 *)      perl5="$perl5"
7246         ;;
7247 esac
7248 case "$perl5" in
7249 '')     echo "None found.  That's ok.";;
7250 *)      echo "Using $perl5." ;;
7251 esac
7252
7253 : Determine list of previous versions to include in @INC
7254 $cat > getverlist <<EOPL
7255 #!$perl5 -w
7256 use File::Basename;
7257 \$api_versionstring = "$api_versionstring";
7258 \$version = "$version";
7259 \$stem = "$sitelib_stem";
7260 \$archname = "$archname";
7261 EOPL
7262         $cat >> getverlist <<'EOPL'
7263 # Can't have leading @ because metaconfig interprets it as a command!
7264 ;@inc_version_list=();
7265 # XXX Redo to do opendir/readdir? 
7266 if (-d $stem) {
7267     chdir($stem);
7268     ;@candidates = glob("5.*");
7269 }
7270 else {
7271     ;@candidates = ();
7272 }
7273
7274 # XXX ToDo:  These comparisons must be reworked when two-digit
7275 # subversions come along, so that 5.7.10 compares as greater than
7276 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
7277 # widespread that we can use the built-in version vectors rather
7278 # than reinventing them here.  For 5.6.0, however, we must
7279 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
7280 foreach $d (@candidates) {
7281     if ($d lt $version) {
7282         if ($d ge $api_versionstring) {
7283             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
7284         }
7285         elsif ($d ge "5.005") {
7286             unshift(@inc_version_list, grep { -d } $d);
7287         }
7288     }
7289     else {
7290         # Skip newer version.  I.e. don't look in
7291         # 5.7.0 if we're installing 5.6.1.
7292     }
7293 }
7294
7295 if (@inc_version_list) {
7296     print join(' ', @inc_version_list);
7297 }
7298 else {
7299     # Blank space to preserve value for next Configure run.
7300     print " ";
7301 }
7302 EOPL
7303 chmod +x getverlist
7304 case "$inc_version_list" in
7305 '')     if test -x "$perl5$exe_ext"; then
7306                 dflt=`$perl5 getverlist`
7307         else
7308                 dflt='none'
7309         fi
7310         ;;
7311 $undef) dflt='none' ;;
7312 *)  eval dflt=\"$inc_version_list\" ;;
7313 esac
7314 case "$dflt" in
7315 ''|' ') dflt=none ;;
7316 esac
7317 case "$dflt" in
7318 5.005) dflt=none ;;
7319 esac
7320 $cat <<'EOM'
7321
7322 In order to ease the process of upgrading, this version of perl 
7323 can be configured to use modules built and installed with earlier 
7324 versions of perl that were installed under $prefix.  Specify here
7325 the list of earlier versions that this version of perl should check.
7326 If Configure detected no earlier versions of perl installed under
7327 $prefix, then the list will be empty.  Answer 'none' to tell perl
7328 to not search earlier versions.
7329
7330 The default should almost always be sensible, so if you're not sure,
7331 just accept the default.
7332 EOM
7333
7334 rp='List of earlier versions to include in @INC?'
7335 . ./myread
7336 case "$ans" in
7337 [Nn]one|''|' ') inc_version_list=' ' ;;
7338 *) inc_version_list="$ans" ;;
7339 esac
7340 case "$inc_version_list" in
7341 ''|' ') 
7342         inc_version_list_init='0';;
7343 *)      inc_version_list_init=`echo $inc_version_list |
7344                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7345         ;;
7346 esac
7347 $rm -f getverlist
7348
7349 : determine whether to install perl also as /usr/bin/perl
7350
7351 echo " "
7352 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7353         $cat <<EOM
7354 Many scripts expect perl to be installed as /usr/bin/perl.
7355 I can install the perl you are about to compile also as /usr/bin/perl
7356 (in addition to $installbin/perl).
7357 EOM
7358         case "$installusrbinperl" in
7359         "$undef"|[nN]*) dflt='n';;
7360         *)              dflt='y';;
7361         esac
7362         rp="Do you want to install perl as /usr/bin/perl?"
7363         . ./myread
7364         case "$ans" in
7365         [yY]*)  val="$define";;
7366         *)      val="$undef" ;;
7367         esac
7368 else
7369         val="$undef"
7370 fi
7371 set installusrbinperl
7372 eval $setvar
7373
7374 : see if dld is available
7375 set dld.h i_dld
7376 eval $inhdr
7377
7378 : see if dlopen exists
7379 xxx_runnm="$runnm"
7380 runnm=false
7381 set dlopen d_dlopen
7382 eval $inlibc
7383 runnm="$xxx_runnm"
7384
7385 : determine which dynamic loading, if any, to compile in
7386 echo " "
7387 dldir="ext/DynaLoader"
7388 case "$usedl" in
7389 $define|y|true)
7390         dflt='y'
7391         usedl="$define"
7392         ;;
7393 $undef|n|false)
7394         dflt='n'
7395         usedl="$undef"
7396         ;;
7397 *) 
7398         dflt='n'
7399         case "$d_dlopen" in
7400             $define) dflt='y' ;;
7401         esac
7402         case "$i_dld" in
7403             $define) dflt='y' ;;
7404         esac
7405         : Does a dl_xxx.xs file exist for this operating system
7406         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7407         ;;
7408 esac
7409 rp="Do you wish to use dynamic loading?"
7410 . ./myread
7411 usedl="$ans"
7412 case "$ans" in
7413 y*) usedl="$define"
7414         case "$dlsrc" in
7415         '')
7416                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7417                         dflt="$dldir/dl_${osname}.xs"
7418                 elif $test "$d_dlopen" = "$define" ; then
7419                         dflt="$dldir/dl_dlopen.xs"
7420                 elif $test "$i_dld" = "$define" ; then
7421                         dflt="$dldir/dl_dld.xs"
7422                 else
7423                         dflt=''
7424                 fi
7425                 ;;
7426         *)      dflt="$dldir/$dlsrc"
7427                 ;;
7428         esac
7429     echo "The following dynamic loading files are available:"
7430         : Can not go over to $dldir because getfile has path hard-coded in.
7431         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7432         rp="Source file to use for dynamic loading"
7433         fn="fne"
7434         gfpth="$src"
7435         . ./getfile
7436         usedl="$define"
7437         : emulate basename
7438         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7439
7440         $cat << EOM
7441
7442 Some systems may require passing special flags to $cc -c to
7443 compile modules that will be used to create a shared library.
7444 To use no flags, say "none".
7445
7446 EOM
7447     case "$cccdlflags" in
7448     '') case "$gccversion" in
7449                 '') case "$osname" in
7450                         hpux)   dflt='+z' ;;
7451                         next)   dflt='none' ;;
7452                         irix*)  dflt='-KPIC' ;;
7453                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7454                         sunos)  dflt='-pic' ;;
7455                         *)      dflt='none' ;;
7456                     esac
7457                         ;;
7458                 *)  case "$osname" in
7459                         darwin) dflt='none' ;;
7460                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7461                         *)      dflt='-fpic' ;;
7462                     esac ;;
7463             esac ;;
7464         ' ') dflt='none' ;;
7465     *)  dflt="$cccdlflags" ;;
7466     esac
7467     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7468     . ./myread
7469     case "$ans" in
7470     none) cccdlflags=' ' ;;
7471     *) cccdlflags="$ans" ;;
7472     esac
7473
7474     cat << EOM
7475
7476 Some systems use ld to create libraries that can be dynamically loaded,
7477 while other systems (such as those using ELF) use $cc.
7478
7479 EOM
7480         case "$ld" in
7481         '')     $cat >try.c <<'EOM'
7482 /* Test for whether ELF binaries are produced */
7483 #include <fcntl.h>
7484 #include <stdlib.h>
7485 int main() {
7486         char b[4];
7487         int i = open("a.out",O_RDONLY);
7488         if(i == -1) 
7489                 exit(1); /* fail */
7490         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7491                 exit(0); /* succeed (yes, it's ELF) */
7492         else
7493                 exit(1); /* fail */
7494 }
7495 EOM
7496                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7497                         cat <<EOM
7498 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7499 EOM
7500                         dflt="$cc"
7501                 else
7502                         echo "I'll use ld to build dynamic libraries."
7503                         dflt='ld'
7504                 fi
7505                 rm -f try.c a.out
7506                 ;;
7507         *)      dflt="$ld"
7508                 ;;
7509         esac
7510
7511     rp="What command should be used to create dynamic libraries?"
7512     . ./myread
7513         ld="$ans"
7514
7515     cat << EOM
7516
7517 Some systems may require passing special flags to $ld to create a
7518 library that can be dynamically loaded.  If your ld flags include
7519 -L/other/path options to locate libraries outside your loader's normal
7520 search path, you may need to specify those -L options here as well.  To
7521 use no flags, say "none".
7522
7523 EOM
7524     case "$lddlflags" in
7525     '') case "$osname" in
7526                         beos) dflt='-nostart' ;;
7527                         hpux) dflt='-b';
7528                               case "$gccversion" in
7529                               '') dflt="$dflt +vnocompatwarnings" ;;
7530                               esac
7531                               ;;        
7532                         linux|irix*)    dflt='-shared' ;;
7533                         next)  dflt='none' ;;
7534                         solaris) dflt='-G' ;;
7535                         sunos) dflt='-assert nodefinitions' ;;
7536                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7537                 *)     dflt='none' ;;
7538                         esac
7539                         ;;
7540     *) dflt="$lddlflags" ;;
7541     esac
7542
7543         : Try to guess additional flags to pick up local libraries.
7544         : Be careful not to append to a plain 'none'
7545         case "$dflt" in
7546         none) dflt='' ;;
7547         esac
7548         for thisflag in $ldflags; do
7549                 case "$thisflag" in
7550                 -L*|-R*|-Wl,-R*)
7551                         case " $dflt " in
7552                         *" $thisflag "*) ;;
7553                         *) dflt="$dflt $thisflag" ;;
7554                         esac
7555                         ;;
7556                 esac
7557         done
7558
7559         case "$dflt" in
7560         ''|' ') dflt='none' ;;
7561         esac
7562
7563     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7564     . ./myread
7565     case "$ans" in
7566     none) lddlflags=' ' ;;
7567     *) lddlflags="$ans" ;;
7568     esac
7569
7570         cat <<EOM
7571
7572 Some systems may require passing special flags to $cc to indicate that
7573 the resulting executable will use dynamic linking.  To use no flags,
7574 say "none".
7575
7576 EOM
7577     case "$ccdlflags" in
7578     '') case "$osname" in
7579                 hpux)   dflt='-Wl,-E' ;;
7580                 linux)  dflt='-rdynamic' ;;
7581                 next)   dflt='none' ;;
7582                 sunos)  dflt='none' ;;
7583                 *)      dflt='none' ;;
7584             esac ;;
7585     ' ')  dflt='none' ;;
7586     *)  dflt="$ccdlflags" ;;
7587     esac
7588     rp="Any special flags to pass to $cc to use dynamic linking?"
7589     . ./myread
7590     case "$ans" in
7591     none) ccdlflags=' ' ;;
7592     *) ccdlflags="$ans" ;;
7593     esac
7594     ;;
7595 *)  usedl="$undef"
7596         ld='ld'
7597     dlsrc='dl_none.xs'
7598     lddlflags=''
7599     ccdlflags=''
7600     ;;
7601 esac
7602
7603 also=''
7604 case "$usedl" in
7605 $undef)
7606         # No dynamic loading being used, so don't bother even to prompt.
7607         useshrplib='false'
7608         ;;
7609 *)      case "$useshrplib" in
7610         '')     case "$osname" in
7611                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7612                         dflt=y
7613                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7614                         ;;
7615                 next*)
7616                         case "$osvers" in
7617                         4*)     dflt=y
7618                                 also='Building a shared libperl is needed for MAB support.'
7619                                 ;;
7620                         *)      dflt=n
7621                                 ;;
7622                         esac
7623                         ;;
7624                 *)      dflt=n
7625                         ;;
7626                 esac
7627                 ;;
7628         $define|true|[Yy]*)
7629                 dflt=y
7630                 ;;
7631         *)      dflt=n
7632                 ;;
7633         esac
7634         $cat << EOM
7635
7636 The perl executable is normally obtained by linking perlmain.c with
7637 libperl${_a}, any static extensions (usually just DynaLoader), and
7638 any other libraries needed on this system (such as -lm, etc.).  Since
7639 your system supports dynamic loading, it is probably possible to build
7640 a shared libperl.$so.  If you will have more than one executable linked
7641 to libperl.$so, this will significantly reduce the size of each
7642 executable, but it may have a noticeable affect on performance.  The
7643 default is probably sensible for your system.
7644 $also
7645
7646 EOM
7647         rp="Build a shared libperl.$so (y/n)"
7648         . ./myread
7649         case "$ans" in
7650         true|$define|[Yy]*)
7651                 useshrplib='true'  ;;
7652         *)      useshrplib='false' ;;
7653         esac
7654         ;;
7655 esac
7656
7657 case "$useshrplib" in
7658 true)
7659         case "$libperl" in
7660         '')
7661                 # Figure out a good name for libperl.so.  Since it gets stored in
7662                 # a version-specific architecture-dependent library, the version
7663                 # number isn't really that important, except for making cc/ld happy.
7664                 #
7665                 # A name such as libperl.so.3.1
7666                 majmin="libperl.$so.$patchlevel.$subversion"
7667                 # A name such as libperl.so.301
7668                 majonly=`echo $patchlevel $subversion |
7669                         $awk '{printf "%d%02d", $1, $2}'`
7670                 majonly=libperl.$so.$majonly
7671                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7672                 # rely on figuring it out from the naming of libc.
7673                 case "${osname}${osvers}" in
7674                 next4*)
7675                         dflt=libperl.5.$so
7676                         # XXX How handle the --version stuff for MAB?
7677                         ;;
7678                 linux*)  # ld won't link with a bare -lperl otherwise.
7679                         dflt=libperl.$so
7680                         ;;
7681                 cygwin*) # ld links against an importlib
7682                         dflt=libperl$lib_ext
7683                         ;;
7684                 *)      # Try to guess based on whether libc has major.minor.
7685                         case "$libc" in
7686                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7687                         *libc.$so.[0-9]*) dflt=$majonly ;;
7688                         *)      dflt=libperl.$so ;;
7689                         esac
7690                         ;;
7691                 esac
7692                 ;;
7693         *)      dflt=$libperl
7694                 ;;
7695         esac
7696         cat << EOM
7697
7698 I need to select a good name for the shared libperl.  If your system uses
7699 library names with major and minor numbers, then you might want something
7700 like $majmin.  Alternatively, if your system uses a single version
7701 number for shared libraries, then you might want to use $majonly.
7702 Or, your system might be quite happy with a simple libperl.$so.
7703
7704 Since the shared libperl will get installed into a version-specific
7705 architecture-dependent directory, the version number of the shared perl
7706 library probably isn't important, so the default should be o.k.
7707
7708 EOM
7709         rp='What name do you want to give to the shared libperl?'
7710         . ./myread
7711         libperl=$ans
7712         echo "Ok, I'll use $libperl"
7713         ;;
7714 *)
7715         libperl="libperl${_a}"
7716         ;;
7717 esac
7718
7719 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7720 case "$shrpdir" in
7721 '') ;;
7722 *)      $cat >&4 <<EOM
7723 WARNING:  Use of the shrpdir variable for the installation location of
7724 the shared $libperl is not supported.  It was never documented and
7725 will not work in this version.  Let me (perlbug@perl.org)
7726 know of any problems this may cause.
7727
7728 EOM
7729         case "$shrpdir" in
7730         "$archlibexp/CORE")
7731                 $cat >&4 <<EOM
7732 But your current setting of $shrpdir is
7733 the default anyway, so it's harmless.
7734 EOM
7735                 ;;
7736         *)
7737                 $cat >&4 <<EOM
7738 Further, your current attempted setting of $shrpdir
7739 conflicts with the value of $archlibexp/CORE
7740 that installperl will use.
7741 EOM
7742                 ;;
7743         esac
7744         ;;
7745 esac
7746
7747 # How will the perl executable find the installed shared $libperl?
7748 # Add $xxx to ccdlflags.
7749 # If we can't figure out a command-line option, use $shrpenv to
7750 # set env LD_RUN_PATH.  The main perl makefile uses this.
7751 shrpdir=$archlibexp/CORE
7752 xxx=''
7753 tmp_shrpenv=''
7754 if "$useshrplib"; then
7755     case "$osname" in 
7756         aix)
7757                 # We'll set it in Makefile.SH...
7758                 ;;
7759         solaris)
7760                 xxx="-R $shrpdir"
7761                 ;;
7762         freebsd|netbsd)
7763                 xxx="-Wl,-R$shrpdir"
7764                 ;;
7765         bsdos|linux|irix*|dec_osf)
7766                 xxx="-Wl,-rpath,$shrpdir"
7767                 ;;
7768         next)
7769                 # next doesn't like the default...
7770                 ;;
7771         beos)
7772                 # beos doesn't like the default, either.
7773                 ;;
7774         hpux*)
7775                 # hpux doesn't like the default, either.
7776                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7777                 ;;
7778         *)
7779                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7780                 ;;
7781         esac
7782         case "$xxx" in
7783         '') ;;
7784         *)      
7785                 # Only add $xxx if it isn't already in ccdlflags.
7786                 case " $ccdlflags " in
7787                 *" $xxx "*)     ;;
7788                 *)      ccdlflags="$ccdlflags $xxx"
7789                         cat <<EOM >&4
7790
7791 Adding $xxx to the flags
7792 passed to $ld so that the perl executable will find the 
7793 installed shared $libperl.
7794
7795 EOM
7796                         ;;
7797                 esac
7798                 ;;
7799         esac
7800 fi
7801 # Fix ccdlflags in AIX for building external extensions.
7802 # (For building Perl itself bare -bE:perl.exp is needed,
7803 #  Makefile.SH takes care of this.)
7804 case "$osname" in
7805 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7806 esac
7807 # Respect a hint or command-line value.
7808 case "$shrpenv" in
7809 '') shrpenv="$tmp_shrpenv" ;;
7810 esac
7811 case "$ldlibpthname" in
7812 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7813 none)   ldlibpthname='' ;;
7814 esac
7815
7816 : determine where manual pages are on this system
7817 echo " "
7818 case "$sysman" in
7819 '') 
7820         syspath='/usr/share/man/man1 /usr/man/man1'
7821         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7822         syspath="$syspath /usr/man/u_man/man1"
7823         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7824         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7825         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7826         sysman=`./loc . /usr/man/man1 $syspath`
7827         ;;
7828 esac
7829 if $test -d "$sysman"; then
7830         echo "System manual is in $sysman." >&4
7831 else
7832         echo "Could not find manual pages in source form." >&4
7833 fi
7834
7835 : determine where manual pages go
7836 set man1dir man1dir none
7837 eval $prefixit
7838 $cat <<EOM
7839
7840 $spackage has manual pages available in source form.
7841 EOM
7842 case "$nroff" in
7843 nroff)
7844         echo "However, you don't have nroff, so they're probably useless to you."
7845         case "$man1dir" in
7846         '') man1dir="none";;
7847         esac;;
7848 esac
7849 echo "If you don't want the manual sources installed, answer 'none'."
7850 case "$man1dir" in
7851 ' ') dflt=none
7852         ;;
7853 '')
7854         lookpath="$prefixexp/share/man/man1"
7855         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7856         lookpath="$lookpath $prefixexp/man/p_man/man1"
7857         lookpath="$lookpath $prefixexp/man/u_man/man1"
7858         lookpath="$lookpath $prefixexp/man/man.1"
7859         case "$sysman" in
7860         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7861         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7862         esac
7863         set dflt
7864         eval $prefixup
7865         ;;
7866 *)  dflt="$man1dir"
7867         ;;
7868 esac
7869 echo " "
7870 fn=dn+~
7871 rp="Where do the main $spackage manual pages (source) go?"
7872 . ./getfile
7873 if $test "X$man1direxp" != "X$ansexp"; then
7874         installman1dir=''
7875 fi
7876 man1dir="$ans"
7877 man1direxp="$ansexp"
7878 case "$man1dir" in
7879 '')     man1dir=' '
7880         installman1dir='';;
7881 esac
7882
7883 : Change installation prefix, if necessary.
7884 if $test X"$prefix" != X"$installprefix"; then
7885         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7886 else
7887         installman1dir="$man1direxp"
7888 fi
7889
7890 : What suffix to use on installed man pages
7891
7892 case "$man1dir" in
7893 ' ')
7894         man1ext='0'
7895         ;;
7896 *)
7897         rp="What suffix should be used for the main $spackage man pages?"
7898         case "$man1ext" in
7899         '')     case "$man1dir" in
7900                 *1)  dflt=1 ;;
7901                 *1p) dflt=1p ;;
7902                 *1pm) dflt=1pm ;;
7903                 *l) dflt=l;;
7904                 *n) dflt=n;;
7905                 *o) dflt=o;;
7906                 *p) dflt=p;;
7907                 *C) dflt=C;;
7908                 *L) dflt=L;;
7909                 *L1) dflt=L1;;
7910                 *) dflt=1;;
7911                 esac
7912                 ;;
7913         *)      dflt="$man1ext";;
7914         esac
7915         . ./myread
7916         man1ext="$ans"
7917         ;;
7918 esac
7919
7920 : see if we can have long filenames
7921 echo " "
7922 first=123456789abcdef
7923 $rm -f $first
7924 if (echo hi >$first) 2>/dev/null; then
7925         if $test -f 123456789abcde; then
7926                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
7927                 val="$undef"
7928         else
7929                 echo 'You can have filenames longer than 14 characters.'>&4
7930                 val="$define"
7931         fi
7932 else
7933         $cat <<'EOM'
7934 You can't have filenames longer than 14 chars.
7935 You can't even think about them!
7936 EOM
7937         val="$undef"
7938 fi 
7939 set d_flexfnam
7940 eval $setvar
7941 $rm -rf 123456789abcde*
7942
7943 : determine where library module manual pages go
7944 set man3dir man3dir none
7945 eval $prefixit
7946 $cat <<EOM
7947
7948 $spackage has manual pages for many of the library modules.
7949 EOM
7950
7951 case "$nroff" in
7952 nroff)
7953         $cat <<'EOM'
7954 However, you don't have nroff, so they're probably useless to you.
7955 EOM
7956         case "$man3dir" in
7957         '') man3dir="none";;
7958         esac;;
7959 esac
7960
7961 case "$d_flexfnam" in
7962 undef)
7963         $cat <<'EOM'
7964 However, your system can't handle the long file names like File::Basename.3. 
7965 EOM
7966         case "$man3dir" in
7967         '') man3dir="none";;
7968         esac;;
7969 esac
7970
7971 echo "If you don't want the manual sources installed, answer 'none'."
7972 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7973 case "$man3dir" in
7974 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7975         if $test -d "$privlib/man/man3"; then
7976                 cat <<EOM >&4
7977
7978 WARNING:  Previous versions of perl installed man3 pages into
7979 $privlib/man/man3.  This version will suggest a 
7980 new default of $dflt.  
7981 EOM
7982                 tdflt=$dflt
7983                 dflt='n'
7984                 rp='Do you wish to preserve the old behavior?(y/n)'
7985                 . ./myread
7986                 case "$ans" in
7987                 y*) dflt="$privlib/man/man3" ;;
7988                 *)  dflt=$tdflt ;;
7989                 esac
7990     fi
7991         ;;
7992 *)      dflt="$man3dir" ;;
7993 esac
7994 case "$dflt" in
7995 ' ') dflt=none ;;
7996 esac
7997 echo " "
7998 fn=dn+~
7999 rp="Where do the $package library man pages (source) go?"
8000 . ./getfile
8001 man3dir="$ans"
8002 man3direxp="$ansexp"
8003 case "$man3dir" in
8004 '')     man3dir=' '
8005         installman3dir='';;
8006 esac
8007
8008 : Change installation prefix, if necessary.
8009 if $test X"$prefix" != X"$installprefix"; then
8010         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8011 else
8012         installman3dir="$man3direxp"
8013 fi
8014
8015 : What suffix to use on installed man pages
8016 case "$man3dir" in
8017 ' ')
8018         man3ext='0'
8019         ;;
8020 *)
8021         rp="What suffix should be used for the $package library man pages?"
8022         case "$man3ext" in
8023         '')     case "$man3dir" in
8024                 *3)  dflt=3 ;;
8025                 *3p) dflt=3p ;;
8026                 *3pm) dflt=3pm ;;
8027                 *l) dflt=l;;
8028                 *n) dflt=n;;
8029                 *o) dflt=o;;
8030                 *p) dflt=p;;
8031                 *C) dflt=C;;
8032                 *L) dflt=L;;
8033                 *L3) dflt=L3;;
8034                 *) dflt=3;;
8035                 esac
8036                 ;;
8037         *)      dflt="$man3ext";;
8038         esac
8039         . ./myread
8040         man3ext="$ans"
8041         ;;
8042 esac
8043
8044 : see if we have to deal with yellow pages, now NIS.
8045 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8046         if $test -f /usr/etc/nibindd; then
8047                 echo " "
8048                 echo "I'm fairly confident you're on a NeXT."
8049                 echo " "
8050                 rp='Do you get the hosts file via NetInfo?'
8051                 dflt=y
8052                 case "$hostcat" in
8053                 nidump*) ;;
8054                 '') ;;
8055                 *) dflt=n;;
8056                 esac
8057                 . ./myread
8058                 case "$ans" in
8059                 y*) hostcat='nidump hosts .';;
8060                 *)      case "$hostcat" in
8061                         nidump*) hostcat='';;
8062                         esac
8063                         ;;
8064                 esac
8065         fi
8066         case "$hostcat" in
8067         nidump*) ;;
8068         *)
8069                 case "$hostcat" in
8070                 *ypcat*) dflt=y;;
8071                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8072                                 dflt=y
8073                         else
8074                                 dflt=n
8075                         fi;;
8076                 *) dflt=n;;
8077                 esac
8078                 echo " "
8079                 rp='Are you getting the hosts file via yellow pages?'
8080                 . ./myread
8081                 case "$ans" in
8082                 y*) hostcat='ypcat hosts';;
8083                 *) hostcat='cat /etc/hosts';;
8084                 esac
8085                 ;;
8086         esac
8087 fi
8088 case "$hostcat" in
8089 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8090 esac
8091 case "$groupcat" in
8092 '') test -f /etc/group && groupcat='cat /etc/group';;
8093 esac
8094 case "$passcat" in
8095 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8096 esac
8097
8098 : now get the host name
8099 echo " "
8100 echo "Figuring out host name..." >&4
8101 case "$myhostname" in
8102 '') cont=true
8103         echo 'Maybe "hostname" will work...'
8104         if tans=`sh -c hostname 2>&1` ; then
8105                 myhostname=$tans
8106                 phostname=hostname
8107                 cont=''
8108         fi
8109         ;;
8110 *) cont='';;
8111 esac
8112 if $test "$cont"; then
8113         if ./xenix; then
8114                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8115                 if tans=`cat /etc/systemid 2>&1` ; then
8116                         myhostname=$tans
8117                         phostname='cat /etc/systemid'
8118                         echo "Whadyaknow.  Xenix always was a bit strange..."
8119                         cont=''
8120                 fi
8121         elif $test -r /etc/systemid; then
8122                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8123         fi
8124 fi
8125 if $test "$cont"; then
8126         echo 'No, maybe "uuname -l" will work...'
8127         if tans=`sh -c 'uuname -l' 2>&1` ; then
8128                 myhostname=$tans
8129                 phostname='uuname -l'
8130         else
8131                 echo 'Strange.  Maybe "uname -n" will work...'
8132                 if tans=`sh -c 'uname -n' 2>&1` ; then
8133                         myhostname=$tans
8134                         phostname='uname -n'
8135                 else
8136                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8137                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8138                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8139                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8140                         else
8141                                 case "$myhostname" in
8142                                 '') echo "Does this machine have an identity crisis or something?"
8143                                         phostname='';;
8144                                 *)
8145                                         echo "Well, you said $myhostname before..."
8146                                         phostname='echo $myhostname';;
8147                                 esac
8148                         fi
8149                 fi
8150         fi
8151 fi
8152 case "$myhostname" in
8153 '') myhostname=noname ;;
8154 esac
8155 : you do not want to know about this
8156 set $myhostname
8157 myhostname=$1
8158
8159 : verify guess
8160 if $test "$myhostname" ; then
8161         dflt=y
8162         rp='Your host name appears to be "'$myhostname'".'" Right?"
8163         . ./myread
8164         case "$ans" in
8165         y*) ;;
8166         *) myhostname='';;
8167         esac
8168 fi
8169
8170 : bad guess or no guess
8171 while $test "X$myhostname" = X ; do
8172         dflt=''
8173         rp="Please type the (one word) name of your host:"
8174         . ./myread
8175         myhostname="$ans"
8176 done
8177
8178 : translate upper to lower if necessary
8179 case "$myhostname" in
8180 *[A-Z]*)
8181         echo "(Normalizing case in your host name)"
8182         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8183         ;;
8184 esac
8185
8186 case "$myhostname" in
8187 *.*)
8188         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8189         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8190         echo "(Trimming domain name from host name--host name is now $myhostname)"
8191         ;;
8192 *) case "$mydomain" in
8193         '')
8194                 {
8195                         test "X$hostcat" = "Xypcat hosts" &&
8196                         ypmatch "$myhostname" hosts 2>/dev/null |\
8197                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8198                         $test -s hosts
8199                 } || {
8200                         test "X$hostcat" != "X" &&
8201                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8202                                         /[       ]$myhostname[  . ]/p" > hosts
8203                 }
8204                 tmp_re="[       . ]"
8205                 if $test -f hosts; then
8206                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8207                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8208                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8209                                 hosts | $sort | $uniq | \
8210                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8211                         case `$echo X$dflt` in
8212                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8213                                 dflt=.
8214                                 ;;
8215                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8216                                 ;;
8217                         esac
8218                 else
8219                         echo "(I cannot locate a hosts database anywhere)"
8220                         dflt=.
8221                 fi
8222                 case "$dflt" in
8223                 .)
8224                         tans=`./loc resolv.conf X /etc /usr/etc`
8225                         if $test -f "$tans"; then
8226                                 echo "(Attempting domain name extraction from $tans)"
8227                                 dflt=.`$sed -n -e 's/   / /g' \
8228                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8229                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8230                                 case "$dflt" in
8231                                 .) dflt=.`$sed -n -e 's/        / /g' \
8232                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8233                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8234                                         ;;
8235                                 esac
8236                         fi
8237                         ;;
8238                 esac
8239                 case "$dflt" in
8240                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8241                         dflt=.`sh -c domainname 2>/dev/null`
8242                         case "$dflt" in
8243                         '') dflt='.';;
8244                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8245                         esac
8246                         ;;
8247                 esac
8248                 case "$dflt$osname" in
8249                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8250                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8251                         ;;
8252                 esac
8253                 case "$dflt" in
8254                 .) echo "(Lost all hope -- silly guess then)"
8255                         dflt='.nonet'
8256                         ;;
8257                 esac
8258                 $rm -f hosts
8259                 ;;
8260         *) dflt="$mydomain";;
8261         esac;;
8262 esac
8263 echo " "
8264 rp="What is your domain name?"
8265 . ./myread
8266 tans="$ans"
8267 case "$ans" in
8268 '') ;;
8269 .*) ;;
8270 *) tans=".$tans";;
8271 esac
8272 mydomain="$tans"
8273
8274 : translate upper to lower if necessary
8275 case "$mydomain" in
8276 *[A-Z]*)
8277         echo "(Normalizing case in your domain name)"
8278         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8279         ;;
8280 esac
8281
8282 : a little sanity check here
8283 case "$phostname" in
8284 '') ;;
8285 *)
8286         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8287         $myhostname$mydomain|$myhostname) ;;
8288         *)
8289                 case "$phostname" in
8290                 sed*)
8291                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8292                         ;;
8293                 *)
8294                         echo "(That doesn't agree with your $phostname command, by the way.)"
8295                         ;;
8296                 esac
8297         ;;
8298         esac
8299         ;;
8300 esac
8301
8302 $cat <<EOM
8303
8304 I need to get your e-mail address in Internet format if possible, i.e.
8305 something like user@host.domain. Please answer accurately since I have
8306 no easy means to double check it. The default value provided below
8307 is most probably close to reality but may not be valid from outside
8308 your organization...
8309
8310 EOM
8311 cont=x
8312 while test "$cont"; do
8313         case "$cf_email" in
8314         '') dflt="$cf_by@$myhostname$mydomain";;
8315         *) dflt="$cf_email";;
8316         esac
8317         rp='What is your e-mail address?'
8318         . ./myread
8319         cf_email="$ans"
8320         case "$cf_email" in
8321         *@*.*) cont='' ;;
8322         *)
8323                 rp='Address does not look like an Internet one.  Use it anyway?'
8324                 case "$fastread" in
8325                 yes) dflt=y ;;
8326                 *) dflt=n ;;
8327                 esac
8328                 . ./myread
8329                 case "$ans" in
8330                 y*) cont='' ;;
8331                 *) echo " " ;;
8332                 esac
8333                 ;;
8334         esac
8335 done
8336
8337 $cat <<EOM
8338
8339 If you or somebody else will be maintaining perl at your site, please
8340 fill in the correct e-mail address here so that they may be contacted
8341 if necessary. Currently, the "perlbug" program included with perl
8342 will send mail to this address in addition to perlbug@perl.org. You may
8343 enter "none" for no administrator.
8344
8345 EOM
8346 case "$perladmin" in
8347 '') dflt="$cf_email";;
8348 *) dflt="$perladmin";;
8349 esac
8350 rp='Perl administrator e-mail address'
8351 . ./myread
8352 perladmin="$ans"
8353
8354 : determine whether to only install version-specific parts.
8355 echo " "
8356 $cat <<EOM
8357 Do you want to install only the version-specific parts of the perl
8358 distribution?  Usually you do *not* want to do this.
8359 EOM
8360 case "$versiononly" in
8361 "$define"|[Yy]*|true) dflt='y' ;;
8362 *) dflt='n';
8363 esac
8364 rp="Do you want to install only the version-specific parts of perl?"
8365 . ./myread
8366 case "$ans" in
8367 [yY]*)  val="$define";;
8368 *)      val="$undef" ;;
8369 esac
8370 set versiononly
8371 eval $setvar
8372
8373 case "$versiononly" in
8374 "$define") inc_version_list=''
8375            inc_version_list_init=0
8376            ;;
8377 esac
8378
8379 : figure out how to guarantee perl startup
8380 case "$startperl" in
8381 '')
8382         case "$sharpbang" in
8383         *!)
8384                 $cat <<EOH
8385
8386 I can use the #! construct to start perl on your system. This will
8387 make startup of perl scripts faster, but may cause problems if you
8388 want to share those scripts and perl is not in a standard place
8389 ($binexp/perl) on all your platforms. The alternative is to force
8390 a shell by starting the script with a single ':' character.
8391
8392 EOH
8393                 case "$versiononly" in
8394                 "$define")      dflt="$binexp/perl$version";;  
8395                 *)              dflt="$binexp/perl";;
8396                 esac
8397                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8398                 . ./myread
8399                 case "$ans" in
8400                 none)   startperl=": # use perl";;
8401                 *)      startperl="#!$ans"
8402                         if $test 30 -lt `echo "$ans" | wc -c`; then
8403                                 $cat >&4 <<EOM
8404
8405 WARNING:  Some systems limit the #! command to 32 characters.
8406 If you experience difficulty running Perl scripts with #!, try
8407 installing Perl in a directory with a shorter pathname.
8408
8409 EOM
8410                         fi ;;
8411                 esac
8412                 ;;
8413         *) startperl=": # use perl"
8414                 ;;
8415         esac
8416         ;;
8417 esac
8418 echo "I'll use $startperl to start perl scripts."
8419
8420 : figure best path for perl in scripts
8421 case "$perlpath" in
8422 '')
8423         case "$versiononly" in
8424         "$define")      perlpath="$binexp/perl$version";;
8425         *)              perlpath="$binexp/perl";;
8426         esac
8427         case "$startperl" in
8428         *!*) ;;
8429         *)
8430                 $cat <<EOH
8431
8432 I will use the "eval 'exec'" idiom to start Perl on your system.
8433 I can use the full path of your Perl binary for this purpose, but
8434 doing so may cause problems if you want to share those scripts and
8435 Perl is not always in a standard place ($binexp/perl).
8436
8437 EOH
8438                 dflt="$binexp/perl"
8439                 rp="What path shall I use in \"eval 'exec'\"?"
8440                 . ./myread
8441                 perlpath="$ans"
8442                 ;;
8443         esac
8444         ;;
8445 esac
8446 case "$startperl" in
8447 *!*)    ;;
8448 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8449 esac
8450
8451 : determine where public executable scripts go
8452 set scriptdir scriptdir
8453 eval $prefixit
8454 case "$scriptdir" in
8455 '')
8456         dflt="$bin"
8457         : guess some guesses
8458         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8459         $test -d /usr/share/bin     && dflt=/usr/share/bin
8460         $test -d /usr/local/script  && dflt=/usr/local/script
8461         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8462         $test -d $prefixexp/script  && dflt=$prefixexp/script
8463         set dflt
8464         eval $prefixup
8465         ;;
8466 *)  dflt="$scriptdir"
8467         ;;
8468 esac
8469 $cat <<EOM
8470  
8471 Some installations have a separate directory just for executable scripts so
8472 that they can mount it across multiple architectures but keep the scripts in
8473 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8474 Or you might just lump your scripts in with all your other executables.
8475  
8476 EOM
8477 fn=d~
8478 rp='Where do you keep publicly executable scripts?'
8479 . ./getfile
8480 if $test "X$ansexp" != "X$scriptdirexp"; then
8481         installscript=''
8482 fi
8483 scriptdir="$ans"
8484 scriptdirexp="$ansexp"
8485 : Change installation prefix, if necessary.
8486 if $test X"$prefix" != X"$installprefix"; then
8487         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8488 else
8489         installscript="$scriptdirexp"
8490 fi
8491
8492 : determine where add-on public executables go
8493 case "$sitebin" in
8494 '')     dflt=$siteprefix/bin ;;
8495 *)      dflt=$sitebin ;;
8496 esac
8497 fn=d~
8498 rp='Pathname where the add-on public executables should be installed?'
8499 . ./getfile
8500 sitebin="$ans"
8501 sitebinexp="$ansexp"
8502 : Change installation prefix, if necessary.
8503 if $test X"$prefix" != X"$installprefix"; then
8504         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8505 else
8506         installsitebin="$sitebinexp"
8507 fi
8508
8509 : define an is-a-typedef? function
8510 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8511 case "$inclist" in
8512 "") inclist="sys/types.h";;
8513 esac;
8514 eval "varval=\$$var";
8515 case "$varval" in
8516 "")
8517         $rm -f temp.c;
8518         for inc in $inclist; do
8519                 echo "#include <$inc>" >>temp.c;
8520         done;
8521         echo "#ifdef $type" >> temp.c;
8522         echo "printf(\"We have $type\");" >> temp.c;
8523         echo "#endif" >> temp.c;
8524         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8525         if $contains $type temp.E >/dev/null 2>&1; then
8526                 eval "$var=\$type";
8527         else
8528                 eval "$var=\$def";
8529         fi;
8530         $rm -f temp.?;;
8531 *) eval "$var=\$varval";;
8532 esac'
8533
8534 : define an is-a-typedef? function that prompts if the type is not available.
8535 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8536 case "$inclist" in
8537 "") inclist="sys/types.h";;
8538 esac;
8539 eval "varval=\$$var";
8540 case "$varval" in
8541 "")
8542         $rm -f temp.c;
8543         for inc in $inclist; do
8544                 echo "#include <$inc>" >>temp.c;
8545         done;
8546         echo "#ifdef $type" >> temp.c;
8547         echo "printf(\"We have $type\");" >> temp.c;
8548         echo "#endif" >> temp.c;
8549         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8550         echo " " ;
8551         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8552         if $contains $type temp.E >/dev/null 2>&1; then
8553                 echo "$type found." >&4;
8554                 eval "$var=\$type";
8555         else
8556                 echo "$type NOT found." >&4;
8557                 dflt="$def";
8558                 . ./myread ;
8559                 eval "$var=\$ans";
8560         fi;
8561         $rm -f temp.?;;
8562 *) eval "$var=\$varval";;
8563 esac'
8564
8565 : see what type lseek is declared as in the kernel
8566 rp="What is the type used for lseek's offset on this system?"
8567 set off_t lseektype long stdio.h sys/types.h
8568 eval $typedef_ask
8569
8570 echo " "
8571 echo "Checking to see how big your file offsets are..." >&4
8572 $cat >try.c <<EOCP
8573 #include <sys/types.h>
8574 #include <stdio.h>
8575 int main()
8576 {
8577     printf("%d\n", (int)sizeof($lseektype));
8578     return(0); 
8579 }
8580 EOCP
8581 set try
8582 if eval $compile_ok; then
8583         lseeksize=`$run ./try`
8584         echo "Your file offsets are $lseeksize bytes long."
8585 else
8586         dflt=$longsize
8587         echo " "
8588         echo "(I can't seem to compile the test program.  Guessing...)"
8589         rp="What is the size of your file offsets (in bytes)?"
8590         . ./myread
8591         lseeksize="$ans"
8592 fi
8593 $rm -f try.c try
8594
8595 : see what type file positions are declared as in the library
8596 rp="What is the type for file position used by fsetpos()?"
8597 set fpos_t fpostype long stdio.h sys/types.h
8598 eval $typedef_ask
8599
8600 echo " "
8601 case "$fpostype" in
8602 *_t) zzz="$fpostype"    ;;
8603 *)   zzz="fpos_t"       ;;
8604 esac
8605 echo "Checking the size of $zzz..." >&4 
8606 cat > try.c <<EOCP
8607 #include <sys/types.h>
8608 #include <stdio.h>
8609 int main() {
8610     printf("%d\n", (int)sizeof($fpostype));
8611     exit(0);
8612 }
8613 EOCP
8614 set try
8615 if eval $compile_ok; then
8616         yyy=`$run ./try`
8617         case "$yyy" in
8618         '')     fpossize=4
8619                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8620                 ;;
8621         *)      fpossize=$yyy
8622                 echo "Your $zzz is $fpossize bytes long."
8623                 ;;
8624         esac
8625 else
8626         dflt="$longsize"
8627         echo " " >&4
8628         echo "(I can't compile the test program.  Guessing...)" >&4
8629         rp="What is the size of your file positions (in bytes)?"
8630         . ./myread
8631         fpossize="$ans"
8632 fi
8633
8634
8635
8636 # Backward compatibility (uselfs is deprecated).
8637 case "$uselfs" in
8638 "$define"|true|[yY]*)
8639         cat <<EOM >&4
8640
8641 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8642 EOM
8643         uselargefiles="$define"
8644         ;;
8645 esac                          
8646
8647 case "$lseeksize:$fpossize" in
8648 8:8) cat <<EOM
8649
8650 You can have files larger than 2 gigabytes.
8651 EOM
8652    val="$define" ;;
8653 *)    case "$uselargefiles" in
8654    "$undef"|false|[nN]*) dflt='n' ;;
8655    *)   dflt='y' ;;
8656    esac
8657    cat <<EOM
8658
8659 Perl can be built to understand large files (files larger than 2 gigabytes)
8660 on some systems.  To do so, Configure can be run with -Duselargefiles.
8661
8662 If this doesn't make any sense to you, just accept the default '$dflt'.
8663 EOM
8664    rp='Try to understand large files, if available?'
8665    . ./myread
8666    case "$ans" in
8667    y|Y)         val="$define" ;;
8668    *)           val="$undef"  ;;
8669    esac
8670    ;;
8671 esac
8672 set uselargefiles
8673 eval $setvar
8674 case "$uselargefiles" in
8675 "$define")
8676 : Look for a hint-file generated 'call-back-unit'.  If the
8677 : user has specified that a large files perl is to be built,
8678 : we may need to set or change some other defaults.
8679         if $test -f uselargefiles.cbu; then
8680                 echo "Your platform has some specific hints for large file builds, using them..."
8681                 . ./uselargefiles.cbu
8682                 echo " "
8683                 echo "Rechecking to see how big your file offsets are..." >&4
8684                 $cat >try.c <<EOCP
8685 #include <sys/types.h>
8686 #include <stdio.h>
8687 int main()
8688 {
8689     printf("%d\n", (int)sizeof($lseektype));
8690     return(0); 
8691 }
8692 EOCP
8693                 set try
8694                 if eval $compile_ok; then
8695                         lseeksize=`$run ./try`
8696                         $echo "Your file offsets are now $lseeksize bytes long."
8697                 else
8698                         dflt="$lseeksize"
8699                         echo " "
8700                         echo "(I can't seem to compile the test program.  Guessing...)"
8701                         rp="What is the size of your file offsets (in bytes)?"
8702                         . ./myread
8703                         lseeksize="$ans"
8704                 fi
8705                 case "$fpostype" in
8706                 *_t) zzz="$fpostype"    ;;
8707                 *)   zzz="fpos_t"       ;;
8708                 esac
8709                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8710                 $cat > try.c <<EOCP
8711 #include <sys/types.h>
8712 #include <stdio.h>
8713 int main() {
8714     printf("%d\n", (int)sizeof($fpostype));
8715     exit(0);
8716 }
8717 EOCP
8718                 set try
8719                 if eval $compile_ok; then
8720                         yyy=`$run ./try`
8721                         dflt="$lseeksize"
8722                         case "$yyy" in
8723                         '')     echo " "
8724                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8725                                 ;;
8726                         *)      fpossize=$yyy
8727                                 echo " $fpossize bytes." >&4
8728                                 ;;
8729                         esac
8730                 else
8731                         dflt="$fpossize"
8732                         echo " "
8733                         echo "(I can't compile the test program.  Guessing...)" >&4
8734                         rp="What is the size of your file positions (in bytes)?"
8735                         . ./myread
8736                         fpossize="$ans"
8737                 fi
8738                 $rm -f try.c try
8739         fi
8740         ;;
8741 esac
8742
8743 case "$vendorprefix" in
8744 '')     d_vendorbin="$undef"
8745         vendorbin=''
8746         vendorbinexp=''
8747         ;;
8748 *)      d_vendorbin="$define"
8749         : determine where vendor-supplied executables go.
8750         case "$vendorbin" in
8751         '') dflt=$vendorprefix/bin ;;
8752         *)      dflt="$vendorbin" ;;
8753         esac
8754         fn=d~+
8755         rp='Pathname for the vendor-supplied executables directory?'
8756         . ./getfile
8757         vendorbin="$ans"
8758         vendorbinexp="$ansexp"
8759         ;;
8760 esac
8761 : Change installation prefix, if necessary.
8762 if $test X"$prefix" != X"$installprefix"; then
8763         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8764 else
8765         installvendorbin="$vendorbinexp"
8766 fi
8767
8768 : see if qgcvt exists
8769 set qgcvt d_qgcvt
8770 eval $inlibc
8771
8772 : Check how to convert floats to strings.
8773
8774 if test "X$d_Gconvert" = X; then
8775
8776 echo " "
8777 echo "Checking for an efficient way to convert floats to strings."
8778 echo " " > try.c
8779 case "$uselongdouble" in
8780 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8781 esac
8782 case "$d_longdbl" in
8783 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8784 esac
8785 case "$d_PRIgldbl" in
8786 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
8787 esac
8788 $cat >>try.c <<EOP
8789 #ifdef TRY_gconvert
8790 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8791 char *myname = "gconvert";
8792 #endif
8793 #ifdef TRY_gcvt
8794 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8795 char *myname = "gcvt";
8796 #endif
8797 #ifdef TRY_qgcvt
8798 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8799 char *myname = "qgcvt";
8800 #define DOUBLETYPE long double
8801 #endif
8802 #ifdef TRY_sprintf
8803 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8804 #ifdef HAS_PRIgldbl
8805 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8806 #else
8807 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
8808 #endif
8809 #else
8810 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8811 #endif
8812 char *myname = "sprintf";
8813 #endif
8814
8815 #ifndef DOUBLETYPE
8816 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8817 #define DOUBLETYPE long double
8818 #else
8819 #define DOUBLETYPE double
8820 #endif
8821 #endif
8822
8823 #include <stdio.h>
8824
8825 #define I_STDLIB $i_stdlib
8826 #ifdef I_STDLIB
8827 #include <stdlib.h>
8828 #endif
8829
8830 int
8831 checkit(expect, got)
8832 char *expect;
8833 char *got;
8834 {
8835     if (strcmp(expect, got)) {
8836                 printf("%s oddity:  Expected %s, got %s\n",
8837                         myname, expect, got);
8838                 exit(1);
8839         }
8840 }
8841
8842 int main()
8843
8844         char buf[64]; 
8845         buf[63] = '\0';
8846
8847         /* This must be 1st test on (which?) platform */
8848         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8849         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8850         checkit("0.1", buf);
8851
8852         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
8853         checkit("0.01", buf);
8854
8855         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
8856         checkit("0.001", buf);
8857
8858         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
8859         checkit("0.0001", buf);
8860
8861         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
8862         if (strlen(buf) > 5)
8863             checkit("9e-005", buf); /* for Microsoft ?? */
8864         else
8865             checkit("9e-05", buf);
8866
8867         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
8868         checkit("1", buf);
8869
8870         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
8871         checkit("1.1", buf);
8872
8873         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
8874         checkit("1.01", buf);
8875
8876         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
8877         checkit("1.001", buf);
8878
8879         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
8880         checkit("1.0001", buf);
8881
8882         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
8883         checkit("1.00001", buf);
8884
8885         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
8886         checkit("1.000001", buf);
8887
8888         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
8889         checkit("0", buf);
8890
8891         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
8892         checkit("-1", buf);
8893
8894         /* Some Linux gcvt's give 1.e+5 here. */
8895         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
8896         checkit("100000", buf);
8897         
8898         /* Some Linux gcvt's give -1.e+5 here. */
8899         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
8900         checkit("-100000", buf);
8901
8902         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
8903         checkit("123.456", buf);
8904
8905         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
8906         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
8907         /* 34 should be enough to scare even long double
8908          * places into using the e notation. */
8909         if (strlen(buf) > 5)
8910             checkit("1e+034", buf); /* for Microsoft */
8911         else
8912             checkit("1e+34", buf);
8913
8914         /* For Perl, if you add additional tests here, also add them to
8915          * t/base/num.t for benefit of platforms not using Configure or
8916          * overriding d_Gconvert */
8917
8918         exit(0);
8919 }
8920 EOP
8921 : first add preferred functions to our list
8922 xxx_list=""
8923 for xxx_convert in $gconvert_preference; do
8924     case $xxx_convert in
8925     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
8926     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
8927     esac 
8928 done
8929 : then add any others
8930 for xxx_convert in gconvert gcvt sprintf; do
8931     case "$xxx_list" in
8932     *$xxx_convert*) ;;
8933     *) xxx_list="$xxx_list $xxx_convert" ;;
8934     esac 
8935 done
8936
8937 case "$d_longdbl$uselongdouble" in
8938 "$define$define")
8939     : again, add prefered functions to our list first
8940     xxx_ld_list=""
8941     for xxx_convert in $gconvert_ld_preference; do
8942         case $xxx_convert in
8943         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
8944         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
8945         esac
8946     done
8947     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
8948     for xxx_convert in qgcvt sprintf $xxx_list; do
8949         case "$xxx_ld_list" in
8950         $xxx_convert*|*" $xxx_convert"*) ;;
8951         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
8952         esac
8953     done
8954     : if sprintf cannot do long doubles, move it to the end
8955     if test "$d_PRIgldbl" != "$define"; then
8956         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
8957     fi
8958     : if no qgcvt, remove it
8959     if test "$d_qgcvt" != "$define"; then
8960         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
8961     fi
8962     : use the ld_list
8963     xxx_list="$xxx_ld_list"
8964     ;;
8965 esac
8966
8967 for xxx_convert in $xxx_list; do
8968         echo "Trying $xxx_convert..."
8969         $rm -f try try$_o
8970         set try -DTRY_$xxx_convert
8971         if eval $compile; then
8972                 echo "$xxx_convert() found." >&4
8973                 if $run ./try; then
8974                         echo "I'll use $xxx_convert to convert floats into a string." >&4
8975                         break;
8976                 else
8977                         echo "...But $xxx_convert didn't work as I expected."
8978                         xxx_convert=''
8979                 fi
8980         else
8981                 echo "$xxx_convert NOT found." >&4
8982         fi
8983 done
8984
8985 if test X$xxx_convert = X; then
8986     echo "*** WHOA THERE!!! ***" >&4
8987     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
8988     xxx_convert=sprintf
8989 fi
8990
8991 case "$xxx_convert" in
8992 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
8993 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
8994 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
8995 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
8996    "$define$define$define")
8997       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
8998    "$define$define$undef")
8999       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9000    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9001    esac
9002    ;;  
9003 esac
9004
9005 fi
9006
9007 : see if _fwalk exists
9008 set fwalk d__fwalk
9009 eval $inlibc
9010
9011 : Initialize h_fcntl
9012 h_fcntl=false
9013
9014 : Initialize h_sysfile
9015 h_sysfile=false
9016
9017 : access call always available on UNIX
9018 set access d_access
9019 eval $inlibc
9020
9021 : locate the flags for 'access()'
9022 case "$d_access" in
9023 "$define")
9024         echo " "
9025         $cat >access.c <<'EOCP'
9026 #include <sys/types.h>
9027 #ifdef I_FCNTL
9028 #include <fcntl.h>
9029 #endif
9030 #ifdef I_SYS_FILE
9031 #include <sys/file.h>
9032 #endif
9033 #ifdef I_UNISTD
9034 #include <unistd.h>
9035 #endif
9036 int main() {
9037         exit(R_OK);
9038 }
9039 EOCP
9040         : check sys/file.h first, no particular reason here
9041         if $test `./findhdr sys/file.h` && \
9042                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9043                 h_sysfile=true;
9044                 echo "<sys/file.h> defines the *_OK access constants." >&4
9045         elif $test `./findhdr fcntl.h` && \
9046                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9047                 h_fcntl=true;
9048                 echo "<fcntl.h> defines the *_OK access constants." >&4
9049         elif $test `./findhdr unistd.h` && \
9050                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9051                 echo "<unistd.h> defines the *_OK access constants." >&4
9052         else
9053                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9054         fi
9055         ;;
9056 esac
9057 $rm -f access*
9058
9059 : see if accessx exists
9060 set accessx d_accessx
9061 eval $inlibc
9062
9063 : see if alarm exists
9064 set alarm d_alarm
9065 eval $inlibc
9066
9067 : see if POSIX threads are available
9068 set pthread.h i_pthread
9069 eval $inhdr
9070
9071 : define a fucntion to check prototypes
9072 $cat > protochk <<EOSH
9073 $startsh
9074 cc="$cc"
9075 optimize="$optimize"
9076 ccflags="$ccflags"
9077 prototype="$prototype"
9078 define="$define"
9079 rm=$rm
9080 usethreads=$usethreads
9081 i_pthread=$i_pthread
9082 pthread_h_first=$pthread_h_first
9083 EOSH
9084
9085 $cat >> protochk <<'EOSH'
9086
9087 $rm -f try.c
9088 foo="$1"
9089 shift
9090 while test $# -ge 2; do
9091         case "$1" in
9092                 $define) echo "#include <$2>" >> try.c ;;
9093                 literal) echo "$2" >> try.c ;;
9094         esac
9095     # Extra magic for the benefit of systems that need pthread.h
9096     # to be included early to correctly detect threadsafe functions.
9097     # Such functions must guarantee themselves, though, that the usethreads
9098     # and i_pthread have been defined, before calling protochk.
9099     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9100         echo "#include <pthread.h>" >> try.c
9101         pthread_h_done=yes
9102     fi
9103     shift 2
9104 done
9105 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9106 cat >> try.c <<'EOCP'
9107 #ifdef CAN_PROTOTYPE
9108 #define _(args) args
9109 #else
9110 #define _(args) ()
9111 #endif
9112 EOCP
9113 echo "$foo" >> try.c
9114 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9115 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9116 status=$?
9117 $rm -f try.[co]
9118 exit $status
9119 EOSH
9120 chmod +x protochk
9121 $eunicefix protochk
9122
9123 hasproto='varname=$1; func=$2; shift; shift;
9124 while $test $# -ge 2; do
9125         case "$1" in
9126         $define) echo "#include <$2>";;
9127         esac ;
9128     shift 2;
9129 done > try.c;
9130 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9131 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9132         echo "$func() prototype found.";
9133         val="$define";
9134 else
9135         echo "$func() prototype NOT found.";
9136         val="$undef";
9137 fi;
9138 set $varname;
9139 eval $setvar;
9140 $rm -f try.c tryout.c'
9141
9142 : see if sys/types.h has to be included
9143 set sys/types.h i_systypes
9144 eval $inhdr
9145
9146 : see if sys/select.h has to be included
9147 set sys/select.h i_sysselct
9148 eval $inhdr
9149
9150 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9151 while $test $# -ge 2; do
9152         case "$1" in
9153         $define) echo "#include <$2>";;
9154         esac ;
9155     shift 2;
9156 done > try.c;
9157 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9158 set try;
9159 if eval $compile; then
9160         val="$define";
9161 else
9162         val="$undef";
9163 fi;
9164 set $varname;
9165 eval $setvar;
9166 $rm -f try.c try.o'
9167
9168 : see if we should include time.h, sys/time.h, or both
9169 echo " "
9170 if test "X$timeincl" = X; then
9171         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9172         $echo $n "I'm now running the test program...$c"
9173         $cat >try.c <<'EOCP'
9174 #include <sys/types.h>
9175 #ifdef I_TIME
9176 #include <time.h>
9177 #endif
9178 #ifdef I_SYSTIME
9179 #ifdef SYSTIMEKERNEL
9180 #define KERNEL
9181 #endif
9182 #include <sys/time.h>
9183 #endif
9184 #ifdef I_SYSSELECT
9185 #include <sys/select.h>
9186 #endif
9187 int main()
9188 {
9189         struct tm foo;
9190 #ifdef S_TIMEVAL
9191         struct timeval bar;
9192 #endif
9193 #ifdef S_TIMEZONE
9194         struct timezone tzp;
9195 #endif
9196         if (foo.tm_sec == foo.tm_sec)
9197                 exit(0);
9198 #ifdef S_TIMEVAL
9199         if (bar.tv_sec == bar.tv_sec)
9200                 exit(0);
9201 #endif
9202         exit(1);
9203 }
9204 EOCP
9205         flags=''
9206         for s_timezone in '-DS_TIMEZONE' ''; do
9207         sysselect=''
9208         for s_timeval in '-DS_TIMEVAL' ''; do
9209         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9210         for i_time in '' '-DI_TIME'; do
9211         for i_systime in '-DI_SYSTIME' ''; do
9212                 case "$flags" in
9213                 '') $echo $n ".$c"
9214                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9215                         if eval $compile; then
9216                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9217                                 shift
9218                                 flags="$*"
9219                                 echo " "
9220                                 $echo $n "Succeeded with $flags$c"
9221                         fi
9222                         ;;
9223                 esac
9224         done
9225         done
9226         done
9227         done
9228         done
9229         timeincl=''
9230         echo " "
9231         case "$flags" in
9232         *SYSTIMEKERNEL*) i_systimek="$define"
9233                 timeincl=`./findhdr sys/time.h`
9234                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9235         *) i_systimek="$undef";;
9236         esac
9237         case "$flags" in
9238         *I_TIME*) i_time="$define"
9239                 timeincl=`./findhdr time.h`" $timeincl"
9240                 echo "We'll include <time.h>." >&4;;
9241         *) i_time="$undef";;
9242         esac
9243         case "$flags" in
9244         *I_SYSTIME*) i_systime="$define"
9245                 timeincl=`./findhdr sys/time.h`" $timeincl"
9246                 echo "We'll include <sys/time.h>." >&4;;
9247         *) i_systime="$undef";;
9248         esac
9249         $rm -f try.c try
9250 fi
9251 : see if struct tm knows about tm_zone
9252 case "$i_systime$i_time" in
9253 *$define*) 
9254         echo " "
9255         echo "Checking to see if your struct tm has tm_zone field..." >&4
9256         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9257         eval $hasfield
9258         ;;
9259 *)      val="$undef"
9260         set d_tm_tm_zone
9261         eval $setvar
9262         ;;
9263 esac
9264 case "$d_tm_tm_zone" in
9265 "$define")      echo "Yes, it does."   ;;
9266 *)              echo "No, it doesn't." ;;
9267 esac
9268 : see if struct tm knows about tm_gmtoff
9269 case "$i_systime$i_time" in
9270 *$define*) 
9271         echo " "
9272         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9273         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9274         eval $hasfield
9275         ;;
9276 *)      val="$undef"
9277         set d_tm_tm_gmtoff
9278         eval $setvar
9279         ;;
9280 esac
9281 case "$d_tm_tm_gmtoff" in
9282 "$define")      echo "Yes, it does."   ;;
9283 *)              echo "No, it doesn't." ;;
9284 esac
9285
9286 : see if asctime_r exists
9287 set asctime_r d_asctime_r
9288 eval $inlibc
9289 case "$d_asctime_r" in
9290 "$define")
9291         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9292         case "$d_asctime_r_proto:$usethreads" in
9293         ":define")      d_asctime_r_proto=define
9294                 set d_asctime_r_proto asctime_r $hdrs
9295                 eval $hasproto ;;
9296         *)      ;;
9297         esac
9298         case "$d_asctime_r_proto" in
9299         define)
9300         case "$asctime_r_proto" in
9301         ''|0) try='char* asctime_r(const struct tm*, char*);'
9302         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9303         esac
9304         case "$asctime_r_proto" in
9305         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9306         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9307         esac
9308         case "$asctime_r_proto" in
9309         ''|0) try='int asctime_r(const struct tm*, char*);'
9310         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9311         esac
9312         case "$asctime_r_proto" in
9313         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9314         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9315         esac
9316         case "$asctime_r_proto" in
9317         ''|0)   d_asctime_r=undef
9318                 asctime_r_proto=0
9319                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9320         * )     case "$asctime_r_proto" in
9321                 REENTRANT_PROTO*) ;;
9322                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9323                 esac
9324                 echo "Prototype: $try" ;;
9325         esac
9326         ;;
9327         *)      case "$usethreads" in
9328                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9329                 esac
9330                 d_asctime_r=undef
9331                 asctime_r_proto=0
9332                 ;;
9333         esac
9334         ;;
9335 *)      asctime_r_proto=0
9336         ;;
9337 esac
9338
9339 : see if atolf exists
9340 set atolf d_atolf
9341 eval $inlibc
9342
9343 : see if atoll exists
9344 set atoll d_atoll
9345 eval $inlibc
9346
9347 : Look for GNU-cc style attribute checking
9348 echo " "
9349 echo "Checking whether your compiler can handle __attribute__ ..." >&4
9350 $cat >attrib.c <<'EOCP'
9351 #include <stdio.h>
9352 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
9353 EOCP
9354 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9355         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9356                 echo "Your C compiler doesn't fully support __attribute__."
9357                 val="$undef"
9358         else
9359                 echo "Your C compiler supports __attribute__."
9360                 val="$define"
9361         fi
9362 else
9363         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9364         val="$undef"
9365 fi
9366 set d_attribut
9367 eval $setvar
9368 $rm -f attrib*
9369
9370 : see if bcmp exists
9371 set bcmp d_bcmp
9372 eval $inlibc
9373
9374 : see if bcopy exists
9375 set bcopy d_bcopy
9376 eval $inlibc
9377
9378 : see if this is a unistd.h system
9379 set unistd.h i_unistd
9380 eval $inhdr
9381
9382 : see if getpgrp exists
9383 set getpgrp d_getpgrp
9384 eval $inlibc
9385
9386 case "$d_getpgrp" in
9387 "$define")
9388         echo " "
9389         echo "Checking to see which flavor of getpgrp is in use..."
9390         $cat >try.c <<EOP
9391 #$i_unistd I_UNISTD
9392 #include <sys/types.h>
9393 #ifdef I_UNISTD
9394 #  include <unistd.h>
9395 #endif
9396 int main()
9397 {
9398         if (getuid() == 0) {
9399                 printf("(I see you are running Configure as super-user...)\n");
9400                 setuid(1);
9401         }
9402 #ifdef TRY_BSD_PGRP
9403         if (getpgrp(1) == 0)
9404                 exit(0);
9405 #else
9406         if (getpgrp() > 0)
9407                 exit(0);
9408 #endif
9409         exit(1);
9410 }
9411 EOP
9412         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9413                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
9414                 val="$define"
9415         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9416                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
9417                 val="$undef"
9418         else
9419                 echo "I can't seem to compile and run the test program."
9420                 if ./usg; then
9421                         xxx="a USG one, i.e. you use getpgrp()."
9422                 else
9423                         # SVR4 systems can appear rather BSD-ish.
9424                         case "$i_unistd" in
9425                         $undef)
9426                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
9427                                 val="$define"
9428                                 ;;
9429                         $define)
9430                                 xxx="probably a USG one, i.e. you use getpgrp()."
9431                                 val="$undef"
9432                                 ;;
9433                         esac
9434                 fi
9435                 echo "Assuming your getpgrp is $xxx" >&4
9436         fi
9437         ;;
9438 *) val="$undef";;
9439 esac
9440 set d_bsdgetpgrp
9441 eval $setvar
9442 $rm -f try try.*
9443
9444 : see if setpgrp exists
9445 set setpgrp d_setpgrp
9446 eval $inlibc
9447
9448 case "$d_setpgrp" in
9449 "$define")
9450         echo " "
9451         echo "Checking to see which flavor of setpgrp is in use..."
9452         $cat >try.c <<EOP
9453 #$i_unistd I_UNISTD
9454 #include <sys/types.h>
9455 #ifdef I_UNISTD
9456 #  include <unistd.h>
9457 #endif
9458 int main()
9459 {
9460         if (getuid() == 0) {
9461                 printf("(I see you are running Configure as super-user...)\n");
9462                 setuid(1);
9463         }
9464 #ifdef TRY_BSD_PGRP
9465         if (-1 == setpgrp(1, 1))
9466                 exit(0);
9467 #else
9468         if (setpgrp() != -1)
9469                 exit(0);
9470 #endif
9471         exit(1);
9472 }
9473 EOP
9474         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9475                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
9476                 val="$define"
9477         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9478                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
9479                 val="$undef"
9480         else
9481                 echo "(I can't seem to compile and run the test program.)"
9482                 if ./usg; then
9483                         xxx="a USG one, i.e. you use setpgrp()."
9484                 else
9485                         # SVR4 systems can appear rather BSD-ish.
9486                         case "$i_unistd" in
9487                         $undef)
9488                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
9489                                 val="$define"
9490                                 ;;
9491                         $define)
9492                                 xxx="probably a USG one, i.e. you use setpgrp()."
9493                                 val="$undef"
9494                                 ;;
9495                         esac
9496                 fi
9497                 echo "Assuming your setpgrp is $xxx" >&4
9498         fi
9499         ;;
9500 *) val="$undef";;
9501 esac
9502 set d_bsdsetpgrp
9503 eval $setvar
9504 $rm -f try try.*
9505 : see if bzero exists
9506 set bzero d_bzero
9507 eval $inlibc
9508
9509 : see if signal is declared as pointer to function returning int or void
9510 echo " "
9511 xxx=`./findhdr signal.h`
9512 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
9513 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
9514         echo "You have int (*signal())() instead of void." >&4
9515         val="$undef"
9516 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
9517         echo "You have void (*signal())()." >&4
9518         val="$define"
9519 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
9520         echo "You have int (*signal())() instead of void." >&4
9521         val="$undef"
9522 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
9523         echo "You have void (*signal())()." >&4
9524         val="$define"
9525 else
9526         case "$d_voidsig" in
9527         '')
9528         echo "I can't determine whether signal handler returns void or int..." >&4
9529                 dflt=void
9530                 rp="What type does your signal handler return?"
9531                 . ./myread
9532                 case "$ans" in
9533                 v*) val="$define";;
9534                 *) val="$undef";;
9535                 esac;;
9536         "$define")
9537                 echo "As you already told me, signal handler returns void." >&4
9538                 val="$define"
9539                 ;;
9540         *)      echo "As you already told me, signal handler returns int." >&4
9541                 val="$undef"
9542                 ;;
9543         esac
9544 fi
9545 set d_voidsig
9546 eval $setvar
9547 case "$d_voidsig" in
9548 "$define") signal_t="void";;
9549 *) signal_t="int";;
9550 esac
9551 $rm -f $$.tmp
9552
9553 : check for ability to cast large floats to 32-bit ints.
9554 echo " "
9555 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
9556 if $test "$intsize" -ge 4; then
9557         xxx=int
9558 else
9559         xxx=long
9560 fi
9561 $cat >try.c <<EOCP
9562 #include <stdio.h>
9563 #include <sys/types.h>
9564 #include <signal.h>
9565 $signal_t blech(s) int s; { exit(3); }
9566 int main()
9567 {
9568         $xxx i32;
9569         double f, g;
9570         int result = 0;
9571         char str[16];
9572         signal(SIGFPE, blech);
9573
9574         /* Don't let compiler optimize the test away.  Store the number 
9575            in a writable string for gcc to pass to sscanf under HP/UX.
9576         */
9577         sprintf(str, "2147483647");
9578         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
9579         g = 10 * f;
9580         i32  = ($xxx) g;
9581
9582         /* x86 processors will probably give 0x8000 0000, which is a
9583        sign change.  We don't want that.  We want to mimic SPARC
9584            behavior here, which is to preserve the sign and give
9585            back 0x7fff ffff.
9586         */
9587         if (i32 != ($xxx) f)
9588                 result |= 1;
9589         exit(result);
9590 }
9591 EOCP
9592 set try
9593 if eval $compile_ok; then
9594         $run ./try
9595         yyy=$?
9596 else
9597         echo "(I can't seem to compile the test program--assuming it can't)"
9598         yyy=1
9599 fi
9600 case "$yyy" in
9601 0)      val="$define"
9602         echo "Yup, it can."
9603         ;;
9604 *)      val="$undef"
9605         echo "Nope, it can't."
9606         ;;
9607 esac
9608 set d_casti32
9609 eval $setvar
9610 $rm -f try try.*
9611
9612 : check for ability to cast negative floats to unsigned
9613 echo " "
9614 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
9615 $cat >try.c <<EOCP
9616 #include <stdio.h>
9617 #include <sys/types.h>
9618 #include <signal.h>
9619 $signal_t blech(s) int s; { exit(7); }
9620 $signal_t blech_in_list(s) int s; { exit(4); }
9621 unsigned long dummy_long(p) unsigned long p; { return p; }
9622 unsigned int dummy_int(p) unsigned int p; { return p; }
9623 unsigned short dummy_short(p) unsigned short p; { return p; }
9624 int main()
9625 {
9626         double f;
9627         unsigned long along;
9628         unsigned int aint;
9629         unsigned short ashort;
9630         int result = 0;
9631         char str[16];
9632         
9633         /* Frustrate gcc-2.7.2's optimizer which failed this test with
9634            a direct f = -123. assignment.  gcc-2.8.0 reportedly
9635            optimized the whole file away
9636         */
9637         /* Store the number in a writable string for gcc to pass to 
9638            sscanf under HP/UX.
9639         */
9640         sprintf(str, "-123");
9641         sscanf(str, "%lf", &f);  /* f = -123.; */
9642
9643         signal(SIGFPE, blech);
9644         along = (unsigned long)f;
9645         aint = (unsigned int)f;
9646         ashort = (unsigned short)f;
9647         if (along != (unsigned long)-123)
9648                 result |= 1;
9649         if (aint != (unsigned int)-123)
9650                 result |= 1;
9651         if (ashort != (unsigned short)-123)
9652                 result |= 1;
9653         sprintf(str, "1073741824.");
9654         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
9655         f = f + f;
9656         along = 0;
9657         along = (unsigned long)f;
9658         if (along != 0x80000000)
9659                 result |= 2;
9660         f -= 1.;
9661         along = 0;
9662         along = (unsigned long)f;
9663         if (along != 0x7fffffff)
9664                 result |= 1;
9665         f += 2.;
9666         along = 0;
9667         along = (unsigned long)f;
9668         if (along != 0x80000001)
9669                 result |= 2;
9670         if (result)
9671                 exit(result);
9672         signal(SIGFPE, blech_in_list);
9673         sprintf(str, "123.");
9674         sscanf(str, "%lf", &f);  /* f = 123.; */
9675         along = dummy_long((unsigned long)f);
9676         aint = dummy_int((unsigned int)f);
9677         ashort = dummy_short((unsigned short)f);
9678         if (along != (unsigned long)123)
9679                 result |= 4;
9680         if (aint != (unsigned int)123)
9681                 result |= 4;
9682         if (ashort != (unsigned short)123)
9683                 result |= 4;
9684         exit(result);
9685
9686 }
9687 EOCP
9688 set try
9689 if eval $compile_ok; then
9690         $run ./try
9691         castflags=$?
9692 else
9693         echo "(I can't seem to compile the test program--assuming it can't)"
9694         castflags=7
9695 fi
9696 case "$castflags" in
9697 0)      val="$define"
9698         echo "Yup, it can."
9699         ;;
9700 *)      val="$undef"
9701         echo "Nope, it can't."
9702         ;;
9703 esac
9704 set d_castneg
9705 eval $setvar
9706 $rm -f try.*
9707
9708 : see if vprintf exists
9709 echo " "
9710 if set vprintf val -f d_vprintf; eval $csym; $val; then
9711         echo 'vprintf() found.' >&4
9712         val="$define"
9713         $cat >try.c <<'EOF'
9714 #include <varargs.h>
9715
9716 int main() { xxx("foo"); }
9717
9718 xxx(va_alist)
9719 va_dcl
9720 {
9721         va_list args;
9722         char buf[10];
9723
9724         va_start(args);
9725         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
9726 }
9727 EOF
9728         set try
9729         if eval $compile && $run ./try; then
9730                 echo "Your vsprintf() returns (int)." >&4
9731                 val2="$undef"
9732         else
9733                 echo "Your vsprintf() returns (char*)." >&4
9734                 val2="$define"
9735         fi
9736 else
9737         echo 'vprintf() NOT found.' >&4
9738                 val="$undef"
9739                 val2="$undef"
9740 fi
9741 $rm -f try try.*
9742 set d_vprintf
9743 eval $setvar
9744 val=$val2
9745 set d_charvspr
9746 eval $setvar
9747
9748 : see if chown exists
9749 set chown d_chown
9750 eval $inlibc
9751
9752 : see if chroot exists
9753 set chroot d_chroot
9754 eval $inlibc
9755
9756 : see if chsize exists
9757 set chsize d_chsize
9758 eval $inlibc
9759
9760 : see if class exists
9761 set class d_class
9762 eval $inlibc
9763
9764 hasstruct='varname=$1; struct=$2; shift; shift;
9765 while $test $# -ge 2; do
9766         case "$1" in
9767         $define) echo "#include <$2>";;
9768         esac ;
9769     shift 2;
9770 done > try.c;
9771 echo "int main () { struct $struct foo; }" >> try.c;
9772 set try;
9773 if eval $compile; then
9774         val="$define";
9775 else
9776         val="$undef";
9777 fi;
9778 set $varname;
9779 eval $setvar;
9780 $rm -f try.c try.o'
9781
9782 socketlib=''
9783 sockethdr=''
9784 : see whether socket exists
9785 echo " "
9786 $echo $n "Hmm... $c" >&4
9787 if set socket val -f d_socket; eval $csym; $val; then
9788         echo "Looks like you have Berkeley networking support." >&4
9789         d_socket="$define"
9790         if set setsockopt val -f; eval $csym; $val; then
9791                 d_oldsock="$undef"
9792         else
9793                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9794                 d_oldsock="$define"
9795         fi
9796 else
9797         if $contains socklib libc.list >/dev/null 2>&1; then
9798                 echo "Looks like you have Berkeley networking support." >&4
9799                 d_socket="$define"
9800                 : we will have to assume that it supports the 4.2 BSD interface
9801                 d_oldsock="$undef"
9802         else
9803                 echo "You don't have Berkeley networking in libc$_a..." >&4
9804                 if test "X$d_socket" = "X$define"; then
9805                    echo "...but you seem to believe that you have sockets." >&4
9806                 else
9807                         for net in net socket
9808                         do
9809                                 if test -f /usr/lib/lib$net$_a; then
9810                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9811                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9812                                         if $contains socket libc.list >/dev/null 2>&1; then
9813                                                 d_socket="$define"
9814                                                 socketlib="-l$net"
9815                                                 case "$net" in
9816                                                 net)
9817                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9818                                                         sockethdr="-I/usr/netinclude"
9819                                                         ;;
9820                                                 esac
9821                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
9822                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9823                                                         d_oldsock="$undef"
9824                                                 else
9825                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9826                                                         d_oldsock="$define"
9827                                                 fi
9828                                                 break
9829                                         fi
9830                                 fi
9831                         done
9832                         if test "X$d_socket" != "X$define"; then
9833                            echo "or anywhere else I see." >&4
9834                            d_socket="$undef"
9835                            d_oldsock="$undef"
9836                         fi
9837                 fi
9838         fi
9839 fi
9840
9841 : see if socketpair exists
9842 set socketpair d_sockpair
9843 eval $inlibc
9844
9845
9846 echo " "
9847 echo "Checking the availability of certain socket constants..." >&4
9848 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9849         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9850         $cat >try.c <<EOF
9851 #include <sys/types.h>
9852 #include <sys/socket.h>
9853 int main() {
9854     int i = $ENUM;
9855 }
9856 EOF
9857         val="$undef"
9858         set try; if eval $compile; then
9859                 val="$define"
9860         fi
9861         set d_${enum}; eval $setvar
9862         $rm -f try.c try
9863 done
9864
9865 : see if this is a sys/uio.h system
9866 set sys/uio.h i_sysuio
9867 eval $inhdr
9868
9869
9870 echo " "
9871 echo "Checking to see if your system supports struct cmsghdr..." >&4
9872 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
9873 eval $hasstruct
9874 case "$d_cmsghdr_s" in
9875 "$define")      echo "Yes, it does."   ;;
9876 *)              echo "No, it doesn't." ;;
9877 esac
9878
9879
9880 : check for const keyword
9881 echo " "
9882 echo 'Checking to see if your C compiler knows about "const"...' >&4
9883 $cat >const.c <<'EOCP'
9884 typedef struct spug { int drokk; } spug;
9885 int main()
9886 {
9887         const char *foo;
9888         const spug y;
9889 }
9890 EOCP
9891 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
9892         val="$define"
9893         echo "Yup, it does."
9894 else
9895         val="$undef"
9896         echo "Nope, it doesn't."
9897 fi
9898 set d_const
9899 eval $setvar
9900
9901 : see if crypt exists
9902 echo " "
9903 set crypt d_crypt
9904 eval $inlibc
9905 case "$d_crypt" in
9906 $define) cryptlib='' ;;
9907 *)      if set crypt val -f d_crypt; eval $csym; $val; then
9908                 echo 'crypt() found.' >&4
9909                 val="$define"
9910                 cryptlib=''
9911         else
9912                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
9913                 if $test -z "$cryptlib"; then
9914                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
9915                 else
9916                         cryptlib=-lcrypt
9917                 fi
9918                 if $test -z "$cryptlib"; then
9919                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
9920                 else
9921                         cryptlib=-lcrypt
9922                 fi
9923                 if $test -z "$cryptlib"; then
9924                         cryptlib=`./loc libcrypt$_a "" $libpth`
9925                 else
9926                         cryptlib=-lcrypt
9927                 fi
9928                 if $test -z "$cryptlib"; then
9929                         echo 'crypt() NOT found.' >&4
9930                         val="$undef"
9931                 else
9932                         val="$define"
9933                 fi
9934         fi
9935         set d_crypt
9936         eval $setvar
9937         ;;
9938 esac
9939
9940 : see if this is a crypt.h system
9941 set crypt.h i_crypt
9942 eval $inhdr
9943
9944 : see if crypt_r exists
9945 set crypt_r d_crypt_r
9946 eval $inlibc
9947 case "$d_crypt_r" in
9948 "$define")
9949         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
9950         case "$d_crypt_r_proto:$usethreads" in
9951         ":define")      d_crypt_r_proto=define
9952                 set d_crypt_r_proto crypt_r $hdrs
9953                 eval $hasproto ;;
9954         *)      ;;
9955         esac
9956         case "$d_crypt_r_proto" in
9957         define)
9958         case "$crypt_r_proto" in
9959         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
9960         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
9961         esac
9962         case "$crypt_r_proto" in
9963         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
9964         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
9965         esac
9966         case "$crypt_r_proto" in
9967         ''|0)   d_crypt_r=undef
9968                 crypt_r_proto=0
9969                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
9970         * )     case "$crypt_r_proto" in
9971                 REENTRANT_PROTO*) ;;
9972                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
9973                 esac
9974                 echo "Prototype: $try" ;;
9975         esac
9976         ;;
9977         *)      case "$usethreads" in
9978                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
9979                 esac
9980                 d_crypt_r=undef
9981                 crypt_r_proto=0
9982                 ;;
9983         esac
9984         ;;
9985 *)      crypt_r_proto=0
9986         ;;
9987 esac
9988
9989 : get csh whereabouts
9990 case "$csh" in
9991 'csh') val="$undef" ;;
9992 *) val="$define" ;;
9993 esac
9994 set d_csh
9995 eval $setvar
9996 : Respect a hint or command line value for full_csh.
9997 case "$full_csh" in
9998 '') full_csh=$csh ;;
9999 esac
10000
10001 : see if ctermid_r exists
10002 set ctermid_r d_ctermid_r
10003 eval $inlibc
10004 case "$d_ctermid_r" in
10005 "$define")
10006         hdrs="$i_systypes sys/types.h define stdio.h "
10007         case "$d_ctermid_r_proto:$usethreads" in
10008         ":define")      d_ctermid_r_proto=define
10009                 set d_ctermid_r_proto ctermid_r $hdrs
10010                 eval $hasproto ;;
10011         *)      ;;
10012         esac
10013         case "$d_ctermid_r_proto" in
10014         define)
10015         case "$ctermid_r_proto" in
10016         ''|0) try='char* ctermid_r(char*);'
10017         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10018         esac
10019         case "$ctermid_r_proto" in
10020         ''|0)   d_ctermid_r=undef
10021                 ctermid_r_proto=0
10022                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10023         * )     case "$ctermid_r_proto" in
10024                 REENTRANT_PROTO*) ;;
10025                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10026                 esac
10027                 echo "Prototype: $try" ;;
10028         esac
10029         ;;
10030         *)      case "$usethreads" in
10031                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10032                 esac
10033                 d_ctermid_r=undef
10034                 ctermid_r_proto=0
10035                 ;;
10036         esac
10037         ;;
10038 *)      ctermid_r_proto=0
10039         ;;
10040 esac
10041
10042 : see if ctime_r exists
10043 set ctime_r d_ctime_r
10044 eval $inlibc
10045 case "$d_ctime_r" in
10046 "$define")
10047         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10048         case "$d_ctime_r_proto:$usethreads" in
10049         ":define")      d_ctime_r_proto=define
10050                 set d_ctime_r_proto ctime_r $hdrs
10051                 eval $hasproto ;;
10052         *)      ;;
10053         esac
10054         case "$d_ctime_r_proto" in
10055         define)
10056         case "$ctime_r_proto" in
10057         ''|0) try='char* ctime_r(const time_t*, char*);'
10058         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10059         esac
10060         case "$ctime_r_proto" in
10061         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10062         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10063         esac
10064         case "$ctime_r_proto" in
10065         ''|0) try='int ctime_r(const time_t*, char*);'
10066         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10067         esac
10068         case "$ctime_r_proto" in
10069         ''|0) try='int ctime_r(const time_t*, char*, int);'
10070         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10071         esac
10072         case "$ctime_r_proto" in
10073         ''|0)   d_ctime_r=undef
10074                 ctime_r_proto=0
10075                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10076         * )     case "$ctime_r_proto" in
10077                 REENTRANT_PROTO*) ;;
10078                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10079                 esac
10080                 echo "Prototype: $try" ;;
10081         esac
10082         ;;
10083         *)      case "$usethreads" in
10084                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10085                 esac
10086                 d_ctime_r=undef
10087                 ctime_r_proto=0
10088                 ;;
10089         esac
10090         ;;
10091 *)      ctime_r_proto=0
10092         ;;
10093 esac
10094
10095 : see if cuserid exists
10096 set cuserid d_cuserid
10097 eval $inlibc
10098
10099 : see if this is a limits.h system
10100 set limits.h i_limits
10101 eval $inhdr
10102
10103 : see if this is a float.h system
10104 set float.h i_float
10105 eval $inhdr
10106
10107 : See if number of significant digits in a double precision number is known
10108 echo " "
10109 $cat >dbl_dig.c <<EOM
10110 #$i_limits I_LIMITS
10111 #$i_float I_FLOAT
10112 #ifdef I_LIMITS
10113 #include <limits.h>
10114 #endif
10115 #ifdef I_FLOAT
10116 #include <float.h>
10117 #endif
10118 #ifdef DBL_DIG
10119 printf("Contains DBL_DIG");
10120 #endif
10121 EOM
10122 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10123 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10124         echo "DBL_DIG found." >&4
10125         val="$define"
10126 else
10127         echo "DBL_DIG NOT found." >&4
10128         val="$undef"
10129 fi
10130 $rm -f dbl_dig.?
10131 set d_dbl_dig
10132 eval $setvar
10133
10134 : see if dbm.h is available
10135 : see if dbmclose exists
10136 set dbmclose d_dbmclose
10137 eval $inlibc
10138
10139 case "$d_dbmclose" in
10140 $define)
10141         set dbm.h i_dbm
10142         eval $inhdr
10143         case "$i_dbm" in
10144         $define)
10145                 val="$undef"
10146                 set i_rpcsvcdbm
10147                 eval $setvar
10148                 ;;
10149         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10150                 eval $inhdr
10151                 ;;
10152         esac
10153         ;;
10154 *)      echo "We won't be including <dbm.h>"
10155         val="$undef"
10156         set i_dbm
10157         eval $setvar
10158         val="$undef"
10159         set i_rpcsvcdbm
10160         eval $setvar
10161         ;;
10162 esac
10163
10164 : see if prototype for dbminit is available
10165 echo " "
10166 set d_dbminitproto dbminit $i_dbm dbm.h
10167 eval $hasproto
10168
10169 : see if difftime exists
10170 set difftime d_difftime
10171 eval $inlibc
10172
10173 : see if this is a dirent system
10174 echo " "
10175 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10176         val="$define"
10177         echo "<dirent.h> found." >&4
10178 else
10179         val="$undef"
10180         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10181                 echo "<sys/dir.h> found." >&4
10182                 echo " "
10183         else
10184                 xinc=`./findhdr sys/ndir.h`
10185         fi
10186         echo "<dirent.h> NOT found." >&4
10187 fi
10188 set i_dirent
10189 eval $setvar
10190
10191 : Look for type of directory structure.
10192 echo " "
10193 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10194
10195 case "$direntrytype" in
10196 ''|' ')
10197         case "$i_dirent" in
10198         $define) guess1='struct dirent' ;;
10199         *) guess1='struct direct'  ;;
10200         esac
10201         ;;
10202 *)      guess1="$direntrytype"
10203         ;;
10204 esac
10205
10206 case "$guess1" in
10207 'struct dirent') guess2='struct direct' ;;
10208 *) guess2='struct dirent' ;;
10209 esac
10210                 
10211 if $contains "$guess1" try.c >/dev/null 2>&1; then
10212         direntrytype="$guess1"
10213         echo "Your directory entries are $direntrytype." >&4
10214 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10215         direntrytype="$guess2"
10216         echo "Your directory entries seem to be $direntrytype." >&4
10217 else
10218         echo "I don't recognize your system's directory entries." >&4
10219         rp="What type is used for directory entries on this system?"
10220         dflt="$guess1"
10221         . ./myread
10222         direntrytype="$ans"
10223 fi
10224 $rm -f try.c
10225
10226
10227 : see if the directory entry stores field length
10228 echo " "
10229 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10230 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10231         echo "Good, your directory entry keeps length information in d_namlen." >&4
10232         val="$define"
10233 else
10234         echo "Your directory entry does not know about the d_namlen field." >&4
10235         val="$undef"
10236 fi
10237 set d_dirnamlen
10238 eval $setvar
10239 $rm -f try.c
10240
10241 : see if this is an sysdir system
10242 set sys/dir.h i_sysdir
10243 eval $inhdr
10244
10245 : see if this is an sysndir system
10246 set sys/ndir.h i_sysndir
10247 eval $inhdr
10248
10249 : Look for dirfd
10250 echo " "
10251 $cat >dirfd.c <<EOM
10252 #include <stdio.h>
10253 #$i_dirent I_DIRENT             /**/
10254 #$i_sysdir I_SYS_DIR            /**/
10255 #$i_sysndir I_SYS_NDIR          /**/
10256 #$i_systypes I_SYS_TYPES        /**/
10257 #if defined(I_SYS_TYPES)
10258 #include <sys/types.h>
10259 #endif
10260 #if defined(I_DIRENT)
10261 #include <dirent.h>
10262 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10263 #include <sys/dir.h>
10264 #endif
10265 #else
10266 #ifdef I_SYS_NDIR
10267 #include <sys/ndir.h>
10268 #else
10269 #ifdef I_SYS_DIR
10270 #ifdef hp9000s500
10271 #include <ndir.h>       /* may be wrong in the future */
10272 #else
10273 #include <sys/dir.h>
10274 #endif
10275 #endif
10276 #endif
10277 #endif 
10278 int main() {
10279         DIR *dirp = opendir(".");
10280         if (dirfd(dirp) >= 0)
10281                 exit(0);
10282         else
10283                 exit(1);
10284 }
10285 EOM
10286 set dirfd
10287 if eval $compile; then
10288         val="$define"
10289 fi
10290 case "$val" in
10291 $define)        echo "dirfd() found." >&4       ;;
10292 *)              echo "dirfd() NOT found." >&4   ;;
10293 esac
10294 set d_dirfd
10295 eval $setvar
10296 $rm -f dirfd*
10297
10298 : see if dlerror exists
10299 xxx_runnm="$runnm"
10300 runnm=false
10301 set dlerror d_dlerror
10302 eval $inlibc
10303 runnm="$xxx_runnm"
10304
10305 : see if dlfcn is available
10306 set dlfcn.h i_dlfcn
10307 eval $inhdr
10308
10309 case "$usedl" in
10310 $define|y|true)
10311         $cat << EOM
10312
10313 On a few systems, the dynamically loaded modules that perl generates and uses
10314 will need a different extension than shared libs. The default will probably
10315 be appropriate.
10316
10317 EOM
10318         case "$dlext" in
10319         '')     dflt="$so" ;;
10320         *)      dflt="$dlext" ;;
10321         esac
10322         rp='What is the extension of dynamically loaded modules'
10323         . ./myread
10324         dlext="$ans"
10325         ;;
10326 *)
10327         dlext="none"
10328         ;;
10329 esac
10330
10331 : Check if dlsym need a leading underscore
10332 echo " "
10333 val="$undef"
10334
10335 case "$dlsrc" in
10336 dl_dlopen.xs)
10337         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
10338         $cat >dyna.c <<'EOM'
10339 fred () { }
10340 EOM
10341
10342 $cat >fred.c<<EOM
10343
10344 #include <stdio.h>
10345 #$i_dlfcn I_DLFCN
10346 #ifdef I_DLFCN
10347 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
10348 #else
10349 #include <sys/types.h>
10350 #include <nlist.h>
10351 #include <link.h>
10352 #endif
10353
10354 extern int fred() ;
10355
10356 int main()
10357 {
10358     void * handle ;
10359     void * symbol ;
10360 #ifndef RTLD_LAZY
10361     int mode = 1 ;
10362 #else
10363     int mode = RTLD_LAZY ;
10364 #endif
10365     handle = dlopen("./dyna.$dlext", mode) ;
10366     if (handle == NULL) {
10367         printf ("1\n") ;
10368         fflush (stdout) ;
10369         exit(0);
10370     }
10371     symbol = dlsym(handle, "fred") ;
10372     if (symbol == NULL) {
10373         /* try putting a leading underscore */
10374         symbol = dlsym(handle, "_fred") ;
10375         if (symbol == NULL) {
10376             printf ("2\n") ;
10377             fflush (stdout) ;
10378             exit(0);
10379         }
10380         printf ("3\n") ;
10381     }
10382     else
10383         printf ("4\n") ;
10384     fflush (stdout) ;
10385     exit(0);
10386 }
10387 EOM
10388         : Call the object file tmp-dyna.o in case dlext=o.
10389         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
10390                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
10391                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
10392                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
10393                 xxx=`$run ./fred`
10394                 case $xxx in
10395                 1)      echo "Test program failed using dlopen." >&4
10396                         echo "Perhaps you should not use dynamic loading." >&4;;
10397                 2)      echo "Test program failed using dlsym." >&4
10398                         echo "Perhaps you should not use dynamic loading." >&4;;
10399                 3)      echo "dlsym needs a leading underscore" >&4
10400                         val="$define" ;;
10401                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
10402                 esac
10403         else
10404                 echo "I can't compile and run the test program." >&4
10405                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
10406         fi
10407         ;;
10408 esac
10409                 
10410 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
10411
10412 set d_dlsymun
10413 eval $setvar
10414
10415 : see if drand48_r exists
10416 set drand48_r d_drand48_r
10417 eval $inlibc
10418 case "$d_drand48_r" in
10419 "$define")
10420         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
10421         case "$d_drand48_r_proto:$usethreads" in
10422         ":define")      d_drand48_r_proto=define
10423                 set d_drand48_r_proto drand48_r $hdrs
10424                 eval $hasproto ;;
10425         *)      ;;
10426         esac
10427         case "$d_drand48_r_proto" in
10428         define)
10429         case "$drand48_r_proto" in
10430         ''|0) try='int drand48_r(struct drand48_data*, double*);'
10431         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
10432         esac
10433         case "$drand48_r_proto" in
10434         ''|0)   d_drand48_r=undef
10435                 drand48_r_proto=0
10436                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10437         * )     case "$drand48_r_proto" in
10438                 REENTRANT_PROTO*) ;;
10439                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
10440                 esac
10441                 echo "Prototype: $try" ;;
10442         esac
10443         ;;
10444         *)      case "$usethreads" in
10445                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
10446                 esac
10447                 d_drand48_r=undef
10448                 drand48_r_proto=0
10449                 ;;
10450         esac
10451         ;;
10452 *)      drand48_r_proto=0
10453         ;;
10454 esac
10455
10456 : see if prototype for drand48 is available
10457 echo " "
10458 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
10459 eval $hasproto
10460
10461 : see if dup2 exists
10462 set dup2 d_dup2
10463 eval $inlibc
10464
10465 : see if eaccess exists
10466 set eaccess d_eaccess
10467 eval $inlibc
10468
10469 : see if endgrent exists
10470 set endgrent d_endgrent
10471 eval $inlibc
10472
10473 : see if this is an grp system
10474 set grp.h i_grp
10475 eval $inhdr
10476
10477 case "$i_grp" in
10478 $define)
10479         xxx=`./findhdr grp.h`
10480         $cppstdin $cppflags $cppminus < $xxx >$$.h
10481
10482         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10483                 val="$define"
10484         else
10485                 val="$undef"
10486         fi
10487         set d_grpasswd
10488         eval $setvar
10489
10490         $rm -f $$.h
10491         ;;
10492 *)
10493         val="$undef";
10494         set d_grpasswd; eval $setvar
10495         ;;
10496 esac
10497
10498 : see if endgrent_r exists
10499 set endgrent_r d_endgrent_r
10500 eval $inlibc
10501 case "$d_endgrent_r" in
10502 "$define")
10503         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
10504         case "$d_endgrent_r_proto:$usethreads" in
10505         ":define")      d_endgrent_r_proto=define
10506                 set d_endgrent_r_proto endgrent_r $hdrs
10507                 eval $hasproto ;;
10508         *)      ;;
10509         esac
10510         case "$d_endgrent_r_proto" in
10511         define)
10512         case "$endgrent_r_proto" in
10513         ''|0) try='int endgrent_r(FILE**);'
10514         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
10515         esac
10516         case "$endgrent_r_proto" in
10517         ''|0) try='void endgrent_r(FILE**);'
10518         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
10519         esac
10520         case "$endgrent_r_proto" in
10521         ''|0)   d_endgrent_r=undef
10522                 endgrent_r_proto=0
10523                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10524         * )     case "$endgrent_r_proto" in
10525                 REENTRANT_PROTO*) ;;
10526                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
10527                 esac
10528                 echo "Prototype: $try" ;;
10529         esac
10530         ;;
10531         *)      case "$usethreads" in
10532                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
10533                 esac
10534                 d_endgrent_r=undef
10535                 endgrent_r_proto=0
10536                 ;;
10537         esac
10538         ;;
10539 *)      endgrent_r_proto=0
10540         ;;
10541 esac
10542
10543 : see if endhostent exists
10544 set endhostent d_endhent
10545 eval $inlibc
10546
10547 : see if this is a netdb.h system
10548 set netdb.h i_netdb
10549 eval $inhdr
10550
10551 : see if endhostent_r exists
10552 set endhostent_r d_endhostent_r
10553 eval $inlibc
10554 case "$d_endhostent_r" in
10555 "$define")
10556         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10557         case "$d_endhostent_r_proto:$usethreads" in
10558         ":define")      d_endhostent_r_proto=define
10559                 set d_endhostent_r_proto endhostent_r $hdrs
10560                 eval $hasproto ;;
10561         *)      ;;
10562         esac
10563         case "$d_endhostent_r_proto" in
10564         define)
10565         case "$endhostent_r_proto" in
10566         ''|0) try='int endhostent_r(struct hostent_data*);'
10567         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
10568         esac
10569         case "$endhostent_r_proto" in
10570         ''|0) try='void endhostent_r(struct hostent_data*);'
10571         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
10572         esac
10573         case "$endhostent_r_proto" in
10574         ''|0)   d_endhostent_r=undef
10575                 endhostent_r_proto=0
10576                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10577         * )     case "$endhostent_r_proto" in
10578                 REENTRANT_PROTO*) ;;
10579                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
10580                 esac
10581                 echo "Prototype: $try" ;;
10582         esac
10583         ;;
10584         *)      case "$usethreads" in
10585                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
10586                 esac
10587                 d_endhostent_r=undef
10588                 endhostent_r_proto=0
10589                 ;;
10590         esac
10591         ;;
10592 *)      endhostent_r_proto=0
10593         ;;
10594 esac
10595
10596 : see if endnetent exists
10597 set endnetent d_endnent
10598 eval $inlibc
10599
10600 : see if endnetent_r exists
10601 set endnetent_r d_endnetent_r
10602 eval $inlibc
10603 case "$d_endnetent_r" in
10604 "$define")
10605         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10606         case "$d_endnetent_r_proto:$usethreads" in
10607         ":define")      d_endnetent_r_proto=define
10608                 set d_endnetent_r_proto endnetent_r $hdrs
10609                 eval $hasproto ;;
10610         *)      ;;
10611         esac
10612         case "$d_endnetent_r_proto" in
10613         define)
10614         case "$endnetent_r_proto" in
10615         ''|0) try='int endnetent_r(struct netent_data*);'
10616         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
10617         esac
10618         case "$endnetent_r_proto" in
10619         ''|0) try='void endnetent_r(struct netent_data*);'
10620         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
10621         esac
10622         case "$endnetent_r_proto" in
10623         ''|0)   d_endnetent_r=undef
10624                 endnetent_r_proto=0
10625                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10626         * )     case "$endnetent_r_proto" in
10627                 REENTRANT_PROTO*) ;;
10628                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
10629                 esac
10630                 echo "Prototype: $try" ;;
10631         esac
10632         ;;
10633         *)      case "$usethreads" in
10634                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
10635                 esac
10636                 d_endnetent_r=undef
10637                 endnetent_r_proto=0
10638                 ;;
10639         esac
10640         ;;
10641 *)      endnetent_r_proto=0
10642         ;;
10643 esac
10644
10645 : see if endprotoent exists
10646 set endprotoent d_endpent
10647 eval $inlibc
10648
10649 : see if endprotoent_r exists
10650 set endprotoent_r d_endprotoent_r
10651 eval $inlibc
10652 case "$d_endprotoent_r" in
10653 "$define")
10654         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10655         case "$d_endprotoent_r_proto:$usethreads" in
10656         ":define")      d_endprotoent_r_proto=define
10657                 set d_endprotoent_r_proto endprotoent_r $hdrs
10658                 eval $hasproto ;;
10659         *)      ;;
10660         esac
10661         case "$d_endprotoent_r_proto" in
10662         define)
10663         case "$endprotoent_r_proto" in
10664         ''|0) try='int endprotoent_r(struct protoent_data*);'
10665         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
10666         esac
10667         case "$endprotoent_r_proto" in
10668         ''|0) try='void endprotoent_r(struct protoent_data*);'
10669         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
10670         esac
10671         case "$endprotoent_r_proto" in
10672         ''|0)   d_endprotoent_r=undef
10673                 endprotoent_r_proto=0
10674                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10675         * )     case "$endprotoent_r_proto" in
10676                 REENTRANT_PROTO*) ;;
10677                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
10678                 esac
10679                 echo "Prototype: $try" ;;
10680         esac
10681         ;;
10682         *)      case "$usethreads" in
10683                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
10684                 esac
10685                 d_endprotoent_r=undef
10686                 endprotoent_r_proto=0
10687                 ;;
10688         esac
10689         ;;
10690 *)      endprotoent_r_proto=0
10691         ;;
10692 esac
10693
10694 : see if endpwent exists
10695 set endpwent d_endpwent
10696 eval $inlibc
10697
10698 : see if this is a pwd.h system
10699 set pwd.h i_pwd
10700 eval $inhdr
10701
10702 case "$i_pwd" in
10703 $define)
10704         xxx=`./findhdr pwd.h`
10705         $cppstdin $cppflags $cppminus < $xxx >$$.h
10706
10707         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10708                 val="$define"
10709         else
10710                 val="$undef"
10711         fi
10712         set d_pwquota
10713         eval $setvar
10714
10715         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10716                 val="$define"
10717         else
10718                 val="$undef"
10719         fi
10720         set d_pwage
10721         eval $setvar
10722
10723         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10724                 val="$define"
10725         else
10726                 val="$undef"
10727         fi
10728         set d_pwchange
10729         eval $setvar
10730
10731         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10732                 val="$define"
10733         else
10734                 val="$undef"
10735         fi
10736         set d_pwclass
10737         eval $setvar
10738
10739         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10740                 val="$define"
10741         else
10742                 val="$undef"
10743         fi
10744         set d_pwexpire
10745         eval $setvar
10746
10747         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10748                 val="$define"
10749         else
10750                 val="$undef"
10751         fi
10752         set d_pwcomment
10753         eval $setvar
10754
10755         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10756                 val="$define"
10757         else
10758                 val="$undef"
10759         fi
10760         set d_pwgecos
10761         eval $setvar
10762
10763         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10764                 val="$define"
10765         else
10766                 val="$undef"
10767         fi
10768         set d_pwpasswd
10769         eval $setvar
10770
10771         $rm -f $$.h
10772         ;;
10773 *)
10774         val="$undef"; 
10775         set d_pwquota; eval $setvar
10776         set d_pwage; eval $setvar
10777         set d_pwchange; eval $setvar
10778         set d_pwclass; eval $setvar
10779         set d_pwexpire; eval $setvar
10780         set d_pwcomment; eval $setvar
10781         set d_pwgecos; eval $setvar
10782         set d_pwpasswd; eval $setvar
10783         ;;
10784 esac
10785
10786 : see if endpwent_r exists
10787 set endpwent_r d_endpwent_r
10788 eval $inlibc
10789 case "$d_endpwent_r" in
10790 "$define")
10791         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
10792         case "$d_endpwent_r_proto:$usethreads" in
10793         ":define")      d_endpwent_r_proto=define
10794                 set d_endpwent_r_proto endpwent_r $hdrs
10795                 eval $hasproto ;;
10796         *)      ;;
10797         esac
10798         case "$d_endpwent_r_proto" in
10799         define)
10800         case "$endpwent_r_proto" in
10801         ''|0) try='int endpwent_r(FILE**);'
10802         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
10803         esac
10804         case "$endpwent_r_proto" in
10805         ''|0) try='void endpwent_r(FILE**);'
10806         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
10807         esac
10808         case "$endpwent_r_proto" in
10809         ''|0)   d_endpwent_r=undef
10810                 endpwent_r_proto=0
10811                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10812         * )     case "$endpwent_r_proto" in
10813                 REENTRANT_PROTO*) ;;
10814                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
10815                 esac
10816                 echo "Prototype: $try" ;;
10817         esac
10818         ;;
10819         *)      case "$usethreads" in
10820                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
10821                 esac
10822                 d_endpwent_r=undef
10823                 endpwent_r_proto=0
10824                 ;;
10825         esac
10826         ;;
10827 *)      endpwent_r_proto=0
10828         ;;
10829 esac
10830
10831 : see if endservent exists
10832 set endservent d_endsent
10833 eval $inlibc
10834
10835 : see if endservent_r exists
10836 set endservent_r d_endservent_r
10837 eval $inlibc
10838 case "$d_endservent_r" in
10839 "$define")
10840         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10841         case "$d_endservent_r_proto:$usethreads" in
10842         ":define")      d_endservent_r_proto=define
10843                 set d_endservent_r_proto endservent_r $hdrs
10844                 eval $hasproto ;;
10845         *)      ;;
10846         esac
10847         case "$d_endservent_r_proto" in
10848         define)
10849         case "$endservent_r_proto" in
10850         ''|0) try='int endservent_r(struct servent_data*);'
10851         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
10852         esac
10853         case "$endservent_r_proto" in
10854         ''|0) try='void endservent_r(struct servent_data*);'
10855         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
10856         esac
10857         case "$endservent_r_proto" in
10858         ''|0)   d_endservent_r=undef
10859                 endservent_r_proto=0
10860                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10861         * )     case "$endservent_r_proto" in
10862                 REENTRANT_PROTO*) ;;
10863                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
10864                 esac
10865                 echo "Prototype: $try" ;;
10866         esac
10867         ;;
10868         *)      case "$usethreads" in
10869                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
10870                 esac
10871                 d_endservent_r=undef
10872                 endservent_r_proto=0
10873                 ;;
10874         esac
10875         ;;
10876 *)      endservent_r_proto=0
10877         ;;
10878 esac
10879
10880 : Locate the flags for 'open()'
10881 echo " "
10882 $cat >try.c <<'EOCP'
10883 #include <sys/types.h>
10884 #ifdef I_FCNTL
10885 #include <fcntl.h>
10886 #endif
10887 #ifdef I_SYS_FILE
10888 #include <sys/file.h>
10889 #endif
10890 int main() {
10891         if(O_RDONLY);
10892 #ifdef O_TRUNC
10893         exit(0);
10894 #else
10895         exit(1);
10896 #endif
10897 }
10898 EOCP
10899 : check sys/file.h first to get FREAD on Sun
10900 if $test `./findhdr sys/file.h` && \
10901                 set try -DI_SYS_FILE && eval $compile; then
10902         h_sysfile=true;
10903         echo "<sys/file.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 elif $test `./findhdr fcntl.h` && \
10912                 set try -DI_FCNTL && eval $compile; then
10913         h_fcntl=true;
10914         echo "<fcntl.h> defines the O_* constants..." >&4
10915         if $run ./try; then
10916                 echo "and you have the 3 argument form of open()." >&4
10917                 val="$define"
10918         else
10919                 echo "but not the 3 argument form of open().  Oh, well." >&4
10920                 val="$undef"
10921         fi
10922 else
10923         val="$undef"
10924         echo "I can't find the O_* constant definitions!  You got problems." >&4
10925 fi
10926 set d_open3
10927 eval $setvar
10928 $rm -f try try.*
10929
10930 : see which of string.h or strings.h is needed
10931 echo " "
10932 strings=`./findhdr string.h`
10933 if $test "$strings" && $test -r "$strings"; then
10934         echo "Using <string.h> instead of <strings.h>." >&4
10935         val="$define"
10936 else
10937         val="$undef"
10938         strings=`./findhdr strings.h`
10939         if $test "$strings" && $test -r "$strings"; then
10940                 echo "Using <strings.h> instead of <string.h>." >&4
10941         else
10942                 echo "No string header found -- You'll surely have problems." >&4
10943         fi
10944 fi
10945 set i_string
10946 eval $setvar
10947 case "$i_string" in
10948 "$undef") strings=`./findhdr strings.h`;;
10949 *)        strings=`./findhdr string.h`;;
10950 esac
10951
10952 : see if this is a sys/file.h system
10953 val=''
10954 set sys/file.h val
10955 eval $inhdr
10956
10957 : do we need to include sys/file.h ?
10958 case "$val" in
10959 "$define")
10960         echo " "
10961         if $h_sysfile; then
10962                 val="$define"
10963                 echo "We'll be including <sys/file.h>." >&4
10964         else
10965                 val="$undef"
10966                 echo "We won't be including <sys/file.h>." >&4
10967         fi
10968         ;;
10969 *)
10970         h_sysfile=false
10971         ;;
10972 esac
10973 set i_sysfile
10974 eval $setvar
10975
10976 : see if fcntl.h is there
10977 val=''
10978 set fcntl.h val
10979 eval $inhdr
10980
10981 : see if we can include fcntl.h
10982 case "$val" in
10983 "$define")
10984         echo " "
10985         if $h_fcntl; then
10986                 val="$define"
10987                 echo "We'll be including <fcntl.h>." >&4
10988         else
10989                 val="$undef"
10990                 if $h_sysfile; then
10991         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
10992                 else
10993                         echo "We won't be including <fcntl.h>." >&4
10994                 fi
10995         fi
10996         ;;
10997 *)
10998         h_fcntl=false
10999         val="$undef"
11000         ;;
11001 esac
11002 set i_fcntl
11003 eval $setvar
11004
11005 : check for non-blocking I/O stuff
11006 case "$h_sysfile" in
11007 true) echo "#include <sys/file.h>" > head.c;;
11008 *)
11009        case "$h_fcntl" in
11010        true) echo "#include <fcntl.h>" > head.c;;
11011        *) echo "#include <sys/fcntl.h>" > head.c;;
11012        esac
11013        ;;
11014 esac
11015 echo " "
11016 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11017 case "$o_nonblock" in
11018 '')
11019         $cat head.c > try.c
11020         $cat >>try.c <<EOCP
11021 #include <stdio.h>
11022 #include <stdlib.h>
11023 #$i_fcntl I_FCNTL
11024 #ifdef I_FCNTL
11025 #include <fcntl.h>
11026 #endif
11027 int main() {
11028 #ifdef O_NONBLOCK
11029         printf("O_NONBLOCK\n");
11030         exit(0);
11031 #endif
11032 #ifdef O_NDELAY
11033         printf("O_NDELAY\n");
11034         exit(0);
11035 #endif
11036 #ifdef FNDELAY
11037         printf("FNDELAY\n");
11038         exit(0);
11039 #endif
11040         exit(0);
11041 }
11042 EOCP
11043         set try
11044         if eval $compile_ok; then
11045                 o_nonblock=`$run ./try`
11046                 case "$o_nonblock" in
11047                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11048                 *) echo "Seems like we can use $o_nonblock.";;
11049                 esac
11050         else
11051                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11052         fi
11053         ;;
11054 *) echo "Using $hint value $o_nonblock.";;
11055 esac
11056 $rm -f try try.* .out core
11057
11058 echo " "
11059 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11060 case "$eagain" in
11061 '')
11062         $cat head.c > try.c
11063         $cat >>try.c <<EOCP
11064 #include <errno.h>
11065 #include <sys/types.h>
11066 #include <signal.h>
11067 #include <stdio.h> 
11068 #include <stdlib.h> 
11069 #$i_fcntl I_FCNTL
11070 #ifdef I_FCNTL
11071 #include <fcntl.h>
11072 #endif
11073 #define MY_O_NONBLOCK $o_nonblock
11074 #ifndef errno  /* XXX need better Configure test */
11075 extern int errno;
11076 #endif
11077 #$i_unistd I_UNISTD
11078 #ifdef I_UNISTD
11079 #include <unistd.h>
11080 #endif
11081 #$i_string I_STRING
11082 #ifdef I_STRING
11083 #include <string.h>
11084 #else
11085 #include <strings.h>
11086 #endif
11087 $signal_t blech(x) int x; { exit(3); }
11088 EOCP
11089         $cat >> try.c <<'EOCP'
11090 int main()
11091 {
11092         int pd[2];
11093         int pu[2];
11094         char buf[1];
11095         char string[100];
11096
11097         pipe(pd);       /* Down: child -> parent */
11098         pipe(pu);       /* Up: parent -> child */
11099         if (0 != fork()) {
11100                 int ret;
11101                 close(pd[1]);   /* Parent reads from pd[0] */
11102                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11103 #ifdef F_SETFL
11104                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11105                         exit(1);
11106 #else
11107                 exit(4);
11108 #endif
11109                 signal(SIGALRM, blech);
11110                 alarm(5);
11111                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11112                         exit(2);
11113                 sprintf(string, "%d\n", ret);
11114                 write(2, string, strlen(string));
11115                 alarm(0);
11116 #ifdef EAGAIN
11117                 if (errno == EAGAIN) {
11118                         printf("EAGAIN\n");
11119                         goto ok;
11120                 }
11121 #endif
11122 #ifdef EWOULDBLOCK
11123                 if (errno == EWOULDBLOCK)
11124                         printf("EWOULDBLOCK\n");
11125 #endif
11126         ok:
11127                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11128                 sleep(2);                               /* Give it time to close our pipe */
11129                 alarm(5);
11130                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11131                 alarm(0);
11132                 sprintf(string, "%d\n", ret);
11133                 write(4, string, strlen(string));
11134                 exit(0);
11135         }
11136
11137         close(pd[0]);                   /* We write to pd[1] */
11138         close(pu[1]);                   /* We read from pu[0] */
11139         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11140         close(pd[1]);                   /* Pipe pd is now fully closed! */
11141         exit(0);                                /* Bye bye, thank you for playing! */
11142 }
11143 EOCP
11144         set try
11145         if eval $compile_ok; then
11146                 echo "$startsh" >mtry
11147                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11148                 chmod +x mtry
11149                 ./mtry >/dev/null 2>&1
11150                 case $? in
11151                 0) eagain=`$cat try.out`;;
11152                 1) echo "Could not perform non-blocking setting!";;
11153                 2) echo "I did a successful read() for something that was not there!";;
11154                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11155                 4) echo "Could not find F_SETFL!";;
11156                 *) echo "Something terribly wrong happened during testing.";;
11157                 esac
11158                 rd_nodata=`$cat try.ret`
11159                 echo "A read() system call with no data present returns $rd_nodata."
11160                 case "$rd_nodata" in
11161                 0|-1) ;;
11162                 *)
11163                         echo "(That's peculiar, fixing that to be -1.)"
11164                         rd_nodata=-1
11165                         ;;
11166                 esac
11167                 case "$eagain" in
11168                 '')
11169                         echo "Forcing errno EAGAIN on read() with no data available."
11170                         eagain=EAGAIN
11171                         ;;
11172                 *)
11173                         echo "Your read() sets errno to $eagain when no data is available."
11174                         ;;
11175                 esac
11176                 status=`$cat try.err`
11177                 case "$status" in
11178                 0) echo "And it correctly returns 0 to signal EOF.";;
11179                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11180                 *) echo "However, your read() returns '$status' on EOF??";;
11181                 esac
11182                 val="$define"
11183                 if test "$status" = "$rd_nodata"; then
11184                         echo "WARNING: you can't distinguish between EOF and no data!"
11185                         val="$undef"
11186                 fi
11187         else
11188                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11189                 eagain=EAGAIN
11190         fi
11191         set d_eofnblk
11192         eval $setvar
11193         ;;
11194 *)
11195         echo "Using $hint value $eagain."
11196         echo "Your read() returns $rd_nodata when no data is present."
11197         case "$d_eofnblk" in
11198         "$define") echo "And you can see EOF because read() returns 0.";;
11199         "$undef") echo "But you can't see EOF status from read() returned value.";;
11200         *)
11201                 echo "(Assuming you can't see EOF status from read anyway.)"
11202                 d_eofnblk=$undef
11203                 ;;
11204         esac
11205         ;;
11206 esac
11207 $rm -f try try.* .out core head.c mtry
11208
11209 : see if fchdir exists
11210 set fchdir d_fchdir
11211 eval $inlibc
11212
11213 : see if fchmod exists
11214 set fchmod d_fchmod
11215 eval $inlibc
11216
11217 : see if fchown exists
11218 set fchown d_fchown
11219 eval $inlibc
11220
11221 : see if this is an fcntl system
11222 set fcntl d_fcntl
11223 eval $inlibc
11224
11225 echo " "
11226 : See if fcntl-based locking works.
11227 $cat >try.c <<EOCP
11228 #include <stdlib.h>
11229 #include <unistd.h>
11230 #include <fcntl.h>
11231 #include <signal.h>
11232 $signal_t blech(x) int x; { exit(3); }
11233 int main() {
11234 #if defined(F_SETLK) && defined(F_SETLKW)
11235      struct flock flock;
11236      int retval, fd;
11237      fd = open("try.c", O_RDONLY);
11238      flock.l_type = F_RDLCK;
11239      flock.l_whence = SEEK_SET;
11240      flock.l_start = flock.l_len = 0;
11241      signal(SIGALRM, blech);
11242      alarm(10);
11243      retval = fcntl(fd, F_SETLK, &flock);
11244      close(fd);
11245      (retval < 0 ? exit(2) : exit(0));
11246 #else
11247      exit(2);
11248 #endif
11249 }
11250 EOCP
11251 echo "Checking if fcntl-based file locking works... "
11252 case "$d_fcntl" in
11253 "$define")
11254         set try
11255         if eval $compile_ok; then
11256                 if $run ./try; then
11257                         echo "Yes, it seems to work."
11258                         val="$define"
11259                 else
11260                         echo "Nope, it didn't work."
11261                         val="$undef"
11262                         case "$?" in
11263                         3) $cat >&4 <<EOM
11264 ***
11265 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
11266 *** This is (almost) impossible.
11267 *** If your NFS lock daemons are not feeling well, something like
11268 *** this may happen, please investigate.  Cannot continue, aborting.
11269 ***
11270 EOM
11271                                 exit 1
11272                                 ;;
11273                         esac
11274                 fi
11275         else
11276                 echo "I'm unable to compile the test program, so I'll assume not."
11277                 val="$undef"
11278         fi
11279         ;;
11280 *) val="$undef";
11281         echo "Nope, since you don't even have fcntl()."
11282         ;;
11283 esac
11284 set d_fcntl_can_lock
11285 eval $setvar
11286 $rm -f try*
11287
11288
11289 : check for fd_set items
11290 $cat <<EOM
11291
11292 Checking to see how well your C compiler handles fd_set and friends ...
11293 EOM
11294 $cat >try.c <<EOCP
11295 #$i_systime I_SYS_TIME
11296 #$i_sysselct I_SYS_SELECT
11297 #$d_socket HAS_SOCKET
11298 #include <sys/types.h>
11299 #ifdef HAS_SOCKET
11300 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
11301 #endif
11302 #ifdef I_SYS_TIME
11303 #include <sys/time.h>
11304 #endif
11305 #ifdef I_SYS_SELECT
11306 #include <sys/select.h>
11307 #endif
11308 int main() {
11309         fd_set fds;
11310
11311 #ifdef TRYBITS
11312         if(fds.fds_bits);
11313 #endif
11314
11315 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
11316         exit(0);
11317 #else
11318         exit(1);
11319 #endif
11320 }
11321 EOCP
11322 set try -DTRYBITS
11323 if eval $compile; then
11324         d_fds_bits="$define"
11325         d_fd_set="$define"
11326         echo "Well, your system knows about the normal fd_set typedef..." >&4
11327         if $run ./try; then
11328                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
11329                 d_fd_macros="$define"
11330         else
11331                 $cat >&4 <<'EOM'
11332 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
11333 EOM
11334                 d_fd_macros="$undef"
11335         fi
11336 else
11337         $cat <<'EOM'
11338 Hmm, your compiler has some difficulty with fd_set.  Checking further...
11339 EOM
11340         set try
11341         if eval $compile; then
11342                 d_fds_bits="$undef"
11343                 d_fd_set="$define"
11344                 echo "Well, your system has some sort of fd_set available..." >&4
11345                 if $run ./try; then
11346                         echo "and you have the normal fd_set macros." >&4
11347                         d_fd_macros="$define"
11348                 else
11349                         $cat <<'EOM'
11350 but not the normal fd_set macros!  Gross!  More work for me...
11351 EOM
11352                         d_fd_macros="$undef"
11353                 fi
11354         else
11355         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
11356                 d_fd_set="$undef"
11357                 d_fds_bits="$undef"
11358                 d_fd_macros="$undef"
11359         fi
11360 fi
11361 $rm -f try try.*
11362
11363 : see if fgetpos exists
11364 set fgetpos d_fgetpos
11365 eval $inlibc
11366
11367 : see if finite exists
11368 set finite d_finite
11369 eval $inlibc
11370
11371 : see if finitel exists
11372 set finitel d_finitel
11373 eval $inlibc
11374
11375 : see if flock exists
11376 set flock d_flock
11377 eval $inlibc
11378
11379 : see if prototype for flock is available
11380 echo " "
11381 set d_flockproto flock $i_sysfile sys/file.h
11382 eval $hasproto
11383
11384 : see if fork exists
11385 set fork d_fork
11386 eval $inlibc
11387
11388 : see if fp_class exists
11389 set fp_class d_fp_class
11390 eval $inlibc
11391
11392 : see if pathconf exists
11393 set pathconf d_pathconf
11394 eval $inlibc
11395
11396 : see if fpathconf exists
11397 set fpathconf d_fpathconf
11398 eval $inlibc
11399
11400 : see if fpclass exists
11401 set fpclass d_fpclass
11402 eval $inlibc
11403
11404 : see if fpclassify exists
11405 set fpclassify d_fpclassify
11406 eval $inlibc
11407
11408 : see if fpclassl exists
11409 set fpclassl d_fpclassl
11410 eval $inlibc
11411
11412
11413 : check for fpos64_t
11414 echo " "
11415 echo "Checking to see if you have fpos64_t..." >&4
11416 $cat >try.c <<EOCP
11417 #include <stdio.h>
11418 int main() { fpos64_t x = 7; }
11419 EOCP
11420 set try
11421 if eval $compile; then
11422         val="$define"
11423         echo "You have fpos64_t."
11424 else
11425         val="$undef"
11426         echo "You do not have fpos64_t."
11427         case "$fpossize" in
11428         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
11429         esac
11430 fi
11431 $rm -f try.* try
11432 set d_fpos64_t
11433 eval $setvar
11434
11435 : see if frexpl exists
11436 set frexpl d_frexpl
11437 eval $inlibc
11438
11439 : see if this is a sys/param system
11440 set sys/param.h i_sysparam
11441 eval $inhdr
11442
11443 : see if this is a sys/mount.h system
11444 set sys/mount.h i_sysmount
11445 eval $inhdr
11446
11447
11448 echo " "
11449 echo "Checking to see if your system supports struct fs_data..." >&4
11450 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
11451 eval $hasstruct
11452 case "$d_fs_data_s" in
11453 "$define")      echo "Yes, it does."   ;;
11454 *)              echo "No, it doesn't." ;;
11455 esac
11456
11457 : see if fseeko exists
11458 set fseeko d_fseeko
11459 eval $inlibc
11460 case "$longsize" in
11461 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
11462 esac
11463
11464 : see if fsetpos exists
11465 set fsetpos d_fsetpos
11466 eval $inlibc
11467
11468
11469 : see if fstatfs exists
11470 set fstatfs d_fstatfs
11471 eval $inlibc
11472
11473
11474 : see if statvfs exists
11475 set statvfs d_statvfs
11476 eval $inlibc
11477
11478 : see if fstatvfs exists
11479 set fstatvfs d_fstatvfs
11480 eval $inlibc
11481
11482
11483 : see if fsync exists
11484 set fsync d_fsync
11485 eval $inlibc
11486
11487 : see if ftello exists
11488 set ftello d_ftello
11489 eval $inlibc
11490 case "$longsize" in
11491 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
11492 esac
11493
11494 : see if getcwd exists
11495 set getcwd d_getcwd
11496 eval $inlibc
11497
11498 : see if getespwnam exists
11499 set getespwnam d_getespwnam
11500 eval $inlibc
11501
11502
11503 : see if getfsstat exists
11504 set getfsstat d_getfsstat
11505 eval $inlibc
11506
11507 : see if getgrent exists
11508 set getgrent d_getgrent
11509 eval $inlibc
11510
11511 : see if getgrent_r exists
11512 set getgrent_r d_getgrent_r
11513 eval $inlibc
11514 case "$d_getgrent_r" in
11515 "$define")
11516         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11517         case "$d_getgrent_r_proto:$usethreads" in
11518         ":define")      d_getgrent_r_proto=define
11519                 set d_getgrent_r_proto getgrent_r $hdrs
11520                 eval $hasproto ;;
11521         *)      ;;
11522         esac
11523         case "$d_getgrent_r_proto" in
11524         define)
11525         case "$getgrent_r_proto" in
11526         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
11527         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
11528         esac
11529         case "$getgrent_r_proto" in
11530         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
11531         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
11532         esac
11533         case "$getgrent_r_proto" in
11534         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
11535         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
11536         esac
11537         case "$getgrent_r_proto" in
11538         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
11539         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
11540         esac
11541         case "$getgrent_r_proto" in
11542         ''|0) try='int getgrent_r(struct group*, char*, int);'
11543         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
11544         esac
11545         case "$getgrent_r_proto" in
11546         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
11547         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
11548         esac
11549         case "$getgrent_r_proto" in
11550         ''|0)   d_getgrent_r=undef
11551                 getgrent_r_proto=0
11552                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
11553         * )     case "$getgrent_r_proto" in
11554                 REENTRANT_PROTO*) ;;
11555                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
11556                 esac
11557                 echo "Prototype: $try" ;;
11558         esac
11559         ;;
11560         *)      case "$usethreads" in
11561                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
11562                 esac
11563                 d_getgrent_r=undef
11564                 getgrent_r_proto=0
11565                 ;;
11566         esac
11567         ;;
11568 *)      getgrent_r_proto=0
11569         ;;
11570 esac
11571
11572 : see if getgrgid_r exists
11573 set getgrgid_r d_getgrgid_r
11574 eval $inlibc
11575 case "$d_getgrgid_r" in
11576 "$define")
11577         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11578         case "$d_getgrgid_r_proto:$usethreads" in
11579         ":define")      d_getgrgid_r_proto=define
11580                 set d_getgrgid_r_proto getgrgid_r $hdrs
11581                 eval $hasproto ;;
11582         *)      ;;
11583         esac
11584         case "$d_getgrgid_r_proto" in
11585         define)
11586         case "$getgrgid_r_proto" in
11587         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
11588         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
11589         esac
11590         case "$getgrgid_r_proto" in
11591         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
11592         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
11593         esac
11594         case "$getgrgid_r_proto" in
11595         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
11596         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
11597         esac
11598         case "$getgrgid_r_proto" in
11599         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
11600         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
11601         esac
11602         case "$getgrgid_r_proto" in
11603         ''|0)   d_getgrgid_r=undef
11604                 getgrgid_r_proto=0
11605                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
11606         * )     case "$getgrgid_r_proto" in
11607                 REENTRANT_PROTO*) ;;
11608                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
11609                 esac
11610                 echo "Prototype: $try" ;;
11611         esac
11612         ;;
11613         *)      case "$usethreads" in
11614                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
11615                 esac
11616                 d_getgrgid_r=undef
11617                 getgrgid_r_proto=0
11618                 ;;
11619         esac
11620         ;;
11621 *)      getgrgid_r_proto=0
11622         ;;
11623 esac
11624
11625 : see if getgrnam_r exists
11626 set getgrnam_r d_getgrnam_r
11627 eval $inlibc
11628 case "$d_getgrnam_r" in
11629 "$define")
11630         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11631         case "$d_getgrnam_r_proto:$usethreads" in
11632         ":define")      d_getgrnam_r_proto=define
11633                 set d_getgrnam_r_proto getgrnam_r $hdrs
11634                 eval $hasproto ;;
11635         *)      ;;
11636         esac
11637         case "$d_getgrnam_r_proto" in
11638         define)
11639         case "$getgrnam_r_proto" in
11640         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
11641         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
11642         esac
11643         case "$getgrnam_r_proto" in
11644         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
11645         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
11646         esac
11647         case "$getgrnam_r_proto" in
11648         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
11649         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
11650         esac
11651         case "$getgrnam_r_proto" in
11652         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
11653         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
11654         esac
11655         case "$getgrnam_r_proto" in
11656         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
11657         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
11658         esac
11659         case "$getgrnam_r_proto" in
11660         ''|0)   d_getgrnam_r=undef
11661                 getgrnam_r_proto=0
11662                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
11663         * )     case "$getgrnam_r_proto" in
11664                 REENTRANT_PROTO*) ;;
11665                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
11666                 esac
11667                 echo "Prototype: $try" ;;
11668         esac
11669         ;;
11670         *)      case "$usethreads" in
11671                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
11672                 esac
11673                 d_getgrnam_r=undef
11674                 getgrnam_r_proto=0
11675                 ;;
11676         esac
11677         ;;
11678 *)      getgrnam_r_proto=0
11679         ;;
11680 esac
11681
11682 : see if gethostbyaddr exists
11683 set gethostbyaddr d_gethbyaddr
11684 eval $inlibc
11685
11686 : see if gethostbyname exists
11687 set gethostbyname d_gethbyname
11688 eval $inlibc
11689
11690 : see if gethostent exists
11691 set gethostent d_gethent
11692 eval $inlibc
11693
11694 : see how we will look up host name
11695 echo " "
11696 call=''
11697 if set gethostname val -f d_gethname; eval $csym; $val; then
11698         echo 'gethostname() found.' >&4
11699         d_gethname="$define"
11700         call=gethostname
11701 fi
11702 if set uname val -f d_uname; eval $csym; $val; then
11703         if ./xenix; then
11704                 $cat <<'EOM'
11705 uname() was found, but you're running xenix, and older versions of xenix
11706 have a broken uname(). If you don't really know whether your xenix is old
11707 enough to have a broken system call, use the default answer.
11708
11709 EOM
11710                 dflt=y
11711                 case "$d_uname" in
11712                 "$define") dflt=n;;
11713                 esac
11714                 rp='Is your uname() broken?'
11715                 . ./myread
11716                 case "$ans" in
11717                 n*) d_uname="$define"; call=uname;;
11718                 esac
11719         else
11720                 echo 'uname() found.' >&4
11721                 d_uname="$define"
11722                 case "$call" in
11723                 '') call=uname ;;
11724                 esac
11725         fi
11726 fi
11727 case "$d_gethname" in
11728 '') d_gethname="$undef";;
11729 esac
11730 case "$d_uname" in
11731 '') d_uname="$undef";;
11732 esac
11733 case "$d_uname$d_gethname" in
11734 *define*)
11735         dflt=n
11736         cat <<EOM
11737  
11738 Every now and then someone has a $call() that lies about the hostname
11739 but can't be fixed for political or economic reasons.  If you wish, I can
11740 pretend $call() isn't there and maybe compute hostname at run-time
11741 thanks to the '$phostname' command.
11742
11743 EOM
11744         rp="Shall I ignore $call() from now on?"
11745         . ./myread
11746         case "$ans" in
11747         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
11748         esac;;
11749 esac
11750 case "$phostname" in
11751 '') aphostname='';;
11752 *) case "$aphostname" in
11753         /*) ;;
11754         *) set X $phostname
11755                 shift
11756                 file=$1
11757                 shift
11758                 file=`./loc $file $file $pth`
11759                 aphostname=`echo $file $*`
11760                 ;;
11761         esac
11762         ;;
11763 esac
11764 case "$d_uname$d_gethname" in
11765 *define*) ;;
11766 *)
11767         case "$phostname" in
11768         '')
11769                 echo "There will be no way for $package to get your hostname." >&4;;
11770         *)
11771         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
11772                 ;;
11773         esac;;
11774 esac
11775 case "$d_phostname" in
11776 '') d_phostname="$undef";;
11777 esac
11778
11779 : see if gethostbyaddr_r exists
11780 set gethostbyaddr_r d_gethostbyaddr_r
11781 eval $inlibc
11782 case "$d_gethostbyaddr_r" in
11783 "$define")
11784         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11785         case "$d_gethostbyaddr_r_proto:$usethreads" in
11786         ":define")      d_gethostbyaddr_r_proto=define
11787                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
11788                 eval $hasproto ;;
11789         *)      ;;
11790         esac
11791         case "$d_gethostbyaddr_r_proto" in
11792         define)
11793         case "$gethostbyaddr_r_proto" in
11794         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
11795         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
11796         esac
11797         case "$gethostbyaddr_r_proto" in
11798         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
11799         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
11800         esac
11801         case "$gethostbyaddr_r_proto" in
11802         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
11803         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
11804         esac
11805         case "$gethostbyaddr_r_proto" in
11806         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
11807         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
11808         esac
11809         case "$gethostbyaddr_r_proto" in
11810         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
11811         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
11812         esac
11813         case "$gethostbyaddr_r_proto" in
11814         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
11815         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
11816         esac
11817         case "$gethostbyaddr_r_proto" in
11818         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
11819         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
11820         esac
11821         case "$gethostbyaddr_r_proto" in
11822         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
11823         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
11824         esac
11825         case "$gethostbyaddr_r_proto" in
11826         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
11827         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
11828         esac
11829         case "$gethostbyaddr_r_proto" in
11830         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
11831         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
11832         esac
11833         case "$gethostbyaddr_r_proto" in
11834         ''|0)   d_gethostbyaddr_r=undef
11835                 gethostbyaddr_r_proto=0
11836                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
11837         * )     case "$gethostbyaddr_r_proto" in
11838                 REENTRANT_PROTO*) ;;
11839                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
11840                 esac
11841                 echo "Prototype: $try" ;;
11842         esac
11843         ;;
11844         *)      case "$usethreads" in
11845                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
11846                 esac
11847                 d_gethostbyaddr_r=undef
11848                 gethostbyaddr_r_proto=0
11849                 ;;
11850         esac
11851         ;;
11852 *)      gethostbyaddr_r_proto=0
11853         ;;
11854 esac
11855
11856 : see if gethostbyname_r exists
11857 set gethostbyname_r d_gethostbyname_r
11858 eval $inlibc
11859 case "$d_gethostbyname_r" in
11860 "$define")
11861         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11862         case "$d_gethostbyname_r_proto:$usethreads" in
11863         ":define")      d_gethostbyname_r_proto=define
11864                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
11865                 eval $hasproto ;;
11866         *)      ;;
11867         esac
11868         case "$d_gethostbyname_r_proto" in
11869         define)
11870         case "$gethostbyname_r_proto" in
11871         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
11872         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
11873         esac
11874         case "$gethostbyname_r_proto" in
11875         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
11876         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
11877         esac
11878         case "$gethostbyname_r_proto" in
11879         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
11880         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
11881         esac
11882         case "$gethostbyname_r_proto" in
11883         ''|0)   d_gethostbyname_r=undef
11884                 gethostbyname_r_proto=0
11885                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
11886         * )     case "$gethostbyname_r_proto" in
11887                 REENTRANT_PROTO*) ;;
11888                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
11889                 esac
11890                 echo "Prototype: $try" ;;
11891         esac
11892         ;;
11893         *)      case "$usethreads" in
11894                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
11895                 esac
11896                 d_gethostbyname_r=undef
11897                 gethostbyname_r_proto=0
11898                 ;;
11899         esac
11900         ;;
11901 *)      gethostbyname_r_proto=0
11902         ;;
11903 esac
11904
11905 : see if gethostent_r exists
11906 set gethostent_r d_gethostent_r
11907 eval $inlibc
11908 case "$d_gethostent_r" in
11909 "$define")
11910         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11911         case "$d_gethostent_r_proto:$usethreads" in
11912         ":define")      d_gethostent_r_proto=define
11913                 set d_gethostent_r_proto gethostent_r $hdrs
11914                 eval $hasproto ;;
11915         *)      ;;
11916         esac
11917         case "$d_gethostent_r_proto" in
11918         define)
11919         case "$gethostent_r_proto" in
11920         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
11921         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
11922         esac
11923         case "$gethostent_r_proto" in
11924         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
11925         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
11926         esac
11927         case "$gethostent_r_proto" in
11928         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
11929         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
11930         esac
11931         case "$gethostent_r_proto" in
11932         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
11933         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
11934         esac
11935         case "$gethostent_r_proto" in
11936         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
11937         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
11938         esac
11939         case "$gethostent_r_proto" in
11940         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
11941         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
11942         esac
11943         case "$gethostent_r_proto" in
11944         ''|0)   d_gethostent_r=undef
11945                 gethostent_r_proto=0
11946                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
11947         * )     case "$gethostent_r_proto" in
11948                 REENTRANT_PROTO*) ;;
11949                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
11950                 esac
11951                 echo "Prototype: $try" ;;
11952         esac
11953         ;;
11954         *)      case "$usethreads" in
11955                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
11956                 esac
11957                 d_gethostent_r=undef
11958                 gethostent_r_proto=0
11959                 ;;
11960         esac
11961         ;;
11962 *)      gethostent_r_proto=0
11963         ;;
11964 esac
11965
11966 : see if prototypes for various gethostxxx netdb.h functions are available
11967 echo " "
11968 set d_gethostprotos gethostent $i_netdb netdb.h
11969 eval $hasproto
11970
11971 : see if getitimer exists
11972 set getitimer d_getitimer
11973 eval $inlibc
11974
11975 : see if getlogin exists
11976 set getlogin d_getlogin
11977 eval $inlibc
11978
11979 : see if getlogin_r exists
11980 set getlogin_r d_getlogin_r
11981 eval $inlibc
11982 case "$d_getlogin_r" in
11983 "$define")
11984         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
11985         case "$d_getlogin_r_proto:$usethreads" in
11986         ":define")      d_getlogin_r_proto=define
11987                 set d_getlogin_r_proto getlogin_r $hdrs
11988                 eval $hasproto ;;
11989         *)      ;;
11990         esac
11991         case "$d_getlogin_r_proto" in
11992         define)
11993         case "$getlogin_r_proto" in
11994         ''|0) try='int getlogin_r(char*, size_t);'
11995         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
11996         esac
11997         case "$getlogin_r_proto" in
11998         ''|0) try='int getlogin_r(char*, int);'
11999         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
12000         esac
12001         case "$getlogin_r_proto" in
12002         ''|0) try='char* getlogin_r(char*, size_t);'
12003         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
12004         esac
12005         case "$getlogin_r_proto" in
12006         ''|0) try='char* getlogin_r(char*, int);'
12007         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
12008         esac
12009         case "$getlogin_r_proto" in
12010         ''|0)   d_getlogin_r=undef
12011                 getlogin_r_proto=0
12012                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
12013         * )     case "$getlogin_r_proto" in
12014                 REENTRANT_PROTO*) ;;
12015                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
12016                 esac
12017                 echo "Prototype: $try" ;;
12018         esac
12019         ;;
12020         *)      case "$usethreads" in
12021                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
12022                 esac
12023                 d_getlogin_r=undef
12024                 getlogin_r_proto=0
12025                 ;;
12026         esac
12027         ;;
12028 *)      getlogin_r_proto=0
12029         ;;
12030 esac
12031
12032 : see if getmnt exists
12033 set getmnt d_getmnt
12034 eval $inlibc
12035
12036 : see if getmntent exists
12037 set getmntent d_getmntent
12038 eval $inlibc
12039
12040 : see if getnetbyaddr exists
12041 set getnetbyaddr d_getnbyaddr
12042 eval $inlibc
12043
12044 : see if getnetbyname exists
12045 set getnetbyname d_getnbyname
12046 eval $inlibc
12047
12048 : see if getnetent exists
12049 set getnetent d_getnent
12050 eval $inlibc
12051
12052 : see if getnetbyaddr_r exists
12053 set getnetbyaddr_r d_getnetbyaddr_r
12054 eval $inlibc
12055 case "$d_getnetbyaddr_r" in
12056 "$define")
12057         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12058         case "$d_getnetbyaddr_r_proto:$usethreads" in
12059         ":define")      d_getnetbyaddr_r_proto=define
12060                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
12061                 eval $hasproto ;;
12062         *)      ;;
12063         esac
12064         case "$d_getnetbyaddr_r_proto" in
12065         define)
12066         case "$getnetbyaddr_r_proto" in
12067         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
12068         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
12069         esac
12070         case "$getnetbyaddr_r_proto" in
12071         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
12072         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
12073         esac
12074         case "$getnetbyaddr_r_proto" in
12075         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
12076         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
12077         esac
12078         case "$getnetbyaddr_r_proto" in
12079         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
12080         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
12081         esac
12082         case "$getnetbyaddr_r_proto" in
12083         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
12084         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
12085         esac
12086         case "$getnetbyaddr_r_proto" in
12087         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
12088         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
12089         esac
12090         case "$getnetbyaddr_r_proto" in
12091         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
12092         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
12093         esac
12094         case "$getnetbyaddr_r_proto" in
12095         ''|0)   d_getnetbyaddr_r=undef
12096                 getnetbyaddr_r_proto=0
12097                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
12098         * )     case "$getnetbyaddr_r_proto" in
12099                 REENTRANT_PROTO*) ;;
12100                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
12101                 esac
12102                 echo "Prototype: $try" ;;
12103         esac
12104         ;;
12105         *)      case "$usethreads" in
12106                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
12107                 esac
12108                 d_getnetbyaddr_r=undef
12109                 getnetbyaddr_r_proto=0
12110                 ;;
12111         esac
12112         ;;
12113 *)      getnetbyaddr_r_proto=0
12114         ;;
12115 esac
12116
12117 : see if getnetbyname_r exists
12118 set getnetbyname_r d_getnetbyname_r
12119 eval $inlibc
12120 case "$d_getnetbyname_r" in
12121 "$define")
12122         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12123         case "$d_getnetbyname_r_proto:$usethreads" in
12124         ":define")      d_getnetbyname_r_proto=define
12125                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
12126                 eval $hasproto ;;
12127         *)      ;;
12128         esac
12129         case "$d_getnetbyname_r_proto" in
12130         define)
12131         case "$getnetbyname_r_proto" in
12132         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
12133         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
12134         esac
12135         case "$getnetbyname_r_proto" in
12136         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
12137         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
12138         esac
12139         case "$getnetbyname_r_proto" in
12140         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
12141         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
12142         esac
12143         case "$getnetbyname_r_proto" in
12144         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
12145         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
12146         esac
12147         case "$getnetbyname_r_proto" in
12148         ''|0)   d_getnetbyname_r=undef
12149                 getnetbyname_r_proto=0
12150                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
12151         * )     case "$getnetbyname_r_proto" in
12152                 REENTRANT_PROTO*) ;;
12153                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
12154                 esac
12155                 echo "Prototype: $try" ;;
12156         esac
12157         ;;
12158         *)      case "$usethreads" in
12159                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
12160                 esac
12161                 d_getnetbyname_r=undef
12162                 getnetbyname_r_proto=0
12163                 ;;
12164         esac
12165         ;;
12166 *)      getnetbyname_r_proto=0
12167         ;;
12168 esac
12169
12170 : see if getnetent_r exists
12171 set getnetent_r d_getnetent_r
12172 eval $inlibc
12173 case "$d_getnetent_r" in
12174 "$define")
12175         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12176         case "$d_getnetent_r_proto:$usethreads" in
12177         ":define")      d_getnetent_r_proto=define
12178                 set d_getnetent_r_proto getnetent_r $hdrs
12179                 eval $hasproto ;;
12180         *)      ;;
12181         esac
12182         case "$d_getnetent_r_proto" in
12183         define)
12184         case "$getnetent_r_proto" in
12185         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
12186         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
12187         esac
12188         case "$getnetent_r_proto" in
12189         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
12190         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
12191         esac
12192         case "$getnetent_r_proto" in
12193         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
12194         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
12195         esac
12196         case "$getnetent_r_proto" in
12197         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
12198         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
12199         esac
12200         case "$getnetent_r_proto" in
12201         ''|0) try='int getnetent_r(struct netent*, char*, int);'
12202         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
12203         esac
12204         case "$getnetent_r_proto" in
12205         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
12206         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
12207         esac
12208         case "$getnetent_r_proto" in
12209         ''|0)   d_getnetent_r=undef
12210                 getnetent_r_proto=0
12211                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
12212         * )     case "$getnetent_r_proto" in
12213                 REENTRANT_PROTO*) ;;
12214                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
12215                 esac
12216                 echo "Prototype: $try" ;;
12217         esac
12218         ;;
12219         *)      case "$usethreads" in
12220                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
12221                 esac
12222                 d_getnetent_r=undef
12223                 getnetent_r_proto=0
12224                 ;;
12225         esac
12226         ;;
12227 *)      getnetent_r_proto=0
12228         ;;
12229 esac
12230
12231 : see if prototypes for various getnetxxx netdb.h functions are available
12232 echo " "
12233 set d_getnetprotos getnetent $i_netdb netdb.h
12234 eval $hasproto
12235
12236 : see if getpagesize exists
12237 set getpagesize d_getpagsz
12238 eval $inlibc
12239
12240
12241 : see if getprotobyname exists
12242 set getprotobyname d_getpbyname
12243 eval $inlibc
12244
12245 : see if getprotobynumber exists
12246 set getprotobynumber d_getpbynumber
12247 eval $inlibc
12248
12249 : see if getprotoent exists
12250 set getprotoent d_getpent
12251 eval $inlibc
12252
12253 : see if getpgid exists
12254 set getpgid d_getpgid
12255 eval $inlibc
12256
12257 : see if getpgrp2 exists
12258 set getpgrp2 d_getpgrp2
12259 eval $inlibc
12260
12261 : see if getppid exists
12262 set getppid d_getppid
12263 eval $inlibc
12264
12265 : see if getpriority exists
12266 set getpriority d_getprior
12267 eval $inlibc
12268
12269 : see if getprotobyname_r exists
12270 set getprotobyname_r d_getprotobyname_r
12271 eval $inlibc
12272 case "$d_getprotobyname_r" in
12273 "$define")
12274         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12275         case "$d_getprotobyname_r_proto:$usethreads" in
12276         ":define")      d_getprotobyname_r_proto=define
12277                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
12278                 eval $hasproto ;;
12279         *)      ;;
12280         esac
12281         case "$d_getprotobyname_r_proto" in
12282         define)
12283         case "$getprotobyname_r_proto" in
12284         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
12285         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
12286         esac
12287         case "$getprotobyname_r_proto" in
12288         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
12289         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
12290         esac
12291         case "$getprotobyname_r_proto" in
12292         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
12293         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
12294         esac
12295         case "$getprotobyname_r_proto" in
12296         ''|0)   d_getprotobyname_r=undef
12297                 getprotobyname_r_proto=0
12298                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
12299         * )     case "$getprotobyname_r_proto" in
12300                 REENTRANT_PROTO*) ;;
12301                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
12302                 esac
12303                 echo "Prototype: $try" ;;
12304         esac
12305         ;;
12306         *)      case "$usethreads" in
12307                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
12308                 esac
12309                 d_getprotobyname_r=undef
12310                 getprotobyname_r_proto=0
12311                 ;;
12312         esac
12313         ;;
12314 *)      getprotobyname_r_proto=0
12315         ;;
12316 esac
12317
12318 : see if getprotobynumber_r exists
12319 set getprotobynumber_r d_getprotobynumber_r
12320 eval $inlibc
12321 case "$d_getprotobynumber_r" in
12322 "$define")
12323         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12324         case "$d_getprotobynumber_r_proto:$usethreads" in
12325         ":define")      d_getprotobynumber_r_proto=define
12326                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
12327                 eval $hasproto ;;
12328         *)      ;;
12329         esac
12330         case "$d_getprotobynumber_r_proto" in
12331         define)
12332         case "$getprotobynumber_r_proto" in
12333         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
12334         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
12335         esac
12336         case "$getprotobynumber_r_proto" in
12337         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
12338         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
12339         esac
12340         case "$getprotobynumber_r_proto" in
12341         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
12342         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
12343         esac
12344         case "$getprotobynumber_r_proto" in
12345         ''|0)   d_getprotobynumber_r=undef
12346                 getprotobynumber_r_proto=0
12347                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
12348         * )     case "$getprotobynumber_r_proto" in
12349                 REENTRANT_PROTO*) ;;
12350                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
12351                 esac
12352                 echo "Prototype: $try" ;;
12353         esac
12354         ;;
12355         *)      case "$usethreads" in
12356                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
12357                 esac
12358                 d_getprotobynumber_r=undef
12359                 getprotobynumber_r_proto=0
12360                 ;;
12361         esac
12362         ;;
12363 *)      getprotobynumber_r_proto=0
12364         ;;
12365 esac
12366
12367 : see if getprotoent_r exists
12368 set getprotoent_r d_getprotoent_r
12369 eval $inlibc
12370 case "$d_getprotoent_r" in
12371 "$define")
12372         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12373         case "$d_getprotoent_r_proto:$usethreads" in
12374         ":define")      d_getprotoent_r_proto=define
12375                 set d_getprotoent_r_proto getprotoent_r $hdrs
12376                 eval $hasproto ;;
12377         *)      ;;
12378         esac
12379         case "$d_getprotoent_r_proto" in
12380         define)
12381         case "$getprotoent_r_proto" in
12382         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
12383         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
12384         esac
12385         case "$getprotoent_r_proto" in
12386         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
12387         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
12388         esac
12389         case "$getprotoent_r_proto" in
12390         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
12391         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
12392         esac
12393         case "$getprotoent_r_proto" in
12394         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
12395         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
12396         esac
12397         case "$getprotoent_r_proto" in
12398         ''|0)   d_getprotoent_r=undef
12399                 getprotoent_r_proto=0
12400                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
12401         * )     case "$getprotoent_r_proto" in
12402                 REENTRANT_PROTO*) ;;
12403                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
12404                 esac
12405                 echo "Prototype: $try" ;;
12406         esac
12407         ;;
12408         *)      case "$usethreads" in
12409                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
12410                 esac
12411                 d_getprotoent_r=undef
12412                 getprotoent_r_proto=0
12413                 ;;
12414         esac
12415         ;;
12416 *)      getprotoent_r_proto=0
12417         ;;
12418 esac
12419
12420 : see if prototypes for various getprotoxxx netdb.h functions are available
12421 echo " "
12422 set d_getprotoprotos getprotoent $i_netdb netdb.h
12423 eval $hasproto
12424
12425 : see if getprpwnam exists
12426 set getprpwnam d_getprpwnam
12427 eval $inlibc
12428
12429 : see if getpwent exists
12430 set getpwent d_getpwent
12431 eval $inlibc
12432
12433 : see if getpwent_r exists
12434 set getpwent_r d_getpwent_r
12435 eval $inlibc
12436 case "$d_getpwent_r" in
12437 "$define")
12438         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12439         case "$d_getpwent_r_proto:$usethreads" in
12440         ":define")      d_getpwent_r_proto=define
12441                 set d_getpwent_r_proto getpwent_r $hdrs
12442                 eval $hasproto ;;
12443         *)      ;;
12444         esac
12445         case "$d_getpwent_r_proto" in
12446         define)
12447         case "$getpwent_r_proto" in
12448         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
12449         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
12450         esac
12451         case "$getpwent_r_proto" in
12452         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
12453         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
12454         esac
12455         case "$getpwent_r_proto" in
12456         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
12457         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
12458         esac
12459         case "$getpwent_r_proto" in
12460         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
12461         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
12462         esac
12463         case "$getpwent_r_proto" in
12464         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
12465         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
12466         esac
12467         case "$getpwent_r_proto" in
12468         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
12469         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
12470         esac
12471         case "$getpwent_r_proto" in
12472         ''|0)   d_getpwent_r=undef
12473                 getpwent_r_proto=0
12474                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
12475         * )     case "$getpwent_r_proto" in
12476                 REENTRANT_PROTO*) ;;
12477                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
12478                 esac
12479                 echo "Prototype: $try" ;;
12480         esac
12481         ;;
12482         *)      case "$usethreads" in
12483                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
12484                 esac
12485                 d_getpwent_r=undef
12486                 getpwent_r_proto=0
12487                 ;;
12488         esac
12489         ;;
12490 *)      getpwent_r_proto=0
12491         ;;
12492 esac
12493
12494 : see if getpwnam_r exists
12495 set getpwnam_r d_getpwnam_r
12496 eval $inlibc
12497 case "$d_getpwnam_r" in
12498 "$define")
12499         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12500         case "$d_getpwnam_r_proto:$usethreads" in
12501         ":define")      d_getpwnam_r_proto=define
12502                 set d_getpwnam_r_proto getpwnam_r $hdrs
12503                 eval $hasproto ;;
12504         *)      ;;
12505         esac
12506         case "$d_getpwnam_r_proto" in
12507         define)
12508         case "$getpwnam_r_proto" in
12509         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
12510         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
12511         esac
12512         case "$getpwnam_r_proto" in
12513         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
12514         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
12515         esac
12516         case "$getpwnam_r_proto" in
12517         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
12518         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
12519         esac
12520         case "$getpwnam_r_proto" in
12521         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
12522         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
12523         esac
12524         case "$getpwnam_r_proto" in
12525         ''|0)   d_getpwnam_r=undef
12526                 getpwnam_r_proto=0
12527                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
12528         * )     case "$getpwnam_r_proto" in
12529                 REENTRANT_PROTO*) ;;
12530                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
12531                 esac
12532                 echo "Prototype: $try" ;;
12533         esac
12534         ;;
12535         *)      case "$usethreads" in
12536                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
12537                 esac
12538                 d_getpwnam_r=undef
12539                 getpwnam_r_proto=0
12540                 ;;
12541         esac
12542         ;;
12543 *)      getpwnam_r_proto=0
12544         ;;
12545 esac
12546
12547 : see if getpwuid_r exists
12548 set getpwuid_r d_getpwuid_r
12549 eval $inlibc
12550 case "$d_getpwuid_r" in
12551 "$define")
12552         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12553         case "$d_getpwuid_r_proto:$usethreads" in
12554         ":define")      d_getpwuid_r_proto=define
12555                 set d_getpwuid_r_proto getpwuid_r $hdrs
12556                 eval $hasproto ;;
12557         *)      ;;
12558         esac
12559         case "$d_getpwuid_r_proto" in
12560         define)
12561         case "$getpwuid_r_proto" in
12562         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
12563         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
12564         esac
12565         case "$getpwuid_r_proto" in
12566         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
12567         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
12568         esac
12569         case "$getpwuid_r_proto" in
12570         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
12571         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
12572         esac
12573         case "$getpwuid_r_proto" in
12574         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
12575         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
12576         esac
12577         case "$getpwuid_r_proto" in
12578         ''|0)   d_getpwuid_r=undef
12579                 getpwuid_r_proto=0
12580                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
12581         * )     case "$getpwuid_r_proto" in
12582                 REENTRANT_PROTO*) ;;
12583                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
12584                 esac
12585                 echo "Prototype: $try" ;;
12586         esac
12587         ;;
12588         *)      case "$usethreads" in
12589                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
12590                 esac
12591                 d_getpwuid_r=undef
12592                 getpwuid_r_proto=0
12593                 ;;
12594         esac
12595         ;;
12596 *)      getpwuid_r_proto=0
12597         ;;
12598 esac
12599
12600
12601 : see if getservbyname exists
12602 set getservbyname d_getsbyname
12603 eval $inlibc
12604
12605 : see if getservbyport exists
12606 set getservbyport d_getsbyport
12607 eval $inlibc
12608
12609 : see if getservent exists
12610 set getservent d_getsent
12611 eval $inlibc
12612
12613 : see if getservbyname_r exists
12614 set getservbyname_r d_getservbyname_r
12615 eval $inlibc
12616 case "$d_getservbyname_r" in
12617 "$define")
12618         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12619         case "$d_getservbyname_r_proto:$usethreads" in
12620         ":define")      d_getservbyname_r_proto=define
12621                 set d_getservbyname_r_proto getservbyname_r $hdrs
12622                 eval $hasproto ;;
12623         *)      ;;
12624         esac
12625         case "$d_getservbyname_r_proto" in
12626         define)
12627         case "$getservbyname_r_proto" in
12628         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
12629         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
12630         esac
12631         case "$getservbyname_r_proto" in
12632         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
12633         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
12634         esac
12635         case "$getservbyname_r_proto" in
12636         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
12637         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
12638         esac
12639         case "$getservbyname_r_proto" in
12640         ''|0)   d_getservbyname_r=undef
12641                 getservbyname_r_proto=0
12642                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
12643         * )     case "$getservbyname_r_proto" in
12644                 REENTRANT_PROTO*) ;;
12645                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
12646                 esac
12647                 echo "Prototype: $try" ;;
12648         esac
12649         ;;
12650         *)      case "$usethreads" in
12651                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
12652                 esac
12653                 d_getservbyname_r=undef
12654                 getservbyname_r_proto=0
12655                 ;;
12656         esac
12657         ;;
12658 *)      getservbyname_r_proto=0
12659         ;;
12660 esac
12661
12662 : see if getservbyport_r exists
12663 set getservbyport_r d_getservbyport_r
12664 eval $inlibc
12665 case "$d_getservbyport_r" in
12666 "$define")
12667         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12668         case "$d_getservbyport_r_proto:$usethreads" in
12669         ":define")      d_getservbyport_r_proto=define
12670                 set d_getservbyport_r_proto getservbyport_r $hdrs
12671                 eval $hasproto ;;
12672         *)      ;;
12673         esac
12674         case "$d_getservbyport_r_proto" in
12675         define)
12676         case "$getservbyport_r_proto" in
12677         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
12678         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
12679         esac
12680         case "$getservbyport_r_proto" in
12681         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
12682         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
12683         esac
12684         case "$getservbyport_r_proto" in
12685         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
12686         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
12687         esac
12688         case "$getservbyport_r_proto" in
12689         ''|0)   d_getservbyport_r=undef
12690                 getservbyport_r_proto=0
12691                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
12692         * )     case "$getservbyport_r_proto" in
12693                 REENTRANT_PROTO*) ;;
12694                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
12695                 esac
12696                 echo "Prototype: $try" ;;
12697         esac
12698         ;;
12699         *)      case "$usethreads" in
12700                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
12701                 esac
12702                 d_getservbyport_r=undef
12703                 getservbyport_r_proto=0
12704                 ;;
12705         esac
12706         ;;
12707 *)      getservbyport_r_proto=0
12708         ;;
12709 esac
12710
12711 : see if getservent_r exists
12712 set getservent_r d_getservent_r
12713 eval $inlibc
12714 case "$d_getservent_r" in
12715 "$define")
12716         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12717         case "$d_getservent_r_proto:$usethreads" in
12718         ":define")      d_getservent_r_proto=define
12719                 set d_getservent_r_proto getservent_r $hdrs
12720                 eval $hasproto ;;
12721         *)      ;;
12722         esac
12723         case "$d_getservent_r_proto" in
12724         define)
12725         case "$getservent_r_proto" in
12726         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
12727         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
12728         esac
12729         case "$getservent_r_proto" in
12730         ''|0) try='int getservent_r(struct servent*, char*, int);'
12731         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
12732         esac
12733         case "$getservent_r_proto" in
12734         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
12735         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
12736         esac
12737         case "$getservent_r_proto" in
12738         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
12739         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
12740         esac
12741         case "$getservent_r_proto" in
12742         ''|0)   d_getservent_r=undef
12743                 getservent_r_proto=0
12744                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
12745         * )     case "$getservent_r_proto" in
12746                 REENTRANT_PROTO*) ;;
12747                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
12748                 esac
12749                 echo "Prototype: $try" ;;
12750         esac
12751         ;;
12752         *)      case "$usethreads" in
12753                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
12754                 esac
12755                 d_getservent_r=undef
12756                 getservent_r_proto=0
12757                 ;;
12758         esac
12759         ;;
12760 *)      getservent_r_proto=0
12761         ;;
12762 esac
12763
12764 : see if prototypes for various getservxxx netdb.h functions are available
12765 echo " "
12766 set d_getservprotos getservent $i_netdb netdb.h
12767 eval $hasproto
12768
12769 : see if getspnam exists
12770 set getspnam d_getspnam
12771 eval $inlibc
12772
12773 : see if this is a shadow.h system
12774 set shadow.h i_shadow
12775 eval $inhdr
12776
12777 : see if getspnam_r exists
12778 set getspnam_r d_getspnam_r
12779 eval $inlibc
12780 case "$d_getspnam_r" in
12781 "$define")
12782         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
12783         case "$d_getspnam_r_proto:$usethreads" in
12784         ":define")      d_getspnam_r_proto=define
12785                 set d_getspnam_r_proto getspnam_r $hdrs
12786                 eval $hasproto ;;
12787         *)      ;;
12788         esac
12789         case "$d_getspnam_r_proto" in
12790         define)
12791         case "$getspnam_r_proto" in
12792         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
12793         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
12794         esac
12795         case "$getspnam_r_proto" in
12796         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
12797         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
12798         esac
12799         case "$getspnam_r_proto" in
12800         ''|0)   d_getspnam_r=undef
12801                 getspnam_r_proto=0
12802                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
12803         * )     case "$getspnam_r_proto" in
12804                 REENTRANT_PROTO*) ;;
12805                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
12806                 esac
12807                 echo "Prototype: $try" ;;
12808         esac
12809         ;;
12810         *)      case "$usethreads" in
12811                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
12812                 esac
12813                 d_getspnam_r=undef
12814                 getspnam_r_proto=0
12815                 ;;
12816         esac
12817         ;;
12818 *)      getspnam_r_proto=0
12819         ;;
12820 esac
12821
12822 : see if gettimeofday or ftime exists
12823 set gettimeofday d_gettimeod
12824 eval $inlibc
12825 case "$d_gettimeod" in
12826 "$undef")
12827         set ftime d_ftime 
12828         eval $inlibc
12829         ;;
12830 *)
12831         val="$undef"; set d_ftime; eval $setvar
12832         ;;
12833 esac
12834 case "$d_gettimeod$d_ftime" in
12835 "$undef$undef")
12836         echo " "
12837         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
12838         ;;
12839 esac
12840
12841 : see if gmtime_r exists
12842 set gmtime_r d_gmtime_r
12843 eval $inlibc
12844 case "$d_gmtime_r" in
12845 "$define")
12846         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12847         case "$d_gmtime_r_proto:$usethreads" in
12848         ":define")      d_gmtime_r_proto=define
12849                 set d_gmtime_r_proto gmtime_r $hdrs
12850                 eval $hasproto ;;
12851         *)      ;;
12852         esac
12853         case "$d_gmtime_r_proto" in
12854         define)
12855         case "$gmtime_r_proto" in
12856         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
12857         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
12858         esac
12859         case "$gmtime_r_proto" in
12860         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
12861         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
12862         esac
12863         case "$gmtime_r_proto" in
12864         ''|0)   d_gmtime_r=undef
12865                 gmtime_r_proto=0
12866                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
12867         * )     case "$gmtime_r_proto" in
12868                 REENTRANT_PROTO*) ;;
12869                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
12870                 esac
12871                 echo "Prototype: $try" ;;
12872         esac
12873         ;;
12874         *)      case "$usethreads" in
12875                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
12876                 esac
12877                 d_gmtime_r=undef
12878                 gmtime_r_proto=0
12879                 ;;
12880         esac
12881         ;;
12882 *)      gmtime_r_proto=0
12883         ;;
12884 esac
12885
12886 : see if hasmntopt exists
12887 set hasmntopt d_hasmntopt
12888 eval $inlibc
12889
12890 : see if this is a netinet/in.h or sys/in.h system
12891 set netinet/in.h i_niin sys/in.h i_sysin
12892 eval $inhdr
12893
12894 : see if arpa/inet.h has to be included
12895 set arpa/inet.h i_arpainet
12896 eval $inhdr
12897
12898 : see if htonl --and friends-- exists
12899 val=''
12900 set htonl val
12901 eval $inlibc
12902
12903 : Maybe they are macros.
12904 case "$val" in
12905 $undef)
12906         $cat >htonl.c <<EOM
12907 #include <stdio.h>
12908 #include <sys/types.h>
12909 #$i_niin I_NETINET_IN
12910 #$i_sysin I_SYS_IN
12911 #$i_arpainet I_ARPA_INET
12912 #ifdef I_NETINET_IN
12913 #include <netinet/in.h>
12914 #endif
12915 #ifdef I_SYS_IN
12916 #include <sys/in.h>
12917 #endif
12918 #ifdef I_ARPA_INET
12919 #include <arpa/inet.h>
12920 #endif
12921 #ifdef htonl
12922 printf("Defined as a macro.");
12923 #endif
12924 EOM
12925         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
12926         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
12927                 val="$define"
12928                 echo "But it seems to be defined as a macro." >&4
12929         fi
12930         $rm -f htonl.?
12931         ;;
12932 esac
12933 set d_htonl
12934 eval $setvar
12935
12936 : index or strchr
12937 echo " "
12938 if set index val -f; eval $csym; $val; then
12939         if set strchr val -f d_strchr; eval $csym; $val; then
12940                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
12941                         val="$define"
12942                         vali="$undef"
12943                         echo "strchr() found." >&4
12944                 else
12945                         val="$undef"
12946                         vali="$define"
12947                         echo "index() found." >&4
12948                 fi
12949         else
12950                 val="$undef"
12951                 vali="$define"
12952                 echo "index() found." >&4
12953         fi
12954 else
12955         if set strchr val -f d_strchr; eval $csym; $val; then
12956                 val="$define"
12957                 vali="$undef"
12958                 echo "strchr() found." >&4
12959         else
12960                 echo "No index() or strchr() found!" >&4
12961                 val="$undef"
12962                 vali="$undef"
12963         fi
12964 fi
12965 set d_strchr; eval $setvar
12966 val="$vali"
12967 set d_index; eval $setvar
12968
12969 : check whether inet_aton exists
12970 set inet_aton d_inetaton
12971 eval $inlibc
12972
12973 : Look for isascii
12974 echo " "
12975 $cat >isascii.c <<'EOCP'
12976 #include <stdio.h>
12977 #include <ctype.h>
12978 int main() {
12979         int c = 'A';
12980         if (isascii(c))
12981                 exit(0);
12982         else
12983                 exit(1);
12984 }
12985 EOCP
12986 set isascii
12987 if eval $compile; then
12988         echo "isascii() found." >&4
12989         val="$define"
12990 else
12991         echo "isascii() NOT found." >&4
12992         val="$undef"
12993 fi
12994 set d_isascii
12995 eval $setvar
12996 $rm -f isascii*
12997
12998 : see if isfinite exists
12999 set isfinite d_isfinite
13000 eval $inlibc
13001
13002 : see if isinf exists
13003 set isinf d_isinf
13004 eval $inlibc
13005
13006 : see if isnan exists
13007 set isnan d_isnan
13008 eval $inlibc
13009
13010 : see if isnanl exists
13011 set isnanl d_isnanl
13012 eval $inlibc
13013
13014 : see if killpg exists
13015 set killpg d_killpg
13016 eval $inlibc
13017
13018 : see if lchown exists
13019 echo " "
13020 $cat > try.c <<'EOCP'
13021 /* System header to define __stub macros and hopefully few prototypes,
13022     which can conflict with char lchown(); below.  */
13023 #include <assert.h>
13024 /* Override any gcc2 internal prototype to avoid an error.  */
13025 /* We use char because int might match the return type of a gcc2
13026    builtin and then its argument prototype would still apply.  */
13027 char lchown();
13028 int main() {
13029     /*  The GNU C library defines this for functions which it implements
13030         to always fail with ENOSYS.  Some functions are actually named
13031         something starting with __ and the normal name is an alias.  */
13032 #if defined (__stub_lchown) || defined (__stub___lchown)
13033 choke me
13034 #else
13035 lchown();
13036 #endif
13037 ; return 0; }
13038 EOCP
13039 set try
13040 if eval $compile; then
13041     $echo "lchown() found." >&4
13042     val="$define"
13043 else
13044     $echo "lchown() NOT found." >&4
13045     val="$undef"
13046 fi
13047 set d_lchown
13048 eval $setvar
13049
13050 : See if number of significant digits in a double precision number is known
13051 echo " "
13052 $cat >ldbl_dig.c <<EOM
13053 #$i_limits I_LIMITS
13054 #$i_float I_FLOAT
13055 #ifdef I_LIMITS
13056 #include <limits.h>
13057 #endif
13058 #ifdef I_FLOAT
13059 #include <float.h>
13060 #endif
13061 #ifdef LDBL_DIG
13062 printf("Contains LDBL_DIG");
13063 #endif
13064 EOM
13065 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
13066 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
13067         echo "LDBL_DIG found." >&4
13068         val="$define"
13069 else
13070         echo "LDBL_DIG NOT found." >&4
13071         val="$undef"
13072 fi
13073 $rm -f ldbl_dig.?
13074 set d_ldbl_dig
13075 eval $setvar
13076
13077 : see if link exists
13078 set link d_link
13079 eval $inlibc
13080
13081 : see if localtime_r exists
13082 set localtime_r d_localtime_r
13083 eval $inlibc
13084 case "$d_localtime_r" in
13085 "$define")
13086         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13087         case "$d_localtime_r_proto:$usethreads" in
13088         ":define")      d_localtime_r_proto=define
13089                 set d_localtime_r_proto localtime_r $hdrs
13090                 eval $hasproto ;;
13091         *)      ;;
13092         esac
13093         case "$d_localtime_r_proto" in
13094         define)
13095         case "$localtime_r_proto" in
13096         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
13097         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
13098         esac
13099         case "$localtime_r_proto" in
13100         ''|0) try='int localtime_r(const time_t*, struct tm*);'
13101         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
13102         esac
13103         case "$localtime_r_proto" in
13104         ''|0)   d_localtime_r=undef
13105                 localtime_r_proto=0
13106                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
13107         * )     case "$localtime_r_proto" in
13108                 REENTRANT_PROTO*) ;;
13109                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
13110                 esac
13111                 echo "Prototype: $try" ;;
13112         esac
13113         ;;
13114         *)      case "$usethreads" in
13115                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
13116                 esac
13117                 d_localtime_r=undef
13118                 localtime_r_proto=0
13119                 ;;
13120         esac
13121         ;;
13122 *)      localtime_r_proto=0
13123         ;;
13124 esac
13125
13126 : see if localeconv exists
13127 set localeconv d_locconv
13128 eval $inlibc
13129
13130 : see if lockf exists
13131 set lockf d_lockf
13132 eval $inlibc
13133
13134 : see if prototype for lseek is available
13135 echo " "
13136 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
13137 eval $hasproto
13138
13139 : see if lstat exists
13140 set lstat d_lstat
13141 eval $inlibc
13142
13143 : see if madvise exists
13144 set madvise d_madvise
13145 eval $inlibc
13146
13147 : see if mblen exists
13148 set mblen d_mblen
13149 eval $inlibc
13150
13151 : see if mbstowcs exists
13152 set mbstowcs d_mbstowcs
13153 eval $inlibc
13154
13155 : see if mbtowc exists
13156 set mbtowc d_mbtowc
13157 eval $inlibc
13158
13159 : see if memchr exists
13160 set memchr d_memchr
13161 eval $inlibc
13162
13163 : see if memcmp exists
13164 set memcmp d_memcmp
13165 eval $inlibc
13166
13167 : see if memcpy exists
13168 set memcpy d_memcpy
13169 eval $inlibc
13170
13171 : see if memmove exists
13172 set memmove d_memmove
13173 eval $inlibc
13174
13175 : see if memset exists
13176 set memset d_memset
13177 eval $inlibc
13178
13179 : see if mkdir exists
13180 set mkdir d_mkdir
13181 eval $inlibc
13182
13183 : see if mkdtemp exists
13184 set mkdtemp d_mkdtemp
13185 eval $inlibc
13186
13187 : see if mkfifo exists
13188 set mkfifo d_mkfifo
13189 eval $inlibc
13190
13191 : see if mkstemp exists
13192 set mkstemp d_mkstemp
13193 eval $inlibc
13194
13195 : see if mkstemps exists
13196 set mkstemps d_mkstemps
13197 eval $inlibc
13198
13199 : see if mktime exists
13200 set mktime d_mktime
13201 eval $inlibc
13202
13203 : see if this is a sys/mman.h system
13204 set sys/mman.h i_sysmman
13205 eval $inhdr
13206
13207 : see if mmap exists
13208 set mmap d_mmap
13209 eval $inlibc
13210 : see what shmat returns
13211 : default to something harmless
13212 mmaptype='void *'
13213 case "$i_sysmman$d_mmap" in
13214 "$define$define")
13215         $cat >mmap.c <<'END'
13216 #include <sys/mman.h>
13217 void *mmap();
13218 END
13219         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
13220                 mmaptype='void *'
13221         else
13222                 mmaptype='caddr_t'
13223         fi
13224         echo "and it returns ($mmaptype)." >&4
13225         ;;
13226 esac
13227
13228
13229
13230 : see if mprotect exists
13231 set mprotect d_mprotect
13232 eval $inlibc
13233
13234 : see if msgctl exists
13235 set msgctl d_msgctl
13236 eval $inlibc
13237
13238 : see if msgget exists
13239 set msgget d_msgget
13240 eval $inlibc
13241
13242 : see if msgsnd exists
13243 set msgsnd d_msgsnd
13244 eval $inlibc
13245
13246 : see if msgrcv exists
13247 set msgrcv d_msgrcv
13248 eval $inlibc
13249
13250 : see how much of the 'msg*(2)' library is present.
13251 h_msg=true
13252 echo " "
13253 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
13254 *"$undef"*) h_msg=false;;
13255 esac
13256 case "$osname" in
13257 freebsd)
13258     case "`ipcs 2>&1`" in
13259     "SVID messages"*"not configured"*)
13260         echo "Your $osname does not have the msg*(2) configured." >&4
13261         h_msg=false
13262         val="$undef"
13263         set msgctl d_msgctl
13264         eval $setvar
13265         set msgget d_msgget
13266         eval $setvar
13267         set msgsnd d_msgsnd
13268         eval $setvar
13269         set msgrcv d_msgrcv
13270         eval $setvar
13271         ;;
13272     esac
13273     ;;
13274 esac
13275 : we could also check for sys/ipc.h ...
13276 if $h_msg && $test `./findhdr sys/msg.h`; then
13277         echo "You have the full msg*(2) library." >&4
13278         val="$define"
13279 else
13280         echo "You don't have the full msg*(2) library." >&4
13281         val="$undef"
13282 fi
13283 set d_msg
13284 eval $setvar
13285
13286
13287 echo " "
13288 echo "Checking to see if your system supports struct msghdr..." >&4
13289 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
13290 eval $hasstruct
13291 case "$d_msghdr_s" in
13292 "$define")      echo "Yes, it does."   ;;
13293 *)              echo "No, it doesn't." ;;
13294 esac
13295
13296
13297 : see if msync exists
13298 set msync d_msync
13299 eval $inlibc
13300
13301 : see if munmap exists
13302 set munmap d_munmap
13303 eval $inlibc
13304
13305 : see if nice exists
13306 set nice d_nice
13307 eval $inlibc
13308
13309 : see if this is a langinfo.h system
13310 set langinfo.h i_langinfo
13311 eval $inhdr
13312
13313 : see if nl_langinfo exists
13314 set nl_langinfo d_nl_langinfo
13315 eval $inlibc
13316
13317 : check for length of character
13318 echo " "
13319 case "$charsize" in
13320 '')
13321         echo "Checking to see how big your characters are (hey, you never know)..." >&4
13322         $cat >try.c <<'EOCP'
13323 #include <stdio.h>
13324 int main()
13325 {
13326     printf("%d\n", (int)sizeof(char));
13327     exit(0);
13328 }
13329 EOCP
13330         set try
13331         if eval $compile_ok; then
13332                 dflt=`$run ./try`
13333         else
13334                 dflt='1'
13335                 echo "(I can't seem to compile the test program.  Guessing...)"
13336         fi
13337         ;;
13338 *)
13339         dflt="$charsize"
13340         ;;
13341 esac
13342 rp="What is the size of a character (in bytes)?"
13343 . ./myread
13344 charsize="$ans"
13345 $rm -f try.c try
13346
13347 : check for volatile keyword
13348 echo " "
13349 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
13350 $cat >try.c <<'EOCP'
13351 int main()
13352 {
13353         typedef struct _goo_struct goo_struct;
13354         goo_struct * volatile goo = ((goo_struct *)0);
13355         struct _goo_struct {
13356                 long long_int;
13357                 int reg_int;
13358                 char char_var;
13359         };
13360         typedef unsigned short foo_t;
13361         char *volatile foo;
13362         volatile int bar;
13363         volatile foo_t blech;
13364         foo = foo;
13365 }
13366 EOCP
13367 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
13368         val="$define"
13369         echo "Yup, it does."
13370 else
13371         val="$undef"
13372         echo "Nope, it doesn't."
13373 fi
13374 set d_volatile
13375 eval $setvar
13376 $rm -f try.*
13377
13378
13379 echo " "
13380 $echo "Choosing the C types to be used for Perl's internal types..." >&4
13381
13382 case "$use64bitint:$d_quad:$quadtype" in
13383 define:define:?*)
13384         ivtype="$quadtype"
13385         uvtype="$uquadtype"
13386         ivsize=8
13387         uvsize=8
13388         ;;
13389 *)      ivtype="long"
13390         uvtype="unsigned long"
13391         ivsize=$longsize
13392         uvsize=$longsize
13393         ;;
13394 esac
13395
13396 case "$uselongdouble:$d_longdbl" in
13397 define:define)
13398         nvtype="long double"
13399         nvsize=$longdblsize
13400         ;;
13401 *)      nvtype=double
13402         nvsize=$doublesize
13403         ;;
13404 esac
13405
13406 $echo "(IV will be "$ivtype", $ivsize bytes)"
13407 $echo "(UV will be "$uvtype", $uvsize bytes)"
13408 $echo "(NV will be "$nvtype", $nvsize bytes)"
13409
13410 $cat >try.c <<EOCP
13411 #$i_inttypes I_INTTYPES
13412 #ifdef I_INTTYPES
13413 #include <inttypes.h>
13414 #endif
13415 #include <stdio.h>
13416 int main() {
13417 #ifdef INT8
13418    int8_t i =  INT8_MAX;
13419   uint8_t u = UINT8_MAX;
13420   printf("int8_t\n");
13421 #endif
13422 #ifdef INT16
13423    int16_t i =  INT16_MAX;
13424   uint16_t i = UINT16_MAX;
13425   printf("int16_t\n");
13426 #endif
13427 #ifdef INT32
13428    int32_t i =  INT32_MAX;
13429   uint32_t u = UINT32_MAX;
13430   printf("int32_t\n");
13431 #endif
13432 }
13433 EOCP
13434
13435 case "$i8type" in
13436 '')     case "$charsize" in
13437         1)      i8type=char
13438                 u8type="unsigned char"
13439                 i8size=$charsize
13440                 u8size=$charsize
13441                 ;;
13442         esac
13443         ;;
13444 esac
13445 case "$i8type" in
13446 '')     set try -DINT8
13447         if eval $compile; then
13448                 case "`$run ./try`" in
13449                 int8_t) i8type=int8_t
13450                         u8type=uint8_t
13451                         i8size=1
13452                         u8size=1
13453                         ;;
13454                 esac
13455         fi
13456         ;;
13457 esac
13458 case "$i8type" in
13459 '')     if $test $charsize -ge 1; then
13460                 i8type=char
13461                 u8type="unsigned char"
13462                 i8size=$charsize
13463                 u8size=$charsize
13464         fi
13465         ;;
13466 esac
13467
13468 case "$i16type" in
13469 '')     case "$shortsize" in
13470         2)      i16type=short
13471                 u16type="unsigned short"
13472                 i16size=$shortsize
13473                 u16size=$shortsize
13474                 ;;
13475         esac
13476         ;;
13477 esac
13478 case "$i16type" in
13479 '')     set try -DINT16
13480         if eval $compile; then
13481                 case "`$run ./try`" in
13482                 int16_t)
13483                         i16type=int16_t
13484                         u16type=uint16_t
13485                         i16size=2
13486                         u16size=2
13487                         ;;
13488                 esac
13489         fi
13490         ;;
13491 esac
13492 case "$i16type" in
13493 '')     if $test $shortsize -ge 2; then
13494                 i16type=short
13495                 u16type="unsigned short"
13496                 i16size=$shortsize
13497                 u16size=$shortsize
13498         fi
13499         ;;
13500 esac
13501
13502 case "$i32type" in
13503 '')     case "$longsize" in
13504         4)      i32type=long
13505                 u32type="unsigned long"
13506                 i32size=$longsize
13507                 u32size=$longsize
13508                 ;;
13509         *)      case "$intsize" in
13510                 4)      i32type=int
13511                         u32type="unsigned int"
13512                         i32size=$intsize
13513                         u32size=$intsize
13514                         ;;
13515                 esac
13516                 ;;
13517         esac
13518         ;;
13519 esac
13520 case "$i32type" in
13521 '')     set try -DINT32
13522         if eval $compile; then
13523                 case "`$run ./try`" in
13524                 int32_t)
13525                         i32type=int32_t
13526                         u32type=uint32_t
13527                         i32size=4
13528                         u32size=4
13529                         ;;
13530                 esac
13531         fi
13532         ;;
13533 esac
13534 case "$i32type" in
13535 '')     if $test $intsize -ge 4; then
13536                 i32type=int
13537                 u32type="unsigned int"
13538                 i32size=$intsize
13539                 u32size=$intsize
13540         fi
13541         ;;
13542 esac
13543
13544 case "$i64type" in
13545 '')     case "$d_quad:$quadtype" in
13546         define:?*)
13547                 i64type="$quadtype"
13548                 u64type="$uquadtype"
13549                 i64size=8
13550                 u64size=8
13551                 ;;
13552         esac
13553         ;;
13554 esac
13555
13556 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
13557 : volatile so that the compiler has to store it out to memory.
13558 if test X"$d_volatile" = X"$define"; then
13559         volatile=volatile
13560 fi
13561 $cat <<EOP >try.c
13562 #include <stdio.h>
13563 #include <sys/types.h>
13564 #include <signal.h>
13565 #ifdef SIGFPE
13566 $volatile int bletched = 0;
13567 $signal_t blech(s) int s; { bletched = 1; }
13568 #endif
13569 int main() {
13570     $uvtype u = 0;
13571     $nvtype d;
13572     int     n = 8 * $uvsize;
13573     int     i;
13574 #ifdef SIGFPE
13575     signal(SIGFPE, blech);
13576 #endif
13577
13578     for (i = 0; i < n; i++) {
13579       u = u << 1 | ($uvtype)1;
13580       d = ($nvtype)u;
13581       if (($uvtype)d != u)
13582         break;
13583       if (d <= 0)
13584         break;
13585       d = ($nvtype)(u - 1);
13586       if (($uvtype)d != (u - 1))
13587         break;
13588 #ifdef SIGFPE
13589       if (bletched) {
13590         break;
13591 #endif
13592       } 
13593     }
13594     printf("%d\n", ((i == n) ? -n : i));
13595     exit(0);
13596 }
13597 EOP
13598 set try
13599
13600 d_nv_preserves_uv="$undef"
13601 if eval $compile; then
13602         nv_preserves_uv_bits="`$run ./try`"
13603 fi
13604 case "$nv_preserves_uv_bits" in
13605 \-[1-9]*)       
13606         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
13607         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
13608         d_nv_preserves_uv="$define"
13609         ;;
13610 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
13611         d_nv_preserves_uv="$undef" ;;
13612 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
13613         nv_preserves_uv_bits="$undef" ;;
13614 esac
13615
13616 $rm -f try.* try
13617
13618
13619 : check for off64_t
13620 echo " "
13621 echo "Checking to see if you have off64_t..." >&4
13622 $cat >try.c <<EOCP
13623 #include <sys/types.h>
13624 #include <unistd.h>
13625 int main() { off64_t x = 7; }
13626 EOCP
13627 set try
13628 if eval $compile; then
13629         val="$define"
13630         echo "You have off64_t."
13631 else
13632         val="$undef"
13633         echo "You do not have off64_t."
13634         case "$lseeksize" in
13635         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
13636         esac
13637 fi
13638 $rm -f try.* try
13639 set d_off64_t
13640 eval $setvar
13641
13642 : how to create joinable pthreads
13643 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
13644         echo " "
13645         echo "Checking what constant to use for creating joinable pthreads..." >&4 
13646         $cat >try.c <<'EOCP'
13647 #include <pthread.h>
13648 int main() {
13649     int detachstate = JOINABLE;
13650 }
13651 EOCP
13652         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
13653         if eval $compile; then
13654                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
13655                 val="$undef" # Yes, undef.
13656                 set d_old_pthread_create_joinable
13657                 eval $setvar
13658                 val=""
13659                 set old_pthread_create_joinable
13660                 eval $setvar
13661         else
13662                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
13663                 if eval $compile; then
13664                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
13665                         val="$define"
13666                         set d_old_pthread_create_joinable
13667                         eval $setvar
13668                         val=PTHREAD_CREATE_UNDETACHED
13669                         set old_pthread_create_joinable
13670                         eval $setvar
13671                 else            
13672                         set try -DJOINABLE=__UNDETACHED
13673                         if eval $compile; then
13674                                 echo "You seem to use __UNDETACHED." >&4
13675                                 val="$define"
13676                                 set d_old_pthread_create_joinable
13677                                 eval $setvar
13678                                 val=__UNDETACHED
13679                                 set old_pthread_create_joinable
13680                                 eval $setvar
13681                         else
13682                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
13683                                 val="$define"
13684                                 set d_old_pthread_create_joinable
13685                                 eval $setvar
13686                                 val=0
13687                                 set old_pthread_create_joinable
13688                                 eval $setvar
13689                         fi
13690                 fi
13691         fi
13692         $rm -f try try.*
13693 else
13694     d_old_pthread_create_joinable="$undef"
13695     old_pthread_create_joinable=""
13696 fi
13697
13698 : see if pause exists
13699 set pause d_pause
13700 eval $inlibc
13701
13702 : see if pipe exists
13703 set pipe d_pipe
13704 eval $inlibc
13705
13706 : see if poll exists
13707 set poll d_poll
13708 eval $inlibc
13709
13710 : see if readlink exists
13711 set readlink d_readlink
13712 eval $inlibc
13713
13714 echo " "
13715 procselfexe=''
13716 val="$undef"
13717 case "$d_readlink" in
13718 "$define")
13719         if $issymlink /proc/self/exe ; then
13720                 $ls -l /proc/self/exe > reflect
13721                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13722                         echo "You have Linux-like /proc/self/exe."
13723                         procselfexe='"/proc/self/exe"'
13724                         val="$define"
13725                 fi
13726         fi
13727         if $issymlink /proc/curproc/file ; then
13728                 $ls -l /proc/curproc/file > reflect
13729                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13730                         echo "You have BSD-like /proc/curproc/file."
13731                         procselfexe='"/proc/curproc/file"'
13732                         val="$define"
13733                 fi
13734         fi
13735         ;;
13736 esac
13737 $rm -f reflect
13738 set d_procselfexe
13739 eval $setvar
13740
13741 : see whether the pthread_atfork exists
13742 $cat >try.c <<EOP
13743 #include <pthread.h>
13744 #include <stdio.h>
13745 int main() {
13746 #ifdef  PTHREAD_ATFORK
13747         pthread_atfork(NULL,NULL,NULL);
13748 #endif
13749 }
13750 EOP
13751
13752 : see if pthread_atfork exists
13753 set try -DPTHREAD_ATFORK
13754 if eval $compile; then
13755     val="$define"
13756 else
13757     val="$undef"
13758 fi
13759 case "$usethreads" in
13760 $define)
13761         case "$val" in
13762         $define) echo 'pthread_atfork found.' >&4        ;;
13763         *)       echo 'pthread_atfork NOT found.' >&4    ;;
13764         esac
13765 esac
13766 set d_pthread_atfork
13767 eval $setvar
13768
13769
13770 : see whether the various POSIXish _yields exist
13771 $cat >try.c <<EOP
13772 #include <pthread.h>
13773 #include <stdio.h>
13774 int main() {
13775 #ifdef SCHED_YIELD
13776         sched_yield();
13777 #else
13778 #ifdef PTHREAD_YIELD
13779         pthread_yield();
13780 #else
13781 #ifdef PTHREAD_YIELD_NULL
13782         pthread_yield(NULL);
13783 #endif
13784 #endif
13785 #endif
13786 }
13787 EOP
13788 : see if sched_yield exists
13789 set try -DSCHED_YIELD
13790 if eval $compile; then
13791     val="$define"
13792     sched_yield='sched_yield()'
13793 else
13794     val="$undef"
13795 fi
13796 case "$usethreads" in
13797 $define)
13798         case "$val" in
13799         $define) echo 'sched_yield() found.' >&4        ;;
13800         *)       echo 'sched_yield() NOT found.' >&4    ;;
13801         esac
13802 esac
13803 set d_sched_yield
13804 eval $setvar
13805
13806 : see if pthread_yield exists
13807 set try -DPTHREAD_YIELD
13808 if eval $compile; then
13809     val="$define"
13810     case "$sched_yield" in
13811     '') sched_yield='pthread_yield()' ;;
13812     esac
13813 else
13814     set try -DPTHREAD_YIELD_NULL
13815     if eval $compile; then
13816         val="$define"
13817         case "$sched_yield" in
13818         '') sched_yield='pthread_yield(NULL)' ;;
13819         esac
13820     else
13821         val="$undef"
13822     fi
13823 fi
13824 case "$usethreads" in
13825 $define)
13826         case "$val" in
13827         $define) echo 'pthread_yield() found.' >&4      ;;
13828         *)       echo 'pthread_yield() NOT found.' >&4  ;;
13829         esac
13830         ;;
13831 esac
13832 set d_pthread_yield
13833 eval $setvar
13834
13835 case "$sched_yield" in
13836 '') sched_yield=undef ;;
13837 esac
13838
13839 $rm -f try try.*
13840
13841 : see if random_r exists
13842 set random_r d_random_r
13843 eval $inlibc
13844 case "$d_random_r" in
13845 "$define")
13846         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
13847         case "$d_random_r_proto:$usethreads" in
13848         ":define")      d_random_r_proto=define
13849                 set d_random_r_proto random_r $hdrs
13850                 eval $hasproto ;;
13851         *)      ;;
13852         esac
13853         case "$d_random_r_proto" in
13854         define)
13855         case "$random_r_proto" in
13856         ''|0) try='int random_r(int*, struct random_data*);'
13857         ./protochk "extern $try" $hdrs && random_r_proto=I_TS ;;
13858         esac
13859         case "$random_r_proto" in
13860         ''|0)   d_random_r=undef
13861                 random_r_proto=0
13862                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
13863         * )     case "$random_r_proto" in
13864                 REENTRANT_PROTO*) ;;
13865                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
13866                 esac
13867                 echo "Prototype: $try" ;;
13868         esac
13869         ;;
13870         *)      case "$usethreads" in
13871                 define) echo "random_r has no prototype, not using it." >&4 ;;
13872                 esac
13873                 d_random_r=undef
13874                 random_r_proto=0
13875                 ;;
13876         esac
13877         ;;
13878 *)      random_r_proto=0
13879         ;;
13880 esac
13881
13882 : see if readdir and friends exist
13883 set readdir d_readdir
13884 eval $inlibc
13885 set seekdir d_seekdir
13886 eval $inlibc
13887 set telldir d_telldir
13888 eval $inlibc
13889 set rewinddir d_rewinddir
13890 eval $inlibc
13891
13892 : see if readdir64_r exists
13893 set readdir64_r d_readdir64_r
13894 eval $inlibc
13895 case "$d_readdir64_r" in
13896 "$define")
13897         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
13898         case "$d_readdir64_r_proto:$usethreads" in
13899         ":define")      d_readdir64_r_proto=define
13900                 set d_readdir64_r_proto readdir64_r $hdrs
13901                 eval $hasproto ;;
13902         *)      ;;
13903         esac
13904         case "$d_readdir64_r_proto" in
13905         define)
13906         case "$readdir64_r_proto" in
13907         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
13908         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
13909         esac
13910         case "$readdir64_r_proto" in
13911         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
13912         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
13913         esac
13914         case "$readdir64_r_proto" in
13915         ''|0)   d_readdir64_r=undef
13916                 readdir64_r_proto=0
13917                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
13918         * )     case "$readdir64_r_proto" in
13919                 REENTRANT_PROTO*) ;;
13920                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
13921                 esac
13922                 echo "Prototype: $try" ;;
13923         esac
13924         ;;
13925         *)      case "$usethreads" in
13926                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
13927                 esac
13928                 d_readdir64_r=undef
13929                 readdir64_r_proto=0
13930                 ;;
13931         esac
13932         ;;
13933 *)      readdir64_r_proto=0
13934         ;;
13935 esac
13936
13937 : see if readdir_r exists
13938 set readdir_r d_readdir_r
13939 eval $inlibc
13940 case "$d_readdir_r" in
13941 "$define")
13942         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
13943         case "$d_readdir_r_proto:$usethreads" in
13944         ":define")      d_readdir_r_proto=define
13945                 set d_readdir_r_proto readdir_r $hdrs
13946                 eval $hasproto ;;
13947         *)      ;;
13948         esac
13949         case "$d_readdir_r_proto" in
13950         define)
13951         case "$readdir_r_proto" in
13952         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
13953         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
13954         esac
13955         case "$readdir_r_proto" in
13956         ''|0) try='int readdir_r(DIR*, struct dirent*);'
13957         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
13958         esac
13959         case "$readdir_r_proto" in
13960         ''|0)   d_readdir_r=undef
13961                 readdir_r_proto=0
13962                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
13963         * )     case "$readdir_r_proto" in
13964                 REENTRANT_PROTO*) ;;
13965                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
13966                 esac
13967                 echo "Prototype: $try" ;;
13968         esac
13969         ;;
13970         *)      case "$usethreads" in
13971                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
13972                 esac
13973                 d_readdir_r=undef
13974                 readdir_r_proto=0
13975                 ;;
13976         esac
13977         ;;
13978 *)      readdir_r_proto=0
13979         ;;
13980 esac
13981
13982 : see if readv exists
13983 set readv d_readv
13984 eval $inlibc
13985
13986 : see if recvmsg exists
13987 set recvmsg d_recvmsg
13988 eval $inlibc
13989
13990 : see if rename exists
13991 set rename d_rename
13992 eval $inlibc
13993
13994 : see if rmdir exists
13995 set rmdir d_rmdir
13996 eval $inlibc
13997
13998 : see if memory.h is available.
13999 val=''
14000 set memory.h val
14001 eval $inhdr
14002
14003 : See if it conflicts with string.h
14004 case "$val" in
14005 $define)
14006         case "$strings" in
14007         '') ;;
14008         *)
14009                 $cppstdin $cppflags $cppminus < $strings > mem.h
14010                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
14011                         echo " "
14012                         echo "We won't be including <memory.h>."
14013                         val="$undef"
14014                 fi
14015                 $rm -f mem.h
14016                 ;;
14017         esac
14018 esac
14019 set i_memory
14020 eval $setvar
14021
14022 : can bcopy handle overlapping blocks?
14023 echo " "
14024 val="$undef"
14025 case "$d_memmove" in
14026 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
14027 *)      case "$d_bcopy" in
14028         "$define")
14029                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
14030                 $cat >try.c <<EOCP
14031 #$i_memory I_MEMORY
14032 #$i_stdlib I_STDLIB
14033 #$i_string I_STRING
14034 #$i_unistd I_UNISTD
14035 EOCP
14036         $cat >>try.c <<'EOCP'
14037 #include <stdio.h>
14038 #ifdef I_MEMORY
14039 #  include <memory.h>
14040 #endif
14041 #ifdef I_STDLIB
14042 #  include <stdlib.h>
14043 #endif
14044 #ifdef I_STRING
14045 #  include <string.h>
14046 #else
14047 #  include <strings.h>
14048 #endif
14049 #ifdef I_UNISTD
14050 #  include <unistd.h>  /* Needed for NetBSD */
14051 #endif
14052 int main()
14053 {
14054 char buf[128], abc[128];
14055 char *b;
14056 int len;
14057 int off;
14058 int align;
14059
14060 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14061    try to store the string in read-only memory. */
14062 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
14063
14064 for (align = 7; align >= 0; align--) {
14065         for (len = 36; len; len--) {
14066                 b = buf+align;
14067                 bcopy(abc, b, len);
14068                 for (off = 1; off <= len; off++) {
14069                         bcopy(b, b+off, len);
14070                         bcopy(b+off, b, len);
14071                         if (bcmp(b, abc, len))
14072                                 exit(1);
14073                 }
14074         }
14075 }
14076 exit(0);
14077 }
14078 EOCP
14079                 set try
14080                 if eval $compile_ok; then
14081                         if ./try 2>/dev/null; then
14082                                 echo "Yes, it can."
14083                                 val="$define"
14084                         else
14085                                 echo "It can't, sorry."
14086                         fi
14087                 else
14088                         echo "(I can't compile the test program, so we'll assume not...)"
14089                 fi
14090                 ;;
14091         esac
14092         $rm -f try.* try core
14093         ;;
14094 esac
14095 set d_safebcpy
14096 eval $setvar
14097
14098 : can memcpy handle overlapping blocks?
14099 echo " "
14100 val="$undef"
14101 case "$d_memmove" in
14102 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
14103 *)      case "$d_memcpy" in
14104         "$define")
14105                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
14106                 $cat >try.c <<EOCP
14107 #$i_memory I_MEMORY
14108 #$i_stdlib I_STDLIB
14109 #$i_string I_STRING
14110 #$i_unistd I_UNISTD
14111 EOCP
14112         $cat >>try.c <<'EOCP'
14113 #include <stdio.h>
14114 #ifdef I_MEMORY
14115 #  include <memory.h>
14116 #endif
14117 #ifdef I_STDLIB
14118 #  include <stdlib.h>
14119 #endif
14120 #ifdef I_STRING
14121 #  include <string.h>
14122 #else
14123 #  include <strings.h>
14124 #endif
14125 #ifdef I_UNISTD
14126 #  include <unistd.h>  /* Needed for NetBSD */
14127 #endif
14128 int main()
14129 {
14130 char buf[128], abc[128];
14131 char *b;
14132 int len;
14133 int off;
14134 int align;
14135
14136 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14137    try to store the string in read-only memory. */
14138 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
14139
14140 for (align = 7; align >= 0; align--) {
14141         for (len = 36; len; len--) {
14142                 b = buf+align;
14143                 memcpy(b, abc, len);
14144                 for (off = 1; off <= len; off++) {
14145                         memcpy(b+off, b, len);
14146                         memcpy(b, b+off, len);
14147                         if (memcmp(b, abc, len))
14148                                 exit(1);
14149                 }
14150         }
14151 }
14152 exit(0);
14153 }
14154 EOCP
14155                 set try
14156                 if eval $compile_ok; then
14157                         if ./try 2>/dev/null; then
14158                                 echo "Yes, it can."
14159                                 val="$define"
14160                         else
14161                                 echo "It can't, sorry."
14162                         fi
14163                 else
14164                         echo "(I can't compile the test program, so we'll assume not...)"
14165                 fi
14166                 ;;
14167         esac
14168         $rm -f try.* try core
14169         ;;
14170 esac
14171 set d_safemcpy
14172 eval $setvar
14173
14174 : can memcmp be trusted to compare relative magnitude?
14175 val="$undef"
14176 case "$d_memcmp" in
14177 "$define")
14178         echo " "
14179         echo "Checking if your memcmp() can compare relative magnitude..." >&4
14180         $cat >try.c <<EOCP
14181 #$i_memory I_MEMORY
14182 #$i_stdlib I_STDLIB
14183 #$i_string I_STRING
14184 #$i_unistd I_UNISTD
14185 EOCP
14186         $cat >>try.c <<'EOCP'
14187 #include <stdio.h>
14188 #ifdef I_MEMORY
14189 #  include <memory.h>
14190 #endif
14191 #ifdef I_STDLIB
14192 #  include <stdlib.h>
14193 #endif
14194 #ifdef I_STRING
14195 #  include <string.h>
14196 #else
14197 #  include <strings.h>
14198 #endif
14199 #ifdef I_UNISTD
14200 #  include <unistd.h>  /* Needed for NetBSD */
14201 #endif
14202 int main()
14203 {
14204 char a = -1;
14205 char b = 0;
14206 if ((a < b) && memcmp(&a, &b, 1) < 0)
14207         exit(1);
14208 exit(0);
14209 }
14210 EOCP
14211         set try
14212         if eval $compile_ok; then
14213                 if $run ./try 2>/dev/null; then
14214                         echo "Yes, it can."
14215                         val="$define"
14216                 else
14217                         echo "No, it can't (it uses signed chars)."
14218                 fi
14219         else
14220                 echo "(I can't compile the test program, so we'll assume not...)"
14221         fi
14222         ;;
14223 esac
14224 $rm -f try.* try core
14225 set d_sanemcmp
14226 eval $setvar
14227
14228 : see if prototype for sbrk is available
14229 echo " "
14230 set d_sbrkproto sbrk $i_unistd unistd.h
14231 eval $hasproto
14232
14233 : see if select exists
14234 set select d_select
14235 eval $inlibc
14236
14237 : see if semctl exists
14238 set semctl d_semctl
14239 eval $inlibc
14240
14241 : see if semget exists
14242 set semget d_semget
14243 eval $inlibc
14244
14245 : see if semop exists
14246 set semop d_semop
14247 eval $inlibc
14248
14249 : see how much of the 'sem*(2)' library is present.
14250 h_sem=true
14251 echo " "
14252 case "$d_semctl$d_semget$d_semop" in
14253 *"$undef"*) h_sem=false;;
14254 esac
14255 case "$osname" in
14256 freebsd)
14257     case "`ipcs 2>&1`" in
14258     "SVID messages"*"not configured"*)
14259         echo "Your $osname does not have the sem*(2) configured." >&4
14260         h_sem=false
14261         val="$undef"
14262         set semctl d_semctl
14263         eval $setvar
14264         set semget d_semget
14265         eval $setvar
14266         set semop d_semop
14267         eval $setvar
14268         ;;
14269     esac
14270     ;;
14271 esac
14272 : we could also check for sys/ipc.h ...
14273 if $h_sem && $test `./findhdr sys/sem.h`; then
14274         echo "You have the full sem*(2) library." >&4
14275         val="$define"
14276 else
14277         echo "You don't have the full sem*(2) library." >&4
14278         val="$undef"
14279 fi
14280 set d_sem
14281 eval $setvar
14282
14283 : see whether sys/sem.h defines union semun
14284 echo " "
14285 $cat > try.c <<'END'
14286 #include <sys/types.h>
14287 #include <sys/ipc.h>
14288 #include <sys/sem.h>
14289 int main () { union semun semun; semun.buf = 0; }
14290 END
14291 set try
14292 if eval $compile; then
14293     echo "You have union semun in <sys/sem.h>." >&4
14294     val="$define"
14295 else
14296     echo "You do not have union semun in <sys/sem.h>." >&4
14297     val="$undef"
14298 fi
14299 $rm -f try try.c try.h
14300 set d_union_semun
14301 eval $setvar
14302
14303 : see how to do semctl IPC_STAT
14304 case "$d_sem" in
14305 $define)
14306     : see whether semctl IPC_STAT can use union semun
14307     echo " "
14308     $cat > try.h <<END
14309 #ifndef S_IRUSR
14310 #   ifdef S_IREAD
14311 #       define S_IRUSR S_IREAD
14312 #       define S_IWUSR S_IWRITE
14313 #       define S_IXUSR S_IEXEC
14314 #   else
14315 #       define S_IRUSR 0400
14316 #       define S_IWUSR 0200
14317 #       define S_IXUSR 0100
14318 #   endif
14319 #   define S_IRGRP (S_IRUSR>>3)
14320 #   define S_IWGRP (S_IWUSR>>3)
14321 #   define S_IXGRP (S_IXUSR>>3)
14322 #   define S_IROTH (S_IRUSR>>6)
14323 #   define S_IWOTH (S_IWUSR>>6)
14324 #   define S_IXOTH (S_IXUSR>>6)
14325 #endif
14326 #ifndef S_IRWXU
14327 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
14328 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
14329 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
14330 #endif
14331 END
14332
14333     $cat > try.c <<END
14334 #include <sys/types.h>
14335 #include <sys/ipc.h>
14336 #include <sys/sem.h>
14337 #include <sys/stat.h>
14338 #include <stdio.h>
14339 #include <errno.h>
14340 #include "try.h"
14341 #ifndef errno
14342 extern int errno;
14343 #endif
14344 #$d_union_semun HAS_UNION_SEMUN
14345 int main() {
14346     union semun
14347 #ifndef HAS_UNION_SEMUN
14348     {
14349         int val;
14350         struct semid_ds *buf;
14351         unsigned short *array;
14352     }
14353 #endif
14354     arg;
14355     int sem, st;
14356
14357 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
14358     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14359     if (sem > -1) {
14360         struct semid_ds argbuf;
14361         arg.buf = &argbuf;
14362 #       ifdef IPC_STAT
14363         st = semctl(sem, 0, IPC_STAT, arg);
14364         if (st == 0)
14365             printf("semun\n");
14366         else
14367 #       endif /* IPC_STAT */
14368             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14369 #       ifdef IPC_RMID
14370         if (semctl(sem, 0, IPC_RMID, arg) != 0)
14371 #       endif /* IPC_RMID */
14372             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14373     } else
14374 #endif /* IPC_PRIVATE && ... */
14375         printf("semget failed: errno = %d\n", errno);
14376   return 0;
14377 }
14378 END
14379     val="$undef"
14380     set try
14381     if eval $compile; then
14382         xxx=`$run ./try`
14383         case "$xxx" in
14384         semun) val="$define" ;;
14385         esac
14386     fi
14387     $rm -f try try.c
14388     set d_semctl_semun
14389     eval $setvar
14390     case "$d_semctl_semun" in
14391     $define)
14392         echo "You can use union semun for semctl IPC_STAT." >&4
14393         also='also'
14394         ;;
14395     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
14396         also=''
14397         ;;
14398     esac
14399
14400     : see whether semctl IPC_STAT can use struct semid_ds pointer
14401     $cat > try.c <<'END'
14402 #include <sys/types.h>
14403 #include <sys/ipc.h>
14404 #include <sys/sem.h>
14405 #include <sys/stat.h>
14406 #include "try.h"
14407 #include <stdio.h>
14408 #include <errno.h>
14409 #ifndef errno
14410 extern int errno;
14411 #endif
14412 int main() {
14413     struct semid_ds arg;
14414     int sem, st;
14415
14416 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
14417     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14418     if (sem > -1) {
14419 #       ifdef IPC_STAT
14420         st = semctl(sem, 0, IPC_STAT, &arg);
14421         if (st == 0)
14422             printf("semid_ds\n");
14423         else
14424 #       endif /* IPC_STAT */
14425             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14426 #       ifdef IPC_RMID
14427         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
14428 #       endif /* IPC_RMID */
14429             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14430     } else
14431 #endif /* IPC_PRIVATE && ... */
14432         printf("semget failed: errno = %d\n", errno);
14433
14434     return 0;
14435 }
14436 END
14437     val="$undef"
14438     set try
14439     if eval $compile; then
14440         xxx=`$run ./try`
14441         case "$xxx" in
14442         semid_ds) val="$define" ;;
14443         esac
14444     fi
14445     $rm -f try try.c
14446     set d_semctl_semid_ds
14447     eval $setvar
14448     case "$d_semctl_semid_ds" in
14449     $define)
14450         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
14451         ;;
14452     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
14453         ;;
14454     esac
14455     $rm -f try.h
14456     ;;
14457 *)  val="$undef"
14458
14459     # We do not have the full sem*(2) library, so assume we can not
14460     # use either.
14461
14462     set d_semctl_semun
14463     eval $setvar
14464
14465     set d_semctl_semid_ds
14466     eval $setvar
14467     ;;
14468 esac
14469
14470 : see if sendmsg exists
14471 set sendmsg d_sendmsg
14472 eval $inlibc
14473
14474 : see if setegid exists
14475 set setegid d_setegid
14476 eval $inlibc
14477
14478 : see if seteuid exists
14479 set seteuid d_seteuid
14480 eval $inlibc
14481
14482 : see if setgrent exists
14483 set setgrent d_setgrent
14484 eval $inlibc
14485
14486 : see if setgrent_r exists
14487 set setgrent_r d_setgrent_r
14488 eval $inlibc
14489 case "$d_setgrent_r" in
14490 "$define")
14491         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14492         case "$d_setgrent_r_proto:$usethreads" in
14493         ":define")      d_setgrent_r_proto=define
14494                 set d_setgrent_r_proto setgrent_r $hdrs
14495                 eval $hasproto ;;
14496         *)      ;;
14497         esac
14498         case "$d_setgrent_r_proto" in
14499         define)
14500         case "$setgrent_r_proto" in
14501         ''|0) try='int setgrent_r(FILE**);'
14502         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
14503         esac
14504         case "$setgrent_r_proto" in
14505         ''|0) try='void setgrent_r(FILE**);'
14506         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
14507         esac
14508         case "$setgrent_r_proto" in
14509         ''|0)   d_setgrent_r=undef
14510                 setgrent_r_proto=0
14511                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
14512         * )     case "$setgrent_r_proto" in
14513                 REENTRANT_PROTO*) ;;
14514                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
14515                 esac
14516                 echo "Prototype: $try" ;;
14517         esac
14518         ;;
14519         *)      case "$usethreads" in
14520                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
14521                 esac
14522                 d_setgrent_r=undef
14523                 setgrent_r_proto=0
14524                 ;;
14525         esac
14526         ;;
14527 *)      setgrent_r_proto=0
14528         ;;
14529 esac
14530
14531 : see if sethostent exists
14532 set sethostent d_sethent
14533 eval $inlibc
14534
14535 : see if sethostent_r exists
14536 set sethostent_r d_sethostent_r
14537 eval $inlibc
14538 case "$d_sethostent_r" in
14539 "$define")
14540         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14541         case "$d_sethostent_r_proto:$usethreads" in
14542         ":define")      d_sethostent_r_proto=define
14543                 set d_sethostent_r_proto sethostent_r $hdrs
14544                 eval $hasproto ;;
14545         *)      ;;
14546         esac
14547         case "$d_sethostent_r_proto" in
14548         define)
14549         case "$sethostent_r_proto" in
14550         ''|0) try='int sethostent_r(int, struct hostent_data*);'
14551         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
14552         esac
14553         case "$sethostent_r_proto" in
14554         ''|0) try='void sethostent_r(int, struct hostent_data*);'
14555         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
14556         esac
14557         case "$sethostent_r_proto" in
14558         ''|0)   d_sethostent_r=undef
14559                 sethostent_r_proto=0
14560                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
14561         * )     case "$sethostent_r_proto" in
14562                 REENTRANT_PROTO*) ;;
14563                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
14564                 esac
14565                 echo "Prototype: $try" ;;
14566         esac
14567         ;;
14568         *)      case "$usethreads" in
14569                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
14570                 esac
14571                 d_sethostent_r=undef
14572                 sethostent_r_proto=0
14573                 ;;
14574         esac
14575         ;;
14576 *)      sethostent_r_proto=0
14577         ;;
14578 esac
14579
14580 : see if setitimer exists
14581 set setitimer d_setitimer
14582 eval $inlibc
14583
14584 : see if setlinebuf exists
14585 set setlinebuf d_setlinebuf
14586 eval $inlibc
14587
14588 : see if setlocale exists
14589 set setlocale d_setlocale
14590 eval $inlibc
14591
14592 : see if locale.h is available
14593 set locale.h i_locale
14594 eval $inhdr
14595
14596 : see if setlocale_r exists
14597 set setlocale_r d_setlocale_r
14598 eval $inlibc
14599 case "$d_setlocale_r" in
14600 "$define")
14601         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
14602         case "$d_setlocale_r_proto:$usethreads" in
14603         ":define")      d_setlocale_r_proto=define
14604                 set d_setlocale_r_proto setlocale_r $hdrs
14605                 eval $hasproto ;;
14606         *)      ;;
14607         esac
14608         case "$d_setlocale_r_proto" in
14609         define)
14610         case "$setlocale_r_proto" in
14611         ''|0) try='int setlocale_r(int, const char*, char*, int);'
14612         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
14613         esac
14614         case "$setlocale_r_proto" in
14615         ''|0)   d_setlocale_r=undef
14616                 setlocale_r_proto=0
14617                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
14618         * )     case "$setlocale_r_proto" in
14619                 REENTRANT_PROTO*) ;;
14620                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
14621                 esac
14622                 echo "Prototype: $try" ;;
14623         esac
14624         ;;
14625         *)      case "$usethreads" in
14626                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
14627                 esac
14628                 d_setlocale_r=undef
14629                 setlocale_r_proto=0
14630                 ;;
14631         esac
14632         ;;
14633 *)      setlocale_r_proto=0
14634         ;;
14635 esac
14636
14637 : see if setnetent exists
14638 set setnetent d_setnent
14639 eval $inlibc
14640
14641 : see if setnetent_r exists
14642 set setnetent_r d_setnetent_r
14643 eval $inlibc
14644 case "$d_setnetent_r" in
14645 "$define")
14646         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14647         case "$d_setnetent_r_proto:$usethreads" in
14648         ":define")      d_setnetent_r_proto=define
14649                 set d_setnetent_r_proto setnetent_r $hdrs
14650                 eval $hasproto ;;
14651         *)      ;;
14652         esac
14653         case "$d_setnetent_r_proto" in
14654         define)
14655         case "$setnetent_r_proto" in
14656         ''|0) try='int setnetent_r(int, struct netent_data*);'
14657         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
14658         esac
14659         case "$setnetent_r_proto" in
14660         ''|0) try='void setnetent_r(int, struct netent_data*);'
14661         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
14662         esac
14663         case "$setnetent_r_proto" in
14664         ''|0)   d_setnetent_r=undef
14665                 setnetent_r_proto=0
14666                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
14667         * )     case "$setnetent_r_proto" in
14668                 REENTRANT_PROTO*) ;;
14669                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
14670                 esac
14671                 echo "Prototype: $try" ;;
14672         esac
14673         ;;
14674         *)      case "$usethreads" in
14675                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
14676                 esac
14677                 d_setnetent_r=undef
14678                 setnetent_r_proto=0
14679                 ;;
14680         esac
14681         ;;
14682 *)      setnetent_r_proto=0
14683         ;;
14684 esac
14685
14686 : see if setprotoent exists
14687 set setprotoent d_setpent
14688 eval $inlibc
14689
14690 : see if setpgid exists
14691 set setpgid d_setpgid
14692 eval $inlibc
14693
14694 : see if setpgrp2 exists
14695 set setpgrp2 d_setpgrp2
14696 eval $inlibc
14697
14698 : see if setpriority exists
14699 set setpriority d_setprior
14700 eval $inlibc
14701
14702 : see if setproctitle exists
14703 set setproctitle d_setproctitle
14704 eval $inlibc
14705
14706 : see if setprotoent_r exists
14707 set setprotoent_r d_setprotoent_r
14708 eval $inlibc
14709 case "$d_setprotoent_r" in
14710 "$define")
14711         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14712         case "$d_setprotoent_r_proto:$usethreads" in
14713         ":define")      d_setprotoent_r_proto=define
14714                 set d_setprotoent_r_proto setprotoent_r $hdrs
14715                 eval $hasproto ;;
14716         *)      ;;
14717         esac
14718         case "$d_setprotoent_r_proto" in
14719         define)
14720         case "$setprotoent_r_proto" in
14721         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
14722         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
14723         esac
14724         case "$setprotoent_r_proto" in
14725         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
14726         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
14727         esac
14728         case "$setprotoent_r_proto" in
14729         ''|0)   d_setprotoent_r=undef
14730                 setprotoent_r_proto=0
14731                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
14732         * )     case "$setprotoent_r_proto" in
14733                 REENTRANT_PROTO*) ;;
14734                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
14735                 esac
14736                 echo "Prototype: $try" ;;
14737         esac
14738         ;;
14739         *)      case "$usethreads" in
14740                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
14741                 esac
14742                 d_setprotoent_r=undef
14743                 setprotoent_r_proto=0
14744                 ;;
14745         esac
14746         ;;
14747 *)      setprotoent_r_proto=0
14748         ;;
14749 esac
14750
14751 : see if setpwent exists
14752 set setpwent d_setpwent
14753 eval $inlibc
14754
14755 : see if setpwent_r exists
14756 set setpwent_r d_setpwent_r
14757 eval $inlibc
14758 case "$d_setpwent_r" in
14759 "$define")
14760         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14761         case "$d_setpwent_r_proto:$usethreads" in
14762         ":define")      d_setpwent_r_proto=define
14763                 set d_setpwent_r_proto setpwent_r $hdrs
14764                 eval $hasproto ;;
14765         *)      ;;
14766         esac
14767         case "$d_setpwent_r_proto" in
14768         define)
14769         case "$setpwent_r_proto" in
14770         ''|0) try='int setpwent_r(FILE**);'
14771         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
14772         esac
14773         case "$setpwent_r_proto" in
14774         ''|0) try='void setpwent_r(FILE**);'
14775         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
14776         esac
14777         case "$setpwent_r_proto" in
14778         ''|0)   d_setpwent_r=undef
14779                 setpwent_r_proto=0
14780                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
14781         * )     case "$setpwent_r_proto" in
14782                 REENTRANT_PROTO*) ;;
14783                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
14784                 esac
14785                 echo "Prototype: $try" ;;
14786         esac
14787         ;;
14788         *)      case "$usethreads" in
14789                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
14790                 esac
14791                 d_setpwent_r=undef
14792                 setpwent_r_proto=0
14793                 ;;
14794         esac
14795         ;;
14796 *)      setpwent_r_proto=0
14797         ;;
14798 esac
14799
14800 : see if setregid exists
14801 set setregid d_setregid
14802 eval $inlibc
14803 set setresgid d_setresgid
14804 eval $inlibc
14805
14806 : see if setreuid exists
14807 set setreuid d_setreuid
14808 eval $inlibc
14809 set setresuid d_setresuid
14810 eval $inlibc
14811
14812 : see if setrgid exists
14813 set setrgid d_setrgid
14814 eval $inlibc
14815
14816 : see if setruid exists
14817 set setruid d_setruid
14818 eval $inlibc
14819
14820 : see if setservent exists
14821 set setservent d_setsent
14822 eval $inlibc
14823
14824 : see if setservent_r exists
14825 set setservent_r d_setservent_r
14826 eval $inlibc
14827 case "$d_setservent_r" in
14828 "$define")
14829         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14830         case "$d_setservent_r_proto:$usethreads" in
14831         ":define")      d_setservent_r_proto=define
14832                 set d_setservent_r_proto setservent_r $hdrs
14833                 eval $hasproto ;;
14834         *)      ;;
14835         esac
14836         case "$d_setservent_r_proto" in
14837         define)
14838         case "$setservent_r_proto" in
14839         ''|0) try='int setservent_r(int, struct servent_data*);'
14840         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
14841         esac
14842         case "$setservent_r_proto" in
14843         ''|0) try='void setservent_r(int, struct servent_data*);'
14844         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
14845         esac
14846         case "$setservent_r_proto" in
14847         ''|0)   d_setservent_r=undef
14848                 setservent_r_proto=0
14849                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
14850         * )     case "$setservent_r_proto" in
14851                 REENTRANT_PROTO*) ;;
14852                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
14853                 esac
14854                 echo "Prototype: $try" ;;
14855         esac
14856         ;;
14857         *)      case "$usethreads" in
14858                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
14859                 esac
14860                 d_setservent_r=undef
14861                 setservent_r_proto=0
14862                 ;;
14863         esac
14864         ;;
14865 *)      setservent_r_proto=0
14866         ;;
14867 esac
14868
14869 : see if setsid exists
14870 set setsid d_setsid
14871 eval $inlibc
14872
14873 : see if setvbuf exists
14874 set setvbuf d_setvbuf
14875 eval $inlibc
14876
14877 : see if sfio.h is available
14878 set sfio.h i_sfio
14879 eval $inhdr
14880
14881
14882 : see if sfio library is available
14883 case "$i_sfio" in
14884 $define)
14885         val=''
14886         set sfreserve val
14887         eval $inlibc
14888         ;;
14889 *)
14890         val="$undef"
14891         ;;
14892 esac
14893 : Ok, but do we want to use it.
14894 case "$val" in
14895 $define)
14896         case "$usesfio" in
14897         true|$define|[yY]*) dflt='y';;
14898         *) dflt='n';;
14899         esac
14900         echo "$package can use the sfio library, but it is experimental."
14901         case "$useperlio" in
14902         "$undef")
14903             echo "For sfio also the PerlIO abstraction layer is needed."
14904             echo "Earlier you said you wouldn't want that."
14905             ;;
14906         esac
14907         rp="You seem to have sfio available, do you want to try using it?"
14908         . ./myread
14909         case "$ans" in
14910         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
14911                 useperlio="$define"
14912                 val="$define"
14913                 ;;
14914         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
14915                 val="$undef"
14916                 ;;
14917         esac
14918         ;;
14919 *)      case "$usesfio" in
14920         true|$define|[yY]*)
14921                 echo "Sorry, cannot find sfio on this machine." >&4
14922                 echo "Ignoring your setting of usesfio=$usesfio." >&4
14923                 val="$undef"
14924                 ;;
14925         esac
14926         ;;
14927 esac
14928 set d_sfio
14929 eval $setvar
14930 case "$d_sfio" in
14931 $define) usesfio='true';;
14932 *) usesfio='false';;
14933 esac
14934 case "$d_sfio" in
14935 $define) ;;
14936 *)      : Remove sfio from list of libraries to use
14937         case "$libs" in
14938         *-lsfio*)
14939                 echo "Removing unneeded -lsfio from library list" >&4
14940                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
14941                 shift
14942                 libs="$*"
14943                 echo "libs = $libs" >&4
14944                 ;;
14945         esac
14946 ;;
14947 esac
14948
14949
14950 : see if shmctl exists
14951 set shmctl d_shmctl
14952 eval $inlibc
14953
14954 : see if shmget exists
14955 set shmget d_shmget
14956 eval $inlibc
14957
14958 : see if shmat exists
14959 set shmat d_shmat
14960 eval $inlibc
14961 : see what shmat returns
14962 case "$d_shmat" in
14963 "$define")
14964         $cat >shmat.c <<'END'
14965 #include <sys/shm.h>
14966 void *shmat();
14967 END
14968         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
14969                 shmattype='void *'
14970         else
14971                 shmattype='char *'
14972         fi
14973         echo "and it returns ($shmattype)." >&4
14974         : see if a prototype for shmat is available
14975         xxx=`./findhdr sys/shm.h`
14976         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
14977         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
14978                 val="$define"
14979         else
14980                 val="$undef"
14981         fi
14982         $rm -f shmat.[co]
14983         ;;
14984 *)
14985         val="$undef"
14986         ;;
14987 esac
14988 set d_shmatprototype
14989 eval $setvar
14990
14991 : see if shmdt exists
14992 set shmdt d_shmdt
14993 eval $inlibc
14994
14995 : see how much of the 'shm*(2)' library is present.
14996 h_shm=true
14997 echo " "
14998 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
14999 *"$undef"*) h_shm=false;;
15000 esac
15001 case "$osname" in
15002 freebsd)
15003     case "`ipcs 2>&1`" in
15004     "SVID shared memory"*"not configured"*)
15005         echo "Your $osname does not have the shm*(2) configured." >&4
15006         h_shm=false
15007         val="$undef"
15008         set shmctl d_shmctl
15009         evat $setvar
15010         set shmget d_shmget
15011         evat $setvar
15012         set shmat d_shmat
15013         evat $setvar
15014         set shmdt d_shmdt
15015         evat $setvar
15016         ;;
15017     esac
15018     ;;
15019 esac
15020 : we could also check for sys/ipc.h ...
15021 if $h_shm && $test `./findhdr sys/shm.h`; then
15022         echo "You have the full shm*(2) library." >&4
15023         val="$define"
15024 else
15025         echo "You don't have the full shm*(2) library." >&4
15026         val="$undef"
15027 fi
15028 set d_shm
15029 eval $setvar
15030
15031 echo " "
15032 : see if we have sigaction
15033 if set sigaction val -f d_sigaction; eval $csym; $val; then
15034         echo 'sigaction() found.' >&4
15035         $cat > try.c <<'EOP'
15036 #include <stdio.h>
15037 #include <sys/types.h>
15038 #include <signal.h>
15039 int main()
15040 {
15041     struct sigaction act, oact;
15042     act.sa_flags = 0;
15043     oact.sa_handler = 0;
15044     /* so that act and oact are used */
15045     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
15046 }
15047 EOP
15048         set try
15049         if eval $compile_ok; then
15050                 val="$define"
15051         else
15052                 echo "But you don't seem to have a useable struct sigaction." >&4
15053                 val="$undef"
15054         fi
15055 else
15056         echo 'sigaction NOT found.' >&4
15057         val="$undef"
15058 fi
15059 set d_sigaction; eval $setvar
15060 $rm -f try try$_o try.c
15061
15062 : see if sigprocmask exists
15063 set sigprocmask d_sigprocmask
15064 eval $inlibc
15065
15066 : see if sigsetjmp exists
15067 echo " "
15068 case "$d_sigsetjmp" in
15069 '')
15070         $cat >try.c <<'EOP'
15071 #include <setjmp.h>
15072 sigjmp_buf env;
15073 int set = 1;
15074 int main()
15075 {
15076         if (sigsetjmp(env,1))
15077                 exit(set);
15078         set = 0;
15079         siglongjmp(env, 1);
15080         exit(1);
15081 }
15082 EOP
15083         set try
15084         if eval $compile; then
15085                 if $run ./try >/dev/null 2>&1; then
15086                         echo "POSIX sigsetjmp found." >&4
15087                         val="$define"
15088                 else
15089                         $cat >&4 <<EOM
15090 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
15091 I'll ignore them.
15092 EOM
15093                         val="$undef"
15094                 fi
15095         else
15096                 echo "sigsetjmp not found." >&4
15097                 val="$undef"
15098         fi
15099         ;;
15100 *) val="$d_sigsetjmp"
15101         case "$d_sigsetjmp" in
15102         $define) echo "POSIX sigsetjmp found." >&4;;
15103         $undef) echo "sigsetjmp not found." >&4;;
15104         esac
15105         ;;
15106 esac
15107 set d_sigsetjmp
15108 eval $setvar
15109 $rm -f try.c try
15110
15111 : see if sockatmark exists
15112 set sockatmark d_sockatmark
15113 eval $inlibc
15114
15115 : see if prototype for sockatmark is available
15116 echo " "
15117 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
15118 eval $hasproto
15119
15120 : see if socks5_init exists
15121 set socks5_init d_socks5_init
15122 eval $inlibc
15123
15124 : see if srand48_r exists
15125 set srand48_r d_srand48_r
15126 eval $inlibc
15127 case "$d_srand48_r" in
15128 "$define")
15129         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15130         case "$d_srand48_r_proto:$usethreads" in
15131         ":define")      d_srand48_r_proto=define
15132                 set d_srand48_r_proto srand48_r $hdrs
15133                 eval $hasproto ;;
15134         *)      ;;
15135         esac
15136         case "$d_srand48_r_proto" in
15137         define)
15138         case "$srand48_r_proto" in
15139         ''|0) try='int srand48_r(long, struct drand48_data*);'
15140         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
15141         esac
15142         case "$srand48_r_proto" in
15143         ''|0)   d_srand48_r=undef
15144                 srand48_r_proto=0
15145                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
15146         * )     case "$srand48_r_proto" in
15147                 REENTRANT_PROTO*) ;;
15148                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
15149                 esac
15150                 echo "Prototype: $try" ;;
15151         esac
15152         ;;
15153         *)      case "$usethreads" in
15154                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
15155                 esac
15156                 d_srand48_r=undef
15157                 srand48_r_proto=0
15158                 ;;
15159         esac
15160         ;;
15161 *)      srand48_r_proto=0
15162         ;;
15163 esac
15164
15165 : see if srandom_r exists
15166 set srandom_r d_srandom_r
15167 eval $inlibc
15168 case "$d_srandom_r" in
15169 "$define")
15170         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15171         case "$d_srandom_r_proto:$usethreads" in
15172         ":define")      d_srandom_r_proto=define
15173                 set d_srandom_r_proto srandom_r $hdrs
15174                 eval $hasproto ;;
15175         *)      ;;
15176         esac
15177         case "$d_srandom_r_proto" in
15178         define)
15179         case "$srandom_r_proto" in
15180         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
15181         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
15182         esac
15183         case "$srandom_r_proto" in
15184         ''|0)   d_srandom_r=undef
15185                 srandom_r_proto=0
15186                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
15187         * )     case "$srandom_r_proto" in
15188                 REENTRANT_PROTO*) ;;
15189                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
15190                 esac
15191                 echo "Prototype: $try" ;;
15192         esac
15193         ;;
15194         *)      case "$usethreads" in
15195                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
15196                 esac
15197                 d_srandom_r=undef
15198                 srandom_r_proto=0
15199                 ;;
15200         esac
15201         ;;
15202 *)      srandom_r_proto=0
15203         ;;
15204 esac
15205
15206 : see if prototype for setresgid is available
15207 echo " "
15208 set d_sresgproto setresgid $i_unistd unistd.h
15209 eval $hasproto
15210
15211 : see if prototype for setresuid is available
15212 echo " "
15213 set d_sresuproto setresuid $i_unistd unistd.h
15214 eval $hasproto
15215
15216 : see if sys/stat.h is available
15217 set sys/stat.h i_sysstat
15218 eval $inhdr
15219
15220
15221 : see if stat knows about block sizes
15222 echo " "
15223 echo "Checking to see if your struct stat has st_blocks field..." >&4
15224 set d_statblks stat st_blocks $i_sysstat sys/stat.h
15225 eval $hasfield
15226
15227
15228 : see if this is a sys/vfs.h system
15229 set sys/vfs.h i_sysvfs
15230 eval $inhdr
15231
15232
15233 : see if this is a sys/statfs.h system
15234 set sys/statfs.h i_sysstatfs
15235 eval $inhdr
15236
15237
15238 echo " "
15239 echo "Checking to see if your system supports struct statfs..." >&4
15240 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
15241 eval $hasstruct
15242 case "$d_statfs_s" in
15243 "$define")      echo "Yes, it does."   ;;
15244 *)              echo "No, it doesn't." ;;
15245 esac
15246
15247
15248
15249 : see if struct statfs knows about f_flags
15250 case "$d_statfs_s" in
15251 define) 
15252         echo " "
15253         echo "Checking to see if your struct statfs has f_flags field..." >&4
15254         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
15255         eval $hasfield
15256         ;;
15257 *)      val="$undef"
15258         set d_statfs_f_flags
15259         eval $setvar
15260         ;;
15261 esac
15262 case "$d_statfs_f_flags" in
15263 "$define")      echo "Yes, it does."   ;;
15264 *)              echo "No, it doesn't." ;;
15265 esac
15266
15267 : see if _ptr and _cnt from stdio act std
15268 echo " "
15269
15270 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
15271         echo "(Looks like you have stdio.h from BSD.)"
15272         case "$stdio_ptr" in
15273         '') stdio_ptr='((fp)->_p)'
15274                 ptr_lval=$define
15275                 ;;
15276         *)      ptr_lval=$d_stdio_ptr_lval;;
15277         esac
15278         case "$stdio_cnt" in
15279         '') stdio_cnt='((fp)->_r)'
15280                 cnt_lval=$define
15281                 ;;
15282         *)      cnt_lval=$d_stdio_cnt_lval;;
15283         esac
15284         case "$stdio_base" in
15285         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
15286         esac
15287         case "$stdio_bufsiz" in
15288         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
15289         esac
15290 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
15291         echo "(Looks like you have stdio.h from Linux.)"
15292         case "$stdio_ptr" in
15293         '') stdio_ptr='((fp)->_IO_read_ptr)'
15294                 ptr_lval=$define
15295                 ;;
15296         *)      ptr_lval=$d_stdio_ptr_lval;;
15297         esac
15298         case "$stdio_cnt" in
15299         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
15300                 cnt_lval=$undef
15301                 ;;
15302         *)      cnt_lval=$d_stdio_cnt_lval;;
15303         esac
15304         case "$stdio_base" in
15305         '') stdio_base='((fp)->_IO_read_base)';;
15306         esac
15307         case "$stdio_bufsiz" in
15308         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
15309         esac
15310 else
15311         case "$stdio_ptr" in
15312         '') stdio_ptr='((fp)->_ptr)'
15313                 ptr_lval=$define
15314                 ;;
15315         *)      ptr_lval=$d_stdio_ptr_lval;;
15316         esac
15317         case "$stdio_cnt" in
15318         '') stdio_cnt='((fp)->_cnt)'
15319                 cnt_lval=$define
15320                 ;;
15321         *)      cnt_lval=$d_stdio_cnt_lval;;
15322         esac
15323         case "$stdio_base" in
15324         '') stdio_base='((fp)->_base)';;
15325         esac
15326         case "$stdio_bufsiz" in
15327         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
15328         esac
15329 fi
15330
15331 : test whether _ptr and _cnt really work
15332 echo "Checking how std your stdio is..." >&4
15333 $cat >try.c <<EOP
15334 #include <stdio.h>
15335 #define FILE_ptr(fp)    $stdio_ptr
15336 #define FILE_cnt(fp)    $stdio_cnt
15337 int main() {
15338         FILE *fp = fopen("try.c", "r");
15339         char c = getc(fp);
15340         if (
15341                 18 <= FILE_cnt(fp) &&
15342                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15343         )
15344                 exit(0);
15345         exit(1);
15346 }
15347 EOP
15348 val="$undef"
15349 set try
15350 if eval $compile && $to try.c; then
15351         if $run ./try; then
15352                 echo "Your stdio acts pretty std."
15353                 val="$define"
15354         else
15355                 echo "Your stdio isn't very std."
15356         fi
15357 else
15358         echo "Your stdio doesn't appear very std."
15359 fi
15360 $rm -f try.c try
15361 set d_stdstdio
15362 eval $setvar
15363
15364 : Can _ptr be used as an lvalue?
15365 case "$d_stdstdio$ptr_lval" in
15366 $define$define) val=$define ;;
15367 *) val=$undef ;;
15368 esac
15369 set d_stdio_ptr_lval
15370 eval $setvar
15371
15372 : Can _cnt be used as an lvalue?
15373 case "$d_stdstdio$cnt_lval" in
15374 $define$define) val=$define ;;
15375 *) val=$undef ;;
15376 esac
15377 set d_stdio_cnt_lval
15378 eval $setvar
15379
15380
15381 : test whether setting _ptr sets _cnt as a side effect
15382 d_stdio_ptr_lval_sets_cnt="$undef"
15383 d_stdio_ptr_lval_nochange_cnt="$undef"
15384 case "$d_stdio_ptr_lval$d_stdstdio" in
15385 $define$define)
15386         echo "Checking to see what happens if we set the stdio ptr..." >&4
15387 $cat >try.c <<EOP
15388 #include <stdio.h>
15389 /* Can we scream? */
15390 /* Eat dust sed :-) */
15391 /* In the buffer space, no one can hear you scream. */
15392 #define FILE_ptr(fp)    $stdio_ptr
15393 #define FILE_cnt(fp)    $stdio_cnt
15394 #include <sys/types.h>
15395 int main() {
15396         FILE *fp = fopen("try.c", "r");
15397         int c;
15398         char *ptr;
15399         size_t cnt;
15400         if (!fp) {
15401             puts("Fail even to read");
15402             exit(1);
15403         }
15404         c = getc(fp); /* Read away the first # */
15405         if (c == EOF) {
15406             puts("Fail even to read");
15407             exit(1);
15408         }
15409         if (!(
15410                 18 <= FILE_cnt(fp) &&
15411                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15412         )) {
15413                 puts("Fail even to read");
15414                 exit (1);
15415         }
15416         ptr = (char*) FILE_ptr(fp);
15417         cnt = (size_t)FILE_cnt(fp);
15418
15419         FILE_ptr(fp) += 42;
15420
15421         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
15422                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
15423                 exit (1);
15424         }
15425         if (FILE_cnt(fp) <= 20) {
15426                 printf ("Fail (<20 chars to test)");
15427                 exit (1);
15428         }
15429         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
15430                 puts("Fail compare");
15431                 exit (1);
15432         }
15433         if (cnt == FILE_cnt(fp)) {
15434                 puts("Pass_unchanged");
15435                 exit (0);
15436         }       
15437         if (FILE_cnt(fp) == (cnt - 42)) {
15438                 puts("Pass_changed");
15439                 exit (0);
15440         }
15441         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
15442         return 1;
15443
15444 }
15445 EOP
15446         set try
15447         if eval $compile && $to try.c; then
15448                 case `$run ./try` in
15449                 Pass_changed)
15450                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
15451                         d_stdio_ptr_lval_sets_cnt="$define" ;;
15452                 Pass_unchanged)
15453                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
15454                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
15455                 Fail*)
15456                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
15457                 *)
15458                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
15459         esac
15460         else
15461                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
15462         fi
15463         $rm -f try.c try
15464         ;;
15465 esac
15466
15467 : see if _base is also standard
15468 val="$undef"
15469 case "$d_stdstdio" in
15470 $define)
15471         $cat >try.c <<EOP
15472 #include <stdio.h>
15473 #define FILE_base(fp)   $stdio_base
15474 #define FILE_bufsiz(fp) $stdio_bufsiz
15475 int main() {
15476         FILE *fp = fopen("try.c", "r");
15477         char c = getc(fp);
15478         if (
15479                 19 <= FILE_bufsiz(fp) &&
15480                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
15481         )
15482                 exit(0);
15483         exit(1);
15484 }
15485 EOP
15486         set try
15487         if eval $compile && $to try.c; then
15488                 if $run ./try; then
15489                         echo "And its _base field acts std."
15490                         val="$define"
15491                 else
15492                         echo "But its _base field isn't std."
15493                 fi
15494         else
15495                 echo "However, it seems to be lacking the _base field."
15496         fi
15497         $rm -f try.c try
15498         ;;
15499 esac
15500 set d_stdiobase
15501 eval $setvar
15502
15503 $cat >&4 <<EOM
15504 Checking how to access stdio streams by file descriptor number...
15505 EOM
15506 case "$stdio_stream_array" in
15507 '')     $cat >try.c <<EOCP
15508 #include <stdio.h>
15509 int main() {
15510   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
15511     printf("yes\n");
15512 }
15513 EOCP
15514         for s in _iob __iob __sF
15515         do
15516                 set try -DSTDIO_STREAM_ARRAY=$s
15517                 if eval $compile; then
15518                         case "`$run ./try`" in
15519                         yes)    stdio_stream_array=$s; break ;;
15520                         esac
15521                 fi
15522         done
15523         $rm -f try.* try$exe_ext
15524 esac
15525 case "$stdio_stream_array" in
15526 '')     $cat >&4 <<EOM
15527 I can't figure out how to access stdio streams by file descriptor number.
15528 EOM
15529         d_stdio_stream_array="$undef"
15530         ;;
15531 *)      $cat >&4 <<EOM
15532 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
15533 EOM
15534         d_stdio_stream_array="$define"
15535         ;;
15536 esac
15537
15538 : see if strcoll exists
15539 set strcoll d_strcoll
15540 eval $inlibc
15541
15542 : check for structure copying
15543 echo " "
15544 echo "Checking to see if your C compiler can copy structs..." >&4
15545 $cat >try.c <<'EOCP'
15546 int main()
15547 {
15548         struct blurfl {
15549                 int dyick;
15550         } foo, bar;
15551
15552         foo = bar;
15553 }
15554 EOCP
15555 if $cc -c try.c >/dev/null 2>&1 ; then
15556         val="$define"
15557         echo "Yup, it can."
15558 else
15559         val="$undef"
15560         echo "Nope, it can't."
15561 fi
15562 set d_strctcpy
15563 eval $setvar
15564 $rm -f try.*
15565
15566 : see if strerror and/or sys_errlist[] exist
15567 echo " "
15568 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
15569     if set strerror val -f d_strerror; eval $csym; $val; then
15570                 echo 'strerror() found.' >&4
15571                 d_strerror="$define"
15572                 d_strerrm='strerror(e)'
15573                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
15574                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
15575                         d_syserrlst="$define"
15576                 else
15577                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
15578                         d_syserrlst="$undef"
15579                 fi
15580     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
15581                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
15582                 echo 'strerror() found in string header.' >&4
15583                 d_strerror="$define"
15584                 d_strerrm='strerror(e)'
15585                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
15586                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
15587                                 d_syserrlst="$define"
15588                 else
15589                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
15590                         d_syserrlst="$undef"
15591                 fi
15592     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
15593                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
15594                 d_strerror="$undef"
15595                 d_syserrlst="$define"
15596                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
15597     else
15598                 echo 'strerror() and sys_errlist[] NOT found.' >&4
15599                 d_strerror="$undef"
15600                 d_syserrlst="$undef"
15601                 d_strerrm='"unknown"'
15602     fi
15603 fi
15604
15605 : see if strerror_r exists
15606 set strerror_r d_strerror_r
15607 eval $inlibc
15608 case "$d_strerror_r" in
15609 "$define")
15610         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
15611         case "$d_strerror_r_proto:$usethreads" in
15612         ":define")      d_strerror_r_proto=define
15613                 set d_strerror_r_proto strerror_r $hdrs
15614                 eval $hasproto ;;
15615         *)      ;;
15616         esac
15617         case "$d_strerror_r_proto" in
15618         define)
15619         case "$strerror_r_proto" in
15620         ''|0) try='int strerror_r(int, char*, size_t);'
15621         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
15622         esac
15623         case "$strerror_r_proto" in
15624         ''|0) try='int strerror_r(int, char*, int);'
15625         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
15626         esac
15627         case "$strerror_r_proto" in
15628         ''|0) try='char* strerror_r(int, char*, size_t);'
15629         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
15630         esac
15631         case "$strerror_r_proto" in
15632         ''|0)   d_strerror_r=undef
15633                 strerror_r_proto=0
15634                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
15635         * )     case "$strerror_r_proto" in
15636                 REENTRANT_PROTO*) ;;
15637                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
15638                 esac
15639                 echo "Prototype: $try" ;;
15640         esac
15641         ;;
15642         *)      case "$usethreads" in
15643                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
15644                 esac
15645                 d_strerror_r=undef
15646                 strerror_r_proto=0
15647                 ;;
15648         esac
15649         ;;
15650 *)      strerror_r_proto=0
15651         ;;
15652 esac
15653
15654 : see if strftime exists
15655 set strftime d_strftime
15656 eval $inlibc
15657
15658 : see if strtod exists
15659 set strtod d_strtod
15660 eval $inlibc
15661
15662 : see if strtol exists
15663 set strtol d_strtol
15664 eval $inlibc
15665
15666 : see if strtold exists
15667 set strtold d_strtold
15668 eval $inlibc
15669
15670 : see if strtoll exists
15671 set strtoll d_strtoll
15672 eval $inlibc
15673
15674 case "$d_longlong-$d_strtoll" in
15675 "$define-$define")
15676         $cat <<EOM
15677 Checking whether your strtoll() works okay...
15678 EOM
15679         $cat >try.c <<'EOCP'
15680 #include <errno.h>
15681 #ifdef __hpux
15682 #define strtoll __strtoll
15683 #endif
15684 #ifdef __EMX__
15685 #define strtoll _strtoll
15686 #endif
15687 #include <stdio.h>
15688 extern long long int strtoll(char *s, char **, int); 
15689 static int bad = 0;
15690 int check(char *s, long long ell, int een) {
15691         long long gll;
15692         errno = 0;
15693         gll = strtoll(s, 0, 10);
15694         if (!((gll == ell) && (errno == een)))
15695                 bad++;
15696 }
15697 int main() {
15698         check(" 1",                                      1LL, 0);
15699         check(" 0",                                      0LL, 0);
15700         check("-1",                                     -1LL, 0);
15701         check("-9223372036854775808", -9223372036854775808LL, 0);
15702         check("-9223372036854775808", -9223372036854775808LL, 0);
15703         check(" 9223372036854775807",  9223372036854775807LL, 0);
15704         check("-9223372036854775808", -9223372036854775808LL, 0);
15705         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
15706         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
15707         if (!bad)
15708                 printf("ok\n");
15709 }
15710 EOCP
15711         set try
15712         if eval $compile; then
15713                 yyy=`$run ./try`
15714                 case "$yyy" in
15715                 ok) echo "Your strtoll() seems to be working okay." ;;
15716                 *) cat <<EOM >&4
15717 Your strtoll() doesn't seem to be working okay.
15718 EOM
15719                    d_strtoll="$undef"
15720                    ;;
15721                 esac
15722         else
15723                 echo "(I can't seem to compile the test program--assuming it doesn't)"
15724                 d_strtoll="$undef"
15725         fi
15726         ;;
15727 esac
15728
15729 : see if strtoq exists
15730 set strtoq d_strtoq
15731 eval $inlibc
15732
15733 : see if strtoul exists
15734 set strtoul d_strtoul
15735 eval $inlibc
15736
15737 case "$d_strtoul" in
15738 "$define")
15739         $cat <<EOM
15740 Checking whether your strtoul() works okay...
15741 EOM
15742         $cat >try.c <<'EOCP'
15743 #include <errno.h>
15744 #include <stdio.h>
15745 extern unsigned long int strtoul(char *s, char **, int); 
15746 static int bad = 0;
15747 void check(char *s, unsigned long eul, int een) {
15748         unsigned long gul;
15749         errno = 0;
15750         gul = strtoul(s, 0, 10);
15751         if (!((gul == eul) && (errno == een)))
15752                 bad++;
15753 }
15754 int main() {
15755         check(" 1", 1L, 0);
15756         check(" 0", 0L, 0);
15757 EOCP
15758         case "$longsize" in
15759         8)
15760             $cat >>try.c <<'EOCP'
15761         check("18446744073709551615", 18446744073709551615UL, 0);
15762         check("18446744073709551616", 18446744073709551615UL, ERANGE);
15763 #if 0 /* strtoul() for /^-/ strings is undefined. */
15764         check("-1", 18446744073709551615UL, 0);
15765         check("-18446744073709551614", 2, 0);
15766         check("-18446744073709551615", 1, 0);
15767         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
15768         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
15769 #endif
15770 EOCP
15771                 ;;
15772         4)
15773                     $cat >>try.c <<'EOCP'
15774         check("4294967295", 4294967295UL, 0);
15775         check("4294967296", 4294967295UL, ERANGE);
15776 #if 0 /* strtoul() for /^-/ strings is undefined. */
15777         check("-1", 4294967295UL, 0);
15778         check("-4294967294", 2, 0);
15779         check("-4294967295", 1, 0);
15780         check("-4294967296", 4294967295UL, ERANGE);
15781         check("-4294967297", 4294967295UL, ERANGE);
15782 #endif
15783 EOCP
15784                 ;;
15785         *)
15786 : Should we write these tests to be more portable by sprintf-ing
15787 : ~0 and then manipulating that char string as input for strtol?
15788                 ;;
15789         esac
15790         $cat >>try.c <<'EOCP'
15791         if (!bad)
15792                 printf("ok\n");
15793         return 0;
15794 }
15795 EOCP
15796         set try
15797         if eval $compile; then
15798                 case "`$run ./try`" in
15799                 ok) echo "Your strtoul() seems to be working okay." ;;
15800                 *) cat <<EOM >&4
15801 Your strtoul() doesn't seem to be working okay.
15802 EOM
15803                    d_strtoul="$undef"
15804                    ;;
15805                 esac
15806         fi
15807         ;;
15808 esac
15809
15810 : see if strtoull exists
15811 set strtoull d_strtoull
15812 eval $inlibc
15813
15814 case "$d_longlong-$d_strtoull" in
15815 "$define-$define")
15816         $cat <<EOM
15817 Checking whether your strtoull() works okay...
15818 EOM
15819         $cat >try.c <<'EOCP'
15820 #include <errno.h>
15821 #ifdef __hpux
15822 #define strtoull __strtoull
15823 #endif
15824 #include <stdio.h>
15825 extern unsigned long long int strtoull(char *s, char **, int); 
15826 static int bad = 0;
15827 int check(char *s, long long eull, int een) {
15828         long long gull;
15829         errno = 0;
15830         gull = strtoull(s, 0, 10);
15831         if (!((gull == eull) && (errno == een)))
15832                 bad++;
15833 }
15834 int main() {
15835         check(" 1",                                        1LL, 0);
15836         check(" 0",                                        0LL, 0);
15837         check("18446744073709551615",  18446744073709551615ULL, 0);
15838         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
15839 #if 0 /* strtoull() for /^-/ strings is undefined. */
15840         check("-1",                    18446744073709551615ULL, 0);
15841         check("-18446744073709551614",                     2LL, 0);
15842         check("-18446744073709551615",                     1LL, 0);
15843         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
15844         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
15845 #endif
15846         if (!bad)
15847                 printf("ok\n");
15848 }
15849 EOCP
15850         set try
15851         if eval $compile; then
15852                 case "`$run ./try`" in
15853                 ok) echo "Your strtoull() seems to be working okay." ;;
15854                 *) cat <<EOM >&4
15855 Your strtoull() doesn't seem to be working okay.
15856 EOM
15857                    d_strtoull="$undef"
15858                    ;;
15859                 esac
15860         fi
15861         ;;
15862 esac
15863
15864 : see if strtouq exists
15865 set strtouq d_strtouq
15866 eval $inlibc
15867
15868 case "$d_strtouq" in
15869 "$define")
15870         $cat <<EOM
15871 Checking whether your strtouq() works okay...
15872 EOM
15873         $cat >try.c <<'EOCP'
15874 #include <errno.h>
15875 #include <stdio.h>
15876 extern unsigned long long int strtouq(char *s, char **, int); 
15877 static int bad = 0;
15878 void check(char *s, unsigned long long eull, int een) {
15879         unsigned long long gull;
15880         errno = 0;
15881         gull = strtouq(s, 0, 10);
15882         if (!((gull == eull) && (errno == een)))
15883                 bad++;
15884 }
15885 int main() {
15886         check(" 1",                                        1LL, 0);
15887         check(" 0",                                        0LL, 0);
15888         check("18446744073709551615",  18446744073709551615ULL, 0);
15889         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
15890 #if 0 /* strtouq() for /^-/ strings is undefined. */
15891         check("-1",                    18446744073709551615ULL, 0);
15892         check("-18446744073709551614",                     2LL, 0);
15893         check("-18446744073709551615",                     1LL, 0);
15894         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
15895         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
15896 #endif
15897         if (!bad)
15898                 printf("ok\n");
15899         return 0;
15900 }
15901 EOCP
15902         set try
15903         if eval $compile; then
15904                 case "`$run ./try`" in
15905                 ok) echo "Your strtouq() seems to be working okay." ;;
15906                 *) cat <<EOM >&4
15907 Your strtouq() doesn't seem to be working okay.
15908 EOM
15909                    d_strtouq="$undef"
15910                    ;;
15911                 esac
15912         fi
15913         ;;
15914 esac
15915
15916 : see if strxfrm exists
15917 set strxfrm d_strxfrm
15918 eval $inlibc
15919
15920 : see if symlink exists
15921 set symlink d_symlink
15922 eval $inlibc
15923
15924 : see if syscall exists
15925 set syscall d_syscall
15926 eval $inlibc
15927
15928 : see if prototype for syscall is available
15929 echo " "
15930 set d_syscallproto syscall $i_unistd unistd.h
15931 eval $hasproto
15932
15933 : see if sysconf exists
15934 set sysconf d_sysconf
15935 eval $inlibc
15936
15937 : see if system exists
15938 set system d_system
15939 eval $inlibc
15940
15941 : see if tcgetpgrp exists
15942 set tcgetpgrp d_tcgetpgrp
15943 eval $inlibc
15944
15945 : see if tcsetpgrp exists
15946 set tcsetpgrp d_tcsetpgrp
15947 eval $inlibc
15948
15949 : see if prototype for telldir is available
15950 echo " "
15951 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
15952 eval $hasproto
15953
15954 : see if time exists
15955 echo " "
15956 if test "X$d_time" = X -o X"$timetype" = X; then
15957     if set time val -f d_time; eval $csym; $val; then
15958                 echo 'time() found.' >&4
15959                 val="$define"
15960                 rp="What is the type returned by time() on this system?"
15961                 set time_t timetype long stdio.h sys/types.h
15962                 eval $typedef_ask
15963     else
15964                 echo 'time() not found, hope that will do.' >&4
15965                 val="$undef"
15966                 timetype='int';
15967     fi
15968     set d_time
15969     eval $setvar
15970 fi
15971
15972 : see if this is a sys/times.h system
15973 set sys/times.h i_systimes
15974 eval $inhdr
15975
15976 : see if times exists
15977 echo " "
15978 if set times val -f d_times; eval $csym; $val; then
15979         echo 'times() found.' >&4
15980         d_times="$define"
15981         inc=''
15982         case "$i_systimes" in
15983         "$define") inc='sys/times.h';;
15984         esac
15985         rp="What is the type returned by times() on this system?"
15986         set clock_t clocktype long stdio.h sys/types.h $inc
15987         eval $typedef_ask
15988 else
15989         echo 'times() NOT found, hope that will do.' >&4
15990         d_times="$undef"
15991         clocktype='int'
15992 fi
15993
15994 : see if tmpnam_r exists
15995 set tmpnam_r d_tmpnam_r
15996 eval $inlibc
15997 case "$d_tmpnam_r" in
15998 "$define")
15999         hdrs="$i_systypes sys/types.h define stdio.h "
16000         case "$d_tmpnam_r_proto:$usethreads" in
16001         ":define")      d_tmpnam_r_proto=define
16002                 set d_tmpnam_r_proto tmpnam_r $hdrs
16003                 eval $hasproto ;;
16004         *)      ;;
16005         esac
16006         case "$d_tmpnam_r_proto" in
16007         define)
16008         case "$tmpnam_r_proto" in
16009         ''|0) try='char* tmpnam_r(char*);'
16010         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
16011         esac
16012         case "$tmpnam_r_proto" in
16013         ''|0)   d_tmpnam_r=undef
16014                 tmpnam_r_proto=0
16015                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
16016         * )     case "$tmpnam_r_proto" in
16017                 REENTRANT_PROTO*) ;;
16018                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
16019                 esac
16020                 echo "Prototype: $try" ;;
16021         esac
16022         ;;
16023         *)      case "$usethreads" in
16024                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
16025                 esac
16026                 d_tmpnam_r=undef
16027                 tmpnam_r_proto=0
16028                 ;;
16029         esac
16030         ;;
16031 *)      tmpnam_r_proto=0
16032         ;;
16033 esac
16034
16035 : see if truncate exists
16036 set truncate d_truncate
16037 eval $inlibc
16038
16039 : see if ttyname_r exists
16040 set ttyname_r d_ttyname_r
16041 eval $inlibc
16042 case "$d_ttyname_r" in
16043 "$define")
16044         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
16045         case "$d_ttyname_r_proto:$usethreads" in
16046         ":define")      d_ttyname_r_proto=define
16047                 set d_ttyname_r_proto ttyname_r $hdrs
16048                 eval $hasproto ;;
16049         *)      ;;
16050         esac
16051         case "$d_ttyname_r_proto" in
16052         define)
16053         case "$ttyname_r_proto" in
16054         ''|0) try='int ttyname_r(int, char*, size_t);'
16055         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
16056         esac
16057         case "$ttyname_r_proto" in
16058         ''|0) try='int ttyname_r(int, char*, int);'
16059         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
16060         esac
16061         case "$ttyname_r_proto" in
16062         ''|0) try='char* ttyname_r(int, char*, int);'
16063         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
16064         esac
16065         case "$ttyname_r_proto" in
16066         ''|0)   d_ttyname_r=undef
16067                 ttyname_r_proto=0
16068                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
16069         * )     case "$ttyname_r_proto" in
16070                 REENTRANT_PROTO*) ;;
16071                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
16072                 esac
16073                 echo "Prototype: $try" ;;
16074         esac
16075         ;;
16076         *)      case "$usethreads" in
16077                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
16078                 esac
16079                 d_ttyname_r=undef
16080                 ttyname_r_proto=0
16081                 ;;
16082         esac
16083         ;;
16084 *)      ttyname_r_proto=0
16085         ;;
16086 esac
16087
16088 : see if tzname[] exists
16089 echo " "
16090 if set tzname val -a d_tzname; eval $csym; $val; then
16091         val="$define"
16092         echo 'tzname[] found.' >&4
16093 else
16094         val="$undef"
16095         echo 'tzname[] NOT found.' >&4
16096 fi
16097 set d_tzname
16098 eval $setvar
16099
16100 case "$osname" in
16101 next|rhapsody|darwin) multiarch="$define" ;;
16102 esac
16103 case "$multiarch" in
16104 ''|[nN]*) multiarch="$undef" ;;
16105 esac
16106
16107 : check for ordering of bytes in a UV
16108 echo " "
16109 case "$usecrosscompile$multiarch" in
16110 *$define*)
16111         $cat <<EOM
16112 You seem to be either cross-compiling or doing a multiarchitecture build,
16113 skipping the byteorder check.
16114
16115 EOM
16116         byteorder='ffff'
16117         ;;
16118 *)
16119         case "$byteorder" in
16120         '')
16121                 $cat <<'EOM'
16122 In the following, larger digits indicate more significance.  A big-endian
16123 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
16124 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
16125 machines may have weird orders like 3412.  A Cray will report 87654321,
16126 an Alpha will report 12345678. If the test program works the default is
16127 probably right.
16128 I'm now running the test program...
16129 EOM
16130                 $cat >try.c <<EOCP
16131 #include <stdio.h>
16132 #include <sys/types.h>
16133 typedef $uvtype UV;
16134 int main()
16135 {
16136         int i;
16137         union {
16138                 UV l;
16139                 char c[$uvsize];
16140         } u;
16141
16142         if ($uvsize > 4)
16143                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
16144         else
16145                 u.l = (UV)0x04030201;
16146         for (i = 0; i < $uvsize; i++)
16147                 printf("%c", u.c[i]+'0');
16148         printf("\n");
16149         exit(0);
16150 }
16151 EOCP
16152                 xxx_prompt=y
16153                 set try
16154                 if eval $compile && ./try > /dev/null; then
16155                         dflt=`$run ./try`
16156                         case "$dflt" in
16157                         [1-4][1-4][1-4][1-4]|12345678|87654321)
16158                                 echo "(The test program ran ok.)"
16159                                 echo "byteorder=$dflt"
16160                                 xxx_prompt=n
16161                         ;;
16162                         ????|????????) echo "(The test program ran ok.)" ;;
16163                         *) echo "(The test program didn't run right for some reason.)" ;;
16164                         esac
16165                 else
16166                         dflt='4321'
16167                         cat <<'EOM'
16168 (I can't seem to compile the test program.  Guessing big-endian...)
16169 EOM
16170                 fi
16171                 case "$xxx_prompt" in
16172                 y)
16173                         rp="What is the order of bytes in $uvtype?"
16174                         . ./myread
16175                         byteorder="$ans"
16176                         ;;
16177                 *)      byteorder=$dflt
16178                         ;;
16179                 esac
16180                 ;;
16181         esac
16182         $rm -f try.c try
16183         ;;
16184 esac
16185
16186
16187 $cat <<EOM
16188
16189 Checking to see whether you can access character data unalignedly...
16190 EOM
16191 case "$d_u32align" in
16192 '')   $cat >try.c <<EOCP
16193 #include <stdio.h>
16194 #define U32 $u32type
16195 #define BYTEORDER 0x$byteorder
16196 #define U8 $u8type
16197 #include <signal.h>
16198 #ifdef SIGBUS
16199 $signal_t bletch(s) int s; { exit(4); }
16200 #endif
16201 int main() {
16202 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
16203     U8 buf[8];
16204     U32 *up;
16205     int i;
16206
16207     if (sizeof(U32) != 4) {
16208         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
16209         exit(1);
16210     }
16211
16212     fflush(stdout);
16213
16214 #ifdef SIGBUS
16215     signal(SIGBUS, bletch);
16216 #endif
16217
16218     buf[0] = 0;
16219     buf[1] = 0;
16220     buf[2] = 0;
16221     buf[3] = 1;
16222     buf[5] = 0;
16223     buf[6] = 0;
16224     buf[7] = 0;
16225     buf[8] = 1;
16226
16227     for (i = 0; i < 4; i++) {
16228         up = (U32*)(buf + i);
16229         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
16230                (*up == 1 << (8*(3-i)))  /* little-endian */
16231               )
16232            )
16233         {
16234             printf("read failed (%x)\n", *up);
16235             exit(2);
16236         }
16237     }
16238
16239     /* write test */
16240     for (i = 0; i < 4; i++) {
16241         up = (U32*)(buf + i);
16242         *up = 0xBeef;
16243         if (*up != 0xBeef) {
16244             printf("write failed (%x)\n", *up);
16245             exit(3);
16246         }
16247     }
16248
16249     exit(0);
16250 #else
16251     printf("1\n");
16252     exit(1);
16253 #endif
16254     return 0;
16255 }
16256 EOCP
16257 set try
16258 if eval $compile_ok; then
16259         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
16260         $run ./try 2>&1 >/dev/null
16261         case "$?" in
16262         0)      cat >&4 <<EOM
16263 You can access character data pretty unalignedly.
16264 EOM
16265                 d_u32align="$undef"
16266                 ;;
16267         *)      cat >&4 <<EOM
16268 It seems that you must access character data in an aligned manner.
16269 EOM
16270                 d_u32align="$define"
16271                 ;;
16272         esac
16273 else
16274         rp='Can you access character data at unaligned addresses?'
16275         dflt='n'
16276         . ./myread
16277         case "$ans" in
16278         [yY]*)  d_u32align="$undef"  ;;
16279         *)      d_u32align="$define" ;;
16280         esac
16281 fi
16282 $rm -f core core.try.* try.core
16283 ;;
16284 esac
16285
16286 : see if ualarm exists
16287 set ualarm d_ualarm
16288 eval $inlibc
16289
16290 : see if umask exists
16291 set umask d_umask
16292 eval $inlibc
16293
16294 : see if unordered exists
16295 set unordered d_unordered
16296 eval $inlibc
16297
16298 : see if usleep exists
16299 set usleep d_usleep
16300 eval $inlibc
16301
16302 : see if prototype for usleep is available
16303 echo " "
16304 set d_usleepproto usleep $i_unistd unistd.h
16305 eval $hasproto
16306
16307 : see if ustat exists
16308 set ustat d_ustat
16309 eval $inlibc
16310
16311 : backward compatibility for d_hvfork
16312 if test X$d_hvfork != X; then
16313         d_vfork="$d_hvfork"
16314         d_hvfork=''
16315 fi
16316 : see if there is a vfork
16317 val=''
16318 set vfork val
16319 eval $inlibc
16320
16321 : Ok, but do we want to use it. vfork is reportedly unreliable in 
16322 : perl on Solaris 2.x, and probably elsewhere.
16323 case "$val" in
16324 $define)
16325         echo " "
16326         case "$usevfork" in
16327         false) dflt='n';;
16328         *) dflt='y';;
16329         esac
16330         cat <<'EOM'
16331  
16332 Perl can only use a vfork() that doesn't suffer from strict
16333 restrictions on calling functions or modifying global data in
16334 the child.  For example, glibc-2.1 contains such a vfork()
16335 that is unsuitable.  If your system provides a proper fork()
16336 call, chances are that you do NOT want perl to use vfork().
16337
16338 EOM
16339         rp="Do you still want to use vfork()?"
16340         . ./myread
16341         case "$ans" in
16342         y|Y) ;;
16343         *)
16344                 echo "Ok, we won't use vfork()."
16345                 val="$undef"
16346                 ;;
16347         esac
16348         ;;
16349 esac
16350 set d_vfork
16351 eval $setvar
16352 case "$d_vfork" in
16353 $define) usevfork='true';;
16354 *) usevfork='false';;
16355 esac
16356
16357 : see if closedir exists
16358 set closedir d_closedir
16359 eval $inlibc
16360
16361 case "$d_closedir" in
16362 "$define")
16363         echo " "
16364         echo "Checking whether closedir() returns a status..." >&4
16365         cat > try.c <<EOM
16366 #$i_dirent I_DIRENT             /**/
16367 #$i_sysdir I_SYS_DIR            /**/
16368 #$i_sysndir I_SYS_NDIR          /**/
16369 #$i_systypes I_SYS_TYPES        /**/
16370
16371 #if defined(I_SYS_TYPES)
16372 #include <sys/types.h>
16373 #endif
16374 #if defined(I_DIRENT)
16375 #include <dirent.h>
16376 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
16377 #include <sys/dir.h>
16378 #endif
16379 #else
16380 #ifdef I_SYS_NDIR
16381 #include <sys/ndir.h>
16382 #else
16383 #ifdef I_SYS_DIR
16384 #ifdef hp9000s500
16385 #include <ndir.h>       /* may be wrong in the future */
16386 #else
16387 #include <sys/dir.h>
16388 #endif
16389 #endif
16390 #endif
16391 #endif 
16392 int main() { return closedir(opendir(".")); }
16393 EOM
16394         set try
16395         if eval $compile_ok; then
16396                 if $run ./try > /dev/null 2>&1 ; then
16397                         echo "Yes, it does."
16398                         val="$undef"
16399                 else
16400                         echo "No, it doesn't."
16401                         val="$define"
16402                 fi
16403         else
16404                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16405                 val="$define"
16406         fi
16407         ;;
16408 *)
16409         val="$undef";
16410         ;;
16411 esac
16412 set d_void_closedir
16413 eval $setvar
16414 $rm -f try try.*
16415 : see if there is a wait4
16416 set wait4 d_wait4
16417 eval $inlibc
16418
16419 : see if waitpid exists
16420 set waitpid d_waitpid
16421 eval $inlibc
16422
16423 : see if wcstombs exists
16424 set wcstombs d_wcstombs
16425 eval $inlibc
16426
16427 : see if wctomb exists
16428 set wctomb d_wctomb
16429 eval $inlibc
16430
16431 : see if writev exists
16432 set writev d_writev
16433 eval $inlibc
16434
16435 : preserve RCS keywords in files with variable substitution, grrr
16436 Date='$Date'
16437 Id='$Id'
16438 Log='$Log'
16439 RCSfile='$RCSfile'
16440 Revision='$Revision'
16441
16442 : check for alignment requirements
16443 echo " "
16444 case "$usecrosscompile$multiarch" in
16445 *$define*)
16446         $cat <<EOM
16447 You seem to be either cross-compiling or doing a multiarchitecture build,
16448 skipping the memory alignment check.
16449
16450 EOM
16451         case "$alignbytes" in
16452         '') alignbytes=8 ;;
16453         esac
16454         ;;
16455 *)
16456         case "$alignbytes" in
16457         '') echo "Checking alignment constraints..." >&4
16458                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
16459                         $cat >try.c <<'EOCP'
16460 typedef long double NV;
16461 EOCP
16462                 else
16463                         $cat >try.c <<'EOCP'
16464 typedef double NV;
16465 EOCP
16466                 fi
16467                 $cat >>try.c <<'EOCP'
16468 #include <stdio.h>
16469 struct foobar {
16470         char foo;
16471         NV bar;
16472 } try_algn;
16473 int main()
16474 {
16475     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
16476     return(0);
16477 }
16478 EOCP
16479                 set try
16480                 if eval $compile_ok; then
16481                         dflt=`$run ./try`
16482                 else
16483                         dflt='8'
16484                         echo "(I can't seem to compile the test program...)"
16485                 fi
16486                 ;;
16487         *) dflt="$alignbytes"
16488                 ;;
16489         esac
16490         rp="Doubles must be aligned on a how-many-byte boundary?"
16491         . ./myread
16492         alignbytes="$ans"
16493         $rm -f try.c try
16494         ;;
16495 esac
16496
16497
16498 : set the base revision
16499 baserev=5.0
16500
16501 : how do we catenate cpp tokens here?
16502 echo " "
16503 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
16504 $cat >cpp_stuff.c <<'EOCP'
16505 #define RCAT(a,b)a/**/b
16506 #define ACAT(a,b)a ## b
16507 RCAT(Rei,ser)
16508 ACAT(Cir,cus)
16509 EOCP
16510 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
16511 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
16512         echo "Oh!  Smells like ANSI's been here." >&4
16513         echo "We can catify or stringify, separately or together!"
16514         cpp_stuff=42
16515 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
16516         echo "Ah, yes!  The good old days!" >&4
16517         echo "However, in the good old days we don't know how to stringify and"
16518         echo "catify at the same time."
16519         cpp_stuff=1
16520 else
16521         $cat >&4 <<EOM
16522 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
16523 to have to edit the values of CAT[2-5] in config.h...
16524 EOM
16525         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
16526 fi
16527 $rm -f cpp_stuff.*
16528
16529 : see if this is a db.h system
16530 set db.h i_db
16531 eval $inhdr
16532
16533 case "$i_db" in
16534 $define)
16535         : Check db version.
16536         echo " "
16537         echo "Checking Berkeley DB version ..." >&4
16538         $cat >try.c <<EOCP
16539 #$d_const HASCONST
16540 #ifndef HASCONST
16541 #define const
16542 #endif
16543 #include <sys/types.h>
16544 #include <stdio.h>
16545 #include <db.h>
16546 int main(int argc, char *argv[])
16547 {
16548 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
16549     int Major, Minor, Patch ;
16550     unsigned long Version ;
16551     (void)db_version(&Major, &Minor, &Patch) ;
16552     if (argc == 2) {
16553         printf("%d %d %d %d %d %d\n",
16554                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
16555                Major, Minor, Patch);
16556         exit(0);
16557     }
16558     printf("You have Berkeley DB Version 2 or greater.\n");
16559
16560     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
16561                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
16562     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
16563                 Major, Minor, Patch) ;
16564
16565     /* check that db.h & libdb are compatible */
16566     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
16567         printf("db.h and libdb are incompatible.\n") ;
16568         exit(3);        
16569     }
16570
16571     printf("db.h and libdb are compatible.\n") ;
16572
16573     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
16574                 + DB_VERSION_PATCH ;
16575
16576     /* needs to be >= 2.3.4 */
16577     if (Version < 2003004) {
16578     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
16579         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
16580         exit(2);        
16581     }
16582
16583     exit(0);
16584 #else
16585 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
16586     if (argc == 2) {
16587         printf("1 0 0\n");
16588         exit(0);
16589     }
16590     printf("You have Berkeley DB Version 1.\n");
16591     exit(0);    /* DB version < 2: the coast is clear. */
16592 #else
16593     exit(1);    /* <db.h> not Berkeley DB? */
16594 #endif
16595 #endif
16596 }
16597 EOCP
16598         set try
16599         if eval $compile_ok && $run ./try; then
16600                 echo 'Looks OK.' >&4
16601                 set `$run ./try 1`
16602                 db_version_major=$1
16603                 db_version_minor=$2
16604                 db_version_patch=$3
16605         else
16606                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
16607                 i_db=$undef
16608                 case " $libs " in
16609                 *"-ldb "*)
16610                         : Remove db from list of libraries to use
16611                         echo "Removing unusable -ldb from library list" >&4
16612                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
16613                         shift
16614                         libs="$*"
16615                         echo "libs = $libs" >&4
16616                         ;;
16617                 esac
16618         fi
16619         $rm -f try.*
16620         ;;
16621 esac
16622
16623 case "$i_db" in
16624 define)
16625         : Check the return type needed for hash 
16626         echo " "
16627         echo "Checking return type needed for hash for Berkeley DB ..." >&4
16628         $cat >try.c <<EOCP
16629 #$d_const HASCONST
16630 #ifndef HASCONST
16631 #define const
16632 #endif
16633 #include <sys/types.h>
16634 #include <db.h>
16635
16636 #ifndef DB_VERSION_MAJOR
16637 u_int32_t hash_cb (ptr, size)
16638 const void *ptr;
16639 size_t size;
16640 {
16641 }
16642 HASHINFO info;
16643 int main()
16644 {
16645         info.hash = hash_cb;
16646 }
16647 #endif
16648 EOCP
16649         if $cc $ccflags -c try.c >try.out 2>&1 ; then
16650                 if $contains warning try.out >>/dev/null 2>&1 ; then
16651                         db_hashtype='int'
16652                 else
16653                         db_hashtype='u_int32_t'
16654                 fi
16655         else
16656                 : XXX Maybe we should just give up here.
16657                 db_hashtype=u_int32_t
16658                 $cat try.out >&4
16659                 echo "Help:  I can't seem to compile the db test program." >&4
16660                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
16661         fi
16662         $rm -f try.*
16663         echo "Your version of Berkeley DB uses $db_hashtype for hash."
16664         ;;
16665 *)      db_hashtype=u_int32_t
16666         ;;
16667 esac
16668 case "$i_db" in
16669 define)
16670         : Check the return type needed for prefix 
16671         echo " "
16672         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
16673         cat >try.c <<EOCP
16674 #$d_const HASCONST
16675 #ifndef HASCONST
16676 #define const
16677 #endif
16678 #include <sys/types.h>
16679 #include <db.h>
16680
16681 #ifndef DB_VERSION_MAJOR
16682 size_t prefix_cb (key1, key2)
16683 const DBT *key1;
16684 const DBT *key2;
16685 {
16686 }
16687 BTREEINFO info;
16688 int main()
16689 {
16690         info.prefix = prefix_cb;
16691 }
16692 #endif
16693 EOCP
16694         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
16695                 if $contains warning try.out >>/dev/null 2>&1 ; then
16696                         db_prefixtype='int'
16697                 else
16698                         db_prefixtype='size_t'
16699                 fi
16700         else
16701                 db_prefixtype='size_t'
16702                 : XXX Maybe we should just give up here.
16703                 $cat try.out >&4
16704                 echo "Help:  I can't seem to compile the db test program." >&4
16705                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
16706         fi
16707         $rm -f try.*
16708         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
16709         ;;
16710 *)      db_prefixtype='size_t'
16711         ;;
16712 esac
16713
16714
16715 : How can we generate normalized random numbers ?
16716 echo " "
16717 echo "Looking for a random number function..." >&4
16718 case "$randfunc" in
16719 '')
16720         if set drand48 val -f; eval $csym; $val; then
16721                 dflt="drand48"
16722                 echo "Good, found drand48()." >&4
16723         elif set random val -f; eval $csym; $val; then
16724                 dflt="random"
16725                 echo "OK, found random()." >&4
16726         else
16727                 dflt="rand"
16728                 echo "Yick, looks like I have to use rand()." >&4
16729         fi
16730         echo " "
16731         ;;
16732 *)
16733         dflt="$randfunc"
16734         ;;
16735 esac
16736 cont=true
16737
16738 case "$ccflags" in
16739 *-Dmy_rand=*|*-Dmy_srand=*)
16740         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
16741         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
16742         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
16743         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
16744         ;;
16745 esac
16746
16747 while $test "$cont"; do
16748         rp="Use which function to generate random numbers?"
16749         . ./myread
16750         if $test "$ans" = "$dflt"; then
16751                 : null
16752         else
16753                 randbits=''
16754         fi
16755         randfunc="$ans"
16756         if set $ans val -f; eval $csym; $val; then
16757                 cont=''
16758         else
16759                 dflt=y
16760                 rp="I cannot find function $ans. Use that name anyway?"
16761                 . ./myread
16762                 dflt=rand
16763                 case "$ans" in
16764                         [yY]*) cont='';;
16765                 esac
16766         fi
16767         case "$cont" in
16768         '')
16769                 case "$randfunc" in
16770                 drand48)
16771                         drand01="drand48()"
16772                         seedfunc="srand48"
16773                         randbits=48
16774                         randseedtype=long
16775                         ;;
16776                 rand|random)
16777                         case "$randbits" in
16778                         '')
16779 echo "Checking to see how many bits your $randfunc() function produces..." >&4
16780                                 $cat >try.c <<EOCP
16781 #$i_unistd I_UNISTD
16782 #$i_stdlib I_STDLIB
16783 #include <stdio.h>
16784 #ifdef I_UNISTD
16785 #  include <unistd.h>
16786 #endif
16787 #ifdef I_STDLIB
16788 #  include <stdlib.h>
16789 #endif
16790 int main()
16791 {
16792         register int i;
16793         register unsigned long tmp;
16794         register unsigned long max = 0L;
16795
16796         for (i = 1000; i; i--) {
16797                 tmp = (unsigned long) $randfunc();
16798                 if (tmp > max) max = tmp;
16799         }
16800         for (i = 0; max; i++)
16801                 max /= 2;
16802         printf("%d\n",i);
16803 }
16804 EOCP
16805                                 set try
16806                                 if eval $compile_ok; then
16807                                         dflt=`try`
16808                                 else
16809                                         dflt='?'
16810                                         echo "(I can't seem to compile the test program...)"
16811                                 fi
16812                                 ;;
16813                         *)
16814                                 dflt="$randbits"
16815                                 ;;
16816                         esac
16817                         rp="How many bits does your $randfunc() function produce?"
16818                         . ./myread
16819                         randbits="$ans"
16820                         $rm -f try.c try
16821                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
16822                         seedfunc="s$randfunc"
16823                         randseedtype=unsigned
16824                         ;;
16825                 *)
16826                         dflt="31"
16827                         rp="How many bits does your $randfunc() function produce?"
16828                         . ./myread
16829                         randbits="$ans"
16830                         seedfunc="s$randfunc"
16831                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
16832                         if set $seedfunc val -f; eval $csym; $val; then
16833                                 echo "(Using $seedfunc() to seed random generator)"
16834                         else
16835                                 echo "(Warning: no $seedfunc() to seed random generator)"
16836                                 seedfunc=rand
16837                         fi
16838                         randseedtype=unsigned
16839                         ;;
16840                 esac
16841                 ;;
16842         esac
16843 done
16844
16845 echo " "
16846 echo "Determining whether or not we are on an EBCDIC system..." >&4
16847 $cat >try.c <<'EOM'
16848 int main()
16849 {
16850   if ('M'==0xd4) return 0;
16851   return 1;
16852 }
16853 EOM
16854
16855 val=$undef
16856 set try
16857 if eval $compile_ok; then
16858         if $run ./try; then
16859                 echo "You seem to speak EBCDIC." >&4
16860                 val="$define"
16861         else
16862                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
16863         fi
16864 else
16865         echo "I'm unable to compile the test program." >&4
16866         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
16867 fi
16868 $rm -f try try.*
16869 set ebcdic
16870 eval $setvar
16871
16872 echo " "
16873 $cat >&4 <<EOM
16874 Checking how to flush all pending stdio output...
16875 EOM
16876 # I only know how to find the first 32 possibly open files on SunOS.
16877 # See also hints/sunos_4_1.sh and util.c  --AD
16878 case "$osname" in
16879 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
16880 esac
16881 $cat >>try.c <<EOCP
16882 #include <stdio.h>
16883 #$i_unistd I_UNISTD
16884 #ifdef I_UNISTD
16885 # include <unistd.h>
16886 #endif
16887 #$d_sysconf HAS_SYSCONF
16888 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
16889 #ifdef HAS_STDIO_STREAM_ARRAY
16890 # define STDIO_STREAM_ARRAY $stdio_stream_array
16891 #endif
16892 int main() {
16893   FILE* p;
16894   unlink("try.out");
16895   p = fopen("try.out", "w");
16896 #ifdef TRY_FPUTC
16897   fputc('x', p);
16898 #else
16899 # ifdef TRY_FPRINTF
16900   fprintf(p, "x");
16901 # endif
16902 #endif
16903 #ifdef TRY_FFLUSH_NULL
16904   fflush(NULL);
16905 #endif
16906 #ifdef TRY_FFLUSH_ALL
16907   {
16908     long open_max = -1;
16909 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
16910     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
16911 # else
16912 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
16913     open_max = sysconf(_SC_OPEN_MAX);
16914 #  else
16915 #   ifdef FOPEN_MAX
16916     open_max = FOPEN_MAX;
16917 #   else
16918 #    ifdef OPEN_MAX
16919     open_max = OPEN_MAX;
16920 #    else
16921 #     ifdef _NFILE
16922     open_max = _NFILE;
16923 #     endif
16924 #    endif
16925 #   endif
16926 #  endif
16927 # endif 
16928 # ifdef HAS_STDIO_STREAM_ARRAY
16929     if (open_max > 0) {
16930       long i;
16931       for (i = 0; i < open_max; i++)
16932             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
16933                 STDIO_STREAM_ARRAY[i]._file < open_max &&
16934                 STDIO_STREAM_ARRAY[i]._flag)
16935                 fflush(&STDIO_STREAM_ARRAY[i]);
16936     }   
16937   }
16938 # endif
16939 #endif
16940   _exit(42);
16941 }
16942 EOCP
16943 : first we have to find out how _not_ to flush
16944 $to try.c
16945 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
16946     output=''
16947     set try -DTRY_FPUTC
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_FPUTC
16954             fi
16955     fi
16956     case "$output" in
16957     '')
16958             set try -DTRY_FPRINTF
16959             if eval $compile; then
16960                     $run ./try 2>/dev/null
16961                     code="$?"
16962                     $from try.out
16963                     if $test ! -s try.out -a "X$code" = X42; then
16964                         output=-DTRY_FPRINTF
16965                     fi
16966             fi
16967         ;;
16968     esac
16969 fi
16970 : check for fflush NULL behaviour
16971 case "$fflushNULL" in
16972 '')     set try -DTRY_FFLUSH_NULL $output
16973         if eval $compile; then
16974                 $run ./try 2>/dev/null
16975                 code="$?"
16976                 $from try.out
16977                 if $test -s try.out -a "X$code" = X42; then
16978                         fflushNULL="`$cat try.out`"
16979                 else
16980                         if $test "X$code" != X42; then
16981                                 $cat >&4 <<EOM
16982 (If this test failed, don't worry, we'll try another method shortly.)
16983 EOM
16984                         fi
16985                 fi
16986         fi
16987         $rm -f core try.core core.try.*
16988         case "$fflushNULL" in
16989         x)      $cat >&4 <<EOM
16990 Your fflush(NULL) works okay for output streams.
16991 Let's see if it clobbers input pipes...
16992 EOM
16993 # As of mid-March 2000 all versions of Solaris appear to have a stdio
16994 # bug that improperly flushes the input end of pipes.  So we avoid the
16995 # autoflush on fork/system/exec support for now. :-(
16996 $cat >tryp.c <<EOCP
16997 #include <stdio.h>
16998 int
16999 main(int argc, char **argv)
17000 {
17001     char buf[1024];
17002     int i;
17003     char *bp = buf;
17004     while (1) {
17005         while ((i = getc(stdin)) != -1
17006                && (*bp++ = i) != '\n'
17007                && bp < &buf[1024])
17008         /* DO NOTHING */ ;
17009         *bp = '\0';
17010         fprintf(stdout, "%s", buf);
17011         fflush(NULL);
17012         if (i == -1)
17013             return 0;
17014         bp = buf;
17015     }
17016 }
17017 EOCP
17018                 fflushNULL="$define"
17019                 set tryp
17020                 if eval $compile; then
17021                     $rm -f tryp.out
17022                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17023                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
17024                        $cat >&4 <<EOM
17025 fflush(NULL) seems to behave okay with input streams.
17026 EOM
17027                         fflushNULL="$define"
17028                     else
17029                         $cat >&4 <<EOM
17030 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
17031 EOM
17032                         fflushNULL="$undef"
17033                     fi
17034                 fi
17035                 $rm -f core tryp.c tryp.core core.tryp.*
17036                 ;;
17037         '')     $cat >&4 <<EOM
17038 Your fflush(NULL) isn't working (contrary to ANSI C).
17039 EOM
17040                 fflushNULL="$undef"
17041                 ;;
17042         *)      $cat >&4 <<EOM
17043 Cannot figure out whether your fflush(NULL) works or not.
17044 I'm assuming it doesn't (contrary to ANSI C).
17045 EOM
17046                 fflushNULL="$undef"
17047                 ;;
17048         esac
17049         ;;
17050 $define|true|[yY]*)
17051         fflushNULL="$define"
17052         ;;
17053 *)
17054         fflushNULL="$undef"
17055         ;;
17056 esac
17057 : check explicit looping only if NULL did not work, and if the pipe
17058 : bug does not show up on an explicit flush too
17059 case "$fflushNULL" in
17060 "$undef")
17061         $cat >tryp.c <<EOCP
17062 #include <stdio.h>
17063 int
17064 main(int argc, char **argv)
17065 {
17066     char buf[1024];
17067     int i;
17068     char *bp = buf;
17069     while (1) {
17070         while ((i = getc(stdin)) != -1
17071                && (*bp++ = i) != '\n'
17072                && bp < &buf[1024])
17073         /* DO NOTHING */ ;
17074         *bp = '\0';
17075         fprintf(stdout, "%s", buf);
17076         fflush(stdin);
17077         if (i == -1)
17078             return 0;
17079         bp = buf;
17080     }
17081 }
17082 EOCP
17083         set tryp
17084         if eval $compile; then
17085             $rm -f tryp.out
17086             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17087             if cmp tryp.c tryp.out >/dev/null 2>&1; then
17088                $cat >&4 <<EOM
17089 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
17090 EOM
17091                 : now check for fflushall behaviour
17092                 case "$fflushall" in
17093                 '')     set try -DTRY_FFLUSH_ALL $output
17094                         if eval $compile; then
17095                                 $cat >&4 <<EOM
17096 (Now testing the other method--but note that this also may fail.)
17097 EOM
17098                                 $run ./try 2>/dev/null
17099                                 code=$?
17100                                 $from try.out
17101                                 if $test -s try.out -a "X$code" = X42; then
17102                                         fflushall="`$cat try.out`"
17103                                 fi
17104                         fi
17105                         $rm -f core try.core core.try.*
17106                         case "$fflushall" in
17107                         x)      $cat >&4 <<EOM
17108 Whew. Flushing explicitly all the stdio streams works.
17109 EOM
17110                                 fflushall="$define"
17111                                 ;;
17112                         '')     $cat >&4 <<EOM
17113 Sigh. Flushing explicitly all the stdio streams doesn't work.
17114 EOM
17115                                 fflushall="$undef"
17116                                 ;;
17117                         *)      $cat >&4 <<EOM
17118 Cannot figure out whether flushing stdio streams explicitly works or not.
17119 I'm assuming it doesn't.
17120 EOM
17121                                 fflushall="$undef"
17122                                 ;;
17123                         esac
17124                         ;;
17125                 "$define"|true|[yY]*)
17126                         fflushall="$define"
17127                         ;;
17128                 *)
17129                         fflushall="$undef"
17130                         ;;
17131                 esac
17132             else
17133                 $cat >&4 <<EOM
17134 All is futile.  Even fflush(stdin) clobbers input pipes!
17135 EOM
17136                 fflushall="$undef"
17137             fi
17138         else
17139             fflushall="$undef"
17140         fi
17141         $rm -f core tryp.c tryp.core core.tryp.*
17142         ;;
17143 *)      fflushall="$undef"
17144         ;;
17145 esac
17146
17147 case "$fflushNULL$fflushall" in
17148 undefundef)
17149         $cat <<EOM
17150 OK, I give up.  I cannot figure out how to flush pending stdio output.
17151 We won't be flushing handles at all before fork/exec/popen.
17152 EOM
17153         ;;
17154 esac
17155 $rm -f try.* try$exe_ext
17156
17157 : Store the full pathname to the ar program for use in the C program
17158 : Respect a hint or command line value for full_ar.
17159 case "$full_ar" in
17160 '') full_ar=$ar ;;
17161 esac
17162
17163 : Store the full pathname to the sed program for use in the C program
17164 full_sed=$sed
17165
17166 : see what type gids are declared as in the kernel
17167 echo " "
17168 echo "Looking for the type for group ids returned by getgid()."
17169 set gid_t gidtype xxx stdio.h sys/types.h
17170 eval $typedef
17171 case "$gidtype" in
17172 xxx)
17173         xxx=`./findhdr sys/user.h`
17174         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
17175         case $1 in
17176         unsigned) dflt="$1 $2" ;;
17177         *) dflt="$1" ;;
17178         esac
17179         ;;
17180 *) dflt="$gidtype";;
17181 esac
17182 case "$gidtype" in
17183 gid_t) echo "gid_t found." ;;
17184 *)      rp="What is the type for group ids returned by getgid()?"
17185         . ./myread
17186         gidtype="$ans"
17187         ;;
17188 esac
17189
17190 echo " "
17191 case "$gidtype" in
17192 *_t) zzz="$gidtype"     ;;
17193 *)   zzz="gid"          ;;
17194 esac
17195 echo "Checking the size of $zzz..." >&4 
17196 cat > try.c <<EOCP
17197 #include <sys/types.h>
17198 #include <stdio.h>
17199 int main() {
17200     printf("%d\n", (int)sizeof($gidtype));
17201     exit(0);
17202 }
17203 EOCP
17204 set try
17205 if eval $compile_ok; then
17206         yyy=`$run ./try`
17207         case "$yyy" in
17208         '')     gidsize=4
17209                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
17210                 ;;
17211         *)      gidsize=$yyy
17212                 echo "Your $zzz is $gidsize bytes long."
17213                 ;;
17214         esac
17215 else
17216         gidsize=4
17217         echo "(I can't compile the test program--guessing $gidsize.)" >&4
17218 fi
17219
17220
17221 echo " "
17222 case "$gidtype" in
17223 *_t) zzz="$gidtype"     ;;
17224 *)   zzz="gid"          ;;
17225 esac
17226 echo "Checking the sign of $zzz..." >&4 
17227 cat > try.c <<EOCP
17228 #include <sys/types.h>
17229 #include <stdio.h>
17230 int main() {
17231         $gidtype foo = -1;
17232         if (foo < 0)
17233                 printf("-1\n");
17234         else
17235                 printf("1\n");
17236 }
17237 EOCP
17238 set try
17239 if eval $compile; then
17240         yyy=`$run ./try`
17241         case "$yyy" in
17242         '')     gidsign=1
17243                 echo "(I can't execute the test program--guessing unsigned.)" >&4
17244                 ;;
17245         *)      gidsign=$yyy
17246                 case "$gidsign" in
17247                  1) echo "Your $zzz is unsigned." ;;
17248                 -1) echo "Your $zzz is signed."   ;;
17249                 esac
17250                 ;;
17251         esac
17252 else
17253         gidsign=1
17254         echo "(I can't compile the test program--guessing unsigned.)" >&4
17255 fi
17256
17257
17258 echo " "
17259
17260 if $test X"$quadtype" != X; then
17261
17262 echo "Checking how to print 64-bit integers..." >&4
17263
17264 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
17265         $cat >try.c <<'EOCP'
17266 #include <sys/types.h>
17267 #include <stdio.h>
17268 int main() {
17269   int q = 12345678901;
17270   printf("%ld\n", q);
17271 }
17272 EOCP
17273         set try
17274         if eval $compile; then
17275                 yyy=`$run ./try`
17276                 case "$yyy" in
17277                 12345678901)
17278                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
17279                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
17280                         echo "We will use %d."
17281                         ;;
17282                 esac
17283         fi
17284 fi
17285
17286 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
17287         $cat >try.c <<'EOCP'
17288 #include <sys/types.h>
17289 #include <stdio.h>
17290 int main() {
17291   long q = 12345678901;
17292   printf("%ld\n", q);
17293 }
17294 EOCP
17295         set try
17296         if eval $compile; then
17297                 yyy=`$run ./try`
17298                 case "$yyy" in
17299                 12345678901)
17300                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
17301                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
17302                         echo "We will use %ld."
17303                         ;;
17304                 esac
17305         fi
17306 fi
17307
17308 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
17309         $cat >try.c <<'EOCP'
17310 #include <sys/types.h>
17311 #include <inttypes.h>
17312 #include <stdio.h>
17313 int main() {
17314   int64_t q = 12345678901;
17315   printf("%" PRId64 "\n", q);
17316 }
17317 EOCP
17318         set try
17319         if eval $compile; then
17320                 yyy=`$run ./try`
17321                 case "$yyy" in
17322                 12345678901)
17323                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
17324                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
17325                         echo "We will use the C9X style."
17326                         ;;
17327                 esac
17328         fi
17329 fi
17330
17331 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17332         $cat >try.c <<EOCP
17333 #include <sys/types.h>
17334 #include <stdio.h>
17335 int main() {
17336   $quadtype q = 12345678901;
17337   printf("%Ld\n", q);
17338 }
17339 EOCP
17340         set try
17341         if eval $compile; then
17342                 yyy=`$run ./try`
17343                 case "$yyy" in
17344                 12345678901)
17345                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
17346                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
17347                         echo "We will use %Ld."
17348                         ;;
17349                 esac
17350         fi
17351 fi
17352
17353 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
17354         $cat >try.c <<'EOCP'
17355 #include <sys/types.h>
17356 #include <stdio.h>
17357 int main() {
17358   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
17359   printf("%lld\n", q);
17360 }
17361 EOCP
17362         set try
17363         if eval $compile; then
17364                 yyy=`$run ./try`
17365                 case "$yyy" in
17366                 12345678901)
17367                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
17368                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
17369                         echo "We will use the %lld style."
17370                         ;;
17371                 esac
17372         fi
17373 fi
17374
17375 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17376         $cat >try.c <<EOCP
17377 #include <sys/types.h>
17378 #include <stdio.h>
17379 int main() {
17380   $quadtype q = 12345678901;
17381   printf("%qd\n", q);
17382 }
17383 EOCP
17384         set try
17385         if eval $compile; then
17386                 yyy=`$run ./try`
17387                 case "$yyy" in
17388                 12345678901)
17389                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
17390                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
17391                         echo "We will use %qd."
17392                         ;;
17393                 esac
17394         fi
17395 fi
17396
17397 if $test X"$sPRId64" = X; then
17398         echo "Cannot figure out how to print 64-bit integers." >&4
17399 fi
17400
17401 $rm -f try try.*
17402
17403 fi
17404
17405 case "$sPRId64" in
17406 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
17407         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
17408         ;;
17409 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
17410         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
17411         ;;
17412 esac
17413
17414
17415 echo " "
17416 $echo "Checking the format strings to be used for Perl's internal types..." >&4
17417
17418 if $test X"$ivsize" = X8; then
17419         ivdformat="$sPRId64"
17420         uvuformat="$sPRIu64"
17421         uvoformat="$sPRIo64"
17422         uvxformat="$sPRIx64"
17423         uvXUformat="$sPRIXU64"
17424 else
17425         if $test X"$ivsize" = X"$longsize"; then
17426                 ivdformat='"ld"'
17427                 uvuformat='"lu"'
17428                 uvoformat='"lo"'
17429                 uvxformat='"lx"'
17430                 uvXUformat='"lX"'
17431         else
17432                 if $test X"$ivsize" = X"$intsize"; then
17433                         ivdformat='"d"'
17434                         uvuformat='"u"'
17435                         uvoformat='"o"'
17436                         uvxformat='"x"'
17437                         uvXUformat='"X"'
17438                 else
17439                         : far out
17440                         if $test X"$ivsize" = X"$shortsize"; then
17441                                 ivdformat='"hd"'
17442                                 uvuformat='"hu"'
17443                                 uvoformat='"ho"'
17444                                 uvxformat='"hx"'
17445                                 uvXUformat='"hX"'
17446                         fi
17447                 fi
17448         fi
17449 fi
17450
17451 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
17452         nveformat="$sPRIeldbl"
17453         nvfformat="$sPRIfldbl"
17454         nvgformat="$sPRIgldbl"
17455         nvEUformat="$sPRIEUldbl"
17456         nvFUformat="$sPRIFUldbl"
17457         nvGUformat="$sPRIGUldbl"
17458 else
17459         nveformat='"e"'
17460         nvfformat='"f"'
17461         nvgformat='"g"'
17462         nvEUformat='"E"'
17463         nvFUformat='"F"'
17464         nvGUformat='"G"'
17465 fi
17466
17467 case "$ivdformat" in
17468 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
17469     exit 1
17470     ;;
17471 esac
17472
17473
17474 echo " "
17475 $echo "Checking the format string to be used for gids..." >&4
17476
17477 case "$gidsign" in
17478 -1)     if $test X"$gidsize" = X"$ivsize"; then
17479                 gidformat="$ivdformat"
17480         else
17481                 if $test X"$gidsize" = X"$longsize"; then
17482                         gidformat='"ld"'
17483                 else
17484                         if $test X"$gidsize" = X"$intsize"; then
17485                                 gidformat='"d"'
17486                         else
17487                                 if $test X"$gidsize" = X"$shortsize"; then
17488                                         gidformat='"hd"'
17489                                 fi
17490                         fi
17491                 fi
17492         fi
17493         ;;
17494 *)      if $test X"$gidsize" = X"$uvsize"; then
17495                 gidformat="$uvuformat"
17496         else
17497                 if $test X"$gidsize" = X"$longsize"; then
17498                         gidformat='"lu"'
17499                 else
17500                         if $test X"$gidsize" = X"$intsize"; then
17501                                 gidformat='"u"'
17502                         else
17503                                 if $test X"$gidsize" = X"$shortsize"; then
17504                                         gidformat='"hu"'
17505                                 fi
17506                         fi
17507                 fi
17508         fi
17509         ;;
17510 esac
17511
17512 : see if getgroups exists
17513 set getgroups d_getgrps
17514 eval $inlibc
17515
17516 : see if setgroups exists
17517 set setgroups d_setgrps
17518 eval $inlibc
17519
17520
17521 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
17522 echo " "
17523 case "$d_getgrps$d_setgrps" in
17524 *define*)
17525         case "$groupstype" in
17526         '') dflt="$gidtype" ;;
17527         *)  dflt="$groupstype" ;;
17528         esac
17529         $cat <<EOM
17530 What type of pointer is the second argument to getgroups() and setgroups()?
17531 Usually this is the same as group ids, $gidtype, but not always.
17532
17533 EOM
17534         rp='What type pointer is the second argument to getgroups() and setgroups()?'
17535         . ./myread
17536         groupstype="$ans"
17537         ;;
17538 *)  groupstype="$gidtype";;
17539 esac
17540
17541 echo " "
17542 echo "Checking if your $make program sets \$(MAKE)..." >&4
17543 case "$make_set_make" in
17544 '')
17545         $sed 's/^X //' > testmake.mak << 'EOF'
17546 Xall:
17547 X       @echo 'maketemp="$(MAKE)"'
17548 EOF
17549         case "`$make -f testmake.mak 2>/dev/null`" in
17550         *maketemp=*) make_set_make='#' ;;
17551         *)      make_set_make="MAKE=$make" ;;
17552         esac
17553         $rm -f testmake.mak
17554         ;;
17555 esac
17556 case "$make_set_make" in
17557 '#') echo "Yup, it does.";;
17558 *) echo "Nope, it doesn't.";;
17559 esac
17560
17561 : see what type is used for mode_t
17562 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
17563 set mode_t modetype int stdio.h sys/types.h
17564 eval $typedef_ask
17565
17566 : see if stdarg is available
17567 echo " "
17568 if $test `./findhdr stdarg.h`; then
17569         echo "<stdarg.h> found." >&4
17570         valstd="$define"
17571 else
17572         echo "<stdarg.h> NOT found." >&4
17573         valstd="$undef"
17574 fi
17575
17576 : see if varags is available
17577 echo " "
17578 if $test `./findhdr varargs.h`; then
17579         echo "<varargs.h> found." >&4
17580 else
17581         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
17582 fi
17583
17584 : set up the varargs testing programs
17585 $cat > varargs.c <<EOP
17586 #ifdef I_STDARG
17587 #include <stdarg.h>
17588 #endif
17589 #ifdef I_VARARGS
17590 #include <varargs.h>
17591 #endif
17592
17593 #ifdef I_STDARG
17594 int f(char *p, ...)
17595 #else
17596 int f(va_alist)
17597 va_dcl
17598 #endif
17599 {
17600         va_list ap;
17601 #ifndef I_STDARG
17602         char *p;
17603 #endif
17604 #ifdef I_STDARG
17605         va_start(ap,p);
17606 #else
17607         va_start(ap);
17608         p = va_arg(ap, char *);
17609 #endif
17610         va_end(ap);
17611 }
17612 EOP
17613 $cat > varargs <<EOP
17614 $startsh
17615 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
17616         echo "true"
17617 else
17618         echo "false"
17619 fi
17620 $rm -f varargs$_o
17621 EOP
17622 chmod +x varargs
17623
17624 : now check which varargs header should be included
17625 echo " "
17626 i_varhdr=''
17627 case "$valstd" in
17628 "$define")
17629         if `./varargs I_STDARG`; then
17630                 val='stdarg.h'
17631         elif `./varargs I_VARARGS`; then
17632                 val='varargs.h'
17633         fi
17634         ;;
17635 *)
17636         if `./varargs I_VARARGS`; then
17637                 val='varargs.h'
17638         fi
17639         ;;
17640 esac
17641 case "$val" in
17642 '')
17643 echo "I could not find the definition for va_dcl... You have problems..." >&4
17644         val="$undef"; set i_stdarg; eval $setvar
17645         val="$undef"; set i_varargs; eval $setvar
17646         ;;
17647 *) 
17648         set i_varhdr
17649         eval $setvar
17650         case "$i_varhdr" in
17651         stdarg.h)
17652                 val="$define"; set i_stdarg; eval $setvar
17653                 val="$undef"; set i_varargs; eval $setvar
17654                 ;;
17655         varargs.h)
17656                 val="$undef"; set i_stdarg; eval $setvar
17657                 val="$define"; set i_varargs; eval $setvar
17658                 ;;
17659         esac
17660         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
17661 esac
17662 $rm -f varargs*
17663
17664 : see if we need va_copy
17665 echo " "
17666 case "$i_stdarg" in
17667 "$define")
17668         $cat >try.c <<EOCP
17669 #include <stdarg.h>
17670 #include <stdio.h>
17671 #$i_stdlib I_STDLIB
17672 #ifdef I_STDLIB
17673 #include <stdlib.h>
17674 #endif
17675 #include <signal.h>
17676
17677 int
17678 ivfprintf(FILE *f, const char *fmt, va_list *valp)
17679 {
17680   return vfprintf(f, fmt, *valp);
17681 }
17682  
17683 int    
17684 myvfprintf(FILE *f, const  char *fmt, va_list val)
17685 {
17686   return ivfprintf(f, fmt, &val);
17687 }
17688       
17689 int
17690 myprintf(char *fmt, ...) 
17691 {
17692   va_list val;
17693   va_start(val, fmt);
17694   return myvfprintf(stdout, fmt, val); 
17695 }         
17696
17697 int
17698 main(int ac, char **av)
17699 {
17700   signal(SIGSEGV, exit);
17701
17702   myprintf("%s%cs all right, then\n", "that", '\'');                            
17703   exit(0);      
17704 }
17705 EOCP
17706         set try
17707         if eval $compile && $run ./try 2>&1 >/dev/null; then
17708                 case "`$run ./try`" in
17709                 "that's all right, then")
17710                         okay=yes
17711                         ;;
17712                 esac
17713         fi
17714         case "$okay" in
17715         yes)    echo "It seems that you don't need va_copy()." >&4
17716                 need_va_copy="$undef"
17717                 ;;
17718         *)      echo "It seems that va_copy() or similar will be needed." >&4
17719                 need_va_copy="$define"
17720                 ;;
17721         esac
17722         $rm -f try.* core core.* *.core *.core.*
17723         ;;
17724 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
17725         ;;
17726 esac
17727
17728 : see what type is used for size_t
17729 rp="What is the type used for the length parameter for string functions?"
17730 set size_t sizetype 'unsigned int' stdio.h sys/types.h
17731 eval $typedef_ask
17732
17733 : check for type of arguments to gethostbyaddr. 
17734 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
17735         case "$d_gethbyaddr" in
17736         $define)
17737                 $cat <<EOM
17738
17739 Checking to see what type of arguments are accepted by gethostbyaddr().
17740 EOM
17741                 hdrs="$define sys/types.h
17742                         $d_socket sys/socket.h 
17743                         $i_niin netinet/in.h 
17744                         $i_netdb netdb.h
17745                         $i_unistd unistd.h"
17746                 : The first arg can 'char *' or 'void *'
17747                 : The second arg is some of integral type
17748                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
17749                         for yyy in size_t long int; do
17750                                 case "$netdb_host_type" in
17751                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
17752                                         if ./protochk "$try" $hdrs; then
17753                                                 echo "Your system accepts $xxx for the first arg."
17754                                                 echo "...and $yyy for the second arg."
17755                                                 netdb_host_type="$xxx"
17756                                                 netdb_hlen_type="$yyy"
17757                                         fi
17758                                         ;;
17759                                 esac
17760                         done
17761                 done
17762                 : In case none of those worked, prompt the user.
17763                 case "$netdb_host_type" in
17764                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
17765                         dflt='char *'
17766                         . ./myread
17767                         netdb_host_type=$ans
17768                         rp='What is the type for the 2nd argument to gethostbyaddr?'
17769                         dflt="$sizetype"
17770                         . ./myread
17771                         netdb_hlen_type=$ans
17772                         ;;
17773                 esac
17774                 ;;
17775         *)      : no gethostbyaddr, so pick harmless defaults
17776                 netdb_host_type='char *'
17777                 netdb_hlen_type="$sizetype"
17778                 ;;
17779         esac
17780         # Remove the "const" if needed. -- but then we'll have a 
17781         # prototype clash!
17782         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
17783 fi
17784
17785 : check for type of argument to gethostbyname. 
17786 if test "X$netdb_name_type" = X ; then
17787         case "$d_gethbyname" in
17788         $define)
17789                 $cat <<EOM
17790
17791 Checking to see what type of argument is accepted by gethostbyname().
17792 EOM
17793                 hdrs="$define sys/types.h
17794                         $d_socket sys/socket.h 
17795                         $i_niin netinet/in.h 
17796                         $i_netdb netdb.h
17797                         $i_unistd unistd.h"
17798                 for xxx in "const char *" "char *"; do
17799                         case "$netdb_name_type" in
17800                         '')     try="extern struct hostent *gethostbyname($xxx);"
17801                                 if ./protochk "$try" $hdrs; then
17802                                         echo "Your system accepts $xxx."
17803                                         netdb_name_type="$xxx"
17804                                 fi
17805                                 ;;
17806                         esac
17807                 done
17808                 : In case none of those worked, prompt the user.
17809                 case "$netdb_name_type" in
17810                 '')     rp='What is the type for the 1st argument to gethostbyname?'
17811                         dflt='char *'
17812                         . ./myread
17813                         netdb_name_type=$ans
17814                         ;;
17815                 esac
17816                 ;;
17817         *)      : no gethostbyname, so pick harmless default
17818                 netdb_name_type='char *'
17819                 ;;
17820         esac
17821 fi
17822
17823 : check for type of 1st argument to getnetbyaddr. 
17824 if test "X$netdb_net_type" = X ; then
17825         case "$d_getnbyaddr" in
17826         $define)
17827                 $cat <<EOM
17828
17829 Checking to see what type of 1st argument is accepted by getnetbyaddr().
17830 EOM
17831                 hdrs="$define sys/types.h
17832                         $d_socket sys/socket.h 
17833                         $i_niin netinet/in.h 
17834                         $i_netdb netdb.h
17835                         $i_unistd unistd.h"
17836                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
17837                         case "$netdb_net_type" in
17838                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
17839                                 if ./protochk "$try" $hdrs; then
17840                                         echo "Your system accepts $xxx."
17841                                         netdb_net_type="$xxx"
17842                                 fi
17843                                 ;;
17844                         esac
17845                 done
17846                 : In case none of those worked, prompt the user.
17847                 case "$netdb_net_type" in
17848                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
17849                         dflt='long'
17850                         . ./myread
17851                         netdb_net_type=$ans
17852                         ;;
17853                 esac
17854                 ;;
17855         *)      : no getnetbyaddr, so pick harmless default
17856                 netdb_net_type='long'
17857                 ;;
17858         esac
17859 fi
17860 : locate the preferred pager for this system
17861 fn=f/
17862 case "$pager" in
17863 '')
17864         dflt=''
17865         case "$pg" in
17866         /*) dflt=$pg;;
17867         [a-zA-Z]:/*) dflt=$pg;;
17868         esac
17869         case "$more" in
17870         /*) dflt=$more;;
17871         [a-zA-Z]:/*) dflt=$more;;
17872         esac
17873         case "$less" in
17874         /*) dflt=$less;;
17875         [a-zA-Z]:/*) dflt=$less;;
17876         esac
17877         case "$dflt" in
17878         '') dflt=/usr/ucb/more;;
17879         esac
17880         ;;
17881 *)      dflt="$pager"
17882         : Instruct ./getfile to trust the hinted or previous pager value,
17883         : even if it does not begin with a slash.  For example, on os2,
17884         : pager might be cmd /c more.  See comments in UU/getfile.
17885         fn="f/($pager)"
17886         ;;
17887 esac
17888 echo " "
17889 rp='What pager is used on your system?'
17890 . ./getfile
17891 pager="$ans"
17892
17893 : see what type pids are declared as in the kernel
17894 rp="What is the type of process ids on this system?"
17895 set pid_t pidtype int stdio.h sys/types.h
17896 eval $typedef_ask
17897
17898 : Find earliest binary compatible site_perl subdirectory perl can use.
17899 xs_apiversion=$version # The current site_perl version.
17900 : Find earliest pure perl site_perl subdirectory perl can use.
17901 : The versioned directories started at 5.005.
17902 pm_apiversion='5.005'
17903
17904 : see if ar generates random libraries by itself
17905 echo " "
17906 echo "Checking how to generate random libraries on your machine..." >&4
17907 echo 'int bar1() { return bar2(); }' > bar1.c
17908 echo 'int bar2() { return 2; }' > bar2.c
17909 $cat > foo.c <<'EOP'
17910 int main() { printf("%d\n", bar1()); exit(0); }
17911 EOP
17912 $cc $ccflags -c bar1.c >/dev/null 2>&1
17913 $cc $ccflags -c bar2.c >/dev/null 2>&1
17914 $cc $ccflags -c foo.c >/dev/null 2>&1
17915 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
17916 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
17917         $run ./foobar >/dev/null 2>&1; then
17918         echo "$ar appears to generate random libraries itself."
17919         orderlib=false
17920         ranlib=":"
17921 elif $ar ts bar$_a >/dev/null 2>&1 &&
17922         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
17923         $run ./foobar >/dev/null 2>&1; then
17924                 echo "a table of contents needs to be added with '$ar ts'."
17925                 orderlib=false
17926                 ranlib="$ar ts"
17927 else
17928         case "$ranlib" in
17929         :) ranlib='';;
17930         '')
17931                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
17932                 $test -f $ranlib || ranlib=''
17933                 ;;
17934         esac
17935         if $test -n "$ranlib"; then
17936                 echo "your system has '$ranlib'; we'll use that."
17937                 orderlib=false
17938         else
17939                 echo "your system doesn't seem to support random libraries"
17940                 echo "so we'll use lorder and tsort to order the libraries."
17941                 orderlib=true
17942                 ranlib=":"
17943         fi
17944 fi
17945 $rm -f foo* bar* 
17946
17947 : check for type of arguments to select. 
17948 case "$selecttype" in
17949 '') case "$d_select" in
17950         $define)
17951                 echo " "
17952                 $cat <<EOM
17953 Checking to see what type of arguments are accepted by select().
17954 EOM
17955                 hdrs="$define sys/types.h
17956                         $i_systime sys/time.h 
17957                         $i_sysselct sys/select.h
17958                         $d_socket sys/socket.h"
17959                 : The first arg can be int, unsigned, or size_t
17960                 : The last arg may or may not be 'const'
17961                 val=''
17962                 : void pointer has been seen but using that
17963                 : breaks the selectminbits test
17964                 for xxx in 'fd_set *' 'int *'; do
17965                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
17966                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
17967                                         case "$val" in
17968                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
17969                                                 if ./protochk "$try" $hdrs; then
17970                                                         echo "Your system accepts $xxx."
17971                                                         val="$xxx"
17972                                                 fi
17973                                                 ;;
17974                                         esac
17975                                 done
17976                         done
17977                 done
17978                 case "$val" in
17979                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
17980                         case "$d_fd_set" in
17981                                 $define) dflt="fd_set *" ;;
17982                                 *)              dflt="int *" ;;
17983                         esac
17984                         . ./myread
17985                         val=$ans
17986                         ;;
17987                 esac
17988                 selecttype="$val"
17989                 ;;
17990         *)      : no select, so pick a harmless default
17991                 selecttype='int *'
17992                 ;;
17993         esac
17994         ;;
17995 esac
17996
17997 : check for the select 'width'
17998 case "$selectminbits" in
17999 '') case "$d_select" in
18000         $define)
18001                 $cat <<EOM
18002
18003 Checking to see on how many bits at a time your select() operates...
18004 EOM
18005                 $cat >try.c <<EOCP
18006 #include <sys/types.h>
18007 #$i_time I_TIME
18008 #$i_systime I_SYS_TIME
18009 #$i_systimek I_SYS_TIME_KERNEL
18010 #ifdef I_TIME
18011 #   include <time.h>
18012 #endif
18013 #ifdef I_SYS_TIME
18014 #   ifdef I_SYS_TIME_KERNEL
18015 #       define KERNEL
18016 #   endif
18017 #   include <sys/time.h>
18018 #   ifdef I_SYS_TIME_KERNEL
18019 #       undef KERNEL
18020 #   endif
18021 #endif
18022 #$i_sysselct I_SYS_SELECT
18023 #ifdef I_SYS_SELECT
18024 #include <sys/select.h>
18025 #endif
18026 #$d_socket HAS_SOCKET
18027 #ifdef HAS_SOCKET
18028 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
18029 #endif
18030 #include <stdio.h>
18031 $selecttype b;
18032 #define S sizeof(*(b))
18033 #define MINBITS 64
18034 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
18035 #define NBITS  (NBYTES * 8)
18036 int main() {
18037     char s[NBYTES];
18038     struct timeval t;
18039     int i;
18040     FILE* fp;
18041     int fd;
18042
18043     fclose(stdin);
18044     fp = fopen("try.c", "r");
18045     if (fp == 0)
18046       exit(1);
18047     fd = fileno(fp);
18048     if (fd < 0)
18049       exit(2);
18050     b = ($selecttype)s;
18051     for (i = 0; i < NBITS; i++)
18052         FD_SET(i, b);
18053     t.tv_sec  = 0;
18054     t.tv_usec = 0;
18055     select(fd + 1, b, 0, 0, &t);
18056     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
18057     printf("%d\n", i + 1);
18058     return 0;
18059 }
18060 EOCP
18061                 set try
18062                 if eval $compile_ok; then
18063                         selectminbits=`$run ./try`
18064                         case "$selectminbits" in
18065                         '')     cat >&4 <<EOM
18066 Cannot figure out on how many bits at a time your select() operates.
18067 I'll play safe and guess it is 32 bits.
18068 EOM
18069                                 selectminbits=32
18070                                 bits="32 bits"
18071                                 ;;
18072                         1)      bits="1 bit" ;;
18073                         *)      bits="$selectminbits bits" ;;
18074                         esac
18075                         echo "Your select() operates on $bits at a time." >&4
18076                 else
18077                         rp='What is the minimum number of bits your select() operates on?'
18078                         case "$byteorder" in
18079                         1234|12345678)  dflt=32 ;;
18080                         *)              dflt=1  ;;
18081                         esac
18082                         . ./myread
18083                         val=$ans
18084                         selectminbits="$val"
18085                 fi
18086                 $rm -f try.* try
18087                 ;;
18088         *)      : no select, so pick a harmless default
18089                 selectminbits='32'
18090                 ;;
18091         esac
18092         ;;
18093 esac
18094
18095 : Trace out the files included by signal.h, then look for SIGxxx names.
18096 : Remove SIGARRAYSIZE used by HPUX.
18097 : Remove SIGSTKSIZE used by Linux.
18098 : Remove SIGSTKSZ used by Posix.
18099 : Remove SIGTYP void lines used by OS2.
18100 : Some cpps, like os390, dont give the file name anywhere
18101 if [ "X$fieldn" = X ]; then
18102         : Just make some guesses.  We check them later.
18103         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
18104 else
18105         xxx=`echo '#include <signal.h>' |
18106         $cppstdin $cppminus $cppflags 2>/dev/null |
18107         $grep '^[       ]*#.*include' | 
18108         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
18109 fi
18110 : Check this list of files to be sure we have parsed the cpp output ok.
18111 : This will also avoid potentially non-existent files, such 
18112 : as ../foo/bar.h
18113 xxxfiles=''
18114 for xx in $xxx /dev/null ; do
18115         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
18116 done
18117 : If we have found no files, at least try signal.h
18118 case "$xxxfiles" in
18119 '')     xxxfiles=`./findhdr signal.h` ;;
18120 esac
18121 xxx=`awk '
18122 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
18123         print substr($2, 4, 20)
18124 }
18125 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
18126         print substr($3, 4, 20)
18127 }' $xxxfiles`
18128 : Append some common names just in case the awk scan failed.
18129 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
18130 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
18131 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
18132 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
18133 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
18134
18135 : generate a few handy files for later
18136 $cat > signal.c <<'EOCP'
18137 #include <sys/types.h>
18138 #include <signal.h>
18139 #include <stdio.h>
18140 int main() {
18141
18142 /* Strange style to avoid deeply-nested #if/#else/#endif */
18143 #ifndef NSIG
18144 #  ifdef _NSIG
18145 #    define NSIG (_NSIG)
18146 #  endif
18147 #endif
18148
18149 #ifndef NSIG
18150 #  ifdef SIGMAX
18151 #    define NSIG (SIGMAX+1)
18152 #  endif
18153 #endif
18154
18155 #ifndef NSIG
18156 #  ifdef SIG_MAX
18157 #    define NSIG (SIG_MAX+1)
18158 #  endif
18159 #endif
18160
18161 #ifndef NSIG
18162 #  ifdef MAXSIG
18163 #    define NSIG (MAXSIG+1)
18164 #  endif
18165 #endif
18166
18167 #ifndef NSIG
18168 #  ifdef MAX_SIG
18169 #    define NSIG (MAX_SIG+1)
18170 #  endif
18171 #endif
18172
18173 #ifndef NSIG
18174 #  ifdef SIGARRAYSIZE
18175 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
18176 #  endif
18177 #endif
18178
18179 #ifndef NSIG
18180 #  ifdef _sys_nsig
18181 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
18182 #  endif
18183 #endif
18184
18185 /* Default to some arbitrary number that's big enough to get most
18186    of the common signals.
18187 */
18188 #ifndef NSIG
18189 #    define NSIG 50
18190 #endif
18191
18192 printf("NSIG %d\n", NSIG);
18193
18194 #ifndef JUST_NSIG
18195
18196 EOCP
18197
18198 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
18199 {
18200         printf "#ifdef SIG"; printf $1; printf "\n"
18201         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
18202         printf $1; printf ");\n"
18203         printf "#endif\n"
18204 }
18205 END {
18206         printf "#endif /* JUST_NSIG */\n";
18207         printf "exit(0);\n}\n";
18208 }
18209 ' >>signal.c
18210 $cat >signal.awk <<'EOP'
18211 BEGIN { ndups = 0 }
18212 $1 ~ /^NSIG$/ { nsig = $2 }
18213 ($1 !~ /^NSIG$/) && (NF == 2) {
18214     if ($2 > maxsig) { maxsig = $2 }
18215     if (sig_name[$2]) {
18216         dup_name[ndups] = $1
18217         dup_num[ndups] = $2
18218         ndups++ 
18219     }
18220     else {
18221         sig_name[$2] = $1
18222         sig_num[$2] = $2
18223     }
18224 }
18225 END { 
18226     if (nsig == 0) {
18227         nsig = maxsig + 1
18228     }
18229     printf("NSIG %d\n", nsig);
18230     for (n = 1; n < nsig; n++) {
18231         if (sig_name[n]) {
18232             printf("%s %d\n", sig_name[n], sig_num[n])
18233         }
18234         else {
18235             printf("NUM%d %d\n", n, n) 
18236         }
18237     }
18238     for (n = 0; n < ndups; n++) {
18239         printf("%s %d\n", dup_name[n], dup_num[n])
18240     }
18241 }
18242 EOP
18243 $cat >signal_cmd <<EOS
18244 $startsh
18245 if $test -s signal.lst; then
18246     echo "Using your existing signal.lst file"
18247         exit 0
18248 fi
18249 xxx="$xxx"
18250 EOS
18251 $cat >>signal_cmd <<'EOS'
18252
18253 set signal
18254 if eval $compile_ok; then
18255         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
18256 else
18257         echo "(I can't seem be able to compile the whole test program)" >&4
18258         echo "(I'll try it in little pieces.)" >&4
18259         set signal -DJUST_NSIG
18260         if eval $compile_ok; then
18261                 $run ./signal$_exe > signal.nsg
18262                 $cat signal.nsg
18263         else
18264                 echo "I can't seem to figure out how many signals you have." >&4
18265                 echo "Guessing 50." >&4
18266                 echo 'NSIG 50' > signal.nsg
18267         fi
18268         : Now look at all the signal names, one at a time.
18269         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
18270                 $cat > signal.c <<EOCP
18271 #include <sys/types.h>
18272 #include <signal.h>
18273 #include <stdio.h>
18274 int main() {
18275 printf("$xx %d\n", SIG${xx});
18276 return 0;
18277 }
18278 EOCP
18279                 set signal
18280                 if eval $compile; then
18281                         echo "SIG${xx} found."
18282                         $run ./signal$_exe  >> signal.ls1
18283                 else
18284                         echo "SIG${xx} NOT found."
18285                 fi
18286         done
18287         if $test -s signal.ls1; then
18288                 $cat signal.nsg signal.ls1 |
18289                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
18290         fi
18291
18292 fi
18293 if $test -s signal.lst; then
18294         :
18295 else
18296         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
18297         echo 'kill -l' >signal
18298         set X `csh -f <signal`
18299         $rm -f signal
18300         shift
18301         case $# in
18302         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
18303         esac
18304         echo $@ | $tr ' ' $trnl | \
18305             $awk '{ printf "%s %d\n", $1, ++s; }
18306                   END { printf "NSIG %d\n", ++s }' >signal.lst
18307 fi
18308 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
18309 EOS
18310 chmod a+x signal_cmd
18311 $eunicefix signal_cmd
18312
18313 : generate list of signal names
18314 echo " "
18315 case "$sig_name_init" in
18316 '') doinit=yes ;;
18317 *)  case "$sig_num_init" in
18318     ''|*,*) doinit=yes ;;
18319     esac ;;
18320 esac
18321 case "$doinit" in
18322 yes)
18323         echo "Generating a list of signal names and numbers..." >&4
18324         . ./signal_cmd
18325         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
18326         sig_name=`$awk 'BEGIN { printf "ZERO " }
18327                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
18328         sig_num=`$awk  'BEGIN { printf "0 " }
18329                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
18330         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
18331                              !/^NSIG/   { printf "\"%s\", ", $1 }
18332                              END        { printf "0\n" }' signal.lst`
18333         sig_num_init=`$awk  'BEGIN      { printf "0, " }
18334                              !/^NSIG/   { printf "%d, ", $2}
18335                              END        { printf "0\n"}' signal.lst`
18336         ;;
18337 esac
18338 echo "The following $sig_count signals are available:"
18339 echo " "
18340 echo $sig_name | $awk \
18341 'BEGIN { linelen = 0 }
18342 {
18343         for (i = 1; i <= NF; i++) {
18344                 name = "SIG" $i " "
18345                 linelen = linelen + length(name)
18346                 if (linelen > 70) {
18347                         printf "\n"
18348                         linelen = length(name)
18349                 }
18350                 printf "%s", name
18351         }
18352         printf "\n"
18353 }'
18354 sig_size=`echo $sig_name | awk '{print NF}'`
18355 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
18356
18357 echo " "
18358 case "$sizetype" in
18359 *_t) zzz="$sizetype"    ;;
18360 *)   zzz="filesize"     ;;
18361 esac
18362 echo "Checking the size of $zzz..." >&4 
18363 cat > try.c <<EOCP
18364 #include <sys/types.h>
18365 #include <stdio.h>
18366 int main() {
18367     printf("%d\n", (int)sizeof($sizetype));
18368     exit(0);
18369 }
18370 EOCP
18371 set try
18372 if eval $compile_ok; then
18373         yyy=`$run ./try`
18374         case "$yyy" in
18375         '')     sizesize=4
18376                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
18377                 ;;
18378         *)      sizesize=$yyy
18379                 echo "Your $zzz size is $sizesize bytes."
18380                 ;;
18381         esac
18382 else
18383         sizesize=4
18384         echo "(I can't compile the test program--guessing $sizesize.)" >&4
18385 fi
18386
18387
18388 : check for socklen_t
18389 echo " "
18390 echo "Checking to see if you have socklen_t..." >&4
18391 $cat >try.c <<EOCP
18392 #include <sys/types.h>
18393 #$d_socket HAS_SOCKET
18394 #ifdef HAS_SOCKET
18395 #include <sys/socket.h>
18396 #endif
18397 int main() { socklen_t x = 16; }
18398 EOCP
18399 set try
18400 if eval $compile; then
18401         val="$define"
18402         echo "You have socklen_t."
18403 else
18404         val="$undef"
18405         echo "You do not have socklen_t."
18406         case "$sizetype" in
18407         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
18408         esac
18409 fi
18410 $rm -f try try.*
18411 set d_socklen_t
18412 eval $setvar
18413
18414 : see if this is a socks.h system
18415 set socks.h i_socks
18416 eval $inhdr
18417
18418 : check for type of the size argument to socket calls
18419 case "$d_socket" in
18420 "$define")
18421         $cat <<EOM
18422
18423 Checking to see what type is the last argument of accept().
18424 EOM
18425         yyy=''
18426         case "$d_socklen_t" in
18427         "$define") yyy="$yyy socklen_t"
18428         esac
18429         yyy="$yyy $sizetype int long unsigned"
18430         for xxx in $yyy; do
18431                 case "$socksizetype" in
18432                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
18433                         case "$usesocks" in
18434                         "$define")
18435                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
18436                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18437                                         socksizetype="$xxx"
18438                                 fi
18439                                 ;;
18440                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
18441                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18442                                         socksizetype="$xxx"
18443                                 fi
18444                                 ;;
18445                         esac
18446                         ;;
18447                 esac
18448         done
18449 : In case none of those worked, prompt the user.
18450         case "$socksizetype" in
18451         '')     rp='What is the type for socket address structure sizes?'
18452                 dflt='int'
18453                 . ./myread
18454                 socksizetype=$ans
18455                 ;;
18456         esac
18457         ;;
18458 *)      : no sockets, so pick relatively harmless default
18459         socksizetype='int'
18460         ;;
18461 esac
18462
18463 : see what type is used for signed size_t
18464 set ssize_t ssizetype int stdio.h sys/types.h
18465 eval $typedef
18466 dflt="$ssizetype"
18467 $cat > try.c <<EOM
18468 #include <stdio.h>
18469 #include <sys/types.h>
18470 #define Size_t $sizetype
18471 #define SSize_t $dflt
18472 int main()
18473 {
18474         if (sizeof(Size_t) == sizeof(SSize_t))
18475                 printf("$dflt\n");
18476         else if (sizeof(Size_t) == sizeof(int))
18477                 printf("int\n");
18478         else 
18479                 printf("long\n");
18480         exit(0);
18481 }
18482 EOM
18483 echo " "
18484 set try
18485 if eval $compile_ok && $run ./try > /dev/null; then
18486         ssizetype=`$run ./try`
18487         echo "I'll be using $ssizetype for functions returning a byte count." >&4
18488 else
18489         $cat >&4 <<EOM
18490 Help! I can't compile and run the ssize_t test program: please enlighten me!
18491 (This is probably a misconfiguration in your system or libraries, and
18492 you really ought to fix it.  Still, I'll try anyway.)
18493
18494 I need a type that is the same size as $sizetype, but is guaranteed to
18495 be signed.  Common values are ssize_t, int and long.
18496
18497 EOM
18498         rp="What signed type is the same size as $sizetype?"
18499         . ./myread
18500         ssizetype="$ans"
18501 fi
18502 $rm -f try try.*
18503
18504 : see what type of char stdio uses.
18505 echo " "
18506 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
18507 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
18508         echo "Your stdio uses unsigned chars." >&4
18509         stdchar="unsigned char"
18510 else
18511         echo "Your stdio uses signed chars." >&4
18512         stdchar="char"
18513 fi
18514 $rm -f stdioh
18515
18516
18517
18518 : see what type uids are declared as in the kernel
18519 echo " "
18520 echo "Looking for the type for user ids returned by getuid()."
18521 set uid_t uidtype xxx stdio.h sys/types.h
18522 eval $typedef
18523 case "$uidtype" in
18524 xxx)
18525         xxx=`./findhdr sys/user.h`
18526         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18527         case $1 in
18528         unsigned) dflt="$1 $2" ;;
18529         *) dflt="$1" ;;
18530         esac
18531         ;;
18532 *) dflt="$uidtype";;
18533 esac
18534 case "$uidtype" in
18535 uid_t)  echo "uid_t found." ;;
18536 *)      rp="What is the type for user ids returned by getuid()?"
18537         . ./myread
18538         uidtype="$ans"
18539         ;;
18540 esac
18541
18542 echo " "
18543 case "$uidtype" in
18544 *_t) zzz="$uidtype"     ;;
18545 *)   zzz="uid"          ;;
18546 esac
18547 echo "Checking the size of $zzz..." >&4 
18548 cat > try.c <<EOCP
18549 #include <sys/types.h>
18550 #include <stdio.h>
18551 int main() {
18552     printf("%d\n", (int)sizeof($uidtype));
18553     exit(0);
18554 }
18555 EOCP
18556 set try
18557 if eval $compile_ok; then
18558         yyy=`$run ./try`
18559         case "$yyy" in
18560         '')     uidsize=4
18561                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
18562                 ;;
18563         *)      uidsize=$yyy
18564                 echo "Your $zzz is $uidsize bytes long."
18565                 ;;
18566         esac
18567 else
18568         uidsize=4
18569         echo "(I can't compile the test program--guessing $uidsize.)" >&4
18570 fi
18571
18572 echo " "
18573 case "$uidtype" in
18574 *_t) zzz="$uidtype"     ;;
18575 *)   zzz="uid"          ;;
18576 esac
18577 echo "Checking the sign of $zzz..." >&4
18578 cat > try.c <<EOCP
18579 #include <sys/types.h>
18580 #include <stdio.h>
18581 int main() {
18582         $uidtype foo = -1;
18583         if (foo < 0)
18584                 printf("-1\n");
18585         else
18586                 printf("1\n");
18587 }
18588 EOCP
18589 set try
18590 if eval $compile; then
18591         yyy=`$run ./try`
18592         case "$yyy" in
18593         '')     uidsign=1
18594                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18595                 ;;
18596         *)      uidsign=$yyy
18597                 case "$uidsign" in
18598                  1) echo "Your $zzz is unsigned." ;;
18599                 -1) echo "Your $zzz is signed."   ;;
18600                 esac
18601                 ;;
18602         esac
18603 else
18604         uidsign=1
18605         echo "(I can't compile the test program--guessing unsigned.)" >&4
18606 fi
18607
18608
18609
18610 echo " "
18611 $echo "Checking the format string to be used for uids..." >&4
18612
18613 case "$uidsign" in
18614 -1)     if $test X"$uidsize" = X"$ivsize"; then
18615                 uidformat="$ivdformat"
18616         else
18617                 if $test X"$uidsize" = X"$longsize"; then
18618                         uidformat='"ld"'
18619                 else
18620                         if $test X"$uidsize" = X"$intsize"; then
18621                                 uidformat='"d"'
18622                         else
18623                                 if $test X"$uidsize" = X"$shortsize"; then
18624                                         uidformat='"hd"'
18625                                 fi
18626                         fi
18627                 fi
18628         fi
18629         ;;
18630 *)      if $test X"$uidsize" = X"$uvsize"; then
18631                 uidformat="$uvuformat"
18632         else
18633                 if $test X"$uidsize" = X"$longsize"; then
18634                         uidformat='"lu"'
18635                 else
18636                         if $test X"$uidsize" = X"$intsize"; then
18637                                 uidformat='"u"'
18638                         else
18639                                 if $test X"$uidsize" = X"$shortsize"; then
18640                                         uidformat='"hu"'
18641                                 fi
18642                         fi
18643                 fi
18644         fi
18645         ;;
18646 esac
18647
18648 : determine compiler compiler
18649 case "$yacc" in
18650 '')
18651         dflt=yacc;;
18652 *)
18653         dflt="$yacc";;
18654 esac
18655 echo " "
18656 comp='yacc'
18657 if $test -f "$byacc$_exe"; then
18658         dflt="$byacc"
18659         comp="byacc or $comp"
18660 fi
18661 if $test -f "$bison$_exe"; then
18662         comp="$comp or bison -y"
18663 fi
18664 rp="Which compiler compiler ($comp) shall I use?"
18665 . ./myread
18666 yacc="$ans"
18667 case "$yacc" in
18668 *bis*)
18669         case "$yacc" in
18670         *-y*) ;;
18671         *)
18672                 yacc="$yacc -y"
18673                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
18674                 ;;
18675         esac
18676         ;;
18677 esac
18678
18679 : see if this is a fp.h system
18680 set fp.h i_fp
18681 eval $inhdr
18682
18683 : see if this is a fp_class.h system
18684 set fp_class.h i_fp_class
18685 eval $inhdr
18686
18687 : see if this is a ieeefp.h system
18688 case "$i_ieeefp" in
18689 '' ) set ieeefp.h i_ieeefp
18690      eval $inhdr
18691      ;;
18692 esac
18693
18694 : see if this is a libutil.h system
18695 set libutil.h i_libutil
18696 eval $inhdr
18697
18698 : see if mach cthreads are available
18699 if test "X$usethreads" = "X$define"; then
18700         set mach/cthreads.h i_machcthr
18701         eval $inhdr
18702 else
18703         i_machcthr="$undef"
18704 fi
18705
18706
18707
18708 : see if this is a math.h system
18709 set math.h i_math
18710 eval $inhdr
18711
18712 : see if this is a mntent.h system
18713 set mntent.h i_mntent
18714 eval $inhdr
18715
18716 : see if ndbm.h is available
18717 set ndbm.h t_ndbm
18718 eval $inhdr
18719
18720 case "$t_ndbm" in
18721 $undef)
18722     # Some Linux distributions such as RedHat 7.1 put the
18723     # ndbm.h header in /usr/include/gdbm/ndbm.h.
18724     if $test -f /usr/include/gdbm/ndbm.h; then
18725         echo '<gdbm/ndbm.h> found.'
18726         ccflags="$ccflags -I/usr/include/gdbm"
18727         cppflags="$cppflags -I/usr/include/gdbm"
18728         t_ndbm=$define
18729     fi
18730     ;;
18731 esac
18732
18733 case "$t_ndbm" in
18734 $define)
18735         : see if dbm_open exists
18736         set dbm_open d_dbm_open
18737         eval $inlibc
18738         case "$d_dbm_open" in
18739         $undef)
18740                 t_ndbm="$undef"
18741                 echo "We won't be including <ndbm.h>"
18742                 ;;
18743         esac
18744         ;;
18745 esac
18746 val="$t_ndbm"
18747 set i_ndbm
18748 eval $setvar
18749
18750 : see if net/errno.h is available
18751 val=''
18752 set net/errno.h val
18753 eval $inhdr
18754
18755 : Unfortunately, it causes problems on some systems.  Arrgh.
18756 case "$val" in
18757 $define)
18758         cat > try.c <<'EOM'
18759 #include <stdio.h>
18760 #include <errno.h>
18761 #include <net/errno.h>
18762 int func()
18763 {
18764         return ENOTSOCK;
18765 }
18766 EOM
18767         if $cc $ccflags -c try.c >/dev/null 2>&1; then
18768                 echo "We'll be including <net/errno.h>." >&4
18769         else
18770                 echo "We won't be including <net/errno.h>." >&4
18771                 val="$undef"
18772         fi
18773         $rm -f try.* try
18774         ;;
18775 esac
18776 set i_neterrno
18777 eval $setvar
18778
18779 : see if netinet/tcp.h is available
18780 set netinet/tcp.h i_netinettcp
18781 eval $inhdr
18782
18783 : see if this is a poll.h system
18784 set poll.h i_poll
18785 eval $inhdr
18786
18787 : see if this is a prot.h system
18788 set prot.h i_prot
18789 eval $inhdr
18790
18791 echo " "
18792 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
18793 $cat <<'EOSH' > Cppsym.know
18794 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
18795 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
18796 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
18797 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
18798 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
18799 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
18800 bull c cadmus clipper CMU COFF COMPILER_VERSION
18801 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
18802 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
18803 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
18804 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
18805 GLIBC GLIBC_MINOR
18806 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
18807 H3050R H3050RX hbullx20 hcx host_mips
18808 hp200 hp300 hp700 HP700 hp800 hp9000
18809 hp9000s200 hp9000s300 hp9000s400 hp9000s500
18810 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
18811 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
18812 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
18813 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
18814 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
18815 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
18816 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
18817 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
18818 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
18819 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
18820 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
18821 MATH_HAS_NO_SIDE_EFFECTS
18822 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
18823 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
18824 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
18825 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
18826 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
18827 NetBSD news1500 news1700 news1800 news1900 news3700
18828 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
18829 ns32016 ns32332 ns32k nsc32000
18830 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
18831 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
18832 pc532 pdp11 PGC PIC plexus PORTAR posix
18833 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
18834 POSIX_C_SOURCE POSIX_SOURCE POWER
18835 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
18836 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
18837 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
18838 sony sony_news sonyrisc sparc sparclite spectrum
18839 stardent stdc STDC_EXT stratos sun sun3 sun386
18840 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
18841 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
18842 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
18843 sysV68 sysV88 Tek4132 Tek4300 titan
18844 TM3200 TM5400 TM5600
18845 tower tower32 tower32_200 tower32_600 tower32_700
18846 tower32_800 tower32_850 tss
18847 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
18848 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
18849 unix UNIX95 UNIX99 unixpc unos
18850 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
18851 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
18852 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
18853 USGr4 USGr4_2
18854 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
18855 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
18856 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
18857 z8000
18858 EOSH
18859 # Maybe put other stuff here too.
18860 cat <<EOSH >>Cppsym.know
18861 $osname
18862 EOSH
18863 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
18864 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
18865 $cat Cppsym.know > Cppsym.c
18866 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
18867 $rm -f Cppsym.a Cppsym.b Cppsym.c
18868 cat <<EOSH > Cppsym
18869 $startsh
18870 if $test \$# -gt 0; then
18871     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
18872     if $test -s Cppsym.got; then
18873         $rm -f Cppsym.got
18874         exit 0
18875     fi
18876     $rm -f Cppsym.got
18877     exit 1
18878 else
18879     $tr " " "$trnl" | ./Cppsym.try
18880     exit 0
18881 fi
18882 EOSH
18883 chmod +x Cppsym
18884 $eunicefix Cppsym
18885 cat <<EOSH > Cppsym.try
18886 $startsh
18887 cat <<'EOCP' > try.c
18888 #include <stdio.h>
18889 int main() {
18890 EOCP
18891 $awk \\
18892 EOSH
18893 cat <<'EOSH' >> Cppsym.try
18894 'length($1) > 0 {
18895     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
18896     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
18897     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
18898     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
18899 }'       >> try.c
18900 echo 'return 0;}' >> try.c
18901 EOSH
18902 cat <<EOSH >> Cppsym.try
18903 ccflags="$ccflags"
18904 case "$osname-$gccversion" in
18905 irix-) ccflags="\$ccflags -woff 1178" ;;
18906 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
18907 esac
18908 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
18909 EOSH
18910 chmod +x Cppsym.try
18911 $eunicefix Cppsym.try
18912 ./Cppsym < Cppsym.know > Cppsym.true
18913 : now check the C compiler for additional symbols
18914 postprocess_cc_v=''
18915 case "$osname" in
18916 aix) postprocess_cc_v="|$tr , ' '" ;;
18917 esac
18918 $cat >ccsym <<EOS
18919 $startsh
18920 $cat >tmp.c <<EOF
18921 extern int foo;
18922 EOF
18923 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
18924 do
18925         case "\$i" in
18926         -D*) echo "\$i" | $sed 's/^-D//';;
18927         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
18928         esac
18929 done
18930 $rm -f try.c
18931 EOS
18932 postprocess_cc_v=''
18933 chmod +x ccsym
18934 $eunicefix ccsym
18935 ./ccsym > ccsym1.raw
18936 if $test -s ccsym1.raw; then
18937        $sort ccsym1.raw | $uniq >ccsym.raw
18938 else
18939        mv ccsym1.raw ccsym.raw
18940 fi
18941
18942 $awk '/\=/ { print $0; next }
18943         { print $0"=1" }' ccsym.raw >ccsym.list
18944 $awk '/\=/ { print $0; next }
18945         { print $0"=1" }' Cppsym.true >ccsym.true
18946 $comm -13 ccsym.true ccsym.list >ccsym.own
18947 $comm -12 ccsym.true ccsym.list >ccsym.com
18948 $comm -23 ccsym.true ccsym.list >ccsym.cpp
18949 also=''
18950 if $test -z ccsym.raw; then
18951         echo "Your C compiler doesn't seem to define any symbols!" >&4
18952         echo " "
18953         echo "However, your C preprocessor defines the following symbols:"
18954         $cat Cppsym.true
18955         ccsymbols=''
18956         cppsymbols=`$cat Cppsym.true`
18957         cppsymbols=`echo $cppsymbols`
18958         cppccsymbols="$cppsymbols"
18959 else
18960         if $test -s ccsym.com; then
18961                 echo "Your C compiler and pre-processor define these symbols:"
18962                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
18963                 also='also '
18964                 symbols='ones'
18965                 cppccsymbols=`$cat ccsym.com`
18966                 cppccsymbols=`echo $cppccsymbols`
18967                 $test "$silent" || sleep 1
18968         fi
18969         if $test -s ccsym.cpp; then
18970                 $test "$also" && echo " "
18971                 echo "Your C pre-processor ${also}defines the following symbols:"
18972                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
18973                 also='further '
18974                 cppsymbols=`$cat ccsym.cpp`
18975                 cppsymbols=`echo $cppsymbols`
18976                 $test "$silent" || sleep 1
18977         fi
18978         if $test -s ccsym.own; then
18979                 $test "$also" && echo " "
18980                 echo "Your C compiler ${also}defines the following cpp symbols:"
18981                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
18982                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
18983                 ccsymbols=`$cat ccsym.own`
18984                 ccsymbols=`echo $ccsymbols`
18985                 $test "$silent" || sleep 1
18986         fi
18987 fi
18988
18989 : see if this is a termio system
18990 val="$undef"
18991 val2="$undef"
18992 val3="$undef"
18993 if $test `./findhdr termios.h`; then
18994         set tcsetattr i_termios
18995         eval $inlibc
18996         val3="$i_termios"
18997 fi
18998 echo " "
18999 case "$val3" in
19000 "$define") echo "You have POSIX termios.h... good!" >&4;;
19001 *) if ./Cppsym pyr; then
19002                 case "`/bin/universe`" in
19003                 ucb) if $test `./findhdr sgtty.h`; then
19004                                 val2="$define"
19005                                 echo "<sgtty.h> found." >&4
19006                         else
19007                                 echo "System is pyramid with BSD universe."
19008                                 echo "<sgtty.h> not found--you could have problems." >&4
19009                         fi;;
19010                 *) if $test `./findhdr termio.h`; then
19011                                 val="$define"
19012                                 echo "<termio.h> found." >&4
19013                         else
19014                                 echo "System is pyramid with USG universe."
19015                                 echo "<termio.h> not found--you could have problems." >&4
19016                         fi;;
19017                 esac
19018         elif ./usg; then
19019                 if $test `./findhdr termio.h`; then
19020                         echo "<termio.h> found." >&4
19021                         val="$define"
19022                 elif $test `./findhdr sgtty.h`; then
19023                         echo "<sgtty.h> found." >&4
19024                         val2="$define"
19025                 else
19026 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
19027                 fi
19028         else
19029                 if $test `./findhdr sgtty.h`; then
19030                         echo "<sgtty.h> found." >&4
19031                         val2="$define"
19032                 elif $test `./findhdr termio.h`; then
19033                         echo "<termio.h> found." >&4
19034                         val="$define"
19035                 else
19036 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
19037                 fi
19038         fi;;
19039 esac
19040 set i_termio; eval $setvar
19041 val=$val2; set i_sgtty; eval $setvar
19042 val=$val3; set i_termios; eval $setvar
19043
19044 : see if stddef is available
19045 set stddef.h i_stddef
19046 eval $inhdr
19047
19048 : see if this is a sunmath.h system
19049 set sunmath.h i_sunmath
19050 eval $inhdr
19051
19052 : see if sys/access.h is available
19053 set sys/access.h i_sysaccess
19054 eval $inhdr
19055
19056 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
19057 set sys/filio.h i_sysfilio
19058 eval $inhdr
19059 echo " "
19060 if $test `./findhdr sys/ioctl.h`; then
19061         val="$define"
19062         echo '<sys/ioctl.h> found.' >&4
19063 else
19064         val="$undef"
19065         if $test $i_sysfilio = "$define"; then
19066             echo '<sys/ioctl.h> NOT found.' >&4
19067         else
19068                 $test $i_sgtty = "$define" && xxx="sgtty.h"
19069                 $test $i_termio = "$define" && xxx="termio.h"
19070                 $test $i_termios = "$define" && xxx="termios.h"
19071 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
19072         fi
19073 fi
19074 set i_sysioctl
19075 eval $setvar
19076
19077 : see if socket ioctl defs are in sys/sockio.h
19078 echo " "
19079 xxx=`./findhdr sys/sockio.h`
19080 if $test "$xxx"; then
19081         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
19082                 val="$define"
19083                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
19084         else
19085                 val="$undef"
19086                 echo "No socket ioctls found in <sys/sockio.h>." >&4
19087         fi
19088 else
19089         val="$undef"
19090         $cat <<EOM
19091 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
19092 EOM
19093 fi
19094 set i_syssockio
19095 eval $setvar
19096
19097
19098 : see if this is a syslog.h system
19099 set syslog.h i_syslog
19100 eval $inhdr
19101
19102
19103 : see if this is a sys/mode.h system
19104 set sys/mode.h i_sysmode
19105 eval $inhdr
19106
19107 : see if sys/resource.h has to be included
19108 set sys/resource.h i_sysresrc
19109 eval $inhdr
19110
19111 : see if sys/security.h is available
19112 set sys/security.h i_syssecrt
19113 eval $inhdr
19114
19115 : see if this is a sys/statvfs.h system
19116 set sys/statvfs.h i_sysstatvfs
19117 eval $inhdr
19118
19119 : see if this is a sys/un.h system
19120 set sys/un.h i_sysun
19121 eval $inhdr
19122
19123
19124 : see if this is a sys/utsname.h system
19125 set sys/utsname.h i_sysutsname
19126 eval $inhdr
19127
19128 : see if this is a syswait system
19129 set sys/wait.h i_syswait
19130 eval $inhdr
19131
19132 : see if this is a ustat.h system
19133 set ustat.h i_ustat
19134 eval $inhdr
19135
19136 : see if this is an utime system
19137 set utime.h i_utime
19138 eval $inhdr
19139
19140 : see if this is a values.h system
19141 set values.h i_values
19142 eval $inhdr
19143
19144 : see if this is a vfork system
19145 case "$d_vfork" in
19146 "$define")
19147         set vfork.h i_vfork
19148         eval $inhdr
19149         ;;
19150 *)
19151         i_vfork="$undef"
19152         ;;
19153 esac
19154
19155 : see if gdbm.h is available
19156 set gdbm.h t_gdbm
19157 eval $inhdr
19158 case "$t_gdbm" in
19159 $define)
19160         : see if gdbm_open exists
19161         set gdbm_open d_gdbm_open
19162         eval $inlibc
19163         case "$d_gdbm_open" in
19164         $undef)
19165                 t_gdbm="$undef"
19166                 echo "We won't be including <gdbm.h>"
19167                 ;;
19168         esac
19169         ;;
19170 esac
19171 val="$t_gdbm"
19172 set i_gdbm
19173 eval $setvar
19174
19175 echo " "
19176 echo "Looking for extensions..." >&4
19177 : If we are using the old config.sh, known_extensions may contain
19178 : old or inaccurate or duplicate values.
19179 known_extensions=''
19180 nonxs_extensions=''
19181 : We do not use find because it might not be available.
19182 : We do not just use MANIFEST because the user may have dropped
19183 : some additional extensions into the source tree and expect them
19184 : to be built.
19185
19186 : Function to recursively find available extensions, ignoring DynaLoader
19187 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
19188 find_extensions='
19189     for xxx in *; do
19190        case "$xxx" in
19191            DynaLoader|dynaload) ;;
19192            *)
19193            if $test -f $xxx/$xxx.xs; then
19194                known_extensions="$known_extensions $1$xxx";
19195            elif $test -f $xxx/Makefile.PL; then
19196                nonxs_extensions="$nonxs_extensions $1$xxx";
19197            else
19198                if $test -d $xxx -a $# -lt 10; then
19199                    set $1$xxx/ $*;
19200                    cd "$xxx";
19201                    eval $find_extensions;
19202                    cd ..;
19203                    shift;
19204                fi;
19205            fi
19206            ;;
19207        esac;
19208     done'
19209 tdir=`pwd`
19210 cd "$rsrc/ext"
19211 set X
19212 shift
19213 eval $find_extensions
19214 # Special case:  Add in threads/shared since it is not picked up by the
19215 # recursive find above (and adding in general recursive finding breaks
19216 # SDBM_File/sdbm).  A.D.  10/25/2001.
19217 known_extensions="$known_extensions threads/shared"
19218 set X $nonxs_extensions
19219 shift
19220 nonxs_extensions="$*"
19221 set X $known_extensions
19222 shift
19223 known_extensions="$*"
19224 cd "$tdir"
19225
19226 : Now see which are supported on this system.
19227 avail_ext=''
19228 for xxx in $known_extensions ; do
19229         case "$xxx" in
19230         DB_File|db_file)
19231                 case "$i_db" in
19232                 $define) avail_ext="$avail_ext $xxx" ;;
19233                 esac
19234                 ;;
19235         GDBM_File|gdbm_fil)
19236                 case "$i_gdbm" in 
19237                 $define) avail_ext="$avail_ext $xxx" ;;
19238                 esac
19239                 ;;
19240         I18N/Langinfo|i18n_lan)
19241                 case "$i_langinfo$d_nl_langinfo" in 
19242                 $define$define) avail_ext="$avail_ext $xxx" ;;
19243                 esac
19244                 ;;
19245         NDBM_File|ndbm_fil)
19246                 case "$i_ndbm" in
19247                 $define)
19248                     case "$osname-$use64bitint" in
19249                     cygwin-*|hpux-define)
19250                         case "$libs" in
19251                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
19252                         esac
19253                         ;;
19254                     *) avail_ext="$avail_ext $xxx" ;;
19255                     esac
19256                     ;;
19257                 esac
19258                 ;;
19259         ODBM_File|odbm_fil) 
19260                 case "${i_dbm}${i_rpcsvcdbm}" in
19261                 *"${define}"*)
19262                     case "$osname-$use64bitint" in
19263                     cygwin-*|hpux-define)
19264                         case "$libs" in
19265                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
19266                         esac
19267                         ;;
19268                     *) avail_ext="$avail_ext $xxx" ;;
19269                     esac
19270                     ;;
19271                 esac
19272                 ;;
19273         POSIX|posix)
19274                 case "$useposix" in
19275                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19276                 esac
19277                 ;;
19278         Opcode|opcode)
19279                 case "$useopcode" in
19280                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19281                 esac
19282                 ;;
19283         Socket|socket)
19284                 case "$d_socket" in 
19285                 true|$define|y)
19286                     case "$osname" in
19287                     beos) ;; # not unless BONE
19288                     *) avail_ext="$avail_ext $xxx" ;;
19289                     esac
19290                     ;;
19291                 esac
19292                 ;;
19293         Sys/Syslog|sys/syslog)
19294                 : XXX syslog requires socket
19295                 case "$d_socket" in 
19296                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
19297                 esac
19298                 ;;
19299         Thread|thread)
19300                 case "$usethreads" in
19301                 true|$define|y)
19302                         case "$useithreads" in
19303                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
19304                         esac
19305                 esac
19306                 ;;
19307         threads|threads/shared)
19308                 # threads and threads::shared are special cases.
19309                 # To stop people from asking "Perl 5.8.0 was supposed
19310                 # to have this new fancy threads implementation but my
19311                 # perl doesn't have it" and from people trying to
19312                 # (re)install the threads module using CPAN.pm and
19313                 # CPAN.pm then offering to reinstall Perl 5.8.0,
19314                 # the threads.pm and threads/shared.pm will always be
19315                 # there, croaking informatively ("you need to rebuild
19316                 # all of Perl with threads, sorry") when threads haven't
19317                 # been compiled in.
19318                 # --jhi
19319                 avail_ext="$avail_ext $xxx"
19320                 ;;
19321         IPC/SysV|ipc/sysv)
19322                 : XXX Do we need a useipcsysv variable here
19323                 case "${d_msg}${d_sem}${d_shm}" in 
19324                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
19325                 esac
19326                 ;;
19327         *)      avail_ext="$avail_ext $xxx"
19328                 ;;
19329         esac
19330 done
19331
19332 set X $avail_ext
19333 shift
19334 avail_ext="$*"
19335
19336 : Now see which nonxs extensions are supported on this system.
19337 : For now assume all are.
19338 nonxs_ext=''
19339 for xxx in $nonxs_extensions ; do
19340         case "$xxx" in
19341         *)      nonxs_ext="$nonxs_ext $xxx"
19342                 ;;
19343         esac
19344 done
19345
19346 set X $nonxs_ext
19347 shift
19348 nonxs_ext="$*"
19349
19350 case $usedl in
19351 $define)
19352         $cat <<EOM
19353 A number of extensions are supplied with $package.  You may choose to
19354 compile these extensions for dynamic loading (the default), compile
19355 them into the $package executable (static loading), or not include
19356 them at all.  Answer "none" to include no extensions.
19357 Note that DynaLoader is always built and need not be mentioned here.
19358
19359 EOM
19360         case "$dynamic_ext" in
19361         '') dflt="$avail_ext" ;;
19362         *)      dflt="$dynamic_ext"
19363                 # Perhaps we are reusing an old out-of-date config.sh.
19364                 case "$hint" in
19365                 previous)
19366                         if test X"$dynamic_ext" != X"$avail_ext"; then
19367                                 $cat <<EOM
19368 NOTICE:  Your previous config.sh list may be incorrect. 
19369 The extensions now available to you are 
19370         ${avail_ext}
19371 but the default list from your previous config.sh is
19372         ${dynamic_ext} 
19373
19374 EOM
19375                         fi
19376                         ;;
19377                 esac
19378                 ;;
19379         esac
19380         case "$dflt" in
19381         '')     dflt=none;;
19382         esac
19383         rp="What extensions do you wish to load dynamically?"
19384         . ./myread
19385         case "$ans" in
19386         none) dynamic_ext=' ' ;;
19387         *) dynamic_ext="$ans" ;;
19388         esac
19389
19390         case "$static_ext" in
19391         '')
19392                 : Exclude those already listed in dynamic linking
19393                 dflt=''
19394                 for xxx in $avail_ext; do
19395                         case " $dynamic_ext " in
19396                         *" $xxx "*) ;;
19397                         *) dflt="$dflt $xxx" ;;
19398                         esac
19399                 done
19400                 set X $dflt
19401                 shift
19402                 dflt="$*"
19403                 ;;
19404         *)  dflt="$static_ext" 
19405                 ;;
19406         esac
19407
19408         case "$dflt" in
19409         '')     dflt=none;;
19410         esac
19411         rp="What extensions do you wish to load statically?"
19412         . ./myread
19413         case "$ans" in
19414         none) static_ext=' ' ;;
19415         *) static_ext="$ans" ;;
19416         esac
19417         ;;
19418 *)
19419         $cat <<EOM
19420 A number of extensions are supplied with $package.  Answer "none" 
19421 to include no extensions. 
19422 Note that DynaLoader is always built and need not be mentioned here.
19423
19424 EOM
19425         case "$static_ext" in
19426         '') dflt="$avail_ext" ;;
19427         *)      dflt="$static_ext"
19428                 # Perhaps we are reusing an old out-of-date config.sh.
19429                 case "$hint" in
19430                 previous)
19431                         if test X"$static_ext" != X"$avail_ext"; then
19432                                 $cat <<EOM
19433 NOTICE:  Your previous config.sh list may be incorrect. 
19434 The extensions now available to you are 
19435         ${avail_ext}
19436 but the default list from your previous config.sh is
19437         ${static_ext} 
19438
19439 EOM
19440                         fi
19441                         ;;
19442                 esac
19443                 ;;
19444         esac
19445         : Exclude those that are not xs extensions
19446         case "$dflt" in
19447         '')     dflt=none;;
19448         esac
19449         rp="What extensions do you wish to include?"
19450         . ./myread
19451         case "$ans" in
19452         none) static_ext=' ' ;;
19453         *) static_ext="$ans" ;;
19454         esac
19455         ;;
19456 esac
19457 #        
19458 # Encode is a special case.  If we are building Encode as a static
19459 # extension, we need to explicitly list its subextensions as well.
19460 # For other nested extensions, this is handled automatically by
19461 # the appropriate Makefile.PL.
19462 case " $static_ext " in
19463         *" Encode "*) # Add the subextensions of Encode
19464         cd "$rsrc/ext"
19465         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
19466                 static_ext="$static_ext Encode/$xxx"
19467         done
19468         cd "$tdir"
19469         ;;
19470 esac
19471
19472 set X $dynamic_ext $static_ext $nonxs_ext
19473 shift
19474 extensions="$*"
19475
19476 : Remove libraries needed only for extensions
19477 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
19478 : The exception is SunOS 4.x, which needs them.
19479 case "${osname}X${osvers}" in
19480 sunos*X4*)
19481     perllibs="$libs"
19482     ;;
19483 *) case "$usedl" in
19484     $define|true|[yY]*)
19485             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
19486             shift
19487             perllibs="$*"
19488             ;;
19489     *)  perllibs="$libs"
19490             ;;
19491     esac
19492     ;;
19493 esac
19494
19495 : Remove build directory name from cppstdin so it can be used from
19496 : either the present location or the final installed location.
19497 echo " "
19498 : Get out of the UU directory to get correct path name.
19499 cd ..
19500 case "$cppstdin" in
19501 `pwd`/cppstdin)
19502         echo "Stripping down cppstdin path name"
19503         cppstdin=cppstdin
19504         ;;
19505 esac
19506 cd UU
19507
19508 : end of configuration questions
19509 echo " "
19510 echo "End of configuration questions."
19511 echo " "
19512
19513 : back to where it started
19514 if test -d ../UU; then
19515         cd ..
19516 fi
19517
19518 : configuration may be patched via a 'config.arch' file
19519 if $test -f config.arch; then
19520         echo "I see a config.arch file, loading it."
19521         . ./config.arch
19522 fi
19523
19524 : configuration may be patched via a 'config.over' file
19525 if $test -f config.over; then
19526         echo " "
19527         dflt=y
19528         rp='I see a config.over file.  Do you wish to load it?'
19529         . UU/myread
19530         case "$ans" in
19531         n*) echo "OK, I'll ignore it.";;
19532         *)      . ./config.over
19533                 echo "Configuration override changes have been loaded."
19534                 ;;
19535         esac
19536 fi
19537
19538 : in case they want portability, strip down executable paths
19539 case "$d_portable" in
19540 "$define")
19541         echo " "
19542         echo "Stripping down executable paths..." >&4
19543         for file in $loclist $trylist; do
19544                 eval temp=\$$file
19545                 eval $file=`basename $temp`
19546         done
19547         ;;
19548 esac
19549
19550 : create config.sh file
19551 echo " "
19552 echo "Creating config.sh..." >&4
19553 $spitshell <<EOT >config.sh
19554 $startsh
19555 #
19556 # This file was produced by running the Configure script. It holds all the
19557 # definitions figured out by Configure. Should you modify one of these values,
19558 # do not forget to propagate your changes by running "Configure -der". You may
19559 # instead choose to run each of the .SH files by yourself, or "Configure -S".
19560 #
19561
19562 # Package name      : $package
19563 # Source directory  : $src
19564 # Configuration time: $cf_time
19565 # Configured by     : $cf_by
19566 # Target system     : $myuname
19567
19568 Author='$Author'
19569 Date='$Date'
19570 Header='$Header'
19571 Id='$Id'
19572 Locker='$Locker'
19573 Log='$Log'
19574 Mcc='$Mcc'
19575 RCSfile='$RCSfile'
19576 Revision='$Revision'
19577 Source='$Source'
19578 State='$State'
19579 _a='$_a'
19580 _exe='$_exe'
19581 _o='$_o'
19582 afs='$afs'
19583 afsroot='$afsroot'
19584 alignbytes='$alignbytes'
19585 ansi2knr='$ansi2knr'
19586 aphostname='$aphostname'
19587 api_revision='$api_revision'
19588 api_subversion='$api_subversion'
19589 api_version='$api_version'
19590 api_versionstring='$api_versionstring'
19591 ar='$ar'
19592 archlib='$archlib'
19593 archlibexp='$archlibexp'
19594 archname64='$archname64'
19595 archname='$archname'
19596 archobjs='$archobjs'
19597 asctime_r_proto='$asctime_r_proto'
19598 awk='$awk'
19599 baserev='$baserev'
19600 bash='$bash'
19601 bin='$bin'
19602 binexp='$binexp'
19603 bison='$bison'
19604 byacc='$byacc'
19605 byteorder='$byteorder'
19606 c='$c'
19607 castflags='$castflags'
19608 cat='$cat'
19609 cc='$cc'
19610 cccdlflags='$cccdlflags'
19611 ccdlflags='$ccdlflags'
19612 ccflags='$ccflags'
19613 ccflags_uselargefiles='$ccflags_uselargefiles'
19614 ccname='$ccname'
19615 ccsymbols='$ccsymbols'
19616 ccversion='$ccversion'
19617 cf_by='$cf_by'
19618 cf_email='$cf_email'
19619 cf_time='$cf_time'
19620 charsize='$charsize'
19621 chgrp='$chgrp'
19622 chmod='$chmod'
19623 chown='$chown'
19624 clocktype='$clocktype'
19625 comm='$comm'
19626 compress='$compress'
19627 contains='$contains'
19628 cp='$cp'
19629 cpio='$cpio'
19630 cpp='$cpp'
19631 cpp_stuff='$cpp_stuff'
19632 cppccsymbols='$cppccsymbols'
19633 cppflags='$cppflags'
19634 cpplast='$cpplast'
19635 cppminus='$cppminus'
19636 cpprun='$cpprun'
19637 cppstdin='$cppstdin'
19638 cppsymbols='$cppsymbols'
19639 crypt_r_proto='$crypt_r_proto'
19640 cryptlib='$cryptlib'
19641 csh='$csh'
19642 ctermid_r_proto='$ctermid_r_proto'
19643 ctime_r_proto='$ctime_r_proto'
19644 d_Gconvert='$d_Gconvert'
19645 d_PRIEUldbl='$d_PRIEUldbl'
19646 d_PRIFUldbl='$d_PRIFUldbl'
19647 d_PRIGUldbl='$d_PRIGUldbl'
19648 d_PRIXU64='$d_PRIXU64'
19649 d_PRId64='$d_PRId64'
19650 d_PRIeldbl='$d_PRIeldbl'
19651 d_PRIfldbl='$d_PRIfldbl'
19652 d_PRIgldbl='$d_PRIgldbl'
19653 d_PRIi64='$d_PRIi64'
19654 d_PRIo64='$d_PRIo64'
19655 d_PRIu64='$d_PRIu64'
19656 d_PRIx64='$d_PRIx64'
19657 d_SCNfldbl='$d_SCNfldbl'
19658 d__fwalk='$d__fwalk'
19659 d_access='$d_access'
19660 d_accessx='$d_accessx'
19661 d_alarm='$d_alarm'
19662 d_archlib='$d_archlib'
19663 d_asctime_r='$d_asctime_r'
19664 d_atolf='$d_atolf'
19665 d_atoll='$d_atoll'
19666 d_attribut='$d_attribut'
19667 d_bcmp='$d_bcmp'
19668 d_bcopy='$d_bcopy'
19669 d_bsd='$d_bsd'
19670 d_bsdgetpgrp='$d_bsdgetpgrp'
19671 d_bsdsetpgrp='$d_bsdsetpgrp'
19672 d_bzero='$d_bzero'
19673 d_casti32='$d_casti32'
19674 d_castneg='$d_castneg'
19675 d_charvspr='$d_charvspr'
19676 d_chown='$d_chown'
19677 d_chroot='$d_chroot'
19678 d_chsize='$d_chsize'
19679 d_class='$d_class'
19680 d_closedir='$d_closedir'
19681 d_cmsghdr_s='$d_cmsghdr_s'
19682 d_const='$d_const'
19683 d_crypt='$d_crypt'
19684 d_crypt_r='$d_crypt_r'
19685 d_csh='$d_csh'
19686 d_ctermid_r='$d_ctermid_r'
19687 d_ctime_r='$d_ctime_r'
19688 d_cuserid='$d_cuserid'
19689 d_dbl_dig='$d_dbl_dig'
19690 d_dbminitproto='$d_dbminitproto'
19691 d_difftime='$d_difftime'
19692 d_dirfd='$d_dirfd'
19693 d_dirnamlen='$d_dirnamlen'
19694 d_dlerror='$d_dlerror'
19695 d_dlopen='$d_dlopen'
19696 d_dlsymun='$d_dlsymun'
19697 d_dosuid='$d_dosuid'
19698 d_drand48_r='$d_drand48_r'
19699 d_drand48proto='$d_drand48proto'
19700 d_dup2='$d_dup2'
19701 d_eaccess='$d_eaccess'
19702 d_endgrent='$d_endgrent'
19703 d_endgrent_r='$d_endgrent_r'
19704 d_endhent='$d_endhent'
19705 d_endhostent_r='$d_endhostent_r'
19706 d_endnent='$d_endnent'
19707 d_endnetent_r='$d_endnetent_r'
19708 d_endpent='$d_endpent'
19709 d_endprotoent_r='$d_endprotoent_r'
19710 d_endpwent='$d_endpwent'
19711 d_endpwent_r='$d_endpwent_r'
19712 d_endsent='$d_endsent'
19713 d_endservent_r='$d_endservent_r'
19714 d_eofnblk='$d_eofnblk'
19715 d_eunice='$d_eunice'
19716 d_fchdir='$d_fchdir'
19717 d_fchmod='$d_fchmod'
19718 d_fchown='$d_fchown'
19719 d_fcntl='$d_fcntl'
19720 d_fcntl_can_lock='$d_fcntl_can_lock'
19721 d_fd_macros='$d_fd_macros'
19722 d_fd_set='$d_fd_set'
19723 d_fds_bits='$d_fds_bits'
19724 d_fgetpos='$d_fgetpos'
19725 d_finite='$d_finite'
19726 d_finitel='$d_finitel'
19727 d_flexfnam='$d_flexfnam'
19728 d_flock='$d_flock'
19729 d_flockproto='$d_flockproto'
19730 d_fork='$d_fork'
19731 d_fp_class='$d_fp_class'
19732 d_fpathconf='$d_fpathconf'
19733 d_fpclass='$d_fpclass'
19734 d_fpclassify='$d_fpclassify'
19735 d_fpclassl='$d_fpclassl'
19736 d_fpos64_t='$d_fpos64_t'
19737 d_frexpl='$d_frexpl'
19738 d_fs_data_s='$d_fs_data_s'
19739 d_fseeko='$d_fseeko'
19740 d_fsetpos='$d_fsetpos'
19741 d_fstatfs='$d_fstatfs'
19742 d_fstatvfs='$d_fstatvfs'
19743 d_fsync='$d_fsync'
19744 d_ftello='$d_ftello'
19745 d_ftime='$d_ftime'
19746 d_getcwd='$d_getcwd'
19747 d_getespwnam='$d_getespwnam'
19748 d_getfsstat='$d_getfsstat'
19749 d_getgrent='$d_getgrent'
19750 d_getgrent_r='$d_getgrent_r'
19751 d_getgrgid_r='$d_getgrgid_r'
19752 d_getgrnam_r='$d_getgrnam_r'
19753 d_getgrps='$d_getgrps'
19754 d_gethbyaddr='$d_gethbyaddr'
19755 d_gethbyname='$d_gethbyname'
19756 d_gethent='$d_gethent'
19757 d_gethname='$d_gethname'
19758 d_gethostbyaddr_r='$d_gethostbyaddr_r'
19759 d_gethostbyname_r='$d_gethostbyname_r'
19760 d_gethostent_r='$d_gethostent_r'
19761 d_gethostprotos='$d_gethostprotos'
19762 d_getitimer='$d_getitimer'
19763 d_getlogin='$d_getlogin'
19764 d_getlogin_r='$d_getlogin_r'
19765 d_getmnt='$d_getmnt'
19766 d_getmntent='$d_getmntent'
19767 d_getnbyaddr='$d_getnbyaddr'
19768 d_getnbyname='$d_getnbyname'
19769 d_getnent='$d_getnent'
19770 d_getnetbyaddr_r='$d_getnetbyaddr_r'
19771 d_getnetbyname_r='$d_getnetbyname_r'
19772 d_getnetent_r='$d_getnetent_r'
19773 d_getnetprotos='$d_getnetprotos'
19774 d_getpagsz='$d_getpagsz'
19775 d_getpbyname='$d_getpbyname'
19776 d_getpbynumber='$d_getpbynumber'
19777 d_getpent='$d_getpent'
19778 d_getpgid='$d_getpgid'
19779 d_getpgrp2='$d_getpgrp2'
19780 d_getpgrp='$d_getpgrp'
19781 d_getppid='$d_getppid'
19782 d_getprior='$d_getprior'
19783 d_getprotobyname_r='$d_getprotobyname_r'
19784 d_getprotobynumber_r='$d_getprotobynumber_r'
19785 d_getprotoent_r='$d_getprotoent_r'
19786 d_getprotoprotos='$d_getprotoprotos'
19787 d_getprpwnam='$d_getprpwnam'
19788 d_getpwent='$d_getpwent'
19789 d_getpwent_r='$d_getpwent_r'
19790 d_getpwnam_r='$d_getpwnam_r'
19791 d_getpwuid_r='$d_getpwuid_r'
19792 d_getsbyname='$d_getsbyname'
19793 d_getsbyport='$d_getsbyport'
19794 d_getsent='$d_getsent'
19795 d_getservbyname_r='$d_getservbyname_r'
19796 d_getservbyport_r='$d_getservbyport_r'
19797 d_getservent_r='$d_getservent_r'
19798 d_getservprotos='$d_getservprotos'
19799 d_getspnam='$d_getspnam'
19800 d_getspnam_r='$d_getspnam_r'
19801 d_gettimeod='$d_gettimeod'
19802 d_gmtime_r='$d_gmtime_r'
19803 d_gnulibc='$d_gnulibc'
19804 d_grpasswd='$d_grpasswd'
19805 d_hasmntopt='$d_hasmntopt'
19806 d_htonl='$d_htonl'
19807 d_index='$d_index'
19808 d_inetaton='$d_inetaton'
19809 d_int64_t='$d_int64_t'
19810 d_isascii='$d_isascii'
19811 d_isfinite='$d_isfinite'
19812 d_isinf='$d_isinf'
19813 d_isnan='$d_isnan'
19814 d_isnanl='$d_isnanl'
19815 d_killpg='$d_killpg'
19816 d_lchown='$d_lchown'
19817 d_ldbl_dig='$d_ldbl_dig'
19818 d_link='$d_link'
19819 d_localtime_r='$d_localtime_r'
19820 d_locconv='$d_locconv'
19821 d_lockf='$d_lockf'
19822 d_longdbl='$d_longdbl'
19823 d_longlong='$d_longlong'
19824 d_lseekproto='$d_lseekproto'
19825 d_lstat='$d_lstat'
19826 d_madvise='$d_madvise'
19827 d_mblen='$d_mblen'
19828 d_mbstowcs='$d_mbstowcs'
19829 d_mbtowc='$d_mbtowc'
19830 d_memchr='$d_memchr'
19831 d_memcmp='$d_memcmp'
19832 d_memcpy='$d_memcpy'
19833 d_memmove='$d_memmove'
19834 d_memset='$d_memset'
19835 d_mkdir='$d_mkdir'
19836 d_mkdtemp='$d_mkdtemp'
19837 d_mkfifo='$d_mkfifo'
19838 d_mkstemp='$d_mkstemp'
19839 d_mkstemps='$d_mkstemps'
19840 d_mktime='$d_mktime'
19841 d_mmap='$d_mmap'
19842 d_modfl='$d_modfl'
19843 d_modfl_pow32_bug='$d_modfl_pow32_bug'
19844 d_mprotect='$d_mprotect'
19845 d_msg='$d_msg'
19846 d_msg_ctrunc='$d_msg_ctrunc'
19847 d_msg_dontroute='$d_msg_dontroute'
19848 d_msg_oob='$d_msg_oob'
19849 d_msg_peek='$d_msg_peek'
19850 d_msg_proxy='$d_msg_proxy'
19851 d_msgctl='$d_msgctl'
19852 d_msgget='$d_msgget'
19853 d_msghdr_s='$d_msghdr_s'
19854 d_msgrcv='$d_msgrcv'
19855 d_msgsnd='$d_msgsnd'
19856 d_msync='$d_msync'
19857 d_munmap='$d_munmap'
19858 d_mymalloc='$d_mymalloc'
19859 d_nice='$d_nice'
19860 d_nl_langinfo='$d_nl_langinfo'
19861 d_nv_preserves_uv='$d_nv_preserves_uv'
19862 d_off64_t='$d_off64_t'
19863 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
19864 d_oldpthreads='$d_oldpthreads'
19865 d_oldsock='$d_oldsock'
19866 d_open3='$d_open3'
19867 d_pathconf='$d_pathconf'
19868 d_pause='$d_pause'
19869 d_perl_otherlibdirs='$d_perl_otherlibdirs'
19870 d_phostname='$d_phostname'
19871 d_pipe='$d_pipe'
19872 d_poll='$d_poll'
19873 d_portable='$d_portable'
19874 d_procselfexe='$d_procselfexe'
19875 d_pthread_atfork='$d_pthread_atfork'
19876 d_pthread_yield='$d_pthread_yield'
19877 d_pwage='$d_pwage'
19878 d_pwchange='$d_pwchange'
19879 d_pwclass='$d_pwclass'
19880 d_pwcomment='$d_pwcomment'
19881 d_pwexpire='$d_pwexpire'
19882 d_pwgecos='$d_pwgecos'
19883 d_pwpasswd='$d_pwpasswd'
19884 d_pwquota='$d_pwquota'
19885 d_qgcvt='$d_qgcvt'
19886 d_quad='$d_quad'
19887 d_random_r='$d_random_r'
19888 d_readdir64_r='$d_readdir64_r'
19889 d_readdir='$d_readdir'
19890 d_readdir_r='$d_readdir_r'
19891 d_readlink='$d_readlink'
19892 d_readv='$d_readv'
19893 d_recvmsg='$d_recvmsg'
19894 d_rename='$d_rename'
19895 d_rewinddir='$d_rewinddir'
19896 d_rmdir='$d_rmdir'
19897 d_safebcpy='$d_safebcpy'
19898 d_safemcpy='$d_safemcpy'
19899 d_sanemcmp='$d_sanemcmp'
19900 d_sbrkproto='$d_sbrkproto'
19901 d_sched_yield='$d_sched_yield'
19902 d_scm_rights='$d_scm_rights'
19903 d_seekdir='$d_seekdir'
19904 d_select='$d_select'
19905 d_sem='$d_sem'
19906 d_semctl='$d_semctl'
19907 d_semctl_semid_ds='$d_semctl_semid_ds'
19908 d_semctl_semun='$d_semctl_semun'
19909 d_semget='$d_semget'
19910 d_semop='$d_semop'
19911 d_sendmsg='$d_sendmsg'
19912 d_setegid='$d_setegid'
19913 d_seteuid='$d_seteuid'
19914 d_setgrent='$d_setgrent'
19915 d_setgrent_r='$d_setgrent_r'
19916 d_setgrps='$d_setgrps'
19917 d_sethent='$d_sethent'
19918 d_sethostent_r='$d_sethostent_r'
19919 d_setitimer='$d_setitimer'
19920 d_setlinebuf='$d_setlinebuf'
19921 d_setlocale='$d_setlocale'
19922 d_setlocale_r='$d_setlocale_r'
19923 d_setnent='$d_setnent'
19924 d_setnetent_r='$d_setnetent_r'
19925 d_setpent='$d_setpent'
19926 d_setpgid='$d_setpgid'
19927 d_setpgrp2='$d_setpgrp2'
19928 d_setpgrp='$d_setpgrp'
19929 d_setprior='$d_setprior'
19930 d_setproctitle='$d_setproctitle'
19931 d_setprotoent_r='$d_setprotoent_r'
19932 d_setpwent='$d_setpwent'
19933 d_setpwent_r='$d_setpwent_r'
19934 d_setregid='$d_setregid'
19935 d_setresgid='$d_setresgid'
19936 d_setresuid='$d_setresuid'
19937 d_setreuid='$d_setreuid'
19938 d_setrgid='$d_setrgid'
19939 d_setruid='$d_setruid'
19940 d_setsent='$d_setsent'
19941 d_setservent_r='$d_setservent_r'
19942 d_setsid='$d_setsid'
19943 d_setvbuf='$d_setvbuf'
19944 d_sfio='$d_sfio'
19945 d_shm='$d_shm'
19946 d_shmat='$d_shmat'
19947 d_shmatprototype='$d_shmatprototype'
19948 d_shmctl='$d_shmctl'
19949 d_shmdt='$d_shmdt'
19950 d_shmget='$d_shmget'
19951 d_sigaction='$d_sigaction'
19952 d_sigprocmask='$d_sigprocmask'
19953 d_sigsetjmp='$d_sigsetjmp'
19954 d_sockatmark='$d_sockatmark'
19955 d_sockatmarkproto='$d_sockatmarkproto'
19956 d_socket='$d_socket'
19957 d_socklen_t='$d_socklen_t'
19958 d_sockpair='$d_sockpair'
19959 d_socks5_init='$d_socks5_init'
19960 d_sqrtl='$d_sqrtl'
19961 d_srand48_r='$d_srand48_r'
19962 d_srandom_r='$d_srandom_r'
19963 d_sresgproto='$d_sresgproto'
19964 d_sresuproto='$d_sresuproto'
19965 d_statblks='$d_statblks'
19966 d_statfs_f_flags='$d_statfs_f_flags'
19967 d_statfs_s='$d_statfs_s'
19968 d_statvfs='$d_statvfs'
19969 d_stdio_cnt_lval='$d_stdio_cnt_lval'
19970 d_stdio_ptr_lval='$d_stdio_ptr_lval'
19971 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
19972 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
19973 d_stdio_stream_array='$d_stdio_stream_array'
19974 d_stdiobase='$d_stdiobase'
19975 d_stdstdio='$d_stdstdio'
19976 d_strchr='$d_strchr'
19977 d_strcoll='$d_strcoll'
19978 d_strctcpy='$d_strctcpy'
19979 d_strerrm='$d_strerrm'
19980 d_strerror='$d_strerror'
19981 d_strerror_r='$d_strerror_r'
19982 d_strftime='$d_strftime'
19983 d_strtod='$d_strtod'
19984 d_strtol='$d_strtol'
19985 d_strtold='$d_strtold'
19986 d_strtoll='$d_strtoll'
19987 d_strtoq='$d_strtoq'
19988 d_strtoul='$d_strtoul'
19989 d_strtoull='$d_strtoull'
19990 d_strtouq='$d_strtouq'
19991 d_strxfrm='$d_strxfrm'
19992 d_suidsafe='$d_suidsafe'
19993 d_symlink='$d_symlink'
19994 d_syscall='$d_syscall'
19995 d_syscallproto='$d_syscallproto'
19996 d_sysconf='$d_sysconf'
19997 d_sysernlst='$d_sysernlst'
19998 d_syserrlst='$d_syserrlst'
19999 d_system='$d_system'
20000 d_tcgetpgrp='$d_tcgetpgrp'
20001 d_tcsetpgrp='$d_tcsetpgrp'
20002 d_telldir='$d_telldir'
20003 d_telldirproto='$d_telldirproto'
20004 d_time='$d_time'
20005 d_times='$d_times'
20006 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
20007 d_tm_tm_zone='$d_tm_tm_zone'
20008 d_tmpnam_r='$d_tmpnam_r'
20009 d_truncate='$d_truncate'
20010 d_ttyname_r='$d_ttyname_r'
20011 d_tzname='$d_tzname'
20012 d_u32align='$d_u32align'
20013 d_ualarm='$d_ualarm'
20014 d_umask='$d_umask'
20015 d_uname='$d_uname'
20016 d_union_semun='$d_union_semun'
20017 d_unordered='$d_unordered'
20018 d_usleep='$d_usleep'
20019 d_usleepproto='$d_usleepproto'
20020 d_ustat='$d_ustat'
20021 d_vendorarch='$d_vendorarch'
20022 d_vendorbin='$d_vendorbin'
20023 d_vendorlib='$d_vendorlib'
20024 d_vfork='$d_vfork'
20025 d_void_closedir='$d_void_closedir'
20026 d_voidsig='$d_voidsig'
20027 d_voidtty='$d_voidtty'
20028 d_volatile='$d_volatile'
20029 d_vprintf='$d_vprintf'
20030 d_wait4='$d_wait4'
20031 d_waitpid='$d_waitpid'
20032 d_wcstombs='$d_wcstombs'
20033 d_wctomb='$d_wctomb'
20034 d_writev='$d_writev'
20035 d_xenix='$d_xenix'
20036 date='$date'
20037 db_hashtype='$db_hashtype'
20038 db_prefixtype='$db_prefixtype'
20039 db_version_major='$db_version_major'
20040 db_version_minor='$db_version_minor'
20041 db_version_patch='$db_version_patch'
20042 defvoidused='$defvoidused'
20043 direntrytype='$direntrytype'
20044 dlext='$dlext'
20045 dlsrc='$dlsrc'
20046 doublesize='$doublesize'
20047 drand01='$drand01'
20048 drand48_r_proto='$drand48_r_proto'
20049 dynamic_ext='$dynamic_ext'
20050 eagain='$eagain'
20051 ebcdic='$ebcdic'
20052 echo='$echo'
20053 egrep='$egrep'
20054 emacs='$emacs'
20055 endgrent_r_proto='$endgrent_r_proto'
20056 endhostent_r_proto='$endhostent_r_proto'
20057 endnetent_r_proto='$endnetent_r_proto'
20058 endprotoent_r_proto='$endprotoent_r_proto'
20059 endpwent_r_proto='$endpwent_r_proto'
20060 endservent_r_proto='$endservent_r_proto'
20061 eunicefix='$eunicefix'
20062 exe_ext='$exe_ext'
20063 expr='$expr'
20064 extensions='$extensions'
20065 extras='$extras'
20066 fflushNULL='$fflushNULL'
20067 fflushall='$fflushall'
20068 find='$find'
20069 firstmakefile='$firstmakefile'
20070 flex='$flex'
20071 fpossize='$fpossize'
20072 fpostype='$fpostype'
20073 freetype='$freetype'
20074 from='$from'
20075 full_ar='$full_ar'
20076 full_csh='$full_csh'
20077 full_sed='$full_sed'
20078 gccosandvers='$gccosandvers'
20079 gccversion='$gccversion'
20080 getgrent_r_proto='$getgrent_r_proto'
20081 getgrgid_r_proto='$getgrgid_r_proto'
20082 getgrnam_r_proto='$getgrnam_r_proto'
20083 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
20084 gethostbyname_r_proto='$gethostbyname_r_proto'
20085 gethostent_r_proto='$gethostent_r_proto'
20086 getlogin_r_proto='$getlogin_r_proto'
20087 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
20088 getnetbyname_r_proto='$getnetbyname_r_proto'
20089 getnetent_r_proto='$getnetent_r_proto'
20090 getprotobyname_r_proto='$getprotobyname_r_proto'
20091 getprotobynumber_r_proto='$getprotobynumber_r_proto'
20092 getprotoent_r_proto='$getprotoent_r_proto'
20093 getpwent_r_proto='$getpwent_r_proto'
20094 getpwnam_r_proto='$getpwnam_r_proto'
20095 getpwuid_r_proto='$getpwuid_r_proto'
20096 getservbyname_r_proto='$getservbyname_r_proto'
20097 getservbyport_r_proto='$getservbyport_r_proto'
20098 getservent_r_proto='$getservent_r_proto'
20099 getspnam_r_proto='$getspnam_r_proto'
20100 gidformat='$gidformat'
20101 gidsign='$gidsign'
20102 gidsize='$gidsize'
20103 gidtype='$gidtype'
20104 glibpth='$glibpth'
20105 gmake='$gmake'
20106 gmtime_r_proto='$gmtime_r_proto'
20107 grep='$grep'
20108 groupcat='$groupcat'
20109 groupstype='$groupstype'
20110 gzip='$gzip'
20111 h_fcntl='$h_fcntl'
20112 h_sysfile='$h_sysfile'
20113 hint='$hint'
20114 hostcat='$hostcat'
20115 i16size='$i16size'
20116 i16type='$i16type'
20117 i32size='$i32size'
20118 i32type='$i32type'
20119 i64size='$i64size'
20120 i64type='$i64type'
20121 i8size='$i8size'
20122 i8type='$i8type'
20123 i_arpainet='$i_arpainet'
20124 i_bsdioctl='$i_bsdioctl'
20125 i_crypt='$i_crypt'
20126 i_db='$i_db'
20127 i_dbm='$i_dbm'
20128 i_dirent='$i_dirent'
20129 i_dld='$i_dld'
20130 i_dlfcn='$i_dlfcn'
20131 i_fcntl='$i_fcntl'
20132 i_float='$i_float'
20133 i_fp='$i_fp'
20134 i_fp_class='$i_fp_class'
20135 i_gdbm='$i_gdbm'
20136 i_grp='$i_grp'
20137 i_ieeefp='$i_ieeefp'
20138 i_inttypes='$i_inttypes'
20139 i_langinfo='$i_langinfo'
20140 i_libutil='$i_libutil'
20141 i_limits='$i_limits'
20142 i_locale='$i_locale'
20143 i_machcthr='$i_machcthr'
20144 i_malloc='$i_malloc'
20145 i_math='$i_math'
20146 i_memory='$i_memory'
20147 i_mntent='$i_mntent'
20148 i_ndbm='$i_ndbm'
20149 i_netdb='$i_netdb'
20150 i_neterrno='$i_neterrno'
20151 i_netinettcp='$i_netinettcp'
20152 i_niin='$i_niin'
20153 i_poll='$i_poll'
20154 i_prot='$i_prot'
20155 i_pthread='$i_pthread'
20156 i_pwd='$i_pwd'
20157 i_rpcsvcdbm='$i_rpcsvcdbm'
20158 i_sfio='$i_sfio'
20159 i_sgtty='$i_sgtty'
20160 i_shadow='$i_shadow'
20161 i_socks='$i_socks'
20162 i_stdarg='$i_stdarg'
20163 i_stddef='$i_stddef'
20164 i_stdlib='$i_stdlib'
20165 i_string='$i_string'
20166 i_sunmath='$i_sunmath'
20167 i_sysaccess='$i_sysaccess'
20168 i_sysdir='$i_sysdir'
20169 i_sysfile='$i_sysfile'
20170 i_sysfilio='$i_sysfilio'
20171 i_sysin='$i_sysin'
20172 i_sysioctl='$i_sysioctl'
20173 i_syslog='$i_syslog'
20174 i_sysmman='$i_sysmman'
20175 i_sysmode='$i_sysmode'
20176 i_sysmount='$i_sysmount'
20177 i_sysndir='$i_sysndir'
20178 i_sysparam='$i_sysparam'
20179 i_sysresrc='$i_sysresrc'
20180 i_syssecrt='$i_syssecrt'
20181 i_sysselct='$i_sysselct'
20182 i_syssockio='$i_syssockio'
20183 i_sysstat='$i_sysstat'
20184 i_sysstatfs='$i_sysstatfs'
20185 i_sysstatvfs='$i_sysstatvfs'
20186 i_systime='$i_systime'
20187 i_systimek='$i_systimek'
20188 i_systimes='$i_systimes'
20189 i_systypes='$i_systypes'
20190 i_sysuio='$i_sysuio'
20191 i_sysun='$i_sysun'
20192 i_sysutsname='$i_sysutsname'
20193 i_sysvfs='$i_sysvfs'
20194 i_syswait='$i_syswait'
20195 i_termio='$i_termio'
20196 i_termios='$i_termios'
20197 i_time='$i_time'
20198 i_unistd='$i_unistd'
20199 i_ustat='$i_ustat'
20200 i_utime='$i_utime'
20201 i_values='$i_values'
20202 i_varargs='$i_varargs'
20203 i_varhdr='$i_varhdr'
20204 i_vfork='$i_vfork'
20205 ignore_versioned_solibs='$ignore_versioned_solibs'
20206 inc_version_list='$inc_version_list'
20207 inc_version_list_init='$inc_version_list_init'
20208 incpath='$incpath'
20209 inews='$inews'
20210 installarchlib='$installarchlib'
20211 installbin='$installbin'
20212 installman1dir='$installman1dir'
20213 installman3dir='$installman3dir'
20214 installprefix='$installprefix'
20215 installprefixexp='$installprefixexp'
20216 installprivlib='$installprivlib'
20217 installscript='$installscript'
20218 installsitearch='$installsitearch'
20219 installsitebin='$installsitebin'
20220 installsitelib='$installsitelib'
20221 installstyle='$installstyle'
20222 installusrbinperl='$installusrbinperl'
20223 installvendorarch='$installvendorarch'
20224 installvendorbin='$installvendorbin'
20225 installvendorlib='$installvendorlib'
20226 intsize='$intsize'
20227 issymlink='$issymlink'
20228 ivdformat='$ivdformat'
20229 ivsize='$ivsize'
20230 ivtype='$ivtype'
20231 known_extensions='$known_extensions'
20232 ksh='$ksh'
20233 ld='$ld'
20234 lddlflags='$lddlflags'
20235 ldflags='$ldflags'
20236 ldflags_uselargefiles='$ldflags_uselargefiles'
20237 ldlibpthname='$ldlibpthname'
20238 less='$less'
20239 lib_ext='$lib_ext'
20240 libc='$libc'
20241 libperl='$libperl'
20242 libpth='$libpth'
20243 libs='$libs'
20244 libsdirs='$libsdirs'
20245 libsfiles='$libsfiles'
20246 libsfound='$libsfound'
20247 libspath='$libspath'
20248 libswanted='$libswanted'
20249 libswanted_uselargefiles='$libswanted_uselargefiles'
20250 line='$line'
20251 lint='$lint'
20252 lkflags='$lkflags'
20253 ln='$ln'
20254 lns='$lns'
20255 localtime_r_proto='$localtime_r_proto'
20256 locincpth='$locincpth'
20257 loclibpth='$loclibpth'
20258 longdblsize='$longdblsize'
20259 longlongsize='$longlongsize'
20260 longsize='$longsize'
20261 lp='$lp'
20262 lpr='$lpr'
20263 ls='$ls'
20264 lseeksize='$lseeksize'
20265 lseektype='$lseektype'
20266 mail='$mail'
20267 mailx='$mailx'
20268 make='$make'
20269 make_set_make='$make_set_make'
20270 mallocobj='$mallocobj'
20271 mallocsrc='$mallocsrc'
20272 malloctype='$malloctype'
20273 man1dir='$man1dir'
20274 man1direxp='$man1direxp'
20275 man1ext='$man1ext'
20276 man3dir='$man3dir'
20277 man3direxp='$man3direxp'
20278 man3ext='$man3ext'
20279 mips_type='$mips_type'
20280 mkdir='$mkdir'
20281 mmaptype='$mmaptype'
20282 modetype='$modetype'
20283 more='$more'
20284 multiarch='$multiarch'
20285 mv='$mv'
20286 myarchname='$myarchname'
20287 mydomain='$mydomain'
20288 myhostname='$myhostname'
20289 myuname='$myuname'
20290 n='$n'
20291 need_va_copy='$need_va_copy'
20292 netdb_hlen_type='$netdb_hlen_type'
20293 netdb_host_type='$netdb_host_type'
20294 netdb_name_type='$netdb_name_type'
20295 netdb_net_type='$netdb_net_type'
20296 nm='$nm'
20297 nm_opt='$nm_opt'
20298 nm_so_opt='$nm_so_opt'
20299 nonxs_ext='$nonxs_ext'
20300 nroff='$nroff'
20301 nvEUformat='$nvEUformat'
20302 nvFUformat='$nvFUformat'
20303 nvGUformat='$nvGUformat'
20304 nv_preserves_uv_bits='$nv_preserves_uv_bits'
20305 nveformat='$nveformat'
20306 nvfformat='$nvfformat'
20307 nvgformat='$nvgformat'
20308 nvsize='$nvsize'
20309 nvtype='$nvtype'
20310 o_nonblock='$o_nonblock'
20311 obj_ext='$obj_ext'
20312 old_pthread_create_joinable='$old_pthread_create_joinable'
20313 optimize='$optimize'
20314 orderlib='$orderlib'
20315 osname='$osname'
20316 osvers='$osvers'
20317 otherlibdirs='$otherlibdirs'
20318 package='$package'
20319 pager='$pager'
20320 passcat='$passcat'
20321 patchlevel='$patchlevel'
20322 path_sep='$path_sep'
20323 perl5='$perl5'
20324 perl='$perl'
20325 perl_patchlevel='$perl_patchlevel'
20326 perladmin='$perladmin'
20327 perllibs='$perllibs'
20328 perlpath='$perlpath'
20329 pg='$pg'
20330 phostname='$phostname'
20331 pidtype='$pidtype'
20332 plibpth='$plibpth'
20333 pm_apiversion='$pm_apiversion'
20334 pmake='$pmake'
20335 pr='$pr'
20336 prefix='$prefix'
20337 prefixexp='$prefixexp'
20338 privlib='$privlib'
20339 privlibexp='$privlibexp'
20340 procselfexe='$procselfexe'
20341 prototype='$prototype'
20342 ptrsize='$ptrsize'
20343 quadkind='$quadkind'
20344 quadtype='$quadtype'
20345 randbits='$randbits'
20346 randfunc='$randfunc'
20347 random_r_proto='$random_r_proto'
20348 randseedtype='$randseedtype'
20349 ranlib='$ranlib'
20350 rd_nodata='$rd_nodata'
20351 readdir64_r_proto='$readdir64_r_proto'
20352 readdir_r_proto='$readdir_r_proto'
20353 revision='$revision'
20354 rm='$rm'
20355 rmail='$rmail'
20356 run='$run'
20357 runnm='$runnm'
20358 sPRIEUldbl='$sPRIEUldbl'
20359 sPRIFUldbl='$sPRIFUldbl'
20360 sPRIGUldbl='$sPRIGUldbl'
20361 sPRIXU64='$sPRIXU64'
20362 sPRId64='$sPRId64'
20363 sPRIeldbl='$sPRIeldbl'
20364 sPRIfldbl='$sPRIfldbl'
20365 sPRIgldbl='$sPRIgldbl'
20366 sPRIi64='$sPRIi64'
20367 sPRIo64='$sPRIo64'
20368 sPRIu64='$sPRIu64'
20369 sPRIx64='$sPRIx64'
20370 sSCNfldbl='$sSCNfldbl'
20371 sched_yield='$sched_yield'
20372 scriptdir='$scriptdir'
20373 scriptdirexp='$scriptdirexp'
20374 sed='$sed'
20375 seedfunc='$seedfunc'
20376 selectminbits='$selectminbits'
20377 selecttype='$selecttype'
20378 sendmail='$sendmail'
20379 setgrent_r_proto='$setgrent_r_proto'
20380 sethostent_r_proto='$sethostent_r_proto'
20381 setlocale_r_proto='$setlocale_r_proto'
20382 setnetent_r_proto='$setnetent_r_proto'
20383 setprotoent_r_proto='$setprotoent_r_proto'
20384 setpwent_r_proto='$setpwent_r_proto'
20385 setservent_r_proto='$setservent_r_proto'
20386 sh='$sh'
20387 shar='$shar'
20388 sharpbang='$sharpbang'
20389 shmattype='$shmattype'
20390 shortsize='$shortsize'
20391 shrpenv='$shrpenv'
20392 shsharp='$shsharp'
20393 sig_count='$sig_count'
20394 sig_name='$sig_name'
20395 sig_name_init='$sig_name_init'
20396 sig_num='$sig_num'
20397 sig_num_init='$sig_num_init'
20398 sig_size='$sig_size'
20399 signal_t='$signal_t'
20400 sitearch='$sitearch'
20401 sitearchexp='$sitearchexp'
20402 sitebin='$sitebin'
20403 sitebinexp='$sitebinexp'
20404 sitelib='$sitelib'
20405 sitelib_stem='$sitelib_stem'
20406 sitelibexp='$sitelibexp'
20407 siteprefix='$siteprefix'
20408 siteprefixexp='$siteprefixexp'
20409 sizesize='$sizesize'
20410 sizetype='$sizetype'
20411 sleep='$sleep'
20412 smail='$smail'
20413 so='$so'
20414 sockethdr='$sockethdr'
20415 socketlib='$socketlib'
20416 socksizetype='$socksizetype'
20417 sort='$sort'
20418 spackage='$spackage'
20419 spitshell='$spitshell'
20420 srand48_r_proto='$srand48_r_proto'
20421 srandom_r_proto='$srandom_r_proto'
20422 src='$src'
20423 ssizetype='$ssizetype'
20424 startperl='$startperl'
20425 startsh='$startsh'
20426 static_ext='$static_ext'
20427 stdchar='$stdchar'
20428 stdio_base='$stdio_base'
20429 stdio_bufsiz='$stdio_bufsiz'
20430 stdio_cnt='$stdio_cnt'
20431 stdio_filbuf='$stdio_filbuf'
20432 stdio_ptr='$stdio_ptr'
20433 stdio_stream_array='$stdio_stream_array'
20434 strerror_r_proto='$strerror_r_proto'
20435 strings='$strings'
20436 submit='$submit'
20437 subversion='$subversion'
20438 sysman='$sysman'
20439 tail='$tail'
20440 tar='$tar'
20441 targetarch='$targetarch'
20442 tbl='$tbl'
20443 tee='$tee'
20444 test='$test'
20445 timeincl='$timeincl'
20446 timetype='$timetype'
20447 tmpnam_r_proto='$tmpnam_r_proto'
20448 to='$to'
20449 touch='$touch'
20450 tr='$tr'
20451 trnl='$trnl'
20452 troff='$troff'
20453 ttyname_r_proto='$ttyname_r_proto'
20454 u16size='$u16size'
20455 u16type='$u16type'
20456 u32size='$u32size'
20457 u32type='$u32type'
20458 u64size='$u64size'
20459 u64type='$u64type'
20460 u8size='$u8size'
20461 u8type='$u8type'
20462 uidformat='$uidformat'
20463 uidsign='$uidsign'
20464 uidsize='$uidsize'
20465 uidtype='$uidtype'
20466 uname='$uname'
20467 uniq='$uniq'
20468 uquadtype='$uquadtype'
20469 use5005threads='$use5005threads'
20470 use64bitall='$use64bitall'
20471 use64bitint='$use64bitint'
20472 usecrosscompile='$usecrosscompile'
20473 usedl='$usedl'
20474 useithreads='$useithreads'
20475 uselargefiles='$uselargefiles'
20476 uselongdouble='$uselongdouble'
20477 usemorebits='$usemorebits'
20478 usemultiplicity='$usemultiplicity'
20479 usemymalloc='$usemymalloc'
20480 usenm='$usenm'
20481 useopcode='$useopcode'
20482 useperlio='$useperlio'
20483 useposix='$useposix'
20484 usereentrant='$usereentrant'
20485 usesfio='$usesfio'
20486 useshrplib='$useshrplib'
20487 usesocks='$usesocks'
20488 usethreads='$usethreads'
20489 usevendorprefix='$usevendorprefix'
20490 usevfork='$usevfork'
20491 usrinc='$usrinc'
20492 uuname='$uuname'
20493 uvXUformat='$uvXUformat'
20494 uvoformat='$uvoformat'
20495 uvsize='$uvsize'
20496 uvtype='$uvtype'
20497 uvuformat='$uvuformat'
20498 uvxformat='$uvxformat'
20499 vendorarch='$vendorarch'
20500 vendorarchexp='$vendorarchexp'
20501 vendorbin='$vendorbin'
20502 vendorbinexp='$vendorbinexp'
20503 vendorlib='$vendorlib'
20504 vendorlib_stem='$vendorlib_stem'
20505 vendorlibexp='$vendorlibexp'
20506 vendorprefix='$vendorprefix'
20507 vendorprefixexp='$vendorprefixexp'
20508 version='$version'
20509 version_patchlevel_string='$version_patchlevel_string'
20510 versiononly='$versiononly'
20511 vi='$vi'
20512 voidflags='$voidflags'
20513 xlibpth='$xlibpth'
20514 xs_apiversion='$xs_apiversion'
20515 yacc='$yacc'
20516 yaccflags='$yaccflags'
20517 zcat='$zcat'
20518 zip='$zip'
20519 EOT
20520
20521 : Add in command line options if available
20522 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
20523
20524 : add special variables
20525 $test -f $src/patchlevel.h && \
20526 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
20527 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
20528 echo "PERL_CONFIG_SH=true" >>config.sh
20529
20530 : propagate old symbols
20531 if $test -f UU/config.sh; then
20532         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
20533         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
20534         $sort | $uniq -u >UU/oldsyms
20535         set X `cat UU/oldsyms`
20536         shift
20537         case $# in
20538         0) ;;
20539         *)
20540                 cat <<EOM
20541 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
20542 EOM
20543                 echo "# Variables propagated from previous config.sh file." >>config.sh
20544                 for sym in `cat UU/oldsyms`; do
20545                         echo "    Propagating $hint variable "'$'"$sym..."
20546                         eval 'tmp="$'"${sym}"'"'
20547                         echo "$tmp" | \
20548                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
20549                 done
20550                 ;;
20551         esac
20552 fi
20553
20554 : Finish up by extracting the .SH files
20555 case "$alldone" in
20556 exit)
20557         $rm -rf UU
20558         echo "Extraction done."
20559         exit 0
20560         ;;
20561 cont)
20562         ;;
20563 '')
20564         dflt=''
20565         nostick=true
20566         $cat <<EOM
20567
20568 If you'd like to make any changes to the config.sh file before I begin
20569 to configure things, do it as a shell escape now (e.g. !vi config.sh).
20570
20571 EOM
20572         rp="Press return or use a shell escape to edit config.sh:"
20573         . UU/myread
20574         nostick=''
20575         case "$ans" in
20576         '') ;;
20577         *) : in case they cannot read
20578                 sh 1>&4 -c "$ans";;
20579         esac
20580         ;;
20581 esac
20582
20583 : if this fails, just run all the .SH files by hand
20584 . ./config.sh
20585
20586 echo " "
20587 exec 1>&4
20588 pwd=`pwd`
20589 . ./UU/extract
20590 cd "$pwd"
20591
20592 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
20593         dflt=y
20594         case "$silent" in
20595         true) ;;
20596         *)
20597                 $cat <<EOM
20598
20599 Now you need to generate make dependencies by running "$make depend".
20600 You might prefer to run it in background: "$make depend > makedepend.out &"
20601 It can take a while, so you might not want to run it right now.
20602
20603 EOM
20604                 ;;
20605         esac
20606         rp="Run $make depend now?"
20607         . UU/myread
20608         case "$ans" in
20609         y*)
20610                 $make depend && echo "Now you must run '$make'."
20611                 ;;
20612         *)
20613                 echo "You must run '$make depend' then '$make'."
20614                 ;;
20615         esac
20616 elif test -f [Mm]akefile; then
20617         echo " "
20618         echo "Now you must run a $make."
20619 else
20620         echo "Configure done."
20621 fi
20622
20623 if $test -f Policy.sh; then
20624     $cat <<EOM
20625
20626 If you compile $package on a different machine or from a different object
20627 directory, copy the Policy.sh file from this object directory to the
20628 new one before you run Configure -- this will help you with most of
20629 the policy defaults.
20630
20631 EOM
20632 fi
20633 if $test -f config.msg; then
20634     echo "Hmm.  I also noted the following information while running:"
20635     echo " "
20636     $cat config.msg >&4
20637     $rm -f config.msg
20638 fi
20639 $rm -f kit*isdone ark*isdone
20640 $rm -rf UU
20641
20642 : End of Configure
20643