I like doubleclicking on URLs in pods to select them.
[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 Sun Mar 24 23:35:42 EET 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 bincompat5005=''
305 d_bincompat5005=''
306 byteorder=''
307 cc=''
308 ccflags=''
309 cppflags=''
310 ldflags=''
311 lkflags=''
312 locincpth=''
313 optimize=''
314 cf_email=''
315 cf_by=''
316 cf_time=''
317 charsize=''
318 contains=''
319 cpp_stuff=''
320 cpplast=''
321 cppminus=''
322 cpprun=''
323 cppstdin=''
324 d__fwalk=''
325 d_access=''
326 d_accessx=''
327 d_alarm=''
328 asctime_r_proto=''
329 d_asctime_r=''
330 d_attribut=''
331 d_bcmp=''
332 d_bcopy=''
333 d_bzero=''
334 d_casti32=''
335 castflags=''
336 d_castneg=''
337 d_chown=''
338 d_chroot=''
339 d_chsize=''
340 d_class=''
341 d_closedir=''
342 d_void_closedir=''
343 d_cmsghdr_s=''
344 d_const=''
345 cryptlib=''
346 d_crypt=''
347 crypt_r_proto=''
348 d_crypt_r=''
349 d_csh=''
350 full_csh=''
351 ctermid_r_proto=''
352 d_ctermid_r=''
353 ctime_r_proto=''
354 d_ctime_r=''
355 d_cuserid=''
356 d_dbl_dig=''
357 d_dbminitproto=''
358 d_difftime=''
359 d_dirfd=''
360 d_dlerror=''
361 d_dlopen=''
362 d_dlsymun=''
363 d_dosuid=''
364 d_suidsafe=''
365 d_drand48_r=''
366 drand48_r_proto=''
367 d_drand48proto=''
368 d_dup2=''
369 d_eaccess=''
370 d_endgrent=''
371 d_endgrent_r=''
372 endgrent_r_proto=''
373 d_endhent=''
374 d_endhostent_r=''
375 endhostent_r_proto=''
376 d_endnent=''
377 d_endnetent_r=''
378 endnetent_r_proto=''
379 d_endpent=''
380 d_endprotoent_r=''
381 endprotoent_r_proto=''
382 d_endpwent=''
383 d_endpwent_r=''
384 endpwent_r_proto=''
385 d_endsent=''
386 d_endservent_r=''
387 endservent_r_proto=''
388 d_fchdir=''
389 d_fchmod=''
390 d_fchown=''
391 d_fcntl=''
392 d_fcntl_can_lock=''
393 d_fd_macros=''
394 d_fd_set=''
395 d_fds_bits=''
396 d_fgetpos=''
397 d_finite=''
398 d_finitel=''
399 d_flexfnam=''
400 d_flock=''
401 d_flockproto=''
402 d_fork=''
403 d_fp_class=''
404 d_fpclass=''
405 d_fpclassify=''
406 d_fpclassl=''
407 d_fpos64_t=''
408 d_frexpl=''
409 d_fs_data_s=''
410 d_fseeko=''
411 d_fsetpos=''
412 d_fstatfs=''
413 d_fsync=''
414 d_ftello=''
415 d_ftime=''
416 d_gettimeod=''
417 d_Gconvert=''
418 d_getcwd=''
419 d_getespwnam=''
420 d_getfsstat=''
421 d_getgrent=''
422 d_getgrent_r=''
423 getgrent_r_proto=''
424 d_getgrgid_r=''
425 getgrgid_r_proto=''
426 d_getgrnam_r=''
427 getgrnam_r_proto=''
428 d_getgrps=''
429 d_gethbyaddr=''
430 d_gethbyname=''
431 d_gethent=''
432 aphostname=''
433 d_gethname=''
434 d_phostname=''
435 d_uname=''
436 d_gethostbyaddr_r=''
437 gethostbyaddr_r_proto=''
438 d_gethostbyname_r=''
439 gethostbyname_r_proto=''
440 d_gethostent_r=''
441 gethostent_r_proto=''
442 d_gethostprotos=''
443 d_getitimer=''
444 d_getlogin=''
445 d_getlogin_r=''
446 getlogin_r_proto=''
447 d_getmnt=''
448 d_getmntent=''
449 d_getnbyaddr=''
450 d_getnbyname=''
451 d_getnent=''
452 d_getnetbyaddr_r=''
453 getnetbyaddr_r_proto=''
454 d_getnetbyname_r=''
455 getnetbyname_r_proto=''
456 d_getnetent_r=''
457 getnetent_r_proto=''
458 d_getnetprotos=''
459 d_getpagsz=''
460 d_getpent=''
461 d_getpgid=''
462 d_getpgrp2=''
463 d_bsdgetpgrp=''
464 d_getpgrp=''
465 d_getppid=''
466 d_getprior=''
467 d_getpbyname=''
468 d_getpbynumber=''
469 d_getprotobyname_r=''
470 getprotobyname_r_proto=''
471 d_getprotobynumber_r=''
472 getprotobynumber_r_proto=''
473 d_getprotoent_r=''
474 getprotoent_r_proto=''
475 d_getprotoprotos=''
476 d_getprpwnam=''
477 d_getpwent=''
478 d_getpwent_r=''
479 getpwent_r_proto=''
480 d_getpwnam_r=''
481 getpwnam_r_proto=''
482 d_getpwuid_r=''
483 getpwuid_r_proto=''
484 d_getsent=''
485 d_getservbyname_r=''
486 getservbyname_r_proto=''
487 d_getservbyport_r=''
488 getservbyport_r_proto=''
489 d_getservent_r=''
490 getservent_r_proto=''
491 d_getservprotos=''
492 d_getspnam=''
493 d_getspnam_r=''
494 getspnam_r_proto=''
495 d_getsbyname=''
496 d_getsbyport=''
497 d_gmtime_r=''
498 gmtime_r_proto=''
499 d_gnulibc=''
500 d_hasmntopt=''
501 d_htonl=''
502 d_inetaton=''
503 d_int64_t=''
504 d_isascii=''
505 d_isfinite=''
506 d_isinf=''
507 d_isnan=''
508 d_isnanl=''
509 d_killpg=''
510 d_lchown=''
511 d_ldbl_dig=''
512 d_link=''
513 d_localtime_r=''
514 localtime_r_proto=''
515 d_locconv=''
516 d_lockf=''
517 d_longdbl=''
518 longdblsize=''
519 d_longlong=''
520 longlongsize=''
521 d_lseekproto=''
522 d_lstat=''
523 d_madvise=''
524 d_mblen=''
525 d_mbstowcs=''
526 d_mbtowc=''
527 d_memchr=''
528 d_memcmp=''
529 d_memcpy=''
530 d_memmove=''
531 d_memset=''
532 d_mkdir=''
533 d_mkdtemp=''
534 d_mkfifo=''
535 d_mkstemp=''
536 d_mkstemps=''
537 d_mktime=''
538 d_mmap=''
539 mmaptype=''
540 d_modfl=''
541 d_modfl_pow32_bug=''
542 d_mprotect=''
543 d_msg=''
544 d_msgctl=''
545 d_msgget=''
546 d_msghdr_s=''
547 d_msgrcv=''
548 d_msgsnd=''
549 d_msync=''
550 d_munmap=''
551 d_nice=''
552 d_nl_langinfo=''
553 d_off64_t=''
554 d_open3=''
555 d_fpathconf=''
556 d_pathconf=''
557 d_pause=''
558 d_pipe=''
559 d_poll=''
560 d_portable=''
561 d_procselfexe=''
562 procselfexe=''
563 d_old_pthread_create_joinable=''
564 old_pthread_create_joinable=''
565 d_pthread_atfork=''
566 d_pthread_yield=''
567 d_sched_yield=''
568 sched_yield=''
569 d_qgcvt=''
570 d_random_r=''
571 random_r_proto=''
572 d_readdir64_r=''
573 readdir64_r_proto=''
574 d_readdir=''
575 d_rewinddir=''
576 d_seekdir=''
577 d_telldir=''
578 d_readdir_r=''
579 readdir_r_proto=''
580 d_readlink=''
581 d_readv=''
582 d_recvmsg=''
583 d_rename=''
584 d_rmdir=''
585 d_safebcpy=''
586 d_safemcpy=''
587 d_sanemcmp=''
588 d_sbrkproto=''
589 d_select=''
590 d_sem=''
591 d_semctl=''
592 d_semget=''
593 d_semop=''
594 d_sendmsg=''
595 d_setegid=''
596 d_seteuid=''
597 d_setgrent=''
598 d_setgrent_r=''
599 setgrent_r_proto=''
600 d_setgrps=''
601 d_sethent=''
602 d_sethostent_r=''
603 sethostent_r_proto=''
604 d_setitimer=''
605 d_setlinebuf=''
606 d_setlocale=''
607 d_setlocale_r=''
608 setlocale_r_proto=''
609 d_setnent=''
610 d_setnetent_r=''
611 setnetent_r_proto=''
612 d_setpent=''
613 d_setpgid=''
614 d_setpgrp2=''
615 d_bsdsetpgrp=''
616 d_setpgrp=''
617 d_setprior=''
618 d_setproctitle=''
619 d_setprotoent_r=''
620 setprotoent_r_proto=''
621 d_setpwent=''
622 d_setpwent_r=''
623 setpwent_r_proto=''
624 d_setregid=''
625 d_setresgid=''
626 d_setresuid=''
627 d_setreuid=''
628 d_setrgid=''
629 d_setruid=''
630 d_setsent=''
631 d_setservent_r=''
632 setservent_r_proto=''
633 d_setsid=''
634 d_setvbuf=''
635 d_sfio=''
636 usesfio=''
637 d_shm=''
638 d_shmat=''
639 d_shmatprototype=''
640 shmattype=''
641 d_shmctl=''
642 d_shmdt=''
643 d_shmget=''
644 d_sigaction=''
645 d_sigprocmask=''
646 d_sigsetjmp=''
647 d_sockatmark=''
648 d_sockatmarkproto=''
649 d_msg_ctrunc=''
650 d_msg_dontroute=''
651 d_msg_oob=''
652 d_msg_peek=''
653 d_msg_proxy=''
654 d_oldsock=''
655 d_scm_rights=''
656 d_socket=''
657 d_sockpair=''
658 sockethdr=''
659 socketlib=''
660 d_socklen_t=''
661 d_socks5_init=''
662 d_sqrtl=''
663 d_srand48_r=''
664 srand48_r_proto=''
665 d_srandom_r=''
666 srandom_r_proto=''
667 d_sresgproto=''
668 d_sresuproto=''
669 d_statblks=''
670 d_statfs_f_flags=''
671 d_statfs_s=''
672 d_fstatvfs=''
673 d_statvfs=''
674 d_stdio_cnt_lval=''
675 d_stdio_ptr_lval=''
676 d_stdio_ptr_lval_nochange_cnt=''
677 d_stdio_ptr_lval_sets_cnt=''
678 d_stdiobase=''
679 d_stdstdio=''
680 stdio_base=''
681 stdio_bufsiz=''
682 stdio_cnt=''
683 stdio_filbuf=''
684 stdio_ptr=''
685 d_index=''
686 d_strchr=''
687 d_strcoll=''
688 d_strctcpy=''
689 d_strerrm=''
690 d_strerror=''
691 d_sysernlst=''
692 d_syserrlst=''
693 d_strerror_r=''
694 strerror_r_proto=''
695 d_strftime=''
696 d_strtod=''
697 d_strtol=''
698 d_strtold=''
699 d_strtoll=''
700 d_strtoq=''
701 d_strtoul=''
702 d_strtoull=''
703 d_strtouq=''
704 d_strxfrm=''
705 d_symlink=''
706 d_syscall=''
707 d_syscallproto=''
708 d_sysconf=''
709 d_system=''
710 d_tcgetpgrp=''
711 d_tcsetpgrp=''
712 d_telldirproto=''
713 d_time=''
714 timetype=''
715 clocktype=''
716 d_times=''
717 d_tmpnam_r=''
718 tmpnam_r_proto=''
719 d_truncate=''
720 d_ttyname_r=''
721 ttyname_r_proto=''
722 d_tzname=''
723 d_u32align=''
724 d_ualarm=''
725 d_umask=''
726 d_semctl_semid_ds=''
727 d_semctl_semun=''
728 d_union_semun=''
729 d_unordered=''
730 d_usleep=''
731 d_usleepproto=''
732 d_ustat=''
733 d_vfork=''
734 usevfork=''
735 d_voidsig=''
736 signal_t=''
737 d_volatile=''
738 d_charvspr=''
739 d_vprintf=''
740 d_wait4=''
741 d_waitpid=''
742 d_wcstombs=''
743 d_wctomb=''
744 d_writev=''
745 dlext=''
746 cccdlflags=''
747 ccdlflags=''
748 dlsrc=''
749 ld=''
750 lddlflags=''
751 usedl=''
752 doublesize=''
753 ebcdic=''
754 fflushNULL=''
755 fflushall=''
756 fpossize=''
757 fpostype=''
758 gccosandvers=''
759 gccversion=''
760 gidformat=''
761 gidsign=''
762 gidsize=''
763 gidtype=''
764 groupstype=''
765 h_fcntl=''
766 h_sysfile=''
767 i_arpainet=''
768 i_crypt=''
769 db_hashtype=''
770 db_prefixtype=''
771 db_version_major=''
772 db_version_minor=''
773 db_version_patch=''
774 i_db=''
775 i_dbm=''
776 i_rpcsvcdbm=''
777 d_dirnamlen=''
778 direntrytype=''
779 i_dirent=''
780 i_dld=''
781 i_dlfcn=''
782 i_fcntl=''
783 i_float=''
784 i_fp=''
785 i_fp_class=''
786 i_gdbm=''
787 d_grpasswd=''
788 i_grp=''
789 i_ieeefp=''
790 i_inttypes=''
791 i_langinfo=''
792 i_libutil=''
793 i_limits=''
794 i_locale=''
795 i_machcthr=''
796 i_malloc=''
797 i_math=''
798 i_memory=''
799 i_mntent=''
800 i_ndbm=''
801 i_netdb=''
802 i_neterrno=''
803 i_netinettcp=''
804 i_niin=''
805 i_sysin=''
806 i_poll=''
807 i_prot=''
808 i_pthread=''
809 d_pwage=''
810 d_pwchange=''
811 d_pwclass=''
812 d_pwcomment=''
813 d_pwexpire=''
814 d_pwgecos=''
815 d_pwpasswd=''
816 d_pwquota=''
817 i_pwd=''
818 i_sfio=''
819 i_shadow=''
820 i_socks=''
821 i_stddef=''
822 i_stdlib=''
823 i_string=''
824 strings=''
825 i_sunmath=''
826 i_sysaccess=''
827 i_sysdir=''
828 i_sysfile=''
829 d_voidtty=''
830 i_bsdioctl=''
831 i_sysfilio=''
832 i_sysioctl=''
833 i_syssockio=''
834 i_syslog=''
835 i_sysmman=''
836 i_sysmode=''
837 i_sysmount=''
838 i_sysndir=''
839 i_sysparam=''
840 i_sysresrc=''
841 i_syssecrt=''
842 i_sysselct=''
843 i_sysstat=''
844 i_sysstatfs=''
845 i_sysstatvfs=''
846 i_systimes=''
847 i_systypes=''
848 i_sysuio=''
849 i_sysun=''
850 i_sysutsname=''
851 i_sysvfs=''
852 i_syswait=''
853 i_sgtty=''
854 i_termio=''
855 i_termios=''
856 d_tm_tm_gmtoff=''
857 d_tm_tm_zone=''
858 i_systime=''
859 i_systimek=''
860 i_time=''
861 timeincl=''
862 i_unistd=''
863 i_ustat=''
864 i_utime=''
865 i_values=''
866 i_stdarg=''
867 i_varargs=''
868 i_varhdr=''
869 i_vfork=''
870 inc_version_list=''
871 inc_version_list_init=''
872 installprefix=''
873 installprefixexp=''
874 installstyle=''
875 installusrbinperl=''
876 intsize=''
877 longsize=''
878 shortsize=''
879 issymlink=''
880 libc=''
881 ldlibpthname=''
882 libperl=''
883 shrpenv=''
884 useshrplib=''
885 glibpth=''
886 libpth=''
887 loclibpth=''
888 plibpth=''
889 xlibpth=''
890 ignore_versioned_solibs=''
891 libs=''
892 libsdirs=''
893 libsfiles=''
894 libsfound=''
895 libspath=''
896 lns=''
897 d_PRIEUldbl=''
898 d_PRIFUldbl=''
899 d_PRIGUldbl=''
900 d_PRIeldbl=''
901 d_PRIfldbl=''
902 d_PRIgldbl=''
903 d_SCNfldbl=''
904 sPRIEUldbl=''
905 sPRIFUldbl=''
906 sPRIGUldbl=''
907 sPRIeldbl=''
908 sPRIfldbl=''
909 sPRIgldbl=''
910 sSCNfldbl=''
911 lseeksize=''
912 lseektype=''
913 make_set_make=''
914 d_mymalloc=''
915 freetype=''
916 mallocobj=''
917 mallocsrc=''
918 malloctype=''
919 usemymalloc=''
920 installman1dir=''
921 man1dir=''
922 man1direxp=''
923 man1ext=''
924 installman3dir=''
925 man3dir=''
926 man3direxp=''
927 man3ext=''
928 modetype=''
929 multiarch=''
930 mydomain=''
931 myhostname=''
932 phostname=''
933 c=''
934 n=''
935 d_eofnblk=''
936 eagain=''
937 o_nonblock=''
938 rd_nodata=''
939 need_va_copy=''
940 netdb_hlen_type=''
941 netdb_host_type=''
942 netdb_name_type=''
943 netdb_net_type=''
944 groupcat=''
945 hostcat=''
946 passcat=''
947 orderlib=''
948 ranlib=''
949 d_perl_otherlibdirs=''
950 otherlibdirs=''
951 package=''
952 spackage=''
953 pager=''
954 api_revision=''
955 api_subversion=''
956 api_version=''
957 api_versionstring=''
958 patchlevel=''
959 perl_patchlevel=''
960 revision=''
961 subversion=''
962 version=''
963 version_patchlevel_string=''
964 perl5=''
965 perladmin=''
966 perlpath=''
967 d_nv_preserves_uv=''
968 i16size=''
969 i16type=''
970 i32size=''
971 i32type=''
972 i64size=''
973 i64type=''
974 i8size=''
975 i8type=''
976 ivsize=''
977 ivtype=''
978 nv_preserves_uv_bits=''
979 nvsize=''
980 nvtype=''
981 u16size=''
982 u16type=''
983 u32size=''
984 u32type=''
985 u64size=''
986 u64type=''
987 u8size=''
988 u8type=''
989 uvsize=''
990 uvtype=''
991 ivdformat=''
992 nvEUformat=''
993 nvFUformat=''
994 nvGUformat=''
995 nveformat=''
996 nvfformat=''
997 nvgformat=''
998 uvXUformat=''
999 uvoformat=''
1000 uvuformat=''
1001 uvxformat=''
1002 pidtype=''
1003 prefix=''
1004 prefixexp=''
1005 installprivlib=''
1006 privlib=''
1007 privlibexp=''
1008 prototype=''
1009 ptrsize=''
1010 d_PRIXU64=''
1011 d_PRId64=''
1012 d_PRIi64=''
1013 d_PRIo64=''
1014 d_PRIu64=''
1015 d_PRIx64=''
1016 sPRIXU64=''
1017 sPRId64=''
1018 sPRIi64=''
1019 sPRIo64=''
1020 sPRIu64=''
1021 sPRIx64=''
1022 d_quad=''
1023 quadkind=''
1024 quadtype=''
1025 uquadtype=''
1026 drand01=''
1027 randbits=''
1028 randfunc=''
1029 randseedtype=''
1030 seedfunc=''
1031 installscript=''
1032 scriptdir=''
1033 scriptdirexp=''
1034 selectminbits=''
1035 selecttype=''
1036 sh=''
1037 sig_count=''
1038 sig_name=''
1039 sig_name_init=''
1040 sig_num=''
1041 sig_num_init=''
1042 sig_size=''
1043 installsitearch=''
1044 sitearch=''
1045 sitearchexp=''
1046 installsitebin=''
1047 sitebin=''
1048 sitebinexp=''
1049 installsitelib=''
1050 sitelib=''
1051 sitelib_stem=''
1052 sitelibexp=''
1053 siteprefix=''
1054 siteprefixexp=''
1055 sizesize=''
1056 sizetype=''
1057 so=''
1058 socksizetype=''
1059 sharpbang=''
1060 shsharp=''
1061 spitshell=''
1062 src=''
1063 ssizetype=''
1064 startperl=''
1065 startsh=''
1066 stdchar=''
1067 d_stdio_stream_array=''
1068 stdio_stream_array=''
1069 sysman=''
1070 trnl=''
1071 uidformat=''
1072 uidsign=''
1073 uidsize=''
1074 uidtype=''
1075 archname64=''
1076 use64bitall=''
1077 use64bitint=''
1078 ccflags_uselargefiles=''
1079 ldflags_uselargefiles=''
1080 libswanted_uselargefiles=''
1081 uselargefiles=''
1082 uselongdouble=''
1083 usemorebits=''
1084 usemultiplicity=''
1085 nm_opt=''
1086 nm_so_opt=''
1087 runnm=''
1088 usenm=''
1089 useperlio=''
1090 usesocks=''
1091 d_oldpthreads=''
1092 use5005threads=''
1093 useithreads=''
1094 usereentrant=''
1095 usethreads=''
1096 incpath=''
1097 mips_type=''
1098 usrinc=''
1099 d_vendorarch=''
1100 installvendorarch=''
1101 vendorarch=''
1102 vendorarchexp=''
1103 d_vendorbin=''
1104 installvendorbin=''
1105 vendorbin=''
1106 vendorbinexp=''
1107 d_vendorlib=''
1108 installvendorlib=''
1109 vendorlib=''
1110 vendorlib_stem=''
1111 vendorlibexp=''
1112 usevendorprefix=''
1113 vendorprefix=''
1114 vendorprefixexp=''
1115 versiononly=''
1116 defvoidused=''
1117 voidflags=''
1118 pm_apiversion=''
1119 xs_apiversion=''
1120 yacc=''
1121 yaccflags=''
1122 CONFIG=''
1123
1124 define='define'
1125 undef='undef'
1126 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1127 rmlist=''
1128
1129 : We must find out about Eunice early
1130 eunicefix=':'
1131 if test -f /etc/unixtovms; then
1132         eunicefix=/etc/unixtovms
1133 fi
1134 if test -f /etc/unixtovms.exe; then
1135         eunicefix=/etc/unixtovms.exe
1136 fi
1137
1138 : Set executable suffix now -- needed before hints available
1139 if test -f "/libs/version.library"; then
1140 : Amiga OS
1141     _exe=""
1142 elif test -f "/system/gnu_library/bin/ar.pm"; then
1143 : Stratus VOS
1144     _exe=".pm"
1145 elif test -n "$DJGPP"; then
1146 : DOS DJGPP
1147     _exe=".exe"
1148 elif test -d c:/. ; then
1149 : OS/2 or cygwin
1150     _exe=".exe"
1151 fi
1152
1153 i_whoami=''
1154 ccname=''
1155 ccversion=''
1156 perllibs=''
1157 : set useposix=false in your hint file to disable the POSIX extension.
1158 useposix=true
1159 : set useopcode=false in your hint file to disable the Opcode extension.
1160 useopcode=true
1161 : Trailing extension.  Override this in a hint file, if needed.
1162 : Extra object files, if any, needed on this platform.
1163 archobjs=''
1164 archname=''
1165 : Possible local include directories to search.
1166 : Set locincpth to "" in a hint file to defeat local include searches.
1167 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1168 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1169 :
1170 : no include file wanted by default
1171 inclwanted=''
1172
1173 groupstype=''
1174 libnames=''
1175 : change the next line if compiling for Xenix/286 on Xenix/386
1176 xlibpth='/usr/lib/386 /lib/386'
1177 : Possible local library directories to search.
1178 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1179 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1180
1181 : general looking path for locating libraries
1182 glibpth="/lib /usr/lib $xlibpth"
1183 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1184 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1185 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1186
1187 : Private path used by Configure to find libraries.  Its value
1188 : is prepended to libpth. This variable takes care of special
1189 : machines, like the mips.  Usually, it should be empty.
1190 plibpth=''
1191
1192 : default library list
1193 libswanted=''
1194 : some systems want to use only the non-versioned libso:s
1195 ignore_versioned_solibs=''
1196 archname64=''
1197 ccflags_uselargefiles=''
1198 ldflags_uselargefiles=''
1199 libswanted_uselargefiles=''
1200 : set usemultiplicity on the Configure command line to enable multiplicity.
1201 : set usesocks on the Configure command line to enable socks.
1202 : set usethreads on the Configure command line to enable threads.
1203 usereentrant='undef'
1204 : full support for void wanted by default
1205 defvoidused=15
1206
1207 : List of libraries we want.
1208 : If anyone needs -lnet, put it in a hint file.
1209 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1210 libswanted="$libswanted dld ld sun m c cposix posix"
1211 libswanted="$libswanted ndir dir crypt sec"
1212 libswanted="$libswanted ucb bsd BSD PW x util"
1213 : We probably want to search /usr/shlib before most other libraries.
1214 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1215 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1216 glibpth="/usr/shlib $glibpth"
1217 : Do not use vfork unless overridden by a hint file.
1218 usevfork=false
1219
1220 : Find the basic shell for Bourne shell scripts
1221 case "$sh" in
1222 '')
1223         case "$SYSTYPE" in
1224         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1225         *) xxx='/bin/sh';;
1226         esac
1227         if test -f "$xxx"; then
1228                 sh="$xxx"
1229         else
1230                 : Build up a list and do a single loop so we can 'break' out.
1231                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1232                 for xxx in sh bash ksh pdksh ash; do
1233                         for p in $pth; do
1234                                 try="$try ${p}/${xxx}"
1235                         done
1236                 done
1237                 for xxx in $try; do
1238                         if test -f "$xxx"; then
1239                                 sh="$xxx";
1240                                 break
1241                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1242                                 sh="$xxx";
1243                                 break
1244                         elif test -f "$xxx.exe"; then
1245                                 sh="$xxx";
1246                                 break
1247                         fi
1248                 done
1249         fi
1250         ;;
1251 esac
1252
1253 case "$sh" in
1254 '')     cat >&2 <<EOM
1255 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1256
1257 Usually it's in /bin/sh.  How did you even get this far?
1258 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1259 we'll try to straighten this all out.
1260 EOM
1261         exit 1
1262         ;;
1263 esac
1264
1265 : see if sh knows # comments
1266 if `$sh -c '#' >/dev/null 2>&1`; then
1267         shsharp=true
1268         spitshell=cat
1269         xcat=/bin/cat
1270         test -f $xcat$_exe || xcat=/usr/bin/cat
1271         if test ! -f $xcat$_exe; then
1272                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1273                         if test -f $p/cat$_exe; then
1274                                 xcat=$p/cat
1275                                 break
1276                         fi
1277                 done
1278                 if test ! -f $xcat$_exe; then
1279                         echo "Can't find cat anywhere!"
1280                         exit 1
1281                 fi
1282         fi
1283         echo "#!$xcat" >sharp
1284         $eunicefix sharp
1285         chmod +x sharp
1286         ./sharp > today
1287         if test -s today; then
1288                 sharpbang='#!'
1289         else
1290                 echo "#! $xcat" > sharp
1291                 $eunicefix sharp
1292                 chmod +x sharp
1293                 ./sharp > today
1294                 if test -s today; then
1295                         sharpbang='#! '
1296                 else
1297                         sharpbang=': use '
1298                 fi
1299         fi
1300 else
1301         echo " "
1302         echo "Your $sh doesn't grok # comments--I will strip them later on."
1303         shsharp=false
1304         cd ..
1305         echo "exec grep -v '^[  ]*#'" >spitshell
1306         chmod +x spitshell
1307         $eunicefix spitshell
1308         spitshell=`pwd`/spitshell
1309         cd UU
1310         echo "I presume that if # doesn't work, #! won't work either!"
1311         sharpbang=': use '
1312 fi
1313 rm -f sharp today
1314
1315 : figure out how to guarantee sh startup
1316 case "$startsh" in
1317 '') startsh=${sharpbang}${sh} ;;
1318 *)
1319 esac
1320 cat >sharp <<EOSS
1321 $startsh
1322 set abc
1323 test "$?abc" != 1
1324 EOSS
1325
1326 chmod +x sharp
1327 $eunicefix sharp
1328 if ./sharp; then
1329         : echo "Yup, it does."
1330 else
1331         echo "Hmm... '$startsh' does not guarantee sh startup..."
1332         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1333 fi
1334 rm -f sharp
1335
1336
1337 : Save command line options in file UU/cmdline.opt for later use in
1338 : generating config.sh.
1339 cat > cmdline.opt <<EOSH
1340 # Configure command line arguments.
1341 config_arg0='$0'
1342 config_args='$*'
1343 config_argc=$#
1344 EOSH
1345 argn=1
1346 args_exp=''
1347 args_sep=''
1348 for arg in "$@"; do
1349         cat >>cmdline.opt <<EOSH
1350 config_arg$argn='$arg'
1351 EOSH
1352         # Extreme backslashitis: replace each ' by '"'"'
1353         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1354 $arg
1355 EOC
1356         arg_exp=`cat cmdl.opt`
1357         args_exp="$args_exp$args_sep'$arg_exp'"
1358         argn=`expr $argn + 1`
1359         args_sep=' '
1360 done
1361 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1362 # used by ./hints/os2.sh
1363 rm -f cmdl.opt
1364
1365 : produce awk script to parse command line options
1366 cat >options.awk <<'EOF'
1367 BEGIN {
1368         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1369
1370         len = length(optstr);
1371         for (i = 1; i <= len; i++) {
1372                 c = substr(optstr, i, 1);
1373                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1374                 if (a == ":") {
1375                         arg[c] = 1;
1376                         i++;
1377                 }
1378                 opt[c] = 1;
1379         }
1380 }
1381 {
1382         expect = 0;
1383         str = $0;
1384         if (substr(str, 1, 1) != "-") {
1385                 printf("'%s'\n", str);
1386                 next;
1387         }
1388         len = length($0);
1389         for (i = 2; i <= len; i++) {
1390                 c = substr(str, i, 1);
1391                 if (!opt[c]) {
1392                         printf("-%s\n", substr(str, i));
1393                         next;
1394                 }
1395                 printf("-%s\n", c);
1396                 if (arg[c]) {
1397                         if (i < len)
1398                                 printf("'%s'\n", substr(str, i + 1));
1399                         else
1400                                 expect = 1;
1401                         next;
1402                 }
1403         }
1404 }
1405 END {
1406         if (expect)
1407                 print "?";
1408 }
1409 EOF
1410
1411 : process the command line options
1412 set X `for arg in "$@"; do echo "X$arg"; done |
1413         sed -e s/X// | awk -f options.awk`
1414 eval "set $*"
1415 shift
1416 rm -f options.awk
1417
1418 : set up default values
1419 fastread=''
1420 reuseval=false
1421 config_sh=''
1422 alldone=''
1423 error=''
1424 silent=''
1425 extractsh=''
1426 override=''
1427 knowitall=''
1428 rm -f optdef.sh posthint.sh
1429 cat >optdef.sh <<EOS
1430 $startsh
1431 EOS
1432
1433
1434 : option parsing
1435 while test $# -gt 0; do
1436         case "$1" in
1437         -d) shift; fastread=yes;;
1438         -e) shift; alldone=cont;;
1439         -f)
1440                 shift
1441                 cd ..
1442                 if test -r "$1"; then
1443                         config_sh="$1"
1444                 else
1445                         echo "$me: cannot read config file $1." >&2
1446                         error=true
1447                 fi
1448                 cd UU
1449                 shift;;
1450         -h) shift; error=true;;
1451         -r) shift; reuseval=true;;
1452         -s) shift; silent=true; realsilent=true;;
1453         -E) shift; alldone=exit;;
1454         -K) shift; knowitall=true;;
1455         -O) shift; override=true;;
1456         -S) shift; silent=true; extractsh=true;;
1457         -D)
1458                 shift
1459                 case "$1" in
1460                 *=)
1461                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1462                         echo "$me: ignoring -D $1" >&2
1463                         ;;
1464                 *=*) echo "$1" | \
1465                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1466                 *) echo "$1='define'" >> optdef.sh;;
1467                 esac
1468                 shift
1469                 ;;
1470         -U)
1471                 shift
1472                 case "$1" in
1473                 *=) echo "$1" >> optdef.sh;;
1474                 *=*)
1475                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1476                         echo "$me: ignoring -U $1" >&2
1477                         ;;
1478                 *) echo "$1='undef'" >> optdef.sh;;
1479                 esac
1480                 shift
1481                 ;;
1482         -A)
1483             shift
1484             xxx=''
1485             yyy="$1"
1486             zzz=''
1487             uuu=undef
1488             case "$yyy" in
1489             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1490                  case "$zzz" in
1491                  *:*) zzz='' ;;
1492                  *)   xxx=append
1493                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1494                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1495                  esac
1496                  ;;
1497             esac
1498             case "$xxx" in
1499             '')  case "$yyy" in
1500                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1501                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1502                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1503                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1504                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1505                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1506                  esac
1507                  ;;       
1508             esac
1509             case "$xxx" in
1510             append)
1511                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1512             clear)
1513                 echo "$yyy=''"                  >> posthint.sh ;;
1514             define)
1515                 case "$zzz" in
1516                 '') zzz=define ;;
1517                 esac
1518                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1519             eval)
1520                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1521             prepend)
1522                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1523             undef)
1524                 case "$zzz" in
1525                 '') zzz="$uuu" ;;
1526                 esac
1527                 echo "$yyy=$zzz"                >> posthint.sh ;;
1528             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1529             esac
1530             shift
1531             ;;
1532         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1533             exit 0;;
1534         --) break;;
1535         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1536         *) break;;
1537         esac
1538 done
1539
1540 case "$error" in
1541 true)
1542         cat >&2 <<EOM
1543 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1544                  [-U symbol] [-U symbol=] [-A command:symbol...]
1545   -d : use defaults for all answers.
1546   -e : go on without questioning past the production of config.sh.
1547   -f : specify an alternate default configuration file.
1548   -h : print this help message and exit (with an error status).
1549   -r : reuse C symbols value if possible (skips costly nm extraction).
1550   -s : silent mode, only echoes questions and essential information.
1551   -D : define symbol to have some value:
1552          -D symbol         symbol gets the value 'define'
1553          -D symbol=value   symbol gets the value 'value'
1554   -E : stop at the end of questions, after having produced config.sh.
1555   -K : do not use unless you know what you are doing.
1556   -O : let -D and -U override definitions from loaded configuration file.
1557   -S : perform variable substitutions on all .SH files (can mix with -f)
1558   -U : undefine symbol:
1559          -U symbol    symbol gets the value 'undef'
1560          -U symbol=   symbol gets completely empty
1561   -A : manipulate symbol after the platform specific hints have been applied:
1562          -A symbol=value                append " "value to symbol
1563          -A append:symbol=value         append value to symbol
1564          -A define:symbol=value         define symbol to have value
1565          -A clear:symbol                define symbol to be ''
1566          -A define:symbol               define symbol to be 'define'
1567          -A eval:symbol=value           define symbol to be eval of value
1568          -A prepend:symbol=value        prepend value to symbol
1569          -A undef:symbol                define symbol to be 'undef'
1570          -A undef:symbol=               define symbol to be ''
1571   -V : print version number and exit (with a zero status).
1572 EOM
1573         exit 1
1574         ;;
1575 esac
1576
1577 : Sanity checks
1578 case "$fastread$alldone" in
1579 yescont|yesexit) ;;
1580 *)
1581         case "$extractsh" in
1582         true) ;;
1583         *)
1584                 if test ! -t 0; then
1585                         echo "Say 'sh Configure', not 'sh <Configure'"
1586                         exit 1
1587                 fi
1588                 ;;
1589         esac
1590         ;;
1591 esac
1592
1593 exec 4>&1
1594 case "$silent" in
1595 true) exec 1>/dev/null;;
1596 esac
1597
1598 : run the defines and the undefines, if any, but leave the file out there...
1599 touch optdef.sh
1600 . ./optdef.sh
1601 : create the posthint manipulation script and leave the file out there...
1602 touch posthint.sh
1603
1604 : set package name
1605 package=perl5
1606 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1607 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1608 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1609 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1610 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1611 esac
1612
1613 : Some greps do not return status, grrr.
1614 echo "grimblepritz" >grimble
1615 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1616         contains=contains
1617 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1618         contains=grep
1619 else
1620         contains=contains
1621 fi
1622 rm -f grimble
1623 : the following should work in any shell
1624 case "$contains" in
1625 contains*)
1626         echo " "
1627         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1628         cat >contains <<'EOSS'
1629 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1630 EOSS
1631 chmod +x contains
1632 esac
1633
1634 : Find the path to the source tree
1635 case "$src" in
1636 '') case "$0" in
1637     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1638          case "$src" in
1639          /*)    ;;
1640          .)     ;;
1641          *)     src=`cd ../$src && pwd` ;;
1642          esac
1643          ;;
1644     *)   src='.';;
1645     esac;;
1646 esac
1647 case "$src" in
1648 '')     src=/
1649         rsrc=/
1650         ;;
1651 /*) rsrc="$src";;
1652 *) rsrc="../$src";;
1653 esac
1654 if test -f $rsrc/Configure && \
1655         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1656 then
1657    : found it, so we are ok.
1658 else
1659         rsrc=''
1660         for src in . .. ../.. ../../.. ../../../..; do
1661                 if test -f ../$src/Configure && \
1662                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1663                 then
1664                         rsrc=../$src
1665                         break
1666                 fi
1667         done
1668 fi
1669 case "$rsrc" in
1670 '')
1671         cat <<EOM >&4
1672
1673 Sorry, I can't seem to locate the source dir for $package.  Please start
1674 Configure with an explicit path -- i.e. /some/path/Configure.
1675
1676 EOM
1677         exit 1
1678         ;;
1679 ../.)   rsrc='..';;
1680 *)
1681         echo " "
1682         echo "Sources for $package found in \"$src\"." >&4
1683         ;;
1684 esac
1685
1686 : script used to extract .SH files with variable substitutions
1687 cat >extract <<'EOS'
1688 PERL_CONFIG_SH=true
1689 echo "Doing variable substitutions on .SH files..."
1690 if test -f MANIFEST; then
1691         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1692 else
1693         echo "(Looking for .SH files under the source directory.)"
1694         set x `(cd "$src"; find . -name "*.SH" -print)`
1695 fi
1696 shift
1697 case $# in
1698 0) set x `(cd "$src"; echo *.SH)`; shift;;
1699 esac
1700 if test ! -f "$src/$1"; then
1701         shift
1702 fi
1703 mkdir_p='
1704 name=$1;
1705 create="";
1706 while test $name; do
1707         if test ! -d "$name"; then
1708                 create="$name $create";
1709                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1710                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1711         else
1712                 name="";
1713         fi;
1714 done;
1715 for file in $create; do
1716         mkdir $file;
1717 done
1718 '
1719 for file in $*; do
1720         case "$src" in
1721         ".")
1722                 case "$file" in
1723                 */*)
1724                         dir=`expr X$file : 'X\(.*\)/'`
1725                         file=`expr X$file : 'X.*/\(.*\)'`
1726                         (cd "$dir" && . ./$file)
1727                         ;;
1728                 *)
1729                         . ./$file
1730                         ;;
1731                 esac
1732                 ;;
1733         *)
1734                 case "$file" in
1735                 */*)
1736                         dir=`expr X$file : 'X\(.*\)/'`
1737                         file=`expr X$file : 'X.*/\(.*\)'`
1738                         (set x $dir; shift; eval $mkdir_p)
1739                         sh <"$src/$dir/$file"
1740                         ;;
1741                 *)
1742                         sh <"$src/$file"
1743                         ;;
1744                 esac
1745                 ;;
1746         esac
1747 done
1748 if test -f "$src/config_h.SH"; then
1749         if test ! -f config.h; then
1750         : oops, they left it out of MANIFEST, probably, so do it anyway.
1751         . "$src/config_h.SH"
1752         fi
1753 fi
1754 EOS
1755
1756 : extract files and exit if asked to do so
1757 case "$extractsh" in
1758 true)
1759         case "$realsilent" in
1760         true) ;;
1761         *) exec 1>&4;;
1762         esac
1763         case "$config_sh" in
1764         '') config_sh='config.sh';;
1765         esac
1766         echo " "
1767         echo "Fetching answers from $config_sh..."
1768         cd ..
1769         . $config_sh
1770         test "$override" && . ./optdef.sh
1771         echo " "
1772         . UU/extract
1773         rm -rf UU
1774         echo "Extraction done."
1775         exit 0
1776         ;;
1777 esac
1778
1779 : Eunice requires " " instead of "", can you believe it
1780 echo " "
1781 : Here we go...
1782 echo "Beginning of configuration questions for $package."
1783
1784 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1785
1786 : first determine how to suppress newline on echo command
1787 echo " "
1788 echo "Checking echo to see how to suppress newlines..."
1789 (echo "hi there\c" ; echo " ") >.echotmp
1790 if $contains c .echotmp >/dev/null 2>&1 ; then
1791         echo "...using -n."
1792         n='-n'
1793         c=''
1794 else
1795         cat <<'EOM'
1796 ...using \c
1797 EOM
1798         n=''
1799         c='\c'
1800 fi
1801 echo $n "The star should be here-->$c"
1802 echo '*'
1803 rm -f .echotmp
1804
1805 : Now test for existence of everything in MANIFEST
1806 echo " "
1807 if test -f "$rsrc/MANIFEST"; then
1808         echo "First let's make sure your kit is complete.  Checking..." >&4
1809         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1810         rm -f missing
1811         tmppwd=`pwd`
1812         for filelist in x??; do
1813                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1814         done
1815         if test -s missing; then
1816                 cat missing >&4
1817                 cat >&4 <<'EOM'
1818
1819 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1820
1821 You have the option of continuing the configuration process, despite the
1822 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1823 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1824 and contact the author (perlbug@perl.org).
1825
1826 EOM
1827                 echo $n "Continue? [n] $c" >&4
1828                 read ans
1829                 case "$ans" in
1830                 y*)
1831                         echo "Continuing..." >&4
1832                         rm -f missing
1833                         ;;
1834                 *)
1835                         echo "ABORTING..." >&4
1836                         kill $$
1837                         ;;
1838                 esac
1839         else
1840                 echo "Looks good..."
1841         fi
1842 else
1843         echo "There is no MANIFEST file.  I hope your kit is complete !"
1844 fi
1845 rm -f missing x??
1846
1847 echo " "
1848 : Find the appropriate value for a newline for tr
1849 if test -n "$DJGPP"; then
1850        trnl='\012'
1851 fi
1852 if test X"$trnl" = X; then
1853         case "`echo foo|tr '\n' x 2>/dev/null`" in
1854         foox) trnl='\n' ;;
1855         esac
1856 fi
1857 if test X"$trnl" = X; then
1858         case "`echo foo|tr '\012' x 2>/dev/null`" in
1859         foox) trnl='\012' ;;
1860         esac
1861 fi
1862 if test X"$trnl" = X; then
1863         cat <<EOM >&2
1864
1865 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1866
1867 EOM
1868         exit 1
1869 fi
1870
1871 : compute the number of columns on the terminal for proper question formatting
1872 case "$COLUMNS" in
1873 '') COLUMNS='80';;
1874 esac
1875
1876 : set up the echo used in my read
1877 myecho="case \"\$xxxm\" in
1878 '') echo $n \"\$rp $c\" >&4;;
1879 *) case \"\$rp\" in
1880         '') echo $n \"[\$xxxm] $c\";;
1881         *)
1882                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1883                         echo \"\$rp\" >&4
1884                         echo $n \"[\$xxxm] $c\" >&4
1885                 else
1886                         echo $n \"\$rp [\$xxxm] $c\" >&4
1887                 fi
1888                 ;;
1889         esac;;
1890 esac"
1891
1892 : now set up to do reads with possible shell escape and default assignment
1893 cat <<EOSC >myread
1894 $startsh
1895 xxxm=\$dflt
1896 $myecho
1897 ans='!'
1898 case "\$fastread" in
1899 yes) case "\$dflt" in
1900         '') ;;
1901         *) ans='';
1902                 case "\$silent-\$rp" in
1903                 true-) ;;
1904                 *) echo " " >&4;;
1905                 esac;;
1906         esac;;
1907 *) case "\$silent" in
1908         true) case "\$rp" in
1909                 '') ans='';;
1910                 esac;;
1911         esac;;
1912 esac
1913 while expr "X\$ans" : "X!" >/dev/null; do
1914         read answ
1915         set x \$xxxm
1916         shift
1917         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1918         case  "\$answ" in
1919         "!")
1920                 sh 1>&4
1921                 echo " "
1922                 $myecho
1923                 ;;
1924         !*)
1925                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1926                 shift
1927                 sh 1>&4 -c "\$*"
1928                 echo " "
1929                 $myecho
1930                 ;;
1931         "\$ans")
1932                 case "\$ans" in
1933                 \\&*)
1934                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1935                         shift
1936                         case "\$1" in
1937                         -d)
1938                                 fastread=yes
1939                                 echo "(OK, I'll run with -d after this question.)" >&4
1940                                 ;;
1941                         -*)
1942                                 echo "*** Sorry, \$1 not supported yet." >&4
1943                                 ;;
1944                         esac
1945                         $myecho
1946                         ans=!
1947                         ;;
1948                 esac;;
1949         *)
1950                 case "\$aok" in
1951                 y)
1952                         echo "*** Substitution done -- please confirm."
1953                         xxxm="\$ans"
1954                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1955                         xxxm="\$ans"
1956                         ans=!
1957                         ;;
1958                 *)
1959                         echo "*** Error -- try again."
1960                         ans=!
1961                         ;;
1962                 esac
1963                 $myecho
1964                 ;;
1965         esac
1966         case "\$ans\$xxxm\$nostick" in
1967         '')
1968                 ans=!
1969                 $myecho
1970                 ;;
1971         esac
1972 done
1973 case "\$ans" in
1974 '') ans="\$xxxm";;
1975 esac
1976 EOSC
1977
1978 : create .config dir to save info across Configure sessions
1979 test -d ../.config || mkdir ../.config
1980 cat >../.config/README <<EOF
1981 This directory created by Configure to save information that should
1982 persist across sessions for $package.
1983
1984 You may safely delete it if you wish.
1985 EOF
1986
1987 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1988 case "$usedevel" in
1989 $define|true|[yY]*) ;;
1990 *) case "$xversion" in
1991    *[13579])
1992         cat >&4 <<EOH
1993 *** WHOA THERE!!! ***
1994
1995     This is an UNSTABLE DEVELOPMENT release.
1996     The version of this $package distribution is $xversion, that is, odd,
1997     (as opposed to even) and that signifies a development release.
1998     If you want a maintenance release, you want an even-numbered version.
1999
2000     Do ***NOT*** install this into production use.
2001     Data corruption and crashes are possible.
2002
2003     It is most seriously suggested that you do not continue any further
2004     unless you want to help in developing and debugging Perl.
2005
2006     If you *still* want to build perl, you can answer 'y' now,
2007     or pass -Dusedevel to Configure.
2008
2009 EOH
2010         rp='Do you really want to continue?'
2011         dflt='n'
2012         . ./myread
2013         case "$ans" in
2014         [yY]) echo >&4 "Okay, continuing."
2015               usedevel="$define" ;;
2016         *) echo >&4 "Okay, bye."
2017            exit 1
2018            ;;
2019         esac
2020         ;;
2021     esac
2022     ;;
2023 esac
2024 case "$usedevel" in
2025 $define|true|[yY]*)
2026         case "$versiononly" in
2027         '') versiononly="$define" ;;
2028         esac
2029         case "$installusrbinperl" in
2030         '') installusrbinperl="$undef" ;;
2031         esac
2032         ;;
2033 esac
2034
2035 : general instructions
2036 needman=true
2037 firsttime=true
2038 user=`(logname) 2>/dev/null`
2039 case "$user" in
2040 '') user=`whoami 2>&1`;;
2041 esac
2042 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2043         firsttime=false
2044         echo " "
2045         rp='Would you like to see the instructions?'
2046         dflt=n
2047         . ./myread
2048         case "$ans" in
2049         [yY]*) ;;
2050         *) needman=false;;
2051         esac
2052 fi
2053 if $needman; then
2054         cat <<EOH
2055
2056 This installation shell script will examine your system and ask you questions
2057 to determine how the perl5 package should be installed. If you get
2058 stuck on a question, you may use a ! shell escape to start a subshell or
2059 execute a command.  Many of the questions will have default answers in square
2060 brackets; typing carriage return will give you the default.
2061
2062 On some of the questions which ask for file or directory names you are allowed
2063 to use the ~name construct to specify the login directory belonging to "name",
2064 even if you don't have a shell which knows about that.  Questions where this is
2065 allowed will be marked "(~name ok)".
2066
2067 EOH
2068         rp=''
2069         dflt='Type carriage return to continue'
2070         . ./myread
2071         cat <<'EOH'
2072
2073 The prompter used in this script allows you to use shell variables and
2074 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2075 in the default answer, as if the default line was a set of arguments given to a
2076 script shell.  This means you may also use $* to repeat the whole default line,
2077 so you do not have to re-type everything to add something to the default.
2078
2079 Everytime there is a substitution, you will have to confirm.  If there is an
2080 error (e.g. an unmatched backtick), the default answer will remain unchanged
2081 and you will be prompted again.
2082
2083 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2084 the questions and use the computed defaults (or the previous answers if there
2085 was already a config.sh file). Type 'Configure -h' for a list of options.
2086 You may also start interactively and then answer '& -d' at any prompt to turn
2087 on the non-interactive behaviour for the remainder of the execution.
2088
2089 EOH
2090         . ./myread
2091         cat <<EOH
2092
2093 Much effort has been expended to ensure that this shell script will run on any
2094 Unix system.  If despite that it blows up on yours, your best bet is to edit
2095 Configure and run it again.  If you can't run Configure for some reason,
2096 you'll have to generate a config.sh file by hand.  Whatever problems you
2097 have, let me (perlbug@perl.org) know how I blew it.
2098
2099 This installation script affects things in two ways:
2100
2101 1) it may do direct variable substitutions on some of the files included
2102    in this kit.
2103 2) it builds a config.h file for inclusion in C programs.  You may edit
2104    any of these files as the need arises after running this script.
2105
2106 If you make a mistake on a question, there is no easy way to back up to it
2107 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2108 files.  Configure will offer to let you do this before it runs the SH files.
2109
2110 EOH
2111         dflt='Type carriage return to continue'
2112         . ./myread
2113         case "$firsttime" in
2114         true) echo $user >>../.config/instruct;;
2115         esac
2116 fi
2117
2118 : find out where common programs are
2119 echo " "
2120 echo "Locating common programs..." >&4
2121 cat <<EOSC >loc
2122 $startsh
2123 case \$# in
2124 0) exit 1;;
2125 esac
2126 thing=\$1
2127 shift
2128 dflt=\$1
2129 shift
2130 for dir in \$*; do
2131         case "\$thing" in
2132         .)
2133         if test -d \$dir/\$thing; then
2134                 echo \$dir
2135                 exit 0
2136         fi
2137         ;;
2138         *)
2139         for thisthing in \$dir/\$thing; do
2140                 : just loop through to pick last item
2141         done
2142         if test -f \$thisthing; then
2143                 echo \$thisthing
2144                 exit 0
2145         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2146                 echo \$thisthing
2147                 exit 0
2148         elif test -f \$dir/\$thing.exe; then
2149                 if test -n "$DJGPP"; then
2150                         echo \$dir/\$thing.exe
2151                 else
2152                         : on Eunice apparently
2153                         echo \$dir/\$thing
2154                 fi
2155                 exit 0
2156         fi
2157         ;;
2158         esac
2159 done
2160 echo \$dflt
2161 exit 1
2162 EOSC
2163 chmod +x loc
2164 $eunicefix loc
2165 loclist="
2166 awk
2167 cat
2168 chmod
2169 comm
2170 cp
2171 echo
2172 expr
2173 grep
2174 ls
2175 mkdir
2176 rm
2177 sed
2178 sort
2179 touch
2180 tr
2181 uniq
2182 "
2183 trylist="
2184 Mcc
2185 ar
2186 bison
2187 byacc
2188 cpp
2189 csh
2190 date
2191 egrep
2192 gmake
2193 gzip
2194 less
2195 ln
2196 make
2197 more
2198 nm
2199 nroff
2200 pg
2201 test
2202 uname
2203 zip
2204 "
2205 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2206 pth="$pth /lib /usr/lib"
2207 for file in $loclist; do
2208         eval xxx=\$$file
2209         case "$xxx" in
2210         /*|?:[\\/]*)
2211                 if test -f "$xxx"; then
2212                         : ok
2213                 else
2214                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2215                         xxx=`./loc $file $file $pth`
2216                 fi
2217                 ;;
2218         '') xxx=`./loc $file $file $pth`;;
2219         *) xxx=`./loc $xxx $xxx $pth`;;
2220         esac
2221         eval $file=$xxx$_exe
2222         eval _$file=$xxx
2223         case "$xxx" in
2224         /*)
2225                 echo $file is in $xxx.
2226                 ;;
2227         ?:[\\/]*)
2228                 echo $file is in $xxx.
2229                 ;;
2230         *)
2231                 echo "I don't know where '$file' is, and my life depends on it." >&4
2232                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2233                 exit 1
2234                 ;;
2235         esac
2236 done
2237 echo " "
2238 echo "Don't worry if any of the following aren't found..."
2239 say=offhand
2240 for file in $trylist; do
2241         eval xxx=\$$file
2242         case "$xxx" in
2243         /*|?:[\\/]*)
2244                 if test -f "$xxx"; then
2245                         : ok
2246                 else
2247                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2248                         xxx=`./loc $file $file $pth`
2249                 fi
2250                 ;;
2251         '') xxx=`./loc $file $file $pth`;;
2252         *) xxx=`./loc $xxx $xxx $pth`;;
2253         esac
2254         eval $file=$xxx$_exe
2255         eval _$file=$xxx
2256         case "$xxx" in
2257         /*)
2258                 echo $file is in $xxx.
2259                 ;;
2260         ?:[\\/]*)
2261                 echo $file is in $xxx.
2262                 ;;
2263         *)
2264                 echo "I don't see $file out there, $say."
2265                 say=either
2266                 ;;
2267         esac
2268 done
2269 case "$egrep" in
2270 egrep)
2271         echo "Substituting grep for egrep."
2272         egrep=$grep
2273         _egrep=$grep
2274         ;;
2275 esac
2276 case "$ln" in
2277 ln)
2278         echo "Substituting cp for ln."
2279         ln=$cp
2280         _ln=$cp
2281         ;;
2282 esac
2283 case "$make" in
2284 make)   
2285         case "$gmake" in
2286         gmake)
2287         echo "I can't find make or gmake, and my life depends on it." >&4
2288         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2289         exit 1
2290         ;;
2291         esac
2292         ;;
2293 esac    
2294 case "$gmake" in
2295 gmake)  ;;
2296 *)      # We can't have osname yet.
2297         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2298                 # Assume that gmake, if found, is definitely GNU make
2299                 # and prefer it over the system make.
2300                 echo "Substituting gmake for make."
2301                 make=$gmake
2302                 _make=$gmake
2303         fi
2304         ;;
2305 esac
2306 case "$test" in
2307 test)
2308         echo "Hopefully test is built into your sh."
2309         ;;
2310 *)
2311         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2312                 echo "Using the test built into your sh."
2313                 test=test
2314                 _test=test
2315         fi
2316         ;;
2317 esac
2318 case "$echo" in
2319 echo)
2320         echo "Hopefully echo is built into your sh."
2321         ;;
2322 '') ;;
2323 *)
2324         echo " "
2325 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2326         $echo $n "hi there$c" >foo1
2327         echo $n "hi there$c" >foo2
2328         if cmp foo1 foo2 >/dev/null 2>&1; then
2329                 echo "They are compatible.  In fact, they may be identical."
2330         else
2331                 case "$n" in
2332                 '-n') n='' c='\c';;
2333                 *) n='-n' c='';;
2334                 esac
2335                 cat <<FOO
2336 They are not compatible!  You are probably running ksh on a non-USG system.
2337 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2338 have echo built in and we may have to run some Bourne shell scripts.  That
2339 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2340
2341 FOO
2342                 $echo $n "The star should be here-->$c"
2343                 $echo "*"
2344         fi
2345         $rm -f foo1 foo2
2346         ;;
2347 esac
2348
2349 cat <<EOS >trygcc
2350 $startsh
2351 EOS
2352 cat <<'EOSC' >>trygcc
2353 case "$cc" in
2354 '') ;;
2355 *)  $rm -f try try.*
2356     $cat >try.c <<EOM
2357 int main(int argc, char *argv[]) {
2358   return 0;
2359 }
2360 EOM
2361     if $cc -o try $ccflags $ldflags try.c; then
2362        :
2363     else
2364         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2365         despair=yes
2366         trygcc=yes
2367         case "$cc" in
2368         *gcc*) trygcc=no ;;
2369         esac
2370         case "`$cc -v -c try.c 2>&1`" in
2371         *gcc*) trygcc=no ;;
2372         esac
2373         if $test X"$trygcc" = Xyes; then
2374             if gcc -o try -c try.c; then
2375                 echo " "
2376                 echo "You seem to have a working gcc, though." >&4
2377                 rp="Would you like to use it?"
2378                 dflt=y
2379                 if $test -f myread; then
2380                     . ./myread
2381                 else
2382                     if $test -f UU/myread; then
2383                         . ./UU/myread
2384                     else
2385                         echo "Cannot find myread, sorry.  Aborting." >&2
2386                         exit 1
2387                     fi
2388                 fi  
2389                 case "$ans" in
2390                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2391                        if $test -f usethreads.cbu; then
2392                            $cat >&4 <<EOM 
2393
2394 *** However, any setting of the C compiler flags (e.g. for thread support)
2395 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2396 *** (together with e.g. -Dusethreads).
2397
2398 EOM
2399                        fi;;
2400                 esac
2401             fi
2402         fi
2403     fi
2404     $rm -f try try.*
2405     ;;
2406 esac
2407 EOSC
2408
2409 cat <<EOS >checkcc
2410 $startsh
2411 EOS
2412 cat <<'EOSC' >>checkcc
2413 case "$cc" in        
2414 '') ;;
2415 *)  $rm -f try try.*              
2416     $cat >try.c <<EOM
2417 int main(int argc, char *argv[]) {
2418   return 0;
2419 }
2420 EOM
2421     if $cc -o try $ccflags $ldflags try.c; then
2422        :
2423     else
2424         if $test X"$despair" = Xyes; then
2425            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2426         fi
2427         $cat >&4 <<EOM         
2428 You need to find a working C compiler.
2429 Either (purchase and) install the C compiler supplied by your OS vendor,
2430 or for a free C compiler try http://gcc.gnu.org/
2431 I cannot continue any further, aborting.
2432 EOM
2433         exit 1
2434     fi
2435     $rm -f try try.*
2436     ;;
2437 esac
2438 EOSC
2439
2440 : determine whether symbolic links are supported
2441 echo " "
2442 $touch blurfl
2443 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2444         echo "Symbolic links are supported." >&4
2445         lns="$ln -s"
2446 else
2447         echo "Symbolic links are NOT supported." >&4
2448         lns="$ln"
2449 fi
2450 $rm -f blurfl sym
2451
2452 : determine whether symbolic links are supported
2453 echo " "
2454 case "$lns" in
2455 *"ln"*" -s")
2456         echo "Checking how to test for symbolic links..." >&4
2457         $lns blurfl sym
2458         if $test "X$issymlink" = X; then
2459                 case "$newsh" in
2460                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2461                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2462                 esac
2463                 if test $? = 0; then
2464                         issymlink="test -h"
2465                 else
2466                         echo "Your builtin 'test -h' may be broken." >&4
2467                         case "$test" in
2468                         /*)     ;;
2469                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2470                                 for p in $pth
2471                                 do
2472                                         if test -f "$p/$test"; then
2473                                                 test="$p/$test"
2474                                                 break
2475                                         fi
2476                                 done
2477                                 ;;
2478                         esac
2479                         case "$test" in
2480                         /*)
2481                                 echo "Trying external '$test -h'." >&4
2482                                 issymlink="$test -h"
2483                                 if $test ! -h sym >/dev/null 2>&1; then
2484                                         echo "External '$test -h' is broken, too." >&4
2485                                         issymlink=''
2486                                 fi
2487                                 ;;
2488                         *)      issymlink='' ;;
2489                         esac
2490                 fi              
2491         fi
2492         if $test "X$issymlink" = X; then
2493                 if $test -L sym 2>/dev/null; then
2494                         issymlink="$test -L"
2495                         echo "The builtin '$test -L' worked." >&4
2496                 fi
2497         fi
2498         if $test "X$issymlink" != X; then
2499                 echo "You can test for symbolic links with '$issymlink'." >&4
2500         else
2501                 echo "I do not know how you can test for symbolic links." >&4
2502         fi
2503         $rm -f blurfl sym
2504         ;;
2505 *)      echo "No symbolic links, so not testing for their testing..." >&4
2506         ;;
2507 esac
2508 echo " "
2509
2510
2511 case "$mksymlinks" in
2512 $define|true|[yY]*)
2513         case "$src" in
2514         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2515                 exit 1
2516                 ;;
2517         *)      case "$lns:$issymlink" in
2518                 *"ln"*" -s:"*"test -"?)
2519                         echo "Creating the symbolic links..." >&4
2520                         echo "(First creating the subdirectories...)" >&4
2521                         cd ..
2522                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2523                                 read directory
2524                                 test -z "$directory" && break
2525                                 mkdir -p $directory
2526                         done
2527                         # Sanity check 1.
2528                         if test ! -d t/base; then
2529                                 echo "Failed to create the subdirectories.  Aborting." >&4
2530                                 exit 1
2531                         fi
2532                         echo "(Then creating the symlinks...)" >&4
2533                         awk '{print $1}' $src/MANIFEST | while true; do
2534                                 read filename
2535                                 test -z "$filename" && break
2536                                 if test -f $filename; then
2537                                         if $issymlink $filename; then
2538                                                 rm -f $filename
2539                                         fi
2540                                 fi
2541                                 if test -f $filename; then
2542                                         echo "$filename already exists, not symlinking."
2543                                 else
2544                                         ln -s $src/$filename $filename
2545                                 fi
2546                         done
2547                         # Sanity check 2.
2548                         if test ! -f t/base/lex.t; then
2549                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2550                                 exit 1
2551                         fi
2552                         cd UU
2553                         ;;
2554                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2555                         ;;
2556                 esac
2557                 ;;
2558         esac
2559         ;;
2560 esac
2561
2562
2563 case "$usecrosscompile" in
2564 $define|true|[yY]*)
2565         $echo "Cross-compiling..."
2566         croak=''
2567         case "$cc" in
2568         *-*-gcc) # A cross-compiling gcc, probably.
2569             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2570             ar=$targetarch-ar
2571             # leave out ld, choosing it is more complex
2572             nm=$targetarch-nm
2573             ranlib=$targetarch-ranlib
2574             $echo 'extern int foo;' > try.c
2575             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2576             shift
2577             if $test $# -gt 0; then
2578                 incpth="$incpth $*"
2579                 incpth="`$echo $incpth|$sed 's/^ //'`"
2580                 echo "Guessing incpth '$incpth'." >&4
2581                 for i in $*; do
2582                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2583                     if $test -d $j; then
2584                         libpth="$libpth $j"
2585                     fi
2586                 done   
2587                 libpth="`$echo $libpth|$sed 's/^ //'`"
2588                 echo "Guessing libpth '$libpth'." >&4
2589             fi
2590             $rm -f try.c
2591             ;;
2592         esac
2593         case "$targetarch" in
2594         '') echo "Targetarch not defined." >&4; croak=y ;;
2595         *)  echo "Using targetarch $targetarch." >&4 ;;
2596         esac
2597         case "$incpth" in
2598         '') echo "Incpth not defined." >&4; croak=y ;;
2599         *)  echo "Using incpth '$incpth'." >&4 ;;
2600         esac
2601         case "$libpth" in
2602         '') echo "Libpth not defined." >&4; croak=y ;;
2603         *)  echo "Using libpth '$libpth'." >&4 ;;
2604         esac
2605         case "$usrinc" in
2606         '') for i in $incpth; do
2607                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2608                     usrinc=$i
2609                     echo "Guessing usrinc $usrinc." >&4
2610                     break
2611                 fi
2612             done
2613             case "$usrinc" in
2614             '') echo "Usrinc not defined." >&4; croak=y ;;
2615             esac
2616             ;;
2617         *)  echo "Using usrinc $usrinc." >&4 ;;
2618         esac
2619         case "$targethost" in
2620         '') echo "Targethost not defined." >&4; croak=y ;;
2621         *)  echo "Using targethost $targethost." >&4
2622         esac
2623         locincpth=' '
2624         loclibpth=' '
2625         case "$croak" in
2626         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2627         esac
2628         case "$src" in
2629         /*) run=$src/Cross/run
2630             targetmkdir=$src/Cross/mkdir
2631             to=$src/Cross/to
2632             from=$src/Cross/from
2633             ;;
2634         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2635             run=$pwd/Cross/run
2636             targetmkdir=$pwd/Cross/mkdir
2637             to=$pwd/Cross/to
2638             from=$pwd/Cross/from
2639             ;;
2640         esac
2641         case "$targetrun" in
2642         '') targetrun=ssh ;;
2643         esac
2644         case "$targetto" in
2645         '') targetto=scp ;;
2646         esac
2647         case "$targetfrom" in
2648         '') targetfrom=scp ;;
2649         esac
2650         run=$run-$targetrun
2651         to=$to-$targetto
2652         from=$from-$targetfrom
2653         case "$targetdir" in
2654         '')  targetdir=/tmp
2655              echo "Guessing targetdir $targetdir." >&4
2656              ;;
2657         esac
2658         case "$targetuser" in
2659         '')  targetuser=root
2660              echo "Guessing targetuser $targetuser." >&4
2661              ;;
2662         esac
2663         case "$targetfrom" in
2664         scp)    q=-q ;;
2665         *)      q='' ;;
2666         esac
2667         case "$targetrun" in
2668         ssh|rsh)
2669             cat >$run <<EOF
2670 #!/bin/sh
2671 case "\$1" in
2672 -cwd)
2673   shift
2674   cwd=\$1
2675   shift
2676   ;;
2677 esac
2678 case "\$cwd" in
2679 '') cwd=$targetdir ;;
2680 esac
2681 exe=\$1
2682 shift
2683 if $test ! -f \$exe.xok; then
2684   $to \$exe
2685   $touch \$exe.xok
2686 fi
2687 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2688 EOF
2689             ;;
2690         *)  echo "Unknown targetrun '$targetrun'" >&4
2691             exit 1
2692             ;;
2693         esac
2694         case "$targetmkdir" in
2695         */Cross/mkdir)
2696             cat >$targetmkdir <<EOF
2697 #!/bin/sh
2698 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2699 EOF
2700             $chmod a+rx $targetmkdir
2701             ;;
2702         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2703             exit 1
2704             ;;
2705         esac
2706         case "$targetto" in
2707         scp|rcp)
2708             cat >$to <<EOF
2709 #!/bin/sh
2710 for f in \$@
2711 do
2712   case "\$f" in
2713   /*)
2714     $targetmkdir \`dirname \$f\`
2715     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2716     ;;
2717   *)
2718     $targetmkdir $targetdir/\`dirname \$f\`
2719     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2720     ;;
2721   esac
2722 done
2723 exit 0
2724 EOF
2725             ;;
2726         cp) cat >$to <<EOF
2727 #!/bin/sh
2728 for f in \$@
2729 do
2730   case "\$f" in
2731   /*)
2732     $mkdir -p $targetdir/\`dirname \$f\`
2733     $cp \$f $targetdir/\$f || exit 1
2734     ;;
2735   *)
2736     $targetmkdir $targetdir/\`dirname \$f\`
2737     $cp \$f $targetdir/\$f || exit 1
2738     ;;
2739   esac
2740 done
2741 exit 0
2742 EOF
2743             ;;
2744         *)  echo "Unknown targetto '$targetto'" >&4
2745             exit 1
2746             ;;
2747         esac
2748         case "$targetfrom" in
2749         scp|rcp)
2750           cat >$from <<EOF
2751 #!/bin/sh
2752 for f in \$@
2753 do
2754   $rm -f \$f
2755   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2756 done
2757 exit 0
2758 EOF
2759             ;;
2760         cp) cat >$from <<EOF
2761 #!/bin/sh
2762 for f in \$@
2763 do
2764   $rm -f \$f
2765   cp $targetdir/\$f . || exit 1
2766 done
2767 exit 0
2768 EOF
2769             ;;
2770         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2771             exit 1
2772             ;;
2773         esac
2774         if $test ! -f $run; then
2775             echo "Target 'run' script '$run' not found." >&4
2776         else
2777             $chmod a+rx $run
2778         fi
2779         if $test ! -f $to; then
2780             echo "Target 'to' script '$to' not found." >&4
2781         else
2782             $chmod a+rx $to
2783         fi
2784         if $test ! -f $from; then
2785             echo "Target 'from' script '$from' not found." >&4
2786         else
2787             $chmod a+rx $from
2788         fi
2789         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2790             exit 1
2791         fi
2792         cat >&4 <<EOF
2793 Using '$run' for remote execution,
2794 and '$from' and '$to'
2795 for remote file transfer.
2796 EOF
2797         ;;
2798 *)      run=''
2799         to=:
2800         from=:
2801         usecrosscompile='undef'
2802         targetarch=''
2803         ;;
2804 esac
2805
2806 : see whether [:lower:] and [:upper:] are supported character classes
2807 echo " "
2808 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2809 ABYZ)
2810         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2811         up='[:upper:]'
2812         low='[:lower:]'
2813         ;;
2814 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2815         # (0xc9 and 0xd1), therefore that is a nice testing point.
2816         if test "X$up" = X -o "X$low" = X; then
2817             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2818             ij) up='[A-Z]'
2819                 low='[a-z]'
2820                 ;;
2821             esac
2822         fi
2823         if test "X$up" = X -o "X$low" = X; then
2824             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2825             ij) up='A-Z'
2826                 low='a-z'
2827                 ;;
2828             esac
2829         fi
2830         if test "X$up" = X -o "X$low" = X; then
2831             case "`echo IJ | od -x 2>/dev/null`" in
2832             *C9D1*|*c9d1*)
2833                 echo "Hey, this might be EBCDIC." >&4
2834                 if test "X$up" = X -o "X$low" = X; then
2835                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2836                     ij) up='[A-IJ-RS-Z]'
2837                         low='[a-ij-rs-z]'
2838                         ;;
2839                     esac
2840                 fi
2841                 if test "X$up" = X -o "X$low" = X; then
2842                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2843                     ij) up='A-IJ-RS-Z'
2844                         low='a-ij-rs-z'
2845                         ;;
2846                     esac
2847                 fi
2848                 ;;
2849             esac
2850         fi
2851 esac
2852 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2853 ij)
2854     echo "Using $up and $low to convert case." >&4
2855     ;;
2856 *)
2857     echo "I don't know how to translate letters from upper to lower case." >&4
2858     echo "Your tr is not acting any way I know of." >&4
2859     exit 1
2860     ;;
2861 esac
2862 : set up the translation script tr, must be called with ./tr of course
2863 cat >tr <<EOSC
2864 $startsh
2865 case "\$1\$2" in
2866 '[A-Z][a-z]') exec $tr '$up' '$low';;
2867 '[a-z][A-Z]') exec $tr '$low' '$up';;
2868 esac
2869 exec $tr "\$@"
2870 EOSC
2871 chmod +x tr
2872 $eunicefix tr
2873
2874 : Try to determine whether config.sh was made on this system
2875 case "$config_sh" in
2876 '')
2877 myuname=`$uname -a 2>/dev/null`
2878 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2879 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2880 # because the A-Z/a-z are not consecutive.
2881 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2882         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2883 newmyuname="$myuname"
2884 dflt=n
2885 case "$knowitall" in
2886 '')
2887         if test -f ../config.sh; then
2888                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2889                         eval "`grep myuname= ../config.sh`"
2890                 fi
2891                 if test "X$myuname" = "X$newmyuname"; then
2892                         dflt=y
2893                 fi
2894         fi
2895         ;;
2896 *) dflt=y;;
2897 esac
2898
2899 : Get old answers from old config file if Configure was run on the
2900 : same system, otherwise use the hints.
2901 hint=default
2902 cd ..
2903 if test -f config.sh; then
2904         echo " "
2905         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2906         . UU/myread
2907         case "$ans" in
2908         n*|N*) echo "OK, I'll ignore it."
2909                 mv config.sh config.sh.old
2910                 myuname="$newmyuname"
2911                 ;;
2912         *)  echo "Fetching default answers from your old config.sh file..." >&4
2913                 tmp_n="$n"
2914                 tmp_c="$c"
2915                 tmp_sh="$sh"
2916                 . ./config.sh
2917                 cp config.sh UU
2918                 n="$tmp_n"
2919                 c="$tmp_c"
2920                 : Older versions did not always set $sh.  Catch re-use of such
2921                 : an old config.sh.
2922                 case "$sh" in
2923                 '') sh="$tmp_sh" ;;
2924                 esac
2925                 hint=previous
2926                 ;;
2927         esac
2928 fi
2929 . ./UU/checkcc
2930 if test ! -f config.sh; then
2931         $cat <<EOM
2932
2933 First time through, eh?  I have some defaults handy for some systems
2934 that need some extra help getting the Configure answers right:
2935
2936 EOM
2937         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2938         dflt=''
2939         : Half the following guesses are probably wrong... If you have better
2940         : tests or hints, please send them to perlbug@perl.org
2941         : The metaconfig authors would also appreciate a copy...
2942         $test -f /irix && osname=irix
2943         $test -f /xenix && osname=sco_xenix
2944         $test -f /dynix && osname=dynix
2945         $test -f /dnix && osname=dnix
2946         $test -f /lynx.os && osname=lynxos
2947         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2948         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2949         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2950         $test -f /bin/mips && /bin/mips && osname=mips
2951         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2952                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2953         $test -d /usr/apollo/bin && osname=apollo
2954         $test -f /etc/saf/_sactab && osname=svr4
2955         $test -d /usr/include/minix && osname=minix
2956         $test -f /system/gnu_library/bin/ar.pm && osname=vos
2957         if $test -d /MachTen -o -d /MachTen_Folder; then
2958                 osname=machten
2959                 if $test -x /sbin/version; then
2960                         osvers=`/sbin/version | $awk '{print $2}' |
2961                         $sed -e 's/[A-Za-z]$//'`
2962                 elif $test -x /usr/etc/version; then
2963                         osvers=`/usr/etc/version | $awk '{print $2}' |
2964                         $sed -e 's/[A-Za-z]$//'`
2965                 else
2966                         osvers="$2.$3"
2967                 fi
2968         fi
2969
2970         $test -f /sys/posix.dll &&
2971                 $test -f /usr/bin/what &&
2972                 set X `/usr/bin/what /sys/posix.dll` &&
2973                 $test "$3" = UWIN &&
2974                 osname=uwin &&
2975                 osvers="$5"
2976
2977         if $test -f $uname; then
2978                 set X $myuname
2979                 shift
2980
2981                 case "$5" in
2982                 fps*) osname=fps ;;
2983                 mips*)
2984                         case "$4" in
2985                         umips) osname=umips ;;
2986                         *) osname=mips ;;
2987                         esac;;
2988                 [23]100) osname=mips ;;
2989                 next*) osname=next ;;
2990                 i386*)
2991                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2992                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2993                                 osname='sco'
2994                                 osvers=$tmp
2995                         elif $test -f /etc/kconfig; then
2996                                 osname=isc
2997                                 if test "$lns" = "$ln -s"; then
2998                                         osvers=4
2999                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3000                                         osvers=3
3001                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3002                                         osvers=2
3003                                 fi
3004                         fi
3005                         tmp=''
3006                         ;;
3007                 pc*)
3008                         if test -n "$DJGPP"; then
3009                                 osname=dos
3010                                 osvers=djgpp
3011                         fi
3012                         ;;
3013                 esac
3014
3015                 case "$1" in
3016                 aix) osname=aix
3017                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3018                         case "$tmp" in
3019                         'not found') osvers="$4"."$3" ;;
3020                         '<3240'|'<>3240') osvers=3.2.0 ;;
3021                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3022                         '=3250'|'>3250') osvers=3.2.5 ;;
3023                         *) osvers=$tmp;;
3024                         esac
3025                         ;;
3026                 bsd386) osname=bsd386
3027                         osvers=`$uname -r`
3028                         ;;
3029                 cygwin*) osname=cygwin
3030                         osvers="$3"
3031                         ;;
3032                 *dc.osx) osname=dcosx
3033                         osvers="$3"
3034                         ;;
3035                 dnix) osname=dnix
3036                         osvers="$3"
3037                         ;;
3038                 domainos) osname=apollo
3039                         osvers="$3"
3040                         ;;
3041                 dgux) osname=dgux 
3042                         osvers="$3"
3043                         ;;
3044                 dynixptx*) osname=dynixptx
3045                         osvers=`echo "$4"|sed 's/^v//'`
3046                         ;;
3047                 freebsd) osname=freebsd 
3048                         osvers="$3" ;;
3049                 genix) osname=genix ;;
3050                 hp*) osname=hpux 
3051                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3052                         ;;
3053                 irix*) osname=irix
3054                         case "$3" in
3055                         4*) osvers=4 ;;
3056                         5*) osvers=5 ;;
3057                         *)      osvers="$3" ;;
3058                         esac
3059                         ;;
3060                 linux) osname=linux
3061                         case "$3" in
3062                         *)      osvers="$3" ;;
3063                         esac
3064                         ;;
3065                 MiNT) osname=mint
3066                         ;;
3067                 netbsd*) osname=netbsd
3068                         osvers="$3"
3069                         ;;
3070                 news-os) osvers="$3"
3071                         case "$3" in
3072                         4*) osname=newsos4 ;;
3073                         *) osname=newsos ;;
3074                         esac
3075                         ;;
3076                 next*) osname=next ;;
3077                 nonstop-ux) osname=nonstopux ;;
3078                 POSIX-BC | posix-bc ) osname=posix-bc
3079                         osvers="$3"
3080                         ;;
3081                 powerux | power_ux | powermax_os | powermaxos | \
3082                 powerunix | power_unix) osname=powerux
3083                         osvers="$3"
3084                         ;;
3085                 qnx) osname=qnx
3086                         osvers="$4"
3087                         ;;
3088                 solaris) osname=solaris
3089                         case "$3" in
3090                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3091                         *)      osvers="$3" ;;
3092                         esac
3093                         ;;
3094                 sunos) osname=sunos
3095                         case "$3" in
3096                         5*) osname=solaris
3097                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3098                         *)      osvers="$3" ;;
3099                         esac
3100                         ;;
3101                 titanos) osname=titanos
3102                         case "$3" in
3103                         1*) osvers=1 ;;
3104                         2*) osvers=2 ;;
3105                         3*) osvers=3 ;;
3106                         4*) osvers=4 ;;
3107                         *)      osvers="$3" ;;
3108                         esac
3109                         ;;
3110                 ultrix) osname=ultrix
3111                         osvers="$3"
3112                         ;;
3113                 osf1|mls+)      case "$5" in
3114                                 alpha)
3115                                         osname=dec_osf
3116                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3117                                         case "$osvers" in
3118                                         [1-9].[0-9]*) ;;
3119                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3120                                         esac
3121                                         ;;
3122                         hp*)    osname=hp_osf1  ;;
3123                         mips)   osname=mips_osf1 ;;
3124                         esac
3125                         ;;
3126                 unixware) osname=svr5
3127                         osvers="$4"
3128                         ;;
3129                 uts)    osname=uts
3130                         osvers="$3"
3131                         ;;
3132                 vos) osvers="$3"
3133                         ;;
3134                 $2) case "$osname" in
3135                         *isc*) ;;
3136                         *freebsd*) ;;
3137                         svr*)
3138                                 : svr4.x or possibly later
3139                                 case "svr$3" in 
3140                                 ${osname}*)
3141                                         osname=svr$3
3142                                         osvers=$4
3143                                         ;;
3144                                 esac
3145                                 case "$osname" in
3146                                 svr4.0)
3147                                         : Check for ESIX
3148                                         if test -f /stand/boot ; then
3149                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3150                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3151                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3152                                                         if test -n "$isesix"; then
3153                                                                 osname=esix4
3154                                                         fi
3155                                                 fi
3156                                         fi
3157                                         ;;
3158                                 esac
3159                                 ;;
3160                         *)      if test -f /etc/systemid; then
3161                                         osname=sco
3162                                         set `echo $3 | $sed 's/\./ /g'` $4
3163                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3164                                                 osvers=$1.$2.$3
3165                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3166                                                 osvers=$1.$2
3167                                         elif $test -f $src/hints/sco_$1.sh; then
3168                                                 osvers=$1
3169                                         fi
3170                                 else
3171                                         case "$osname" in
3172                                         '') : Still unknown.  Probably a generic Sys V.
3173                                                 osname="sysv"
3174                                                 osvers="$3"
3175                                                 ;;
3176                                         esac
3177                                 fi
3178                                 ;;
3179                         esac
3180                         ;;
3181                 *)      case "$osname" in
3182                         '') : Still unknown.  Probably a generic BSD.
3183                                 osname="$1"
3184                                 osvers="$3"
3185                                 ;;
3186                         esac
3187                         ;;
3188                 esac
3189         else
3190                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3191                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3192                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3193                                 osname=news_os
3194                         fi
3195                         $rm -f UU/kernel.what
3196                 elif test -d c:/.; then
3197                         set X $myuname
3198                         osname=os2
3199                         osvers="$5"
3200                 fi
3201         fi
3202         
3203         case "$targetarch" in
3204         '') ;;
3205         *)  hostarch=$osname
3206             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3207             osvers=''
3208             ;;
3209         esac
3210
3211         : Now look for a hint file osname_osvers, unless one has been
3212         : specified already.
3213         case "$hintfile" in
3214         ''|' ')
3215                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3216                 : Also try without trailing minor version numbers.
3217                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3218                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3219                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3220                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3221                 case "$file" in
3222                 '') dflt=none ;;
3223                 *)  case "$osvers" in
3224                         '') dflt=$file
3225                                 ;;
3226                         *)  if $test -f $src/hints/$file.sh ; then
3227                                         dflt=$file
3228                                 elif $test -f $src/hints/$xfile.sh ; then
3229                                         dflt=$xfile
3230                                 elif $test -f $src/hints/$xxfile.sh ; then
3231                                         dflt=$xxfile
3232                                 elif $test -f $src/hints/$xxxfile.sh ; then
3233                                         dflt=$xxxfile
3234                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3235                                         dflt=$xxxxfile
3236                                 elif $test -f "$src/hints/${osname}.sh" ; then
3237                                         dflt="${osname}"
3238                                 else
3239                                         dflt=none
3240                                 fi
3241                                 ;;
3242                         esac
3243                         ;;
3244                 esac
3245                 if $test -f Policy.sh ; then
3246                         case "$dflt" in
3247                         *Policy*) ;;
3248                         none) dflt="Policy" ;;
3249                         *) dflt="Policy $dflt" ;;
3250                         esac
3251                 fi
3252                 ;;
3253         *)
3254                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3255                 ;;
3256         esac
3257
3258         if $test -f Policy.sh ; then
3259                 $cat <<EOM
3260
3261 There's also a Policy hint file available, which should make the
3262 site-specific (policy) questions easier to answer.
3263 EOM
3264
3265         fi
3266
3267         $cat <<EOM
3268
3269 You may give one or more space-separated answers, or "none" if appropriate.
3270 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3271 is a good thing.  DO NOT give a wrong version or a wrong OS.
3272
3273 EOM
3274
3275         rp="Which of these apply, if any?"
3276         . UU/myread
3277         tans=$ans
3278         for file in $tans; do
3279                 if $test X$file = XPolicy -a -f Policy.sh; then
3280                         . Policy.sh
3281                         $cat Policy.sh >> UU/config.sh
3282                 elif $test -f $src/hints/$file.sh; then
3283                         . $src/hints/$file.sh
3284                         $cat $src/hints/$file.sh >> UU/config.sh
3285                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3286                         : nothing
3287                 else
3288                         : Give one chance to correct a possible typo.
3289                         echo "$file.sh does not exist"
3290                         dflt=$file
3291                         rp="hint to use instead?"
3292                         . UU/myread
3293                         for file in $ans; do
3294                                 if $test -f "$src/hints/$file.sh"; then
3295                                         . $src/hints/$file.sh
3296                                         $cat $src/hints/$file.sh >> UU/config.sh
3297                                 elif $test X$ans = X -o X$ans = Xnone ; then
3298                                         : nothing
3299                                 else
3300                                         echo "$file.sh does not exist -- ignored."
3301                                 fi
3302                         done
3303                 fi
3304         done
3305
3306         hint=recommended
3307         : Remember our hint file for later.
3308         if $test -f "$src/hints/$file.sh" ; then
3309                 hintfile="$file"
3310         else
3311                 hintfile=''
3312         fi
3313 fi
3314 cd UU
3315 ;;
3316 *)
3317         echo " "
3318         echo "Fetching default answers from $config_sh..." >&4
3319         tmp_n="$n"
3320         tmp_c="$c"
3321         cd ..
3322         cp $config_sh config.sh 2>/dev/null
3323         chmod +w config.sh
3324         . ./config.sh
3325         cd UU
3326         cp ../config.sh .
3327         n="$tmp_n"
3328         c="$tmp_c"
3329         hint=previous
3330         ;;
3331 esac
3332 test "$override" && . ./optdef.sh
3333
3334 : Restore computed paths
3335 for file in $loclist $trylist; do
3336         eval $file="\$_$file"
3337 done
3338
3339 cat << EOM
3340
3341 Configure uses the operating system name and version to set some defaults.
3342 The default value is probably right if the name rings a bell. Otherwise,
3343 since spelling matters for me, either accept the default or answer "none"
3344 to leave it blank.
3345
3346 EOM
3347 case "$osname" in
3348         ''|' ')
3349                 case "$hintfile" in
3350                 ''|' '|none) dflt=none ;;
3351                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3352                 esac
3353                 ;;
3354         *) dflt="$osname" ;;
3355 esac
3356 rp="Operating system name?"
3357 . ./myread
3358 case "$ans" in
3359 none)  osname='' ;;
3360 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3361 esac
3362 echo " "
3363 case "$osvers" in
3364         ''|' ')
3365                 case "$hintfile" in
3366                 ''|' '|none) dflt=none ;;
3367                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3368                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3369                         case "$dflt" in
3370                         ''|' ') dflt=none ;;
3371                         esac
3372                         ;;
3373                 esac
3374                 ;;
3375         *) dflt="$osvers" ;;
3376 esac
3377 rp="Operating system version?"
3378 . ./myread
3379 case "$ans" in
3380 none)  osvers='' ;;
3381 *) osvers="$ans" ;;
3382 esac
3383
3384
3385 . ./posthint.sh
3386
3387 : who configured the system
3388 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3389 cf_by=`(logname) 2>/dev/null`
3390 case "$cf_by" in
3391 "")
3392         cf_by=`(whoami) 2>/dev/null`
3393         case "$cf_by" in
3394         "") cf_by=unknown ;;
3395         esac ;;
3396 esac
3397
3398 : set up the script used to warn in case of inconsistency
3399 cat <<EOS >whoa
3400 $startsh
3401 EOS
3402 cat <<'EOSC' >>whoa
3403 dflt=y
3404 echo " "
3405 echo "*** WHOA THERE!!! ***" >&4
3406 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3407 rp="    Keep the $hint value?"
3408 . ./myread
3409 case "$ans" in
3410 y) td=$was; tu=$was;;
3411 esac
3412 EOSC
3413
3414 : function used to set $1 to $val
3415 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3416 case "$val$was" in
3417 $define$undef) . ./whoa; eval "$var=\$td";;
3418 $undef$define) . ./whoa; eval "$var=\$tu";;
3419 *) eval "$var=$val";;
3420 esac'
3421
3422 case "$usethreads" in
3423 $define|true|[yY]*)     dflt='y';;
3424 *) dflt='n';;
3425 esac
3426 cat <<EOM
3427
3428 Perl can be built to take advantage of threads on some systems.
3429 To do so, Configure can be run with -Dusethreads.
3430
3431 Note that threading is a highly experimental feature, and
3432 some known race conditions still remain.  If you choose to try
3433 it, be very sure to not actually deploy it for production
3434 purposes.  README.threads has more details, and is required
3435 reading if you enable threads.
3436
3437 If this doesn't make any sense to you, just accept the default '$dflt'.
3438 EOM
3439 rp='Build a threading Perl?'
3440 . ./myread
3441 case "$ans" in
3442 y|Y)    val="$define" ;;
3443 *)      val="$undef" ;;
3444 esac
3445 set usethreads
3446 eval $setvar
3447
3448 case "$usethreads" in
3449 $define)
3450         $cat <<EOM
3451
3452 As of release 5.6, Perl has two different threading implementations,
3453 an interpreter-based version (ithreads) with one interpreter per
3454 thread, and the 5.005 version (5005threads).  Both implementations
3455 are considered experimental, but since 5.8 ithreads somewhat less so.
3456 The 5005threads is effectively unmaintained.
3457
3458 EOM
3459         : Default to ithreads unless overridden on command line or with
3460         : old config.sh
3461         dflt='y'
3462         case "$use5005threads" in
3463                 $define|true|[yY]*) dflt='n';;
3464         esac
3465         case "$useithreads" in
3466                 $undef|false|[nN]*) dflt='n';;
3467         esac
3468         rp='Use interpreter-based ithreads?'
3469         . ./myread
3470         case "$ans" in
3471         y|Y)    val="$define" ;;
3472         *)      val="$undef" ;;
3473         esac
3474         set useithreads
3475         eval $setvar
3476         : Now set use5005threads to the opposite value.
3477         case "$useithreads" in
3478         $define) val="$undef" ;;
3479         *) val="$define" ;;
3480         esac
3481         set use5005threads
3482         eval $setvar
3483         ;;
3484 *)
3485         useithreads="$undef"
3486         use5005threads="$undef"
3487         ;;
3488 esac
3489
3490 case "$useithreads$use5005threads" in
3491 "$define$define")
3492         $cat >&4 <<EOM
3493
3494 You cannot have both the ithreads and the 5.005 threads enabled
3495 at the same time.  Disabling the 5.005 threads since they are
3496 much less stable than the ithreads.
3497
3498 EOM
3499         use5005threads="$undef"
3500         ;;
3501 esac
3502
3503 case "$d_oldpthreads" in
3504 '')     : Configure tests would be welcome here.  For now, assume undef.
3505         val="$undef" ;;
3506 *)      val="$d_oldpthreads" ;;
3507 esac
3508 set d_oldpthreads
3509 eval $setvar
3510
3511
3512 case "$usethreads" in
3513 "$define"|true|[yY]*)
3514 : Look for a hint-file generated 'call-back-unit'.  If the
3515 : user has specified that a threading perl is to be built,
3516 : we may need to set or change some other defaults.
3517         if $test -f usethreads.cbu; then
3518                 echo "Your platform has some specific hints for threaded builds, using them..."
3519                 . ./usethreads.cbu
3520         else
3521                 $cat <<EOM
3522 (Your platform doesn't have any specific hints for threaded builds.
3523  Assuming POSIX threads, then.)
3524 EOM
3525         fi
3526         ;;
3527 esac
3528
3529 cat <<EOM
3530
3531 Perl can be built so that multiple Perl interpreters can coexist
3532 within the same Perl executable.
3533 EOM
3534
3535 case "$useithreads" in
3536 $define)
3537         cat <<EOM
3538 This multiple interpreter support is required for interpreter-based threads.
3539 EOM
3540         val="$define"
3541         ;;
3542 *)      case "$usemultiplicity" in
3543         $define|true|[yY]*)     dflt='y';;
3544         *) dflt='n';;
3545         esac
3546         echo " "
3547         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3548         rp='Build Perl for multiplicity?'
3549         . ./myread
3550         case "$ans" in
3551         y|Y)    val="$define" ;;
3552         *)      val="$undef" ;;
3553         esac
3554         ;;
3555 esac
3556 set usemultiplicity
3557 eval $setvar
3558
3559
3560 case "$usemorebits" in
3561 "$define"|true|[yY]*)
3562         use64bitint="$define"
3563         uselongdouble="$define"
3564         usemorebits="$define"
3565         ;;
3566 *)      usemorebits="$undef"
3567         ;;
3568 esac
3569
3570 : make some quick guesses about what we are up against
3571 echo " "
3572 $echo $n "Hmm...  $c"
3573 echo exit 1 >bsd
3574 echo exit 1 >usg
3575 echo exit 1 >v7
3576 echo exit 1 >osf1
3577 echo exit 1 >eunice
3578 echo exit 1 >xenix
3579 echo exit 1 >venix
3580 echo exit 1 >os2
3581 d_bsd="$undef"
3582 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3583 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3584 then
3585         echo "Looks kind of like an OSF/1 system, but we'll see..."
3586         echo exit 0 >osf1
3587 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3588         xxx=`./loc addbib blurfl $pth`
3589         if $test -f $xxx; then
3590         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3591                 echo exit 0 >bsd
3592                 echo exit 0 >usg
3593         else
3594                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3595                         echo "Looks kind of like an extended USG system, but we'll see..."
3596                 else
3597                         echo "Looks kind of like a USG system, but we'll see..."
3598                 fi
3599                 echo exit 0 >usg
3600         fi
3601 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3602         echo "Looks kind of like a BSD system, but we'll see..."
3603         d_bsd="$define"
3604         echo exit 0 >bsd
3605 else
3606         echo "Looks kind of like a Version 7 system, but we'll see..."
3607         echo exit 0 >v7
3608 fi
3609 case "$eunicefix" in
3610 *unixtovms*)
3611         $cat <<'EOI'
3612 There is, however, a strange, musty smell in the air that reminds me of
3613 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3614 EOI
3615         echo exit 0 >eunice
3616         d_eunice="$define"
3617 : it so happens the Eunice I know will not run shell scripts in Unix format
3618         ;;
3619 *)
3620         echo " "
3621         echo "Congratulations.  You aren't running Eunice."
3622         d_eunice="$undef"
3623         ;;
3624 esac
3625 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3626 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3627 : semicolon as a patch separator
3628 case "$p_" in
3629 :) ;;
3630 *)
3631         $cat <<'EOI'
3632 I have the feeling something is not exactly right, however...don't tell me...
3633 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3634 (Or you may be running DOS with DJGPP.)
3635 EOI
3636         echo exit 0 >os2
3637         ;;
3638 esac
3639 if test -f /xenix; then
3640         echo "Actually, this looks more like a XENIX system..."
3641         echo exit 0 >xenix
3642         d_xenix="$define"
3643 else
3644         echo " "
3645         echo "It's not Xenix..."
3646         d_xenix="$undef"
3647 fi
3648 chmod +x xenix
3649 $eunicefix xenix
3650 if test -f /venix; then
3651         echo "Actually, this looks more like a VENIX system..."
3652         echo exit 0 >venix
3653 else
3654         echo " "
3655         if ./xenix; then
3656                 : null
3657         else
3658                 echo "Nor is it Venix..."
3659         fi
3660 fi
3661 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3662 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3663 $rm -f foo
3664
3665 case "$cc" in
3666 '') dflt=cc;;
3667 *) dflt="$cc";;
3668 esac
3669 rp="Use which C compiler?"
3670 . ./myread
3671 cc="$ans"
3672
3673 : See if they have not cc but they do have gcc
3674 . ./trygcc
3675 : Look for a hint-file generated 'call-back-unit'.  Now that the
3676 : user has specified the compiler, we may need to set or change some
3677 : other defaults.
3678 if $test -f cc.cbu; then
3679     . ./cc.cbu
3680 fi
3681 . ./checkcc
3682
3683 echo " "
3684 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3685 $cat >try.c <<EOM
3686 #include <stdio.h>
3687 int main() {
3688 #ifdef __GNUC__
3689 #ifdef __VERSION__
3690         printf("%s\n", __VERSION__);
3691 #else
3692         printf("%s\n", "1");
3693 #endif
3694 #endif
3695         exit(0);
3696 }
3697 EOM
3698 if $cc -o try $ccflags $ldflags try.c; then
3699         gccversion=`$run ./try`
3700         case "$gccversion" in
3701         '') echo "You are not using GNU cc." ;;
3702         *)  echo "You are using GNU cc $gccversion."
3703             ccname=gcc  
3704             ;;
3705         esac
3706 else
3707         echo " "
3708         echo "*** WHOA THERE!!! ***" >&4
3709         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3710         case "$knowitall" in
3711         '')
3712         echo "    You'd better start hunting for one and let me know about it." >&4
3713                 exit 1
3714                 ;;
3715         esac
3716 fi
3717 $rm -f try try.*
3718 case "$gccversion" in
3719 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3720 esac
3721 case "$gccversion" in
3722 '') gccosandvers='' ;;
3723 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3724    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3725    gccshortvers=''
3726    case "$gccosandvers" in
3727    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3728    $osname$osvers) ;; # looking good
3729    $osname*) cat <<EOM >&4
3730
3731 *** WHOA THERE!!! ***
3732
3733     Your gcc has not been compiled for the exact release of
3734     your operating system ($gccosandvers versus $osname$osvers).
3735
3736     In general it is a good idea to keep gcc synchronized with
3737     the operating system because otherwise serious problems
3738     may ensue when trying to compile software, like Perl.
3739
3740     I'm trying to be optimistic here, though, and will continue.
3741     If later during the configuration and build icky compilation
3742     problems appear (headerfile conflicts being the most common
3743     manifestation), I suggest reinstalling the gcc to match
3744     your operating system release.
3745
3746 EOM
3747       ;;
3748    *) gccosandvers='' ;; # failed to parse, better be silent
3749    esac
3750    ;;
3751 esac
3752 case "$ccname" in
3753 '') ccname="$cc" ;;
3754 esac
3755
3756
3757 : decide how portable to be.  Allow command line overrides.
3758 case "$d_portable" in
3759 "$undef") ;;
3760 *)      d_portable="$define" ;;
3761 esac
3762
3763 : set up shell script to do ~ expansion
3764 cat >filexp <<EOSS
3765 $startsh
3766 : expand filename
3767 case "\$1" in
3768  ~/*|~)
3769         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3770         ;;
3771  ~*)
3772         if $test -f /bin/csh; then
3773                 /bin/csh -f -c "glob \$1"
3774                 failed=\$?
3775                 echo ""
3776                 exit \$failed
3777         else
3778                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3779                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3780                 if $test ! -d "\$dir"; then
3781                         me=\`basename \$0\`
3782                         echo "\$me: can't locate home directory for: \$name" >&2
3783                         exit 1
3784                 fi
3785                 case "\$1" in
3786                 */*)
3787                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3788                         ;;
3789                 *)
3790                         echo \$dir
3791                         ;;
3792                 esac
3793         fi
3794         ;;
3795 *)
3796         echo \$1
3797         ;;
3798 esac
3799 EOSS
3800 chmod +x filexp
3801 $eunicefix filexp
3802
3803 : now set up to get a file name
3804 cat <<EOS >getfile
3805 $startsh
3806 EOS
3807 cat <<'EOSC' >>getfile
3808 tilde=''
3809 fullpath=''
3810 already=''
3811 skip=''
3812 none_ok=''
3813 exp_file=''
3814 nopath_ok=''
3815 orig_rp="$rp"
3816 orig_dflt="$dflt"
3817 case "$gfpth" in
3818 '') gfpth='.' ;;
3819 esac
3820
3821 case "$fn" in
3822 *\(*)
3823         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3824         fn=`echo $fn | sed 's/(.*)//'`
3825         ;;
3826 esac
3827
3828 case "$fn" in
3829 *:*)
3830         loc_file=`expr $fn : '.*:\(.*\)'`
3831         fn=`expr $fn : '\(.*\):.*'`
3832         ;;
3833 esac
3834
3835 case "$fn" in
3836 *~*) tilde=true;;
3837 esac
3838 case "$fn" in
3839 */*) fullpath=true;;
3840 esac
3841 case "$fn" in
3842 *+*) skip=true;;
3843 esac
3844 case "$fn" in
3845 *n*) none_ok=true;;
3846 esac
3847 case "$fn" in
3848 *e*) exp_file=true;;
3849 esac
3850 case "$fn" in
3851 *p*) nopath_ok=true;;
3852 esac
3853
3854 case "$fn" in
3855 *f*) type='File';;
3856 *d*) type='Directory';;
3857 *l*) type='Locate';;
3858 esac
3859
3860 what="$type"
3861 case "$what" in
3862 Locate) what='File';;
3863 esac
3864
3865 case "$exp_file" in
3866 '')
3867         case "$d_portable" in
3868         "$define") ;;
3869         *) exp_file=true;;
3870         esac
3871         ;;
3872 esac
3873
3874 cd ..
3875 while test "$type"; do
3876         redo=''
3877         rp="$orig_rp"
3878         dflt="$orig_dflt"
3879         case "$tilde" in
3880         true) rp="$rp (~name ok)";;
3881         esac
3882         . UU/myread
3883         if test -f UU/getfile.ok && \
3884                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3885         then
3886                 value="$ans"
3887                 ansexp="$ans"
3888                 break
3889         fi
3890         case "$ans" in
3891         none)
3892                 value=''
3893                 ansexp=''
3894                 case "$none_ok" in
3895                 true) type='';;
3896                 esac
3897                 ;;
3898         *)
3899                 case "$tilde" in
3900                 '') value="$ans"
3901                         ansexp="$ans";;
3902                 *)
3903                         value=`UU/filexp $ans`
3904                         case $? in
3905                         0)
3906                                 if test "$ans" != "$value"; then
3907                                         echo "(That expands to $value on this system.)"
3908                                 fi
3909                                 ;;
3910                         *) value="$ans";;
3911                         esac
3912                         ansexp="$value"
3913                         case "$exp_file" in
3914                         '') value="$ans";;
3915                         esac
3916                         ;;
3917                 esac
3918                 case "$fullpath" in
3919                 true)
3920                         case "$ansexp" in
3921                         /*) value="$ansexp" ;;
3922                         [a-zA-Z]:/*) value="$ansexp" ;;
3923                         *)
3924                                 redo=true
3925                                 case "$already" in
3926                                 true)
3927                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3928                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3929                                         ;;
3930                                 *)
3931                                 echo "Please give a full path name, starting with slash." >&4
3932                                         case "$tilde" in
3933                                         true)
3934                                 echo "Note that using ~name is ok provided it expands well." >&4
3935                                                 already=true
3936                                                 ;;
3937                                         esac
3938                                 esac
3939                                 ;;
3940                         esac
3941                         ;;
3942                 esac
3943                 case "$redo" in
3944                 '')
3945                         case "$type" in
3946                         File)
3947                                 for fp in $gfpth; do
3948                                         if test "X$fp" = X.; then
3949                                             pf="$ansexp"
3950                                         else    
3951                                             pf="$fp/$ansexp"
3952                                         fi
3953                                         if test -f "$pf"; then
3954                                                 type=''
3955                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3956                                         then
3957                                                 echo "($value is not a plain file, but that's ok.)"
3958                                                 type=''
3959                                         fi
3960                                         if test X"$type" = X; then
3961                                             value="$pf"
3962                                             break
3963                                         fi
3964                                 done
3965                                 ;;
3966                         Directory)
3967                                 for fp in $gfpth; do
3968                                         if test "X$fp" = X.; then
3969                                             dir="$ans"
3970                                             direxp="$ansexp"
3971                                         else    
3972                                             dir="$fp/$ansexp"
3973                                             direxp="$fp/$ansexp"
3974                                         fi
3975                                         if test -d "$direxp"; then
3976                                                 type=''
3977                                                 value="$dir"
3978                                                 break
3979                                         fi
3980                                 done
3981                                 ;;
3982                         Locate)
3983                                 if test -d "$ansexp"; then
3984                                         echo "(Looking for $loc_file in directory $value.)"
3985                                         value="$value/$loc_file"
3986                                         ansexp="$ansexp/$loc_file"
3987                                 fi
3988                                 if test -f "$ansexp"; then
3989                                         type=''
3990                                 fi
3991                                 case "$nopath_ok" in
3992                                 true)   case "$value" in
3993                                         */*) ;;
3994                                         *)      echo "Assuming $value will be in people's path."
3995                                                 type=''
3996                                                 ;;
3997                                         esac
3998                                         ;;
3999                                 esac
4000                                 ;;
4001                         esac
4002
4003                         case "$skip" in
4004                         true) type='';
4005                         esac
4006
4007                         case "$type" in
4008                         '') ;;
4009                         *)
4010                                 if test "$fastread" = yes; then
4011                                         dflt=y
4012                                 else
4013                                         dflt=n
4014                                 fi
4015                                 rp="$what $value doesn't exist.  Use that name anyway?"
4016                                 . UU/myread
4017                                 dflt=''
4018                                 case "$ans" in
4019                                 y*) type='';;
4020                                 *) echo " ";;
4021                                 esac
4022                                 ;;
4023                         esac
4024                         ;;
4025                 esac
4026                 ;;
4027         esac
4028 done
4029 cd UU
4030 ans="$value"
4031 rp="$orig_rp"
4032 dflt="$orig_dflt"
4033 rm -f getfile.ok
4034 test "X$gfpthkeep" != Xy && gfpth=""
4035 EOSC
4036
4037 : What should the include directory be ?
4038 echo " "
4039 $echo $n "Hmm...  $c"
4040 dflt='/usr/include'
4041 incpath=''
4042 mips_type=''
4043 if $test -f /bin/mips && /bin/mips; then
4044         echo "Looks like a MIPS system..."
4045         $cat >usr.c <<'EOCP'
4046 #ifdef SYSTYPE_BSD43
4047 /bsd43
4048 #endif
4049 EOCP
4050         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4051                 dflt='/bsd43/usr/include'
4052                 incpath='/bsd43'
4053                 mips_type='BSD 4.3'
4054         else
4055                 mips_type='System V'
4056         fi
4057         $rm -f usr.c usr.out
4058         echo "and you're compiling with the $mips_type compiler and libraries."
4059         xxx_prompt=y
4060         echo "exit 0" >mips
4061 else
4062         echo "Doesn't look like a MIPS system."
4063         xxx_prompt=n
4064         echo "exit 1" >mips
4065 fi
4066 chmod +x mips
4067 $eunicefix mips
4068 case "$usrinc" in
4069 '') ;;
4070 *) dflt="$usrinc";;
4071 esac
4072 case "$xxx_prompt" in
4073 y)      fn=d/
4074         echo " "
4075         rp='Where are the include files you want to use?'
4076         . ./getfile
4077         usrinc="$ans"
4078         ;;
4079 *)      usrinc="$dflt"
4080         ;;
4081 esac
4082
4083 : see how we invoke the C preprocessor
4084 echo " "
4085 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4086 cat <<'EOT' >testcpp.c
4087 #define ABC abc
4088 #define XYZ xyz
4089 ABC.XYZ
4090 EOT
4091 cd ..
4092 if test ! -f cppstdin; then
4093         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4094                 # AIX cc -E doesn't show the absolute headerfile
4095                 # locations but we'll cheat by using the -M flag.
4096                 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
4097         else
4098                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4099         fi
4100 else
4101         echo "Keeping your $hint cppstdin wrapper."
4102 fi
4103 chmod 755 cppstdin
4104 wrapper=`pwd`/cppstdin
4105 ok='false'
4106 cd UU
4107
4108 if $test "X$cppstdin" != "X" && \
4109         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4110         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4111 then
4112         echo "You used to use $cppstdin $cppminus so we'll use that again."
4113         case "$cpprun" in
4114         '') echo "But let's see if we can live without a wrapper..." ;;
4115         *)
4116                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4117                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4118                 then
4119                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4120                         ok='true'
4121                 else
4122                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4123                 fi
4124                 ;;
4125         esac
4126 else
4127         case "$cppstdin" in
4128         '') ;;
4129         *)
4130                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4131                 ;;
4132         esac
4133 fi
4134
4135 if $ok; then
4136         : nothing
4137 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4138         $cc -E <testcpp.c >testcpp.out 2>&1; \
4139         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4140         echo "Yup, it does."
4141         x_cpp="$cc -E"
4142         x_minus='';
4143 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4144         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4145         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4146         echo "Yup, it does."
4147         x_cpp="$cc -E"
4148         x_minus='-';
4149 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4150         $cc -P <testcpp.c >testcpp.out 2>&1; \
4151         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4152         echo "Yipee, that works!"
4153         x_cpp="$cc -P"
4154         x_minus='';
4155 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4156         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4157         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4158         echo "At long last!"
4159         x_cpp="$cc -P"
4160         x_minus='-';
4161 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4162         $cpp <testcpp.c >testcpp.out 2>&1; \
4163         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4164         echo "It works!"
4165         x_cpp="$cpp"
4166         x_minus='';
4167 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4168         $cpp - <testcpp.c >testcpp.out 2>&1; \
4169         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4170         echo "Hooray, it works!  I was beginning to wonder."
4171         x_cpp="$cpp"
4172         x_minus='-';
4173 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4174         $wrapper <testcpp.c >testcpp.out 2>&1; \
4175         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4176         x_cpp="$wrapper"
4177         x_minus=''
4178         echo "Eureka!"
4179 else
4180         dflt=''
4181         rp="No dice.  I can't find a C preprocessor.  Name one:"
4182         . ./myread
4183         x_cpp="$ans"
4184         x_minus=''
4185         $x_cpp <testcpp.c >testcpp.out 2>&1
4186         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4187                 echo "OK, that will do." >&4
4188         else
4189 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4190                 exit 1
4191         fi
4192 fi
4193
4194 case "$ok" in
4195 false)
4196         cppstdin="$x_cpp"
4197         cppminus="$x_minus"
4198         cpprun="$x_cpp"
4199         cpplast="$x_minus"
4200         set X $x_cpp
4201         shift
4202         case "$1" in
4203         "$cpp")
4204                 echo "Perhaps can we force $cc -E using a wrapper..."
4205                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4206                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4207                 then
4208                         echo "Yup, we can."
4209                         cppstdin="$wrapper"
4210                         cppminus='';
4211                 else
4212                         echo "Nope, we'll have to live without it..."
4213                 fi
4214                 ;;
4215         esac
4216         case "$cpprun" in
4217         "$wrapper")
4218                 cpprun=''
4219                 cpplast=''
4220                 ;;
4221         esac
4222         ;;
4223 esac
4224
4225 case "$cppstdin" in
4226 "$wrapper"|'cppstdin') ;;
4227 *) $rm -f $wrapper;;
4228 esac
4229 $rm -f testcpp.c testcpp.out
4230
4231 : Set private lib path
4232 case "$plibpth" in
4233 '') if ./mips; then
4234                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4235         fi;;
4236 esac
4237 case "$libpth" in
4238 ' ') dlist='';;
4239 '') dlist="$loclibpth $plibpth $glibpth";;
4240 *) dlist="$libpth";;
4241 esac
4242
4243 : Now check and see which directories actually exist, avoiding duplicates
4244 libpth=''
4245 for xxx in $dlist
4246 do
4247     if $test -d $xxx; then
4248                 case " $libpth " in
4249                 *" $xxx "*) ;;
4250                 *) libpth="$libpth $xxx";;
4251                 esac
4252     fi
4253 done
4254 $cat <<'EOM'
4255
4256 Some systems have incompatible or broken versions of libraries.  Among
4257 the directories listed in the question below, please remove any you
4258 know not to be holding relevant libraries, and add any that are needed.
4259 Say "none" for none.
4260
4261 EOM
4262 case "$libpth" in
4263 '') dflt='none';;
4264 *)
4265         set X $libpth
4266         shift
4267         dflt=${1+"$@"}
4268         ;;
4269 esac
4270 rp="Directories to use for library searches?"
4271 . ./myread
4272 case "$ans" in
4273 none) libpth=' ';;
4274 *) libpth="$ans";;
4275 esac
4276
4277 : compute shared library extension
4278 case "$so" in
4279 '')
4280         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4281                 dflt='sl'
4282         else
4283                 dflt='so'
4284         fi
4285         ;;
4286 *) dflt="$so";;
4287 esac
4288 $cat <<EOM
4289
4290 On some systems, shared libraries may be available.  Answer 'none' if
4291 you want to suppress searching of shared libraries for the remainder
4292 of this configuration.
4293
4294 EOM
4295 rp='What is the file extension used for shared libraries?'
4296 . ./myread
4297 so="$ans"
4298
4299 : Define several unixisms.
4300 : Hints files or command line option can be used to override them.
4301 : The convoluted testing is in case hints files set either the old
4302 : or the new name.
4303 case "$_exe" in
4304 '')     case "$exe_ext" in
4305         '')     ;;
4306         *)      _exe="$exe_ext" ;;
4307         esac
4308         ;;
4309 esac
4310 case "$_a" in
4311 '')     case "$lib_ext" in
4312     '') _a='.a';;
4313         *)      _a="$lib_ext" ;;
4314         esac
4315         ;;
4316 esac
4317 case "$_o" in
4318 '') case "$obj_ext" in
4319         '')     _o='.o';;
4320         *)      _o="$obj_ext";;
4321         esac
4322         ;;
4323 esac
4324 case "$p_" in
4325 '') case "$path_sep" in
4326         '')     p_=':';;
4327         *)      p_="$path_sep";;
4328         esac
4329         ;;
4330 esac
4331 exe_ext=$_exe
4332 lib_ext=$_a
4333 obj_ext=$_o
4334 path_sep=$p_
4335
4336 : Which makefile gets called first.  This is used by make depend.
4337 case "$firstmakefile" in
4338 '') firstmakefile='makefile';;
4339 esac
4340
4341 case "$usesocks" in
4342 $define|true|[yY]*)     dflt='y';;
4343 *) dflt='n';;
4344 esac
4345 cat <<EOM
4346
4347 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4348 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4349 to use the PerlIO abstraction layer, this will be implicitly selected.
4350
4351 If this doesn't make any sense to you, just accept the default '$dflt'.
4352 EOM
4353 rp='Build Perl for SOCKS?'
4354 . ./myread
4355 case "$ans" in
4356 y|Y)    val="$define" ;;     
4357 *)      val="$undef" ;;
4358 esac
4359 set usesocks
4360 eval $setvar
4361
4362 case "$usesocks" in
4363 $define|true|[yY]*) useperlio="$define";;
4364 esac
4365
4366 : Looking for optional libraries
4367 echo " "
4368 echo "Checking for optional libraries..." >&4
4369 case "$libs" in
4370 ' '|'') dflt='';;
4371 *) dflt="$libs";;
4372 esac
4373 case "$libswanted" in
4374 '') libswanted='c_s';;
4375 esac
4376 case "$usesocks" in
4377 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4378 esac
4379 libsfound=''
4380 libsfiles=''
4381 libsdirs=''
4382 libspath=''
4383 for thisdir in $libpth $xlibpth; do
4384   test -d $thisdir && libspath="$libspath $thisdir"
4385 done
4386 for thislib in $libswanted; do
4387         for thisdir in $libspath; do
4388             xxx=''
4389             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4390                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4391                 $test -f "$xxx" && eval $libscheck
4392                 $test -f "$xxx" && libstyle=shared
4393             fi
4394             if test ! -f "$xxx"; then
4395                 xxx=$thisdir/lib$thislib.$so
4396                 $test -f "$xxx" && eval $libscheck
4397                 $test -f "$xxx" && libstyle=shared
4398             fi  
4399             if test ! -f "$xxx"; then
4400                 xxx=$thisdir/lib$thislib$_a
4401                 $test -f "$xxx" && eval $libscheck
4402                 $test -f "$xxx" && libstyle=static
4403             fi
4404             if test ! -f "$xxx"; then
4405                 xxx=$thisdir/$thislib$_a
4406                 $test -f "$xxx" && eval $libscheck
4407                 $test -f "$xxx" && libstyle=static
4408             fi
4409             if test ! -f "$xxx"; then
4410                 xxx=$thisdir/lib${thislib}_s$_a
4411                 $test -f "$xxx" && eval $libscheck
4412                 $test -f "$xxx" && libstyle=static
4413                 $test -f "$xxx" && thislib=${thislib}_s
4414             fi
4415             if test ! -f "$xxx"; then
4416                 xxx=$thisdir/Slib$thislib$_a
4417                 $test -f "$xxx" && eval $libscheck
4418                 $test -f "$xxx" && libstyle=static
4419             fi
4420             if $test -f "$xxx"; then
4421                 case "$libstyle" in
4422                 shared) echo "Found -l$thislib (shared)." ;;
4423                 static) echo "Found -l$thislib." ;;
4424                 *)      echo "Found -l$thislib ($libstyle)." ;;
4425                 esac
4426                 case " $dflt " in
4427                 *"-l$thislib "*);;
4428                 *) dflt="$dflt -l$thislib"
4429                    libsfound="$libsfound $xxx"
4430                    yyy=`basename $xxx`
4431                    libsfiles="$libsfiles $yyy"
4432                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4433                    case " $libsdirs " in
4434                    *" $yyy "*) ;;
4435                    *) libsdirs="$libsdirs $yyy" ;;
4436                    esac
4437                    ;;
4438                 esac
4439                 break
4440             fi  
4441         done
4442         if $test ! -f "$xxx"; then
4443             echo "No -l$thislib."
4444         fi
4445 done
4446 set X $dflt
4447 shift
4448 dflt="$*"
4449 case "$libs" in
4450 '') dflt="$dflt";;
4451 *) dflt="$libs";;
4452 esac
4453 case "$dflt" in
4454 ' '|'') dflt='none';;
4455 esac
4456
4457 $cat <<EOM
4458
4459 In order to compile $package on your machine, a number of libraries
4460 are usually needed.  Include any other special libraries here as well.
4461 Say "none" for none.  The default list is almost always right.
4462 EOM
4463
4464 echo " "
4465 rp="What libraries to use?"
4466 . ./myread
4467 case "$ans" in
4468 none) libs=' ';;
4469 *) libs="$ans";;
4470 esac
4471
4472 : determine optimization, if desired, or use for debug flag also
4473 case "$optimize" in
4474 ' '|$undef) dflt='none';;
4475 '') dflt='-O';;
4476 *) dflt="$optimize";;
4477 esac
4478 $cat <<EOH
4479
4480 By default, $package compiles with the -O flag to use the optimizer.
4481 Alternately, you might want to use the symbolic debugger, which uses
4482 the -g flag (on traditional Unix systems).  Either flag can be
4483 specified here.  To use neither flag, specify the word "none".
4484
4485 EOH
4486 rp="What optimizer/debugger flag should be used?"
4487 . ./myread
4488 optimize="$ans"
4489 case "$optimize" in
4490 'none') optimize=" ";;
4491 esac
4492
4493 dflt=''
4494 : We will not override a previous value, but we might want to
4495 : augment a hint file
4496 case "$hint" in
4497 default|recommended)
4498         case "$gccversion" in
4499         1*) dflt='-fpcc-struct-return' ;;
4500         esac
4501         case "$optimize" in
4502         *-g*) dflt="$dflt -DDEBUGGING";;
4503         esac
4504         case "$gccversion" in
4505         2*) if test -d /etc/conf/kconfig.d &&
4506                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4507                 then
4508                         dflt="$dflt -posix"
4509                 fi
4510                 ;;
4511         esac
4512         case "$gccversion" in
4513         1*) ;;
4514         2.[0-8]*) ;;
4515         ?*)     echo " "
4516                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4517                 echo 'int main(void) { return 0; }' > gcctest.c
4518                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4519                         echo "Yes, it does." 2>&1
4520                         case "$ccflags" in
4521                         *strict-aliasing*) 
4522                                 echo "Leaving current flags $ccflags alone." 2>&1
4523                                 ;;
4524                         *) dflt="$dflt -fno-strict-aliasing" ;;
4525                         esac
4526                 else
4527                         echo "Nope, it doesn't, but that's ok." 2>&1
4528                 fi
4529                 ;;
4530         esac
4531         ;;
4532 esac
4533
4534 case "$mips_type" in
4535 *BSD*|'') inclwanted="$locincpth $usrinc";;
4536 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4537 esac
4538 for thisincl in $inclwanted; do
4539         if $test -d $thisincl; then
4540                 if $test x$thisincl != x$usrinc; then
4541                         case "$dflt" in
4542                         *" -I$thisincl "*);;
4543                         *) dflt="$dflt -I$thisincl ";;
4544                         esac
4545                 fi
4546         fi
4547 done
4548
4549 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4550         xxx=true;
4551 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4552         xxx=true;
4553 else
4554         xxx=false;
4555 fi;
4556 if $xxx; then
4557         case "$dflt" in
4558         *$2*);;
4559         *) dflt="$dflt -D$2";;
4560         esac;
4561 fi'
4562
4563 set signal.h LANGUAGE_C; eval $inctest
4564
4565 case "$usesocks" in
4566 $define)
4567         ccflags="$ccflags -DSOCKS"
4568         ;;
4569 esac
4570
4571 case "$hint" in
4572 default|recommended) dflt="$ccflags $dflt" ;;
4573 *) dflt="$ccflags";;
4574 esac
4575
4576 case "$dflt" in
4577 ''|' ') dflt=none;;
4578 esac
4579
4580 $cat <<EOH
4581
4582 Your C compiler may want other flags.  For this question you should include
4583 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4584 but you should NOT include libraries or ld flags like -lwhatever.  If you
4585 want $package to honor its debug switch, you should include -DDEBUGGING here.
4586 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4587
4588 To use no flags, specify the word "none".
4589
4590 EOH
4591 set X $dflt
4592 shift
4593 dflt=${1+"$@"}
4594 rp="Any additional cc flags?"
4595 . ./myread
4596 case "$ans" in
4597 none) ccflags='';;
4598 *) ccflags="$ans";;
4599 esac
4600
4601 : the following weeds options from ccflags that are of no interest to cpp
4602 case "$cppflags" in
4603 '') cppflags="$ccflags" ;;
4604 *)  cppflags="$cppflags $ccflags" ;;
4605 esac
4606 case "$gccversion" in
4607 1*) cppflags="$cppflags -D__GNUC__"
4608 esac
4609 case "$mips_type" in
4610 '');;
4611 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4612 esac
4613 case "$cppflags" in
4614 '');;
4615 *)
4616         echo " "
4617         echo "Let me guess what the preprocessor flags are..." >&4
4618         set X $cppflags
4619         shift
4620         cppflags=''
4621         $cat >cpp.c <<'EOM'
4622 #define BLURFL foo
4623
4624 BLURFL xx LFRULB
4625 EOM
4626         previous=''
4627         for flag in $*
4628         do
4629                 case "$flag" in
4630                 -*) ftry="$flag";;
4631                 *) ftry="$previous $flag";;
4632                 esac
4633                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4634                         >cpp1.out 2>/dev/null && \
4635                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4636                         >cpp2.out 2>/dev/null && \
4637                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4638                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4639                 then
4640                         cppflags="$cppflags $ftry"
4641                         previous=''
4642                 else
4643                         previous="$flag"
4644                 fi
4645         done
4646         set X $cppflags
4647         shift
4648         cppflags=${1+"$@"}
4649         case "$cppflags" in
4650         *-*)  echo "They appear to be: $cppflags";;
4651         esac
4652         $rm -f cpp.c cpp?.out
4653         ;;
4654 esac
4655
4656 : flags used in final linking phase
4657 case "$ldflags" in
4658 '') if ./venix; then
4659                 dflt='-i -z'
4660         else
4661                 dflt=''
4662         fi
4663         case "$ccflags" in
4664         *-posix*) dflt="$dflt -posix" ;;
4665         esac
4666         ;;
4667 *) dflt="$ldflags";;
4668 esac
4669
4670 : Try to guess additional flags to pick up local libraries.
4671 for thislibdir in $libpth; do
4672         case " $loclibpth " in
4673         *" $thislibdir "*)
4674                 case "$dflt " in 
4675                 *"-L$thislibdir "*) ;;
4676                 *)  dflt="$dflt -L$thislibdir" ;;
4677                 esac
4678                 ;;
4679         esac
4680 done
4681
4682 case "$dflt" in
4683 '') dflt='none' ;;
4684 esac
4685
4686 $cat <<EOH
4687
4688 Your C linker may need flags.  For this question you should
4689 include -L/whatever and any other flags used by the C linker, but you
4690 should NOT include libraries like -lwhatever.
4691
4692 Make sure you include the appropriate -L/path flags if your C linker
4693 does not normally search all of the directories you specified above,
4694 namely
4695         $libpth
4696 To use no flags, specify the word "none".
4697
4698 EOH
4699
4700 rp="Any additional ld flags (NOT including libraries)?"
4701 . ./myread
4702 case "$ans" in
4703 none) ldflags='';;
4704 *) ldflags="$ans";;
4705 esac
4706 rmlist="$rmlist pdp11"
4707
4708 : coherency check
4709 echo " "
4710 echo "Checking your choice of C compiler and flags for coherency..." >&4
4711 $cat > try.c <<'EOF'
4712 #include <stdio.h>
4713 int main() { printf("Ok\n"); exit(0); }
4714 EOF
4715 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4716 shift
4717 $cat >try.msg <<'EOM'
4718 I've tried to compile and run the following simple program:
4719
4720 EOM
4721 $cat try.c >> try.msg
4722
4723 $cat >> try.msg <<EOM
4724
4725 I used the command:
4726
4727         $*
4728         $run ./try
4729
4730 and I got the following output:
4731
4732 EOM
4733 dflt=y
4734 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4735         if $sh -c "$run ./try" >>try.msg 2>&1; then
4736                 xxx=`$run ./try`
4737                 case "$xxx" in
4738                 "Ok") dflt=n ;;
4739                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4740                         case " $libs " in
4741                         *" -lsfio "*)
4742                                 cat >> try.msg <<'EOQS'
4743 If $libs contains -lsfio, and sfio is mis-configured, then it
4744 sometimes (apparently) runs and exits with a 0 status, but with no
4745 output!  It may have to do with sfio's use of _exit vs. exit.
4746
4747 EOQS
4748                                 rp="You have a big problem.  Shall I abort Configure"
4749                                 dflt=y
4750                                 ;;
4751                         esac
4752                         ;;
4753                 esac
4754         else
4755                 echo "The program compiled OK, but exited with status $?." >>try.msg
4756                 rp="You have a problem.  Shall I abort Configure"
4757                 dflt=y
4758         fi
4759 else
4760         echo "I can't compile the test program." >>try.msg
4761         rp="You have a BIG problem.  Shall I abort Configure"
4762         dflt=y
4763 fi
4764 case "$dflt" in
4765 y)
4766         $cat try.msg >&4
4767         case "$knowitall" in
4768         '')
4769                 echo "(The supplied flags or libraries might be incorrect.)"
4770                 ;;
4771         *) dflt=n;;
4772         esac
4773         echo " "
4774         . ./myread
4775         case "$ans" in
4776         n*|N*) ;;
4777         *)      echo "Ok.  Stopping Configure." >&4
4778                 exit 1
4779                 ;;
4780         esac
4781         ;;
4782 n) echo "OK, that should do.";;
4783 esac
4784 $rm -f try try.* core
4785
4786 : define a shorthand compile call
4787 compile='
4788 mc_file=$1;
4789 shift;
4790 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4791 : define a shorthand compile call for compilations that should be ok.
4792 compile_ok='
4793 mc_file=$1;
4794 shift;
4795 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4796
4797 : check for lengths of integral types
4798 echo " "
4799 case "$intsize" in
4800 '')
4801         echo "Checking to see how big your integers are..." >&4
4802         $cat >try.c <<'EOCP'
4803 #include <stdio.h>
4804 int main()
4805 {
4806         printf("intsize=%d;\n", (int)sizeof(int));
4807         printf("longsize=%d;\n", (int)sizeof(long));
4808         printf("shortsize=%d;\n", (int)sizeof(short));
4809         exit(0);
4810 }
4811 EOCP
4812         set try
4813         if eval $compile_ok && $run ./try > /dev/null; then
4814                 eval `$run ./try`
4815                 echo "Your integers are $intsize bytes long."
4816                 echo "Your long integers are $longsize bytes long."
4817                 echo "Your short integers are $shortsize bytes long."
4818         else
4819                 $cat >&4 <<EOM
4820 !
4821 Help! I can't compile and run the intsize test program: please enlighten me!
4822 (This is probably a misconfiguration in your system or libraries, and
4823 you really ought to fix it.  Still, I'll try anyway.)
4824 !
4825 EOM
4826                 dflt=4
4827                 rp="What is the size of an integer (in bytes)?"
4828                 . ./myread
4829                 intsize="$ans"
4830                 dflt=$intsize
4831                 rp="What is the size of a long integer (in bytes)?"
4832                 . ./myread
4833                 longsize="$ans"
4834                 dflt=2
4835                 rp="What is the size of a short integer (in bytes)?"
4836                 . ./myread
4837                 shortsize="$ans"
4838         fi
4839         ;;
4840 esac
4841 $rm -f try try.*
4842
4843 : check for void type
4844 echo " "
4845 echo "Checking to see how well your C compiler groks the void type..." >&4
4846 case "$voidflags" in
4847 '')
4848         $cat >try.c <<'EOCP'
4849 #if TRY & 1
4850 void sub() {
4851 #else
4852 sub() {
4853 #endif
4854         extern void moo();      /* function returning void */
4855         void (*goo)();          /* ptr to func returning void */
4856 #if TRY & 8
4857         void *hue;              /* generic ptr */
4858 #endif
4859 #if TRY & 2
4860         void (*foo[10])();
4861 #endif
4862
4863 #if TRY & 4
4864         if(goo == moo) {
4865                 exit(0);
4866         }
4867 #endif
4868         exit(0);
4869 }
4870 int main() { sub(); }
4871 EOCP
4872         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4873                 voidflags=$defvoidused
4874         echo "Good.  It appears to support void to the level $package wants.">&4
4875                 if $contains warning .out >/dev/null 2>&1; then
4876                         echo "However, you might get some warnings that look like this:"
4877                         $cat .out
4878                 fi
4879         else
4880 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
4881                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4882                         echo "It supports 1..."
4883                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4884                                 echo "It also supports 2..."
4885                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4886                                         voidflags=7
4887                                         echo "And it supports 4 but not 8 definitely."
4888                                 else
4889                                         echo "It doesn't support 4..."
4890                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4891                                                 voidflags=11
4892                                                 echo "But it supports 8."
4893                                         else
4894                                                 voidflags=3
4895                                                 echo "Neither does it support 8."
4896                                         fi
4897                                 fi
4898                         else
4899                                 echo "It does not support 2..."
4900                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4901                                         voidflags=13
4902                                         echo "But it supports 4 and 8."
4903                                 else
4904                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4905                                                 voidflags=5
4906                                                 echo "And it supports 4 but has not heard about 8."
4907                                         else
4908                                                 echo "However it supports 8 but not 4."
4909                                         fi
4910                                 fi
4911                         fi
4912                 else
4913                         echo "There is no support at all for void."
4914                         voidflags=0
4915                 fi
4916         fi
4917 esac
4918 case "$voidflags" in
4919 "$defvoidused") ;;
4920 *)      $cat >&4 <<'EOM'
4921   Support flag bits are:
4922     1: basic void declarations.
4923     2: arrays of pointers to functions returning void.
4924     4: operations between pointers to and addresses of void functions.
4925     8: generic void pointers.
4926 EOM
4927         dflt="$voidflags";
4928         rp="Your void support flags add up to what?"
4929         . ./myread
4930         voidflags="$ans"
4931         ;;
4932 esac
4933 $rm -f try.* .out
4934
4935 : check for length of pointer
4936 echo " "
4937 case "$ptrsize" in
4938 '')
4939         echo "Checking to see how big your pointers are..." >&4
4940         if test "$voidflags" -gt 7; then
4941                 echo '#define VOID_PTR char *' > try.c
4942         else
4943                 echo '#define VOID_PTR void *' > try.c
4944         fi
4945         $cat >>try.c <<'EOCP'
4946 #include <stdio.h>
4947 int main()
4948 {
4949     printf("%d\n", (int)sizeof(VOID_PTR));
4950     exit(0);
4951 }
4952 EOCP
4953         set try
4954         if eval $compile_ok; then
4955                 ptrsize=`$run ./try`
4956                 echo "Your pointers are $ptrsize bytes long."
4957         else
4958                 dflt='4'
4959                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
4960                 rp="What is the size of a pointer (in bytes)?"
4961                 . ./myread
4962                 ptrsize="$ans"
4963         fi
4964         ;;
4965 esac
4966 $rm -f try.c try
4967
4968 : check for long long
4969 echo " "
4970 echo "Checking to see if you have long long..." >&4
4971 echo 'int main() { long long x = 7; return 0; }' > try.c
4972 set try
4973 if eval $compile; then
4974         val="$define"
4975         echo "You have long long."
4976 else
4977         val="$undef"
4978         echo "You do not have long long."
4979 fi
4980 $rm try.*
4981 set d_longlong
4982 eval $setvar
4983
4984 : check for length of long long
4985 case "${d_longlong}${longlongsize}" in
4986 $define)
4987         echo " "
4988         echo "Checking to see how big your long longs are..." >&4
4989         $cat >try.c <<'EOCP'
4990 #include <stdio.h>
4991 int main()
4992 {
4993     printf("%d\n", (int)sizeof(long long));
4994     return(0);
4995 }
4996 EOCP
4997         set try
4998         if eval $compile_ok; then
4999                 longlongsize=`$run ./try`
5000                 echo "Your long longs are $longlongsize bytes long."
5001         else
5002                 dflt='8'
5003                 echo " "
5004                 echo "(I can't seem to compile the test program.  Guessing...)"
5005                 rp="What is the size of a long long (in bytes)?"
5006                 . ./myread
5007                 longlongsize="$ans"
5008         fi
5009         if $test "X$longsize" = "X$longlongsize"; then
5010                 echo "(That isn't any different from an ordinary long.)"
5011         fi      
5012         ;;
5013 esac
5014 $rm -f try.* try
5015
5016 : determine filename position in cpp output
5017 echo " "
5018 echo "Computing filename position in cpp output for #include directives..." >&4
5019 case "$osname" in
5020 vos) testaccess=-e ;;
5021 *)   testaccess=-r ;;
5022 esac
5023 echo '#include <stdio.h>' > foo.c
5024 $cat >fieldn <<EOF
5025 $startsh
5026 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5027 $grep '^[       ]*#.*stdio\.h' | \
5028 while read cline; do
5029         pos=1
5030         set \$cline
5031         while $test \$# -gt 0; do
5032                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5033                         echo "\$pos"
5034                         exit 0
5035                 fi
5036                 shift
5037                 pos=\`expr \$pos + 1\`
5038         done
5039 done
5040 EOF
5041 chmod +x fieldn
5042 fieldn=`./fieldn`
5043 $rm -f foo.c fieldn
5044 case $fieldn in
5045 '') pos='???';;
5046 1) pos=first;;
5047 2) pos=second;;
5048 3) pos=third;;
5049 *) pos="${fieldn}th";;
5050 esac
5051 echo "Your cpp writes the filename in the $pos field of the line."
5052
5053 case "$osname" in
5054 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5055 *)   cppfilter='' ;;
5056 esac
5057 : locate header file
5058 $cat >findhdr <<EOF
5059 $startsh
5060 wanted=\$1
5061 name=''
5062 for usrincdir in $usrinc
5063 do
5064         if test -f \$usrincdir/\$wanted; then
5065                 echo "\$usrincdir/\$wanted"
5066                 exit 0
5067         fi
5068 done
5069 awkprg='{ print \$$fieldn }'
5070 echo "#include <\$wanted>" > foo\$\$.c
5071 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5072 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5073 while read cline; do
5074         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5075         case "\$name" in
5076         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5077         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5078         *) exit 2;;
5079         esac;
5080 done;
5081 #
5082 # status = 0: grep returned 0 lines, case statement not executed
5083 # status = 1: headerfile found
5084 # status = 2: while loop executed, no headerfile found
5085 #
5086 status=\$?
5087 $rm -f foo\$\$.c;
5088 if test \$status -eq 1; then
5089         exit 0;
5090 fi
5091 exit 1
5092 EOF
5093 chmod +x findhdr
5094
5095 : define an alternate in-header-list? function
5096 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5097 cont=true; xxf="echo \"<\$1> found.\" >&4";
5098 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5099 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5100 esac;
5101 case $# in 4) instead=instead;; *) instead="at last";; esac;
5102 while $test "$cont"; do
5103         xxx=`./findhdr $1`
5104         var=$2; eval "was=\$$2";
5105         if $test "$xxx" && $test -r "$xxx";
5106         then eval $xxf;
5107         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5108                 cont="";
5109         else eval $xxnf;
5110         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5111         set $yyy; shift; shift; yyy=$@;
5112         case $# in 0) cont="";;
5113         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5114                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5115         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5116                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5117         esac;
5118 done;
5119 while $test "$yyy";
5120 do set $yyy; var=$2; eval "was=\$$2";
5121         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5122         set $yyy; shift; shift; yyy=$@;
5123 done'
5124
5125 : see if inttypes.h is available
5126 : we want a real compile instead of Inhdr because some systems
5127 : have an inttypes.h which includes non-existent headers
5128 echo " "
5129 $cat >try.c <<EOCP
5130 #include <inttypes.h>
5131 int main() {
5132         static int32_t foo32 = 0x12345678;
5133 }
5134 EOCP
5135 set try
5136 if eval $compile; then
5137         echo "<inttypes.h> found." >&4
5138         val="$define"
5139 else
5140         echo "<inttypes.h> NOT found." >&4
5141         val="$undef"
5142 fi
5143 $rm -f try.c try
5144 set i_inttypes
5145 eval $setvar
5146
5147 : check for int64_t
5148 echo " "
5149 echo "Checking to see if you have int64_t..." >&4
5150 $cat >try.c <<EOCP
5151 #include <sys/types.h>
5152 #$i_inttypes I_INTTYPES
5153 #ifdef I_INTTYPES
5154 #include <inttypes.h>
5155 #endif
5156 int main() { int64_t x = 7; }
5157 EOCP
5158 set try
5159 if eval $compile; then
5160         val="$define"
5161         echo "You have int64_t."
5162 else
5163         val="$undef"
5164         echo "You do not have int64_t."
5165 fi
5166 $rm -f try try.*
5167 set d_int64_t
5168 eval $setvar
5169
5170
5171 echo " "
5172 echo "Checking which 64-bit integer type we could use..." >&4
5173
5174 case "$intsize" in
5175 8) val=int
5176    set quadtype
5177    eval $setvar
5178    val='"unsigned int"'
5179    set uquadtype
5180    eval $setvar
5181    quadkind=1
5182    ;;
5183 *) case "$longsize" in
5184    8) val=long
5185       set quadtype
5186       eval $setvar
5187       val='"unsigned long"'
5188       set uquadtype
5189       eval $setvar
5190       quadkind=2
5191       ;;
5192    *) case "$d_longlong:$longlongsize" in
5193       define:8)
5194         val='"long long"'
5195         set quadtype
5196         eval $setvar
5197         val='"unsigned long long"'
5198         set uquadtype
5199         eval $setvar
5200         quadkind=3
5201         ;;
5202       *) case "$d_int64_t" in
5203          define)
5204            val=int64_t
5205            set quadtype
5206            eval $setvar
5207            val=uint64_t
5208            set uquadtype
5209            eval $setvar
5210            quadkind=4
5211            ;;
5212          esac
5213          ;;
5214       esac
5215       ;;
5216    esac
5217    ;;
5218 esac
5219
5220 case "$quadtype" in
5221 '')     echo "Alas, no 64-bit integer types in sight." >&4
5222         d_quad="$undef"
5223         ;;
5224 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5225         d_quad="$define"
5226         ;;
5227 esac
5228
5229
5230 case "$uselonglong" in
5231 "$define"|true|[yY]*)
5232         cat <<EOM >&4
5233
5234 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5235 EOM
5236         use64bitint="$define"
5237         ;;
5238 esac                          
5239 case "$use64bits" in
5240 "$define"|true|[yY]*)
5241         cat <<EOM >&4
5242
5243 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5244 EOM
5245         use64bitint="$define"
5246         ;;
5247 esac                          
5248 case "$use64bitints" in
5249 "$define"|true|[yY]*)
5250         cat <<EOM >&4
5251
5252 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5253 EOM
5254         use64bitint="$define"
5255         ;;
5256 esac                          
5257 case "$use64bitsint" in
5258 "$define"|true|[yY]*)
5259         cat <<EOM >&4
5260
5261 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5262 EOM
5263         use64bitint="$define"
5264         ;;
5265 esac                          
5266 case "$uselonglongs" in
5267 "$define"|true|[yY]*)
5268         cat <<EOM >&4
5269
5270 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5271 EOM
5272         use64bitint="$define"
5273         ;;
5274 esac                          
5275 case "$use64bitsall" in
5276 "$define"|true|[yY]*)
5277         cat <<EOM >&4
5278
5279 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5280 EOM
5281         use64bitall="$define"
5282         ;;
5283 esac                          
5284
5285 case "$ccflags" in
5286 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5287 esac
5288 case "$use64bitall" in
5289 "$define"|true|[yY]*) use64bitint="$define" ;;
5290 esac
5291
5292 case "$longsize" in
5293 8) cat <<EOM
5294
5295 You have natively 64-bit long integers.
5296 EOM
5297    val="$define"
5298    ;;
5299 *) case "$use64bitint" in
5300    "$define"|true|[yY]*) dflt='y';;
5301    *) dflt='n';;
5302    esac
5303    case "$d_quad" in
5304    "$define") ;;
5305    *) dflt='n' ;;
5306    esac
5307    cat <<EOM
5308
5309 Perl can be built to take advantage of 64-bit integer types
5310 on some systems.  To do so, Configure can be run with -Duse64bitint.
5311 Choosing this option will most probably introduce binary incompatibilities.
5312
5313 If this doesn't make any sense to you, just accept the default '$dflt'.
5314 (The default has been chosen based on your configuration.)
5315 EOM
5316    rp='Try to use 64-bit integers, if available?'
5317    . ./myread
5318    case "$ans" in
5319    [yY]*) val="$define" ;;
5320    *)     val="$undef"  ;;
5321    esac
5322    ;;
5323 esac
5324 set use64bitint
5325 eval $setvar
5326
5327 case "$use64bitall" in
5328 "$define"|true|[yY]*) dflt='y' ;;
5329 *) case "$longsize" in
5330    8) dflt='y' ;;
5331    *) dflt='n' ;;
5332    esac
5333    ;;
5334 esac    
5335 cat <<EOM
5336
5337 You may also choose to try maximal 64-bitness.  It means using as much
5338 64-bitness as possible on the platform.  This in turn means even more
5339 binary incompatibilities.  On the other hand, your platform may not
5340 have any more 64-bitness available than what you already have chosen.
5341
5342 If this doesn't make any sense to you, just accept the default '$dflt'.
5343 (The default has been chosen based on your configuration.)
5344 EOM
5345 rp='Try to use maximal 64-bit support, if available?'
5346 . ./myread
5347 case "$ans" in
5348 [yY]*) val="$define" ;;
5349 *)     val="$undef"  ;;
5350 esac
5351 set use64bitall
5352 eval $setvar
5353 case "$use64bitall" in
5354 "$define")
5355         case "$use64bitint" in
5356         "$undef")
5357                 cat <<EOM
5358
5359 Since you have chosen a maximally 64-bit build, I'm also turning on
5360 the use of 64-bit integers.
5361 EOM
5362                 use64bitint="$define" ;;
5363         esac
5364         ;;
5365 esac
5366
5367 case "$use64bitall" in
5368 "$define"|true|[yY]*)
5369         case "$ptrsize" in
5370         4)      cat <<EOM >&4
5371
5372 *** You have chosen a maximally 64-bit build, but your pointers
5373 *** are only 4 bytes wide, disabling maximal 64-bitness.
5374
5375 EOM
5376                 use64bitall="$undef"
5377                 case "$use64bitint" in
5378                 "$define"|true|[yY]*) ;;
5379                 *)      cat <<EOM >&4
5380
5381 *** Downgrading from maximal 64-bitness to using 64-bit integers.
5382
5383 EOM
5384                         use64bitint="$define"
5385                         ;;
5386                 esac
5387                 ;;
5388         esac
5389         ;;
5390 esac
5391
5392 case "$use64bitint" in
5393 "$define"|true|[yY]*)
5394 : Look for a hint-file generated 'call-back-unit'.  If the
5395 : user has specified that a 64-bit perl is to be built,
5396 : we may need to set or change some other defaults.
5397         if $test -f use64bitint.cbu; then
5398                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5399                 . ./use64bitint.cbu
5400         fi
5401         case "$longsize" in
5402         4) case "$archname64" in
5403            '') archname64=64int ;;
5404            esac
5405            ;;
5406         esac
5407         ;;
5408 esac
5409
5410 case "$use64bitall" in
5411 "$define"|true|[yY]*)
5412 : Look for a hint-file generated 'call-back-unit'.  If the
5413 : user has specified that a maximally 64-bit perl is to be built,
5414 : we may need to set or change some other defaults.
5415         if $test -f use64bitall.cbu; then
5416                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5417                 . ./use64bitall.cbu
5418         fi
5419         case "$longsize" in
5420         4) case "$archname64" in
5421            ''|64int) archname64=64all ;;
5422            esac
5423            ;;
5424         esac
5425         ;;
5426 esac
5427
5428 echo " "
5429 echo "Checking for GNU C Library..." >&4
5430 cat >try.c <<EOM
5431 #include <stdio.h>
5432 int main()
5433 {
5434 #ifdef __GLIBC__
5435     exit(0);
5436 #else
5437     exit(1);
5438 #endif
5439 }
5440 EOM
5441 set try
5442 if eval $compile_ok && $run ./try; then
5443         val="$define"
5444         echo "You are using the GNU C Library"
5445 else
5446         val="$undef"
5447         echo "You are not using the GNU C Library"
5448 fi
5449 $rm -f try try.*
5450 set d_gnulibc
5451 eval $setvar
5452
5453 : see if nm is to be used to determine whether a symbol is defined or not
5454 case "$usenm" in
5455 '')
5456         dflt=''
5457         case "$d_gnulibc" in
5458         "$define")
5459                 echo " "
5460                 echo "nm probably won't work on the GNU C Library." >&4
5461                 dflt=n
5462                 ;;
5463         esac
5464         case "$dflt" in
5465         '') 
5466                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5467                         echo " "
5468                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5469                         echo "'nm' won't be sufficient on this sytem." >&4
5470                         dflt=n
5471                 fi
5472                 ;;
5473         esac
5474         case "$dflt" in
5475         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5476                 if $test $dflt -gt 20; then
5477                         dflt=y
5478                 else
5479                         dflt=n
5480                 fi
5481                 ;;
5482         esac
5483         ;;
5484 *)
5485         case "$usenm" in
5486         true|$define) dflt=y;;
5487         *) dflt=n;;
5488         esac
5489         ;;
5490 esac
5491 $cat <<EOM
5492
5493 I can use $nm to extract the symbols from your C libraries. This
5494 is a time consuming task which may generate huge output on the disk (up
5495 to 3 megabytes) but that should make the symbols extraction faster. The
5496 alternative is to skip the 'nm' extraction part and to compile a small
5497 test program instead to determine whether each symbol is present. If
5498 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5499 this may be the best solution.
5500
5501 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5502
5503 EOM
5504 rp="Shall I use $nm to extract C symbols from the libraries?"
5505 . ./myread
5506 case "$ans" in
5507 [Nn]*) usenm=false;;
5508 *) usenm=true;;
5509 esac
5510
5511 runnm=$usenm
5512 case "$reuseval" in
5513 true) runnm=false;;
5514 esac
5515
5516 : nm options which may be necessary
5517 case "$nm_opt" in
5518 '') if $test -f /mach_boot; then
5519                 nm_opt=''       # Mach
5520         elif $test -d /usr/ccs/lib; then
5521                 nm_opt='-p'     # Solaris (and SunOS?)
5522         elif $test -f /dgux; then
5523                 nm_opt='-p'     # DG-UX
5524         elif $test -f /lib64/rld; then
5525                 nm_opt='-p'     # 64-bit Irix
5526         else
5527                 nm_opt=''
5528         fi;;
5529 esac
5530
5531 : nm options which may be necessary for shared libraries but illegal
5532 : for archive libraries.  Thank you, Linux.
5533 case "$nm_so_opt" in
5534 '')     case "$myuname" in
5535         *linux*)
5536                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5537                         nm_so_opt='--dynamic'
5538                 fi
5539                 ;;
5540         esac
5541         ;;
5542 esac
5543
5544 case "$runnm" in
5545 true)
5546 : get list of predefined functions in a handy place
5547 echo " "
5548 case "$libc" in
5549 '') libc=unknown
5550         case "$libs" in
5551         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5552         esac
5553         ;;
5554 esac
5555 case "$libs" in
5556 '') ;;
5557 *)  for thislib in $libs; do
5558         case "$thislib" in
5559         -lc|-lc_s)
5560                 : Handle C library specially below.
5561                 ;;
5562         -l*)
5563                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5564                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5565                         :
5566                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5567                         :
5568                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5569                         :
5570                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5571                         :
5572                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5573                         :
5574                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5575                         :
5576                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5577                         :
5578                 else
5579                         try=''
5580                 fi
5581                 libnames="$libnames $try"
5582                 ;;
5583         *) libnames="$libnames $thislib" ;;
5584         esac
5585         done
5586         ;;
5587 esac
5588 xxx=normal
5589 case "$libc" in
5590 unknown)
5591         set /lib/libc.$so
5592         for xxx in $libpth; do
5593                 $test -r $1 || set $xxx/libc.$so
5594                 : The messy sed command sorts on library version numbers.
5595                 $test -r $1 || \
5596                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5597                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5598                                 h
5599                                 s/[0-9][0-9]*/0000&/g
5600                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5601                                 G
5602                                 s/\n/ /' | \
5603                          $sort | $sed -e 's/^.* //'`
5604                 eval set \$$#
5605         done
5606         $test -r $1 || set /usr/ccs/lib/libc.$so
5607         $test -r $1 || set /lib/libsys_s$_a
5608         ;;
5609 *)
5610         set blurfl
5611         ;;
5612 esac
5613 if $test -r "$1"; then
5614         echo "Your (shared) C library seems to be in $1."
5615         libc="$1"
5616 elif $test -r /lib/libc && $test -r /lib/clib; then
5617         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5618         xxx=apollo
5619         libc='/lib/clib /lib/libc'
5620         if $test -r /lib/syslib; then
5621                 echo "(Your math library is in /lib/syslib.)"
5622                 libc="$libc /lib/syslib"
5623         fi
5624 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5625         echo "Your C library seems to be in $libc, as you said before."
5626 elif $test -r $incpath/usr/lib/libc$_a; then
5627         libc=$incpath/usr/lib/libc$_a;
5628         echo "Your C library seems to be in $libc.  That's fine."
5629 elif $test -r /lib/libc$_a; then
5630         libc=/lib/libc$_a;
5631         echo "Your C library seems to be in $libc.  You're normal."
5632 else
5633         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5634                 :
5635         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5636                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5637         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5638                 :
5639         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5640                 :
5641         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5642                 :
5643         else
5644                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5645         fi
5646         if $test -r "$tans"; then
5647                 echo "Your C library seems to be in $tans, of all places."
5648                 libc=$tans
5649         else
5650                 libc='blurfl'
5651         fi
5652 fi
5653 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5654         dflt="$libc"
5655         cat <<EOM
5656
5657 If the guess above is wrong (which it might be if you're using a strange
5658 compiler, or your machine supports multiple models), you can override it here.
5659
5660 EOM
5661 else
5662         dflt=''
5663         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5664         cat >&4 <<EOM
5665 I can't seem to find your C library.  I've looked in the following places:
5666
5667 EOM
5668         $sed 's/^/      /' libpath
5669         cat <<EOM
5670
5671 None of these seems to contain your C library. I need to get its name...
5672
5673 EOM
5674 fi
5675 fn=f
5676 rp='Where is your C library?'
5677 . ./getfile
5678 libc="$ans"
5679
5680 echo " "
5681 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5682 set X `cat libnames`
5683 shift
5684 xxx=files
5685 case $# in 1) xxx=file; esac
5686 echo "Extracting names from the following $xxx for later perusal:" >&4
5687 echo " "
5688 $sed 's/^/      /' libnames >&4
5689 echo " "
5690 $echo $n "This may take a while...$c" >&4
5691
5692 for file in $*; do
5693         case $file in
5694         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5695         *) $nm $nm_opt $file 2>/dev/null;;
5696         esac
5697 done >libc.tmp
5698
5699 $echo $n ".$c"
5700 $grep fprintf libc.tmp > libc.ptf
5701 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5702 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
5703 xxx='[ADTSIW]'
5704 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5705         eval $xscan;\
5706         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5707                 eval $xrun
5708 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5709         eval $xscan;\
5710         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5711                 eval $xrun
5712 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5713         eval $xscan;\
5714         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5715                 eval $xrun
5716 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5717         eval $xscan;\
5718         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5719                 eval $xrun
5720 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5721         eval $xscan;\
5722         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5723                 eval $xrun
5724 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5725         eval $xscan;\
5726         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5727                 eval $xrun
5728 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5729                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5730         eval $xscan;\
5731         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5732                 eval $xrun
5733 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5734         eval $xscan;\
5735         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5736                 eval $xrun
5737 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5738         eval $xscan;\
5739         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5740                 eval $xrun
5741 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5742         eval $xscan;\
5743         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5744                 eval $xrun
5745 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5746         eval $xscan;\
5747         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5748                 eval $xrun
5749 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5750         eval $xscan;\
5751         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5752                 eval $xrun
5753 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5754         eval $xscan;\
5755         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5756                 eval $xrun
5757 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5758         eval $xscan;\
5759         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5760                 eval $xrun
5761 else
5762         $nm -p $* 2>/dev/null >libc.tmp
5763         $grep fprintf libc.tmp > libc.ptf
5764         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5765                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5766         then
5767                 nm_opt='-p'
5768                 eval $xrun
5769         else
5770                 echo " "
5771                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5772                 com=''
5773                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5774                         for thisname in $libnames $libc; do
5775                                 $ar t $thisname >>libc.tmp
5776                         done
5777                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5778                         echo "Ok." >&4
5779                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5780                         # Repeat libc to extract forwarders to DLL entries too
5781                         for thisname in $libnames $libc; do
5782                                 $ar tv $thisname >>libc.tmp
5783                                 # Revision 50 of EMX has bug in $ar.
5784                                 # it will not extract forwarders to DLL entries
5785                                 # Use emximp which will extract exactly them.
5786                                 emximp -o tmp.imp $thisname \
5787                                     2>/dev/null && \
5788                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5789                                     < tmp.imp >>libc.tmp
5790                                 $rm tmp.imp
5791                         done
5792                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5793                         echo "Ok." >&4
5794                 else
5795                         echo "$ar didn't seem to work right." >&4
5796                         echo "Maybe this is a Cray...trying bld instead..." >&4
5797                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5798                         then
5799                                 for thisname in $libnames; do
5800                                         bld t $libnames | \
5801                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5802                                         $ar t $thisname >>libc.tmp
5803                                 done
5804                                 echo "Ok." >&4
5805                         else
5806                                 echo "That didn't work either.  Giving up." >&4
5807                                 exit 1
5808                         fi
5809                 fi
5810         fi
5811 fi
5812 nm_extract="$com"
5813 if $test -f /lib/syscalls.exp; then
5814         echo " "
5815         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5816         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
5817 fi
5818 ;;
5819 esac
5820 $rm -f libnames libpath
5821
5822 : is a C symbol defined?
5823 csym='tlook=$1;
5824 case "$3" in
5825 -v) tf=libc.tmp; tc=""; tdc="";;
5826 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5827 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5828 esac;
5829 tx=yes;
5830 case "$reuseval-$4" in
5831 true-) ;;
5832 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5833 esac;
5834 case "$tx" in
5835 yes)
5836         case "$runnm" in
5837         true)
5838                 if $contains $tlook $tf >/dev/null 2>&1;
5839                 then tval=true;
5840                 else tval=false;
5841                 fi;;
5842         *)
5843                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5844                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5845                 then tval=true;
5846                 else tval=false;
5847                 fi;
5848                 $rm -f t t.c;;
5849         esac;;
5850 *)
5851         case "$tval" in
5852         $define) tval=true;;
5853         *) tval=false;;
5854         esac;;
5855 esac;
5856 eval "$2=$tval"'
5857
5858 : define an is-in-libc? function
5859 inlibc='echo " "; td=$define; tu=$undef;
5860 sym=$1; var=$2; eval "was=\$$2";
5861 tx=yes;
5862 case "$reuseval$was" in
5863 true) ;;
5864 true*) tx=no;;
5865 esac;
5866 case "$tx" in
5867 yes)
5868         set $sym tres -f;
5869         eval $csym;
5870         case "$tres" in
5871         true)
5872                 echo "$sym() found." >&4;
5873                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5874         *)
5875                 echo "$sym() NOT found." >&4;
5876                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5877         esac;;
5878 *)
5879         case "$was" in
5880         $define) echo "$sym() found." >&4;;
5881         *) echo "$sym() NOT found." >&4;;
5882         esac;;
5883 esac'
5884
5885 : see if sqrtl exists
5886 set sqrtl d_sqrtl
5887 eval $inlibc
5888
5889 : check for length of double
5890 echo " "
5891 case "$doublesize" in
5892 '')
5893         echo "Checking to see how big your double precision numbers are..." >&4
5894         $cat >try.c <<'EOCP'
5895 #include <stdio.h>
5896 int main()
5897 {
5898     printf("%d\n", (int)sizeof(double));
5899     exit(0);
5900 }
5901 EOCP
5902         set try
5903         if eval $compile_ok; then
5904                 doublesize=`$run ./try`
5905                 echo "Your double is $doublesize bytes long."
5906         else
5907                 dflt='8'
5908                 echo "(I can't seem to compile the test program.  Guessing...)"
5909                 rp="What is the size of a double precision number (in bytes)?"
5910                 . ./myread
5911                 doublesize="$ans"
5912         fi
5913         ;;
5914 esac
5915 $rm -f try.c try
5916
5917 : check for long doubles
5918 echo " "
5919 echo "Checking to see if you have long double..." >&4
5920 echo 'int main() { long double x = 7.0; }' > try.c
5921 set try
5922 if eval $compile; then
5923         val="$define"
5924         echo "You have long double."
5925 else
5926         val="$undef"
5927         echo "You do not have long double."
5928 fi
5929 $rm try.*
5930 set d_longdbl
5931 eval $setvar
5932
5933 : check for length of long double
5934 case "${d_longdbl}${longdblsize}" in
5935 $define)
5936         echo " "
5937         echo "Checking to see how big your long doubles are..." >&4
5938         $cat >try.c <<'EOCP'
5939 #include <stdio.h>
5940 int main()
5941 {
5942         printf("%d\n", sizeof(long double));
5943 }
5944 EOCP
5945         set try
5946         set try
5947         if eval $compile; then
5948                 longdblsize=`$run ./try`
5949                 echo "Your long doubles are $longdblsize bytes long."
5950         else
5951                 dflt='8'
5952                 echo " "
5953                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5954                 rp="What is the size of a long double (in bytes)?"
5955                 . ./myread
5956                 longdblsize="$ans"
5957         fi
5958         if $test "X$doublesize" = "X$longdblsize"; then
5959                 echo "(That isn't any different from an ordinary double.)"
5960         fi      
5961         ;;
5962 esac
5963 $rm -f try.* try
5964
5965 echo " "
5966
5967 if $test X"$d_longdbl" = X"$define"; then
5968
5969 echo "Checking how to print long doubles..." >&4
5970
5971 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
5972         $cat >try.c <<'EOCP'
5973 #include <sys/types.h>
5974 #include <stdio.h>
5975 int main() {
5976   double d = 123.456;
5977   printf("%.3f\n", d);
5978 }
5979 EOCP
5980         set try
5981         if eval $compile; then
5982                 yyy=`$run ./try`
5983                 case "$yyy" in
5984                 123.456)
5985                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
5986                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
5987                         echo "We will use %f."
5988                         ;;
5989                 esac
5990         fi
5991 fi
5992
5993 if $test X"$sPRIfldbl" = X; then
5994         $cat >try.c <<'EOCP'
5995 #include <sys/types.h>
5996 #include <stdio.h>
5997 int main() {
5998   long double d = 123.456;
5999   printf("%.3Lf\n", d);
6000 }
6001 EOCP
6002         set try
6003         if eval $compile; then
6004                 yyy=`$run ./try`
6005                 case "$yyy" in
6006                 123.456)
6007                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
6008                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
6009                         echo "We will use %Lf."
6010                         ;;
6011                 esac
6012         fi
6013 fi
6014
6015 if $test X"$sPRIfldbl" = X; then
6016         $cat >try.c <<'EOCP'
6017 #include <sys/types.h>
6018 #include <stdio.h>
6019 int main() {
6020   long double d = 123.456;
6021   printf("%.3llf\n", d);
6022 }
6023 EOCP
6024         set try
6025         if eval $compile; then
6026                 yyy=`$run ./try`
6027                 case "$yyy" in
6028                 123.456)
6029                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
6030                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
6031                         echo "We will use %llf."
6032                         ;;
6033                 esac
6034         fi
6035 fi
6036
6037 if $test X"$sPRIfldbl" = X; then
6038         $cat >try.c <<'EOCP'
6039 #include <sys/types.h>
6040 #include <stdio.h>
6041 int main() {
6042   long double d = 123.456;
6043   printf("%.3lf\n", d);
6044 }
6045 EOCP
6046         set try
6047         if eval $compile; then
6048                 yyy=`$run ./try`
6049                 case "$yyy" in
6050                 123.456)
6051                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
6052                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
6053                         echo "We will use %lf."
6054                         ;;
6055                 esac
6056         fi
6057 fi
6058
6059 if $test X"$sPRIfldbl" = X; then
6060         echo "Cannot figure out how to print long doubles." >&4
6061 else
6062         sSCNfldbl=$sPRIfldbl    # expect consistency
6063 fi
6064
6065 $rm -f try try.*
6066
6067 fi # d_longdbl
6068
6069 case "$sPRIfldbl" in
6070 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
6071         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
6072         d_SCNfldbl="$undef";
6073         ;;
6074 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
6075         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
6076         d_SCNfldbl="$define";
6077         ;;
6078 esac
6079
6080 : see if modfl exists
6081 set modfl d_modfl
6082 eval $inlibc
6083
6084 d_modfl_pow32_bug="$undef"
6085
6086 case "$d_longdbl$d_modfl" in
6087 $define$define)
6088         $cat <<EOM
6089 Checking to see whether your modfl() is okay for large values...
6090 EOM
6091 $cat >try.c <<EOCP
6092 #include <math.h> 
6093 #include <stdio.h>
6094 int main() {
6095     long double nv = 4294967303.15;
6096     long double v, w;
6097     v = modfl(nv, &w);         
6098 #ifdef __GLIBC__
6099     printf("glibc");
6100 #endif
6101     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
6102     return 0;
6103 }
6104 EOCP
6105         case "$osname:$gccversion" in
6106         aix:)   saveccflags="$ccflags"
6107                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
6108         esac
6109         set try
6110         if eval $compile; then
6111                 foo=`$run ./try`
6112                 case "$foo" in
6113                 *" 4294967303.150000 1.150000 4294967302.000000")
6114                         echo >&4 "Your modfl() is broken for large values."
6115                         d_modfl_pow32_bug="$define"
6116                         case "$foo" in
6117                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
6118                         ;;
6119                         esac
6120                         ;;
6121                 *" 4294967303.150000 0.150000 4294967303.000000")
6122                         echo >&4 "Your modfl() seems okay for large values."
6123                         ;;
6124                 *)      echo >&4 "I don't understand your modfl() at all."
6125                         d_modfl="$undef"
6126                         ;;
6127                 esac
6128                 $rm -f try.* try core core.try.*
6129         else
6130                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
6131                 d_modfl="$undef"
6132         fi
6133         case "$osname:$gccversion" in
6134         aix:)   ccflags="$saveccflags" ;; # restore
6135         esac
6136         ;;
6137 esac
6138
6139 case "$ccflags" in
6140 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6141 esac
6142
6143 case "$uselongdouble" in
6144 $define|true|[yY]*)     dflt='y';;
6145 *) dflt='n';;
6146 esac
6147 cat <<EOM
6148
6149 Perl can be built to take advantage of long doubles which
6150 (if available) may give more accuracy and range for floating point numbers.
6151
6152 If this doesn't make any sense to you, just accept the default '$dflt'.
6153 EOM
6154 rp='Try to use long doubles if available?'
6155 . ./myread
6156 case "$ans" in
6157 y|Y)    val="$define"   ;;
6158 *)      val="$undef"    ;;
6159 esac
6160 set uselongdouble
6161 eval $setvar
6162
6163 case "$uselongdouble" in
6164 true|[yY]*) uselongdouble="$define" ;;
6165 esac
6166
6167 case "$uselongdouble" in
6168 $define)
6169 : Look for a hint-file generated 'call-back-unit'.  If the
6170 : user has specified that long doubles should be used,
6171 : we may need to set or change some other defaults.
6172         if $test -f uselongdouble.cbu; then
6173                 echo "Your platform has some specific hints for long doubles, using them..."
6174                 . ./uselongdouble.cbu
6175         else
6176                 $cat <<EOM
6177 (Your platform doesn't have any specific hints for long doubles.)
6178 EOM
6179         fi
6180         ;;
6181 esac
6182
6183 message=X
6184 case "$uselongdouble:$d_sqrtl:$d_modfl" in
6185 $define:$define:$define)
6186         : You have both
6187         ;;
6188 $define:$define:$undef)
6189         message="I could not find modfl"
6190         ;;
6191 $define:$undef:$define)
6192         message="I could not find sqrtl"
6193         ;;
6194 $define:$undef:$undef)
6195         message="I found neither sqrtl nor modfl"
6196         ;;
6197 esac
6198
6199 if $test "$message" != X; then
6200         $cat <<EOM >&4
6201
6202 *** You requested the use of long doubles but you do not seem to have
6203 *** the mathematic functions for long doubles.
6204 *** ($message)
6205 *** I'm disabling the use of long doubles.
6206
6207 EOM
6208
6209         uselongdouble=$undef
6210 fi
6211
6212 case "$useperlio" in
6213 $define|true|[yY]*|'')  dflt='y';;
6214 *) dflt='n';;
6215 esac
6216 cat <<EOM
6217
6218 Previous version of $package used the standard IO mechanisms as
6219 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
6220 alternate IO mechanisms via the PerlIO abstraction layer, but the
6221 stdio mechanism is still available if needed.  The abstraction layer
6222 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
6223 Using PerlIO with sfio may cause problems with some extension modules.
6224
6225 If this doesn't make any sense to you, just accept the default '$dflt'.
6226 EOM
6227 rp='Use the PerlIO abstraction layer?'
6228 . ./myread
6229 case "$ans" in
6230 y|Y) 
6231         val="$define"
6232         ;;
6233 *)      
6234         echo "Ok, doing things the stdio way."
6235         val="$undef"
6236         ;;
6237 esac
6238 set useperlio
6239 eval $setvar 
6240
6241 case "$usesocks" in
6242 $define|true|[yY]*)
6243         case "$useperlio" in
6244         $define|true|[yY]*) ;;
6245         *)      cat >&4 <<EOM
6246
6247 You are using the SOCKS proxy protocol library which means that you
6248 should also use the PerlIO layer.  You may be headed for trouble.
6249
6250 EOM
6251                 ;;
6252         esac
6253         ;;
6254 esac
6255
6256         
6257 : determine the architecture name
6258 echo " "
6259 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6260         tarch=`arch`"-$osname"
6261 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6262         if uname -m > tmparch 2>&1 ; then
6263                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6264                         -e 's/$/'"-$osname/" tmparch`
6265         else
6266                 tarch="$osname"
6267         fi
6268         $rm -f tmparch
6269 else
6270         tarch="$osname"
6271 fi
6272 case "$myarchname" in
6273 ''|"$tarch") ;;
6274 *)
6275         echo "(Your architecture name used to be $myarchname.)"
6276         archname=''
6277         ;;
6278 esac
6279 case "$targetarch" in
6280 '') ;;
6281 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6282 esac
6283 myarchname="$tarch"
6284 case "$archname" in
6285 '') dflt="$tarch";;
6286 *) dflt="$archname";;
6287 esac
6288 rp='What is your architecture name'
6289 . ./myread
6290 archname="$ans"
6291 case "$usethreads" in
6292 $define)
6293         echo "Threads selected." >&4
6294         case "$archname" in
6295         *-thread*) echo "...and architecture name already has -thread." >&4
6296                 ;;
6297         *)      archname="$archname-thread"
6298                 echo "...setting architecture name to $archname." >&4
6299                 ;;
6300         esac
6301         ;;
6302 esac
6303 case "$usemultiplicity" in
6304 $define)
6305         echo "Multiplicity selected." >&4
6306         case "$archname" in
6307         *-multi*) echo "...and architecture name already has -multi." >&4
6308                 ;;
6309         *)      archname="$archname-multi"
6310                 echo "...setting architecture name to $archname." >&4
6311                 ;;
6312         esac
6313         ;;
6314 esac
6315 case "$use64bitint$use64bitall" in
6316 *"$define"*)
6317         case "$archname64" in
6318         '')
6319                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6320                 ;;
6321         *)
6322                 case "$use64bitint" in
6323                 "$define") echo "64 bit integers selected." >&4 ;;
6324                 esac
6325                 case "$use64bitall" in
6326                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6327                 esac
6328                 case "$archname" in
6329                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6330                         ;;
6331                 *)      archname="$archname-$archname64"
6332                         echo "...setting architecture name to $archname." >&4
6333                         ;;
6334                 esac
6335                 ;;
6336         esac
6337 esac
6338 case "$uselongdouble" in
6339 $define)
6340         echo "Long doubles selected." >&4
6341         case "$longdblsize" in
6342         $doublesize)
6343                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6344                 ;;
6345         *)
6346                 case "$archname" in
6347                 *-ld*) echo "...and architecture name already has -ld." >&4
6348                         ;;
6349                 *)      archname="$archname-ld"
6350                         echo "...setting architecture name to $archname." >&4
6351                         ;;
6352                 esac
6353                 ;;
6354         esac
6355         ;;
6356 esac
6357 case "$useperlio" in
6358 $define)
6359         echo "Perlio selected." >&4
6360         ;;
6361 *)
6362         echo "Perlio not selected, using stdio." >&4
6363         case "$archname" in
6364         *-stdio*) echo "...and architecture name already has -stdio." >&4
6365                 ;;
6366         *)      archname="$archname-stdio"
6367                 echo "...setting architecture name to $archname." >&4
6368                 ;;
6369         esac
6370         ;;
6371 esac
6372
6373 : determine root of directory hierarchy where package will be installed.
6374 case "$prefix" in
6375 '')
6376         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
6377         ;;
6378 *)
6379         dflt="$prefix"
6380         ;;
6381 esac
6382 $cat <<EOM
6383
6384 By default, $package will be installed in $dflt/bin, manual pages
6385 under $dflt/man, etc..., i.e. with $dflt as prefix for all
6386 installation directories. Typically this is something like /usr/local.
6387 If you wish to have binaries under /usr/bin but other parts of the
6388 installation under /usr/local, that's ok: you will be prompted
6389 separately for each of the installation directories, the prefix being
6390 only used to set the defaults.
6391
6392 EOM
6393 fn=d~
6394 rp='Installation prefix to use?'
6395 . ./getfile
6396 oldprefix=''
6397 case "$prefix" in
6398 '') ;;
6399 *)
6400         case "$ans" in
6401         "$prefix") ;;
6402         *) oldprefix="$prefix";;
6403         esac
6404         ;;
6405 esac
6406 prefix="$ans"
6407 prefixexp="$ansexp"
6408
6409 case "$afsroot" in
6410 '')     afsroot=/afs ;;
6411 *)      afsroot=$afsroot ;;
6412 esac
6413
6414 : is AFS running?
6415 echo " "
6416 case "$afs" in
6417 $define|true)   afs=true ;;
6418 $undef|false)   afs=false ;;
6419 *)      if test -d $afsroot; then
6420                 afs=true
6421         else
6422                 afs=false
6423         fi
6424         ;;
6425 esac
6426 if $afs; then
6427         echo "AFS may be running... I'll be extra cautious then..." >&4
6428 else
6429         echo "AFS does not seem to be running..." >&4
6430 fi
6431
6432 : determine installation prefix for where package is to be installed.
6433 if $afs; then 
6434 $cat <<EOM
6435
6436 Since you are running AFS, I need to distinguish the directory in which
6437 files will reside from the directory in which they are installed (and from
6438 which they are presumably copied to the former directory by occult means).
6439
6440 EOM
6441         case "$installprefix" in
6442         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6443         *) dflt="$installprefix";;
6444         esac
6445 else
6446 $cat <<EOM
6447
6448 In some special cases, particularly when building $package for distribution,
6449 it is convenient to distinguish between the directory in which files should 
6450 be installed from the directory ($prefix) in which they 
6451 will eventually reside.  For most users, these two directories are the same.
6452
6453 EOM
6454         case "$installprefix" in
6455         '') dflt=$prefix ;;
6456         *) dflt=$installprefix;;
6457         esac
6458 fi
6459 fn=d~
6460 rp='What installation prefix should I use for installing files?'
6461 . ./getfile
6462 installprefix="$ans"
6463 installprefixexp="$ansexp"
6464
6465 : set the prefixit variable, to compute a suitable default value
6466 prefixit='case "$3" in
6467 ""|none)
6468         case "$oldprefix" in
6469         "") eval "$1=\"\$$2\"";;
6470         *)
6471                 case "$3" in
6472                 "") eval "$1=";;
6473                 none)
6474                         eval "tp=\"\$$2\"";
6475                         case "$tp" in
6476                         ""|" ") eval "$1=\"\$$2\"";;
6477                         *) eval "$1=";;
6478                         esac;;
6479                 esac;;
6480         esac;;
6481 *)
6482         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6483         case "$tp" in
6484         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6485         /*-$oldprefix/*|\~*-$oldprefix/*)
6486                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6487         *) eval "$1=\"\$$2\"";;
6488         esac;;
6489 esac'
6490
6491 : get the patchlevel
6492 echo " "
6493 echo "Getting the current patchlevel..." >&4
6494 if $test -r $rsrc/patchlevel.h;then
6495         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6496         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6497         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6498         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6499         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6500         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6501        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6502 else
6503         revision=0
6504         patchlevel=0
6505         subversion=0
6506         api_revision=0
6507         api_version=0
6508         api_subversion=0
6509         perl_patchlevel=0
6510         $echo "(You do not have patchlevel.h.  Eek.)"
6511 fi
6512 if $test -r $rsrc/.patch ; then  
6513         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6514                 perl_patchlevel=`cat $rsrc/.patch`
6515         fi
6516 fi
6517 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
6518 version_patchlevel_string="version $patchlevel subversion $subversion"
6519 case "$perl_patchlevel" in
6520 0|'') ;;
6521 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
6522 esac
6523
6524 $echo "(You have $package $version_patchlevel_string.)"
6525
6526 case "$osname" in
6527 dos|vms)
6528         : XXX Should be a Configure test for double-dots in filenames.
6529         version=`echo $revision $patchlevel $subversion | \
6530                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6531         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6532                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6533         ;;
6534 *)
6535         version=`echo $revision $patchlevel $subversion | \
6536                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6537         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6538                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6539         ;;
6540 esac
6541 : Special case the 5.005_xx maintenance series, which used 5.005
6542 : without any subversion label as a subdirectory in $sitelib
6543 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6544         api_versionstring='5.005'
6545 fi
6546
6547 : determine installation style
6548 : For now, try to deduce it from prefix unless it is already set.
6549 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6550 case "$installstyle" in
6551 '')     case "$prefix" in
6552                 *perl*) dflt='lib';;
6553                 *) dflt='lib/perl5' ;;
6554         esac
6555         ;;
6556 *)      dflt="$installstyle" ;;
6557 esac
6558 : Probably not worth prompting for this since we prompt for all
6559 : the directories individually, and the prompt would be too long and
6560 : confusing anyway.
6561 installstyle=$dflt
6562
6563 : determine where private library files go
6564 : Usual default is /usr/local/lib/perl5/$version.
6565 : Also allow things like /opt/perl/lib/$version, since 
6566 : /opt/perl/lib/perl5... would be redundant.
6567 : The default "style" setting is made in installstyle.U
6568 case "$installstyle" in
6569 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6570 *)       set dflt privlib lib/$version ;;
6571 esac
6572 eval $prefixit
6573 $cat <<EOM
6574
6575 There are some auxiliary files for $package that need to be put into a
6576 private library directory that is accessible by everyone.
6577
6578 EOM
6579 fn=d~+
6580 rp='Pathname where the private library files will reside?'
6581 . ./getfile
6582 privlib="$ans"
6583 privlibexp="$ansexp"
6584 : Change installation prefix, if necessary.
6585 if $test X"$prefix" != X"$installprefix"; then
6586         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6587 else
6588         installprivlib="$privlibexp"
6589 fi
6590
6591 : set the prefixup variable, to restore leading tilda escape
6592 prefixup='case "$prefixexp" in
6593 "$prefix") ;;
6594 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6595 esac'
6596
6597 : determine where public architecture dependent libraries go
6598 set archlib archlib
6599 eval $prefixit
6600 : privlib default is /usr/local/lib/$package/$version
6601 : archlib default is /usr/local/lib/$package/$version/$archname
6602 : privlib may have an optional trailing /share.
6603 tdflt=`echo $privlib | $sed 's,/share$,,'`
6604 tdflt=$tdflt/$archname
6605 case "$archlib" in
6606 '')     dflt=$tdflt
6607         ;;
6608 *)      dflt="$archlib"
6609     ;;
6610 esac
6611 $cat <<EOM
6612
6613 $spackage contains architecture-dependent library files.  If you are
6614 sharing libraries in a heterogeneous environment, you might store
6615 these files in a separate location.  Otherwise, you can just include
6616 them with the rest of the public library files.
6617
6618 EOM
6619 fn=d+~
6620 rp='Where do you want to put the public architecture-dependent libraries?'
6621 . ./getfile
6622 archlib="$ans"
6623 archlibexp="$ansexp"
6624 if $test X"$archlib" = X"$privlib"; then
6625         d_archlib="$undef"
6626 else
6627         d_archlib="$define"
6628 fi
6629 : Change installation prefix, if necessary.
6630 if $test X"$prefix" != X"$installprefix"; then
6631         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6632 else
6633         installarchlib="$archlibexp"
6634 fi
6635
6636
6637 : Binary compatibility with 5.005 is not possible for builds
6638 : with advanced features
6639 case "$usethreads$usemultiplicity" in
6640 *define*)
6641         bincompat5005="$undef"
6642         d_bincompat5005="$undef"
6643         ;;
6644 *)      $cat <<EOM
6645
6646 This version of Perl can be compiled for binary compatibility with 5.005.
6647 If you decide to do so, you will be able to continue using most of the
6648 extensions that were compiled for Perl 5.005.
6649
6650 EOM
6651         case "$bincompat5005$d_bincompat5005" in
6652         *"$undef"*) dflt=n ;;
6653         *) dflt=y ;;
6654         esac
6655         rp='Binary compatibility with Perl 5.005?'
6656         . ./myread
6657         case "$ans" in
6658         y*) val="$define" ;;
6659         *)  val="$undef" ;;
6660         esac
6661         set d_bincompat5005
6662         eval $setvar
6663         case "$d_bincompat5005" in
6664         "$define")
6665                 bincompat5005="$define"
6666                 ;;
6667         *)      bincompat5005="$undef"
6668                 d_bincompat5005="$undef"
6669                 ;;
6670         esac
6671         ;;
6672 esac
6673
6674
6675 : see if setuid scripts can be secure
6676 $cat <<EOM
6677
6678 Some kernels have a bug that prevents setuid #! scripts from being
6679 secure.  Some sites have disabled setuid #! scripts because of this.
6680
6681 First let's decide if your kernel supports secure setuid #! scripts.
6682 (If setuid #! scripts would be secure but have been disabled anyway,
6683 don't say that they are secure if asked.)
6684
6685 EOM
6686
6687 val="$undef"
6688 if $test -d /dev/fd; then
6689         echo "#!$ls" >reflect
6690         chmod +x,u+s reflect
6691         ./reflect >flect 2>&1
6692         if $contains "/dev/fd" flect >/dev/null; then
6693                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6694                 val="$define"
6695         else
6696                 $cat <<EOM
6697 If you are not sure if they are secure, I can check but I'll need a
6698 username and password different from the one you are using right now.
6699 If you don't have such a username or don't want me to test, simply
6700 enter 'none'.
6701
6702 EOM
6703                 rp='Other username to test security of setuid scripts with?'
6704                 dflt='none'
6705                 . ./myread
6706                 case "$ans" in
6707                 n|none)
6708                         case "$d_suidsafe" in
6709                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6710                                 dflt=n;;
6711                         "$undef")
6712                                 echo "Well, the $hint value is *not* secure." >&4
6713                                 dflt=n;;
6714                         *)      echo "Well, the $hint value *is* secure." >&4
6715                                 dflt=y;;
6716                         esac
6717                         ;;
6718                 *)
6719                         $rm -f reflect flect
6720                         echo "#!$ls" >reflect
6721                         chmod +x,u+s reflect
6722                         echo >flect
6723                         chmod a+w flect
6724                         echo '"su" will (probably) prompt you for '"$ans's password."
6725                         su $ans -c './reflect >flect'
6726                         if $contains "/dev/fd" flect >/dev/null; then
6727                                 echo "Okay, it looks like setuid scripts are secure." >&4
6728                                 dflt=y
6729                         else
6730                                 echo "I don't think setuid scripts are secure." >&4
6731                                 dflt=n
6732                         fi
6733                         ;;
6734                 esac
6735                 rp='Does your kernel have *secure* setuid scripts?'
6736                 . ./myread
6737                 case "$ans" in
6738                 [yY]*)  val="$define";;
6739                 *)      val="$undef";;
6740                 esac
6741         fi
6742 else
6743         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6744         echo "(That's for file descriptors, not floppy disks.)"
6745         val="$undef"
6746 fi
6747 set d_suidsafe
6748 eval $setvar
6749
6750 $rm -f reflect flect
6751
6752 : now see if they want to do setuid emulation
6753 echo " "
6754 val="$undef"
6755 case "$d_suidsafe" in
6756 "$define")
6757         val="$undef"
6758         echo "No need to emulate SUID scripts since they are secure here." >&4
6759         ;;
6760 *)
6761         $cat <<EOM
6762 Some systems have disabled setuid scripts, especially systems where
6763 setuid scripts cannot be secure.  On systems where setuid scripts have
6764 been disabled, the setuid/setgid bits on scripts are currently
6765 useless.  It is possible for $package to detect those bits and emulate
6766 setuid/setgid in a secure fashion.  This emulation will only work if
6767 setuid scripts have been disabled in your kernel.
6768
6769 EOM
6770         case "$d_dosuid" in
6771         "$define") dflt=y ;;
6772         *) dflt=n ;;
6773         esac
6774         rp="Do you want to do setuid/setgid emulation?"
6775         . ./myread
6776         case "$ans" in
6777         [yY]*)  val="$define";;
6778         *)      val="$undef";;
6779         esac
6780         ;;
6781 esac
6782 set d_dosuid
6783 eval $setvar
6784
6785 : see if this is a malloc.h system
6786 set malloc.h i_malloc
6787 eval $inhdr
6788
6789 : see if stdlib is available
6790 set stdlib.h i_stdlib
6791 eval $inhdr
6792
6793 : determine which malloc to compile in
6794 echo " "
6795 case "$usemymalloc" in
6796 [yY]*|true|$define)     dflt='y' ;;
6797 [nN]*|false|$undef)     dflt='n' ;;
6798 *)      case "$ptrsize" in
6799         4) dflt='y' ;;
6800         *) dflt='n' ;;
6801         esac
6802         ;;
6803 esac
6804 rp="Do you wish to attempt to use the malloc that comes with $package?"
6805 . ./myread
6806 usemymalloc="$ans"
6807 case "$ans" in
6808 y*|true)
6809         usemymalloc='y'
6810         mallocsrc='malloc.c'
6811         mallocobj="malloc$_o"
6812         d_mymalloc="$define"
6813         case "$libs" in
6814         *-lmalloc*)
6815                 : Remove malloc from list of libraries to use
6816                 echo "Removing unneeded -lmalloc from library list" >&4
6817                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6818                 shift
6819                 libs="$*"
6820                 echo "libs = $libs" >&4
6821                 ;;
6822         esac
6823         ;;
6824 *)
6825         usemymalloc='n'
6826         mallocsrc=''
6827         mallocobj=''
6828         d_mymalloc="$undef"
6829         ;;
6830 esac
6831
6832 : compute the return types of malloc and free
6833 echo " "
6834 $cat >malloc.c <<END
6835 #$i_malloc I_MALLOC
6836 #$i_stdlib I_STDLIB
6837 #include <stdio.h>
6838 #include <sys/types.h>
6839 #ifdef I_MALLOC
6840 #include <malloc.h>
6841 #endif
6842 #ifdef I_STDLIB
6843 #include <stdlib.h>
6844 #endif
6845 #ifdef TRY_MALLOC
6846 void *malloc();
6847 #endif
6848 #ifdef TRY_FREE
6849 void free();
6850 #endif
6851 END
6852 case "$malloctype" in
6853 '')
6854         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6855                 malloctype='void *'
6856         else
6857                 malloctype='char *'
6858         fi
6859         ;;
6860 esac
6861 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6862
6863 case "$freetype" in
6864 '')
6865         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6866                 freetype='void'
6867         else
6868                 freetype='int'
6869         fi
6870         ;;
6871 esac
6872 echo "Your system uses $freetype free(), it would seem." >&4
6873 $rm -f malloc.[co]
6874 $cat <<EOM
6875
6876 After $package is installed, you may wish to install various
6877 add-on modules and utilities.  Typically, these add-ons will
6878 be installed under $prefix with the rest
6879 of this package.  However, you may wish to install such add-ons
6880 elsewhere under a different prefix.
6881
6882 If you do not wish to put everything under a single prefix, that's
6883 ok.  You will be prompted for the individual locations; this siteprefix
6884 is only used to suggest the defaults.
6885
6886 The default should be fine for most people.
6887
6888 EOM
6889 fn=d~+
6890 rp='Installation prefix to use for add-on modules and utilities?'
6891 : XXX Here might be another good place for an installstyle setting.
6892 case "$siteprefix" in
6893 '') dflt=$prefix ;;
6894 *)  dflt=$siteprefix ;;
6895 esac
6896 . ./getfile
6897 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6898 oldsiteprefix=''
6899 case "$siteprefix" in
6900 '') ;;
6901 *)      case "$ans" in
6902         "$prefix") ;;
6903         *) oldsiteprefix="$prefix";;
6904         esac
6905         ;;
6906 esac
6907 siteprefix="$ans"
6908 siteprefixexp="$ansexp"
6909
6910 : determine where site specific libraries go.
6911 : Usual default is /usr/local/lib/perl5/site_perl/$version
6912 : The default "style" setting is made in installstyle.U
6913 : XXX No longer works with Prefixit stuff.
6914 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6915 case "$sitelib" in
6916 '') case "$installstyle" in
6917         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6918         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6919         esac
6920         ;;
6921 *)      dflt="$sitelib"
6922         ;;
6923 esac
6924 $cat <<EOM
6925
6926 The installation process will create a directory for
6927 site-specific extensions and modules.  Most users find it convenient
6928 to place all site-specific files in this directory rather than in the
6929 main distribution directory.
6930
6931 EOM
6932 fn=d~+
6933 rp='Pathname for the site-specific library files?'
6934 . ./getfile
6935 sitelib="$ans"
6936 sitelibexp="$ansexp"
6937 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6938 : Change installation prefix, if necessary.
6939 if $test X"$prefix" != X"$installprefix"; then
6940         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6941 else
6942         installsitelib="$sitelibexp"
6943 fi
6944
6945 : determine where site specific architecture-dependent libraries go.
6946 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6947 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6948 : sitelib may have an optional trailing /share.
6949 case "$sitearch" in
6950 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6951         dflt="$dflt/$archname"
6952         ;;
6953 *)      dflt="$sitearch"
6954         ;;
6955 esac
6956 set sitearch sitearch none
6957 eval $prefixit
6958 $cat <<EOM
6959
6960 The installation process will also create a directory for
6961 architecture-dependent site-specific extensions and modules.
6962
6963 EOM
6964 fn=d~+
6965 rp='Pathname for the site-specific architecture-dependent library files?'
6966 . ./getfile
6967 sitearch="$ans"
6968 sitearchexp="$ansexp"
6969 : Change installation prefix, if necessary.
6970 if $test X"$prefix" != X"$installprefix"; then
6971         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6972 else
6973         installsitearch="$sitearchexp"
6974 fi
6975
6976 $cat <<EOM
6977
6978 The installation process will also create a directory for
6979 vendor-supplied add-ons.  Vendors who supply perl with their system
6980 may find it convenient to place all vendor-supplied files in this
6981 directory rather than in the main distribution directory.  This will
6982 ease upgrades between binary-compatible maintenance versions of perl.
6983
6984 Of course you may also use these directories in whatever way you see
6985 fit.  For example, you might use them to access modules shared over a
6986 company-wide network.
6987
6988 The default answer should be fine for most people.
6989 This causes further questions about vendor add-ons to be skipped
6990 and no vendor-specific directories will be configured for perl.
6991
6992 EOM
6993 rp='Do you want to configure vendor-specific add-on directories?'
6994 case "$usevendorprefix" in
6995 define|true|[yY]*) dflt=y ;;
6996 *)      : User may have set vendorprefix directly on Configure command line.
6997         case "$vendorprefix" in
6998         ''|' ') dflt=n ;;
6999         *)      dflt=y ;;
7000         esac
7001         ;;
7002 esac
7003 . ./myread
7004 case "$ans" in
7005 [yY]*)  fn=d~+
7006         rp='Installation prefix to use for vendor-supplied add-ons?'
7007         case "$vendorprefix" in
7008         '') dflt='' ;;
7009         *)  dflt=$vendorprefix ;;
7010         esac
7011         . ./getfile
7012         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7013         oldvendorprefix=''
7014         case "$vendorprefix" in
7015         '') ;;
7016         *)      case "$ans" in
7017                 "$prefix") ;;
7018                 *) oldvendorprefix="$prefix";;
7019                 esac
7020                 ;;
7021         esac
7022         usevendorprefix="$define"
7023         vendorprefix="$ans"
7024         vendorprefixexp="$ansexp"
7025         ;;
7026 *)      usevendorprefix="$undef"
7027         vendorprefix=''
7028         vendorprefixexp=''
7029         ;;
7030 esac
7031
7032 case "$vendorprefix" in
7033 '')     d_vendorlib="$undef"
7034         vendorlib=''
7035         vendorlibexp=''
7036         ;;
7037 *)      d_vendorlib="$define"
7038         : determine where vendor-supplied modules go.
7039         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7040         case "$vendorlib" in
7041         '')
7042                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7043                 case "$installstyle" in
7044                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7045                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7046                 esac
7047                 ;;
7048         *)      dflt="$vendorlib"
7049                 ;;
7050         esac
7051         fn=d~+
7052         rp='Pathname for the vendor-supplied library files?'
7053         . ./getfile
7054         vendorlib="$ans"
7055         vendorlibexp="$ansexp"
7056         ;;
7057 esac
7058 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7059 : Change installation prefix, if necessary.
7060 if $test X"$prefix" != X"$installprefix"; then
7061         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
7062 else
7063         installvendorlib="$vendorlibexp"
7064 fi
7065
7066 case "$vendorprefix" in
7067 '')     d_vendorarch="$undef"
7068         vendorarch=''
7069         vendorarchexp=''
7070         ;;
7071 *)      d_vendorarch="$define"
7072         : determine where vendor-supplied architecture-dependent libraries go.
7073         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7074         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7075         : vendorlib may have an optional trailing /share.
7076         case "$vendorarch" in
7077         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7078                 dflt="$dflt/$archname"
7079                 ;;
7080         *)      dflt="$vendorarch" ;;
7081         esac
7082         fn=d~+
7083         rp='Pathname for vendor-supplied architecture-dependent files?'
7084         . ./getfile
7085         vendorarch="$ans"
7086         vendorarchexp="$ansexp"
7087         ;;
7088 esac
7089 : Change installation prefix, if necessary.
7090 if $test X"$prefix" != X"$installprefix"; then
7091         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
7092 else
7093         installvendorarch="$vendorarchexp"
7094 fi
7095
7096 : Final catch-all directories to search
7097 $cat <<EOM
7098
7099 Lastly, you can have perl look in other directories for extensions and
7100 modules in addition to those already specified.
7101 These directories will be searched after 
7102         $sitearch 
7103         $sitelib 
7104 EOM
7105 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7106 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7107 echo ' '
7108 case "$otherlibdirs" in
7109 ''|' ') dflt='none' ;;
7110 *)      dflt="$otherlibdirs" ;;
7111 esac
7112 $cat <<EOM
7113 Enter a colon-separated set of extra paths to include in perl's @INC
7114 search path, or enter 'none' for no extra paths.
7115
7116 EOM
7117
7118 rp='Colon-separated list of additional directories for perl to search?'
7119 . ./myread
7120 case "$ans" in
7121 ' '|''|none)    otherlibdirs=' ' ;;     
7122 *)      otherlibdirs="$ans" ;;
7123 esac
7124 case "$otherlibdirs" in
7125 ' ') val=$undef ;;
7126 *)      val=$define ;;
7127 esac
7128 set d_perl_otherlibdirs
7129 eval $setvar
7130
7131 : Cruising for prototypes
7132 echo " "
7133 echo "Checking out function prototypes..." >&4
7134 $cat >prototype.c <<'EOCP'
7135 int main(int argc, char *argv[]) {
7136         exit(0);}
7137 EOCP
7138 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7139         echo "Your C compiler appears to support function prototypes."
7140         val="$define"
7141 else
7142         echo "Your C compiler doesn't seem to understand function prototypes."
7143         val="$undef"
7144 fi
7145 set prototype
7146 eval $setvar
7147 $rm -f prototype*
7148
7149 case "$prototype" in
7150 "$define") ;;
7151 *)      ansi2knr='ansi2knr'
7152         echo " "
7153         cat <<EOM >&4
7154
7155 $me:  FATAL ERROR:
7156 This version of $package can only be compiled by a compiler that 
7157 understands function prototypes.  Unfortunately, your C compiler 
7158         $cc $ccflags
7159 doesn't seem to understand them.  Sorry about that.
7160
7161 If GNU cc is available for your system, perhaps you could try that instead.  
7162
7163 Eventually, we hope to support building Perl with pre-ANSI compilers.
7164 If you would like to help in that effort, please contact <perlbug@perl.org>.
7165
7166 Aborting Configure now.
7167 EOM
7168         exit 2
7169         ;;
7170 esac
7171
7172 : determine where public executables go
7173 echo " "
7174 set dflt bin bin
7175 eval $prefixit
7176 fn=d~
7177 rp='Pathname where the public executables will reside?'
7178 . ./getfile
7179 if $test "X$ansexp" != "X$binexp"; then
7180         installbin=''
7181 fi
7182 bin="$ans"
7183 binexp="$ansexp"
7184 : Change installation prefix, if necessary.
7185 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7186 if $test X"$prefix" != X"$installprefix"; then
7187         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
7188 else
7189         installbin="$binexp"
7190 fi
7191
7192 echo " "
7193 case "$extras" in
7194 '') dflt='n';;
7195 *) dflt='y';;
7196 esac
7197 cat <<EOM
7198 Perl can be built with extra modules or bundles of modules which
7199 will be fetched from the CPAN and installed alongside Perl.
7200
7201 Notice that you will need access to the CPAN; either via the Internet,
7202 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7203 be asked later to configure the CPAN.pm module which will in turn do
7204 the installation of the rest of the extra modules or bundles.)
7205
7206 Notice also that if the modules require any external software such as
7207 libraries and headers (the libz library and the zlib.h header for the
7208 Compress::Zlib module, for example) you MUST have any such software
7209 already installed, this configuration process will NOT install such
7210 things for you.
7211
7212 If this doesn't make any sense to you, just accept the default '$dflt'.
7213 EOM
7214 rp='Install any extra modules (y or n)?'
7215 . ./myread
7216 case "$ans" in
7217 y|Y)
7218         cat <<EOM
7219
7220 Please list any extra modules or bundles to be installed from CPAN,
7221 with spaces between the names.  The names can be in any format the
7222 'install' command of CPAN.pm will understand.  (Answer 'none',
7223 without the quotes, to install no extra modules or bundles.)
7224 EOM
7225         rp='Extras?'
7226         dflt="$extras"
7227         . ./myread
7228         extras="$ans"
7229 esac
7230 case "$extras" in
7231 ''|'none')
7232         val=''
7233         $rm -f ../extras.lst
7234         ;;
7235 *)      echo "(Saving the list of extras for later...)"
7236         echo "$extras" > ../extras.lst
7237         val="'$extras'"
7238         ;;
7239 esac
7240 set extras
7241 eval $setvar
7242 echo " "
7243
7244 : Find perl5.005 or later.
7245 echo "Looking for a previously installed perl5.005 or later... "
7246 case "$perl5" in
7247 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7248                 : Check if this perl is recent and can load a simple module
7249                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7250                         perl5=$tdir/perl
7251                         break;
7252                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7253                         perl5=$tdir/perl5
7254                         break;
7255                 fi
7256         done
7257         ;;
7258 *)      perl5="$perl5"
7259         ;;
7260 esac
7261 case "$perl5" in
7262 '')     echo "None found.  That's ok.";;
7263 *)      echo "Using $perl5." ;;
7264 esac
7265
7266 : Determine list of previous versions to include in @INC
7267 $cat > getverlist <<EOPL
7268 #!$perl5 -w
7269 use File::Basename;
7270 \$api_versionstring = "$api_versionstring";
7271 \$version = "$version";
7272 \$stem = "$sitelib_stem";
7273 \$archname = "$archname";
7274 EOPL
7275         $cat >> getverlist <<'EOPL'
7276 # Can't have leading @ because metaconfig interprets it as a command!
7277 ;@inc_version_list=();
7278 # XXX Redo to do opendir/readdir? 
7279 if (-d $stem) {
7280     chdir($stem);
7281     ;@candidates = glob("5.*");
7282 }
7283 else {
7284     ;@candidates = ();
7285 }
7286
7287 # XXX ToDo:  These comparisons must be reworked when two-digit
7288 # subversions come along, so that 5.7.10 compares as greater than
7289 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
7290 # widespread that we can use the built-in version vectors rather
7291 # than reinventing them here.  For 5.6.0, however, we must
7292 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
7293 foreach $d (@candidates) {
7294     if ($d lt $version) {
7295         if ($d ge $api_versionstring) {
7296             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
7297         }
7298         elsif ($d ge "5.005") {
7299             unshift(@inc_version_list, grep { -d } $d);
7300         }
7301     }
7302     else {
7303         # Skip newer version.  I.e. don't look in
7304         # 5.7.0 if we're installing 5.6.1.
7305     }
7306 }
7307
7308 if (@inc_version_list) {
7309     print join(' ', @inc_version_list);
7310 }
7311 else {
7312     # Blank space to preserve value for next Configure run.
7313     print " ";
7314 }
7315 EOPL
7316 chmod +x getverlist
7317 case "$inc_version_list" in
7318 '')     if test -x "$perl5$exe_ext"; then
7319                 dflt=`$perl5 getverlist`
7320         else
7321                 dflt='none'
7322         fi
7323         ;;
7324 $undef) dflt='none' ;;
7325 *)  eval dflt=\"$inc_version_list\" ;;
7326 esac
7327 case "$dflt" in
7328 ''|' ') dflt=none ;;
7329 esac
7330 case "$dflt" in
7331 5.005) case "$bincompat5005" in
7332        $define|true|[yY]*) ;;
7333        *) dflt=none ;;
7334        esac
7335        ;;
7336 esac
7337 $cat <<'EOM'
7338
7339 In order to ease the process of upgrading, this version of perl 
7340 can be configured to use modules built and installed with earlier 
7341 versions of perl that were installed under $prefix.  Specify here
7342 the list of earlier versions that this version of perl should check.
7343 If Configure detected no earlier versions of perl installed under
7344 $prefix, then the list will be empty.  Answer 'none' to tell perl
7345 to not search earlier versions.
7346
7347 The default should almost always be sensible, so if you're not sure,
7348 just accept the default.
7349 EOM
7350
7351 rp='List of earlier versions to include in @INC?'
7352 . ./myread
7353 case "$ans" in
7354 [Nn]one|''|' ') inc_version_list=' ' ;;
7355 *) inc_version_list="$ans" ;;
7356 esac
7357 case "$inc_version_list" in
7358 ''|' ') 
7359         inc_version_list_init='0';;
7360 *)      inc_version_list_init=`echo $inc_version_list |
7361                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7362         ;;
7363 esac
7364 $rm -f getverlist
7365
7366 : determine whether to install perl also as /usr/bin/perl
7367
7368 echo " "
7369 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7370         $cat <<EOM
7371 Many scripts expect perl to be installed as /usr/bin/perl.
7372 I can install the perl you are about to compile also as /usr/bin/perl
7373 (in addition to $installbin/perl).
7374 EOM
7375         case "$installusrbinperl" in
7376         "$undef"|[nN]*) dflt='n';;
7377         *)              dflt='y';;
7378         esac
7379         rp="Do you want to install perl as /usr/bin/perl?"
7380         . ./myread
7381         case "$ans" in
7382         [yY]*)  val="$define";;
7383         *)      val="$undef" ;;
7384         esac
7385 else
7386         val="$undef"
7387 fi
7388 set installusrbinperl
7389 eval $setvar
7390
7391 : see if dld is available
7392 set dld.h i_dld
7393 eval $inhdr
7394
7395 : see if dlopen exists
7396 xxx_runnm="$runnm"
7397 runnm=false
7398 set dlopen d_dlopen
7399 eval $inlibc
7400 runnm="$xxx_runnm"
7401
7402 : determine which dynamic loading, if any, to compile in
7403 echo " "
7404 dldir="ext/DynaLoader"
7405 case "$usedl" in
7406 $define|y|true)
7407         dflt='y'
7408         usedl="$define"
7409         ;;
7410 $undef|n|false)
7411         dflt='n'
7412         usedl="$undef"
7413         ;;
7414 *) 
7415         dflt='n'
7416         case "$d_dlopen" in
7417             $define) dflt='y' ;;
7418         esac
7419         case "$i_dld" in
7420             $define) dflt='y' ;;
7421         esac
7422         : Does a dl_xxx.xs file exist for this operating system
7423         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7424         ;;
7425 esac
7426 rp="Do you wish to use dynamic loading?"
7427 . ./myread
7428 usedl="$ans"
7429 case "$ans" in
7430 y*) usedl="$define"
7431         case "$dlsrc" in
7432         '')
7433                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7434                         dflt="$dldir/dl_${osname}.xs"
7435                 elif $test "$d_dlopen" = "$define" ; then
7436                         dflt="$dldir/dl_dlopen.xs"
7437                 elif $test "$i_dld" = "$define" ; then
7438                         dflt="$dldir/dl_dld.xs"
7439                 else
7440                         dflt=''
7441                 fi
7442                 ;;
7443         *)      dflt="$dldir/$dlsrc"
7444                 ;;
7445         esac
7446     echo "The following dynamic loading files are available:"
7447         : Can not go over to $dldir because getfile has path hard-coded in.
7448         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7449         rp="Source file to use for dynamic loading"
7450         fn="fne"
7451         gfpth="$src"
7452         . ./getfile
7453         usedl="$define"
7454         : emulate basename
7455         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7456
7457         $cat << EOM
7458
7459 Some systems may require passing special flags to $cc -c to
7460 compile modules that will be used to create a shared library.
7461 To use no flags, say "none".
7462
7463 EOM
7464     case "$cccdlflags" in
7465     '') case "$gccversion" in
7466                 '') case "$osname" in
7467                         hpux)   dflt='+z' ;;
7468                         next)   dflt='none' ;;
7469                         irix*)  dflt='-KPIC' ;;
7470                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7471                         sunos)  dflt='-pic' ;;
7472                         *)      dflt='none' ;;
7473                     esac
7474                         ;;
7475                 *)  case "$osname" in
7476                         darwin) dflt='none' ;;
7477                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7478                         *)      dflt='-fpic' ;;
7479                     esac ;;
7480             esac ;;
7481         ' ') dflt='none' ;;
7482     *)  dflt="$cccdlflags" ;;
7483     esac
7484     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7485     . ./myread
7486     case "$ans" in
7487     none) cccdlflags=' ' ;;
7488     *) cccdlflags="$ans" ;;
7489     esac
7490
7491     cat << EOM
7492
7493 Some systems use ld to create libraries that can be dynamically loaded,
7494 while other systems (such as those using ELF) use $cc.
7495
7496 EOM
7497         case "$ld" in
7498         '')     $cat >try.c <<'EOM'
7499 /* Test for whether ELF binaries are produced */
7500 #include <fcntl.h>
7501 #include <stdlib.h>
7502 int main() {
7503         char b[4];
7504         int i = open("a.out",O_RDONLY);
7505         if(i == -1) 
7506                 exit(1); /* fail */
7507         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7508                 exit(0); /* succeed (yes, it's ELF) */
7509         else
7510                 exit(1); /* fail */
7511 }
7512 EOM
7513                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7514                         cat <<EOM
7515 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7516 EOM
7517                         dflt="$cc"
7518                 else
7519                         echo "I'll use ld to build dynamic libraries."
7520                         dflt='ld'
7521                 fi
7522                 rm -f try.c a.out
7523                 ;;
7524         *)      dflt="$ld"
7525                 ;;
7526         esac
7527
7528     rp="What command should be used to create dynamic libraries?"
7529     . ./myread
7530         ld="$ans"
7531
7532     cat << EOM
7533
7534 Some systems may require passing special flags to $ld to create a
7535 library that can be dynamically loaded.  If your ld flags include
7536 -L/other/path options to locate libraries outside your loader's normal
7537 search path, you may need to specify those -L options here as well.  To
7538 use no flags, say "none".
7539
7540 EOM
7541     case "$lddlflags" in
7542     '') case "$osname" in
7543                         beos) dflt='-nostart' ;;
7544                         hpux) dflt='-b';
7545                               case "$gccversion" in
7546                               '') dflt="$dflt +vnocompatwarnings" ;;
7547                               esac
7548                               ;;        
7549                         linux|irix*)    dflt='-shared' ;;
7550                         next)  dflt='none' ;;
7551                         solaris) dflt='-G' ;;
7552                         sunos) dflt='-assert nodefinitions' ;;
7553                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7554                 *)     dflt='none' ;;
7555                         esac
7556                         ;;
7557     *) dflt="$lddlflags" ;;
7558     esac
7559
7560         : Try to guess additional flags to pick up local libraries.
7561         : Be careful not to append to a plain 'none'
7562         case "$dflt" in
7563         none) dflt='' ;;
7564         esac
7565         for thisflag in $ldflags; do
7566                 case "$thisflag" in
7567                 -L*|-R*|-Wl,-R*)
7568                         case " $dflt " in
7569                         *" $thisflag "*) ;;
7570                         *) dflt="$dflt $thisflag" ;;
7571                         esac
7572                         ;;
7573                 esac
7574         done
7575
7576         case "$dflt" in
7577         ''|' ') dflt='none' ;;
7578         esac
7579
7580     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7581     . ./myread
7582     case "$ans" in
7583     none) lddlflags=' ' ;;
7584     *) lddlflags="$ans" ;;
7585     esac
7586
7587         cat <<EOM
7588
7589 Some systems may require passing special flags to $cc to indicate that
7590 the resulting executable will use dynamic linking.  To use no flags,
7591 say "none".
7592
7593 EOM
7594     case "$ccdlflags" in
7595     '') case "$osname" in
7596                 hpux)   dflt='-Wl,-E' ;;
7597                 linux)  dflt='-rdynamic' ;;
7598                 next)   dflt='none' ;;
7599                 sunos)  dflt='none' ;;
7600                 *)      dflt='none' ;;
7601             esac ;;
7602     ' ')  dflt='none' ;;
7603     *)  dflt="$ccdlflags" ;;
7604     esac
7605     rp="Any special flags to pass to $cc to use dynamic linking?"
7606     . ./myread
7607     case "$ans" in
7608     none) ccdlflags=' ' ;;
7609     *) ccdlflags="$ans" ;;
7610     esac
7611     ;;
7612 *)  usedl="$undef"
7613         ld='ld'
7614     dlsrc='dl_none.xs'
7615     lddlflags=''
7616     ccdlflags=''
7617     ;;
7618 esac
7619
7620 also=''
7621 case "$usedl" in
7622 $undef)
7623         # No dynamic loading being used, so don't bother even to prompt.
7624         useshrplib='false'
7625         ;;
7626 *)      case "$useshrplib" in
7627         '')     case "$osname" in
7628                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7629                         dflt=y
7630                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7631                         ;;
7632                 next*)
7633                         case "$osvers" in
7634                         4*)     dflt=y
7635                                 also='Building a shared libperl is needed for MAB support.'
7636                                 ;;
7637                         *)      dflt=n
7638                                 ;;
7639                         esac
7640                         ;;
7641                 *)      dflt=n
7642                         ;;
7643                 esac
7644                 ;;
7645         $define|true|[Yy]*)
7646                 dflt=y
7647                 ;;
7648         *)      dflt=n
7649                 ;;
7650         esac
7651         $cat << EOM
7652
7653 The perl executable is normally obtained by linking perlmain.c with
7654 libperl${_a}, any static extensions (usually just DynaLoader), and
7655 any other libraries needed on this system (such as -lm, etc.).  Since
7656 your system supports dynamic loading, it is probably possible to build
7657 a shared libperl.$so.  If you will have more than one executable linked
7658 to libperl.$so, this will significantly reduce the size of each
7659 executable, but it may have a noticeable affect on performance.  The
7660 default is probably sensible for your system.
7661 $also
7662
7663 EOM
7664         rp="Build a shared libperl.$so (y/n)"
7665         . ./myread
7666         case "$ans" in
7667         true|$define|[Yy]*)
7668                 useshrplib='true'  ;;
7669         *)      useshrplib='false' ;;
7670         esac
7671         ;;
7672 esac
7673
7674 case "$useshrplib" in
7675 true)
7676         case "$libperl" in
7677         '')
7678                 # Figure out a good name for libperl.so.  Since it gets stored in
7679                 # a version-specific architecture-dependent library, the version
7680                 # number isn't really that important, except for making cc/ld happy.
7681                 #
7682                 # A name such as libperl.so.3.1
7683                 majmin="libperl.$so.$patchlevel.$subversion"
7684                 # A name such as libperl.so.301
7685                 majonly=`echo $patchlevel $subversion |
7686                         $awk '{printf "%d%02d", $1, $2}'`
7687                 majonly=libperl.$so.$majonly
7688                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7689                 # rely on figuring it out from the naming of libc.
7690                 case "${osname}${osvers}" in
7691                 next4*)
7692                         dflt=libperl.5.$so
7693                         # XXX How handle the --version stuff for MAB?
7694                         ;;
7695                 linux*)  # ld won't link with a bare -lperl otherwise.
7696                         dflt=libperl.$so
7697                         ;;
7698                 cygwin*) # ld links against an importlib
7699                         dflt=libperl$lib_ext
7700                         ;;
7701                 *)      # Try to guess based on whether libc has major.minor.
7702                         case "$libc" in
7703                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7704                         *libc.$so.[0-9]*) dflt=$majonly ;;
7705                         *)      dflt=libperl.$so ;;
7706                         esac
7707                         ;;
7708                 esac
7709                 ;;
7710         *)      dflt=$libperl
7711                 ;;
7712         esac
7713         cat << EOM
7714
7715 I need to select a good name for the shared libperl.  If your system uses
7716 library names with major and minor numbers, then you might want something
7717 like $majmin.  Alternatively, if your system uses a single version
7718 number for shared libraries, then you might want to use $majonly.
7719 Or, your system might be quite happy with a simple libperl.$so.
7720
7721 Since the shared libperl will get installed into a version-specific
7722 architecture-dependent directory, the version number of the shared perl
7723 library probably isn't important, so the default should be o.k.
7724
7725 EOM
7726         rp='What name do you want to give to the shared libperl?'
7727         . ./myread
7728         libperl=$ans
7729         echo "Ok, I'll use $libperl"
7730         ;;
7731 *)
7732         libperl="libperl${_a}"
7733         ;;
7734 esac
7735
7736 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7737 case "$shrpdir" in
7738 '') ;;
7739 *)      $cat >&4 <<EOM
7740 WARNING:  Use of the shrpdir variable for the installation location of
7741 the shared $libperl is not supported.  It was never documented and
7742 will not work in this version.  Let me (perlbug@perl.org)
7743 know of any problems this may cause.
7744
7745 EOM
7746         case "$shrpdir" in
7747         "$archlibexp/CORE")
7748                 $cat >&4 <<EOM
7749 But your current setting of $shrpdir is
7750 the default anyway, so it's harmless.
7751 EOM
7752                 ;;
7753         *)
7754                 $cat >&4 <<EOM
7755 Further, your current attempted setting of $shrpdir
7756 conflicts with the value of $archlibexp/CORE
7757 that installperl will use.
7758 EOM
7759                 ;;
7760         esac
7761         ;;
7762 esac
7763
7764 # How will the perl executable find the installed shared $libperl?
7765 # Add $xxx to ccdlflags.
7766 # If we can't figure out a command-line option, use $shrpenv to
7767 # set env LD_RUN_PATH.  The main perl makefile uses this.
7768 shrpdir=$archlibexp/CORE
7769 xxx=''
7770 tmp_shrpenv=''
7771 if "$useshrplib"; then
7772     case "$osname" in 
7773         aix)
7774                 # We'll set it in Makefile.SH...
7775                 ;;
7776         solaris)
7777                 xxx="-R $shrpdir"
7778                 ;;
7779         freebsd|netbsd)
7780                 xxx="-Wl,-R$shrpdir"
7781                 ;;
7782         bsdos|linux|irix*|dec_osf)
7783                 xxx="-Wl,-rpath,$shrpdir"
7784                 ;;
7785         next)
7786                 # next doesn't like the default...
7787                 ;;
7788         beos)
7789                 # beos doesn't like the default, either.
7790                 ;;
7791         hpux*)
7792                 # hpux doesn't like the default, either.
7793                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7794                 ;;
7795         *)
7796                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7797                 ;;
7798         esac
7799         case "$xxx" in
7800         '') ;;
7801         *)      
7802                 # Only add $xxx if it isn't already in ccdlflags.
7803                 case " $ccdlflags " in
7804                 *" $xxx "*)     ;;
7805                 *)      ccdlflags="$ccdlflags $xxx"
7806                         cat <<EOM >&4
7807
7808 Adding $xxx to the flags
7809 passed to $ld so that the perl executable will find the 
7810 installed shared $libperl.
7811
7812 EOM
7813                         ;;
7814                 esac
7815                 ;;
7816         esac
7817 fi
7818 # Fix ccdlflags in AIX for building external extensions.
7819 # (For building Perl itself bare -bE:perl.exp is needed,
7820 #  Makefile.SH takes care of this.)
7821 case "$osname" in
7822 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7823 esac
7824 # Respect a hint or command-line value.
7825 case "$shrpenv" in
7826 '') shrpenv="$tmp_shrpenv" ;;
7827 esac
7828 case "$ldlibpthname" in
7829 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7830 none)   ldlibpthname='' ;;
7831 esac
7832
7833 : determine where manual pages are on this system
7834 echo " "
7835 case "$sysman" in
7836 '') 
7837         syspath='/usr/share/man/man1 /usr/man/man1'
7838         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7839         syspath="$syspath /usr/man/u_man/man1"
7840         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7841         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7842         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7843         sysman=`./loc . /usr/man/man1 $syspath`
7844         ;;
7845 esac
7846 if $test -d "$sysman"; then
7847         echo "System manual is in $sysman." >&4
7848 else
7849         echo "Could not find manual pages in source form." >&4
7850 fi
7851
7852 : determine where manual pages go
7853 set man1dir man1dir none
7854 eval $prefixit
7855 $cat <<EOM
7856
7857 $spackage has manual pages available in source form.
7858 EOM
7859 case "$nroff" in
7860 nroff)
7861         echo "However, you don't have nroff, so they're probably useless to you."
7862         case "$man1dir" in
7863         '') man1dir="none";;
7864         esac;;
7865 esac
7866 echo "If you don't want the manual sources installed, answer 'none'."
7867 case "$man1dir" in
7868 ' ') dflt=none
7869         ;;
7870 '')
7871         lookpath="$prefixexp/share/man/man1"
7872         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7873         lookpath="$lookpath $prefixexp/man/p_man/man1"
7874         lookpath="$lookpath $prefixexp/man/u_man/man1"
7875         lookpath="$lookpath $prefixexp/man/man.1"
7876         case "$sysman" in
7877         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7878         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7879         esac
7880         set dflt
7881         eval $prefixup
7882         ;;
7883 *)  dflt="$man1dir"
7884         ;;
7885 esac
7886 echo " "
7887 fn=dn+~
7888 rp="Where do the main $spackage manual pages (source) go?"
7889 . ./getfile
7890 if $test "X$man1direxp" != "X$ansexp"; then
7891         installman1dir=''
7892 fi
7893 man1dir="$ans"
7894 man1direxp="$ansexp"
7895 case "$man1dir" in
7896 '')     man1dir=' '
7897         installman1dir='';;
7898 esac
7899
7900 : Change installation prefix, if necessary.
7901 if $test X"$prefix" != X"$installprefix"; then
7902         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7903 else
7904         installman1dir="$man1direxp"
7905 fi
7906
7907 : What suffix to use on installed man pages
7908
7909 case "$man1dir" in
7910 ' ')
7911         man1ext='0'
7912         ;;
7913 *)
7914         rp="What suffix should be used for the main $spackage man pages?"
7915         case "$man1ext" in
7916         '')     case "$man1dir" in
7917                 *1)  dflt=1 ;;
7918                 *1p) dflt=1p ;;
7919                 *1pm) dflt=1pm ;;
7920                 *l) dflt=l;;
7921                 *n) dflt=n;;
7922                 *o) dflt=o;;
7923                 *p) dflt=p;;
7924                 *C) dflt=C;;
7925                 *L) dflt=L;;
7926                 *L1) dflt=L1;;
7927                 *) dflt=1;;
7928                 esac
7929                 ;;
7930         *)      dflt="$man1ext";;
7931         esac
7932         . ./myread
7933         man1ext="$ans"
7934         ;;
7935 esac
7936
7937 : see if we can have long filenames
7938 echo " "
7939 first=123456789abcdef
7940 $rm -f $first
7941 if (echo hi >$first) 2>/dev/null; then
7942         if $test -f 123456789abcde; then
7943                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
7944                 val="$undef"
7945         else
7946                 echo 'You can have filenames longer than 14 characters.'>&4
7947                 val="$define"
7948         fi
7949 else
7950         $cat <<'EOM'
7951 You can't have filenames longer than 14 chars.
7952 You can't even think about them!
7953 EOM
7954         val="$undef"
7955 fi 
7956 set d_flexfnam
7957 eval $setvar
7958 $rm -rf 123456789abcde*
7959
7960 : determine where library module manual pages go
7961 set man3dir man3dir none
7962 eval $prefixit
7963 $cat <<EOM
7964
7965 $spackage has manual pages for many of the library modules.
7966 EOM
7967
7968 case "$nroff" in
7969 nroff)
7970         $cat <<'EOM'
7971 However, you don't have nroff, so they're probably useless to you.
7972 EOM
7973         case "$man3dir" in
7974         '') man3dir="none";;
7975         esac;;
7976 esac
7977
7978 case "$d_flexfnam" in
7979 undef)
7980         $cat <<'EOM'
7981 However, your system can't handle the long file names like File::Basename.3. 
7982 EOM
7983         case "$man3dir" in
7984         '') man3dir="none";;
7985         esac;;
7986 esac
7987
7988 echo "If you don't want the manual sources installed, answer 'none'."
7989 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7990 case "$man3dir" in
7991 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7992         if $test -d "$privlib/man/man3"; then
7993                 cat <<EOM >&4
7994
7995 WARNING:  Previous versions of perl installed man3 pages into
7996 $privlib/man/man3.  This version will suggest a 
7997 new default of $dflt.  
7998 EOM
7999                 tdflt=$dflt
8000                 dflt='n'
8001                 rp='Do you wish to preserve the old behavior?(y/n)'
8002                 . ./myread
8003                 case "$ans" in
8004                 y*) dflt="$privlib/man/man3" ;;
8005                 *)  dflt=$tdflt ;;
8006                 esac
8007     fi
8008         ;;
8009 *)      dflt="$man3dir" ;;
8010 esac
8011 case "$dflt" in
8012 ' ') dflt=none ;;
8013 esac
8014 echo " "
8015 fn=dn+~
8016 rp="Where do the $package library man pages (source) go?"
8017 . ./getfile
8018 man3dir="$ans"
8019 man3direxp="$ansexp"
8020 case "$man3dir" in
8021 '')     man3dir=' '
8022         installman3dir='';;
8023 esac
8024
8025 : Change installation prefix, if necessary.
8026 if $test X"$prefix" != X"$installprefix"; then
8027         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8028 else
8029         installman3dir="$man3direxp"
8030 fi
8031
8032 : What suffix to use on installed man pages
8033 case "$man3dir" in
8034 ' ')
8035         man3ext='0'
8036         ;;
8037 *)
8038         rp="What suffix should be used for the $package library man pages?"
8039         case "$man3ext" in
8040         '')     case "$man3dir" in
8041                 *3)  dflt=3 ;;
8042                 *3p) dflt=3p ;;
8043                 *3pm) dflt=3pm ;;
8044                 *l) dflt=l;;
8045                 *n) dflt=n;;
8046                 *o) dflt=o;;
8047                 *p) dflt=p;;
8048                 *C) dflt=C;;
8049                 *L) dflt=L;;
8050                 *L3) dflt=L3;;
8051                 *) dflt=3;;
8052                 esac
8053                 ;;
8054         *)      dflt="$man3ext";;
8055         esac
8056         . ./myread
8057         man3ext="$ans"
8058         ;;
8059 esac
8060
8061 : see if we have to deal with yellow pages, now NIS.
8062 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8063         if $test -f /usr/etc/nibindd; then
8064                 echo " "
8065                 echo "I'm fairly confident you're on a NeXT."
8066                 echo " "
8067                 rp='Do you get the hosts file via NetInfo?'
8068                 dflt=y
8069                 case "$hostcat" in
8070                 nidump*) ;;
8071                 '') ;;
8072                 *) dflt=n;;
8073                 esac
8074                 . ./myread
8075                 case "$ans" in
8076                 y*) hostcat='nidump hosts .';;
8077                 *)      case "$hostcat" in
8078                         nidump*) hostcat='';;
8079                         esac
8080                         ;;
8081                 esac
8082         fi
8083         case "$hostcat" in
8084         nidump*) ;;
8085         *)
8086                 case "$hostcat" in
8087                 *ypcat*) dflt=y;;
8088                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8089                                 dflt=y
8090                         else
8091                                 dflt=n
8092                         fi;;
8093                 *) dflt=n;;
8094                 esac
8095                 echo " "
8096                 rp='Are you getting the hosts file via yellow pages?'
8097                 . ./myread
8098                 case "$ans" in
8099                 y*) hostcat='ypcat hosts';;
8100                 *) hostcat='cat /etc/hosts';;
8101                 esac
8102                 ;;
8103         esac
8104 fi
8105 case "$hostcat" in
8106 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8107 esac
8108 case "$groupcat" in
8109 '') test -f /etc/group && groupcat='cat /etc/group';;
8110 esac
8111 case "$passcat" in
8112 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8113 esac
8114
8115 : now get the host name
8116 echo " "
8117 echo "Figuring out host name..." >&4
8118 case "$myhostname" in
8119 '') cont=true
8120         echo 'Maybe "hostname" will work...'
8121         if tans=`sh -c hostname 2>&1` ; then
8122                 myhostname=$tans
8123                 phostname=hostname
8124                 cont=''
8125         fi
8126         ;;
8127 *) cont='';;
8128 esac
8129 if $test "$cont"; then
8130         if ./xenix; then
8131                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8132                 if tans=`cat /etc/systemid 2>&1` ; then
8133                         myhostname=$tans
8134                         phostname='cat /etc/systemid'
8135                         echo "Whadyaknow.  Xenix always was a bit strange..."
8136                         cont=''
8137                 fi
8138         elif $test -r /etc/systemid; then
8139                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8140         fi
8141 fi
8142 if $test "$cont"; then
8143         echo 'No, maybe "uuname -l" will work...'
8144         if tans=`sh -c 'uuname -l' 2>&1` ; then
8145                 myhostname=$tans
8146                 phostname='uuname -l'
8147         else
8148                 echo 'Strange.  Maybe "uname -n" will work...'
8149                 if tans=`sh -c 'uname -n' 2>&1` ; then
8150                         myhostname=$tans
8151                         phostname='uname -n'
8152                 else
8153                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8154                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8155                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8156                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8157                         else
8158                                 case "$myhostname" in
8159                                 '') echo "Does this machine have an identity crisis or something?"
8160                                         phostname='';;
8161                                 *)
8162                                         echo "Well, you said $myhostname before..."
8163                                         phostname='echo $myhostname';;
8164                                 esac
8165                         fi
8166                 fi
8167         fi
8168 fi
8169 case "$myhostname" in
8170 '') myhostname=noname ;;
8171 esac
8172 : you do not want to know about this
8173 set $myhostname
8174 myhostname=$1
8175
8176 : verify guess
8177 if $test "$myhostname" ; then
8178         dflt=y
8179         rp='Your host name appears to be "'$myhostname'".'" Right?"
8180         . ./myread
8181         case "$ans" in
8182         y*) ;;
8183         *) myhostname='';;
8184         esac
8185 fi
8186
8187 : bad guess or no guess
8188 while $test "X$myhostname" = X ; do
8189         dflt=''
8190         rp="Please type the (one word) name of your host:"
8191         . ./myread
8192         myhostname="$ans"
8193 done
8194
8195 : translate upper to lower if necessary
8196 case "$myhostname" in
8197 *[A-Z]*)
8198         echo "(Normalizing case in your host name)"
8199         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8200         ;;
8201 esac
8202
8203 case "$myhostname" in
8204 *.*)
8205         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8206         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8207         echo "(Trimming domain name from host name--host name is now $myhostname)"
8208         ;;
8209 *) case "$mydomain" in
8210         '')
8211                 {
8212                         test "X$hostcat" = "Xypcat hosts" &&
8213                         ypmatch "$myhostname" hosts 2>/dev/null |\
8214                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8215                         $test -s hosts
8216                 } || {
8217                         test "X$hostcat" != "X" &&
8218                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8219                                         /[       ]$myhostname[  . ]/p" > hosts
8220                 }
8221                 tmp_re="[       . ]"
8222                 if $test -f hosts; then
8223                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8224                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8225                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8226                                 hosts | $sort | $uniq | \
8227                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8228                         case `$echo X$dflt` in
8229                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8230                                 dflt=.
8231                                 ;;
8232                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8233                                 ;;
8234                         esac
8235                 else
8236                         echo "(I cannot locate a hosts database anywhere)"
8237                         dflt=.
8238                 fi
8239                 case "$dflt" in
8240                 .)
8241                         tans=`./loc resolv.conf X /etc /usr/etc`
8242                         if $test -f "$tans"; then
8243                                 echo "(Attempting domain name extraction from $tans)"
8244                                 dflt=.`$sed -n -e 's/   / /g' \
8245                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8246                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8247                                 case "$dflt" in
8248                                 .) dflt=.`$sed -n -e 's/        / /g' \
8249                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8250                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8251                                         ;;
8252                                 esac
8253                         fi
8254                         ;;
8255                 esac
8256                 case "$dflt" in
8257                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8258                         dflt=.`sh -c domainname 2>/dev/null`
8259                         case "$dflt" in
8260                         '') dflt='.';;
8261                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8262                         esac
8263                         ;;
8264                 esac
8265                 case "$dflt$osname" in
8266                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8267                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8268                         ;;
8269                 esac
8270                 case "$dflt" in
8271                 .) echo "(Lost all hope -- silly guess then)"
8272                         dflt='.nonet'
8273                         ;;
8274                 esac
8275                 $rm -f hosts
8276                 ;;
8277         *) dflt="$mydomain";;
8278         esac;;
8279 esac
8280 echo " "
8281 rp="What is your domain name?"
8282 . ./myread
8283 tans="$ans"
8284 case "$ans" in
8285 '') ;;
8286 .*) ;;
8287 *) tans=".$tans";;
8288 esac
8289 mydomain="$tans"
8290
8291 : translate upper to lower if necessary
8292 case "$mydomain" in
8293 *[A-Z]*)
8294         echo "(Normalizing case in your domain name)"
8295         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8296         ;;
8297 esac
8298
8299 : a little sanity check here
8300 case "$phostname" in
8301 '') ;;
8302 *)
8303         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8304         $myhostname$mydomain|$myhostname) ;;
8305         *)
8306                 case "$phostname" in
8307                 sed*)
8308                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8309                         ;;
8310                 *)
8311                         echo "(That doesn't agree with your $phostname command, by the way.)"
8312                         ;;
8313                 esac
8314         ;;
8315         esac
8316         ;;
8317 esac
8318
8319 $cat <<EOM
8320
8321 I need to get your e-mail address in Internet format if possible, i.e.
8322 something like user@host.domain. Please answer accurately since I have
8323 no easy means to double check it. The default value provided below
8324 is most probably close to reality but may not be valid from outside
8325 your organization...
8326
8327 EOM
8328 cont=x
8329 while test "$cont"; do
8330         case "$cf_email" in
8331         '') dflt="$cf_by@$myhostname$mydomain";;
8332         *) dflt="$cf_email";;
8333         esac
8334         rp='What is your e-mail address?'
8335         . ./myread
8336         cf_email="$ans"
8337         case "$cf_email" in
8338         *@*.*) cont='' ;;
8339         *)
8340                 rp='Address does not look like an Internet one.  Use it anyway?'
8341                 case "$fastread" in
8342                 yes) dflt=y ;;
8343                 *) dflt=n ;;
8344                 esac
8345                 . ./myread
8346                 case "$ans" in
8347                 y*) cont='' ;;
8348                 *) echo " " ;;
8349                 esac
8350                 ;;
8351         esac
8352 done
8353
8354 $cat <<EOM
8355
8356 If you or somebody else will be maintaining perl at your site, please
8357 fill in the correct e-mail address here so that they may be contacted
8358 if necessary. Currently, the "perlbug" program included with perl
8359 will send mail to this address in addition to perlbug@perl.org. You may
8360 enter "none" for no administrator.
8361
8362 EOM
8363 case "$perladmin" in
8364 '') dflt="$cf_email";;
8365 *) dflt="$perladmin";;
8366 esac
8367 rp='Perl administrator e-mail address'
8368 . ./myread
8369 perladmin="$ans"
8370
8371 : determine whether to only install version-specific parts.
8372 echo " "
8373 $cat <<EOM
8374 Do you want to install only the version-specific parts of the perl
8375 distribution?  Usually you do *not* want to do this.
8376 EOM
8377 case "$versiononly" in
8378 "$define"|[Yy]*|true) dflt='y' ;;
8379 *) dflt='n';
8380 esac
8381 rp="Do you want to install only the version-specific parts of perl?"
8382 . ./myread
8383 case "$ans" in
8384 [yY]*)  val="$define";;
8385 *)      val="$undef" ;;
8386 esac
8387 set versiononly
8388 eval $setvar
8389
8390 : figure out how to guarantee perl startup
8391 case "$startperl" in
8392 '')
8393         case "$sharpbang" in
8394         *!)
8395                 $cat <<EOH
8396
8397 I can use the #! construct to start perl on your system. This will
8398 make startup of perl scripts faster, but may cause problems if you
8399 want to share those scripts and perl is not in a standard place
8400 ($binexp/perl) on all your platforms. The alternative is to force
8401 a shell by starting the script with a single ':' character.
8402
8403 EOH
8404                 case "$versiononly" in
8405                 "$define")      dflt="$binexp/perl$version";;  
8406                 *)              dflt="$binexp/perl";;
8407                 esac
8408                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8409                 . ./myread
8410                 case "$ans" in
8411                 none)   startperl=": # use perl";;
8412                 *)      startperl="#!$ans"
8413                         if $test 30 -lt `echo "$ans" | wc -c`; then
8414                                 $cat >&4 <<EOM
8415
8416 WARNING:  Some systems limit the #! command to 32 characters.
8417 If you experience difficulty running Perl scripts with #!, try
8418 installing Perl in a directory with a shorter pathname.
8419
8420 EOM
8421                         fi ;;
8422                 esac
8423                 ;;
8424         *) startperl=": # use perl"
8425                 ;;
8426         esac
8427         ;;
8428 esac
8429 echo "I'll use $startperl to start perl scripts."
8430
8431 : figure best path for perl in scripts
8432 case "$perlpath" in
8433 '')
8434         case "$versiononly" in
8435         "$define")      perlpath="$binexp/perl$version";;
8436         *)              perlpath="$binexp/perl";;
8437         esac
8438         case "$startperl" in
8439         *!*) ;;
8440         *)
8441                 $cat <<EOH
8442
8443 I will use the "eval 'exec'" idiom to start Perl on your system.
8444 I can use the full path of your Perl binary for this purpose, but
8445 doing so may cause problems if you want to share those scripts and
8446 Perl is not always in a standard place ($binexp/perl).
8447
8448 EOH
8449                 dflt="$binexp/perl"
8450                 rp="What path shall I use in \"eval 'exec'\"?"
8451                 . ./myread
8452                 perlpath="$ans"
8453                 ;;
8454         esac
8455         ;;
8456 esac
8457 case "$startperl" in
8458 *!*)    ;;
8459 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8460 esac
8461
8462 : determine where public executable scripts go
8463 set scriptdir scriptdir
8464 eval $prefixit
8465 case "$scriptdir" in
8466 '')
8467         dflt="$bin"
8468         : guess some guesses
8469         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8470         $test -d /usr/share/bin     && dflt=/usr/share/bin
8471         $test -d /usr/local/script  && dflt=/usr/local/script
8472         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8473         $test -d $prefixexp/script  && dflt=$prefixexp/script
8474         set dflt
8475         eval $prefixup
8476         ;;
8477 *)  dflt="$scriptdir"
8478         ;;
8479 esac
8480 $cat <<EOM
8481  
8482 Some installations have a separate directory just for executable scripts so
8483 that they can mount it across multiple architectures but keep the scripts in
8484 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8485 Or you might just lump your scripts in with all your other executables.
8486  
8487 EOM
8488 fn=d~
8489 rp='Where do you keep publicly executable scripts?'
8490 . ./getfile
8491 if $test "X$ansexp" != "X$scriptdirexp"; then
8492         installscript=''
8493 fi
8494 scriptdir="$ans"
8495 scriptdirexp="$ansexp"
8496 : Change installation prefix, if necessary.
8497 if $test X"$prefix" != X"$installprefix"; then
8498         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8499 else
8500         installscript="$scriptdirexp"
8501 fi
8502
8503 : determine where add-on public executables go
8504 case "$sitebin" in
8505 '')     dflt=$siteprefix/bin ;;
8506 *)      dflt=$sitebin ;;
8507 esac
8508 fn=d~
8509 rp='Pathname where the add-on public executables should be installed?'
8510 . ./getfile
8511 sitebin="$ans"
8512 sitebinexp="$ansexp"
8513 : Change installation prefix, if necessary.
8514 if $test X"$prefix" != X"$installprefix"; then
8515         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8516 else
8517         installsitebin="$sitebinexp"
8518 fi
8519
8520 : define an is-a-typedef? function
8521 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8522 case "$inclist" in
8523 "") inclist="sys/types.h";;
8524 esac;
8525 eval "varval=\$$var";
8526 case "$varval" in
8527 "")
8528         $rm -f temp.c;
8529         for inc in $inclist; do
8530                 echo "#include <$inc>" >>temp.c;
8531         done;
8532         echo "#ifdef $type" >> temp.c;
8533         echo "printf(\"We have $type\");" >> temp.c;
8534         echo "#endif" >> temp.c;
8535         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8536         if $contains $type temp.E >/dev/null 2>&1; then
8537                 eval "$var=\$type";
8538         else
8539                 eval "$var=\$def";
8540         fi;
8541         $rm -f temp.?;;
8542 *) eval "$var=\$varval";;
8543 esac'
8544
8545 : define an is-a-typedef? function that prompts if the type is not available.
8546 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8547 case "$inclist" in
8548 "") inclist="sys/types.h";;
8549 esac;
8550 eval "varval=\$$var";
8551 case "$varval" in
8552 "")
8553         $rm -f temp.c;
8554         for inc in $inclist; do
8555                 echo "#include <$inc>" >>temp.c;
8556         done;
8557         echo "#ifdef $type" >> temp.c;
8558         echo "printf(\"We have $type\");" >> temp.c;
8559         echo "#endif" >> temp.c;
8560         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8561         echo " " ;
8562         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8563         if $contains $type temp.E >/dev/null 2>&1; then
8564                 echo "$type found." >&4;
8565                 eval "$var=\$type";
8566         else
8567                 echo "$type NOT found." >&4;
8568                 dflt="$def";
8569                 . ./myread ;
8570                 eval "$var=\$ans";
8571         fi;
8572         $rm -f temp.?;;
8573 *) eval "$var=\$varval";;
8574 esac'
8575
8576 : see what type lseek is declared as in the kernel
8577 rp="What is the type used for lseek's offset on this system?"
8578 set off_t lseektype long stdio.h sys/types.h
8579 eval $typedef_ask
8580
8581 echo " "
8582 echo "Checking to see how big your file offsets are..." >&4
8583 $cat >try.c <<EOCP
8584 #include <sys/types.h>
8585 #include <stdio.h>
8586 int main()
8587 {
8588     printf("%d\n", (int)sizeof($lseektype));
8589     return(0); 
8590 }
8591 EOCP
8592 set try
8593 if eval $compile_ok; then
8594         lseeksize=`$run ./try`
8595         echo "Your file offsets are $lseeksize bytes long."
8596 else
8597         dflt=$longsize
8598         echo " "
8599         echo "(I can't seem to compile the test program.  Guessing...)"
8600         rp="What is the size of your file offsets (in bytes)?"
8601         . ./myread
8602         lseeksize="$ans"
8603 fi
8604 $rm -f try.c try
8605
8606 : see what type file positions are declared as in the library
8607 rp="What is the type for file position used by fsetpos()?"
8608 set fpos_t fpostype long stdio.h sys/types.h
8609 eval $typedef_ask
8610
8611 echo " "
8612 case "$fpostype" in
8613 *_t) zzz="$fpostype"    ;;
8614 *)   zzz="fpos_t"       ;;
8615 esac
8616 echo "Checking the size of $zzz..." >&4 
8617 cat > try.c <<EOCP
8618 #include <sys/types.h>
8619 #include <stdio.h>
8620 int main() {
8621     printf("%d\n", (int)sizeof($fpostype));
8622     exit(0);
8623 }
8624 EOCP
8625 set try
8626 if eval $compile_ok; then
8627         yyy=`$run ./try`
8628         case "$yyy" in
8629         '')     fpossize=4
8630                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8631                 ;;
8632         *)      fpossize=$yyy
8633                 echo "Your $zzz is $fpossize bytes long."
8634                 ;;
8635         esac
8636 else
8637         dflt="$longsize"
8638         echo " " >&4
8639         echo "(I can't compile the test program.  Guessing...)" >&4
8640         rp="What is the size of your file positions (in bytes)?"
8641         . ./myread
8642         fpossize="$ans"
8643 fi
8644
8645
8646
8647 # Backward compatibility (uselfs is deprecated).
8648 case "$uselfs" in
8649 "$define"|true|[yY]*)
8650         cat <<EOM >&4
8651
8652 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8653 EOM
8654         uselargefiles="$define"
8655         ;;
8656 esac                          
8657
8658 case "$lseeksize:$fpossize" in
8659 8:8) cat <<EOM
8660
8661 You can have files larger than 2 gigabytes.
8662 EOM
8663    val="$define" ;;
8664 *)    case "$uselargefiles" in
8665    "$undef"|false|[nN]*) dflt='n' ;;
8666    *)   dflt='y' ;;
8667    esac
8668    cat <<EOM
8669
8670 Perl can be built to understand large files (files larger than 2 gigabytes)
8671 on some systems.  To do so, Configure can be run with -Duselargefiles.
8672
8673 If this doesn't make any sense to you, just accept the default '$dflt'.
8674 EOM
8675    rp='Try to understand large files, if available?'
8676    . ./myread
8677    case "$ans" in
8678    y|Y)         val="$define" ;;
8679    *)           val="$undef"  ;;
8680    esac
8681    ;;
8682 esac
8683 set uselargefiles
8684 eval $setvar
8685 case "$uselargefiles" in
8686 "$define")
8687 : Look for a hint-file generated 'call-back-unit'.  If the
8688 : user has specified that a large files perl is to be built,
8689 : we may need to set or change some other defaults.
8690         if $test -f uselargefiles.cbu; then
8691                 echo "Your platform has some specific hints for large file builds, using them..."
8692                 . ./uselargefiles.cbu
8693                 echo " "
8694                 echo "Rechecking to see how big your file offsets are..." >&4
8695                 $cat >try.c <<EOCP
8696 #include <sys/types.h>
8697 #include <stdio.h>
8698 int main()
8699 {
8700     printf("%d\n", (int)sizeof($lseektype));
8701     return(0); 
8702 }
8703 EOCP
8704                 set try
8705                 if eval $compile_ok; then
8706                         lseeksize=`$run ./try`
8707                         $echo "Your file offsets are now $lseeksize bytes long."
8708                 else
8709                         dflt="$lseeksize"
8710                         echo " "
8711                         echo "(I can't seem to compile the test program.  Guessing...)"
8712                         rp="What is the size of your file offsets (in bytes)?"
8713                         . ./myread
8714                         lseeksize="$ans"
8715                 fi
8716                 case "$fpostype" in
8717                 *_t) zzz="$fpostype"    ;;
8718                 *)   zzz="fpos_t"       ;;
8719                 esac
8720                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8721                 $cat > try.c <<EOCP
8722 #include <sys/types.h>
8723 #include <stdio.h>
8724 int main() {
8725     printf("%d\n", (int)sizeof($fpostype));
8726     exit(0);
8727 }
8728 EOCP
8729                 set try
8730                 if eval $compile_ok; then
8731                         yyy=`$run ./try`
8732                         dflt="$lseeksize"
8733                         case "$yyy" in
8734                         '')     echo " "
8735                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8736                                 ;;
8737                         *)      fpossize=$yyy
8738                                 echo " $fpossize bytes." >&4
8739                                 ;;
8740                         esac
8741                 else
8742                         dflt="$fpossize"
8743                         echo " "
8744                         echo "(I can't compile the test program.  Guessing...)" >&4
8745                         rp="What is the size of your file positions (in bytes)?"
8746                         . ./myread
8747                         fpossize="$ans"
8748                 fi
8749                 $rm -f try.c try
8750         fi
8751         ;;
8752 esac
8753
8754 case "$vendorprefix" in
8755 '')     d_vendorbin="$undef"
8756         vendorbin=''
8757         vendorbinexp=''
8758         ;;
8759 *)      d_vendorbin="$define"
8760         : determine where vendor-supplied executables go.
8761         case "$vendorbin" in
8762         '') dflt=$vendorprefix/bin ;;
8763         *)      dflt="$vendorbin" ;;
8764         esac
8765         fn=d~+
8766         rp='Pathname for the vendor-supplied executables directory?'
8767         . ./getfile
8768         vendorbin="$ans"
8769         vendorbinexp="$ansexp"
8770         ;;
8771 esac
8772 : Change installation prefix, if necessary.
8773 if $test X"$prefix" != X"$installprefix"; then
8774         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8775 else
8776         installvendorbin="$vendorbinexp"
8777 fi
8778
8779 : see if qgcvt exists
8780 set qgcvt d_qgcvt
8781 eval $inlibc
8782
8783 : Check how to convert floats to strings.
8784
8785 if test "X$d_Gconvert" = X; then
8786
8787 echo " "
8788 echo "Checking for an efficient way to convert floats to strings."
8789 echo " " > try.c
8790 case "$uselongdouble" in
8791 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8792 esac
8793 case "$d_longdbl" in
8794 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8795 esac
8796 case "$d_PRIgldbl" in
8797 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
8798 esac
8799 $cat >>try.c <<EOP
8800 #ifdef TRY_gconvert
8801 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8802 char *myname = "gconvert";
8803 #endif
8804 #ifdef TRY_gcvt
8805 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8806 char *myname = "gcvt";
8807 #endif
8808 #ifdef TRY_qgcvt
8809 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8810 char *myname = "qgcvt";
8811 #define DOUBLETYPE long double
8812 #endif
8813 #ifdef TRY_sprintf
8814 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8815 #ifdef HAS_PRIgldbl
8816 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8817 #else
8818 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
8819 #endif
8820 #else
8821 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8822 #endif
8823 char *myname = "sprintf";
8824 #endif
8825
8826 #ifndef DOUBLETYPE
8827 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8828 #define DOUBLETYPE long double
8829 #else
8830 #define DOUBLETYPE double
8831 #endif
8832 #endif
8833
8834 #include <stdio.h>
8835
8836 #define I_STDLIB $i_stdlib
8837 #ifdef I_STDLIB
8838 #include <stdlib.h>
8839 #endif
8840
8841 int
8842 checkit(expect, got)
8843 char *expect;
8844 char *got;
8845 {
8846     if (strcmp(expect, got)) {
8847                 printf("%s oddity:  Expected %s, got %s\n",
8848                         myname, expect, got);
8849                 exit(1);
8850         }
8851 }
8852
8853 int main()
8854
8855         char buf[64]; 
8856         buf[63] = '\0';
8857
8858         /* This must be 1st test on (which?) platform */
8859         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8860         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8861         checkit("0.1", buf);
8862
8863         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
8864         checkit("0.01", buf);
8865
8866         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
8867         checkit("0.001", buf);
8868
8869         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
8870         checkit("0.0001", buf);
8871
8872         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
8873         if (strlen(buf) > 5)
8874             checkit("9e-005", buf); /* for Microsoft ?? */
8875         else
8876             checkit("9e-05", buf);
8877
8878         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
8879         checkit("1", buf);
8880
8881         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
8882         checkit("1.1", buf);
8883
8884         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
8885         checkit("1.01", buf);
8886
8887         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
8888         checkit("1.001", buf);
8889
8890         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
8891         checkit("1.0001", buf);
8892
8893         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
8894         checkit("1.00001", buf);
8895
8896         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
8897         checkit("1.000001", buf);
8898
8899         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
8900         checkit("0", buf);
8901
8902         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
8903         checkit("-1", buf);
8904
8905         /* Some Linux gcvt's give 1.e+5 here. */
8906         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
8907         checkit("100000", buf);
8908         
8909         /* Some Linux gcvt's give -1.e+5 here. */
8910         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
8911         checkit("-100000", buf);
8912
8913         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
8914         checkit("123.456", buf);
8915
8916         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
8917         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
8918         /* 34 should be enough to scare even long double
8919          * places into using the e notation. */
8920         if (strlen(buf) > 5)
8921             checkit("1e+034", buf); /* for Microsoft */
8922         else
8923             checkit("1e+34", buf);
8924
8925         /* For Perl, if you add additional tests here, also add them to
8926          * t/base/num.t for benefit of platforms not using Configure or
8927          * overriding d_Gconvert */
8928
8929         exit(0);
8930 }
8931 EOP
8932 : first add preferred functions to our list
8933 xxx_list=""
8934 for xxx_convert in $gconvert_preference; do
8935     case $xxx_convert in
8936     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
8937     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
8938     esac 
8939 done
8940 : then add any others
8941 for xxx_convert in gconvert gcvt sprintf; do
8942     case "$xxx_list" in
8943     *$xxx_convert*) ;;
8944     *) xxx_list="$xxx_list $xxx_convert" ;;
8945     esac 
8946 done
8947
8948 case "$d_longdbl$uselongdouble" in
8949 "$define$define")
8950     : again, add prefered functions to our list first
8951     xxx_ld_list=""
8952     for xxx_convert in $gconvert_ld_preference; do
8953         case $xxx_convert in
8954         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
8955         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
8956         esac
8957     done
8958     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
8959     for xxx_convert in qgcvt sprintf $xxx_list; do
8960         case "$xxx_ld_list" in
8961         $xxx_convert*|*" $xxx_convert"*) ;;
8962         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
8963         esac
8964     done
8965     : if sprintf cannot do long doubles, move it to the end
8966     if test "$d_PRIgldbl" != "$define"; then
8967         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
8968     fi
8969     : if no qgcvt, remove it
8970     if test "$d_qgcvt" != "$define"; then
8971         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
8972     fi
8973     : use the ld_list
8974     xxx_list="$xxx_ld_list"
8975     ;;
8976 esac
8977
8978 for xxx_convert in $xxx_list; do
8979         echo "Trying $xxx_convert..."
8980         $rm -f try try$_o
8981         set try -DTRY_$xxx_convert
8982         if eval $compile; then
8983                 echo "$xxx_convert() found." >&4
8984                 if $run ./try; then
8985                         echo "I'll use $xxx_convert to convert floats into a string." >&4
8986                         break;
8987                 else
8988                         echo "...But $xxx_convert didn't work as I expected."
8989                         xxx_convert=''
8990                 fi
8991         else
8992                 echo "$xxx_convert NOT found." >&4
8993         fi
8994 done
8995
8996 if test X$xxx_convert = X; then
8997     echo "*** WHOA THERE!!! ***" >&4
8998     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
8999     xxx_convert=sprintf
9000 fi
9001
9002 case "$xxx_convert" in
9003 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9004 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9005 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9006 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9007    "$define$define$define")
9008       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9009    "$define$define$undef")
9010       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9011    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9012    esac
9013    ;;  
9014 esac
9015
9016 fi
9017
9018 : see if _fwalk exists
9019 set fwalk d__fwalk
9020 eval $inlibc
9021
9022 : Initialize h_fcntl
9023 h_fcntl=false
9024
9025 : Initialize h_sysfile
9026 h_sysfile=false
9027
9028 : access call always available on UNIX
9029 set access d_access
9030 eval $inlibc
9031
9032 : locate the flags for 'access()'
9033 case "$d_access" in
9034 "$define")
9035         echo " "
9036         $cat >access.c <<'EOCP'
9037 #include <sys/types.h>
9038 #ifdef I_FCNTL
9039 #include <fcntl.h>
9040 #endif
9041 #ifdef I_SYS_FILE
9042 #include <sys/file.h>
9043 #endif
9044 #ifdef I_UNISTD
9045 #include <unistd.h>
9046 #endif
9047 int main() {
9048         exit(R_OK);
9049 }
9050 EOCP
9051         : check sys/file.h first, no particular reason here
9052         if $test `./findhdr sys/file.h` && \
9053                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9054                 h_sysfile=true;
9055                 echo "<sys/file.h> defines the *_OK access constants." >&4
9056         elif $test `./findhdr fcntl.h` && \
9057                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9058                 h_fcntl=true;
9059                 echo "<fcntl.h> defines the *_OK access constants." >&4
9060         elif $test `./findhdr unistd.h` && \
9061                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9062                 echo "<unistd.h> defines the *_OK access constants." >&4
9063         else
9064                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9065         fi
9066         ;;
9067 esac
9068 $rm -f access*
9069
9070 : see if accessx exists
9071 set accessx d_accessx
9072 eval $inlibc
9073
9074 : see if alarm exists
9075 set alarm d_alarm
9076 eval $inlibc
9077
9078 : define a fucntion to check prototypes
9079 $cat > protochk <<EOSH
9080 $startsh
9081 cc="$cc"
9082 optimize="$optimize"
9083 ccflags="$ccflags"
9084 prototype="$prototype"
9085 define="$define"
9086 rm=$rm
9087 EOSH
9088
9089 $cat >> protochk <<'EOSH'
9090
9091 $rm -f try.c
9092 foo="$1"
9093 shift
9094 while test $# -ge 2; do
9095         case "$1" in
9096                 $define) echo "#include <$2>" >> try.c ;;
9097                 literal) echo "$2" >> try.c ;;
9098         esac
9099     shift 2
9100 done
9101 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9102 cat >> try.c <<'EOCP'
9103 #ifdef CAN_PROTOTYPE
9104 #define _(args) args
9105 #else
9106 #define _(args) ()
9107 #endif
9108 EOCP
9109 echo "$foo" >> try.c
9110 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9111 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9112 status=$?
9113 $rm -f try.[co]
9114 exit $status
9115 EOSH
9116 chmod +x protochk
9117 $eunicefix protochk
9118
9119 hasproto='varname=$1; func=$2; shift; shift;
9120 while $test $# -ge 2; do
9121         case "$1" in
9122         $define) echo "#include <$2>";;
9123         esac ;
9124     shift 2;
9125 done > try.c;
9126 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9127 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9128         echo "$func() prototype found.";
9129         val="$define";
9130 else
9131         echo "$func() prototype NOT found.";
9132         val="$undef";
9133 fi;
9134 set $varname;
9135 eval $setvar;
9136 $rm -f try.c tryout.c'
9137
9138 : see if sys/types.h has to be included
9139 set sys/types.h i_systypes
9140 eval $inhdr
9141
9142 : see if sys/select.h has to be included
9143 set sys/select.h i_sysselct
9144 eval $inhdr
9145
9146 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9147 while $test $# -ge 2; do
9148         case "$1" in
9149         $define) echo "#include <$2>";;
9150         esac ;
9151     shift 2;
9152 done > try.c;
9153 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9154 set try;
9155 if eval $compile; then
9156         val="$define";
9157 else
9158         val="$undef";
9159 fi;
9160 set $varname;
9161 eval $setvar;
9162 $rm -f try.c try.o'
9163
9164 : see if we should include time.h, sys/time.h, or both
9165 echo " "
9166 if test "X$timeincl" = X; then
9167         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9168         $echo $n "I'm now running the test program...$c"
9169         $cat >try.c <<'EOCP'
9170 #include <sys/types.h>
9171 #ifdef I_TIME
9172 #include <time.h>
9173 #endif
9174 #ifdef I_SYSTIME
9175 #ifdef SYSTIMEKERNEL
9176 #define KERNEL
9177 #endif
9178 #include <sys/time.h>
9179 #endif
9180 #ifdef I_SYSSELECT
9181 #include <sys/select.h>
9182 #endif
9183 int main()
9184 {
9185         struct tm foo;
9186 #ifdef S_TIMEVAL
9187         struct timeval bar;
9188 #endif
9189 #ifdef S_TIMEZONE
9190         struct timezone tzp;
9191 #endif
9192         if (foo.tm_sec == foo.tm_sec)
9193                 exit(0);
9194 #ifdef S_TIMEVAL
9195         if (bar.tv_sec == bar.tv_sec)
9196                 exit(0);
9197 #endif
9198         exit(1);
9199 }
9200 EOCP
9201         flags=''
9202         for s_timezone in '-DS_TIMEZONE' ''; do
9203         sysselect=''
9204         for s_timeval in '-DS_TIMEVAL' ''; do
9205         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9206         for i_time in '' '-DI_TIME'; do
9207         for i_systime in '-DI_SYSTIME' ''; do
9208                 case "$flags" in
9209                 '') $echo $n ".$c"
9210                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9211                         if eval $compile; then
9212                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9213                                 shift
9214                                 flags="$*"
9215                                 echo " "
9216                                 $echo $n "Succeeded with $flags$c"
9217                         fi
9218                         ;;
9219                 esac
9220         done
9221         done
9222         done
9223         done
9224         done
9225         timeincl=''
9226         echo " "
9227         case "$flags" in
9228         *SYSTIMEKERNEL*) i_systimek="$define"
9229                 timeincl=`./findhdr sys/time.h`
9230                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9231         *) i_systimek="$undef";;
9232         esac
9233         case "$flags" in
9234         *I_TIME*) i_time="$define"
9235                 timeincl=`./findhdr time.h`" $timeincl"
9236                 echo "We'll include <time.h>." >&4;;
9237         *) i_time="$undef";;
9238         esac
9239         case "$flags" in
9240         *I_SYSTIME*) i_systime="$define"
9241                 timeincl=`./findhdr sys/time.h`" $timeincl"
9242                 echo "We'll include <sys/time.h>." >&4;;
9243         *) i_systime="$undef";;
9244         esac
9245         $rm -f try.c try
9246 fi
9247 : see if struct tm knows about tm_zone
9248 case "$i_systime$i_time" in
9249 *$define*) 
9250         echo " "
9251         echo "Checking to see if your struct tm has tm_zone field..." >&4
9252         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9253         eval $hasfield
9254         ;;
9255 *)      val="$undef"
9256         set d_tm_tm_zone
9257         eval $setvar
9258         ;;
9259 esac
9260 case "$d_tm_tm_zone" in
9261 "$define")      echo "Yes, it does."   ;;
9262 *)              echo "No, it doesn't." ;;
9263 esac
9264 : see if struct tm knows about tm_gmtoff
9265 case "$i_systime$i_time" in
9266 *$define*) 
9267         echo " "
9268         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9269         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9270         eval $hasfield
9271         ;;
9272 *)      val="$undef"
9273         set d_tm_tm_gmtoff
9274         eval $setvar
9275         ;;
9276 esac
9277 case "$d_tm_tm_gmtoff" in
9278 "$define")      echo "Yes, it does."   ;;
9279 *)              echo "No, it doesn't." ;;
9280 esac
9281
9282 : see if asctime_r exists
9283 set asctime_r d_asctime_r
9284 eval $inlibc
9285 case "$d_asctime_r" in
9286 "$define")
9287         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h"
9288         case "time" in
9289         time)
9290                 hdrs="$hdrs $i_systime sys/time.h"
9291                 ;;
9292         esac
9293         case "$d_asctime_r_proto:$usethreads" in
9294         ":define")      d_asctime_r_proto=define
9295                 set d_asctime_r_proto asctime_r $hdrs
9296                 eval $hasproto ;;
9297         *)      ;;
9298         esac
9299         case "$d_asctime_r_proto" in
9300         define)
9301         case "$asctime_r_proto" in
9302         ''|0) try='char* asctime_r(const struct tm*, char*);'
9303         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9304         esac
9305         case "$asctime_r_proto" in
9306         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9307         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9308         esac
9309         case "$asctime_r_proto" in
9310         ''|0) try='int asctime_r(const struct tm*, char*);'
9311         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9312         esac
9313         case "$asctime_r_proto" in
9314         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9315         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9316         esac
9317         case "$asctime_r_proto" in
9318         ''|0)   d_asctime_r=undef
9319                 asctime_r_proto=0
9320                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9321         * )     case "$asctime_r_proto" in
9322                 REENTRANT_PROTO*) ;;
9323                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9324                 esac
9325                 echo "Prototype: $try" ;;
9326         esac
9327         ;;
9328         *)      case "$usethreads" in
9329                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9330                 esac
9331                 d_asctime_r=undef
9332                 asctime_r_proto=0
9333                 ;;
9334         esac
9335         ;;
9336 *)      asctime_r_proto=0
9337         ;;
9338 esac
9339
9340 : see if atolf exists
9341 set atolf d_atolf
9342 eval $inlibc
9343
9344 : see if atoll exists
9345 set atoll d_atoll
9346 eval $inlibc
9347
9348 : Look for GNU-cc style attribute checking
9349 echo " "
9350 echo "Checking whether your compiler can handle __attribute__ ..." >&4
9351 $cat >attrib.c <<'EOCP'
9352 #include <stdio.h>
9353 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
9354 EOCP
9355 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9356         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9357                 echo "Your C compiler doesn't fully support __attribute__."
9358                 val="$undef"
9359         else
9360                 echo "Your C compiler supports __attribute__."
9361                 val="$define"
9362         fi
9363 else
9364         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9365         val="$undef"
9366 fi
9367 set d_attribut
9368 eval $setvar
9369 $rm -f attrib*
9370
9371 : see if bcmp exists
9372 set bcmp d_bcmp
9373 eval $inlibc
9374
9375 : see if bcopy exists
9376 set bcopy d_bcopy
9377 eval $inlibc
9378
9379 : see if this is a unistd.h system
9380 set unistd.h i_unistd
9381 eval $inhdr
9382
9383 : see if getpgrp exists
9384 set getpgrp d_getpgrp
9385 eval $inlibc
9386
9387 case "$d_getpgrp" in
9388 "$define")
9389         echo " "
9390         echo "Checking to see which flavor of getpgrp is in use..."
9391         $cat >try.c <<EOP
9392 #$i_unistd I_UNISTD
9393 #include <sys/types.h>
9394 #ifdef I_UNISTD
9395 #  include <unistd.h>
9396 #endif
9397 int main()
9398 {
9399         if (getuid() == 0) {
9400                 printf("(I see you are running Configure as super-user...)\n");
9401                 setuid(1);
9402         }
9403 #ifdef TRY_BSD_PGRP
9404         if (getpgrp(1) == 0)
9405                 exit(0);
9406 #else
9407         if (getpgrp() > 0)
9408                 exit(0);
9409 #endif
9410         exit(1);
9411 }
9412 EOP
9413         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9414                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
9415                 val="$define"
9416         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9417                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
9418                 val="$undef"
9419         else
9420                 echo "I can't seem to compile and run the test program."
9421                 if ./usg; then
9422                         xxx="a USG one, i.e. you use getpgrp()."
9423                 else
9424                         # SVR4 systems can appear rather BSD-ish.
9425                         case "$i_unistd" in
9426                         $undef)
9427                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
9428                                 val="$define"
9429                                 ;;
9430                         $define)
9431                                 xxx="probably a USG one, i.e. you use getpgrp()."
9432                                 val="$undef"
9433                                 ;;
9434                         esac
9435                 fi
9436                 echo "Assuming your getpgrp is $xxx" >&4
9437         fi
9438         ;;
9439 *) val="$undef";;
9440 esac
9441 set d_bsdgetpgrp
9442 eval $setvar
9443 $rm -f try try.*
9444
9445 : see if setpgrp exists
9446 set setpgrp d_setpgrp
9447 eval $inlibc
9448
9449 case "$d_setpgrp" in
9450 "$define")
9451         echo " "
9452         echo "Checking to see which flavor of setpgrp is in use..."
9453         $cat >try.c <<EOP
9454 #$i_unistd I_UNISTD
9455 #include <sys/types.h>
9456 #ifdef I_UNISTD
9457 #  include <unistd.h>
9458 #endif
9459 int main()
9460 {
9461         if (getuid() == 0) {
9462                 printf("(I see you are running Configure as super-user...)\n");
9463                 setuid(1);
9464         }
9465 #ifdef TRY_BSD_PGRP
9466         if (-1 == setpgrp(1, 1))
9467                 exit(0);
9468 #else
9469         if (setpgrp() != -1)
9470                 exit(0);
9471 #endif
9472         exit(1);
9473 }
9474 EOP
9475         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9476                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
9477                 val="$define"
9478         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9479                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
9480                 val="$undef"
9481         else
9482                 echo "(I can't seem to compile and run the test program.)"
9483                 if ./usg; then
9484                         xxx="a USG one, i.e. you use setpgrp()."
9485                 else
9486                         # SVR4 systems can appear rather BSD-ish.
9487                         case "$i_unistd" in
9488                         $undef)
9489                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
9490                                 val="$define"
9491                                 ;;
9492                         $define)
9493                                 xxx="probably a USG one, i.e. you use setpgrp()."
9494                                 val="$undef"
9495                                 ;;
9496                         esac
9497                 fi
9498                 echo "Assuming your setpgrp is $xxx" >&4
9499         fi
9500         ;;
9501 *) val="$undef";;
9502 esac
9503 set d_bsdsetpgrp
9504 eval $setvar
9505 $rm -f try try.*
9506 : see if bzero exists
9507 set bzero d_bzero
9508 eval $inlibc
9509
9510 : see if signal is declared as pointer to function returning int or void
9511 echo " "
9512 xxx=`./findhdr signal.h`
9513 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
9514 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
9515         echo "You have int (*signal())() instead of void." >&4
9516         val="$undef"
9517 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
9518         echo "You have void (*signal())()." >&4
9519         val="$define"
9520 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
9521         echo "You have int (*signal())() instead of void." >&4
9522         val="$undef"
9523 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
9524         echo "You have void (*signal())()." >&4
9525         val="$define"
9526 else
9527         case "$d_voidsig" in
9528         '')
9529         echo "I can't determine whether signal handler returns void or int..." >&4
9530                 dflt=void
9531                 rp="What type does your signal handler return?"
9532                 . ./myread
9533                 case "$ans" in
9534                 v*) val="$define";;
9535                 *) val="$undef";;
9536                 esac;;
9537         "$define")
9538                 echo "As you already told me, signal handler returns void." >&4
9539                 val="$define"
9540                 ;;
9541         *)      echo "As you already told me, signal handler returns int." >&4
9542                 val="$undef"
9543                 ;;
9544         esac
9545 fi
9546 set d_voidsig
9547 eval $setvar
9548 case "$d_voidsig" in
9549 "$define") signal_t="void";;
9550 *) signal_t="int";;
9551 esac
9552 $rm -f $$.tmp
9553
9554 : check for ability to cast large floats to 32-bit ints.
9555 echo " "
9556 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
9557 if $test "$intsize" -ge 4; then
9558         xxx=int
9559 else
9560         xxx=long
9561 fi
9562 $cat >try.c <<EOCP
9563 #include <stdio.h>
9564 #include <sys/types.h>
9565 #include <signal.h>
9566 $signal_t blech(s) int s; { exit(3); }
9567 int main()
9568 {
9569         $xxx i32;
9570         double f, g;
9571         int result = 0;
9572         char str[16];
9573         signal(SIGFPE, blech);
9574
9575         /* Don't let compiler optimize the test away.  Store the number 
9576            in a writable string for gcc to pass to sscanf under HP/UX.
9577         */
9578         sprintf(str, "2147483647");
9579         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
9580         g = 10 * f;
9581         i32  = ($xxx) g;
9582
9583         /* x86 processors will probably give 0x8000 0000, which is a
9584        sign change.  We don't want that.  We want to mimic SPARC
9585            behavior here, which is to preserve the sign and give
9586            back 0x7fff ffff.
9587         */
9588         if (i32 != ($xxx) f)
9589                 result |= 1;
9590         exit(result);
9591 }
9592 EOCP
9593 set try
9594 if eval $compile_ok; then
9595         $run ./try
9596         yyy=$?
9597 else
9598         echo "(I can't seem to compile the test program--assuming it can't)"
9599         yyy=1
9600 fi
9601 case "$yyy" in
9602 0)      val="$define"
9603         echo "Yup, it can."
9604         ;;
9605 *)      val="$undef"
9606         echo "Nope, it can't."
9607         ;;
9608 esac
9609 set d_casti32
9610 eval $setvar
9611 $rm -f try try.*
9612
9613 : check for ability to cast negative floats to unsigned
9614 echo " "
9615 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
9616 $cat >try.c <<EOCP
9617 #include <stdio.h>
9618 #include <sys/types.h>
9619 #include <signal.h>
9620 $signal_t blech(s) int s; { exit(7); }
9621 $signal_t blech_in_list(s) int s; { exit(4); }
9622 unsigned long dummy_long(p) unsigned long p; { return p; }
9623 unsigned int dummy_int(p) unsigned int p; { return p; }
9624 unsigned short dummy_short(p) unsigned short p; { return p; }
9625 int main()
9626 {
9627         double f;
9628         unsigned long along;
9629         unsigned int aint;
9630         unsigned short ashort;
9631         int result = 0;
9632         char str[16];
9633         
9634         /* Frustrate gcc-2.7.2's optimizer which failed this test with
9635            a direct f = -123. assignment.  gcc-2.8.0 reportedly
9636            optimized the whole file away
9637         */
9638         /* Store the number in a writable string for gcc to pass to 
9639            sscanf under HP/UX.
9640         */
9641         sprintf(str, "-123");
9642         sscanf(str, "%lf", &f);  /* f = -123.; */
9643
9644         signal(SIGFPE, blech);
9645         along = (unsigned long)f;
9646         aint = (unsigned int)f;
9647         ashort = (unsigned short)f;
9648         if (along != (unsigned long)-123)
9649                 result |= 1;
9650         if (aint != (unsigned int)-123)
9651                 result |= 1;
9652         if (ashort != (unsigned short)-123)
9653                 result |= 1;
9654         sprintf(str, "1073741824.");
9655         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
9656         f = f + f;
9657         along = 0;
9658         along = (unsigned long)f;
9659         if (along != 0x80000000)
9660                 result |= 2;
9661         f -= 1.;
9662         along = 0;
9663         along = (unsigned long)f;
9664         if (along != 0x7fffffff)
9665                 result |= 1;
9666         f += 2.;
9667         along = 0;
9668         along = (unsigned long)f;
9669         if (along != 0x80000001)
9670                 result |= 2;
9671         if (result)
9672                 exit(result);
9673         signal(SIGFPE, blech_in_list);
9674         sprintf(str, "123.");
9675         sscanf(str, "%lf", &f);  /* f = 123.; */
9676         along = dummy_long((unsigned long)f);
9677         aint = dummy_int((unsigned int)f);
9678         ashort = dummy_short((unsigned short)f);
9679         if (along != (unsigned long)123)
9680                 result |= 4;
9681         if (aint != (unsigned int)123)
9682                 result |= 4;
9683         if (ashort != (unsigned short)123)
9684                 result |= 4;
9685         exit(result);
9686
9687 }
9688 EOCP
9689 set try
9690 if eval $compile_ok; then
9691         $run ./try
9692         castflags=$?
9693 else
9694         echo "(I can't seem to compile the test program--assuming it can't)"
9695         castflags=7
9696 fi
9697 case "$castflags" in
9698 0)      val="$define"
9699         echo "Yup, it can."
9700         ;;
9701 *)      val="$undef"
9702         echo "Nope, it can't."
9703         ;;
9704 esac
9705 set d_castneg
9706 eval $setvar
9707 $rm -f try.*
9708
9709 : see if vprintf exists
9710 echo " "
9711 if set vprintf val -f d_vprintf; eval $csym; $val; then
9712         echo 'vprintf() found.' >&4
9713         val="$define"
9714         $cat >try.c <<'EOF'
9715 #include <varargs.h>
9716
9717 int main() { xxx("foo"); }
9718
9719 xxx(va_alist)
9720 va_dcl
9721 {
9722         va_list args;
9723         char buf[10];
9724
9725         va_start(args);
9726         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
9727 }
9728 EOF
9729         set try
9730         if eval $compile && $run ./try; then
9731                 echo "Your vsprintf() returns (int)." >&4
9732                 val2="$undef"
9733         else
9734                 echo "Your vsprintf() returns (char*)." >&4
9735                 val2="$define"
9736         fi
9737 else
9738         echo 'vprintf() NOT found.' >&4
9739                 val="$undef"
9740                 val2="$undef"
9741 fi
9742 $rm -f try try.*
9743 set d_vprintf
9744 eval $setvar
9745 val=$val2
9746 set d_charvspr
9747 eval $setvar
9748
9749 : see if chown exists
9750 set chown d_chown
9751 eval $inlibc
9752
9753 : see if chroot exists
9754 set chroot d_chroot
9755 eval $inlibc
9756
9757 : see if chsize exists
9758 set chsize d_chsize
9759 eval $inlibc
9760
9761 : see if class exists
9762 set class d_class
9763 eval $inlibc
9764
9765 hasstruct='varname=$1; struct=$2; shift; shift;
9766 while $test $# -ge 2; do
9767         case "$1" in
9768         $define) echo "#include <$2>";;
9769         esac ;
9770     shift 2;
9771 done > try.c;
9772 echo "int main () { struct $struct foo; }" >> try.c;
9773 set try;
9774 if eval $compile; then
9775         val="$define";
9776 else
9777         val="$undef";
9778 fi;
9779 set $varname;
9780 eval $setvar;
9781 $rm -f try.c try.o'
9782
9783 socketlib=''
9784 sockethdr=''
9785 : see whether socket exists
9786 echo " "
9787 $echo $n "Hmm... $c" >&4
9788 if set socket val -f d_socket; eval $csym; $val; then
9789         echo "Looks like you have Berkeley networking support." >&4
9790         d_socket="$define"
9791         if set setsockopt val -f; eval $csym; $val; then
9792                 d_oldsock="$undef"
9793         else
9794                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9795                 d_oldsock="$define"
9796         fi
9797 else
9798         if $contains socklib libc.list >/dev/null 2>&1; then
9799                 echo "Looks like you have Berkeley networking support." >&4
9800                 d_socket="$define"
9801                 : we will have to assume that it supports the 4.2 BSD interface
9802                 d_oldsock="$undef"
9803         else
9804                 echo "You don't have Berkeley networking in libc$_a..." >&4
9805                 if test "X$d_socket" = "X$define"; then
9806                    echo "...but you seem to believe that you have sockets." >&4
9807                 else
9808                         for net in net socket
9809                         do
9810                                 if test -f /usr/lib/lib$net$_a; then
9811                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9812                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9813                                         if $contains socket libc.list >/dev/null 2>&1; then
9814                                                 d_socket="$define"
9815                                                 socketlib="-l$net"
9816                                                 case "$net" in
9817                                                 net)
9818                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9819                                                         sockethdr="-I/usr/netinclude"
9820                                                         ;;
9821                                                 esac
9822                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
9823                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9824                                                         d_oldsock="$undef"
9825                                                 else
9826                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9827                                                         d_oldsock="$define"
9828                                                 fi
9829                                                 break
9830                                         fi
9831                                 fi
9832                         done
9833                         if test "X$d_socket" != "X$define"; then
9834                            echo "or anywhere else I see." >&4
9835                            d_socket="$undef"
9836                            d_oldsock="$undef"
9837                         fi
9838                 fi
9839         fi
9840 fi
9841
9842 : see if socketpair exists
9843 set socketpair d_sockpair
9844 eval $inlibc
9845
9846
9847 echo " "
9848 echo "Checking the availability of certain socket constants..." >&4
9849 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9850         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9851         $cat >try.c <<EOF
9852 #include <sys/types.h>
9853 #include <sys/socket.h>
9854 int main() {
9855     int i = $ENUM;
9856 }
9857 EOF
9858         val="$undef"
9859         set try; if eval $compile; then
9860                 val="$define"
9861         fi
9862         set d_${enum}; eval $setvar
9863         $rm -f try.c try
9864 done
9865
9866 : see if this is a sys/uio.h system
9867 set sys/uio.h i_sysuio
9868 eval $inhdr
9869
9870
9871 echo " "
9872 echo "Checking to see if your system supports struct cmsghdr..." >&4
9873 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
9874 eval $hasstruct
9875 case "$d_cmsghdr_s" in
9876 "$define")      echo "Yes, it does."   ;;
9877 *)              echo "No, it doesn't." ;;
9878 esac
9879
9880
9881 : check for const keyword
9882 echo " "
9883 echo 'Checking to see if your C compiler knows about "const"...' >&4
9884 $cat >const.c <<'EOCP'
9885 typedef struct spug { int drokk; } spug;
9886 int main()
9887 {
9888         const char *foo;
9889         const spug y;
9890 }
9891 EOCP
9892 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
9893         val="$define"
9894         echo "Yup, it does."
9895 else
9896         val="$undef"
9897         echo "Nope, it doesn't."
9898 fi
9899 set d_const
9900 eval $setvar
9901
9902 : see if crypt exists
9903 echo " "
9904 set crypt d_crypt
9905 eval $inlibc
9906 case "$d_crypt" in
9907 $define) cryptlib='' ;;
9908 *)      if set crypt val -f d_crypt; eval $csym; $val; then
9909                 echo 'crypt() found.' >&4
9910                 val="$define"
9911                 cryptlib=''
9912         else
9913                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
9914                 if $test -z "$cryptlib"; then
9915                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
9916                 else
9917                         cryptlib=-lcrypt
9918                 fi
9919                 if $test -z "$cryptlib"; then
9920                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
9921                 else
9922                         cryptlib=-lcrypt
9923                 fi
9924                 if $test -z "$cryptlib"; then
9925                         cryptlib=`./loc libcrypt$_a "" $libpth`
9926                 else
9927                         cryptlib=-lcrypt
9928                 fi
9929                 if $test -z "$cryptlib"; then
9930                         echo 'crypt() NOT found.' >&4
9931                         val="$undef"
9932                 else
9933                         val="$define"
9934                 fi
9935         fi
9936         set d_crypt
9937         eval $setvar
9938         ;;
9939 esac
9940
9941 : see if this is a crypt.h system
9942 set crypt.h i_crypt
9943 eval $inhdr
9944
9945 : see if crypt_r exists
9946 set crypt_r d_crypt_r
9947 eval $inlibc
9948 case "$d_crypt_r" in
9949 "$define")
9950         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
9951         case "crypt" in
9952         time)
9953                 hdrs="$hdrs $i_systime sys/time.h"
9954                 ;;
9955         esac
9956         case "$d_crypt_r_proto:$usethreads" in
9957         ":define")      d_crypt_r_proto=define
9958                 set d_crypt_r_proto crypt_r $hdrs
9959                 eval $hasproto ;;
9960         *)      ;;
9961         esac
9962         case "$d_crypt_r_proto" in
9963         define)
9964         case "$crypt_r_proto" in
9965         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
9966         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
9967         esac
9968         case "$crypt_r_proto" in
9969         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
9970         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
9971         esac
9972         case "$crypt_r_proto" in
9973         ''|0)   d_crypt_r=undef
9974                 crypt_r_proto=0
9975                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
9976         * )     case "$crypt_r_proto" in
9977                 REENTRANT_PROTO*) ;;
9978                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
9979                 esac
9980                 echo "Prototype: $try" ;;
9981         esac
9982         ;;
9983         *)      case "$usethreads" in
9984                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
9985                 esac
9986                 d_crypt_r=undef
9987                 crypt_r_proto=0
9988                 ;;
9989         esac
9990         ;;
9991 *)      crypt_r_proto=0
9992         ;;
9993 esac
9994
9995 : get csh whereabouts
9996 case "$csh" in
9997 'csh') val="$undef" ;;
9998 *) val="$define" ;;
9999 esac
10000 set d_csh
10001 eval $setvar
10002 : Respect a hint or command line value for full_csh.
10003 case "$full_csh" in
10004 '') full_csh=$csh ;;
10005 esac
10006
10007 : see if ctermid_r exists
10008 set ctermid_r d_ctermid_r
10009 eval $inlibc
10010 case "$d_ctermid_r" in
10011 "$define")
10012         hdrs="$i_systypes sys/types.h define stdio.h "
10013         case "stdio" in
10014         time)
10015                 hdrs="$hdrs $i_systime sys/time.h"
10016                 ;;
10017         esac
10018         case "$d_ctermid_r_proto:$usethreads" in
10019         ":define")      d_ctermid_r_proto=define
10020                 set d_ctermid_r_proto ctermid_r $hdrs
10021                 eval $hasproto ;;
10022         *)      ;;
10023         esac
10024         case "$d_ctermid_r_proto" in
10025         define)
10026         case "$ctermid_r_proto" in
10027         ''|0) try='char* ctermid_r(char*);'
10028         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10029         esac
10030         case "$ctermid_r_proto" in
10031         ''|0)   d_ctermid_r=undef
10032                 ctermid_r_proto=0
10033                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10034         * )     case "$ctermid_r_proto" in
10035                 REENTRANT_PROTO*) ;;
10036                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10037                 esac
10038                 echo "Prototype: $try" ;;
10039         esac
10040         ;;
10041         *)      case "$usethreads" in
10042                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10043                 esac
10044                 d_ctermid_r=undef
10045                 ctermid_r_proto=0
10046                 ;;
10047         esac
10048         ;;
10049 *)      ctermid_r_proto=0
10050         ;;
10051 esac
10052
10053 : see if ctime_r exists
10054 set ctime_r d_ctime_r
10055 eval $inlibc
10056 case "$d_ctime_r" in
10057 "$define")
10058         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h"
10059         case "time" in
10060         time)
10061                 hdrs="$hdrs $i_systime sys/time.h"
10062                 ;;
10063         esac
10064         case "$d_ctime_r_proto:$usethreads" in
10065         ":define")      d_ctime_r_proto=define
10066                 set d_ctime_r_proto ctime_r $hdrs
10067                 eval $hasproto ;;
10068         *)      ;;
10069         esac
10070         case "$d_ctime_r_proto" in
10071         define)
10072         case "$ctime_r_proto" in
10073         ''|0) try='char* ctime_r(const time_t*, char*);'
10074         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10075         esac
10076         case "$ctime_r_proto" in
10077         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10078         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10079         esac
10080         case "$ctime_r_proto" in
10081         ''|0) try='int ctime_r(const time_t*, char*);'
10082         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10083         esac
10084         case "$ctime_r_proto" in
10085         ''|0) try='int ctime_r(const time_t*, char*, int);'
10086         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10087         esac
10088         case "$ctime_r_proto" in
10089         ''|0)   d_ctime_r=undef
10090                 ctime_r_proto=0
10091                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10092         * )     case "$ctime_r_proto" in
10093                 REENTRANT_PROTO*) ;;
10094                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10095                 esac
10096                 echo "Prototype: $try" ;;
10097         esac
10098         ;;
10099         *)      case "$usethreads" in
10100                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10101                 esac
10102                 d_ctime_r=undef
10103                 ctime_r_proto=0
10104                 ;;
10105         esac
10106         ;;
10107 *)      ctime_r_proto=0
10108         ;;
10109 esac
10110
10111 : see if cuserid exists
10112 set cuserid d_cuserid
10113 eval $inlibc
10114
10115 : see if this is a limits.h system
10116 set limits.h i_limits
10117 eval $inhdr
10118
10119 : see if this is a float.h system
10120 set float.h i_float
10121 eval $inhdr
10122
10123 : See if number of significant digits in a double precision number is known
10124 echo " "
10125 $cat >dbl_dig.c <<EOM
10126 #$i_limits I_LIMITS
10127 #$i_float I_FLOAT
10128 #ifdef I_LIMITS
10129 #include <limits.h>
10130 #endif
10131 #ifdef I_FLOAT
10132 #include <float.h>
10133 #endif
10134 #ifdef DBL_DIG
10135 printf("Contains DBL_DIG");
10136 #endif
10137 EOM
10138 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10139 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10140         echo "DBL_DIG found." >&4
10141         val="$define"
10142 else
10143         echo "DBL_DIG NOT found." >&4
10144         val="$undef"
10145 fi
10146 $rm -f dbl_dig.?
10147 set d_dbl_dig
10148 eval $setvar
10149
10150 : see if dbm.h is available
10151 : see if dbmclose exists
10152 set dbmclose d_dbmclose
10153 eval $inlibc
10154
10155 case "$d_dbmclose" in
10156 $define)
10157         set dbm.h i_dbm
10158         eval $inhdr
10159         case "$i_dbm" in
10160         $define)
10161                 val="$undef"
10162                 set i_rpcsvcdbm
10163                 eval $setvar
10164                 ;;
10165         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10166                 eval $inhdr
10167                 ;;
10168         esac
10169         ;;
10170 *)      echo "We won't be including <dbm.h>"
10171         val="$undef"
10172         set i_dbm
10173         eval $setvar
10174         val="$undef"
10175         set i_rpcsvcdbm
10176         eval $setvar
10177         ;;
10178 esac
10179
10180 : see if prototype for dbminit is available
10181 echo " "
10182 set d_dbminitproto dbminit $i_dbm dbm.h
10183 eval $hasproto
10184
10185 : see if difftime exists
10186 set difftime d_difftime
10187 eval $inlibc
10188
10189 : see if this is a dirent system
10190 echo " "
10191 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10192         val="$define"
10193         echo "<dirent.h> found." >&4
10194 else
10195         val="$undef"
10196         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10197                 echo "<sys/dir.h> found." >&4
10198                 echo " "
10199         else
10200                 xinc=`./findhdr sys/ndir.h`
10201         fi
10202         echo "<dirent.h> NOT found." >&4
10203 fi
10204 set i_dirent
10205 eval $setvar
10206
10207 : Look for type of directory structure.
10208 echo " "
10209 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10210
10211 case "$direntrytype" in
10212 ''|' ')
10213         case "$i_dirent" in
10214         $define) guess1='struct dirent' ;;
10215         *) guess1='struct direct'  ;;
10216         esac
10217         ;;
10218 *)      guess1="$direntrytype"
10219         ;;
10220 esac
10221
10222 case "$guess1" in
10223 'struct dirent') guess2='struct direct' ;;
10224 *) guess2='struct dirent' ;;
10225 esac
10226                 
10227 if $contains "$guess1" try.c >/dev/null 2>&1; then
10228         direntrytype="$guess1"
10229         echo "Your directory entries are $direntrytype." >&4
10230 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10231         direntrytype="$guess2"
10232         echo "Your directory entries seem to be $direntrytype." >&4
10233 else
10234         echo "I don't recognize your system's directory entries." >&4
10235         rp="What type is used for directory entries on this system?"
10236         dflt="$guess1"
10237         . ./myread
10238         direntrytype="$ans"
10239 fi
10240 $rm -f try.c
10241
10242
10243 : see if the directory entry stores field length
10244 echo " "
10245 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10246 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10247         echo "Good, your directory entry keeps length information in d_namlen." >&4
10248         val="$define"
10249 else
10250         echo "Your directory entry does not know about the d_namlen field." >&4
10251         val="$undef"
10252 fi
10253 set d_dirnamlen
10254 eval $setvar
10255 $rm -f try.c
10256
10257 : see if this is an sysdir system
10258 set sys/dir.h i_sysdir
10259 eval $inhdr
10260
10261 : see if this is an sysndir system
10262 set sys/ndir.h i_sysndir
10263 eval $inhdr
10264
10265 : Look for dirfd
10266 echo " "
10267 $cat >dirfd.c <<EOM
10268 #include <stdio.h>
10269 #$i_dirent I_DIRENT             /**/
10270 #$i_sysdir I_SYS_DIR            /**/
10271 #$i_sysndir I_SYS_NDIR          /**/
10272 #$i_systypes I_SYS_TYPES        /**/
10273 #if defined(I_SYS_TYPES)
10274 #include <sys/types.h>
10275 #endif
10276 #if defined(I_DIRENT)
10277 #include <dirent.h>
10278 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10279 #include <sys/dir.h>
10280 #endif
10281 #else
10282 #ifdef I_SYS_NDIR
10283 #include <sys/ndir.h>
10284 #else
10285 #ifdef I_SYS_DIR
10286 #ifdef hp9000s500
10287 #include <ndir.h>       /* may be wrong in the future */
10288 #else
10289 #include <sys/dir.h>
10290 #endif
10291 #endif
10292 #endif
10293 #endif 
10294 int main() {
10295         DIR *dirp = opendir(".");
10296         if (dirfd(dirp) >= 0)
10297                 exit(0);
10298         else
10299                 exit(1);
10300 }
10301 EOM
10302 set dirfd
10303 if eval $compile; then
10304         val="$define"
10305 fi
10306 case "$val" in
10307 $define)        echo "dirfd() found." >&4       ;;
10308 *)              echo "dirfd() NOT found." >&4   ;;
10309 esac
10310 set d_dirfd
10311 eval $setvar
10312 $rm -f dirfd*
10313
10314 : see if dlerror exists
10315 xxx_runnm="$runnm"
10316 runnm=false
10317 set dlerror d_dlerror
10318 eval $inlibc
10319 runnm="$xxx_runnm"
10320
10321 : see if dlfcn is available
10322 set dlfcn.h i_dlfcn
10323 eval $inhdr
10324
10325 case "$usedl" in
10326 $define|y|true)
10327         $cat << EOM
10328
10329 On a few systems, the dynamically loaded modules that perl generates and uses
10330 will need a different extension than shared libs. The default will probably
10331 be appropriate.
10332
10333 EOM
10334         case "$dlext" in
10335         '')     dflt="$so" ;;
10336         *)      dflt="$dlext" ;;
10337         esac
10338         rp='What is the extension of dynamically loaded modules'
10339         . ./myread
10340         dlext="$ans"
10341         ;;
10342 *)
10343         dlext="none"
10344         ;;
10345 esac
10346
10347 : Check if dlsym need a leading underscore
10348 echo " "
10349 val="$undef"
10350
10351 case "$dlsrc" in
10352 dl_dlopen.xs)
10353         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
10354         $cat >dyna.c <<'EOM'
10355 fred () { }
10356 EOM
10357
10358 $cat >fred.c<<EOM
10359
10360 #include <stdio.h>
10361 #$i_dlfcn I_DLFCN
10362 #ifdef I_DLFCN
10363 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
10364 #else
10365 #include <sys/types.h>
10366 #include <nlist.h>
10367 #include <link.h>
10368 #endif
10369
10370 extern int fred() ;
10371
10372 int main()
10373 {
10374     void * handle ;
10375     void * symbol ;
10376 #ifndef RTLD_LAZY
10377     int mode = 1 ;
10378 #else
10379     int mode = RTLD_LAZY ;
10380 #endif
10381     handle = dlopen("./dyna.$dlext", mode) ;
10382     if (handle == NULL) {
10383         printf ("1\n") ;
10384         fflush (stdout) ;
10385         exit(0);
10386     }
10387     symbol = dlsym(handle, "fred") ;
10388     if (symbol == NULL) {
10389         /* try putting a leading underscore */
10390         symbol = dlsym(handle, "_fred") ;
10391         if (symbol == NULL) {
10392             printf ("2\n") ;
10393             fflush (stdout) ;
10394             exit(0);
10395         }
10396         printf ("3\n") ;
10397     }
10398     else
10399         printf ("4\n") ;
10400     fflush (stdout) ;
10401     exit(0);
10402 }
10403 EOM
10404         : Call the object file tmp-dyna.o in case dlext=o.
10405         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
10406                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
10407                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
10408                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
10409                 xxx=`$run ./fred`
10410                 case $xxx in
10411                 1)      echo "Test program failed using dlopen." >&4
10412                         echo "Perhaps you should not use dynamic loading." >&4;;
10413                 2)      echo "Test program failed using dlsym." >&4
10414                         echo "Perhaps you should not use dynamic loading." >&4;;
10415                 3)      echo "dlsym needs a leading underscore" >&4
10416                         val="$define" ;;
10417                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
10418                 esac
10419         else
10420                 echo "I can't compile and run the test program." >&4
10421                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
10422         fi
10423         ;;
10424 esac
10425                 
10426 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
10427
10428 set d_dlsymun
10429 eval $setvar
10430
10431 : see if drand48_r exists
10432 set drand48_r d_drand48_r
10433 eval $inlibc
10434 case "$d_drand48_r" in
10435 "$define")
10436         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
10437         case "stdlib" in
10438         time)
10439                 hdrs="$hdrs $i_systime sys/time.h"
10440                 ;;
10441         esac
10442         case "$d_drand48_r_proto:$usethreads" in
10443         ":define")      d_drand48_r_proto=define
10444                 set d_drand48_r_proto drand48_r $hdrs
10445                 eval $hasproto ;;
10446         *)      ;;
10447         esac
10448         case "$d_drand48_r_proto" in
10449         define)
10450         case "$drand48_r_proto" in
10451         ''|0) try='int drand48_r(struct drand48_data*, double*);'
10452         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
10453         esac
10454         case "$drand48_r_proto" in
10455         ''|0)   d_drand48_r=undef
10456                 drand48_r_proto=0
10457                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10458         * )     case "$drand48_r_proto" in
10459                 REENTRANT_PROTO*) ;;
10460                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
10461                 esac
10462                 echo "Prototype: $try" ;;
10463         esac
10464         ;;
10465         *)      case "$usethreads" in
10466                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
10467                 esac
10468                 d_drand48_r=undef
10469                 drand48_r_proto=0
10470                 ;;
10471         esac
10472         ;;
10473 *)      drand48_r_proto=0
10474         ;;
10475 esac
10476
10477 : see if prototype for drand48 is available
10478 echo " "
10479 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
10480 eval $hasproto
10481
10482 : see if dup2 exists
10483 set dup2 d_dup2
10484 eval $inlibc
10485
10486 : see if eaccess exists
10487 set eaccess d_eaccess
10488 eval $inlibc
10489
10490 : see if endgrent exists
10491 set endgrent d_endgrent
10492 eval $inlibc
10493
10494 : see if this is an grp system
10495 set grp.h i_grp
10496 eval $inhdr
10497
10498 case "$i_grp" in
10499 $define)
10500         xxx=`./findhdr grp.h`
10501         $cppstdin $cppflags $cppminus < $xxx >$$.h
10502
10503         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10504                 val="$define"
10505         else
10506                 val="$undef"
10507         fi
10508         set d_grpasswd
10509         eval $setvar
10510
10511         $rm -f $$.h
10512         ;;
10513 *)
10514         val="$undef";
10515         set d_grpasswd; eval $setvar
10516         ;;
10517 esac
10518
10519 : see if endgrent_r exists
10520 set endgrent_r d_endgrent_r
10521 eval $inlibc
10522 case "$d_endgrent_r" in
10523 "$define")
10524         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
10525         case "grp" in
10526         time)
10527                 hdrs="$hdrs $i_systime sys/time.h"
10528                 ;;
10529         esac
10530         case "$d_endgrent_r_proto:$usethreads" in
10531         ":define")      d_endgrent_r_proto=define
10532                 set d_endgrent_r_proto endgrent_r $hdrs
10533                 eval $hasproto ;;
10534         *)      ;;
10535         esac
10536         case "$d_endgrent_r_proto" in
10537         define)
10538         case "$endgrent_r_proto" in
10539         ''|0) try='int endgrent_r(FILE**);'
10540         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
10541         esac
10542         case "$endgrent_r_proto" in
10543         ''|0) try='void endgrent_r(FILE**);'
10544         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
10545         esac
10546         case "$endgrent_r_proto" in
10547         ''|0)   d_endgrent_r=undef
10548                 endgrent_r_proto=0
10549                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10550         * )     case "$endgrent_r_proto" in
10551                 REENTRANT_PROTO*) ;;
10552                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
10553                 esac
10554                 echo "Prototype: $try" ;;
10555         esac
10556         ;;
10557         *)      case "$usethreads" in
10558                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
10559                 esac
10560                 d_endgrent_r=undef
10561                 endgrent_r_proto=0
10562                 ;;
10563         esac
10564         ;;
10565 *)      endgrent_r_proto=0
10566         ;;
10567 esac
10568
10569 : see if endhostent exists
10570 set endhostent d_endhent
10571 eval $inlibc
10572
10573 : see if this is a netdb.h system
10574 set netdb.h i_netdb
10575 eval $inhdr
10576
10577 : see if endhostent_r exists
10578 set endhostent_r d_endhostent_r
10579 eval $inlibc
10580 case "$d_endhostent_r" in
10581 "$define")
10582         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10583         case "netdb" in
10584         time)
10585                 hdrs="$hdrs $i_systime sys/time.h"
10586                 ;;
10587         esac
10588         case "$d_endhostent_r_proto:$usethreads" in
10589         ":define")      d_endhostent_r_proto=define
10590                 set d_endhostent_r_proto endhostent_r $hdrs
10591                 eval $hasproto ;;
10592         *)      ;;
10593         esac
10594         case "$d_endhostent_r_proto" in
10595         define)
10596         case "$endhostent_r_proto" in
10597         ''|0) try='int endhostent_r(struct hostent_data*);'
10598         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
10599         esac
10600         case "$endhostent_r_proto" in
10601         ''|0) try='void endhostent_r(struct hostent_data*);'
10602         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
10603         esac
10604         case "$endhostent_r_proto" in
10605         ''|0)   d_endhostent_r=undef
10606                 endhostent_r_proto=0
10607                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10608         * )     case "$endhostent_r_proto" in
10609                 REENTRANT_PROTO*) ;;
10610                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
10611                 esac
10612                 echo "Prototype: $try" ;;
10613         esac
10614         ;;
10615         *)      case "$usethreads" in
10616                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
10617                 esac
10618                 d_endhostent_r=undef
10619                 endhostent_r_proto=0
10620                 ;;
10621         esac
10622         ;;
10623 *)      endhostent_r_proto=0
10624         ;;
10625 esac
10626
10627 : see if endnetent exists
10628 set endnetent d_endnent
10629 eval $inlibc
10630
10631 : see if endnetent_r exists
10632 set endnetent_r d_endnetent_r
10633 eval $inlibc
10634 case "$d_endnetent_r" in
10635 "$define")
10636         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10637         case "netdb" in
10638         time)
10639                 hdrs="$hdrs $i_systime sys/time.h"
10640                 ;;
10641         esac
10642         case "$d_endnetent_r_proto:$usethreads" in
10643         ":define")      d_endnetent_r_proto=define
10644                 set d_endnetent_r_proto endnetent_r $hdrs
10645                 eval $hasproto ;;
10646         *)      ;;
10647         esac
10648         case "$d_endnetent_r_proto" in
10649         define)
10650         case "$endnetent_r_proto" in
10651         ''|0) try='int endnetent_r(struct netent_data*);'
10652         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
10653         esac
10654         case "$endnetent_r_proto" in
10655         ''|0) try='void endnetent_r(struct netent_data*);'
10656         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
10657         esac
10658         case "$endnetent_r_proto" in
10659         ''|0)   d_endnetent_r=undef
10660                 endnetent_r_proto=0
10661                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10662         * )     case "$endnetent_r_proto" in
10663                 REENTRANT_PROTO*) ;;
10664                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
10665                 esac
10666                 echo "Prototype: $try" ;;
10667         esac
10668         ;;
10669         *)      case "$usethreads" in
10670                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
10671                 esac
10672                 d_endnetent_r=undef
10673                 endnetent_r_proto=0
10674                 ;;
10675         esac
10676         ;;
10677 *)      endnetent_r_proto=0
10678         ;;
10679 esac
10680
10681 : see if endprotoent exists
10682 set endprotoent d_endpent
10683 eval $inlibc
10684
10685 : see if endprotoent_r exists
10686 set endprotoent_r d_endprotoent_r
10687 eval $inlibc
10688 case "$d_endprotoent_r" in
10689 "$define")
10690         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10691         case "netdb" in
10692         time)
10693                 hdrs="$hdrs $i_systime sys/time.h"
10694                 ;;
10695         esac
10696         case "$d_endprotoent_r_proto:$usethreads" in
10697         ":define")      d_endprotoent_r_proto=define
10698                 set d_endprotoent_r_proto endprotoent_r $hdrs
10699                 eval $hasproto ;;
10700         *)      ;;
10701         esac
10702         case "$d_endprotoent_r_proto" in
10703         define)
10704         case "$endprotoent_r_proto" in
10705         ''|0) try='int endprotoent_r(struct protoent_data*);'
10706         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
10707         esac
10708         case "$endprotoent_r_proto" in
10709         ''|0) try='void endprotoent_r(struct protoent_data*);'
10710         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
10711         esac
10712         case "$endprotoent_r_proto" in
10713         ''|0)   d_endprotoent_r=undef
10714                 endprotoent_r_proto=0
10715                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10716         * )     case "$endprotoent_r_proto" in
10717                 REENTRANT_PROTO*) ;;
10718                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
10719                 esac
10720                 echo "Prototype: $try" ;;
10721         esac
10722         ;;
10723         *)      case "$usethreads" in
10724                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
10725                 esac
10726                 d_endprotoent_r=undef
10727                 endprotoent_r_proto=0
10728                 ;;
10729         esac
10730         ;;
10731 *)      endprotoent_r_proto=0
10732         ;;
10733 esac
10734
10735 : see if endpwent exists
10736 set endpwent d_endpwent
10737 eval $inlibc
10738
10739 : see if this is a pwd.h system
10740 set pwd.h i_pwd
10741 eval $inhdr
10742
10743 case "$i_pwd" in
10744 $define)
10745         xxx=`./findhdr pwd.h`
10746         $cppstdin $cppflags $cppminus < $xxx >$$.h
10747
10748         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10749                 val="$define"
10750         else
10751                 val="$undef"
10752         fi
10753         set d_pwquota
10754         eval $setvar
10755
10756         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10757                 val="$define"
10758         else
10759                 val="$undef"
10760         fi
10761         set d_pwage
10762         eval $setvar
10763
10764         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10765                 val="$define"
10766         else
10767                 val="$undef"
10768         fi
10769         set d_pwchange
10770         eval $setvar
10771
10772         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10773                 val="$define"
10774         else
10775                 val="$undef"
10776         fi
10777         set d_pwclass
10778         eval $setvar
10779
10780         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10781                 val="$define"
10782         else
10783                 val="$undef"
10784         fi
10785         set d_pwexpire
10786         eval $setvar
10787
10788         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10789                 val="$define"
10790         else
10791                 val="$undef"
10792         fi
10793         set d_pwcomment
10794         eval $setvar
10795
10796         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10797                 val="$define"
10798         else
10799                 val="$undef"
10800         fi
10801         set d_pwgecos
10802         eval $setvar
10803
10804         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10805                 val="$define"
10806         else
10807                 val="$undef"
10808         fi
10809         set d_pwpasswd
10810         eval $setvar
10811
10812         $rm -f $$.h
10813         ;;
10814 *)
10815         val="$undef"; 
10816         set d_pwquota; eval $setvar
10817         set d_pwage; eval $setvar
10818         set d_pwchange; eval $setvar
10819         set d_pwclass; eval $setvar
10820         set d_pwexpire; eval $setvar
10821         set d_pwcomment; eval $setvar
10822         set d_pwgecos; eval $setvar
10823         set d_pwpasswd; eval $setvar
10824         ;;
10825 esac
10826
10827 : see if endpwent_r exists
10828 set endpwent_r d_endpwent_r
10829 eval $inlibc
10830 case "$d_endpwent_r" in
10831 "$define")
10832         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
10833         case "pwd" in
10834         time)
10835                 hdrs="$hdrs $i_systime sys/time.h"
10836                 ;;
10837         esac
10838         case "$d_endpwent_r_proto:$usethreads" in
10839         ":define")      d_endpwent_r_proto=define
10840                 set d_endpwent_r_proto endpwent_r $hdrs
10841                 eval $hasproto ;;
10842         *)      ;;
10843         esac
10844         case "$d_endpwent_r_proto" in
10845         define)
10846         case "$endpwent_r_proto" in
10847         ''|0) try='int endpwent_r(FILE**);'
10848         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
10849         esac
10850         case "$endpwent_r_proto" in
10851         ''|0) try='void endpwent_r(FILE**);'
10852         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
10853         esac
10854         case "$endpwent_r_proto" in
10855         ''|0)   d_endpwent_r=undef
10856                 endpwent_r_proto=0
10857                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10858         * )     case "$endpwent_r_proto" in
10859                 REENTRANT_PROTO*) ;;
10860                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
10861                 esac
10862                 echo "Prototype: $try" ;;
10863         esac
10864         ;;
10865         *)      case "$usethreads" in
10866                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
10867                 esac
10868                 d_endpwent_r=undef
10869                 endpwent_r_proto=0
10870                 ;;
10871         esac
10872         ;;
10873 *)      endpwent_r_proto=0
10874         ;;
10875 esac
10876
10877 : see if endservent exists
10878 set endservent d_endsent
10879 eval $inlibc
10880
10881 : see if endservent_r exists
10882 set endservent_r d_endservent_r
10883 eval $inlibc
10884 case "$d_endservent_r" in
10885 "$define")
10886         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10887         case "netdb" in
10888         time)
10889                 hdrs="$hdrs $i_systime sys/time.h"
10890                 ;;
10891         esac
10892         case "$d_endservent_r_proto:$usethreads" in
10893         ":define")      d_endservent_r_proto=define
10894                 set d_endservent_r_proto endservent_r $hdrs
10895                 eval $hasproto ;;
10896         *)      ;;
10897         esac
10898         case "$d_endservent_r_proto" in
10899         define)
10900         case "$endservent_r_proto" in
10901         ''|0) try='int endservent_r(struct servent_data*);'
10902         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
10903         esac
10904         case "$endservent_r_proto" in
10905         ''|0) try='void endservent_r(struct servent_data*);'
10906         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
10907         esac
10908         case "$endservent_r_proto" in
10909         ''|0)   d_endservent_r=undef
10910                 endservent_r_proto=0
10911                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10912         * )     case "$endservent_r_proto" in
10913                 REENTRANT_PROTO*) ;;
10914                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
10915                 esac
10916                 echo "Prototype: $try" ;;
10917         esac
10918         ;;
10919         *)      case "$usethreads" in
10920                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
10921                 esac
10922                 d_endservent_r=undef
10923                 endservent_r_proto=0
10924                 ;;
10925         esac
10926         ;;
10927 *)      endservent_r_proto=0
10928         ;;
10929 esac
10930
10931 : Locate the flags for 'open()'
10932 echo " "
10933 $cat >try.c <<'EOCP'
10934 #include <sys/types.h>
10935 #ifdef I_FCNTL
10936 #include <fcntl.h>
10937 #endif
10938 #ifdef I_SYS_FILE
10939 #include <sys/file.h>
10940 #endif
10941 int main() {
10942         if(O_RDONLY);
10943 #ifdef O_TRUNC
10944         exit(0);
10945 #else
10946         exit(1);
10947 #endif
10948 }
10949 EOCP
10950 : check sys/file.h first to get FREAD on Sun
10951 if $test `./findhdr sys/file.h` && \
10952                 set try -DI_SYS_FILE && eval $compile; then
10953         h_sysfile=true;
10954         echo "<sys/file.h> defines the O_* constants..." >&4
10955         if $run ./try; then
10956                 echo "and you have the 3 argument form of open()." >&4
10957                 val="$define"
10958         else
10959                 echo "but not the 3 argument form of open().  Oh, well." >&4
10960                 val="$undef"
10961         fi
10962 elif $test `./findhdr fcntl.h` && \
10963                 set try -DI_FCNTL && eval $compile; then
10964         h_fcntl=true;
10965         echo "<fcntl.h> defines the O_* constants..." >&4
10966         if $run ./try; then
10967                 echo "and you have the 3 argument form of open()." >&4
10968                 val="$define"
10969         else
10970                 echo "but not the 3 argument form of open().  Oh, well." >&4
10971                 val="$undef"
10972         fi
10973 else
10974         val="$undef"
10975         echo "I can't find the O_* constant definitions!  You got problems." >&4
10976 fi
10977 set d_open3
10978 eval $setvar
10979 $rm -f try try.*
10980
10981 : see which of string.h or strings.h is needed
10982 echo " "
10983 strings=`./findhdr string.h`
10984 if $test "$strings" && $test -r "$strings"; then
10985         echo "Using <string.h> instead of <strings.h>." >&4
10986         val="$define"
10987 else
10988         val="$undef"
10989         strings=`./findhdr strings.h`
10990         if $test "$strings" && $test -r "$strings"; then
10991                 echo "Using <strings.h> instead of <string.h>." >&4
10992         else
10993                 echo "No string header found -- You'll surely have problems." >&4
10994         fi
10995 fi
10996 set i_string
10997 eval $setvar
10998 case "$i_string" in
10999 "$undef") strings=`./findhdr strings.h`;;
11000 *)        strings=`./findhdr string.h`;;
11001 esac
11002
11003 : see if this is a sys/file.h system
11004 val=''
11005 set sys/file.h val
11006 eval $inhdr
11007
11008 : do we need to include sys/file.h ?
11009 case "$val" in
11010 "$define")
11011         echo " "
11012         if $h_sysfile; then
11013                 val="$define"
11014                 echo "We'll be including <sys/file.h>." >&4
11015         else
11016                 val="$undef"
11017                 echo "We won't be including <sys/file.h>." >&4
11018         fi
11019         ;;
11020 *)
11021         h_sysfile=false
11022         ;;
11023 esac
11024 set i_sysfile
11025 eval $setvar
11026
11027 : see if fcntl.h is there
11028 val=''
11029 set fcntl.h val
11030 eval $inhdr
11031
11032 : see if we can include fcntl.h
11033 case "$val" in
11034 "$define")
11035         echo " "
11036         if $h_fcntl; then
11037                 val="$define"
11038                 echo "We'll be including <fcntl.h>." >&4
11039         else
11040                 val="$undef"
11041                 if $h_sysfile; then
11042         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11043                 else
11044                         echo "We won't be including <fcntl.h>." >&4
11045                 fi
11046         fi
11047         ;;
11048 *)
11049         h_fcntl=false
11050         val="$undef"
11051         ;;
11052 esac
11053 set i_fcntl
11054 eval $setvar
11055
11056 : check for non-blocking I/O stuff
11057 case "$h_sysfile" in
11058 true) echo "#include <sys/file.h>" > head.c;;
11059 *)
11060        case "$h_fcntl" in
11061        true) echo "#include <fcntl.h>" > head.c;;
11062        *) echo "#include <sys/fcntl.h>" > head.c;;
11063        esac
11064        ;;
11065 esac
11066 echo " "
11067 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11068 case "$o_nonblock" in
11069 '')
11070         $cat head.c > try.c
11071         $cat >>try.c <<EOCP
11072 #include <stdio.h>
11073 #include <stdlib.h>
11074 #$i_fcntl I_FCNTL
11075 #ifdef I_FCNTL
11076 #include <fcntl.h>
11077 #endif
11078 int main() {
11079 #ifdef O_NONBLOCK
11080         printf("O_NONBLOCK\n");
11081         exit(0);
11082 #endif
11083 #ifdef O_NDELAY
11084         printf("O_NDELAY\n");
11085         exit(0);
11086 #endif
11087 #ifdef FNDELAY
11088         printf("FNDELAY\n");
11089         exit(0);
11090 #endif
11091         exit(0);
11092 }
11093 EOCP
11094         set try
11095         if eval $compile_ok; then
11096                 o_nonblock=`$run ./try`
11097                 case "$o_nonblock" in
11098                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11099                 *) echo "Seems like we can use $o_nonblock.";;
11100                 esac
11101         else
11102                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11103         fi
11104         ;;
11105 *) echo "Using $hint value $o_nonblock.";;
11106 esac
11107 $rm -f try try.* .out core
11108
11109 echo " "
11110 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11111 case "$eagain" in
11112 '')
11113         $cat head.c > try.c
11114         $cat >>try.c <<EOCP
11115 #include <errno.h>
11116 #include <sys/types.h>
11117 #include <signal.h>
11118 #include <stdio.h> 
11119 #include <stdlib.h> 
11120 #$i_fcntl I_FCNTL
11121 #ifdef I_FCNTL
11122 #include <fcntl.h>
11123 #endif
11124 #define MY_O_NONBLOCK $o_nonblock
11125 #ifndef errno  /* XXX need better Configure test */
11126 extern int errno;
11127 #endif
11128 #$i_unistd I_UNISTD
11129 #ifdef I_UNISTD
11130 #include <unistd.h>
11131 #endif
11132 #$i_string I_STRING
11133 #ifdef I_STRING
11134 #include <string.h>
11135 #else
11136 #include <strings.h>
11137 #endif
11138 $signal_t blech(x) int x; { exit(3); }
11139 EOCP
11140         $cat >> try.c <<'EOCP'
11141 int main()
11142 {
11143         int pd[2];
11144         int pu[2];
11145         char buf[1];
11146         char string[100];
11147
11148         pipe(pd);       /* Down: child -> parent */
11149         pipe(pu);       /* Up: parent -> child */
11150         if (0 != fork()) {
11151                 int ret;
11152                 close(pd[1]);   /* Parent reads from pd[0] */
11153                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11154 #ifdef F_SETFL
11155                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11156                         exit(1);
11157 #else
11158                 exit(4);
11159 #endif
11160                 signal(SIGALRM, blech);
11161                 alarm(5);
11162                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11163                         exit(2);
11164                 sprintf(string, "%d\n", ret);
11165                 write(2, string, strlen(string));
11166                 alarm(0);
11167 #ifdef EAGAIN
11168                 if (errno == EAGAIN) {
11169                         printf("EAGAIN\n");
11170                         goto ok;
11171                 }
11172 #endif
11173 #ifdef EWOULDBLOCK
11174                 if (errno == EWOULDBLOCK)
11175                         printf("EWOULDBLOCK\n");
11176 #endif
11177         ok:
11178                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11179                 sleep(2);                               /* Give it time to close our pipe */
11180                 alarm(5);
11181                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11182                 alarm(0);
11183                 sprintf(string, "%d\n", ret);
11184                 write(4, string, strlen(string));
11185                 exit(0);
11186         }
11187
11188         close(pd[0]);                   /* We write to pd[1] */
11189         close(pu[1]);                   /* We read from pu[0] */
11190         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11191         close(pd[1]);                   /* Pipe pd is now fully closed! */
11192         exit(0);                                /* Bye bye, thank you for playing! */
11193 }
11194 EOCP
11195         set try
11196         if eval $compile_ok; then
11197                 echo "$startsh" >mtry
11198                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11199                 chmod +x mtry
11200                 ./mtry >/dev/null 2>&1
11201                 case $? in
11202                 0) eagain=`$cat try.out`;;
11203                 1) echo "Could not perform non-blocking setting!";;
11204                 2) echo "I did a successful read() for something that was not there!";;
11205                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11206                 4) echo "Could not find F_SETFL!";;
11207                 *) echo "Something terribly wrong happened during testing.";;
11208                 esac
11209                 rd_nodata=`$cat try.ret`
11210                 echo "A read() system call with no data present returns $rd_nodata."
11211                 case "$rd_nodata" in
11212                 0|-1) ;;
11213                 *)
11214                         echo "(That's peculiar, fixing that to be -1.)"
11215                         rd_nodata=-1
11216                         ;;
11217                 esac
11218                 case "$eagain" in
11219                 '')
11220                         echo "Forcing errno EAGAIN on read() with no data available."
11221                         eagain=EAGAIN
11222                         ;;
11223                 *)
11224                         echo "Your read() sets errno to $eagain when no data is available."
11225                         ;;
11226                 esac
11227                 status=`$cat try.err`
11228                 case "$status" in
11229                 0) echo "And it correctly returns 0 to signal EOF.";;
11230                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11231                 *) echo "However, your read() returns '$status' on EOF??";;
11232                 esac
11233                 val="$define"
11234                 if test "$status" = "$rd_nodata"; then
11235                         echo "WARNING: you can't distinguish between EOF and no data!"
11236                         val="$undef"
11237                 fi
11238         else
11239                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11240                 eagain=EAGAIN
11241         fi
11242         set d_eofnblk
11243         eval $setvar
11244         ;;
11245 *)
11246         echo "Using $hint value $eagain."
11247         echo "Your read() returns $rd_nodata when no data is present."
11248         case "$d_eofnblk" in
11249         "$define") echo "And you can see EOF because read() returns 0.";;
11250         "$undef") echo "But you can't see EOF status from read() returned value.";;
11251         *)
11252                 echo "(Assuming you can't see EOF status from read anyway.)"
11253                 d_eofnblk=$undef
11254                 ;;
11255         esac
11256         ;;
11257 esac
11258 $rm -f try try.* .out core head.c mtry
11259
11260 : see if fchdir exists
11261 set fchdir d_fchdir
11262 eval $inlibc
11263
11264 : see if fchmod exists
11265 set fchmod d_fchmod
11266 eval $inlibc
11267
11268 : see if fchown exists
11269 set fchown d_fchown
11270 eval $inlibc
11271
11272 : see if this is an fcntl system
11273 set fcntl d_fcntl
11274 eval $inlibc
11275
11276 echo " "
11277 : See if fcntl-based locking works.
11278 $cat >try.c <<EOCP
11279 #include <stdlib.h>
11280 #include <unistd.h>
11281 #include <fcntl.h>
11282 #include <signal.h>
11283 $signal_t blech(x) int x; { exit(3); }
11284 int main() {
11285 #if defined(F_SETLK) && defined(F_SETLKW)
11286      struct flock flock;
11287      int retval, fd;
11288      fd = open("try.c", O_RDONLY);
11289      flock.l_type = F_RDLCK;
11290      flock.l_whence = SEEK_SET;
11291      flock.l_start = flock.l_len = 0;
11292      signal(SIGALRM, blech);
11293      alarm(10);
11294      retval = fcntl(fd, F_SETLK, &flock);
11295      close(fd);
11296      (retval < 0 ? exit(2) : exit(0));
11297 #else
11298      exit(2);
11299 #endif
11300 }
11301 EOCP
11302 echo "Checking if fcntl-based file locking works... "
11303 case "$d_fcntl" in
11304 "$define")
11305         set try
11306         if eval $compile_ok; then
11307                 if $run ./try; then
11308                         echo "Yes, it seems to work."
11309                         val="$define"
11310                 else
11311                         echo "Nope, it didn't work."
11312                         val="$undef"
11313                         case "$?" in
11314                         3) $cat >&4 <<EOM
11315 ***
11316 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
11317 *** This is (almost) impossible.
11318 *** If your NFS lock daemons are not feeling well, something like
11319 *** this may happen, please investigate.  Cannot continue, aborting.
11320 ***
11321 EOM
11322                                 exit 1
11323                                 ;;
11324                         esac
11325                 fi
11326         else
11327                 echo "I'm unable to compile the test program, so I'll assume not."
11328                 val="$undef"
11329         fi
11330         ;;
11331 *) val="$undef";
11332         echo "Nope, since you don't even have fcntl()."
11333         ;;
11334 esac
11335 set d_fcntl_can_lock
11336 eval $setvar
11337 $rm -f try*
11338
11339
11340 : check for fd_set items
11341 $cat <<EOM
11342
11343 Checking to see how well your C compiler handles fd_set and friends ...
11344 EOM
11345 $cat >try.c <<EOCP
11346 #$i_systime I_SYS_TIME
11347 #$i_sysselct I_SYS_SELECT
11348 #$d_socket HAS_SOCKET
11349 #include <sys/types.h>
11350 #ifdef HAS_SOCKET
11351 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
11352 #endif
11353 #ifdef I_SYS_TIME
11354 #include <sys/time.h>
11355 #endif
11356 #ifdef I_SYS_SELECT
11357 #include <sys/select.h>
11358 #endif
11359 int main() {
11360         fd_set fds;
11361
11362 #ifdef TRYBITS
11363         if(fds.fds_bits);
11364 #endif
11365
11366 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
11367         exit(0);
11368 #else
11369         exit(1);
11370 #endif
11371 }
11372 EOCP
11373 set try -DTRYBITS
11374 if eval $compile; then
11375         d_fds_bits="$define"
11376         d_fd_set="$define"
11377         echo "Well, your system knows about the normal fd_set typedef..." >&4
11378         if $run ./try; then
11379                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
11380                 d_fd_macros="$define"
11381         else
11382                 $cat >&4 <<'EOM'
11383 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
11384 EOM
11385                 d_fd_macros="$undef"
11386         fi
11387 else
11388         $cat <<'EOM'
11389 Hmm, your compiler has some difficulty with fd_set.  Checking further...
11390 EOM
11391         set try
11392         if eval $compile; then
11393                 d_fds_bits="$undef"
11394                 d_fd_set="$define"
11395                 echo "Well, your system has some sort of fd_set available..." >&4
11396                 if $run ./try; then
11397                         echo "and you have the normal fd_set macros." >&4
11398                         d_fd_macros="$define"
11399                 else
11400                         $cat <<'EOM'
11401 but not the normal fd_set macros!  Gross!  More work for me...
11402 EOM
11403                         d_fd_macros="$undef"
11404                 fi
11405         else
11406         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
11407                 d_fd_set="$undef"
11408                 d_fds_bits="$undef"
11409                 d_fd_macros="$undef"
11410         fi
11411 fi
11412 $rm -f try try.*
11413
11414 : see if fgetpos exists
11415 set fgetpos d_fgetpos
11416 eval $inlibc
11417
11418 : see if finite exists
11419 set finite d_finite
11420 eval $inlibc
11421
11422 : see if finitel exists
11423 set finitel d_finitel
11424 eval $inlibc
11425
11426 : see if flock exists
11427 set flock d_flock
11428 eval $inlibc
11429
11430 : see if prototype for flock is available
11431 echo " "
11432 set d_flockproto flock $i_sysfile sys/file.h
11433 eval $hasproto
11434
11435 : see if fork exists
11436 set fork d_fork
11437 eval $inlibc
11438
11439 : see if fp_class exists
11440 set fp_class d_fp_class
11441 eval $inlibc
11442
11443 : see if pathconf exists
11444 set pathconf d_pathconf
11445 eval $inlibc
11446
11447 : see if fpathconf exists
11448 set fpathconf d_fpathconf
11449 eval $inlibc
11450
11451 : see if fpclass exists
11452 set fpclass d_fpclass
11453 eval $inlibc
11454
11455 : see if fpclassify exists
11456 set fpclassify d_fpclassify
11457 eval $inlibc
11458
11459 : see if fpclassl exists
11460 set fpclassl d_fpclassl
11461 eval $inlibc
11462
11463
11464 : check for fpos64_t
11465 echo " "
11466 echo "Checking to see if you have fpos64_t..." >&4
11467 $cat >try.c <<EOCP
11468 #include <stdio.h>
11469 int main() { fpos64_t x = 7; }
11470 EOCP
11471 set try
11472 if eval $compile; then
11473         val="$define"
11474         echo "You have fpos64_t."
11475 else
11476         val="$undef"
11477         echo "You do not have fpos64_t."
11478         case "$fpossize" in
11479         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
11480         esac
11481 fi
11482 $rm -f try.* try
11483 set d_fpos64_t
11484 eval $setvar
11485
11486 : see if frexpl exists
11487 set frexpl d_frexpl
11488 eval $inlibc
11489
11490 : see if this is a sys/param system
11491 set sys/param.h i_sysparam
11492 eval $inhdr
11493
11494 : see if this is a sys/mount.h system
11495 set sys/mount.h i_sysmount
11496 eval $inhdr
11497
11498
11499 echo " "
11500 echo "Checking to see if your system supports struct fs_data..." >&4
11501 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
11502 eval $hasstruct
11503 case "$d_fs_data_s" in
11504 "$define")      echo "Yes, it does."   ;;
11505 *)              echo "No, it doesn't." ;;
11506 esac
11507
11508 : see if fseeko exists
11509 set fseeko d_fseeko
11510 eval $inlibc
11511 case "$longsize" in
11512 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
11513 esac
11514
11515 : see if fsetpos exists
11516 set fsetpos d_fsetpos
11517 eval $inlibc
11518
11519
11520 : see if fstatfs exists
11521 set fstatfs d_fstatfs
11522 eval $inlibc
11523
11524
11525 : see if statvfs exists
11526 set statvfs d_statvfs
11527 eval $inlibc
11528
11529 : see if fstatvfs exists
11530 set fstatvfs d_fstatvfs
11531 eval $inlibc
11532
11533
11534 : see if fsync exists
11535 set fsync d_fsync
11536 eval $inlibc
11537
11538 : see if ftello exists
11539 set ftello d_ftello
11540 eval $inlibc
11541 case "$longsize" in
11542 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
11543 esac
11544
11545 : see if getcwd exists
11546 set getcwd d_getcwd
11547 eval $inlibc
11548
11549 : see if getespwnam exists
11550 set getespwnam d_getespwnam
11551 eval $inlibc
11552
11553
11554 : see if getfsstat exists
11555 set getfsstat d_getfsstat
11556 eval $inlibc
11557
11558 : see if getgrent exists
11559 set getgrent d_getgrent
11560 eval $inlibc
11561
11562 : see if getgrent_r exists
11563 set getgrent_r d_getgrent_r
11564 eval $inlibc
11565 case "$d_getgrent_r" in
11566 "$define")
11567         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11568         case "grp" in
11569         time)
11570                 hdrs="$hdrs $i_systime sys/time.h"
11571                 ;;
11572         esac
11573         case "$d_getgrent_r_proto:$usethreads" in
11574         ":define")      d_getgrent_r_proto=define
11575                 set d_getgrent_r_proto getgrent_r $hdrs
11576                 eval $hasproto ;;
11577         *)      ;;
11578         esac
11579         case "$d_getgrent_r_proto" in
11580         define)
11581         case "$getgrent_r_proto" in
11582         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
11583         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
11584         esac
11585         case "$getgrent_r_proto" in
11586         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
11587         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
11588         esac
11589         case "$getgrent_r_proto" in
11590         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
11591         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
11592         esac
11593         case "$getgrent_r_proto" in
11594         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
11595         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
11596         esac
11597         case "$getgrent_r_proto" in
11598         ''|0) try='int getgrent_r(struct group*, char*, int);'
11599         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
11600         esac
11601         case "$getgrent_r_proto" in
11602         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
11603         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
11604         esac
11605         case "$getgrent_r_proto" in
11606         ''|0)   d_getgrent_r=undef
11607                 getgrent_r_proto=0
11608                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
11609         * )     case "$getgrent_r_proto" in
11610                 REENTRANT_PROTO*) ;;
11611                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
11612                 esac
11613                 echo "Prototype: $try" ;;
11614         esac
11615         ;;
11616         *)      case "$usethreads" in
11617                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
11618                 esac
11619                 d_getgrent_r=undef
11620                 getgrent_r_proto=0
11621                 ;;
11622         esac
11623         ;;
11624 *)      getgrent_r_proto=0
11625         ;;
11626 esac
11627
11628 : see if getgrgid_r exists
11629 set getgrgid_r d_getgrgid_r
11630 eval $inlibc
11631 case "$d_getgrgid_r" in
11632 "$define")
11633         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11634         case "grp" in
11635         time)
11636                 hdrs="$hdrs $i_systime sys/time.h"
11637                 ;;
11638         esac
11639         case "$d_getgrgid_r_proto:$usethreads" in
11640         ":define")      d_getgrgid_r_proto=define
11641                 set d_getgrgid_r_proto getgrgid_r $hdrs
11642                 eval $hasproto ;;
11643         *)      ;;
11644         esac
11645         case "$d_getgrgid_r_proto" in
11646         define)
11647         case "$getgrgid_r_proto" in
11648         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
11649         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
11650         esac
11651         case "$getgrgid_r_proto" in
11652         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
11653         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
11654         esac
11655         case "$getgrgid_r_proto" in
11656         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
11657         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
11658         esac
11659         case "$getgrgid_r_proto" in
11660         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
11661         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
11662         esac
11663         case "$getgrgid_r_proto" in
11664         ''|0)   d_getgrgid_r=undef
11665                 getgrgid_r_proto=0
11666                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
11667         * )     case "$getgrgid_r_proto" in
11668                 REENTRANT_PROTO*) ;;
11669                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
11670                 esac
11671                 echo "Prototype: $try" ;;
11672         esac
11673         ;;
11674         *)      case "$usethreads" in
11675                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
11676                 esac
11677                 d_getgrgid_r=undef
11678                 getgrgid_r_proto=0
11679                 ;;
11680         esac
11681         ;;
11682 *)      getgrgid_r_proto=0
11683         ;;
11684 esac
11685
11686 : see if getgrnam_r exists
11687 set getgrnam_r d_getgrnam_r
11688 eval $inlibc
11689 case "$d_getgrnam_r" in
11690 "$define")
11691         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11692         case "grp" in
11693         time)
11694                 hdrs="$hdrs $i_systime sys/time.h"
11695                 ;;
11696         esac
11697         case "$d_getgrnam_r_proto:$usethreads" in
11698         ":define")      d_getgrnam_r_proto=define
11699                 set d_getgrnam_r_proto getgrnam_r $hdrs
11700                 eval $hasproto ;;
11701         *)      ;;
11702         esac
11703         case "$d_getgrnam_r_proto" in
11704         define)
11705         case "$getgrnam_r_proto" in
11706         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
11707         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
11708         esac
11709         case "$getgrnam_r_proto" in
11710         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
11711         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
11712         esac
11713         case "$getgrnam_r_proto" in
11714         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
11715         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
11716         esac
11717         case "$getgrnam_r_proto" in
11718         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
11719         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
11720         esac
11721         case "$getgrnam_r_proto" in
11722         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
11723         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
11724         esac
11725         case "$getgrnam_r_proto" in
11726         ''|0)   d_getgrnam_r=undef
11727                 getgrnam_r_proto=0
11728                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
11729         * )     case "$getgrnam_r_proto" in
11730                 REENTRANT_PROTO*) ;;
11731                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
11732                 esac
11733                 echo "Prototype: $try" ;;
11734         esac
11735         ;;
11736         *)      case "$usethreads" in
11737                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
11738                 esac
11739                 d_getgrnam_r=undef
11740                 getgrnam_r_proto=0
11741                 ;;
11742         esac
11743         ;;
11744 *)      getgrnam_r_proto=0
11745         ;;
11746 esac
11747
11748 : see if gethostbyaddr exists
11749 set gethostbyaddr d_gethbyaddr
11750 eval $inlibc
11751
11752 : see if gethostbyname exists
11753 set gethostbyname d_gethbyname
11754 eval $inlibc
11755
11756 : see if gethostent exists
11757 set gethostent d_gethent
11758 eval $inlibc
11759
11760 : see how we will look up host name
11761 echo " "
11762 call=''
11763 if set gethostname val -f d_gethname; eval $csym; $val; then
11764         echo 'gethostname() found.' >&4
11765         d_gethname="$define"
11766         call=gethostname
11767 fi
11768 if set uname val -f d_uname; eval $csym; $val; then
11769         if ./xenix; then
11770                 $cat <<'EOM'
11771 uname() was found, but you're running xenix, and older versions of xenix
11772 have a broken uname(). If you don't really know whether your xenix is old
11773 enough to have a broken system call, use the default answer.
11774
11775 EOM
11776                 dflt=y
11777                 case "$d_uname" in
11778                 "$define") dflt=n;;
11779                 esac
11780                 rp='Is your uname() broken?'
11781                 . ./myread
11782                 case "$ans" in
11783                 n*) d_uname="$define"; call=uname;;
11784                 esac
11785         else
11786                 echo 'uname() found.' >&4
11787                 d_uname="$define"
11788                 case "$call" in
11789                 '') call=uname ;;
11790                 esac
11791         fi
11792 fi
11793 case "$d_gethname" in
11794 '') d_gethname="$undef";;
11795 esac
11796 case "$d_uname" in
11797 '') d_uname="$undef";;
11798 esac
11799 case "$d_uname$d_gethname" in
11800 *define*)
11801         dflt=n
11802         cat <<EOM
11803  
11804 Every now and then someone has a $call() that lies about the hostname
11805 but can't be fixed for political or economic reasons.  If you wish, I can
11806 pretend $call() isn't there and maybe compute hostname at run-time
11807 thanks to the '$phostname' command.
11808
11809 EOM
11810         rp="Shall I ignore $call() from now on?"
11811         . ./myread
11812         case "$ans" in
11813         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
11814         esac;;
11815 esac
11816 case "$phostname" in
11817 '') aphostname='';;
11818 *) case "$aphostname" in
11819         /*) ;;
11820         *) set X $phostname
11821                 shift
11822                 file=$1
11823                 shift
11824                 file=`./loc $file $file $pth`
11825                 aphostname=`echo $file $*`
11826                 ;;
11827         esac
11828         ;;
11829 esac
11830 case "$d_uname$d_gethname" in
11831 *define*) ;;
11832 *)
11833         case "$phostname" in
11834         '')
11835                 echo "There will be no way for $package to get your hostname." >&4;;
11836         *)
11837         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
11838                 ;;
11839         esac;;
11840 esac
11841 case "$d_phostname" in
11842 '') d_phostname="$undef";;
11843 esac
11844
11845 : see if gethostbyaddr_r exists
11846 set gethostbyaddr_r d_gethostbyaddr_r
11847 eval $inlibc
11848 case "$d_gethostbyaddr_r" in
11849 "$define")
11850         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11851         case "netdb" in
11852         time)
11853                 hdrs="$hdrs $i_systime sys/time.h"
11854                 ;;
11855         esac
11856         case "$d_gethostbyaddr_r_proto:$usethreads" in
11857         ":define")      d_gethostbyaddr_r_proto=define
11858                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
11859                 eval $hasproto ;;
11860         *)      ;;
11861         esac
11862         case "$d_gethostbyaddr_r_proto" in
11863         define)
11864         case "$gethostbyaddr_r_proto" in
11865         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
11866         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
11867         esac
11868         case "$gethostbyaddr_r_proto" in
11869         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
11870         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
11871         esac
11872         case "$gethostbyaddr_r_proto" in
11873         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
11874         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
11875         esac
11876         case "$gethostbyaddr_r_proto" in
11877         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
11878         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
11879         esac
11880         case "$gethostbyaddr_r_proto" in
11881         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
11882         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
11883         esac
11884         case "$gethostbyaddr_r_proto" in
11885         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
11886         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
11887         esac
11888         case "$gethostbyaddr_r_proto" in
11889         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
11890         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
11891         esac
11892         case "$gethostbyaddr_r_proto" in
11893         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
11894         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
11895         esac
11896         case "$gethostbyaddr_r_proto" in
11897         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
11898         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
11899         esac
11900         case "$gethostbyaddr_r_proto" in
11901         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
11902         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
11903         esac
11904         case "$gethostbyaddr_r_proto" in
11905         ''|0)   d_gethostbyaddr_r=undef
11906                 gethostbyaddr_r_proto=0
11907                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
11908         * )     case "$gethostbyaddr_r_proto" in
11909                 REENTRANT_PROTO*) ;;
11910                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
11911                 esac
11912                 echo "Prototype: $try" ;;
11913         esac
11914         ;;
11915         *)      case "$usethreads" in
11916                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
11917                 esac
11918                 d_gethostbyaddr_r=undef
11919                 gethostbyaddr_r_proto=0
11920                 ;;
11921         esac
11922         ;;
11923 *)      gethostbyaddr_r_proto=0
11924         ;;
11925 esac
11926
11927 : see if gethostbyname_r exists
11928 set gethostbyname_r d_gethostbyname_r
11929 eval $inlibc
11930 case "$d_gethostbyname_r" in
11931 "$define")
11932         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11933         case "netdb" in
11934         time)
11935                 hdrs="$hdrs $i_systime sys/time.h"
11936                 ;;
11937         esac
11938         case "$d_gethostbyname_r_proto:$usethreads" in
11939         ":define")      d_gethostbyname_r_proto=define
11940                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
11941                 eval $hasproto ;;
11942         *)      ;;
11943         esac
11944         case "$d_gethostbyname_r_proto" in
11945         define)
11946         case "$gethostbyname_r_proto" in
11947         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
11948         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
11949         esac
11950         case "$gethostbyname_r_proto" in
11951         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
11952         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
11953         esac
11954         case "$gethostbyname_r_proto" in
11955         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
11956         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
11957         esac
11958         case "$gethostbyname_r_proto" in
11959         ''|0)   d_gethostbyname_r=undef
11960                 gethostbyname_r_proto=0
11961                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
11962         * )     case "$gethostbyname_r_proto" in
11963                 REENTRANT_PROTO*) ;;
11964                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
11965                 esac
11966                 echo "Prototype: $try" ;;
11967         esac
11968         ;;
11969         *)      case "$usethreads" in
11970                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
11971                 esac
11972                 d_gethostbyname_r=undef
11973                 gethostbyname_r_proto=0
11974                 ;;
11975         esac
11976         ;;
11977 *)      gethostbyname_r_proto=0
11978         ;;
11979 esac
11980
11981 : see if gethostent_r exists
11982 set gethostent_r d_gethostent_r
11983 eval $inlibc
11984 case "$d_gethostent_r" in
11985 "$define")
11986         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11987         case "netdb" in
11988         time)
11989                 hdrs="$hdrs $i_systime sys/time.h"
11990                 ;;
11991         esac
11992         case "$d_gethostent_r_proto:$usethreads" in
11993         ":define")      d_gethostent_r_proto=define
11994                 set d_gethostent_r_proto gethostent_r $hdrs
11995                 eval $hasproto ;;
11996         *)      ;;
11997         esac
11998         case "$d_gethostent_r_proto" in
11999         define)
12000         case "$gethostent_r_proto" in
12001         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
12002         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
12003         esac
12004         case "$gethostent_r_proto" in
12005         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
12006         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
12007         esac
12008         case "$gethostent_r_proto" in
12009         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
12010         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
12011         esac
12012         case "$gethostent_r_proto" in
12013         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
12014         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
12015         esac
12016         case "$gethostent_r_proto" in
12017         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
12018         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
12019         esac
12020         case "$gethostent_r_proto" in
12021         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
12022         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
12023         esac
12024         case "$gethostent_r_proto" in
12025         ''|0)   d_gethostent_r=undef
12026                 gethostent_r_proto=0
12027                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
12028         * )     case "$gethostent_r_proto" in
12029                 REENTRANT_PROTO*) ;;
12030                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
12031                 esac
12032                 echo "Prototype: $try" ;;
12033         esac
12034         ;;
12035         *)      case "$usethreads" in
12036                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
12037                 esac
12038                 d_gethostent_r=undef
12039                 gethostent_r_proto=0
12040                 ;;
12041         esac
12042         ;;
12043 *)      gethostent_r_proto=0
12044         ;;
12045 esac
12046
12047 : see if prototypes for various gethostxxx netdb.h functions are available
12048 echo " "
12049 set d_gethostprotos gethostent $i_netdb netdb.h
12050 eval $hasproto
12051
12052 : see if getitimer exists
12053 set getitimer d_getitimer
12054 eval $inlibc
12055
12056 : see if getlogin exists
12057 set getlogin d_getlogin
12058 eval $inlibc
12059
12060 : see if getlogin_r exists
12061 set getlogin_r d_getlogin_r
12062 eval $inlibc
12063 case "$d_getlogin_r" in
12064 "$define")
12065         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
12066         case "unistd" in
12067         time)
12068                 hdrs="$hdrs $i_systime sys/time.h"
12069                 ;;
12070         esac
12071         case "$d_getlogin_r_proto:$usethreads" in
12072         ":define")      d_getlogin_r_proto=define
12073                 set d_getlogin_r_proto getlogin_r $hdrs
12074                 eval $hasproto ;;
12075         *)      ;;
12076         esac
12077         case "$d_getlogin_r_proto" in
12078         define)
12079         case "$getlogin_r_proto" in
12080         ''|0) try='int getlogin_r(char*, size_t);'
12081         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
12082         esac
12083         case "$getlogin_r_proto" in
12084         ''|0) try='int getlogin_r(char*, int);'
12085         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
12086         esac
12087         case "$getlogin_r_proto" in
12088         ''|0) try='char* getlogin_r(char*, size_t);'
12089         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
12090         esac
12091         case "$getlogin_r_proto" in
12092         ''|0) try='char* getlogin_r(char*, int);'
12093         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
12094         esac
12095         case "$getlogin_r_proto" in
12096         ''|0)   d_getlogin_r=undef
12097                 getlogin_r_proto=0
12098                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
12099         * )     case "$getlogin_r_proto" in
12100                 REENTRANT_PROTO*) ;;
12101                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
12102                 esac
12103                 echo "Prototype: $try" ;;
12104         esac
12105         ;;
12106         *)      case "$usethreads" in
12107                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
12108                 esac
12109                 d_getlogin_r=undef
12110                 getlogin_r_proto=0
12111                 ;;
12112         esac
12113         ;;
12114 *)      getlogin_r_proto=0
12115         ;;
12116 esac
12117
12118 : see if getmnt exists
12119 set getmnt d_getmnt
12120 eval $inlibc
12121
12122 : see if getmntent exists
12123 set getmntent d_getmntent
12124 eval $inlibc
12125
12126 : see if getnetbyaddr exists
12127 set getnetbyaddr d_getnbyaddr
12128 eval $inlibc
12129
12130 : see if getnetbyname exists
12131 set getnetbyname d_getnbyname
12132 eval $inlibc
12133
12134 : see if getnetent exists
12135 set getnetent d_getnent
12136 eval $inlibc
12137
12138 : see if getnetbyaddr_r exists
12139 set getnetbyaddr_r d_getnetbyaddr_r
12140 eval $inlibc
12141 case "$d_getnetbyaddr_r" in
12142 "$define")
12143         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12144         case "netdb" in
12145         time)
12146                 hdrs="$hdrs $i_systime sys/time.h"
12147                 ;;
12148         esac
12149         case "$d_getnetbyaddr_r_proto:$usethreads" in
12150         ":define")      d_getnetbyaddr_r_proto=define
12151                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
12152                 eval $hasproto ;;
12153         *)      ;;
12154         esac
12155         case "$d_getnetbyaddr_r_proto" in
12156         define)
12157         case "$getnetbyaddr_r_proto" in
12158         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
12159         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
12160         esac
12161         case "$getnetbyaddr_r_proto" in
12162         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
12163         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
12164         esac
12165         case "$getnetbyaddr_r_proto" in
12166         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
12167         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
12168         esac
12169         case "$getnetbyaddr_r_proto" in
12170         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
12171         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
12172         esac
12173         case "$getnetbyaddr_r_proto" in
12174         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
12175         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
12176         esac
12177         case "$getnetbyaddr_r_proto" in
12178         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
12179         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
12180         esac
12181         case "$getnetbyaddr_r_proto" in
12182         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
12183         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
12184         esac
12185         case "$getnetbyaddr_r_proto" in
12186         ''|0)   d_getnetbyaddr_r=undef
12187                 getnetbyaddr_r_proto=0
12188                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
12189         * )     case "$getnetbyaddr_r_proto" in
12190                 REENTRANT_PROTO*) ;;
12191                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
12192                 esac
12193                 echo "Prototype: $try" ;;
12194         esac
12195         ;;
12196         *)      case "$usethreads" in
12197                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
12198                 esac
12199                 d_getnetbyaddr_r=undef
12200                 getnetbyaddr_r_proto=0
12201                 ;;
12202         esac
12203         ;;
12204 *)      getnetbyaddr_r_proto=0
12205         ;;
12206 esac
12207
12208 : see if getnetbyname_r exists
12209 set getnetbyname_r d_getnetbyname_r
12210 eval $inlibc
12211 case "$d_getnetbyname_r" in
12212 "$define")
12213         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12214         case "netdb" in
12215         time)
12216                 hdrs="$hdrs $i_systime sys/time.h"
12217                 ;;
12218         esac
12219         case "$d_getnetbyname_r_proto:$usethreads" in
12220         ":define")      d_getnetbyname_r_proto=define
12221                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
12222                 eval $hasproto ;;
12223         *)      ;;
12224         esac
12225         case "$d_getnetbyname_r_proto" in
12226         define)
12227         case "$getnetbyname_r_proto" in
12228         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
12229         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
12230         esac
12231         case "$getnetbyname_r_proto" in
12232         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
12233         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
12234         esac
12235         case "$getnetbyname_r_proto" in
12236         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
12237         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
12238         esac
12239         case "$getnetbyname_r_proto" in
12240         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
12241         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
12242         esac
12243         case "$getnetbyname_r_proto" in
12244         ''|0)   d_getnetbyname_r=undef
12245                 getnetbyname_r_proto=0
12246                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
12247         * )     case "$getnetbyname_r_proto" in
12248                 REENTRANT_PROTO*) ;;
12249                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
12250                 esac
12251                 echo "Prototype: $try" ;;
12252         esac
12253         ;;
12254         *)      case "$usethreads" in
12255                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
12256                 esac
12257                 d_getnetbyname_r=undef
12258                 getnetbyname_r_proto=0
12259                 ;;
12260         esac
12261         ;;
12262 *)      getnetbyname_r_proto=0
12263         ;;
12264 esac
12265
12266 : see if getnetent_r exists
12267 set getnetent_r d_getnetent_r
12268 eval $inlibc
12269 case "$d_getnetent_r" in
12270 "$define")
12271         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12272         case "netdb" in
12273         time)
12274                 hdrs="$hdrs $i_systime sys/time.h"
12275                 ;;
12276         esac
12277         case "$d_getnetent_r_proto:$usethreads" in
12278         ":define")      d_getnetent_r_proto=define
12279                 set d_getnetent_r_proto getnetent_r $hdrs
12280                 eval $hasproto ;;
12281         *)      ;;
12282         esac
12283         case "$d_getnetent_r_proto" in
12284         define)
12285         case "$getnetent_r_proto" in
12286         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
12287         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
12288         esac
12289         case "$getnetent_r_proto" in
12290         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
12291         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
12292         esac
12293         case "$getnetent_r_proto" in
12294         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
12295         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
12296         esac
12297         case "$getnetent_r_proto" in
12298         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
12299         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
12300         esac
12301         case "$getnetent_r_proto" in
12302         ''|0) try='int getnetent_r(struct netent*, char*, int);'
12303         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
12304         esac
12305         case "$getnetent_r_proto" in
12306         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
12307         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
12308         esac
12309         case "$getnetent_r_proto" in
12310         ''|0)   d_getnetent_r=undef
12311                 getnetent_r_proto=0
12312                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
12313         * )     case "$getnetent_r_proto" in
12314                 REENTRANT_PROTO*) ;;
12315                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
12316                 esac
12317                 echo "Prototype: $try" ;;
12318         esac
12319         ;;
12320         *)      case "$usethreads" in
12321                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
12322                 esac
12323                 d_getnetent_r=undef
12324                 getnetent_r_proto=0
12325                 ;;
12326         esac
12327         ;;
12328 *)      getnetent_r_proto=0
12329         ;;
12330 esac
12331
12332 : see if prototypes for various getnetxxx netdb.h functions are available
12333 echo " "
12334 set d_getnetprotos getnetent $i_netdb netdb.h
12335 eval $hasproto
12336
12337 : see if getpagesize exists
12338 set getpagesize d_getpagsz
12339 eval $inlibc
12340
12341
12342 : see if getprotobyname exists
12343 set getprotobyname d_getpbyname
12344 eval $inlibc
12345
12346 : see if getprotobynumber exists
12347 set getprotobynumber d_getpbynumber
12348 eval $inlibc
12349
12350 : see if getprotoent exists
12351 set getprotoent d_getpent
12352 eval $inlibc
12353
12354 : see if getpgid exists
12355 set getpgid d_getpgid
12356 eval $inlibc
12357
12358 : see if getpgrp2 exists
12359 set getpgrp2 d_getpgrp2
12360 eval $inlibc
12361
12362 : see if getppid exists
12363 set getppid d_getppid
12364 eval $inlibc
12365
12366 : see if getpriority exists
12367 set getpriority d_getprior
12368 eval $inlibc
12369
12370 : see if getprotobyname_r exists
12371 set getprotobyname_r d_getprotobyname_r
12372 eval $inlibc
12373 case "$d_getprotobyname_r" in
12374 "$define")
12375         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12376         case "netdb" in
12377         time)
12378                 hdrs="$hdrs $i_systime sys/time.h"
12379                 ;;
12380         esac
12381         case "$d_getprotobyname_r_proto:$usethreads" in
12382         ":define")      d_getprotobyname_r_proto=define
12383                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
12384                 eval $hasproto ;;
12385         *)      ;;
12386         esac
12387         case "$d_getprotobyname_r_proto" in
12388         define)
12389         case "$getprotobyname_r_proto" in
12390         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
12391         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
12392         esac
12393         case "$getprotobyname_r_proto" in
12394         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
12395         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
12396         esac
12397         case "$getprotobyname_r_proto" in
12398         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
12399         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
12400         esac
12401         case "$getprotobyname_r_proto" in
12402         ''|0)   d_getprotobyname_r=undef
12403                 getprotobyname_r_proto=0
12404                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
12405         * )     case "$getprotobyname_r_proto" in
12406                 REENTRANT_PROTO*) ;;
12407                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
12408                 esac
12409                 echo "Prototype: $try" ;;
12410         esac
12411         ;;
12412         *)      case "$usethreads" in
12413                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
12414                 esac
12415                 d_getprotobyname_r=undef
12416                 getprotobyname_r_proto=0
12417                 ;;
12418         esac
12419         ;;
12420 *)      getprotobyname_r_proto=0
12421         ;;
12422 esac
12423
12424 : see if getprotobynumber_r exists
12425 set getprotobynumber_r d_getprotobynumber_r
12426 eval $inlibc
12427 case "$d_getprotobynumber_r" in
12428 "$define")
12429         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12430         case "netdb" in
12431         time)
12432                 hdrs="$hdrs $i_systime sys/time.h"
12433                 ;;
12434         esac
12435         case "$d_getprotobynumber_r_proto:$usethreads" in
12436         ":define")      d_getprotobynumber_r_proto=define
12437                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
12438                 eval $hasproto ;;
12439         *)      ;;
12440         esac
12441         case "$d_getprotobynumber_r_proto" in
12442         define)
12443         case "$getprotobynumber_r_proto" in
12444         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
12445         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
12446         esac
12447         case "$getprotobynumber_r_proto" in
12448         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
12449         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
12450         esac
12451         case "$getprotobynumber_r_proto" in
12452         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
12453         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
12454         esac
12455         case "$getprotobynumber_r_proto" in
12456         ''|0)   d_getprotobynumber_r=undef
12457                 getprotobynumber_r_proto=0
12458                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
12459         * )     case "$getprotobynumber_r_proto" in
12460                 REENTRANT_PROTO*) ;;
12461                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
12462                 esac
12463                 echo "Prototype: $try" ;;
12464         esac
12465         ;;
12466         *)      case "$usethreads" in
12467                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
12468                 esac
12469                 d_getprotobynumber_r=undef
12470                 getprotobynumber_r_proto=0
12471                 ;;
12472         esac
12473         ;;
12474 *)      getprotobynumber_r_proto=0
12475         ;;
12476 esac
12477
12478 : see if getprotoent_r exists
12479 set getprotoent_r d_getprotoent_r
12480 eval $inlibc
12481 case "$d_getprotoent_r" in
12482 "$define")
12483         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12484         case "netdb" in
12485         time)
12486                 hdrs="$hdrs $i_systime sys/time.h"
12487                 ;;
12488         esac
12489         case "$d_getprotoent_r_proto:$usethreads" in
12490         ":define")      d_getprotoent_r_proto=define
12491                 set d_getprotoent_r_proto getprotoent_r $hdrs
12492                 eval $hasproto ;;
12493         *)      ;;
12494         esac
12495         case "$d_getprotoent_r_proto" in
12496         define)
12497         case "$getprotoent_r_proto" in
12498         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
12499         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
12500         esac
12501         case "$getprotoent_r_proto" in
12502         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
12503         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
12504         esac
12505         case "$getprotoent_r_proto" in
12506         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
12507         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
12508         esac
12509         case "$getprotoent_r_proto" in
12510         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
12511         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
12512         esac
12513         case "$getprotoent_r_proto" in
12514         ''|0)   d_getprotoent_r=undef
12515                 getprotoent_r_proto=0
12516                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
12517         * )     case "$getprotoent_r_proto" in
12518                 REENTRANT_PROTO*) ;;
12519                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
12520                 esac
12521                 echo "Prototype: $try" ;;
12522         esac
12523         ;;
12524         *)      case "$usethreads" in
12525                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
12526                 esac
12527                 d_getprotoent_r=undef
12528                 getprotoent_r_proto=0
12529                 ;;
12530         esac
12531         ;;
12532 *)      getprotoent_r_proto=0
12533         ;;
12534 esac
12535
12536 : see if prototypes for various getprotoxxx netdb.h functions are available
12537 echo " "
12538 set d_getprotoprotos getprotoent $i_netdb netdb.h
12539 eval $hasproto
12540
12541 : see if getprpwnam exists
12542 set getprpwnam d_getprpwnam
12543 eval $inlibc
12544
12545 : see if getpwent exists
12546 set getpwent d_getpwent
12547 eval $inlibc
12548
12549 : see if getpwent_r exists
12550 set getpwent_r d_getpwent_r
12551 eval $inlibc
12552 case "$d_getpwent_r" in
12553 "$define")
12554         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12555         case "pwd" in
12556         time)
12557                 hdrs="$hdrs $i_systime sys/time.h"
12558                 ;;
12559         esac
12560         case "$d_getpwent_r_proto:$usethreads" in
12561         ":define")      d_getpwent_r_proto=define
12562                 set d_getpwent_r_proto getpwent_r $hdrs
12563                 eval $hasproto ;;
12564         *)      ;;
12565         esac
12566         case "$d_getpwent_r_proto" in
12567         define)
12568         case "$getpwent_r_proto" in
12569         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
12570         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
12571         esac
12572         case "$getpwent_r_proto" in
12573         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
12574         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
12575         esac
12576         case "$getpwent_r_proto" in
12577         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
12578         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
12579         esac
12580         case "$getpwent_r_proto" in
12581         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
12582         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
12583         esac
12584         case "$getpwent_r_proto" in
12585         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
12586         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
12587         esac
12588         case "$getpwent_r_proto" in
12589         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
12590         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
12591         esac
12592         case "$getpwent_r_proto" in
12593         ''|0)   d_getpwent_r=undef
12594                 getpwent_r_proto=0
12595                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
12596         * )     case "$getpwent_r_proto" in
12597                 REENTRANT_PROTO*) ;;
12598                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
12599                 esac
12600                 echo "Prototype: $try" ;;
12601         esac
12602         ;;
12603         *)      case "$usethreads" in
12604                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
12605                 esac
12606                 d_getpwent_r=undef
12607                 getpwent_r_proto=0
12608                 ;;
12609         esac
12610         ;;
12611 *)      getpwent_r_proto=0
12612         ;;
12613 esac
12614
12615 : see if getpwnam_r exists
12616 set getpwnam_r d_getpwnam_r
12617 eval $inlibc
12618 case "$d_getpwnam_r" in
12619 "$define")
12620         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12621         case "pwd" in
12622         time)
12623                 hdrs="$hdrs $i_systime sys/time.h"
12624                 ;;
12625         esac
12626         case "$d_getpwnam_r_proto:$usethreads" in
12627         ":define")      d_getpwnam_r_proto=define
12628                 set d_getpwnam_r_proto getpwnam_r $hdrs
12629                 eval $hasproto ;;
12630         *)      ;;
12631         esac
12632         case "$d_getpwnam_r_proto" in
12633         define)
12634         case "$getpwnam_r_proto" in
12635         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
12636         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
12637         esac
12638         case "$getpwnam_r_proto" in
12639         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
12640         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
12641         esac
12642         case "$getpwnam_r_proto" in
12643         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
12644         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
12645         esac
12646         case "$getpwnam_r_proto" in
12647         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
12648         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
12649         esac
12650         case "$getpwnam_r_proto" in
12651         ''|0)   d_getpwnam_r=undef
12652                 getpwnam_r_proto=0
12653                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
12654         * )     case "$getpwnam_r_proto" in
12655                 REENTRANT_PROTO*) ;;
12656                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
12657                 esac
12658                 echo "Prototype: $try" ;;
12659         esac
12660         ;;
12661         *)      case "$usethreads" in
12662                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
12663                 esac
12664                 d_getpwnam_r=undef
12665                 getpwnam_r_proto=0
12666                 ;;
12667         esac
12668         ;;
12669 *)      getpwnam_r_proto=0
12670         ;;
12671 esac
12672
12673 : see if getpwuid_r exists
12674 set getpwuid_r d_getpwuid_r
12675 eval $inlibc
12676 case "$d_getpwuid_r" in
12677 "$define")
12678         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12679         case "pwd" in
12680         time)
12681                 hdrs="$hdrs $i_systime sys/time.h"
12682                 ;;
12683         esac
12684         case "$d_getpwuid_r_proto:$usethreads" in
12685         ":define")      d_getpwuid_r_proto=define
12686                 set d_getpwuid_r_proto getpwuid_r $hdrs
12687                 eval $hasproto ;;
12688         *)      ;;
12689         esac
12690         case "$d_getpwuid_r_proto" in
12691         define)
12692         case "$getpwuid_r_proto" in
12693         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
12694         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
12695         esac
12696         case "$getpwuid_r_proto" in
12697         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
12698         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
12699         esac
12700         case "$getpwuid_r_proto" in
12701         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
12702         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
12703         esac
12704         case "$getpwuid_r_proto" in
12705         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
12706         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
12707         esac
12708         case "$getpwuid_r_proto" in
12709         ''|0)   d_getpwuid_r=undef
12710                 getpwuid_r_proto=0
12711                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
12712         * )     case "$getpwuid_r_proto" in
12713                 REENTRANT_PROTO*) ;;
12714                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
12715                 esac
12716                 echo "Prototype: $try" ;;
12717         esac
12718         ;;
12719         *)      case "$usethreads" in
12720                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
12721                 esac
12722                 d_getpwuid_r=undef
12723                 getpwuid_r_proto=0
12724                 ;;
12725         esac
12726         ;;
12727 *)      getpwuid_r_proto=0
12728         ;;
12729 esac
12730
12731
12732 : see if getservbyname exists
12733 set getservbyname d_getsbyname
12734 eval $inlibc
12735
12736 : see if getservbyport exists
12737 set getservbyport d_getsbyport
12738 eval $inlibc
12739
12740 : see if getservent exists
12741 set getservent d_getsent
12742 eval $inlibc
12743
12744 : see if getservbyname_r exists
12745 set getservbyname_r d_getservbyname_r
12746 eval $inlibc
12747 case "$d_getservbyname_r" in
12748 "$define")
12749         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12750         case "netdb" in
12751         time)
12752                 hdrs="$hdrs $i_systime sys/time.h"
12753                 ;;
12754         esac
12755         case "$d_getservbyname_r_proto:$usethreads" in
12756         ":define")      d_getservbyname_r_proto=define
12757                 set d_getservbyname_r_proto getservbyname_r $hdrs
12758                 eval $hasproto ;;
12759         *)      ;;
12760         esac
12761         case "$d_getservbyname_r_proto" in
12762         define)
12763         case "$getservbyname_r_proto" in
12764         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
12765         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
12766         esac
12767         case "$getservbyname_r_proto" in
12768         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
12769         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
12770         esac
12771         case "$getservbyname_r_proto" in
12772         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
12773         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
12774         esac
12775         case "$getservbyname_r_proto" in
12776         ''|0)   d_getservbyname_r=undef
12777                 getservbyname_r_proto=0
12778                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
12779         * )     case "$getservbyname_r_proto" in
12780                 REENTRANT_PROTO*) ;;
12781                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
12782                 esac
12783                 echo "Prototype: $try" ;;
12784         esac
12785         ;;
12786         *)      case "$usethreads" in
12787                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
12788                 esac
12789                 d_getservbyname_r=undef
12790                 getservbyname_r_proto=0
12791                 ;;
12792         esac
12793         ;;
12794 *)      getservbyname_r_proto=0
12795         ;;
12796 esac
12797
12798 : see if getservbyport_r exists
12799 set getservbyport_r d_getservbyport_r
12800 eval $inlibc
12801 case "$d_getservbyport_r" in
12802 "$define")
12803         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12804         case "netdb" in
12805         time)
12806                 hdrs="$hdrs $i_systime sys/time.h"
12807                 ;;
12808         esac
12809         case "$d_getservbyport_r_proto:$usethreads" in
12810         ":define")      d_getservbyport_r_proto=define
12811                 set d_getservbyport_r_proto getservbyport_r $hdrs
12812                 eval $hasproto ;;
12813         *)      ;;
12814         esac
12815         case "$d_getservbyport_r_proto" in
12816         define)
12817         case "$getservbyport_r_proto" in
12818         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
12819         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
12820         esac
12821         case "$getservbyport_r_proto" in
12822         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
12823         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
12824         esac
12825         case "$getservbyport_r_proto" in
12826         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
12827         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
12828         esac
12829         case "$getservbyport_r_proto" in
12830         ''|0)   d_getservbyport_r=undef
12831                 getservbyport_r_proto=0
12832                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
12833         * )     case "$getservbyport_r_proto" in
12834                 REENTRANT_PROTO*) ;;
12835                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
12836                 esac
12837                 echo "Prototype: $try" ;;
12838         esac
12839         ;;
12840         *)      case "$usethreads" in
12841                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
12842                 esac
12843                 d_getservbyport_r=undef
12844                 getservbyport_r_proto=0
12845                 ;;
12846         esac
12847         ;;
12848 *)      getservbyport_r_proto=0
12849         ;;
12850 esac
12851
12852 : see if getservent_r exists
12853 set getservent_r d_getservent_r
12854 eval $inlibc
12855 case "$d_getservent_r" in
12856 "$define")
12857         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12858         case "netdb" in
12859         time)
12860                 hdrs="$hdrs $i_systime sys/time.h"
12861                 ;;
12862         esac
12863         case "$d_getservent_r_proto:$usethreads" in
12864         ":define")      d_getservent_r_proto=define
12865                 set d_getservent_r_proto getservent_r $hdrs
12866                 eval $hasproto ;;
12867         *)      ;;
12868         esac
12869         case "$d_getservent_r_proto" in
12870         define)
12871         case "$getservent_r_proto" in
12872         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
12873         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
12874         esac
12875         case "$getservent_r_proto" in
12876         ''|0) try='int getservent_r(struct servent*, char*, int);'
12877         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
12878         esac
12879         case "$getservent_r_proto" in
12880         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
12881         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
12882         esac
12883         case "$getservent_r_proto" in
12884         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
12885         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
12886         esac
12887         case "$getservent_r_proto" in
12888         ''|0)   d_getservent_r=undef
12889                 getservent_r_proto=0
12890                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
12891         * )     case "$getservent_r_proto" in
12892                 REENTRANT_PROTO*) ;;
12893                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
12894                 esac
12895                 echo "Prototype: $try" ;;
12896         esac
12897         ;;
12898         *)      case "$usethreads" in
12899                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
12900                 esac
12901                 d_getservent_r=undef
12902                 getservent_r_proto=0
12903                 ;;
12904         esac
12905         ;;
12906 *)      getservent_r_proto=0
12907         ;;
12908 esac
12909
12910 : see if prototypes for various getservxxx netdb.h functions are available
12911 echo " "
12912 set d_getservprotos getservent $i_netdb netdb.h
12913 eval $hasproto
12914
12915 : see if getspnam exists
12916 set getspnam d_getspnam
12917 eval $inlibc
12918
12919 : see if this is a shadow.h system
12920 set shadow.h i_shadow
12921 eval $inhdr
12922
12923 : see if getspnam_r exists
12924 set getspnam_r d_getspnam_r
12925 eval $inlibc
12926 case "$d_getspnam_r" in
12927 "$define")
12928         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
12929         case "shadow" in
12930         time)
12931                 hdrs="$hdrs $i_systime sys/time.h"
12932                 ;;
12933         esac
12934         case "$d_getspnam_r_proto:$usethreads" in
12935         ":define")      d_getspnam_r_proto=define
12936                 set d_getspnam_r_proto getspnam_r $hdrs
12937                 eval $hasproto ;;
12938         *)      ;;
12939         esac
12940         case "$d_getspnam_r_proto" in
12941         define)
12942         case "$getspnam_r_proto" in
12943         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
12944         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
12945         esac
12946         case "$getspnam_r_proto" in
12947         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
12948         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
12949         esac
12950         case "$getspnam_r_proto" in
12951         ''|0)   d_getspnam_r=undef
12952                 getspnam_r_proto=0
12953                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
12954         * )     case "$getspnam_r_proto" in
12955                 REENTRANT_PROTO*) ;;
12956                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
12957                 esac
12958                 echo "Prototype: $try" ;;
12959         esac
12960         ;;
12961         *)      case "$usethreads" in
12962                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
12963                 esac
12964                 d_getspnam_r=undef
12965                 getspnam_r_proto=0
12966                 ;;
12967         esac
12968         ;;
12969 *)      getspnam_r_proto=0
12970         ;;
12971 esac
12972
12973 : see if gettimeofday or ftime exists
12974 set gettimeofday d_gettimeod
12975 eval $inlibc
12976 case "$d_gettimeod" in
12977 "$undef")
12978         set ftime d_ftime 
12979         eval $inlibc
12980         ;;
12981 *)
12982         val="$undef"; set d_ftime; eval $setvar
12983         ;;
12984 esac
12985 case "$d_gettimeod$d_ftime" in
12986 "$undef$undef")
12987         echo " "
12988         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
12989         ;;
12990 esac
12991
12992 : see if gmtime_r exists
12993 set gmtime_r d_gmtime_r
12994 eval $inlibc
12995 case "$d_gmtime_r" in
12996 "$define")
12997         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h"
12998         case "time" in
12999         time)
13000                 hdrs="$hdrs $i_systime sys/time.h"
13001                 ;;
13002         esac
13003         case "$d_gmtime_r_proto:$usethreads" in
13004         ":define")      d_gmtime_r_proto=define
13005                 set d_gmtime_r_proto gmtime_r $hdrs
13006                 eval $hasproto ;;
13007         *)      ;;
13008         esac
13009         case "$d_gmtime_r_proto" in
13010         define)
13011         case "$gmtime_r_proto" in
13012         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
13013         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
13014         esac
13015         case "$gmtime_r_proto" in
13016         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
13017         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
13018         esac
13019         case "$gmtime_r_proto" in
13020         ''|0)   d_gmtime_r=undef
13021                 gmtime_r_proto=0
13022                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
13023         * )     case "$gmtime_r_proto" in
13024                 REENTRANT_PROTO*) ;;
13025                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
13026                 esac
13027                 echo "Prototype: $try" ;;
13028         esac
13029         ;;
13030         *)      case "$usethreads" in
13031                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
13032                 esac
13033                 d_gmtime_r=undef
13034                 gmtime_r_proto=0
13035                 ;;
13036         esac
13037         ;;
13038 *)      gmtime_r_proto=0
13039         ;;
13040 esac
13041
13042 : see if hasmntopt exists
13043 set hasmntopt d_hasmntopt
13044 eval $inlibc
13045
13046 : see if this is a netinet/in.h or sys/in.h system
13047 set netinet/in.h i_niin sys/in.h i_sysin
13048 eval $inhdr
13049
13050 : see if arpa/inet.h has to be included
13051 set arpa/inet.h i_arpainet
13052 eval $inhdr
13053
13054 : see if htonl --and friends-- exists
13055 val=''
13056 set htonl val
13057 eval $inlibc
13058
13059 : Maybe they are macros.
13060 case "$val" in
13061 $undef)
13062         $cat >htonl.c <<EOM
13063 #include <stdio.h>
13064 #include <sys/types.h>
13065 #$i_niin I_NETINET_IN
13066 #$i_sysin I_SYS_IN
13067 #$i_arpainet I_ARPA_INET
13068 #ifdef I_NETINET_IN
13069 #include <netinet/in.h>
13070 #endif
13071 #ifdef I_SYS_IN
13072 #include <sys/in.h>
13073 #endif
13074 #ifdef I_ARPA_INET
13075 #include <arpa/inet.h>
13076 #endif
13077 #ifdef htonl
13078 printf("Defined as a macro.");
13079 #endif
13080 EOM
13081         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
13082         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
13083                 val="$define"
13084                 echo "But it seems to be defined as a macro." >&4
13085         fi
13086         $rm -f htonl.?
13087         ;;
13088 esac
13089 set d_htonl
13090 eval $setvar
13091
13092 : index or strchr
13093 echo " "
13094 if set index val -f; eval $csym; $val; then
13095         if set strchr val -f d_strchr; eval $csym; $val; then
13096                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
13097                         val="$define"
13098                         vali="$undef"
13099                         echo "strchr() found." >&4
13100                 else
13101                         val="$undef"
13102                         vali="$define"
13103                         echo "index() found." >&4
13104                 fi
13105         else
13106                 val="$undef"
13107                 vali="$define"
13108                 echo "index() found." >&4
13109         fi
13110 else
13111         if set strchr val -f d_strchr; eval $csym; $val; then
13112                 val="$define"
13113                 vali="$undef"
13114                 echo "strchr() found." >&4
13115         else
13116                 echo "No index() or strchr() found!" >&4
13117                 val="$undef"
13118                 vali="$undef"
13119         fi
13120 fi
13121 set d_strchr; eval $setvar
13122 val="$vali"
13123 set d_index; eval $setvar
13124
13125 : check whether inet_aton exists
13126 set inet_aton d_inetaton
13127 eval $inlibc
13128
13129 : Look for isascii
13130 echo " "
13131 $cat >isascii.c <<'EOCP'
13132 #include <stdio.h>
13133 #include <ctype.h>
13134 int main() {
13135         int c = 'A';
13136         if (isascii(c))
13137                 exit(0);
13138         else
13139                 exit(1);
13140 }
13141 EOCP
13142 set isascii
13143 if eval $compile; then
13144         echo "isascii() found." >&4
13145         val="$define"
13146 else
13147         echo "isascii() NOT found." >&4
13148         val="$undef"
13149 fi
13150 set d_isascii
13151 eval $setvar
13152 $rm -f isascii*
13153
13154 : see if isfinite exists
13155 set isfinite d_isfinite
13156 eval $inlibc
13157
13158 : see if isinf exists
13159 set isinf d_isinf
13160 eval $inlibc
13161
13162 : see if isnan exists
13163 set isnan d_isnan
13164 eval $inlibc
13165
13166 : see if isnanl exists
13167 set isnanl d_isnanl
13168 eval $inlibc
13169
13170 : see if killpg exists
13171 set killpg d_killpg
13172 eval $inlibc
13173
13174 : see if lchown exists
13175 echo " "
13176 $cat > try.c <<'EOCP'
13177 /* System header to define __stub macros and hopefully few prototypes,
13178     which can conflict with char lchown(); below.  */
13179 #include <assert.h>
13180 /* Override any gcc2 internal prototype to avoid an error.  */
13181 /* We use char because int might match the return type of a gcc2
13182    builtin and then its argument prototype would still apply.  */
13183 char lchown();
13184 int main() {
13185     /*  The GNU C library defines this for functions which it implements
13186         to always fail with ENOSYS.  Some functions are actually named
13187         something starting with __ and the normal name is an alias.  */
13188 #if defined (__stub_lchown) || defined (__stub___lchown)
13189 choke me
13190 #else
13191 lchown();
13192 #endif
13193 ; return 0; }
13194 EOCP
13195 set try
13196 if eval $compile; then
13197     $echo "lchown() found." >&4
13198     val="$define"
13199 else
13200     $echo "lchown() NOT found." >&4
13201     val="$undef"
13202 fi
13203 set d_lchown
13204 eval $setvar
13205
13206 : See if number of significant digits in a double precision number is known
13207 echo " "
13208 $cat >ldbl_dig.c <<EOM
13209 #$i_limits I_LIMITS
13210 #$i_float I_FLOAT
13211 #ifdef I_LIMITS
13212 #include <limits.h>
13213 #endif
13214 #ifdef I_FLOAT
13215 #include <float.h>
13216 #endif
13217 #ifdef LDBL_DIG
13218 printf("Contains LDBL_DIG");
13219 #endif
13220 EOM
13221 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
13222 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
13223         echo "LDBL_DIG found." >&4
13224         val="$define"
13225 else
13226         echo "LDBL_DIG NOT found." >&4
13227         val="$undef"
13228 fi
13229 $rm -f ldbl_dig.?
13230 set d_ldbl_dig
13231 eval $setvar
13232
13233 : see if link exists
13234 set link d_link
13235 eval $inlibc
13236
13237 : see if localtime_r exists
13238 set localtime_r d_localtime_r
13239 eval $inlibc
13240 case "$d_localtime_r" in
13241 "$define")
13242         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h"
13243         case "time" in
13244         time)
13245                 hdrs="$hdrs $i_systime sys/time.h"
13246                 ;;
13247         esac
13248         case "$d_localtime_r_proto:$usethreads" in
13249         ":define")      d_localtime_r_proto=define
13250                 set d_localtime_r_proto localtime_r $hdrs
13251                 eval $hasproto ;;
13252         *)      ;;
13253         esac
13254         case "$d_localtime_r_proto" in
13255         define)
13256         case "$localtime_r_proto" in
13257         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
13258         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
13259         esac
13260         case "$localtime_r_proto" in
13261         ''|0) try='int localtime_r(const time_t*, struct tm*);'
13262         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
13263         esac
13264         case "$localtime_r_proto" in
13265         ''|0)   d_localtime_r=undef
13266                 localtime_r_proto=0
13267                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
13268         * )     case "$localtime_r_proto" in
13269                 REENTRANT_PROTO*) ;;
13270                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
13271                 esac
13272                 echo "Prototype: $try" ;;
13273         esac
13274         ;;
13275         *)      case "$usethreads" in
13276                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
13277                 esac
13278                 d_localtime_r=undef
13279                 localtime_r_proto=0
13280                 ;;
13281         esac
13282         ;;
13283 *)      localtime_r_proto=0
13284         ;;
13285 esac
13286
13287 : see if localeconv exists
13288 set localeconv d_locconv
13289 eval $inlibc
13290
13291 : see if lockf exists
13292 set lockf d_lockf
13293 eval $inlibc
13294
13295 : see if prototype for lseek is available
13296 echo " "
13297 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
13298 eval $hasproto
13299
13300 : see if lstat exists
13301 set lstat d_lstat
13302 eval $inlibc
13303
13304 : see if madvise exists
13305 set madvise d_madvise
13306 eval $inlibc
13307
13308 : see if mblen exists
13309 set mblen d_mblen
13310 eval $inlibc
13311
13312 : see if mbstowcs exists
13313 set mbstowcs d_mbstowcs
13314 eval $inlibc
13315
13316 : see if mbtowc exists
13317 set mbtowc d_mbtowc
13318 eval $inlibc
13319
13320 : see if memchr exists
13321 set memchr d_memchr
13322 eval $inlibc
13323
13324 : see if memcmp exists
13325 set memcmp d_memcmp
13326 eval $inlibc
13327
13328 : see if memcpy exists
13329 set memcpy d_memcpy
13330 eval $inlibc
13331
13332 : see if memmove exists
13333 set memmove d_memmove
13334 eval $inlibc
13335
13336 : see if memset exists
13337 set memset d_memset
13338 eval $inlibc
13339
13340 : see if mkdir exists
13341 set mkdir d_mkdir
13342 eval $inlibc
13343
13344 : see if mkdtemp exists
13345 set mkdtemp d_mkdtemp
13346 eval $inlibc
13347
13348 : see if mkfifo exists
13349 set mkfifo d_mkfifo
13350 eval $inlibc
13351
13352 : see if mkstemp exists
13353 set mkstemp d_mkstemp
13354 eval $inlibc
13355
13356 : see if mkstemps exists
13357 set mkstemps d_mkstemps
13358 eval $inlibc
13359
13360 : see if mktime exists
13361 set mktime d_mktime
13362 eval $inlibc
13363
13364 : see if this is a sys/mman.h system
13365 set sys/mman.h i_sysmman
13366 eval $inhdr
13367
13368 : see if mmap exists
13369 set mmap d_mmap
13370 eval $inlibc
13371 : see what shmat returns
13372 : default to something harmless
13373 mmaptype='void *'
13374 case "$i_sysmman$d_mmap" in
13375 "$define$define")
13376         $cat >mmap.c <<'END'
13377 #include <sys/mman.h>
13378 void *mmap();
13379 END
13380         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
13381                 mmaptype='void *'
13382         else
13383                 mmaptype='caddr_t'
13384         fi
13385         echo "and it returns ($mmaptype)." >&4
13386         ;;
13387 esac
13388
13389
13390
13391 : see if mprotect exists
13392 set mprotect d_mprotect
13393 eval $inlibc
13394
13395 : see if msgctl exists
13396 set msgctl d_msgctl
13397 eval $inlibc
13398
13399 : see if msgget exists
13400 set msgget d_msgget
13401 eval $inlibc
13402
13403 : see if msgsnd exists
13404 set msgsnd d_msgsnd
13405 eval $inlibc
13406
13407 : see if msgrcv exists
13408 set msgrcv d_msgrcv
13409 eval $inlibc
13410
13411 : see how much of the 'msg*(2)' library is present.
13412 h_msg=true
13413 echo " "
13414 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
13415 *"$undef"*) h_msg=false;;
13416 esac
13417 case "$osname" in
13418 freebsd)
13419     case "`ipcs 2>&1`" in
13420     "SVID messages"*"not configured"*)
13421         echo "Your $osname does not have the msg*(2) configured." >&4
13422         h_msg=false
13423         val="$undef"
13424         set msgctl d_msgctl
13425         eval $setvar
13426         set msgget d_msgget
13427         eval $setvar
13428         set msgsnd d_msgsnd
13429         eval $setvar
13430         set msgrcv d_msgrcv
13431         eval $setvar
13432         ;;
13433     esac
13434     ;;
13435 esac
13436 : we could also check for sys/ipc.h ...
13437 if $h_msg && $test `./findhdr sys/msg.h`; then
13438         echo "You have the full msg*(2) library." >&4
13439         val="$define"
13440 else
13441         echo "You don't have the full msg*(2) library." >&4
13442         val="$undef"
13443 fi
13444 set d_msg
13445 eval $setvar
13446
13447
13448 echo " "
13449 echo "Checking to see if your system supports struct msghdr..." >&4
13450 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
13451 eval $hasstruct
13452 case "$d_msghdr_s" in
13453 "$define")      echo "Yes, it does."   ;;
13454 *)              echo "No, it doesn't." ;;
13455 esac
13456
13457
13458 : see if msync exists
13459 set msync d_msync
13460 eval $inlibc
13461
13462 : see if munmap exists
13463 set munmap d_munmap
13464 eval $inlibc
13465
13466 : see if nice exists
13467 set nice d_nice
13468 eval $inlibc
13469
13470 : see if this is a langinfo.h system
13471 set langinfo.h i_langinfo
13472 eval $inhdr
13473
13474 : see if nl_langinfo exists
13475 set nl_langinfo d_nl_langinfo
13476 eval $inlibc
13477
13478 : check for length of character
13479 echo " "
13480 case "$charsize" in
13481 '')
13482         echo "Checking to see how big your characters are (hey, you never know)..." >&4
13483         $cat >try.c <<'EOCP'
13484 #include <stdio.h>
13485 int main()
13486 {
13487     printf("%d\n", (int)sizeof(char));
13488     exit(0);
13489 }
13490 EOCP
13491         set try
13492         if eval $compile_ok; then
13493                 dflt=`$run ./try`
13494         else
13495                 dflt='1'
13496                 echo "(I can't seem to compile the test program.  Guessing...)"
13497         fi
13498         ;;
13499 *)
13500         dflt="$charsize"
13501         ;;
13502 esac
13503 rp="What is the size of a character (in bytes)?"
13504 . ./myread
13505 charsize="$ans"
13506 $rm -f try.c try
13507
13508 : check for volatile keyword
13509 echo " "
13510 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
13511 $cat >try.c <<'EOCP'
13512 int main()
13513 {
13514         typedef struct _goo_struct goo_struct;
13515         goo_struct * volatile goo = ((goo_struct *)0);
13516         struct _goo_struct {
13517                 long long_int;
13518                 int reg_int;
13519                 char char_var;
13520         };
13521         typedef unsigned short foo_t;
13522         char *volatile foo;
13523         volatile int bar;
13524         volatile foo_t blech;
13525         foo = foo;
13526 }
13527 EOCP
13528 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
13529         val="$define"
13530         echo "Yup, it does."
13531 else
13532         val="$undef"
13533         echo "Nope, it doesn't."
13534 fi
13535 set d_volatile
13536 eval $setvar
13537 $rm -f try.*
13538
13539
13540 echo " "
13541 $echo "Choosing the C types to be used for Perl's internal types..." >&4
13542
13543 case "$use64bitint:$d_quad:$quadtype" in
13544 define:define:?*)
13545         ivtype="$quadtype"
13546         uvtype="$uquadtype"
13547         ivsize=8
13548         uvsize=8
13549         ;;
13550 *)      ivtype="long"
13551         uvtype="unsigned long"
13552         ivsize=$longsize
13553         uvsize=$longsize
13554         ;;
13555 esac
13556
13557 case "$uselongdouble:$d_longdbl" in
13558 define:define)
13559         nvtype="long double"
13560         nvsize=$longdblsize
13561         ;;
13562 *)      nvtype=double
13563         nvsize=$doublesize
13564         ;;
13565 esac
13566
13567 $echo "(IV will be "$ivtype", $ivsize bytes)"
13568 $echo "(UV will be "$uvtype", $uvsize bytes)"
13569 $echo "(NV will be "$nvtype", $nvsize bytes)"
13570
13571 $cat >try.c <<EOCP
13572 #$i_inttypes I_INTTYPES
13573 #ifdef I_INTTYPES
13574 #include <inttypes.h>
13575 #endif
13576 #include <stdio.h>
13577 int main() {
13578 #ifdef INT8
13579    int8_t i =  INT8_MAX;
13580   uint8_t u = UINT8_MAX;
13581   printf("int8_t\n");
13582 #endif
13583 #ifdef INT16
13584    int16_t i =  INT16_MAX;
13585   uint16_t i = UINT16_MAX;
13586   printf("int16_t\n");
13587 #endif
13588 #ifdef INT32
13589    int32_t i =  INT32_MAX;
13590   uint32_t u = UINT32_MAX;
13591   printf("int32_t\n");
13592 #endif
13593 }
13594 EOCP
13595
13596 case "$i8type" in
13597 '')     case "$charsize" in
13598         1)      i8type=char
13599                 u8type="unsigned char"
13600                 i8size=$charsize
13601                 u8size=$charsize
13602                 ;;
13603         esac
13604         ;;
13605 esac
13606 case "$i8type" in
13607 '')     set try -DINT8
13608         if eval $compile; then
13609                 case "`$run ./try`" in
13610                 int8_t) i8type=int8_t
13611                         u8type=uint8_t
13612                         i8size=1
13613                         u8size=1
13614                         ;;
13615                 esac
13616         fi
13617         ;;
13618 esac
13619 case "$i8type" in
13620 '')     if $test $charsize -ge 1; then
13621                 i8type=char
13622                 u8type="unsigned char"
13623                 i8size=$charsize
13624                 u8size=$charsize
13625         fi
13626         ;;
13627 esac
13628
13629 case "$i16type" in
13630 '')     case "$shortsize" in
13631         2)      i16type=short
13632                 u16type="unsigned short"
13633                 i16size=$shortsize
13634                 u16size=$shortsize
13635                 ;;
13636         esac
13637         ;;
13638 esac
13639 case "$i16type" in
13640 '')     set try -DINT16
13641         if eval $compile; then
13642                 case "`$run ./try`" in
13643                 int16_t)
13644                         i16type=int16_t
13645                         u16type=uint16_t
13646                         i16size=2
13647                         u16size=2
13648                         ;;
13649                 esac
13650         fi
13651         ;;
13652 esac
13653 case "$i16type" in
13654 '')     if $test $shortsize -ge 2; then
13655                 i16type=short
13656                 u16type="unsigned short"
13657                 i16size=$shortsize
13658                 u16size=$shortsize
13659         fi
13660         ;;
13661 esac
13662
13663 case "$i32type" in
13664 '')     case "$longsize" in
13665         4)      i32type=long
13666                 u32type="unsigned long"
13667                 i32size=$longsize
13668                 u32size=$longsize
13669                 ;;
13670         *)      case "$intsize" in
13671                 4)      i32type=int
13672                         u32type="unsigned int"
13673                         i32size=$intsize
13674                         u32size=$intsize
13675                         ;;
13676                 esac
13677                 ;;
13678         esac
13679         ;;
13680 esac
13681 case "$i32type" in
13682 '')     set try -DINT32
13683         if eval $compile; then
13684                 case "`$run ./try`" in
13685                 int32_t)
13686                         i32type=int32_t
13687                         u32type=uint32_t
13688                         i32size=4
13689                         u32size=4
13690                         ;;
13691                 esac
13692         fi
13693         ;;
13694 esac
13695 case "$i32type" in
13696 '')     if $test $intsize -ge 4; then
13697                 i32type=int
13698                 u32type="unsigned int"
13699                 i32size=$intsize
13700                 u32size=$intsize
13701         fi
13702         ;;
13703 esac
13704
13705 case "$i64type" in
13706 '')     case "$d_quad:$quadtype" in
13707         define:?*)
13708                 i64type="$quadtype"
13709                 u64type="$uquadtype"
13710                 i64size=8
13711                 u64size=8
13712                 ;;
13713         esac
13714         ;;
13715 esac
13716
13717 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
13718 : volatile so that the compiler has to store it out to memory.
13719 if test X"$d_volatile" = X"$define"; then
13720         volatile=volatile
13721 fi
13722 $cat <<EOP >try.c
13723 #include <stdio.h>
13724 #include <sys/types.h>
13725 #include <signal.h>
13726 #ifdef SIGFPE
13727 $volatile int bletched = 0;
13728 $signal_t blech(s) int s; { bletched = 1; }
13729 #endif
13730 int main() {
13731     $uvtype u = 0;
13732     $nvtype d;
13733     int     n = 8 * $uvsize;
13734     int     i;
13735 #ifdef SIGFPE
13736     signal(SIGFPE, blech);
13737 #endif
13738
13739     for (i = 0; i < n; i++) {
13740       u = u << 1 | ($uvtype)1;
13741       d = ($nvtype)u;
13742       if (($uvtype)d != u)
13743         break;
13744       if (d <= 0)
13745         break;
13746       d = ($nvtype)(u - 1);
13747       if (($uvtype)d != (u - 1))
13748         break;
13749 #ifdef SIGFPE
13750       if (bletched) {
13751         break;
13752 #endif
13753       } 
13754     }
13755     printf("%d\n", ((i == n) ? -n : i));
13756     exit(0);
13757 }
13758 EOP
13759 set try
13760
13761 d_nv_preserves_uv="$undef"
13762 if eval $compile; then
13763         nv_preserves_uv_bits="`$run ./try`"
13764 fi
13765 case "$nv_preserves_uv_bits" in
13766 \-[1-9]*)       
13767         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
13768         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
13769         d_nv_preserves_uv="$define"
13770         ;;
13771 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
13772         d_nv_preserves_uv="$undef" ;;
13773 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
13774         nv_preserves_uv_bits="$undef" ;;
13775 esac
13776
13777 $rm -f try.* try
13778
13779
13780 : check for off64_t
13781 echo " "
13782 echo "Checking to see if you have off64_t..." >&4
13783 $cat >try.c <<EOCP
13784 #include <sys/types.h>
13785 #include <unistd.h>
13786 int main() { off64_t x = 7; }
13787 EOCP
13788 set try
13789 if eval $compile; then
13790         val="$define"
13791         echo "You have off64_t."
13792 else
13793         val="$undef"
13794         echo "You do not have off64_t."
13795         case "$lseeksize" in
13796         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
13797         esac
13798 fi
13799 $rm -f try.* try
13800 set d_off64_t
13801 eval $setvar
13802
13803 : see if POSIX threads are available
13804 set pthread.h i_pthread
13805 eval $inhdr
13806
13807
13808
13809
13810 : how to create joinable pthreads
13811 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
13812         echo " "
13813         echo "Checking what constant to use for creating joinable pthreads..." >&4 
13814         $cat >try.c <<'EOCP'
13815 #include <pthread.h>
13816 int main() {
13817     int detachstate = JOINABLE;
13818 }
13819 EOCP
13820         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
13821         if eval $compile; then
13822                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
13823                 val="$undef" # Yes, undef.
13824                 set d_old_pthread_create_joinable
13825                 eval $setvar
13826                 val=""
13827                 set old_pthread_create_joinable
13828                 eval $setvar
13829         else
13830                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
13831                 if eval $compile; then
13832                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
13833                         val="$define"
13834                         set d_old_pthread_create_joinable
13835                         eval $setvar
13836                         val=PTHREAD_CREATE_UNDETACHED
13837                         set old_pthread_create_joinable
13838                         eval $setvar
13839                 else            
13840                         set try -DJOINABLE=__UNDETACHED
13841                         if eval $compile; then
13842                                 echo "You seem to use __UNDETACHED." >&4
13843                                 val="$define"
13844                                 set d_old_pthread_create_joinable
13845                                 eval $setvar
13846                                 val=__UNDETACHED
13847                                 set old_pthread_create_joinable
13848                                 eval $setvar
13849                         else
13850                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
13851                                 val="$define"
13852                                 set d_old_pthread_create_joinable
13853                                 eval $setvar
13854                                 val=0
13855                                 set old_pthread_create_joinable
13856                                 eval $setvar
13857                         fi
13858                 fi
13859         fi
13860         $rm -f try try.*
13861 else
13862     d_old_pthread_create_joinable="$undef"
13863     old_pthread_create_joinable=""
13864 fi
13865
13866 : see if pause exists
13867 set pause d_pause
13868 eval $inlibc
13869
13870 : see if pipe exists
13871 set pipe d_pipe
13872 eval $inlibc
13873
13874 : see if poll exists
13875 set poll d_poll
13876 eval $inlibc
13877
13878 : see if readlink exists
13879 set readlink d_readlink
13880 eval $inlibc
13881
13882 echo " "
13883 procselfexe=''
13884 val="$undef"
13885 case "$d_readlink" in
13886 "$define")
13887         if $issymlink /proc/self/exe ; then
13888                 $ls -l /proc/self/exe > reflect
13889                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13890                         echo "You have Linux-like /proc/self/exe."
13891                         procselfexe='"/proc/self/exe"'
13892                         val="$define"
13893                 fi
13894         fi
13895         if $issymlink /proc/curproc/file ; then
13896                 $ls -l /proc/curproc/file > reflect
13897                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13898                         echo "You have BSD-like /proc/curproc/file."
13899                         procselfexe='"/proc/curproc/file"'
13900                         val="$define"
13901                 fi
13902         fi
13903         ;;
13904 esac
13905 $rm -f reflect
13906 set d_procselfexe
13907 eval $setvar
13908
13909 : see whether the pthread_atfork exists
13910 $cat >try.c <<EOP
13911 #include <pthread.h>
13912 #include <stdio.h>
13913 int main() {
13914 #ifdef  PTHREAD_ATFORK
13915         pthread_atfork(NULL,NULL,NULL);
13916 #endif
13917 }
13918 EOP
13919
13920 : see if pthread_atfork exists
13921 set try -DPTHREAD_ATFORK
13922 if eval $compile; then
13923     val="$define"
13924 else
13925     val="$undef"
13926 fi
13927 case "$usethreads" in
13928 $define)
13929         case "$val" in
13930         $define) echo 'pthread_atfork found.' >&4        ;;
13931         *)       echo 'pthread_atfork NOT found.' >&4    ;;
13932         esac
13933 esac
13934 set d_pthread_atfork
13935 eval $setvar
13936
13937
13938 : see whether the various POSIXish _yields exist
13939 $cat >try.c <<EOP
13940 #include <pthread.h>
13941 #include <stdio.h>
13942 int main() {
13943 #ifdef SCHED_YIELD
13944         sched_yield();
13945 #else
13946 #ifdef PTHREAD_YIELD
13947         pthread_yield();
13948 #else
13949 #ifdef PTHREAD_YIELD_NULL
13950         pthread_yield(NULL);
13951 #endif
13952 #endif
13953 #endif
13954 }
13955 EOP
13956 : see if sched_yield exists
13957 set try -DSCHED_YIELD
13958 if eval $compile; then
13959     val="$define"
13960     sched_yield='sched_yield()'
13961 else
13962     val="$undef"
13963 fi
13964 case "$usethreads" in
13965 $define)
13966         case "$val" in
13967         $define) echo 'sched_yield() found.' >&4        ;;
13968         *)       echo 'sched_yield() NOT found.' >&4    ;;
13969         esac
13970 esac
13971 set d_sched_yield
13972 eval $setvar
13973
13974 : see if pthread_yield exists
13975 set try -DPTHREAD_YIELD
13976 if eval $compile; then
13977     val="$define"
13978     case "$sched_yield" in
13979     '') sched_yield='pthread_yield()' ;;
13980     esac
13981 else
13982     set try -DPTHREAD_YIELD_NULL
13983     if eval $compile; then
13984         val="$define"
13985         case "$sched_yield" in
13986         '') sched_yield='pthread_yield(NULL)' ;;
13987         esac
13988     else
13989         val="$undef"
13990     fi
13991 fi
13992 case "$usethreads" in
13993 $define)
13994         case "$val" in
13995         $define) echo 'pthread_yield() found.' >&4      ;;
13996         *)       echo 'pthread_yield() NOT found.' >&4  ;;
13997         esac
13998         ;;
13999 esac
14000 set d_pthread_yield
14001 eval $setvar
14002
14003 case "$sched_yield" in
14004 '') sched_yield=undef ;;
14005 esac
14006
14007 $rm -f try try.*
14008
14009 : see if random_r exists
14010 set random_r d_random_r
14011 eval $inlibc
14012 case "$d_random_r" in
14013 "$define")
14014         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
14015         case "stdlib" in
14016         time)
14017                 hdrs="$hdrs $i_systime sys/time.h"
14018                 ;;
14019         esac
14020         case "$d_random_r_proto:$usethreads" in
14021         ":define")      d_random_r_proto=define
14022                 set d_random_r_proto random_r $hdrs
14023                 eval $hasproto ;;
14024         *)      ;;
14025         esac
14026         case "$d_random_r_proto" in
14027         define)
14028         case "$random_r_proto" in
14029         ''|0) try='int random_r(int*, struct random_data*);'
14030         ./protochk "extern $try" $hdrs && random_r_proto=I_TS ;;
14031         esac
14032         case "$random_r_proto" in
14033         ''|0)   d_random_r=undef
14034                 random_r_proto=0
14035                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
14036         * )     case "$random_r_proto" in
14037                 REENTRANT_PROTO*) ;;
14038                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
14039                 esac
14040                 echo "Prototype: $try" ;;
14041         esac
14042         ;;
14043         *)      case "$usethreads" in
14044                 define) echo "random_r has no prototype, not using it." >&4 ;;
14045                 esac
14046                 d_random_r=undef
14047                 random_r_proto=0
14048                 ;;
14049         esac
14050         ;;
14051 *)      random_r_proto=0
14052         ;;
14053 esac
14054
14055 : see if readdir and friends exist
14056 set readdir d_readdir
14057 eval $inlibc
14058 set seekdir d_seekdir
14059 eval $inlibc
14060 set telldir d_telldir
14061 eval $inlibc
14062 set rewinddir d_rewinddir
14063 eval $inlibc
14064
14065 : see if readdir64_r exists
14066 set readdir64_r d_readdir64_r
14067 eval $inlibc
14068 case "$d_readdir64_r" in
14069 "$define")
14070         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
14071         case "dirent" in
14072         time)
14073                 hdrs="$hdrs $i_systime sys/time.h"
14074                 ;;
14075         esac
14076         case "$d_readdir64_r_proto:$usethreads" in
14077         ":define")      d_readdir64_r_proto=define
14078                 set d_readdir64_r_proto readdir64_r $hdrs
14079                 eval $hasproto ;;
14080         *)      ;;
14081         esac
14082         case "$d_readdir64_r_proto" in
14083         define)
14084         case "$readdir64_r_proto" in
14085         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
14086         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
14087         esac
14088         case "$readdir64_r_proto" in
14089         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
14090         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
14091         esac
14092         case "$readdir64_r_proto" in
14093         ''|0)   d_readdir64_r=undef
14094                 readdir64_r_proto=0
14095                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
14096         * )     case "$readdir64_r_proto" in
14097                 REENTRANT_PROTO*) ;;
14098                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
14099                 esac
14100                 echo "Prototype: $try" ;;
14101         esac
14102         ;;
14103         *)      case "$usethreads" in
14104                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
14105                 esac
14106                 d_readdir64_r=undef
14107                 readdir64_r_proto=0
14108                 ;;
14109         esac
14110         ;;
14111 *)      readdir64_r_proto=0
14112         ;;
14113 esac
14114
14115 : see if readdir_r exists
14116 set readdir_r d_readdir_r
14117 eval $inlibc
14118 case "$d_readdir_r" in
14119 "$define")
14120         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
14121         case "dirent" in
14122         time)
14123                 hdrs="$hdrs $i_systime sys/time.h"
14124                 ;;
14125         esac
14126         case "$d_readdir_r_proto:$usethreads" in
14127         ":define")      d_readdir_r_proto=define
14128                 set d_readdir_r_proto readdir_r $hdrs
14129                 eval $hasproto ;;
14130         *)      ;;
14131         esac
14132         case "$d_readdir_r_proto" in
14133         define)
14134         case "$readdir_r_proto" in
14135         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
14136         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
14137         esac
14138         case "$readdir_r_proto" in
14139         ''|0) try='int readdir_r(DIR*, struct dirent*);'
14140         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
14141         esac
14142         case "$readdir_r_proto" in
14143         ''|0)   d_readdir_r=undef
14144                 readdir_r_proto=0
14145                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
14146         * )     case "$readdir_r_proto" in
14147                 REENTRANT_PROTO*) ;;
14148                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
14149                 esac
14150                 echo "Prototype: $try" ;;
14151         esac
14152         ;;
14153         *)      case "$usethreads" in
14154                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
14155                 esac
14156                 d_readdir_r=undef
14157                 readdir_r_proto=0
14158                 ;;
14159         esac
14160         ;;
14161 *)      readdir_r_proto=0
14162         ;;
14163 esac
14164
14165 : see if readv exists
14166 set readv d_readv
14167 eval $inlibc
14168
14169 : see if recvmsg exists
14170 set recvmsg d_recvmsg
14171 eval $inlibc
14172
14173 : see if rename exists
14174 set rename d_rename
14175 eval $inlibc
14176
14177 : see if rmdir exists
14178 set rmdir d_rmdir
14179 eval $inlibc
14180
14181 : see if memory.h is available.
14182 val=''
14183 set memory.h val
14184 eval $inhdr
14185
14186 : See if it conflicts with string.h
14187 case "$val" in
14188 $define)
14189         case "$strings" in
14190         '') ;;
14191         *)
14192                 $cppstdin $cppflags $cppminus < $strings > mem.h
14193                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
14194                         echo " "
14195                         echo "We won't be including <memory.h>."
14196                         val="$undef"
14197                 fi
14198                 $rm -f mem.h
14199                 ;;
14200         esac
14201 esac
14202 set i_memory
14203 eval $setvar
14204
14205 : can bcopy handle overlapping blocks?
14206 echo " "
14207 val="$undef"
14208 case "$d_memmove" in
14209 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
14210 *)      case "$d_bcopy" in
14211         "$define")
14212                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
14213                 $cat >try.c <<EOCP
14214 #$i_memory I_MEMORY
14215 #$i_stdlib I_STDLIB
14216 #$i_string I_STRING
14217 #$i_unistd I_UNISTD
14218 EOCP
14219         $cat >>try.c <<'EOCP'
14220 #include <stdio.h>
14221 #ifdef I_MEMORY
14222 #  include <memory.h>
14223 #endif
14224 #ifdef I_STDLIB
14225 #  include <stdlib.h>
14226 #endif
14227 #ifdef I_STRING
14228 #  include <string.h>
14229 #else
14230 #  include <strings.h>
14231 #endif
14232 #ifdef I_UNISTD
14233 #  include <unistd.h>  /* Needed for NetBSD */
14234 #endif
14235 int main()
14236 {
14237 char buf[128], abc[128];
14238 char *b;
14239 int len;
14240 int off;
14241 int align;
14242
14243 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14244    try to store the string in read-only memory. */
14245 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
14246
14247 for (align = 7; align >= 0; align--) {
14248         for (len = 36; len; len--) {
14249                 b = buf+align;
14250                 bcopy(abc, b, len);
14251                 for (off = 1; off <= len; off++) {
14252                         bcopy(b, b+off, len);
14253                         bcopy(b+off, b, len);
14254                         if (bcmp(b, abc, len))
14255                                 exit(1);
14256                 }
14257         }
14258 }
14259 exit(0);
14260 }
14261 EOCP
14262                 set try
14263                 if eval $compile_ok; then
14264                         if ./try 2>/dev/null; then
14265                                 echo "Yes, it can."
14266                                 val="$define"
14267                         else
14268                                 echo "It can't, sorry."
14269                         fi
14270                 else
14271                         echo "(I can't compile the test program, so we'll assume not...)"
14272                 fi
14273                 ;;
14274         esac
14275         $rm -f try.* try core
14276         ;;
14277 esac
14278 set d_safebcpy
14279 eval $setvar
14280
14281 : can memcpy handle overlapping blocks?
14282 echo " "
14283 val="$undef"
14284 case "$d_memmove" in
14285 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
14286 *)      case "$d_memcpy" in
14287         "$define")
14288                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
14289                 $cat >try.c <<EOCP
14290 #$i_memory I_MEMORY
14291 #$i_stdlib I_STDLIB
14292 #$i_string I_STRING
14293 #$i_unistd I_UNISTD
14294 EOCP
14295         $cat >>try.c <<'EOCP'
14296 #include <stdio.h>
14297 #ifdef I_MEMORY
14298 #  include <memory.h>
14299 #endif
14300 #ifdef I_STDLIB
14301 #  include <stdlib.h>
14302 #endif
14303 #ifdef I_STRING
14304 #  include <string.h>
14305 #else
14306 #  include <strings.h>
14307 #endif
14308 #ifdef I_UNISTD
14309 #  include <unistd.h>  /* Needed for NetBSD */
14310 #endif
14311 int main()
14312 {
14313 char buf[128], abc[128];
14314 char *b;
14315 int len;
14316 int off;
14317 int align;
14318
14319 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14320    try to store the string in read-only memory. */
14321 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
14322
14323 for (align = 7; align >= 0; align--) {
14324         for (len = 36; len; len--) {
14325                 b = buf+align;
14326                 memcpy(b, abc, len);
14327                 for (off = 1; off <= len; off++) {
14328                         memcpy(b+off, b, len);
14329                         memcpy(b, b+off, len);
14330                         if (memcmp(b, abc, len))
14331                                 exit(1);
14332                 }
14333         }
14334 }
14335 exit(0);
14336 }
14337 EOCP
14338                 set try
14339                 if eval $compile_ok; then
14340                         if ./try 2>/dev/null; then
14341                                 echo "Yes, it can."
14342                                 val="$define"
14343                         else
14344                                 echo "It can't, sorry."
14345                         fi
14346                 else
14347                         echo "(I can't compile the test program, so we'll assume not...)"
14348                 fi
14349                 ;;
14350         esac
14351         $rm -f try.* try core
14352         ;;
14353 esac
14354 set d_safemcpy
14355 eval $setvar
14356
14357 : can memcmp be trusted to compare relative magnitude?
14358 val="$undef"
14359 case "$d_memcmp" in
14360 "$define")
14361         echo " "
14362         echo "Checking if your memcmp() can compare relative magnitude..." >&4
14363         $cat >try.c <<EOCP
14364 #$i_memory I_MEMORY
14365 #$i_stdlib I_STDLIB
14366 #$i_string I_STRING
14367 #$i_unistd I_UNISTD
14368 EOCP
14369         $cat >>try.c <<'EOCP'
14370 #include <stdio.h>
14371 #ifdef I_MEMORY
14372 #  include <memory.h>
14373 #endif
14374 #ifdef I_STDLIB
14375 #  include <stdlib.h>
14376 #endif
14377 #ifdef I_STRING
14378 #  include <string.h>
14379 #else
14380 #  include <strings.h>
14381 #endif
14382 #ifdef I_UNISTD
14383 #  include <unistd.h>  /* Needed for NetBSD */
14384 #endif
14385 int main()
14386 {
14387 char a = -1;
14388 char b = 0;
14389 if ((a < b) && memcmp(&a, &b, 1) < 0)
14390         exit(1);
14391 exit(0);
14392 }
14393 EOCP
14394         set try
14395         if eval $compile_ok; then
14396                 if $run ./try 2>/dev/null; then
14397                         echo "Yes, it can."
14398                         val="$define"
14399                 else
14400                         echo "No, it can't (it uses signed chars)."
14401                 fi
14402         else
14403                 echo "(I can't compile the test program, so we'll assume not...)"
14404         fi
14405         ;;
14406 esac
14407 $rm -f try.* try core
14408 set d_sanemcmp
14409 eval $setvar
14410
14411 : see if prototype for sbrk is available
14412 echo " "
14413 set d_sbrkproto sbrk $i_unistd unistd.h
14414 eval $hasproto
14415
14416 : see if select exists
14417 set select d_select
14418 eval $inlibc
14419
14420 : see if semctl exists
14421 set semctl d_semctl
14422 eval $inlibc
14423
14424 : see if semget exists
14425 set semget d_semget
14426 eval $inlibc
14427
14428 : see if semop exists
14429 set semop d_semop
14430 eval $inlibc
14431
14432 : see how much of the 'sem*(2)' library is present.
14433 h_sem=true
14434 echo " "
14435 case "$d_semctl$d_semget$d_semop" in
14436 *"$undef"*) h_sem=false;;
14437 esac
14438 case "$osname" in
14439 freebsd)
14440     case "`ipcs 2>&1`" in
14441     "SVID messages"*"not configured"*)
14442         echo "Your $osname does not have the sem*(2) configured." >&4
14443         h_sem=false
14444         val="$undef"
14445         set semctl d_semctl
14446         eval $setvar
14447         set semget d_semget
14448         eval $setvar
14449         set semop d_semop
14450         eval $setvar
14451         ;;
14452     esac
14453     ;;
14454 esac
14455 : we could also check for sys/ipc.h ...
14456 if $h_sem && $test `./findhdr sys/sem.h`; then
14457         echo "You have the full sem*(2) library." >&4
14458         val="$define"
14459 else
14460         echo "You don't have the full sem*(2) library." >&4
14461         val="$undef"
14462 fi
14463 set d_sem
14464 eval $setvar
14465
14466 : see whether sys/sem.h defines union semun
14467 echo " "
14468 $cat > try.c <<'END'
14469 #include <sys/types.h>
14470 #include <sys/ipc.h>
14471 #include <sys/sem.h>
14472 int main () { union semun semun; semun.buf = 0; }
14473 END
14474 set try
14475 if eval $compile; then
14476     echo "You have union semun in <sys/sem.h>." >&4
14477     val="$define"
14478 else
14479     echo "You do not have union semun in <sys/sem.h>." >&4
14480     val="$undef"
14481 fi
14482 $rm -f try try.c try.h
14483 set d_union_semun
14484 eval $setvar
14485
14486 : see how to do semctl IPC_STAT
14487 case "$d_sem" in
14488 $define)
14489     : see whether semctl IPC_STAT can use union semun
14490     echo " "
14491     $cat > try.h <<END
14492 #ifndef S_IRUSR
14493 #   ifdef S_IREAD
14494 #       define S_IRUSR S_IREAD
14495 #       define S_IWUSR S_IWRITE
14496 #       define S_IXUSR S_IEXEC
14497 #   else
14498 #       define S_IRUSR 0400
14499 #       define S_IWUSR 0200
14500 #       define S_IXUSR 0100
14501 #   endif
14502 #   define S_IRGRP (S_IRUSR>>3)
14503 #   define S_IWGRP (S_IWUSR>>3)
14504 #   define S_IXGRP (S_IXUSR>>3)
14505 #   define S_IROTH (S_IRUSR>>6)
14506 #   define S_IWOTH (S_IWUSR>>6)
14507 #   define S_IXOTH (S_IXUSR>>6)
14508 #endif
14509 #ifndef S_IRWXU
14510 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
14511 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
14512 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
14513 #endif
14514 END
14515
14516     $cat > try.c <<END
14517 #include <sys/types.h>
14518 #include <sys/ipc.h>
14519 #include <sys/sem.h>
14520 #include <sys/stat.h>
14521 #include <stdio.h>
14522 #include <errno.h>
14523 #include "try.h"
14524 #ifndef errno
14525 extern int errno;
14526 #endif
14527 #$d_union_semun HAS_UNION_SEMUN
14528 int main() {
14529     union semun
14530 #ifndef HAS_UNION_SEMUN
14531     {
14532         int val;
14533         struct semid_ds *buf;
14534         unsigned short *array;
14535     }
14536 #endif
14537     arg;
14538     int sem, st;
14539
14540 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
14541     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14542     if (sem > -1) {
14543         struct semid_ds argbuf;
14544         arg.buf = &argbuf;
14545 #       ifdef IPC_STAT
14546         st = semctl(sem, 0, IPC_STAT, arg);
14547         if (st == 0)
14548             printf("semun\n");
14549         else
14550 #       endif /* IPC_STAT */
14551             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14552 #       ifdef IPC_RMID
14553         if (semctl(sem, 0, IPC_RMID, arg) != 0)
14554 #       endif /* IPC_RMID */
14555             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14556     } else
14557 #endif /* IPC_PRIVATE && ... */
14558         printf("semget failed: errno = %d\n", errno);
14559   return 0;
14560 }
14561 END
14562     val="$undef"
14563     set try
14564     if eval $compile; then
14565         xxx=`$run ./try`
14566         case "$xxx" in
14567         semun) val="$define" ;;
14568         esac
14569     fi
14570     $rm -f try try.c
14571     set d_semctl_semun
14572     eval $setvar
14573     case "$d_semctl_semun" in
14574     $define)
14575         echo "You can use union semun for semctl IPC_STAT." >&4
14576         also='also'
14577         ;;
14578     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
14579         also=''
14580         ;;
14581     esac
14582
14583     : see whether semctl IPC_STAT can use struct semid_ds pointer
14584     $cat > try.c <<'END'
14585 #include <sys/types.h>
14586 #include <sys/ipc.h>
14587 #include <sys/sem.h>
14588 #include <sys/stat.h>
14589 #include "try.h"
14590 #include <stdio.h>
14591 #include <errno.h>
14592 #ifndef errno
14593 extern int errno;
14594 #endif
14595 int main() {
14596     struct semid_ds arg;
14597     int sem, st;
14598
14599 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
14600     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14601     if (sem > -1) {
14602 #       ifdef IPC_STAT
14603         st = semctl(sem, 0, IPC_STAT, &arg);
14604         if (st == 0)
14605             printf("semid_ds\n");
14606         else
14607 #       endif /* IPC_STAT */
14608             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14609 #       ifdef IPC_RMID
14610         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
14611 #       endif /* IPC_RMID */
14612             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14613     } else
14614 #endif /* IPC_PRIVATE && ... */
14615         printf("semget failed: errno = %d\n", errno);
14616
14617     return 0;
14618 }
14619 END
14620     val="$undef"
14621     set try
14622     if eval $compile; then
14623         xxx=`$run ./try`
14624         case "$xxx" in
14625         semid_ds) val="$define" ;;
14626         esac
14627     fi
14628     $rm -f try try.c
14629     set d_semctl_semid_ds
14630     eval $setvar
14631     case "$d_semctl_semid_ds" in
14632     $define)
14633         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
14634         ;;
14635     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
14636         ;;
14637     esac
14638     $rm -f try.h
14639     ;;
14640 *)  val="$undef"
14641
14642     # We do not have the full sem*(2) library, so assume we can not
14643     # use either.
14644
14645     set d_semctl_semun
14646     eval $setvar
14647
14648     set d_semctl_semid_ds
14649     eval $setvar
14650     ;;
14651 esac
14652
14653 : see if sendmsg exists
14654 set sendmsg d_sendmsg
14655 eval $inlibc
14656
14657 : see if setegid exists
14658 set setegid d_setegid
14659 eval $inlibc
14660
14661 : see if seteuid exists
14662 set seteuid d_seteuid
14663 eval $inlibc
14664
14665 : see if setgrent exists
14666 set setgrent d_setgrent
14667 eval $inlibc
14668
14669 : see if setgrent_r exists
14670 set setgrent_r d_setgrent_r
14671 eval $inlibc
14672 case "$d_setgrent_r" in
14673 "$define")
14674         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14675         case "grp" in
14676         time)
14677                 hdrs="$hdrs $i_systime sys/time.h"
14678                 ;;
14679         esac
14680         case "$d_setgrent_r_proto:$usethreads" in
14681         ":define")      d_setgrent_r_proto=define
14682                 set d_setgrent_r_proto setgrent_r $hdrs
14683                 eval $hasproto ;;
14684         *)      ;;
14685         esac
14686         case "$d_setgrent_r_proto" in
14687         define)
14688         case "$setgrent_r_proto" in
14689         ''|0) try='int setgrent_r(FILE**);'
14690         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
14691         esac
14692         case "$setgrent_r_proto" in
14693         ''|0) try='void setgrent_r(FILE**);'
14694         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
14695         esac
14696         case "$setgrent_r_proto" in
14697         ''|0)   d_setgrent_r=undef
14698                 setgrent_r_proto=0
14699                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
14700         * )     case "$setgrent_r_proto" in
14701                 REENTRANT_PROTO*) ;;
14702                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
14703                 esac
14704                 echo "Prototype: $try" ;;
14705         esac
14706         ;;
14707         *)      case "$usethreads" in
14708                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
14709                 esac
14710                 d_setgrent_r=undef
14711                 setgrent_r_proto=0
14712                 ;;
14713         esac
14714         ;;
14715 *)      setgrent_r_proto=0
14716         ;;
14717 esac
14718
14719 : see if sethostent exists
14720 set sethostent d_sethent
14721 eval $inlibc
14722
14723 : see if sethostent_r exists
14724 set sethostent_r d_sethostent_r
14725 eval $inlibc
14726 case "$d_sethostent_r" in
14727 "$define")
14728         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14729         case "netdb" in
14730         time)
14731                 hdrs="$hdrs $i_systime sys/time.h"
14732                 ;;
14733         esac
14734         case "$d_sethostent_r_proto:$usethreads" in
14735         ":define")      d_sethostent_r_proto=define
14736                 set d_sethostent_r_proto sethostent_r $hdrs
14737                 eval $hasproto ;;
14738         *)      ;;
14739         esac
14740         case "$d_sethostent_r_proto" in
14741         define)
14742         case "$sethostent_r_proto" in
14743         ''|0) try='int sethostent_r(int, struct hostent_data*);'
14744         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
14745         esac
14746         case "$sethostent_r_proto" in
14747         ''|0) try='void sethostent_r(int, struct hostent_data*);'
14748         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
14749         esac
14750         case "$sethostent_r_proto" in
14751         ''|0)   d_sethostent_r=undef
14752                 sethostent_r_proto=0
14753                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
14754         * )     case "$sethostent_r_proto" in
14755                 REENTRANT_PROTO*) ;;
14756                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
14757                 esac
14758                 echo "Prototype: $try" ;;
14759         esac
14760         ;;
14761         *)      case "$usethreads" in
14762                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
14763                 esac
14764                 d_sethostent_r=undef
14765                 sethostent_r_proto=0
14766                 ;;
14767         esac
14768         ;;
14769 *)      sethostent_r_proto=0
14770         ;;
14771 esac
14772
14773 : see if setitimer exists
14774 set setitimer d_setitimer
14775 eval $inlibc
14776
14777 : see if setlinebuf exists
14778 set setlinebuf d_setlinebuf
14779 eval $inlibc
14780
14781 : see if setlocale exists
14782 set setlocale d_setlocale
14783 eval $inlibc
14784
14785 : see if locale.h is available
14786 set locale.h i_locale
14787 eval $inhdr
14788
14789 : see if setlocale_r exists
14790 set setlocale_r d_setlocale_r
14791 eval $inlibc
14792 case "$d_setlocale_r" in
14793 "$define")
14794         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
14795         case "locale" in
14796         time)
14797                 hdrs="$hdrs $i_systime sys/time.h"
14798                 ;;
14799         esac
14800         case "$d_setlocale_r_proto:$usethreads" in
14801         ":define")      d_setlocale_r_proto=define
14802                 set d_setlocale_r_proto setlocale_r $hdrs
14803                 eval $hasproto ;;
14804         *)      ;;
14805         esac
14806         case "$d_setlocale_r_proto" in
14807         define)
14808         case "$setlocale_r_proto" in
14809         ''|0) try='int setlocale_r(int, const char*, char*, int);'
14810         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
14811         esac
14812         case "$setlocale_r_proto" in
14813         ''|0)   d_setlocale_r=undef
14814                 setlocale_r_proto=0
14815                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
14816         * )     case "$setlocale_r_proto" in
14817                 REENTRANT_PROTO*) ;;
14818                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
14819                 esac
14820                 echo "Prototype: $try" ;;
14821         esac
14822         ;;
14823         *)      case "$usethreads" in
14824                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
14825                 esac
14826                 d_setlocale_r=undef
14827                 setlocale_r_proto=0
14828                 ;;
14829         esac
14830         ;;
14831 *)      setlocale_r_proto=0
14832         ;;
14833 esac
14834
14835 : see if setnetent exists
14836 set setnetent d_setnent
14837 eval $inlibc
14838
14839 : see if setnetent_r exists
14840 set setnetent_r d_setnetent_r
14841 eval $inlibc
14842 case "$d_setnetent_r" in
14843 "$define")
14844         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14845         case "netdb" in
14846         time)
14847                 hdrs="$hdrs $i_systime sys/time.h"
14848                 ;;
14849         esac
14850         case "$d_setnetent_r_proto:$usethreads" in
14851         ":define")      d_setnetent_r_proto=define
14852                 set d_setnetent_r_proto setnetent_r $hdrs
14853                 eval $hasproto ;;
14854         *)      ;;
14855         esac
14856         case "$d_setnetent_r_proto" in
14857         define)
14858         case "$setnetent_r_proto" in
14859         ''|0) try='int setnetent_r(int, struct netent_data*);'
14860         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
14861         esac
14862         case "$setnetent_r_proto" in
14863         ''|0) try='void setnetent_r(int, struct netent_data*);'
14864         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
14865         esac
14866         case "$setnetent_r_proto" in
14867         ''|0)   d_setnetent_r=undef
14868                 setnetent_r_proto=0
14869                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
14870         * )     case "$setnetent_r_proto" in
14871                 REENTRANT_PROTO*) ;;
14872                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
14873                 esac
14874                 echo "Prototype: $try" ;;
14875         esac
14876         ;;
14877         *)      case "$usethreads" in
14878                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
14879                 esac
14880                 d_setnetent_r=undef
14881                 setnetent_r_proto=0
14882                 ;;
14883         esac
14884         ;;
14885 *)      setnetent_r_proto=0
14886         ;;
14887 esac
14888
14889 : see if setprotoent exists
14890 set setprotoent d_setpent
14891 eval $inlibc
14892
14893 : see if setpgid exists
14894 set setpgid d_setpgid
14895 eval $inlibc
14896
14897 : see if setpgrp2 exists
14898 set setpgrp2 d_setpgrp2
14899 eval $inlibc
14900
14901 : see if setpriority exists
14902 set setpriority d_setprior
14903 eval $inlibc
14904
14905 : see if setproctitle exists
14906 set setproctitle d_setproctitle
14907 eval $inlibc
14908
14909 : see if setprotoent_r exists
14910 set setprotoent_r d_setprotoent_r
14911 eval $inlibc
14912 case "$d_setprotoent_r" in
14913 "$define")
14914         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14915         case "netdb" in
14916         time)
14917                 hdrs="$hdrs $i_systime sys/time.h"
14918                 ;;
14919         esac
14920         case "$d_setprotoent_r_proto:$usethreads" in
14921         ":define")      d_setprotoent_r_proto=define
14922                 set d_setprotoent_r_proto setprotoent_r $hdrs
14923                 eval $hasproto ;;
14924         *)      ;;
14925         esac
14926         case "$d_setprotoent_r_proto" in
14927         define)
14928         case "$setprotoent_r_proto" in
14929         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
14930         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
14931         esac
14932         case "$setprotoent_r_proto" in
14933         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
14934         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
14935         esac
14936         case "$setprotoent_r_proto" in
14937         ''|0)   d_setprotoent_r=undef
14938                 setprotoent_r_proto=0
14939                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
14940         * )     case "$setprotoent_r_proto" in
14941                 REENTRANT_PROTO*) ;;
14942                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
14943                 esac
14944                 echo "Prototype: $try" ;;
14945         esac
14946         ;;
14947         *)      case "$usethreads" in
14948                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
14949                 esac
14950                 d_setprotoent_r=undef
14951                 setprotoent_r_proto=0
14952                 ;;
14953         esac
14954         ;;
14955 *)      setprotoent_r_proto=0
14956         ;;
14957 esac
14958
14959 : see if setpwent exists
14960 set setpwent d_setpwent
14961 eval $inlibc
14962
14963 : see if setpwent_r exists
14964 set setpwent_r d_setpwent_r
14965 eval $inlibc
14966 case "$d_setpwent_r" in
14967 "$define")
14968         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14969         case "pwd" in
14970         time)
14971                 hdrs="$hdrs $i_systime sys/time.h"
14972                 ;;
14973         esac
14974         case "$d_setpwent_r_proto:$usethreads" in
14975         ":define")      d_setpwent_r_proto=define
14976                 set d_setpwent_r_proto setpwent_r $hdrs
14977                 eval $hasproto ;;
14978         *)      ;;
14979         esac
14980         case "$d_setpwent_r_proto" in
14981         define)
14982         case "$setpwent_r_proto" in
14983         ''|0) try='int setpwent_r(FILE**);'
14984         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
14985         esac
14986         case "$setpwent_r_proto" in
14987         ''|0) try='void setpwent_r(FILE**);'
14988         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
14989         esac
14990         case "$setpwent_r_proto" in
14991         ''|0)   d_setpwent_r=undef
14992                 setpwent_r_proto=0
14993                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
14994         * )     case "$setpwent_r_proto" in
14995                 REENTRANT_PROTO*) ;;
14996                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
14997                 esac
14998                 echo "Prototype: $try" ;;
14999         esac
15000         ;;
15001         *)      case "$usethreads" in
15002                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
15003                 esac
15004                 d_setpwent_r=undef
15005                 setpwent_r_proto=0
15006                 ;;
15007         esac
15008         ;;
15009 *)      setpwent_r_proto=0
15010         ;;
15011 esac
15012
15013 : see if setregid exists
15014 set setregid d_setregid
15015 eval $inlibc
15016 set setresgid d_setresgid
15017 eval $inlibc
15018
15019 : see if setreuid exists
15020 set setreuid d_setreuid
15021 eval $inlibc
15022 set setresuid d_setresuid
15023 eval $inlibc
15024
15025 : see if setrgid exists
15026 set setrgid d_setrgid
15027 eval $inlibc
15028
15029 : see if setruid exists
15030 set setruid d_setruid
15031 eval $inlibc
15032
15033 : see if setservent exists
15034 set setservent d_setsent
15035 eval $inlibc
15036
15037 : see if setservent_r exists
15038 set setservent_r d_setservent_r
15039 eval $inlibc
15040 case "$d_setservent_r" in
15041 "$define")
15042         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15043         case "netdb" in
15044         time)
15045                 hdrs="$hdrs $i_systime sys/time.h"
15046                 ;;
15047         esac
15048         case "$d_setservent_r_proto:$usethreads" in
15049         ":define")      d_setservent_r_proto=define
15050                 set d_setservent_r_proto setservent_r $hdrs
15051                 eval $hasproto ;;
15052         *)      ;;
15053         esac
15054         case "$d_setservent_r_proto" in
15055         define)
15056         case "$setservent_r_proto" in
15057         ''|0) try='int setservent_r(int, struct servent_data*);'
15058         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
15059         esac
15060         case "$setservent_r_proto" in
15061         ''|0) try='void setservent_r(int, struct servent_data*);'
15062         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
15063         esac
15064         case "$setservent_r_proto" in
15065         ''|0)   d_setservent_r=undef
15066                 setservent_r_proto=0
15067                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
15068         * )     case "$setservent_r_proto" in
15069                 REENTRANT_PROTO*) ;;
15070                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
15071                 esac
15072                 echo "Prototype: $try" ;;
15073         esac
15074         ;;
15075         *)      case "$usethreads" in
15076                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
15077                 esac
15078                 d_setservent_r=undef
15079                 setservent_r_proto=0
15080                 ;;
15081         esac
15082         ;;
15083 *)      setservent_r_proto=0
15084         ;;
15085 esac
15086
15087 : see if setsid exists
15088 set setsid d_setsid
15089 eval $inlibc
15090
15091 : see if setvbuf exists
15092 set setvbuf d_setvbuf
15093 eval $inlibc
15094
15095 : see if sfio.h is available
15096 set sfio.h i_sfio
15097 eval $inhdr
15098
15099
15100 : see if sfio library is available
15101 case "$i_sfio" in
15102 $define)
15103         val=''
15104         set sfreserve val
15105         eval $inlibc
15106         ;;
15107 *)
15108         val="$undef"
15109         ;;
15110 esac
15111 : Ok, but do we want to use it.
15112 case "$val" in
15113 $define)
15114         case "$usesfio" in
15115         true|$define|[yY]*) dflt='y';;
15116         *) dflt='n';;
15117         esac
15118         echo "$package can use the sfio library, but it is experimental."
15119         case "$useperlio" in
15120         "$undef")
15121             echo "For sfio also the PerlIO abstraction layer is needed."
15122             echo "Earlier you said you wouldn't want that."
15123             ;;
15124         esac
15125         rp="You seem to have sfio available, do you want to try using it?"
15126         . ./myread
15127         case "$ans" in
15128         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
15129                 useperlio="$define"
15130                 val="$define"
15131                 ;;
15132         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
15133                 val="$undef"
15134                 ;;
15135         esac
15136         ;;
15137 *)      case "$usesfio" in
15138         true|$define|[yY]*)
15139                 echo "Sorry, cannot find sfio on this machine." >&4
15140                 echo "Ignoring your setting of usesfio=$usesfio." >&4
15141                 val="$undef"
15142                 ;;
15143         esac
15144         ;;
15145 esac
15146 set d_sfio
15147 eval $setvar
15148 case "$d_sfio" in
15149 $define) usesfio='true';;
15150 *) usesfio='false';;
15151 esac
15152 case "$d_sfio" in
15153 $define) ;;
15154 *)      : Remove sfio from list of libraries to use
15155         case "$libs" in
15156         *-lsfio*)
15157                 echo "Removing unneeded -lsfio from library list" >&4
15158                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
15159                 shift
15160                 libs="$*"
15161                 echo "libs = $libs" >&4
15162                 ;;
15163         esac
15164 ;;
15165 esac
15166
15167
15168 : see if shmctl exists
15169 set shmctl d_shmctl
15170 eval $inlibc
15171
15172 : see if shmget exists
15173 set shmget d_shmget
15174 eval $inlibc
15175
15176 : see if shmat exists
15177 set shmat d_shmat
15178 eval $inlibc
15179 : see what shmat returns
15180 case "$d_shmat" in
15181 "$define")
15182         $cat >shmat.c <<'END'
15183 #include <sys/shm.h>
15184 void *shmat();
15185 END
15186         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
15187                 shmattype='void *'
15188         else
15189                 shmattype='char *'
15190         fi
15191         echo "and it returns ($shmattype)." >&4
15192         : see if a prototype for shmat is available
15193         xxx=`./findhdr sys/shm.h`
15194         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
15195         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
15196                 val="$define"
15197         else
15198                 val="$undef"
15199         fi
15200         $rm -f shmat.[co]
15201         ;;
15202 *)
15203         val="$undef"
15204         ;;
15205 esac
15206 set d_shmatprototype
15207 eval $setvar
15208
15209 : see if shmdt exists
15210 set shmdt d_shmdt
15211 eval $inlibc
15212
15213 : see how much of the 'shm*(2)' library is present.
15214 h_shm=true
15215 echo " "
15216 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
15217 *"$undef"*) h_shm=false;;
15218 esac
15219 case "$osname" in
15220 freebsd)
15221     case "`ipcs 2>&1`" in
15222     "SVID shared memory"*"not configured"*)
15223         echo "Your $osname does not have the shm*(2) configured." >&4
15224         h_shm=false
15225         val="$undef"
15226         set shmctl d_shmctl
15227         evat $setvar
15228         set shmget d_shmget
15229         evat $setvar
15230         set shmat d_shmat
15231         evat $setvar
15232         set shmdt d_shmdt
15233         evat $setvar
15234         ;;
15235     esac
15236     ;;
15237 esac
15238 : we could also check for sys/ipc.h ...
15239 if $h_shm && $test `./findhdr sys/shm.h`; then
15240         echo "You have the full shm*(2) library." >&4
15241         val="$define"
15242 else
15243         echo "You don't have the full shm*(2) library." >&4
15244         val="$undef"
15245 fi
15246 set d_shm
15247 eval $setvar
15248
15249 echo " "
15250 : see if we have sigaction
15251 if set sigaction val -f d_sigaction; eval $csym; $val; then
15252         echo 'sigaction() found.' >&4
15253         $cat > try.c <<'EOP'
15254 #include <stdio.h>
15255 #include <sys/types.h>
15256 #include <signal.h>
15257 int main()
15258 {
15259     struct sigaction act, oact;
15260     act.sa_flags = 0;
15261     oact.sa_handler = 0;
15262     /* so that act and oact are used */
15263     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
15264 }
15265 EOP
15266         set try
15267         if eval $compile_ok; then
15268                 val="$define"
15269         else
15270                 echo "But you don't seem to have a useable struct sigaction." >&4
15271                 val="$undef"
15272         fi
15273 else
15274         echo 'sigaction NOT found.' >&4
15275         val="$undef"
15276 fi
15277 set d_sigaction; eval $setvar
15278 $rm -f try try$_o try.c
15279
15280 : see if sigprocmask exists
15281 set sigprocmask d_sigprocmask
15282 eval $inlibc
15283
15284 : see if sigsetjmp exists
15285 echo " "
15286 case "$d_sigsetjmp" in
15287 '')
15288         $cat >try.c <<'EOP'
15289 #include <setjmp.h>
15290 sigjmp_buf env;
15291 int set = 1;
15292 int main()
15293 {
15294         if (sigsetjmp(env,1))
15295                 exit(set);
15296         set = 0;
15297         siglongjmp(env, 1);
15298         exit(1);
15299 }
15300 EOP
15301         set try
15302         if eval $compile; then
15303                 if $run ./try >/dev/null 2>&1; then
15304                         echo "POSIX sigsetjmp found." >&4
15305                         val="$define"
15306                 else
15307                         $cat >&4 <<EOM
15308 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
15309 I'll ignore them.
15310 EOM
15311                         val="$undef"
15312                 fi
15313         else
15314                 echo "sigsetjmp not found." >&4
15315                 val="$undef"
15316         fi
15317         ;;
15318 *) val="$d_sigsetjmp"
15319         case "$d_sigsetjmp" in
15320         $define) echo "POSIX sigsetjmp found." >&4;;
15321         $undef) echo "sigsetjmp not found." >&4;;
15322         esac
15323         ;;
15324 esac
15325 set d_sigsetjmp
15326 eval $setvar
15327 $rm -f try.c try
15328
15329 : see if sockatmark exists
15330 set sockatmark d_sockatmark
15331 eval $inlibc
15332
15333 : see if prototype for sockatmark is available
15334 echo " "
15335 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
15336 eval $hasproto
15337
15338 : see if socks5_init exists
15339 set socks5_init d_socks5_init
15340 eval $inlibc
15341
15342 : see if srand48_r exists
15343 set srand48_r d_srand48_r
15344 eval $inlibc
15345 case "$d_srand48_r" in
15346 "$define")
15347         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15348         case "stdlib" in
15349         time)
15350                 hdrs="$hdrs $i_systime sys/time.h"
15351                 ;;
15352         esac
15353         case "$d_srand48_r_proto:$usethreads" in
15354         ":define")      d_srand48_r_proto=define
15355                 set d_srand48_r_proto srand48_r $hdrs
15356                 eval $hasproto ;;
15357         *)      ;;
15358         esac
15359         case "$d_srand48_r_proto" in
15360         define)
15361         case "$srand48_r_proto" in
15362         ''|0) try='int srand48_r(long, struct drand48_data*);'
15363         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
15364         esac
15365         case "$srand48_r_proto" in
15366         ''|0)   d_srand48_r=undef
15367                 srand48_r_proto=0
15368                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
15369         * )     case "$srand48_r_proto" in
15370                 REENTRANT_PROTO*) ;;
15371                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
15372                 esac
15373                 echo "Prototype: $try" ;;
15374         esac
15375         ;;
15376         *)      case "$usethreads" in
15377                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
15378                 esac
15379                 d_srand48_r=undef
15380                 srand48_r_proto=0
15381                 ;;
15382         esac
15383         ;;
15384 *)      srand48_r_proto=0
15385         ;;
15386 esac
15387
15388 : see if srandom_r exists
15389 set srandom_r d_srandom_r
15390 eval $inlibc
15391 case "$d_srandom_r" in
15392 "$define")
15393         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15394         case "stdlib" in
15395         time)
15396                 hdrs="$hdrs $i_systime sys/time.h"
15397                 ;;
15398         esac
15399         case "$d_srandom_r_proto:$usethreads" in
15400         ":define")      d_srandom_r_proto=define
15401                 set d_srandom_r_proto srandom_r $hdrs
15402                 eval $hasproto ;;
15403         *)      ;;
15404         esac
15405         case "$d_srandom_r_proto" in
15406         define)
15407         case "$srandom_r_proto" in
15408         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
15409         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
15410         esac
15411         case "$srandom_r_proto" in
15412         ''|0)   d_srandom_r=undef
15413                 srandom_r_proto=0
15414                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
15415         * )     case "$srandom_r_proto" in
15416                 REENTRANT_PROTO*) ;;
15417                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
15418                 esac
15419                 echo "Prototype: $try" ;;
15420         esac
15421         ;;
15422         *)      case "$usethreads" in
15423                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
15424                 esac
15425                 d_srandom_r=undef
15426                 srandom_r_proto=0
15427                 ;;
15428         esac
15429         ;;
15430 *)      srandom_r_proto=0
15431         ;;
15432 esac
15433
15434 : see if prototype for setresgid is available
15435 echo " "
15436 set d_sresgproto setresgid $i_unistd unistd.h
15437 eval $hasproto
15438
15439 : see if prototype for setresuid is available
15440 echo " "
15441 set d_sresuproto setresuid $i_unistd unistd.h
15442 eval $hasproto
15443
15444 : see if sys/stat.h is available
15445 set sys/stat.h i_sysstat
15446 eval $inhdr
15447
15448
15449 : see if stat knows about block sizes
15450 echo " "
15451 echo "Checking to see if your struct stat has st_blocks field..." >&4
15452 set d_statblks stat st_blocks $i_sysstat sys/stat.h
15453 eval $hasfield
15454
15455
15456 : see if this is a sys/vfs.h system
15457 set sys/vfs.h i_sysvfs
15458 eval $inhdr
15459
15460
15461 : see if this is a sys/statfs.h system
15462 set sys/statfs.h i_sysstatfs
15463 eval $inhdr
15464
15465
15466 echo " "
15467 echo "Checking to see if your system supports struct statfs..." >&4
15468 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
15469 eval $hasstruct
15470 case "$d_statfs_s" in
15471 "$define")      echo "Yes, it does."   ;;
15472 *)              echo "No, it doesn't." ;;
15473 esac
15474
15475
15476
15477 : see if struct statfs knows about f_flags
15478 case "$d_statfs_s" in
15479 define) 
15480         echo " "
15481         echo "Checking to see if your struct statfs has f_flags field..." >&4
15482         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
15483         eval $hasfield
15484         ;;
15485 *)      val="$undef"
15486         set d_statfs_f_flags
15487         eval $setvar
15488         ;;
15489 esac
15490 case "$d_statfs_f_flags" in
15491 "$define")      echo "Yes, it does."   ;;
15492 *)              echo "No, it doesn't." ;;
15493 esac
15494
15495 : see if _ptr and _cnt from stdio act std
15496 echo " "
15497
15498 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
15499         echo "(Looks like you have stdio.h from BSD.)"
15500         case "$stdio_ptr" in
15501         '') stdio_ptr='((fp)->_p)'
15502                 ptr_lval=$define
15503                 ;;
15504         *)      ptr_lval=$d_stdio_ptr_lval;;
15505         esac
15506         case "$stdio_cnt" in
15507         '') stdio_cnt='((fp)->_r)'
15508                 cnt_lval=$define
15509                 ;;
15510         *)      cnt_lval=$d_stdio_cnt_lval;;
15511         esac
15512         case "$stdio_base" in
15513         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
15514         esac
15515         case "$stdio_bufsiz" in
15516         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
15517         esac
15518 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
15519         echo "(Looks like you have stdio.h from Linux.)"
15520         case "$stdio_ptr" in
15521         '') stdio_ptr='((fp)->_IO_read_ptr)'
15522                 ptr_lval=$define
15523                 ;;
15524         *)      ptr_lval=$d_stdio_ptr_lval;;
15525         esac
15526         case "$stdio_cnt" in
15527         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
15528                 cnt_lval=$undef
15529                 ;;
15530         *)      cnt_lval=$d_stdio_cnt_lval;;
15531         esac
15532         case "$stdio_base" in
15533         '') stdio_base='((fp)->_IO_read_base)';;
15534         esac
15535         case "$stdio_bufsiz" in
15536         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
15537         esac
15538 else
15539         case "$stdio_ptr" in
15540         '') stdio_ptr='((fp)->_ptr)'
15541                 ptr_lval=$define
15542                 ;;
15543         *)      ptr_lval=$d_stdio_ptr_lval;;
15544         esac
15545         case "$stdio_cnt" in
15546         '') stdio_cnt='((fp)->_cnt)'
15547                 cnt_lval=$define
15548                 ;;
15549         *)      cnt_lval=$d_stdio_cnt_lval;;
15550         esac
15551         case "$stdio_base" in
15552         '') stdio_base='((fp)->_base)';;
15553         esac
15554         case "$stdio_bufsiz" in
15555         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
15556         esac
15557 fi
15558
15559 : test whether _ptr and _cnt really work
15560 echo "Checking how std your stdio is..." >&4
15561 $cat >try.c <<EOP
15562 #include <stdio.h>
15563 #define FILE_ptr(fp)    $stdio_ptr
15564 #define FILE_cnt(fp)    $stdio_cnt
15565 int main() {
15566         FILE *fp = fopen("try.c", "r");
15567         char c = getc(fp);
15568         if (
15569                 18 <= FILE_cnt(fp) &&
15570                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15571         )
15572                 exit(0);
15573         exit(1);
15574 }
15575 EOP
15576 val="$undef"
15577 set try
15578 if eval $compile && $to try.c; then
15579         if $run ./try; then
15580                 echo "Your stdio acts pretty std."
15581                 val="$define"
15582         else
15583                 echo "Your stdio isn't very std."
15584         fi
15585 else
15586         echo "Your stdio doesn't appear very std."
15587 fi
15588 $rm -f try.c try
15589 set d_stdstdio
15590 eval $setvar
15591
15592 : Can _ptr be used as an lvalue?
15593 case "$d_stdstdio$ptr_lval" in
15594 $define$define) val=$define ;;
15595 *) val=$undef ;;
15596 esac
15597 set d_stdio_ptr_lval
15598 eval $setvar
15599
15600 : Can _cnt be used as an lvalue?
15601 case "$d_stdstdio$cnt_lval" in
15602 $define$define) val=$define ;;
15603 *) val=$undef ;;
15604 esac
15605 set d_stdio_cnt_lval
15606 eval $setvar
15607
15608
15609 : test whether setting _ptr sets _cnt as a side effect
15610 d_stdio_ptr_lval_sets_cnt="$undef"
15611 d_stdio_ptr_lval_nochange_cnt="$undef"
15612 case "$d_stdio_ptr_lval$d_stdstdio" in
15613 $define$define)
15614         echo "Checking to see what happens if we set the stdio ptr..." >&4
15615 $cat >try.c <<EOP
15616 #include <stdio.h>
15617 /* Can we scream? */
15618 /* Eat dust sed :-) */
15619 /* In the buffer space, no one can hear you scream. */
15620 #define FILE_ptr(fp)    $stdio_ptr
15621 #define FILE_cnt(fp)    $stdio_cnt
15622 #include <sys/types.h>
15623 int main() {
15624         FILE *fp = fopen("try.c", "r");
15625         int c;
15626         char *ptr;
15627         size_t cnt;
15628         if (!fp) {
15629             puts("Fail even to read");
15630             exit(1);
15631         }
15632         c = getc(fp); /* Read away the first # */
15633         if (c == EOF) {
15634             puts("Fail even to read");
15635             exit(1);
15636         }
15637         if (!(
15638                 18 <= FILE_cnt(fp) &&
15639                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15640         )) {
15641                 puts("Fail even to read");
15642                 exit (1);
15643         }
15644         ptr = (char*) FILE_ptr(fp);
15645         cnt = (size_t)FILE_cnt(fp);
15646
15647         FILE_ptr(fp) += 42;
15648
15649         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
15650                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
15651                 exit (1);
15652         }
15653         if (FILE_cnt(fp) <= 20) {
15654                 printf ("Fail (<20 chars to test)");
15655                 exit (1);
15656         }
15657         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
15658                 puts("Fail compare");
15659                 exit (1);
15660         }
15661         if (cnt == FILE_cnt(fp)) {
15662                 puts("Pass_unchanged");
15663                 exit (0);
15664         }       
15665         if (FILE_cnt(fp) == (cnt - 42)) {
15666                 puts("Pass_changed");
15667                 exit (0);
15668         }
15669         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
15670         return 1;
15671
15672 }
15673 EOP
15674         set try
15675         if eval $compile && $to try.c; then
15676                 case `$run ./try` in
15677                 Pass_changed)
15678                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
15679                         d_stdio_ptr_lval_sets_cnt="$define" ;;
15680                 Pass_unchanged)
15681                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
15682                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
15683                 Fail*)
15684                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
15685                 *)
15686                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
15687         esac
15688         else
15689                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
15690         fi
15691         $rm -f try.c try
15692         ;;
15693 esac
15694
15695 : see if _base is also standard
15696 val="$undef"
15697 case "$d_stdstdio" in
15698 $define)
15699         $cat >try.c <<EOP
15700 #include <stdio.h>
15701 #define FILE_base(fp)   $stdio_base
15702 #define FILE_bufsiz(fp) $stdio_bufsiz
15703 int main() {
15704         FILE *fp = fopen("try.c", "r");
15705         char c = getc(fp);
15706         if (
15707                 19 <= FILE_bufsiz(fp) &&
15708                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
15709         )
15710                 exit(0);
15711         exit(1);
15712 }
15713 EOP
15714         set try
15715         if eval $compile && $to try.c; then
15716                 if $run ./try; then
15717                         echo "And its _base field acts std."
15718                         val="$define"
15719                 else
15720                         echo "But its _base field isn't std."
15721                 fi
15722         else
15723                 echo "However, it seems to be lacking the _base field."
15724         fi
15725         $rm -f try.c try
15726         ;;
15727 esac
15728 set d_stdiobase
15729 eval $setvar
15730
15731 $cat >&4 <<EOM
15732 Checking how to access stdio streams by file descriptor number...
15733 EOM
15734 case "$stdio_stream_array" in
15735 '')     $cat >try.c <<EOCP
15736 #include <stdio.h>
15737 int main() {
15738   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
15739     printf("yes\n");
15740 }
15741 EOCP
15742         for s in _iob __iob __sF
15743         do
15744                 set try -DSTDIO_STREAM_ARRAY=$s
15745                 if eval $compile; then
15746                         case "`$run ./try`" in
15747                         yes)    stdio_stream_array=$s; break ;;
15748                         esac
15749                 fi
15750         done
15751         $rm -f try.* try$exe_ext
15752 esac
15753 case "$stdio_stream_array" in
15754 '')     $cat >&4 <<EOM
15755 I can't figure out how to access stdio streams by file descriptor number.
15756 EOM
15757         d_stdio_stream_array="$undef"
15758         ;;
15759 *)      $cat >&4 <<EOM
15760 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
15761 EOM
15762         d_stdio_stream_array="$define"
15763         ;;
15764 esac
15765
15766 : see if strcoll exists
15767 set strcoll d_strcoll
15768 eval $inlibc
15769
15770 : check for structure copying
15771 echo " "
15772 echo "Checking to see if your C compiler can copy structs..." >&4
15773 $cat >try.c <<'EOCP'
15774 int main()
15775 {
15776         struct blurfl {
15777                 int dyick;
15778         } foo, bar;
15779
15780         foo = bar;
15781 }
15782 EOCP
15783 if $cc -c try.c >/dev/null 2>&1 ; then
15784         val="$define"
15785         echo "Yup, it can."
15786 else
15787         val="$undef"
15788         echo "Nope, it can't."
15789 fi
15790 set d_strctcpy
15791 eval $setvar
15792 $rm -f try.*
15793
15794 : see if strerror and/or sys_errlist[] exist
15795 echo " "
15796 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
15797     if set strerror val -f d_strerror; eval $csym; $val; then
15798                 echo 'strerror() found.' >&4
15799                 d_strerror="$define"
15800                 d_strerrm='strerror(e)'
15801                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
15802                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
15803                         d_syserrlst="$define"
15804                 else
15805                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
15806                         d_syserrlst="$undef"
15807                 fi
15808     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
15809                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
15810                 echo 'strerror() found in string header.' >&4
15811                 d_strerror="$define"
15812                 d_strerrm='strerror(e)'
15813                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
15814                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
15815                                 d_syserrlst="$define"
15816                 else
15817                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
15818                         d_syserrlst="$undef"
15819                 fi
15820     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
15821                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
15822                 d_strerror="$undef"
15823                 d_syserrlst="$define"
15824                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
15825     else
15826                 echo 'strerror() and sys_errlist[] NOT found.' >&4
15827                 d_strerror="$undef"
15828                 d_syserrlst="$undef"
15829                 d_strerrm='"unknown"'
15830     fi
15831 fi
15832
15833 : see if strerror_r exists
15834 set strerror_r d_strerror_r
15835 eval $inlibc
15836 case "$d_strerror_r" in
15837 "$define")
15838         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
15839         case "string" in
15840         time)
15841                 hdrs="$hdrs $i_systime sys/time.h"
15842                 ;;
15843         esac
15844         case "$d_strerror_r_proto:$usethreads" in
15845         ":define")      d_strerror_r_proto=define
15846                 set d_strerror_r_proto strerror_r $hdrs
15847                 eval $hasproto ;;
15848         *)      ;;
15849         esac
15850         case "$d_strerror_r_proto" in
15851         define)
15852         case "$strerror_r_proto" in
15853         ''|0) try='int strerror_r(int, char*, size_t);'
15854         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
15855         esac
15856         case "$strerror_r_proto" in
15857         ''|0) try='int strerror_r(int, char*, int);'
15858         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
15859         esac
15860         case "$strerror_r_proto" in
15861         ''|0) try='char* strerror_r(int, char*, size_t);'
15862         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
15863         esac
15864         case "$strerror_r_proto" in
15865         ''|0)   d_strerror_r=undef
15866                 strerror_r_proto=0
15867                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
15868         * )     case "$strerror_r_proto" in
15869                 REENTRANT_PROTO*) ;;
15870                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
15871                 esac
15872                 echo "Prototype: $try" ;;
15873         esac
15874         ;;
15875         *)      case "$usethreads" in
15876                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
15877                 esac
15878                 d_strerror_r=undef
15879                 strerror_r_proto=0
15880                 ;;
15881         esac
15882         ;;
15883 *)      strerror_r_proto=0
15884         ;;
15885 esac
15886
15887 : see if strftime exists
15888 set strftime d_strftime
15889 eval $inlibc
15890
15891 : see if strtod exists
15892 set strtod d_strtod
15893 eval $inlibc
15894
15895 : see if strtol exists
15896 set strtol d_strtol
15897 eval $inlibc
15898
15899 : see if strtold exists
15900 set strtold d_strtold
15901 eval $inlibc
15902
15903 : see if strtoll exists
15904 set strtoll d_strtoll
15905 eval $inlibc
15906
15907 case "$d_longlong-$d_strtoll" in
15908 "$define-$define")
15909         $cat <<EOM
15910 Checking whether your strtoll() works okay...
15911 EOM
15912         $cat >try.c <<'EOCP'
15913 #include <errno.h>
15914 #ifdef __hpux
15915 #define strtoll __strtoll
15916 #endif
15917 #ifdef __EMX__
15918 #define strtoll _strtoll
15919 #endif
15920 #include <stdio.h>
15921 extern long long int strtoll(char *s, char **, int); 
15922 static int bad = 0;
15923 int check(char *s, long long ell, int een) {
15924         long long gll;
15925         errno = 0;
15926         gll = strtoll(s, 0, 10);
15927         if (!((gll == ell) && (errno == een)))
15928                 bad++;
15929 }
15930 int main() {
15931         check(" 1",                                      1LL, 0);
15932         check(" 0",                                      0LL, 0);
15933         check("-1",                                     -1LL, 0);
15934         check("-9223372036854775808", -9223372036854775808LL, 0);
15935         check("-9223372036854775808", -9223372036854775808LL, 0);
15936         check(" 9223372036854775807",  9223372036854775807LL, 0);
15937         check("-9223372036854775808", -9223372036854775808LL, 0);
15938         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
15939         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
15940         if (!bad)
15941                 printf("ok\n");
15942 }
15943 EOCP
15944         set try
15945         if eval $compile; then
15946                 yyy=`$run ./try`
15947                 case "$yyy" in
15948                 ok) echo "Your strtoll() seems to be working okay." ;;
15949                 *) cat <<EOM >&4
15950 Your strtoll() doesn't seem to be working okay.
15951 EOM
15952                    d_strtoll="$undef"
15953                    ;;
15954                 esac
15955         else
15956                 echo "(I can't seem to compile the test program--assuming it doesn't)"
15957                 d_strtoll="$undef"
15958         fi
15959         ;;
15960 esac
15961
15962 : see if strtoq exists
15963 set strtoq d_strtoq
15964 eval $inlibc
15965
15966 : see if strtoul exists
15967 set strtoul d_strtoul
15968 eval $inlibc
15969
15970 case "$d_strtoul" in
15971 "$define")
15972         $cat <<EOM
15973 Checking whether your strtoul() works okay...
15974 EOM
15975         $cat >try.c <<'EOCP'
15976 #include <errno.h>
15977 #include <stdio.h>
15978 extern unsigned long int strtoul(char *s, char **, int); 
15979 static int bad = 0;
15980 void check(char *s, unsigned long eul, int een) {
15981         unsigned long gul;
15982         errno = 0;
15983         gul = strtoul(s, 0, 10);
15984         if (!((gul == eul) && (errno == een)))
15985                 bad++;
15986 }
15987 int main() {
15988         check(" 1", 1L, 0);
15989         check(" 0", 0L, 0);
15990 EOCP
15991         case "$longsize" in
15992         8)
15993             $cat >>try.c <<'EOCP'
15994         check("18446744073709551615", 18446744073709551615UL, 0);
15995         check("18446744073709551616", 18446744073709551615UL, ERANGE);
15996 #if 0 /* strtoul() for /^-/ strings is undefined. */
15997         check("-1", 18446744073709551615UL, 0);
15998         check("-18446744073709551614", 2, 0);
15999         check("-18446744073709551615", 1, 0);
16000         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
16001         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
16002 #endif
16003 EOCP
16004                 ;;
16005         4)
16006                     $cat >>try.c <<'EOCP'
16007         check("4294967295", 4294967295UL, 0);
16008         check("4294967296", 4294967295UL, ERANGE);
16009 #if 0 /* strtoul() for /^-/ strings is undefined. */
16010         check("-1", 4294967295UL, 0);
16011         check("-4294967294", 2, 0);
16012         check("-4294967295", 1, 0);
16013         check("-4294967296", 4294967295UL, ERANGE);
16014         check("-4294967297", 4294967295UL, ERANGE);
16015 #endif
16016 EOCP
16017                 ;;
16018         *)
16019 : Should we write these tests to be more portable by sprintf-ing
16020 : ~0 and then manipulating that char string as input for strtol?
16021                 ;;
16022         esac
16023         $cat >>try.c <<'EOCP'
16024         if (!bad)
16025                 printf("ok\n");
16026         return 0;
16027 }
16028 EOCP
16029         set try
16030         if eval $compile; then
16031                 case "`$run ./try`" in
16032                 ok) echo "Your strtoul() seems to be working okay." ;;
16033                 *) cat <<EOM >&4
16034 Your strtoul() doesn't seem to be working okay.
16035 EOM
16036                    d_strtoul="$undef"
16037                    ;;
16038                 esac
16039         fi
16040         ;;
16041 esac
16042
16043 : see if strtoull exists
16044 set strtoull d_strtoull
16045 eval $inlibc
16046
16047 case "$d_longlong-$d_strtoull" in
16048 "$define-$define")
16049         $cat <<EOM
16050 Checking whether your strtoull() works okay...
16051 EOM
16052         $cat >try.c <<'EOCP'
16053 #include <errno.h>
16054 #ifdef __hpux
16055 #define strtoull __strtoull
16056 #endif
16057 #include <stdio.h>
16058 extern unsigned long long int strtoull(char *s, char **, int); 
16059 static int bad = 0;
16060 int check(char *s, long long eull, int een) {
16061         long long gull;
16062         errno = 0;
16063         gull = strtoull(s, 0, 10);
16064         if (!((gull == eull) && (errno == een)))
16065                 bad++;
16066 }
16067 int main() {
16068         check(" 1",                                        1LL, 0);
16069         check(" 0",                                        0LL, 0);
16070         check("18446744073709551615",  18446744073709551615ULL, 0);
16071         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
16072 #if 0 /* strtoull() for /^-/ strings is undefined. */
16073         check("-1",                    18446744073709551615ULL, 0);
16074         check("-18446744073709551614",                     2LL, 0);
16075         check("-18446744073709551615",                     1LL, 0);
16076         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16077         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
16078 #endif
16079         if (!bad)
16080                 printf("ok\n");
16081 }
16082 EOCP
16083         set try
16084         if eval $compile; then
16085                 case "`$run ./try`" in
16086                 ok) echo "Your strtoull() seems to be working okay." ;;
16087                 *) cat <<EOM >&4
16088 Your strtoull() doesn't seem to be working okay.
16089 EOM
16090                    d_strtoull="$undef"
16091                    ;;
16092                 esac
16093         fi
16094         ;;
16095 esac
16096
16097 : see if strtouq exists
16098 set strtouq d_strtouq
16099 eval $inlibc
16100
16101 case "$d_strtouq" in
16102 "$define")
16103         $cat <<EOM
16104 Checking whether your strtouq() works okay...
16105 EOM
16106         $cat >try.c <<'EOCP'
16107 #include <errno.h>
16108 #include <stdio.h>
16109 extern unsigned long long int strtouq(char *s, char **, int); 
16110 static int bad = 0;
16111 void check(char *s, unsigned long long eull, int een) {
16112         unsigned long long gull;
16113         errno = 0;
16114         gull = strtouq(s, 0, 10);
16115         if (!((gull == eull) && (errno == een)))
16116                 bad++;
16117 }
16118 int main() {
16119         check(" 1",                                        1LL, 0);
16120         check(" 0",                                        0LL, 0);
16121         check("18446744073709551615",  18446744073709551615ULL, 0);
16122         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
16123 #if 0 /* strtouq() for /^-/ strings is undefined. */
16124         check("-1",                    18446744073709551615ULL, 0);
16125         check("-18446744073709551614",                     2LL, 0);
16126         check("-18446744073709551615",                     1LL, 0);
16127         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16128         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
16129 #endif
16130         if (!bad)
16131                 printf("ok\n");
16132         return 0;
16133 }
16134 EOCP
16135         set try
16136         if eval $compile; then
16137                 case "`$run ./try`" in
16138                 ok) echo "Your strtouq() seems to be working okay." ;;
16139                 *) cat <<EOM >&4
16140 Your strtouq() doesn't seem to be working okay.
16141 EOM
16142                    d_strtouq="$undef"
16143                    ;;
16144                 esac
16145         fi
16146         ;;
16147 esac
16148
16149 : see if strxfrm exists
16150 set strxfrm d_strxfrm
16151 eval $inlibc
16152
16153 : see if symlink exists
16154 set symlink d_symlink
16155 eval $inlibc
16156
16157 : see if syscall exists
16158 set syscall d_syscall
16159 eval $inlibc
16160
16161 : see if prototype for syscall is available
16162 echo " "
16163 set d_syscallproto syscall $i_unistd unistd.h
16164 eval $hasproto
16165
16166 : see if sysconf exists
16167 set sysconf d_sysconf
16168 eval $inlibc
16169
16170 : see if system exists
16171 set system d_system
16172 eval $inlibc
16173
16174 : see if tcgetpgrp exists
16175 set tcgetpgrp d_tcgetpgrp
16176 eval $inlibc
16177
16178 : see if tcsetpgrp exists
16179 set tcsetpgrp d_tcsetpgrp
16180 eval $inlibc
16181
16182 : see if prototype for telldir is available
16183 echo " "
16184 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
16185 eval $hasproto
16186
16187 : see if this is a sys/times.h system
16188 set sys/times.h i_systimes
16189 eval $inhdr
16190
16191 : see if times exists
16192 echo " "
16193 if set times val -f d_times; eval $csym; $val; then
16194         echo 'times() found.' >&4
16195         d_times="$define"
16196         inc=''
16197         case "$i_systimes" in
16198         "$define") inc='sys/times.h';;
16199         esac
16200         rp="What is the type returned by times() on this system?"
16201         set clock_t clocktype long stdio.h sys/types.h $inc
16202         eval $typedef_ask
16203 else
16204         echo 'times() NOT found, hope that will do.' >&4
16205         d_times="$undef"
16206         clocktype='int'
16207 fi
16208
16209 : see if tmpnam_r exists
16210 set tmpnam_r d_tmpnam_r
16211 eval $inlibc
16212 case "$d_tmpnam_r" in
16213 "$define")
16214         hdrs="$i_systypes sys/types.h define stdio.h "
16215         case "stdio" in
16216         time)
16217                 hdrs="$hdrs $i_systime sys/time.h"
16218                 ;;
16219         esac
16220         case "$d_tmpnam_r_proto:$usethreads" in
16221         ":define")      d_tmpnam_r_proto=define
16222                 set d_tmpnam_r_proto tmpnam_r $hdrs
16223                 eval $hasproto ;;
16224         *)      ;;
16225         esac
16226         case "$d_tmpnam_r_proto" in
16227         define)
16228         case "$tmpnam_r_proto" in
16229         ''|0) try='char* tmpnam_r(char*);'
16230         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
16231         esac
16232         case "$tmpnam_r_proto" in
16233         ''|0)   d_tmpnam_r=undef
16234                 tmpnam_r_proto=0
16235                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
16236         * )     case "$tmpnam_r_proto" in
16237                 REENTRANT_PROTO*) ;;
16238                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
16239                 esac
16240                 echo "Prototype: $try" ;;
16241         esac
16242         ;;
16243         *)      case "$usethreads" in
16244                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
16245                 esac
16246                 d_tmpnam_r=undef
16247                 tmpnam_r_proto=0
16248                 ;;
16249         esac
16250         ;;
16251 *)      tmpnam_r_proto=0
16252         ;;
16253 esac
16254
16255 : see if truncate exists
16256 set truncate d_truncate
16257 eval $inlibc
16258
16259 : see if ttyname_r exists
16260 set ttyname_r d_ttyname_r
16261 eval $inlibc
16262 case "$d_ttyname_r" in
16263 "$define")
16264         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
16265         case "unistd" in
16266         time)
16267                 hdrs="$hdrs $i_systime sys/time.h"
16268                 ;;
16269         esac
16270         case "$d_ttyname_r_proto:$usethreads" in
16271         ":define")      d_ttyname_r_proto=define
16272                 set d_ttyname_r_proto ttyname_r $hdrs
16273                 eval $hasproto ;;
16274         *)      ;;
16275         esac
16276         case "$d_ttyname_r_proto" in
16277         define)
16278         case "$ttyname_r_proto" in
16279         ''|0) try='int ttyname_r(int, char*, size_t);'
16280         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
16281         esac
16282         case "$ttyname_r_proto" in
16283         ''|0) try='int ttyname_r(int, char*, int);'
16284         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
16285         esac
16286         case "$ttyname_r_proto" in
16287         ''|0) try='char* ttyname_r(int, char*, int);'
16288         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
16289         esac
16290         case "$ttyname_r_proto" in
16291         ''|0)   d_ttyname_r=undef
16292                 ttyname_r_proto=0
16293                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
16294         * )     case "$ttyname_r_proto" in
16295                 REENTRANT_PROTO*) ;;
16296                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
16297                 esac
16298                 echo "Prototype: $try" ;;
16299         esac
16300         ;;
16301         *)      case "$usethreads" in
16302                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
16303                 esac
16304                 d_ttyname_r=undef
16305                 ttyname_r_proto=0
16306                 ;;
16307         esac
16308         ;;
16309 *)      ttyname_r_proto=0
16310         ;;
16311 esac
16312
16313 : see if tzname[] exists
16314 echo " "
16315 if set tzname val -a d_tzname; eval $csym; $val; then
16316         val="$define"
16317         echo 'tzname[] found.' >&4
16318 else
16319         val="$undef"
16320         echo 'tzname[] NOT found.' >&4
16321 fi
16322 set d_tzname
16323 eval $setvar
16324
16325 case "$osname" in
16326 next|rhapsody|darwin) multiarch="$define" ;;
16327 esac
16328 case "$multiarch" in
16329 ''|[nN]*) multiarch="$undef" ;;
16330 esac
16331
16332 : check for ordering of bytes in a long
16333 echo " "
16334 case "$usecrosscompile$multiarch" in
16335 *$define*)
16336         $cat <<EOM
16337 You seem to be either cross-compiling or doing a multiarchitecture build,
16338 skipping the byteorder check.
16339
16340 EOM
16341         byteorder='ffff'
16342         ;;
16343 *)
16344         case "$byteorder" in
16345         '')
16346                 $cat <<'EOM'
16347 In the following, larger digits indicate more significance.  A big-endian
16348 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
16349 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
16350 machines may have weird orders like 3412.  A Cray will report 87654321,
16351 an Alpha will report 12345678. If the test program works the default is
16352 probably right.
16353 I'm now running the test program...
16354 EOM
16355                 $cat >try.c <<'EOCP'
16356 #include <stdio.h>
16357 int main()
16358 {
16359         int i;
16360         union {
16361                 unsigned long l;
16362                 char c[sizeof(long)];
16363         } u;
16364
16365         if (sizeof(long) > 4)
16366                 u.l = (0x08070605L << 32) | 0x04030201L;
16367         else
16368                 u.l = 0x04030201L;
16369         for (i = 0; i < sizeof(long); i++)
16370                 printf("%c", u.c[i]+'0');
16371         printf("\n");
16372         exit(0);
16373 }
16374 EOCP
16375                 xxx_prompt=y
16376                 set try
16377                 if eval $compile && ./try > /dev/null; then
16378                         dflt=`$run ./try`
16379                         case "$dflt" in
16380                         [1-4][1-4][1-4][1-4]|12345678|87654321)
16381                                 echo "(The test program ran ok.)"
16382                                 echo "byteorder=$dflt"
16383                                 xxx_prompt=n
16384                         ;;
16385                         ????|????????) echo "(The test program ran ok.)" ;;
16386                         *) echo "(The test program didn't run right for some reason.)" ;;
16387                         esac
16388                 else
16389                         dflt='4321'
16390                         cat <<'EOM'
16391 (I can't seem to compile the test program.  Guessing big-endian...)
16392 EOM
16393                 fi
16394                 case "$xxx_prompt" in
16395                 y)
16396                         rp="What is the order of bytes in a long?"
16397                         . ./myread
16398                         byteorder="$ans"
16399                         ;;
16400                 *)      byteorder=$dflt
16401                         ;;
16402                 esac
16403                 ;;
16404         esac
16405         $rm -f try.c try
16406         ;;
16407 esac
16408
16409
16410 $cat <<EOM
16411
16412 Checking to see whether you can access character data unalignedly...
16413 EOM
16414 case "$d_u32align" in
16415 '')   $cat >try.c <<EOCP
16416 #include <stdio.h>
16417 #define U32 $u32type
16418 #define BYTEORDER 0x$byteorder
16419 #define U8 $u8type
16420 #include <signal.h>
16421 #ifdef SIGBUS
16422 $signal_t bletch(s) int s; { exit(4); }
16423 #endif
16424 int main() {
16425 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
16426     U8 buf[8];
16427     U32 *up;
16428     int i;
16429
16430     if (sizeof(U32) != 4) {
16431         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
16432         exit(1);
16433     }
16434
16435     fflush(stdout);
16436
16437 #ifdef SIGBUS
16438     signal(SIGBUS, bletch);
16439 #endif
16440
16441     buf[0] = 0;
16442     buf[1] = 0;
16443     buf[2] = 0;
16444     buf[3] = 1;
16445     buf[5] = 0;
16446     buf[6] = 0;
16447     buf[7] = 0;
16448     buf[8] = 1;
16449
16450     for (i = 0; i < 4; i++) {
16451         up = (U32*)(buf + i);
16452         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
16453                (*up == 1 << (8*(3-i)))  /* little-endian */
16454               )
16455            )
16456         {
16457             printf("read failed (%x)\n", *up);
16458             exit(2);
16459         }
16460     }
16461
16462     /* write test */
16463     for (i = 0; i < 4; i++) {
16464         up = (U32*)(buf + i);
16465         *up = 0xBeef;
16466         if (*up != 0xBeef) {
16467             printf("write failed (%x)\n", *up);
16468             exit(3);
16469         }
16470     }
16471
16472     exit(0);
16473 #else
16474     printf("1\n");
16475     exit(1);
16476 #endif
16477     return 0;
16478 }
16479 EOCP
16480 set try
16481 if eval $compile_ok; then
16482         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
16483         $run ./try 2>&1 >/dev/null
16484         case "$?" in
16485         0)      cat >&4 <<EOM
16486 You can access character data pretty unalignedly.
16487 EOM
16488                 d_u32align="$undef"
16489                 ;;
16490         *)      cat >&4 <<EOM
16491 It seems that you must access character data in an aligned manner.
16492 EOM
16493                 d_u32align="$define"
16494                 ;;
16495         esac
16496 else
16497         rp='Can you access character data at unaligned addresses?'
16498         dflt='n'
16499         . ./myread
16500         case "$ans" in
16501         [yY]*)  d_u32align="$undef"  ;;
16502         *)      d_u32align="$define" ;;
16503         esac
16504 fi
16505 $rm -f core core.try.* try.core
16506 ;;
16507 esac
16508
16509 : see if ualarm exists
16510 set ualarm d_ualarm
16511 eval $inlibc
16512
16513 : see if umask exists
16514 set umask d_umask
16515 eval $inlibc
16516
16517 : see if unordered exists
16518 set unordered d_unordered
16519 eval $inlibc
16520
16521 : see if usleep exists
16522 set usleep d_usleep
16523 eval $inlibc
16524
16525 : see if prototype for usleep is available
16526 echo " "
16527 set d_usleepproto usleep $i_unistd unistd.h
16528 eval $hasproto
16529
16530 : see if ustat exists
16531 set ustat d_ustat
16532 eval $inlibc
16533
16534 : backward compatibility for d_hvfork
16535 if test X$d_hvfork != X; then
16536         d_vfork="$d_hvfork"
16537         d_hvfork=''
16538 fi
16539 : see if there is a vfork
16540 val=''
16541 set vfork val
16542 eval $inlibc
16543
16544 : Ok, but do we want to use it. vfork is reportedly unreliable in 
16545 : perl on Solaris 2.x, and probably elsewhere.
16546 case "$val" in
16547 $define)
16548         echo " "
16549         case "$usevfork" in
16550         false) dflt='n';;
16551         *) dflt='y';;
16552         esac
16553         cat <<'EOM'
16554  
16555 Perl can only use a vfork() that doesn't suffer from strict
16556 restrictions on calling functions or modifying global data in
16557 the child.  For example, glibc-2.1 contains such a vfork()
16558 that is unsuitable.  If your system provides a proper fork()
16559 call, chances are that you do NOT want perl to use vfork().
16560
16561 EOM
16562         rp="Do you still want to use vfork()?"
16563         . ./myread
16564         case "$ans" in
16565         y|Y) ;;
16566         *)
16567                 echo "Ok, we won't use vfork()."
16568                 val="$undef"
16569                 ;;
16570         esac
16571         ;;
16572 esac
16573 set d_vfork
16574 eval $setvar
16575 case "$d_vfork" in
16576 $define) usevfork='true';;
16577 *) usevfork='false';;
16578 esac
16579
16580 : see if closedir exists
16581 set closedir d_closedir
16582 eval $inlibc
16583
16584 case "$d_closedir" in
16585 "$define")
16586         echo " "
16587         echo "Checking whether closedir() returns a status..." >&4
16588         cat > try.c <<EOM
16589 #$i_dirent I_DIRENT             /**/
16590 #$i_sysdir I_SYS_DIR            /**/
16591 #$i_sysndir I_SYS_NDIR          /**/
16592 #$i_systypes I_SYS_TYPES        /**/
16593
16594 #if defined(I_SYS_TYPES)
16595 #include <sys/types.h>
16596 #endif
16597 #if defined(I_DIRENT)
16598 #include <dirent.h>
16599 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
16600 #include <sys/dir.h>
16601 #endif
16602 #else
16603 #ifdef I_SYS_NDIR
16604 #include <sys/ndir.h>
16605 #else
16606 #ifdef I_SYS_DIR
16607 #ifdef hp9000s500
16608 #include <ndir.h>       /* may be wrong in the future */
16609 #else
16610 #include <sys/dir.h>
16611 #endif
16612 #endif
16613 #endif
16614 #endif 
16615 int main() { return closedir(opendir(".")); }
16616 EOM
16617         set try
16618         if eval $compile_ok; then
16619                 if $run ./try > /dev/null 2>&1 ; then
16620                         echo "Yes, it does."
16621                         val="$undef"
16622                 else
16623                         echo "No, it doesn't."
16624                         val="$define"
16625                 fi
16626         else
16627                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16628                 val="$define"
16629         fi
16630         ;;
16631 *)
16632         val="$undef";
16633         ;;
16634 esac
16635 set d_void_closedir
16636 eval $setvar
16637 $rm -f try try.*
16638 : see if there is a wait4
16639 set wait4 d_wait4
16640 eval $inlibc
16641
16642 : see if waitpid exists
16643 set waitpid d_waitpid
16644 eval $inlibc
16645
16646 : see if wcstombs exists
16647 set wcstombs d_wcstombs
16648 eval $inlibc
16649
16650 : see if wctomb exists
16651 set wctomb d_wctomb
16652 eval $inlibc
16653
16654 : see if writev exists
16655 set writev d_writev
16656 eval $inlibc
16657
16658 : preserve RCS keywords in files with variable substitution, grrr
16659 Date='$Date'
16660 Id='$Id'
16661 Log='$Log'
16662 RCSfile='$RCSfile'
16663 Revision='$Revision'
16664
16665 : check for alignment requirements
16666 echo " "
16667 case "$usecrosscompile$multiarch" in
16668 *$define*)
16669         $cat <<EOM
16670 You seem to be either cross-compiling or doing a multiarchitecture build,
16671 skipping the memory alignment check.
16672
16673 EOM
16674         case "$alignbytes" in
16675         '') alignbytes=8 ;;
16676         esac
16677         ;;
16678 *)
16679         case "$alignbytes" in
16680         '') echo "Checking alignment constraints..." >&4
16681                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
16682                         $cat >try.c <<'EOCP'
16683 typedef long double NV;
16684 EOCP
16685                 else
16686                         $cat >try.c <<'EOCP'
16687 typedef double NV;
16688 EOCP
16689                 fi
16690                 $cat >>try.c <<'EOCP'
16691 #include <stdio.h>
16692 struct foobar {
16693         char foo;
16694         NV bar;
16695 } try_algn;
16696 int main()
16697 {
16698     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
16699     return(0);
16700 }
16701 EOCP
16702                 set try
16703                 if eval $compile_ok; then
16704                         dflt=`$run ./try`
16705                 else
16706                         dflt='8'
16707                         echo "(I can't seem to compile the test program...)"
16708                 fi
16709                 ;;
16710         *) dflt="$alignbytes"
16711                 ;;
16712         esac
16713         rp="Doubles must be aligned on a how-many-byte boundary?"
16714         . ./myread
16715         alignbytes="$ans"
16716         $rm -f try.c try
16717         ;;
16718 esac
16719
16720
16721 : set the base revision
16722 baserev=5.0
16723
16724 : how do we catenate cpp tokens here?
16725 echo " "
16726 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
16727 $cat >cpp_stuff.c <<'EOCP'
16728 #define RCAT(a,b)a/**/b
16729 #define ACAT(a,b)a ## b
16730 RCAT(Rei,ser)
16731 ACAT(Cir,cus)
16732 EOCP
16733 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
16734 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
16735         echo "Oh!  Smells like ANSI's been here." >&4
16736         echo "We can catify or stringify, separately or together!"
16737         cpp_stuff=42
16738 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
16739         echo "Ah, yes!  The good old days!" >&4
16740         echo "However, in the good old days we don't know how to stringify and"
16741         echo "catify at the same time."
16742         cpp_stuff=1
16743 else
16744         $cat >&4 <<EOM
16745 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
16746 to have to edit the values of CAT[2-5] in config.h...
16747 EOM
16748         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
16749 fi
16750 $rm -f cpp_stuff.*
16751
16752 : see if this is a db.h system
16753 set db.h i_db
16754 eval $inhdr
16755
16756 case "$i_db" in
16757 $define)
16758         : Check db version.
16759         echo " "
16760         echo "Checking Berkeley DB version ..." >&4
16761         $cat >try.c <<EOCP
16762 #$d_const HASCONST
16763 #ifndef HASCONST
16764 #define const
16765 #endif
16766 #include <sys/types.h>
16767 #include <stdio.h>
16768 #include <db.h>
16769 int main(int argc, char *argv[])
16770 {
16771 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
16772     int Major, Minor, Patch ;
16773     unsigned long Version ;
16774     (void)db_version(&Major, &Minor, &Patch) ;
16775     if (argc == 2) {
16776         printf("%d %d %d %d %d %d\n",
16777                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
16778                Major, Minor, Patch);
16779         exit(0);
16780     }
16781     printf("You have Berkeley DB Version 2 or greater.\n");
16782
16783     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
16784                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
16785     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
16786                 Major, Minor, Patch) ;
16787
16788     /* check that db.h & libdb are compatible */
16789     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
16790         printf("db.h and libdb are incompatible.\n") ;
16791         exit(3);        
16792     }
16793
16794     printf("db.h and libdb are compatible.\n") ;
16795
16796     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
16797                 + DB_VERSION_PATCH ;
16798
16799     /* needs to be >= 2.3.4 */
16800     if (Version < 2003004) {
16801     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
16802         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
16803         exit(2);        
16804     }
16805
16806     exit(0);
16807 #else
16808 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
16809     if (argc == 2) {
16810         printf("1 0 0\n");
16811         exit(0);
16812     }
16813     printf("You have Berkeley DB Version 1.\n");
16814     exit(0);    /* DB version < 2: the coast is clear. */
16815 #else
16816     exit(1);    /* <db.h> not Berkeley DB? */
16817 #endif
16818 #endif
16819 }
16820 EOCP
16821         set try
16822         if eval $compile_ok && $run ./try; then
16823                 echo 'Looks OK.' >&4
16824                 set `$run ./try 1`
16825                 db_version_major=$1
16826                 db_version_minor=$2
16827                 db_version_patch=$3
16828         else
16829                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
16830                 i_db=$undef
16831                 case " $libs " in
16832                 *"-ldb "*)
16833                         : Remove db from list of libraries to use
16834                         echo "Removing unusable -ldb from library list" >&4
16835                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
16836                         shift
16837                         libs="$*"
16838                         echo "libs = $libs" >&4
16839                         ;;
16840                 esac
16841         fi
16842         $rm -f try.*
16843         ;;
16844 esac
16845
16846 case "$i_db" in
16847 define)
16848         : Check the return type needed for hash 
16849         echo " "
16850         echo "Checking return type needed for hash for Berkeley DB ..." >&4
16851         $cat >try.c <<EOCP
16852 #$d_const HASCONST
16853 #ifndef HASCONST
16854 #define const
16855 #endif
16856 #include <sys/types.h>
16857 #include <db.h>
16858
16859 #ifndef DB_VERSION_MAJOR
16860 u_int32_t hash_cb (ptr, size)
16861 const void *ptr;
16862 size_t size;
16863 {
16864 }
16865 HASHINFO info;
16866 int main()
16867 {
16868         info.hash = hash_cb;
16869 }
16870 #endif
16871 EOCP
16872         if $cc $ccflags -c try.c >try.out 2>&1 ; then
16873                 if $contains warning try.out >>/dev/null 2>&1 ; then
16874                         db_hashtype='int'
16875                 else
16876                         db_hashtype='u_int32_t'
16877                 fi
16878         else
16879                 : XXX Maybe we should just give up here.
16880                 db_hashtype=u_int32_t
16881                 $cat try.out >&4
16882                 echo "Help:  I can't seem to compile the db test program." >&4
16883                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
16884         fi
16885         $rm -f try.*
16886         echo "Your version of Berkeley DB uses $db_hashtype for hash."
16887         ;;
16888 *)      db_hashtype=u_int32_t
16889         ;;
16890 esac
16891 case "$i_db" in
16892 define)
16893         : Check the return type needed for prefix 
16894         echo " "
16895         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
16896         cat >try.c <<EOCP
16897 #$d_const HASCONST
16898 #ifndef HASCONST
16899 #define const
16900 #endif
16901 #include <sys/types.h>
16902 #include <db.h>
16903
16904 #ifndef DB_VERSION_MAJOR
16905 size_t prefix_cb (key1, key2)
16906 const DBT *key1;
16907 const DBT *key2;
16908 {
16909 }
16910 BTREEINFO info;
16911 int main()
16912 {
16913         info.prefix = prefix_cb;
16914 }
16915 #endif
16916 EOCP
16917         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
16918                 if $contains warning try.out >>/dev/null 2>&1 ; then
16919                         db_prefixtype='int'
16920                 else
16921                         db_prefixtype='size_t'
16922                 fi
16923         else
16924                 db_prefixtype='size_t'
16925                 : XXX Maybe we should just give up here.
16926                 $cat try.out >&4
16927                 echo "Help:  I can't seem to compile the db test program." >&4
16928                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
16929         fi
16930         $rm -f try.*
16931         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
16932         ;;
16933 *)      db_prefixtype='size_t'
16934         ;;
16935 esac
16936
16937
16938 : How can we generate normalized random numbers ?
16939 echo " "
16940 echo "Looking for a random number function..." >&4
16941 case "$randfunc" in
16942 '')
16943         if set drand48 val -f; eval $csym; $val; then
16944                 dflt="drand48"
16945                 echo "Good, found drand48()." >&4
16946         elif set random val -f; eval $csym; $val; then
16947                 dflt="random"
16948                 echo "OK, found random()." >&4
16949         else
16950                 dflt="rand"
16951                 echo "Yick, looks like I have to use rand()." >&4
16952         fi
16953         echo " "
16954         ;;
16955 *)
16956         dflt="$randfunc"
16957         ;;
16958 esac
16959 cont=true
16960
16961 case "$ccflags" in
16962 *-Dmy_rand=*|*-Dmy_srand=*)
16963         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
16964         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
16965         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
16966         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
16967         ;;
16968 esac
16969
16970 while $test "$cont"; do
16971         rp="Use which function to generate random numbers?"
16972         . ./myread
16973         if $test "$ans" = "$dflt"; then
16974                 : null
16975         else
16976                 randbits=''
16977         fi
16978         randfunc="$ans"
16979         if set $ans val -f; eval $csym; $val; then
16980                 cont=''
16981         else
16982                 dflt=y
16983                 rp="I cannot find function $ans. Use that name anyway?"
16984                 . ./myread
16985                 dflt=rand
16986                 case "$ans" in
16987                         [yY]*) cont='';;
16988                 esac
16989         fi
16990         case "$cont" in
16991         '')
16992                 case "$randfunc" in
16993                 drand48)
16994                         drand01="drand48()"
16995                         seedfunc="srand48"
16996                         randbits=48
16997                         randseedtype=long
16998                         ;;
16999                 rand|random)
17000                         case "$randbits" in
17001                         '')
17002 echo "Checking to see how many bits your $randfunc() function produces..." >&4
17003                                 $cat >try.c <<EOCP
17004 #$i_unistd I_UNISTD
17005 #$i_stdlib I_STDLIB
17006 #include <stdio.h>
17007 #ifdef I_UNISTD
17008 #  include <unistd.h>
17009 #endif
17010 #ifdef I_STDLIB
17011 #  include <stdlib.h>
17012 #endif
17013 int main()
17014 {
17015         register int i;
17016         register unsigned long tmp;
17017         register unsigned long max = 0L;
17018
17019         for (i = 1000; i; i--) {
17020                 tmp = (unsigned long) $randfunc();
17021                 if (tmp > max) max = tmp;
17022         }
17023         for (i = 0; max; i++)
17024                 max /= 2;
17025         printf("%d\n",i);
17026 }
17027 EOCP
17028                                 set try
17029                                 if eval $compile_ok; then
17030                                         dflt=`try`
17031                                 else
17032                                         dflt='?'
17033                                         echo "(I can't seem to compile the test program...)"
17034                                 fi
17035                                 ;;
17036                         *)
17037                                 dflt="$randbits"
17038                                 ;;
17039                         esac
17040                         rp="How many bits does your $randfunc() function produce?"
17041                         . ./myread
17042                         randbits="$ans"
17043                         $rm -f try.c try
17044                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17045                         seedfunc="s$randfunc"
17046                         randseedtype=unsigned
17047                         ;;
17048                 *)
17049                         dflt="31"
17050                         rp="How many bits does your $randfunc() function produce?"
17051                         . ./myread
17052                         randbits="$ans"
17053                         seedfunc="s$randfunc"
17054                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17055                         if set $seedfunc val -f; eval $csym; $val; then
17056                                 echo "(Using $seedfunc() to seed random generator)"
17057                         else
17058                                 echo "(Warning: no $seedfunc() to seed random generator)"
17059                                 seedfunc=rand
17060                         fi
17061                         randseedtype=unsigned
17062                         ;;
17063                 esac
17064                 ;;
17065         esac
17066 done
17067
17068 echo " "
17069 echo "Determining whether or not we are on an EBCDIC system..." >&4
17070 $cat >try.c <<'EOM'
17071 int main()
17072 {
17073   if ('M'==0xd4) return 0;
17074   return 1;
17075 }
17076 EOM
17077
17078 val=$undef
17079 set try
17080 if eval $compile_ok; then
17081         if $run ./try; then
17082                 echo "You seem to speak EBCDIC." >&4
17083                 val="$define"
17084         else
17085                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
17086         fi
17087 else
17088         echo "I'm unable to compile the test program." >&4
17089         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
17090 fi
17091 $rm -f try try.*
17092 set ebcdic
17093 eval $setvar
17094
17095 echo " "
17096 $cat >&4 <<EOM
17097 Checking how to flush all pending stdio output...
17098 EOM
17099 # I only know how to find the first 32 possibly open files on SunOS.
17100 # See also hints/sunos_4_1.sh and util.c  --AD
17101 case "$osname" in
17102 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
17103 esac
17104 $cat >>try.c <<EOCP
17105 #include <stdio.h>
17106 #$i_unistd I_UNISTD
17107 #ifdef I_UNISTD
17108 # include <unistd.h>
17109 #endif
17110 #$d_sysconf HAS_SYSCONF
17111 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
17112 #ifdef HAS_STDIO_STREAM_ARRAY
17113 # define STDIO_STREAM_ARRAY $stdio_stream_array
17114 #endif
17115 int main() {
17116   FILE* p;
17117   unlink("try.out");
17118   p = fopen("try.out", "w");
17119 #ifdef TRY_FPUTC
17120   fputc('x', p);
17121 #else
17122 # ifdef TRY_FPRINTF
17123   fprintf(p, "x");
17124 # endif
17125 #endif
17126 #ifdef TRY_FFLUSH_NULL
17127   fflush(NULL);
17128 #endif
17129 #ifdef TRY_FFLUSH_ALL
17130   {
17131     long open_max = -1;
17132 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
17133     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
17134 # else
17135 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
17136     open_max = sysconf(_SC_OPEN_MAX);
17137 #  else
17138 #   ifdef FOPEN_MAX
17139     open_max = FOPEN_MAX;
17140 #   else
17141 #    ifdef OPEN_MAX
17142     open_max = OPEN_MAX;
17143 #    else
17144 #     ifdef _NFILE
17145     open_max = _NFILE;
17146 #     endif
17147 #    endif
17148 #   endif
17149 #  endif
17150 # endif 
17151 # ifdef HAS_STDIO_STREAM_ARRAY
17152     if (open_max > 0) {
17153       long i;
17154       for (i = 0; i < open_max; i++)
17155             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
17156                 STDIO_STREAM_ARRAY[i]._file < open_max &&
17157                 STDIO_STREAM_ARRAY[i]._flag)
17158                 fflush(&STDIO_STREAM_ARRAY[i]);
17159     }   
17160   }
17161 # endif
17162 #endif
17163   _exit(42);
17164 }
17165 EOCP
17166 : first we have to find out how _not_ to flush
17167 $to try.c
17168 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
17169     output=''
17170     set try -DTRY_FPUTC
17171     if eval $compile; then
17172             $run ./try 2>/dev/null
17173             code="$?"
17174             $from try.out
17175             if $test ! -s try.out -a "X$code" = X42; then
17176                 output=-DTRY_FPUTC
17177             fi
17178     fi
17179     case "$output" in
17180     '')
17181             set try -DTRY_FPRINTF
17182             if eval $compile; then
17183                     $run ./try 2>/dev/null
17184                     code="$?"
17185                     $from try.out
17186                     if $test ! -s try.out -a "X$code" = X42; then
17187                         output=-DTRY_FPRINTF
17188                     fi
17189             fi
17190         ;;
17191     esac
17192 fi
17193 : check for fflush NULL behaviour
17194 case "$fflushNULL" in
17195 '')     set try -DTRY_FFLUSH_NULL $output
17196         if eval $compile; then
17197                 $run ./try 2>/dev/null
17198                 code="$?"
17199                 $from try.out
17200                 if $test -s try.out -a "X$code" = X42; then
17201                         fflushNULL="`$cat try.out`"
17202                 else
17203                         if $test "X$code" != X42; then
17204                                 $cat >&4 <<EOM
17205 (If this test failed, don't worry, we'll try another method shortly.)
17206 EOM
17207                         fi
17208                 fi
17209         fi
17210         $rm -f core try.core core.try.*
17211         case "$fflushNULL" in
17212         x)      $cat >&4 <<EOM
17213 Your fflush(NULL) works okay for output streams.
17214 Let's see if it clobbers input pipes...
17215 EOM
17216 # As of mid-March 2000 all versions of Solaris appear to have a stdio
17217 # bug that improperly flushes the input end of pipes.  So we avoid the
17218 # autoflush on fork/system/exec support for now. :-(
17219 $cat >tryp.c <<EOCP
17220 #include <stdio.h>
17221 int
17222 main(int argc, char **argv)
17223 {
17224     char buf[1024];
17225     int i;
17226     char *bp = buf;
17227     while (1) {
17228         while ((i = getc(stdin)) != -1
17229                && (*bp++ = i) != '\n'
17230                && bp < &buf[1024])
17231         /* DO NOTHING */ ;
17232         *bp = '\0';
17233         fprintf(stdout, "%s", buf);
17234         fflush(NULL);
17235         if (i == -1)
17236             return 0;
17237         bp = buf;
17238     }
17239 }
17240 EOCP
17241                 fflushNULL="$define"
17242                 set tryp
17243                 if eval $compile; then
17244                     $rm -f tryp.out
17245                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17246                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
17247                        $cat >&4 <<EOM
17248 fflush(NULL) seems to behave okay with input streams.
17249 EOM
17250                         fflushNULL="$define"
17251                     else
17252                         $cat >&4 <<EOM
17253 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
17254 EOM
17255                         fflushNULL="$undef"
17256                     fi
17257                 fi
17258                 $rm -f core tryp.c tryp.core core.tryp.*
17259                 ;;
17260         '')     $cat >&4 <<EOM
17261 Your fflush(NULL) isn't working (contrary to ANSI C).
17262 EOM
17263                 fflushNULL="$undef"
17264                 ;;
17265         *)      $cat >&4 <<EOM
17266 Cannot figure out whether your fflush(NULL) works or not.
17267 I'm assuming it doesn't (contrary to ANSI C).
17268 EOM
17269                 fflushNULL="$undef"
17270                 ;;
17271         esac
17272         ;;
17273 $define|true|[yY]*)
17274         fflushNULL="$define"
17275         ;;
17276 *)
17277         fflushNULL="$undef"
17278         ;;
17279 esac
17280 : check explicit looping only if NULL did not work, and if the pipe
17281 : bug does not show up on an explicit flush too
17282 case "$fflushNULL" in
17283 "$undef")
17284         $cat >tryp.c <<EOCP
17285 #include <stdio.h>
17286 int
17287 main(int argc, char **argv)
17288 {
17289     char buf[1024];
17290     int i;
17291     char *bp = buf;
17292     while (1) {
17293         while ((i = getc(stdin)) != -1
17294                && (*bp++ = i) != '\n'
17295                && bp < &buf[1024])
17296         /* DO NOTHING */ ;
17297         *bp = '\0';
17298         fprintf(stdout, "%s", buf);
17299         fflush(stdin);
17300         if (i == -1)
17301             return 0;
17302         bp = buf;
17303     }
17304 }
17305 EOCP
17306         set tryp
17307         if eval $compile; then
17308             $rm -f tryp.out
17309             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17310             if cmp tryp.c tryp.out >/dev/null 2>&1; then
17311                $cat >&4 <<EOM
17312 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
17313 EOM
17314                 : now check for fflushall behaviour
17315                 case "$fflushall" in
17316                 '')     set try -DTRY_FFLUSH_ALL $output
17317                         if eval $compile; then
17318                                 $cat >&4 <<EOM
17319 (Now testing the other method--but note that this also may fail.)
17320 EOM
17321                                 $run ./try 2>/dev/null
17322                                 code=$?
17323                                 $from try.out
17324                                 if $test -s try.out -a "X$code" = X42; then
17325                                         fflushall="`$cat try.out`"
17326                                 fi
17327                         fi
17328                         $rm -f core try.core core.try.*
17329                         case "$fflushall" in
17330                         x)      $cat >&4 <<EOM
17331 Whew. Flushing explicitly all the stdio streams works.
17332 EOM
17333                                 fflushall="$define"
17334                                 ;;
17335                         '')     $cat >&4 <<EOM
17336 Sigh. Flushing explicitly all the stdio streams doesn't work.
17337 EOM
17338                                 fflushall="$undef"
17339                                 ;;
17340                         *)      $cat >&4 <<EOM
17341 Cannot figure out whether flushing stdio streams explicitly works or not.
17342 I'm assuming it doesn't.
17343 EOM
17344                                 fflushall="$undef"
17345                                 ;;
17346                         esac
17347                         ;;
17348                 "$define"|true|[yY]*)
17349                         fflushall="$define"
17350                         ;;
17351                 *)
17352                         fflushall="$undef"
17353                         ;;
17354                 esac
17355             else
17356                 $cat >&4 <<EOM
17357 All is futile.  Even fflush(stdin) clobbers input pipes!
17358 EOM
17359                 fflushall="$undef"
17360             fi
17361         else
17362             fflushall="$undef"
17363         fi
17364         $rm -f core tryp.c tryp.core core.tryp.*
17365         ;;
17366 *)      fflushall="$undef"
17367         ;;
17368 esac
17369
17370 case "$fflushNULL$fflushall" in
17371 undefundef)
17372         $cat <<EOM
17373 OK, I give up.  I cannot figure out how to flush pending stdio output.
17374 We won't be flushing handles at all before fork/exec/popen.
17375 EOM
17376         ;;
17377 esac
17378 $rm -f try.* try$exe_ext
17379
17380 : Store the full pathname to the ar program for use in the C program
17381 : Respect a hint or command line value for full_ar.
17382 case "$full_ar" in
17383 '') full_ar=$ar ;;
17384 esac
17385
17386 : Store the full pathname to the sed program for use in the C program
17387 full_sed=$sed
17388
17389 : see what type gids are declared as in the kernel
17390 echo " "
17391 echo "Looking for the type for group ids returned by getgid()."
17392 set gid_t gidtype xxx stdio.h sys/types.h
17393 eval $typedef
17394 case "$gidtype" in
17395 xxx)
17396         xxx=`./findhdr sys/user.h`
17397         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
17398         case $1 in
17399         unsigned) dflt="$1 $2" ;;
17400         *) dflt="$1" ;;
17401         esac
17402         ;;
17403 *) dflt="$gidtype";;
17404 esac
17405 case "$gidtype" in
17406 gid_t) echo "gid_t found." ;;
17407 *)      rp="What is the type for group ids returned by getgid()?"
17408         . ./myread
17409         gidtype="$ans"
17410         ;;
17411 esac
17412
17413 echo " "
17414 case "$gidtype" in
17415 *_t) zzz="$gidtype"     ;;
17416 *)   zzz="gid"          ;;
17417 esac
17418 echo "Checking the size of $zzz..." >&4 
17419 cat > try.c <<EOCP
17420 #include <sys/types.h>
17421 #include <stdio.h>
17422 int main() {
17423     printf("%d\n", (int)sizeof($gidtype));
17424     exit(0);
17425 }
17426 EOCP
17427 set try
17428 if eval $compile_ok; then
17429         yyy=`$run ./try`
17430         case "$yyy" in
17431         '')     gidsize=4
17432                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
17433                 ;;
17434         *)      gidsize=$yyy
17435                 echo "Your $zzz is $gidsize bytes long."
17436                 ;;
17437         esac
17438 else
17439         gidsize=4
17440         echo "(I can't compile the test program--guessing $gidsize.)" >&4
17441 fi
17442
17443
17444 echo " "
17445 case "$gidtype" in
17446 *_t) zzz="$gidtype"     ;;
17447 *)   zzz="gid"          ;;
17448 esac
17449 echo "Checking the sign of $zzz..." >&4 
17450 cat > try.c <<EOCP
17451 #include <sys/types.h>
17452 #include <stdio.h>
17453 int main() {
17454         $gidtype foo = -1;
17455         if (foo < 0)
17456                 printf("-1\n");
17457         else
17458                 printf("1\n");
17459 }
17460 EOCP
17461 set try
17462 if eval $compile; then
17463         yyy=`$run ./try`
17464         case "$yyy" in
17465         '')     gidsign=1
17466                 echo "(I can't execute the test program--guessing unsigned.)" >&4
17467                 ;;
17468         *)      gidsign=$yyy
17469                 case "$gidsign" in
17470                  1) echo "Your $zzz is unsigned." ;;
17471                 -1) echo "Your $zzz is signed."   ;;
17472                 esac
17473                 ;;
17474         esac
17475 else
17476         gidsign=1
17477         echo "(I can't compile the test program--guessing unsigned.)" >&4
17478 fi
17479
17480
17481 echo " "
17482
17483 if $test X"$quadtype" != X; then
17484
17485 echo "Checking how to print 64-bit integers..." >&4
17486
17487 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
17488         $cat >try.c <<'EOCP'
17489 #include <sys/types.h>
17490 #include <stdio.h>
17491 int main() {
17492   int q = 12345678901;
17493   printf("%ld\n", q);
17494 }
17495 EOCP
17496         set try
17497         if eval $compile; then
17498                 yyy=`$run ./try`
17499                 case "$yyy" in
17500                 12345678901)
17501                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
17502                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
17503                         echo "We will use %d."
17504                         ;;
17505                 esac
17506         fi
17507 fi
17508
17509 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
17510         $cat >try.c <<'EOCP'
17511 #include <sys/types.h>
17512 #include <stdio.h>
17513 int main() {
17514   long q = 12345678901;
17515   printf("%ld\n", q);
17516 }
17517 EOCP
17518         set try
17519         if eval $compile; then
17520                 yyy=`$run ./try`
17521                 case "$yyy" in
17522                 12345678901)
17523                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
17524                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
17525                         echo "We will use %ld."
17526                         ;;
17527                 esac
17528         fi
17529 fi
17530
17531 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
17532         $cat >try.c <<'EOCP'
17533 #include <sys/types.h>
17534 #include <inttypes.h>
17535 #include <stdio.h>
17536 int main() {
17537   int64_t q = 12345678901;
17538   printf("%" PRId64 "\n", q);
17539 }
17540 EOCP
17541         set try
17542         if eval $compile; then
17543                 yyy=`$run ./try`
17544                 case "$yyy" in
17545                 12345678901)
17546                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
17547                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
17548                         echo "We will use the C9X style."
17549                         ;;
17550                 esac
17551         fi
17552 fi
17553
17554 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17555         $cat >try.c <<EOCP
17556 #include <sys/types.h>
17557 #include <stdio.h>
17558 int main() {
17559   $quadtype q = 12345678901;
17560   printf("%Ld\n", q);
17561 }
17562 EOCP
17563         set try
17564         if eval $compile; then
17565                 yyy=`$run ./try`
17566                 case "$yyy" in
17567                 12345678901)
17568                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
17569                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
17570                         echo "We will use %Ld."
17571                         ;;
17572                 esac
17573         fi
17574 fi
17575
17576 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
17577         $cat >try.c <<'EOCP'
17578 #include <sys/types.h>
17579 #include <stdio.h>
17580 int main() {
17581   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
17582   printf("%lld\n", q);
17583 }
17584 EOCP
17585         set try
17586         if eval $compile; then
17587                 yyy=`$run ./try`
17588                 case "$yyy" in
17589                 12345678901)
17590                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
17591                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
17592                         echo "We will use the %lld style."
17593                         ;;
17594                 esac
17595         fi
17596 fi
17597
17598 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17599         $cat >try.c <<EOCP
17600 #include <sys/types.h>
17601 #include <stdio.h>
17602 int main() {
17603   $quadtype q = 12345678901;
17604   printf("%qd\n", q);
17605 }
17606 EOCP
17607         set try
17608         if eval $compile; then
17609                 yyy=`$run ./try`
17610                 case "$yyy" in
17611                 12345678901)
17612                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
17613                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
17614                         echo "We will use %qd."
17615                         ;;
17616                 esac
17617         fi
17618 fi
17619
17620 if $test X"$sPRId64" = X; then
17621         echo "Cannot figure out how to print 64-bit integers." >&4
17622 fi
17623
17624 $rm -f try try.*
17625
17626 fi
17627
17628 case "$sPRId64" in
17629 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
17630         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
17631         ;;
17632 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
17633         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
17634         ;;
17635 esac
17636
17637
17638 echo " "
17639 $echo "Checking the format strings to be used for Perl's internal types..." >&4
17640
17641 if $test X"$ivsize" = X8; then
17642         ivdformat="$sPRId64"
17643         uvuformat="$sPRIu64"
17644         uvoformat="$sPRIo64"
17645         uvxformat="$sPRIx64"
17646         uvXUformat="$sPRIXU64"
17647 else
17648         if $test X"$ivsize" = X"$longsize"; then
17649                 ivdformat='"ld"'
17650                 uvuformat='"lu"'
17651                 uvoformat='"lo"'
17652                 uvxformat='"lx"'
17653                 uvXUformat='"lX"'
17654         else
17655                 if $test X"$ivsize" = X"$intsize"; then
17656                         ivdformat='"d"'
17657                         uvuformat='"u"'
17658                         uvoformat='"o"'
17659                         uvxformat='"x"'
17660                         uvXUformat='"X"'
17661                 else
17662                         : far out
17663                         if $test X"$ivsize" = X"$shortsize"; then
17664                                 ivdformat='"hd"'
17665                                 uvuformat='"hu"'
17666                                 uvoformat='"ho"'
17667                                 uvxformat='"hx"'
17668                                 uvXUformat='"hX"'
17669                         fi
17670                 fi
17671         fi
17672 fi
17673
17674 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
17675         nveformat="$sPRIeldbl"
17676         nvfformat="$sPRIfldbl"
17677         nvgformat="$sPRIgldbl"
17678         nvEUformat="$sPRIEUldbl"
17679         nvFUformat="$sPRIFUldbl"
17680         nvGUformat="$sPRIGUldbl"
17681 else
17682         nveformat='"e"'
17683         nvfformat='"f"'
17684         nvgformat='"g"'
17685         nvEUformat='"E"'
17686         nvFUformat='"F"'
17687         nvGUformat='"G"'
17688 fi
17689
17690 case "$ivdformat" in
17691 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
17692     exit 1
17693     ;;
17694 esac
17695
17696
17697 echo " "
17698 $echo "Checking the format string to be used for gids..." >&4
17699
17700 case "$gidsign" in
17701 -1)     if $test X"$gidsize" = X"$ivsize"; then
17702                 gidformat="$ivdformat"
17703         else
17704                 if $test X"$gidsize" = X"$longsize"; then
17705                         gidformat='"ld"'
17706                 else
17707                         if $test X"$gidsize" = X"$intsize"; then
17708                                 gidformat='"d"'
17709                         else
17710                                 if $test X"$gidsize" = X"$shortsize"; then
17711                                         gidformat='"hd"'
17712                                 fi
17713                         fi
17714                 fi
17715         fi
17716         ;;
17717 *)      if $test X"$gidsize" = X"$uvsize"; then
17718                 gidformat="$uvuformat"
17719         else
17720                 if $test X"$gidsize" = X"$longsize"; then
17721                         gidformat='"lu"'
17722                 else
17723                         if $test X"$gidsize" = X"$intsize"; then
17724                                 gidformat='"u"'
17725                         else
17726                                 if $test X"$gidsize" = X"$shortsize"; then
17727                                         gidformat='"hu"'
17728                                 fi
17729                         fi
17730                 fi
17731         fi
17732         ;;
17733 esac
17734
17735 : see if getgroups exists
17736 set getgroups d_getgrps
17737 eval $inlibc
17738
17739 : see if setgroups exists
17740 set setgroups d_setgrps
17741 eval $inlibc
17742
17743
17744 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
17745 echo " "
17746 case "$d_getgrps$d_setgrps" in
17747 *define*)
17748         case "$groupstype" in
17749         '') dflt="$gidtype" ;;
17750         *)  dflt="$groupstype" ;;
17751         esac
17752         $cat <<EOM
17753 What type of pointer is the second argument to getgroups() and setgroups()?
17754 Usually this is the same as group ids, $gidtype, but not always.
17755
17756 EOM
17757         rp='What type pointer is the second argument to getgroups() and setgroups()?'
17758         . ./myread
17759         groupstype="$ans"
17760         ;;
17761 *)  groupstype="$gidtype";;
17762 esac
17763
17764 echo " "
17765 echo "Checking if your $make program sets \$(MAKE)..." >&4
17766 case "$make_set_make" in
17767 '')
17768         $sed 's/^X //' > testmake.mak << 'EOF'
17769 Xall:
17770 X       @echo 'maketemp="$(MAKE)"'
17771 EOF
17772         case "`$make -f testmake.mak 2>/dev/null`" in
17773         *maketemp=*) make_set_make='#' ;;
17774         *)      make_set_make="MAKE=$make" ;;
17775         esac
17776         $rm -f testmake.mak
17777         ;;
17778 esac
17779 case "$make_set_make" in
17780 '#') echo "Yup, it does.";;
17781 *) echo "Nope, it doesn't.";;
17782 esac
17783
17784 : see what type is used for mode_t
17785 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
17786 set mode_t modetype int stdio.h sys/types.h
17787 eval $typedef_ask
17788
17789 : see if stdarg is available
17790 echo " "
17791 if $test `./findhdr stdarg.h`; then
17792         echo "<stdarg.h> found." >&4
17793         valstd="$define"
17794 else
17795         echo "<stdarg.h> NOT found." >&4
17796         valstd="$undef"
17797 fi
17798
17799 : see if varags is available
17800 echo " "
17801 if $test `./findhdr varargs.h`; then
17802         echo "<varargs.h> found." >&4
17803 else
17804         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
17805 fi
17806
17807 : set up the varargs testing programs
17808 $cat > varargs.c <<EOP
17809 #ifdef I_STDARG
17810 #include <stdarg.h>
17811 #endif
17812 #ifdef I_VARARGS
17813 #include <varargs.h>
17814 #endif
17815
17816 #ifdef I_STDARG
17817 int f(char *p, ...)
17818 #else
17819 int f(va_alist)
17820 va_dcl
17821 #endif
17822 {
17823         va_list ap;
17824 #ifndef I_STDARG
17825         char *p;
17826 #endif
17827 #ifdef I_STDARG
17828         va_start(ap,p);
17829 #else
17830         va_start(ap);
17831         p = va_arg(ap, char *);
17832 #endif
17833         va_end(ap);
17834 }
17835 EOP
17836 $cat > varargs <<EOP
17837 $startsh
17838 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
17839         echo "true"
17840 else
17841         echo "false"
17842 fi
17843 $rm -f varargs$_o
17844 EOP
17845 chmod +x varargs
17846
17847 : now check which varargs header should be included
17848 echo " "
17849 i_varhdr=''
17850 case "$valstd" in
17851 "$define")
17852         if `./varargs I_STDARG`; then
17853                 val='stdarg.h'
17854         elif `./varargs I_VARARGS`; then
17855                 val='varargs.h'
17856         fi
17857         ;;
17858 *)
17859         if `./varargs I_VARARGS`; then
17860                 val='varargs.h'
17861         fi
17862         ;;
17863 esac
17864 case "$val" in
17865 '')
17866 echo "I could not find the definition for va_dcl... You have problems..." >&4
17867         val="$undef"; set i_stdarg; eval $setvar
17868         val="$undef"; set i_varargs; eval $setvar
17869         ;;
17870 *) 
17871         set i_varhdr
17872         eval $setvar
17873         case "$i_varhdr" in
17874         stdarg.h)
17875                 val="$define"; set i_stdarg; eval $setvar
17876                 val="$undef"; set i_varargs; eval $setvar
17877                 ;;
17878         varargs.h)
17879                 val="$undef"; set i_stdarg; eval $setvar
17880                 val="$define"; set i_varargs; eval $setvar
17881                 ;;
17882         esac
17883         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
17884 esac
17885 $rm -f varargs*
17886
17887 : see if we need va_copy
17888 echo " "
17889 case "$i_stdarg" in
17890 "$define")
17891         $cat >try.c <<EOCP
17892 #include <stdarg.h>
17893 #include <stdio.h>
17894 #$i_stdlib I_STDLIB
17895 #ifdef I_STDLIB
17896 #include <stdlib.h>
17897 #endif
17898 #include <signal.h>
17899
17900 int
17901 ivfprintf(FILE *f, const char *fmt, va_list *valp)
17902 {
17903   return vfprintf(f, fmt, *valp);
17904 }
17905  
17906 int    
17907 myvfprintf(FILE *f, const  char *fmt, va_list val)
17908 {
17909   return ivfprintf(f, fmt, &val);
17910 }
17911       
17912 int
17913 myprintf(char *fmt, ...) 
17914 {
17915   va_list val;
17916   va_start(val, fmt);
17917   return myvfprintf(stdout, fmt, val); 
17918 }         
17919
17920 int
17921 main(int ac, char **av)
17922 {
17923   signal(SIGSEGV, exit);
17924
17925   myprintf("%s%cs all right, then\n", "that", '\'');                            
17926   exit(0);      
17927 }
17928 EOCP
17929         set try
17930         if eval $compile && $run ./try 2>&1 >/dev/null; then
17931                 case "`$run ./try`" in
17932                 "that's all right, then")
17933                         okay=yes
17934                         ;;
17935                 esac
17936         fi
17937         case "$okay" in
17938         yes)    echo "It seems that you don't need va_copy()." >&4
17939                 need_va_copy="$undef"
17940                 ;;
17941         *)      echo "It seems that va_copy() or similar will be needed." >&4
17942                 need_va_copy="$define"
17943                 ;;
17944         esac
17945         $rm -f try.* core core.* *.core *.core.*
17946         ;;
17947 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
17948         ;;
17949 esac
17950
17951 : see what type is used for size_t
17952 rp="What is the type used for the length parameter for string functions?"
17953 set size_t sizetype 'unsigned int' stdio.h sys/types.h
17954 eval $typedef_ask
17955
17956 : check for type of arguments to gethostbyaddr. 
17957 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
17958         case "$d_gethbyaddr" in
17959         $define)
17960                 $cat <<EOM
17961
17962 Checking to see what type of arguments are accepted by gethostbyaddr().
17963 EOM
17964                 hdrs="$define sys/types.h
17965                         $d_socket sys/socket.h 
17966                         $i_niin netinet/in.h 
17967                         $i_netdb netdb.h
17968                         $i_unistd unistd.h"
17969                 : The first arg can 'char *' or 'void *'
17970                 : The second arg is some of integral type
17971                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
17972                         for yyy in size_t long int; do
17973                                 case "$netdb_host_type" in
17974                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
17975                                         if ./protochk "$try" $hdrs; then
17976                                                 echo "Your system accepts $xxx for the first arg."
17977                                                 echo "...and $yyy for the second arg."
17978                                                 netdb_host_type="$xxx"
17979                                                 netdb_hlen_type="$yyy"
17980                                         fi
17981                                         ;;
17982                                 esac
17983                         done
17984                 done
17985                 : In case none of those worked, prompt the user.
17986                 case "$netdb_host_type" in
17987                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
17988                         dflt='char *'
17989                         . ./myread
17990                         netdb_host_type=$ans
17991                         rp='What is the type for the 2nd argument to gethostbyaddr?'
17992                         dflt="$sizetype"
17993                         . ./myread
17994                         netdb_hlen_type=$ans
17995                         ;;
17996                 esac
17997                 ;;
17998         *)      : no gethostbyaddr, so pick harmless defaults
17999                 netdb_host_type='char *'
18000                 netdb_hlen_type="$sizetype"
18001                 ;;
18002         esac
18003         # Remove the "const" if needed. -- but then we'll have a 
18004         # prototype clash!
18005         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
18006 fi
18007
18008 : check for type of argument to gethostbyname. 
18009 if test "X$netdb_name_type" = X ; then
18010         case "$d_gethbyname" in
18011         $define)
18012                 $cat <<EOM
18013
18014 Checking to see what type of argument is accepted by gethostbyname().
18015 EOM
18016                 hdrs="$define sys/types.h
18017                         $d_socket sys/socket.h 
18018                         $i_niin netinet/in.h 
18019                         $i_netdb netdb.h
18020                         $i_unistd unistd.h"
18021                 for xxx in "const char *" "char *"; do
18022                         case "$netdb_name_type" in
18023                         '')     try="extern struct hostent *gethostbyname($xxx);"
18024                                 if ./protochk "$try" $hdrs; then
18025                                         echo "Your system accepts $xxx."
18026                                         netdb_name_type="$xxx"
18027                                 fi
18028                                 ;;
18029                         esac
18030                 done
18031                 : In case none of those worked, prompt the user.
18032                 case "$netdb_name_type" in
18033                 '')     rp='What is the type for the 1st argument to gethostbyname?'
18034                         dflt='char *'
18035                         . ./myread
18036                         netdb_name_type=$ans
18037                         ;;
18038                 esac
18039                 ;;
18040         *)      : no gethostbyname, so pick harmless default
18041                 netdb_name_type='char *'
18042                 ;;
18043         esac
18044 fi
18045
18046 : check for type of 1st argument to getnetbyaddr. 
18047 if test "X$netdb_net_type" = X ; then
18048         case "$d_getnbyaddr" in
18049         $define)
18050                 $cat <<EOM
18051
18052 Checking to see what type of 1st argument is accepted by getnetbyaddr().
18053 EOM
18054                 hdrs="$define sys/types.h
18055                         $d_socket sys/socket.h 
18056                         $i_niin netinet/in.h 
18057                         $i_netdb netdb.h
18058                         $i_unistd unistd.h"
18059                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
18060                         case "$netdb_net_type" in
18061                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
18062                                 if ./protochk "$try" $hdrs; then
18063                                         echo "Your system accepts $xxx."
18064                                         netdb_net_type="$xxx"
18065                                 fi
18066                                 ;;
18067                         esac
18068                 done
18069                 : In case none of those worked, prompt the user.
18070                 case "$netdb_net_type" in
18071                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
18072                         dflt='long'
18073                         . ./myread
18074                         netdb_net_type=$ans
18075                         ;;
18076                 esac
18077                 ;;
18078         *)      : no getnetbyaddr, so pick harmless default
18079                 netdb_net_type='long'
18080                 ;;
18081         esac
18082 fi
18083 : locate the preferred pager for this system
18084 case "$pager" in
18085 '')
18086         dflt=''
18087         case "$pg" in
18088         /*) dflt=$pg;;
18089         [a-zA-Z]:/*) dflt=$pg;;
18090         esac
18091         case "$more" in
18092         /*) dflt=$more;;
18093         [a-zA-Z]:/*) dflt=$more;;
18094         esac
18095         case "$less" in
18096         /*) dflt=$less;;
18097         [a-zA-Z]:/*) dflt=$less;;
18098         esac
18099         case "$dflt" in
18100         '') dflt=/usr/ucb/more;;
18101         esac
18102         ;;
18103 *) dflt="$pager";;
18104 esac
18105 echo " "
18106 fn=f/
18107 rp='What pager is used on your system?'
18108 . ./getfile
18109 pager="$ans"
18110
18111 : see what type pids are declared as in the kernel
18112 rp="What is the type of process ids on this system?"
18113 set pid_t pidtype int stdio.h sys/types.h
18114 eval $typedef_ask
18115
18116 : Find earliest binary compatible site_perl subdirectory perl can use.
18117 case "$bincompat5005" in
18118 "$define") xs_apiversion='5.005' ;;
18119 *) xs_apiversion=$version ;;   # The current site_perl version.
18120 esac
18121 : Find earliest pure perl site_perl subdirectory perl can use.
18122 : The versioned directories started at 5.005.
18123 pm_apiversion='5.005'
18124
18125 : see if ar generates random libraries by itself
18126 echo " "
18127 echo "Checking how to generate random libraries on your machine..." >&4
18128 echo 'int bar1() { return bar2(); }' > bar1.c
18129 echo 'int bar2() { return 2; }' > bar2.c
18130 $cat > foo.c <<'EOP'
18131 int main() { printf("%d\n", bar1()); exit(0); }
18132 EOP
18133 $cc $ccflags -c bar1.c >/dev/null 2>&1
18134 $cc $ccflags -c bar2.c >/dev/null 2>&1
18135 $cc $ccflags -c foo.c >/dev/null 2>&1
18136 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
18137 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
18138         $run ./foobar >/dev/null 2>&1; then
18139         echo "$ar appears to generate random libraries itself."
18140         orderlib=false
18141         ranlib=":"
18142 elif $ar ts bar$_a >/dev/null 2>&1 &&
18143         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
18144         $run ./foobar >/dev/null 2>&1; then
18145                 echo "a table of contents needs to be added with '$ar ts'."
18146                 orderlib=false
18147                 ranlib="$ar ts"
18148 else
18149         case "$ranlib" in
18150         :) ranlib='';;
18151         '')
18152                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
18153                 $test -f $ranlib || ranlib=''
18154                 ;;
18155         esac
18156         if $test -n "$ranlib"; then
18157                 echo "your system has '$ranlib'; we'll use that."
18158                 orderlib=false
18159         else
18160                 echo "your system doesn't seem to support random libraries"
18161                 echo "so we'll use lorder and tsort to order the libraries."
18162                 orderlib=true
18163                 ranlib=":"
18164         fi
18165 fi
18166 $rm -f foo* bar* 
18167
18168 : check for type of arguments to select. 
18169 case "$selecttype" in
18170 '') case "$d_select" in
18171         $define)
18172                 echo " "
18173                 $cat <<EOM
18174 Checking to see what type of arguments are accepted by select().
18175 EOM
18176                 hdrs="$define sys/types.h
18177                         $i_systime sys/time.h 
18178                         $i_sysselct sys/select.h
18179                         $d_socket sys/socket.h"
18180                 : The first arg can be int, unsigned, or size_t
18181                 : The last arg may or may not be 'const'
18182                 val=''
18183                 : void pointer has been seen but using that
18184                 : breaks the selectminbits test
18185                 for xxx in 'fd_set *' 'int *'; do
18186                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
18187                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
18188                                         case "$val" in
18189                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
18190                                                 if ./protochk "$try" $hdrs; then
18191                                                         echo "Your system accepts $xxx."
18192                                                         val="$xxx"
18193                                                 fi
18194                                                 ;;
18195                                         esac
18196                                 done
18197                         done
18198                 done
18199                 case "$val" in
18200                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
18201                         case "$d_fd_set" in
18202                                 $define) dflt="fd_set *" ;;
18203                                 *)              dflt="int *" ;;
18204                         esac
18205                         . ./myread
18206                         val=$ans
18207                         ;;
18208                 esac
18209                 selecttype="$val"
18210                 ;;
18211         *)      : no select, so pick a harmless default
18212                 selecttype='int *'
18213                 ;;
18214         esac
18215         ;;
18216 esac
18217
18218 : check for the select 'width'
18219 case "$selectminbits" in
18220 '') case "$d_select" in
18221         $define)
18222                 $cat <<EOM
18223
18224 Checking to see on how many bits at a time your select() operates...
18225 EOM
18226                 $cat >try.c <<EOCP
18227 #include <sys/types.h>
18228 #$i_time I_TIME
18229 #$i_systime I_SYS_TIME
18230 #$i_systimek I_SYS_TIME_KERNEL
18231 #ifdef I_TIME
18232 #   include <time.h>
18233 #endif
18234 #ifdef I_SYS_TIME
18235 #   ifdef I_SYS_TIME_KERNEL
18236 #       define KERNEL
18237 #   endif
18238 #   include <sys/time.h>
18239 #   ifdef I_SYS_TIME_KERNEL
18240 #       undef KERNEL
18241 #   endif
18242 #endif
18243 #$i_sysselct I_SYS_SELECT
18244 #ifdef I_SYS_SELECT
18245 #include <sys/select.h>
18246 #endif
18247 #$d_socket HAS_SOCKET
18248 #ifdef HAS_SOCKET
18249 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
18250 #endif
18251 #include <stdio.h>
18252 $selecttype b;
18253 #define S sizeof(*(b))
18254 #define MINBITS 64
18255 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
18256 #define NBITS  (NBYTES * 8)
18257 int main() {
18258     char s[NBYTES];
18259     struct timeval t;
18260     int i;
18261     FILE* fp;
18262     int fd;
18263
18264     fclose(stdin);
18265     fp = fopen("try.c", "r");
18266     if (fp == 0)
18267       exit(1);
18268     fd = fileno(fp);
18269     if (fd < 0)
18270       exit(2);
18271     b = ($selecttype)s;
18272     for (i = 0; i < NBITS; i++)
18273         FD_SET(i, b);
18274     t.tv_sec  = 0;
18275     t.tv_usec = 0;
18276     select(fd + 1, b, 0, 0, &t);
18277     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
18278     printf("%d\n", i + 1);
18279     return 0;
18280 }
18281 EOCP
18282                 set try
18283                 if eval $compile_ok; then
18284                         selectminbits=`$run ./try`
18285                         case "$selectminbits" in
18286                         '')     cat >&4 <<EOM
18287 Cannot figure out on how many bits at a time your select() operates.
18288 I'll play safe and guess it is 32 bits.
18289 EOM
18290                                 selectminbits=32
18291                                 bits="32 bits"
18292                                 ;;
18293                         1)      bits="1 bit" ;;
18294                         *)      bits="$selectminbits bits" ;;
18295                         esac
18296                         echo "Your select() operates on $bits at a time." >&4
18297                 else
18298                         rp='What is the minimum number of bits your select() operates on?'
18299                         case "$byteorder" in
18300                         1234|12345678)  dflt=32 ;;
18301                         *)              dflt=1  ;;
18302                         esac
18303                         . ./myread
18304                         val=$ans
18305                         selectminbits="$val"
18306                 fi
18307                 $rm -f try.* try
18308                 ;;
18309         *)      : no select, so pick a harmless default
18310                 selectminbits='32'
18311                 ;;
18312         esac
18313         ;;
18314 esac
18315
18316 : Trace out the files included by signal.h, then look for SIGxxx names.
18317 : Remove SIGARRAYSIZE used by HPUX.
18318 : Remove SIGSTKSIZE used by Linux.
18319 : Remove SIGSTKSZ used by Posix.
18320 : Remove SIGTYP void lines used by OS2.
18321 : Some cpps, like os390, dont give the file name anywhere
18322 if [ "X$fieldn" = X ]; then
18323         : Just make some guesses.  We check them later.
18324         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
18325 else
18326         xxx=`echo '#include <signal.h>' |
18327         $cppstdin $cppminus $cppflags 2>/dev/null |
18328         $grep '^[       ]*#.*include' | 
18329         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
18330 fi
18331 : Check this list of files to be sure we have parsed the cpp output ok.
18332 : This will also avoid potentially non-existent files, such 
18333 : as ../foo/bar.h
18334 xxxfiles=''
18335 for xx in $xxx /dev/null ; do
18336         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
18337 done
18338 : If we have found no files, at least try signal.h
18339 case "$xxxfiles" in
18340 '')     xxxfiles=`./findhdr signal.h` ;;
18341 esac
18342 xxx=`awk '
18343 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
18344         print substr($2, 4, 20)
18345 }
18346 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
18347         print substr($3, 4, 20)
18348 }' $xxxfiles`
18349 : Append some common names just in case the awk scan failed.
18350 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
18351 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
18352 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
18353 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
18354 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
18355
18356 : generate a few handy files for later
18357 $cat > signal.c <<'EOCP'
18358 #include <sys/types.h>
18359 #include <signal.h>
18360 #include <stdio.h>
18361 int main() {
18362
18363 /* Strange style to avoid deeply-nested #if/#else/#endif */
18364 #ifndef NSIG
18365 #  ifdef _NSIG
18366 #    define NSIG (_NSIG)
18367 #  endif
18368 #endif
18369
18370 #ifndef NSIG
18371 #  ifdef SIGMAX
18372 #    define NSIG (SIGMAX+1)
18373 #  endif
18374 #endif
18375
18376 #ifndef NSIG
18377 #  ifdef SIG_MAX
18378 #    define NSIG (SIG_MAX+1)
18379 #  endif
18380 #endif
18381
18382 #ifndef NSIG
18383 #  ifdef MAXSIG
18384 #    define NSIG (MAXSIG+1)
18385 #  endif
18386 #endif
18387
18388 #ifndef NSIG
18389 #  ifdef MAX_SIG
18390 #    define NSIG (MAX_SIG+1)
18391 #  endif
18392 #endif
18393
18394 #ifndef NSIG
18395 #  ifdef SIGARRAYSIZE
18396 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
18397 #  endif
18398 #endif
18399
18400 #ifndef NSIG
18401 #  ifdef _sys_nsig
18402 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
18403 #  endif
18404 #endif
18405
18406 /* Default to some arbitrary number that's big enough to get most
18407    of the common signals.
18408 */
18409 #ifndef NSIG
18410 #    define NSIG 50
18411 #endif
18412
18413 printf("NSIG %d\n", NSIG);
18414
18415 #ifndef JUST_NSIG
18416
18417 EOCP
18418
18419 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
18420 {
18421         printf "#ifdef SIG"; printf $1; printf "\n"
18422         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
18423         printf $1; printf ");\n"
18424         printf "#endif\n"
18425 }
18426 END {
18427         printf "#endif /* JUST_NSIG */\n";
18428         printf "exit(0);\n}\n";
18429 }
18430 ' >>signal.c
18431 $cat >signal.awk <<'EOP'
18432 BEGIN { ndups = 0 }
18433 $1 ~ /^NSIG$/ { nsig = $2 }
18434 ($1 !~ /^NSIG$/) && (NF == 2) {
18435     if ($2 > maxsig) { maxsig = $2 }
18436     if (sig_name[$2]) {
18437         dup_name[ndups] = $1
18438         dup_num[ndups] = $2
18439         ndups++ 
18440     }
18441     else {
18442         sig_name[$2] = $1
18443         sig_num[$2] = $2
18444     }
18445 }
18446 END { 
18447     if (nsig == 0) {
18448         nsig = maxsig + 1
18449     }
18450     printf("NSIG %d\n", nsig);
18451     for (n = 1; n < nsig; n++) {
18452         if (sig_name[n]) {
18453             printf("%s %d\n", sig_name[n], sig_num[n])
18454         }
18455         else {
18456             printf("NUM%d %d\n", n, n) 
18457         }
18458     }
18459     for (n = 0; n < ndups; n++) {
18460         printf("%s %d\n", dup_name[n], dup_num[n])
18461     }
18462 }
18463 EOP
18464 $cat >signal_cmd <<EOS
18465 $startsh
18466 if $test -s signal.lst; then
18467     echo "Using your existing signal.lst file"
18468         exit 0
18469 fi
18470 xxx="$xxx"
18471 EOS
18472 $cat >>signal_cmd <<'EOS'
18473
18474 set signal
18475 if eval $compile_ok; then
18476         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
18477 else
18478         echo "(I can't seem be able to compile the whole test program)" >&4
18479         echo "(I'll try it in little pieces.)" >&4
18480         set signal -DJUST_NSIG
18481         if eval $compile_ok; then
18482                 $run ./signal$_exe > signal.nsg
18483                 $cat signal.nsg
18484         else
18485                 echo "I can't seem to figure out how many signals you have." >&4
18486                 echo "Guessing 50." >&4
18487                 echo 'NSIG 50' > signal.nsg
18488         fi
18489         : Now look at all the signal names, one at a time.
18490         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
18491                 $cat > signal.c <<EOCP
18492 #include <sys/types.h>
18493 #include <signal.h>
18494 #include <stdio.h>
18495 int main() {
18496 printf("$xx %d\n", SIG${xx});
18497 return 0;
18498 }
18499 EOCP
18500                 set signal
18501                 if eval $compile; then
18502                         echo "SIG${xx} found."
18503                         $run ./signal$_exe  >> signal.ls1
18504                 else
18505                         echo "SIG${xx} NOT found."
18506                 fi
18507         done
18508         if $test -s signal.ls1; then
18509                 $cat signal.nsg signal.ls1 |
18510                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
18511         fi
18512
18513 fi
18514 if $test -s signal.lst; then
18515         :
18516 else
18517         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
18518         echo 'kill -l' >signal
18519         set X `csh -f <signal`
18520         $rm -f signal
18521         shift
18522         case $# in
18523         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
18524         esac
18525         echo $@ | $tr ' ' $trnl | \
18526             $awk '{ printf "%s %d\n", $1, ++s; }
18527                   END { printf "NSIG %d\n", ++s }' >signal.lst
18528 fi
18529 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
18530 EOS
18531 chmod a+x signal_cmd
18532 $eunicefix signal_cmd
18533
18534 : generate list of signal names
18535 echo " "
18536 case "$sig_name_init" in
18537 '') doinit=yes ;;
18538 *)  case "$sig_num_init" in
18539     ''|*,*) doinit=yes ;;
18540     esac ;;
18541 esac
18542 case "$doinit" in
18543 yes)
18544         echo "Generating a list of signal names and numbers..." >&4
18545         . ./signal_cmd
18546         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
18547         sig_name=`$awk 'BEGIN { printf "ZERO " }
18548                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
18549         sig_num=`$awk  'BEGIN { printf "0 " }
18550                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
18551         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
18552                              !/^NSIG/   { printf "\"%s\", ", $1 }
18553                              END        { printf "0\n" }' signal.lst`
18554         sig_num_init=`$awk  'BEGIN      { printf "0, " }
18555                              !/^NSIG/   { printf "%d, ", $2}
18556                              END        { printf "0\n"}' signal.lst`
18557         ;;
18558 esac
18559 echo "The following $sig_count signals are available:"
18560 echo " "
18561 echo $sig_name | $awk \
18562 'BEGIN { linelen = 0 }
18563 {
18564         for (i = 1; i <= NF; i++) {
18565                 name = "SIG" $i " "
18566                 linelen = linelen + length(name)
18567                 if (linelen > 70) {
18568                         printf "\n"
18569                         linelen = length(name)
18570                 }
18571                 printf "%s", name
18572         }
18573         printf "\n"
18574 }'
18575 sig_size=`echo $sig_name | awk '{print NF}'`
18576 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
18577
18578 echo " "
18579 case "$sizetype" in
18580 *_t) zzz="$sizetype"    ;;
18581 *)   zzz="filesize"     ;;
18582 esac
18583 echo "Checking the size of $zzz..." >&4 
18584 cat > try.c <<EOCP
18585 #include <sys/types.h>
18586 #include <stdio.h>
18587 int main() {
18588     printf("%d\n", (int)sizeof($sizetype));
18589     exit(0);
18590 }
18591 EOCP
18592 set try
18593 if eval $compile_ok; then
18594         yyy=`$run ./try`
18595         case "$yyy" in
18596         '')     sizesize=4
18597                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
18598                 ;;
18599         *)      sizesize=$yyy
18600                 echo "Your $zzz size is $sizesize bytes."
18601                 ;;
18602         esac
18603 else
18604         sizesize=4
18605         echo "(I can't compile the test program--guessing $sizesize.)" >&4
18606 fi
18607
18608
18609 : check for socklen_t
18610 echo " "
18611 echo "Checking to see if you have socklen_t..." >&4
18612 $cat >try.c <<EOCP
18613 #include <sys/types.h>
18614 #$d_socket HAS_SOCKET
18615 #ifdef HAS_SOCKET
18616 #include <sys/socket.h>
18617 #endif
18618 int main() { socklen_t x = 16; }
18619 EOCP
18620 set try
18621 if eval $compile; then
18622         val="$define"
18623         echo "You have socklen_t."
18624 else
18625         val="$undef"
18626         echo "You do not have socklen_t."
18627         case "$sizetype" in
18628         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
18629         esac
18630 fi
18631 $rm -f try try.*
18632 set d_socklen_t
18633 eval $setvar
18634
18635 : see if this is a socks.h system
18636 set socks.h i_socks
18637 eval $inhdr
18638
18639 : check for type of the size argument to socket calls
18640 case "$d_socket" in
18641 "$define")
18642         $cat <<EOM
18643
18644 Checking to see what type is the last argument of accept().
18645 EOM
18646         yyy=''
18647         case "$d_socklen_t" in
18648         "$define") yyy="$yyy socklen_t"
18649         esac
18650         yyy="$yyy $sizetype int long unsigned"
18651         for xxx in $yyy; do
18652                 case "$socksizetype" in
18653                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
18654                         case "$usesocks" in
18655                         "$define")
18656                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
18657                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18658                                         socksizetype="$xxx"
18659                                 fi
18660                                 ;;
18661                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
18662                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18663                                         socksizetype="$xxx"
18664                                 fi
18665                                 ;;
18666                         esac
18667                         ;;
18668                 esac
18669         done
18670 : In case none of those worked, prompt the user.
18671         case "$socksizetype" in
18672         '')     rp='What is the type for socket address structure sizes?'
18673                 dflt='int'
18674                 . ./myread
18675                 socksizetype=$ans
18676                 ;;
18677         esac
18678         ;;
18679 *)      : no sockets, so pick relatively harmless default
18680         socksizetype='int'
18681         ;;
18682 esac
18683
18684 : see what type is used for signed size_t
18685 set ssize_t ssizetype int stdio.h sys/types.h
18686 eval $typedef
18687 dflt="$ssizetype"
18688 $cat > try.c <<EOM
18689 #include <stdio.h>
18690 #include <sys/types.h>
18691 #define Size_t $sizetype
18692 #define SSize_t $dflt
18693 int main()
18694 {
18695         if (sizeof(Size_t) == sizeof(SSize_t))
18696                 printf("$dflt\n");
18697         else if (sizeof(Size_t) == sizeof(int))
18698                 printf("int\n");
18699         else 
18700                 printf("long\n");
18701         exit(0);
18702 }
18703 EOM
18704 echo " "
18705 set try
18706 if eval $compile_ok && $run ./try > /dev/null; then
18707         ssizetype=`$run ./try`
18708         echo "I'll be using $ssizetype for functions returning a byte count." >&4
18709 else
18710         $cat >&4 <<EOM
18711 Help! I can't compile and run the ssize_t test program: please enlighten me!
18712 (This is probably a misconfiguration in your system or libraries, and
18713 you really ought to fix it.  Still, I'll try anyway.)
18714
18715 I need a type that is the same size as $sizetype, but is guaranteed to
18716 be signed.  Common values are ssize_t, int and long.
18717
18718 EOM
18719         rp="What signed type is the same size as $sizetype?"
18720         . ./myread
18721         ssizetype="$ans"
18722 fi
18723 $rm -f try try.*
18724
18725 : see what type of char stdio uses.
18726 echo " "
18727 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
18728 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
18729         echo "Your stdio uses unsigned chars." >&4
18730         stdchar="unsigned char"
18731 else
18732         echo "Your stdio uses signed chars." >&4
18733         stdchar="char"
18734 fi
18735 $rm -f stdioh
18736
18737
18738
18739 : see if time exists
18740 echo " "
18741 if test "X$d_time" = X -o X"$timetype" = X; then
18742     if set time val -f d_time; eval $csym; $val; then
18743                 echo 'time() found.' >&4
18744                 val="$define"
18745                 rp="What is the type returned by time() on this system?"
18746                 set time_t timetype long stdio.h sys/types.h
18747                 eval $typedef_ask
18748     else
18749                 echo 'time() not found, hope that will do.' >&4
18750                 val="$undef"
18751                 timetype='int';
18752     fi
18753     set d_time
18754     eval $setvar
18755 fi
18756
18757 : see what type uids are declared as in the kernel
18758 echo " "
18759 echo "Looking for the type for user ids returned by getuid()."
18760 set uid_t uidtype xxx stdio.h sys/types.h
18761 eval $typedef
18762 case "$uidtype" in
18763 xxx)
18764         xxx=`./findhdr sys/user.h`
18765         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18766         case $1 in
18767         unsigned) dflt="$1 $2" ;;
18768         *) dflt="$1" ;;
18769         esac
18770         ;;
18771 *) dflt="$uidtype";;
18772 esac
18773 case "$uidtype" in
18774 uid_t)  echo "uid_t found." ;;
18775 *)      rp="What is the type for user ids returned by getuid()?"
18776         . ./myread
18777         uidtype="$ans"
18778         ;;
18779 esac
18780
18781 echo " "
18782 case "$uidtype" in
18783 *_t) zzz="$uidtype"     ;;
18784 *)   zzz="uid"          ;;
18785 esac
18786 echo "Checking the size of $zzz..." >&4 
18787 cat > try.c <<EOCP
18788 #include <sys/types.h>
18789 #include <stdio.h>
18790 int main() {
18791     printf("%d\n", (int)sizeof($uidtype));
18792     exit(0);
18793 }
18794 EOCP
18795 set try
18796 if eval $compile_ok; then
18797         yyy=`$run ./try`
18798         case "$yyy" in
18799         '')     uidsize=4
18800                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
18801                 ;;
18802         *)      uidsize=$yyy
18803                 echo "Your $zzz is $uidsize bytes long."
18804                 ;;
18805         esac
18806 else
18807         uidsize=4
18808         echo "(I can't compile the test program--guessing $uidsize.)" >&4
18809 fi
18810
18811 echo " "
18812 case "$uidtype" in
18813 *_t) zzz="$uidtype"     ;;
18814 *)   zzz="uid"          ;;
18815 esac
18816 echo "Checking the sign of $zzz..." >&4
18817 cat > try.c <<EOCP
18818 #include <sys/types.h>
18819 #include <stdio.h>
18820 int main() {
18821         $uidtype foo = -1;
18822         if (foo < 0)
18823                 printf("-1\n");
18824         else
18825                 printf("1\n");
18826 }
18827 EOCP
18828 set try
18829 if eval $compile; then
18830         yyy=`$run ./try`
18831         case "$yyy" in
18832         '')     uidsign=1
18833                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18834                 ;;
18835         *)      uidsign=$yyy
18836                 case "$uidsign" in
18837                  1) echo "Your $zzz is unsigned." ;;
18838                 -1) echo "Your $zzz is signed."   ;;
18839                 esac
18840                 ;;
18841         esac
18842 else
18843         uidsign=1
18844         echo "(I can't compile the test program--guessing unsigned.)" >&4
18845 fi
18846
18847
18848
18849 echo " "
18850 $echo "Checking the format string to be used for uids..." >&4
18851
18852 case "$uidsign" in
18853 -1)     if $test X"$uidsize" = X"$ivsize"; then
18854                 uidformat="$ivdformat"
18855         else
18856                 if $test X"$uidsize" = X"$longsize"; then
18857                         uidformat='"ld"'
18858                 else
18859                         if $test X"$uidsize" = X"$intsize"; then
18860                                 uidformat='"d"'
18861                         else
18862                                 if $test X"$uidsize" = X"$shortsize"; then
18863                                         uidformat='"hd"'
18864                                 fi
18865                         fi
18866                 fi
18867         fi
18868         ;;
18869 *)      if $test X"$uidsize" = X"$uvsize"; then
18870                 uidformat="$uvuformat"
18871         else
18872                 if $test X"$uidsize" = X"$longsize"; then
18873                         uidformat='"lu"'
18874                 else
18875                         if $test X"$uidsize" = X"$intsize"; then
18876                                 uidformat='"u"'
18877                         else
18878                                 if $test X"$uidsize" = X"$shortsize"; then
18879                                         uidformat='"hu"'
18880                                 fi
18881                         fi
18882                 fi
18883         fi
18884         ;;
18885 esac
18886
18887 : determine compiler compiler
18888 case "$yacc" in
18889 '')
18890         dflt=yacc;;
18891 *)
18892         dflt="$yacc";;
18893 esac
18894 echo " "
18895 comp='yacc'
18896 if $test -f "$byacc$_exe"; then
18897         dflt="$byacc"
18898         comp="byacc or $comp"
18899 fi
18900 if $test -f "$bison$_exe"; then
18901         comp="$comp or bison -y"
18902 fi
18903 rp="Which compiler compiler ($comp) shall I use?"
18904 . ./myread
18905 yacc="$ans"
18906 case "$yacc" in
18907 *bis*)
18908         case "$yacc" in
18909         *-y*) ;;
18910         *)
18911                 yacc="$yacc -y"
18912                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
18913                 ;;
18914         esac
18915         ;;
18916 esac
18917
18918 : see if this is a fp.h system
18919 set fp.h i_fp
18920 eval $inhdr
18921
18922 : see if this is a fp_class.h system
18923 set fp_class.h i_fp_class
18924 eval $inhdr
18925
18926 : see if this is a ieeefp.h system
18927 case "$i_ieeefp" in
18928 '' ) set ieeefp.h i_ieeefp
18929      eval $inhdr
18930      ;;
18931 esac
18932
18933 : see if this is a libutil.h system
18934 set libutil.h i_libutil
18935 eval $inhdr
18936
18937 : see if mach cthreads are available
18938 if test "X$usethreads" = "X$define"; then
18939         set mach/cthreads.h i_machcthr
18940         eval $inhdr
18941 else
18942         i_machcthr="$undef"
18943 fi
18944
18945
18946
18947 : see if this is a math.h system
18948 set math.h i_math
18949 eval $inhdr
18950
18951 : see if this is a mntent.h system
18952 set mntent.h i_mntent
18953 eval $inhdr
18954
18955 : see if ndbm.h is available
18956 set ndbm.h t_ndbm
18957 eval $inhdr
18958
18959 case "$t_ndbm" in
18960 $undef)
18961     # Some Linux distributions such as RedHat 7.1 put the
18962     # ndbm.h header in /usr/include/gdbm/ndbm.h.
18963     if $test -f /usr/include/gdbm/ndbm.h; then
18964         echo '<gdbm/ndbm.h> found.'
18965         ccflags="$ccflags -I/usr/include/gdbm"
18966         cppflags="$cppflags -I/usr/include/gdbm"
18967         t_ndbm=$define
18968     fi
18969     ;;
18970 esac
18971
18972 case "$t_ndbm" in
18973 $define)
18974         : see if dbm_open exists
18975         set dbm_open d_dbm_open
18976         eval $inlibc
18977         case "$d_dbm_open" in
18978         $undef)
18979                 t_ndbm="$undef"
18980                 echo "We won't be including <ndbm.h>"
18981                 ;;
18982         esac
18983         ;;
18984 esac
18985 val="$t_ndbm"
18986 set i_ndbm
18987 eval $setvar
18988
18989 : see if net/errno.h is available
18990 val=''
18991 set net/errno.h val
18992 eval $inhdr
18993
18994 : Unfortunately, it causes problems on some systems.  Arrgh.
18995 case "$val" in
18996 $define)
18997         cat > try.c <<'EOM'
18998 #include <stdio.h>
18999 #include <errno.h>
19000 #include <net/errno.h>
19001 int func()
19002 {
19003         return ENOTSOCK;
19004 }
19005 EOM
19006         if $cc $ccflags -c try.c >/dev/null 2>&1; then
19007                 echo "We'll be including <net/errno.h>." >&4
19008         else
19009                 echo "We won't be including <net/errno.h>." >&4
19010                 val="$undef"
19011         fi
19012         $rm -f try.* try
19013         ;;
19014 esac
19015 set i_neterrno
19016 eval $setvar
19017
19018 : see if netinet/tcp.h is available
19019 set netinet/tcp.h i_netinettcp
19020 eval $inhdr
19021
19022 : see if this is a poll.h system
19023 set poll.h i_poll
19024 eval $inhdr
19025
19026 : see if this is a prot.h system
19027 set prot.h i_prot
19028 eval $inhdr
19029
19030 echo " "
19031 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
19032 $cat <<'EOSH' > Cppsym.know
19033 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
19034 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
19035 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
19036 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
19037 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
19038 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
19039 bull c cadmus clipper CMU COFF COMPILER_VERSION
19040 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
19041 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
19042 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
19043 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
19044 GLIBC GLIBC_MINOR
19045 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
19046 H3050R H3050RX hbullx20 hcx host_mips
19047 hp200 hp300 hp700 HP700 hp800 hp9000
19048 hp9000s200 hp9000s300 hp9000s400 hp9000s500
19049 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
19050 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
19051 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
19052 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
19053 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
19054 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
19055 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
19056 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
19057 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
19058 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
19059 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
19060 MATH_HAS_NO_SIDE_EFFECTS
19061 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
19062 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
19063 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
19064 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
19065 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
19066 NetBSD news1500 news1700 news1800 news1900 news3700
19067 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
19068 ns32016 ns32332 ns32k nsc32000
19069 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
19070 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
19071 pc532 pdp11 PGC PIC plexus PORTAR posix
19072 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
19073 POSIX_C_SOURCE POSIX_SOURCE POWER
19074 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
19075 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
19076 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
19077 sony sony_news sonyrisc sparc sparclite spectrum
19078 stardent stdc STDC_EXT stratos sun sun3 sun386
19079 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
19080 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
19081 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
19082 sysV68 sysV88 Tek4132 Tek4300 titan
19083 TM3200 TM5400 TM5600
19084 tower tower32 tower32_200 tower32_600 tower32_700
19085 tower32_800 tower32_850 tss
19086 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
19087 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
19088 unix UNIX95 UNIX99 unixpc unos
19089 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
19090 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
19091 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
19092 USGr4 USGr4_2
19093 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
19094 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
19095 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
19096 z8000
19097 EOSH
19098 # Maybe put other stuff here too.
19099 cat <<EOSH >>Cppsym.know
19100 $osname
19101 EOSH
19102 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
19103 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
19104 $cat Cppsym.know > Cppsym.c
19105 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
19106 $rm -f Cppsym.a Cppsym.b Cppsym.c
19107 cat <<EOSH > Cppsym
19108 $startsh
19109 if $test \$# -gt 0; then
19110     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
19111     if $test -s Cppsym.got; then
19112         $rm -f Cppsym.got
19113         exit 0
19114     fi
19115     $rm -f Cppsym.got
19116     exit 1
19117 else
19118     $tr " " "$trnl" | ./Cppsym.try
19119     exit 0
19120 fi
19121 EOSH
19122 chmod +x Cppsym
19123 $eunicefix Cppsym
19124 cat <<EOSH > Cppsym.try
19125 $startsh
19126 cat <<'EOCP' > try.c
19127 #include <stdio.h>
19128 int main() {
19129 EOCP
19130 $awk \\
19131 EOSH
19132 cat <<'EOSH' >> Cppsym.try
19133 'length($1) > 0 {
19134     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
19135     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
19136     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
19137     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
19138 }'       >> try.c
19139 echo 'return 0;}' >> try.c
19140 EOSH
19141 cat <<EOSH >> Cppsym.try
19142 ccflags="$ccflags"
19143 case "$osname-$gccversion" in
19144 irix-) ccflags="\$ccflags -woff 1178" ;;
19145 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
19146 esac
19147 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
19148 EOSH
19149 chmod +x Cppsym.try
19150 $eunicefix Cppsym.try
19151 ./Cppsym < Cppsym.know > Cppsym.true
19152 : now check the C compiler for additional symbols
19153 postprocess_cc_v=''
19154 case "$osname" in
19155 aix) postprocess_cc_v="|$tr , ' '" ;;
19156 esac
19157 $cat >ccsym <<EOS
19158 $startsh
19159 $cat >tmp.c <<EOF
19160 extern int foo;
19161 EOF
19162 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
19163 do
19164         case "\$i" in
19165         -D*) echo "\$i" | $sed 's/^-D//';;
19166         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
19167         esac
19168 done
19169 $rm -f try.c
19170 EOS
19171 postprocess_cc_v=''
19172 chmod +x ccsym
19173 $eunicefix ccsym
19174 ./ccsym > ccsym1.raw
19175 if $test -s ccsym1.raw; then
19176        $sort ccsym1.raw | $uniq >ccsym.raw
19177 else
19178        mv ccsym1.raw ccsym.raw
19179 fi
19180
19181 $awk '/\=/ { print $0; next }
19182         { print $0"=1" }' ccsym.raw >ccsym.list
19183 $awk '/\=/ { print $0; next }
19184         { print $0"=1" }' Cppsym.true >ccsym.true
19185 $comm -13 ccsym.true ccsym.list >ccsym.own
19186 $comm -12 ccsym.true ccsym.list >ccsym.com
19187 $comm -23 ccsym.true ccsym.list >ccsym.cpp
19188 also=''
19189 if $test -z ccsym.raw; then
19190         echo "Your C compiler doesn't seem to define any symbols!" >&4
19191         echo " "
19192         echo "However, your C preprocessor defines the following symbols:"
19193         $cat Cppsym.true
19194         ccsymbols=''
19195         cppsymbols=`$cat Cppsym.true`
19196         cppsymbols=`echo $cppsymbols`
19197         cppccsymbols="$cppsymbols"
19198 else
19199         if $test -s ccsym.com; then
19200                 echo "Your C compiler and pre-processor define these symbols:"
19201                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
19202                 also='also '
19203                 symbols='ones'
19204                 cppccsymbols=`$cat ccsym.com`
19205                 cppccsymbols=`echo $cppccsymbols`
19206                 $test "$silent" || sleep 1
19207         fi
19208         if $test -s ccsym.cpp; then
19209                 $test "$also" && echo " "
19210                 echo "Your C pre-processor ${also}defines the following symbols:"
19211                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
19212                 also='further '
19213                 cppsymbols=`$cat ccsym.cpp`
19214                 cppsymbols=`echo $cppsymbols`
19215                 $test "$silent" || sleep 1
19216         fi
19217         if $test -s ccsym.own; then
19218                 $test "$also" && echo " "
19219                 echo "Your C compiler ${also}defines the following cpp symbols:"
19220                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
19221                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
19222                 ccsymbols=`$cat ccsym.own`
19223                 ccsymbols=`echo $ccsymbols`
19224                 $test "$silent" || sleep 1
19225         fi
19226 fi
19227
19228 : see if this is a termio system
19229 val="$undef"
19230 val2="$undef"
19231 val3="$undef"
19232 if $test `./findhdr termios.h`; then
19233         set tcsetattr i_termios
19234         eval $inlibc
19235         val3="$i_termios"
19236 fi
19237 echo " "
19238 case "$val3" in
19239 "$define") echo "You have POSIX termios.h... good!" >&4;;
19240 *) if ./Cppsym pyr; then
19241                 case "`/bin/universe`" in
19242                 ucb) if $test `./findhdr sgtty.h`; then
19243                                 val2="$define"
19244                                 echo "<sgtty.h> found." >&4
19245                         else
19246                                 echo "System is pyramid with BSD universe."
19247                                 echo "<sgtty.h> not found--you could have problems." >&4
19248                         fi;;
19249                 *) if $test `./findhdr termio.h`; then
19250                                 val="$define"
19251                                 echo "<termio.h> found." >&4
19252                         else
19253                                 echo "System is pyramid with USG universe."
19254                                 echo "<termio.h> not found--you could have problems." >&4
19255                         fi;;
19256                 esac
19257         elif ./usg; then
19258                 if $test `./findhdr termio.h`; then
19259                         echo "<termio.h> found." >&4
19260                         val="$define"
19261                 elif $test `./findhdr sgtty.h`; then
19262                         echo "<sgtty.h> found." >&4
19263                         val2="$define"
19264                 else
19265 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
19266                 fi
19267         else
19268                 if $test `./findhdr sgtty.h`; then
19269                         echo "<sgtty.h> found." >&4
19270                         val2="$define"
19271                 elif $test `./findhdr termio.h`; then
19272                         echo "<termio.h> found." >&4
19273                         val="$define"
19274                 else
19275 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
19276                 fi
19277         fi;;
19278 esac
19279 set i_termio; eval $setvar
19280 val=$val2; set i_sgtty; eval $setvar
19281 val=$val3; set i_termios; eval $setvar
19282
19283 : see if stddef is available
19284 set stddef.h i_stddef
19285 eval $inhdr
19286
19287 : see if this is a sunmath.h system
19288 set sunmath.h i_sunmath
19289 eval $inhdr
19290
19291 : see if sys/access.h is available
19292 set sys/access.h i_sysaccess
19293 eval $inhdr
19294
19295 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
19296 set sys/filio.h i_sysfilio
19297 eval $inhdr
19298 echo " "
19299 if $test `./findhdr sys/ioctl.h`; then
19300         val="$define"
19301         echo '<sys/ioctl.h> found.' >&4
19302 else
19303         val="$undef"
19304         if $test $i_sysfilio = "$define"; then
19305             echo '<sys/ioctl.h> NOT found.' >&4
19306         else
19307                 $test $i_sgtty = "$define" && xxx="sgtty.h"
19308                 $test $i_termio = "$define" && xxx="termio.h"
19309                 $test $i_termios = "$define" && xxx="termios.h"
19310 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
19311         fi
19312 fi
19313 set i_sysioctl
19314 eval $setvar
19315
19316 : see if socket ioctl defs are in sys/sockio.h
19317 echo " "
19318 xxx=`./findhdr sys/sockio.h`
19319 if $test "$xxx"; then
19320         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
19321                 val="$define"
19322                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
19323         else
19324                 val="$undef"
19325                 echo "No socket ioctls found in <sys/sockio.h>." >&4
19326         fi
19327 else
19328         val="$undef"
19329         $cat <<EOM
19330 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
19331 EOM
19332 fi
19333 set i_syssockio
19334 eval $setvar
19335
19336
19337 : see if this is a syslog.h system
19338 set syslog.h i_syslog
19339 eval $inhdr
19340
19341
19342 : see if this is a sys/mode.h system
19343 set sys/mode.h i_sysmode
19344 eval $inhdr
19345
19346 : see if sys/resource.h has to be included
19347 set sys/resource.h i_sysresrc
19348 eval $inhdr
19349
19350 : see if sys/security.h is available
19351 set sys/security.h i_syssecrt
19352 eval $inhdr
19353
19354 : see if this is a sys/statvfs.h system
19355 set sys/statvfs.h i_sysstatvfs
19356 eval $inhdr
19357
19358 : see if this is a sys/un.h system
19359 set sys/un.h i_sysun
19360 eval $inhdr
19361
19362
19363 : see if this is a sys/utsname.h system
19364 set sys/utsname.h i_sysutsname
19365 eval $inhdr
19366
19367 : see if this is a syswait system
19368 set sys/wait.h i_syswait
19369 eval $inhdr
19370
19371 : see if this is a ustat.h system
19372 set ustat.h i_ustat
19373 eval $inhdr
19374
19375 : see if this is an utime system
19376 set utime.h i_utime
19377 eval $inhdr
19378
19379 : see if this is a values.h system
19380 set values.h i_values
19381 eval $inhdr
19382
19383 : see if this is a vfork system
19384 case "$d_vfork" in
19385 "$define")
19386         set vfork.h i_vfork
19387         eval $inhdr
19388         ;;
19389 *)
19390         i_vfork="$undef"
19391         ;;
19392 esac
19393
19394 : see if gdbm.h is available
19395 set gdbm.h t_gdbm
19396 eval $inhdr
19397 case "$t_gdbm" in
19398 $define)
19399         : see if gdbm_open exists
19400         set gdbm_open d_gdbm_open
19401         eval $inlibc
19402         case "$d_gdbm_open" in
19403         $undef)
19404                 t_gdbm="$undef"
19405                 echo "We won't be including <gdbm.h>"
19406                 ;;
19407         esac
19408         ;;
19409 esac
19410 val="$t_gdbm"
19411 set i_gdbm
19412 eval $setvar
19413
19414 echo " "
19415 echo "Looking for extensions..." >&4
19416 : If we are using the old config.sh, known_extensions may contain
19417 : old or inaccurate or duplicate values.
19418 known_extensions=''
19419 nonxs_extensions=''
19420 : We do not use find because it might not be available.
19421 : We do not just use MANIFEST because the user may have dropped
19422 : some additional extensions into the source tree and expect them
19423 : to be built.
19424
19425 : Function to recursively find available extensions, ignoring DynaLoader
19426 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
19427 find_extensions='
19428     for xxx in *; do
19429        case "$xxx" in
19430            DynaLoader|dynaload) ;;
19431            *)
19432            if $test -f $xxx/$xxx.xs; then
19433                known_extensions="$known_extensions $1$xxx";
19434            elif $test -f $xxx/Makefile.PL; then
19435                nonxs_extensions="$nonxs_extensions $1$xxx";
19436            else
19437                if $test -d $xxx -a $# -lt 10; then
19438                    set $1$xxx/ $*;
19439                    cd "$xxx";
19440                    eval $find_extensions;
19441                    cd ..;
19442                    shift;
19443                fi;
19444            fi
19445            ;;
19446        esac;
19447     done'
19448 tdir=`pwd`
19449 cd "$rsrc/ext"
19450 set X
19451 shift
19452 eval $find_extensions
19453 # Special case:  Add in threads/shared since it is not picked up by the
19454 # recursive find above (and adding in general recursive finding breaks
19455 # SDBM_File/sdbm).  A.D.  10/25/2001.
19456 known_extensions="$known_extensions threads/shared"
19457 set X $nonxs_extensions
19458 shift
19459 nonxs_extensions="$*"
19460 set X $known_extensions
19461 shift
19462 known_extensions="$*"
19463 cd "$tdir"
19464
19465 : Now see which are supported on this system.
19466 avail_ext=''
19467 for xxx in $known_extensions ; do
19468         case "$xxx" in
19469         DB_File|db_file)
19470                 case "$i_db" in
19471                 $define) avail_ext="$avail_ext $xxx" ;;
19472                 esac
19473                 ;;
19474         GDBM_File|gdbm_fil)
19475                 case "$i_gdbm" in 
19476                 $define) avail_ext="$avail_ext $xxx" ;;
19477                 esac
19478                 ;;
19479         I18N/Langinfo|i18n_lan)
19480                 case "$i_langinfo$d_nl_langinfo" in 
19481                 $define$define) avail_ext="$avail_ext $xxx" ;;
19482                 esac
19483                 ;;
19484         NDBM_File|ndbm_fil)
19485                 case "$i_ndbm" in
19486                 $define)
19487                     case "$osname-$use64bitint" in
19488                     cygwin-*|hpux-define)
19489                         case "$libs" in
19490                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
19491                         esac
19492                         ;;
19493                     *) avail_ext="$avail_ext $xxx" ;;
19494                     esac
19495                     ;;
19496                 esac
19497                 ;;
19498         ODBM_File|odbm_fil) 
19499                 case "${i_dbm}${i_rpcsvcdbm}" in
19500                 *"${define}"*)
19501                     case "$osname-$use64bitint" in
19502                     cygwin-*|hpux-define)
19503                         case "$libs" in
19504                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
19505                         esac
19506                         ;;
19507                     *) avail_ext="$avail_ext $xxx" ;;
19508                     esac
19509                     ;;
19510                 esac
19511                 ;;
19512         POSIX|posix)
19513                 case "$useposix" in
19514                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19515                 esac
19516                 ;;
19517         Opcode|opcode)
19518                 case "$useopcode" in
19519                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19520                 esac
19521                 ;;
19522         Socket|socket)
19523                 case "$d_socket" in 
19524                 true|$define|y)
19525                     case "$osname" in
19526                     beos) ;; # not unless BONE
19527                     *) avail_ext="$avail_ext $xxx" ;;
19528                     esac
19529                     ;;
19530                 esac
19531                 ;;
19532         Sys/Syslog|sys/syslog)
19533                 : XXX syslog requires socket
19534                 case "$d_socket" in 
19535                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
19536                 esac
19537                 ;;
19538         Thread|thread)
19539                 case "$usethreads" in
19540                 true|$define|y)
19541                         case "$useithreads" in
19542                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
19543                         esac
19544                 esac
19545                 ;;
19546         threads|threads/shared)
19547                 case "$usethreads" in
19548                 true|$define|y)
19549                         case "$useithreads" in
19550                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
19551                         esac
19552                 esac
19553                 ;;
19554         IPC/SysV|ipc/sysv)
19555                 : XXX Do we need a useipcsysv variable here
19556                 case "${d_msg}${d_sem}${d_shm}" in 
19557                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
19558                 esac
19559                 ;;
19560         *)      avail_ext="$avail_ext $xxx"
19561                 ;;
19562         esac
19563 done
19564
19565 set X $avail_ext
19566 shift
19567 avail_ext="$*"
19568
19569 : Now see which nonxs extensions are supported on this system.
19570 : For now assume all are.
19571 nonxs_ext=''
19572 for xxx in $nonxs_extensions ; do
19573         case "$xxx" in
19574         *)      nonxs_ext="$nonxs_ext $xxx"
19575                 ;;
19576         esac
19577 done
19578
19579 set X $nonxs_ext
19580 shift
19581 nonxs_ext="$*"
19582
19583 case $usedl in
19584 $define)
19585         $cat <<EOM
19586 A number of extensions are supplied with $package.  You may choose to
19587 compile these extensions for dynamic loading (the default), compile
19588 them into the $package executable (static loading), or not include
19589 them at all.  Answer "none" to include no extensions.
19590 Note that DynaLoader is always built and need not be mentioned here.
19591
19592 EOM
19593         case "$dynamic_ext" in
19594         '') dflt="$avail_ext" ;;
19595         *)      dflt="$dynamic_ext"
19596                 # Perhaps we are reusing an old out-of-date config.sh.
19597                 case "$hint" in
19598                 previous)
19599                         if test X"$dynamic_ext" != X"$avail_ext"; then
19600                                 $cat <<EOM
19601 NOTICE:  Your previous config.sh list may be incorrect. 
19602 The extensions now available to you are 
19603         ${avail_ext}
19604 but the default list from your previous config.sh is
19605         ${dynamic_ext} 
19606
19607 EOM
19608                         fi
19609                         ;;
19610                 esac
19611                 ;;
19612         esac
19613         case "$dflt" in
19614         '')     dflt=none;;
19615         esac
19616         rp="What extensions do you wish to load dynamically?"
19617         . ./myread
19618         case "$ans" in
19619         none) dynamic_ext=' ' ;;
19620         *) dynamic_ext="$ans" ;;
19621         esac
19622
19623         case "$static_ext" in
19624         '')
19625                 : Exclude those already listed in dynamic linking
19626                 dflt=''
19627                 for xxx in $avail_ext; do
19628                         case " $dynamic_ext " in
19629                         *" $xxx "*) ;;
19630                         *) dflt="$dflt $xxx" ;;
19631                         esac
19632                 done
19633                 set X $dflt
19634                 shift
19635                 dflt="$*"
19636                 ;;
19637         *)  dflt="$static_ext" 
19638                 ;;
19639         esac
19640
19641         case "$dflt" in
19642         '')     dflt=none;;
19643         esac
19644         rp="What extensions do you wish to load statically?"
19645         . ./myread
19646         case "$ans" in
19647         none) static_ext=' ' ;;
19648         *) static_ext="$ans" ;;
19649         esac
19650         ;;
19651 *)
19652         $cat <<EOM
19653 A number of extensions are supplied with $package.  Answer "none" 
19654 to include no extensions. 
19655 Note that DynaLoader is always built and need not be mentioned here.
19656
19657 EOM
19658         case "$static_ext" in
19659         '') dflt="$avail_ext" ;;
19660         *)      dflt="$static_ext"
19661                 # Perhaps we are reusing an old out-of-date config.sh.
19662                 case "$hint" in
19663                 previous)
19664                         if test X"$static_ext" != X"$avail_ext"; then
19665                                 $cat <<EOM
19666 NOTICE:  Your previous config.sh list may be incorrect. 
19667 The extensions now available to you are 
19668         ${avail_ext}
19669 but the default list from your previous config.sh is
19670         ${static_ext} 
19671
19672 EOM
19673                         fi
19674                         ;;
19675                 esac
19676                 ;;
19677         esac
19678         : Exclude those that are not xs extensions
19679         case "$dflt" in
19680         '')     dflt=none;;
19681         *)  case " $dflt " in
19682             *" Encode "*) # Add the subextensions of Encode
19683                 cd "$rsrc/ext"
19684                 for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
19685                         dflt="$dflt Encode/$xxx"
19686                 done
19687                 cd "$tdir"
19688                 ;;
19689             esac
19690             ;;
19691         esac
19692         rp="What extensions do you wish to include?"
19693         . ./myread
19694         case "$ans" in
19695         none) static_ext=' ' ;;
19696         *) static_ext="$ans" ;;
19697         esac
19698         ;;
19699 esac
19700
19701 set X $dynamic_ext $static_ext $nonxs_ext
19702 shift
19703 extensions="$*"
19704
19705 : Remove libraries needed only for extensions
19706 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
19707 : The exception is SunOS 4.x, which needs them.
19708 case "${osname}X${osvers}" in
19709 sunos*X4*)
19710     perllibs="$libs"
19711     ;;
19712 *) case "$usedl" in
19713     $define|true|[yY]*)
19714             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
19715             shift
19716             perllibs="$*"
19717             ;;
19718     *)  perllibs="$libs"
19719             ;;
19720     esac
19721     ;;
19722 esac
19723
19724 : Remove build directory name from cppstdin so it can be used from
19725 : either the present location or the final installed location.
19726 echo " "
19727 : Get out of the UU directory to get correct path name.
19728 cd ..
19729 case "$cppstdin" in
19730 `pwd`/cppstdin)
19731         echo "Stripping down cppstdin path name"
19732         cppstdin=cppstdin
19733         ;;
19734 esac
19735 cd UU
19736
19737 : end of configuration questions
19738 echo " "
19739 echo "End of configuration questions."
19740 echo " "
19741
19742 : back to where it started
19743 if test -d ../UU; then
19744         cd ..
19745 fi
19746
19747 : configuration may be patched via a 'config.arch' file
19748 if $test -f config.arch; then
19749         echo "I see a config.arch file, loading it."
19750         . ./config.arch
19751 fi
19752
19753 : configuration may be patched via a 'config.over' file
19754 if $test -f config.over; then
19755         echo " "
19756         dflt=y
19757         rp='I see a config.over file.  Do you wish to load it?'
19758         . UU/myread
19759         case "$ans" in
19760         n*) echo "OK, I'll ignore it.";;
19761         *)      . ./config.over
19762                 echo "Configuration override changes have been loaded."
19763                 ;;
19764         esac
19765 fi
19766
19767 : in case they want portability, strip down executable paths
19768 case "$d_portable" in
19769 "$define")
19770         echo " "
19771         echo "Stripping down executable paths..." >&4
19772         for file in $loclist $trylist; do
19773                 eval temp=\$$file
19774                 eval $file=`basename $temp`
19775         done
19776         ;;
19777 esac
19778
19779 : create config.sh file
19780 echo " "
19781 echo "Creating config.sh..." >&4
19782 $spitshell <<EOT >config.sh
19783 $startsh
19784 #
19785 # This file was produced by running the Configure script. It holds all the
19786 # definitions figured out by Configure. Should you modify one of these values,
19787 # do not forget to propagate your changes by running "Configure -der". You may
19788 # instead choose to run each of the .SH files by yourself, or "Configure -S".
19789 #
19790
19791 # Package name      : $package
19792 # Source directory  : $src
19793 # Configuration time: $cf_time
19794 # Configured by     : $cf_by
19795 # Target system     : $myuname
19796
19797 Author='$Author'
19798 Date='$Date'
19799 Header='$Header'
19800 Id='$Id'
19801 Locker='$Locker'
19802 Log='$Log'
19803 Mcc='$Mcc'
19804 RCSfile='$RCSfile'
19805 Revision='$Revision'
19806 Source='$Source'
19807 State='$State'
19808 _a='$_a'
19809 _exe='$_exe'
19810 _o='$_o'
19811 afs='$afs'
19812 afsroot='$afsroot'
19813 alignbytes='$alignbytes'
19814 ansi2knr='$ansi2knr'
19815 aphostname='$aphostname'
19816 api_revision='$api_revision'
19817 api_subversion='$api_subversion'
19818 api_version='$api_version'
19819 api_versionstring='$api_versionstring'
19820 ar='$ar'
19821 archlib='$archlib'
19822 archlibexp='$archlibexp'
19823 archname64='$archname64'
19824 archname='$archname'
19825 archobjs='$archobjs'
19826 asctime_r_proto='$asctime_r_proto'
19827 awk='$awk'
19828 baserev='$baserev'
19829 bash='$bash'
19830 bin='$bin'
19831 bincompat5005='$bincompat5005'
19832 binexp='$binexp'
19833 bison='$bison'
19834 byacc='$byacc'
19835 byteorder='$byteorder'
19836 c='$c'
19837 castflags='$castflags'
19838 cat='$cat'
19839 cc='$cc'
19840 cccdlflags='$cccdlflags'
19841 ccdlflags='$ccdlflags'
19842 ccflags='$ccflags'
19843 ccflags_uselargefiles='$ccflags_uselargefiles'
19844 ccname='$ccname'
19845 ccsymbols='$ccsymbols'
19846 ccversion='$ccversion'
19847 cf_by='$cf_by'
19848 cf_email='$cf_email'
19849 cf_time='$cf_time'
19850 charsize='$charsize'
19851 chgrp='$chgrp'
19852 chmod='$chmod'
19853 chown='$chown'
19854 clocktype='$clocktype'
19855 comm='$comm'
19856 compress='$compress'
19857 contains='$contains'
19858 cp='$cp'
19859 cpio='$cpio'
19860 cpp='$cpp'
19861 cpp_stuff='$cpp_stuff'
19862 cppccsymbols='$cppccsymbols'
19863 cppflags='$cppflags'
19864 cpplast='$cpplast'
19865 cppminus='$cppminus'
19866 cpprun='$cpprun'
19867 cppstdin='$cppstdin'
19868 cppsymbols='$cppsymbols'
19869 crypt_r_proto='$crypt_r_proto'
19870 cryptlib='$cryptlib'
19871 csh='$csh'
19872 ctermid_r_proto='$ctermid_r_proto'
19873 ctime_r_proto='$ctime_r_proto'
19874 d_Gconvert='$d_Gconvert'
19875 d_PRIEUldbl='$d_PRIEUldbl'
19876 d_PRIFUldbl='$d_PRIFUldbl'
19877 d_PRIGUldbl='$d_PRIGUldbl'
19878 d_PRIXU64='$d_PRIXU64'
19879 d_PRId64='$d_PRId64'
19880 d_PRIeldbl='$d_PRIeldbl'
19881 d_PRIfldbl='$d_PRIfldbl'
19882 d_PRIgldbl='$d_PRIgldbl'
19883 d_PRIi64='$d_PRIi64'
19884 d_PRIo64='$d_PRIo64'
19885 d_PRIu64='$d_PRIu64'
19886 d_PRIx64='$d_PRIx64'
19887 d_SCNfldbl='$d_SCNfldbl'
19888 d__fwalk='$d__fwalk'
19889 d_access='$d_access'
19890 d_accessx='$d_accessx'
19891 d_alarm='$d_alarm'
19892 d_archlib='$d_archlib'
19893 d_asctime_r='$d_asctime_r'
19894 d_atolf='$d_atolf'
19895 d_atoll='$d_atoll'
19896 d_attribut='$d_attribut'
19897 d_bcmp='$d_bcmp'
19898 d_bcopy='$d_bcopy'
19899 d_bincompat5005='$d_bincompat5005'
19900 d_bsd='$d_bsd'
19901 d_bsdgetpgrp='$d_bsdgetpgrp'
19902 d_bsdsetpgrp='$d_bsdsetpgrp'
19903 d_bzero='$d_bzero'
19904 d_casti32='$d_casti32'
19905 d_castneg='$d_castneg'
19906 d_charvspr='$d_charvspr'
19907 d_chown='$d_chown'
19908 d_chroot='$d_chroot'
19909 d_chsize='$d_chsize'
19910 d_class='$d_class'
19911 d_closedir='$d_closedir'
19912 d_cmsghdr_s='$d_cmsghdr_s'
19913 d_const='$d_const'
19914 d_crypt='$d_crypt'
19915 d_crypt_r='$d_crypt_r'
19916 d_csh='$d_csh'
19917 d_ctermid_r='$d_ctermid_r'
19918 d_ctime_r='$d_ctime_r'
19919 d_cuserid='$d_cuserid'
19920 d_dbl_dig='$d_dbl_dig'
19921 d_dbminitproto='$d_dbminitproto'
19922 d_difftime='$d_difftime'
19923 d_dirfd='$d_dirfd'
19924 d_dirnamlen='$d_dirnamlen'
19925 d_dlerror='$d_dlerror'
19926 d_dlopen='$d_dlopen'
19927 d_dlsymun='$d_dlsymun'
19928 d_dosuid='$d_dosuid'
19929 d_drand48_r='$d_drand48_r'
19930 d_drand48proto='$d_drand48proto'
19931 d_dup2='$d_dup2'
19932 d_eaccess='$d_eaccess'
19933 d_endgrent='$d_endgrent'
19934 d_endgrent_r='$d_endgrent_r'
19935 d_endhent='$d_endhent'
19936 d_endhostent_r='$d_endhostent_r'
19937 d_endnent='$d_endnent'
19938 d_endnetent_r='$d_endnetent_r'
19939 d_endpent='$d_endpent'
19940 d_endprotoent_r='$d_endprotoent_r'
19941 d_endpwent='$d_endpwent'
19942 d_endpwent_r='$d_endpwent_r'
19943 d_endsent='$d_endsent'
19944 d_endservent_r='$d_endservent_r'
19945 d_eofnblk='$d_eofnblk'
19946 d_eunice='$d_eunice'
19947 d_fchdir='$d_fchdir'
19948 d_fchmod='$d_fchmod'
19949 d_fchown='$d_fchown'
19950 d_fcntl='$d_fcntl'
19951 d_fcntl_can_lock='$d_fcntl_can_lock'
19952 d_fd_macros='$d_fd_macros'
19953 d_fd_set='$d_fd_set'
19954 d_fds_bits='$d_fds_bits'
19955 d_fgetpos='$d_fgetpos'
19956 d_finite='$d_finite'
19957 d_finitel='$d_finitel'
19958 d_flexfnam='$d_flexfnam'
19959 d_flock='$d_flock'
19960 d_flockproto='$d_flockproto'
19961 d_fork='$d_fork'
19962 d_fp_class='$d_fp_class'
19963 d_fpathconf='$d_fpathconf'
19964 d_fpclass='$d_fpclass'
19965 d_fpclassify='$d_fpclassify'
19966 d_fpclassl='$d_fpclassl'
19967 d_fpos64_t='$d_fpos64_t'
19968 d_frexpl='$d_frexpl'
19969 d_fs_data_s='$d_fs_data_s'
19970 d_fseeko='$d_fseeko'
19971 d_fsetpos='$d_fsetpos'
19972 d_fstatfs='$d_fstatfs'
19973 d_fstatvfs='$d_fstatvfs'
19974 d_fsync='$d_fsync'
19975 d_ftello='$d_ftello'
19976 d_ftime='$d_ftime'
19977 d_getcwd='$d_getcwd'
19978 d_getespwnam='$d_getespwnam'
19979 d_getfsstat='$d_getfsstat'
19980 d_getgrent='$d_getgrent'
19981 d_getgrent_r='$d_getgrent_r'
19982 d_getgrgid_r='$d_getgrgid_r'
19983 d_getgrnam_r='$d_getgrnam_r'
19984 d_getgrps='$d_getgrps'
19985 d_gethbyaddr='$d_gethbyaddr'
19986 d_gethbyname='$d_gethbyname'
19987 d_gethent='$d_gethent'
19988 d_gethname='$d_gethname'
19989 d_gethostbyaddr_r='$d_gethostbyaddr_r'
19990 d_gethostbyname_r='$d_gethostbyname_r'
19991 d_gethostent_r='$d_gethostent_r'
19992 d_gethostprotos='$d_gethostprotos'
19993 d_getitimer='$d_getitimer'
19994 d_getlogin='$d_getlogin'
19995 d_getlogin_r='$d_getlogin_r'
19996 d_getmnt='$d_getmnt'
19997 d_getmntent='$d_getmntent'
19998 d_getnbyaddr='$d_getnbyaddr'
19999 d_getnbyname='$d_getnbyname'
20000 d_getnent='$d_getnent'
20001 d_getnetbyaddr_r='$d_getnetbyaddr_r'
20002 d_getnetbyname_r='$d_getnetbyname_r'
20003 d_getnetent_r='$d_getnetent_r'
20004 d_getnetprotos='$d_getnetprotos'
20005 d_getpagsz='$d_getpagsz'
20006 d_getpbyname='$d_getpbyname'
20007 d_getpbynumber='$d_getpbynumber'
20008 d_getpent='$d_getpent'
20009 d_getpgid='$d_getpgid'
20010 d_getpgrp2='$d_getpgrp2'
20011 d_getpgrp='$d_getpgrp'
20012 d_getppid='$d_getppid'
20013 d_getprior='$d_getprior'
20014 d_getprotobyname_r='$d_getprotobyname_r'
20015 d_getprotobynumber_r='$d_getprotobynumber_r'
20016 d_getprotoent_r='$d_getprotoent_r'
20017 d_getprotoprotos='$d_getprotoprotos'
20018 d_getprpwnam='$d_getprpwnam'
20019 d_getpwent='$d_getpwent'
20020 d_getpwent_r='$d_getpwent_r'
20021 d_getpwnam_r='$d_getpwnam_r'
20022 d_getpwuid_r='$d_getpwuid_r'
20023 d_getsbyname='$d_getsbyname'
20024 d_getsbyport='$d_getsbyport'
20025 d_getsent='$d_getsent'
20026 d_getservbyname_r='$d_getservbyname_r'
20027 d_getservbyport_r='$d_getservbyport_r'
20028 d_getservent_r='$d_getservent_r'
20029 d_getservprotos='$d_getservprotos'
20030 d_getspnam='$d_getspnam'
20031 d_getspnam_r='$d_getspnam_r'
20032 d_gettimeod='$d_gettimeod'
20033 d_gmtime_r='$d_gmtime_r'
20034 d_gnulibc='$d_gnulibc'
20035 d_grpasswd='$d_grpasswd'
20036 d_hasmntopt='$d_hasmntopt'
20037 d_htonl='$d_htonl'
20038 d_index='$d_index'
20039 d_inetaton='$d_inetaton'
20040 d_int64_t='$d_int64_t'
20041 d_isascii='$d_isascii'
20042 d_isfinite='$d_isfinite'
20043 d_isinf='$d_isinf'
20044 d_isnan='$d_isnan'
20045 d_isnanl='$d_isnanl'
20046 d_killpg='$d_killpg'
20047 d_lchown='$d_lchown'
20048 d_ldbl_dig='$d_ldbl_dig'
20049 d_link='$d_link'
20050 d_localtime_r='$d_localtime_r'
20051 d_locconv='$d_locconv'
20052 d_lockf='$d_lockf'
20053 d_longdbl='$d_longdbl'
20054 d_longlong='$d_longlong'
20055 d_lseekproto='$d_lseekproto'
20056 d_lstat='$d_lstat'
20057 d_madvise='$d_madvise'
20058 d_mblen='$d_mblen'
20059 d_mbstowcs='$d_mbstowcs'
20060 d_mbtowc='$d_mbtowc'
20061 d_memchr='$d_memchr'
20062 d_memcmp='$d_memcmp'
20063 d_memcpy='$d_memcpy'
20064 d_memmove='$d_memmove'
20065 d_memset='$d_memset'
20066 d_mkdir='$d_mkdir'
20067 d_mkdtemp='$d_mkdtemp'
20068 d_mkfifo='$d_mkfifo'
20069 d_mkstemp='$d_mkstemp'
20070 d_mkstemps='$d_mkstemps'
20071 d_mktime='$d_mktime'
20072 d_mmap='$d_mmap'
20073 d_modfl='$d_modfl'
20074 d_modfl_pow32_bug='$d_modfl_pow32_bug'
20075 d_mprotect='$d_mprotect'
20076 d_msg='$d_msg'
20077 d_msg_ctrunc='$d_msg_ctrunc'
20078 d_msg_dontroute='$d_msg_dontroute'
20079 d_msg_oob='$d_msg_oob'
20080 d_msg_peek='$d_msg_peek'
20081 d_msg_proxy='$d_msg_proxy'
20082 d_msgctl='$d_msgctl'
20083 d_msgget='$d_msgget'
20084 d_msghdr_s='$d_msghdr_s'
20085 d_msgrcv='$d_msgrcv'
20086 d_msgsnd='$d_msgsnd'
20087 d_msync='$d_msync'
20088 d_munmap='$d_munmap'
20089 d_mymalloc='$d_mymalloc'
20090 d_nice='$d_nice'
20091 d_nl_langinfo='$d_nl_langinfo'
20092 d_nv_preserves_uv='$d_nv_preserves_uv'
20093 d_off64_t='$d_off64_t'
20094 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
20095 d_oldpthreads='$d_oldpthreads'
20096 d_oldsock='$d_oldsock'
20097 d_open3='$d_open3'
20098 d_pathconf='$d_pathconf'
20099 d_pause='$d_pause'
20100 d_perl_otherlibdirs='$d_perl_otherlibdirs'
20101 d_phostname='$d_phostname'
20102 d_pipe='$d_pipe'
20103 d_poll='$d_poll'
20104 d_portable='$d_portable'
20105 d_procselfexe='$d_procselfexe'
20106 d_pthread_atfork='$d_pthread_atfork'
20107 d_pthread_yield='$d_pthread_yield'
20108 d_pwage='$d_pwage'
20109 d_pwchange='$d_pwchange'
20110 d_pwclass='$d_pwclass'
20111 d_pwcomment='$d_pwcomment'
20112 d_pwexpire='$d_pwexpire'
20113 d_pwgecos='$d_pwgecos'
20114 d_pwpasswd='$d_pwpasswd'
20115 d_pwquota='$d_pwquota'
20116 d_qgcvt='$d_qgcvt'
20117 d_quad='$d_quad'
20118 d_random_r='$d_random_r'
20119 d_readdir64_r='$d_readdir64_r'
20120 d_readdir='$d_readdir'
20121 d_readdir_r='$d_readdir_r'
20122 d_readlink='$d_readlink'
20123 d_readv='$d_readv'
20124 d_recvmsg='$d_recvmsg'
20125 d_rename='$d_rename'
20126 d_rewinddir='$d_rewinddir'
20127 d_rmdir='$d_rmdir'
20128 d_safebcpy='$d_safebcpy'
20129 d_safemcpy='$d_safemcpy'
20130 d_sanemcmp='$d_sanemcmp'
20131 d_sbrkproto='$d_sbrkproto'
20132 d_sched_yield='$d_sched_yield'
20133 d_scm_rights='$d_scm_rights'
20134 d_seekdir='$d_seekdir'
20135 d_select='$d_select'
20136 d_sem='$d_sem'
20137 d_semctl='$d_semctl'
20138 d_semctl_semid_ds='$d_semctl_semid_ds'
20139 d_semctl_semun='$d_semctl_semun'
20140 d_semget='$d_semget'
20141 d_semop='$d_semop'
20142 d_sendmsg='$d_sendmsg'
20143 d_setegid='$d_setegid'
20144 d_seteuid='$d_seteuid'
20145 d_setgrent='$d_setgrent'
20146 d_setgrent_r='$d_setgrent_r'
20147 d_setgrps='$d_setgrps'
20148 d_sethent='$d_sethent'
20149 d_sethostent_r='$d_sethostent_r'
20150 d_setitimer='$d_setitimer'
20151 d_setlinebuf='$d_setlinebuf'
20152 d_setlocale='$d_setlocale'
20153 d_setlocale_r='$d_setlocale_r'
20154 d_setnent='$d_setnent'
20155 d_setnetent_r='$d_setnetent_r'
20156 d_setpent='$d_setpent'
20157 d_setpgid='$d_setpgid'
20158 d_setpgrp2='$d_setpgrp2'
20159 d_setpgrp='$d_setpgrp'
20160 d_setprior='$d_setprior'
20161 d_setproctitle='$d_setproctitle'
20162 d_setprotoent_r='$d_setprotoent_r'
20163 d_setpwent='$d_setpwent'
20164 d_setpwent_r='$d_setpwent_r'
20165 d_setregid='$d_setregid'
20166 d_setresgid='$d_setresgid'
20167 d_setresuid='$d_setresuid'
20168 d_setreuid='$d_setreuid'
20169 d_setrgid='$d_setrgid'
20170 d_setruid='$d_setruid'
20171 d_setsent='$d_setsent'
20172 d_setservent_r='$d_setservent_r'
20173 d_setsid='$d_setsid'
20174 d_setvbuf='$d_setvbuf'
20175 d_sfio='$d_sfio'
20176 d_shm='$d_shm'
20177 d_shmat='$d_shmat'
20178 d_shmatprototype='$d_shmatprototype'
20179 d_shmctl='$d_shmctl'
20180 d_shmdt='$d_shmdt'
20181 d_shmget='$d_shmget'
20182 d_sigaction='$d_sigaction'
20183 d_sigprocmask='$d_sigprocmask'
20184 d_sigsetjmp='$d_sigsetjmp'
20185 d_sockatmark='$d_sockatmark'
20186 d_sockatmarkproto='$d_sockatmarkproto'
20187 d_socket='$d_socket'
20188 d_socklen_t='$d_socklen_t'
20189 d_sockpair='$d_sockpair'
20190 d_socks5_init='$d_socks5_init'
20191 d_sqrtl='$d_sqrtl'
20192 d_srand48_r='$d_srand48_r'
20193 d_srandom_r='$d_srandom_r'
20194 d_sresgproto='$d_sresgproto'
20195 d_sresuproto='$d_sresuproto'
20196 d_statblks='$d_statblks'
20197 d_statfs_f_flags='$d_statfs_f_flags'
20198 d_statfs_s='$d_statfs_s'
20199 d_statvfs='$d_statvfs'
20200 d_stdio_cnt_lval='$d_stdio_cnt_lval'
20201 d_stdio_ptr_lval='$d_stdio_ptr_lval'
20202 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
20203 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
20204 d_stdio_stream_array='$d_stdio_stream_array'
20205 d_stdiobase='$d_stdiobase'
20206 d_stdstdio='$d_stdstdio'
20207 d_strchr='$d_strchr'
20208 d_strcoll='$d_strcoll'
20209 d_strctcpy='$d_strctcpy'
20210 d_strerrm='$d_strerrm'
20211 d_strerror='$d_strerror'
20212 d_strerror_r='$d_strerror_r'
20213 d_strftime='$d_strftime'
20214 d_strtod='$d_strtod'
20215 d_strtol='$d_strtol'
20216 d_strtold='$d_strtold'
20217 d_strtoll='$d_strtoll'
20218 d_strtoq='$d_strtoq'
20219 d_strtoul='$d_strtoul'
20220 d_strtoull='$d_strtoull'
20221 d_strtouq='$d_strtouq'
20222 d_strxfrm='$d_strxfrm'
20223 d_suidsafe='$d_suidsafe'
20224 d_symlink='$d_symlink'
20225 d_syscall='$d_syscall'
20226 d_syscallproto='$d_syscallproto'
20227 d_sysconf='$d_sysconf'
20228 d_sysernlst='$d_sysernlst'
20229 d_syserrlst='$d_syserrlst'
20230 d_system='$d_system'
20231 d_tcgetpgrp='$d_tcgetpgrp'
20232 d_tcsetpgrp='$d_tcsetpgrp'
20233 d_telldir='$d_telldir'
20234 d_telldirproto='$d_telldirproto'
20235 d_time='$d_time'
20236 d_times='$d_times'
20237 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
20238 d_tm_tm_zone='$d_tm_tm_zone'
20239 d_tmpnam_r='$d_tmpnam_r'
20240 d_truncate='$d_truncate'
20241 d_ttyname_r='$d_ttyname_r'
20242 d_tzname='$d_tzname'
20243 d_u32align='$d_u32align'
20244 d_ualarm='$d_ualarm'
20245 d_umask='$d_umask'
20246 d_uname='$d_uname'
20247 d_union_semun='$d_union_semun'
20248 d_unordered='$d_unordered'
20249 d_usleep='$d_usleep'
20250 d_usleepproto='$d_usleepproto'
20251 d_ustat='$d_ustat'
20252 d_vendorarch='$d_vendorarch'
20253 d_vendorbin='$d_vendorbin'
20254 d_vendorlib='$d_vendorlib'
20255 d_vfork='$d_vfork'
20256 d_void_closedir='$d_void_closedir'
20257 d_voidsig='$d_voidsig'
20258 d_voidtty='$d_voidtty'
20259 d_volatile='$d_volatile'
20260 d_vprintf='$d_vprintf'
20261 d_wait4='$d_wait4'
20262 d_waitpid='$d_waitpid'
20263 d_wcstombs='$d_wcstombs'
20264 d_wctomb='$d_wctomb'
20265 d_writev='$d_writev'
20266 d_xenix='$d_xenix'
20267 date='$date'
20268 db_hashtype='$db_hashtype'
20269 db_prefixtype='$db_prefixtype'
20270 db_version_major='$db_version_major'
20271 db_version_minor='$db_version_minor'
20272 db_version_patch='$db_version_patch'
20273 defvoidused='$defvoidused'
20274 direntrytype='$direntrytype'
20275 dlext='$dlext'
20276 dlsrc='$dlsrc'
20277 doublesize='$doublesize'
20278 drand01='$drand01'
20279 drand48_r_proto='$drand48_r_proto'
20280 dynamic_ext='$dynamic_ext'
20281 eagain='$eagain'
20282 ebcdic='$ebcdic'
20283 echo='$echo'
20284 egrep='$egrep'
20285 emacs='$emacs'
20286 endgrent_r_proto='$endgrent_r_proto'
20287 endhostent_r_proto='$endhostent_r_proto'
20288 endnetent_r_proto='$endnetent_r_proto'
20289 endprotoent_r_proto='$endprotoent_r_proto'
20290 endpwent_r_proto='$endpwent_r_proto'
20291 endservent_r_proto='$endservent_r_proto'
20292 eunicefix='$eunicefix'
20293 exe_ext='$exe_ext'
20294 expr='$expr'
20295 extensions='$extensions'
20296 extras='$extras'
20297 fflushNULL='$fflushNULL'
20298 fflushall='$fflushall'
20299 find='$find'
20300 firstmakefile='$firstmakefile'
20301 flex='$flex'
20302 fpossize='$fpossize'
20303 fpostype='$fpostype'
20304 freetype='$freetype'
20305 from='$from'
20306 full_ar='$full_ar'
20307 full_csh='$full_csh'
20308 full_sed='$full_sed'
20309 gccosandvers='$gccosandvers'
20310 gccversion='$gccversion'
20311 getgrent_r_proto='$getgrent_r_proto'
20312 getgrgid_r_proto='$getgrgid_r_proto'
20313 getgrnam_r_proto='$getgrnam_r_proto'
20314 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
20315 gethostbyname_r_proto='$gethostbyname_r_proto'
20316 gethostent_r_proto='$gethostent_r_proto'
20317 getlogin_r_proto='$getlogin_r_proto'
20318 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
20319 getnetbyname_r_proto='$getnetbyname_r_proto'
20320 getnetent_r_proto='$getnetent_r_proto'
20321 getprotobyname_r_proto='$getprotobyname_r_proto'
20322 getprotobynumber_r_proto='$getprotobynumber_r_proto'
20323 getprotoent_r_proto='$getprotoent_r_proto'
20324 getpwent_r_proto='$getpwent_r_proto'
20325 getpwnam_r_proto='$getpwnam_r_proto'
20326 getpwuid_r_proto='$getpwuid_r_proto'
20327 getservbyname_r_proto='$getservbyname_r_proto'
20328 getservbyport_r_proto='$getservbyport_r_proto'
20329 getservent_r_proto='$getservent_r_proto'
20330 getspnam_r_proto='$getspnam_r_proto'
20331 gidformat='$gidformat'
20332 gidsign='$gidsign'
20333 gidsize='$gidsize'
20334 gidtype='$gidtype'
20335 glibpth='$glibpth'
20336 gmake='$gmake'
20337 gmtime_r_proto='$gmtime_r_proto'
20338 grep='$grep'
20339 groupcat='$groupcat'
20340 groupstype='$groupstype'
20341 gzip='$gzip'
20342 h_fcntl='$h_fcntl'
20343 h_sysfile='$h_sysfile'
20344 hint='$hint'
20345 hostcat='$hostcat'
20346 i16size='$i16size'
20347 i16type='$i16type'
20348 i32size='$i32size'
20349 i32type='$i32type'
20350 i64size='$i64size'
20351 i64type='$i64type'
20352 i8size='$i8size'
20353 i8type='$i8type'
20354 i_arpainet='$i_arpainet'
20355 i_bsdioctl='$i_bsdioctl'
20356 i_crypt='$i_crypt'
20357 i_db='$i_db'
20358 i_dbm='$i_dbm'
20359 i_dirent='$i_dirent'
20360 i_dld='$i_dld'
20361 i_dlfcn='$i_dlfcn'
20362 i_fcntl='$i_fcntl'
20363 i_float='$i_float'
20364 i_fp='$i_fp'
20365 i_fp_class='$i_fp_class'
20366 i_gdbm='$i_gdbm'
20367 i_grp='$i_grp'
20368 i_ieeefp='$i_ieeefp'
20369 i_inttypes='$i_inttypes'
20370 i_langinfo='$i_langinfo'
20371 i_libutil='$i_libutil'
20372 i_limits='$i_limits'
20373 i_locale='$i_locale'
20374 i_machcthr='$i_machcthr'
20375 i_malloc='$i_malloc'
20376 i_math='$i_math'
20377 i_memory='$i_memory'
20378 i_mntent='$i_mntent'
20379 i_ndbm='$i_ndbm'
20380 i_netdb='$i_netdb'
20381 i_neterrno='$i_neterrno'
20382 i_netinettcp='$i_netinettcp'
20383 i_niin='$i_niin'
20384 i_poll='$i_poll'
20385 i_prot='$i_prot'
20386 i_pthread='$i_pthread'
20387 i_pwd='$i_pwd'
20388 i_rpcsvcdbm='$i_rpcsvcdbm'
20389 i_sfio='$i_sfio'
20390 i_sgtty='$i_sgtty'
20391 i_shadow='$i_shadow'
20392 i_socks='$i_socks'
20393 i_stdarg='$i_stdarg'
20394 i_stddef='$i_stddef'
20395 i_stdlib='$i_stdlib'
20396 i_string='$i_string'
20397 i_sunmath='$i_sunmath'
20398 i_sysaccess='$i_sysaccess'
20399 i_sysdir='$i_sysdir'
20400 i_sysfile='$i_sysfile'
20401 i_sysfilio='$i_sysfilio'
20402 i_sysin='$i_sysin'
20403 i_sysioctl='$i_sysioctl'
20404 i_syslog='$i_syslog'
20405 i_sysmman='$i_sysmman'
20406 i_sysmode='$i_sysmode'
20407 i_sysmount='$i_sysmount'
20408 i_sysndir='$i_sysndir'
20409 i_sysparam='$i_sysparam'
20410 i_sysresrc='$i_sysresrc'
20411 i_syssecrt='$i_syssecrt'
20412 i_sysselct='$i_sysselct'
20413 i_syssockio='$i_syssockio'
20414 i_sysstat='$i_sysstat'
20415 i_sysstatfs='$i_sysstatfs'
20416 i_sysstatvfs='$i_sysstatvfs'
20417 i_systime='$i_systime'
20418 i_systimek='$i_systimek'
20419 i_systimes='$i_systimes'
20420 i_systypes='$i_systypes'
20421 i_sysuio='$i_sysuio'
20422 i_sysun='$i_sysun'
20423 i_sysutsname='$i_sysutsname'
20424 i_sysvfs='$i_sysvfs'
20425 i_syswait='$i_syswait'
20426 i_termio='$i_termio'
20427 i_termios='$i_termios'
20428 i_time='$i_time'
20429 i_unistd='$i_unistd'
20430 i_ustat='$i_ustat'
20431 i_utime='$i_utime'
20432 i_values='$i_values'
20433 i_varargs='$i_varargs'
20434 i_varhdr='$i_varhdr'
20435 i_vfork='$i_vfork'
20436 ignore_versioned_solibs='$ignore_versioned_solibs'
20437 inc_version_list='$inc_version_list'
20438 inc_version_list_init='$inc_version_list_init'
20439 incpath='$incpath'
20440 inews='$inews'
20441 installarchlib='$installarchlib'
20442 installbin='$installbin'
20443 installman1dir='$installman1dir'
20444 installman3dir='$installman3dir'
20445 installprefix='$installprefix'
20446 installprefixexp='$installprefixexp'
20447 installprivlib='$installprivlib'
20448 installscript='$installscript'
20449 installsitearch='$installsitearch'
20450 installsitebin='$installsitebin'
20451 installsitelib='$installsitelib'
20452 installstyle='$installstyle'
20453 installusrbinperl='$installusrbinperl'
20454 installvendorarch='$installvendorarch'
20455 installvendorbin='$installvendorbin'
20456 installvendorlib='$installvendorlib'
20457 intsize='$intsize'
20458 issymlink='$issymlink'
20459 ivdformat='$ivdformat'
20460 ivsize='$ivsize'
20461 ivtype='$ivtype'
20462 known_extensions='$known_extensions'
20463 ksh='$ksh'
20464 ld='$ld'
20465 lddlflags='$lddlflags'
20466 ldflags='$ldflags'
20467 ldflags_uselargefiles='$ldflags_uselargefiles'
20468 ldlibpthname='$ldlibpthname'
20469 less='$less'
20470 lib_ext='$lib_ext'
20471 libc='$libc'
20472 libperl='$libperl'
20473 libpth='$libpth'
20474 libs='$libs'
20475 libsdirs='$libsdirs'
20476 libsfiles='$libsfiles'
20477 libsfound='$libsfound'
20478 libspath='$libspath'
20479 libswanted='$libswanted'
20480 libswanted_uselargefiles='$libswanted_uselargefiles'
20481 line='$line'
20482 lint='$lint'
20483 lkflags='$lkflags'
20484 ln='$ln'
20485 lns='$lns'
20486 localtime_r_proto='$localtime_r_proto'
20487 locincpth='$locincpth'
20488 loclibpth='$loclibpth'
20489 longdblsize='$longdblsize'
20490 longlongsize='$longlongsize'
20491 longsize='$longsize'
20492 lp='$lp'
20493 lpr='$lpr'
20494 ls='$ls'
20495 lseeksize='$lseeksize'
20496 lseektype='$lseektype'
20497 mail='$mail'
20498 mailx='$mailx'
20499 make='$make'
20500 make_set_make='$make_set_make'
20501 mallocobj='$mallocobj'
20502 mallocsrc='$mallocsrc'
20503 malloctype='$malloctype'
20504 man1dir='$man1dir'
20505 man1direxp='$man1direxp'
20506 man1ext='$man1ext'
20507 man3dir='$man3dir'
20508 man3direxp='$man3direxp'
20509 man3ext='$man3ext'
20510 mips_type='$mips_type'
20511 mkdir='$mkdir'
20512 mmaptype='$mmaptype'
20513 modetype='$modetype'
20514 more='$more'
20515 multiarch='$multiarch'
20516 mv='$mv'
20517 myarchname='$myarchname'
20518 mydomain='$mydomain'
20519 myhostname='$myhostname'
20520 myuname='$myuname'
20521 n='$n'
20522 need_va_copy='$need_va_copy'
20523 netdb_hlen_type='$netdb_hlen_type'
20524 netdb_host_type='$netdb_host_type'
20525 netdb_name_type='$netdb_name_type'
20526 netdb_net_type='$netdb_net_type'
20527 nm='$nm'
20528 nm_opt='$nm_opt'
20529 nm_so_opt='$nm_so_opt'
20530 nonxs_ext='$nonxs_ext'
20531 nroff='$nroff'
20532 nvEUformat='$nvEUformat'
20533 nvFUformat='$nvFUformat'
20534 nvGUformat='$nvGUformat'
20535 nv_preserves_uv_bits='$nv_preserves_uv_bits'
20536 nveformat='$nveformat'
20537 nvfformat='$nvfformat'
20538 nvgformat='$nvgformat'
20539 nvsize='$nvsize'
20540 nvtype='$nvtype'
20541 o_nonblock='$o_nonblock'
20542 obj_ext='$obj_ext'
20543 old_pthread_create_joinable='$old_pthread_create_joinable'
20544 optimize='$optimize'
20545 orderlib='$orderlib'
20546 osname='$osname'
20547 osvers='$osvers'
20548 otherlibdirs='$otherlibdirs'
20549 package='$package'
20550 pager='$pager'
20551 passcat='$passcat'
20552 patchlevel='$patchlevel'
20553 path_sep='$path_sep'
20554 perl5='$perl5'
20555 perl='$perl'
20556 perl_patchlevel='$perl_patchlevel'
20557 perladmin='$perladmin'
20558 perllibs='$perllibs'
20559 perlpath='$perlpath'
20560 pg='$pg'
20561 phostname='$phostname'
20562 pidtype='$pidtype'
20563 plibpth='$plibpth'
20564 pm_apiversion='$pm_apiversion'
20565 pmake='$pmake'
20566 pr='$pr'
20567 prefix='$prefix'
20568 prefixexp='$prefixexp'
20569 privlib='$privlib'
20570 privlibexp='$privlibexp'
20571 procselfexe='$procselfexe'
20572 prototype='$prototype'
20573 ptrsize='$ptrsize'
20574 quadkind='$quadkind'
20575 quadtype='$quadtype'
20576 randbits='$randbits'
20577 randfunc='$randfunc'
20578 random_r_proto='$random_r_proto'
20579 randseedtype='$randseedtype'
20580 ranlib='$ranlib'
20581 rd_nodata='$rd_nodata'
20582 readdir64_r_proto='$readdir64_r_proto'
20583 readdir_r_proto='$readdir_r_proto'
20584 revision='$revision'
20585 rm='$rm'
20586 rmail='$rmail'
20587 run='$run'
20588 runnm='$runnm'
20589 sPRIEUldbl='$sPRIEUldbl'
20590 sPRIFUldbl='$sPRIFUldbl'
20591 sPRIGUldbl='$sPRIGUldbl'
20592 sPRIXU64='$sPRIXU64'
20593 sPRId64='$sPRId64'
20594 sPRIeldbl='$sPRIeldbl'
20595 sPRIfldbl='$sPRIfldbl'
20596 sPRIgldbl='$sPRIgldbl'
20597 sPRIi64='$sPRIi64'
20598 sPRIo64='$sPRIo64'
20599 sPRIu64='$sPRIu64'
20600 sPRIx64='$sPRIx64'
20601 sSCNfldbl='$sSCNfldbl'
20602 sched_yield='$sched_yield'
20603 scriptdir='$scriptdir'
20604 scriptdirexp='$scriptdirexp'
20605 sed='$sed'
20606 seedfunc='$seedfunc'
20607 selectminbits='$selectminbits'
20608 selecttype='$selecttype'
20609 sendmail='$sendmail'
20610 setgrent_r_proto='$setgrent_r_proto'
20611 sethostent_r_proto='$sethostent_r_proto'
20612 setlocale_r_proto='$setlocale_r_proto'
20613 setnetent_r_proto='$setnetent_r_proto'
20614 setprotoent_r_proto='$setprotoent_r_proto'
20615 setpwent_r_proto='$setpwent_r_proto'
20616 setservent_r_proto='$setservent_r_proto'
20617 sh='$sh'
20618 shar='$shar'
20619 sharpbang='$sharpbang'
20620 shmattype='$shmattype'
20621 shortsize='$shortsize'
20622 shrpenv='$shrpenv'
20623 shsharp='$shsharp'
20624 sig_count='$sig_count'
20625 sig_name='$sig_name'
20626 sig_name_init='$sig_name_init'
20627 sig_num='$sig_num'
20628 sig_num_init='$sig_num_init'
20629 sig_size='$sig_size'
20630 signal_t='$signal_t'
20631 sitearch='$sitearch'
20632 sitearchexp='$sitearchexp'
20633 sitebin='$sitebin'
20634 sitebinexp='$sitebinexp'
20635 sitelib='$sitelib'
20636 sitelib_stem='$sitelib_stem'
20637 sitelibexp='$sitelibexp'
20638 siteprefix='$siteprefix'
20639 siteprefixexp='$siteprefixexp'
20640 sizesize='$sizesize'
20641 sizetype='$sizetype'
20642 sleep='$sleep'
20643 smail='$smail'
20644 so='$so'
20645 sockethdr='$sockethdr'
20646 socketlib='$socketlib'
20647 socksizetype='$socksizetype'
20648 sort='$sort'
20649 spackage='$spackage'
20650 spitshell='$spitshell'
20651 srand48_r_proto='$srand48_r_proto'
20652 srandom_r_proto='$srandom_r_proto'
20653 src='$src'
20654 ssizetype='$ssizetype'
20655 startperl='$startperl'
20656 startsh='$startsh'
20657 static_ext='$static_ext'
20658 stdchar='$stdchar'
20659 stdio_base='$stdio_base'
20660 stdio_bufsiz='$stdio_bufsiz'
20661 stdio_cnt='$stdio_cnt'
20662 stdio_filbuf='$stdio_filbuf'
20663 stdio_ptr='$stdio_ptr'
20664 stdio_stream_array='$stdio_stream_array'
20665 strerror_r_proto='$strerror_r_proto'
20666 strings='$strings'
20667 submit='$submit'
20668 subversion='$subversion'
20669 sysman='$sysman'
20670 tail='$tail'
20671 tar='$tar'
20672 targetarch='$targetarch'
20673 tbl='$tbl'
20674 tee='$tee'
20675 test='$test'
20676 timeincl='$timeincl'
20677 timetype='$timetype'
20678 tmpnam_r_proto='$tmpnam_r_proto'
20679 to='$to'
20680 touch='$touch'
20681 tr='$tr'
20682 trnl='$trnl'
20683 troff='$troff'
20684 ttyname_r_proto='$ttyname_r_proto'
20685 u16size='$u16size'
20686 u16type='$u16type'
20687 u32size='$u32size'
20688 u32type='$u32type'
20689 u64size='$u64size'
20690 u64type='$u64type'
20691 u8size='$u8size'
20692 u8type='$u8type'
20693 uidformat='$uidformat'
20694 uidsign='$uidsign'
20695 uidsize='$uidsize'
20696 uidtype='$uidtype'
20697 uname='$uname'
20698 uniq='$uniq'
20699 uquadtype='$uquadtype'
20700 use5005threads='$use5005threads'
20701 use64bitall='$use64bitall'
20702 use64bitint='$use64bitint'
20703 usecrosscompile='$usecrosscompile'
20704 usedl='$usedl'
20705 useithreads='$useithreads'
20706 uselargefiles='$uselargefiles'
20707 uselongdouble='$uselongdouble'
20708 usemorebits='$usemorebits'
20709 usemultiplicity='$usemultiplicity'
20710 usemymalloc='$usemymalloc'
20711 usenm='$usenm'
20712 useopcode='$useopcode'
20713 useperlio='$useperlio'
20714 useposix='$useposix'
20715 usereentrant='$usereentrant'
20716 usesfio='$usesfio'
20717 useshrplib='$useshrplib'
20718 usesocks='$usesocks'
20719 usethreads='$usethreads'
20720 usevendorprefix='$usevendorprefix'
20721 usevfork='$usevfork'
20722 usrinc='$usrinc'
20723 uuname='$uuname'
20724 uvXUformat='$uvXUformat'
20725 uvoformat='$uvoformat'
20726 uvsize='$uvsize'
20727 uvtype='$uvtype'
20728 uvuformat='$uvuformat'
20729 uvxformat='$uvxformat'
20730 vendorarch='$vendorarch'
20731 vendorarchexp='$vendorarchexp'
20732 vendorbin='$vendorbin'
20733 vendorbinexp='$vendorbinexp'
20734 vendorlib='$vendorlib'
20735 vendorlib_stem='$vendorlib_stem'
20736 vendorlibexp='$vendorlibexp'
20737 vendorprefix='$vendorprefix'
20738 vendorprefixexp='$vendorprefixexp'
20739 version='$version'
20740 version_patchlevel_string='$version_patchlevel_string'
20741 versiononly='$versiononly'
20742 vi='$vi'
20743 voidflags='$voidflags'
20744 xlibpth='$xlibpth'
20745 xs_apiversion='$xs_apiversion'
20746 yacc='$yacc'
20747 yaccflags='$yaccflags'
20748 zcat='$zcat'
20749 zip='$zip'
20750 EOT
20751
20752 : Add in command line options if available
20753 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
20754
20755 : add special variables
20756 $test -f $src/patchlevel.h && \
20757 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
20758 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
20759 echo "PERL_CONFIG_SH=true" >>config.sh
20760
20761 : propagate old symbols
20762 if $test -f UU/config.sh; then
20763         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
20764         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
20765         $sort | $uniq -u >UU/oldsyms
20766         set X `cat UU/oldsyms`
20767         shift
20768         case $# in
20769         0) ;;
20770         *)
20771                 cat <<EOM
20772 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
20773 EOM
20774                 echo "# Variables propagated from previous config.sh file." >>config.sh
20775                 for sym in `cat UU/oldsyms`; do
20776                         echo "    Propagating $hint variable "'$'"$sym..."
20777                         eval 'tmp="$'"${sym}"'"'
20778                         echo "$tmp" | \
20779                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
20780                 done
20781                 ;;
20782         esac
20783 fi
20784
20785 : Finish up by extracting the .SH files
20786 case "$alldone" in
20787 exit)
20788         $rm -rf UU
20789         echo "Extraction done."
20790         exit 0
20791         ;;
20792 cont)
20793         ;;
20794 '')
20795         dflt=''
20796         nostick=true
20797         $cat <<EOM
20798
20799 If you'd like to make any changes to the config.sh file before I begin
20800 to configure things, do it as a shell escape now (e.g. !vi config.sh).
20801
20802 EOM
20803         rp="Press return or use a shell escape to edit config.sh:"
20804         . UU/myread
20805         nostick=''
20806         case "$ans" in
20807         '') ;;
20808         *) : in case they cannot read
20809                 sh 1>&4 -c "$ans";;
20810         esac
20811         ;;
20812 esac
20813
20814 : if this fails, just run all the .SH files by hand
20815 . ./config.sh
20816
20817 echo " "
20818 exec 1>&4
20819 pwd=`pwd`
20820 . ./UU/extract
20821 cd "$pwd"
20822
20823 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
20824         dflt=y
20825         case "$silent" in
20826         true) ;;
20827         *)
20828                 $cat <<EOM
20829
20830 Now you need to generate make dependencies by running "$make depend".
20831 You might prefer to run it in background: "$make depend > makedepend.out &"
20832 It can take a while, so you might not want to run it right now.
20833
20834 EOM
20835                 ;;
20836         esac
20837         rp="Run $make depend now?"
20838         . UU/myread
20839         case "$ans" in
20840         y*)
20841                 $make depend && echo "Now you must run '$make'."
20842                 ;;
20843         *)
20844                 echo "You must run '$make depend' then '$make'."
20845                 ;;
20846         esac
20847 elif test -f [Mm]akefile; then
20848         echo " "
20849         echo "Now you must run a $make."
20850 else
20851         echo "Configure done."
20852 fi
20853
20854 if $test -f Policy.sh; then
20855     $cat <<EOM
20856
20857 If you compile $package on a different machine or from a different object
20858 directory, copy the Policy.sh file from this object directory to the
20859 new one before you run Configure -- this will help you with most of
20860 the policy defaults.
20861
20862 EOM
20863 fi
20864 if $test -f config.msg; then
20865     echo "Hmm.  I also noted the following information while running:"
20866     echo " "
20867     $cat config.msg >&4
20868     $rm -f config.msg
20869 fi
20870 $rm -f kit*isdone ark*isdone
20871 $rm -rf UU
20872
20873 : End of Configure
20874