nanosleep probes as per Jarkko's request
[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 Mon Sep 30 10:11:20 METDST 2002 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.org)
25
26 cat >c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat c1$$ c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f c1$$ c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 case "X${MACHTYPE:-nonesuchmach}" in
69                 *cygwin) ;;
70                 *) p_=\; ;;
71                 esac
72         fi
73 fi
74
75 : Proper PATH setting
76 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
77 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
78 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
79 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
80 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
81 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
82 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
83 paths="$paths /sbin /usr/sbin /usr/libexec"
84 paths="$paths /system/gnu_library/bin"
85
86 for p in $paths
87 do
88         case "$p_$PATH$p_" in
89         *$p_$p$p_*) ;;
90         *) test -d $p && PATH=$PATH$p_$p ;;
91         esac
92 done
93
94 PATH=.$p_$PATH
95 export PATH
96
97 : shall we be using ksh?
98 inksh=''
99 needksh=''
100 avoidksh=''
101 newsh=/bin/ksh
102 changesh=''
103 if (PATH=.; alias -x) >/dev/null 2>&1; then
104                 inksh=true
105 fi
106 if test -f /hp-ux -a -f /bin/ksh; then
107         needksh='to avoid sh bug in "here document" expansion'
108 fi
109 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
110         if test X`/usr/bin/uname -v` = X4; then
111                 avoidksh="to avoid AIX 4's /bin/sh"
112                 newsh=/usr/bin/bsh
113         fi
114 fi
115 if test -f /osf_boot -a -f /usr/sbin/setld; then
116         if test X`/usr/bin/uname -s` = XOSF1; then
117                 avoidksh="to avoid Digital UNIX' ksh"
118                 newsh=/bin/sh
119                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
120         fi
121 fi
122 case "$inksh/$needksh" in
123 /[a-z]*)
124                 ENV=''
125                 changesh=true
126                 reason="$needksh"
127         ;;
128 esac
129 case "$inksh/$avoidksh" in
130 true/[a-z]*)
131         changesh=true
132         reason="$avoidksh"
133         ;;
134 esac
135 case "$inksh/$needksh-$avoidksh-" in
136 true/--)
137                 cat <<EOM
138 (I see you are using the Korn shell.  Some ksh's blow up on $me,
139 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
140 EOM
141         ;;
142 esac
143 case "$changesh" in
144 true)
145         export newsh
146         echo "(Feeding myself to $newsh $reason.)"
147         case "$0" in
148         Configure|*/Configure) exec $newsh $0 "$@";;
149         *) exec $newsh Configure "$@";;
150         esac
151         ;;
152 esac
153
154 : if needed set CDPATH to a harmless value that is not chatty
155 : avoid bash 2.02 problems with empty CDPATH.
156 case "$CDPATH" in
157 '')     ;;
158 *)      case "$SHELL" in
159         *bash*) CDPATH='.' ;;
160         *)              CDPATH='' ;;
161         esac
162         ;;
163 esac
164 : Configure runs within the UU subdirectory
165 test -d UU || mkdir UU
166 cd UU && rm -f ./*
167
168
169 ccname=''
170 ccversion=''
171 ccsymbols=''
172 cppccsymbols=''
173 cppsymbols=''
174 from=''
175 run=''
176 targetarch=''
177 to=''
178 usecrosscompile=''
179 perllibs=''
180 dynamic_ext=''
181 extensions=''
182 known_extensions=''
183 nonxs_ext=''
184 static_ext=''
185 useopcode=''
186 useposix=''
187 extras=''
188 d_bsd=''
189 d_eunice=''
190 d_xenix=''
191 eunicefix=''
192 Mcc=''
193 ar=''
194 awk=''
195 bash=''
196 bison=''
197 byacc=''
198 cat=''
199 chgrp=''
200 chmod=''
201 chown=''
202 comm=''
203 compress=''
204 cp=''
205 cpio=''
206 cpp=''
207 csh=''
208 date=''
209 echo=''
210 egrep=''
211 emacs=''
212 expr=''
213 find=''
214 flex=''
215 gmake=''
216 grep=''
217 gzip=''
218 inews=''
219 ksh=''
220 less=''
221 line=''
222 lint=''
223 ln=''
224 lp=''
225 lpr=''
226 ls=''
227 mail=''
228 mailx=''
229 make=''
230 mkdir=''
231 more=''
232 mv=''
233 nm=''
234 nroff=''
235 perl=''
236 pg=''
237 pmake=''
238 pr=''
239 rm=''
240 rmail=''
241 sed=''
242 sendmail=''
243 shar=''
244 sleep=''
245 smail=''
246 sort=''
247 submit=''
248 tail=''
249 tar=''
250 tbl=''
251 tee=''
252 test=''
253 touch=''
254 tr=''
255 troff=''
256 uname=''
257 uniq=''
258 uuname=''
259 vi=''
260 zcat=''
261 zip=''
262 full_ar=''
263 full_sed=''
264 libswanted=''
265 hint=''
266 myuname=''
267 osname=''
268 osvers=''
269 Author=''
270 Date=''
271 Header=''
272 Id=''
273 Locker=''
274 Log=''
275 RCSfile=''
276 Revision=''
277 Source=''
278 State=''
279 _a=''
280 _exe=''
281 _o=''
282 archobjs=''
283 exe_ext=''
284 firstmakefile=''
285 lib_ext=''
286 obj_ext=''
287 path_sep=''
288 afs=''
289 afsroot=''
290 alignbytes=''
291 ansi2knr=''
292 archlib=''
293 archlibexp=''
294 d_archlib=''
295 installarchlib=''
296 archname=''
297 myarchname=''
298 d_atolf=''
299 d_atoll=''
300 baserev=''
301 bin=''
302 binexp=''
303 installbin=''
304 byteorder=''
305 cc=''
306 ccflags=''
307 cppflags=''
308 ldflags=''
309 lkflags=''
310 locincpth=''
311 optimize=''
312 cf_email=''
313 cf_by=''
314 cf_time=''
315 charsize=''
316 contains=''
317 cpp_stuff=''
318 cpplast=''
319 cppminus=''
320 cpprun=''
321 cppstdin=''
322 d__fwalk=''
323 d_access=''
324 d_accessx=''
325 d_alarm=''
326 asctime_r_proto=''
327 d_asctime_r=''
328 d_attribut=''
329 d_bcmp=''
330 d_bcopy=''
331 d_bzero=''
332 d_casti32=''
333 castflags=''
334 d_castneg=''
335 d_chown=''
336 d_chroot=''
337 d_chsize=''
338 d_class=''
339 d_closedir=''
340 d_void_closedir=''
341 d_cmsghdr_s=''
342 d_const=''
343 cryptlib=''
344 d_crypt=''
345 crypt_r_proto=''
346 d_crypt_r=''
347 d_csh=''
348 full_csh=''
349 ctermid_r_proto=''
350 d_ctermid_r=''
351 ctime_r_proto=''
352 d_ctime_r=''
353 d_cuserid=''
354 d_dbl_dig=''
355 d_dbminitproto=''
356 d_difftime=''
357 d_dirfd=''
358 d_dlerror=''
359 d_dlopen=''
360 d_dlsymun=''
361 d_dosuid=''
362 d_suidsafe=''
363 d_drand48_r=''
364 drand48_r_proto=''
365 d_drand48proto=''
366 d_dup2=''
367 d_eaccess=''
368 d_endgrent=''
369 d_endgrent_r=''
370 endgrent_r_proto=''
371 d_endhent=''
372 d_endhostent_r=''
373 endhostent_r_proto=''
374 d_endnent=''
375 d_endnetent_r=''
376 endnetent_r_proto=''
377 d_endpent=''
378 d_endprotoent_r=''
379 endprotoent_r_proto=''
380 d_endpwent=''
381 d_endpwent_r=''
382 endpwent_r_proto=''
383 d_endsent=''
384 d_endservent_r=''
385 endservent_r_proto=''
386 d_fchdir=''
387 d_fchmod=''
388 d_fchown=''
389 d_fcntl=''
390 d_fcntl_can_lock=''
391 d_fd_macros=''
392 d_fd_set=''
393 d_fds_bits=''
394 d_fgetpos=''
395 d_finite=''
396 d_finitel=''
397 d_flexfnam=''
398 d_flock=''
399 d_flockproto=''
400 d_fork=''
401 d_fp_class=''
402 d_fpclass=''
403 d_fpclassify=''
404 d_fpclassl=''
405 d_fpos64_t=''
406 d_frexpl=''
407 d_fs_data_s=''
408 d_fseeko=''
409 d_fsetpos=''
410 d_fstatfs=''
411 d_fsync=''
412 d_ftello=''
413 d_ftime=''
414 d_gettimeod=''
415 d_Gconvert=''
416 d_getcwd=''
417 d_getespwnam=''
418 d_getfsstat=''
419 d_getgrent=''
420 d_getgrent_r=''
421 getgrent_r_proto=''
422 d_getgrgid_r=''
423 getgrgid_r_proto=''
424 d_getgrnam_r=''
425 getgrnam_r_proto=''
426 d_getgrps=''
427 d_gethbyaddr=''
428 d_gethbyname=''
429 d_gethent=''
430 aphostname=''
431 d_gethname=''
432 d_phostname=''
433 d_uname=''
434 d_gethostbyaddr_r=''
435 gethostbyaddr_r_proto=''
436 d_gethostbyname_r=''
437 gethostbyname_r_proto=''
438 d_gethostent_r=''
439 gethostent_r_proto=''
440 d_gethostprotos=''
441 d_getitimer=''
442 d_getlogin=''
443 d_getlogin_r=''
444 getlogin_r_proto=''
445 d_getmnt=''
446 d_getmntent=''
447 d_getnbyaddr=''
448 d_getnbyname=''
449 d_getnent=''
450 d_getnetbyaddr_r=''
451 getnetbyaddr_r_proto=''
452 d_getnetbyname_r=''
453 getnetbyname_r_proto=''
454 d_getnetent_r=''
455 getnetent_r_proto=''
456 d_getnetprotos=''
457 d_getpagsz=''
458 d_getpent=''
459 d_getpgid=''
460 d_getpgrp2=''
461 d_bsdgetpgrp=''
462 d_getpgrp=''
463 d_getppid=''
464 d_getprior=''
465 d_getpbyname=''
466 d_getpbynumber=''
467 d_getprotobyname_r=''
468 getprotobyname_r_proto=''
469 d_getprotobynumber_r=''
470 getprotobynumber_r_proto=''
471 d_getprotoent_r=''
472 getprotoent_r_proto=''
473 d_getprotoprotos=''
474 d_getprpwnam=''
475 d_getpwent=''
476 d_getpwent_r=''
477 getpwent_r_proto=''
478 d_getpwnam_r=''
479 getpwnam_r_proto=''
480 d_getpwuid_r=''
481 getpwuid_r_proto=''
482 d_getsent=''
483 d_getservbyname_r=''
484 getservbyname_r_proto=''
485 d_getservbyport_r=''
486 getservbyport_r_proto=''
487 d_getservent_r=''
488 getservent_r_proto=''
489 d_getservprotos=''
490 d_getspnam=''
491 d_getspnam_r=''
492 getspnam_r_proto=''
493 d_getsbyname=''
494 d_getsbyport=''
495 d_gmtime_r=''
496 gmtime_r_proto=''
497 d_gnulibc=''
498 gnulibc_version=''
499 d_hasmntopt=''
500 d_htonl=''
501 d_inetaton=''
502 d_int64_t=''
503 d_isascii=''
504 d_isfinite=''
505 d_isinf=''
506 d_isnan=''
507 d_isnanl=''
508 d_killpg=''
509 d_lchown=''
510 d_ldbl_dig=''
511 d_link=''
512 d_localtime_r=''
513 localtime_r_proto=''
514 d_locconv=''
515 d_lockf=''
516 d_longdbl=''
517 longdblsize=''
518 d_longlong=''
519 longlongsize=''
520 d_lseekproto=''
521 d_lstat=''
522 d_madvise=''
523 d_mblen=''
524 d_mbstowcs=''
525 d_mbtowc=''
526 d_memchr=''
527 d_memcmp=''
528 d_memcpy=''
529 d_memmove=''
530 d_memset=''
531 d_mkdir=''
532 d_mkdtemp=''
533 d_mkfifo=''
534 d_mkstemp=''
535 d_mkstemps=''
536 d_mktime=''
537 d_mmap=''
538 mmaptype=''
539 d_modfl=''
540 d_modfl_pow32_bug=''
541 d_modflproto=''
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_nanosleep=''
552 d_nice=''
553 d_nl_langinfo=''
554 d_off64_t=''
555 d_open3=''
556 d_fpathconf=''
557 d_pathconf=''
558 d_pause=''
559 d_pipe=''
560 d_poll=''
561 d_portable=''
562 d_procselfexe=''
563 procselfexe=''
564 d_old_pthread_create_joinable=''
565 old_pthread_create_joinable=''
566 d_pthread_atfork=''
567 d_pthread_yield=''
568 d_sched_yield=''
569 sched_yield=''
570 d_qgcvt=''
571 d_random_r=''
572 random_r_proto=''
573 d_readdir64_r=''
574 readdir64_r_proto=''
575 d_readdir=''
576 d_rewinddir=''
577 d_seekdir=''
578 d_telldir=''
579 d_readdir_r=''
580 readdir_r_proto=''
581 d_readlink=''
582 d_readv=''
583 d_recvmsg=''
584 d_rename=''
585 d_rmdir=''
586 d_safebcpy=''
587 d_safemcpy=''
588 d_sanemcmp=''
589 d_sbrkproto=''
590 d_select=''
591 d_sem=''
592 d_semctl=''
593 d_semget=''
594 d_semop=''
595 d_sendmsg=''
596 d_setegid=''
597 d_seteuid=''
598 d_setgrent=''
599 d_setgrent_r=''
600 setgrent_r_proto=''
601 d_setgrps=''
602 d_sethent=''
603 d_sethostent_r=''
604 sethostent_r_proto=''
605 d_setitimer=''
606 d_setlinebuf=''
607 d_setlocale=''
608 d_setlocale_r=''
609 setlocale_r_proto=''
610 d_setnent=''
611 d_setnetent_r=''
612 setnetent_r_proto=''
613 d_setpent=''
614 d_setpgid=''
615 d_setpgrp2=''
616 d_bsdsetpgrp=''
617 d_setpgrp=''
618 d_setprior=''
619 d_setproctitle=''
620 d_setprotoent_r=''
621 setprotoent_r_proto=''
622 d_setpwent=''
623 d_setpwent_r=''
624 setpwent_r_proto=''
625 d_setregid=''
626 d_setresgid=''
627 d_setresuid=''
628 d_setreuid=''
629 d_setrgid=''
630 d_setruid=''
631 d_setsent=''
632 d_setservent_r=''
633 setservent_r_proto=''
634 d_setsid=''
635 d_setvbuf=''
636 d_sfio=''
637 usesfio=''
638 d_shm=''
639 d_shmat=''
640 d_shmatprototype=''
641 shmattype=''
642 d_shmctl=''
643 d_shmdt=''
644 d_shmget=''
645 d_sigaction=''
646 d_sigprocmask=''
647 d_sigsetjmp=''
648 d_sockatmark=''
649 d_sockatmarkproto=''
650 d_msg_ctrunc=''
651 d_msg_dontroute=''
652 d_msg_oob=''
653 d_msg_peek=''
654 d_msg_proxy=''
655 d_oldsock=''
656 d_scm_rights=''
657 d_socket=''
658 d_sockpair=''
659 sockethdr=''
660 socketlib=''
661 d_socklen_t=''
662 d_socks5_init=''
663 d_sqrtl=''
664 d_srand48_r=''
665 srand48_r_proto=''
666 d_srandom_r=''
667 srandom_r_proto=''
668 d_sresgproto=''
669 d_sresuproto=''
670 d_statblks=''
671 d_statfs_f_flags=''
672 d_statfs_s=''
673 d_fstatvfs=''
674 d_statvfs=''
675 d_stdio_cnt_lval=''
676 d_stdio_ptr_lval=''
677 d_stdio_ptr_lval_nochange_cnt=''
678 d_stdio_ptr_lval_sets_cnt=''
679 d_stdiobase=''
680 d_stdstdio=''
681 stdio_base=''
682 stdio_bufsiz=''
683 stdio_cnt=''
684 stdio_filbuf=''
685 stdio_ptr=''
686 d_index=''
687 d_strchr=''
688 d_strcoll=''
689 d_strctcpy=''
690 d_strerrm=''
691 d_strerror=''
692 d_sysernlst=''
693 d_syserrlst=''
694 d_strerror_r=''
695 strerror_r_proto=''
696 d_strftime=''
697 d_strtod=''
698 d_strtol=''
699 d_strtold=''
700 d_strtoll=''
701 d_strtoq=''
702 d_strtoul=''
703 d_strtoull=''
704 d_strtouq=''
705 d_strxfrm=''
706 d_symlink=''
707 d_syscall=''
708 d_syscallproto=''
709 d_sysconf=''
710 d_system=''
711 d_tcgetpgrp=''
712 d_tcsetpgrp=''
713 d_telldirproto=''
714 d_time=''
715 timetype=''
716 clocktype=''
717 d_times=''
718 d_tmpnam_r=''
719 tmpnam_r_proto=''
720 d_truncate=''
721 d_ttyname_r=''
722 ttyname_r_proto=''
723 d_tzname=''
724 d_u32align=''
725 d_ualarm=''
726 d_umask=''
727 d_semctl_semid_ds=''
728 d_semctl_semun=''
729 d_union_semun=''
730 d_unordered=''
731 d_usleep=''
732 d_usleepproto=''
733 d_ustat=''
734 d_vfork=''
735 usevfork=''
736 d_voidsig=''
737 signal_t=''
738 d_volatile=''
739 d_charvspr=''
740 d_vprintf=''
741 d_wait4=''
742 d_waitpid=''
743 d_wcstombs=''
744 d_wctomb=''
745 d_writev=''
746 dlext=''
747 cccdlflags=''
748 ccdlflags=''
749 dlsrc=''
750 ld=''
751 lddlflags=''
752 usedl=''
753 doublesize=''
754 ebcdic=''
755 fflushNULL=''
756 fflushall=''
757 fpossize=''
758 fpostype=''
759 gccansipedantic=''
760 gccosandvers=''
761 gccversion=''
762 gidformat=''
763 gidsign=''
764 gidsize=''
765 gidtype=''
766 groupstype=''
767 h_fcntl=''
768 h_sysfile=''
769 i_arpainet=''
770 i_crypt=''
771 db_hashtype=''
772 db_prefixtype=''
773 db_version_major=''
774 db_version_minor=''
775 db_version_patch=''
776 i_db=''
777 i_dbm=''
778 i_rpcsvcdbm=''
779 d_dirnamlen=''
780 direntrytype=''
781 i_dirent=''
782 i_dld=''
783 i_dlfcn=''
784 i_fcntl=''
785 i_float=''
786 i_fp=''
787 i_fp_class=''
788 i_gdbm=''
789 d_grpasswd=''
790 i_grp=''
791 i_ieeefp=''
792 i_inttypes=''
793 i_langinfo=''
794 i_libutil=''
795 i_limits=''
796 i_locale=''
797 i_machcthr=''
798 i_malloc=''
799 i_math=''
800 i_memory=''
801 i_mntent=''
802 i_ndbm=''
803 i_netdb=''
804 i_neterrno=''
805 i_netinettcp=''
806 i_niin=''
807 i_sysin=''
808 i_poll=''
809 i_prot=''
810 i_pthread=''
811 d_pwage=''
812 d_pwchange=''
813 d_pwclass=''
814 d_pwcomment=''
815 d_pwexpire=''
816 d_pwgecos=''
817 d_pwpasswd=''
818 d_pwquota=''
819 i_pwd=''
820 i_sfio=''
821 i_shadow=''
822 i_socks=''
823 i_stddef=''
824 i_stdlib=''
825 i_string=''
826 strings=''
827 i_sunmath=''
828 i_sysaccess=''
829 i_sysdir=''
830 i_sysfile=''
831 d_voidtty=''
832 i_bsdioctl=''
833 i_sysfilio=''
834 i_sysioctl=''
835 i_syssockio=''
836 i_syslog=''
837 i_sysmman=''
838 i_sysmode=''
839 i_sysmount=''
840 i_sysndir=''
841 i_sysparam=''
842 i_sysresrc=''
843 i_syssecrt=''
844 i_sysselct=''
845 i_sysstat=''
846 i_sysstatfs=''
847 i_sysstatvfs=''
848 i_systimes=''
849 i_systypes=''
850 i_sysuio=''
851 i_sysun=''
852 i_sysutsname=''
853 i_sysvfs=''
854 i_syswait=''
855 i_sgtty=''
856 i_termio=''
857 i_termios=''
858 d_tm_tm_gmtoff=''
859 d_tm_tm_zone=''
860 i_systime=''
861 i_systimek=''
862 i_time=''
863 timeincl=''
864 i_unistd=''
865 i_ustat=''
866 i_utime=''
867 i_values=''
868 i_stdarg=''
869 i_varargs=''
870 i_varhdr=''
871 i_vfork=''
872 inc_version_list=''
873 inc_version_list_init=''
874 installprefix=''
875 installprefixexp=''
876 installstyle=''
877 installusrbinperl=''
878 intsize=''
879 longsize=''
880 shortsize=''
881 issymlink=''
882 libc=''
883 ldlibpthname=''
884 libperl=''
885 shrpenv=''
886 useshrplib=''
887 glibpth=''
888 libpth=''
889 loclibpth=''
890 plibpth=''
891 xlibpth=''
892 ignore_versioned_solibs=''
893 libs=''
894 libsdirs=''
895 libsfiles=''
896 libsfound=''
897 libspath=''
898 lns=''
899 d_PRIEUldbl=''
900 d_PRIFUldbl=''
901 d_PRIGUldbl=''
902 d_PRIeldbl=''
903 d_PRIfldbl=''
904 d_PRIgldbl=''
905 d_SCNfldbl=''
906 sPRIEUldbl=''
907 sPRIFUldbl=''
908 sPRIGUldbl=''
909 sPRIeldbl=''
910 sPRIfldbl=''
911 sPRIgldbl=''
912 sSCNfldbl=''
913 lseeksize=''
914 lseektype=''
915 make_set_make=''
916 d_mymalloc=''
917 freetype=''
918 mallocobj=''
919 mallocsrc=''
920 malloctype=''
921 usemymalloc=''
922 installman1dir=''
923 man1dir=''
924 man1direxp=''
925 man1ext=''
926 installman3dir=''
927 man3dir=''
928 man3direxp=''
929 man3ext=''
930 modetype=''
931 multiarch=''
932 mydomain=''
933 myhostname=''
934 phostname=''
935 c=''
936 n=''
937 d_eofnblk=''
938 eagain=''
939 o_nonblock=''
940 rd_nodata=''
941 need_va_copy=''
942 netdb_hlen_type=''
943 netdb_host_type=''
944 netdb_name_type=''
945 netdb_net_type=''
946 groupcat=''
947 hostcat=''
948 passcat=''
949 orderlib=''
950 ranlib=''
951 d_perl_otherlibdirs=''
952 otherlibdirs=''
953 package=''
954 spackage=''
955 pager=''
956 api_revision=''
957 api_subversion=''
958 api_version=''
959 api_versionstring=''
960 patchlevel=''
961 perl_patchlevel=''
962 revision=''
963 subversion=''
964 version=''
965 version_patchlevel_string=''
966 perl5=''
967 perladmin=''
968 perlpath=''
969 d_nv_preserves_uv=''
970 i16size=''
971 i16type=''
972 i32size=''
973 i32type=''
974 i64size=''
975 i64type=''
976 i8size=''
977 i8type=''
978 ivsize=''
979 ivtype=''
980 nv_preserves_uv_bits=''
981 nvsize=''
982 nvtype=''
983 u16size=''
984 u16type=''
985 u32size=''
986 u32type=''
987 u64size=''
988 u64type=''
989 u8size=''
990 u8type=''
991 uvsize=''
992 uvtype=''
993 ivdformat=''
994 nvEUformat=''
995 nvFUformat=''
996 nvGUformat=''
997 nveformat=''
998 nvfformat=''
999 nvgformat=''
1000 uvXUformat=''
1001 uvoformat=''
1002 uvuformat=''
1003 uvxformat=''
1004 pidtype=''
1005 prefix=''
1006 prefixexp=''
1007 installprivlib=''
1008 privlib=''
1009 privlibexp=''
1010 prototype=''
1011 ptrsize=''
1012 d_PRIXU64=''
1013 d_PRId64=''
1014 d_PRIi64=''
1015 d_PRIo64=''
1016 d_PRIu64=''
1017 d_PRIx64=''
1018 sPRIXU64=''
1019 sPRId64=''
1020 sPRIi64=''
1021 sPRIo64=''
1022 sPRIu64=''
1023 sPRIx64=''
1024 d_quad=''
1025 quadkind=''
1026 quadtype=''
1027 uquadtype=''
1028 drand01=''
1029 randbits=''
1030 randfunc=''
1031 randseedtype=''
1032 seedfunc=''
1033 installscript=''
1034 scriptdir=''
1035 scriptdirexp=''
1036 selectminbits=''
1037 selecttype=''
1038 sh=''
1039 sig_count=''
1040 sig_name=''
1041 sig_name_init=''
1042 sig_num=''
1043 sig_num_init=''
1044 sig_size=''
1045 installsitearch=''
1046 sitearch=''
1047 sitearchexp=''
1048 installsitebin=''
1049 sitebin=''
1050 sitebinexp=''
1051 installsitelib=''
1052 sitelib=''
1053 sitelib_stem=''
1054 sitelibexp=''
1055 siteprefix=''
1056 siteprefixexp=''
1057 sizesize=''
1058 sizetype=''
1059 so=''
1060 socksizetype=''
1061 sharpbang=''
1062 shsharp=''
1063 spitshell=''
1064 src=''
1065 ssizetype=''
1066 startperl=''
1067 startsh=''
1068 stdchar=''
1069 d_stdio_stream_array=''
1070 stdio_stream_array=''
1071 sysman=''
1072 trnl=''
1073 uidformat=''
1074 uidsign=''
1075 uidsize=''
1076 uidtype=''
1077 archname64=''
1078 use64bitall=''
1079 use64bitint=''
1080 ccflags_uselargefiles=''
1081 ldflags_uselargefiles=''
1082 libswanted_uselargefiles=''
1083 uselargefiles=''
1084 uselongdouble=''
1085 usemorebits=''
1086 usemultiplicity=''
1087 nm_opt=''
1088 nm_so_opt=''
1089 runnm=''
1090 usenm=''
1091 useperlio=''
1092 usesocks=''
1093 d_oldpthreads=''
1094 use5005threads=''
1095 useithreads=''
1096 usereentrant=''
1097 usethreads=''
1098 incpath=''
1099 mips_type=''
1100 usrinc=''
1101 d_vendorarch=''
1102 installvendorarch=''
1103 vendorarch=''
1104 vendorarchexp=''
1105 d_vendorbin=''
1106 installvendorbin=''
1107 vendorbin=''
1108 vendorbinexp=''
1109 d_vendorlib=''
1110 installvendorlib=''
1111 vendorlib=''
1112 vendorlib_stem=''
1113 vendorlibexp=''
1114 usevendorprefix=''
1115 vendorprefix=''
1116 vendorprefixexp=''
1117 versiononly=''
1118 defvoidused=''
1119 voidflags=''
1120 pm_apiversion=''
1121 xs_apiversion=''
1122 yacc=''
1123 yaccflags=''
1124 CONFIG=''
1125
1126 define='define'
1127 undef='undef'
1128 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1129 rmlist=''
1130
1131 : We must find out about Eunice early
1132 eunicefix=':'
1133 if test -f /etc/unixtovms; then
1134         eunicefix=/etc/unixtovms
1135 fi
1136 if test -f /etc/unixtovms.exe; then
1137         eunicefix=/etc/unixtovms.exe
1138 fi
1139
1140 : Set executable suffix now -- needed before hints available
1141 if test -f "/libs/version.library"; then
1142 : Amiga OS
1143     _exe=""
1144 elif test -f "/system/gnu_library/bin/ar.pm"; then
1145 : Stratus VOS
1146     _exe=".pm"
1147 elif test -n "$DJGPP"; then
1148 : DOS DJGPP
1149     _exe=".exe"
1150 elif test -d c:/. ; then
1151 : OS/2 or cygwin
1152     _exe=".exe"
1153 fi
1154
1155 i_whoami=''
1156 ccname=''
1157 ccversion=''
1158 perllibs=''
1159 : set useposix=false in your hint file to disable the POSIX extension.
1160 useposix=true
1161 : set useopcode=false in your hint file to disable the Opcode extension.
1162 useopcode=true
1163 : Trailing extension.  Override this in a hint file, if needed.
1164 : Extra object files, if any, needed on this platform.
1165 archobjs=''
1166 archname=''
1167 : Possible local include directories to search.
1168 : Set locincpth to "" in a hint file to defeat local include searches.
1169 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1170 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1171 :
1172 : no include file wanted by default
1173 inclwanted=''
1174
1175 groupstype=''
1176 libnames=''
1177 : change the next line if compiling for Xenix/286 on Xenix/386
1178 xlibpth='/usr/lib/386 /lib/386'
1179 : Possible local library directories to search.
1180 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1181 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1182
1183 : general looking path for locating libraries
1184 glibpth="/lib /usr/lib $xlibpth"
1185 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1186 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1187 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1188
1189 : Private path used by Configure to find libraries.  Its value
1190 : is prepended to libpth. This variable takes care of special
1191 : machines, like the mips.  Usually, it should be empty.
1192 plibpth=''
1193
1194 : default library list
1195 libswanted=''
1196 : some systems want to use only the non-versioned libso:s
1197 ignore_versioned_solibs=''
1198 archname64=''
1199 ccflags_uselargefiles=''
1200 ldflags_uselargefiles=''
1201 libswanted_uselargefiles=''
1202 : set usemultiplicity on the Configure command line to enable multiplicity.
1203 : set usesocks on the Configure command line to enable socks.
1204 : set usethreads on the Configure command line to enable threads.
1205 usereentrant='undef'
1206 : full support for void wanted by default
1207 defvoidused=15
1208
1209 : List of libraries we want.
1210 : If anyone needs -lnet, put it in a hint file.
1211 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1212 libswanted="$libswanted dld ld sun m c cposix posix"
1213 libswanted="$libswanted ndir dir crypt sec"
1214 libswanted="$libswanted ucb bsd BSD PW x util"
1215 : We probably want to search /usr/shlib before most other libraries.
1216 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1217 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1218 glibpth="/usr/shlib $glibpth"
1219 : Do not use vfork unless overridden by a hint file.
1220 usevfork=false
1221
1222 : Find the basic shell for Bourne shell scripts
1223 case "$sh" in
1224 '')
1225         case "$SYSTYPE" in
1226         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1227         *) xxx='/bin/sh';;
1228         esac
1229         if test -f "$xxx"; then
1230                 sh="$xxx"
1231         else
1232                 : Build up a list and do a single loop so we can 'break' out.
1233                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1234                 for xxx in sh bash ksh pdksh ash; do
1235                         for p in $pth; do
1236                                 try="$try ${p}/${xxx}"
1237                         done
1238                 done
1239                 for xxx in $try; do
1240                         if test -f "$xxx"; then
1241                                 sh="$xxx";
1242                                 break
1243                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1244                                 sh="$xxx";
1245                                 break
1246                         elif test -f "$xxx.exe"; then
1247                                 sh="$xxx";
1248                                 break
1249                         fi
1250                 done
1251         fi
1252         ;;
1253 esac
1254
1255 case "$sh" in
1256 '')     cat >&2 <<EOM
1257 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1258
1259 Usually it's in /bin/sh.  How did you even get this far?
1260 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1261 we'll try to straighten this all out.
1262 EOM
1263         exit 1
1264         ;;
1265 esac
1266
1267 : see if sh knows # comments
1268 if `$sh -c '#' >/dev/null 2>&1`; then
1269         shsharp=true
1270         spitshell=cat
1271         xcat=/bin/cat
1272         test -f $xcat$_exe || xcat=/usr/bin/cat
1273         if test ! -f $xcat$_exe; then
1274                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1275                         if test -f $p/cat$_exe; then
1276                                 xcat=$p/cat
1277                                 break
1278                         fi
1279                 done
1280                 if test ! -f $xcat$_exe; then
1281                         echo "Can't find cat anywhere!"
1282                         exit 1
1283                 fi
1284         fi
1285         echo "#!$xcat" >sharp
1286         $eunicefix sharp
1287         chmod +x sharp
1288         ./sharp > today
1289         if test -s today; then
1290                 sharpbang='#!'
1291         else
1292                 echo "#! $xcat" > sharp
1293                 $eunicefix sharp
1294                 chmod +x sharp
1295                 ./sharp > today
1296                 if test -s today; then
1297                         sharpbang='#! '
1298                 else
1299                         sharpbang=': use '
1300                 fi
1301         fi
1302 else
1303         echo " "
1304         echo "Your $sh doesn't grok # comments--I will strip them later on."
1305         shsharp=false
1306         cd ..
1307         echo "exec grep -v '^[  ]*#'" >spitshell
1308         chmod +x spitshell
1309         $eunicefix spitshell
1310         spitshell=`pwd`/spitshell
1311         cd UU
1312         echo "I presume that if # doesn't work, #! won't work either!"
1313         sharpbang=': use '
1314 fi
1315 rm -f sharp today
1316
1317 : figure out how to guarantee sh startup
1318 case "$startsh" in
1319 '') startsh=${sharpbang}${sh} ;;
1320 *)
1321 esac
1322 cat >sharp <<EOSS
1323 $startsh
1324 set abc
1325 test "$?abc" != 1
1326 EOSS
1327
1328 chmod +x sharp
1329 $eunicefix sharp
1330 if ./sharp; then
1331         : echo "Yup, it does."
1332 else
1333         echo "Hmm... '$startsh' does not guarantee sh startup..."
1334         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1335 fi
1336 rm -f sharp
1337
1338
1339 : Save command line options in file UU/cmdline.opt for later use in
1340 : generating config.sh.
1341 cat > cmdline.opt <<EOSH
1342 # Configure command line arguments.
1343 config_arg0='$0'
1344 config_args='$*'
1345 config_argc=$#
1346 EOSH
1347 argn=1
1348 args_exp=''
1349 args_sep=''
1350 for arg in "$@"; do
1351         cat >>cmdline.opt <<EOSH
1352 config_arg$argn='$arg'
1353 EOSH
1354         # Extreme backslashitis: replace each ' by '"'"'
1355         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1356 $arg
1357 EOC
1358         arg_exp=`cat cmdl.opt`
1359         args_exp="$args_exp$args_sep'$arg_exp'"
1360         argn=`expr $argn + 1`
1361         args_sep=' '
1362 done
1363 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1364 # used by ./hints/os2.sh
1365 rm -f cmdl.opt
1366
1367 : produce awk script to parse command line options
1368 cat >options.awk <<'EOF'
1369 BEGIN {
1370         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1371
1372         len = length(optstr);
1373         for (i = 1; i <= len; i++) {
1374                 c = substr(optstr, i, 1);
1375                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1376                 if (a == ":") {
1377                         arg[c] = 1;
1378                         i++;
1379                 }
1380                 opt[c] = 1;
1381         }
1382 }
1383 {
1384         expect = 0;
1385         str = $0;
1386         if (substr(str, 1, 1) != "-") {
1387                 printf("'%s'\n", str);
1388                 next;
1389         }
1390         len = length($0);
1391         for (i = 2; i <= len; i++) {
1392                 c = substr(str, i, 1);
1393                 if (!opt[c]) {
1394                         printf("-%s\n", substr(str, i));
1395                         next;
1396                 }
1397                 printf("-%s\n", c);
1398                 if (arg[c]) {
1399                         if (i < len)
1400                                 printf("'%s'\n", substr(str, i + 1));
1401                         else
1402                                 expect = 1;
1403                         next;
1404                 }
1405         }
1406 }
1407 END {
1408         if (expect)
1409                 print "?";
1410 }
1411 EOF
1412
1413 : process the command line options
1414 set X `for arg in "$@"; do echo "X$arg"; done |
1415         sed -e s/X// | awk -f options.awk`
1416 eval "set $*"
1417 shift
1418 rm -f options.awk
1419
1420 : set up default values
1421 fastread=''
1422 reuseval=false
1423 config_sh=''
1424 alldone=''
1425 error=''
1426 silent=''
1427 extractsh=''
1428 override=''
1429 knowitall=''
1430 rm -f optdef.sh posthint.sh
1431 cat >optdef.sh <<EOS
1432 $startsh
1433 EOS
1434
1435
1436 : option parsing
1437 while test $# -gt 0; do
1438         case "$1" in
1439         -d) shift; fastread=yes;;
1440         -e) shift; alldone=cont;;
1441         -f)
1442                 shift
1443                 cd ..
1444                 if test -r "$1"; then
1445                         config_sh="$1"
1446                 else
1447                         echo "$me: cannot read config file $1." >&2
1448                         error=true
1449                 fi
1450                 cd UU
1451                 shift;;
1452         -h) shift; error=true;;
1453         -r) shift; reuseval=true;;
1454         -s) shift; silent=true; realsilent=true;;
1455         -E) shift; alldone=exit;;
1456         -K) shift; knowitall=true;;
1457         -O) shift; override=true;;
1458         -S) shift; silent=true; extractsh=true;;
1459         -D)
1460                 shift
1461                 case "$1" in
1462                 *=)
1463                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1464                         echo "$me: ignoring -D $1" >&2
1465                         ;;
1466                 *=*) echo "$1" | \
1467                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1468                 *) echo "$1='define'" >> optdef.sh;;
1469                 esac
1470                 shift
1471                 ;;
1472         -U)
1473                 shift
1474                 case "$1" in
1475                 *=) echo "$1" >> optdef.sh;;
1476                 *=*)
1477                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1478                         echo "$me: ignoring -U $1" >&2
1479                         ;;
1480                 *) echo "$1='undef'" >> optdef.sh;;
1481                 esac
1482                 shift
1483                 ;;
1484         -A)
1485             shift
1486             xxx=''
1487             yyy="$1"
1488             zzz=''
1489             uuu=undef
1490             case "$yyy" in
1491             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1492                  case "$zzz" in
1493                  *:*) zzz='' ;;
1494                  *)   xxx=append
1495                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1496                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1497                  esac
1498                  ;;
1499             esac
1500             case "$xxx" in
1501             '')  case "$yyy" in
1502                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1503                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1504                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1505                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1506                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1507                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1508                  esac
1509                  ;;       
1510             esac
1511             case "$xxx" in
1512             append)
1513                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1514             clear)
1515                 echo "$yyy=''"                  >> posthint.sh ;;
1516             define)
1517                 case "$zzz" in
1518                 '') zzz=define ;;
1519                 esac
1520                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1521             eval)
1522                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1523             prepend)
1524                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1525             undef)
1526                 case "$zzz" in
1527                 '') zzz="$uuu" ;;
1528                 esac
1529                 echo "$yyy=$zzz"                >> posthint.sh ;;
1530             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1531             esac
1532             shift
1533             ;;
1534         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1535             exit 0;;
1536         --) break;;
1537         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1538         *) break;;
1539         esac
1540 done
1541
1542 case "$error" in
1543 true)
1544         cat >&2 <<EOM
1545 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1546                  [-U symbol] [-U symbol=] [-A command:symbol...]
1547   -d : use defaults for all answers.
1548   -e : go on without questioning past the production of config.sh.
1549   -f : specify an alternate default configuration file.
1550   -h : print this help message and exit (with an error status).
1551   -r : reuse C symbols value if possible (skips costly nm extraction).
1552   -s : silent mode, only echoes questions and essential information.
1553   -D : define symbol to have some value:
1554          -D symbol         symbol gets the value 'define'
1555          -D symbol=value   symbol gets the value 'value'
1556   -E : stop at the end of questions, after having produced config.sh.
1557   -K : do not use unless you know what you are doing.
1558   -O : let -D and -U override definitions from loaded configuration file.
1559   -S : perform variable substitutions on all .SH files (can mix with -f)
1560   -U : undefine symbol:
1561          -U symbol    symbol gets the value 'undef'
1562          -U symbol=   symbol gets completely empty
1563   -A : manipulate symbol after the platform specific hints have been applied:
1564          -A symbol=value                append " "value to symbol
1565          -A append:symbol=value         append value to symbol
1566          -A define:symbol=value         define symbol to have value
1567          -A clear:symbol                define symbol to be ''
1568          -A define:symbol               define symbol to be 'define'
1569          -A eval:symbol=value           define symbol to be eval of value
1570          -A prepend:symbol=value        prepend value to symbol
1571          -A undef:symbol                define symbol to be 'undef'
1572          -A undef:symbol=               define symbol to be ''
1573   -V : print version number and exit (with a zero status).
1574 EOM
1575         exit 1
1576         ;;
1577 esac
1578
1579 : Sanity checks
1580 case "$fastread$alldone" in
1581 yescont|yesexit) ;;
1582 *)
1583         case "$extractsh" in
1584         true) ;;
1585         *)
1586                 if test ! -t 0; then
1587                         echo "Say 'sh Configure', not 'sh <Configure'"
1588                         exit 1
1589                 fi
1590                 ;;
1591         esac
1592         ;;
1593 esac
1594
1595 exec 4>&1
1596 case "$silent" in
1597 true) exec 1>/dev/null;;
1598 esac
1599
1600 : run the defines and the undefines, if any, but leave the file out there...
1601 touch optdef.sh
1602 . ./optdef.sh
1603 : create the posthint manipulation script and leave the file out there...
1604 touch posthint.sh
1605
1606 : set package name
1607 package=perl5
1608 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1609 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1610 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1611 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1612 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1613 esac
1614
1615 : Some greps do not return status, grrr.
1616 echo "grimblepritz" >grimble
1617 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1618         contains=contains
1619 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1620         contains=grep
1621 else
1622         contains=contains
1623 fi
1624 rm -f grimble
1625 : the following should work in any shell
1626 case "$contains" in
1627 contains*)
1628         echo " "
1629         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1630         cat >contains <<'EOSS'
1631 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1632 EOSS
1633 chmod +x contains
1634 esac
1635
1636 : Find the path to the source tree
1637 case "$src" in
1638 '') case "$0" in
1639     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1640          case "$src" in
1641          /*)    ;;
1642          .)     ;;
1643          *)     src=`cd ../$src && pwd` ;;
1644          esac
1645          ;;
1646     *)   src='.';;
1647     esac;;
1648 esac
1649 case "$src" in
1650 '')     src=/
1651         rsrc=/
1652         ;;
1653 /*) rsrc="$src";;
1654 *) rsrc="../$src";;
1655 esac
1656 if test -f $rsrc/Configure && \
1657         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1658 then
1659    : found it, so we are ok.
1660 else
1661         rsrc=''
1662         for src in . .. ../.. ../../.. ../../../..; do
1663                 if test -f ../$src/Configure && \
1664                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1665                 then
1666                         rsrc=../$src
1667                         break
1668                 fi
1669         done
1670 fi
1671 case "$rsrc" in
1672 '')
1673         cat <<EOM >&4
1674
1675 Sorry, I can't seem to locate the source dir for $package.  Please start
1676 Configure with an explicit path -- i.e. /some/path/Configure.
1677
1678 EOM
1679         exit 1
1680         ;;
1681 ../.)   rsrc='..';;
1682 *)
1683         echo " "
1684         echo "Sources for $package found in \"$src\"." >&4
1685         ;;
1686 esac
1687
1688 : script used to extract .SH files with variable substitutions
1689 cat >extract <<'EOS'
1690 PERL_CONFIG_SH=true
1691 echo "Doing variable substitutions on .SH files..."
1692 if test -f MANIFEST; then
1693         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1694 else
1695         echo "(Looking for .SH files under the source directory.)"
1696         set x `(cd "$src"; find . -name "*.SH" -print)`
1697 fi
1698 shift
1699 case $# in
1700 0) set x `(cd "$src"; echo *.SH)`; shift;;
1701 esac
1702 if test ! -f "$src/$1"; then
1703         shift
1704 fi
1705 mkdir_p='
1706 name=$1;
1707 create="";
1708 while test $name; do
1709         if test ! -d "$name"; then
1710                 create="$name $create";
1711                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1712                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1713         else
1714                 name="";
1715         fi;
1716 done;
1717 for file in $create; do
1718         mkdir $file;
1719 done
1720 '
1721 for file in $*; do
1722         case "$src" in
1723         ".")
1724                 case "$file" in
1725                 */*)
1726                         dir=`expr X$file : 'X\(.*\)/'`
1727                         file=`expr X$file : 'X.*/\(.*\)'`
1728                         (cd "$dir" && . ./$file)
1729                         ;;
1730                 *)
1731                         . ./$file
1732                         ;;
1733                 esac
1734                 ;;
1735         *)
1736                 case "$file" in
1737                 */*)
1738                         dir=`expr X$file : 'X\(.*\)/'`
1739                         file=`expr X$file : 'X.*/\(.*\)'`
1740                         (set x $dir; shift; eval $mkdir_p)
1741                         sh <"$src/$dir/$file"
1742                         ;;
1743                 *)
1744                         sh <"$src/$file"
1745                         ;;
1746                 esac
1747                 ;;
1748         esac
1749 done
1750 if test -f "$src/config_h.SH"; then
1751         if test ! -f config.h; then
1752         : oops, they left it out of MANIFEST, probably, so do it anyway.
1753         . "$src/config_h.SH"
1754         fi
1755 fi
1756 EOS
1757
1758 : extract files and exit if asked to do so
1759 case "$extractsh" in
1760 true)
1761         case "$realsilent" in
1762         true) ;;
1763         *) exec 1>&4;;
1764         esac
1765         case "$config_sh" in
1766         '') config_sh='config.sh';;
1767         esac
1768         echo " "
1769         echo "Fetching answers from $config_sh..."
1770         cd ..
1771         . $config_sh
1772         test "$override" && . ./optdef.sh
1773         echo " "
1774         . UU/extract
1775         rm -rf UU
1776         echo "Extraction done."
1777         exit 0
1778         ;;
1779 esac
1780
1781 : Eunice requires " " instead of "", can you believe it
1782 echo " "
1783 : Here we go...
1784 echo "Beginning of configuration questions for $package."
1785
1786 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1787
1788 : first determine how to suppress newline on echo command
1789 echo " "
1790 echo "Checking echo to see how to suppress newlines..."
1791 (echo "hi there\c" ; echo " ") >.echotmp
1792 if $contains c .echotmp >/dev/null 2>&1 ; then
1793         echo "...using -n."
1794         n='-n'
1795         c=''
1796 else
1797         cat <<'EOM'
1798 ...using \c
1799 EOM
1800         n=''
1801         c='\c'
1802 fi
1803 echo $n "The star should be here-->$c"
1804 echo '*'
1805 rm -f .echotmp
1806
1807 : Now test for existence of everything in MANIFEST
1808 echo " "
1809 if test -f "$rsrc/MANIFEST"; then
1810         echo "First let's make sure your kit is complete.  Checking..." >&4
1811         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1812         rm -f missing
1813         tmppwd=`pwd`
1814         for filelist in x??; do
1815                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1816         done
1817         if test -s missing; then
1818                 cat missing >&4
1819                 cat >&4 <<'EOM'
1820
1821 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1822
1823 You have the option of continuing the configuration process, despite the
1824 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1825 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1826 and contact the author (perlbug@perl.org).
1827
1828 EOM
1829                 echo $n "Continue? [n] $c" >&4
1830                 read ans
1831                 case "$ans" in
1832                 y*)
1833                         echo "Continuing..." >&4
1834                         rm -f missing
1835                         ;;
1836                 *)
1837                         echo "ABORTING..." >&4
1838                         kill $$
1839                         ;;
1840                 esac
1841         else
1842                 echo "Looks good..."
1843         fi
1844 else
1845         echo "There is no MANIFEST file.  I hope your kit is complete !"
1846 fi
1847 rm -f missing x??
1848
1849 echo " "
1850 : Find the appropriate value for a newline for tr
1851 if test -n "$DJGPP"; then
1852        trnl='\012'
1853 fi
1854 if test X"$trnl" = X; then
1855         case "`echo foo|tr '\n' x 2>/dev/null`" in
1856         foox) trnl='\n' ;;
1857         esac
1858 fi
1859 if test X"$trnl" = X; then
1860         case "`echo foo|tr '\012' x 2>/dev/null`" in
1861         foox) trnl='\012' ;;
1862         esac
1863 fi
1864 if test X"$trnl" = X; then
1865        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1866        fooxy) trnl='\n\r' ;;
1867        esac
1868 fi
1869 if test X"$trnl" = X; then
1870         cat <<EOM >&2
1871
1872 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1873
1874 EOM
1875         exit 1
1876 fi
1877
1878 : compute the number of columns on the terminal for proper question formatting
1879 case "$COLUMNS" in
1880 '') COLUMNS='80';;
1881 esac
1882
1883 : set up the echo used in my read
1884 myecho="case \"\$xxxm\" in
1885 '') echo $n \"\$rp $c\" >&4;;
1886 *) case \"\$rp\" in
1887         '') echo $n \"[\$xxxm] $c\";;
1888         *)
1889                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1890                         echo \"\$rp\" >&4
1891                         echo $n \"[\$xxxm] $c\" >&4
1892                 else
1893                         echo $n \"\$rp [\$xxxm] $c\" >&4
1894                 fi
1895                 ;;
1896         esac;;
1897 esac"
1898
1899 : now set up to do reads with possible shell escape and default assignment
1900 cat <<EOSC >myread
1901 $startsh
1902 xxxm=\$dflt
1903 $myecho
1904 ans='!'
1905 case "\$fastread" in
1906 yes) case "\$dflt" in
1907         '') ;;
1908         *) ans='';
1909                 case "\$silent-\$rp" in
1910                 true-) ;;
1911                 *) echo " " >&4;;
1912                 esac;;
1913         esac;;
1914 *) case "\$silent" in
1915         true) case "\$rp" in
1916                 '') ans='';;
1917                 esac;;
1918         esac;;
1919 esac
1920 while expr "X\$ans" : "X!" >/dev/null; do
1921         read answ
1922         set x \$xxxm
1923         shift
1924         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1925         case  "\$answ" in
1926         "!")
1927                 sh 1>&4
1928                 echo " "
1929                 $myecho
1930                 ;;
1931         !*)
1932                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1933                 shift
1934                 sh 1>&4 -c "\$*"
1935                 echo " "
1936                 $myecho
1937                 ;;
1938         "\$ans")
1939                 case "\$ans" in
1940                 \\&*)
1941                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1942                         shift
1943                         case "\$1" in
1944                         -d)
1945                                 fastread=yes
1946                                 echo "(OK, I'll run with -d after this question.)" >&4
1947                                 ;;
1948                         -*)
1949                                 echo "*** Sorry, \$1 not supported yet." >&4
1950                                 ;;
1951                         esac
1952                         $myecho
1953                         ans=!
1954                         ;;
1955                 esac;;
1956         *)
1957                 case "\$aok" in
1958                 y)
1959                         echo "*** Substitution done -- please confirm."
1960                         xxxm="\$ans"
1961                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1962                         xxxm="\$ans"
1963                         ans=!
1964                         ;;
1965                 *)
1966                         echo "*** Error -- try again."
1967                         ans=!
1968                         ;;
1969                 esac
1970                 $myecho
1971                 ;;
1972         esac
1973         case "\$ans\$xxxm\$nostick" in
1974         '')
1975                 ans=!
1976                 $myecho
1977                 ;;
1978         esac
1979 done
1980 case "\$ans" in
1981 '') ans="\$xxxm";;
1982 esac
1983 EOSC
1984
1985 : create .config dir to save info across Configure sessions
1986 test -d ../.config || mkdir ../.config
1987 cat >../.config/README <<EOF
1988 This directory created by Configure to save information that should
1989 persist across sessions for $package.
1990
1991 You may safely delete it if you wish.
1992 EOF
1993
1994 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1995 case "$usedevel" in
1996 $define|true|[yY]*) ;;
1997 *) case "$xversion" in
1998    *[13579])
1999         cat >&4 <<EOH
2000 *** WHOA THERE!!! ***
2001
2002     This is an UNSTABLE DEVELOPMENT release.
2003     The version of this $package distribution is $xversion, that is, odd,
2004     (as opposed to even) and that signifies a development release.
2005     If you want a maintenance release, you want an even-numbered version.
2006
2007     Do ***NOT*** install this into production use.
2008     Data corruption and crashes are possible.
2009
2010     It is most seriously suggested that you do not continue any further
2011     unless you want to help in developing and debugging Perl.
2012
2013     If you *still* want to build perl, you can answer 'y' now,
2014     or pass -Dusedevel to Configure.
2015
2016 EOH
2017         rp='Do you really want to continue?'
2018         dflt='n'
2019         . ./myread
2020         case "$ans" in
2021         [yY]) echo >&4 "Okay, continuing."
2022               usedevel="$define" ;;
2023         *) echo >&4 "Okay, bye."
2024            exit 1
2025            ;;
2026         esac
2027         ;;
2028     esac
2029     ;;
2030 esac
2031 case "$usedevel" in
2032 $define|true|[yY]*)
2033         case "$versiononly" in
2034         '') versiononly="$define" ;;
2035         esac
2036         case "$installusrbinperl" in
2037         '') installusrbinperl="$undef" ;;
2038         esac
2039         ;;
2040 esac
2041
2042 : general instructions
2043 needman=true
2044 firsttime=true
2045 user=`(logname) 2>/dev/null`
2046 case "$user" in
2047 '') user=`whoami 2>&1`;;
2048 esac
2049 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2050         firsttime=false
2051         echo " "
2052         rp='Would you like to see the instructions?'
2053         dflt=n
2054         . ./myread
2055         case "$ans" in
2056         [yY]*) ;;
2057         *) needman=false;;
2058         esac
2059 fi
2060 if $needman; then
2061         cat <<EOH
2062
2063 This installation shell script will examine your system and ask you questions
2064 to determine how the perl5 package should be installed. If you get
2065 stuck on a question, you may use a ! shell escape to start a subshell or
2066 execute a command.  Many of the questions will have default answers in square
2067 brackets; typing carriage return will give you the default.
2068
2069 On some of the questions which ask for file or directory names you are allowed
2070 to use the ~name construct to specify the login directory belonging to "name",
2071 even if you don't have a shell which knows about that.  Questions where this is
2072 allowed will be marked "(~name ok)".
2073
2074 EOH
2075         rp=''
2076         dflt='Type carriage return to continue'
2077         . ./myread
2078         cat <<'EOH'
2079
2080 The prompter used in this script allows you to use shell variables and
2081 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2082 in the default answer, as if the default line was a set of arguments given to a
2083 script shell.  This means you may also use $* to repeat the whole default line,
2084 so you do not have to re-type everything to add something to the default.
2085
2086 Everytime there is a substitution, you will have to confirm.  If there is an
2087 error (e.g. an unmatched backtick), the default answer will remain unchanged
2088 and you will be prompted again.
2089
2090 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2091 the questions and use the computed defaults (or the previous answers if there
2092 was already a config.sh file). Type 'Configure -h' for a list of options.
2093 You may also start interactively and then answer '& -d' at any prompt to turn
2094 on the non-interactive behaviour for the remainder of the execution.
2095
2096 EOH
2097         . ./myread
2098         cat <<EOH
2099
2100 Much effort has been expended to ensure that this shell script will run on any
2101 Unix system.  If despite that it blows up on yours, your best bet is to edit
2102 Configure and run it again.  If you can't run Configure for some reason,
2103 you'll have to generate a config.sh file by hand.  Whatever problems you
2104 have, let me (perlbug@perl.org) know how I blew it.
2105
2106 This installation script affects things in two ways:
2107
2108 1) it may do direct variable substitutions on some of the files included
2109    in this kit.
2110 2) it builds a config.h file for inclusion in C programs.  You may edit
2111    any of these files as the need arises after running this script.
2112
2113 If you make a mistake on a question, there is no easy way to back up to it
2114 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2115 files.  Configure will offer to let you do this before it runs the SH files.
2116
2117 EOH
2118         dflt='Type carriage return to continue'
2119         . ./myread
2120         case "$firsttime" in
2121         true) echo $user >>../.config/instruct;;
2122         esac
2123 fi
2124
2125 : find out where common programs are
2126 echo " "
2127 echo "Locating common programs..." >&4
2128 cat <<EOSC >loc
2129 $startsh
2130 case \$# in
2131 0) exit 1;;
2132 esac
2133 thing=\$1
2134 shift
2135 dflt=\$1
2136 shift
2137 for dir in \$*; do
2138         case "\$thing" in
2139         .)
2140         if test -d \$dir/\$thing; then
2141                 echo \$dir
2142                 exit 0
2143         fi
2144         ;;
2145         *)
2146         for thisthing in \$dir/\$thing; do
2147                 : just loop through to pick last item
2148         done
2149         if test -f \$thisthing; then
2150                 echo \$thisthing
2151                 exit 0
2152         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2153                 echo \$thisthing
2154                 exit 0
2155         elif test -f \$dir/\$thing.exe; then
2156                 if test -n "$DJGPP"; then
2157                         echo \$dir/\$thing.exe
2158                 elif test "$eunicefix" != ":"; then
2159                         : on Eunice apparently
2160                         echo \$dir/\$thing
2161                         exit 0
2162                 fi
2163                 exit 0
2164         fi
2165         ;;
2166         esac
2167 done
2168 echo \$dflt
2169 exit 1
2170 EOSC
2171 chmod +x loc
2172 $eunicefix loc
2173 loclist="
2174 awk
2175 cat
2176 chmod
2177 comm
2178 cp
2179 echo
2180 expr
2181 grep
2182 ls
2183 mkdir
2184 rm
2185 sed
2186 sort
2187 touch
2188 tr
2189 uniq
2190 "
2191 trylist="
2192 Mcc
2193 ar
2194 bison
2195 byacc
2196 cpp
2197 csh
2198 date
2199 egrep
2200 gmake
2201 gzip
2202 less
2203 ln
2204 make
2205 more
2206 nm
2207 nroff
2208 pg
2209 test
2210 uname
2211 zip
2212 "
2213 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2214 pth="$pth /lib /usr/lib"
2215 for file in $loclist; do
2216         eval xxx=\$$file
2217         case "$xxx" in
2218         /*|?:[\\/]*)
2219                 if test -f "$xxx"; then
2220                         : ok
2221                 else
2222                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2223                         xxx=`./loc $file $file $pth`
2224                 fi
2225                 ;;
2226         '') xxx=`./loc $file $file $pth`;;
2227         *) xxx=`./loc $xxx $xxx $pth`;;
2228         esac
2229         eval $file=$xxx$_exe
2230         eval _$file=$xxx
2231         case "$xxx" in
2232         /*)
2233                 echo $file is in $xxx.
2234                 ;;
2235         ?:[\\/]*)
2236                 echo $file is in $xxx.
2237                 ;;
2238         *)
2239                 echo "I don't know where '$file' is, and my life depends on it." >&4
2240                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2241                 exit 1
2242                 ;;
2243         esac
2244 done
2245 echo " "
2246 echo "Don't worry if any of the following aren't found..."
2247 say=offhand
2248 for file in $trylist; do
2249         eval xxx=\$$file
2250         case "$xxx" in
2251         /*|?:[\\/]*)
2252                 if test -f "$xxx"; then
2253                         : ok
2254                 else
2255                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2256                         xxx=`./loc $file $file $pth`
2257                 fi
2258                 ;;
2259         '') xxx=`./loc $file $file $pth`;;
2260         *) xxx=`./loc $xxx $xxx $pth`;;
2261         esac
2262         eval $file=$xxx$_exe
2263         eval _$file=$xxx
2264         case "$xxx" in
2265         /*)
2266                 echo $file is in $xxx.
2267                 ;;
2268         ?:[\\/]*)
2269                 echo $file is in $xxx.
2270                 ;;
2271         *)
2272                 echo "I don't see $file out there, $say."
2273                 say=either
2274                 ;;
2275         esac
2276 done
2277 case "$egrep" in
2278 egrep)
2279         echo "Substituting grep for egrep."
2280         egrep=$grep
2281         _egrep=$grep
2282         ;;
2283 esac
2284 case "$ln" in
2285 ln)
2286         echo "Substituting cp for ln."
2287         ln=$cp
2288         _ln=$cp
2289         ;;
2290 esac
2291 case "$make" in
2292 make)   
2293         case "$gmake" in
2294         gmake)
2295         echo "I can't find make or gmake, and my life depends on it." >&4
2296         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2297         exit 1
2298         ;;
2299         esac
2300         ;;
2301 esac    
2302 case "$gmake" in
2303 gmake)  ;;
2304 *)      # We can't have osname yet.
2305         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2306                 # Assume that gmake, if found, is definitely GNU make
2307                 # and prefer it over the system make.
2308                 echo "Substituting gmake for make."
2309                 make=$gmake
2310                 _make=$gmake
2311         fi
2312         ;;
2313 esac
2314 case "$test" in
2315 test)
2316         echo "Hopefully test is built into your sh."
2317         ;;
2318 *)
2319         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2320                 echo "Using the test built into your sh."
2321                 test=test
2322                 _test=test
2323         fi
2324         ;;
2325 esac
2326 case "$echo" in
2327 echo)
2328         echo "Hopefully echo is built into your sh."
2329         ;;
2330 '') ;;
2331 *)
2332         echo " "
2333 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2334         $echo $n "hi there$c" >foo1
2335         echo $n "hi there$c" >foo2
2336         if cmp foo1 foo2 >/dev/null 2>&1; then
2337                 echo "They are compatible.  In fact, they may be identical."
2338         else
2339                 case "$n" in
2340                 '-n') n='' c='\c';;
2341                 *) n='-n' c='';;
2342                 esac
2343                 cat <<FOO
2344 They are not compatible!  You are probably running ksh on a non-USG system.
2345 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2346 have echo built in and we may have to run some Bourne shell scripts.  That
2347 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2348
2349 FOO
2350                 $echo $n "The star should be here-->$c"
2351                 $echo "*"
2352         fi
2353         $rm -f foo1 foo2
2354         ;;
2355 esac
2356
2357 cat <<EOS >trygcc
2358 $startsh
2359 EOS
2360 cat <<'EOSC' >>trygcc
2361 case "$cc" in
2362 '') ;;
2363 *)  $rm -f try try.*
2364     $cat >try.c <<EOM
2365 int main(int argc, char *argv[]) {
2366   return 0;
2367 }
2368 EOM
2369     if $cc -o try $ccflags $ldflags try.c; then
2370        :
2371     else
2372         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2373         despair=yes
2374         trygcc=yes
2375         case "$cc" in
2376         *gcc*) trygcc=no ;;
2377         esac
2378         case "`$cc -v -c try.c 2>&1`" in
2379         *gcc*) trygcc=no ;;
2380         esac
2381         if $test X"$trygcc" = Xyes; then
2382             if gcc -o try -c try.c; then
2383                 echo " "
2384                 echo "You seem to have a working gcc, though." >&4
2385                 rp="Would you like to use it?"
2386                 dflt=y
2387                 if $test -f myread; then
2388                     . ./myread
2389                 else
2390                     if $test -f UU/myread; then
2391                         . ./UU/myread
2392                     else
2393                         echo "Cannot find myread, sorry.  Aborting." >&2
2394                         exit 1
2395                     fi
2396                 fi  
2397                 case "$ans" in
2398                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2399                        if $test -f usethreads.cbu; then
2400                            $cat >&4 <<EOM 
2401
2402 *** However, any setting of the C compiler flags (e.g. for thread support)
2403 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2404 *** (together with e.g. -Dusethreads).
2405
2406 EOM
2407                        fi;;
2408                 esac
2409             fi
2410         fi
2411     fi
2412     $rm -f try try.*
2413     ;;
2414 esac
2415 EOSC
2416
2417 cat <<EOS >checkcc
2418 $startsh
2419 EOS
2420 cat <<'EOSC' >>checkcc
2421 case "$cc" in        
2422 '') ;;
2423 *)  $rm -f try try.*              
2424     $cat >try.c <<EOM
2425 int main(int argc, char *argv[]) {
2426   return 0;
2427 }
2428 EOM
2429     if $cc -o try $ccflags $ldflags try.c; then
2430        :
2431     else
2432         if $test X"$despair" = Xyes; then
2433            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2434         fi
2435         $cat >&4 <<EOM         
2436 You need to find a working C compiler.
2437 Either (purchase and) install the C compiler supplied by your OS vendor,
2438 or for a free C compiler try http://gcc.gnu.org/
2439 I cannot continue any further, aborting.
2440 EOM
2441         exit 1
2442     fi
2443     $rm -f try try.*
2444     ;;
2445 esac
2446 EOSC
2447
2448 : determine whether symbolic links are supported
2449 echo " "
2450 $touch blurfl
2451 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2452         echo "Symbolic links are supported." >&4
2453         lns="$ln -s"
2454 else
2455         echo "Symbolic links are NOT supported." >&4
2456         lns="$ln"
2457 fi
2458 $rm -f blurfl sym
2459
2460 : determine whether symbolic links are supported
2461 echo " "
2462 case "$lns" in
2463 *"ln"*" -s")
2464         echo "Checking how to test for symbolic links..." >&4
2465         $lns blurfl sym
2466         if $test "X$issymlink" = X; then
2467                 case "$newsh" in
2468                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2469                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2470                 esac
2471                 if test $? = 0; then
2472                         issymlink="test -h"
2473                 else
2474                         echo "Your builtin 'test -h' may be broken." >&4
2475                         case "$test" in
2476                         /*)     ;;
2477                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2478                                 for p in $pth
2479                                 do
2480                                         if test -f "$p/$test"; then
2481                                                 test="$p/$test"
2482                                                 break
2483                                         fi
2484                                 done
2485                                 ;;
2486                         esac
2487                         case "$test" in
2488                         /*)
2489                                 echo "Trying external '$test -h'." >&4
2490                                 issymlink="$test -h"
2491                                 if $test ! -h sym >/dev/null 2>&1; then
2492                                         echo "External '$test -h' is broken, too." >&4
2493                                         issymlink=''
2494                                 fi
2495                                 ;;
2496                         *)      issymlink='' ;;
2497                         esac
2498                 fi              
2499         fi
2500         if $test "X$issymlink" = X; then
2501                 if $test -L sym 2>/dev/null; then
2502                         issymlink="$test -L"
2503                         echo "The builtin '$test -L' worked." >&4
2504                 fi
2505         fi
2506         if $test "X$issymlink" != X; then
2507                 echo "You can test for symbolic links with '$issymlink'." >&4
2508         else
2509                 echo "I do not know how you can test for symbolic links." >&4
2510         fi
2511         $rm -f blurfl sym
2512         ;;
2513 *)      echo "No symbolic links, so not testing for their testing..." >&4
2514         ;;
2515 esac
2516 echo " "
2517
2518
2519 case "$mksymlinks" in
2520 $define|true|[yY]*)
2521         case "$src" in
2522         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2523                 exit 1
2524                 ;;
2525         *)      case "$lns:$issymlink" in
2526                 *"ln"*" -s:"*"test -"?)
2527                         echo "Creating the symbolic links..." >&4
2528                         echo "(First creating the subdirectories...)" >&4
2529                         cd ..
2530                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2531                                 read directory
2532                                 test -z "$directory" && break
2533                                 mkdir -p $directory
2534                         done
2535                         # Sanity check 1.
2536                         if test ! -d t/base; then
2537                                 echo "Failed to create the subdirectories.  Aborting." >&4
2538                                 exit 1
2539                         fi
2540                         echo "(Then creating the symlinks...)" >&4
2541                         awk '{print $1}' $src/MANIFEST | while true; do
2542                                 read filename
2543                                 test -z "$filename" && break
2544                                 if test -f $filename; then
2545                                         if $issymlink $filename; then
2546                                                 rm -f $filename
2547                                         fi
2548                                 fi
2549                                 if test -f $filename; then
2550                                         echo "$filename already exists, not symlinking."
2551                                 else
2552                                         ln -s $src/$filename $filename
2553                                 fi
2554                         done
2555                         # Sanity check 2.
2556                         if test ! -f t/base/lex.t; then
2557                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2558                                 exit 1
2559                         fi
2560                         cd UU
2561                         ;;
2562                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2563                         ;;
2564                 esac
2565                 ;;
2566         esac
2567         ;;
2568 esac
2569
2570
2571 case "$usecrosscompile" in
2572 $define|true|[yY]*)
2573         $echo "Cross-compiling..."
2574         croak=''
2575         case "$cc" in
2576         *-*-gcc) # A cross-compiling gcc, probably.
2577             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2578             ar=$targetarch-ar
2579             # leave out ld, choosing it is more complex
2580             nm=$targetarch-nm
2581             ranlib=$targetarch-ranlib
2582             $echo 'extern int foo;' > try.c
2583             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2584             shift
2585             if $test $# -gt 0; then
2586                 incpth="$incpth $*"
2587                 incpth="`$echo $incpth|$sed 's/^ //'`"
2588                 echo "Guessing incpth '$incpth'." >&4
2589                 for i in $*; do
2590                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2591                     if $test -d $j; then
2592                         libpth="$libpth $j"
2593                     fi
2594                 done   
2595                 libpth="`$echo $libpth|$sed 's/^ //'`"
2596                 echo "Guessing libpth '$libpth'." >&4
2597             fi
2598             $rm -f try.c
2599             ;;
2600         esac
2601         case "$targetarch" in
2602         '') echo "Targetarch not defined." >&4; croak=y ;;
2603         *)  echo "Using targetarch $targetarch." >&4 ;;
2604         esac
2605         case "$incpth" in
2606         '') echo "Incpth not defined." >&4; croak=y ;;
2607         *)  echo "Using incpth '$incpth'." >&4 ;;
2608         esac
2609         case "$libpth" in
2610         '') echo "Libpth not defined." >&4; croak=y ;;
2611         *)  echo "Using libpth '$libpth'." >&4 ;;
2612         esac
2613         case "$usrinc" in
2614         '') for i in $incpth; do
2615                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2616                     usrinc=$i
2617                     echo "Guessing usrinc $usrinc." >&4
2618                     break
2619                 fi
2620             done
2621             case "$usrinc" in
2622             '') echo "Usrinc not defined." >&4; croak=y ;;
2623             esac
2624             ;;
2625         *)  echo "Using usrinc $usrinc." >&4 ;;
2626         esac
2627         case "$targethost" in
2628         '') echo "Targethost not defined." >&4; croak=y ;;
2629         *)  echo "Using targethost $targethost." >&4
2630         esac
2631         locincpth=' '
2632         loclibpth=' '
2633         case "$croak" in
2634         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2635         esac
2636         case "$src" in
2637         /*) run=$src/Cross/run
2638             targetmkdir=$src/Cross/mkdir
2639             to=$src/Cross/to
2640             from=$src/Cross/from
2641             ;;
2642         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2643             run=$pwd/Cross/run
2644             targetmkdir=$pwd/Cross/mkdir
2645             to=$pwd/Cross/to
2646             from=$pwd/Cross/from
2647             ;;
2648         esac
2649         case "$targetrun" in
2650         '') targetrun=ssh ;;
2651         esac
2652         case "$targetto" in
2653         '') targetto=scp ;;
2654         esac
2655         case "$targetfrom" in
2656         '') targetfrom=scp ;;
2657         esac
2658         run=$run-$targetrun
2659         to=$to-$targetto
2660         from=$from-$targetfrom
2661         case "$targetdir" in
2662         '')  targetdir=/tmp
2663              echo "Guessing targetdir $targetdir." >&4
2664              ;;
2665         esac
2666         case "$targetuser" in
2667         '')  targetuser=root
2668              echo "Guessing targetuser $targetuser." >&4
2669              ;;
2670         esac
2671         case "$targetfrom" in
2672         scp)    q=-q ;;
2673         *)      q='' ;;
2674         esac
2675         case "$targetrun" in
2676         ssh|rsh)
2677             cat >$run <<EOF
2678 #!/bin/sh
2679 case "\$1" in
2680 -cwd)
2681   shift
2682   cwd=\$1
2683   shift
2684   ;;
2685 esac
2686 case "\$cwd" in
2687 '') cwd=$targetdir ;;
2688 esac
2689 exe=\$1
2690 shift
2691 if $test ! -f \$exe.xok; then
2692   $to \$exe
2693   $touch \$exe.xok
2694 fi
2695 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2696 EOF
2697             ;;
2698         *)  echo "Unknown targetrun '$targetrun'" >&4
2699             exit 1
2700             ;;
2701         esac
2702         case "$targetmkdir" in
2703         */Cross/mkdir)
2704             cat >$targetmkdir <<EOF
2705 #!/bin/sh
2706 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2707 EOF
2708             $chmod a+rx $targetmkdir
2709             ;;
2710         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2711             exit 1
2712             ;;
2713         esac
2714         case "$targetto" in
2715         scp|rcp)
2716             cat >$to <<EOF
2717 #!/bin/sh
2718 for f in \$@
2719 do
2720   case "\$f" in
2721   /*)
2722     $targetmkdir \`dirname \$f\`
2723     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2724     ;;
2725   *)
2726     $targetmkdir $targetdir/\`dirname \$f\`
2727     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2728     ;;
2729   esac
2730 done
2731 exit 0
2732 EOF
2733             ;;
2734         cp) cat >$to <<EOF
2735 #!/bin/sh
2736 for f in \$@
2737 do
2738   case "\$f" in
2739   /*)
2740     $mkdir -p $targetdir/\`dirname \$f\`
2741     $cp \$f $targetdir/\$f || exit 1
2742     ;;
2743   *)
2744     $targetmkdir $targetdir/\`dirname \$f\`
2745     $cp \$f $targetdir/\$f || exit 1
2746     ;;
2747   esac
2748 done
2749 exit 0
2750 EOF
2751             ;;
2752         *)  echo "Unknown targetto '$targetto'" >&4
2753             exit 1
2754             ;;
2755         esac
2756         case "$targetfrom" in
2757         scp|rcp)
2758           cat >$from <<EOF
2759 #!/bin/sh
2760 for f in \$@
2761 do
2762   $rm -f \$f
2763   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2764 done
2765 exit 0
2766 EOF
2767             ;;
2768         cp) cat >$from <<EOF
2769 #!/bin/sh
2770 for f in \$@
2771 do
2772   $rm -f \$f
2773   cp $targetdir/\$f . || exit 1
2774 done
2775 exit 0
2776 EOF
2777             ;;
2778         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2779             exit 1
2780             ;;
2781         esac
2782         if $test ! -f $run; then
2783             echo "Target 'run' script '$run' not found." >&4
2784         else
2785             $chmod a+rx $run
2786         fi
2787         if $test ! -f $to; then
2788             echo "Target 'to' script '$to' not found." >&4
2789         else
2790             $chmod a+rx $to
2791         fi
2792         if $test ! -f $from; then
2793             echo "Target 'from' script '$from' not found." >&4
2794         else
2795             $chmod a+rx $from
2796         fi
2797         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2798             exit 1
2799         fi
2800         cat >&4 <<EOF
2801 Using '$run' for remote execution,
2802 and '$from' and '$to'
2803 for remote file transfer.
2804 EOF
2805         ;;
2806 *)      run=''
2807         to=:
2808         from=:
2809         usecrosscompile='undef'
2810         targetarch=''
2811         ;;
2812 esac
2813
2814 : see whether [:lower:] and [:upper:] are supported character classes
2815 echo " "
2816 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2817 ABYZ)
2818         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2819         up='[:upper:]'
2820         low='[:lower:]'
2821         ;;
2822 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2823         # (0xc9 and 0xd1), therefore that is a nice testing point.
2824         if test "X$up" = X -o "X$low" = X; then
2825             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2826             ij) up='[A-Z]'
2827                 low='[a-z]'
2828                 ;;
2829             esac
2830         fi
2831         if test "X$up" = X -o "X$low" = X; then
2832             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2833             ij) up='A-Z'
2834                 low='a-z'
2835                 ;;
2836             esac
2837         fi
2838         if test "X$up" = X -o "X$low" = X; then
2839             case "`echo IJ | od -x 2>/dev/null`" in
2840             *C9D1*|*c9d1*)
2841                 echo "Hey, this might be EBCDIC." >&4
2842                 if test "X$up" = X -o "X$low" = X; then
2843                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2844                     ij) up='[A-IJ-RS-Z]'
2845                         low='[a-ij-rs-z]'
2846                         ;;
2847                     esac
2848                 fi
2849                 if test "X$up" = X -o "X$low" = X; then
2850                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2851                     ij) up='A-IJ-RS-Z'
2852                         low='a-ij-rs-z'
2853                         ;;
2854                     esac
2855                 fi
2856                 ;;
2857             esac
2858         fi
2859 esac
2860 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2861 ij)
2862     echo "Using $up and $low to convert case." >&4
2863     ;;
2864 *)
2865     echo "I don't know how to translate letters from upper to lower case." >&4
2866     echo "Your tr is not acting any way I know of." >&4
2867     exit 1
2868     ;;
2869 esac
2870 : set up the translation script tr, must be called with ./tr of course
2871 cat >tr <<EOSC
2872 $startsh
2873 case "\$1\$2" in
2874 '[A-Z][a-z]') exec $tr '$up' '$low';;
2875 '[a-z][A-Z]') exec $tr '$low' '$up';;
2876 esac
2877 exec $tr "\$@"
2878 EOSC
2879 chmod +x tr
2880 $eunicefix tr
2881
2882 : Try to determine whether config.sh was made on this system
2883 case "$config_sh" in
2884 '')
2885 myuname=`$uname -a 2>/dev/null`
2886 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2887 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2888 # because the A-Z/a-z are not consecutive.
2889 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2890         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2891 newmyuname="$myuname"
2892 dflt=n
2893 case "$knowitall" in
2894 '')
2895         if test -f ../config.sh; then
2896                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2897                         eval "`grep myuname= ../config.sh`"
2898                 fi
2899                 if test "X$myuname" = "X$newmyuname"; then
2900                         dflt=y
2901                 fi
2902         fi
2903         ;;
2904 *) dflt=y;;
2905 esac
2906
2907 : Get old answers from old config file if Configure was run on the
2908 : same system, otherwise use the hints.
2909 hint=default
2910 cd ..
2911 if test -f config.sh; then
2912         echo " "
2913         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2914         . UU/myread
2915         case "$ans" in
2916         n*|N*) echo "OK, I'll ignore it."
2917                 mv config.sh config.sh.old
2918                 myuname="$newmyuname"
2919                 ;;
2920         *)  echo "Fetching default answers from your old config.sh file..." >&4
2921                 tmp_n="$n"
2922                 tmp_c="$c"
2923                 tmp_sh="$sh"
2924                 . ./config.sh
2925                 cp config.sh UU
2926                 n="$tmp_n"
2927                 c="$tmp_c"
2928                 : Older versions did not always set $sh.  Catch re-use of such
2929                 : an old config.sh.
2930                 case "$sh" in
2931                 '') sh="$tmp_sh" ;;
2932                 esac
2933                 hint=previous
2934                 ;;
2935         esac
2936 fi
2937 . ./UU/checkcc
2938 if test ! -f config.sh; then
2939         $cat <<EOM
2940
2941 First time through, eh?  I have some defaults handy for some systems
2942 that need some extra help getting the Configure answers right:
2943
2944 EOM
2945         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2946         dflt=''
2947         : Half the following guesses are probably wrong... If you have better
2948         : tests or hints, please send them to perlbug@perl.org
2949         : The metaconfig authors would also appreciate a copy...
2950         $test -f /irix && osname=irix
2951         $test -f /xenix && osname=sco_xenix
2952         $test -f /dynix && osname=dynix
2953         $test -f /dnix && osname=dnix
2954         $test -f /lynx.os && osname=lynxos
2955         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2956         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2957         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2958         $test -f /bin/mips && /bin/mips && osname=mips
2959         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2960                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2961         $test -d /usr/apollo/bin && osname=apollo
2962         $test -f /etc/saf/_sactab && osname=svr4
2963         $test -d /usr/include/minix && osname=minix
2964         $test -f /system/gnu_library/bin/ar.pm && osname=vos
2965         if $test -d /MachTen -o -d /MachTen_Folder; then
2966                 osname=machten
2967                 if $test -x /sbin/version; then
2968                         osvers=`/sbin/version | $awk '{print $2}' |
2969                         $sed -e 's/[A-Za-z]$//'`
2970                 elif $test -x /usr/etc/version; then
2971                         osvers=`/usr/etc/version | $awk '{print $2}' |
2972                         $sed -e 's/[A-Za-z]$//'`
2973                 else
2974                         osvers="$2.$3"
2975                 fi
2976         fi
2977
2978         $test -f /sys/posix.dll &&
2979                 $test -f /usr/bin/what &&
2980                 set X `/usr/bin/what /sys/posix.dll` &&
2981                 $test "$3" = UWIN &&
2982                 osname=uwin &&
2983                 osvers="$5"
2984
2985         if $test -f $uname; then
2986                 set X $myuname
2987                 shift
2988
2989                 case "$5" in
2990                 fps*) osname=fps ;;
2991                 mips*)
2992                         case "$4" in
2993                         umips) osname=umips ;;
2994                         *) osname=mips ;;
2995                         esac;;
2996                 [23]100) osname=mips ;;
2997                 next*) osname=next ;;
2998                 i386*)
2999                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3000                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3001                                 osname='sco'
3002                                 osvers=$tmp
3003                         elif $test -f /etc/kconfig; then
3004                                 osname=isc
3005                                 if test "$lns" = "$ln -s"; then
3006                                         osvers=4
3007                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3008                                         osvers=3
3009                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3010                                         osvers=2
3011                                 fi
3012                         fi
3013                         tmp=''
3014                         ;;
3015                 pc*)
3016                         if test -n "$DJGPP"; then
3017                                 osname=dos
3018                                 osvers=djgpp
3019                         fi
3020                         ;;
3021                 esac
3022
3023                 case "$1" in
3024                 aix) osname=aix
3025                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3026                         case "$tmp" in
3027                         'not found') osvers="$4"."$3" ;;
3028                         '<3240'|'<>3240') osvers=3.2.0 ;;
3029                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3030                         '=3250'|'>3250') osvers=3.2.5 ;;
3031                         *) osvers=$tmp;;
3032                         esac
3033                         ;;
3034                 bsd386) osname=bsd386
3035                         osvers=`$uname -r`
3036                         ;;
3037                 cygwin*) osname=cygwin
3038                         osvers="$3"
3039                         ;;
3040                 *dc.osx) osname=dcosx
3041                         osvers="$3"
3042                         ;;
3043                 dnix) osname=dnix
3044                         osvers="$3"
3045                         ;;
3046                 domainos) osname=apollo
3047                         osvers="$3"
3048                         ;;
3049                 dgux) osname=dgux 
3050                         osvers="$3"
3051                         ;;
3052                 dynixptx*) osname=dynixptx
3053                         osvers=`echo "$4"|sed 's/^v//'`
3054                         ;;
3055                 freebsd) osname=freebsd 
3056                         osvers="$3" ;;
3057                 genix) osname=genix ;;
3058                 hp*) osname=hpux 
3059                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3060                         ;;
3061                 irix*) osname=irix
3062                         case "$3" in
3063                         4*) osvers=4 ;;
3064                         5*) osvers=5 ;;
3065                         *)      osvers="$3" ;;
3066                         esac
3067                         ;;
3068                 linux) osname=linux
3069                         case "$3" in
3070                         *)      osvers="$3" ;;
3071                         esac
3072                         ;;
3073                 MiNT) osname=mint
3074                         ;;
3075                 netbsd*) osname=netbsd
3076                         osvers="$3"
3077                         ;;
3078                 news-os) osvers="$3"
3079                         case "$3" in
3080                         4*) osname=newsos4 ;;
3081                         *) osname=newsos ;;
3082                         esac
3083                         ;;
3084                 next*) osname=next ;;
3085                 nonstop-ux) osname=nonstopux ;;
3086                 openbsd) osname=openbsd
3087                         osvers="$3"
3088                         ;;
3089                 POSIX-BC | posix-bc ) osname=posix-bc
3090                         osvers="$3"
3091                         ;;
3092                 powerux | power_ux | powermax_os | powermaxos | \
3093                 powerunix | power_unix) osname=powerux
3094                         osvers="$3"
3095                         ;;
3096                 qnx) osname=qnx
3097                         osvers="$4"
3098                         ;;
3099                 solaris) osname=solaris
3100                         case "$3" in
3101                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3102                         *)      osvers="$3" ;;
3103                         esac
3104                         ;;
3105                 sunos) osname=sunos
3106                         case "$3" in
3107                         5*) osname=solaris
3108                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3109                         *)      osvers="$3" ;;
3110                         esac
3111                         ;;
3112                 titanos) osname=titanos
3113                         case "$3" in
3114                         1*) osvers=1 ;;
3115                         2*) osvers=2 ;;
3116                         3*) osvers=3 ;;
3117                         4*) osvers=4 ;;
3118                         *)      osvers="$3" ;;
3119                         esac
3120                         ;;
3121                 ultrix) osname=ultrix
3122                         osvers="$3"
3123                         ;;
3124                 osf1|mls+)      case "$5" in
3125                                 alpha)
3126                                         osname=dec_osf
3127                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3128                                         case "$osvers" in
3129                                         [1-9].[0-9]*) ;;
3130                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3131                                         esac
3132                                         ;;
3133                         hp*)    osname=hp_osf1  ;;
3134                         mips)   osname=mips_osf1 ;;
3135                         esac
3136                         ;;
3137                 unixware) osname=svr5
3138                         osvers="$4"
3139                         ;;
3140                 uts)    osname=uts
3141                         osvers="$3"
3142                         ;;
3143                 vos) osvers="$3"
3144                         ;;
3145                 $2) case "$osname" in
3146                         *isc*) ;;
3147                         *freebsd*) ;;
3148                         svr*)
3149                                 : svr4.x or possibly later
3150                                 case "svr$3" in 
3151                                 ${osname}*)
3152                                         osname=svr$3
3153                                         osvers=$4
3154                                         ;;
3155                                 esac
3156                                 case "$osname" in
3157                                 svr4.0)
3158                                         : Check for ESIX
3159                                         if test -f /stand/boot ; then
3160                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3161                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3162                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3163                                                         if test -n "$isesix"; then
3164                                                                 osname=esix4
3165                                                         fi
3166                                                 fi
3167                                         fi
3168                                         ;;
3169                                 esac
3170                                 ;;
3171                         *)      if test -f /etc/systemid; then
3172                                         osname=sco
3173                                         set `echo $3 | $sed 's/\./ /g'` $4
3174                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3175                                                 osvers=$1.$2.$3
3176                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3177                                                 osvers=$1.$2
3178                                         elif $test -f $src/hints/sco_$1.sh; then
3179                                                 osvers=$1
3180                                         fi
3181                                 else
3182                                         case "$osname" in
3183                                         '') : Still unknown.  Probably a generic Sys V.
3184                                                 osname="sysv"
3185                                                 osvers="$3"
3186                                                 ;;
3187                                         esac
3188                                 fi
3189                                 ;;
3190                         esac
3191                         ;;
3192                 *)      case "$osname" in
3193                         '') : Still unknown.  Probably a generic BSD.
3194                                 osname="$1"
3195                                 osvers="$3"
3196                                 ;;
3197                         esac
3198                         ;;
3199                 esac
3200         else
3201                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3202                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3203                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3204                                 osname=news_os
3205                         fi
3206                         $rm -f UU/kernel.what
3207                 elif test -d c:/.; then
3208                         set X $myuname
3209                         osname=os2
3210                         osvers="$5"
3211                 fi
3212         fi
3213         
3214         case "$targetarch" in
3215         '') ;;
3216         *)  hostarch=$osname
3217             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3218             osvers=''
3219             ;;
3220         esac
3221
3222         : Now look for a hint file osname_osvers, unless one has been
3223         : specified already.
3224         case "$hintfile" in
3225         ''|' ')
3226                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3227                 : Also try without trailing minor version numbers.
3228                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3229                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3230                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3231                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3232                 case "$file" in
3233                 '') dflt=none ;;
3234                 *)  case "$osvers" in
3235                         '') dflt=$file
3236                                 ;;
3237                         *)  if $test -f $src/hints/$file.sh ; then
3238                                         dflt=$file
3239                                 elif $test -f $src/hints/$xfile.sh ; then
3240                                         dflt=$xfile
3241                                 elif $test -f $src/hints/$xxfile.sh ; then
3242                                         dflt=$xxfile
3243                                 elif $test -f $src/hints/$xxxfile.sh ; then
3244                                         dflt=$xxxfile
3245                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3246                                         dflt=$xxxxfile
3247                                 elif $test -f "$src/hints/${osname}.sh" ; then
3248                                         dflt="${osname}"
3249                                 else
3250                                         dflt=none
3251                                 fi
3252                                 ;;
3253                         esac
3254                         ;;
3255                 esac
3256                 if $test -f Policy.sh ; then
3257                         case "$dflt" in
3258                         *Policy*) ;;
3259                         none) dflt="Policy" ;;
3260                         *) dflt="Policy $dflt" ;;
3261                         esac
3262                 fi
3263                 ;;
3264         *)
3265                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3266                 ;;
3267         esac
3268
3269         if $test -f Policy.sh ; then
3270                 $cat <<EOM
3271
3272 There's also a Policy hint file available, which should make the
3273 site-specific (policy) questions easier to answer.
3274 EOM
3275
3276         fi
3277
3278         $cat <<EOM
3279
3280 You may give one or more space-separated answers, or "none" if appropriate.
3281 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3282 is a good thing.  DO NOT give a wrong version or a wrong OS.
3283
3284 EOM
3285
3286         rp="Which of these apply, if any?"
3287         . UU/myread
3288         tans=$ans
3289         for file in $tans; do
3290                 if $test X$file = XPolicy -a -f Policy.sh; then
3291                         . Policy.sh
3292                         $cat Policy.sh >> UU/config.sh
3293                 elif $test -f $src/hints/$file.sh; then
3294                         . $src/hints/$file.sh
3295                         $cat $src/hints/$file.sh >> UU/config.sh
3296                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3297                         : nothing
3298                 else
3299                         : Give one chance to correct a possible typo.
3300                         echo "$file.sh does not exist"
3301                         dflt=$file
3302                         rp="hint to use instead?"
3303                         . UU/myread
3304                         for file in $ans; do
3305                                 if $test -f "$src/hints/$file.sh"; then
3306                                         . $src/hints/$file.sh
3307                                         $cat $src/hints/$file.sh >> UU/config.sh
3308                                 elif $test X$ans = X -o X$ans = Xnone ; then
3309                                         : nothing
3310                                 else
3311                                         echo "$file.sh does not exist -- ignored."
3312                                 fi
3313                         done
3314                 fi
3315         done
3316
3317         hint=recommended
3318         : Remember our hint file for later.
3319         if $test -f "$src/hints/$file.sh" ; then
3320                 hintfile="$file"
3321         else
3322                 hintfile=''
3323         fi
3324 fi
3325 cd UU
3326 ;;
3327 *)
3328         echo " "
3329         echo "Fetching default answers from $config_sh..." >&4
3330         tmp_n="$n"
3331         tmp_c="$c"
3332         cd ..
3333         cp $config_sh config.sh 2>/dev/null
3334         chmod +w config.sh
3335         . ./config.sh
3336         cd UU
3337         cp ../config.sh .
3338         n="$tmp_n"
3339         c="$tmp_c"
3340         hint=previous
3341         ;;
3342 esac
3343 test "$override" && . ./optdef.sh
3344
3345 : Restore computed paths
3346 for file in $loclist $trylist; do
3347         eval $file="\$_$file"
3348 done
3349
3350 cat << EOM
3351
3352 Configure uses the operating system name and version to set some defaults.
3353 The default value is probably right if the name rings a bell. Otherwise,
3354 since spelling matters for me, either accept the default or answer "none"
3355 to leave it blank.
3356
3357 EOM
3358 case "$osname" in
3359         ''|' ')
3360                 case "$hintfile" in
3361                 ''|' '|none) dflt=none ;;
3362                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3363                 esac
3364                 ;;
3365         *) dflt="$osname" ;;
3366 esac
3367 rp="Operating system name?"
3368 . ./myread
3369 case "$ans" in
3370 none)  osname='' ;;
3371 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3372 esac
3373 echo " "
3374 case "$osvers" in
3375         ''|' ')
3376                 case "$hintfile" in
3377                 ''|' '|none) dflt=none ;;
3378                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3379                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3380                         case "$dflt" in
3381                         ''|' ') dflt=none ;;
3382                         esac
3383                         ;;
3384                 esac
3385                 ;;
3386         *) dflt="$osvers" ;;
3387 esac
3388 rp="Operating system version?"
3389 . ./myread
3390 case "$ans" in
3391 none)  osvers='' ;;
3392 *) osvers="$ans" ;;
3393 esac
3394
3395
3396 . ./posthint.sh
3397
3398 : who configured the system
3399 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3400 cf_by=`(logname) 2>/dev/null`
3401 case "$cf_by" in
3402 "")
3403         cf_by=`(whoami) 2>/dev/null`
3404         case "$cf_by" in
3405         "") cf_by=unknown ;;
3406         esac ;;
3407 esac
3408
3409 : set up the script used to warn in case of inconsistency
3410 cat <<EOS >whoa
3411 $startsh
3412 EOS
3413 cat <<'EOSC' >>whoa
3414 dflt=y
3415 echo " "
3416 echo "*** WHOA THERE!!! ***" >&4
3417 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3418 rp="    Keep the $hint value?"
3419 . ./myread
3420 case "$ans" in
3421 y) td=$was; tu=$was;;
3422 esac
3423 EOSC
3424
3425 : function used to set $1 to $val
3426 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3427 case "$val$was" in
3428 $define$undef) . ./whoa; eval "$var=\$td";;
3429 $undef$define) . ./whoa; eval "$var=\$tu";;
3430 *) eval "$var=$val";;
3431 esac'
3432
3433 case "$usesocks" in
3434 $define|true|[yY]*)     dflt='y';;
3435 *) dflt='n';;
3436 esac
3437 cat <<EOM
3438
3439 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3440 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3441 to use the PerlIO abstraction layer, this will be implicitly selected.
3442
3443 If this doesn't make any sense to you, just accept the default '$dflt'.
3444 EOM
3445 rp='Build Perl for SOCKS?'
3446 . ./myread
3447 case "$ans" in
3448 y|Y)    val="$define" ;;     
3449 *)      val="$undef" ;;
3450 esac
3451 set usesocks
3452 eval $setvar
3453
3454 case "$usesocks" in
3455 $define|true|[yY]*) useperlio="$define";;
3456 esac
3457
3458 case "$useperlio" in
3459 $define|true|[yY]*|'')  dflt='y';;
3460 *) dflt='n';;
3461 esac
3462 cat <<EOM
3463
3464 Previous version of $package used the standard IO mechanisms as
3465 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3466 alternate IO mechanisms via the PerlIO abstraction layer, but the
3467 stdio mechanism is still available if needed.  The abstraction layer
3468 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3469 Using PerlIO with sfio may cause problems with some extension modules.
3470
3471 If this doesn't make any sense to you, just accept the default '$dflt'.
3472 EOM
3473 rp='Use the PerlIO abstraction layer?'
3474 . ./myread
3475 case "$ans" in
3476 y|Y) 
3477         val="$define"
3478         ;;
3479 *)      
3480         echo "Ok, doing things the stdio way."
3481         val="$undef"
3482         ;;
3483 esac
3484 set useperlio
3485 eval $setvar 
3486
3487 case "$usesocks" in
3488 $define|true|[yY]*)
3489         case "$useperlio" in
3490         $define|true|[yY]*) ;;
3491         *)      cat >&4 <<EOM
3492
3493 You are using the SOCKS proxy protocol library which means that you
3494 should also use the PerlIO layer.  You may be headed for trouble.
3495
3496 EOM
3497                 ;;
3498         esac
3499         ;;
3500 esac
3501
3502         
3503 case "$usethreads" in
3504 $define|true|[yY]*)     dflt='y';;
3505 *)     # Catch case where user specified ithreads or 5005threads but
3506        # forgot -Dusethreads (A.D. 4/2002)
3507        case "$useithreads$use5005threads" in
3508        *$define*)      
3509                 case "$useperlio" in
3510                 "$define")      dflt='y' ;;
3511                 *)              dflt='n' ;;
3512                 esac
3513                 ;;
3514        *)       dflt='n';;
3515        esac
3516        ;;
3517 esac
3518 cat <<EOM
3519
3520 Perl can be built to take advantage of threads on some systems.
3521 To do so, Configure can be run with -Dusethreads.
3522
3523 Note that Perl built with threading support runs slightly slower
3524 and uses more memory than plain Perl. The current implementation
3525 is believed to be stable, but it is fairly new, and so should be
3526 treated with caution.
3527
3528 If this doesn't make any sense to you, just accept the default '$dflt'.
3529 EOM
3530 rp='Build a threading Perl?'
3531 . ./myread
3532 case "$ans" in
3533 y|Y)    val="$define" ;;
3534 *)      val="$undef" ;;
3535 esac
3536 set usethreads
3537 eval $setvar
3538
3539 case "$usethreads" in
3540 $define)
3541         $cat <<EOM
3542
3543 Since release 5.6, Perl has had two different threading implementations,
3544 the newer interpreter-based version (ithreads) with one interpreter per
3545 thread, and the older 5.005 version (5005threads).
3546 The 5005threads version is effectively unmaintained and will probably be
3547 removed in Perl 5.10, so there should be no need to build a Perl using it
3548 unless needed for backwards compatibility with some existing 5.005threads
3549 code.
3550
3551 EOM
3552         : Default to ithreads unless overridden on command line or with
3553         : old config.sh
3554         dflt='y'
3555         case "$use5005threads" in
3556                 $define|true|[yY]*) dflt='n';;
3557         esac
3558         case "$useithreads" in
3559                 $undef|false|[nN]*) dflt='n';;
3560         esac
3561         rp='Use the newer interpreter-based ithreads?'
3562         . ./myread
3563         case "$ans" in
3564         y|Y)    val="$define" ;;
3565         *)      val="$undef" ;;
3566         esac
3567         set useithreads
3568         eval $setvar
3569         : Now set use5005threads to the opposite value.
3570         case "$useithreads" in
3571         $define) val="$undef" ;;
3572         *) val="$define" ;;
3573         esac
3574         set use5005threads
3575         eval $setvar
3576         ;;
3577 *)
3578         useithreads="$undef"
3579         use5005threads="$undef"
3580         ;;
3581 esac
3582
3583 case "$useithreads$use5005threads" in
3584 "$define$define")
3585         $cat >&4 <<EOM
3586
3587 You cannot have both the ithreads and the 5.005 threads enabled
3588 at the same time.  Disabling the 5.005 threads since they are
3589 much less stable than the ithreads.
3590
3591 EOM
3592         use5005threads="$undef"
3593         ;;
3594 esac
3595
3596 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3597         cat >&4 <<EOF
3598 ***
3599 *** To build with ithreads you must also use the PerlIO layer.
3600 *** Cannot continue, aborting.
3601 ***
3602 EOF
3603         exit 1
3604 fi
3605
3606 case "$d_oldpthreads" in
3607 '')     : Configure tests would be welcome here.  For now, assume undef.
3608         val="$undef" ;;
3609 *)      val="$d_oldpthreads" ;;
3610 esac
3611 set d_oldpthreads
3612 eval $setvar
3613
3614
3615 case "$usethreads" in
3616 "$define"|true|[yY]*)
3617 : Look for a hint-file generated 'call-back-unit'.  If the
3618 : user has specified that a threading perl is to be built,
3619 : we may need to set or change some other defaults.
3620         if $test -f usethreads.cbu; then
3621                 echo "Your platform has some specific hints for threaded builds, using them..."
3622                 . ./usethreads.cbu
3623         else
3624                 $cat <<EOM
3625 (Your platform doesn't have any specific hints for threaded builds.
3626  Assuming POSIX threads, then.)
3627 EOM
3628         fi
3629         ;;
3630 esac
3631
3632 cat <<EOM
3633
3634 Perl can be built so that multiple Perl interpreters can coexist
3635 within the same Perl executable.
3636 EOM
3637
3638 case "$useithreads" in
3639 $define)
3640         cat <<EOM
3641 This multiple interpreter support is required for interpreter-based threads.
3642 EOM
3643         val="$define"
3644         ;;
3645 *)      case "$usemultiplicity" in
3646         $define|true|[yY]*)     dflt='y';;
3647         *) dflt='n';;
3648         esac
3649         echo " "
3650         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3651         rp='Build Perl for multiplicity?'
3652         . ./myread
3653         case "$ans" in
3654         y|Y)    val="$define" ;;
3655         *)      val="$undef" ;;
3656         esac
3657         ;;
3658 esac
3659 set usemultiplicity
3660 eval $setvar
3661
3662
3663 case "$usemorebits" in
3664 "$define"|true|[yY]*)
3665         use64bitint="$define"
3666         uselongdouble="$define"
3667         usemorebits="$define"
3668         ;;
3669 *)      usemorebits="$undef"
3670         ;;
3671 esac
3672
3673 : make some quick guesses about what we are up against
3674 echo " "
3675 $echo $n "Hmm...  $c"
3676 echo exit 1 >bsd
3677 echo exit 1 >usg
3678 echo exit 1 >v7
3679 echo exit 1 >osf1
3680 echo exit 1 >eunice
3681 echo exit 1 >xenix
3682 echo exit 1 >venix
3683 echo exit 1 >os2
3684 d_bsd="$undef"
3685 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3686 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3687 then
3688         echo "Looks kind of like an OSF/1 system, but we'll see..."
3689         echo exit 0 >osf1
3690 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3691         xxx=`./loc addbib blurfl $pth`
3692         if $test -f $xxx; then
3693         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3694                 echo exit 0 >bsd
3695                 echo exit 0 >usg
3696         else
3697                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3698                         echo "Looks kind of like an extended USG system, but we'll see..."
3699                 else
3700                         echo "Looks kind of like a USG system, but we'll see..."
3701                 fi
3702                 echo exit 0 >usg
3703         fi
3704 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3705         echo "Looks kind of like a BSD system, but we'll see..."
3706         d_bsd="$define"
3707         echo exit 0 >bsd
3708 else
3709         echo "Looks kind of like a Version 7 system, but we'll see..."
3710         echo exit 0 >v7
3711 fi
3712 case "$eunicefix" in
3713 *unixtovms*)
3714         $cat <<'EOI'
3715 There is, however, a strange, musty smell in the air that reminds me of
3716 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3717 EOI
3718         echo exit 0 >eunice
3719         d_eunice="$define"
3720 : it so happens the Eunice I know will not run shell scripts in Unix format
3721         ;;
3722 *)
3723         echo " "
3724         echo "Congratulations.  You aren't running Eunice."
3725         d_eunice="$undef"
3726         ;;
3727 esac
3728 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3729 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3730 : semicolon as a patch separator
3731 case "$p_" in
3732 :) ;;
3733 *)
3734         $cat <<'EOI'
3735 I have the feeling something is not exactly right, however...don't tell me...
3736 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3737 (Or you may be running DOS with DJGPP.)
3738 EOI
3739         echo exit 0 >os2
3740         ;;
3741 esac
3742 if test -f /xenix; then
3743         echo "Actually, this looks more like a XENIX system..."
3744         echo exit 0 >xenix
3745         d_xenix="$define"
3746 else
3747         echo " "
3748         echo "It's not Xenix..."
3749         d_xenix="$undef"
3750 fi
3751 chmod +x xenix
3752 $eunicefix xenix
3753 if test -f /venix; then
3754         echo "Actually, this looks more like a VENIX system..."
3755         echo exit 0 >venix
3756 else
3757         echo " "
3758         if ./xenix; then
3759                 : null
3760         else
3761                 echo "Nor is it Venix..."
3762         fi
3763 fi
3764 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3765 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3766 $rm -f foo
3767
3768 case "$cc" in
3769 '') dflt=cc;;
3770 *) dflt="$cc";;
3771 esac
3772 rp="Use which C compiler?"
3773 . ./myread
3774 cc="$ans"
3775
3776 : See if they have not cc but they do have gcc
3777 . ./trygcc
3778 : Look for a hint-file generated 'call-back-unit'.  Now that the
3779 : user has specified the compiler, we may need to set or change some
3780 : other defaults.
3781 if $test -f cc.cbu; then
3782     . ./cc.cbu
3783 fi
3784 . ./checkcc
3785
3786 echo " "
3787 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3788 $cat >try.c <<EOM
3789 #include <stdio.h>
3790 int main() {
3791 #ifdef __GNUC__
3792 #ifdef __VERSION__
3793         printf("%s\n", __VERSION__);
3794 #else
3795         printf("%s\n", "1");
3796 #endif
3797 #endif
3798         exit(0);
3799 }
3800 EOM
3801 if $cc -o try $ccflags $ldflags try.c; then
3802         gccversion=`$run ./try`
3803         case "$gccversion" in
3804         '') echo "You are not using GNU cc." ;;
3805         *)  echo "You are using GNU cc $gccversion."
3806             ccname=gcc  
3807             ;;
3808         esac
3809 else
3810         echo " "
3811         echo "*** WHOA THERE!!! ***" >&4
3812         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3813         case "$knowitall" in
3814         '')
3815         echo "    You'd better start hunting for one and let me know about it." >&4
3816                 exit 1
3817                 ;;
3818         esac
3819 fi
3820 $rm -f try try.*
3821 case "$gccversion" in
3822 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3823 esac
3824 case "$gccversion" in
3825 '') gccosandvers='' ;;
3826 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3827    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3828    gccshortvers=''
3829    case "$gccosandvers" in
3830    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3831    $osname$osvers) ;; # looking good
3832    $osname*) cat <<EOM >&4
3833
3834 *** WHOA THERE!!! ***
3835
3836     Your gcc has not been compiled for the exact release of
3837     your operating system ($gccosandvers versus $osname$osvers).
3838
3839     In general it is a good idea to keep gcc synchronized with
3840     the operating system because otherwise serious problems
3841     may ensue when trying to compile software, like Perl.
3842
3843     I'm trying to be optimistic here, though, and will continue.
3844     If later during the configuration and build icky compilation
3845     problems appear (headerfile conflicts being the most common
3846     manifestation), I suggest reinstalling the gcc to match
3847     your operating system release.
3848
3849 EOM
3850       ;;
3851    *) gccosandvers='' ;; # failed to parse, better be silent
3852    esac
3853    ;;
3854 esac
3855 case "$ccname" in
3856 '') ccname="$cc" ;;
3857 esac
3858
3859 # gcc 3.* complain about adding -Idirectories that they already know about,
3860 # so we will take those off from locincpth.
3861 case "$gccversion" in
3862 3*)
3863     echo "main(){}">try.c
3864     for incdir in $locincpth; do
3865        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
3866              grep '^cc1: warning: changing search order '`
3867        if test "X$warn" != X; then
3868            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
3869        fi
3870     done
3871     $rm -f try try.*
3872 esac
3873
3874 : decide how portable to be.  Allow command line overrides.
3875 case "$d_portable" in
3876 "$undef") ;;
3877 *)      d_portable="$define" ;;
3878 esac
3879
3880 : set up shell script to do ~ expansion
3881 cat >filexp <<EOSS
3882 $startsh
3883 : expand filename
3884 case "\$1" in
3885  ~/*|~)
3886         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3887         ;;
3888  ~*)
3889         if $test -f /bin/csh; then
3890                 /bin/csh -f -c "glob \$1"
3891                 failed=\$?
3892                 echo ""
3893                 exit \$failed
3894         else
3895                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3896                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3897                 if $test ! -d "\$dir"; then
3898                         me=\`basename \$0\`
3899                         echo "\$me: can't locate home directory for: \$name" >&2
3900                         exit 1
3901                 fi
3902                 case "\$1" in
3903                 */*)
3904                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3905                         ;;
3906                 *)
3907                         echo \$dir
3908                         ;;
3909                 esac
3910         fi
3911         ;;
3912 *)
3913         echo \$1
3914         ;;
3915 esac
3916 EOSS
3917 chmod +x filexp
3918 $eunicefix filexp
3919
3920 : now set up to get a file name
3921 cat <<EOS >getfile
3922 $startsh
3923 EOS
3924 cat <<'EOSC' >>getfile
3925 tilde=''
3926 fullpath=''
3927 already=''
3928 skip=''
3929 none_ok=''
3930 exp_file=''
3931 nopath_ok=''
3932 orig_rp="$rp"
3933 orig_dflt="$dflt"
3934 case "$gfpth" in
3935 '') gfpth='.' ;;
3936 esac
3937
3938 case "$fn" in
3939 *\(*)
3940         : getfile will accept an answer from the comma-separated list
3941         : enclosed in parentheses even if it does not meet other criteria.
3942         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3943         fn=`echo $fn | sed 's/(.*)//'`
3944         ;;
3945 esac
3946
3947 case "$fn" in
3948 *:*)
3949         loc_file=`expr $fn : '.*:\(.*\)'`
3950         fn=`expr $fn : '\(.*\):.*'`
3951         ;;
3952 esac
3953
3954 case "$fn" in
3955 *~*) tilde=true;;
3956 esac
3957 case "$fn" in
3958 */*) fullpath=true;;
3959 esac
3960 case "$fn" in
3961 *+*) skip=true;;
3962 esac
3963 case "$fn" in
3964 *n*) none_ok=true;;
3965 esac
3966 case "$fn" in
3967 *e*) exp_file=true;;
3968 esac
3969 case "$fn" in
3970 *p*) nopath_ok=true;;
3971 esac
3972
3973 case "$fn" in
3974 *f*) type='File';;
3975 *d*) type='Directory';;
3976 *l*) type='Locate';;
3977 esac
3978
3979 what="$type"
3980 case "$what" in
3981 Locate) what='File';;
3982 esac
3983
3984 case "$exp_file" in
3985 '')
3986         case "$d_portable" in
3987         "$define") ;;
3988         *) exp_file=true;;
3989         esac
3990         ;;
3991 esac
3992
3993 cd ..
3994 while test "$type"; do
3995         redo=''
3996         rp="$orig_rp"
3997         dflt="$orig_dflt"
3998         case "$tilde" in
3999         true) rp="$rp (~name ok)";;
4000         esac
4001         . UU/myread
4002         if test -f UU/getfile.ok && \
4003                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4004         then
4005                 value="$ans"
4006                 ansexp="$ans"
4007                 break
4008         fi
4009         case "$ans" in
4010         none)
4011                 value=''
4012                 ansexp=''
4013                 case "$none_ok" in
4014                 true) type='';;
4015                 esac
4016                 ;;
4017         *)
4018                 case "$tilde" in
4019                 '') value="$ans"
4020                         ansexp="$ans";;
4021                 *)
4022                         value=`UU/filexp $ans`
4023                         case $? in
4024                         0)
4025                                 if test "$ans" != "$value"; then
4026                                         echo "(That expands to $value on this system.)"
4027                                 fi
4028                                 ;;
4029                         *) value="$ans";;
4030                         esac
4031                         ansexp="$value"
4032                         case "$exp_file" in
4033                         '') value="$ans";;
4034                         esac
4035                         ;;
4036                 esac
4037                 case "$fullpath" in
4038                 true)
4039                         case "$ansexp" in
4040                         /*) value="$ansexp" ;;
4041                         [a-zA-Z]:/*) value="$ansexp" ;;
4042                         *)
4043                                 redo=true
4044                                 case "$already" in
4045                                 true)
4046                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4047                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4048                                         ;;
4049                                 *)
4050                                 echo "Please give a full path name, starting with slash." >&4
4051                                         case "$tilde" in
4052                                         true)
4053                                 echo "Note that using ~name is ok provided it expands well." >&4
4054                                                 already=true
4055                                                 ;;
4056                                         esac
4057                                 esac
4058                                 ;;
4059                         esac
4060                         ;;
4061                 esac
4062                 case "$redo" in
4063                 '')
4064                         case "$type" in
4065                         File)
4066                                 for fp in $gfpth; do
4067                                         if test "X$fp" = X.; then
4068                                             pf="$ansexp"
4069                                         else    
4070                                             pf="$fp/$ansexp"
4071                                         fi
4072                                         if test -f "$pf"; then
4073                                                 type=''
4074                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4075                                         then
4076                                                 echo "($value is not a plain file, but that's ok.)"
4077                                                 type=''
4078                                         fi
4079                                         if test X"$type" = X; then
4080                                             value="$pf"
4081                                             break
4082                                         fi
4083                                 done
4084                                 ;;
4085                         Directory)
4086                                 for fp in $gfpth; do
4087                                         if test "X$fp" = X.; then
4088                                             dir="$ans"
4089                                             direxp="$ansexp"
4090                                         else    
4091                                             dir="$fp/$ansexp"
4092                                             direxp="$fp/$ansexp"
4093                                         fi
4094                                         if test -d "$direxp"; then
4095                                                 type=''
4096                                                 value="$dir"
4097                                                 break
4098                                         fi
4099                                 done
4100                                 ;;
4101                         Locate)
4102                                 if test -d "$ansexp"; then
4103                                         echo "(Looking for $loc_file in directory $value.)"
4104                                         value="$value/$loc_file"
4105                                         ansexp="$ansexp/$loc_file"
4106                                 fi
4107                                 if test -f "$ansexp"; then
4108                                         type=''
4109                                 fi
4110                                 case "$nopath_ok" in
4111                                 true)   case "$value" in
4112                                         */*) ;;
4113                                         *)      echo "Assuming $value will be in people's path."
4114                                                 type=''
4115                                                 ;;
4116                                         esac
4117                                         ;;
4118                                 esac
4119                                 ;;
4120                         esac
4121
4122                         case "$skip" in
4123                         true) type='';
4124                         esac
4125
4126                         case "$type" in
4127                         '') ;;
4128                         *)
4129                                 if test "$fastread" = yes; then
4130                                         dflt=y
4131                                 else
4132                                         dflt=n
4133                                 fi
4134                                 rp="$what $value doesn't exist.  Use that name anyway?"
4135                                 . UU/myread
4136                                 dflt=''
4137                                 case "$ans" in
4138                                 y*) type='';;
4139                                 *) echo " ";;
4140                                 esac
4141                                 ;;
4142                         esac
4143                         ;;
4144                 esac
4145                 ;;
4146         esac
4147 done
4148 cd UU
4149 ans="$value"
4150 rp="$orig_rp"
4151 dflt="$orig_dflt"
4152 rm -f getfile.ok
4153 test "X$gfpthkeep" != Xy && gfpth=""
4154 EOSC
4155
4156 : What should the include directory be ?
4157 echo " "
4158 $echo $n "Hmm...  $c"
4159 dflt='/usr/include'
4160 incpath=''
4161 mips_type=''
4162 if $test -f /bin/mips && /bin/mips; then
4163         echo "Looks like a MIPS system..."
4164         $cat >usr.c <<'EOCP'
4165 #ifdef SYSTYPE_BSD43
4166 /bsd43
4167 #endif
4168 EOCP
4169         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4170                 dflt='/bsd43/usr/include'
4171                 incpath='/bsd43'
4172                 mips_type='BSD 4.3'
4173         else
4174                 mips_type='System V'
4175         fi
4176         $rm -f usr.c usr.out
4177         echo "and you're compiling with the $mips_type compiler and libraries."
4178         xxx_prompt=y
4179         echo "exit 0" >mips
4180 else
4181         echo "Doesn't look like a MIPS system."
4182         xxx_prompt=n
4183         echo "exit 1" >mips
4184 fi
4185 chmod +x mips
4186 $eunicefix mips
4187 case "$usrinc" in
4188 '') ;;
4189 *) dflt="$usrinc";;
4190 esac
4191 case "$xxx_prompt" in
4192 y)      fn=d/
4193         echo " "
4194         rp='Where are the include files you want to use?'
4195         . ./getfile
4196         usrinc="$ans"
4197         ;;
4198 *)      usrinc="$dflt"
4199         ;;
4200 esac
4201
4202 : see how we invoke the C preprocessor
4203 echo " "
4204 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4205 cat <<'EOT' >testcpp.c
4206 #define ABC abc
4207 #define XYZ xyz
4208 ABC.XYZ
4209 EOT
4210 cd ..
4211 if test ! -f cppstdin; then
4212         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4213                 # AIX cc -E doesn't show the absolute headerfile
4214                 # locations but we'll cheat by using the -M flag.
4215                 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
4216         else
4217                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4218         fi
4219 else
4220         echo "Keeping your $hint cppstdin wrapper."
4221 fi
4222 chmod 755 cppstdin
4223 wrapper=`pwd`/cppstdin
4224 ok='false'
4225 cd UU
4226
4227 if $test "X$cppstdin" != "X" && \
4228         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4229         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4230 then
4231         echo "You used to use $cppstdin $cppminus so we'll use that again."
4232         case "$cpprun" in
4233         '') echo "But let's see if we can live without a wrapper..." ;;
4234         *)
4235                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4236                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4237                 then
4238                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4239                         ok='true'
4240                 else
4241                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4242                 fi
4243                 ;;
4244         esac
4245 else
4246         case "$cppstdin" in
4247         '') ;;
4248         *)
4249                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4250                 ;;
4251         esac
4252 fi
4253
4254 if $ok; then
4255         : nothing
4256 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4257         $cc -E <testcpp.c >testcpp.out 2>&1; \
4258         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4259         echo "Yup, it does."
4260         x_cpp="$cc -E"
4261         x_minus='';
4262 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4263         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4264         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4265         echo "Yup, it does."
4266         x_cpp="$cc -E"
4267         x_minus='-';
4268 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4269         $cc -P <testcpp.c >testcpp.out 2>&1; \
4270         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4271         echo "Yipee, that works!"
4272         x_cpp="$cc -P"
4273         x_minus='';
4274 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4275         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4276         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4277         echo "At long last!"
4278         x_cpp="$cc -P"
4279         x_minus='-';
4280 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4281         $cpp <testcpp.c >testcpp.out 2>&1; \
4282         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4283         echo "It works!"
4284         x_cpp="$cpp"
4285         x_minus='';
4286 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4287         $cpp - <testcpp.c >testcpp.out 2>&1; \
4288         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4289         echo "Hooray, it works!  I was beginning to wonder."
4290         x_cpp="$cpp"
4291         x_minus='-';
4292 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4293         $wrapper <testcpp.c >testcpp.out 2>&1; \
4294         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4295         x_cpp="$wrapper"
4296         x_minus=''
4297         echo "Eureka!"
4298 else
4299         dflt=''
4300         rp="No dice.  I can't find a C preprocessor.  Name one:"
4301         . ./myread
4302         x_cpp="$ans"
4303         x_minus=''
4304         $x_cpp <testcpp.c >testcpp.out 2>&1
4305         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4306                 echo "OK, that will do." >&4
4307         else
4308 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4309                 exit 1
4310         fi
4311 fi
4312
4313 case "$ok" in
4314 false)
4315         cppstdin="$x_cpp"
4316         cppminus="$x_minus"
4317         cpprun="$x_cpp"
4318         cpplast="$x_minus"
4319         set X $x_cpp
4320         shift
4321         case "$1" in
4322         "$cpp")
4323                 echo "Perhaps can we force $cc -E using a wrapper..."
4324                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4325                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4326                 then
4327                         echo "Yup, we can."
4328                         cppstdin="$wrapper"
4329                         cppminus='';
4330                 else
4331                         echo "Nope, we'll have to live without it..."
4332                 fi
4333                 ;;
4334         esac
4335         case "$cpprun" in
4336         "$wrapper")
4337                 cpprun=''
4338                 cpplast=''
4339                 ;;
4340         esac
4341         ;;
4342 esac
4343
4344 case "$cppstdin" in
4345 "$wrapper"|'cppstdin') ;;
4346 *) $rm -f $wrapper;;
4347 esac
4348 $rm -f testcpp.c testcpp.out
4349
4350 : Set private lib path
4351 case "$plibpth" in
4352 '') if ./mips; then
4353                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4354         fi;;
4355 esac
4356 case "$libpth" in
4357 ' ') dlist='';;
4358 '') dlist="$loclibpth $plibpth $glibpth";;
4359 *) dlist="$libpth";;
4360 esac
4361
4362 : Now check and see which directories actually exist, avoiding duplicates
4363 libpth=''
4364 for xxx in $dlist
4365 do
4366     if $test -d $xxx; then
4367                 case " $libpth " in
4368                 *" $xxx "*) ;;
4369                 *) libpth="$libpth $xxx";;
4370                 esac
4371     fi
4372 done
4373 $cat <<'EOM'
4374
4375 Some systems have incompatible or broken versions of libraries.  Among
4376 the directories listed in the question below, please remove any you
4377 know not to be holding relevant libraries, and add any that are needed.
4378 Say "none" for none.
4379
4380 EOM
4381 case "$libpth" in
4382 '') dflt='none';;
4383 *)
4384         set X $libpth
4385         shift
4386         dflt=${1+"$@"}
4387         ;;
4388 esac
4389 rp="Directories to use for library searches?"
4390 . ./myread
4391 case "$ans" in
4392 none) libpth=' ';;
4393 *) libpth="$ans";;
4394 esac
4395
4396 : compute shared library extension
4397 case "$so" in
4398 '')
4399         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4400                 dflt='sl'
4401         else
4402                 dflt='so'
4403         fi
4404         ;;
4405 *) dflt="$so";;
4406 esac
4407 $cat <<EOM
4408
4409 On some systems, shared libraries may be available.  Answer 'none' if
4410 you want to suppress searching of shared libraries for the remainder
4411 of this configuration.
4412
4413 EOM
4414 rp='What is the file extension used for shared libraries?'
4415 . ./myread
4416 so="$ans"
4417
4418 : Define several unixisms.
4419 : Hints files or command line option can be used to override them.
4420 : The convoluted testing is in case hints files set either the old
4421 : or the new name.
4422 case "$_exe" in
4423 '')     case "$exe_ext" in
4424         '')     ;;
4425         *)      _exe="$exe_ext" ;;
4426         esac
4427         ;;
4428 esac
4429 case "$_a" in
4430 '')     case "$lib_ext" in
4431     '') _a='.a';;
4432         *)      _a="$lib_ext" ;;
4433         esac
4434         ;;
4435 esac
4436 case "$_o" in
4437 '') case "$obj_ext" in
4438         '')     _o='.o';;
4439         *)      _o="$obj_ext";;
4440         esac
4441         ;;
4442 esac
4443 case "$p_" in
4444 '') case "$path_sep" in
4445         '')     p_=':';;
4446         *)      p_="$path_sep";;
4447         esac
4448         ;;
4449 esac
4450 exe_ext=$_exe
4451 lib_ext=$_a
4452 obj_ext=$_o
4453 path_sep=$p_
4454
4455 : Which makefile gets called first.  This is used by make depend.
4456 case "$firstmakefile" in
4457 '') firstmakefile='makefile';;
4458 esac
4459
4460 : Looking for optional libraries
4461 echo " "
4462 echo "Checking for optional libraries..." >&4
4463 case "$libs" in
4464 ' '|'') dflt='';;
4465 *) dflt="$libs";;
4466 esac
4467 case "$libswanted" in
4468 '') libswanted='c_s';;
4469 esac
4470 case "$usesocks" in
4471 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4472 esac
4473 libsfound=''
4474 libsfiles=''
4475 libsdirs=''
4476 libspath=''
4477 for thisdir in $libpth $xlibpth; do
4478   test -d $thisdir && libspath="$libspath $thisdir"
4479 done
4480 for thislib in $libswanted; do
4481         for thisdir in $libspath; do
4482             xxx=''
4483             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4484                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4485                 $test -f "$xxx" && eval $libscheck
4486                 $test -f "$xxx" && libstyle=shared
4487             fi
4488             if test ! -f "$xxx"; then
4489                 xxx=$thisdir/lib$thislib.$so
4490                 $test -f "$xxx" && eval $libscheck
4491                 $test -f "$xxx" && libstyle=shared
4492             fi  
4493             if test ! -f "$xxx"; then
4494                 xxx=$thisdir/lib$thislib$_a
4495                 $test -f "$xxx" && eval $libscheck
4496                 $test -f "$xxx" && libstyle=static
4497             fi
4498             if test ! -f "$xxx"; then
4499                 xxx=$thisdir/$thislib$_a
4500                 $test -f "$xxx" && eval $libscheck
4501                 $test -f "$xxx" && libstyle=static
4502             fi
4503             if test ! -f "$xxx"; then
4504                 xxx=$thisdir/lib${thislib}_s$_a
4505                 $test -f "$xxx" && eval $libscheck
4506                 $test -f "$xxx" && libstyle=static
4507                 $test -f "$xxx" && thislib=${thislib}_s
4508             fi
4509             if test ! -f "$xxx"; then
4510                 xxx=$thisdir/Slib$thislib$_a
4511                 $test -f "$xxx" && eval $libscheck
4512                 $test -f "$xxx" && libstyle=static
4513             fi
4514             if $test -f "$xxx"; then
4515                 case "$libstyle" in
4516                 shared) echo "Found -l$thislib (shared)." ;;
4517                 static) echo "Found -l$thislib." ;;
4518                 *)      echo "Found -l$thislib ($libstyle)." ;;
4519                 esac
4520                 case " $dflt " in
4521                 *"-l$thislib "*);;
4522                 *) dflt="$dflt -l$thislib"
4523                    libsfound="$libsfound $xxx"
4524                    yyy=`basename $xxx`
4525                    libsfiles="$libsfiles $yyy"
4526                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4527                    case " $libsdirs " in
4528                    *" $yyy "*) ;;
4529                    *) libsdirs="$libsdirs $yyy" ;;
4530                    esac
4531                    ;;
4532                 esac
4533                 break
4534             fi  
4535         done
4536         if $test ! -f "$xxx"; then
4537             echo "No -l$thislib."
4538         fi
4539 done
4540 set X $dflt
4541 shift
4542 dflt="$*"
4543 case "$libs" in
4544 '') dflt="$dflt";;
4545 *) dflt="$libs";;
4546 esac
4547 case "$dflt" in
4548 ' '|'') dflt='none';;
4549 esac
4550
4551 $cat <<EOM
4552
4553 In order to compile $package on your machine, a number of libraries
4554 are usually needed.  Include any other special libraries here as well.
4555 Say "none" for none.  The default list is almost always right.
4556 EOM
4557
4558 echo " "
4559 rp="What libraries to use?"
4560 . ./myread
4561 case "$ans" in
4562 none) libs=' ';;
4563 *) libs="$ans";;
4564 esac
4565
4566 : determine optimization, if desired, or use for debug flag also
4567 case "$optimize" in
4568 ' '|$undef) dflt='none';;
4569 '') dflt='-O';;
4570 *) dflt="$optimize";;
4571 esac
4572 $cat <<EOH
4573
4574 By default, $package compiles with the -O flag to use the optimizer.
4575 Alternately, you might want to use the symbolic debugger, which uses
4576 the -g flag (on traditional Unix systems).  Either flag can be
4577 specified here.  To use neither flag, specify the word "none".
4578
4579 EOH
4580 rp="What optimizer/debugger flag should be used?"
4581 . ./myread
4582 optimize="$ans"
4583 case "$optimize" in
4584 'none') optimize=" ";;
4585 esac
4586
4587 dflt=''
4588 : We will not override a previous value, but we might want to
4589 : augment a hint file
4590 case "$hint" in
4591 default|recommended)
4592         case "$gccversion" in
4593         1*) dflt='-fpcc-struct-return' ;;
4594         esac
4595         case "$optimize" in
4596         *-g*) dflt="$dflt -DDEBUGGING";;
4597         esac
4598         case "$gccversion" in
4599         2*) if test -d /etc/conf/kconfig.d &&
4600                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4601                 then
4602                         dflt="$dflt -posix"
4603                 fi
4604                 ;;
4605         esac
4606         case "$gccversion" in
4607         1*) ;;
4608         2.[0-8]*) ;;
4609         ?*)     echo " "
4610                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4611                 echo 'int main(void) { return 0; }' > gcctest.c
4612                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4613                         echo "Yes, it does." 2>&1
4614                         case "$ccflags" in
4615                         *strict-aliasing*) 
4616                                 echo "Leaving current flags $ccflags alone." 2>&1
4617                                 ;;
4618                         *) dflt="$dflt -fno-strict-aliasing" ;;
4619                         esac
4620                 else
4621                         echo "Nope, it doesn't, but that's ok." 2>&1
4622                 fi
4623                 ;;
4624         esac
4625         ;;
4626 esac
4627
4628 case "$mips_type" in
4629 *BSD*|'') inclwanted="$locincpth $usrinc";;
4630 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4631 esac
4632 for thisincl in $inclwanted; do
4633         if $test -d $thisincl; then
4634                 if $test x$thisincl != x$usrinc; then
4635                         case "$dflt" in
4636                         *" -I$thisincl "*);;
4637                         *) dflt="$dflt -I$thisincl ";;
4638                         esac
4639                 fi
4640         fi
4641 done
4642
4643 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4644         xxx=true;
4645 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4646         xxx=true;
4647 else
4648         xxx=false;
4649 fi;
4650 if $xxx; then
4651         case "$dflt" in
4652         *$2*);;
4653         *) dflt="$dflt -D$2";;
4654         esac;
4655 fi'
4656
4657 set signal.h LANGUAGE_C; eval $inctest
4658
4659 case "$usesocks" in
4660 $define)
4661         ccflags="$ccflags -DSOCKS"
4662         ;;
4663 esac
4664
4665 case "$hint" in
4666 default|recommended) dflt="$ccflags $dflt" ;;
4667 *) dflt="$ccflags";;
4668 esac
4669
4670 case "$dflt" in
4671 ''|' ') dflt=none;;
4672 esac
4673
4674 $cat <<EOH
4675
4676 Your C compiler may want other flags.  For this question you should include
4677 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4678 but you should NOT include libraries or ld flags like -lwhatever.  If you
4679 want $package to honor its debug switch, you should include -DDEBUGGING here.
4680 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4681
4682 To use no flags, specify the word "none".
4683
4684 EOH
4685 set X $dflt
4686 shift
4687 dflt=${1+"$@"}
4688 rp="Any additional cc flags?"
4689 . ./myread
4690 case "$ans" in
4691 none) ccflags='';;
4692 *) ccflags="$ans";;
4693 esac
4694
4695 : the following weeds options from ccflags that are of no interest to cpp
4696 case "$cppflags" in
4697 '') cppflags="$ccflags" ;;
4698 *)  cppflags="$cppflags $ccflags" ;;
4699 esac
4700 case "$gccversion" in
4701 1*) cppflags="$cppflags -D__GNUC__"
4702 esac
4703 case "$mips_type" in
4704 '');;
4705 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4706 esac
4707 case "$cppflags" in
4708 '');;
4709 *)
4710         echo " "
4711         echo "Let me guess what the preprocessor flags are..." >&4
4712         set X $cppflags
4713         shift
4714         cppflags=''
4715         $cat >cpp.c <<'EOM'
4716 #define BLURFL foo
4717
4718 BLURFL xx LFRULB
4719 EOM
4720         previous=''
4721         for flag in $*
4722         do
4723                 case "$flag" in
4724                 -*) ftry="$flag";;
4725                 *) ftry="$previous $flag";;
4726                 esac
4727                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4728                         >cpp1.out 2>/dev/null && \
4729                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4730                         >cpp2.out 2>/dev/null && \
4731                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4732                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4733                 then
4734                         cppflags="$cppflags $ftry"
4735                         previous=''
4736                 else
4737                         previous="$flag"
4738                 fi
4739         done
4740         set X $cppflags
4741         shift
4742         cppflags=${1+"$@"}
4743         case "$cppflags" in
4744         *-*)  echo "They appear to be: $cppflags";;
4745         esac
4746         $rm -f cpp.c cpp?.out
4747         ;;
4748 esac
4749
4750 : flags used in final linking phase
4751 case "$ldflags" in
4752 '') if ./venix; then
4753                 dflt='-i -z'
4754         else
4755                 dflt=''
4756         fi
4757         case "$ccflags" in
4758         *-posix*) dflt="$dflt -posix" ;;
4759         esac
4760         ;;
4761 *) dflt="$ldflags";;
4762 esac
4763
4764 : Try to guess additional flags to pick up local libraries.
4765 for thislibdir in $libpth; do
4766         case " $loclibpth " in
4767         *" $thislibdir "*)
4768                 case "$dflt " in 
4769                 *"-L$thislibdir "*) ;;
4770                 *)  dflt="$dflt -L$thislibdir" ;;
4771                 esac
4772                 ;;
4773         esac
4774 done
4775
4776 case "$dflt" in
4777 '') dflt='none' ;;
4778 esac
4779
4780 $cat <<EOH
4781
4782 Your C linker may need flags.  For this question you should
4783 include -L/whatever and any other flags used by the C linker, but you
4784 should NOT include libraries like -lwhatever.
4785
4786 Make sure you include the appropriate -L/path flags if your C linker
4787 does not normally search all of the directories you specified above,
4788 namely
4789         $libpth
4790 To use no flags, specify the word "none".
4791
4792 EOH
4793
4794 rp="Any additional ld flags (NOT including libraries)?"
4795 . ./myread
4796 case "$ans" in
4797 none) ldflags='';;
4798 *) ldflags="$ans";;
4799 esac
4800 rmlist="$rmlist pdp11"
4801
4802 : coherency check
4803 echo " "
4804 echo "Checking your choice of C compiler and flags for coherency..." >&4
4805 $cat > try.c <<'EOF'
4806 #include <stdio.h>
4807 int main() { printf("Ok\n"); exit(0); }
4808 EOF
4809 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4810 shift
4811 $cat >try.msg <<'EOM'
4812 I've tried to compile and run the following simple program:
4813
4814 EOM
4815 $cat try.c >> try.msg
4816
4817 $cat >> try.msg <<EOM
4818
4819 I used the command:
4820
4821         $*
4822         $run ./try
4823
4824 and I got the following output:
4825
4826 EOM
4827 dflt=y
4828 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4829         if $sh -c "$run ./try" >>try.msg 2>&1; then
4830                 xxx=`$run ./try`
4831                 case "$xxx" in
4832                 "Ok") dflt=n ;;
4833                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4834                         case " $libs " in
4835                         *" -lsfio "*)
4836                                 cat >> try.msg <<'EOQS'
4837 If $libs contains -lsfio, and sfio is mis-configured, then it
4838 sometimes (apparently) runs and exits with a 0 status, but with no
4839 output!  It may have to do with sfio's use of _exit vs. exit.
4840
4841 EOQS
4842                                 rp="You have a big problem.  Shall I abort Configure"
4843                                 dflt=y
4844                                 ;;
4845                         esac
4846                         ;;
4847                 esac
4848         else
4849                 echo "The program compiled OK, but exited with status $?." >>try.msg
4850                 rp="You have a problem.  Shall I abort Configure"
4851                 dflt=y
4852         fi
4853 else
4854         echo "I can't compile the test program." >>try.msg
4855         rp="You have a BIG problem.  Shall I abort Configure"
4856         dflt=y
4857 fi
4858 case "$dflt" in
4859 y)
4860         $cat try.msg >&4
4861         case "$knowitall" in
4862         '')
4863                 echo "(The supplied flags or libraries might be incorrect.)"
4864                 ;;
4865         *) dflt=n;;
4866         esac
4867         echo " "
4868         . ./myread
4869         case "$ans" in
4870         n*|N*) ;;
4871         *)      echo "Ok.  Stopping Configure." >&4
4872                 exit 1
4873                 ;;
4874         esac
4875         ;;
4876 n) echo "OK, that should do.";;
4877 esac
4878 $rm -f try try.* core
4879
4880 : define a shorthand compile call
4881 compile='
4882 mc_file=$1;
4883 shift;
4884 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4885 : define a shorthand compile call for compilations that should be ok.
4886 compile_ok='
4887 mc_file=$1;
4888 shift;
4889 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4890
4891 : check for lengths of integral types
4892 echo " "
4893 case "$intsize" in
4894 '')
4895         echo "Checking to see how big your integers are..." >&4
4896         $cat >try.c <<'EOCP'
4897 #include <stdio.h>
4898 int main()
4899 {
4900         printf("intsize=%d;\n", (int)sizeof(int));
4901         printf("longsize=%d;\n", (int)sizeof(long));
4902         printf("shortsize=%d;\n", (int)sizeof(short));
4903         exit(0);
4904 }
4905 EOCP
4906         set try
4907         if eval $compile_ok && $run ./try > /dev/null; then
4908                 eval `$run ./try`
4909                 echo "Your integers are $intsize bytes long."
4910                 echo "Your long integers are $longsize bytes long."
4911                 echo "Your short integers are $shortsize bytes long."
4912         else
4913                 $cat >&4 <<EOM
4914 !
4915 Help! I can't compile and run the intsize test program: please enlighten me!
4916 (This is probably a misconfiguration in your system or libraries, and
4917 you really ought to fix it.  Still, I'll try anyway.)
4918 !
4919 EOM
4920                 dflt=4
4921                 rp="What is the size of an integer (in bytes)?"
4922                 . ./myread
4923                 intsize="$ans"
4924                 dflt=$intsize
4925                 rp="What is the size of a long integer (in bytes)?"
4926                 . ./myread
4927                 longsize="$ans"
4928                 dflt=2
4929                 rp="What is the size of a short integer (in bytes)?"
4930                 . ./myread
4931                 shortsize="$ans"
4932         fi
4933         ;;
4934 esac
4935 $rm -f try try.*
4936
4937 : check for long long
4938 echo " "
4939 echo "Checking to see if you have long long..." >&4
4940 echo 'int main() { long long x = 7; return 0; }' > try.c
4941 set try
4942 if eval $compile; then
4943         val="$define"
4944         echo "You have long long."
4945 else
4946         val="$undef"
4947         echo "You do not have long long."
4948 fi
4949 $rm try.*
4950 set d_longlong
4951 eval $setvar
4952
4953 : check for length of long long
4954 case "${d_longlong}${longlongsize}" in
4955 $define)
4956         echo " "
4957         echo "Checking to see how big your long longs are..." >&4
4958         $cat >try.c <<'EOCP'
4959 #include <stdio.h>
4960 int main()
4961 {
4962     printf("%d\n", (int)sizeof(long long));
4963     return(0);
4964 }
4965 EOCP
4966         set try
4967         if eval $compile_ok; then
4968                 longlongsize=`$run ./try`
4969                 echo "Your long longs are $longlongsize bytes long."
4970         else
4971                 dflt='8'
4972                 echo " "
4973                 echo "(I can't seem to compile the test program.  Guessing...)"
4974                 rp="What is the size of a long long (in bytes)?"
4975                 . ./myread
4976                 longlongsize="$ans"
4977         fi
4978         if $test "X$longsize" = "X$longlongsize"; then
4979                 echo "(That isn't any different from an ordinary long.)"
4980         fi      
4981         ;;
4982 esac
4983 $rm -f try.* try
4984
4985 : determine filename position in cpp output
4986 echo " "
4987 echo "Computing filename position in cpp output for #include directives..." >&4
4988 case "$osname" in
4989 vos) testaccess=-e ;;
4990 *)   testaccess=-r ;;
4991 esac
4992 echo '#include <stdio.h>' > foo.c
4993 $cat >fieldn <<EOF
4994 $startsh
4995 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4996 $grep '^[       ]*#.*stdio\.h' | \
4997 while read cline; do
4998         pos=1
4999         set \$cline
5000         while $test \$# -gt 0; do
5001                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5002                         echo "\$pos"
5003                         exit 0
5004                 fi
5005                 shift
5006                 pos=\`expr \$pos + 1\`
5007         done
5008 done
5009 EOF
5010 chmod +x fieldn
5011 fieldn=`./fieldn`
5012 $rm -f foo.c fieldn
5013 case $fieldn in
5014 '') pos='???';;
5015 1) pos=first;;
5016 2) pos=second;;
5017 3) pos=third;;
5018 *) pos="${fieldn}th";;
5019 esac
5020 echo "Your cpp writes the filename in the $pos field of the line."
5021
5022 case "$osname" in
5023 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5024 *)   cppfilter='' ;;
5025 esac
5026 : locate header file
5027 $cat >findhdr <<EOF
5028 $startsh
5029 wanted=\$1
5030 name=''
5031 for usrincdir in $usrinc
5032 do
5033         if test -f \$usrincdir/\$wanted; then
5034                 echo "\$usrincdir/\$wanted"
5035                 exit 0
5036         fi
5037 done
5038 awkprg='{ print \$$fieldn }'
5039 echo "#include <\$wanted>" > foo\$\$.c
5040 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5041 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5042 while read cline; do
5043         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5044         case "\$name" in
5045         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5046         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5047         *) exit 2;;
5048         esac;
5049 done;
5050 #
5051 # status = 0: grep returned 0 lines, case statement not executed
5052 # status = 1: headerfile found
5053 # status = 2: while loop executed, no headerfile found
5054 #
5055 status=\$?
5056 $rm -f foo\$\$.c;
5057 if test \$status -eq 1; then
5058         exit 0;
5059 fi
5060 exit 1
5061 EOF
5062 chmod +x findhdr
5063
5064 : define an alternate in-header-list? function
5065 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5066 cont=true; xxf="echo \"<\$1> found.\" >&4";
5067 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5068 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5069 esac;
5070 case $# in 4) instead=instead;; *) instead="at last";; esac;
5071 while $test "$cont"; do
5072         xxx=`./findhdr $1`
5073         var=$2; eval "was=\$$2";
5074         if $test "$xxx" && $test -r "$xxx";
5075         then eval $xxf;
5076         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5077                 cont="";
5078         else eval $xxnf;
5079         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5080         set $yyy; shift; shift; yyy=$@;
5081         case $# in 0) cont="";;
5082         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5083                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5084         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5085                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5086         esac;
5087 done;
5088 while $test "$yyy";
5089 do set $yyy; var=$2; eval "was=\$$2";
5090         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5091         set $yyy; shift; shift; yyy=$@;
5092 done'
5093
5094 : see if inttypes.h is available
5095 : we want a real compile instead of Inhdr because some systems
5096 : have an inttypes.h which includes non-existent headers
5097 echo " "
5098 $cat >try.c <<EOCP
5099 #include <inttypes.h>
5100 int main() {
5101         static int32_t foo32 = 0x12345678;
5102 }
5103 EOCP
5104 set try
5105 if eval $compile; then
5106         echo "<inttypes.h> found." >&4
5107         val="$define"
5108 else
5109         echo "<inttypes.h> NOT found." >&4
5110         val="$undef"
5111 fi
5112 $rm -f try.c try
5113 set i_inttypes
5114 eval $setvar
5115
5116 : check for int64_t
5117 echo " "
5118 echo "Checking to see if you have int64_t..." >&4
5119 $cat >try.c <<EOCP
5120 #include <sys/types.h>
5121 #$i_inttypes I_INTTYPES
5122 #ifdef I_INTTYPES
5123 #include <inttypes.h>
5124 #endif
5125 int main() { int64_t x = 7; }
5126 EOCP
5127 set try
5128 if eval $compile; then
5129         val="$define"
5130         echo "You have int64_t."
5131 else
5132         val="$undef"
5133         echo "You do not have int64_t."
5134 fi
5135 $rm -f try try.*
5136 set d_int64_t
5137 eval $setvar
5138
5139
5140 echo " "
5141 echo "Checking which 64-bit integer type we could use..." >&4
5142
5143 case "$intsize" in
5144 8) val=int
5145    set quadtype
5146    eval $setvar
5147    val='"unsigned int"'
5148    set uquadtype
5149    eval $setvar
5150    quadkind=1
5151    ;;
5152 *) case "$longsize" in
5153    8) val=long
5154       set quadtype
5155       eval $setvar
5156       val='"unsigned long"'
5157       set uquadtype
5158       eval $setvar
5159       quadkind=2
5160       ;;
5161    *) case "$d_longlong:$longlongsize" in
5162       define:8)
5163         val='"long long"'
5164         set quadtype
5165         eval $setvar
5166         val='"unsigned long long"'
5167         set uquadtype
5168         eval $setvar
5169         quadkind=3
5170         ;;
5171       *) case "$d_int64_t" in
5172          define)
5173            val=int64_t
5174            set quadtype
5175            eval $setvar
5176            val=uint64_t
5177            set uquadtype
5178            eval $setvar
5179            quadkind=4
5180            ;;
5181          esac
5182          ;;
5183       esac
5184       ;;
5185    esac
5186    ;;
5187 esac
5188
5189 case "$quadtype" in
5190 '')     echo "Alas, no 64-bit integer types in sight." >&4
5191         d_quad="$undef"
5192         ;;
5193 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5194         d_quad="$define"
5195         ;;
5196 esac
5197
5198
5199 case "$uselonglong" in
5200 "$define"|true|[yY]*)
5201         cat <<EOM >&4
5202
5203 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5204 EOM
5205         use64bitint="$define"
5206         ;;
5207 esac                          
5208 case "$use64bits" in
5209 "$define"|true|[yY]*)
5210         cat <<EOM >&4
5211
5212 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5213 EOM
5214         use64bitint="$define"
5215         ;;
5216 esac                          
5217 case "$use64bitints" in
5218 "$define"|true|[yY]*)
5219         cat <<EOM >&4
5220
5221 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5222 EOM
5223         use64bitint="$define"
5224         ;;
5225 esac                          
5226 case "$use64bitsint" in
5227 "$define"|true|[yY]*)
5228         cat <<EOM >&4
5229
5230 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5231 EOM
5232         use64bitint="$define"
5233         ;;
5234 esac                          
5235 case "$uselonglongs" in
5236 "$define"|true|[yY]*)
5237         cat <<EOM >&4
5238
5239 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5240 EOM
5241         use64bitint="$define"
5242         ;;
5243 esac                          
5244 case "$use64bitsall" in
5245 "$define"|true|[yY]*)
5246         cat <<EOM >&4
5247
5248 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5249 EOM
5250         use64bitall="$define"
5251         ;;
5252 esac                          
5253
5254 case "$ccflags" in
5255 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5256 esac
5257 case "$use64bitall" in
5258 "$define"|true|[yY]*) use64bitint="$define" ;;
5259 esac
5260
5261 case "$longsize" in
5262 8) cat <<EOM
5263
5264 You have natively 64-bit long integers.
5265 EOM
5266    val="$define"
5267    ;;
5268 *) case "$use64bitint" in
5269    "$define"|true|[yY]*) dflt='y';;
5270    *) dflt='n';;
5271    esac
5272    case "$d_quad" in
5273    "$define") ;;
5274    *) dflt='n' ;;
5275    esac
5276    cat <<EOM
5277
5278 Perl can be built to take advantage of 64-bit integer types
5279 on some systems.  To do so, Configure can be run with -Duse64bitint.
5280 Choosing this option will most probably introduce binary incompatibilities.
5281
5282 If this doesn't make any sense to you, just accept the default '$dflt'.
5283 (The default has been chosen based on your configuration.)
5284 EOM
5285    rp='Try to use 64-bit integers, if available?'
5286    . ./myread
5287    case "$ans" in
5288    [yY]*) val="$define" ;;
5289    *)     val="$undef"  ;;
5290    esac
5291    ;;
5292 esac
5293 set use64bitint
5294 eval $setvar
5295
5296 case "$use64bitall" in
5297 "$define"|true|[yY]*) dflt='y' ;;
5298 *) case "$longsize" in
5299    8) dflt='y' ;;
5300    *) dflt='n' ;;
5301    esac
5302    ;;
5303 esac    
5304 cat <<EOM
5305
5306 You may also choose to try maximal 64-bitness.  It means using as much
5307 64-bitness as possible on the platform.  This in turn means even more
5308 binary incompatibilities.  On the other hand, your platform may not
5309 have any more 64-bitness available than what you already have chosen.
5310
5311 If this doesn't make any sense to you, just accept the default '$dflt'.
5312 (The default has been chosen based on your configuration.)
5313 EOM
5314 rp='Try to use maximal 64-bit support, if available?'
5315 . ./myread
5316 case "$ans" in
5317 [yY]*) val="$define" ;;
5318 *)     val="$undef"  ;;
5319 esac
5320 set use64bitall
5321 eval $setvar
5322 case "$use64bitall" in
5323 "$define")
5324         case "$use64bitint" in
5325         "$undef")
5326                 cat <<EOM
5327
5328 Since you have chosen a maximally 64-bit build, I'm also turning on
5329 the use of 64-bit integers.
5330 EOM
5331                 use64bitint="$define" ;;
5332         esac
5333         ;;
5334 esac
5335
5336 case "$use64bitint" in
5337 "$define"|true|[yY]*)
5338 : Look for a hint-file generated 'call-back-unit'.  If the
5339 : user has specified that a 64-bit perl is to be built,
5340 : we may need to set or change some other defaults.
5341         if $test -f use64bitint.cbu; then
5342                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5343                 . ./use64bitint.cbu
5344         fi
5345         case "$longsize" in
5346         4) case "$archname64" in
5347            '') archname64=64int ;;
5348            esac
5349            ;;
5350         esac
5351         ;;
5352 esac
5353
5354 case "$use64bitall" in
5355 "$define"|true|[yY]*)
5356 : Look for a hint-file generated 'call-back-unit'.  If the
5357 : user has specified that a maximally 64-bit perl is to be built,
5358 : we may need to set or change some other defaults.
5359         if $test -f use64bitall.cbu; then
5360                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5361                 . ./use64bitall.cbu
5362         fi
5363         case "$longsize" in
5364         4) case "$archname64" in
5365            ''|64int) archname64=64all ;;
5366            esac
5367            ;;
5368         esac
5369         ;;
5370 esac
5371
5372 echo " "
5373 echo "Checking for GNU C Library..." >&4
5374 cat >try.c <<'EOCP'
5375 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
5376    alone are insufficient to distinguish different versions, such as
5377    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
5378    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
5379 */
5380 #include <stdio.h>
5381 int main(void)
5382 {
5383 #ifdef __GLIBC__
5384 #   ifdef __GLIBC_MINOR__
5385 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
5386 #           include <gnu/libc-version.h>
5387             printf("%s\n",  gnu_get_libc_version());
5388 #       else
5389             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
5390 #       endif
5391 #   else
5392         printf("%d\n",  __GLIBC__);
5393 #   endif
5394     return 0;
5395 #else
5396     return 1;
5397 #endif
5398 }
5399 EOCP
5400 set try
5401 if eval $compile_ok && $run ./try > glibc.ver; then
5402         val="$define"
5403         gnulibc_version=`$cat glibc.ver`
5404         echo "You are using the GNU C Library version $gnulibc_version"
5405 else
5406         val="$undef"
5407         gnulibc_version=''
5408         echo "You are not using the GNU C Library"
5409 fi
5410 $rm -f try try.* glibc.ver
5411 set d_gnulibc
5412 eval $setvar
5413
5414 : see if nm is to be used to determine whether a symbol is defined or not
5415 case "$usenm" in
5416 '')
5417         dflt=''
5418         case "$d_gnulibc" in
5419         "$define")
5420                 echo " "
5421                 echo "nm probably won't work on the GNU C Library." >&4
5422                 dflt=n
5423                 ;;
5424         esac
5425         case "$dflt" in
5426         '') 
5427                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
5428                         echo " "
5429                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5430                         echo "'nm' won't be sufficient on this sytem." >&4
5431                         dflt=n
5432                 fi
5433                 ;;
5434         esac
5435         case "$dflt" in
5436         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5437                 if $test $dflt -gt 20; then
5438                         dflt=y
5439                 else
5440                         dflt=n
5441                 fi
5442                 ;;
5443         esac
5444         ;;
5445 *)
5446         case "$usenm" in
5447         true|$define) dflt=y;;
5448         *) dflt=n;;
5449         esac
5450         ;;
5451 esac
5452 $cat <<EOM
5453
5454 I can use $nm to extract the symbols from your C libraries. This
5455 is a time consuming task which may generate huge output on the disk (up
5456 to 3 megabytes) but that should make the symbols extraction faster. The
5457 alternative is to skip the 'nm' extraction part and to compile a small
5458 test program instead to determine whether each symbol is present. If
5459 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5460 this may be the best solution.
5461
5462 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5463
5464 EOM
5465 rp="Shall I use $nm to extract C symbols from the libraries?"
5466 . ./myread
5467 case "$ans" in
5468 [Nn]*) usenm=false;;
5469 *) usenm=true;;
5470 esac
5471
5472 runnm=$usenm
5473 case "$reuseval" in
5474 true) runnm=false;;
5475 esac
5476
5477 : nm options which may be necessary
5478 case "$nm_opt" in
5479 '') if $test -f /mach_boot; then
5480                 nm_opt=''       # Mach
5481         elif $test -d /usr/ccs/lib; then
5482                 nm_opt='-p'     # Solaris (and SunOS?)
5483         elif $test -f /dgux; then
5484                 nm_opt='-p'     # DG-UX
5485         elif $test -f /lib64/rld; then
5486                 nm_opt='-p'     # 64-bit Irix
5487         else
5488                 nm_opt=''
5489         fi;;
5490 esac
5491
5492 : nm options which may be necessary for shared libraries but illegal
5493 : for archive libraries.  Thank you, Linux.
5494 case "$nm_so_opt" in
5495 '')     case "$myuname" in
5496         *linux*)
5497                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5498                         nm_so_opt='--dynamic'
5499                 fi
5500                 ;;
5501         esac
5502         ;;
5503 esac
5504
5505 case "$runnm" in
5506 true)
5507 : get list of predefined functions in a handy place
5508 echo " "
5509 case "$libc" in
5510 '') libc=unknown
5511         case "$libs" in
5512         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5513         esac
5514         ;;
5515 esac
5516 case "$libs" in
5517 '') ;;
5518 *)  for thislib in $libs; do
5519         case "$thislib" in
5520         -lc|-lc_s)
5521                 : Handle C library specially below.
5522                 ;;
5523         -l*)
5524                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5525                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5526                         :
5527                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5528                         :
5529                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5530                         :
5531                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5532                         :
5533                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5534                         :
5535                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5536                         :
5537                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5538                         :
5539                 else
5540                         try=''
5541                 fi
5542                 libnames="$libnames $try"
5543                 ;;
5544         *) libnames="$libnames $thislib" ;;
5545         esac
5546         done
5547         ;;
5548 esac
5549 xxx=normal
5550 case "$libc" in
5551 unknown)
5552         set /lib/libc.$so
5553         for xxx in $libpth; do
5554                 $test -r $1 || set $xxx/libc.$so
5555                 : The messy sed command sorts on library version numbers.
5556                 $test -r $1 || \
5557                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5558                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5559                                 h
5560                                 s/[0-9][0-9]*/0000&/g
5561                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5562                                 G
5563                                 s/\n/ /' | \
5564                          $sort | $sed -e 's/^.* //'`
5565                 eval set \$$#
5566         done
5567         $test -r $1 || set /usr/ccs/lib/libc.$so
5568         $test -r $1 || set /lib/libsys_s$_a
5569         ;;
5570 *)
5571         set blurfl
5572         ;;
5573 esac
5574 if $test -r "$1"; then
5575         echo "Your (shared) C library seems to be in $1."
5576         libc="$1"
5577 elif $test -r /lib/libc && $test -r /lib/clib; then
5578         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5579         xxx=apollo
5580         libc='/lib/clib /lib/libc'
5581         if $test -r /lib/syslib; then
5582                 echo "(Your math library is in /lib/syslib.)"
5583                 libc="$libc /lib/syslib"
5584         fi
5585 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5586         echo "Your C library seems to be in $libc, as you said before."
5587 elif $test -r $incpath/usr/lib/libc$_a; then
5588         libc=$incpath/usr/lib/libc$_a;
5589         echo "Your C library seems to be in $libc.  That's fine."
5590 elif $test -r /lib/libc$_a; then
5591         libc=/lib/libc$_a;
5592         echo "Your C library seems to be in $libc.  You're normal."
5593 else
5594         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5595                 :
5596         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5597                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5598         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5599                 :
5600         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5601                 :
5602         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5603                 :
5604         else
5605                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5606         fi
5607         if $test -r "$tans"; then
5608                 echo "Your C library seems to be in $tans, of all places."
5609                 libc=$tans
5610         else
5611                 libc='blurfl'
5612         fi
5613 fi
5614 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5615         dflt="$libc"
5616         cat <<EOM
5617
5618 If the guess above is wrong (which it might be if you're using a strange
5619 compiler, or your machine supports multiple models), you can override it here.
5620
5621 EOM
5622 else
5623         dflt=''
5624         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5625         cat >&4 <<EOM
5626 I can't seem to find your C library.  I've looked in the following places:
5627
5628 EOM
5629         $sed 's/^/      /' libpath
5630         cat <<EOM
5631
5632 None of these seems to contain your C library. I need to get its name...
5633
5634 EOM
5635 fi
5636 fn=f
5637 rp='Where is your C library?'
5638 . ./getfile
5639 libc="$ans"
5640
5641 echo " "
5642 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5643 set X `cat libnames`
5644 shift
5645 xxx=files
5646 case $# in 1) xxx=file; esac
5647 echo "Extracting names from the following $xxx for later perusal:" >&4
5648 echo " "
5649 $sed 's/^/      /' libnames >&4
5650 echo " "
5651 $echo $n "This may take a while...$c" >&4
5652
5653 for file in $*; do
5654         case $file in
5655         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5656         *) $nm $nm_opt $file 2>/dev/null;;
5657         esac
5658 done >libc.tmp
5659
5660 $echo $n ".$c"
5661 $grep fprintf libc.tmp > libc.ptf
5662 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5663 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
5664 xxx='[ADTSIW]'
5665 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5666         eval $xscan;\
5667         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5668                 eval $xrun
5669 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5670         eval $xscan;\
5671         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5672                 eval $xrun
5673 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5674         eval $xscan;\
5675         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5676                 eval $xrun
5677 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5678         eval $xscan;\
5679         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5680                 eval $xrun
5681 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5682         eval $xscan;\
5683         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5684                 eval $xrun
5685 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5686         eval $xscan;\
5687         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5688                 eval $xrun
5689 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5690                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5691         eval $xscan;\
5692         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5693                 eval $xrun
5694 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5695         eval $xscan;\
5696         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5697                 eval $xrun
5698 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5699         eval $xscan;\
5700         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5701                 eval $xrun
5702 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5703         eval $xscan;\
5704         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5705                 eval $xrun
5706 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5707         eval $xscan;\
5708         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5709                 eval $xrun
5710 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5711         eval $xscan;\
5712         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5713                 eval $xrun
5714 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5715         eval $xscan;\
5716         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5717                 eval $xrun
5718 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5719         eval $xscan;\
5720         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5721                 eval $xrun
5722 else
5723         $nm -p $* 2>/dev/null >libc.tmp
5724         $grep fprintf libc.tmp > libc.ptf
5725         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5726                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5727         then
5728                 nm_opt='-p'
5729                 eval $xrun
5730         else
5731                 echo " "
5732                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5733                 com=''
5734                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5735                         for thisname in $libnames $libc; do
5736                                 $ar t $thisname >>libc.tmp
5737                         done
5738                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5739                         echo "Ok." >&4
5740                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5741                         # Repeat libc to extract forwarders to DLL entries too
5742                         for thisname in $libnames $libc; do
5743                                 $ar tv $thisname >>libc.tmp
5744                                 # Revision 50 of EMX has bug in $ar.
5745                                 # it will not extract forwarders to DLL entries
5746                                 # Use emximp which will extract exactly them.
5747                                 emximp -o tmp.imp $thisname \
5748                                     2>/dev/null && \
5749                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5750                                     < tmp.imp >>libc.tmp
5751                                 $rm tmp.imp
5752                         done
5753                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5754                         echo "Ok." >&4
5755                 else
5756                         echo "$ar didn't seem to work right." >&4
5757                         echo "Maybe this is a Cray...trying bld instead..." >&4
5758                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5759                         then
5760                                 for thisname in $libnames; do
5761                                         bld t $libnames | \
5762                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5763                                         $ar t $thisname >>libc.tmp
5764                                 done
5765                                 echo "Ok." >&4
5766                         else
5767                                 echo "That didn't work either.  Giving up." >&4
5768                                 exit 1
5769                         fi
5770                 fi
5771         fi
5772 fi
5773 nm_extract="$com"
5774 case "$PASE" in
5775 define)
5776     echo " "
5777     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
5778     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
5779     ;;
5780 *)  if $test -f /lib/syscalls.exp; then
5781         echo " "
5782         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5783         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
5784     fi
5785     ;;
5786 esac
5787 ;;
5788 esac
5789 $rm -f libnames libpath
5790
5791 : is a C symbol defined?
5792 csym='tlook=$1;
5793 case "$3" in
5794 -v) tf=libc.tmp; tc=""; tdc="";;
5795 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5796 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5797 esac;
5798 tx=yes;
5799 case "$reuseval-$4" in
5800 true-) ;;
5801 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5802 esac;
5803 case "$tx" in
5804 yes)
5805         case "$runnm" in
5806         true)
5807                 if $contains $tlook $tf >/dev/null 2>&1;
5808                 then tval=true;
5809                 else tval=false;
5810                 fi;;
5811         *)
5812                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5813                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5814                 then tval=true;
5815                 else tval=false;
5816                 fi;
5817                 $rm -f t t.c;;
5818         esac;;
5819 *)
5820         case "$tval" in
5821         $define) tval=true;;
5822         *) tval=false;;
5823         esac;;
5824 esac;
5825 eval "$2=$tval"'
5826
5827 : define an is-in-libc? function
5828 inlibc='echo " "; td=$define; tu=$undef;
5829 sym=$1; var=$2; eval "was=\$$2";
5830 tx=yes;
5831 case "$reuseval$was" in
5832 true) ;;
5833 true*) tx=no;;
5834 esac;
5835 case "$tx" in
5836 yes)
5837         set $sym tres -f;
5838         eval $csym;
5839         case "$tres" in
5840         true)
5841                 echo "$sym() found." >&4;
5842                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5843         *)
5844                 echo "$sym() NOT found." >&4;
5845                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5846         esac;;
5847 *)
5848         case "$was" in
5849         $define) echo "$sym() found." >&4;;
5850         *) echo "$sym() NOT found." >&4;;
5851         esac;;
5852 esac'
5853
5854 : see if sqrtl exists
5855 set sqrtl d_sqrtl
5856 eval $inlibc
5857
5858 hasproto='varname=$1; func=$2; shift; shift;
5859 while $test $# -ge 2; do
5860         case "$1" in
5861         $define) echo "#include <$2>";;
5862         esac ;
5863     shift 2;
5864 done > try.c;
5865 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
5866 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
5867         echo "$func() prototype found.";
5868         val="$define";
5869 else
5870         echo "$func() prototype NOT found.";
5871         val="$undef";
5872 fi;
5873 set $varname;
5874 eval $setvar;
5875 $rm -f try.c tryout.c'
5876
5877 : check for length of double
5878 echo " "
5879 case "$doublesize" in
5880 '')
5881         echo "Checking to see how big your double precision numbers are..." >&4
5882         $cat >try.c <<'EOCP'
5883 #include <stdio.h>
5884 int main()
5885 {
5886     printf("%d\n", (int)sizeof(double));
5887     exit(0);
5888 }
5889 EOCP
5890         set try
5891         if eval $compile_ok; then
5892                 doublesize=`$run ./try`
5893                 echo "Your double is $doublesize bytes long."
5894         else
5895                 dflt='8'
5896                 echo "(I can't seem to compile the test program.  Guessing...)"
5897                 rp="What is the size of a double precision number (in bytes)?"
5898                 . ./myread
5899                 doublesize="$ans"
5900         fi
5901         ;;
5902 esac
5903 $rm -f try.c try
5904
5905 : check for long doubles
5906 echo " "
5907 echo "Checking to see if you have long double..." >&4
5908 echo 'int main() { long double x = 7.0; }' > try.c
5909 set try
5910 if eval $compile; then
5911         val="$define"
5912         echo "You have long double."
5913 else
5914         val="$undef"
5915         echo "You do not have long double."
5916 fi
5917 $rm try.*
5918 set d_longdbl
5919 eval $setvar
5920
5921 : check for length of long double
5922 case "${d_longdbl}${longdblsize}" in
5923 $define)
5924         echo " "
5925         echo "Checking to see how big your long doubles are..." >&4
5926         $cat >try.c <<'EOCP'
5927 #include <stdio.h>
5928 int main()
5929 {
5930         printf("%d\n", sizeof(long double));
5931 }
5932 EOCP
5933         set try
5934         set try
5935         if eval $compile; then
5936                 longdblsize=`$run ./try`
5937                 echo "Your long doubles are $longdblsize bytes long."
5938         else
5939                 dflt='8'
5940                 echo " "
5941                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5942                 rp="What is the size of a long double (in bytes)?"
5943                 . ./myread
5944                 longdblsize="$ans"
5945         fi
5946         if $test "X$doublesize" = "X$longdblsize"; then
5947                 echo "(That isn't any different from an ordinary double.)"
5948         fi      
5949         ;;
5950 esac
5951 $rm -f try.* try
5952
5953 echo " "
5954
5955 if $test X"$d_longdbl" = X"$define"; then
5956
5957 echo "Checking how to print long doubles..." >&4
5958
5959 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
5960         $cat >try.c <<'EOCP'
5961 #include <sys/types.h>
5962 #include <stdio.h>
5963 int main() {
5964   double d = 123.456;
5965   printf("%.3f\n", d);
5966 }
5967 EOCP
5968         set try
5969         if eval $compile; then
5970                 yyy=`$run ./try`
5971                 case "$yyy" in
5972                 123.456)
5973                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
5974                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
5975                         echo "We will use %f."
5976                         ;;
5977                 esac
5978         fi
5979 fi
5980
5981 if $test X"$sPRIfldbl" = X; then
5982         $cat >try.c <<'EOCP'
5983 #include <sys/types.h>
5984 #include <stdio.h>
5985 int main() {
5986   long double d = 123.456;
5987   printf("%.3Lf\n", d);
5988 }
5989 EOCP
5990         set try
5991         if eval $compile; then
5992                 yyy=`$run ./try`
5993                 case "$yyy" in
5994                 123.456)
5995                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
5996                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
5997                         echo "We will use %Lf."
5998                         ;;
5999                 esac
6000         fi
6001 fi
6002
6003 if $test X"$sPRIfldbl" = X; then
6004         $cat >try.c <<'EOCP'
6005 #include <sys/types.h>
6006 #include <stdio.h>
6007 int main() {
6008   long double d = 123.456;
6009   printf("%.3llf\n", d);
6010 }
6011 EOCP
6012         set try
6013         if eval $compile; then
6014                 yyy=`$run ./try`
6015                 case "$yyy" in
6016                 123.456)
6017                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
6018                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
6019                         echo "We will use %llf."
6020                         ;;
6021                 esac
6022         fi
6023 fi
6024
6025 if $test X"$sPRIfldbl" = X; then
6026         $cat >try.c <<'EOCP'
6027 #include <sys/types.h>
6028 #include <stdio.h>
6029 int main() {
6030   long double d = 123.456;
6031   printf("%.3lf\n", d);
6032 }
6033 EOCP
6034         set try
6035         if eval $compile; then
6036                 yyy=`$run ./try`
6037                 case "$yyy" in
6038                 123.456)
6039                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
6040                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
6041                         echo "We will use %lf."
6042                         ;;
6043                 esac
6044         fi
6045 fi
6046
6047 if $test X"$sPRIfldbl" = X; then
6048         echo "Cannot figure out how to print long doubles." >&4
6049 else
6050         sSCNfldbl=$sPRIfldbl    # expect consistency
6051 fi
6052
6053 $rm -f try try.*
6054
6055 fi # d_longdbl
6056
6057 case "$sPRIfldbl" in
6058 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
6059         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
6060         d_SCNfldbl="$undef";
6061         ;;
6062 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
6063         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
6064         d_SCNfldbl="$define";
6065         ;;
6066 esac
6067
6068 : see if modfl exists
6069 set modfl d_modfl
6070 eval $inlibc
6071
6072 : see if prototype for modfl is available
6073 echo " "
6074 set d_modflproto modfl math.h
6075 eval $hasproto
6076
6077 d_modfl_pow32_bug="$undef"
6078
6079 case "$d_longdbl$d_modfl" in
6080 $define$define)
6081         $cat <<EOM
6082 Checking to see whether your modfl() is okay for large values...
6083 EOM
6084 $cat >try.c <<EOCP
6085 #include <math.h> 
6086 #include <stdio.h>
6087 EOCP
6088 if $test "X$d_modflproto" != "X$define"; then
6089         $cat >>try.c <<EOCP
6090 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
6091 long double modfl (long double, long double *);
6092 EOCP
6093 fi
6094 $cat >>try.c <<EOCP
6095 int main() {
6096     long double nv = 4294967303.15;
6097     long double v, w;
6098     v = modfl(nv, &w);         
6099 #ifdef __GLIBC__
6100     printf("glibc");
6101 #endif
6102     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
6103     return 0;
6104 }
6105 EOCP
6106         case "$osname:$gccversion" in
6107         aix:)   saveccflags="$ccflags"
6108                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
6109         esac
6110         set try
6111         if eval $compile; then
6112                 foo=`$run ./try`
6113                 case "$foo" in
6114                 *" 4294967303.150000 1.150000 4294967302.000000")
6115                         echo >&4 "Your modfl() is broken for large values."
6116                         d_modfl_pow32_bug="$define"
6117                         case "$foo" in
6118                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
6119                         ;;
6120                         esac
6121                         ;;
6122                 *" 4294967303.150000 0.150000 4294967303.000000")
6123                         echo >&4 "Your modfl() seems okay for large values."
6124                         ;;
6125                 *)      echo >&4 "I don't understand your modfl() at all."
6126                         d_modfl="$undef"
6127                         ;;
6128                 esac
6129                 $rm -f try.* try core core.try.*
6130         else
6131                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
6132                 d_modfl="$undef"
6133         fi
6134         case "$osname:$gccversion" in
6135         aix:)   ccflags="$saveccflags" ;; # restore
6136         esac
6137         ;;
6138 esac
6139
6140 case "$ccflags" in
6141 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6142 esac
6143
6144 case "$uselongdouble" in
6145 $define|true|[yY]*)     dflt='y';;
6146 *) dflt='n';;
6147 esac
6148 cat <<EOM
6149
6150 Perl can be built to take advantage of long doubles which
6151 (if available) may give more accuracy and range for floating point numbers.
6152
6153 If this doesn't make any sense to you, just accept the default '$dflt'.
6154 EOM
6155 rp='Try to use long doubles if available?'
6156 . ./myread
6157 case "$ans" in
6158 y|Y)    val="$define"   ;;
6159 *)      val="$undef"    ;;
6160 esac
6161 set uselongdouble
6162 eval $setvar
6163
6164 case "$uselongdouble" in
6165 true|[yY]*) uselongdouble="$define" ;;
6166 esac
6167
6168 case "$uselongdouble" in
6169 $define)
6170 : Look for a hint-file generated 'call-back-unit'.  If the
6171 : user has specified that long doubles should be used,
6172 : we may need to set or change some other defaults.
6173         if $test -f uselongdouble.cbu; then
6174                 echo "Your platform has some specific hints for long doubles, using them..."
6175                 . ./uselongdouble.cbu
6176         else
6177                 $cat <<EOM
6178 (Your platform doesn't have any specific hints for long doubles.)
6179 EOM
6180         fi
6181         ;;
6182 esac
6183
6184 message=X
6185 case "$uselongdouble:$d_sqrtl:$d_modfl" in
6186 $define:$define:$define)
6187         : You have both
6188         ;;
6189 $define:$define:$undef)
6190         message="I could not find modfl"
6191         ;;
6192 $define:$undef:$define)
6193         message="I could not find sqrtl"
6194         ;;
6195 $define:$undef:$undef)
6196         message="I found neither sqrtl nor modfl"
6197         ;;
6198 esac
6199
6200 if $test "$message" != X; then
6201         $cat <<EOM >&4
6202
6203 *** You requested the use of long doubles but you do not seem to have
6204 *** the mathematic functions for long doubles.
6205 *** ($message)
6206 *** I'm disabling the use of long doubles.
6207
6208 EOM
6209
6210         uselongdouble=$undef
6211 fi
6212
6213 : determine the architecture name
6214 echo " "
6215 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6216         tarch=`arch`"-$osname"
6217 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6218         if uname -m > tmparch 2>&1 ; then
6219                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6220                         -e 's/$/'"-$osname/" tmparch`
6221         else
6222                 tarch="$osname"
6223         fi
6224         $rm -f tmparch
6225 else
6226         tarch="$osname"
6227 fi
6228 case "$myarchname" in
6229 ''|"$tarch") ;;
6230 *)
6231         echo "(Your architecture name used to be $myarchname.)"
6232         archname=''
6233         ;;
6234 esac
6235 case "$targetarch" in
6236 '') ;;
6237 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6238 esac
6239 myarchname="$tarch"
6240 case "$archname" in
6241 '') dflt="$tarch";;
6242 *) dflt="$archname";;
6243 esac
6244 rp='What is your architecture name'
6245 . ./myread
6246 archname="$ans"
6247 case "$usethreads" in
6248 $define)
6249         echo "Threads selected." >&4
6250         case "$archname" in
6251         *-thread*) echo "...and architecture name already has -thread." >&4
6252                 ;;
6253         *)      archname="$archname-thread"
6254                 echo "...setting architecture name to $archname." >&4
6255                 ;;
6256         esac
6257         ;;
6258 esac
6259 case "$usemultiplicity" in
6260 $define)
6261         echo "Multiplicity selected." >&4
6262         case "$archname" in
6263         *-multi*) echo "...and architecture name already has -multi." >&4
6264                 ;;
6265         *)      archname="$archname-multi"
6266                 echo "...setting architecture name to $archname." >&4
6267                 ;;
6268         esac
6269         ;;
6270 esac
6271 case "$use64bitint$use64bitall" in
6272 *"$define"*)
6273         case "$archname64" in
6274         '')
6275                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6276                 ;;
6277         *)
6278                 case "$use64bitint" in
6279                 "$define") echo "64 bit integers selected." >&4 ;;
6280                 esac
6281                 case "$use64bitall" in
6282                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6283                 esac
6284                 case "$archname" in
6285                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6286                         ;;
6287                 *)      archname="$archname-$archname64"
6288                         echo "...setting architecture name to $archname." >&4
6289                         ;;
6290                 esac
6291                 ;;
6292         esac
6293 esac
6294 case "$uselongdouble" in
6295 $define)
6296         echo "Long doubles selected." >&4
6297         case "$longdblsize" in
6298         $doublesize)
6299                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6300                 ;;
6301         *)
6302                 case "$archname" in
6303                 *-ld*) echo "...and architecture name already has -ld." >&4
6304                         ;;
6305                 *)      archname="$archname-ld"
6306                         echo "...setting architecture name to $archname." >&4
6307                         ;;
6308                 esac
6309                 ;;
6310         esac
6311         ;;
6312 esac
6313 case "$useperlio" in
6314 $define)
6315         echo "Perlio selected." >&4
6316         ;;
6317 *)
6318         echo "Perlio not selected, using stdio." >&4
6319         case "$archname" in
6320         *-stdio*) echo "...and architecture name already has -stdio." >&4
6321                 ;;
6322         *)      archname="$archname-stdio"
6323                 echo "...setting architecture name to $archname." >&4
6324                 ;;
6325         esac
6326         ;;
6327 esac
6328
6329 : determine root of directory hierarchy where package will be installed.
6330 case "$prefix" in
6331 '')
6332         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
6333         ;;
6334 *?/)
6335         dflt=`echo "$prefix" | sed 's/.$//'`
6336         ;;
6337 *)
6338         dflt="$prefix"
6339         ;;
6340 esac
6341 $cat <<EOM
6342
6343 By default, $package will be installed in $dflt/bin, manual pages
6344 under $dflt/man, etc..., i.e. with $dflt as prefix for all
6345 installation directories. Typically this is something like /usr/local.
6346 If you wish to have binaries under /usr/bin but other parts of the
6347 installation under /usr/local, that's ok: you will be prompted
6348 separately for each of the installation directories, the prefix being
6349 only used to set the defaults.
6350
6351 EOM
6352 fn=d~
6353 rp='Installation prefix to use?'
6354 . ./getfile
6355 oldprefix=''
6356 case "$prefix" in
6357 '') ;;
6358 *)
6359         case "$ans" in
6360         "$prefix") ;;
6361         *) oldprefix="$prefix";;
6362         esac
6363         ;;
6364 esac
6365 prefix="$ans"
6366 prefixexp="$ansexp"
6367
6368 case "$afsroot" in
6369 '')     afsroot=/afs ;;
6370 *)      afsroot=$afsroot ;;
6371 esac
6372
6373 : is AFS running?
6374 echo " "
6375 case "$afs" in
6376 $define|true)   afs=true ;;
6377 $undef|false)   afs=false ;;
6378 *)      if test -d $afsroot; then
6379                 afs=true
6380         else
6381                 afs=false
6382         fi
6383         ;;
6384 esac
6385 if $afs; then
6386         echo "AFS may be running... I'll be extra cautious then..." >&4
6387 else
6388         echo "AFS does not seem to be running..." >&4
6389 fi
6390
6391 : determine installation prefix for where package is to be installed.
6392 if $afs; then 
6393 $cat <<EOM
6394
6395 Since you are running AFS, I need to distinguish the directory in which
6396 files will reside from the directory in which they are installed (and from
6397 which they are presumably copied to the former directory by occult means).
6398
6399 EOM
6400         case "$installprefix" in
6401         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6402         *) dflt="$installprefix";;
6403         esac
6404 else
6405 $cat <<EOM
6406
6407 In some special cases, particularly when building $package for distribution,
6408 it is convenient to distinguish between the directory in which files should 
6409 be installed from the directory ($prefix) in which they 
6410 will eventually reside.  For most users, these two directories are the same.
6411
6412 EOM
6413         case "$installprefix" in
6414         '') dflt=$prefix ;;
6415         *) dflt=$installprefix;;
6416         esac
6417 fi
6418 fn=d~
6419 rp='What installation prefix should I use for installing files?'
6420 . ./getfile
6421 installprefix="$ans"
6422 installprefixexp="$ansexp"
6423
6424 : set the prefixit variable, to compute a suitable default value
6425 prefixit='case "$3" in
6426 ""|none)
6427         case "$oldprefix" in
6428         "") eval "$1=\"\$$2\"";;
6429         *)
6430                 case "$3" in
6431                 "") eval "$1=";;
6432                 none)
6433                         eval "tp=\"\$$2\"";
6434                         case "$tp" in
6435                         ""|" ") eval "$1=\"\$$2\"";;
6436                         *) eval "$1=";;
6437                         esac;;
6438                 esac;;
6439         esac;;
6440 *)
6441         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6442         case "$tp" in
6443         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6444         /*-$oldprefix/*|\~*-$oldprefix/*)
6445                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6446         *) eval "$1=\"\$$2\"";;
6447         esac;;
6448 esac'
6449
6450 : get the patchlevel
6451 echo " "
6452 echo "Getting the current patchlevel..." >&4
6453 if $test -r $rsrc/patchlevel.h;then
6454         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6455         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6456         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6457         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6458         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6459         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6460        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6461 else
6462         revision=0
6463         patchlevel=0
6464         subversion=0
6465         api_revision=0
6466         api_version=0
6467         api_subversion=0
6468         perl_patchlevel=0
6469         $echo "(You do not have patchlevel.h.  Eek.)"
6470 fi
6471 if $test -r $rsrc/.patch ; then  
6472         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6473                 perl_patchlevel=`cat $rsrc/.patch`
6474         fi
6475 fi
6476 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
6477 version_patchlevel_string="version $patchlevel subversion $subversion"
6478 case "$perl_patchlevel" in
6479 0|'') ;;
6480 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
6481 esac
6482
6483 $echo "(You have $package $version_patchlevel_string.)"
6484
6485 case "$osname" in
6486 dos|vms)
6487         : XXX Should be a Configure test for double-dots in filenames.
6488         version=`echo $revision $patchlevel $subversion | \
6489                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6490         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6491                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6492         ;;
6493 *)
6494         version=`echo $revision $patchlevel $subversion | \
6495                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6496         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6497                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6498         ;;
6499 esac
6500 : Special case the 5.005_xx maintenance series, which used 5.005
6501 : without any subversion label as a subdirectory in $sitelib
6502 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6503         api_versionstring='5.005'
6504 fi
6505
6506 : determine installation style
6507 : For now, try to deduce it from prefix unless it is already set.
6508 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6509 case "$installstyle" in
6510 '')     case "$prefix" in
6511                 *perl*) dflt='lib';;
6512                 *) dflt='lib/perl5' ;;
6513         esac
6514         ;;
6515 *)      dflt="$installstyle" ;;
6516 esac
6517 : Probably not worth prompting for this since we prompt for all
6518 : the directories individually, and the prompt would be too long and
6519 : confusing anyway.
6520 installstyle=$dflt
6521
6522 : determine where private library files go
6523 : Usual default is /usr/local/lib/perl5/$version.
6524 : Also allow things like /opt/perl/lib/$version, since 
6525 : /opt/perl/lib/perl5... would be redundant.
6526 : The default "style" setting is made in installstyle.U
6527 case "$installstyle" in
6528 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6529 *)       set dflt privlib lib/$version ;;
6530 esac
6531 eval $prefixit
6532 $cat <<EOM
6533
6534 There are some auxiliary files for $package that need to be put into a
6535 private library directory that is accessible by everyone.
6536
6537 EOM
6538 fn=d~+
6539 rp='Pathname where the private library files will reside?'
6540 . ./getfile
6541 privlib="$ans"
6542 privlibexp="$ansexp"
6543 : Change installation prefix, if necessary.
6544 if $test X"$prefix" != X"$installprefix"; then
6545         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6546 else
6547         installprivlib="$privlibexp"
6548 fi
6549
6550 : set the prefixup variable, to restore leading tilda escape
6551 prefixup='case "$prefixexp" in
6552 "$prefix") ;;
6553 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6554 esac'
6555
6556 : determine where public architecture dependent libraries go
6557 set archlib archlib
6558 eval $prefixit
6559 : privlib default is /usr/local/lib/$package/$version
6560 : archlib default is /usr/local/lib/$package/$version/$archname
6561 : privlib may have an optional trailing /share.
6562 tdflt=`echo $privlib | $sed 's,/share$,,'`
6563 tdflt=$tdflt/$archname
6564 case "$archlib" in
6565 '')     dflt=$tdflt
6566         ;;
6567 *)      dflt="$archlib"
6568     ;;
6569 esac
6570 $cat <<EOM
6571
6572 $spackage contains architecture-dependent library files.  If you are
6573 sharing libraries in a heterogeneous environment, you might store
6574 these files in a separate location.  Otherwise, you can just include
6575 them with the rest of the public library files.
6576
6577 EOM
6578 fn=d+~
6579 rp='Where do you want to put the public architecture-dependent libraries?'
6580 . ./getfile
6581 archlib="$ans"
6582 archlibexp="$ansexp"
6583 if $test X"$archlib" = X"$privlib"; then
6584         d_archlib="$undef"
6585 else
6586         d_archlib="$define"
6587 fi
6588 : Change installation prefix, if necessary.
6589 if $test X"$prefix" != X"$installprefix"; then
6590         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6591 else
6592         installarchlib="$archlibexp"
6593 fi
6594
6595 : see if setuid scripts can be secure
6596 $cat <<EOM
6597
6598 Some kernels have a bug that prevents setuid #! scripts from being
6599 secure.  Some sites have disabled setuid #! scripts because of this.
6600
6601 First let's decide if your kernel supports secure setuid #! scripts.
6602 (If setuid #! scripts would be secure but have been disabled anyway,
6603 don't say that they are secure if asked.)
6604
6605 EOM
6606
6607 val="$undef"
6608 if $test -d /dev/fd; then
6609         echo "#!$ls" >reflect
6610         chmod +x,u+s reflect
6611         ./reflect >flect 2>&1
6612         if $contains "/dev/fd" flect >/dev/null; then
6613                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6614                 val="$define"
6615         else
6616                 $cat <<EOM
6617 If you are not sure if they are secure, I can check but I'll need a
6618 username and password different from the one you are using right now.
6619 If you don't have such a username or don't want me to test, simply
6620 enter 'none'.
6621
6622 EOM
6623                 rp='Other username to test security of setuid scripts with?'
6624                 dflt='none'
6625                 . ./myread
6626                 case "$ans" in
6627                 n|none)
6628                         case "$d_suidsafe" in
6629                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6630                                 dflt=n;;
6631                         "$undef")
6632                                 echo "Well, the $hint value is *not* secure." >&4
6633                                 dflt=n;;
6634                         *)      echo "Well, the $hint value *is* secure." >&4
6635                                 dflt=y;;
6636                         esac
6637                         ;;
6638                 *)
6639                         $rm -f reflect flect
6640                         echo "#!$ls" >reflect
6641                         chmod +x,u+s reflect
6642                         echo >flect
6643                         chmod a+w flect
6644                         echo '"su" will (probably) prompt you for '"$ans's password."
6645                         su $ans -c './reflect >flect'
6646                         if $contains "/dev/fd" flect >/dev/null; then
6647                                 echo "Okay, it looks like setuid scripts are secure." >&4
6648                                 dflt=y
6649                         else
6650                                 echo "I don't think setuid scripts are secure." >&4
6651                                 dflt=n
6652                         fi
6653                         ;;
6654                 esac
6655                 rp='Does your kernel have *secure* setuid scripts?'
6656                 . ./myread
6657                 case "$ans" in
6658                 [yY]*)  val="$define";;
6659                 *)      val="$undef";;
6660                 esac
6661         fi
6662 else
6663         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6664         echo "(That's for file descriptors, not floppy disks.)"
6665         val="$undef"
6666 fi
6667 set d_suidsafe
6668 eval $setvar
6669
6670 $rm -f reflect flect
6671
6672 : now see if they want to do setuid emulation
6673 echo " "
6674 val="$undef"
6675 case "$d_suidsafe" in
6676 "$define")
6677         val="$undef"
6678         echo "No need to emulate SUID scripts since they are secure here." >&4
6679         ;;
6680 *)
6681         $cat <<EOM
6682 Some systems have disabled setuid scripts, especially systems where
6683 setuid scripts cannot be secure.  On systems where setuid scripts have
6684 been disabled, the setuid/setgid bits on scripts are currently
6685 useless.  It is possible for $package to detect those bits and emulate
6686 setuid/setgid in a secure fashion.  This emulation will only work if
6687 setuid scripts have been disabled in your kernel.
6688
6689 EOM
6690         case "$d_dosuid" in
6691         "$define") dflt=y ;;
6692         *) dflt=n ;;
6693         esac
6694         rp="Do you want to do setuid/setgid emulation?"
6695         . ./myread
6696         case "$ans" in
6697         [yY]*)  val="$define";;
6698         *)      val="$undef";;
6699         esac
6700         ;;
6701 esac
6702 set d_dosuid
6703 eval $setvar
6704
6705 : see if this is a malloc.h system
6706 set malloc.h i_malloc
6707 eval $inhdr
6708
6709 : see if stdlib is available
6710 set stdlib.h i_stdlib
6711 eval $inhdr
6712
6713 : check for void type
6714 echo " "
6715 echo "Checking to see how well your C compiler groks the void type..." >&4
6716 case "$voidflags" in
6717 '')
6718         $cat >try.c <<'EOCP'
6719 #if TRY & 1
6720 void sub() {
6721 #else
6722 sub() {
6723 #endif
6724         extern void moo();      /* function returning void */
6725         void (*goo)();          /* ptr to func returning void */
6726 #if TRY & 8
6727         void *hue;              /* generic ptr */
6728 #endif
6729 #if TRY & 2
6730         void (*foo[10])();
6731 #endif
6732
6733 #if TRY & 4
6734         if(goo == moo) {
6735                 exit(0);
6736         }
6737 #endif
6738         exit(0);
6739 }
6740 int main() { sub(); }
6741 EOCP
6742         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6743                 voidflags=$defvoidused
6744         echo "Good.  It appears to support void to the level $package wants.">&4
6745                 if $contains warning .out >/dev/null 2>&1; then
6746                         echo "However, you might get some warnings that look like this:"
6747                         $cat .out
6748                 fi
6749         else
6750 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6751                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6752                         echo "It supports 1..."
6753                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6754                                 echo "It also supports 2..."
6755                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6756                                         voidflags=7
6757                                         echo "And it supports 4 but not 8 definitely."
6758                                 else
6759                                         echo "It doesn't support 4..."
6760                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6761                                                 voidflags=11
6762                                                 echo "But it supports 8."
6763                                         else
6764                                                 voidflags=3
6765                                                 echo "Neither does it support 8."
6766                                         fi
6767                                 fi
6768                         else
6769                                 echo "It does not support 2..."
6770                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6771                                         voidflags=13
6772                                         echo "But it supports 4 and 8."
6773                                 else
6774                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6775                                                 voidflags=5
6776                                                 echo "And it supports 4 but has not heard about 8."
6777                                         else
6778                                                 echo "However it supports 8 but not 4."
6779                                         fi
6780                                 fi
6781                         fi
6782                 else
6783                         echo "There is no support at all for void."
6784                         voidflags=0
6785                 fi
6786         fi
6787 esac
6788 case "$voidflags" in
6789 "$defvoidused") ;;
6790 *)      $cat >&4 <<'EOM'
6791   Support flag bits are:
6792     1: basic void declarations.
6793     2: arrays of pointers to functions returning void.
6794     4: operations between pointers to and addresses of void functions.
6795     8: generic void pointers.
6796 EOM
6797         dflt="$voidflags";
6798         rp="Your void support flags add up to what?"
6799         . ./myread
6800         voidflags="$ans"
6801         ;;
6802 esac
6803 $rm -f try.* .out
6804
6805 : check for length of pointer
6806 echo " "
6807 case "$ptrsize" in
6808 '')
6809         echo "Checking to see how big your pointers are..." >&4
6810         if test "$voidflags" -gt 7; then
6811                 echo '#define VOID_PTR char *' > try.c
6812         else
6813                 echo '#define VOID_PTR void *' > try.c
6814         fi
6815         $cat >>try.c <<'EOCP'
6816 #include <stdio.h>
6817 int main()
6818 {
6819     printf("%d\n", (int)sizeof(VOID_PTR));
6820     exit(0);
6821 }
6822 EOCP
6823         set try
6824         if eval $compile_ok; then
6825                 ptrsize=`$run ./try`
6826                 echo "Your pointers are $ptrsize bytes long."
6827         else
6828                 dflt='4'
6829                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6830                 rp="What is the size of a pointer (in bytes)?"
6831                 . ./myread
6832                 ptrsize="$ans"
6833         fi
6834         ;;
6835 esac
6836 $rm -f try.c try
6837 case "$use64bitall" in
6838 "$define"|true|[yY]*)
6839         case "$ptrsize" in
6840         4)      cat <<EOM >&4
6841
6842 *** You have chosen a maximally 64-bit build, but your pointers
6843 *** are only 4 bytes wide, disabling maximal 64-bitness.
6844
6845 EOM
6846                 use64bitall="$undef"
6847                 case "$use64bitint" in
6848                 "$define"|true|[yY]*) ;;
6849                 *)      cat <<EOM >&4
6850
6851 *** Downgrading from maximal 64-bitness to using 64-bit integers.
6852
6853 EOM
6854                         use64bitint="$define"
6855                         ;;
6856                 esac
6857                 ;;
6858         esac
6859         ;;
6860 esac
6861
6862
6863 : determine which malloc to compile in
6864 echo " "
6865 case "$usemymalloc" in
6866 [yY]*|true|$define)     dflt='y' ;;
6867 [nN]*|false|$undef)     dflt='n' ;;
6868 *)      case "$ptrsize" in
6869         4) dflt='y' ;;
6870         *) dflt='n' ;;
6871         esac
6872         ;;
6873 esac
6874 rp="Do you wish to attempt to use the malloc that comes with $package?"
6875 . ./myread
6876 usemymalloc="$ans"
6877 case "$ans" in
6878 y*|true)
6879         usemymalloc='y'
6880         mallocsrc='malloc.c'
6881         mallocobj="malloc$_o"
6882         d_mymalloc="$define"
6883         case "$libs" in
6884         *-lmalloc*)
6885                 : Remove malloc from list of libraries to use
6886                 echo "Removing unneeded -lmalloc from library list" >&4
6887                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6888                 shift
6889                 libs="$*"
6890                 echo "libs = $libs" >&4
6891                 ;;
6892         esac
6893         ;;
6894 *)
6895         usemymalloc='n'
6896         mallocsrc=''
6897         mallocobj=''
6898         d_mymalloc="$undef"
6899         ;;
6900 esac
6901
6902 : compute the return types of malloc and free
6903 echo " "
6904 $cat >malloc.c <<END
6905 #$i_malloc I_MALLOC
6906 #$i_stdlib I_STDLIB
6907 #include <stdio.h>
6908 #include <sys/types.h>
6909 #ifdef I_MALLOC
6910 #include <malloc.h>
6911 #endif
6912 #ifdef I_STDLIB
6913 #include <stdlib.h>
6914 #endif
6915 #ifdef TRY_MALLOC
6916 void *malloc();
6917 #endif
6918 #ifdef TRY_FREE
6919 void free();
6920 #endif
6921 END
6922 case "$malloctype" in
6923 '')
6924         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6925                 malloctype='void *'
6926         else
6927                 malloctype='char *'
6928         fi
6929         ;;
6930 esac
6931 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6932
6933 case "$freetype" in
6934 '')
6935         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6936                 freetype='void'
6937         else
6938                 freetype='int'
6939         fi
6940         ;;
6941 esac
6942 echo "Your system uses $freetype free(), it would seem." >&4
6943 $rm -f malloc.[co]
6944 $cat <<EOM
6945
6946 After $package is installed, you may wish to install various
6947 add-on modules and utilities.  Typically, these add-ons will
6948 be installed under $prefix with the rest
6949 of this package.  However, you may wish to install such add-ons
6950 elsewhere under a different prefix.
6951
6952 If you do not wish to put everything under a single prefix, that's
6953 ok.  You will be prompted for the individual locations; this siteprefix
6954 is only used to suggest the defaults.
6955
6956 The default should be fine for most people.
6957
6958 EOM
6959 fn=d~+
6960 rp='Installation prefix to use for add-on modules and utilities?'
6961 : XXX Here might be another good place for an installstyle setting.
6962 case "$siteprefix" in
6963 '') dflt=$prefix ;;
6964 *)  dflt=$siteprefix ;;
6965 esac
6966 . ./getfile
6967 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6968 oldsiteprefix=''
6969 case "$siteprefix" in
6970 '') ;;
6971 *)      case "$ans" in
6972         "$prefix") ;;
6973         *) oldsiteprefix="$prefix";;
6974         esac
6975         ;;
6976 esac
6977 siteprefix="$ans"
6978 siteprefixexp="$ansexp"
6979
6980 : determine where site specific libraries go.
6981 : Usual default is /usr/local/lib/perl5/site_perl/$version
6982 : The default "style" setting is made in installstyle.U
6983 : XXX No longer works with Prefixit stuff.
6984 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6985 case "$sitelib" in
6986 '') case "$installstyle" in
6987         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6988         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6989         esac
6990         ;;
6991 *)      dflt="$sitelib"
6992         ;;
6993 esac
6994 $cat <<EOM
6995
6996 The installation process will create a directory for
6997 site-specific extensions and modules.  Most users find it convenient
6998 to place all site-specific files in this directory rather than in the
6999 main distribution directory.
7000
7001 EOM
7002 fn=d~+
7003 rp='Pathname for the site-specific library files?'
7004 . ./getfile
7005 sitelib="$ans"
7006 sitelibexp="$ansexp"
7007 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7008 : Change installation prefix, if necessary.
7009 if $test X"$prefix" != X"$installprefix"; then
7010         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
7011 else
7012         installsitelib="$sitelibexp"
7013 fi
7014
7015 : determine where site specific architecture-dependent libraries go.
7016 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7017 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7018 : sitelib may have an optional trailing /share.
7019 case "$sitearch" in
7020 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7021         dflt="$dflt/$archname"
7022         ;;
7023 *)      dflt="$sitearch"
7024         ;;
7025 esac
7026 set sitearch sitearch none
7027 eval $prefixit
7028 $cat <<EOM
7029
7030 The installation process will also create a directory for
7031 architecture-dependent site-specific extensions and modules.
7032
7033 EOM
7034 fn=d~+
7035 rp='Pathname for the site-specific architecture-dependent library files?'
7036 . ./getfile
7037 sitearch="$ans"
7038 sitearchexp="$ansexp"
7039 : Change installation prefix, if necessary.
7040 if $test X"$prefix" != X"$installprefix"; then
7041         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
7042 else
7043         installsitearch="$sitearchexp"
7044 fi
7045
7046 $cat <<EOM
7047
7048 The installation process will also create a directory for
7049 vendor-supplied add-ons.  Vendors who supply perl with their system
7050 may find it convenient to place all vendor-supplied files in this
7051 directory rather than in the main distribution directory.  This will
7052 ease upgrades between binary-compatible maintenance versions of perl.
7053
7054 Of course you may also use these directories in whatever way you see
7055 fit.  For example, you might use them to access modules shared over a
7056 company-wide network.
7057
7058 The default answer should be fine for most people.
7059 This causes further questions about vendor add-ons to be skipped
7060 and no vendor-specific directories will be configured for perl.
7061
7062 EOM
7063 rp='Do you want to configure vendor-specific add-on directories?'
7064 case "$usevendorprefix" in
7065 define|true|[yY]*) dflt=y ;;
7066 *)      : User may have set vendorprefix directly on Configure command line.
7067         case "$vendorprefix" in
7068         ''|' ') dflt=n ;;
7069         *)      dflt=y ;;
7070         esac
7071         ;;
7072 esac
7073 . ./myread
7074 case "$ans" in
7075 [yY]*)  fn=d~+
7076         rp='Installation prefix to use for vendor-supplied add-ons?'
7077         case "$vendorprefix" in
7078         '') dflt='' ;;
7079         *)  dflt=$vendorprefix ;;
7080         esac
7081         . ./getfile
7082         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7083         oldvendorprefix=''
7084         case "$vendorprefix" in
7085         '') ;;
7086         *)      case "$ans" in
7087                 "$prefix") ;;
7088                 *) oldvendorprefix="$prefix";;
7089                 esac
7090                 ;;
7091         esac
7092         usevendorprefix="$define"
7093         vendorprefix="$ans"
7094         vendorprefixexp="$ansexp"
7095         ;;
7096 *)      usevendorprefix="$undef"
7097         vendorprefix=''
7098         vendorprefixexp=''
7099         ;;
7100 esac
7101
7102 case "$vendorprefix" in
7103 '')     d_vendorlib="$undef"
7104         vendorlib=''
7105         vendorlibexp=''
7106         ;;
7107 *)      d_vendorlib="$define"
7108         : determine where vendor-supplied modules go.
7109         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7110         case "$vendorlib" in
7111         '')
7112                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7113                 case "$installstyle" in
7114                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7115                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7116                 esac
7117                 ;;
7118         *)      dflt="$vendorlib"
7119                 ;;
7120         esac
7121         fn=d~+
7122         rp='Pathname for the vendor-supplied library files?'
7123         . ./getfile
7124         vendorlib="$ans"
7125         vendorlibexp="$ansexp"
7126         ;;
7127 esac
7128 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7129 : Change installation prefix, if necessary.
7130 if $test X"$prefix" != X"$installprefix"; then
7131         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
7132 else
7133         installvendorlib="$vendorlibexp"
7134 fi
7135
7136 case "$vendorprefix" in
7137 '')     d_vendorarch="$undef"
7138         vendorarch=''
7139         vendorarchexp=''
7140         ;;
7141 *)      d_vendorarch="$define"
7142         : determine where vendor-supplied architecture-dependent libraries go.
7143         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7144         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7145         : vendorlib may have an optional trailing /share.
7146         case "$vendorarch" in
7147         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7148                 dflt="$dflt/$archname"
7149                 ;;
7150         *)      dflt="$vendorarch" ;;
7151         esac
7152         fn=d~+
7153         rp='Pathname for vendor-supplied architecture-dependent files?'
7154         . ./getfile
7155         vendorarch="$ans"
7156         vendorarchexp="$ansexp"
7157         ;;
7158 esac
7159 : Change installation prefix, if necessary.
7160 if $test X"$prefix" != X"$installprefix"; then
7161         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
7162 else
7163         installvendorarch="$vendorarchexp"
7164 fi
7165
7166 : Final catch-all directories to search
7167 $cat <<EOM
7168
7169 Lastly, you can have perl look in other directories for extensions and
7170 modules in addition to those already specified.
7171 These directories will be searched after 
7172         $sitearch 
7173         $sitelib 
7174 EOM
7175 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7176 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7177 echo ' '
7178 case "$otherlibdirs" in
7179 ''|' ') dflt='none' ;;
7180 *)      dflt="$otherlibdirs" ;;
7181 esac
7182 $cat <<EOM
7183 Enter a colon-separated set of extra paths to include in perl's @INC
7184 search path, or enter 'none' for no extra paths.
7185
7186 EOM
7187
7188 rp='Colon-separated list of additional directories for perl to search?'
7189 . ./myread
7190 case "$ans" in
7191 ' '|''|none)    otherlibdirs=' ' ;;     
7192 *)      otherlibdirs="$ans" ;;
7193 esac
7194 case "$otherlibdirs" in
7195 ' ') val=$undef ;;
7196 *)      val=$define ;;
7197 esac
7198 set d_perl_otherlibdirs
7199 eval $setvar
7200
7201 : Cruising for prototypes
7202 echo " "
7203 echo "Checking out function prototypes..." >&4
7204 $cat >prototype.c <<'EOCP'
7205 int main(int argc, char *argv[]) {
7206         exit(0);}
7207 EOCP
7208 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7209         echo "Your C compiler appears to support function prototypes."
7210         val="$define"
7211 else
7212         echo "Your C compiler doesn't seem to understand function prototypes."
7213         val="$undef"
7214 fi
7215 set prototype
7216 eval $setvar
7217 $rm -f prototype*
7218
7219 case "$prototype" in
7220 "$define") ;;
7221 *)      ansi2knr='ansi2knr'
7222         echo " "
7223         cat <<EOM >&4
7224
7225 $me:  FATAL ERROR:
7226 This version of $package can only be compiled by a compiler that 
7227 understands function prototypes.  Unfortunately, your C compiler 
7228         $cc $ccflags
7229 doesn't seem to understand them.  Sorry about that.
7230
7231 If GNU cc is available for your system, perhaps you could try that instead.  
7232
7233 Eventually, we hope to support building Perl with pre-ANSI compilers.
7234 If you would like to help in that effort, please contact <perlbug@perl.org>.
7235
7236 Aborting Configure now.
7237 EOM
7238         exit 2
7239         ;;
7240 esac
7241
7242 : determine where public executables go
7243 echo " "
7244 set dflt bin bin
7245 eval $prefixit
7246 fn=d~
7247 rp='Pathname where the public executables will reside?'
7248 . ./getfile
7249 if $test "X$ansexp" != "X$binexp"; then
7250         installbin=''
7251 fi
7252 bin="$ans"
7253 binexp="$ansexp"
7254 : Change installation prefix, if necessary.
7255 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7256 if $test X"$prefix" != X"$installprefix"; then
7257         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
7258 else
7259         installbin="$binexp"
7260 fi
7261
7262 echo " "
7263 case "$extras" in
7264 '') dflt='n';;
7265 *) dflt='y';;
7266 esac
7267 cat <<EOM
7268 Perl can be built with extra modules or bundles of modules which
7269 will be fetched from the CPAN and installed alongside Perl.
7270
7271 Notice that you will need access to the CPAN; either via the Internet,
7272 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7273 be asked later to configure the CPAN.pm module which will in turn do
7274 the installation of the rest of the extra modules or bundles.)
7275
7276 Notice also that if the modules require any external software such as
7277 libraries and headers (the libz library and the zlib.h header for the
7278 Compress::Zlib module, for example) you MUST have any such software
7279 already installed, this configuration process will NOT install such
7280 things for you.
7281
7282 If this doesn't make any sense to you, just accept the default '$dflt'.
7283 EOM
7284 rp='Install any extra modules (y or n)?'
7285 . ./myread
7286 case "$ans" in
7287 y|Y)
7288         cat <<EOM
7289
7290 Please list any extra modules or bundles to be installed from CPAN,
7291 with spaces between the names.  The names can be in any format the
7292 'install' command of CPAN.pm will understand.  (Answer 'none',
7293 without the quotes, to install no extra modules or bundles.)
7294 EOM
7295         rp='Extras?'
7296         dflt="$extras"
7297         . ./myread
7298         extras="$ans"
7299 esac
7300 case "$extras" in
7301 ''|'none')
7302         val=''
7303         $rm -f ../extras.lst
7304         ;;
7305 *)      echo "(Saving the list of extras for later...)"
7306         echo "$extras" > ../extras.lst
7307         val="'$extras'"
7308         ;;
7309 esac
7310 set extras
7311 eval $setvar
7312 echo " "
7313
7314 : Find perl5.005 or later.
7315 echo "Looking for a previously installed perl5.005 or later... "
7316 case "$perl5" in
7317 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7318                 : Check if this perl is recent and can load a simple module
7319                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7320                         perl5=$tdir/perl
7321                         break;
7322                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7323                         perl5=$tdir/perl5
7324                         break;
7325                 fi
7326         done
7327         ;;
7328 *)      perl5="$perl5"
7329         ;;
7330 esac
7331 case "$perl5" in
7332 '')     echo "None found.  That's ok.";;
7333 *)      echo "Using $perl5." ;;
7334 esac
7335
7336 : Determine list of previous versions to include in @INC
7337 $cat > getverlist <<EOPL
7338 #!$perl5 -w
7339 use File::Basename;
7340 \$api_versionstring = "$api_versionstring";
7341 \$version = "$version";
7342 \$stem = "$sitelib_stem";
7343 \$archname = "$archname";
7344 EOPL
7345         $cat >> getverlist <<'EOPL'
7346 # Can't have leading @ because metaconfig interprets it as a command!
7347 ;@inc_version_list=();
7348 # XXX Redo to do opendir/readdir? 
7349 if (-d $stem) {
7350     chdir($stem);
7351     ;@candidates = glob("5.*");
7352 }
7353 else {
7354     ;@candidates = ();
7355 }
7356
7357 # XXX ToDo:  These comparisons must be reworked when two-digit
7358 # subversions come along, so that 5.7.10 compares as greater than
7359 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
7360 # widespread that we can use the built-in version vectors rather
7361 # than reinventing them here.  For 5.6.0, however, we must
7362 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
7363 foreach $d (@candidates) {
7364     if ($d lt $version) {
7365         if ($d ge $api_versionstring) {
7366             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
7367         }
7368         elsif ($d ge "5.005") {
7369             unshift(@inc_version_list, grep { -d } $d);
7370         }
7371     }
7372     else {
7373         # Skip newer version.  I.e. don't look in
7374         # 5.7.0 if we're installing 5.6.1.
7375     }
7376 }
7377
7378 if (@inc_version_list) {
7379     print join(' ', @inc_version_list);
7380 }
7381 else {
7382     # Blank space to preserve value for next Configure run.
7383     print " ";
7384 }
7385 EOPL
7386 chmod +x getverlist
7387 case "$inc_version_list" in
7388 '')     if test -x "$perl5$exe_ext"; then
7389                 dflt=`$perl5 getverlist`
7390         else
7391                 dflt='none'
7392         fi
7393         ;;
7394 $undef) dflt='none' ;;
7395 *)  eval dflt=\"$inc_version_list\" ;;
7396 esac
7397 case "$dflt" in
7398 ''|' ') dflt=none ;;
7399 esac
7400 case "$dflt" in
7401 5.005) dflt=none ;;
7402 esac
7403 $cat <<EOM
7404
7405 In order to ease the process of upgrading, this version of perl 
7406 can be configured to use modules built and installed with earlier 
7407 versions of perl that were installed under $prefix.  Specify here
7408 the list of earlier versions that this version of perl should check.
7409 If Configure detected no earlier versions of perl installed under
7410 $prefix, then the list will be empty.  Answer 'none' to tell perl
7411 to not search earlier versions.
7412
7413 The default should almost always be sensible, so if you're not sure,
7414 just accept the default.
7415 EOM
7416
7417 rp='List of earlier versions to include in @INC?'
7418 . ./myread
7419 case "$ans" in
7420 [Nn]one|''|' ') inc_version_list=' ' ;;
7421 *) inc_version_list="$ans" ;;
7422 esac
7423 case "$inc_version_list" in
7424 ''|' ') 
7425         inc_version_list_init='0';;
7426 *)      inc_version_list_init=`echo $inc_version_list |
7427                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7428         ;;
7429 esac
7430 $rm -f getverlist
7431
7432 : determine whether to install perl also as /usr/bin/perl
7433
7434 echo " "
7435 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7436         $cat <<EOM
7437 Many scripts expect perl to be installed as /usr/bin/perl.
7438
7439 If you want to, I can install the perl you are about to compile
7440 as /usr/bin/perl (in addition to $bin/perl).
7441 EOM
7442         if test -f /usr/bin/perl; then
7443             $cat <<EOM
7444
7445 However, please note that because you already have a /usr/bin/perl,
7446 overwriting that with a new Perl would very probably cause problems.
7447 Therefore I'm assuming you don't want to do that (unless you insist).
7448
7449 EOM
7450             case "$installusrbinperl" in
7451             "$define"|[yY]*)    dflt='y';;
7452             *)                  dflt='n';;
7453             esac
7454         else
7455             $cat <<EOM
7456
7457 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7458
7459 EOM
7460             case "$installusrbinperl" in
7461             "$undef"|[nN]*)     dflt='n';;
7462             *)                  dflt='y';;
7463             esac
7464         fi
7465         rp="Do you want to install perl as /usr/bin/perl?"
7466         . ./myread
7467         case "$ans" in
7468         [yY]*)  val="$define";;
7469         *)      val="$undef" ;;
7470         esac
7471 else
7472         val="$undef"
7473 fi
7474 set installusrbinperl
7475 eval $setvar
7476
7477 : see if dld is available
7478 set dld.h i_dld
7479 eval $inhdr
7480
7481 : see if dlopen exists
7482 xxx_runnm="$runnm"
7483 runnm=false
7484 set dlopen d_dlopen
7485 eval $inlibc
7486 runnm="$xxx_runnm"
7487
7488 : determine which dynamic loading, if any, to compile in
7489 echo " "
7490 dldir="ext/DynaLoader"
7491 case "$usedl" in
7492 $define|y|true)
7493         dflt='y'
7494         usedl="$define"
7495         ;;
7496 $undef|n|false)
7497         dflt='n'
7498         usedl="$undef"
7499         ;;
7500 *) 
7501         dflt='n'
7502         case "$d_dlopen" in
7503             $define) dflt='y' ;;
7504         esac
7505         case "$i_dld" in
7506             $define) dflt='y' ;;
7507         esac
7508         : Does a dl_xxx.xs file exist for this operating system
7509         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7510         ;;
7511 esac
7512 rp="Do you wish to use dynamic loading?"
7513 . ./myread
7514 usedl="$ans"
7515 case "$ans" in
7516 y*) usedl="$define"
7517         case "$dlsrc" in
7518         '')
7519                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7520                         dflt="$dldir/dl_${osname}.xs"
7521                 elif $test "$d_dlopen" = "$define" ; then
7522                         dflt="$dldir/dl_dlopen.xs"
7523                 elif $test "$i_dld" = "$define" ; then
7524                         dflt="$dldir/dl_dld.xs"
7525                 else
7526                         dflt=''
7527                 fi
7528                 ;;
7529         *)      dflt="$dldir/$dlsrc"
7530                 ;;
7531         esac
7532     echo "The following dynamic loading files are available:"
7533         : Can not go over to $dldir because getfile has path hard-coded in.
7534         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7535         rp="Source file to use for dynamic loading"
7536         fn="fne"
7537         gfpth="$src"
7538         . ./getfile
7539         usedl="$define"
7540         : emulate basename
7541         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7542
7543         $cat << EOM
7544
7545 Some systems may require passing special flags to $cc -c to
7546 compile modules that will be used to create a shared library.
7547 To use no flags, say "none".
7548
7549 EOM
7550     case "$cccdlflags" in
7551     '') case "$gccversion" in
7552                 '') case "$osname" in
7553                         hpux)   dflt='+z' ;;
7554                         next)   dflt='none' ;;
7555                         irix*)  dflt='-KPIC' ;;
7556                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7557                         sunos)  dflt='-pic' ;;
7558                         *)      dflt='none' ;;
7559                     esac
7560                         ;;
7561                 *)  case "$osname" in
7562                         darwin) dflt='none' ;;
7563                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7564                         *)      dflt='-fpic' ;;
7565                     esac ;;
7566             esac ;;
7567         ' ') dflt='none' ;;
7568     *)  dflt="$cccdlflags" ;;
7569     esac
7570     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7571     . ./myread
7572     case "$ans" in
7573     none) cccdlflags=' ' ;;
7574     *) cccdlflags="$ans" ;;
7575     esac
7576
7577     cat << EOM
7578
7579 Some systems use ld to create libraries that can be dynamically loaded,
7580 while other systems (such as those using ELF) use $cc.
7581
7582 EOM
7583         case "$ld" in
7584         '')     $cat >try.c <<'EOM'
7585 /* Test for whether ELF binaries are produced */
7586 #include <fcntl.h>
7587 #include <stdlib.h>
7588 int main() {
7589         char b[4];
7590         int i = open("a.out",O_RDONLY);
7591         if(i == -1) 
7592                 exit(1); /* fail */
7593         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7594                 exit(0); /* succeed (yes, it's ELF) */
7595         else
7596                 exit(1); /* fail */
7597 }
7598 EOM
7599                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7600                         cat <<EOM
7601 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7602 EOM
7603                         dflt="$cc"
7604                 else
7605                         echo "I'll use ld to build dynamic libraries."
7606                         dflt='ld'
7607                 fi
7608                 rm -f try.c a.out
7609                 ;;
7610         *)      dflt="$ld"
7611                 ;;
7612         esac
7613
7614     rp="What command should be used to create dynamic libraries?"
7615     . ./myread
7616         ld="$ans"
7617
7618     cat << EOM
7619
7620 Some systems may require passing special flags to $ld to create a
7621 library that can be dynamically loaded.  If your ld flags include
7622 -L/other/path options to locate libraries outside your loader's normal
7623 search path, you may need to specify those -L options here as well.  To
7624 use no flags, say "none".
7625
7626 EOM
7627     case "$lddlflags" in
7628     '') case "$osname" in
7629                         beos) dflt='-nostart' ;;
7630                         hpux) dflt='-b';
7631                               case "$gccversion" in
7632                               '') dflt="$dflt +vnocompatwarnings" ;;
7633                               esac
7634                               ;;        
7635                         linux|irix*)    dflt='-shared' ;;
7636                         next)  dflt='none' ;;
7637                         solaris) dflt='-G' ;;
7638                         sunos) dflt='-assert nodefinitions' ;;
7639                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7640                 *)     dflt='none' ;;
7641                         esac
7642                         ;;
7643     *) dflt="$lddlflags" ;;
7644     esac
7645
7646         : Try to guess additional flags to pick up local libraries.
7647         : Be careful not to append to a plain 'none'
7648         case "$dflt" in
7649         none) dflt='' ;;
7650         esac
7651         for thisflag in $ldflags; do
7652                 case "$thisflag" in
7653                 -L*|-R*|-Wl,-R*)
7654                         case " $dflt " in
7655                         *" $thisflag "*) ;;
7656                         *) dflt="$dflt $thisflag" ;;
7657                         esac
7658                         ;;
7659                 esac
7660         done
7661
7662         case "$dflt" in
7663         ''|' ') dflt='none' ;;
7664         esac
7665
7666     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7667     . ./myread
7668     case "$ans" in
7669     none) lddlflags=' ' ;;
7670     *) lddlflags="$ans" ;;
7671     esac
7672
7673         cat <<EOM
7674
7675 Some systems may require passing special flags to $cc to indicate that
7676 the resulting executable will use dynamic linking.  To use no flags,
7677 say "none".
7678
7679 EOM
7680     case "$ccdlflags" in
7681     '') case "$osname" in
7682                 hpux)   dflt='-Wl,-E' ;;
7683                 linux)  dflt='-rdynamic' ;;
7684                 next)   dflt='none' ;;
7685                 sunos)  dflt='none' ;;
7686                 *)      dflt='none' ;;
7687             esac ;;
7688     ' ')  dflt='none' ;;
7689     *)  dflt="$ccdlflags" ;;
7690     esac
7691     rp="Any special flags to pass to $cc to use dynamic linking?"
7692     . ./myread
7693     case "$ans" in
7694     none) ccdlflags=' ' ;;
7695     *) ccdlflags="$ans" ;;
7696     esac
7697     ;;
7698 *)  usedl="$undef"
7699         ld='ld'
7700     dlsrc='dl_none.xs'
7701     lddlflags=''
7702     ccdlflags=''
7703     ;;
7704 esac
7705
7706 also=''
7707 case "$usedl" in
7708 $undef)
7709         # No dynamic loading being used, so don't bother even to prompt.
7710         useshrplib='false'
7711         ;;
7712 *)      case "$useshrplib" in
7713         '')     case "$osname" in
7714                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7715                         dflt=y
7716                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7717                         ;;
7718                 next*)
7719                         case "$osvers" in
7720                         4*)     dflt=y
7721                                 also='Building a shared libperl is needed for MAB support.'
7722                                 ;;
7723                         *)      dflt=n
7724                                 ;;
7725                         esac
7726                         ;;
7727                 *)      dflt=n
7728                         ;;
7729                 esac
7730                 ;;
7731         $define|true|[Yy]*)
7732                 dflt=y
7733                 ;;
7734         *)      dflt=n
7735                 ;;
7736         esac
7737         $cat << EOM
7738
7739 The perl executable is normally obtained by linking perlmain.c with
7740 libperl${_a}, any static extensions (usually just DynaLoader), and
7741 any other libraries needed on this system (such as -lm, etc.).  Since
7742 your system supports dynamic loading, it is probably possible to build
7743 a shared libperl.$so.  If you will have more than one executable linked
7744 to libperl.$so, this will significantly reduce the size of each
7745 executable, but it may have a noticeable affect on performance.  The
7746 default is probably sensible for your system.
7747 $also
7748
7749 EOM
7750         rp="Build a shared libperl.$so (y/n)"
7751         . ./myread
7752         case "$ans" in
7753         true|$define|[Yy]*)
7754                 useshrplib='true'  ;;
7755         *)      useshrplib='false' ;;
7756         esac
7757         ;;
7758 esac
7759
7760 case "$useshrplib" in
7761 true)
7762         case "$libperl" in
7763         '')
7764                 # Figure out a good name for libperl.so.  Since it gets stored in
7765                 # a version-specific architecture-dependent library, the version
7766                 # number isn't really that important, except for making cc/ld happy.
7767                 #
7768                 # A name such as libperl.so.3.1
7769                 majmin="libperl.$so.$patchlevel.$subversion"
7770                 # A name such as libperl.so.301
7771                 majonly=`echo $patchlevel $subversion |
7772                         $awk '{printf "%d%02d", $1, $2}'`
7773                 majonly=libperl.$so.$majonly
7774                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7775                 # rely on figuring it out from the naming of libc.
7776                 case "${osname}${osvers}" in
7777                 next4*)
7778                         dflt=libperl.5.$so
7779                         # XXX How handle the --version stuff for MAB?
7780                         ;;
7781                 linux*)  # ld won't link with a bare -lperl otherwise.
7782                         dflt=libperl.$so
7783                         ;;
7784                 cygwin*) # ld links against an importlib
7785                         dflt=libperl$lib_ext
7786                         ;;
7787                 *)      # Try to guess based on whether libc has major.minor.
7788                         case "$libc" in
7789                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7790                         *libc.$so.[0-9]*) dflt=$majonly ;;
7791                         *)      dflt=libperl.$so ;;
7792                         esac
7793                         ;;
7794                 esac
7795                 ;;
7796         *)      dflt=$libperl
7797                 ;;
7798         esac
7799         cat << EOM
7800
7801 I need to select a good name for the shared libperl.  If your system uses
7802 library names with major and minor numbers, then you might want something
7803 like $majmin.  Alternatively, if your system uses a single version
7804 number for shared libraries, then you might want to use $majonly.
7805 Or, your system might be quite happy with a simple libperl.$so.
7806
7807 Since the shared libperl will get installed into a version-specific
7808 architecture-dependent directory, the version number of the shared perl
7809 library probably isn't important, so the default should be o.k.
7810
7811 EOM
7812         rp='What name do you want to give to the shared libperl?'
7813         . ./myread
7814         libperl=$ans
7815         echo "Ok, I'll use $libperl"
7816         ;;
7817 *)
7818         libperl="libperl${_a}"
7819         ;;
7820 esac
7821
7822 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7823 case "$shrpdir" in
7824 '') ;;
7825 *)      $cat >&4 <<EOM
7826 WARNING:  Use of the shrpdir variable for the installation location of
7827 the shared $libperl is not supported.  It was never documented and
7828 will not work in this version.  Let me (perlbug@perl.org)
7829 know of any problems this may cause.
7830
7831 EOM
7832         case "$shrpdir" in
7833         "$archlibexp/CORE")
7834                 $cat >&4 <<EOM
7835 But your current setting of $shrpdir is
7836 the default anyway, so it's harmless.
7837 EOM
7838                 ;;
7839         *)
7840                 $cat >&4 <<EOM
7841 Further, your current attempted setting of $shrpdir
7842 conflicts with the value of $archlibexp/CORE
7843 that installperl will use.
7844 EOM
7845                 ;;
7846         esac
7847         ;;
7848 esac
7849
7850 # How will the perl executable find the installed shared $libperl?
7851 # Add $xxx to ccdlflags.
7852 # If we can't figure out a command-line option, use $shrpenv to
7853 # set env LD_RUN_PATH.  The main perl makefile uses this.
7854 shrpdir=$archlibexp/CORE
7855 xxx=''
7856 tmp_shrpenv=''
7857 if "$useshrplib"; then
7858     case "$osname" in 
7859         aix)
7860                 # We'll set it in Makefile.SH...
7861                 ;;
7862         solaris)
7863                 xxx="-R $shrpdir"
7864                 ;;
7865         freebsd|netbsd)
7866                 xxx="-Wl,-R$shrpdir"
7867                 ;;
7868         bsdos|linux|irix*|dec_osf)
7869                 xxx="-Wl,-rpath,$shrpdir"
7870                 ;;
7871         next)
7872                 # next doesn't like the default...
7873                 ;;
7874         beos)
7875                 # beos doesn't like the default, either.
7876                 ;;
7877         hpux*)
7878                 # hpux doesn't like the default, either.
7879                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7880                 ;;
7881         *)
7882                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7883                 ;;
7884         esac
7885         case "$xxx" in
7886         '') ;;
7887         *)      
7888                 # Only add $xxx if it isn't already in ccdlflags.
7889                 case " $ccdlflags " in
7890                 *" $xxx "*)     ;;
7891                 *)      ccdlflags="$ccdlflags $xxx"
7892                         cat <<EOM >&4
7893
7894 Adding $xxx to the flags
7895 passed to $ld so that the perl executable will find the 
7896 installed shared $libperl.
7897
7898 EOM
7899                         ;;
7900                 esac
7901                 ;;
7902         esac
7903 fi
7904 # Fix ccdlflags in AIX for building external extensions.
7905 # (For building Perl itself bare -bE:perl.exp is needed,
7906 #  Makefile.SH takes care of this.)
7907 case "$osname" in
7908 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7909 esac
7910 # Respect a hint or command-line value.
7911 case "$shrpenv" in
7912 '') shrpenv="$tmp_shrpenv" ;;
7913 esac
7914 case "$ldlibpthname" in
7915 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7916 none)   ldlibpthname='' ;;
7917 esac
7918
7919 : determine where manual pages are on this system
7920 echo " "
7921 case "$sysman" in
7922 '') 
7923         syspath='/usr/share/man/man1 /usr/man/man1'
7924         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7925         syspath="$syspath /usr/man/u_man/man1"
7926         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7927         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7928         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7929         sysman=`./loc . /usr/man/man1 $syspath`
7930         ;;
7931 esac
7932 if $test -d "$sysman"; then
7933         echo "System manual is in $sysman." >&4
7934 else
7935         echo "Could not find manual pages in source form." >&4
7936 fi
7937
7938 : determine where manual pages go
7939 set man1dir man1dir none
7940 eval $prefixit
7941 $cat <<EOM
7942
7943 $spackage has manual pages available in source form.
7944 EOM
7945 case "$nroff" in
7946 nroff)
7947         echo "However, you don't have nroff, so they're probably useless to you."
7948         case "$man1dir" in
7949         '') man1dir="none";;
7950         esac;;
7951 esac
7952 echo "If you don't want the manual sources installed, answer 'none'."
7953 case "$man1dir" in
7954 ' ') dflt=none
7955         ;;
7956 '')
7957         lookpath="$prefixexp/share/man/man1"
7958         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7959         lookpath="$lookpath $prefixexp/man/p_man/man1"
7960         lookpath="$lookpath $prefixexp/man/u_man/man1"
7961         lookpath="$lookpath $prefixexp/man/man.1"
7962         case "$sysman" in
7963         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7964         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7965         esac
7966         set dflt
7967         eval $prefixup
7968         ;;
7969 *)  dflt="$man1dir"
7970         ;;
7971 esac
7972 echo " "
7973 fn=dn+~
7974 rp="Where do the main $spackage manual pages (source) go?"
7975 . ./getfile
7976 if $test "X$man1direxp" != "X$ansexp"; then
7977         installman1dir=''
7978 fi
7979 man1dir="$ans"
7980 man1direxp="$ansexp"
7981 case "$man1dir" in
7982 '')     man1dir=' '
7983         installman1dir='';;
7984 esac
7985
7986 : Change installation prefix, if necessary.
7987 if $test X"$prefix" != X"$installprefix"; then
7988         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7989 else
7990         installman1dir="$man1direxp"
7991 fi
7992
7993 : What suffix to use on installed man pages
7994
7995 case "$man1dir" in
7996 ' ')
7997         man1ext='0'
7998         ;;
7999 *)
8000         rp="What suffix should be used for the main $spackage man pages?"
8001         case "$man1ext" in
8002         '')     case "$man1dir" in
8003                 *1)  dflt=1 ;;
8004                 *1p) dflt=1p ;;
8005                 *1pm) dflt=1pm ;;
8006                 *l) dflt=l;;
8007                 *n) dflt=n;;
8008                 *o) dflt=o;;
8009                 *p) dflt=p;;
8010                 *C) dflt=C;;
8011                 *L) dflt=L;;
8012                 *L1) dflt=L1;;
8013                 *) dflt=1;;
8014                 esac
8015                 ;;
8016         *)      dflt="$man1ext";;
8017         esac
8018         . ./myread
8019         man1ext="$ans"
8020         ;;
8021 esac
8022
8023 : see if we can have long filenames
8024 echo " "
8025 first=123456789abcdef
8026 $rm -f $first
8027 if (echo hi >$first) 2>/dev/null; then
8028         if $test -f 123456789abcde; then
8029                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8030                 val="$undef"
8031         else
8032                 echo 'You can have filenames longer than 14 characters.'>&4
8033                 val="$define"
8034         fi
8035 else
8036         $cat <<'EOM'
8037 You can't have filenames longer than 14 chars.
8038 You can't even think about them!
8039 EOM
8040         val="$undef"
8041 fi 
8042 set d_flexfnam
8043 eval $setvar
8044 $rm -rf 123456789abcde*
8045
8046 : determine where library module manual pages go
8047 set man3dir man3dir none
8048 eval $prefixit
8049 $cat <<EOM
8050
8051 $spackage has manual pages for many of the library modules.
8052 EOM
8053
8054 case "$nroff" in
8055 nroff)
8056         $cat <<'EOM'
8057 However, you don't have nroff, so they're probably useless to you.
8058 EOM
8059         case "$man3dir" in
8060         '') man3dir="none";;
8061         esac;;
8062 esac
8063
8064 case "$d_flexfnam" in
8065 undef)
8066         $cat <<'EOM'
8067 However, your system can't handle the long file names like File::Basename.3. 
8068 EOM
8069         case "$man3dir" in
8070         '') man3dir="none";;
8071         esac;;
8072 esac
8073
8074 echo "If you don't want the manual sources installed, answer 'none'."
8075 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8076 case "$man3dir" in
8077 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8078         if $test -d "$privlib/man/man3"; then
8079                 cat <<EOM >&4
8080
8081 WARNING:  Previous versions of perl installed man3 pages into
8082 $privlib/man/man3.  This version will suggest a 
8083 new default of $dflt.  
8084 EOM
8085                 tdflt=$dflt
8086                 dflt='n'
8087                 rp='Do you wish to preserve the old behavior?(y/n)'
8088                 . ./myread
8089                 case "$ans" in
8090                 y*) dflt="$privlib/man/man3" ;;
8091                 *)  dflt=$tdflt ;;
8092                 esac
8093     fi
8094         ;;
8095 *)      dflt="$man3dir" ;;
8096 esac
8097 case "$dflt" in
8098 ' ') dflt=none ;;
8099 esac
8100 echo " "
8101 fn=dn+~
8102 rp="Where do the $package library man pages (source) go?"
8103 . ./getfile
8104 man3dir="$ans"
8105 man3direxp="$ansexp"
8106 case "$man3dir" in
8107 '')     man3dir=' '
8108         installman3dir='';;
8109 esac
8110
8111 : Change installation prefix, if necessary.
8112 if $test X"$prefix" != X"$installprefix"; then
8113         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8114 else
8115         installman3dir="$man3direxp"
8116 fi
8117
8118 : What suffix to use on installed man pages
8119 case "$man3dir" in
8120 ' ')
8121         man3ext='0'
8122         ;;
8123 *)
8124         rp="What suffix should be used for the $package library man pages?"
8125         case "$man3ext" in
8126         '')     case "$man3dir" in
8127                 *3)  dflt=3 ;;
8128                 *3p) dflt=3p ;;
8129                 *3pm) dflt=3pm ;;
8130                 *l) dflt=l;;
8131                 *n) dflt=n;;
8132                 *o) dflt=o;;
8133                 *p) dflt=p;;
8134                 *C) dflt=C;;
8135                 *L) dflt=L;;
8136                 *L3) dflt=L3;;
8137                 *) dflt=3;;
8138                 esac
8139                 ;;
8140         *)      dflt="$man3ext";;
8141         esac
8142         . ./myread
8143         man3ext="$ans"
8144         ;;
8145 esac
8146
8147 : see if we have to deal with yellow pages, now NIS.
8148 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8149         if $test -f /usr/etc/nibindd; then
8150                 echo " "
8151                 echo "I'm fairly confident you're on a NeXT."
8152                 echo " "
8153                 rp='Do you get the hosts file via NetInfo?'
8154                 dflt=y
8155                 case "$hostcat" in
8156                 nidump*) ;;
8157                 '') ;;
8158                 *) dflt=n;;
8159                 esac
8160                 . ./myread
8161                 case "$ans" in
8162                 y*) hostcat='nidump hosts .';;
8163                 *)      case "$hostcat" in
8164                         nidump*) hostcat='';;
8165                         esac
8166                         ;;
8167                 esac
8168         fi
8169         case "$hostcat" in
8170         nidump*) ;;
8171         *)
8172                 case "$hostcat" in
8173                 *ypcat*) dflt=y;;
8174                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8175                                 dflt=y
8176                         else
8177                                 dflt=n
8178                         fi;;
8179                 *) dflt=n;;
8180                 esac
8181                 echo " "
8182                 rp='Are you getting the hosts file via yellow pages?'
8183                 . ./myread
8184                 case "$ans" in
8185                 y*) hostcat='ypcat hosts';;
8186                 *) hostcat='cat /etc/hosts';;
8187                 esac
8188                 ;;
8189         esac
8190 fi
8191 case "$hostcat" in
8192 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8193 esac
8194 case "$groupcat" in
8195 '') test -f /etc/group && groupcat='cat /etc/group';;
8196 esac
8197 case "$passcat" in
8198 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8199 esac
8200
8201 : now get the host name
8202 echo " "
8203 echo "Figuring out host name..." >&4
8204 case "$myhostname" in
8205 '') cont=true
8206         echo 'Maybe "hostname" will work...'
8207         if tans=`sh -c hostname 2>&1` ; then
8208                 myhostname=$tans
8209                 phostname=hostname
8210                 cont=''
8211         fi
8212         ;;
8213 *) cont='';;
8214 esac
8215 if $test "$cont"; then
8216         if ./xenix; then
8217                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8218                 if tans=`cat /etc/systemid 2>&1` ; then
8219                         myhostname=$tans
8220                         phostname='cat /etc/systemid'
8221                         echo "Whadyaknow.  Xenix always was a bit strange..."
8222                         cont=''
8223                 fi
8224         elif $test -r /etc/systemid; then
8225                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8226         fi
8227 fi
8228 if $test "$cont"; then
8229         echo 'No, maybe "uuname -l" will work...'
8230         if tans=`sh -c 'uuname -l' 2>&1` ; then
8231                 myhostname=$tans
8232                 phostname='uuname -l'
8233         else
8234                 echo 'Strange.  Maybe "uname -n" will work...'
8235                 if tans=`sh -c 'uname -n' 2>&1` ; then
8236                         myhostname=$tans
8237                         phostname='uname -n'
8238                 else
8239                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8240                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8241                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8242                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8243                         else
8244                                 case "$myhostname" in
8245                                 '') echo "Does this machine have an identity crisis or something?"
8246                                         phostname='';;
8247                                 *)
8248                                         echo "Well, you said $myhostname before..."
8249                                         phostname='echo $myhostname';;
8250                                 esac
8251                         fi
8252                 fi
8253         fi
8254 fi
8255 case "$myhostname" in
8256 '') myhostname=noname ;;
8257 esac
8258 : you do not want to know about this
8259 set $myhostname
8260 myhostname=$1
8261
8262 : verify guess
8263 if $test "$myhostname" ; then
8264         dflt=y
8265         rp='Your host name appears to be "'$myhostname'".'" Right?"
8266         . ./myread
8267         case "$ans" in
8268         y*) ;;
8269         *) myhostname='';;
8270         esac
8271 fi
8272
8273 : bad guess or no guess
8274 while $test "X$myhostname" = X ; do
8275         dflt=''
8276         rp="Please type the (one word) name of your host:"
8277         . ./myread
8278         myhostname="$ans"
8279 done
8280
8281 : translate upper to lower if necessary
8282 case "$myhostname" in
8283 *[A-Z]*)
8284         echo "(Normalizing case in your host name)"
8285         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8286         ;;
8287 esac
8288
8289 case "$myhostname" in
8290 *.*)
8291         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8292         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8293         echo "(Trimming domain name from host name--host name is now $myhostname)"
8294         ;;
8295 *) case "$mydomain" in
8296         '')
8297                 {
8298                         test "X$hostcat" = "Xypcat hosts" &&
8299                         ypmatch "$myhostname" hosts 2>/dev/null |\
8300                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8301                         $test -s hosts
8302                 } || {
8303                         test "X$hostcat" != "X" &&
8304                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8305                                         /[       ]$myhostname[  . ]/p" > hosts
8306                 }
8307                 tmp_re="[       . ]"
8308                 if $test -f hosts; then
8309                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8310                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8311                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8312                                 hosts | $sort | $uniq | \
8313                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8314                         case `$echo X$dflt` in
8315                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8316                                 dflt=.
8317                                 ;;
8318                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8319                                 ;;
8320                         esac
8321                 else
8322                         echo "(I cannot locate a hosts database anywhere)"
8323                         dflt=.
8324                 fi
8325                 case "$dflt" in
8326                 .)
8327                         tans=`./loc resolv.conf X /etc /usr/etc`
8328                         if $test -f "$tans"; then
8329                                 echo "(Attempting domain name extraction from $tans)"
8330                                 dflt=.`$sed -n -e 's/   / /g' \
8331                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8332                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8333                                 case "$dflt" in
8334                                 .) dflt=.`$sed -n -e 's/        / /g' \
8335                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8336                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8337                                         ;;
8338                                 esac
8339                         fi
8340                         ;;
8341                 esac
8342                 case "$dflt" in
8343                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8344                         dflt=.`sh -c domainname 2>/dev/null`
8345                         case "$dflt" in
8346                         '') dflt='.';;
8347                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8348                         esac
8349                         ;;
8350                 esac
8351                 case "$dflt$osname" in
8352                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8353                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8354                         ;;
8355                 esac
8356                 case "$dflt" in
8357                 .) echo "(Lost all hope -- silly guess then)"
8358                         dflt='.nonet'
8359                         ;;
8360                 esac
8361                 $rm -f hosts
8362                 ;;
8363         *) dflt="$mydomain";;
8364         esac;;
8365 esac
8366 echo " "
8367 rp="What is your domain name?"
8368 . ./myread
8369 tans="$ans"
8370 case "$ans" in
8371 '') ;;
8372 .*) ;;
8373 *) tans=".$tans";;
8374 esac
8375 mydomain="$tans"
8376
8377 : translate upper to lower if necessary
8378 case "$mydomain" in
8379 *[A-Z]*)
8380         echo "(Normalizing case in your domain name)"
8381         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8382         ;;
8383 esac
8384
8385 : a little sanity check here
8386 case "$phostname" in
8387 '') ;;
8388 *)
8389         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8390         $myhostname$mydomain|$myhostname) ;;
8391         *)
8392                 case "$phostname" in
8393                 sed*)
8394                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8395                         ;;
8396                 *)
8397                         echo "(That doesn't agree with your $phostname command, by the way.)"
8398                         ;;
8399                 esac
8400         ;;
8401         esac
8402         ;;
8403 esac
8404
8405 $cat <<EOM
8406
8407 I need to get your e-mail address in Internet format if possible, i.e.
8408 something like user@host.domain. Please answer accurately since I have
8409 no easy means to double check it. The default value provided below
8410 is most probably close to reality but may not be valid from outside
8411 your organization...
8412
8413 EOM
8414 cont=x
8415 while test "$cont"; do
8416         case "$cf_email" in
8417         '') dflt="$cf_by@$myhostname$mydomain";;
8418         *) dflt="$cf_email";;
8419         esac
8420         rp='What is your e-mail address?'
8421         . ./myread
8422         cf_email="$ans"
8423         case "$cf_email" in
8424         *@*.*) cont='' ;;
8425         *)
8426                 rp='Address does not look like an Internet one.  Use it anyway?'
8427                 case "$fastread" in
8428                 yes) dflt=y ;;
8429                 *) dflt=n ;;
8430                 esac
8431                 . ./myread
8432                 case "$ans" in
8433                 y*) cont='' ;;
8434                 *) echo " " ;;
8435                 esac
8436                 ;;
8437         esac
8438 done
8439
8440 $cat <<EOM
8441
8442 If you or somebody else will be maintaining perl at your site, please
8443 fill in the correct e-mail address here so that they may be contacted
8444 if necessary. Currently, the "perlbug" program included with perl
8445 will send mail to this address in addition to perlbug@perl.org. You may
8446 enter "none" for no administrator.
8447
8448 EOM
8449 case "$perladmin" in
8450 '') dflt="$cf_email";;
8451 *) dflt="$perladmin";;
8452 esac
8453 rp='Perl administrator e-mail address'
8454 . ./myread
8455 perladmin="$ans"
8456
8457 : determine whether to only install version-specific parts.
8458 echo " "
8459 $cat <<EOM
8460 Do you want to install only the version-specific parts of the perl
8461 distribution?  Usually you do *not* want to do this.
8462 EOM
8463 case "$versiononly" in
8464 "$define"|[Yy]*|true) dflt='y' ;;
8465 *) dflt='n';
8466 esac
8467 rp="Do you want to install only the version-specific parts of perl?"
8468 . ./myread
8469 case "$ans" in
8470 [yY]*)  val="$define";;
8471 *)      val="$undef" ;;
8472 esac
8473 set versiononly
8474 eval $setvar
8475
8476 case "$versiononly" in
8477 "$define") inc_version_list=''
8478            inc_version_list_init=0
8479            ;;
8480 esac
8481
8482 : figure out how to guarantee perl startup
8483 case "$startperl" in
8484 '')
8485         case "$sharpbang" in
8486         *!)
8487                 $cat <<EOH
8488
8489 I can use the #! construct to start perl on your system. This will
8490 make startup of perl scripts faster, but may cause problems if you
8491 want to share those scripts and perl is not in a standard place
8492 ($binexp/perl) on all your platforms. The alternative is to force
8493 a shell by starting the script with a single ':' character.
8494
8495 EOH
8496                 case "$versiononly" in
8497                 "$define")      dflt="$binexp/perl$version";;  
8498                 *)              dflt="$binexp/perl";;
8499                 esac
8500                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8501                 . ./myread
8502                 case "$ans" in
8503                 none)   startperl=": # use perl";;
8504                 *)      startperl="#!$ans"
8505                         if $test 30 -lt `echo "$ans" | wc -c`; then
8506                                 $cat >&4 <<EOM
8507
8508 WARNING:  Some systems limit the #! command to 32 characters.
8509 If you experience difficulty running Perl scripts with #!, try
8510 installing Perl in a directory with a shorter pathname.
8511
8512 EOM
8513                         fi ;;
8514                 esac
8515                 ;;
8516         *) startperl=": # use perl"
8517                 ;;
8518         esac
8519         ;;
8520 esac
8521 echo "I'll use $startperl to start perl scripts."
8522
8523 : figure best path for perl in scripts
8524 case "$perlpath" in
8525 '')
8526         case "$versiononly" in
8527         "$define")      perlpath="$binexp/perl$version";;
8528         *)              perlpath="$binexp/perl";;
8529         esac
8530         case "$startperl" in
8531         *!*) ;;
8532         *)
8533                 $cat <<EOH
8534
8535 I will use the "eval 'exec'" idiom to start Perl on your system.
8536 I can use the full path of your Perl binary for this purpose, but
8537 doing so may cause problems if you want to share those scripts and
8538 Perl is not always in a standard place ($binexp/perl).
8539
8540 EOH
8541                 dflt="$binexp/perl"
8542                 rp="What path shall I use in \"eval 'exec'\"?"
8543                 . ./myread
8544                 perlpath="$ans"
8545                 ;;
8546         esac
8547         ;;
8548 esac
8549 case "$startperl" in
8550 *!*)    ;;
8551 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8552 esac
8553
8554 : determine where public executable scripts go
8555 set scriptdir scriptdir
8556 eval $prefixit
8557 case "$scriptdir" in
8558 '')
8559         dflt="$bin"
8560         : guess some guesses
8561         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8562         $test -d /usr/share/bin     && dflt=/usr/share/bin
8563         $test -d /usr/local/script  && dflt=/usr/local/script
8564         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8565         $test -d $prefixexp/script  && dflt=$prefixexp/script
8566         set dflt
8567         eval $prefixup
8568         ;;
8569 *)  dflt="$scriptdir"
8570         ;;
8571 esac
8572 $cat <<EOM
8573  
8574 Some installations have a separate directory just for executable scripts so
8575 that they can mount it across multiple architectures but keep the scripts in
8576 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8577 Or you might just lump your scripts in with all your other executables.
8578  
8579 EOM
8580 fn=d~
8581 rp='Where do you keep publicly executable scripts?'
8582 . ./getfile
8583 if $test "X$ansexp" != "X$scriptdirexp"; then
8584         installscript=''
8585 fi
8586 scriptdir="$ans"
8587 scriptdirexp="$ansexp"
8588 : Change installation prefix, if necessary.
8589 if $test X"$prefix" != X"$installprefix"; then
8590         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8591 else
8592         installscript="$scriptdirexp"
8593 fi
8594
8595 : determine where add-on public executables go
8596 case "$sitebin" in
8597 '')     dflt=$siteprefix/bin ;;
8598 *)      dflt=$sitebin ;;
8599 esac
8600 fn=d~
8601 rp='Pathname where the add-on public executables should be installed?'
8602 . ./getfile
8603 sitebin="$ans"
8604 sitebinexp="$ansexp"
8605 : Change installation prefix, if necessary.
8606 if $test X"$prefix" != X"$installprefix"; then
8607         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8608 else
8609         installsitebin="$sitebinexp"
8610 fi
8611
8612 : define an is-a-typedef? function
8613 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8614 case "$inclist" in
8615 "") inclist="sys/types.h";;
8616 esac;
8617 eval "varval=\$$var";
8618 case "$varval" in
8619 "")
8620         $rm -f temp.c;
8621         for inc in $inclist; do
8622                 echo "#include <$inc>" >>temp.c;
8623         done;
8624         echo "#ifdef $type" >> temp.c;
8625         echo "printf(\"We have $type\");" >> temp.c;
8626         echo "#endif" >> temp.c;
8627         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8628         if $contains $type temp.E >/dev/null 2>&1; then
8629                 eval "$var=\$type";
8630         else
8631                 eval "$var=\$def";
8632         fi;
8633         $rm -f temp.?;;
8634 *) eval "$var=\$varval";;
8635 esac'
8636
8637 : define an is-a-typedef? function that prompts if the type is not available.
8638 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8639 case "$inclist" in
8640 "") inclist="sys/types.h";;
8641 esac;
8642 eval "varval=\$$var";
8643 case "$varval" in
8644 "")
8645         $rm -f temp.c;
8646         for inc in $inclist; do
8647                 echo "#include <$inc>" >>temp.c;
8648         done;
8649         echo "#ifdef $type" >> temp.c;
8650         echo "printf(\"We have $type\");" >> temp.c;
8651         echo "#endif" >> temp.c;
8652         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8653         echo " " ;
8654         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8655         if $contains $type temp.E >/dev/null 2>&1; then
8656                 echo "$type found." >&4;
8657                 eval "$var=\$type";
8658         else
8659                 echo "$type NOT found." >&4;
8660                 dflt="$def";
8661                 . ./myread ;
8662                 eval "$var=\$ans";
8663         fi;
8664         $rm -f temp.?;;
8665 *) eval "$var=\$varval";;
8666 esac'
8667
8668 : see what type lseek is declared as in the kernel
8669 rp="What is the type used for lseek's offset on this system?"
8670 set off_t lseektype long stdio.h sys/types.h
8671 eval $typedef_ask
8672
8673 echo " "
8674 echo "Checking to see how big your file offsets are..." >&4
8675 $cat >try.c <<EOCP
8676 #include <sys/types.h>
8677 #include <stdio.h>
8678 int main()
8679 {
8680     printf("%d\n", (int)sizeof($lseektype));
8681     return(0); 
8682 }
8683 EOCP
8684 set try
8685 if eval $compile_ok; then
8686         lseeksize=`$run ./try`
8687         echo "Your file offsets are $lseeksize bytes long."
8688 else
8689         dflt=$longsize
8690         echo " "
8691         echo "(I can't seem to compile the test program.  Guessing...)"
8692         rp="What is the size of your file offsets (in bytes)?"
8693         . ./myread
8694         lseeksize="$ans"
8695 fi
8696 $rm -f try.c try
8697
8698 : see what type file positions are declared as in the library
8699 rp="What is the type for file position used by fsetpos()?"
8700 set fpos_t fpostype long stdio.h sys/types.h
8701 eval $typedef_ask
8702
8703 echo " "
8704 case "$fpostype" in
8705 *_t) zzz="$fpostype"    ;;
8706 *)   zzz="fpos_t"       ;;
8707 esac
8708 echo "Checking the size of $zzz..." >&4 
8709 cat > try.c <<EOCP
8710 #include <sys/types.h>
8711 #include <stdio.h>
8712 int main() {
8713     printf("%d\n", (int)sizeof($fpostype));
8714     exit(0);
8715 }
8716 EOCP
8717 set try
8718 if eval $compile_ok; then
8719         yyy=`$run ./try`
8720         case "$yyy" in
8721         '')     fpossize=4
8722                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8723                 ;;
8724         *)      fpossize=$yyy
8725                 echo "Your $zzz is $fpossize bytes long."
8726                 ;;
8727         esac
8728 else
8729         dflt="$longsize"
8730         echo " " >&4
8731         echo "(I can't compile the test program.  Guessing...)" >&4
8732         rp="What is the size of your file positions (in bytes)?"
8733         . ./myread
8734         fpossize="$ans"
8735 fi
8736
8737
8738
8739 # Backward compatibility (uselfs is deprecated).
8740 case "$uselfs" in
8741 "$define"|true|[yY]*)
8742         cat <<EOM >&4
8743
8744 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8745 EOM
8746         uselargefiles="$define"
8747         ;;
8748 esac                          
8749
8750 case "$lseeksize:$fpossize" in
8751 8:8) cat <<EOM
8752
8753 You can have files larger than 2 gigabytes.
8754 EOM
8755    val="$define" ;;
8756 *)    case "$uselargefiles" in
8757    "$undef"|false|[nN]*) dflt='n' ;;
8758    *)   dflt='y' ;;
8759    esac
8760    cat <<EOM
8761
8762 Perl can be built to understand large files (files larger than 2 gigabytes)
8763 on some systems.  To do so, Configure can be run with -Duselargefiles.
8764
8765 If this doesn't make any sense to you, just accept the default '$dflt'.
8766 EOM
8767    rp='Try to understand large files, if available?'
8768    . ./myread
8769    case "$ans" in
8770    y|Y)         val="$define" ;;
8771    *)           val="$undef"  ;;
8772    esac
8773    ;;
8774 esac
8775 set uselargefiles
8776 eval $setvar
8777 case "$uselargefiles" in
8778 "$define")
8779 : Look for a hint-file generated 'call-back-unit'.  If the
8780 : user has specified that a large files perl is to be built,
8781 : we may need to set or change some other defaults.
8782         if $test -f uselargefiles.cbu; then
8783                 echo "Your platform has some specific hints for large file builds, using them..."
8784                 . ./uselargefiles.cbu
8785                 echo " "
8786                 echo "Rechecking to see how big your file offsets are..." >&4
8787                 $cat >try.c <<EOCP
8788 #include <sys/types.h>
8789 #include <stdio.h>
8790 int main()
8791 {
8792     printf("%d\n", (int)sizeof($lseektype));
8793     return(0); 
8794 }
8795 EOCP
8796                 set try
8797                 if eval $compile_ok; then
8798                         lseeksize=`$run ./try`
8799                         $echo "Your file offsets are now $lseeksize bytes long."
8800                 else
8801                         dflt="$lseeksize"
8802                         echo " "
8803                         echo "(I can't seem to compile the test program.  Guessing...)"
8804                         rp="What is the size of your file offsets (in bytes)?"
8805                         . ./myread
8806                         lseeksize="$ans"
8807                 fi
8808                 case "$fpostype" in
8809                 *_t) zzz="$fpostype"    ;;
8810                 *)   zzz="fpos_t"       ;;
8811                 esac
8812                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8813                 $cat > try.c <<EOCP
8814 #include <sys/types.h>
8815 #include <stdio.h>
8816 int main() {
8817     printf("%d\n", (int)sizeof($fpostype));
8818     exit(0);
8819 }
8820 EOCP
8821                 set try
8822                 if eval $compile_ok; then
8823                         yyy=`$run ./try`
8824                         dflt="$lseeksize"
8825                         case "$yyy" in
8826                         '')     echo " "
8827                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8828                                 ;;
8829                         *)      fpossize=$yyy
8830                                 echo " $fpossize bytes." >&4
8831                                 ;;
8832                         esac
8833                 else
8834                         dflt="$fpossize"
8835                         echo " "
8836                         echo "(I can't compile the test program.  Guessing...)" >&4
8837                         rp="What is the size of your file positions (in bytes)?"
8838                         . ./myread
8839                         fpossize="$ans"
8840                 fi
8841                 $rm -f try.c try
8842         fi
8843         ;;
8844 esac
8845
8846 case "$vendorprefix" in
8847 '')     d_vendorbin="$undef"
8848         vendorbin=''
8849         vendorbinexp=''
8850         ;;
8851 *)      d_vendorbin="$define"
8852         : determine where vendor-supplied executables go.
8853         case "$vendorbin" in
8854         '') dflt=$vendorprefix/bin ;;
8855         *)      dflt="$vendorbin" ;;
8856         esac
8857         fn=d~+
8858         rp='Pathname for the vendor-supplied executables directory?'
8859         . ./getfile
8860         vendorbin="$ans"
8861         vendorbinexp="$ansexp"
8862         ;;
8863 esac
8864 : Change installation prefix, if necessary.
8865 if $test X"$prefix" != X"$installprefix"; then
8866         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8867 else
8868         installvendorbin="$vendorbinexp"
8869 fi
8870
8871 : see if qgcvt exists
8872 set qgcvt d_qgcvt
8873 eval $inlibc
8874
8875 : Check how to convert floats to strings.
8876
8877 if test "X$d_Gconvert" = X; then
8878
8879 echo " "
8880 echo "Checking for an efficient way to convert floats to strings."
8881 echo " " > try.c
8882 case "$uselongdouble" in
8883 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8884 esac
8885 case "$d_longdbl" in
8886 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8887 esac
8888 case "$d_PRIgldbl" in
8889 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
8890 esac
8891 $cat >>try.c <<EOP
8892 #ifdef TRY_gconvert
8893 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8894 char *myname = "gconvert";
8895 #endif
8896 #ifdef TRY_gcvt
8897 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8898 char *myname = "gcvt";
8899 #endif
8900 #ifdef TRY_qgcvt
8901 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8902 char *myname = "qgcvt";
8903 #define DOUBLETYPE long double
8904 #endif
8905 #ifdef TRY_sprintf
8906 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8907 #ifdef HAS_PRIgldbl
8908 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8909 #else
8910 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
8911 #endif
8912 #else
8913 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8914 #endif
8915 char *myname = "sprintf";
8916 #endif
8917
8918 #ifndef DOUBLETYPE
8919 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8920 #define DOUBLETYPE long double
8921 #else
8922 #define DOUBLETYPE double
8923 #endif
8924 #endif
8925
8926 #include <stdio.h>
8927
8928 #define I_STDLIB $i_stdlib
8929 #ifdef I_STDLIB
8930 #include <stdlib.h>
8931 #endif
8932
8933 int
8934 checkit(expect, got)
8935 char *expect;
8936 char *got;
8937 {
8938     if (strcmp(expect, got)) {
8939                 printf("%s oddity:  Expected %s, got %s\n",
8940                         myname, expect, got);
8941                 exit(1);
8942         }
8943 }
8944
8945 int main()
8946
8947         char buf[64]; 
8948         buf[63] = '\0';
8949
8950         /* This must be 1st test on (which?) platform */
8951         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8952         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8953         checkit("0.1", buf);
8954
8955         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
8956         checkit("0.01", buf);
8957
8958         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
8959         checkit("0.001", buf);
8960
8961         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
8962         checkit("0.0001", buf);
8963
8964         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
8965         if (strlen(buf) > 5)
8966             checkit("9e-005", buf); /* for Microsoft ?? */
8967         else
8968             checkit("9e-05", buf);
8969
8970         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
8971         checkit("1", buf);
8972
8973         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
8974         checkit("1.1", buf);
8975
8976         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
8977         checkit("1.01", buf);
8978
8979         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
8980         checkit("1.001", buf);
8981
8982         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
8983         checkit("1.0001", buf);
8984
8985         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
8986         checkit("1.00001", buf);
8987
8988         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
8989         checkit("1.000001", buf);
8990
8991         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
8992         checkit("0", buf);
8993
8994         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
8995         checkit("-1", buf);
8996
8997         /* Some Linux gcvt's give 1.e+5 here. */
8998         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
8999         checkit("100000", buf);
9000         
9001         /* Some Linux gcvt's give -1.e+5 here. */
9002         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9003         checkit("-100000", buf);
9004
9005         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9006         checkit("123.456", buf);
9007
9008         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9009         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9010         /* 34 should be enough to scare even long double
9011          * places into using the e notation. */
9012         if (strlen(buf) > 5)
9013             checkit("1e+034", buf); /* for Microsoft */
9014         else
9015             checkit("1e+34", buf);
9016
9017         /* For Perl, if you add additional tests here, also add them to
9018          * t/base/num.t for benefit of platforms not using Configure or
9019          * overriding d_Gconvert */
9020
9021         exit(0);
9022 }
9023 EOP
9024 : first add preferred functions to our list
9025 xxx_list=""
9026 for xxx_convert in $gconvert_preference; do
9027     case $xxx_convert in
9028     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9029     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9030     esac 
9031 done
9032 : then add any others
9033 for xxx_convert in gconvert gcvt sprintf; do
9034     case "$xxx_list" in
9035     *$xxx_convert*) ;;
9036     *) xxx_list="$xxx_list $xxx_convert" ;;
9037     esac 
9038 done
9039
9040 case "$d_longdbl$uselongdouble" in
9041 "$define$define")
9042     : again, add prefered functions to our list first
9043     xxx_ld_list=""
9044     for xxx_convert in $gconvert_ld_preference; do
9045         case $xxx_convert in
9046         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9047         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9048         esac
9049     done
9050     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9051     for xxx_convert in qgcvt sprintf $xxx_list; do
9052         case "$xxx_ld_list" in
9053         $xxx_convert*|*" $xxx_convert"*) ;;
9054         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9055         esac
9056     done
9057     : if sprintf cannot do long doubles, move it to the end
9058     if test "$d_PRIgldbl" != "$define"; then
9059         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9060     fi
9061     : if no qgcvt, remove it
9062     if test "$d_qgcvt" != "$define"; then
9063         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9064     fi
9065     : use the ld_list
9066     xxx_list="$xxx_ld_list"
9067     ;;
9068 esac
9069
9070 for xxx_convert in $xxx_list; do
9071         echo "Trying $xxx_convert..."
9072         $rm -f try try$_o
9073         set try -DTRY_$xxx_convert
9074         if eval $compile; then
9075                 echo "$xxx_convert() found." >&4
9076                 if $run ./try; then
9077                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9078                         break;
9079                 else
9080                         echo "...But $xxx_convert didn't work as I expected."
9081                         xxx_convert=''
9082                 fi
9083         else
9084                 echo "$xxx_convert NOT found." >&4
9085         fi
9086 done
9087
9088 if test X$xxx_convert = X; then
9089     echo "*** WHOA THERE!!! ***" >&4
9090     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9091     xxx_convert=sprintf
9092 fi
9093
9094 case "$xxx_convert" in
9095 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9096 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9097 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9098 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9099    "$define$define$define")
9100       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9101    "$define$define$undef")
9102       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9103    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9104    esac
9105    ;;  
9106 esac
9107
9108 fi
9109
9110 : see if _fwalk exists
9111 set fwalk d__fwalk
9112 eval $inlibc
9113
9114 : Initialize h_fcntl
9115 h_fcntl=false
9116
9117 : Initialize h_sysfile
9118 h_sysfile=false
9119
9120 : access call always available on UNIX
9121 set access d_access
9122 eval $inlibc
9123
9124 : locate the flags for 'access()'
9125 case "$d_access" in
9126 "$define")
9127         echo " "
9128         $cat >access.c <<'EOCP'
9129 #include <sys/types.h>
9130 #ifdef I_FCNTL
9131 #include <fcntl.h>
9132 #endif
9133 #ifdef I_SYS_FILE
9134 #include <sys/file.h>
9135 #endif
9136 #ifdef I_UNISTD
9137 #include <unistd.h>
9138 #endif
9139 int main() {
9140         exit(R_OK);
9141 }
9142 EOCP
9143         : check sys/file.h first, no particular reason here
9144         if $test `./findhdr sys/file.h` && \
9145                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9146                 h_sysfile=true;
9147                 echo "<sys/file.h> defines the *_OK access constants." >&4
9148         elif $test `./findhdr fcntl.h` && \
9149                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9150                 h_fcntl=true;
9151                 echo "<fcntl.h> defines the *_OK access constants." >&4
9152         elif $test `./findhdr unistd.h` && \
9153                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9154                 echo "<unistd.h> defines the *_OK access constants." >&4
9155         else
9156                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9157         fi
9158         ;;
9159 esac
9160 $rm -f access*
9161
9162 : see if accessx exists
9163 set accessx d_accessx
9164 eval $inlibc
9165
9166 : see if alarm exists
9167 set alarm d_alarm
9168 eval $inlibc
9169
9170 : see if POSIX threads are available
9171 set pthread.h i_pthread
9172 eval $inhdr
9173
9174 : define a fucntion to check prototypes
9175 $cat > protochk <<EOSH
9176 $startsh
9177 cc="$cc"
9178 optimize="$optimize"
9179 ccflags="$ccflags"
9180 prototype="$prototype"
9181 define="$define"
9182 rm=$rm
9183 usethreads=$usethreads
9184 i_pthread=$i_pthread
9185 pthread_h_first=$pthread_h_first
9186 EOSH
9187
9188 $cat >> protochk <<'EOSH'
9189
9190 $rm -f try.c
9191 foo="$1"
9192 shift
9193 while test $# -ge 2; do
9194         case "$1" in
9195                 $define) echo "#include <$2>" >> try.c ;;
9196                 literal) echo "$2" >> try.c ;;
9197         esac
9198     # Extra magic for the benefit of systems that need pthread.h
9199     # to be included early to correctly detect threadsafe functions.
9200     # Such functions must guarantee themselves, though, that the usethreads
9201     # and i_pthread have been defined, before calling protochk.
9202     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9203         echo "#include <pthread.h>" >> try.c
9204         pthread_h_done=yes
9205     fi
9206     shift 2
9207 done
9208 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9209 cat >> try.c <<'EOCP'
9210 #ifdef CAN_PROTOTYPE
9211 #define _(args) args
9212 #else
9213 #define _(args) ()
9214 #endif
9215 EOCP
9216 echo "$foo" >> try.c
9217 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9218 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9219 status=$?
9220 $rm -f try.[co]
9221 exit $status
9222 EOSH
9223 chmod +x protochk
9224 $eunicefix protochk
9225
9226 : see if sys/types.h has to be included
9227 set sys/types.h i_systypes
9228 eval $inhdr
9229
9230 : see if sys/select.h has to be included
9231 set sys/select.h i_sysselct
9232 eval $inhdr
9233
9234 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9235 while $test $# -ge 2; do
9236         case "$1" in
9237         $define) echo "#include <$2>";;
9238         esac ;
9239     shift 2;
9240 done > try.c;
9241 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9242 set try;
9243 if eval $compile; then
9244         val="$define";
9245 else
9246         val="$undef";
9247 fi;
9248 set $varname;
9249 eval $setvar;
9250 $rm -f try.c try.o'
9251
9252 : see if we should include time.h, sys/time.h, or both
9253 echo " "
9254 if test "X$timeincl" = X; then
9255         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9256         $echo $n "I'm now running the test program...$c"
9257         $cat >try.c <<'EOCP'
9258 #include <sys/types.h>
9259 #ifdef I_TIME
9260 #include <time.h>
9261 #endif
9262 #ifdef I_SYSTIME
9263 #ifdef SYSTIMEKERNEL
9264 #define KERNEL
9265 #endif
9266 #include <sys/time.h>
9267 #endif
9268 #ifdef I_SYSSELECT
9269 #include <sys/select.h>
9270 #endif
9271 int main()
9272 {
9273         struct tm foo;
9274 #ifdef S_TIMEVAL
9275         struct timeval bar;
9276 #endif
9277 #ifdef S_TIMEZONE
9278         struct timezone tzp;
9279 #endif
9280         if (foo.tm_sec == foo.tm_sec)
9281                 exit(0);
9282 #ifdef S_TIMEVAL
9283         if (bar.tv_sec == bar.tv_sec)
9284                 exit(0);
9285 #endif
9286         exit(1);
9287 }
9288 EOCP
9289         flags=''
9290         for s_timezone in '-DS_TIMEZONE' ''; do
9291         sysselect=''
9292         for s_timeval in '-DS_TIMEVAL' ''; do
9293         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9294         for i_time in '' '-DI_TIME'; do
9295         for i_systime in '-DI_SYSTIME' ''; do
9296                 case "$flags" in
9297                 '') $echo $n ".$c"
9298                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9299                         if eval $compile; then
9300                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9301                                 shift
9302                                 flags="$*"
9303                                 echo " "
9304                                 $echo $n "Succeeded with $flags$c"
9305                         fi
9306                         ;;
9307                 esac
9308         done
9309         done
9310         done
9311         done
9312         done
9313         timeincl=''
9314         echo " "
9315         case "$flags" in
9316         *SYSTIMEKERNEL*) i_systimek="$define"
9317                 timeincl=`./findhdr sys/time.h`
9318                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9319         *) i_systimek="$undef";;
9320         esac
9321         case "$flags" in
9322         *I_TIME*) i_time="$define"
9323                 timeincl=`./findhdr time.h`" $timeincl"
9324                 echo "We'll include <time.h>." >&4;;
9325         *) i_time="$undef";;
9326         esac
9327         case "$flags" in
9328         *I_SYSTIME*) i_systime="$define"
9329                 timeincl=`./findhdr sys/time.h`" $timeincl"
9330                 echo "We'll include <sys/time.h>." >&4;;
9331         *) i_systime="$undef";;
9332         esac
9333         $rm -f try.c try
9334 fi
9335 : see if struct tm knows about tm_zone
9336 case "$i_systime$i_time" in
9337 *$define*) 
9338         echo " "
9339         echo "Checking to see if your struct tm has tm_zone field..." >&4
9340         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9341         eval $hasfield
9342         ;;
9343 *)      val="$undef"
9344         set d_tm_tm_zone
9345         eval $setvar
9346         ;;
9347 esac
9348 case "$d_tm_tm_zone" in
9349 "$define")      echo "Yes, it does."   ;;
9350 *)              echo "No, it doesn't." ;;
9351 esac
9352 : see if struct tm knows about tm_gmtoff
9353 case "$i_systime$i_time" in
9354 *$define*) 
9355         echo " "
9356         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9357         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9358         eval $hasfield
9359         ;;
9360 *)      val="$undef"
9361         set d_tm_tm_gmtoff
9362         eval $setvar
9363         ;;
9364 esac
9365 case "$d_tm_tm_gmtoff" in
9366 "$define")      echo "Yes, it does."   ;;
9367 *)              echo "No, it doesn't." ;;
9368 esac
9369
9370 : see if asctime_r exists
9371 set asctime_r d_asctime_r
9372 eval $inlibc
9373 case "$d_asctime_r" in
9374 "$define")
9375         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9376         case "$d_asctime_r_proto:$usethreads" in
9377         ":define")      d_asctime_r_proto=define
9378                 set d_asctime_r_proto asctime_r $hdrs
9379                 eval $hasproto ;;
9380         *)      ;;
9381         esac
9382         case "$d_asctime_r_proto" in
9383         define)
9384         case "$asctime_r_proto" in
9385         ''|0) try='char* asctime_r(const struct tm*, char*);'
9386         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9387         esac
9388         case "$asctime_r_proto" in
9389         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9390         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9391         esac
9392         case "$asctime_r_proto" in
9393         ''|0) try='int asctime_r(const struct tm*, char*);'
9394         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9395         esac
9396         case "$asctime_r_proto" in
9397         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9398         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9399         esac
9400         case "$asctime_r_proto" in
9401         ''|0)   d_asctime_r=undef
9402                 asctime_r_proto=0
9403                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9404         * )     case "$asctime_r_proto" in
9405                 REENTRANT_PROTO*) ;;
9406                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9407                 esac
9408                 echo "Prototype: $try" ;;
9409         esac
9410         ;;
9411         *)      case "$usethreads" in
9412                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9413                 esac
9414                 d_asctime_r=undef
9415                 asctime_r_proto=0
9416                 ;;
9417         esac
9418         ;;
9419 *)      asctime_r_proto=0
9420         ;;
9421 esac
9422
9423 : see if atolf exists
9424 set atolf d_atolf
9425 eval $inlibc
9426
9427 : see if atoll exists
9428 set atoll d_atoll
9429 eval $inlibc
9430
9431 : Look for GNU-cc style attribute checking
9432 echo " "
9433 echo "Checking whether your compiler can handle __attribute__ ..." >&4
9434 $cat >attrib.c <<'EOCP'
9435 #include <stdio.h>
9436 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
9437 EOCP
9438 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9439         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9440                 echo "Your C compiler doesn't fully support __attribute__."
9441                 val="$undef"
9442         else
9443                 echo "Your C compiler supports __attribute__."
9444                 val="$define"
9445         fi
9446 else
9447         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9448         val="$undef"
9449 fi
9450 set d_attribut
9451 eval $setvar
9452 $rm -f attrib*
9453
9454 : see if bcmp exists
9455 set bcmp d_bcmp
9456 eval $inlibc
9457
9458 : see if bcopy exists
9459 set bcopy d_bcopy
9460 eval $inlibc
9461
9462 : see if this is a unistd.h system
9463 set unistd.h i_unistd
9464 eval $inhdr
9465
9466 : see if getpgrp exists
9467 set getpgrp d_getpgrp
9468 eval $inlibc
9469
9470 case "$d_getpgrp" in
9471 "$define")
9472         echo " "
9473         echo "Checking to see which flavor of getpgrp is in use..."
9474         $cat >try.c <<EOP
9475 #$i_unistd I_UNISTD
9476 #include <sys/types.h>
9477 #ifdef I_UNISTD
9478 #  include <unistd.h>
9479 #endif
9480 int main()
9481 {
9482         if (getuid() == 0) {
9483                 printf("(I see you are running Configure as super-user...)\n");
9484                 setuid(1);
9485         }
9486 #ifdef TRY_BSD_PGRP
9487         if (getpgrp(1) == 0)
9488                 exit(0);
9489 #else
9490         if (getpgrp() > 0)
9491                 exit(0);
9492 #endif
9493         exit(1);
9494 }
9495 EOP
9496         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9497                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
9498                 val="$define"
9499         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9500                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
9501                 val="$undef"
9502         else
9503                 echo "I can't seem to compile and run the test program."
9504                 if ./usg; then
9505                         xxx="a USG one, i.e. you use getpgrp()."
9506                 else
9507                         # SVR4 systems can appear rather BSD-ish.
9508                         case "$i_unistd" in
9509                         $undef)
9510                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
9511                                 val="$define"
9512                                 ;;
9513                         $define)
9514                                 xxx="probably a USG one, i.e. you use getpgrp()."
9515                                 val="$undef"
9516                                 ;;
9517                         esac
9518                 fi
9519                 echo "Assuming your getpgrp is $xxx" >&4
9520         fi
9521         ;;
9522 *) val="$undef";;
9523 esac
9524 set d_bsdgetpgrp
9525 eval $setvar
9526 $rm -f try try.*
9527
9528 : see if setpgrp exists
9529 set setpgrp d_setpgrp
9530 eval $inlibc
9531
9532 case "$d_setpgrp" in
9533 "$define")
9534         echo " "
9535         echo "Checking to see which flavor of setpgrp is in use..."
9536         $cat >try.c <<EOP
9537 #$i_unistd I_UNISTD
9538 #include <sys/types.h>
9539 #ifdef I_UNISTD
9540 #  include <unistd.h>
9541 #endif
9542 int main()
9543 {
9544         if (getuid() == 0) {
9545                 printf("(I see you are running Configure as super-user...)\n");
9546                 setuid(1);
9547         }
9548 #ifdef TRY_BSD_PGRP
9549         if (-1 == setpgrp(1, 1))
9550                 exit(0);
9551 #else
9552         if (setpgrp() != -1)
9553                 exit(0);
9554 #endif
9555         exit(1);
9556 }
9557 EOP
9558         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9559                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
9560                 val="$define"
9561         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9562                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
9563                 val="$undef"
9564         else
9565                 echo "(I can't seem to compile and run the test program.)"
9566                 if ./usg; then
9567                         xxx="a USG one, i.e. you use setpgrp()."
9568                 else
9569                         # SVR4 systems can appear rather BSD-ish.
9570                         case "$i_unistd" in
9571                         $undef)
9572                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
9573                                 val="$define"
9574                                 ;;
9575                         $define)
9576                                 xxx="probably a USG one, i.e. you use setpgrp()."
9577                                 val="$undef"
9578                                 ;;
9579                         esac
9580                 fi
9581                 echo "Assuming your setpgrp is $xxx" >&4
9582         fi
9583         ;;
9584 *) val="$undef";;
9585 esac
9586 set d_bsdsetpgrp
9587 eval $setvar
9588 $rm -f try try.*
9589 : see if bzero exists
9590 set bzero d_bzero
9591 eval $inlibc
9592
9593 : see if signal is declared as pointer to function returning int or void
9594 echo " "
9595 xxx=`./findhdr signal.h`
9596 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
9597 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
9598         echo "You have int (*signal())() instead of void." >&4
9599         val="$undef"
9600 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
9601         echo "You have void (*signal())()." >&4
9602         val="$define"
9603 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
9604         echo "You have int (*signal())() instead of void." >&4
9605         val="$undef"
9606 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
9607         echo "You have void (*signal())()." >&4
9608         val="$define"
9609 else
9610         case "$d_voidsig" in
9611         '')
9612         echo "I can't determine whether signal handler returns void or int..." >&4
9613                 dflt=void
9614                 rp="What type does your signal handler return?"
9615                 . ./myread
9616                 case "$ans" in
9617                 v*) val="$define";;
9618                 *) val="$undef";;
9619                 esac;;
9620         "$define")
9621                 echo "As you already told me, signal handler returns void." >&4
9622                 val="$define"
9623                 ;;
9624         *)      echo "As you already told me, signal handler returns int." >&4
9625                 val="$undef"
9626                 ;;
9627         esac
9628 fi
9629 set d_voidsig
9630 eval $setvar
9631 case "$d_voidsig" in
9632 "$define") signal_t="void";;
9633 *) signal_t="int";;
9634 esac
9635 $rm -f $$.tmp
9636
9637 : check for ability to cast large floats to 32-bit ints.
9638 echo " "
9639 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
9640 if $test "$intsize" -ge 4; then
9641         xxx=int
9642 else
9643         xxx=long
9644 fi
9645 $cat >try.c <<EOCP
9646 #include <stdio.h>
9647 #include <sys/types.h>
9648 #include <signal.h>
9649 $signal_t blech(s) int s; { exit(3); }
9650 int main()
9651 {
9652         $xxx i32;
9653         double f, g;
9654         int result = 0;
9655         char str[16];
9656         signal(SIGFPE, blech);
9657
9658         /* Don't let compiler optimize the test away.  Store the number 
9659            in a writable string for gcc to pass to sscanf under HP/UX.
9660         */
9661         sprintf(str, "2147483647");
9662         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
9663         g = 10 * f;
9664         i32  = ($xxx) g;
9665
9666         /* x86 processors will probably give 0x8000 0000, which is a
9667        sign change.  We don't want that.  We want to mimic SPARC
9668            behavior here, which is to preserve the sign and give
9669            back 0x7fff ffff.
9670         */
9671         if (i32 != ($xxx) f)
9672                 result |= 1;
9673         exit(result);
9674 }
9675 EOCP
9676 set try
9677 if eval $compile_ok; then
9678         $run ./try
9679         yyy=$?
9680 else
9681         echo "(I can't seem to compile the test program--assuming it can't)"
9682         yyy=1
9683 fi
9684 case "$yyy" in
9685 0)      val="$define"
9686         echo "Yup, it can."
9687         ;;
9688 *)      val="$undef"
9689         echo "Nope, it can't."
9690         ;;
9691 esac
9692 set d_casti32
9693 eval $setvar
9694 $rm -f try try.*
9695
9696 : check for ability to cast negative floats to unsigned
9697 echo " "
9698 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
9699 $cat >try.c <<EOCP
9700 #include <stdio.h>
9701 #include <sys/types.h>
9702 #include <signal.h>
9703 $signal_t blech(s) int s; { exit(7); }
9704 $signal_t blech_in_list(s) int s; { exit(4); }
9705 unsigned long dummy_long(p) unsigned long p; { return p; }
9706 unsigned int dummy_int(p) unsigned int p; { return p; }
9707 unsigned short dummy_short(p) unsigned short p; { return p; }
9708 int main()
9709 {
9710         double f;
9711         unsigned long along;
9712         unsigned int aint;
9713         unsigned short ashort;
9714         int result = 0;
9715         char str[16];
9716         
9717         /* Frustrate gcc-2.7.2's optimizer which failed this test with
9718            a direct f = -123. assignment.  gcc-2.8.0 reportedly
9719            optimized the whole file away
9720         */
9721         /* Store the number in a writable string for gcc to pass to 
9722            sscanf under HP/UX.
9723         */
9724         sprintf(str, "-123");
9725         sscanf(str, "%lf", &f);  /* f = -123.; */
9726
9727         signal(SIGFPE, blech);
9728         along = (unsigned long)f;
9729         aint = (unsigned int)f;
9730         ashort = (unsigned short)f;
9731         if (along != (unsigned long)-123)
9732                 result |= 1;
9733         if (aint != (unsigned int)-123)
9734                 result |= 1;
9735         if (ashort != (unsigned short)-123)
9736                 result |= 1;
9737         sprintf(str, "1073741824.");
9738         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
9739         f = f + f;
9740         along = 0;
9741         along = (unsigned long)f;
9742         if (along != 0x80000000)
9743                 result |= 2;
9744         f -= 1.;
9745         along = 0;
9746         along = (unsigned long)f;
9747         if (along != 0x7fffffff)
9748                 result |= 1;
9749         f += 2.;
9750         along = 0;
9751         along = (unsigned long)f;
9752         if (along != 0x80000001)
9753                 result |= 2;
9754         if (result)
9755                 exit(result);
9756         signal(SIGFPE, blech_in_list);
9757         sprintf(str, "123.");
9758         sscanf(str, "%lf", &f);  /* f = 123.; */
9759         along = dummy_long((unsigned long)f);
9760         aint = dummy_int((unsigned int)f);
9761         ashort = dummy_short((unsigned short)f);
9762         if (along != (unsigned long)123)
9763                 result |= 4;
9764         if (aint != (unsigned int)123)
9765                 result |= 4;
9766         if (ashort != (unsigned short)123)
9767                 result |= 4;
9768         exit(result);
9769
9770 }
9771 EOCP
9772 set try
9773 if eval $compile_ok; then
9774         $run ./try
9775         castflags=$?
9776 else
9777         echo "(I can't seem to compile the test program--assuming it can't)"
9778         castflags=7
9779 fi
9780 case "$castflags" in
9781 0)      val="$define"
9782         echo "Yup, it can."
9783         ;;
9784 *)      val="$undef"
9785         echo "Nope, it can't."
9786         ;;
9787 esac
9788 set d_castneg
9789 eval $setvar
9790 $rm -f try.*
9791
9792 : see if vprintf exists
9793 echo " "
9794 if set vprintf val -f d_vprintf; eval $csym; $val; then
9795         echo 'vprintf() found.' >&4
9796         val="$define"
9797         $cat >try.c <<'EOF'
9798 #include <varargs.h>
9799
9800 int main() { xxx("foo"); }
9801
9802 xxx(va_alist)
9803 va_dcl
9804 {
9805         va_list args;
9806         char buf[10];
9807
9808         va_start(args);
9809         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
9810 }
9811 EOF
9812         set try
9813         if eval $compile && $run ./try; then
9814                 echo "Your vsprintf() returns (int)." >&4
9815                 val2="$undef"
9816         else
9817                 echo "Your vsprintf() returns (char*)." >&4
9818                 val2="$define"
9819         fi
9820 else
9821         echo 'vprintf() NOT found.' >&4
9822                 val="$undef"
9823                 val2="$undef"
9824 fi
9825 $rm -f try try.*
9826 set d_vprintf
9827 eval $setvar
9828 val=$val2
9829 set d_charvspr
9830 eval $setvar
9831
9832 : see if chown exists
9833 set chown d_chown
9834 eval $inlibc
9835
9836 : see if chroot exists
9837 set chroot d_chroot
9838 eval $inlibc
9839
9840 : see if chsize exists
9841 set chsize d_chsize
9842 eval $inlibc
9843
9844 : see if class exists
9845 set class d_class
9846 eval $inlibc
9847
9848 hasstruct='varname=$1; struct=$2; shift; shift;
9849 while $test $# -ge 2; do
9850         case "$1" in
9851         $define) echo "#include <$2>";;
9852         esac ;
9853     shift 2;
9854 done > try.c;
9855 echo "int main () { struct $struct foo; }" >> try.c;
9856 set try;
9857 if eval $compile; then
9858         val="$define";
9859 else
9860         val="$undef";
9861 fi;
9862 set $varname;
9863 eval $setvar;
9864 $rm -f try.c try.o'
9865
9866 socketlib=''
9867 sockethdr=''
9868 : see whether socket exists
9869 echo " "
9870 $echo $n "Hmm... $c" >&4
9871 if set socket val -f d_socket; eval $csym; $val; then
9872         echo "Looks like you have Berkeley networking support." >&4
9873         d_socket="$define"
9874         if set setsockopt val -f; eval $csym; $val; then
9875                 d_oldsock="$undef"
9876         else
9877                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9878                 d_oldsock="$define"
9879         fi
9880 else
9881         if $contains socklib libc.list >/dev/null 2>&1; then
9882                 echo "Looks like you have Berkeley networking support." >&4
9883                 d_socket="$define"
9884                 : we will have to assume that it supports the 4.2 BSD interface
9885                 d_oldsock="$undef"
9886         else
9887                 echo "You don't have Berkeley networking in libc$_a..." >&4
9888                 if test "X$d_socket" = "X$define"; then
9889                    echo "...but you seem to believe that you have sockets." >&4
9890                 else
9891                         for net in net socket
9892                         do
9893                                 if test -f /usr/lib/lib$net$_a; then
9894                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9895                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9896                                         if $contains socket libc.list >/dev/null 2>&1; then
9897                                                 d_socket="$define"
9898                                                 socketlib="-l$net"
9899                                                 case "$net" in
9900                                                 net)
9901                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9902                                                         sockethdr="-I/usr/netinclude"
9903                                                         ;;
9904                                                 esac
9905                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
9906                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9907                                                         d_oldsock="$undef"
9908                                                 else
9909                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9910                                                         d_oldsock="$define"
9911                                                 fi
9912                                                 break
9913                                         fi
9914                                 fi
9915                         done
9916                         if test "X$d_socket" != "X$define"; then
9917                            echo "or anywhere else I see." >&4
9918                            d_socket="$undef"
9919                            d_oldsock="$undef"
9920                         fi
9921                 fi
9922         fi
9923 fi
9924
9925 : see if socketpair exists
9926 set socketpair d_sockpair
9927 eval $inlibc
9928
9929
9930 echo " "
9931 echo "Checking the availability of certain socket constants..." >&4
9932 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9933         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9934         $cat >try.c <<EOF
9935 #include <sys/types.h>
9936 #include <sys/socket.h>
9937 int main() {
9938     int i = $ENUM;
9939 }
9940 EOF
9941         val="$undef"
9942         set try; if eval $compile; then
9943                 val="$define"
9944         fi
9945         set d_${enum}; eval $setvar
9946         $rm -f try.c try
9947 done
9948
9949 : see if this is a sys/uio.h system
9950 set sys/uio.h i_sysuio
9951 eval $inhdr
9952
9953
9954 echo " "
9955 echo "Checking to see if your system supports struct cmsghdr..." >&4
9956 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
9957 eval $hasstruct
9958 case "$d_cmsghdr_s" in
9959 "$define")      echo "Yes, it does."   ;;
9960 *)              echo "No, it doesn't." ;;
9961 esac
9962
9963
9964 : check for const keyword
9965 echo " "
9966 echo 'Checking to see if your C compiler knows about "const"...' >&4
9967 $cat >const.c <<'EOCP'
9968 typedef struct spug { int drokk; } spug;
9969 main()
9970 {
9971         const char *foo;
9972         const spug y;
9973 }
9974 EOCP
9975 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
9976         val="$define"
9977         echo "Yup, it does."
9978 else
9979         val="$undef"
9980         echo "Nope, it doesn't."
9981 fi
9982 set d_const
9983 eval $setvar
9984
9985 : see if crypt exists
9986 echo " "
9987 set crypt d_crypt
9988 eval $inlibc
9989 case "$d_crypt" in
9990 $define) cryptlib='' ;;
9991 *)      if set crypt val -f d_crypt; eval $csym; $val; then
9992                 echo 'crypt() found.' >&4
9993                 val="$define"
9994                 cryptlib=''
9995         else
9996                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
9997                 if $test -z "$cryptlib"; then
9998                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
9999                 else
10000                         cryptlib=-lcrypt
10001                 fi
10002                 if $test -z "$cryptlib"; then
10003                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10004                 else
10005                         cryptlib=-lcrypt
10006                 fi
10007                 if $test -z "$cryptlib"; then
10008                         cryptlib=`./loc libcrypt$_a "" $libpth`
10009                 else
10010                         cryptlib=-lcrypt
10011                 fi
10012                 if $test -z "$cryptlib"; then
10013                         echo 'crypt() NOT found.' >&4
10014                         val="$undef"
10015                 else
10016                         val="$define"
10017                 fi
10018         fi
10019         set d_crypt
10020         eval $setvar
10021         ;;
10022 esac
10023
10024 : see if this is a crypt.h system
10025 set crypt.h i_crypt
10026 eval $inhdr
10027
10028 : see if crypt_r exists
10029 set crypt_r d_crypt_r
10030 eval $inlibc
10031 case "$d_crypt_r" in
10032 "$define")
10033         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10034         case "$d_crypt_r_proto:$usethreads" in
10035         ":define")      d_crypt_r_proto=define
10036                 set d_crypt_r_proto crypt_r $hdrs
10037                 eval $hasproto ;;
10038         *)      ;;
10039         esac
10040         case "$d_crypt_r_proto" in
10041         define)
10042         case "$crypt_r_proto" in
10043         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10044         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10045         esac
10046         case "$crypt_r_proto" in
10047         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10048         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10049         esac
10050         case "$crypt_r_proto" in
10051         ''|0)   d_crypt_r=undef
10052                 crypt_r_proto=0
10053                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10054         * )     case "$crypt_r_proto" in
10055                 REENTRANT_PROTO*) ;;
10056                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10057                 esac
10058                 echo "Prototype: $try" ;;
10059         esac
10060         ;;
10061         *)      case "$usethreads" in
10062                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10063                 esac
10064                 d_crypt_r=undef
10065                 crypt_r_proto=0
10066                 ;;
10067         esac
10068         ;;
10069 *)      crypt_r_proto=0
10070         ;;
10071 esac
10072
10073 : get csh whereabouts
10074 case "$csh" in
10075 'csh') val="$undef" ;;
10076 *) val="$define" ;;
10077 esac
10078 set d_csh
10079 eval $setvar
10080 : Respect a hint or command line value for full_csh.
10081 case "$full_csh" in
10082 '') full_csh=$csh ;;
10083 esac
10084
10085 : see if ctermid_r exists
10086 set ctermid_r d_ctermid_r
10087 eval $inlibc
10088 case "$d_ctermid_r" in
10089 "$define")
10090         hdrs="$i_systypes sys/types.h define stdio.h "
10091         case "$d_ctermid_r_proto:$usethreads" in
10092         ":define")      d_ctermid_r_proto=define
10093                 set d_ctermid_r_proto ctermid_r $hdrs
10094                 eval $hasproto ;;
10095         *)      ;;
10096         esac
10097         case "$d_ctermid_r_proto" in
10098         define)
10099         case "$ctermid_r_proto" in
10100         ''|0) try='char* ctermid_r(char*);'
10101         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10102         esac
10103         case "$ctermid_r_proto" in
10104         ''|0)   d_ctermid_r=undef
10105                 ctermid_r_proto=0
10106                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10107         * )     case "$ctermid_r_proto" in
10108                 REENTRANT_PROTO*) ;;
10109                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10110                 esac
10111                 echo "Prototype: $try" ;;
10112         esac
10113         ;;
10114         *)      case "$usethreads" in
10115                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10116                 esac
10117                 d_ctermid_r=undef
10118                 ctermid_r_proto=0
10119                 ;;
10120         esac
10121         ;;
10122 *)      ctermid_r_proto=0
10123         ;;
10124 esac
10125
10126 : see if ctime_r exists
10127 set ctime_r d_ctime_r
10128 eval $inlibc
10129 case "$d_ctime_r" in
10130 "$define")
10131         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10132         case "$d_ctime_r_proto:$usethreads" in
10133         ":define")      d_ctime_r_proto=define
10134                 set d_ctime_r_proto ctime_r $hdrs
10135                 eval $hasproto ;;
10136         *)      ;;
10137         esac
10138         case "$d_ctime_r_proto" in
10139         define)
10140         case "$ctime_r_proto" in
10141         ''|0) try='char* ctime_r(const time_t*, char*);'
10142         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10143         esac
10144         case "$ctime_r_proto" in
10145         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10146         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10147         esac
10148         case "$ctime_r_proto" in
10149         ''|0) try='int ctime_r(const time_t*, char*);'
10150         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10151         esac
10152         case "$ctime_r_proto" in
10153         ''|0) try='int ctime_r(const time_t*, char*, int);'
10154         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10155         esac
10156         case "$ctime_r_proto" in
10157         ''|0)   d_ctime_r=undef
10158                 ctime_r_proto=0
10159                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10160         * )     case "$ctime_r_proto" in
10161                 REENTRANT_PROTO*) ;;
10162                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10163                 esac
10164                 echo "Prototype: $try" ;;
10165         esac
10166         ;;
10167         *)      case "$usethreads" in
10168                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10169                 esac
10170                 d_ctime_r=undef
10171                 ctime_r_proto=0
10172                 ;;
10173         esac
10174         ;;
10175 *)      ctime_r_proto=0
10176         ;;
10177 esac
10178
10179 : see if cuserid exists
10180 set cuserid d_cuserid
10181 eval $inlibc
10182
10183 : see if this is a limits.h system
10184 set limits.h i_limits
10185 eval $inhdr
10186
10187 : see if this is a float.h system
10188 set float.h i_float
10189 eval $inhdr
10190
10191 : See if number of significant digits in a double precision number is known
10192 echo " "
10193 $cat >dbl_dig.c <<EOM
10194 #$i_limits I_LIMITS
10195 #$i_float I_FLOAT
10196 #ifdef I_LIMITS
10197 #include <limits.h>
10198 #endif
10199 #ifdef I_FLOAT
10200 #include <float.h>
10201 #endif
10202 #ifdef DBL_DIG
10203 printf("Contains DBL_DIG");
10204 #endif
10205 EOM
10206 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10207 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10208         echo "DBL_DIG found." >&4
10209         val="$define"
10210 else
10211         echo "DBL_DIG NOT found." >&4
10212         val="$undef"
10213 fi
10214 $rm -f dbl_dig.?
10215 set d_dbl_dig
10216 eval $setvar
10217
10218 : see if dbm.h is available
10219 : see if dbmclose exists
10220 set dbmclose d_dbmclose
10221 eval $inlibc
10222
10223 case "$d_dbmclose" in
10224 $define)
10225         set dbm.h i_dbm
10226         eval $inhdr
10227         case "$i_dbm" in
10228         $define)
10229                 val="$undef"
10230                 set i_rpcsvcdbm
10231                 eval $setvar
10232                 ;;
10233         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10234                 eval $inhdr
10235                 ;;
10236         esac
10237         ;;
10238 *)      echo "We won't be including <dbm.h>"
10239         val="$undef"
10240         set i_dbm
10241         eval $setvar
10242         val="$undef"
10243         set i_rpcsvcdbm
10244         eval $setvar
10245         ;;
10246 esac
10247
10248 : see if prototype for dbminit is available
10249 echo " "
10250 set d_dbminitproto dbminit $i_dbm dbm.h
10251 eval $hasproto
10252
10253 : see if difftime exists
10254 set difftime d_difftime
10255 eval $inlibc
10256
10257 : see if this is a dirent system
10258 echo " "
10259 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10260         val="$define"
10261         echo "<dirent.h> found." >&4
10262 else
10263         val="$undef"
10264         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10265                 echo "<sys/dir.h> found." >&4
10266                 echo " "
10267         else
10268                 xinc=`./findhdr sys/ndir.h`
10269         fi
10270         echo "<dirent.h> NOT found." >&4
10271 fi
10272 set i_dirent
10273 eval $setvar
10274
10275 : Look for type of directory structure.
10276 echo " "
10277 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10278
10279 case "$direntrytype" in
10280 ''|' ')
10281         case "$i_dirent" in
10282         $define) guess1='struct dirent' ;;
10283         *) guess1='struct direct'  ;;
10284         esac
10285         ;;
10286 *)      guess1="$direntrytype"
10287         ;;
10288 esac
10289
10290 case "$guess1" in
10291 'struct dirent') guess2='struct direct' ;;
10292 *) guess2='struct dirent' ;;
10293 esac
10294                 
10295 if $contains "$guess1" try.c >/dev/null 2>&1; then
10296         direntrytype="$guess1"
10297         echo "Your directory entries are $direntrytype." >&4
10298 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10299         direntrytype="$guess2"
10300         echo "Your directory entries seem to be $direntrytype." >&4
10301 else
10302         echo "I don't recognize your system's directory entries." >&4
10303         rp="What type is used for directory entries on this system?"
10304         dflt="$guess1"
10305         . ./myread
10306         direntrytype="$ans"
10307 fi
10308 $rm -f try.c
10309
10310
10311 : see if the directory entry stores field length
10312 echo " "
10313 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10314 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10315         echo "Good, your directory entry keeps length information in d_namlen." >&4
10316         val="$define"
10317 else
10318         echo "Your directory entry does not know about the d_namlen field." >&4
10319         val="$undef"
10320 fi
10321 set d_dirnamlen
10322 eval $setvar
10323 $rm -f try.c
10324
10325 : see if this is an sysdir system
10326 set sys/dir.h i_sysdir
10327 eval $inhdr
10328
10329 : see if this is an sysndir system
10330 set sys/ndir.h i_sysndir
10331 eval $inhdr
10332
10333 : Look for dirfd
10334 echo " "
10335 $cat >dirfd.c <<EOM
10336 #include <stdio.h>
10337 #$i_dirent I_DIRENT             /**/
10338 #$i_sysdir I_SYS_DIR            /**/
10339 #$i_sysndir I_SYS_NDIR          /**/
10340 #$i_systypes I_SYS_TYPES        /**/
10341 #if defined(I_SYS_TYPES)
10342 #include <sys/types.h>
10343 #endif
10344 #if defined(I_DIRENT)
10345 #include <dirent.h>
10346 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10347 #include <sys/dir.h>
10348 #endif
10349 #else
10350 #ifdef I_SYS_NDIR
10351 #include <sys/ndir.h>
10352 #else
10353 #ifdef I_SYS_DIR
10354 #ifdef hp9000s500
10355 #include <ndir.h>       /* may be wrong in the future */
10356 #else
10357 #include <sys/dir.h>
10358 #endif
10359 #endif
10360 #endif
10361 #endif 
10362 int main() {
10363         DIR *dirp = opendir(".");
10364         if (dirfd(dirp) >= 0)
10365                 exit(0);
10366         else
10367                 exit(1);
10368 }
10369 EOM
10370 set dirfd
10371 if eval $compile; then
10372         val="$define"
10373 fi
10374 case "$val" in
10375 $define)        echo "dirfd() found." >&4       ;;
10376 *)              echo "dirfd() NOT found." >&4   ;;
10377 esac
10378 set d_dirfd
10379 eval $setvar
10380 $rm -f dirfd*
10381
10382 : see if dlerror exists
10383 xxx_runnm="$runnm"
10384 runnm=false
10385 set dlerror d_dlerror
10386 eval $inlibc
10387 runnm="$xxx_runnm"
10388
10389 : see if dlfcn is available
10390 set dlfcn.h i_dlfcn
10391 eval $inhdr
10392
10393 case "$usedl" in
10394 $define|y|true)
10395         $cat << EOM
10396
10397 On a few systems, the dynamically loaded modules that perl generates and uses
10398 will need a different extension than shared libs. The default will probably
10399 be appropriate.
10400
10401 EOM
10402         case "$dlext" in
10403         '')     dflt="$so" ;;
10404         *)      dflt="$dlext" ;;
10405         esac
10406         rp='What is the extension of dynamically loaded modules'
10407         . ./myread
10408         dlext="$ans"
10409         ;;
10410 *)
10411         dlext="none"
10412         ;;
10413 esac
10414
10415 : Check if dlsym need a leading underscore
10416 echo " "
10417 val="$undef"
10418
10419 case "$dlsrc" in
10420 dl_dlopen.xs)
10421         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
10422         $cat >dyna.c <<'EOM'
10423 fred () { }
10424 EOM
10425
10426 $cat >fred.c<<EOM
10427
10428 #include <stdio.h>
10429 #$i_dlfcn I_DLFCN
10430 #ifdef I_DLFCN
10431 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
10432 #else
10433 #include <sys/types.h>
10434 #include <nlist.h>
10435 #include <link.h>
10436 #endif
10437
10438 extern int fred() ;
10439
10440 int main()
10441 {
10442     void * handle ;
10443     void * symbol ;
10444 #ifndef RTLD_LAZY
10445     int mode = 1 ;
10446 #else
10447     int mode = RTLD_LAZY ;
10448 #endif
10449     handle = dlopen("./dyna.$dlext", mode) ;
10450     if (handle == NULL) {
10451         printf ("1\n") ;
10452         fflush (stdout) ;
10453         exit(0);
10454     }
10455     symbol = dlsym(handle, "fred") ;
10456     if (symbol == NULL) {
10457         /* try putting a leading underscore */
10458         symbol = dlsym(handle, "_fred") ;
10459         if (symbol == NULL) {
10460             printf ("2\n") ;
10461             fflush (stdout) ;
10462             exit(0);
10463         }
10464         printf ("3\n") ;
10465     }
10466     else
10467         printf ("4\n") ;
10468     fflush (stdout) ;
10469     exit(0);
10470 }
10471 EOM
10472         : Call the object file tmp-dyna.o in case dlext=o.
10473         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
10474                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
10475                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
10476                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
10477                 xxx=`$run ./fred`
10478                 case $xxx in
10479                 1)      echo "Test program failed using dlopen." >&4
10480                         echo "Perhaps you should not use dynamic loading." >&4;;
10481                 2)      echo "Test program failed using dlsym." >&4
10482                         echo "Perhaps you should not use dynamic loading." >&4;;
10483                 3)      echo "dlsym needs a leading underscore" >&4
10484                         val="$define" ;;
10485                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
10486                 esac
10487         else
10488                 echo "I can't compile and run the test program." >&4
10489                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
10490         fi
10491         ;;
10492 esac
10493                 
10494 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
10495
10496 set d_dlsymun
10497 eval $setvar
10498
10499 : see if drand48_r exists
10500 set drand48_r d_drand48_r
10501 eval $inlibc
10502 case "$d_drand48_r" in
10503 "$define")
10504         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
10505         case "$d_drand48_r_proto:$usethreads" in
10506         ":define")      d_drand48_r_proto=define
10507                 set d_drand48_r_proto drand48_r $hdrs
10508                 eval $hasproto ;;
10509         *)      ;;
10510         esac
10511         case "$d_drand48_r_proto" in
10512         define)
10513         case "$drand48_r_proto" in
10514         ''|0) try='int drand48_r(struct drand48_data*, double*);'
10515         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
10516         esac
10517         case "$drand48_r_proto" in
10518         ''|0)   d_drand48_r=undef
10519                 drand48_r_proto=0
10520                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10521         * )     case "$drand48_r_proto" in
10522                 REENTRANT_PROTO*) ;;
10523                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
10524                 esac
10525                 echo "Prototype: $try" ;;
10526         esac
10527         ;;
10528         *)      case "$usethreads" in
10529                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
10530                 esac
10531                 d_drand48_r=undef
10532                 drand48_r_proto=0
10533                 ;;
10534         esac
10535         ;;
10536 *)      drand48_r_proto=0
10537         ;;
10538 esac
10539
10540 : see if prototype for drand48 is available
10541 echo " "
10542 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
10543 eval $hasproto
10544
10545 : see if dup2 exists
10546 set dup2 d_dup2
10547 eval $inlibc
10548
10549 : see if eaccess exists
10550 set eaccess d_eaccess
10551 eval $inlibc
10552
10553 : see if endgrent exists
10554 set endgrent d_endgrent
10555 eval $inlibc
10556
10557 : see if this is an grp system
10558 set grp.h i_grp
10559 eval $inhdr
10560
10561 case "$i_grp" in
10562 $define)
10563         xxx=`./findhdr grp.h`
10564         $cppstdin $cppflags $cppminus < $xxx >$$.h
10565
10566         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10567                 val="$define"
10568         else
10569                 val="$undef"
10570         fi
10571         set d_grpasswd
10572         eval $setvar
10573
10574         $rm -f $$.h
10575         ;;
10576 *)
10577         val="$undef";
10578         set d_grpasswd; eval $setvar
10579         ;;
10580 esac
10581
10582 : see if endgrent_r exists
10583 set endgrent_r d_endgrent_r
10584 eval $inlibc
10585 case "$d_endgrent_r" in
10586 "$define")
10587         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
10588         case "$d_endgrent_r_proto:$usethreads" in
10589         ":define")      d_endgrent_r_proto=define
10590                 set d_endgrent_r_proto endgrent_r $hdrs
10591                 eval $hasproto ;;
10592         *)      ;;
10593         esac
10594         case "$d_endgrent_r_proto" in
10595         define)
10596         case "$endgrent_r_proto" in
10597         ''|0) try='int endgrent_r(FILE**);'
10598         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
10599         esac
10600         case "$endgrent_r_proto" in
10601         ''|0) try='void endgrent_r(FILE**);'
10602         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
10603         esac
10604         case "$endgrent_r_proto" in
10605         ''|0)   d_endgrent_r=undef
10606                 endgrent_r_proto=0
10607                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10608         * )     case "$endgrent_r_proto" in
10609                 REENTRANT_PROTO*) ;;
10610                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
10611                 esac
10612                 echo "Prototype: $try" ;;
10613         esac
10614         ;;
10615         *)      case "$usethreads" in
10616                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
10617                 esac
10618                 d_endgrent_r=undef
10619                 endgrent_r_proto=0
10620                 ;;
10621         esac
10622         ;;
10623 *)      endgrent_r_proto=0
10624         ;;
10625 esac
10626
10627 : see if endhostent exists
10628 set endhostent d_endhent
10629 eval $inlibc
10630
10631 : see if this is a netdb.h system
10632 set netdb.h i_netdb
10633 eval $inhdr
10634
10635 : see if endhostent_r exists
10636 set endhostent_r d_endhostent_r
10637 eval $inlibc
10638 case "$d_endhostent_r" in
10639 "$define")
10640         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10641         case "$d_endhostent_r_proto:$usethreads" in
10642         ":define")      d_endhostent_r_proto=define
10643                 set d_endhostent_r_proto endhostent_r $hdrs
10644                 eval $hasproto ;;
10645         *)      ;;
10646         esac
10647         case "$d_endhostent_r_proto" in
10648         define)
10649         case "$endhostent_r_proto" in
10650         ''|0) try='int endhostent_r(struct hostent_data*);'
10651         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
10652         esac
10653         case "$endhostent_r_proto" in
10654         ''|0) try='void endhostent_r(struct hostent_data*);'
10655         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
10656         esac
10657         case "$endhostent_r_proto" in
10658         ''|0)   d_endhostent_r=undef
10659                 endhostent_r_proto=0
10660                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10661         * )     case "$endhostent_r_proto" in
10662                 REENTRANT_PROTO*) ;;
10663                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
10664                 esac
10665                 echo "Prototype: $try" ;;
10666         esac
10667         ;;
10668         *)      case "$usethreads" in
10669                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
10670                 esac
10671                 d_endhostent_r=undef
10672                 endhostent_r_proto=0
10673                 ;;
10674         esac
10675         ;;
10676 *)      endhostent_r_proto=0
10677         ;;
10678 esac
10679
10680 : see if endnetent exists
10681 set endnetent d_endnent
10682 eval $inlibc
10683
10684 : see if endnetent_r exists
10685 set endnetent_r d_endnetent_r
10686 eval $inlibc
10687 case "$d_endnetent_r" in
10688 "$define")
10689         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10690         case "$d_endnetent_r_proto:$usethreads" in
10691         ":define")      d_endnetent_r_proto=define
10692                 set d_endnetent_r_proto endnetent_r $hdrs
10693                 eval $hasproto ;;
10694         *)      ;;
10695         esac
10696         case "$d_endnetent_r_proto" in
10697         define)
10698         case "$endnetent_r_proto" in
10699         ''|0) try='int endnetent_r(struct netent_data*);'
10700         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
10701         esac
10702         case "$endnetent_r_proto" in
10703         ''|0) try='void endnetent_r(struct netent_data*);'
10704         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
10705         esac
10706         case "$endnetent_r_proto" in
10707         ''|0)   d_endnetent_r=undef
10708                 endnetent_r_proto=0
10709                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10710         * )     case "$endnetent_r_proto" in
10711                 REENTRANT_PROTO*) ;;
10712                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
10713                 esac
10714                 echo "Prototype: $try" ;;
10715         esac
10716         ;;
10717         *)      case "$usethreads" in
10718                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
10719                 esac
10720                 d_endnetent_r=undef
10721                 endnetent_r_proto=0
10722                 ;;
10723         esac
10724         ;;
10725 *)      endnetent_r_proto=0
10726         ;;
10727 esac
10728
10729 : see if endprotoent exists
10730 set endprotoent d_endpent
10731 eval $inlibc
10732
10733 : see if endprotoent_r exists
10734 set endprotoent_r d_endprotoent_r
10735 eval $inlibc
10736 case "$d_endprotoent_r" in
10737 "$define")
10738         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10739         case "$d_endprotoent_r_proto:$usethreads" in
10740         ":define")      d_endprotoent_r_proto=define
10741                 set d_endprotoent_r_proto endprotoent_r $hdrs
10742                 eval $hasproto ;;
10743         *)      ;;
10744         esac
10745         case "$d_endprotoent_r_proto" in
10746         define)
10747         case "$endprotoent_r_proto" in
10748         ''|0) try='int endprotoent_r(struct protoent_data*);'
10749         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
10750         esac
10751         case "$endprotoent_r_proto" in
10752         ''|0) try='void endprotoent_r(struct protoent_data*);'
10753         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
10754         esac
10755         case "$endprotoent_r_proto" in
10756         ''|0)   d_endprotoent_r=undef
10757                 endprotoent_r_proto=0
10758                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10759         * )     case "$endprotoent_r_proto" in
10760                 REENTRANT_PROTO*) ;;
10761                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
10762                 esac
10763                 echo "Prototype: $try" ;;
10764         esac
10765         ;;
10766         *)      case "$usethreads" in
10767                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
10768                 esac
10769                 d_endprotoent_r=undef
10770                 endprotoent_r_proto=0
10771                 ;;
10772         esac
10773         ;;
10774 *)      endprotoent_r_proto=0
10775         ;;
10776 esac
10777
10778 : see if endpwent exists
10779 set endpwent d_endpwent
10780 eval $inlibc
10781
10782 : see if this is a pwd.h system
10783 set pwd.h i_pwd
10784 eval $inhdr
10785
10786 case "$i_pwd" in
10787 $define)
10788         xxx=`./findhdr pwd.h`
10789         $cppstdin $cppflags $cppminus < $xxx >$$.h
10790
10791         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10792                 val="$define"
10793         else
10794                 val="$undef"
10795         fi
10796         set d_pwquota
10797         eval $setvar
10798
10799         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10800                 val="$define"
10801         else
10802                 val="$undef"
10803         fi
10804         set d_pwage
10805         eval $setvar
10806
10807         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10808                 val="$define"
10809         else
10810                 val="$undef"
10811         fi
10812         set d_pwchange
10813         eval $setvar
10814
10815         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10816                 val="$define"
10817         else
10818                 val="$undef"
10819         fi
10820         set d_pwclass
10821         eval $setvar
10822
10823         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10824                 val="$define"
10825         else
10826                 val="$undef"
10827         fi
10828         set d_pwexpire
10829         eval $setvar
10830
10831         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10832                 val="$define"
10833         else
10834                 val="$undef"
10835         fi
10836         set d_pwcomment
10837         eval $setvar
10838
10839         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10840                 val="$define"
10841         else
10842                 val="$undef"
10843         fi
10844         set d_pwgecos
10845         eval $setvar
10846
10847         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10848                 val="$define"
10849         else
10850                 val="$undef"
10851         fi
10852         set d_pwpasswd
10853         eval $setvar
10854
10855         $rm -f $$.h
10856         ;;
10857 *)
10858         val="$undef"; 
10859         set d_pwquota; eval $setvar
10860         set d_pwage; eval $setvar
10861         set d_pwchange; eval $setvar
10862         set d_pwclass; eval $setvar
10863         set d_pwexpire; eval $setvar
10864         set d_pwcomment; eval $setvar
10865         set d_pwgecos; eval $setvar
10866         set d_pwpasswd; eval $setvar
10867         ;;
10868 esac
10869
10870 : see if endpwent_r exists
10871 set endpwent_r d_endpwent_r
10872 eval $inlibc
10873 case "$d_endpwent_r" in
10874 "$define")
10875         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
10876         case "$d_endpwent_r_proto:$usethreads" in
10877         ":define")      d_endpwent_r_proto=define
10878                 set d_endpwent_r_proto endpwent_r $hdrs
10879                 eval $hasproto ;;
10880         *)      ;;
10881         esac
10882         case "$d_endpwent_r_proto" in
10883         define)
10884         case "$endpwent_r_proto" in
10885         ''|0) try='int endpwent_r(FILE**);'
10886         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
10887         esac
10888         case "$endpwent_r_proto" in
10889         ''|0) try='void endpwent_r(FILE**);'
10890         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
10891         esac
10892         case "$endpwent_r_proto" in
10893         ''|0)   d_endpwent_r=undef
10894                 endpwent_r_proto=0
10895                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10896         * )     case "$endpwent_r_proto" in
10897                 REENTRANT_PROTO*) ;;
10898                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
10899                 esac
10900                 echo "Prototype: $try" ;;
10901         esac
10902         ;;
10903         *)      case "$usethreads" in
10904                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
10905                 esac
10906                 d_endpwent_r=undef
10907                 endpwent_r_proto=0
10908                 ;;
10909         esac
10910         ;;
10911 *)      endpwent_r_proto=0
10912         ;;
10913 esac
10914
10915 : see if endservent exists
10916 set endservent d_endsent
10917 eval $inlibc
10918
10919 : see if endservent_r exists
10920 set endservent_r d_endservent_r
10921 eval $inlibc
10922 case "$d_endservent_r" in
10923 "$define")
10924         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10925         case "$d_endservent_r_proto:$usethreads" in
10926         ":define")      d_endservent_r_proto=define
10927                 set d_endservent_r_proto endservent_r $hdrs
10928                 eval $hasproto ;;
10929         *)      ;;
10930         esac
10931         case "$d_endservent_r_proto" in
10932         define)
10933         case "$endservent_r_proto" in
10934         ''|0) try='int endservent_r(struct servent_data*);'
10935         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
10936         esac
10937         case "$endservent_r_proto" in
10938         ''|0) try='void endservent_r(struct servent_data*);'
10939         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
10940         esac
10941         case "$endservent_r_proto" in
10942         ''|0)   d_endservent_r=undef
10943                 endservent_r_proto=0
10944                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10945         * )     case "$endservent_r_proto" in
10946                 REENTRANT_PROTO*) ;;
10947                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
10948                 esac
10949                 echo "Prototype: $try" ;;
10950         esac
10951         ;;
10952         *)      case "$usethreads" in
10953                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
10954                 esac
10955                 d_endservent_r=undef
10956                 endservent_r_proto=0
10957                 ;;
10958         esac
10959         ;;
10960 *)      endservent_r_proto=0
10961         ;;
10962 esac
10963
10964 : Locate the flags for 'open()'
10965 echo " "
10966 $cat >try.c <<'EOCP'
10967 #include <sys/types.h>
10968 #ifdef I_FCNTL
10969 #include <fcntl.h>
10970 #endif
10971 #ifdef I_SYS_FILE
10972 #include <sys/file.h>
10973 #endif
10974 int main() {
10975         if(O_RDONLY);
10976 #ifdef O_TRUNC
10977         exit(0);
10978 #else
10979         exit(1);
10980 #endif
10981 }
10982 EOCP
10983 : check sys/file.h first to get FREAD on Sun
10984 if $test `./findhdr sys/file.h` && \
10985                 set try -DI_SYS_FILE && eval $compile; then
10986         h_sysfile=true;
10987         echo "<sys/file.h> defines the O_* constants..." >&4
10988         if $run ./try; then
10989                 echo "and you have the 3 argument form of open()." >&4
10990                 val="$define"
10991         else
10992                 echo "but not the 3 argument form of open().  Oh, well." >&4
10993                 val="$undef"
10994         fi
10995 elif $test `./findhdr fcntl.h` && \
10996                 set try -DI_FCNTL && eval $compile; then
10997         h_fcntl=true;
10998         echo "<fcntl.h> defines the O_* constants..." >&4
10999         if $run ./try; then
11000                 echo "and you have the 3 argument form of open()." >&4
11001                 val="$define"
11002         else
11003                 echo "but not the 3 argument form of open().  Oh, well." >&4
11004                 val="$undef"
11005         fi
11006 else
11007         val="$undef"
11008         echo "I can't find the O_* constant definitions!  You got problems." >&4
11009 fi
11010 set d_open3
11011 eval $setvar
11012 $rm -f try try.*
11013
11014 : see which of string.h or strings.h is needed
11015 echo " "
11016 strings=`./findhdr string.h`
11017 if $test "$strings" && $test -r "$strings"; then
11018         echo "Using <string.h> instead of <strings.h>." >&4
11019         val="$define"
11020 else
11021         val="$undef"
11022         strings=`./findhdr strings.h`
11023         if $test "$strings" && $test -r "$strings"; then
11024                 echo "Using <strings.h> instead of <string.h>." >&4
11025         else
11026                 echo "No string header found -- You'll surely have problems." >&4
11027         fi
11028 fi
11029 set i_string
11030 eval $setvar
11031 case "$i_string" in
11032 "$undef") strings=`./findhdr strings.h`;;
11033 *)        strings=`./findhdr string.h`;;
11034 esac
11035
11036 : see if this is a sys/file.h system
11037 val=''
11038 set sys/file.h val
11039 eval $inhdr
11040
11041 : do we need to include sys/file.h ?
11042 case "$val" in
11043 "$define")
11044         echo " "
11045         if $h_sysfile; then
11046                 val="$define"
11047                 echo "We'll be including <sys/file.h>." >&4
11048         else
11049                 val="$undef"
11050                 echo "We won't be including <sys/file.h>." >&4
11051         fi
11052         ;;
11053 *)
11054         h_sysfile=false
11055         ;;
11056 esac
11057 set i_sysfile
11058 eval $setvar
11059
11060 : see if fcntl.h is there
11061 val=''
11062 set fcntl.h val
11063 eval $inhdr
11064
11065 : see if we can include fcntl.h
11066 case "$val" in
11067 "$define")
11068         echo " "
11069         if $h_fcntl; then
11070                 val="$define"
11071                 echo "We'll be including <fcntl.h>." >&4
11072         else
11073                 val="$undef"
11074                 if $h_sysfile; then
11075         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11076                 else
11077                         echo "We won't be including <fcntl.h>." >&4
11078                 fi
11079         fi
11080         ;;
11081 *)
11082         h_fcntl=false
11083         val="$undef"
11084         ;;
11085 esac
11086 set i_fcntl
11087 eval $setvar
11088
11089 : check for non-blocking I/O stuff
11090 case "$h_sysfile" in
11091 true) echo "#include <sys/file.h>" > head.c;;
11092 *)
11093        case "$h_fcntl" in
11094        true) echo "#include <fcntl.h>" > head.c;;
11095        *) echo "#include <sys/fcntl.h>" > head.c;;
11096        esac
11097        ;;
11098 esac
11099 echo " "
11100 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11101 case "$o_nonblock" in
11102 '')
11103         $cat head.c > try.c
11104         $cat >>try.c <<EOCP
11105 #include <stdio.h>
11106 #include <stdlib.h>
11107 #$i_fcntl I_FCNTL
11108 #ifdef I_FCNTL
11109 #include <fcntl.h>
11110 #endif
11111 int main() {
11112 #ifdef O_NONBLOCK
11113         printf("O_NONBLOCK\n");
11114         exit(0);
11115 #endif
11116 #ifdef O_NDELAY
11117         printf("O_NDELAY\n");
11118         exit(0);
11119 #endif
11120 #ifdef FNDELAY
11121         printf("FNDELAY\n");
11122         exit(0);
11123 #endif
11124         exit(0);
11125 }
11126 EOCP
11127         set try
11128         if eval $compile_ok; then
11129                 o_nonblock=`$run ./try`
11130                 case "$o_nonblock" in
11131                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11132                 *) echo "Seems like we can use $o_nonblock.";;
11133                 esac
11134         else
11135                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11136         fi
11137         ;;
11138 *) echo "Using $hint value $o_nonblock.";;
11139 esac
11140 $rm -f try try.* .out core
11141
11142 echo " "
11143 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11144 case "$eagain" in
11145 '')
11146         $cat head.c > try.c
11147         $cat >>try.c <<EOCP
11148 #include <errno.h>
11149 #include <sys/types.h>
11150 #include <signal.h>
11151 #include <stdio.h> 
11152 #include <stdlib.h> 
11153 #$i_fcntl I_FCNTL
11154 #ifdef I_FCNTL
11155 #include <fcntl.h>
11156 #endif
11157 #define MY_O_NONBLOCK $o_nonblock
11158 #ifndef errno  /* XXX need better Configure test */
11159 extern int errno;
11160 #endif
11161 #$i_unistd I_UNISTD
11162 #ifdef I_UNISTD
11163 #include <unistd.h>
11164 #endif
11165 #$i_string I_STRING
11166 #ifdef I_STRING
11167 #include <string.h>
11168 #else
11169 #include <strings.h>
11170 #endif
11171 $signal_t blech(x) int x; { exit(3); }
11172 EOCP
11173         $cat >> try.c <<'EOCP'
11174 int main()
11175 {
11176         int pd[2];
11177         int pu[2];
11178         char buf[1];
11179         char string[100];
11180
11181         pipe(pd);       /* Down: child -> parent */
11182         pipe(pu);       /* Up: parent -> child */
11183         if (0 != fork()) {
11184                 int ret;
11185                 close(pd[1]);   /* Parent reads from pd[0] */
11186                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11187 #ifdef F_SETFL
11188                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11189                         exit(1);
11190 #else
11191                 exit(4);
11192 #endif
11193                 signal(SIGALRM, blech);
11194                 alarm(5);
11195                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11196                         exit(2);
11197                 sprintf(string, "%d\n", ret);
11198                 write(2, string, strlen(string));
11199                 alarm(0);
11200 #ifdef EAGAIN
11201                 if (errno == EAGAIN) {
11202                         printf("EAGAIN\n");
11203                         goto ok;
11204                 }
11205 #endif
11206 #ifdef EWOULDBLOCK
11207                 if (errno == EWOULDBLOCK)
11208                         printf("EWOULDBLOCK\n");
11209 #endif
11210         ok:
11211                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11212                 sleep(2);                               /* Give it time to close our pipe */
11213                 alarm(5);
11214                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11215                 alarm(0);
11216                 sprintf(string, "%d\n", ret);
11217                 write(4, string, strlen(string));
11218                 exit(0);
11219         }
11220
11221         close(pd[0]);                   /* We write to pd[1] */
11222         close(pu[1]);                   /* We read from pu[0] */
11223         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11224         close(pd[1]);                   /* Pipe pd is now fully closed! */
11225         exit(0);                                /* Bye bye, thank you for playing! */
11226 }
11227 EOCP
11228         set try
11229         if eval $compile_ok; then
11230                 echo "$startsh" >mtry
11231                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11232                 chmod +x mtry
11233                 ./mtry >/dev/null 2>&1
11234                 case $? in
11235                 0) eagain=`$cat try.out`;;
11236                 1) echo "Could not perform non-blocking setting!";;
11237                 2) echo "I did a successful read() for something that was not there!";;
11238                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11239                 4) echo "Could not find F_SETFL!";;
11240                 *) echo "Something terribly wrong happened during testing.";;
11241                 esac
11242                 rd_nodata=`$cat try.ret`
11243                 echo "A read() system call with no data present returns $rd_nodata."
11244                 case "$rd_nodata" in
11245                 0|-1) ;;
11246                 *)
11247                         echo "(That's peculiar, fixing that to be -1.)"
11248                         rd_nodata=-1
11249                         ;;
11250                 esac
11251                 case "$eagain" in
11252                 '')
11253                         echo "Forcing errno EAGAIN on read() with no data available."
11254                         eagain=EAGAIN
11255                         ;;
11256                 *)
11257                         echo "Your read() sets errno to $eagain when no data is available."
11258                         ;;
11259                 esac
11260                 status=`$cat try.err`
11261                 case "$status" in
11262                 0) echo "And it correctly returns 0 to signal EOF.";;
11263                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11264                 *) echo "However, your read() returns '$status' on EOF??";;
11265                 esac
11266                 val="$define"
11267                 if test "$status" = "$rd_nodata"; then
11268                         echo "WARNING: you can't distinguish between EOF and no data!"
11269                         val="$undef"
11270                 fi
11271         else
11272                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11273                 eagain=EAGAIN
11274         fi
11275         set d_eofnblk
11276         eval $setvar
11277         ;;
11278 *)
11279         echo "Using $hint value $eagain."
11280         echo "Your read() returns $rd_nodata when no data is present."
11281         case "$d_eofnblk" in
11282         "$define") echo "And you can see EOF because read() returns 0.";;
11283         "$undef") echo "But you can't see EOF status from read() returned value.";;
11284         *)
11285                 echo "(Assuming you can't see EOF status from read anyway.)"
11286                 d_eofnblk=$undef
11287                 ;;
11288         esac
11289         ;;
11290 esac
11291 $rm -f try try.* .out core head.c mtry
11292
11293 : see if fchdir exists
11294 set fchdir d_fchdir
11295 eval $inlibc
11296
11297 : see if fchmod exists
11298 set fchmod d_fchmod
11299 eval $inlibc
11300
11301 : see if fchown exists
11302 set fchown d_fchown
11303 eval $inlibc
11304
11305 : see if this is an fcntl system
11306 set fcntl d_fcntl
11307 eval $inlibc
11308
11309 echo " "
11310 : See if fcntl-based locking works.
11311 $cat >try.c <<EOCP
11312 #include <stdlib.h>
11313 #include <unistd.h>
11314 #include <fcntl.h>
11315 #include <signal.h>
11316 $signal_t blech(x) int x; { exit(3); }
11317 int main() {
11318 #if defined(F_SETLK) && defined(F_SETLKW)
11319      struct flock flock;
11320      int retval, fd;
11321      fd = open("try.c", O_RDONLY);
11322      flock.l_type = F_RDLCK;
11323      flock.l_whence = SEEK_SET;
11324      flock.l_start = flock.l_len = 0;
11325      signal(SIGALRM, blech);
11326      alarm(10);
11327      retval = fcntl(fd, F_SETLK, &flock);
11328      close(fd);
11329      (retval < 0 ? exit(2) : exit(0));
11330 #else
11331      exit(2);
11332 #endif
11333 }
11334 EOCP
11335 echo "Checking if fcntl-based file locking works... "
11336 case "$d_fcntl" in
11337 "$define")
11338         set try
11339         if eval $compile_ok; then
11340                 if $run ./try; then
11341                         echo "Yes, it seems to work."
11342                         val="$define"
11343                 else
11344                         echo "Nope, it didn't work."
11345                         val="$undef"
11346                         case "$?" in
11347                         3) $cat >&4 <<EOM
11348 ***
11349 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
11350 *** This is (almost) impossible.
11351 *** If your NFS lock daemons are not feeling well, something like
11352 *** this may happen, please investigate.  Cannot continue, aborting.
11353 ***
11354 EOM
11355                                 exit 1
11356                                 ;;
11357                         esac
11358                 fi
11359         else
11360                 echo "I'm unable to compile the test program, so I'll assume not."
11361                 val="$undef"
11362         fi
11363         ;;
11364 *) val="$undef";
11365         echo "Nope, since you don't even have fcntl()."
11366         ;;
11367 esac
11368 set d_fcntl_can_lock
11369 eval $setvar
11370 $rm -f try*
11371
11372
11373 : check for fd_set items
11374 $cat <<EOM
11375
11376 Checking to see how well your C compiler handles fd_set and friends ...
11377 EOM
11378 $cat >try.c <<EOCP
11379 #$i_systime I_SYS_TIME
11380 #$i_sysselct I_SYS_SELECT
11381 #$d_socket HAS_SOCKET
11382 #include <sys/types.h>
11383 #ifdef HAS_SOCKET
11384 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
11385 #endif
11386 #ifdef I_SYS_TIME
11387 #include <sys/time.h>
11388 #endif
11389 #ifdef I_SYS_SELECT
11390 #include <sys/select.h>
11391 #endif
11392 int main() {
11393         fd_set fds;
11394
11395 #ifdef TRYBITS
11396         if(fds.fds_bits);
11397 #endif
11398
11399 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
11400         exit(0);
11401 #else
11402         exit(1);
11403 #endif
11404 }
11405 EOCP
11406 set try -DTRYBITS
11407 if eval $compile; then
11408         d_fds_bits="$define"
11409         d_fd_set="$define"
11410         echo "Well, your system knows about the normal fd_set typedef..." >&4
11411         if $run ./try; then
11412                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
11413                 d_fd_macros="$define"
11414         else
11415                 $cat >&4 <<'EOM'
11416 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
11417 EOM
11418                 d_fd_macros="$undef"
11419         fi
11420 else
11421         $cat <<'EOM'
11422 Hmm, your compiler has some difficulty with fd_set.  Checking further...
11423 EOM
11424         set try
11425         if eval $compile; then
11426                 d_fds_bits="$undef"
11427                 d_fd_set="$define"
11428                 echo "Well, your system has some sort of fd_set available..." >&4
11429                 if $run ./try; then
11430                         echo "and you have the normal fd_set macros." >&4
11431                         d_fd_macros="$define"
11432                 else
11433                         $cat <<'EOM'
11434 but not the normal fd_set macros!  Gross!  More work for me...
11435 EOM
11436                         d_fd_macros="$undef"
11437                 fi
11438         else
11439         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
11440                 d_fd_set="$undef"
11441                 d_fds_bits="$undef"
11442                 d_fd_macros="$undef"
11443         fi
11444 fi
11445 $rm -f try try.*
11446
11447 : see if fgetpos exists
11448 set fgetpos d_fgetpos
11449 eval $inlibc
11450
11451 : see if finite exists
11452 set finite d_finite
11453 eval $inlibc
11454
11455 : see if finitel exists
11456 set finitel d_finitel
11457 eval $inlibc
11458
11459 : see if flock exists
11460 set flock d_flock
11461 eval $inlibc
11462
11463 : see if prototype for flock is available
11464 echo " "
11465 set d_flockproto flock $i_sysfile sys/file.h
11466 eval $hasproto
11467
11468 : see if fork exists
11469 set fork d_fork
11470 eval $inlibc
11471
11472 : see if fp_class exists
11473 set fp_class d_fp_class
11474 eval $inlibc
11475
11476 : see if pathconf exists
11477 set pathconf d_pathconf
11478 eval $inlibc
11479
11480 : see if fpathconf exists
11481 set fpathconf d_fpathconf
11482 eval $inlibc
11483
11484 : see if fpclass exists
11485 set fpclass d_fpclass
11486 eval $inlibc
11487
11488 : see if fpclassify exists
11489 set fpclassify d_fpclassify
11490 eval $inlibc
11491
11492 : see if fpclassl exists
11493 set fpclassl d_fpclassl
11494 eval $inlibc
11495
11496
11497 : check for fpos64_t
11498 echo " "
11499 echo "Checking to see if you have fpos64_t..." >&4
11500 $cat >try.c <<EOCP
11501 #include <stdio.h>
11502 int main() { fpos64_t x = 7; }
11503 EOCP
11504 set try
11505 if eval $compile; then
11506         val="$define"
11507         echo "You have fpos64_t."
11508 else
11509         val="$undef"
11510         echo "You do not have fpos64_t."
11511         case "$fpossize" in
11512         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
11513         esac
11514 fi
11515 $rm -f try.* try
11516 set d_fpos64_t
11517 eval $setvar
11518
11519 : see if frexpl exists
11520 set frexpl d_frexpl
11521 eval $inlibc
11522
11523 : see if this is a sys/param system
11524 set sys/param.h i_sysparam
11525 eval $inhdr
11526
11527 : see if this is a sys/mount.h system
11528 set sys/mount.h i_sysmount
11529 eval $inhdr
11530
11531
11532 echo " "
11533 echo "Checking to see if your system supports struct fs_data..." >&4
11534 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
11535 eval $hasstruct
11536 case "$d_fs_data_s" in
11537 "$define")      echo "Yes, it does."   ;;
11538 *)              echo "No, it doesn't." ;;
11539 esac
11540
11541 : see if fseeko exists
11542 set fseeko d_fseeko
11543 eval $inlibc
11544 case "$longsize" in
11545 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
11546 esac
11547
11548 : see if fsetpos exists
11549 set fsetpos d_fsetpos
11550 eval $inlibc
11551
11552
11553 : see if fstatfs exists
11554 set fstatfs d_fstatfs
11555 eval $inlibc
11556
11557
11558 : see if statvfs exists
11559 set statvfs d_statvfs
11560 eval $inlibc
11561
11562 : see if fstatvfs exists
11563 set fstatvfs d_fstatvfs
11564 eval $inlibc
11565
11566
11567 : see if fsync exists
11568 set fsync d_fsync
11569 eval $inlibc
11570
11571 : see if ftello exists
11572 set ftello d_ftello
11573 eval $inlibc
11574 case "$longsize" in
11575 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
11576 esac
11577
11578 : see if getcwd exists
11579 set getcwd d_getcwd
11580 eval $inlibc
11581
11582 : see if getespwnam exists
11583 set getespwnam d_getespwnam
11584 eval $inlibc
11585
11586
11587 : see if getfsstat exists
11588 set getfsstat d_getfsstat
11589 eval $inlibc
11590
11591 : see if getgrent exists
11592 set getgrent d_getgrent
11593 eval $inlibc
11594
11595 : see if getgrent_r exists
11596 set getgrent_r d_getgrent_r
11597 eval $inlibc
11598 case "$d_getgrent_r" in
11599 "$define")
11600         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11601         case "$d_getgrent_r_proto:$usethreads" in
11602         ":define")      d_getgrent_r_proto=define
11603                 set d_getgrent_r_proto getgrent_r $hdrs
11604                 eval $hasproto ;;
11605         *)      ;;
11606         esac
11607         case "$d_getgrent_r_proto" in
11608         define)
11609         case "$getgrent_r_proto" in
11610         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
11611         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
11612         esac
11613         case "$getgrent_r_proto" in
11614         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
11615         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
11616         esac
11617         case "$getgrent_r_proto" in
11618         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
11619         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
11620         esac
11621         case "$getgrent_r_proto" in
11622         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
11623         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
11624         esac
11625         case "$getgrent_r_proto" in
11626         ''|0) try='int getgrent_r(struct group*, char*, int);'
11627         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
11628         esac
11629         case "$getgrent_r_proto" in
11630         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
11631         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
11632         esac
11633         case "$getgrent_r_proto" in
11634         ''|0)   d_getgrent_r=undef
11635                 getgrent_r_proto=0
11636                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
11637         * )     case "$getgrent_r_proto" in
11638                 REENTRANT_PROTO*) ;;
11639                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
11640                 esac
11641                 echo "Prototype: $try" ;;
11642         esac
11643         ;;
11644         *)      case "$usethreads" in
11645                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
11646                 esac
11647                 d_getgrent_r=undef
11648                 getgrent_r_proto=0
11649                 ;;
11650         esac
11651         ;;
11652 *)      getgrent_r_proto=0
11653         ;;
11654 esac
11655
11656 : see if getgrgid_r exists
11657 set getgrgid_r d_getgrgid_r
11658 eval $inlibc
11659 case "$d_getgrgid_r" in
11660 "$define")
11661         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11662         case "$d_getgrgid_r_proto:$usethreads" in
11663         ":define")      d_getgrgid_r_proto=define
11664                 set d_getgrgid_r_proto getgrgid_r $hdrs
11665                 eval $hasproto ;;
11666         *)      ;;
11667         esac
11668         case "$d_getgrgid_r_proto" in
11669         define)
11670         case "$getgrgid_r_proto" in
11671         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
11672         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
11673         esac
11674         case "$getgrgid_r_proto" in
11675         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
11676         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
11677         esac
11678         case "$getgrgid_r_proto" in
11679         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
11680         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
11681         esac
11682         case "$getgrgid_r_proto" in
11683         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
11684         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
11685         esac
11686         case "$getgrgid_r_proto" in
11687         ''|0)   d_getgrgid_r=undef
11688                 getgrgid_r_proto=0
11689                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
11690         * )     case "$getgrgid_r_proto" in
11691                 REENTRANT_PROTO*) ;;
11692                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
11693                 esac
11694                 echo "Prototype: $try" ;;
11695         esac
11696         ;;
11697         *)      case "$usethreads" in
11698                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
11699                 esac
11700                 d_getgrgid_r=undef
11701                 getgrgid_r_proto=0
11702                 ;;
11703         esac
11704         ;;
11705 *)      getgrgid_r_proto=0
11706         ;;
11707 esac
11708
11709 : see if getgrnam_r exists
11710 set getgrnam_r d_getgrnam_r
11711 eval $inlibc
11712 case "$d_getgrnam_r" in
11713 "$define")
11714         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11715         case "$d_getgrnam_r_proto:$usethreads" in
11716         ":define")      d_getgrnam_r_proto=define
11717                 set d_getgrnam_r_proto getgrnam_r $hdrs
11718                 eval $hasproto ;;
11719         *)      ;;
11720         esac
11721         case "$d_getgrnam_r_proto" in
11722         define)
11723         case "$getgrnam_r_proto" in
11724         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
11725         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
11726         esac
11727         case "$getgrnam_r_proto" in
11728         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
11729         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
11730         esac
11731         case "$getgrnam_r_proto" in
11732         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
11733         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
11734         esac
11735         case "$getgrnam_r_proto" in
11736         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
11737         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
11738         esac
11739         case "$getgrnam_r_proto" in
11740         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
11741         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
11742         esac
11743         case "$getgrnam_r_proto" in
11744         ''|0)   d_getgrnam_r=undef
11745                 getgrnam_r_proto=0
11746                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
11747         * )     case "$getgrnam_r_proto" in
11748                 REENTRANT_PROTO*) ;;
11749                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
11750                 esac
11751                 echo "Prototype: $try" ;;
11752         esac
11753         ;;
11754         *)      case "$usethreads" in
11755                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
11756                 esac
11757                 d_getgrnam_r=undef
11758                 getgrnam_r_proto=0
11759                 ;;
11760         esac
11761         ;;
11762 *)      getgrnam_r_proto=0
11763         ;;
11764 esac
11765
11766 : see if gethostbyaddr exists
11767 set gethostbyaddr d_gethbyaddr
11768 eval $inlibc
11769
11770 : see if gethostbyname exists
11771 set gethostbyname d_gethbyname
11772 eval $inlibc
11773
11774 : see if gethostent exists
11775 set gethostent d_gethent
11776 eval $inlibc
11777
11778 : see how we will look up host name
11779 echo " "
11780 call=''
11781 if set gethostname val -f d_gethname; eval $csym; $val; then
11782         echo 'gethostname() found.' >&4
11783         d_gethname="$define"
11784         call=gethostname
11785 fi
11786 if set uname val -f d_uname; eval $csym; $val; then
11787         if ./xenix; then
11788                 $cat <<'EOM'
11789 uname() was found, but you're running xenix, and older versions of xenix
11790 have a broken uname(). If you don't really know whether your xenix is old
11791 enough to have a broken system call, use the default answer.
11792
11793 EOM
11794                 dflt=y
11795                 case "$d_uname" in
11796                 "$define") dflt=n;;
11797                 esac
11798                 rp='Is your uname() broken?'
11799                 . ./myread
11800                 case "$ans" in
11801                 n*) d_uname="$define"; call=uname;;
11802                 esac
11803         else
11804                 echo 'uname() found.' >&4
11805                 d_uname="$define"
11806                 case "$call" in
11807                 '') call=uname ;;
11808                 esac
11809         fi
11810 fi
11811 case "$d_gethname" in
11812 '') d_gethname="$undef";;
11813 esac
11814 case "$d_uname" in
11815 '') d_uname="$undef";;
11816 esac
11817 case "$d_uname$d_gethname" in
11818 *define*)
11819         dflt=n
11820         cat <<EOM
11821  
11822 Every now and then someone has a $call() that lies about the hostname
11823 but can't be fixed for political or economic reasons.  If you wish, I can
11824 pretend $call() isn't there and maybe compute hostname at run-time
11825 thanks to the '$phostname' command.
11826
11827 EOM
11828         rp="Shall I ignore $call() from now on?"
11829         . ./myread
11830         case "$ans" in
11831         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
11832         esac;;
11833 esac
11834 case "$phostname" in
11835 '') aphostname='';;
11836 *) case "$aphostname" in
11837         /*) ;;
11838         *) set X $phostname
11839                 shift
11840                 file=$1
11841                 shift
11842                 file=`./loc $file $file $pth`
11843                 aphostname=`echo $file $*`
11844                 ;;
11845         esac
11846         ;;
11847 esac
11848 case "$d_uname$d_gethname" in
11849 *define*) ;;
11850 *)
11851         case "$phostname" in
11852         '')
11853                 echo "There will be no way for $package to get your hostname." >&4;;
11854         *)
11855         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
11856                 ;;
11857         esac;;
11858 esac
11859 case "$d_phostname" in
11860 '') d_phostname="$undef";;
11861 esac
11862
11863 : see if gethostbyaddr_r exists
11864 set gethostbyaddr_r d_gethostbyaddr_r
11865 eval $inlibc
11866 case "$d_gethostbyaddr_r" in
11867 "$define")
11868         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11869         case "$d_gethostbyaddr_r_proto:$usethreads" in
11870         ":define")      d_gethostbyaddr_r_proto=define
11871                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
11872                 eval $hasproto ;;
11873         *)      ;;
11874         esac
11875         case "$d_gethostbyaddr_r_proto" in
11876         define)
11877         case "$gethostbyaddr_r_proto" in
11878         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
11879         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
11880         esac
11881         case "$gethostbyaddr_r_proto" in
11882         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
11883         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
11884         esac
11885         case "$gethostbyaddr_r_proto" in
11886         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
11887         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
11888         esac
11889         case "$gethostbyaddr_r_proto" in
11890         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
11891         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
11892         esac
11893         case "$gethostbyaddr_r_proto" in
11894         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
11895         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
11896         esac
11897         case "$gethostbyaddr_r_proto" in
11898         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
11899         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
11900         esac
11901         case "$gethostbyaddr_r_proto" in
11902         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
11903         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
11904         esac
11905         case "$gethostbyaddr_r_proto" in
11906         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
11907         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
11908         esac
11909         case "$gethostbyaddr_r_proto" in
11910         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
11911         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
11912         esac
11913         case "$gethostbyaddr_r_proto" in
11914         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
11915         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
11916         esac
11917         case "$gethostbyaddr_r_proto" in
11918         ''|0)   d_gethostbyaddr_r=undef
11919                 gethostbyaddr_r_proto=0
11920                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
11921         * )     case "$gethostbyaddr_r_proto" in
11922                 REENTRANT_PROTO*) ;;
11923                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
11924                 esac
11925                 echo "Prototype: $try" ;;
11926         esac
11927         ;;
11928         *)      case "$usethreads" in
11929                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
11930                 esac
11931                 d_gethostbyaddr_r=undef
11932                 gethostbyaddr_r_proto=0
11933                 ;;
11934         esac
11935         ;;
11936 *)      gethostbyaddr_r_proto=0
11937         ;;
11938 esac
11939
11940 : see if gethostbyname_r exists
11941 set gethostbyname_r d_gethostbyname_r
11942 eval $inlibc
11943 case "$d_gethostbyname_r" in
11944 "$define")
11945         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11946         case "$d_gethostbyname_r_proto:$usethreads" in
11947         ":define")      d_gethostbyname_r_proto=define
11948                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
11949                 eval $hasproto ;;
11950         *)      ;;
11951         esac
11952         case "$d_gethostbyname_r_proto" in
11953         define)
11954         case "$gethostbyname_r_proto" in
11955         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
11956         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
11957         esac
11958         case "$gethostbyname_r_proto" in
11959         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
11960         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
11961         esac
11962         case "$gethostbyname_r_proto" in
11963         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
11964         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
11965         esac
11966         case "$gethostbyname_r_proto" in
11967         ''|0)   d_gethostbyname_r=undef
11968                 gethostbyname_r_proto=0
11969                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
11970         * )     case "$gethostbyname_r_proto" in
11971                 REENTRANT_PROTO*) ;;
11972                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
11973                 esac
11974                 echo "Prototype: $try" ;;
11975         esac
11976         ;;
11977         *)      case "$usethreads" in
11978                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
11979                 esac
11980                 d_gethostbyname_r=undef
11981                 gethostbyname_r_proto=0
11982                 ;;
11983         esac
11984         ;;
11985 *)      gethostbyname_r_proto=0
11986         ;;
11987 esac
11988
11989 : see if gethostent_r exists
11990 set gethostent_r d_gethostent_r
11991 eval $inlibc
11992 case "$d_gethostent_r" in
11993 "$define")
11994         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11995         case "$d_gethostent_r_proto:$usethreads" in
11996         ":define")      d_gethostent_r_proto=define
11997                 set d_gethostent_r_proto gethostent_r $hdrs
11998                 eval $hasproto ;;
11999         *)      ;;
12000         esac
12001         case "$d_gethostent_r_proto" in
12002         define)
12003         case "$gethostent_r_proto" in
12004         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
12005         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
12006         esac
12007         case "$gethostent_r_proto" in
12008         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
12009         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
12010         esac
12011         case "$gethostent_r_proto" in
12012         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
12013         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
12014         esac
12015         case "$gethostent_r_proto" in
12016         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
12017         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
12018         esac
12019         case "$gethostent_r_proto" in
12020         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
12021         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
12022         esac
12023         case "$gethostent_r_proto" in
12024         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
12025         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
12026         esac
12027         case "$gethostent_r_proto" in
12028         ''|0)   d_gethostent_r=undef
12029                 gethostent_r_proto=0
12030                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
12031         * )     case "$gethostent_r_proto" in
12032                 REENTRANT_PROTO*) ;;
12033                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
12034                 esac
12035                 echo "Prototype: $try" ;;
12036         esac
12037         ;;
12038         *)      case "$usethreads" in
12039                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
12040                 esac
12041                 d_gethostent_r=undef
12042                 gethostent_r_proto=0
12043                 ;;
12044         esac
12045         ;;
12046 *)      gethostent_r_proto=0
12047         ;;
12048 esac
12049
12050 : see if prototypes for various gethostxxx netdb.h functions are available
12051 echo " "
12052 set d_gethostprotos gethostent $i_netdb netdb.h
12053 eval $hasproto
12054
12055 : see if getitimer exists
12056 set getitimer d_getitimer
12057 eval $inlibc
12058
12059 : see if getlogin exists
12060 set getlogin d_getlogin
12061 eval $inlibc
12062
12063 : see if getlogin_r exists
12064 set getlogin_r d_getlogin_r
12065 eval $inlibc
12066 case "$d_getlogin_r" in
12067 "$define")
12068         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
12069         case "$d_getlogin_r_proto:$usethreads" in
12070         ":define")      d_getlogin_r_proto=define
12071                 set d_getlogin_r_proto getlogin_r $hdrs
12072                 eval $hasproto ;;
12073         *)      ;;
12074         esac
12075         case "$d_getlogin_r_proto" in
12076         define)
12077         case "$getlogin_r_proto" in
12078         ''|0) try='int getlogin_r(char*, size_t);'
12079         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
12080         esac
12081         case "$getlogin_r_proto" in
12082         ''|0) try='int getlogin_r(char*, int);'
12083         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
12084         esac
12085         case "$getlogin_r_proto" in
12086         ''|0) try='char* getlogin_r(char*, size_t);'
12087         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
12088         esac
12089         case "$getlogin_r_proto" in
12090         ''|0) try='char* getlogin_r(char*, int);'
12091         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
12092         esac
12093         case "$getlogin_r_proto" in
12094         ''|0)   d_getlogin_r=undef
12095                 getlogin_r_proto=0
12096                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
12097         * )     case "$getlogin_r_proto" in
12098                 REENTRANT_PROTO*) ;;
12099                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
12100                 esac
12101                 echo "Prototype: $try" ;;
12102         esac
12103         ;;
12104         *)      case "$usethreads" in
12105                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
12106                 esac
12107                 d_getlogin_r=undef
12108                 getlogin_r_proto=0
12109                 ;;
12110         esac
12111         ;;
12112 *)      getlogin_r_proto=0
12113         ;;
12114 esac
12115
12116 : see if getmnt exists
12117 set getmnt d_getmnt
12118 eval $inlibc
12119
12120 : see if getmntent exists
12121 set getmntent d_getmntent
12122 eval $inlibc
12123
12124 : see if getnetbyaddr exists
12125 set getnetbyaddr d_getnbyaddr
12126 eval $inlibc
12127
12128 : see if getnetbyname exists
12129 set getnetbyname d_getnbyname
12130 eval $inlibc
12131
12132 : see if getnetent exists
12133 set getnetent d_getnent
12134 eval $inlibc
12135
12136 : see if getnetbyaddr_r exists
12137 set getnetbyaddr_r d_getnetbyaddr_r
12138 eval $inlibc
12139 case "$d_getnetbyaddr_r" in
12140 "$define")
12141         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12142         case "$d_getnetbyaddr_r_proto:$usethreads" in
12143         ":define")      d_getnetbyaddr_r_proto=define
12144                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
12145                 eval $hasproto ;;
12146         *)      ;;
12147         esac
12148         case "$d_getnetbyaddr_r_proto" in
12149         define)
12150         case "$getnetbyaddr_r_proto" in
12151         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
12152         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
12153         esac
12154         case "$getnetbyaddr_r_proto" in
12155         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
12156         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
12157         esac
12158         case "$getnetbyaddr_r_proto" in
12159         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
12160         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
12161         esac
12162         case "$getnetbyaddr_r_proto" in
12163         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
12164         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
12165         esac
12166         case "$getnetbyaddr_r_proto" in
12167         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
12168         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
12169         esac
12170         case "$getnetbyaddr_r_proto" in
12171         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
12172         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
12173         esac
12174         case "$getnetbyaddr_r_proto" in
12175         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
12176         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
12177         esac
12178         case "$getnetbyaddr_r_proto" in
12179         ''|0)   d_getnetbyaddr_r=undef
12180                 getnetbyaddr_r_proto=0
12181                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
12182         * )     case "$getnetbyaddr_r_proto" in
12183                 REENTRANT_PROTO*) ;;
12184                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
12185                 esac
12186                 echo "Prototype: $try" ;;
12187         esac
12188         ;;
12189         *)      case "$usethreads" in
12190                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
12191                 esac
12192                 d_getnetbyaddr_r=undef
12193                 getnetbyaddr_r_proto=0
12194                 ;;
12195         esac
12196         ;;
12197 *)      getnetbyaddr_r_proto=0
12198         ;;
12199 esac
12200
12201 : see if getnetbyname_r exists
12202 set getnetbyname_r d_getnetbyname_r
12203 eval $inlibc
12204 case "$d_getnetbyname_r" in
12205 "$define")
12206         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12207         case "$d_getnetbyname_r_proto:$usethreads" in
12208         ":define")      d_getnetbyname_r_proto=define
12209                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
12210                 eval $hasproto ;;
12211         *)      ;;
12212         esac
12213         case "$d_getnetbyname_r_proto" in
12214         define)
12215         case "$getnetbyname_r_proto" in
12216         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
12217         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
12218         esac
12219         case "$getnetbyname_r_proto" in
12220         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
12221         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
12222         esac
12223         case "$getnetbyname_r_proto" in
12224         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
12225         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
12226         esac
12227         case "$getnetbyname_r_proto" in
12228         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
12229         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
12230         esac
12231         case "$getnetbyname_r_proto" in
12232         ''|0)   d_getnetbyname_r=undef
12233                 getnetbyname_r_proto=0
12234                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
12235         * )     case "$getnetbyname_r_proto" in
12236                 REENTRANT_PROTO*) ;;
12237                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
12238                 esac
12239                 echo "Prototype: $try" ;;
12240         esac
12241         ;;
12242         *)      case "$usethreads" in
12243                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
12244                 esac
12245                 d_getnetbyname_r=undef
12246                 getnetbyname_r_proto=0
12247                 ;;
12248         esac
12249         ;;
12250 *)      getnetbyname_r_proto=0
12251         ;;
12252 esac
12253
12254 : see if getnetent_r exists
12255 set getnetent_r d_getnetent_r
12256 eval $inlibc
12257 case "$d_getnetent_r" in
12258 "$define")
12259         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12260         case "$d_getnetent_r_proto:$usethreads" in
12261         ":define")      d_getnetent_r_proto=define
12262                 set d_getnetent_r_proto getnetent_r $hdrs
12263                 eval $hasproto ;;
12264         *)      ;;
12265         esac
12266         case "$d_getnetent_r_proto" in
12267         define)
12268         case "$getnetent_r_proto" in
12269         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
12270         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
12271         esac
12272         case "$getnetent_r_proto" in
12273         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
12274         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
12275         esac
12276         case "$getnetent_r_proto" in
12277         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
12278         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
12279         esac
12280         case "$getnetent_r_proto" in
12281         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
12282         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
12283         esac
12284         case "$getnetent_r_proto" in
12285         ''|0) try='int getnetent_r(struct netent*, char*, int);'
12286         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
12287         esac
12288         case "$getnetent_r_proto" in
12289         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
12290         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
12291         esac
12292         case "$getnetent_r_proto" in
12293         ''|0)   d_getnetent_r=undef
12294                 getnetent_r_proto=0
12295                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
12296         * )     case "$getnetent_r_proto" in
12297                 REENTRANT_PROTO*) ;;
12298                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
12299                 esac
12300                 echo "Prototype: $try" ;;
12301         esac
12302         ;;
12303         *)      case "$usethreads" in
12304                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
12305                 esac
12306                 d_getnetent_r=undef
12307                 getnetent_r_proto=0
12308                 ;;
12309         esac
12310         ;;
12311 *)      getnetent_r_proto=0
12312         ;;
12313 esac
12314
12315 : see if prototypes for various getnetxxx netdb.h functions are available
12316 echo " "
12317 set d_getnetprotos getnetent $i_netdb netdb.h
12318 eval $hasproto
12319
12320 : see if getpagesize exists
12321 set getpagesize d_getpagsz
12322 eval $inlibc
12323
12324
12325 : see if getprotobyname exists
12326 set getprotobyname d_getpbyname
12327 eval $inlibc
12328
12329 : see if getprotobynumber exists
12330 set getprotobynumber d_getpbynumber
12331 eval $inlibc
12332
12333 : see if getprotoent exists
12334 set getprotoent d_getpent
12335 eval $inlibc
12336
12337 : see if getpgid exists
12338 set getpgid d_getpgid
12339 eval $inlibc
12340
12341 : see if getpgrp2 exists
12342 set getpgrp2 d_getpgrp2
12343 eval $inlibc
12344
12345 : see if getppid exists
12346 set getppid d_getppid
12347 eval $inlibc
12348
12349 : see if getpriority exists
12350 set getpriority d_getprior
12351 eval $inlibc
12352
12353 : see if getprotobyname_r exists
12354 set getprotobyname_r d_getprotobyname_r
12355 eval $inlibc
12356 case "$d_getprotobyname_r" in
12357 "$define")
12358         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12359         case "$d_getprotobyname_r_proto:$usethreads" in
12360         ":define")      d_getprotobyname_r_proto=define
12361                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
12362                 eval $hasproto ;;
12363         *)      ;;
12364         esac
12365         case "$d_getprotobyname_r_proto" in
12366         define)
12367         case "$getprotobyname_r_proto" in
12368         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
12369         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
12370         esac
12371         case "$getprotobyname_r_proto" in
12372         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
12373         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
12374         esac
12375         case "$getprotobyname_r_proto" in
12376         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
12377         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
12378         esac
12379         case "$getprotobyname_r_proto" in
12380         ''|0)   d_getprotobyname_r=undef
12381                 getprotobyname_r_proto=0
12382                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
12383         * )     case "$getprotobyname_r_proto" in
12384                 REENTRANT_PROTO*) ;;
12385                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
12386                 esac
12387                 echo "Prototype: $try" ;;
12388         esac
12389         ;;
12390         *)      case "$usethreads" in
12391                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
12392                 esac
12393                 d_getprotobyname_r=undef
12394                 getprotobyname_r_proto=0
12395                 ;;
12396         esac
12397         ;;
12398 *)      getprotobyname_r_proto=0
12399         ;;
12400 esac
12401
12402 : see if getprotobynumber_r exists
12403 set getprotobynumber_r d_getprotobynumber_r
12404 eval $inlibc
12405 case "$d_getprotobynumber_r" in
12406 "$define")
12407         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12408         case "$d_getprotobynumber_r_proto:$usethreads" in
12409         ":define")      d_getprotobynumber_r_proto=define
12410                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
12411                 eval $hasproto ;;
12412         *)      ;;
12413         esac
12414         case "$d_getprotobynumber_r_proto" in
12415         define)
12416         case "$getprotobynumber_r_proto" in
12417         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
12418         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
12419         esac
12420         case "$getprotobynumber_r_proto" in
12421         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
12422         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
12423         esac
12424         case "$getprotobynumber_r_proto" in
12425         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
12426         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
12427         esac
12428         case "$getprotobynumber_r_proto" in
12429         ''|0)   d_getprotobynumber_r=undef
12430                 getprotobynumber_r_proto=0
12431                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
12432         * )     case "$getprotobynumber_r_proto" in
12433                 REENTRANT_PROTO*) ;;
12434                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
12435                 esac
12436                 echo "Prototype: $try" ;;
12437         esac
12438         ;;
12439         *)      case "$usethreads" in
12440                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
12441                 esac
12442                 d_getprotobynumber_r=undef
12443                 getprotobynumber_r_proto=0
12444                 ;;
12445         esac
12446         ;;
12447 *)      getprotobynumber_r_proto=0
12448         ;;
12449 esac
12450
12451 : see if getprotoent_r exists
12452 set getprotoent_r d_getprotoent_r
12453 eval $inlibc
12454 case "$d_getprotoent_r" in
12455 "$define")
12456         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12457         case "$d_getprotoent_r_proto:$usethreads" in
12458         ":define")      d_getprotoent_r_proto=define
12459                 set d_getprotoent_r_proto getprotoent_r $hdrs
12460                 eval $hasproto ;;
12461         *)      ;;
12462         esac
12463         case "$d_getprotoent_r_proto" in
12464         define)
12465         case "$getprotoent_r_proto" in
12466         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
12467         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
12468         esac
12469         case "$getprotoent_r_proto" in
12470         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
12471         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
12472         esac
12473         case "$getprotoent_r_proto" in
12474         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
12475         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
12476         esac
12477         case "$getprotoent_r_proto" in
12478         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
12479         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
12480         esac
12481         case "$getprotoent_r_proto" in
12482         ''|0)   d_getprotoent_r=undef
12483                 getprotoent_r_proto=0
12484                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
12485         * )     case "$getprotoent_r_proto" in
12486                 REENTRANT_PROTO*) ;;
12487                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
12488                 esac
12489                 echo "Prototype: $try" ;;
12490         esac
12491         ;;
12492         *)      case "$usethreads" in
12493                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
12494                 esac
12495                 d_getprotoent_r=undef
12496                 getprotoent_r_proto=0
12497                 ;;
12498         esac
12499         ;;
12500 *)      getprotoent_r_proto=0
12501         ;;
12502 esac
12503
12504 : see if prototypes for various getprotoxxx netdb.h functions are available
12505 echo " "
12506 set d_getprotoprotos getprotoent $i_netdb netdb.h
12507 eval $hasproto
12508
12509 : see if getprpwnam exists
12510 set getprpwnam d_getprpwnam
12511 eval $inlibc
12512
12513 : see if getpwent exists
12514 set getpwent d_getpwent
12515 eval $inlibc
12516
12517 : see if getpwent_r exists
12518 set getpwent_r d_getpwent_r
12519 eval $inlibc
12520 case "$d_getpwent_r" in
12521 "$define")
12522         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12523         case "$d_getpwent_r_proto:$usethreads" in
12524         ":define")      d_getpwent_r_proto=define
12525                 set d_getpwent_r_proto getpwent_r $hdrs
12526                 eval $hasproto ;;
12527         *)      ;;
12528         esac
12529         case "$d_getpwent_r_proto" in
12530         define)
12531         case "$getpwent_r_proto" in
12532         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
12533         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
12534         esac
12535         case "$getpwent_r_proto" in
12536         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
12537         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
12538         esac
12539         case "$getpwent_r_proto" in
12540         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
12541         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
12542         esac
12543         case "$getpwent_r_proto" in
12544         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
12545         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
12546         esac
12547         case "$getpwent_r_proto" in
12548         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
12549         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
12550         esac
12551         case "$getpwent_r_proto" in
12552         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
12553         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
12554         esac
12555         case "$getpwent_r_proto" in
12556         ''|0)   d_getpwent_r=undef
12557                 getpwent_r_proto=0
12558                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
12559         * )     case "$getpwent_r_proto" in
12560                 REENTRANT_PROTO*) ;;
12561                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
12562                 esac
12563                 echo "Prototype: $try" ;;
12564         esac
12565         ;;
12566         *)      case "$usethreads" in
12567                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
12568                 esac
12569                 d_getpwent_r=undef
12570                 getpwent_r_proto=0
12571                 ;;
12572         esac
12573         ;;
12574 *)      getpwent_r_proto=0
12575         ;;
12576 esac
12577
12578 : see if getpwnam_r exists
12579 set getpwnam_r d_getpwnam_r
12580 eval $inlibc
12581 case "$d_getpwnam_r" in
12582 "$define")
12583         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12584         case "$d_getpwnam_r_proto:$usethreads" in
12585         ":define")      d_getpwnam_r_proto=define
12586                 set d_getpwnam_r_proto getpwnam_r $hdrs
12587                 eval $hasproto ;;
12588         *)      ;;
12589         esac
12590         case "$d_getpwnam_r_proto" in
12591         define)
12592         case "$getpwnam_r_proto" in
12593         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
12594         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
12595         esac
12596         case "$getpwnam_r_proto" in
12597         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
12598         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
12599         esac
12600         case "$getpwnam_r_proto" in
12601         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
12602         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
12603         esac
12604         case "$getpwnam_r_proto" in
12605         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
12606         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
12607         esac
12608         case "$getpwnam_r_proto" in
12609         ''|0)   d_getpwnam_r=undef
12610                 getpwnam_r_proto=0
12611                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
12612         * )     case "$getpwnam_r_proto" in
12613                 REENTRANT_PROTO*) ;;
12614                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
12615                 esac
12616                 echo "Prototype: $try" ;;
12617         esac
12618         ;;
12619         *)      case "$usethreads" in
12620                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
12621                 esac
12622                 d_getpwnam_r=undef
12623                 getpwnam_r_proto=0
12624                 ;;
12625         esac
12626         ;;
12627 *)      getpwnam_r_proto=0
12628         ;;
12629 esac
12630
12631 : see if getpwuid_r exists
12632 set getpwuid_r d_getpwuid_r
12633 eval $inlibc
12634 case "$d_getpwuid_r" in
12635 "$define")
12636         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12637         case "$d_getpwuid_r_proto:$usethreads" in
12638         ":define")      d_getpwuid_r_proto=define
12639                 set d_getpwuid_r_proto getpwuid_r $hdrs
12640                 eval $hasproto ;;
12641         *)      ;;
12642         esac
12643         case "$d_getpwuid_r_proto" in
12644         define)
12645         case "$getpwuid_r_proto" in
12646         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
12647         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
12648         esac
12649         case "$getpwuid_r_proto" in
12650         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
12651         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
12652         esac
12653         case "$getpwuid_r_proto" in
12654         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
12655         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
12656         esac
12657         case "$getpwuid_r_proto" in
12658         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
12659         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
12660         esac
12661         case "$getpwuid_r_proto" in
12662         ''|0)   d_getpwuid_r=undef
12663                 getpwuid_r_proto=0
12664                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
12665         * )     case "$getpwuid_r_proto" in
12666                 REENTRANT_PROTO*) ;;
12667                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
12668                 esac
12669                 echo "Prototype: $try" ;;
12670         esac
12671         ;;
12672         *)      case "$usethreads" in
12673                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
12674                 esac
12675                 d_getpwuid_r=undef
12676                 getpwuid_r_proto=0
12677                 ;;
12678         esac
12679         ;;
12680 *)      getpwuid_r_proto=0
12681         ;;
12682 esac
12683
12684
12685 : see if getservbyname exists
12686 set getservbyname d_getsbyname
12687 eval $inlibc
12688
12689 : see if getservbyport exists
12690 set getservbyport d_getsbyport
12691 eval $inlibc
12692
12693 : see if getservent exists
12694 set getservent d_getsent
12695 eval $inlibc
12696
12697 : see if getservbyname_r exists
12698 set getservbyname_r d_getservbyname_r
12699 eval $inlibc
12700 case "$d_getservbyname_r" in
12701 "$define")
12702         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12703         case "$d_getservbyname_r_proto:$usethreads" in
12704         ":define")      d_getservbyname_r_proto=define
12705                 set d_getservbyname_r_proto getservbyname_r $hdrs
12706                 eval $hasproto ;;
12707         *)      ;;
12708         esac
12709         case "$d_getservbyname_r_proto" in
12710         define)
12711         case "$getservbyname_r_proto" in
12712         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
12713         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
12714         esac
12715         case "$getservbyname_r_proto" in
12716         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
12717         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
12718         esac
12719         case "$getservbyname_r_proto" in
12720         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
12721         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
12722         esac
12723         case "$getservbyname_r_proto" in
12724         ''|0)   d_getservbyname_r=undef
12725                 getservbyname_r_proto=0
12726                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
12727         * )     case "$getservbyname_r_proto" in
12728                 REENTRANT_PROTO*) ;;
12729                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
12730                 esac
12731                 echo "Prototype: $try" ;;
12732         esac
12733         ;;
12734         *)      case "$usethreads" in
12735                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
12736                 esac
12737                 d_getservbyname_r=undef
12738                 getservbyname_r_proto=0
12739                 ;;
12740         esac
12741         ;;
12742 *)      getservbyname_r_proto=0
12743         ;;
12744 esac
12745
12746 : see if getservbyport_r exists
12747 set getservbyport_r d_getservbyport_r
12748 eval $inlibc
12749 case "$d_getservbyport_r" in
12750 "$define")
12751         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12752         case "$d_getservbyport_r_proto:$usethreads" in
12753         ":define")      d_getservbyport_r_proto=define
12754                 set d_getservbyport_r_proto getservbyport_r $hdrs
12755                 eval $hasproto ;;
12756         *)      ;;
12757         esac
12758         case "$d_getservbyport_r_proto" in
12759         define)
12760         case "$getservbyport_r_proto" in
12761         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
12762         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
12763         esac
12764         case "$getservbyport_r_proto" in
12765         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
12766         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
12767         esac
12768         case "$getservbyport_r_proto" in
12769         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
12770         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
12771         esac
12772         case "$getservbyport_r_proto" in
12773         ''|0)   d_getservbyport_r=undef
12774                 getservbyport_r_proto=0
12775                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
12776         * )     case "$getservbyport_r_proto" in
12777                 REENTRANT_PROTO*) ;;
12778                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
12779                 esac
12780                 echo "Prototype: $try" ;;
12781         esac
12782         ;;
12783         *)      case "$usethreads" in
12784                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
12785                 esac
12786                 d_getservbyport_r=undef
12787                 getservbyport_r_proto=0
12788                 ;;
12789         esac
12790         ;;
12791 *)      getservbyport_r_proto=0
12792         ;;
12793 esac
12794
12795 : see if getservent_r exists
12796 set getservent_r d_getservent_r
12797 eval $inlibc
12798 case "$d_getservent_r" in
12799 "$define")
12800         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12801         case "$d_getservent_r_proto:$usethreads" in
12802         ":define")      d_getservent_r_proto=define
12803                 set d_getservent_r_proto getservent_r $hdrs
12804                 eval $hasproto ;;
12805         *)      ;;
12806         esac
12807         case "$d_getservent_r_proto" in
12808         define)
12809         case "$getservent_r_proto" in
12810         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
12811         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
12812         esac
12813         case "$getservent_r_proto" in
12814         ''|0) try='int getservent_r(struct servent*, char*, int);'
12815         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
12816         esac
12817         case "$getservent_r_proto" in
12818         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
12819         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
12820         esac
12821         case "$getservent_r_proto" in
12822         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
12823         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
12824         esac
12825         case "$getservent_r_proto" in
12826         ''|0)   d_getservent_r=undef
12827                 getservent_r_proto=0
12828                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
12829         * )     case "$getservent_r_proto" in
12830                 REENTRANT_PROTO*) ;;
12831                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
12832                 esac
12833                 echo "Prototype: $try" ;;
12834         esac
12835         ;;
12836         *)      case "$usethreads" in
12837                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
12838                 esac
12839                 d_getservent_r=undef
12840                 getservent_r_proto=0
12841                 ;;
12842         esac
12843         ;;
12844 *)      getservent_r_proto=0
12845         ;;
12846 esac
12847
12848 : see if prototypes for various getservxxx netdb.h functions are available
12849 echo " "
12850 set d_getservprotos getservent $i_netdb netdb.h
12851 eval $hasproto
12852
12853 : see if getspnam exists
12854 set getspnam d_getspnam
12855 eval $inlibc
12856
12857 : see if this is a shadow.h system
12858 set shadow.h i_shadow
12859 eval $inhdr
12860
12861 : see if getspnam_r exists
12862 set getspnam_r d_getspnam_r
12863 eval $inlibc
12864 case "$d_getspnam_r" in
12865 "$define")
12866         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
12867         case "$d_getspnam_r_proto:$usethreads" in
12868         ":define")      d_getspnam_r_proto=define
12869                 set d_getspnam_r_proto getspnam_r $hdrs
12870                 eval $hasproto ;;
12871         *)      ;;
12872         esac
12873         case "$d_getspnam_r_proto" in
12874         define)
12875         case "$getspnam_r_proto" in
12876         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
12877         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
12878         esac
12879         case "$getspnam_r_proto" in
12880         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
12881         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
12882         esac
12883         case "$getspnam_r_proto" in
12884         ''|0)   d_getspnam_r=undef
12885                 getspnam_r_proto=0
12886                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
12887         * )     case "$getspnam_r_proto" in
12888                 REENTRANT_PROTO*) ;;
12889                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
12890                 esac
12891                 echo "Prototype: $try" ;;
12892         esac
12893         ;;
12894         *)      case "$usethreads" in
12895                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
12896                 esac
12897                 d_getspnam_r=undef
12898                 getspnam_r_proto=0
12899                 ;;
12900         esac
12901         ;;
12902 *)      getspnam_r_proto=0
12903         ;;
12904 esac
12905
12906 : see if gettimeofday or ftime exists
12907 set gettimeofday d_gettimeod
12908 eval $inlibc
12909 case "$d_gettimeod" in
12910 "$undef")
12911         set ftime d_ftime 
12912         eval $inlibc
12913         ;;
12914 *)
12915         val="$undef"; set d_ftime; eval $setvar
12916         ;;
12917 esac
12918 case "$d_gettimeod$d_ftime" in
12919 "$undef$undef")
12920         echo " "
12921         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
12922         ;;
12923 esac
12924
12925 : see if gmtime_r exists
12926 set gmtime_r d_gmtime_r
12927 eval $inlibc
12928 case "$d_gmtime_r" in
12929 "$define")
12930         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12931         case "$d_gmtime_r_proto:$usethreads" in
12932         ":define")      d_gmtime_r_proto=define
12933                 set d_gmtime_r_proto gmtime_r $hdrs
12934                 eval $hasproto ;;
12935         *)      ;;
12936         esac
12937         case "$d_gmtime_r_proto" in
12938         define)
12939         case "$gmtime_r_proto" in
12940         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
12941         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
12942         esac
12943         case "$gmtime_r_proto" in
12944         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
12945         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
12946         esac
12947         case "$gmtime_r_proto" in
12948         ''|0)   d_gmtime_r=undef
12949                 gmtime_r_proto=0
12950                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
12951         * )     case "$gmtime_r_proto" in
12952                 REENTRANT_PROTO*) ;;
12953                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
12954                 esac
12955                 echo "Prototype: $try" ;;
12956         esac
12957         ;;
12958         *)      case "$usethreads" in
12959                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
12960                 esac
12961                 d_gmtime_r=undef
12962                 gmtime_r_proto=0
12963                 ;;
12964         esac
12965         ;;
12966 *)      gmtime_r_proto=0
12967         ;;
12968 esac
12969
12970 : see if hasmntopt exists
12971 set hasmntopt d_hasmntopt
12972 eval $inlibc
12973
12974 : see if this is a netinet/in.h or sys/in.h system
12975 set netinet/in.h i_niin sys/in.h i_sysin
12976 eval $inhdr
12977
12978 : see if arpa/inet.h has to be included
12979 set arpa/inet.h i_arpainet
12980 eval $inhdr
12981
12982 : see if htonl --and friends-- exists
12983 val=''
12984 set htonl val
12985 eval $inlibc
12986
12987 : Maybe they are macros.
12988 case "$val" in
12989 $undef)
12990         $cat >htonl.c <<EOM
12991 #include <stdio.h>
12992 #include <sys/types.h>
12993 #$i_niin I_NETINET_IN
12994 #$i_sysin I_SYS_IN
12995 #$i_arpainet I_ARPA_INET
12996 #ifdef I_NETINET_IN
12997 #include <netinet/in.h>
12998 #endif
12999 #ifdef I_SYS_IN
13000 #include <sys/in.h>
13001 #endif
13002 #ifdef I_ARPA_INET
13003 #include <arpa/inet.h>
13004 #endif
13005 #ifdef htonl
13006 printf("Defined as a macro.");
13007 #endif
13008 EOM
13009         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
13010         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
13011                 val="$define"
13012                 echo "But it seems to be defined as a macro." >&4
13013         fi
13014         $rm -f htonl.?
13015         ;;
13016 esac
13017 set d_htonl
13018 eval $setvar
13019
13020 : index or strchr
13021 echo " "
13022 if set index val -f; eval $csym; $val; then
13023         if set strchr val -f d_strchr; eval $csym; $val; then
13024                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
13025                         val="$define"
13026                         vali="$undef"
13027                         echo "strchr() found." >&4
13028                 else
13029                         val="$undef"
13030                         vali="$define"
13031                         echo "index() found." >&4
13032                 fi
13033         else
13034                 val="$undef"
13035                 vali="$define"
13036                 echo "index() found." >&4
13037         fi
13038 else
13039         if set strchr val -f d_strchr; eval $csym; $val; then
13040                 val="$define"
13041                 vali="$undef"
13042                 echo "strchr() found." >&4
13043         else
13044                 echo "No index() or strchr() found!" >&4
13045                 val="$undef"
13046                 vali="$undef"
13047         fi
13048 fi
13049 set d_strchr; eval $setvar
13050 val="$vali"
13051 set d_index; eval $setvar
13052
13053 : check whether inet_aton exists
13054 set inet_aton d_inetaton
13055 eval $inlibc
13056
13057 : Look for isascii
13058 echo " "
13059 $cat >isascii.c <<'EOCP'
13060 #include <stdio.h>
13061 #include <ctype.h>
13062 int main() {
13063         int c = 'A';
13064         if (isascii(c))
13065                 exit(0);
13066         else
13067                 exit(1);
13068 }
13069 EOCP
13070 set isascii
13071 if eval $compile; then
13072         echo "isascii() found." >&4
13073         val="$define"
13074 else
13075         echo "isascii() NOT found." >&4
13076         val="$undef"
13077 fi
13078 set d_isascii
13079 eval $setvar
13080 $rm -f isascii*
13081
13082 : see if isfinite exists
13083 set isfinite d_isfinite
13084 eval $inlibc
13085
13086 : see if isinf exists
13087 set isinf d_isinf
13088 eval $inlibc
13089
13090 : see if isnan exists
13091 set isnan d_isnan
13092 eval $inlibc
13093
13094 : see if isnanl exists
13095 set isnanl d_isnanl
13096 eval $inlibc
13097
13098 : see if killpg exists
13099 set killpg d_killpg
13100 eval $inlibc
13101
13102 : see if lchown exists
13103 echo " "
13104 $cat > try.c <<'EOCP'
13105 /* System header to define __stub macros and hopefully few prototypes,
13106     which can conflict with char lchown(); below.  */
13107 #include <assert.h>
13108 /* Override any gcc2 internal prototype to avoid an error.  */
13109 /* We use char because int might match the return type of a gcc2
13110    builtin and then its argument prototype would still apply.  */
13111 char lchown();
13112 int main() {
13113     /*  The GNU C library defines this for functions which it implements
13114         to always fail with ENOSYS.  Some functions are actually named
13115         something starting with __ and the normal name is an alias.  */
13116 #if defined (__stub_lchown) || defined (__stub___lchown)
13117 choke me
13118 #else
13119 lchown();
13120 #endif
13121 ; return 0; }
13122 EOCP
13123 set try
13124 if eval $compile; then
13125     $echo "lchown() found." >&4
13126     val="$define"
13127 else
13128     $echo "lchown() NOT found." >&4
13129     val="$undef"
13130 fi
13131 set d_lchown
13132 eval $setvar
13133
13134 : See if number of significant digits in a double precision number is known
13135 echo " "
13136 $cat >ldbl_dig.c <<EOM
13137 #$i_limits I_LIMITS
13138 #$i_float I_FLOAT
13139 #ifdef I_LIMITS
13140 #include <limits.h>
13141 #endif
13142 #ifdef I_FLOAT
13143 #include <float.h>
13144 #endif
13145 #ifdef LDBL_DIG
13146 printf("Contains LDBL_DIG");
13147 #endif
13148 EOM
13149 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
13150 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
13151         echo "LDBL_DIG found." >&4
13152         val="$define"
13153 else
13154         echo "LDBL_DIG NOT found." >&4
13155         val="$undef"
13156 fi
13157 $rm -f ldbl_dig.?
13158 set d_ldbl_dig
13159 eval $setvar
13160
13161 : see if link exists
13162 set link d_link
13163 eval $inlibc
13164
13165 : see if localtime_r exists
13166 set localtime_r d_localtime_r
13167 eval $inlibc
13168 case "$d_localtime_r" in
13169 "$define")
13170         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13171         case "$d_localtime_r_proto:$usethreads" in
13172         ":define")      d_localtime_r_proto=define
13173                 set d_localtime_r_proto localtime_r $hdrs
13174                 eval $hasproto ;;
13175         *)      ;;
13176         esac
13177         case "$d_localtime_r_proto" in
13178         define)
13179         case "$localtime_r_proto" in
13180         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
13181         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
13182         esac
13183         case "$localtime_r_proto" in
13184         ''|0) try='int localtime_r(const time_t*, struct tm*);'
13185         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
13186         esac
13187         case "$localtime_r_proto" in
13188         ''|0)   d_localtime_r=undef
13189                 localtime_r_proto=0
13190                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
13191         * )     case "$localtime_r_proto" in
13192                 REENTRANT_PROTO*) ;;
13193                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
13194                 esac
13195                 echo "Prototype: $try" ;;
13196         esac
13197         ;;
13198         *)      case "$usethreads" in
13199                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
13200                 esac
13201                 d_localtime_r=undef
13202                 localtime_r_proto=0
13203                 ;;
13204         esac
13205         ;;
13206 *)      localtime_r_proto=0
13207         ;;
13208 esac
13209
13210 : see if localeconv exists
13211 set localeconv d_locconv
13212 eval $inlibc
13213
13214 : see if lockf exists
13215 set lockf d_lockf
13216 eval $inlibc
13217
13218 : see if prototype for lseek is available
13219 echo " "
13220 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
13221 eval $hasproto
13222
13223 : see if lstat exists
13224 set lstat d_lstat
13225 eval $inlibc
13226
13227 : see if madvise exists
13228 set madvise d_madvise
13229 eval $inlibc
13230
13231 : see if mblen exists
13232 set mblen d_mblen
13233 eval $inlibc
13234
13235 : see if mbstowcs exists
13236 set mbstowcs d_mbstowcs
13237 eval $inlibc
13238
13239 : see if mbtowc exists
13240 set mbtowc d_mbtowc
13241 eval $inlibc
13242
13243 : see if memchr exists
13244 set memchr d_memchr
13245 eval $inlibc
13246
13247 : see if memcmp exists
13248 set memcmp d_memcmp
13249 eval $inlibc
13250
13251 : see if memcpy exists
13252 set memcpy d_memcpy
13253 eval $inlibc
13254
13255 : see if memmove exists
13256 set memmove d_memmove
13257 eval $inlibc
13258
13259 : see if memset exists
13260 set memset d_memset
13261 eval $inlibc
13262
13263 : see if mkdir exists
13264 set mkdir d_mkdir
13265 eval $inlibc
13266
13267 : see if mkdtemp exists
13268 set mkdtemp d_mkdtemp
13269 eval $inlibc
13270
13271 : see if mkfifo exists
13272 set mkfifo d_mkfifo
13273 eval $inlibc
13274
13275 : see if mkstemp exists
13276 set mkstemp d_mkstemp
13277 eval $inlibc
13278
13279 : see if mkstemps exists
13280 set mkstemps d_mkstemps
13281 eval $inlibc
13282
13283 : see if mktime exists
13284 set mktime d_mktime
13285 eval $inlibc
13286
13287 : see if this is a sys/mman.h system
13288 set sys/mman.h i_sysmman
13289 eval $inhdr
13290
13291 : see if mmap exists
13292 set mmap d_mmap
13293 eval $inlibc
13294 : see what shmat returns
13295 : default to something harmless
13296 mmaptype='void *'
13297 case "$i_sysmman$d_mmap" in
13298 "$define$define")
13299         $cat >mmap.c <<'END'
13300 #include <sys/mman.h>
13301 void *mmap();
13302 END
13303         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
13304                 mmaptype='void *'
13305         else
13306                 mmaptype='caddr_t'
13307         fi
13308         echo "and it returns ($mmaptype)." >&4
13309         ;;
13310 esac
13311
13312
13313
13314 : see if mprotect exists
13315 set mprotect d_mprotect
13316 eval $inlibc
13317
13318 : see if msgctl exists
13319 set msgctl d_msgctl
13320 eval $inlibc
13321
13322 : see if msgget exists
13323 set msgget d_msgget
13324 eval $inlibc
13325
13326 : see if msgsnd exists
13327 set msgsnd d_msgsnd
13328 eval $inlibc
13329
13330 : see if msgrcv exists
13331 set msgrcv d_msgrcv
13332 eval $inlibc
13333
13334 : see how much of the 'msg*(2)' library is present.
13335 h_msg=true
13336 echo " "
13337 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
13338 *"$undef"*) h_msg=false;;
13339 esac
13340 case "$osname" in
13341 freebsd)
13342     case "`ipcs 2>&1`" in
13343     "SVID messages"*"not configured"*)
13344         echo "Your $osname does not have the msg*(2) configured." >&4
13345         h_msg=false
13346         val="$undef"
13347         set msgctl d_msgctl
13348         eval $setvar
13349         set msgget d_msgget
13350         eval $setvar
13351         set msgsnd d_msgsnd
13352         eval $setvar
13353         set msgrcv d_msgrcv
13354         eval $setvar
13355         ;;
13356     esac
13357     ;;
13358 esac
13359 : we could also check for sys/ipc.h ...
13360 if $h_msg && $test `./findhdr sys/msg.h`; then
13361         echo "You have the full msg*(2) library." >&4
13362         val="$define"
13363 else
13364         echo "You don't have the full msg*(2) library." >&4
13365         val="$undef"
13366 fi
13367 set d_msg
13368 eval $setvar
13369
13370
13371 echo " "
13372 echo "Checking to see if your system supports struct msghdr..." >&4
13373 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
13374 eval $hasstruct
13375 case "$d_msghdr_s" in
13376 "$define")      echo "Yes, it does."   ;;
13377 *)              echo "No, it doesn't." ;;
13378 esac
13379
13380
13381 : see if msync exists
13382 set msync d_msync
13383 eval $inlibc
13384
13385 : see if munmap exists
13386 set munmap d_munmap
13387 eval $inlibc
13388
13389 : see if nanosleep exists
13390 set nanosleep d_nanosleep
13391 eval $inlibc
13392
13393 : see if nice exists
13394 set nice d_nice
13395 eval $inlibc
13396
13397 : see if this is a langinfo.h system
13398 set langinfo.h i_langinfo
13399 eval $inhdr
13400
13401 : see if nl_langinfo exists
13402 set nl_langinfo d_nl_langinfo
13403 eval $inlibc
13404
13405 : check for length of character
13406 echo " "
13407 case "$charsize" in
13408 '')
13409         echo "Checking to see how big your characters are (hey, you never know)..." >&4
13410         $cat >try.c <<'EOCP'
13411 #include <stdio.h>
13412 int main()
13413 {
13414     printf("%d\n", (int)sizeof(char));
13415     exit(0);
13416 }
13417 EOCP
13418         set try
13419         if eval $compile_ok; then
13420                 dflt=`$run ./try`
13421         else
13422                 dflt='1'
13423                 echo "(I can't seem to compile the test program.  Guessing...)"
13424         fi
13425         ;;
13426 *)
13427         dflt="$charsize"
13428         ;;
13429 esac
13430 rp="What is the size of a character (in bytes)?"
13431 . ./myread
13432 charsize="$ans"
13433 $rm -f try.c try
13434
13435 : check for volatile keyword
13436 echo " "
13437 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
13438 $cat >try.c <<'EOCP'
13439 main()
13440 {
13441         typedef struct _goo_struct goo_struct;
13442         goo_struct * volatile goo = ((goo_struct *)0);
13443         struct _goo_struct {
13444                 long long_int;
13445                 int reg_int;
13446                 char char_var;
13447         };
13448         typedef unsigned short foo_t;
13449         char *volatile foo;
13450         volatile int bar;
13451         volatile foo_t blech;
13452         foo = foo;
13453 }
13454 EOCP
13455 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
13456         val="$define"
13457         echo "Yup, it does."
13458 else
13459         val="$undef"
13460         echo "Nope, it doesn't."
13461 fi
13462 set d_volatile
13463 eval $setvar
13464 $rm -f try.*
13465
13466
13467 echo " "
13468 $echo "Choosing the C types to be used for Perl's internal types..." >&4
13469
13470 case "$use64bitint:$d_quad:$quadtype" in
13471 define:define:?*)
13472         ivtype="$quadtype"
13473         uvtype="$uquadtype"
13474         ivsize=8
13475         uvsize=8
13476         ;;
13477 *)      ivtype="long"
13478         uvtype="unsigned long"
13479         ivsize=$longsize
13480         uvsize=$longsize
13481         ;;
13482 esac
13483
13484 case "$uselongdouble:$d_longdbl" in
13485 define:define)
13486         nvtype="long double"
13487         nvsize=$longdblsize
13488         ;;
13489 *)      nvtype=double
13490         nvsize=$doublesize
13491         ;;
13492 esac
13493
13494 $echo "(IV will be "$ivtype", $ivsize bytes)"
13495 $echo "(UV will be "$uvtype", $uvsize bytes)"
13496 $echo "(NV will be "$nvtype", $nvsize bytes)"
13497
13498 $cat >try.c <<EOCP
13499 #$i_inttypes I_INTTYPES
13500 #ifdef I_INTTYPES
13501 #include <inttypes.h>
13502 #endif
13503 #include <stdio.h>
13504 int main() {
13505 #ifdef INT8
13506    int8_t i =  INT8_MAX;
13507   uint8_t u = UINT8_MAX;
13508   printf("int8_t\n");
13509 #endif
13510 #ifdef INT16
13511    int16_t i =  INT16_MAX;
13512   uint16_t i = UINT16_MAX;
13513   printf("int16_t\n");
13514 #endif
13515 #ifdef INT32
13516    int32_t i =  INT32_MAX;
13517   uint32_t u = UINT32_MAX;
13518   printf("int32_t\n");
13519 #endif
13520 }
13521 EOCP
13522
13523 case "$i8type" in
13524 '')     case "$charsize" in
13525         1)      i8type=char
13526                 u8type="unsigned char"
13527                 i8size=$charsize
13528                 u8size=$charsize
13529                 ;;
13530         esac
13531         ;;
13532 esac
13533 case "$i8type" in
13534 '')     set try -DINT8
13535         if eval $compile; then
13536                 case "`$run ./try`" in
13537                 int8_t) i8type=int8_t
13538                         u8type=uint8_t
13539                         i8size=1
13540                         u8size=1
13541                         ;;
13542                 esac
13543         fi
13544         ;;
13545 esac
13546 case "$i8type" in
13547 '')     if $test $charsize -ge 1; then
13548                 i8type=char
13549                 u8type="unsigned char"
13550                 i8size=$charsize
13551                 u8size=$charsize
13552         fi
13553         ;;
13554 esac
13555
13556 case "$i16type" in
13557 '')     case "$shortsize" in
13558         2)      i16type=short
13559                 u16type="unsigned short"
13560                 i16size=$shortsize
13561                 u16size=$shortsize
13562                 ;;
13563         esac
13564         ;;
13565 esac
13566 case "$i16type" in
13567 '')     set try -DINT16
13568         if eval $compile; then
13569                 case "`$run ./try`" in
13570                 int16_t)
13571                         i16type=int16_t
13572                         u16type=uint16_t
13573                         i16size=2
13574                         u16size=2
13575                         ;;
13576                 esac
13577         fi
13578         ;;
13579 esac
13580 case "$i16type" in
13581 '')     if $test $shortsize -ge 2; then
13582                 i16type=short
13583                 u16type="unsigned short"
13584                 i16size=$shortsize
13585                 u16size=$shortsize
13586         fi
13587         ;;
13588 esac
13589
13590 case "$i32type" in
13591 '')     case "$longsize" in
13592         4)      i32type=long
13593                 u32type="unsigned long"
13594                 i32size=$longsize
13595                 u32size=$longsize
13596                 ;;
13597         *)      case "$intsize" in
13598                 4)      i32type=int
13599                         u32type="unsigned int"
13600                         i32size=$intsize
13601                         u32size=$intsize
13602                         ;;
13603                 esac
13604                 ;;
13605         esac
13606         ;;
13607 esac
13608 case "$i32type" in
13609 '')     set try -DINT32
13610         if eval $compile; then
13611                 case "`$run ./try`" in
13612                 int32_t)
13613                         i32type=int32_t
13614                         u32type=uint32_t
13615                         i32size=4
13616                         u32size=4
13617                         ;;
13618                 esac
13619         fi
13620         ;;
13621 esac
13622 case "$i32type" in
13623 '')     if $test $intsize -ge 4; then
13624                 i32type=int
13625                 u32type="unsigned int"
13626                 i32size=$intsize
13627                 u32size=$intsize
13628         fi
13629         ;;
13630 esac
13631
13632 case "$i64type" in
13633 '')     case "$d_quad:$quadtype" in
13634         define:?*)
13635                 i64type="$quadtype"
13636                 u64type="$uquadtype"
13637                 i64size=8
13638                 u64size=8
13639                 ;;
13640         esac
13641         ;;
13642 esac
13643
13644 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
13645 : volatile so that the compiler has to store it out to memory.
13646 if test X"$d_volatile" = X"$define"; then
13647         volatile=volatile
13648 fi
13649 $cat <<EOP >try.c
13650 #include <stdio.h>
13651 #include <sys/types.h>
13652 #include <signal.h>
13653 #ifdef SIGFPE
13654 $volatile int bletched = 0;
13655 $signal_t blech(s) int s; { bletched = 1; }
13656 #endif
13657 int main() {
13658     $uvtype u = 0;
13659     $nvtype d;
13660     int     n = 8 * $uvsize;
13661     int     i;
13662 #ifdef SIGFPE
13663     signal(SIGFPE, blech);
13664 #endif
13665
13666     for (i = 0; i < n; i++) {
13667       u = u << 1 | ($uvtype)1;
13668       d = ($nvtype)u;
13669       if (($uvtype)d != u)
13670         break;
13671       if (d <= 0)
13672         break;
13673       d = ($nvtype)(u - 1);
13674       if (($uvtype)d != (u - 1))
13675         break;
13676 #ifdef SIGFPE
13677       if (bletched) {
13678         break;
13679 #endif
13680       } 
13681     }
13682     printf("%d\n", ((i == n) ? -n : i));
13683     exit(0);
13684 }
13685 EOP
13686 set try
13687
13688 d_nv_preserves_uv="$undef"
13689 if eval $compile; then
13690         nv_preserves_uv_bits="`$run ./try`"
13691 fi
13692 case "$nv_preserves_uv_bits" in
13693 \-[1-9]*)       
13694         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
13695         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
13696         d_nv_preserves_uv="$define"
13697         ;;
13698 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
13699         d_nv_preserves_uv="$undef" ;;
13700 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
13701         nv_preserves_uv_bits="$undef" ;;
13702 esac
13703
13704 $rm -f try.* try
13705
13706
13707 : check for off64_t
13708 echo " "
13709 echo "Checking to see if you have off64_t..." >&4
13710 $cat >try.c <<EOCP
13711 #include <sys/types.h>
13712 #include <unistd.h>
13713 int main() { off64_t x = 7; }
13714 EOCP
13715 set try
13716 if eval $compile; then
13717         val="$define"
13718         echo "You have off64_t."
13719 else
13720         val="$undef"
13721         echo "You do not have off64_t."
13722         case "$lseeksize" in
13723         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
13724         esac
13725 fi
13726 $rm -f try.* try
13727 set d_off64_t
13728 eval $setvar
13729
13730 : how to create joinable pthreads
13731 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
13732         echo " "
13733         echo "Checking what constant to use for creating joinable pthreads..." >&4 
13734         $cat >try.c <<'EOCP'
13735 #include <pthread.h>
13736 int main() {
13737     int detachstate = JOINABLE;
13738 }
13739 EOCP
13740         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
13741         if eval $compile; then
13742                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
13743                 val="$undef" # Yes, undef.
13744                 set d_old_pthread_create_joinable
13745                 eval $setvar
13746                 val=""
13747                 set old_pthread_create_joinable
13748                 eval $setvar
13749         else
13750                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
13751                 if eval $compile; then
13752                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
13753                         val="$define"
13754                         set d_old_pthread_create_joinable
13755                         eval $setvar
13756                         val=PTHREAD_CREATE_UNDETACHED
13757                         set old_pthread_create_joinable
13758                         eval $setvar
13759                 else            
13760                         set try -DJOINABLE=__UNDETACHED
13761                         if eval $compile; then
13762                                 echo "You seem to use __UNDETACHED." >&4
13763                                 val="$define"
13764                                 set d_old_pthread_create_joinable
13765                                 eval $setvar
13766                                 val=__UNDETACHED
13767                                 set old_pthread_create_joinable
13768                                 eval $setvar
13769                         else
13770                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
13771                                 val="$define"
13772                                 set d_old_pthread_create_joinable
13773                                 eval $setvar
13774                                 val=0
13775                                 set old_pthread_create_joinable
13776                                 eval $setvar
13777                         fi
13778                 fi
13779         fi
13780         $rm -f try try.*
13781 else
13782     d_old_pthread_create_joinable="$undef"
13783     old_pthread_create_joinable=""
13784 fi
13785
13786 : see if pause exists
13787 set pause d_pause
13788 eval $inlibc
13789
13790 : see if pipe exists
13791 set pipe d_pipe
13792 eval $inlibc
13793
13794 : see if poll exists
13795 set poll d_poll
13796 eval $inlibc
13797
13798 : see if readlink exists
13799 set readlink d_readlink
13800 eval $inlibc
13801
13802 echo " "
13803 procselfexe=''
13804 val="$undef"
13805 case "$d_readlink" in
13806 "$define")
13807         if $issymlink /proc/self/exe ; then
13808                 $ls -l /proc/self/exe > reflect
13809                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13810                         echo "You have Linux-like /proc/self/exe."
13811                         procselfexe='"/proc/self/exe"'
13812                         val="$define"
13813                 fi
13814         fi
13815         if $issymlink /proc/curproc/file ; then
13816                 $ls -l /proc/curproc/file > reflect
13817                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13818                         echo "You have BSD-like /proc/curproc/file."
13819                         procselfexe='"/proc/curproc/file"'
13820                         val="$define"
13821                 fi
13822         fi
13823         ;;
13824 esac
13825 $rm -f reflect
13826 set d_procselfexe
13827 eval $setvar
13828
13829 : see whether the pthread_atfork exists
13830 $cat >try.c <<EOP
13831 #include <pthread.h>
13832 #include <stdio.h>
13833 int main() {
13834 #ifdef  PTHREAD_ATFORK
13835         pthread_atfork(NULL,NULL,NULL);
13836 #endif
13837 }
13838 EOP
13839
13840 : see if pthread_atfork exists
13841 set try -DPTHREAD_ATFORK
13842 if eval $compile; then
13843     val="$define"
13844 else
13845     val="$undef"
13846 fi
13847 case "$usethreads" in
13848 $define)
13849         case "$val" in
13850         $define) echo 'pthread_atfork found.' >&4        ;;
13851         *)       echo 'pthread_atfork NOT found.' >&4    ;;
13852         esac
13853 esac
13854 set d_pthread_atfork
13855 eval $setvar
13856
13857
13858 : see whether the various POSIXish _yields exist
13859 $cat >try.c <<EOP
13860 #include <pthread.h>
13861 #include <stdio.h>
13862 int main() {
13863 #ifdef SCHED_YIELD
13864         sched_yield();
13865 #else
13866 #ifdef PTHREAD_YIELD
13867         pthread_yield();
13868 #else
13869 #ifdef PTHREAD_YIELD_NULL
13870         pthread_yield(NULL);
13871 #endif
13872 #endif
13873 #endif
13874 }
13875 EOP
13876 : see if sched_yield exists
13877 set try -DSCHED_YIELD
13878 if eval $compile; then
13879     val="$define"
13880     sched_yield='sched_yield()'
13881 else
13882     val="$undef"
13883 fi
13884 case "$usethreads" in
13885 $define)
13886         case "$val" in
13887         $define) echo 'sched_yield() found.' >&4        ;;
13888         *)       echo 'sched_yield() NOT found.' >&4    ;;
13889         esac
13890 esac
13891 set d_sched_yield
13892 eval $setvar
13893
13894 : see if pthread_yield exists
13895 set try -DPTHREAD_YIELD
13896 if eval $compile; then
13897     val="$define"
13898     case "$sched_yield" in
13899     '') sched_yield='pthread_yield()' ;;
13900     esac
13901 else
13902     set try -DPTHREAD_YIELD_NULL
13903     if eval $compile; then
13904         val="$define"
13905         case "$sched_yield" in
13906         '') sched_yield='pthread_yield(NULL)' ;;
13907         esac
13908     else
13909         val="$undef"
13910     fi
13911 fi
13912 case "$usethreads" in
13913 $define)
13914         case "$val" in
13915         $define) echo 'pthread_yield() found.' >&4      ;;
13916         *)       echo 'pthread_yield() NOT found.' >&4  ;;
13917         esac
13918         ;;
13919 esac
13920 set d_pthread_yield
13921 eval $setvar
13922
13923 case "$sched_yield" in
13924 '') sched_yield=undef ;;
13925 esac
13926
13927 $rm -f try try.*
13928
13929 : see if random_r exists
13930 set random_r d_random_r
13931 eval $inlibc
13932 case "$d_random_r" in
13933 "$define")
13934         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
13935         case "$d_random_r_proto:$usethreads" in
13936         ":define")      d_random_r_proto=define
13937                 set d_random_r_proto random_r $hdrs
13938                 eval $hasproto ;;
13939         *)      ;;
13940         esac
13941         case "$d_random_r_proto" in
13942         define)
13943         case "$random_r_proto" in
13944         ''|0) try='int random_r(int*, struct random_data*);'
13945         ./protochk "extern $try" $hdrs && random_r_proto=I_TS ;;
13946         esac
13947         case "$random_r_proto" in
13948         ''|0)   d_random_r=undef
13949                 random_r_proto=0
13950                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
13951         * )     case "$random_r_proto" in
13952                 REENTRANT_PROTO*) ;;
13953                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
13954                 esac
13955                 echo "Prototype: $try" ;;
13956         esac
13957         ;;
13958         *)      case "$usethreads" in
13959                 define) echo "random_r has no prototype, not using it." >&4 ;;
13960                 esac
13961                 d_random_r=undef
13962                 random_r_proto=0
13963                 ;;
13964         esac
13965         ;;
13966 *)      random_r_proto=0
13967         ;;
13968 esac
13969
13970 : see if readdir and friends exist
13971 set readdir d_readdir
13972 eval $inlibc
13973 set seekdir d_seekdir
13974 eval $inlibc
13975 set telldir d_telldir
13976 eval $inlibc
13977 set rewinddir d_rewinddir
13978 eval $inlibc
13979
13980 : see if readdir64_r exists
13981 set readdir64_r d_readdir64_r
13982 eval $inlibc
13983 case "$d_readdir64_r" in
13984 "$define")
13985         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
13986         case "$d_readdir64_r_proto:$usethreads" in
13987         ":define")      d_readdir64_r_proto=define
13988                 set d_readdir64_r_proto readdir64_r $hdrs
13989                 eval $hasproto ;;
13990         *)      ;;
13991         esac
13992         case "$d_readdir64_r_proto" in
13993         define)
13994         case "$readdir64_r_proto" in
13995         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
13996         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
13997         esac
13998         case "$readdir64_r_proto" in
13999         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
14000         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
14001         esac
14002         case "$readdir64_r_proto" in
14003         ''|0)   d_readdir64_r=undef
14004                 readdir64_r_proto=0
14005                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
14006         * )     case "$readdir64_r_proto" in
14007                 REENTRANT_PROTO*) ;;
14008                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
14009                 esac
14010                 echo "Prototype: $try" ;;
14011         esac
14012         ;;
14013         *)      case "$usethreads" in
14014                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
14015                 esac
14016                 d_readdir64_r=undef
14017                 readdir64_r_proto=0
14018                 ;;
14019         esac
14020         ;;
14021 *)      readdir64_r_proto=0
14022         ;;
14023 esac
14024
14025 : see if readdir_r exists
14026 set readdir_r d_readdir_r
14027 eval $inlibc
14028 case "$d_readdir_r" in
14029 "$define")
14030         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
14031         case "$d_readdir_r_proto:$usethreads" in
14032         ":define")      d_readdir_r_proto=define
14033                 set d_readdir_r_proto readdir_r $hdrs
14034                 eval $hasproto ;;
14035         *)      ;;
14036         esac
14037         case "$d_readdir_r_proto" in
14038         define)
14039         case "$readdir_r_proto" in
14040         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
14041         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
14042         esac
14043         case "$readdir_r_proto" in
14044         ''|0) try='int readdir_r(DIR*, struct dirent*);'
14045         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
14046         esac
14047         case "$readdir_r_proto" in
14048         ''|0)   d_readdir_r=undef
14049                 readdir_r_proto=0
14050                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
14051         * )     case "$readdir_r_proto" in
14052                 REENTRANT_PROTO*) ;;
14053                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
14054                 esac
14055                 echo "Prototype: $try" ;;
14056         esac
14057         ;;
14058         *)      case "$usethreads" in
14059                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
14060                 esac
14061                 d_readdir_r=undef
14062                 readdir_r_proto=0
14063                 ;;
14064         esac
14065         ;;
14066 *)      readdir_r_proto=0
14067         ;;
14068 esac
14069
14070 : see if readv exists
14071 set readv d_readv
14072 eval $inlibc
14073
14074 : see if recvmsg exists
14075 set recvmsg d_recvmsg
14076 eval $inlibc
14077
14078 : see if rename exists
14079 set rename d_rename
14080 eval $inlibc
14081
14082 : see if rmdir exists
14083 set rmdir d_rmdir
14084 eval $inlibc
14085
14086 : see if memory.h is available.
14087 val=''
14088 set memory.h val
14089 eval $inhdr
14090
14091 : See if it conflicts with string.h
14092 case "$val" in
14093 $define)
14094         case "$strings" in
14095         '') ;;
14096         *)
14097                 $cppstdin $cppflags $cppminus < $strings > mem.h
14098                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
14099                         echo " "
14100                         echo "We won't be including <memory.h>."
14101                         val="$undef"
14102                 fi
14103                 $rm -f mem.h
14104                 ;;
14105         esac
14106 esac
14107 set i_memory
14108 eval $setvar
14109
14110 : can bcopy handle overlapping blocks?
14111 echo " "
14112 val="$undef"
14113 case "$d_memmove" in
14114 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
14115 *)      case "$d_bcopy" in
14116         "$define")
14117                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
14118                 $cat >try.c <<EOCP
14119 #$i_memory I_MEMORY
14120 #$i_stdlib I_STDLIB
14121 #$i_string I_STRING
14122 #$i_unistd I_UNISTD
14123 EOCP
14124         $cat >>try.c <<'EOCP'
14125 #include <stdio.h>
14126 #ifdef I_MEMORY
14127 #  include <memory.h>
14128 #endif
14129 #ifdef I_STDLIB
14130 #  include <stdlib.h>
14131 #endif
14132 #ifdef I_STRING
14133 #  include <string.h>
14134 #else
14135 #  include <strings.h>
14136 #endif
14137 #ifdef I_UNISTD
14138 #  include <unistd.h>  /* Needed for NetBSD */
14139 #endif
14140 int main()
14141 {
14142 char buf[128], abc[128];
14143 char *b;
14144 int len;
14145 int off;
14146 int align;
14147
14148 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14149    try to store the string in read-only memory. */
14150 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
14151
14152 for (align = 7; align >= 0; align--) {
14153         for (len = 36; len; len--) {
14154                 b = buf+align;
14155                 bcopy(abc, b, len);
14156                 for (off = 1; off <= len; off++) {
14157                         bcopy(b, b+off, len);
14158                         bcopy(b+off, b, len);
14159                         if (bcmp(b, abc, len))
14160                                 exit(1);
14161                 }
14162         }
14163 }
14164 exit(0);
14165 }
14166 EOCP
14167                 set try
14168                 if eval $compile_ok; then
14169                         if ./try 2>/dev/null; then
14170                                 echo "Yes, it can."
14171                                 val="$define"
14172                         else
14173                                 echo "It can't, sorry."
14174                         fi
14175                 else
14176                         echo "(I can't compile the test program, so we'll assume not...)"
14177                 fi
14178                 ;;
14179         esac
14180         $rm -f try.* try core
14181         ;;
14182 esac
14183 set d_safebcpy
14184 eval $setvar
14185
14186 : can memcpy handle overlapping blocks?
14187 echo " "
14188 val="$undef"
14189 case "$d_memmove" in
14190 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
14191 *)      case "$d_memcpy" in
14192         "$define")
14193                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
14194                 $cat >try.c <<EOCP
14195 #$i_memory I_MEMORY
14196 #$i_stdlib I_STDLIB
14197 #$i_string I_STRING
14198 #$i_unistd I_UNISTD
14199 EOCP
14200         $cat >>try.c <<'EOCP'
14201 #include <stdio.h>
14202 #ifdef I_MEMORY
14203 #  include <memory.h>
14204 #endif
14205 #ifdef I_STDLIB
14206 #  include <stdlib.h>
14207 #endif
14208 #ifdef I_STRING
14209 #  include <string.h>
14210 #else
14211 #  include <strings.h>
14212 #endif
14213 #ifdef I_UNISTD
14214 #  include <unistd.h>  /* Needed for NetBSD */
14215 #endif
14216 int main()
14217 {
14218 char buf[128], abc[128];
14219 char *b;
14220 int len;
14221 int off;
14222 int align;
14223
14224 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14225    try to store the string in read-only memory. */
14226 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
14227
14228 for (align = 7; align >= 0; align--) {
14229         for (len = 36; len; len--) {
14230                 b = buf+align;
14231                 memcpy(b, abc, len);
14232                 for (off = 1; off <= len; off++) {
14233                         memcpy(b+off, b, len);
14234                         memcpy(b, b+off, len);
14235                         if (memcmp(b, abc, len))
14236                                 exit(1);
14237                 }
14238         }
14239 }
14240 exit(0);
14241 }
14242 EOCP
14243                 set try
14244                 if eval $compile_ok; then
14245                         if ./try 2>/dev/null; then
14246                                 echo "Yes, it can."
14247                                 val="$define"
14248                         else
14249                                 echo "It can't, sorry."
14250                         fi
14251                 else
14252                         echo "(I can't compile the test program, so we'll assume not...)"
14253                 fi
14254                 ;;
14255         esac
14256         $rm -f try.* try core
14257         ;;
14258 esac
14259 set d_safemcpy
14260 eval $setvar
14261
14262 : can memcmp be trusted to compare relative magnitude?
14263 val="$undef"
14264 case "$d_memcmp" in
14265 "$define")
14266         echo " "
14267         echo "Checking if your memcmp() can compare relative magnitude..." >&4
14268         $cat >try.c <<EOCP
14269 #$i_memory I_MEMORY
14270 #$i_stdlib I_STDLIB
14271 #$i_string I_STRING
14272 #$i_unistd I_UNISTD
14273 EOCP
14274         $cat >>try.c <<'EOCP'
14275 #include <stdio.h>
14276 #ifdef I_MEMORY
14277 #  include <memory.h>
14278 #endif
14279 #ifdef I_STDLIB
14280 #  include <stdlib.h>
14281 #endif
14282 #ifdef I_STRING
14283 #  include <string.h>
14284 #else
14285 #  include <strings.h>
14286 #endif
14287 #ifdef I_UNISTD
14288 #  include <unistd.h>  /* Needed for NetBSD */
14289 #endif
14290 int main()
14291 {
14292 char a = -1;
14293 char b = 0;
14294 if ((a < b) && memcmp(&a, &b, 1) < 0)
14295         exit(1);
14296 exit(0);
14297 }
14298 EOCP
14299         set try
14300         if eval $compile_ok; then
14301                 if $run ./try 2>/dev/null; then
14302                         echo "Yes, it can."
14303                         val="$define"
14304                 else
14305                         echo "No, it can't (it uses signed chars)."
14306                 fi
14307         else
14308                 echo "(I can't compile the test program, so we'll assume not...)"
14309         fi
14310         ;;
14311 esac
14312 $rm -f try.* try core
14313 set d_sanemcmp
14314 eval $setvar
14315
14316 : see if prototype for sbrk is available
14317 echo " "
14318 set d_sbrkproto sbrk $i_unistd unistd.h
14319 eval $hasproto
14320
14321 : see if select exists
14322 set select d_select
14323 eval $inlibc
14324
14325 : see if semctl exists
14326 set semctl d_semctl
14327 eval $inlibc
14328
14329 : see if semget exists
14330 set semget d_semget
14331 eval $inlibc
14332
14333 : see if semop exists
14334 set semop d_semop
14335 eval $inlibc
14336
14337 : see how much of the 'sem*(2)' library is present.
14338 h_sem=true
14339 echo " "
14340 case "$d_semctl$d_semget$d_semop" in
14341 *"$undef"*) h_sem=false;;
14342 esac
14343 case "$osname" in
14344 freebsd)
14345     case "`ipcs 2>&1`" in
14346     "SVID messages"*"not configured"*)
14347         echo "Your $osname does not have the sem*(2) configured." >&4
14348         h_sem=false
14349         val="$undef"
14350         set semctl d_semctl
14351         eval $setvar
14352         set semget d_semget
14353         eval $setvar
14354         set semop d_semop
14355         eval $setvar
14356         ;;
14357     esac
14358     ;;
14359 esac
14360 : we could also check for sys/ipc.h ...
14361 if $h_sem && $test `./findhdr sys/sem.h`; then
14362         echo "You have the full sem*(2) library." >&4
14363         val="$define"
14364 else
14365         echo "You don't have the full sem*(2) library." >&4
14366         val="$undef"
14367 fi
14368 set d_sem
14369 eval $setvar
14370
14371 : see whether sys/sem.h defines union semun
14372 echo " "
14373 $cat > try.c <<'END'
14374 #include <sys/types.h>
14375 #include <sys/ipc.h>
14376 #include <sys/sem.h>
14377 int main () { union semun semun; semun.buf = 0; }
14378 END
14379 set try
14380 if eval $compile; then
14381     echo "You have union semun in <sys/sem.h>." >&4
14382     val="$define"
14383 else
14384     echo "You do not have union semun in <sys/sem.h>." >&4
14385     val="$undef"
14386 fi
14387 $rm -f try try.c try.h
14388 set d_union_semun
14389 eval $setvar
14390
14391 : see how to do semctl IPC_STAT
14392 case "$d_sem" in
14393 $define)
14394     : see whether semctl IPC_STAT can use union semun
14395     echo " "
14396     $cat > try.h <<END
14397 #ifndef S_IRUSR
14398 #   ifdef S_IREAD
14399 #       define S_IRUSR S_IREAD
14400 #       define S_IWUSR S_IWRITE
14401 #       define S_IXUSR S_IEXEC
14402 #   else
14403 #       define S_IRUSR 0400
14404 #       define S_IWUSR 0200
14405 #       define S_IXUSR 0100
14406 #   endif
14407 #   define S_IRGRP (S_IRUSR>>3)
14408 #   define S_IWGRP (S_IWUSR>>3)
14409 #   define S_IXGRP (S_IXUSR>>3)
14410 #   define S_IROTH (S_IRUSR>>6)
14411 #   define S_IWOTH (S_IWUSR>>6)
14412 #   define S_IXOTH (S_IXUSR>>6)
14413 #endif
14414 #ifndef S_IRWXU
14415 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
14416 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
14417 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
14418 #endif
14419 END
14420
14421     $cat > try.c <<END
14422 #include <sys/types.h>
14423 #include <sys/ipc.h>
14424 #include <sys/sem.h>
14425 #include <sys/stat.h>
14426 #include <stdio.h>
14427 #include <errno.h>
14428 #include "try.h"
14429 #ifndef errno
14430 extern int errno;
14431 #endif
14432 #$d_union_semun HAS_UNION_SEMUN
14433 int main() {
14434     union semun
14435 #ifndef HAS_UNION_SEMUN
14436     {
14437         int val;
14438         struct semid_ds *buf;
14439         unsigned short *array;
14440     }
14441 #endif
14442     arg;
14443     int sem, st;
14444
14445 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
14446     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14447     if (sem > -1) {
14448         struct semid_ds argbuf;
14449         arg.buf = &argbuf;
14450 #       ifdef IPC_STAT
14451         st = semctl(sem, 0, IPC_STAT, arg);
14452         if (st == 0)
14453             printf("semun\n");
14454         else
14455 #       endif /* IPC_STAT */
14456             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14457 #       ifdef IPC_RMID
14458         if (semctl(sem, 0, IPC_RMID, arg) != 0)
14459 #       endif /* IPC_RMID */
14460             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14461     } else
14462 #endif /* IPC_PRIVATE && ... */
14463         printf("semget failed: errno = %d\n", errno);
14464   return 0;
14465 }
14466 END
14467     val="$undef"
14468     set try
14469     if eval $compile; then
14470         xxx=`$run ./try`
14471         case "$xxx" in
14472         semun) val="$define" ;;
14473         esac
14474     fi
14475     $rm -f try try.c
14476     set d_semctl_semun
14477     eval $setvar
14478     case "$d_semctl_semun" in
14479     $define)
14480         echo "You can use union semun for semctl IPC_STAT." >&4
14481         also='also'
14482         ;;
14483     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
14484         also=''
14485         ;;
14486     esac
14487
14488     : see whether semctl IPC_STAT can use struct semid_ds pointer
14489     $cat > try.c <<'END'
14490 #include <sys/types.h>
14491 #include <sys/ipc.h>
14492 #include <sys/sem.h>
14493 #include <sys/stat.h>
14494 #include "try.h"
14495 #include <stdio.h>
14496 #include <errno.h>
14497 #ifndef errno
14498 extern int errno;
14499 #endif
14500 int main() {
14501     struct semid_ds arg;
14502     int sem, st;
14503
14504 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
14505     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14506     if (sem > -1) {
14507 #       ifdef IPC_STAT
14508         st = semctl(sem, 0, IPC_STAT, &arg);
14509         if (st == 0)
14510             printf("semid_ds\n");
14511         else
14512 #       endif /* IPC_STAT */
14513             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14514 #       ifdef IPC_RMID
14515         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
14516 #       endif /* IPC_RMID */
14517             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14518     } else
14519 #endif /* IPC_PRIVATE && ... */
14520         printf("semget failed: errno = %d\n", errno);
14521
14522     return 0;
14523 }
14524 END
14525     val="$undef"
14526     set try
14527     if eval $compile; then
14528         xxx=`$run ./try`
14529         case "$xxx" in
14530         semid_ds) val="$define" ;;
14531         esac
14532     fi
14533     $rm -f try try.c
14534     set d_semctl_semid_ds
14535     eval $setvar
14536     case "$d_semctl_semid_ds" in
14537     $define)
14538         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
14539         ;;
14540     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
14541         ;;
14542     esac
14543     $rm -f try.h
14544     ;;
14545 *)  val="$undef"
14546
14547     # We do not have the full sem*(2) library, so assume we can not
14548     # use either.
14549
14550     set d_semctl_semun
14551     eval $setvar
14552
14553     set d_semctl_semid_ds
14554     eval $setvar
14555     ;;
14556 esac
14557
14558 : see if sendmsg exists
14559 set sendmsg d_sendmsg
14560 eval $inlibc
14561
14562 : see if setegid exists
14563 set setegid d_setegid
14564 eval $inlibc
14565
14566 : see if seteuid exists
14567 set seteuid d_seteuid
14568 eval $inlibc
14569
14570 : see if setgrent exists
14571 set setgrent d_setgrent
14572 eval $inlibc
14573
14574 : see if setgrent_r exists
14575 set setgrent_r d_setgrent_r
14576 eval $inlibc
14577 case "$d_setgrent_r" in
14578 "$define")
14579         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14580         case "$d_setgrent_r_proto:$usethreads" in
14581         ":define")      d_setgrent_r_proto=define
14582                 set d_setgrent_r_proto setgrent_r $hdrs
14583                 eval $hasproto ;;
14584         *)      ;;
14585         esac
14586         case "$d_setgrent_r_proto" in
14587         define)
14588         case "$setgrent_r_proto" in
14589         ''|0) try='int setgrent_r(FILE**);'
14590         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
14591         esac
14592         case "$setgrent_r_proto" in
14593         ''|0) try='void setgrent_r(FILE**);'
14594         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
14595         esac
14596         case "$setgrent_r_proto" in
14597         ''|0)   d_setgrent_r=undef
14598                 setgrent_r_proto=0
14599                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
14600         * )     case "$setgrent_r_proto" in
14601                 REENTRANT_PROTO*) ;;
14602                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
14603                 esac
14604                 echo "Prototype: $try" ;;
14605         esac
14606         ;;
14607         *)      case "$usethreads" in
14608                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
14609                 esac
14610                 d_setgrent_r=undef
14611                 setgrent_r_proto=0
14612                 ;;
14613         esac
14614         ;;
14615 *)      setgrent_r_proto=0
14616         ;;
14617 esac
14618
14619 : see if sethostent exists
14620 set sethostent d_sethent
14621 eval $inlibc
14622
14623 : see if sethostent_r exists
14624 set sethostent_r d_sethostent_r
14625 eval $inlibc
14626 case "$d_sethostent_r" in
14627 "$define")
14628         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14629         case "$d_sethostent_r_proto:$usethreads" in
14630         ":define")      d_sethostent_r_proto=define
14631                 set d_sethostent_r_proto sethostent_r $hdrs
14632                 eval $hasproto ;;
14633         *)      ;;
14634         esac
14635         case "$d_sethostent_r_proto" in
14636         define)
14637         case "$sethostent_r_proto" in
14638         ''|0) try='int sethostent_r(int, struct hostent_data*);'
14639         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
14640         esac
14641         case "$sethostent_r_proto" in
14642         ''|0) try='void sethostent_r(int, struct hostent_data*);'
14643         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
14644         esac
14645         case "$sethostent_r_proto" in
14646         ''|0)   d_sethostent_r=undef
14647                 sethostent_r_proto=0
14648                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
14649         * )     case "$sethostent_r_proto" in
14650                 REENTRANT_PROTO*) ;;
14651                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
14652                 esac
14653                 echo "Prototype: $try" ;;
14654         esac
14655         ;;
14656         *)      case "$usethreads" in
14657                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
14658                 esac
14659                 d_sethostent_r=undef
14660                 sethostent_r_proto=0
14661                 ;;
14662         esac
14663         ;;
14664 *)      sethostent_r_proto=0
14665         ;;
14666 esac
14667
14668 : see if setitimer exists
14669 set setitimer d_setitimer
14670 eval $inlibc
14671
14672 : see if setlinebuf exists
14673 set setlinebuf d_setlinebuf
14674 eval $inlibc
14675
14676 : see if setlocale exists
14677 set setlocale d_setlocale
14678 eval $inlibc
14679
14680 : see if locale.h is available
14681 set locale.h i_locale
14682 eval $inhdr
14683
14684 : see if setlocale_r exists
14685 set setlocale_r d_setlocale_r
14686 eval $inlibc
14687 case "$d_setlocale_r" in
14688 "$define")
14689         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
14690         case "$d_setlocale_r_proto:$usethreads" in
14691         ":define")      d_setlocale_r_proto=define
14692                 set d_setlocale_r_proto setlocale_r $hdrs
14693                 eval $hasproto ;;
14694         *)      ;;
14695         esac
14696         case "$d_setlocale_r_proto" in
14697         define)
14698         case "$setlocale_r_proto" in
14699         ''|0) try='int setlocale_r(int, const char*, char*, int);'
14700         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
14701         esac
14702         case "$setlocale_r_proto" in
14703         ''|0)   d_setlocale_r=undef
14704                 setlocale_r_proto=0
14705                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
14706         * )     case "$setlocale_r_proto" in
14707                 REENTRANT_PROTO*) ;;
14708                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
14709                 esac
14710                 echo "Prototype: $try" ;;
14711         esac
14712         ;;
14713         *)      case "$usethreads" in
14714                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
14715                 esac
14716                 d_setlocale_r=undef
14717                 setlocale_r_proto=0
14718                 ;;
14719         esac
14720         ;;
14721 *)      setlocale_r_proto=0
14722         ;;
14723 esac
14724
14725 : see if setnetent exists
14726 set setnetent d_setnent
14727 eval $inlibc
14728
14729 : see if setnetent_r exists
14730 set setnetent_r d_setnetent_r
14731 eval $inlibc
14732 case "$d_setnetent_r" in
14733 "$define")
14734         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14735         case "$d_setnetent_r_proto:$usethreads" in
14736         ":define")      d_setnetent_r_proto=define
14737                 set d_setnetent_r_proto setnetent_r $hdrs
14738                 eval $hasproto ;;
14739         *)      ;;
14740         esac
14741         case "$d_setnetent_r_proto" in
14742         define)
14743         case "$setnetent_r_proto" in
14744         ''|0) try='int setnetent_r(int, struct netent_data*);'
14745         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
14746         esac
14747         case "$setnetent_r_proto" in
14748         ''|0) try='void setnetent_r(int, struct netent_data*);'
14749         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
14750         esac
14751         case "$setnetent_r_proto" in
14752         ''|0)   d_setnetent_r=undef
14753                 setnetent_r_proto=0
14754                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
14755         * )     case "$setnetent_r_proto" in
14756                 REENTRANT_PROTO*) ;;
14757                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
14758                 esac
14759                 echo "Prototype: $try" ;;
14760         esac
14761         ;;
14762         *)      case "$usethreads" in
14763                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
14764                 esac
14765                 d_setnetent_r=undef
14766                 setnetent_r_proto=0
14767                 ;;
14768         esac
14769         ;;
14770 *)      setnetent_r_proto=0
14771         ;;
14772 esac
14773
14774 : see if setprotoent exists
14775 set setprotoent d_setpent
14776 eval $inlibc
14777
14778 : see if setpgid exists
14779 set setpgid d_setpgid
14780 eval $inlibc
14781
14782 : see if setpgrp2 exists
14783 set setpgrp2 d_setpgrp2
14784 eval $inlibc
14785
14786 : see if setpriority exists
14787 set setpriority d_setprior
14788 eval $inlibc
14789
14790 : see if setproctitle exists
14791 set setproctitle d_setproctitle
14792 eval $inlibc
14793
14794 : see if setprotoent_r exists
14795 set setprotoent_r d_setprotoent_r
14796 eval $inlibc
14797 case "$d_setprotoent_r" in
14798 "$define")
14799         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14800         case "$d_setprotoent_r_proto:$usethreads" in
14801         ":define")      d_setprotoent_r_proto=define
14802                 set d_setprotoent_r_proto setprotoent_r $hdrs
14803                 eval $hasproto ;;
14804         *)      ;;
14805         esac
14806         case "$d_setprotoent_r_proto" in
14807         define)
14808         case "$setprotoent_r_proto" in
14809         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
14810         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
14811         esac
14812         case "$setprotoent_r_proto" in
14813         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
14814         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
14815         esac
14816         case "$setprotoent_r_proto" in
14817         ''|0)   d_setprotoent_r=undef
14818                 setprotoent_r_proto=0
14819                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
14820         * )     case "$setprotoent_r_proto" in
14821                 REENTRANT_PROTO*) ;;
14822                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
14823                 esac
14824                 echo "Prototype: $try" ;;
14825         esac
14826         ;;
14827         *)      case "$usethreads" in
14828                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
14829                 esac
14830                 d_setprotoent_r=undef
14831                 setprotoent_r_proto=0
14832                 ;;
14833         esac
14834         ;;
14835 *)      setprotoent_r_proto=0
14836         ;;
14837 esac
14838
14839 : see if setpwent exists
14840 set setpwent d_setpwent
14841 eval $inlibc
14842
14843 : see if setpwent_r exists
14844 set setpwent_r d_setpwent_r
14845 eval $inlibc
14846 case "$d_setpwent_r" in
14847 "$define")
14848         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14849         case "$d_setpwent_r_proto:$usethreads" in
14850         ":define")      d_setpwent_r_proto=define
14851                 set d_setpwent_r_proto setpwent_r $hdrs
14852                 eval $hasproto ;;
14853         *)      ;;
14854         esac
14855         case "$d_setpwent_r_proto" in
14856         define)
14857         case "$setpwent_r_proto" in
14858         ''|0) try='int setpwent_r(FILE**);'
14859         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
14860         esac
14861         case "$setpwent_r_proto" in
14862         ''|0) try='void setpwent_r(FILE**);'
14863         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
14864         esac
14865         case "$setpwent_r_proto" in
14866         ''|0)   d_setpwent_r=undef
14867                 setpwent_r_proto=0
14868                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
14869         * )     case "$setpwent_r_proto" in
14870                 REENTRANT_PROTO*) ;;
14871                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
14872                 esac
14873                 echo "Prototype: $try" ;;
14874         esac
14875         ;;
14876         *)      case "$usethreads" in
14877                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
14878                 esac
14879                 d_setpwent_r=undef
14880                 setpwent_r_proto=0
14881                 ;;
14882         esac
14883         ;;
14884 *)      setpwent_r_proto=0
14885         ;;
14886 esac
14887
14888 : see if setregid exists
14889 set setregid d_setregid
14890 eval $inlibc
14891 set setresgid d_setresgid
14892 eval $inlibc
14893
14894 : see if setreuid exists
14895 set setreuid d_setreuid
14896 eval $inlibc
14897 set setresuid d_setresuid
14898 eval $inlibc
14899
14900 : see if setrgid exists
14901 set setrgid d_setrgid
14902 eval $inlibc
14903
14904 : see if setruid exists
14905 set setruid d_setruid
14906 eval $inlibc
14907
14908 : see if setservent exists
14909 set setservent d_setsent
14910 eval $inlibc
14911
14912 : see if setservent_r exists
14913 set setservent_r d_setservent_r
14914 eval $inlibc
14915 case "$d_setservent_r" in
14916 "$define")
14917         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14918         case "$d_setservent_r_proto:$usethreads" in
14919         ":define")      d_setservent_r_proto=define
14920                 set d_setservent_r_proto setservent_r $hdrs
14921                 eval $hasproto ;;
14922         *)      ;;
14923         esac
14924         case "$d_setservent_r_proto" in
14925         define)
14926         case "$setservent_r_proto" in
14927         ''|0) try='int setservent_r(int, struct servent_data*);'
14928         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
14929         esac
14930         case "$setservent_r_proto" in
14931         ''|0) try='void setservent_r(int, struct servent_data*);'
14932         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
14933         esac
14934         case "$setservent_r_proto" in
14935         ''|0)   d_setservent_r=undef
14936                 setservent_r_proto=0
14937                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
14938         * )     case "$setservent_r_proto" in
14939                 REENTRANT_PROTO*) ;;
14940                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
14941                 esac
14942                 echo "Prototype: $try" ;;
14943         esac
14944         ;;
14945         *)      case "$usethreads" in
14946                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
14947                 esac
14948                 d_setservent_r=undef
14949                 setservent_r_proto=0
14950                 ;;
14951         esac
14952         ;;
14953 *)      setservent_r_proto=0
14954         ;;
14955 esac
14956
14957 : see if setsid exists
14958 set setsid d_setsid
14959 eval $inlibc
14960
14961 : see if setvbuf exists
14962 set setvbuf d_setvbuf
14963 eval $inlibc
14964
14965 : see if sfio.h is available
14966 set sfio.h i_sfio
14967 eval $inhdr
14968
14969
14970 : see if sfio library is available
14971 case "$i_sfio" in
14972 $define)
14973         val=''
14974         set sfreserve val
14975         eval $inlibc
14976         ;;
14977 *)
14978         val="$undef"
14979         ;;
14980 esac
14981 : Ok, but do we want to use it.
14982 case "$val" in
14983 $define)
14984         case "$usesfio" in
14985         true|$define|[yY]*) dflt='y';;
14986         *) dflt='n';;
14987         esac
14988         echo "$package can use the sfio library, but it is experimental."
14989         case "$useperlio" in
14990         "$undef")
14991             echo "For sfio also the PerlIO abstraction layer is needed."
14992             echo "Earlier you said you wouldn't want that."
14993             ;;
14994         esac
14995         rp="You seem to have sfio available, do you want to try using it?"
14996         . ./myread
14997         case "$ans" in
14998         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
14999                 useperlio="$define"
15000                 val="$define"
15001                 ;;
15002         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
15003                 val="$undef"
15004                 ;;
15005         esac
15006         ;;
15007 *)      case "$usesfio" in
15008         true|$define|[yY]*)
15009                 echo "Sorry, cannot find sfio on this machine." >&4
15010                 echo "Ignoring your setting of usesfio=$usesfio." >&4
15011                 val="$undef"
15012                 ;;
15013         esac
15014         ;;
15015 esac
15016 set d_sfio
15017 eval $setvar
15018 case "$d_sfio" in
15019 $define) usesfio='true';;
15020 *) usesfio='false';;
15021 esac
15022 case "$d_sfio" in
15023 $define) ;;
15024 *)      : Remove sfio from list of libraries to use
15025         case "$libs" in
15026         *-lsfio*)
15027                 echo "Removing unneeded -lsfio from library list" >&4
15028                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
15029                 shift
15030                 libs="$*"
15031                 echo "libs = $libs" >&4
15032                 ;;
15033         esac
15034 ;;
15035 esac
15036
15037
15038 : see if shmctl exists
15039 set shmctl d_shmctl
15040 eval $inlibc
15041
15042 : see if shmget exists
15043 set shmget d_shmget
15044 eval $inlibc
15045
15046 : see if shmat exists
15047 set shmat d_shmat
15048 eval $inlibc
15049 : see what shmat returns
15050 case "$d_shmat" in
15051 "$define")
15052         $cat >shmat.c <<'END'
15053 #include <sys/shm.h>
15054 void *shmat();
15055 END
15056         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
15057                 shmattype='void *'
15058         else
15059                 shmattype='char *'
15060         fi
15061         echo "and it returns ($shmattype)." >&4
15062         : see if a prototype for shmat is available
15063         xxx=`./findhdr sys/shm.h`
15064         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
15065         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
15066                 val="$define"
15067         else
15068                 val="$undef"
15069         fi
15070         $rm -f shmat.[co]
15071         ;;
15072 *)
15073         val="$undef"
15074         ;;
15075 esac
15076 set d_shmatprototype
15077 eval $setvar
15078
15079 : see if shmdt exists
15080 set shmdt d_shmdt
15081 eval $inlibc
15082
15083 : see how much of the 'shm*(2)' library is present.
15084 h_shm=true
15085 echo " "
15086 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
15087 *"$undef"*) h_shm=false;;
15088 esac
15089 case "$osname" in
15090 freebsd)
15091     case "`ipcs 2>&1`" in
15092     "SVID shared memory"*"not configured"*)
15093         echo "Your $osname does not have the shm*(2) configured." >&4
15094         h_shm=false
15095         val="$undef"
15096         set shmctl d_shmctl
15097         evat $setvar
15098         set shmget d_shmget
15099         evat $setvar
15100         set shmat d_shmat
15101         evat $setvar
15102         set shmdt d_shmdt
15103         evat $setvar
15104         ;;
15105     esac
15106     ;;
15107 esac
15108 : we could also check for sys/ipc.h ...
15109 if $h_shm && $test `./findhdr sys/shm.h`; then
15110         echo "You have the full shm*(2) library." >&4
15111         val="$define"
15112 else
15113         echo "You don't have the full shm*(2) library." >&4
15114         val="$undef"
15115 fi
15116 set d_shm
15117 eval $setvar
15118
15119 echo " "
15120 : see if we have sigaction
15121 if set sigaction val -f d_sigaction; eval $csym; $val; then
15122         echo 'sigaction() found.' >&4
15123         $cat > try.c <<'EOP'
15124 #include <stdio.h>
15125 #include <sys/types.h>
15126 #include <signal.h>
15127 int main()
15128 {
15129     struct sigaction act, oact;
15130     act.sa_flags = 0;
15131     oact.sa_handler = 0;
15132     /* so that act and oact are used */
15133     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
15134 }
15135 EOP
15136         set try
15137         if eval $compile_ok; then
15138                 val="$define"
15139         else
15140                 echo "But you don't seem to have a useable struct sigaction." >&4
15141                 val="$undef"
15142         fi
15143 else
15144         echo 'sigaction NOT found.' >&4
15145         val="$undef"
15146 fi
15147 set d_sigaction; eval $setvar
15148 $rm -f try try$_o try.c
15149
15150 : see if sigprocmask exists
15151 set sigprocmask d_sigprocmask
15152 eval $inlibc
15153
15154 : see if sigsetjmp exists
15155 echo " "
15156 case "$d_sigsetjmp" in
15157 '')
15158         $cat >try.c <<'EOP'
15159 #include <setjmp.h>
15160 sigjmp_buf env;
15161 int set = 1;
15162 int main()
15163 {
15164         if (sigsetjmp(env,1))
15165                 exit(set);
15166         set = 0;
15167         siglongjmp(env, 1);
15168         exit(1);
15169 }
15170 EOP
15171         set try
15172         if eval $compile; then
15173                 if $run ./try >/dev/null 2>&1; then
15174                         echo "POSIX sigsetjmp found." >&4
15175                         val="$define"
15176                 else
15177                         $cat >&4 <<EOM
15178 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
15179 I'll ignore them.
15180 EOM
15181                         val="$undef"
15182                 fi
15183         else
15184                 echo "sigsetjmp not found." >&4
15185                 val="$undef"
15186         fi
15187         ;;
15188 *) val="$d_sigsetjmp"
15189         case "$d_sigsetjmp" in
15190         $define) echo "POSIX sigsetjmp found." >&4;;
15191         $undef) echo "sigsetjmp not found." >&4;;
15192         esac
15193         ;;
15194 esac
15195 set d_sigsetjmp
15196 eval $setvar
15197 $rm -f try.c try
15198
15199 : see if sockatmark exists
15200 set sockatmark d_sockatmark
15201 eval $inlibc
15202
15203 : see if prototype for sockatmark is available
15204 echo " "
15205 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
15206 eval $hasproto
15207
15208 : see if socks5_init exists
15209 set socks5_init d_socks5_init
15210 eval $inlibc
15211
15212 : see if srand48_r exists
15213 set srand48_r d_srand48_r
15214 eval $inlibc
15215 case "$d_srand48_r" in
15216 "$define")
15217         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15218         case "$d_srand48_r_proto:$usethreads" in
15219         ":define")      d_srand48_r_proto=define
15220                 set d_srand48_r_proto srand48_r $hdrs
15221                 eval $hasproto ;;
15222         *)      ;;
15223         esac
15224         case "$d_srand48_r_proto" in
15225         define)
15226         case "$srand48_r_proto" in
15227         ''|0) try='int srand48_r(long, struct drand48_data*);'
15228         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
15229         esac
15230         case "$srand48_r_proto" in
15231         ''|0)   d_srand48_r=undef
15232                 srand48_r_proto=0
15233                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
15234         * )     case "$srand48_r_proto" in
15235                 REENTRANT_PROTO*) ;;
15236                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
15237                 esac
15238                 echo "Prototype: $try" ;;
15239         esac
15240         ;;
15241         *)      case "$usethreads" in
15242                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
15243                 esac
15244                 d_srand48_r=undef
15245                 srand48_r_proto=0
15246                 ;;
15247         esac
15248         ;;
15249 *)      srand48_r_proto=0
15250         ;;
15251 esac
15252
15253 : see if srandom_r exists
15254 set srandom_r d_srandom_r
15255 eval $inlibc
15256 case "$d_srandom_r" in
15257 "$define")
15258         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15259         case "$d_srandom_r_proto:$usethreads" in
15260         ":define")      d_srandom_r_proto=define
15261                 set d_srandom_r_proto srandom_r $hdrs
15262                 eval $hasproto ;;
15263         *)      ;;
15264         esac
15265         case "$d_srandom_r_proto" in
15266         define)
15267         case "$srandom_r_proto" in
15268         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
15269         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
15270         esac
15271         case "$srandom_r_proto" in
15272         ''|0)   d_srandom_r=undef
15273                 srandom_r_proto=0
15274                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
15275         * )     case "$srandom_r_proto" in
15276                 REENTRANT_PROTO*) ;;
15277                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
15278                 esac
15279                 echo "Prototype: $try" ;;
15280         esac
15281         ;;
15282         *)      case "$usethreads" in
15283                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
15284                 esac
15285                 d_srandom_r=undef
15286                 srandom_r_proto=0
15287                 ;;
15288         esac
15289         ;;
15290 *)      srandom_r_proto=0
15291         ;;
15292 esac
15293
15294 : see if prototype for setresgid is available
15295 echo " "
15296 set d_sresgproto setresgid $i_unistd unistd.h
15297 eval $hasproto
15298
15299 : see if prototype for setresuid is available
15300 echo " "
15301 set d_sresuproto setresuid $i_unistd unistd.h
15302 eval $hasproto
15303
15304 : see if sys/stat.h is available
15305 set sys/stat.h i_sysstat
15306 eval $inhdr
15307
15308
15309 : see if stat knows about block sizes
15310 echo " "
15311 echo "Checking to see if your struct stat has st_blocks field..." >&4
15312 set d_statblks stat st_blocks $i_sysstat sys/stat.h
15313 eval $hasfield
15314
15315
15316 : see if this is a sys/vfs.h system
15317 set sys/vfs.h i_sysvfs
15318 eval $inhdr
15319
15320
15321 : see if this is a sys/statfs.h system
15322 set sys/statfs.h i_sysstatfs
15323 eval $inhdr
15324
15325
15326 echo " "
15327 echo "Checking to see if your system supports struct statfs..." >&4
15328 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
15329 eval $hasstruct
15330 case "$d_statfs_s" in
15331 "$define")      echo "Yes, it does."   ;;
15332 *)              echo "No, it doesn't." ;;
15333 esac
15334
15335
15336
15337 : see if struct statfs knows about f_flags
15338 case "$d_statfs_s" in
15339 define) 
15340         echo " "
15341         echo "Checking to see if your struct statfs has f_flags field..." >&4
15342         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
15343         eval $hasfield
15344         ;;
15345 *)      val="$undef"
15346         set d_statfs_f_flags
15347         eval $setvar
15348         ;;
15349 esac
15350 case "$d_statfs_f_flags" in
15351 "$define")      echo "Yes, it does."   ;;
15352 *)              echo "No, it doesn't." ;;
15353 esac
15354
15355 : see if _ptr and _cnt from stdio act std
15356 echo " "
15357
15358 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
15359         echo "(Looks like you have stdio.h from BSD.)"
15360         case "$stdio_ptr" in
15361         '') stdio_ptr='((fp)->_p)'
15362                 ptr_lval=$define
15363                 ;;
15364         *)      ptr_lval=$d_stdio_ptr_lval;;
15365         esac
15366         case "$stdio_cnt" in
15367         '') stdio_cnt='((fp)->_r)'
15368                 cnt_lval=$define
15369                 ;;
15370         *)      cnt_lval=$d_stdio_cnt_lval;;
15371         esac
15372         case "$stdio_base" in
15373         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
15374         esac
15375         case "$stdio_bufsiz" in
15376         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
15377         esac
15378 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
15379         echo "(Looks like you have stdio.h from Linux.)"
15380         case "$stdio_ptr" in
15381         '') stdio_ptr='((fp)->_IO_read_ptr)'
15382                 ptr_lval=$define
15383                 ;;
15384         *)      ptr_lval=$d_stdio_ptr_lval;;
15385         esac
15386         case "$stdio_cnt" in
15387         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
15388                 cnt_lval=$undef
15389                 ;;
15390         *)      cnt_lval=$d_stdio_cnt_lval;;
15391         esac
15392         case "$stdio_base" in
15393         '') stdio_base='((fp)->_IO_read_base)';;
15394         esac
15395         case "$stdio_bufsiz" in
15396         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
15397         esac
15398 else
15399         case "$stdio_ptr" in
15400         '') stdio_ptr='((fp)->_ptr)'
15401                 ptr_lval=$define
15402                 ;;
15403         *)      ptr_lval=$d_stdio_ptr_lval;;
15404         esac
15405         case "$stdio_cnt" in
15406         '') stdio_cnt='((fp)->_cnt)'
15407                 cnt_lval=$define
15408                 ;;
15409         *)      cnt_lval=$d_stdio_cnt_lval;;
15410         esac
15411         case "$stdio_base" in
15412         '') stdio_base='((fp)->_base)';;
15413         esac
15414         case "$stdio_bufsiz" in
15415         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
15416         esac
15417 fi
15418
15419 : test whether _ptr and _cnt really work
15420 echo "Checking how std your stdio is..." >&4
15421 $cat >try.c <<EOP
15422 #include <stdio.h>
15423 #define FILE_ptr(fp)    $stdio_ptr
15424 #define FILE_cnt(fp)    $stdio_cnt
15425 int main() {
15426         FILE *fp = fopen("try.c", "r");
15427         char c = getc(fp);
15428         if (
15429                 18 <= FILE_cnt(fp) &&
15430                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15431         )
15432                 exit(0);
15433         exit(1);
15434 }
15435 EOP
15436 val="$undef"
15437 set try
15438 if eval $compile && $to try.c; then
15439         if $run ./try; then
15440                 echo "Your stdio acts pretty std."
15441                 val="$define"
15442         else
15443                 echo "Your stdio isn't very std."
15444         fi
15445 else
15446         echo "Your stdio doesn't appear very std."
15447 fi
15448 $rm -f try.c try
15449
15450 # glibc 2.2.90 and above apparently change stdio streams so Perl's
15451 # direct buffer manipulation no longer works.  The Configure tests
15452 # should be changed to correctly detect this, but until then,
15453 # the following check should at least let perl compile and run.
15454 # (This quick fix should be updated before 5.8.1.)
15455 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
15456 # A. Dougherty, June 3, 2002.
15457 case "$d_gnulibc" in
15458 $define)
15459         case "$gnulibc_version" in
15460         2.[01]*)  ;;
15461         2.2) ;;
15462         2.2.[0-9]) ;;
15463         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
15464                 val="$undef"
15465                 ;;
15466         esac
15467         ;;
15468 esac
15469 set d_stdstdio
15470 eval $setvar
15471
15472 : Can _ptr be used as an lvalue?
15473 case "$d_stdstdio$ptr_lval" in
15474 $define$define) val=$define ;;
15475 *) val=$undef ;;
15476 esac
15477 set d_stdio_ptr_lval
15478 eval $setvar
15479
15480 : Can _cnt be used as an lvalue?
15481 case "$d_stdstdio$cnt_lval" in
15482 $define$define) val=$define ;;
15483 *) val=$undef ;;
15484 esac
15485 set d_stdio_cnt_lval
15486 eval $setvar
15487
15488
15489 : test whether setting _ptr sets _cnt as a side effect
15490 d_stdio_ptr_lval_sets_cnt="$undef"
15491 d_stdio_ptr_lval_nochange_cnt="$undef"
15492 case "$d_stdio_ptr_lval$d_stdstdio" in
15493 $define$define)
15494         echo "Checking to see what happens if we set the stdio ptr..." >&4
15495 $cat >try.c <<EOP
15496 #include <stdio.h>
15497 /* Can we scream? */
15498 /* Eat dust sed :-) */
15499 /* In the buffer space, no one can hear you scream. */
15500 #define FILE_ptr(fp)    $stdio_ptr
15501 #define FILE_cnt(fp)    $stdio_cnt
15502 #include <sys/types.h>
15503 int main() {
15504         FILE *fp = fopen("try.c", "r");
15505         int c;
15506         char *ptr;
15507         size_t cnt;
15508         if (!fp) {
15509             puts("Fail even to read");
15510             exit(1);
15511         }
15512         c = getc(fp); /* Read away the first # */
15513         if (c == EOF) {
15514             puts("Fail even to read");
15515             exit(1);
15516         }
15517         if (!(
15518                 18 <= FILE_cnt(fp) &&
15519                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15520         )) {
15521                 puts("Fail even to read");
15522                 exit (1);
15523         }
15524         ptr = (char*) FILE_ptr(fp);
15525         cnt = (size_t)FILE_cnt(fp);
15526
15527         FILE_ptr(fp) += 42;
15528
15529         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
15530                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
15531                 exit (1);
15532         }
15533         if (FILE_cnt(fp) <= 20) {
15534                 printf ("Fail (<20 chars to test)");
15535                 exit (1);
15536         }
15537         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
15538                 puts("Fail compare");
15539                 exit (1);
15540         }
15541         if (cnt == FILE_cnt(fp)) {
15542                 puts("Pass_unchanged");
15543                 exit (0);
15544         }       
15545         if (FILE_cnt(fp) == (cnt - 42)) {
15546                 puts("Pass_changed");
15547                 exit (0);
15548         }
15549         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
15550         return 1;
15551
15552 }
15553 EOP
15554         set try
15555         if eval $compile && $to try.c; then
15556                 case `$run ./try` in
15557                 Pass_changed)
15558                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
15559                         d_stdio_ptr_lval_sets_cnt="$define" ;;
15560                 Pass_unchanged)
15561                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
15562                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
15563                 Fail*)
15564                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
15565                 *)
15566                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
15567         esac
15568         else
15569                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
15570         fi
15571         $rm -f try.c try
15572         ;;
15573 esac
15574
15575 : see if _base is also standard
15576 val="$undef"
15577 case "$d_stdstdio" in
15578 $define)
15579         $cat >try.c <<EOP
15580 #include <stdio.h>
15581 #define FILE_base(fp)   $stdio_base
15582 #define FILE_bufsiz(fp) $stdio_bufsiz
15583 int main() {
15584         FILE *fp = fopen("try.c", "r");
15585         char c = getc(fp);
15586         if (
15587                 19 <= FILE_bufsiz(fp) &&
15588                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
15589         )
15590                 exit(0);
15591         exit(1);
15592 }
15593 EOP
15594         set try
15595         if eval $compile && $to try.c; then
15596                 if $run ./try; then
15597                         echo "And its _base field acts std."
15598                         val="$define"
15599                 else
15600                         echo "But its _base field isn't std."
15601                 fi
15602         else
15603                 echo "However, it seems to be lacking the _base field."
15604         fi
15605         $rm -f try.c try
15606         ;;
15607 esac
15608 set d_stdiobase
15609 eval $setvar
15610
15611 $cat >&4 <<EOM
15612 Checking how to access stdio streams by file descriptor number...
15613 EOM
15614 case "$stdio_stream_array" in
15615 '')     $cat >try.c <<EOCP
15616 #include <stdio.h>
15617 int main() {
15618   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
15619     printf("yes\n");
15620 }
15621 EOCP
15622         for s in _iob __iob __sF
15623         do
15624                 set try -DSTDIO_STREAM_ARRAY=$s
15625                 if eval $compile; then
15626                         case "`$run ./try`" in
15627                         yes)    stdio_stream_array=$s; break ;;
15628                         esac
15629                 fi
15630         done
15631         $rm -f try.* try$exe_ext
15632 esac
15633 case "$stdio_stream_array" in
15634 '')     $cat >&4 <<EOM
15635 I can't figure out how to access stdio streams by file descriptor number.
15636 EOM
15637         d_stdio_stream_array="$undef"
15638         ;;
15639 *)      $cat >&4 <<EOM
15640 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
15641 EOM
15642         d_stdio_stream_array="$define"
15643         ;;
15644 esac
15645
15646 : see if strcoll exists
15647 set strcoll d_strcoll
15648 eval $inlibc
15649
15650 : check for structure copying
15651 echo " "
15652 echo "Checking to see if your C compiler can copy structs..." >&4
15653 $cat >try.c <<'EOCP'
15654 main()
15655 {
15656         struct blurfl {
15657                 int dyick;
15658         } foo, bar;
15659
15660         foo = bar;
15661 }
15662 EOCP
15663 if $cc -c try.c >/dev/null 2>&1 ; then
15664         val="$define"
15665         echo "Yup, it can."
15666 else
15667         val="$undef"
15668         echo "Nope, it can't."
15669 fi
15670 set d_strctcpy
15671 eval $setvar
15672 $rm -f try.*
15673
15674 : see if strerror and/or sys_errlist[] exist
15675 echo " "
15676 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
15677     if set strerror val -f d_strerror; eval $csym; $val; then
15678                 echo 'strerror() found.' >&4
15679                 d_strerror="$define"
15680                 d_strerrm='strerror(e)'
15681                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
15682                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
15683                         d_syserrlst="$define"
15684                 else
15685                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
15686                         d_syserrlst="$undef"
15687                 fi
15688     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
15689                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
15690                 echo 'strerror() found in string header.' >&4
15691                 d_strerror="$define"
15692                 d_strerrm='strerror(e)'
15693                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
15694                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
15695                                 d_syserrlst="$define"
15696                 else
15697                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
15698                         d_syserrlst="$undef"
15699                 fi
15700     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
15701                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
15702                 d_strerror="$undef"
15703                 d_syserrlst="$define"
15704                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
15705     else
15706                 echo 'strerror() and sys_errlist[] NOT found.' >&4
15707                 d_strerror="$undef"
15708                 d_syserrlst="$undef"
15709                 d_strerrm='"unknown"'
15710     fi
15711 fi
15712
15713 : see if strerror_r exists
15714 set strerror_r d_strerror_r
15715 eval $inlibc
15716 case "$d_strerror_r" in
15717 "$define")
15718         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
15719         case "$d_strerror_r_proto:$usethreads" in
15720         ":define")      d_strerror_r_proto=define
15721                 set d_strerror_r_proto strerror_r $hdrs
15722                 eval $hasproto ;;
15723         *)      ;;
15724         esac
15725         case "$d_strerror_r_proto" in
15726         define)
15727         case "$strerror_r_proto" in
15728         ''|0) try='int strerror_r(int, char*, size_t);'
15729         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
15730         esac
15731         case "$strerror_r_proto" in
15732         ''|0) try='int strerror_r(int, char*, int);'
15733         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
15734         esac
15735         case "$strerror_r_proto" in
15736         ''|0) try='char* strerror_r(int, char*, size_t);'
15737         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
15738         esac
15739         case "$strerror_r_proto" in
15740         ''|0)   d_strerror_r=undef
15741                 strerror_r_proto=0
15742                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
15743         * )     case "$strerror_r_proto" in
15744                 REENTRANT_PROTO*) ;;
15745                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
15746                 esac
15747                 echo "Prototype: $try" ;;
15748         esac
15749         ;;
15750         *)      case "$usethreads" in
15751                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
15752                 esac
15753                 d_strerror_r=undef
15754                 strerror_r_proto=0
15755                 ;;
15756         esac
15757         ;;
15758 *)      strerror_r_proto=0
15759         ;;
15760 esac
15761
15762 : see if strftime exists
15763 set strftime d_strftime
15764 eval $inlibc
15765
15766 : see if strtod exists
15767 set strtod d_strtod
15768 eval $inlibc
15769
15770 : see if strtol exists
15771 set strtol d_strtol
15772 eval $inlibc
15773
15774 : see if strtold exists
15775 set strtold d_strtold
15776 eval $inlibc
15777
15778 : see if strtoll exists
15779 set strtoll d_strtoll
15780 eval $inlibc
15781
15782 case "$d_longlong-$d_strtoll" in
15783 "$define-$define")
15784         $cat <<EOM
15785 Checking whether your strtoll() works okay...
15786 EOM
15787         $cat >try.c <<'EOCP'
15788 #include <errno.h>
15789 #ifdef __hpux
15790 #define strtoll __strtoll
15791 #endif
15792 #ifdef __EMX__
15793 #define strtoll _strtoll
15794 #endif
15795 #include <stdio.h>
15796 extern long long int strtoll(char *s, char **, int); 
15797 static int bad = 0;
15798 int check(char *s, long long ell, int een) {
15799         long long gll;
15800         errno = 0;
15801         gll = strtoll(s, 0, 10);
15802         if (!((gll == ell) && (errno == een)))
15803                 bad++;
15804 }
15805 int main() {
15806         check(" 1",                                      1LL, 0);
15807         check(" 0",                                      0LL, 0);
15808         check("-1",                                     -1LL, 0);
15809         check("-9223372036854775808", -9223372036854775808LL, 0);
15810         check("-9223372036854775808", -9223372036854775808LL, 0);
15811         check(" 9223372036854775807",  9223372036854775807LL, 0);
15812         check("-9223372036854775808", -9223372036854775808LL, 0);
15813         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
15814         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
15815         if (!bad)
15816                 printf("ok\n");
15817 }
15818 EOCP
15819         set try
15820         if eval $compile; then
15821                 yyy=`$run ./try`
15822                 case "$yyy" in
15823                 ok) echo "Your strtoll() seems to be working okay." ;;
15824                 *) cat <<EOM >&4
15825 Your strtoll() doesn't seem to be working okay.
15826 EOM
15827                    d_strtoll="$undef"
15828                    ;;
15829                 esac
15830         else
15831                 echo "(I can't seem to compile the test program--assuming it doesn't)"
15832                 d_strtoll="$undef"
15833         fi
15834         ;;
15835 esac
15836
15837 : see if strtoq exists
15838 set strtoq d_strtoq
15839 eval $inlibc
15840
15841 : see if strtoul exists
15842 set strtoul d_strtoul
15843 eval $inlibc
15844
15845 case "$d_strtoul" in
15846 "$define")
15847         $cat <<EOM
15848 Checking whether your strtoul() works okay...
15849 EOM
15850         $cat >try.c <<'EOCP'
15851 #include <errno.h>
15852 #include <stdio.h>
15853 extern unsigned long int strtoul(char *s, char **, int); 
15854 static int bad = 0;
15855 void check(char *s, unsigned long eul, int een) {
15856         unsigned long gul;
15857         errno = 0;
15858         gul = strtoul(s, 0, 10);
15859         if (!((gul == eul) && (errno == een)))
15860                 bad++;
15861 }
15862 int main() {
15863         check(" 1", 1L, 0);
15864         check(" 0", 0L, 0);
15865 EOCP
15866         case "$longsize" in
15867         8)
15868             $cat >>try.c <<'EOCP'
15869         check("18446744073709551615", 18446744073709551615UL, 0);
15870         check("18446744073709551616", 18446744073709551615UL, ERANGE);
15871 #if 0 /* strtoul() for /^-/ strings is undefined. */
15872         check("-1", 18446744073709551615UL, 0);
15873         check("-18446744073709551614", 2, 0);
15874         check("-18446744073709551615", 1, 0);
15875         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
15876         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
15877 #endif
15878 EOCP
15879                 ;;
15880         4)
15881                     $cat >>try.c <<'EOCP'
15882         check("4294967295", 4294967295UL, 0);
15883         check("4294967296", 4294967295UL, ERANGE);
15884 #if 0 /* strtoul() for /^-/ strings is undefined. */
15885         check("-1", 4294967295UL, 0);
15886         check("-4294967294", 2, 0);
15887         check("-4294967295", 1, 0);
15888         check("-4294967296", 4294967295UL, ERANGE);
15889         check("-4294967297", 4294967295UL, ERANGE);
15890 #endif
15891 EOCP
15892                 ;;
15893         *)
15894 : Should we write these tests to be more portable by sprintf-ing
15895 : ~0 and then manipulating that char string as input for strtol?
15896                 ;;
15897         esac
15898         $cat >>try.c <<'EOCP'
15899         if (!bad)
15900                 printf("ok\n");
15901         return 0;
15902 }
15903 EOCP
15904         set try
15905         if eval $compile; then
15906                 case "`$run ./try`" in
15907                 ok) echo "Your strtoul() seems to be working okay." ;;
15908                 *) cat <<EOM >&4
15909 Your strtoul() doesn't seem to be working okay.
15910 EOM
15911                    d_strtoul="$undef"
15912                    ;;
15913                 esac
15914         fi
15915         ;;
15916 esac
15917
15918 : see if strtoull exists
15919 set strtoull d_strtoull
15920 eval $inlibc
15921
15922 case "$d_longlong-$d_strtoull" in
15923 "$define-$define")
15924         $cat <<EOM
15925 Checking whether your strtoull() works okay...
15926 EOM
15927         $cat >try.c <<'EOCP'
15928 #include <errno.h>
15929 #ifdef __hpux
15930 #define strtoull __strtoull
15931 #endif
15932 #include <stdio.h>
15933 extern unsigned long long int strtoull(char *s, char **, int); 
15934 static int bad = 0;
15935 int check(char *s, long long eull, int een) {
15936         long long gull;
15937         errno = 0;
15938         gull = strtoull(s, 0, 10);
15939         if (!((gull == eull) && (errno == een)))
15940                 bad++;
15941 }
15942 int main() {
15943         check(" 1",                                        1LL, 0);
15944         check(" 0",                                        0LL, 0);
15945         check("18446744073709551615",  18446744073709551615ULL, 0);
15946         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
15947 #if 0 /* strtoull() for /^-/ strings is undefined. */
15948         check("-1",                    18446744073709551615ULL, 0);
15949         check("-18446744073709551614",                     2LL, 0);
15950         check("-18446744073709551615",                     1LL, 0);
15951         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
15952         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
15953 #endif
15954         if (!bad)
15955                 printf("ok\n");
15956 }
15957 EOCP
15958         set try
15959         if eval $compile; then
15960                 case "`$run ./try`" in
15961                 ok) echo "Your strtoull() seems to be working okay." ;;
15962                 *) cat <<EOM >&4
15963 Your strtoull() doesn't seem to be working okay.
15964 EOM
15965                    d_strtoull="$undef"
15966                    ;;
15967                 esac
15968         fi
15969         ;;
15970 esac
15971
15972 : see if strtouq exists
15973 set strtouq d_strtouq
15974 eval $inlibc
15975
15976 case "$d_strtouq" in
15977 "$define")
15978         $cat <<EOM
15979 Checking whether your strtouq() works okay...
15980 EOM
15981         $cat >try.c <<'EOCP'
15982 #include <errno.h>
15983 #include <stdio.h>
15984 extern unsigned long long int strtouq(char *s, char **, int); 
15985 static int bad = 0;
15986 void check(char *s, unsigned long long eull, int een) {
15987         unsigned long long gull;
15988         errno = 0;
15989         gull = strtouq(s, 0, 10);
15990         if (!((gull == eull) && (errno == een)))
15991                 bad++;
15992 }
15993 int main() {
15994         check(" 1",                                        1LL, 0);
15995         check(" 0",                                        0LL, 0);
15996         check("18446744073709551615",  18446744073709551615ULL, 0);
15997         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
15998 #if 0 /* strtouq() for /^-/ strings is undefined. */
15999         check("-1",                    18446744073709551615ULL, 0);
16000         check("-18446744073709551614",                     2LL, 0);
16001         check("-18446744073709551615",                     1LL, 0);
16002         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16003         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
16004 #endif
16005         if (!bad)
16006                 printf("ok\n");
16007         return 0;
16008 }
16009 EOCP
16010         set try
16011         if eval $compile; then
16012                 case "`$run ./try`" in
16013                 ok) echo "Your strtouq() seems to be working okay." ;;
16014                 *) cat <<EOM >&4
16015 Your strtouq() doesn't seem to be working okay.
16016 EOM
16017                    d_strtouq="$undef"
16018                    ;;
16019                 esac
16020         fi
16021         ;;
16022 esac
16023
16024 : see if strxfrm exists
16025 set strxfrm d_strxfrm
16026 eval $inlibc
16027
16028 : see if symlink exists
16029 set symlink d_symlink
16030 eval $inlibc
16031
16032 : see if syscall exists
16033 set syscall d_syscall
16034 eval $inlibc
16035
16036 : see if prototype for syscall is available
16037 echo " "
16038 set d_syscallproto syscall $i_unistd unistd.h
16039 eval $hasproto
16040
16041 : see if sysconf exists
16042 set sysconf d_sysconf
16043 eval $inlibc
16044
16045 : see if system exists
16046 set system d_system
16047 eval $inlibc
16048
16049 : see if tcgetpgrp exists
16050 set tcgetpgrp d_tcgetpgrp
16051 eval $inlibc
16052
16053 : see if tcsetpgrp exists
16054 set tcsetpgrp d_tcsetpgrp
16055 eval $inlibc
16056
16057 : see if prototype for telldir is available
16058 echo " "
16059 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
16060 eval $hasproto
16061
16062 : see if time exists
16063 echo " "
16064 if test "X$d_time" = X -o X"$timetype" = X; then
16065     if set time val -f d_time; eval $csym; $val; then
16066                 echo 'time() found.' >&4
16067                 val="$define"
16068                 rp="What is the type returned by time() on this system?"
16069                 set time_t timetype long stdio.h sys/types.h
16070                 eval $typedef_ask
16071     else
16072                 echo 'time() not found, hope that will do.' >&4
16073                 val="$undef"
16074                 timetype='int';
16075     fi
16076     set d_time
16077     eval $setvar
16078 fi
16079
16080 : see if this is a sys/times.h system
16081 set sys/times.h i_systimes
16082 eval $inhdr
16083
16084 : see if times exists
16085 echo " "
16086 if set times val -f d_times; eval $csym; $val; then
16087         echo 'times() found.' >&4
16088         d_times="$define"
16089         inc=''
16090         case "$i_systimes" in
16091         "$define") inc='sys/times.h';;
16092         esac
16093         rp="What is the type returned by times() on this system?"
16094         set clock_t clocktype long stdio.h sys/types.h $inc
16095         eval $typedef_ask
16096 else
16097         echo 'times() NOT found, hope that will do.' >&4
16098         d_times="$undef"
16099         clocktype='int'
16100 fi
16101
16102 : see if tmpnam_r exists
16103 set tmpnam_r d_tmpnam_r
16104 eval $inlibc
16105 case "$d_tmpnam_r" in
16106 "$define")
16107         hdrs="$i_systypes sys/types.h define stdio.h "
16108         case "$d_tmpnam_r_proto:$usethreads" in
16109         ":define")      d_tmpnam_r_proto=define
16110                 set d_tmpnam_r_proto tmpnam_r $hdrs
16111                 eval $hasproto ;;
16112         *)      ;;
16113         esac
16114         case "$d_tmpnam_r_proto" in
16115         define)
16116         case "$tmpnam_r_proto" in
16117         ''|0) try='char* tmpnam_r(char*);'
16118         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
16119         esac
16120         case "$tmpnam_r_proto" in
16121         ''|0)   d_tmpnam_r=undef
16122                 tmpnam_r_proto=0
16123                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
16124         * )     case "$tmpnam_r_proto" in
16125                 REENTRANT_PROTO*) ;;
16126                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
16127                 esac
16128                 echo "Prototype: $try" ;;
16129         esac
16130         ;;
16131         *)      case "$usethreads" in
16132                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
16133                 esac
16134                 d_tmpnam_r=undef
16135                 tmpnam_r_proto=0
16136                 ;;
16137         esac
16138         ;;
16139 *)      tmpnam_r_proto=0
16140         ;;
16141 esac
16142
16143 : see if truncate exists
16144 set truncate d_truncate
16145 eval $inlibc
16146
16147 : see if ttyname_r exists
16148 set ttyname_r d_ttyname_r
16149 eval $inlibc
16150 case "$d_ttyname_r" in
16151 "$define")
16152         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
16153         case "$d_ttyname_r_proto:$usethreads" in
16154         ":define")      d_ttyname_r_proto=define
16155                 set d_ttyname_r_proto ttyname_r $hdrs
16156                 eval $hasproto ;;
16157         *)      ;;
16158         esac
16159         case "$d_ttyname_r_proto" in
16160         define)
16161         case "$ttyname_r_proto" in
16162         ''|0) try='int ttyname_r(int, char*, size_t);'
16163         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
16164         esac
16165         case "$ttyname_r_proto" in
16166         ''|0) try='int ttyname_r(int, char*, int);'
16167         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
16168         esac
16169         case "$ttyname_r_proto" in
16170         ''|0) try='char* ttyname_r(int, char*, int);'
16171         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
16172         esac
16173         case "$ttyname_r_proto" in
16174         ''|0)   d_ttyname_r=undef
16175                 ttyname_r_proto=0
16176                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
16177         * )     case "$ttyname_r_proto" in
16178                 REENTRANT_PROTO*) ;;
16179                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
16180                 esac
16181                 echo "Prototype: $try" ;;
16182         esac
16183         ;;
16184         *)      case "$usethreads" in
16185                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
16186                 esac
16187                 d_ttyname_r=undef
16188                 ttyname_r_proto=0
16189                 ;;
16190         esac
16191         ;;
16192 *)      ttyname_r_proto=0
16193         ;;
16194 esac
16195
16196 : see if tzname[] exists
16197 echo " "
16198 if set tzname val -a d_tzname; eval $csym; $val; then
16199         val="$define"
16200         echo 'tzname[] found.' >&4
16201 else
16202         val="$undef"
16203         echo 'tzname[] NOT found.' >&4
16204 fi
16205 set d_tzname
16206 eval $setvar
16207
16208 case "$osname" in
16209 next|rhapsody|darwin) multiarch="$define" ;;
16210 esac
16211 case "$multiarch" in
16212 ''|[nN]*) multiarch="$undef" ;;
16213 esac
16214
16215 : check for ordering of bytes in a UV
16216 echo " "
16217 case "$usecrosscompile$multiarch" in
16218 *$define*)
16219         $cat <<EOM
16220 You seem to be either cross-compiling or doing a multiarchitecture build,
16221 skipping the byteorder check.
16222
16223 EOM
16224         byteorder='ffff'
16225         ;;
16226 *)
16227         case "$byteorder" in
16228         '')
16229                 $cat <<'EOM'
16230 In the following, larger digits indicate more significance.  A big-endian
16231 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
16232 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
16233 machines may have weird orders like 3412.  A Cray will report 87654321,
16234 an Alpha will report 12345678. If the test program works the default is
16235 probably right.
16236 I'm now running the test program...
16237 EOM
16238                 $cat >try.c <<EOCP
16239 #include <stdio.h>
16240 #include <sys/types.h>
16241 typedef $uvtype UV;
16242 int main()
16243 {
16244         int i;
16245         union {
16246                 UV l;
16247                 char c[$uvsize];
16248         } u;
16249
16250         if ($uvsize > 4)
16251                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
16252         else
16253                 u.l = (UV)0x04030201;
16254         for (i = 0; i < $uvsize; i++)
16255                 printf("%c", u.c[i]+'0');
16256         printf("\n");
16257         exit(0);
16258 }
16259 EOCP
16260                 xxx_prompt=y
16261                 set try
16262                 if eval $compile && ./try > /dev/null; then
16263                         dflt=`$run ./try`
16264                         case "$dflt" in
16265                         [1-4][1-4][1-4][1-4]|12345678|87654321)
16266                                 echo "(The test program ran ok.)"
16267                                 echo "byteorder=$dflt"
16268                                 xxx_prompt=n
16269                         ;;
16270                         ????|????????) echo "(The test program ran ok.)" ;;
16271                         *) echo "(The test program didn't run right for some reason.)" ;;
16272                         esac
16273                 else
16274                         dflt='4321'
16275                         cat <<'EOM'
16276 (I can't seem to compile the test program.  Guessing big-endian...)
16277 EOM
16278                 fi
16279                 case "$xxx_prompt" in
16280                 y)
16281                         rp="What is the order of bytes in $uvtype?"
16282                         . ./myread
16283                         byteorder="$ans"
16284                         ;;
16285                 *)      byteorder=$dflt
16286                         ;;
16287                 esac
16288                 ;;
16289         esac
16290         $rm -f try.c try
16291         ;;
16292 esac
16293
16294
16295 $cat <<EOM
16296
16297 Checking to see whether you can access character data unalignedly...
16298 EOM
16299 case "$d_u32align" in
16300 '')   $cat >try.c <<EOCP
16301 #include <stdio.h>
16302 #define U32 $u32type
16303 #define BYTEORDER 0x$byteorder
16304 #define U8 $u8type
16305 #include <signal.h>
16306 #ifdef SIGBUS
16307 $signal_t bletch(s) int s; { exit(4); }
16308 #endif
16309 int main() {
16310 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
16311     U8 buf[8];
16312     U32 *up;
16313     int i;
16314
16315     if (sizeof(U32) != 4) {
16316         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
16317         exit(1);
16318     }
16319
16320     fflush(stdout);
16321
16322 #ifdef SIGBUS
16323     signal(SIGBUS, bletch);
16324 #endif
16325
16326     buf[0] = 0;
16327     buf[1] = 0;
16328     buf[2] = 0;
16329     buf[3] = 1;
16330     buf[5] = 0;
16331     buf[6] = 0;
16332     buf[7] = 0;
16333     buf[8] = 1;
16334
16335     for (i = 0; i < 4; i++) {
16336         up = (U32*)(buf + i);
16337         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
16338                (*up == 1 << (8*(3-i)))  /* little-endian */
16339               )
16340            )
16341         {
16342             printf("read failed (%x)\n", *up);
16343             exit(2);
16344         }
16345     }
16346
16347     /* write test */
16348     for (i = 0; i < 4; i++) {
16349         up = (U32*)(buf + i);
16350         *up = 0xBeef;
16351         if (*up != 0xBeef) {
16352             printf("write failed (%x)\n", *up);
16353             exit(3);
16354         }
16355     }
16356
16357     exit(0);
16358 #else
16359     printf("1\n");
16360     exit(1);
16361 #endif
16362     return 0;
16363 }
16364 EOCP
16365 set try
16366 if eval $compile_ok; then
16367         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
16368         $run ./try 2>&1 >/dev/null
16369         case "$?" in
16370         0)      cat >&4 <<EOM
16371 You can access character data pretty unalignedly.
16372 EOM
16373                 d_u32align="$undef"
16374                 ;;
16375         *)      cat >&4 <<EOM
16376 It seems that you must access character data in an aligned manner.
16377 EOM
16378                 d_u32align="$define"
16379                 ;;
16380         esac
16381 else
16382         rp='Can you access character data at unaligned addresses?'
16383         dflt='n'
16384         . ./myread
16385         case "$ans" in
16386         [yY]*)  d_u32align="$undef"  ;;
16387         *)      d_u32align="$define" ;;
16388         esac
16389 fi
16390 $rm -f core core.try.* try.core
16391 ;;
16392 esac
16393
16394 : see if ualarm exists
16395 set ualarm d_ualarm
16396 eval $inlibc
16397
16398 : see if umask exists
16399 set umask d_umask
16400 eval $inlibc
16401
16402 : see if unordered exists
16403 set unordered d_unordered
16404 eval $inlibc
16405
16406 : see if usleep exists
16407 set usleep d_usleep
16408 eval $inlibc
16409
16410 : see if prototype for usleep is available
16411 echo " "
16412 set d_usleepproto usleep $i_unistd unistd.h
16413 eval $hasproto
16414
16415 : see if ustat exists
16416 set ustat d_ustat
16417 eval $inlibc
16418
16419 : backward compatibility for d_hvfork
16420 if test X$d_hvfork != X; then
16421         d_vfork="$d_hvfork"
16422         d_hvfork=''
16423 fi
16424 : see if there is a vfork
16425 val=''
16426 set vfork val
16427 eval $inlibc
16428
16429 : Ok, but do we want to use it. vfork is reportedly unreliable in 
16430 : perl on Solaris 2.x, and probably elsewhere.
16431 case "$val" in
16432 $define)
16433         echo " "
16434         case "$usevfork" in
16435         false) dflt='n';;
16436         *) dflt='y';;
16437         esac
16438         cat <<'EOM'
16439  
16440 Perl can only use a vfork() that doesn't suffer from strict
16441 restrictions on calling functions or modifying global data in
16442 the child.  For example, glibc-2.1 contains such a vfork()
16443 that is unsuitable.  If your system provides a proper fork()
16444 call, chances are that you do NOT want perl to use vfork().
16445
16446 EOM
16447         rp="Do you still want to use vfork()?"
16448         . ./myread
16449         case "$ans" in
16450         y|Y) ;;
16451         *)
16452                 echo "Ok, we won't use vfork()."
16453                 val="$undef"
16454                 ;;
16455         esac
16456         ;;
16457 esac
16458 set d_vfork
16459 eval $setvar
16460 case "$d_vfork" in
16461 $define) usevfork='true';;
16462 *) usevfork='false';;
16463 esac
16464
16465 : see if closedir exists
16466 set closedir d_closedir
16467 eval $inlibc
16468
16469 case "$d_closedir" in
16470 "$define")
16471         echo " "
16472         echo "Checking whether closedir() returns a status..." >&4
16473         cat > try.c <<EOM
16474 #$i_dirent I_DIRENT             /**/
16475 #$i_sysdir I_SYS_DIR            /**/
16476 #$i_sysndir I_SYS_NDIR          /**/
16477 #$i_systypes I_SYS_TYPES        /**/
16478
16479 #if defined(I_SYS_TYPES)
16480 #include <sys/types.h>
16481 #endif
16482 #if defined(I_DIRENT)
16483 #include <dirent.h>
16484 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
16485 #include <sys/dir.h>
16486 #endif
16487 #else
16488 #ifdef I_SYS_NDIR
16489 #include <sys/ndir.h>
16490 #else
16491 #ifdef I_SYS_DIR
16492 #ifdef hp9000s500
16493 #include <ndir.h>       /* may be wrong in the future */
16494 #else
16495 #include <sys/dir.h>
16496 #endif
16497 #endif
16498 #endif
16499 #endif 
16500 int main() { return closedir(opendir(".")); }
16501 EOM
16502         set try
16503         if eval $compile_ok; then
16504                 if $run ./try > /dev/null 2>&1 ; then
16505                         echo "Yes, it does."
16506                         val="$undef"
16507                 else
16508                         echo "No, it doesn't."
16509                         val="$define"
16510                 fi
16511         else
16512                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16513                 val="$define"
16514         fi
16515         ;;
16516 *)
16517         val="$undef";
16518         ;;
16519 esac
16520 set d_void_closedir
16521 eval $setvar
16522 $rm -f try try.*
16523 : see if there is a wait4
16524 set wait4 d_wait4
16525 eval $inlibc
16526
16527 : see if waitpid exists
16528 set waitpid d_waitpid
16529 eval $inlibc
16530
16531 : see if wcstombs exists
16532 set wcstombs d_wcstombs
16533 eval $inlibc
16534
16535 : see if wctomb exists
16536 set wctomb d_wctomb
16537 eval $inlibc
16538
16539 : see if writev exists
16540 set writev d_writev
16541 eval $inlibc
16542
16543 : preserve RCS keywords in files with variable substitution, grrr
16544 Date='$Date'
16545 Id='$Id'
16546 Log='$Log'
16547 RCSfile='$RCSfile'
16548 Revision='$Revision'
16549
16550 : check for alignment requirements
16551 echo " "
16552 case "$usecrosscompile$multiarch" in
16553 *$define*)
16554         $cat <<EOM
16555 You seem to be either cross-compiling or doing a multiarchitecture build,
16556 skipping the memory alignment check.
16557
16558 EOM
16559         case "$alignbytes" in
16560         '') alignbytes=8 ;;
16561         esac
16562         ;;
16563 *)
16564         case "$alignbytes" in
16565         '') echo "Checking alignment constraints..." >&4
16566                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
16567                         $cat >try.c <<'EOCP'
16568 typedef long double NV;
16569 EOCP
16570                 else
16571                         $cat >try.c <<'EOCP'
16572 typedef double NV;
16573 EOCP
16574                 fi
16575                 $cat >>try.c <<'EOCP'
16576 #include <stdio.h>
16577 struct foobar {
16578         char foo;
16579         NV bar;
16580 } try_algn;
16581 int main()
16582 {
16583     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
16584     return(0);
16585 }
16586 EOCP
16587                 set try
16588                 if eval $compile_ok; then
16589                         dflt=`$run ./try`
16590                 else
16591                         dflt='8'
16592                         echo "(I can't seem to compile the test program...)"
16593                 fi
16594                 ;;
16595         *) dflt="$alignbytes"
16596                 ;;
16597         esac
16598         rp="Doubles must be aligned on a how-many-byte boundary?"
16599         . ./myread
16600         alignbytes="$ans"
16601         $rm -f try.c try
16602         ;;
16603 esac
16604
16605
16606 : set the base revision
16607 baserev=5.0
16608
16609 : how do we catenate cpp tokens here?
16610 echo " "
16611 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
16612 $cat >cpp_stuff.c <<'EOCP'
16613 #define RCAT(a,b)a/**/b
16614 #define ACAT(a,b)a ## b
16615 RCAT(Rei,ser)
16616 ACAT(Cir,cus)
16617 EOCP
16618 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
16619 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
16620         echo "Oh!  Smells like ANSI's been here." >&4
16621         echo "We can catify or stringify, separately or together!"
16622         cpp_stuff=42
16623 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
16624         echo "Ah, yes!  The good old days!" >&4
16625         echo "However, in the good old days we don't know how to stringify and"
16626         echo "catify at the same time."
16627         cpp_stuff=1
16628 else
16629         $cat >&4 <<EOM
16630 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
16631 to have to edit the values of CAT[2-5] in config.h...
16632 EOM
16633         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
16634 fi
16635 $rm -f cpp_stuff.*
16636
16637 : see if this is a db.h system
16638 set db.h i_db
16639 eval $inhdr
16640
16641 case "$i_db" in
16642 $define)
16643         : Check db version.
16644         echo " "
16645         echo "Checking Berkeley DB version ..." >&4
16646         $cat >try.c <<EOCP
16647 #$d_const HASCONST
16648 #ifndef HASCONST
16649 #define const
16650 #endif
16651 #include <sys/types.h>
16652 #include <stdio.h>
16653 #include <db.h>
16654 int main(int argc, char *argv[])
16655 {
16656 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
16657     int Major, Minor, Patch ;
16658     unsigned long Version ;
16659     (void)db_version(&Major, &Minor, &Patch) ;
16660     if (argc == 2) {
16661         printf("%d %d %d %d %d %d\n",
16662                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
16663                Major, Minor, Patch);
16664         exit(0);
16665     }
16666     printf("You have Berkeley DB Version 2 or greater.\n");
16667
16668     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
16669                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
16670     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
16671                 Major, Minor, Patch) ;
16672
16673     /* check that db.h & libdb are compatible */
16674     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
16675         printf("db.h and libdb are incompatible.\n") ;
16676         exit(3);        
16677     }
16678
16679     printf("db.h and libdb are compatible.\n") ;
16680
16681     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
16682                 + DB_VERSION_PATCH ;
16683
16684     /* needs to be >= 2.3.4 */
16685     if (Version < 2003004) {
16686     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
16687         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
16688         exit(2);        
16689     }
16690
16691     exit(0);
16692 #else
16693 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
16694     if (argc == 2) {
16695         printf("1 0 0\n");
16696         exit(0);
16697     }
16698     printf("You have Berkeley DB Version 1.\n");
16699     exit(0);    /* DB version < 2: the coast is clear. */
16700 #else
16701     exit(1);    /* <db.h> not Berkeley DB? */
16702 #endif
16703 #endif
16704 }
16705 EOCP
16706         set try
16707         if eval $compile_ok && $run ./try; then
16708                 echo 'Looks OK.' >&4
16709                 set `$run ./try 1`
16710                 db_version_major=$1
16711                 db_version_minor=$2
16712                 db_version_patch=$3
16713         else
16714                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
16715                 i_db=$undef
16716                 case " $libs " in
16717                 *"-ldb "*)
16718                         : Remove db from list of libraries to use
16719                         echo "Removing unusable -ldb from library list" >&4
16720                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
16721                         shift
16722                         libs="$*"
16723                         echo "libs = $libs" >&4
16724                         ;;
16725                 esac
16726         fi
16727         $rm -f try.*
16728         ;;
16729 esac
16730
16731 case "$i_db" in
16732 define)
16733         : Check the return type needed for hash 
16734         echo " "
16735         echo "Checking return type needed for hash for Berkeley DB ..." >&4
16736         $cat >try.c <<EOCP
16737 #$d_const HASCONST
16738 #ifndef HASCONST
16739 #define const
16740 #endif
16741 #include <sys/types.h>
16742 #include <db.h>
16743
16744 #ifndef DB_VERSION_MAJOR
16745 u_int32_t hash_cb (ptr, size)
16746 const void *ptr;
16747 size_t size;
16748 {
16749 }
16750 HASHINFO info;
16751 int main()
16752 {
16753         info.hash = hash_cb;
16754 }
16755 #endif
16756 EOCP
16757         if $cc $ccflags -c try.c >try.out 2>&1 ; then
16758                 if $contains warning try.out >>/dev/null 2>&1 ; then
16759                         db_hashtype='int'
16760                 else
16761                         db_hashtype='u_int32_t'
16762                 fi
16763         else
16764                 : XXX Maybe we should just give up here.
16765                 db_hashtype=u_int32_t
16766                 $cat try.out >&4
16767                 echo "Help:  I can't seem to compile the db test program." >&4
16768                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
16769         fi
16770         $rm -f try.*
16771         echo "Your version of Berkeley DB uses $db_hashtype for hash."
16772         ;;
16773 *)      db_hashtype=u_int32_t
16774         ;;
16775 esac
16776 case "$i_db" in
16777 define)
16778         : Check the return type needed for prefix 
16779         echo " "
16780         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
16781         cat >try.c <<EOCP
16782 #$d_const HASCONST
16783 #ifndef HASCONST
16784 #define const
16785 #endif
16786 #include <sys/types.h>
16787 #include <db.h>
16788
16789 #ifndef DB_VERSION_MAJOR
16790 size_t prefix_cb (key1, key2)
16791 const DBT *key1;
16792 const DBT *key2;
16793 {
16794 }
16795 BTREEINFO info;
16796 int main()
16797 {
16798         info.prefix = prefix_cb;
16799 }
16800 #endif
16801 EOCP
16802         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
16803                 if $contains warning try.out >>/dev/null 2>&1 ; then
16804                         db_prefixtype='int'
16805                 else
16806                         db_prefixtype='size_t'
16807                 fi
16808         else
16809                 db_prefixtype='size_t'
16810                 : XXX Maybe we should just give up here.
16811                 $cat try.out >&4
16812                 echo "Help:  I can't seem to compile the db test program." >&4
16813                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
16814         fi
16815         $rm -f try.*
16816         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
16817         ;;
16818 *)      db_prefixtype='size_t'
16819         ;;
16820 esac
16821
16822
16823 : How can we generate normalized random numbers ?
16824 echo " "
16825 echo "Looking for a random number function..." >&4
16826 case "$randfunc" in
16827 '')
16828         if set drand48 val -f; eval $csym; $val; then
16829                 dflt="drand48"
16830                 echo "Good, found drand48()." >&4
16831         elif set random val -f; eval $csym; $val; then
16832                 dflt="random"
16833                 echo "OK, found random()." >&4
16834         else
16835                 dflt="rand"
16836                 echo "Yick, looks like I have to use rand()." >&4
16837         fi
16838         echo " "
16839         ;;
16840 *)
16841         dflt="$randfunc"
16842         ;;
16843 esac
16844 cont=true
16845
16846 case "$ccflags" in
16847 *-Dmy_rand=*|*-Dmy_srand=*)
16848         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
16849         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
16850         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
16851         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
16852         ;;
16853 esac
16854
16855 while $test "$cont"; do
16856         rp="Use which function to generate random numbers?"
16857         . ./myread
16858         if $test "$ans" = "$dflt"; then
16859                 : null
16860         else
16861                 randbits=''
16862         fi
16863         randfunc="$ans"
16864         if set $ans val -f; eval $csym; $val; then
16865                 cont=''
16866         else
16867                 dflt=y
16868                 rp="I cannot find function $ans. Use that name anyway?"
16869                 . ./myread
16870                 dflt=rand
16871                 case "$ans" in
16872                         [yY]*) cont='';;
16873                 esac
16874         fi
16875         case "$cont" in
16876         '')
16877                 case "$randfunc" in
16878                 drand48)
16879                         drand01="drand48()"
16880                         seedfunc="srand48"
16881                         randbits=48
16882                         randseedtype=long
16883                         ;;
16884                 rand|random)
16885                         case "$randbits" in
16886                         '')
16887 echo "Checking to see how many bits your $randfunc() function produces..." >&4
16888                                 $cat >try.c <<EOCP
16889 #$i_unistd I_UNISTD
16890 #$i_stdlib I_STDLIB
16891 #include <stdio.h>
16892 #ifdef I_UNISTD
16893 #  include <unistd.h>
16894 #endif
16895 #ifdef I_STDLIB
16896 #  include <stdlib.h>
16897 #endif
16898 int main()
16899 {
16900         register int i;
16901         register unsigned long tmp;
16902         register unsigned long max = 0L;
16903
16904         for (i = 1000; i; i--) {
16905                 tmp = (unsigned long) $randfunc();
16906                 if (tmp > max) max = tmp;
16907         }
16908         for (i = 0; max; i++)
16909                 max /= 2;
16910         printf("%d\n",i);
16911 }
16912 EOCP
16913                                 set try
16914                                 if eval $compile_ok; then
16915                                         dflt=`try`
16916                                 else
16917                                         dflt='?'
16918                                         echo "(I can't seem to compile the test program...)"
16919                                 fi
16920                                 ;;
16921                         *)
16922                                 dflt="$randbits"
16923                                 ;;
16924                         esac
16925                         rp="How many bits does your $randfunc() function produce?"
16926                         . ./myread
16927                         randbits="$ans"
16928                         $rm -f try.c try
16929                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
16930                         seedfunc="s$randfunc"
16931                         randseedtype=unsigned
16932                         ;;
16933                 *)
16934                         dflt="31"
16935                         rp="How many bits does your $randfunc() function produce?"
16936                         . ./myread
16937                         randbits="$ans"
16938                         seedfunc="s$randfunc"
16939                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
16940                         if set $seedfunc val -f; eval $csym; $val; then
16941                                 echo "(Using $seedfunc() to seed random generator)"
16942                         else
16943                                 echo "(Warning: no $seedfunc() to seed random generator)"
16944                                 seedfunc=rand
16945                         fi
16946                         randseedtype=unsigned
16947                         ;;
16948                 esac
16949                 ;;
16950         esac
16951 done
16952
16953 echo " "
16954 echo "Determining whether or not we are on an EBCDIC system..." >&4
16955 $cat >try.c <<'EOM'
16956 int main()
16957 {
16958   if ('M'==0xd4) return 0;
16959   return 1;
16960 }
16961 EOM
16962
16963 val=$undef
16964 set try
16965 if eval $compile_ok; then
16966         if $run ./try; then
16967                 echo "You seem to speak EBCDIC." >&4
16968                 val="$define"
16969         else
16970                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
16971         fi
16972 else
16973         echo "I'm unable to compile the test program." >&4
16974         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
16975 fi
16976 $rm -f try try.*
16977 set ebcdic
16978 eval $setvar
16979
16980 echo " "
16981 $cat >&4 <<EOM
16982 Checking how to flush all pending stdio output...
16983 EOM
16984 # I only know how to find the first 32 possibly open files on SunOS.
16985 # See also hints/sunos_4_1.sh and util.c  --AD
16986 case "$osname" in
16987 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
16988 esac
16989 $cat >>try.c <<EOCP
16990 #include <stdio.h>
16991 #$i_unistd I_UNISTD
16992 #ifdef I_UNISTD
16993 # include <unistd.h>
16994 #endif
16995 #$d_sysconf HAS_SYSCONF
16996 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
16997 #ifdef HAS_STDIO_STREAM_ARRAY
16998 # define STDIO_STREAM_ARRAY $stdio_stream_array
16999 #endif
17000 int main() {
17001   FILE* p;
17002   unlink("try.out");
17003   p = fopen("try.out", "w");
17004 #ifdef TRY_FPUTC
17005   fputc('x', p);
17006 #else
17007 # ifdef TRY_FPRINTF
17008   fprintf(p, "x");
17009 # endif
17010 #endif
17011 #ifdef TRY_FFLUSH_NULL
17012   fflush(NULL);
17013 #endif
17014 #ifdef TRY_FFLUSH_ALL
17015   {
17016     long open_max = -1;
17017 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
17018     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
17019 # else
17020 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
17021     open_max = sysconf(_SC_OPEN_MAX);
17022 #  else
17023 #   ifdef FOPEN_MAX
17024     open_max = FOPEN_MAX;
17025 #   else
17026 #    ifdef OPEN_MAX
17027     open_max = OPEN_MAX;
17028 #    else
17029 #     ifdef _NFILE
17030     open_max = _NFILE;
17031 #     endif
17032 #    endif
17033 #   endif
17034 #  endif
17035 # endif 
17036 # ifdef HAS_STDIO_STREAM_ARRAY
17037     if (open_max > 0) {
17038       long i;
17039       for (i = 0; i < open_max; i++)
17040             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
17041                 STDIO_STREAM_ARRAY[i]._file < open_max &&
17042                 STDIO_STREAM_ARRAY[i]._flag)
17043                 fflush(&STDIO_STREAM_ARRAY[i]);
17044     }   
17045   }
17046 # endif
17047 #endif
17048   _exit(42);
17049 }
17050 EOCP
17051 : first we have to find out how _not_ to flush
17052 $to try.c
17053 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
17054     output=''
17055     set try -DTRY_FPUTC
17056     if eval $compile; then
17057             $run ./try 2>/dev/null
17058             code="$?"
17059             $from try.out
17060             if $test ! -s try.out -a "X$code" = X42; then
17061                 output=-DTRY_FPUTC
17062             fi
17063     fi
17064     case "$output" in
17065     '')
17066             set try -DTRY_FPRINTF
17067             if eval $compile; then
17068                     $run ./try 2>/dev/null
17069                     code="$?"
17070                     $from try.out
17071                     if $test ! -s try.out -a "X$code" = X42; then
17072                         output=-DTRY_FPRINTF
17073                     fi
17074             fi
17075         ;;
17076     esac
17077 fi
17078 : check for fflush NULL behaviour
17079 case "$fflushNULL" in
17080 '')     set try -DTRY_FFLUSH_NULL $output
17081         if eval $compile; then
17082                 $run ./try 2>/dev/null
17083                 code="$?"
17084                 $from try.out
17085                 if $test -s try.out -a "X$code" = X42; then
17086                         fflushNULL="`$cat try.out`"
17087                 else
17088                         if $test "X$code" != X42; then
17089                                 $cat >&4 <<EOM
17090 (If this test failed, don't worry, we'll try another method shortly.)
17091 EOM
17092                         fi
17093                 fi
17094         fi
17095         $rm -f core try.core core.try.*
17096         case "$fflushNULL" in
17097         x)      $cat >&4 <<EOM
17098 Your fflush(NULL) works okay for output streams.
17099 Let's see if it clobbers input pipes...
17100 EOM
17101 # As of mid-March 2000 all versions of Solaris appear to have a stdio
17102 # bug that improperly flushes the input end of pipes.  So we avoid the
17103 # autoflush on fork/system/exec support for now. :-(
17104 $cat >tryp.c <<EOCP
17105 #include <stdio.h>
17106 int
17107 main(int argc, char **argv)
17108 {
17109     char buf[1024];
17110     int i;
17111     char *bp = buf;
17112     while (1) {
17113         while ((i = getc(stdin)) != -1
17114                && (*bp++ = i) != '\n'
17115                && bp < &buf[1024])
17116         /* DO NOTHING */ ;
17117         *bp = '\0';
17118         fprintf(stdout, "%s", buf);
17119         fflush(NULL);
17120         if (i == -1)
17121             return 0;
17122         bp = buf;
17123     }
17124 }
17125 EOCP
17126                 fflushNULL="$define"
17127                 set tryp
17128                 if eval $compile; then
17129                     $rm -f tryp.out
17130                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17131                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
17132                        $cat >&4 <<EOM
17133 fflush(NULL) seems to behave okay with input streams.
17134 EOM
17135                         fflushNULL="$define"
17136                     else
17137                         $cat >&4 <<EOM
17138 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
17139 EOM
17140                         fflushNULL="$undef"
17141                     fi
17142                 fi
17143                 $rm -f core tryp.c tryp.core core.tryp.*
17144                 ;;
17145         '')     $cat >&4 <<EOM
17146 Your fflush(NULL) isn't working (contrary to ANSI C).
17147 EOM
17148                 fflushNULL="$undef"
17149                 ;;
17150         *)      $cat >&4 <<EOM
17151 Cannot figure out whether your fflush(NULL) works or not.
17152 I'm assuming it doesn't (contrary to ANSI C).
17153 EOM
17154                 fflushNULL="$undef"
17155                 ;;
17156         esac
17157         ;;
17158 $define|true|[yY]*)
17159         fflushNULL="$define"
17160         ;;
17161 *)
17162         fflushNULL="$undef"
17163         ;;
17164 esac
17165 : check explicit looping only if NULL did not work, and if the pipe
17166 : bug does not show up on an explicit flush too
17167 case "$fflushNULL" in
17168 "$undef")
17169         $cat >tryp.c <<EOCP
17170 #include <stdio.h>
17171 int
17172 main(int argc, char **argv)
17173 {
17174     char buf[1024];
17175     int i;
17176     char *bp = buf;
17177     while (1) {
17178         while ((i = getc(stdin)) != -1
17179                && (*bp++ = i) != '\n'
17180                && bp < &buf[1024])
17181         /* DO NOTHING */ ;
17182         *bp = '\0';
17183         fprintf(stdout, "%s", buf);
17184         fflush(stdin);
17185         if (i == -1)
17186             return 0;
17187         bp = buf;
17188     }
17189 }
17190 EOCP
17191         set tryp
17192         if eval $compile; then
17193             $rm -f tryp.out
17194             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17195             if cmp tryp.c tryp.out >/dev/null 2>&1; then
17196                $cat >&4 <<EOM
17197 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
17198 EOM
17199                 : now check for fflushall behaviour
17200                 case "$fflushall" in
17201                 '')     set try -DTRY_FFLUSH_ALL $output
17202                         if eval $compile; then
17203                                 $cat >&4 <<EOM
17204 (Now testing the other method--but note that this also may fail.)
17205 EOM
17206                                 $run ./try 2>/dev/null
17207                                 code=$?
17208                                 $from try.out
17209                                 if $test -s try.out -a "X$code" = X42; then
17210                                         fflushall="`$cat try.out`"
17211                                 fi
17212                         fi
17213                         $rm -f core try.core core.try.*
17214                         case "$fflushall" in
17215                         x)      $cat >&4 <<EOM
17216 Whew. Flushing explicitly all the stdio streams works.
17217 EOM
17218                                 fflushall="$define"
17219                                 ;;
17220                         '')     $cat >&4 <<EOM
17221 Sigh. Flushing explicitly all the stdio streams doesn't work.
17222 EOM
17223                                 fflushall="$undef"
17224                                 ;;
17225                         *)      $cat >&4 <<EOM
17226 Cannot figure out whether flushing stdio streams explicitly works or not.
17227 I'm assuming it doesn't.
17228 EOM
17229                                 fflushall="$undef"
17230                                 ;;
17231                         esac
17232                         ;;
17233                 "$define"|true|[yY]*)
17234                         fflushall="$define"
17235                         ;;
17236                 *)
17237                         fflushall="$undef"
17238                         ;;
17239                 esac
17240             else
17241                 $cat >&4 <<EOM
17242 All is futile.  Even fflush(stdin) clobbers input pipes!
17243 EOM
17244                 fflushall="$undef"
17245             fi
17246         else
17247             fflushall="$undef"
17248         fi
17249         $rm -f core tryp.c tryp.core core.tryp.*
17250         ;;
17251 *)      fflushall="$undef"
17252         ;;
17253 esac
17254
17255 case "$fflushNULL$fflushall" in
17256 undefundef)
17257         $cat <<EOM
17258 OK, I give up.  I cannot figure out how to flush pending stdio output.
17259 We won't be flushing handles at all before fork/exec/popen.
17260 EOM
17261         ;;
17262 esac
17263 $rm -f try.* try$exe_ext
17264
17265 : Store the full pathname to the ar program for use in the C program
17266 : Respect a hint or command line value for full_ar.
17267 case "$full_ar" in
17268 '') full_ar=$ar ;;
17269 esac
17270
17271 : Store the full pathname to the sed program for use in the C program
17272 full_sed=$sed
17273
17274 : see what type gids are declared as in the kernel
17275 echo " "
17276 echo "Looking for the type for group ids returned by getgid()."
17277 set gid_t gidtype xxx stdio.h sys/types.h
17278 eval $typedef
17279 case "$gidtype" in
17280 xxx)
17281         xxx=`./findhdr sys/user.h`
17282         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
17283         case $1 in
17284         unsigned) dflt="$1 $2" ;;
17285         *) dflt="$1" ;;
17286         esac
17287         ;;
17288 *) dflt="$gidtype";;
17289 esac
17290 case "$gidtype" in
17291 gid_t) echo "gid_t found." ;;
17292 *)      rp="What is the type for group ids returned by getgid()?"
17293         . ./myread
17294         gidtype="$ans"
17295         ;;
17296 esac
17297
17298 echo " "
17299 case "$gidtype" in
17300 *_t) zzz="$gidtype"     ;;
17301 *)   zzz="gid"          ;;
17302 esac
17303 echo "Checking the size of $zzz..." >&4 
17304 cat > try.c <<EOCP
17305 #include <sys/types.h>
17306 #include <stdio.h>
17307 int main() {
17308     printf("%d\n", (int)sizeof($gidtype));
17309     exit(0);
17310 }
17311 EOCP
17312 set try
17313 if eval $compile_ok; then
17314         yyy=`$run ./try`
17315         case "$yyy" in
17316         '')     gidsize=4
17317                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
17318                 ;;
17319         *)      gidsize=$yyy
17320                 echo "Your $zzz is $gidsize bytes long."
17321                 ;;
17322         esac
17323 else
17324         gidsize=4
17325         echo "(I can't compile the test program--guessing $gidsize.)" >&4
17326 fi
17327
17328
17329 echo " "
17330 case "$gidtype" in
17331 *_t) zzz="$gidtype"     ;;
17332 *)   zzz="gid"          ;;
17333 esac
17334 echo "Checking the sign of $zzz..." >&4 
17335 cat > try.c <<EOCP
17336 #include <sys/types.h>
17337 #include <stdio.h>
17338 int main() {
17339         $gidtype foo = -1;
17340         if (foo < 0)
17341                 printf("-1\n");
17342         else
17343                 printf("1\n");
17344 }
17345 EOCP
17346 set try
17347 if eval $compile; then
17348         yyy=`$run ./try`
17349         case "$yyy" in
17350         '')     gidsign=1
17351                 echo "(I can't execute the test program--guessing unsigned.)" >&4
17352                 ;;
17353         *)      gidsign=$yyy
17354                 case "$gidsign" in
17355                  1) echo "Your $zzz is unsigned." ;;
17356                 -1) echo "Your $zzz is signed."   ;;
17357                 esac
17358                 ;;
17359         esac
17360 else
17361         gidsign=1
17362         echo "(I can't compile the test program--guessing unsigned.)" >&4
17363 fi
17364
17365
17366 echo " "
17367
17368 if $test X"$quadtype" != X; then
17369
17370 echo "Checking how to print 64-bit integers..." >&4
17371
17372 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
17373         $cat >try.c <<'EOCP'
17374 #include <sys/types.h>
17375 #include <stdio.h>
17376 int main() {
17377   int q = 12345678901;
17378   printf("%ld\n", q);
17379 }
17380 EOCP
17381         set try
17382         if eval $compile; then
17383                 yyy=`$run ./try`
17384                 case "$yyy" in
17385                 12345678901)
17386                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
17387                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
17388                         echo "We will use %d."
17389                         ;;
17390                 esac
17391         fi
17392 fi
17393
17394 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
17395         $cat >try.c <<'EOCP'
17396 #include <sys/types.h>
17397 #include <stdio.h>
17398 int main() {
17399   long q = 12345678901;
17400   printf("%ld\n", q);
17401 }
17402 EOCP
17403         set try
17404         if eval $compile; then
17405                 yyy=`$run ./try`
17406                 case "$yyy" in
17407                 12345678901)
17408                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
17409                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
17410                         echo "We will use %ld."
17411                         ;;
17412                 esac
17413         fi
17414 fi
17415
17416 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
17417         $cat >try.c <<'EOCP'
17418 #include <sys/types.h>
17419 #include <inttypes.h>
17420 #include <stdio.h>
17421 int main() {
17422   int64_t q = 12345678901;
17423   printf("%" PRId64 "\n", q);
17424 }
17425 EOCP
17426         set try
17427         if eval $compile; then
17428                 yyy=`$run ./try`
17429                 case "$yyy" in
17430                 12345678901)
17431                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
17432                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
17433                         echo "We will use the C9X style."
17434                         ;;
17435                 esac
17436         fi
17437 fi
17438
17439 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17440         $cat >try.c <<EOCP
17441 #include <sys/types.h>
17442 #include <stdio.h>
17443 int main() {
17444   $quadtype q = 12345678901;
17445   printf("%Ld\n", q);
17446 }
17447 EOCP
17448         set try
17449         if eval $compile; then
17450                 yyy=`$run ./try`
17451                 case "$yyy" in
17452                 12345678901)
17453                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
17454                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
17455                         echo "We will use %Ld."
17456                         ;;
17457                 esac
17458         fi
17459 fi
17460
17461 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
17462         $cat >try.c <<'EOCP'
17463 #include <sys/types.h>
17464 #include <stdio.h>
17465 int main() {
17466   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
17467   printf("%lld\n", q);
17468 }
17469 EOCP
17470         set try
17471         if eval $compile; then
17472                 yyy=`$run ./try`
17473                 case "$yyy" in
17474                 12345678901)
17475                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
17476                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
17477                         echo "We will use the %lld style."
17478                         ;;
17479                 esac
17480         fi
17481 fi
17482
17483 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17484         $cat >try.c <<EOCP
17485 #include <sys/types.h>
17486 #include <stdio.h>
17487 int main() {
17488   $quadtype q = 12345678901;
17489   printf("%qd\n", q);
17490 }
17491 EOCP
17492         set try
17493         if eval $compile; then
17494                 yyy=`$run ./try`
17495                 case "$yyy" in
17496                 12345678901)
17497                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
17498                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
17499                         echo "We will use %qd."
17500                         ;;
17501                 esac
17502         fi
17503 fi
17504
17505 if $test X"$sPRId64" = X; then
17506         echo "Cannot figure out how to print 64-bit integers." >&4
17507 fi
17508
17509 $rm -f try try.*
17510
17511 fi
17512
17513 case "$sPRId64" in
17514 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
17515         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
17516         ;;
17517 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
17518         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
17519         ;;
17520 esac
17521
17522
17523 echo " "
17524 $echo "Checking the format strings to be used for Perl's internal types..." >&4
17525
17526 if $test X"$ivsize" = X8; then
17527         ivdformat="$sPRId64"
17528         uvuformat="$sPRIu64"
17529         uvoformat="$sPRIo64"
17530         uvxformat="$sPRIx64"
17531         uvXUformat="$sPRIXU64"
17532 else
17533         if $test X"$ivsize" = X"$longsize"; then
17534                 ivdformat='"ld"'
17535                 uvuformat='"lu"'
17536                 uvoformat='"lo"'
17537                 uvxformat='"lx"'
17538                 uvXUformat='"lX"'
17539         else
17540                 if $test X"$ivsize" = X"$intsize"; then
17541                         ivdformat='"d"'
17542                         uvuformat='"u"'
17543                         uvoformat='"o"'
17544                         uvxformat='"x"'
17545                         uvXUformat='"X"'
17546                 else
17547                         : far out
17548                         if $test X"$ivsize" = X"$shortsize"; then
17549                                 ivdformat='"hd"'
17550                                 uvuformat='"hu"'
17551                                 uvoformat='"ho"'
17552                                 uvxformat='"hx"'
17553                                 uvXUformat='"hX"'
17554                         fi
17555                 fi
17556         fi
17557 fi
17558
17559 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
17560         nveformat="$sPRIeldbl"
17561         nvfformat="$sPRIfldbl"
17562         nvgformat="$sPRIgldbl"
17563         nvEUformat="$sPRIEUldbl"
17564         nvFUformat="$sPRIFUldbl"
17565         nvGUformat="$sPRIGUldbl"
17566 else
17567         nveformat='"e"'
17568         nvfformat='"f"'
17569         nvgformat='"g"'
17570         nvEUformat='"E"'
17571         nvFUformat='"F"'
17572         nvGUformat='"G"'
17573 fi
17574
17575 case "$ivdformat" in
17576 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
17577     exit 1
17578     ;;
17579 esac
17580
17581
17582 echo " "
17583 $echo "Checking the format string to be used for gids..." >&4
17584
17585 case "$gidsign" in
17586 -1)     if $test X"$gidsize" = X"$ivsize"; then
17587                 gidformat="$ivdformat"
17588         else
17589                 if $test X"$gidsize" = X"$longsize"; then
17590                         gidformat='"ld"'
17591                 else
17592                         if $test X"$gidsize" = X"$intsize"; then
17593                                 gidformat='"d"'
17594                         else
17595                                 if $test X"$gidsize" = X"$shortsize"; then
17596                                         gidformat='"hd"'
17597                                 fi
17598                         fi
17599                 fi
17600         fi
17601         ;;
17602 *)      if $test X"$gidsize" = X"$uvsize"; then
17603                 gidformat="$uvuformat"
17604         else
17605                 if $test X"$gidsize" = X"$longsize"; then
17606                         gidformat='"lu"'
17607                 else
17608                         if $test X"$gidsize" = X"$intsize"; then
17609                                 gidformat='"u"'
17610                         else
17611                                 if $test X"$gidsize" = X"$shortsize"; then
17612                                         gidformat='"hu"'
17613                                 fi
17614                         fi
17615                 fi
17616         fi
17617         ;;
17618 esac
17619
17620 : see if getgroups exists
17621 set getgroups d_getgrps
17622 eval $inlibc
17623
17624 : see if setgroups exists
17625 set setgroups d_setgrps
17626 eval $inlibc
17627
17628
17629 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
17630 echo " "
17631 case "$d_getgrps$d_setgrps" in
17632 *define*)
17633         case "$groupstype" in
17634         '') dflt="$gidtype" ;;
17635         *)  dflt="$groupstype" ;;
17636         esac
17637         $cat <<EOM
17638 What type of pointer is the second argument to getgroups() and setgroups()?
17639 Usually this is the same as group ids, $gidtype, but not always.
17640
17641 EOM
17642         rp='What type pointer is the second argument to getgroups() and setgroups()?'
17643         . ./myread
17644         groupstype="$ans"
17645         ;;
17646 *)  groupstype="$gidtype";;
17647 esac
17648
17649 echo " "
17650 echo "Checking if your $make program sets \$(MAKE)..." >&4
17651 case "$make_set_make" in
17652 '')
17653         $sed 's/^X //' > testmake.mak << 'EOF'
17654 Xall:
17655 X       @echo 'maketemp="$(MAKE)"'
17656 EOF
17657         case "`$make -f testmake.mak 2>/dev/null`" in
17658         *maketemp=*) make_set_make='#' ;;
17659         *)      make_set_make="MAKE=$make" ;;
17660         esac
17661         $rm -f testmake.mak
17662         ;;
17663 esac
17664 case "$make_set_make" in
17665 '#') echo "Yup, it does.";;
17666 *) echo "Nope, it doesn't.";;
17667 esac
17668
17669 : see what type is used for mode_t
17670 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
17671 set mode_t modetype int stdio.h sys/types.h
17672 eval $typedef_ask
17673
17674 : see if stdarg is available
17675 echo " "
17676 if $test `./findhdr stdarg.h`; then
17677         echo "<stdarg.h> found." >&4
17678         valstd="$define"
17679 else
17680         echo "<stdarg.h> NOT found." >&4
17681         valstd="$undef"
17682 fi
17683
17684 : see if varags is available
17685 echo " "
17686 if $test `./findhdr varargs.h`; then
17687         echo "<varargs.h> found." >&4
17688 else
17689         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
17690 fi
17691
17692 : set up the varargs testing programs
17693 $cat > varargs.c <<EOP
17694 #ifdef I_STDARG
17695 #include <stdarg.h>
17696 #endif
17697 #ifdef I_VARARGS
17698 #include <varargs.h>
17699 #endif
17700
17701 #ifdef I_STDARG
17702 int f(char *p, ...)
17703 #else
17704 int f(va_alist)
17705 va_dcl
17706 #endif
17707 {
17708         va_list ap;
17709 #ifndef I_STDARG
17710         char *p;
17711 #endif
17712 #ifdef I_STDARG
17713         va_start(ap,p);
17714 #else
17715         va_start(ap);
17716         p = va_arg(ap, char *);
17717 #endif
17718         va_end(ap);
17719 }
17720 EOP
17721 $cat > varargs <<EOP
17722 $startsh
17723 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
17724         echo "true"
17725 else
17726         echo "false"
17727 fi
17728 $rm -f varargs$_o
17729 EOP
17730 chmod +x varargs
17731
17732 : now check which varargs header should be included
17733 echo " "
17734 i_varhdr=''
17735 case "$valstd" in
17736 "$define")
17737         if `./varargs I_STDARG`; then
17738                 val='stdarg.h'
17739         elif `./varargs I_VARARGS`; then
17740                 val='varargs.h'
17741         fi
17742         ;;
17743 *)
17744         if `./varargs I_VARARGS`; then
17745                 val='varargs.h'
17746         fi
17747         ;;
17748 esac
17749 case "$val" in
17750 '')
17751 echo "I could not find the definition for va_dcl... You have problems..." >&4
17752         val="$undef"; set i_stdarg; eval $setvar
17753         val="$undef"; set i_varargs; eval $setvar
17754         ;;
17755 *) 
17756         set i_varhdr
17757         eval $setvar
17758         case "$i_varhdr" in
17759         stdarg.h)
17760                 val="$define"; set i_stdarg; eval $setvar
17761                 val="$undef"; set i_varargs; eval $setvar
17762                 ;;
17763         varargs.h)
17764                 val="$undef"; set i_stdarg; eval $setvar
17765                 val="$define"; set i_varargs; eval $setvar
17766                 ;;
17767         esac
17768         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
17769 esac
17770 $rm -f varargs*
17771
17772 : see if we need va_copy
17773 echo " "
17774 case "$i_stdarg" in
17775 "$define")
17776         $cat >try.c <<EOCP
17777 #include <stdarg.h>
17778 #include <stdio.h>
17779 #$i_stdlib I_STDLIB
17780 #ifdef I_STDLIB
17781 #include <stdlib.h>
17782 #endif
17783 #include <signal.h>
17784
17785 int
17786 ivfprintf(FILE *f, const char *fmt, va_list *valp)
17787 {
17788   return vfprintf(f, fmt, *valp);
17789 }
17790  
17791 int    
17792 myvfprintf(FILE *f, const  char *fmt, va_list val)
17793 {
17794   return ivfprintf(f, fmt, &val);
17795 }
17796       
17797 int
17798 myprintf(char *fmt, ...) 
17799 {
17800   va_list val;
17801   va_start(val, fmt);
17802   return myvfprintf(stdout, fmt, val); 
17803 }         
17804
17805 int
17806 main(int ac, char **av)
17807 {
17808   signal(SIGSEGV, exit);
17809
17810   myprintf("%s%cs all right, then\n", "that", '\'');                            
17811   exit(0);      
17812 }
17813 EOCP
17814         set try
17815         if eval $compile && $run ./try 2>&1 >/dev/null; then
17816                 case "`$run ./try`" in
17817                 "that's all right, then")
17818                         okay=yes
17819                         ;;
17820                 esac
17821         fi
17822         case "$okay" in
17823         yes)    echo "It seems that you don't need va_copy()." >&4
17824                 need_va_copy="$undef"
17825                 ;;
17826         *)      echo "It seems that va_copy() or similar will be needed." >&4
17827                 need_va_copy="$define"
17828                 ;;
17829         esac
17830         $rm -f try.* core core.* *.core *.core.*
17831         ;;
17832 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
17833         ;;
17834 esac
17835
17836 : see what type is used for size_t
17837 rp="What is the type used for the length parameter for string functions?"
17838 set size_t sizetype 'unsigned int' stdio.h sys/types.h
17839 eval $typedef_ask
17840
17841 : check for type of arguments to gethostbyaddr. 
17842 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
17843         case "$d_gethbyaddr" in
17844         $define)
17845                 $cat <<EOM
17846
17847 Checking to see what type of arguments are accepted by gethostbyaddr().
17848 EOM
17849                 hdrs="$define sys/types.h
17850                         $d_socket sys/socket.h 
17851                         $i_niin netinet/in.h 
17852                         $i_netdb netdb.h
17853                         $i_unistd unistd.h"
17854                 : The first arg can 'char *' or 'void *'
17855                 : The second arg is some of integral type
17856                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
17857                         for yyy in size_t long int; do
17858                                 case "$netdb_host_type" in
17859                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
17860                                         if ./protochk "$try" $hdrs; then
17861                                                 echo "Your system accepts $xxx for the first arg."
17862                                                 echo "...and $yyy for the second arg."
17863                                                 netdb_host_type="$xxx"
17864                                                 netdb_hlen_type="$yyy"
17865                                         fi
17866                                         ;;
17867                                 esac
17868                         done
17869                 done
17870                 : In case none of those worked, prompt the user.
17871                 case "$netdb_host_type" in
17872                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
17873                         dflt='char *'
17874                         . ./myread
17875                         netdb_host_type=$ans
17876                         rp='What is the type for the 2nd argument to gethostbyaddr?'
17877                         dflt="$sizetype"
17878                         . ./myread
17879                         netdb_hlen_type=$ans
17880                         ;;
17881                 esac
17882                 ;;
17883         *)      : no gethostbyaddr, so pick harmless defaults
17884                 netdb_host_type='char *'
17885                 netdb_hlen_type="$sizetype"
17886                 ;;
17887         esac
17888         # Remove the "const" if needed. -- but then we'll have a 
17889         # prototype clash!
17890         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
17891 fi
17892
17893 : check for type of argument to gethostbyname. 
17894 if test "X$netdb_name_type" = X ; then
17895         case "$d_gethbyname" in
17896         $define)
17897                 $cat <<EOM
17898
17899 Checking to see what type of argument is accepted by gethostbyname().
17900 EOM
17901                 hdrs="$define sys/types.h
17902                         $d_socket sys/socket.h 
17903                         $i_niin netinet/in.h 
17904                         $i_netdb netdb.h
17905                         $i_unistd unistd.h"
17906                 for xxx in "const char *" "char *"; do
17907                         case "$netdb_name_type" in
17908                         '')     try="extern struct hostent *gethostbyname($xxx);"
17909                                 if ./protochk "$try" $hdrs; then
17910                                         echo "Your system accepts $xxx."
17911                                         netdb_name_type="$xxx"
17912                                 fi
17913                                 ;;
17914                         esac
17915                 done
17916                 : In case none of those worked, prompt the user.
17917                 case "$netdb_name_type" in
17918                 '')     rp='What is the type for the 1st argument to gethostbyname?'
17919                         dflt='char *'
17920                         . ./myread
17921                         netdb_name_type=$ans
17922                         ;;
17923                 esac
17924                 ;;
17925         *)      : no gethostbyname, so pick harmless default
17926                 netdb_name_type='char *'
17927                 ;;
17928         esac
17929 fi
17930
17931 : check for type of 1st argument to getnetbyaddr. 
17932 if test "X$netdb_net_type" = X ; then
17933         case "$d_getnbyaddr" in
17934         $define)
17935                 $cat <<EOM
17936
17937 Checking to see what type of 1st argument is accepted by getnetbyaddr().
17938 EOM
17939                 hdrs="$define sys/types.h
17940                         $d_socket sys/socket.h 
17941                         $i_niin netinet/in.h 
17942                         $i_netdb netdb.h
17943                         $i_unistd unistd.h"
17944                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
17945                         case "$netdb_net_type" in
17946                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
17947                                 if ./protochk "$try" $hdrs; then
17948                                         echo "Your system accepts $xxx."
17949                                         netdb_net_type="$xxx"
17950                                 fi
17951                                 ;;
17952                         esac
17953                 done
17954                 : In case none of those worked, prompt the user.
17955                 case "$netdb_net_type" in
17956                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
17957                         dflt='long'
17958                         . ./myread
17959                         netdb_net_type=$ans
17960                         ;;
17961                 esac
17962                 ;;
17963         *)      : no getnetbyaddr, so pick harmless default
17964                 netdb_net_type='long'
17965                 ;;
17966         esac
17967 fi
17968 : locate the preferred pager for this system
17969 fn=f/
17970 case "$pager" in
17971 '')
17972         dflt=''
17973         case "$pg" in
17974         /*) dflt=$pg;;
17975         [a-zA-Z]:/*) dflt=$pg;;
17976         esac
17977         case "$more" in
17978         /*) dflt=$more;;
17979         [a-zA-Z]:/*) dflt=$more;;
17980         esac
17981         case "$less" in
17982         /*) dflt=$less;;
17983         [a-zA-Z]:/*) dflt=$less;;
17984         esac
17985         case "$dflt" in
17986         '') dflt=/usr/ucb/more;;
17987         esac
17988         ;;
17989 *)      dflt="$pager"
17990         : Instruct ./getfile to trust the hinted or previous pager value,
17991         : even if it does not begin with a slash.  For example, on os2,
17992         : pager might be cmd /c more.  See comments in UU/getfile.
17993         fn="f/($pager)"
17994         ;;
17995 esac
17996 echo " "
17997 rp='What pager is used on your system?'
17998 . ./getfile
17999 pager="$ans"
18000
18001 : see what type pids are declared as in the kernel
18002 rp="What is the type of process ids on this system?"
18003 set pid_t pidtype int stdio.h sys/types.h
18004 eval $typedef_ask
18005
18006 : Find earliest binary compatible site_perl subdirectory perl can use.
18007 xs_apiversion=$version # The current site_perl version.
18008 : Find earliest pure perl site_perl subdirectory perl can use.
18009 : The versioned directories started at 5.005.
18010 pm_apiversion='5.005'
18011
18012 : see if ar generates random libraries by itself
18013 echo " "
18014 echo "Checking how to generate random libraries on your machine..." >&4
18015 echo 'int bar1() { return bar2(); }' > bar1.c
18016 echo 'int bar2() { return 2; }' > bar2.c
18017 $cat > foo.c <<'EOP'
18018 int main() { printf("%d\n", bar1()); exit(0); }
18019 EOP
18020 $cc $ccflags -c bar1.c >/dev/null 2>&1
18021 $cc $ccflags -c bar2.c >/dev/null 2>&1
18022 $cc $ccflags -c foo.c >/dev/null 2>&1
18023 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
18024 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
18025         $run ./foobar >/dev/null 2>&1; then
18026         echo "$ar appears to generate random libraries itself."
18027         orderlib=false
18028         ranlib=":"
18029 elif $ar ts bar$_a >/dev/null 2>&1 &&
18030         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
18031         $run ./foobar >/dev/null 2>&1; then
18032                 echo "a table of contents needs to be added with '$ar ts'."
18033                 orderlib=false
18034                 ranlib="$ar ts"
18035 else
18036         case "$ranlib" in
18037         :) ranlib='';;
18038         '')
18039                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
18040                 $test -f $ranlib || ranlib=''
18041                 ;;
18042         esac
18043         if $test -n "$ranlib"; then
18044                 echo "your system has '$ranlib'; we'll use that."
18045                 orderlib=false
18046         else
18047                 echo "your system doesn't seem to support random libraries"
18048                 echo "so we'll use lorder and tsort to order the libraries."
18049                 orderlib=true
18050                 ranlib=":"
18051         fi
18052 fi
18053 $rm -f foo* bar* 
18054
18055 : check for type of arguments to select. 
18056 case "$selecttype" in
18057 '') case "$d_select" in
18058         $define)
18059                 echo " "
18060                 $cat <<EOM
18061 Checking to see what type of arguments are accepted by select().
18062 EOM
18063                 hdrs="$define sys/types.h
18064                         $i_systime sys/time.h 
18065                         $i_sysselct sys/select.h
18066                         $d_socket sys/socket.h"
18067                 : The first arg can be int, unsigned, or size_t
18068                 : The last arg may or may not be 'const'
18069                 val=''
18070                 : void pointer has been seen but using that
18071                 : breaks the selectminbits test
18072                 for xxx in 'fd_set *' 'int *'; do
18073                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
18074                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
18075                                         case "$val" in
18076                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
18077                                                 if ./protochk "$try" $hdrs; then
18078                                                         echo "Your system accepts $xxx."
18079                                                         val="$xxx"
18080                                                 fi
18081                                                 ;;
18082                                         esac
18083                                 done
18084                         done
18085                 done
18086                 case "$val" in
18087                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
18088                         case "$d_fd_set" in
18089                                 $define) dflt="fd_set *" ;;
18090                                 *)              dflt="int *" ;;
18091                         esac
18092                         . ./myread
18093                         val=$ans
18094                         ;;
18095                 esac
18096                 selecttype="$val"
18097                 ;;
18098         *)      : no select, so pick a harmless default
18099                 selecttype='int *'
18100                 ;;
18101         esac
18102         ;;
18103 esac
18104
18105 : check for the select 'width'
18106 case "$selectminbits" in
18107 '') case "$d_select" in
18108         $define)
18109                 $cat <<EOM
18110
18111 Checking to see on how many bits at a time your select() operates...
18112 EOM
18113                 $cat >try.c <<EOCP
18114 #include <sys/types.h>
18115 #$i_time I_TIME
18116 #$i_systime I_SYS_TIME
18117 #$i_systimek I_SYS_TIME_KERNEL
18118 #ifdef I_TIME
18119 #   include <time.h>
18120 #endif
18121 #ifdef I_SYS_TIME
18122 #   ifdef I_SYS_TIME_KERNEL
18123 #       define KERNEL
18124 #   endif
18125 #   include <sys/time.h>
18126 #   ifdef I_SYS_TIME_KERNEL
18127 #       undef KERNEL
18128 #   endif
18129 #endif
18130 #$i_sysselct I_SYS_SELECT
18131 #ifdef I_SYS_SELECT
18132 #include <sys/select.h>
18133 #endif
18134 #$d_socket HAS_SOCKET
18135 #ifdef HAS_SOCKET
18136 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
18137 #endif
18138 #include <stdio.h>
18139 $selecttype b;
18140 #define S sizeof(*(b))
18141 #define MINBITS 64
18142 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
18143 #define NBITS  (NBYTES * 8)
18144 int main() {
18145     char s[NBYTES];
18146     struct timeval t;
18147     int i;
18148     FILE* fp;
18149     int fd;
18150
18151     fclose(stdin);
18152     fp = fopen("try.c", "r");
18153     if (fp == 0)
18154       exit(1);
18155     fd = fileno(fp);
18156     if (fd < 0)
18157       exit(2);
18158     b = ($selecttype)s;
18159     for (i = 0; i < NBITS; i++)
18160         FD_SET(i, b);
18161     t.tv_sec  = 0;
18162     t.tv_usec = 0;
18163     select(fd + 1, b, 0, 0, &t);
18164     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
18165     printf("%d\n", i + 1);
18166     return 0;
18167 }
18168 EOCP
18169                 set try
18170                 if eval $compile_ok; then
18171                         selectminbits=`$run ./try`
18172                         case "$selectminbits" in
18173                         '')     cat >&4 <<EOM
18174 Cannot figure out on how many bits at a time your select() operates.
18175 I'll play safe and guess it is 32 bits.
18176 EOM
18177                                 selectminbits=32
18178                                 bits="32 bits"
18179                                 ;;
18180                         1)      bits="1 bit" ;;
18181                         *)      bits="$selectminbits bits" ;;
18182                         esac
18183                         echo "Your select() operates on $bits at a time." >&4
18184                 else
18185                         rp='What is the minimum number of bits your select() operates on?'
18186                         case "$byteorder" in
18187                         1234|12345678)  dflt=32 ;;
18188                         *)              dflt=1  ;;
18189                         esac
18190                         . ./myread
18191                         val=$ans
18192                         selectminbits="$val"
18193                 fi
18194                 $rm -f try.* try
18195                 ;;
18196         *)      : no select, so pick a harmless default
18197                 selectminbits='32'
18198                 ;;
18199         esac
18200         ;;
18201 esac
18202
18203 : Trace out the files included by signal.h, then look for SIGxxx names.
18204 : Remove SIGARRAYSIZE used by HPUX.
18205 : Remove SIGSTKSIZE used by Linux.
18206 : Remove SIGSTKSZ used by Posix.
18207 : Remove SIGTYP void lines used by OS2.
18208 : Some cpps, like os390, dont give the file name anywhere
18209 if [ "X$fieldn" = X ]; then
18210         : Just make some guesses.  We check them later.
18211         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
18212 else
18213         xxx=`echo '#include <signal.h>' |
18214         $cppstdin $cppminus $cppflags 2>/dev/null |
18215         $grep '^[       ]*#.*include' | 
18216         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
18217 fi
18218 : Check this list of files to be sure we have parsed the cpp output ok.
18219 : This will also avoid potentially non-existent files, such 
18220 : as ../foo/bar.h
18221 xxxfiles=''
18222 for xx in $xxx /dev/null ; do
18223         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
18224 done
18225 : If we have found no files, at least try signal.h
18226 case "$xxxfiles" in
18227 '')     xxxfiles=`./findhdr signal.h` ;;
18228 esac
18229 xxx=`awk '
18230 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
18231         print substr($2, 4, 20)
18232 }
18233 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
18234         print substr($3, 4, 20)
18235 }' $xxxfiles`
18236 : Append some common names just in case the awk scan failed.
18237 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
18238 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
18239 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
18240 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
18241 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
18242
18243 : generate a few handy files for later
18244 $cat > signal.c <<'EOCP'
18245 #include <sys/types.h>
18246 #include <signal.h>
18247 #include <stdio.h>
18248 int main() {
18249
18250 /* Strange style to avoid deeply-nested #if/#else/#endif */
18251 #ifndef NSIG
18252 #  ifdef _NSIG
18253 #    define NSIG (_NSIG)
18254 #  endif
18255 #endif
18256
18257 #ifndef NSIG
18258 #  ifdef SIGMAX
18259 #    define NSIG (SIGMAX+1)
18260 #  endif
18261 #endif
18262
18263 #ifndef NSIG
18264 #  ifdef SIG_MAX
18265 #    define NSIG (SIG_MAX+1)
18266 #  endif
18267 #endif
18268
18269 #ifndef NSIG
18270 #  ifdef MAXSIG
18271 #    define NSIG (MAXSIG+1)
18272 #  endif
18273 #endif
18274
18275 #ifndef NSIG
18276 #  ifdef MAX_SIG
18277 #    define NSIG (MAX_SIG+1)
18278 #  endif
18279 #endif
18280
18281 #ifndef NSIG
18282 #  ifdef SIGARRAYSIZE
18283 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
18284 #  endif
18285 #endif
18286
18287 #ifndef NSIG
18288 #  ifdef _sys_nsig
18289 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
18290 #  endif
18291 #endif
18292
18293 /* Default to some arbitrary number that's big enough to get most
18294    of the common signals.
18295 */
18296 #ifndef NSIG
18297 #    define NSIG 50
18298 #endif
18299
18300 printf("NSIG %d\n", NSIG);
18301
18302 #ifndef JUST_NSIG
18303
18304 EOCP
18305
18306 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
18307 {
18308         printf "#ifdef SIG"; printf $1; printf "\n"
18309         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
18310         printf $1; printf ");\n"
18311         printf "#endif\n"
18312 }
18313 END {
18314         printf "#endif /* JUST_NSIG */\n";
18315         printf "exit(0);\n}\n";
18316 }
18317 ' >>signal.c
18318 $cat >signal.awk <<'EOP'
18319 BEGIN { ndups = 0 }
18320 $1 ~ /^NSIG$/ { nsig = $2 }
18321 ($1 !~ /^NSIG$/) && (NF == 2) {
18322     if ($2 > maxsig) { maxsig = $2 }
18323     if (sig_name[$2]) {
18324         dup_name[ndups] = $1
18325         dup_num[ndups] = $2
18326         ndups++ 
18327     }
18328     else {
18329         sig_name[$2] = $1
18330         sig_num[$2] = $2
18331     }
18332 }
18333 END { 
18334     if (nsig == 0) {
18335         nsig = maxsig + 1
18336     }
18337     printf("NSIG %d\n", nsig);
18338     for (n = 1; n < nsig; n++) {
18339         if (sig_name[n]) {
18340             printf("%s %d\n", sig_name[n], sig_num[n])
18341         }
18342         else {
18343             printf("NUM%d %d\n", n, n) 
18344         }
18345     }
18346     for (n = 0; n < ndups; n++) {
18347         printf("%s %d\n", dup_name[n], dup_num[n])
18348     }
18349 }
18350 EOP
18351 $cat >signal_cmd <<EOS
18352 $startsh
18353 if $test -s signal.lst; then
18354     echo "Using your existing signal.lst file"
18355         exit 0
18356 fi
18357 xxx="$xxx"
18358 EOS
18359 $cat >>signal_cmd <<'EOS'
18360
18361 set signal
18362 if eval $compile_ok; then
18363         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
18364 else
18365         echo "(I can't seem be able to compile the whole test program)" >&4
18366         echo "(I'll try it in little pieces.)" >&4
18367         set signal -DJUST_NSIG
18368         if eval $compile_ok; then
18369                 $run ./signal$_exe > signal.nsg
18370                 $cat signal.nsg
18371         else
18372                 echo "I can't seem to figure out how many signals you have." >&4
18373                 echo "Guessing 50." >&4
18374                 echo 'NSIG 50' > signal.nsg
18375         fi
18376         : Now look at all the signal names, one at a time.
18377         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
18378                 $cat > signal.c <<EOCP
18379 #include <sys/types.h>
18380 #include <signal.h>
18381 #include <stdio.h>
18382 int main() {
18383 printf("$xx %d\n", SIG${xx});
18384 return 0;
18385 }
18386 EOCP
18387                 set signal
18388                 if eval $compile; then
18389                         echo "SIG${xx} found."
18390                         $run ./signal$_exe  >> signal.ls1
18391                 else
18392                         echo "SIG${xx} NOT found."
18393                 fi
18394         done
18395         if $test -s signal.ls1; then
18396                 $cat signal.nsg signal.ls1 |
18397                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
18398         fi
18399
18400 fi
18401 if $test -s signal.lst; then
18402         :
18403 else
18404         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
18405         echo 'kill -l' >signal
18406         set X `csh -f <signal`
18407         $rm -f signal
18408         shift
18409         case $# in
18410         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
18411         esac
18412         echo $@ | $tr ' ' $trnl | \
18413             $awk '{ printf "%s %d\n", $1, ++s; }
18414                   END { printf "NSIG %d\n", ++s }' >signal.lst
18415 fi
18416 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
18417 EOS
18418 chmod a+x signal_cmd
18419 $eunicefix signal_cmd
18420
18421 : generate list of signal names
18422 echo " "
18423 case "$sig_name_init" in
18424 '') doinit=yes ;;
18425 *)  case "$sig_num_init" in
18426     ''|*,*) doinit=yes ;;
18427     esac ;;
18428 esac
18429 case "$doinit" in
18430 yes)
18431         echo "Generating a list of signal names and numbers..." >&4
18432         . ./signal_cmd
18433         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
18434         sig_name=`$awk 'BEGIN { printf "ZERO " }
18435                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
18436         sig_num=`$awk  'BEGIN { printf "0 " }
18437                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
18438         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
18439                              !/^NSIG/   { printf "\"%s\", ", $1 }
18440                              END        { printf "0\n" }' signal.lst`
18441         sig_num_init=`$awk  'BEGIN      { printf "0, " }
18442                              !/^NSIG/   { printf "%d, ", $2}
18443                              END        { printf "0\n"}' signal.lst`
18444         ;;
18445 esac
18446 echo "The following $sig_count signals are available:"
18447 echo " "
18448 echo $sig_name | $awk \
18449 'BEGIN { linelen = 0 }
18450 {
18451         for (i = 1; i <= NF; i++) {
18452                 name = "SIG" $i " "
18453                 linelen = linelen + length(name)
18454                 if (linelen > 70) {
18455                         printf "\n"
18456                         linelen = length(name)
18457                 }
18458                 printf "%s", name
18459         }
18460         printf "\n"
18461 }'
18462 sig_size=`echo $sig_name | awk '{print NF}'`
18463 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
18464
18465 echo " "
18466 case "$sizetype" in
18467 *_t) zzz="$sizetype"    ;;
18468 *)   zzz="filesize"     ;;
18469 esac
18470 echo "Checking the size of $zzz..." >&4 
18471 cat > try.c <<EOCP
18472 #include <sys/types.h>
18473 #include <stdio.h>
18474 int main() {
18475     printf("%d\n", (int)sizeof($sizetype));
18476     exit(0);
18477 }
18478 EOCP
18479 set try
18480 if eval $compile_ok; then
18481         yyy=`$run ./try`
18482         case "$yyy" in
18483         '')     sizesize=4
18484                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
18485                 ;;
18486         *)      sizesize=$yyy
18487                 echo "Your $zzz size is $sizesize bytes."
18488                 ;;
18489         esac
18490 else
18491         sizesize=4
18492         echo "(I can't compile the test program--guessing $sizesize.)" >&4
18493 fi
18494
18495
18496 : check for socklen_t
18497 echo " "
18498 echo "Checking to see if you have socklen_t..." >&4
18499 $cat >try.c <<EOCP
18500 #include <sys/types.h>
18501 #$d_socket HAS_SOCKET
18502 #ifdef HAS_SOCKET
18503 #include <sys/socket.h>
18504 #endif
18505 int main() { socklen_t x = 16; }
18506 EOCP
18507 set try
18508 if eval $compile; then
18509         val="$define"
18510         echo "You have socklen_t."
18511 else
18512         val="$undef"
18513         echo "You do not have socklen_t."
18514         case "$sizetype" in
18515         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
18516         esac
18517 fi
18518 $rm -f try try.*
18519 set d_socklen_t
18520 eval $setvar
18521
18522 : see if this is a socks.h system
18523 set socks.h i_socks
18524 eval $inhdr
18525
18526 : check for type of the size argument to socket calls
18527 case "$d_socket" in
18528 "$define")
18529         $cat <<EOM
18530
18531 Checking to see what type is the last argument of accept().
18532 EOM
18533         yyy=''
18534         case "$d_socklen_t" in
18535         "$define") yyy="$yyy socklen_t"
18536         esac
18537         yyy="$yyy $sizetype int long unsigned"
18538         for xxx in $yyy; do
18539                 case "$socksizetype" in
18540                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
18541                         case "$usesocks" in
18542                         "$define")
18543                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
18544                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18545                                         socksizetype="$xxx"
18546                                 fi
18547                                 ;;
18548                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
18549                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18550                                         socksizetype="$xxx"
18551                                 fi
18552                                 ;;
18553                         esac
18554                         ;;
18555                 esac
18556         done
18557 : In case none of those worked, prompt the user.
18558         case "$socksizetype" in
18559         '')     rp='What is the type for socket address structure sizes?'
18560                 dflt='int'
18561                 . ./myread
18562                 socksizetype=$ans
18563                 ;;
18564         esac
18565         ;;
18566 *)      : no sockets, so pick relatively harmless default
18567         socksizetype='int'
18568         ;;
18569 esac
18570
18571 : see what type is used for signed size_t
18572 set ssize_t ssizetype int stdio.h sys/types.h
18573 eval $typedef
18574 dflt="$ssizetype"
18575 $cat > try.c <<EOM
18576 #include <stdio.h>
18577 #include <sys/types.h>
18578 #define Size_t $sizetype
18579 #define SSize_t $dflt
18580 int main()
18581 {
18582         if (sizeof(Size_t) == sizeof(SSize_t))
18583                 printf("$dflt\n");
18584         else if (sizeof(Size_t) == sizeof(int))
18585                 printf("int\n");
18586         else 
18587                 printf("long\n");
18588         exit(0);
18589 }
18590 EOM
18591 echo " "
18592 set try
18593 if eval $compile_ok && $run ./try > /dev/null; then
18594         ssizetype=`$run ./try`
18595         echo "I'll be using $ssizetype for functions returning a byte count." >&4
18596 else
18597         $cat >&4 <<EOM
18598 Help! I can't compile and run the ssize_t test program: please enlighten me!
18599 (This is probably a misconfiguration in your system or libraries, and
18600 you really ought to fix it.  Still, I'll try anyway.)
18601
18602 I need a type that is the same size as $sizetype, but is guaranteed to
18603 be signed.  Common values are ssize_t, int and long.
18604
18605 EOM
18606         rp="What signed type is the same size as $sizetype?"
18607         . ./myread
18608         ssizetype="$ans"
18609 fi
18610 $rm -f try try.*
18611
18612 : see what type of char stdio uses.
18613 echo " "
18614 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
18615 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
18616         echo "Your stdio uses unsigned chars." >&4
18617         stdchar="unsigned char"
18618 else
18619         echo "Your stdio uses signed chars." >&4
18620         stdchar="char"
18621 fi
18622 $rm -f stdioh
18623
18624
18625
18626 : see what type uids are declared as in the kernel
18627 echo " "
18628 echo "Looking for the type for user ids returned by getuid()."
18629 set uid_t uidtype xxx stdio.h sys/types.h
18630 eval $typedef
18631 case "$uidtype" in
18632 xxx)
18633         xxx=`./findhdr sys/user.h`
18634         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18635         case $1 in
18636         unsigned) dflt="$1 $2" ;;
18637         *) dflt="$1" ;;
18638         esac
18639         ;;
18640 *) dflt="$uidtype";;
18641 esac
18642 case "$uidtype" in
18643 uid_t)  echo "uid_t found." ;;
18644 *)      rp="What is the type for user ids returned by getuid()?"
18645         . ./myread
18646         uidtype="$ans"
18647         ;;
18648 esac
18649
18650 echo " "
18651 case "$uidtype" in
18652 *_t) zzz="$uidtype"     ;;
18653 *)   zzz="uid"          ;;
18654 esac
18655 echo "Checking the size of $zzz..." >&4 
18656 cat > try.c <<EOCP
18657 #include <sys/types.h>
18658 #include <stdio.h>
18659 int main() {
18660     printf("%d\n", (int)sizeof($uidtype));
18661     exit(0);
18662 }
18663 EOCP
18664 set try
18665 if eval $compile_ok; then
18666         yyy=`$run ./try`
18667         case "$yyy" in
18668         '')     uidsize=4
18669                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
18670                 ;;
18671         *)      uidsize=$yyy
18672                 echo "Your $zzz is $uidsize bytes long."
18673                 ;;
18674         esac
18675 else
18676         uidsize=4
18677         echo "(I can't compile the test program--guessing $uidsize.)" >&4
18678 fi
18679
18680 echo " "
18681 case "$uidtype" in
18682 *_t) zzz="$uidtype"     ;;
18683 *)   zzz="uid"          ;;
18684 esac
18685 echo "Checking the sign of $zzz..." >&4
18686 cat > try.c <<EOCP
18687 #include <sys/types.h>
18688 #include <stdio.h>
18689 int main() {
18690         $uidtype foo = -1;
18691         if (foo < 0)
18692                 printf("-1\n");
18693         else
18694                 printf("1\n");
18695 }
18696 EOCP
18697 set try
18698 if eval $compile; then
18699         yyy=`$run ./try`
18700         case "$yyy" in
18701         '')     uidsign=1
18702                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18703                 ;;
18704         *)      uidsign=$yyy
18705                 case "$uidsign" in
18706                  1) echo "Your $zzz is unsigned." ;;
18707                 -1) echo "Your $zzz is signed."   ;;
18708                 esac
18709                 ;;
18710         esac
18711 else
18712         uidsign=1
18713         echo "(I can't compile the test program--guessing unsigned.)" >&4
18714 fi
18715
18716
18717
18718 echo " "
18719 $echo "Checking the format string to be used for uids..." >&4
18720
18721 case "$uidsign" in
18722 -1)     if $test X"$uidsize" = X"$ivsize"; then
18723                 uidformat="$ivdformat"
18724         else
18725                 if $test X"$uidsize" = X"$longsize"; then
18726                         uidformat='"ld"'
18727                 else
18728                         if $test X"$uidsize" = X"$intsize"; then
18729                                 uidformat='"d"'
18730                         else
18731                                 if $test X"$uidsize" = X"$shortsize"; then
18732                                         uidformat='"hd"'
18733                                 fi
18734                         fi
18735                 fi
18736         fi
18737         ;;
18738 *)      if $test X"$uidsize" = X"$uvsize"; then
18739                 uidformat="$uvuformat"
18740         else
18741                 if $test X"$uidsize" = X"$longsize"; then
18742                         uidformat='"lu"'
18743                 else
18744                         if $test X"$uidsize" = X"$intsize"; then
18745                                 uidformat='"u"'
18746                         else
18747                                 if $test X"$uidsize" = X"$shortsize"; then
18748                                         uidformat='"hu"'
18749                                 fi
18750                         fi
18751                 fi
18752         fi
18753         ;;
18754 esac
18755
18756 : determine compiler compiler
18757 case "$yacc" in
18758 '')
18759         dflt=yacc;;
18760 *)
18761         dflt="$yacc";;
18762 esac
18763 echo " "
18764 comp='yacc'
18765 if $test -f "$byacc$_exe"; then
18766         dflt="$byacc"
18767         comp="byacc or $comp"
18768 fi
18769 if $test -f "$bison$_exe"; then
18770         comp="$comp or bison -y"
18771 fi
18772 rp="Which compiler compiler ($comp) shall I use?"
18773 . ./myread
18774 yacc="$ans"
18775 case "$yacc" in
18776 *bis*)
18777         case "$yacc" in
18778         *-y*) ;;
18779         *)
18780                 yacc="$yacc -y"
18781                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
18782                 ;;
18783         esac
18784         ;;
18785 esac
18786
18787 : see if this is a fp.h system
18788 set fp.h i_fp
18789 eval $inhdr
18790
18791 : see if this is a fp_class.h system
18792 set fp_class.h i_fp_class
18793 eval $inhdr
18794
18795 : see if this is a ieeefp.h system
18796 case "$i_ieeefp" in
18797 '' ) set ieeefp.h i_ieeefp
18798      eval $inhdr
18799      ;;
18800 esac
18801
18802 : see if this is a libutil.h system
18803 set libutil.h i_libutil
18804 eval $inhdr
18805
18806 : see if mach cthreads are available
18807 if test "X$usethreads" = "X$define"; then
18808         set mach/cthreads.h i_machcthr
18809         eval $inhdr
18810 else
18811         i_machcthr="$undef"
18812 fi
18813
18814
18815
18816 : see if this is a math.h system
18817 set math.h i_math
18818 eval $inhdr
18819
18820 : see if this is a mntent.h system
18821 set mntent.h i_mntent
18822 eval $inhdr
18823
18824 : see if ndbm.h is available
18825 set ndbm.h t_ndbm
18826 eval $inhdr
18827
18828 case "$t_ndbm" in
18829 $undef)
18830     # Some Linux distributions such as RedHat 7.1 put the
18831     # ndbm.h header in /usr/include/gdbm/ndbm.h.
18832     if $test -f /usr/include/gdbm/ndbm.h; then
18833         echo '<gdbm/ndbm.h> found.'
18834         ccflags="$ccflags -I/usr/include/gdbm"
18835         cppflags="$cppflags -I/usr/include/gdbm"
18836         t_ndbm=$define
18837     fi
18838     ;;
18839 esac
18840
18841 case "$t_ndbm" in
18842 $define)
18843         : see if dbm_open exists
18844         set dbm_open d_dbm_open
18845         eval $inlibc
18846         case "$d_dbm_open" in
18847         $undef)
18848                 t_ndbm="$undef"
18849                 echo "We won't be including <ndbm.h>"
18850                 ;;
18851         esac
18852         ;;
18853 esac
18854 val="$t_ndbm"
18855 set i_ndbm
18856 eval $setvar
18857
18858 : see if net/errno.h is available
18859 val=''
18860 set net/errno.h val
18861 eval $inhdr
18862
18863 : Unfortunately, it causes problems on some systems.  Arrgh.
18864 case "$val" in
18865 $define)
18866         cat > try.c <<'EOM'
18867 #include <stdio.h>
18868 #include <errno.h>
18869 #include <net/errno.h>
18870 int func()
18871 {
18872         return ENOTSOCK;
18873 }
18874 EOM
18875         if $cc $ccflags -c try.c >/dev/null 2>&1; then
18876                 echo "We'll be including <net/errno.h>." >&4
18877         else
18878                 echo "We won't be including <net/errno.h>." >&4
18879                 val="$undef"
18880         fi
18881         $rm -f try.* try
18882         ;;
18883 esac
18884 set i_neterrno
18885 eval $setvar
18886
18887 : see if netinet/tcp.h is available
18888 set netinet/tcp.h i_netinettcp
18889 eval $inhdr
18890
18891 : see if this is a poll.h system
18892 set poll.h i_poll
18893 eval $inhdr
18894
18895 : see if this is a prot.h system
18896 set prot.h i_prot
18897 eval $inhdr
18898
18899 echo " "
18900 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
18901 $cat <<'EOSH' > Cppsym.know
18902 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
18903 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
18904 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
18905 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
18906 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
18907 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
18908 bull c cadmus clipper CMU COFF COMPILER_VERSION
18909 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
18910 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
18911 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
18912 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
18913 GLIBC GLIBC_MINOR
18914 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
18915 H3050R H3050RX hbullx20 hcx host_mips
18916 hp200 hp300 hp700 HP700 hp800 hp9000
18917 hp9000s200 hp9000s300 hp9000s400 hp9000s500
18918 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
18919 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
18920 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
18921 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
18922 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
18923 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
18924 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
18925 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
18926 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
18927 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
18928 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
18929 MATH_HAS_NO_SIDE_EFFECTS
18930 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
18931 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
18932 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
18933 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
18934 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
18935 NetBSD news1500 news1700 news1800 news1900 news3700
18936 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
18937 ns32016 ns32332 ns32k nsc32000
18938 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
18939 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
18940 pc532 pdp11 PGC PIC plexus PORTAR posix
18941 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
18942 POSIX_C_SOURCE POSIX_SOURCE POWER
18943 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
18944 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
18945 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
18946 sony sony_news sonyrisc sparc sparclite spectrum
18947 stardent stdc STDC_EXT stratos sun sun3 sun386
18948 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
18949 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
18950 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
18951 sysV68 sysV88 Tek4132 Tek4300 titan
18952 TM3200 TM5400 TM5600
18953 tower tower32 tower32_200 tower32_600 tower32_700
18954 tower32_800 tower32_850 tss
18955 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
18956 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
18957 unix UNIX95 UNIX99 unixpc unos
18958 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
18959 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
18960 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
18961 USGr4 USGr4_2
18962 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
18963 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
18964 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
18965 z8000
18966 EOSH
18967 # Maybe put other stuff here too.
18968 cat <<EOSH >>Cppsym.know
18969 $osname
18970 EOSH
18971 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
18972 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
18973 $cat Cppsym.know > Cppsym.c
18974 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
18975 $rm -f Cppsym.a Cppsym.b Cppsym.c
18976 cat <<EOSH > Cppsym
18977 $startsh
18978 if $test \$# -gt 0; then
18979     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
18980     if $test -s Cppsym.got; then
18981         $rm -f Cppsym.got
18982         exit 0
18983     fi
18984     $rm -f Cppsym.got
18985     exit 1
18986 else
18987     $tr " " "$trnl" | ./Cppsym.try
18988     exit 0
18989 fi
18990 EOSH
18991 chmod +x Cppsym
18992 $eunicefix Cppsym
18993 cat <<EOSH > Cppsym.try
18994 $startsh
18995 cat <<'EOCP' > try.c
18996 #include <stdio.h>
18997 int main() {
18998 EOCP
18999 $awk \\
19000 EOSH
19001 cat <<'EOSH' >> Cppsym.try
19002 'length($1) > 0 {
19003     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
19004     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
19005     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
19006     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
19007 }'       >> try.c
19008 echo 'return 0;}' >> try.c
19009 EOSH
19010 cat <<EOSH >> Cppsym.try
19011 ccflags="$ccflags"
19012 case "$osname-$gccversion" in
19013 irix-) ccflags="\$ccflags -woff 1178" ;;
19014 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
19015 esac
19016 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
19017 EOSH
19018 chmod +x Cppsym.try
19019 $eunicefix Cppsym.try
19020 ./Cppsym < Cppsym.know > Cppsym.true
19021 : now check the C compiler for additional symbols
19022 postprocess_cc_v=''
19023 case "$osname" in
19024 aix) postprocess_cc_v="|$tr , ' '" ;;
19025 esac
19026 $cat >ccsym <<EOS
19027 $startsh
19028 $cat >tmp.c <<EOF
19029 extern int foo;
19030 EOF
19031 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
19032 do
19033         case "\$i" in
19034         -D*) echo "\$i" | $sed 's/^-D//';;
19035         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
19036         esac
19037 done
19038 $rm -f try.c
19039 EOS
19040 postprocess_cc_v=''
19041 chmod +x ccsym
19042 $eunicefix ccsym
19043 ./ccsym > ccsym1.raw
19044 if $test -s ccsym1.raw; then
19045        $sort ccsym1.raw | $uniq >ccsym.raw
19046 else
19047        mv ccsym1.raw ccsym.raw
19048 fi
19049
19050 $awk '/\=/ { print $0; next }
19051         { print $0"=1" }' ccsym.raw >ccsym.list
19052 $awk '/\=/ { print $0; next }
19053         { print $0"=1" }' Cppsym.true >ccsym.true
19054 $comm -13 ccsym.true ccsym.list >ccsym.own
19055 $comm -12 ccsym.true ccsym.list >ccsym.com
19056 $comm -23 ccsym.true ccsym.list >ccsym.cpp
19057 also=''
19058 if $test -z ccsym.raw; then
19059         echo "Your C compiler doesn't seem to define any symbols!" >&4
19060         echo " "
19061         echo "However, your C preprocessor defines the following symbols:"
19062         $cat Cppsym.true
19063         ccsymbols=''
19064         cppsymbols=`$cat Cppsym.true`
19065         cppsymbols=`echo $cppsymbols`
19066         cppccsymbols="$cppsymbols"
19067 else
19068         if $test -s ccsym.com; then
19069                 echo "Your C compiler and pre-processor define these symbols:"
19070                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
19071                 also='also '
19072                 symbols='ones'
19073                 cppccsymbols=`$cat ccsym.com`
19074                 cppccsymbols=`echo $cppccsymbols`
19075                 $test "$silent" || sleep 1
19076         fi
19077         if $test -s ccsym.cpp; then
19078                 $test "$also" && echo " "
19079                 echo "Your C pre-processor ${also}defines the following symbols:"
19080                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
19081                 also='further '
19082                 cppsymbols=`$cat ccsym.cpp`
19083                 cppsymbols=`echo $cppsymbols`
19084                 $test "$silent" || sleep 1
19085         fi
19086         if $test -s ccsym.own; then
19087                 $test "$also" && echo " "
19088                 echo "Your C compiler ${also}defines the following cpp symbols:"
19089                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
19090                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
19091                 ccsymbols=`$cat ccsym.own`
19092                 ccsymbols=`echo $ccsymbols`
19093                 $test "$silent" || sleep 1
19094         fi
19095 fi
19096
19097 : see if this is a termio system
19098 val="$undef"
19099 val2="$undef"
19100 val3="$undef"
19101 if $test `./findhdr termios.h`; then
19102         set tcsetattr i_termios
19103         eval $inlibc
19104         val3="$i_termios"
19105 fi
19106 echo " "
19107 case "$val3" in
19108 "$define") echo "You have POSIX termios.h... good!" >&4;;
19109 *) if ./Cppsym pyr; then
19110                 case "`/bin/universe`" in
19111                 ucb) if $test `./findhdr sgtty.h`; then
19112                                 val2="$define"
19113                                 echo "<sgtty.h> found." >&4
19114                         else
19115                                 echo "System is pyramid with BSD universe."
19116                                 echo "<sgtty.h> not found--you could have problems." >&4
19117                         fi;;
19118                 *) if $test `./findhdr termio.h`; then
19119                                 val="$define"
19120                                 echo "<termio.h> found." >&4
19121                         else
19122                                 echo "System is pyramid with USG universe."
19123                                 echo "<termio.h> not found--you could have problems." >&4
19124                         fi;;
19125                 esac
19126         elif ./usg; then
19127                 if $test `./findhdr termio.h`; then
19128                         echo "<termio.h> found." >&4
19129                         val="$define"
19130                 elif $test `./findhdr sgtty.h`; then
19131                         echo "<sgtty.h> found." >&4
19132                         val2="$define"
19133                 else
19134 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
19135                 fi
19136         else
19137                 if $test `./findhdr sgtty.h`; then
19138                         echo "<sgtty.h> found." >&4
19139                         val2="$define"
19140                 elif $test `./findhdr termio.h`; then
19141                         echo "<termio.h> found." >&4
19142                         val="$define"
19143                 else
19144 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
19145                 fi
19146         fi;;
19147 esac
19148 set i_termio; eval $setvar
19149 val=$val2; set i_sgtty; eval $setvar
19150 val=$val3; set i_termios; eval $setvar
19151
19152 : see if stddef is available
19153 set stddef.h i_stddef
19154 eval $inhdr
19155
19156 : see if this is a sunmath.h system
19157 set sunmath.h i_sunmath
19158 eval $inhdr
19159
19160 : see if sys/access.h is available
19161 set sys/access.h i_sysaccess
19162 eval $inhdr
19163
19164 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
19165 set sys/filio.h i_sysfilio
19166 eval $inhdr
19167 echo " "
19168 if $test `./findhdr sys/ioctl.h`; then
19169         val="$define"
19170         echo '<sys/ioctl.h> found.' >&4
19171 else
19172         val="$undef"
19173         if $test $i_sysfilio = "$define"; then
19174             echo '<sys/ioctl.h> NOT found.' >&4
19175         else
19176                 $test $i_sgtty = "$define" && xxx="sgtty.h"
19177                 $test $i_termio = "$define" && xxx="termio.h"
19178                 $test $i_termios = "$define" && xxx="termios.h"
19179 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
19180         fi
19181 fi
19182 set i_sysioctl
19183 eval $setvar
19184
19185 : see if socket ioctl defs are in sys/sockio.h
19186 echo " "
19187 xxx=`./findhdr sys/sockio.h`
19188 if $test "$xxx"; then
19189         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
19190                 val="$define"
19191                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
19192         else
19193                 val="$undef"
19194                 echo "No socket ioctls found in <sys/sockio.h>." >&4
19195         fi
19196 else
19197         val="$undef"
19198         $cat <<EOM
19199 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
19200 EOM
19201 fi
19202 set i_syssockio
19203 eval $setvar
19204
19205
19206 : see if this is a syslog.h system
19207 set syslog.h i_syslog
19208 eval $inhdr
19209
19210
19211 : see if this is a sys/mode.h system
19212 set sys/mode.h i_sysmode
19213 eval $inhdr
19214
19215 : see if sys/resource.h has to be included
19216 set sys/resource.h i_sysresrc
19217 eval $inhdr
19218
19219 : see if sys/security.h is available
19220 set sys/security.h i_syssecrt
19221 eval $inhdr
19222
19223 : see if this is a sys/statvfs.h system
19224 set sys/statvfs.h i_sysstatvfs
19225 eval $inhdr
19226
19227 : see if this is a sys/un.h system
19228 set sys/un.h i_sysun
19229 eval $inhdr
19230
19231
19232 : see if this is a sys/utsname.h system
19233 set sys/utsname.h i_sysutsname
19234 eval $inhdr
19235
19236 : see if this is a syswait system
19237 set sys/wait.h i_syswait
19238 eval $inhdr
19239
19240 : see if this is a ustat.h system
19241 set ustat.h i_ustat
19242 eval $inhdr
19243
19244 : see if this is an utime system
19245 set utime.h i_utime
19246 eval $inhdr
19247
19248 : see if this is a values.h system
19249 set values.h i_values
19250 eval $inhdr
19251
19252 : see if this is a vfork system
19253 case "$d_vfork" in
19254 "$define")
19255         set vfork.h i_vfork
19256         eval $inhdr
19257         ;;
19258 *)
19259         i_vfork="$undef"
19260         ;;
19261 esac
19262
19263 : see if gdbm.h is available
19264 set gdbm.h t_gdbm
19265 eval $inhdr
19266 case "$t_gdbm" in
19267 $define)
19268         : see if gdbm_open exists
19269         set gdbm_open d_gdbm_open
19270         eval $inlibc
19271         case "$d_gdbm_open" in
19272         $undef)
19273                 t_gdbm="$undef"
19274                 echo "We won't be including <gdbm.h>"
19275                 ;;
19276         esac
19277         ;;
19278 esac
19279 val="$t_gdbm"
19280 set i_gdbm
19281 eval $setvar
19282
19283 echo " "
19284 echo "Looking for extensions..." >&4
19285 : If we are using the old config.sh, known_extensions may contain
19286 : old or inaccurate or duplicate values.
19287 known_extensions=''
19288 nonxs_extensions=''
19289 : We do not use find because it might not be available.
19290 : We do not just use MANIFEST because the user may have dropped
19291 : some additional extensions into the source tree and expect them
19292 : to be built.
19293
19294 : Function to recursively find available extensions, ignoring DynaLoader
19295 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
19296 find_extensions='
19297     for xxx in *; do
19298        case "$xxx" in
19299            DynaLoader|dynaload) ;;
19300            *)
19301            if $test -f $xxx/$xxx.xs; then
19302                known_extensions="$known_extensions $1$xxx";
19303            elif $test -f $xxx/Makefile.PL; then
19304                nonxs_extensions="$nonxs_extensions $1$xxx";
19305            else
19306                if $test -d $xxx -a $# -lt 10; then
19307                    set $1$xxx/ $*;
19308                    cd "$xxx";
19309                    eval $find_extensions;
19310                    cd ..;
19311                    shift;
19312                fi;
19313            fi
19314            ;;
19315        esac;
19316     done'
19317 tdir=`pwd`
19318 cd "$rsrc/ext"
19319 set X
19320 shift
19321 eval $find_extensions
19322 # Special case:  Add in threads/shared since it is not picked up by the
19323 # recursive find above (and adding in general recursive finding breaks
19324 # SDBM_File/sdbm).  A.D.  10/25/2001.
19325 known_extensions="$known_extensions threads/shared"
19326 set X $nonxs_extensions
19327 shift
19328 nonxs_extensions="$*"
19329 set X $known_extensions
19330 shift
19331 known_extensions="$*"
19332 cd "$tdir"
19333
19334 : Now see which are supported on this system.
19335 avail_ext=''
19336 for xxx in $known_extensions ; do
19337         case "$xxx" in
19338         DB_File|db_file)
19339                 case "$i_db" in
19340                 $define) avail_ext="$avail_ext $xxx" ;;
19341                 esac
19342                 ;;
19343         GDBM_File|gdbm_fil)
19344                 case "$i_gdbm" in 
19345                 $define) avail_ext="$avail_ext $xxx" ;;
19346                 esac
19347                 ;;
19348         I18N/Langinfo|i18n_lan)
19349                 case "$i_langinfo$d_nl_langinfo" in 
19350                 $define$define) avail_ext="$avail_ext $xxx" ;;
19351                 esac
19352                 ;;
19353         NDBM_File|ndbm_fil)
19354                 case "$i_ndbm" in
19355                 $define)
19356                     case "$osname-$use64bitint" in
19357                     hpux-define)
19358                         case "$libs" in
19359                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
19360                         esac
19361                         ;;
19362                     *) avail_ext="$avail_ext $xxx" ;;
19363                     esac
19364                     ;;
19365                 esac
19366                 ;;
19367         ODBM_File|odbm_fil) 
19368                 case "${i_dbm}${i_rpcsvcdbm}" in
19369                 *"${define}"*)
19370                     case "$osname-$use64bitint" in
19371                     hpux-define)
19372                         case "$libs" in
19373                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
19374                         esac
19375                         ;;
19376                     *) avail_ext="$avail_ext $xxx" ;;
19377                     esac
19378                     ;;
19379                 esac
19380                 ;;
19381         POSIX|posix)
19382                 case "$useposix" in
19383                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19384                 esac
19385                 ;;
19386         Opcode|opcode)
19387                 case "$useopcode" in
19388                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19389                 esac
19390                 ;;
19391         Socket|socket)
19392                 case "$d_socket" in 
19393                 true|$define|y)
19394                     case "$osname" in
19395                     beos) ;; # not unless BONE
19396                     *) avail_ext="$avail_ext $xxx" ;;
19397                     esac
19398                     ;;
19399                 esac
19400                 ;;
19401         Sys/Syslog|sys/syslog)
19402                 : XXX syslog requires socket
19403                 case "$d_socket" in 
19404                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
19405                 esac
19406                 ;;
19407         Thread|thread)
19408                 case "$usethreads" in
19409                 true|$define|y)
19410                         case "$useithreads" in
19411                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
19412                         esac
19413                 esac
19414                 ;;
19415         XS/APItest|xs/apitest)
19416                 # This is just for testing.  Skip it unless we have dynamic loading.
19417
19418                 case "$usedl" in
19419                 $define) avail_ext="$avail_ext $xxx" ;;
19420                 esac
19421                 ;;
19422         XS/Typemap|xs/typemap)
19423                 # This is just for testing.  Skip it unless we have dynamic loading.
19424                 case "$usedl" in
19425                 $define) avail_ext="$avail_ext $xxx" ;;
19426                 esac
19427                 ;;
19428         threads|threads/shared)
19429                 # threads and threads::shared are special cases.
19430                 # To stop people from asking "Perl 5.8.0 was supposed
19431                 # to have this new fancy threads implementation but my
19432                 # perl doesn't have it" and from people trying to
19433                 # (re)install the threads module using CPAN.pm and
19434                 # CPAN.pm then offering to reinstall Perl 5.8.0,
19435                 # the threads.pm and threads/shared.pm will always be
19436                 # there, croaking informatively ("you need to rebuild
19437                 # all of Perl with threads, sorry") when threads haven't
19438                 # been compiled in.
19439                 # --jhi
19440                 avail_ext="$avail_ext $xxx"
19441                 ;;
19442         IPC/SysV|ipc/sysv)
19443                 : XXX Do we need a useipcsysv variable here
19444                 case "${d_msg}${d_sem}${d_shm}" in 
19445                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
19446                 esac
19447                 ;;
19448         *)      avail_ext="$avail_ext $xxx"
19449                 ;;
19450         esac
19451 done
19452
19453 set X $avail_ext
19454 shift
19455 avail_ext="$*"
19456
19457 : Now see which nonxs extensions are supported on this system.
19458 : For now assume all are.
19459 nonxs_ext=''
19460 for xxx in $nonxs_extensions ; do
19461         case "$xxx" in
19462         *)      nonxs_ext="$nonxs_ext $xxx"
19463                 ;;
19464         esac
19465 done
19466
19467 set X $nonxs_ext
19468 shift
19469 nonxs_ext="$*"
19470
19471 case $usedl in
19472 $define)
19473         $cat <<EOM
19474 A number of extensions are supplied with $package.  You may choose to
19475 compile these extensions for dynamic loading (the default), compile
19476 them into the $package executable (static loading), or not include
19477 them at all.  Answer "none" to include no extensions.
19478 Note that DynaLoader is always built and need not be mentioned here.
19479
19480 EOM
19481         case "$dynamic_ext" in
19482         '')
19483                 : Exclude those listed in static_ext
19484                 dflt=''
19485                 for xxx in $avail_ext; do
19486                         case " $static_ext " in
19487                         *" $xxx "*) ;;
19488                         *) dflt="$dflt $xxx" ;;
19489                         esac
19490                 done
19491                 set X $dflt
19492                 shift
19493                 dflt="$*"
19494                 ;;
19495         *)      dflt="$dynamic_ext"
19496                 # Perhaps we are reusing an old out-of-date config.sh.
19497                 case "$hint" in
19498                 previous)
19499                         if test X"$dynamic_ext" != X"$avail_ext"; then
19500                                 $cat <<EOM
19501 NOTICE:  Your previous config.sh list may be incorrect. 
19502 The extensions now available to you are 
19503         ${avail_ext}
19504 but the default list from your previous config.sh is
19505         ${dynamic_ext} 
19506
19507 EOM
19508                         fi
19509                         ;;
19510                 esac
19511                 ;;
19512         esac
19513         case "$dflt" in
19514         '')     dflt=none;;
19515         esac
19516         rp="What extensions do you wish to load dynamically?"
19517         . ./myread
19518         case "$ans" in
19519         none) dynamic_ext=' ' ;;
19520         *) dynamic_ext="$ans" ;;
19521         esac
19522
19523         case "$static_ext" in
19524         '')
19525                 : Exclude those already listed in dynamic linking
19526                 dflt=''
19527                 for xxx in $avail_ext; do
19528                         case " $dynamic_ext " in
19529                         *" $xxx "*) ;;
19530                         *) dflt="$dflt $xxx" ;;
19531                         esac
19532                 done
19533                 set X $dflt
19534                 shift
19535                 dflt="$*"
19536                 ;;
19537         *)  dflt="$static_ext" 
19538                 ;;
19539         esac
19540
19541         case "$dflt" in
19542         '')     dflt=none;;
19543         esac
19544         rp="What extensions do you wish to load statically?"
19545         . ./myread
19546         case "$ans" in
19547         none) static_ext=' ' ;;
19548         *) static_ext="$ans" ;;
19549         esac
19550         ;;
19551 *)
19552         $cat <<EOM
19553 A number of extensions are supplied with $package.  Answer "none" 
19554 to include no extensions. 
19555 Note that DynaLoader is always built and need not be mentioned here.
19556
19557 EOM
19558         case "$static_ext" in
19559         '') dflt="$avail_ext" ;;
19560         *)      dflt="$static_ext"
19561                 # Perhaps we are reusing an old out-of-date config.sh.
19562                 case "$hint" in
19563                 previous)
19564                         if test X"$static_ext" != X"$avail_ext"; then
19565                                 $cat <<EOM
19566 NOTICE:  Your previous config.sh list may be incorrect. 
19567 The extensions now available to you are 
19568         ${avail_ext}
19569 but the default list from your previous config.sh is
19570         ${static_ext} 
19571
19572 EOM
19573                         fi
19574                         ;;
19575                 esac
19576                 ;;
19577         esac
19578         : Exclude those that are not xs extensions
19579         case "$dflt" in
19580         '')     dflt=none;;
19581         esac
19582         rp="What extensions do you wish to include?"
19583         . ./myread
19584         case "$ans" in
19585         none) static_ext=' ' ;;
19586         *) static_ext="$ans" ;;
19587         esac
19588         ;;
19589 esac
19590 #        
19591 # Encode is a special case.  If we are building Encode as a static
19592 # extension, we need to explicitly list its subextensions as well.
19593 # For other nested extensions, this is handled automatically by
19594 # the appropriate Makefile.PL.
19595 case " $static_ext " in
19596         *" Encode "*) # Add the subextensions of Encode
19597         cd "$rsrc/ext"
19598         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
19599                 static_ext="$static_ext Encode/$xxx"
19600         done
19601         cd "$tdir"
19602         ;;
19603 esac
19604
19605 set X $dynamic_ext $static_ext $nonxs_ext
19606 shift
19607 extensions="$*"
19608
19609 : Remove libraries needed only for extensions
19610 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
19611 : The exception is SunOS 4.x, which needs them.
19612 case "${osname}X${osvers}" in
19613 sunos*X4*)
19614     perllibs="$libs"
19615     ;;
19616 *) case "$usedl" in
19617     $define|true|[yY]*)
19618             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
19619             shift
19620             perllibs="$*"
19621             ;;
19622     *)  perllibs="$libs"
19623             ;;
19624     esac
19625     ;;
19626 esac
19627
19628 : Remove build directory name from cppstdin so it can be used from
19629 : either the present location or the final installed location.
19630 echo " "
19631 : Get out of the UU directory to get correct path name.
19632 cd ..
19633 case "$cppstdin" in
19634 `pwd`/cppstdin)
19635         echo "Stripping down cppstdin path name"
19636         cppstdin=cppstdin
19637         ;;
19638 esac
19639 cd UU
19640
19641 : end of configuration questions
19642 echo " "
19643 echo "End of configuration questions."
19644 echo " "
19645
19646 : back to where it started
19647 if test -d ../UU; then
19648         cd ..
19649 fi
19650
19651 : configuration may be patched via a 'config.arch' file
19652 if $test -f config.arch; then
19653         echo "I see a config.arch file, loading it."
19654         . ./config.arch
19655 fi
19656
19657 : configuration may be patched via a 'config.over' file
19658 if $test -f config.over; then
19659         echo " "
19660         dflt=y
19661         rp='I see a config.over file.  Do you wish to load it?'
19662         . UU/myread
19663         case "$ans" in
19664         n*) echo "OK, I'll ignore it.";;
19665         *)      . ./config.over
19666                 echo "Configuration override changes have been loaded."
19667                 ;;
19668         esac
19669 fi
19670
19671 : in case they want portability, strip down executable paths
19672 case "$d_portable" in
19673 "$define")
19674         echo " "
19675         echo "Stripping down executable paths..." >&4
19676         for file in $loclist $trylist; do
19677                 eval temp=\$$file
19678                 eval $file=`basename $temp`
19679         done
19680         ;;
19681 esac
19682
19683 : create config.sh file
19684 echo " "
19685 echo "Creating config.sh..." >&4
19686 $spitshell <<EOT >config.sh
19687 $startsh
19688 #
19689 # This file was produced by running the Configure script. It holds all the
19690 # definitions figured out by Configure. Should you modify one of these values,
19691 # do not forget to propagate your changes by running "Configure -der". You may
19692 # instead choose to run each of the .SH files by yourself, or "Configure -S".
19693 #
19694
19695 # Package name      : $package
19696 # Source directory  : $src
19697 # Configuration time: $cf_time
19698 # Configured by     : $cf_by
19699 # Target system     : $myuname
19700
19701 Author='$Author'
19702 Date='$Date'
19703 Header='$Header'
19704 Id='$Id'
19705 Locker='$Locker'
19706 Log='$Log'
19707 Mcc='$Mcc'
19708 RCSfile='$RCSfile'
19709 Revision='$Revision'
19710 Source='$Source'
19711 State='$State'
19712 _a='$_a'
19713 _exe='$_exe'
19714 _o='$_o'
19715 afs='$afs'
19716 afsroot='$afsroot'
19717 alignbytes='$alignbytes'
19718 ansi2knr='$ansi2knr'
19719 aphostname='$aphostname'
19720 api_revision='$api_revision'
19721 api_subversion='$api_subversion'
19722 api_version='$api_version'
19723 api_versionstring='$api_versionstring'
19724 ar='$ar'
19725 archlib='$archlib'
19726 archlibexp='$archlibexp'
19727 archname64='$archname64'
19728 archname='$archname'
19729 archobjs='$archobjs'
19730 asctime_r_proto='$asctime_r_proto'
19731 awk='$awk'
19732 baserev='$baserev'
19733 bash='$bash'
19734 bin='$bin'
19735 binexp='$binexp'
19736 bison='$bison'
19737 byacc='$byacc'
19738 byteorder='$byteorder'
19739 c='$c'
19740 castflags='$castflags'
19741 cat='$cat'
19742 cc='$cc'
19743 cccdlflags='$cccdlflags'
19744 ccdlflags='$ccdlflags'
19745 ccflags='$ccflags'
19746 ccflags_uselargefiles='$ccflags_uselargefiles'
19747 ccname='$ccname'
19748 ccsymbols='$ccsymbols'
19749 ccversion='$ccversion'
19750 cf_by='$cf_by'
19751 cf_email='$cf_email'
19752 cf_time='$cf_time'
19753 charsize='$charsize'
19754 chgrp='$chgrp'
19755 chmod='$chmod'
19756 chown='$chown'
19757 clocktype='$clocktype'
19758 comm='$comm'
19759 compress='$compress'
19760 contains='$contains'
19761 cp='$cp'
19762 cpio='$cpio'
19763 cpp='$cpp'
19764 cpp_stuff='$cpp_stuff'
19765 cppccsymbols='$cppccsymbols'
19766 cppflags='$cppflags'
19767 cpplast='$cpplast'
19768 cppminus='$cppminus'
19769 cpprun='$cpprun'
19770 cppstdin='$cppstdin'
19771 cppsymbols='$cppsymbols'
19772 crypt_r_proto='$crypt_r_proto'
19773 cryptlib='$cryptlib'
19774 csh='$csh'
19775 ctermid_r_proto='$ctermid_r_proto'
19776 ctime_r_proto='$ctime_r_proto'
19777 d_Gconvert='$d_Gconvert'
19778 d_PRIEUldbl='$d_PRIEUldbl'
19779 d_PRIFUldbl='$d_PRIFUldbl'
19780 d_PRIGUldbl='$d_PRIGUldbl'
19781 d_PRIXU64='$d_PRIXU64'
19782 d_PRId64='$d_PRId64'
19783 d_PRIeldbl='$d_PRIeldbl'
19784 d_PRIfldbl='$d_PRIfldbl'
19785 d_PRIgldbl='$d_PRIgldbl'
19786 d_PRIi64='$d_PRIi64'
19787 d_PRIo64='$d_PRIo64'
19788 d_PRIu64='$d_PRIu64'
19789 d_PRIx64='$d_PRIx64'
19790 d_SCNfldbl='$d_SCNfldbl'
19791 d__fwalk='$d__fwalk'
19792 d_access='$d_access'
19793 d_accessx='$d_accessx'
19794 d_alarm='$d_alarm'
19795 d_archlib='$d_archlib'
19796 d_asctime_r='$d_asctime_r'
19797 d_atolf='$d_atolf'
19798 d_atoll='$d_atoll'
19799 d_attribut='$d_attribut'
19800 d_bcmp='$d_bcmp'
19801 d_bcopy='$d_bcopy'
19802 d_bsd='$d_bsd'
19803 d_bsdgetpgrp='$d_bsdgetpgrp'
19804 d_bsdsetpgrp='$d_bsdsetpgrp'
19805 d_bzero='$d_bzero'
19806 d_casti32='$d_casti32'
19807 d_castneg='$d_castneg'
19808 d_charvspr='$d_charvspr'
19809 d_chown='$d_chown'
19810 d_chroot='$d_chroot'
19811 d_chsize='$d_chsize'
19812 d_class='$d_class'
19813 d_closedir='$d_closedir'
19814 d_cmsghdr_s='$d_cmsghdr_s'
19815 d_const='$d_const'
19816 d_crypt='$d_crypt'
19817 d_crypt_r='$d_crypt_r'
19818 d_csh='$d_csh'
19819 d_ctermid_r='$d_ctermid_r'
19820 d_ctime_r='$d_ctime_r'
19821 d_cuserid='$d_cuserid'
19822 d_dbl_dig='$d_dbl_dig'
19823 d_dbminitproto='$d_dbminitproto'
19824 d_difftime='$d_difftime'
19825 d_dirfd='$d_dirfd'
19826 d_dirnamlen='$d_dirnamlen'
19827 d_dlerror='$d_dlerror'
19828 d_dlopen='$d_dlopen'
19829 d_dlsymun='$d_dlsymun'
19830 d_dosuid='$d_dosuid'
19831 d_drand48_r='$d_drand48_r'
19832 d_drand48proto='$d_drand48proto'
19833 d_dup2='$d_dup2'
19834 d_eaccess='$d_eaccess'
19835 d_endgrent='$d_endgrent'
19836 d_endgrent_r='$d_endgrent_r'
19837 d_endhent='$d_endhent'
19838 d_endhostent_r='$d_endhostent_r'
19839 d_endnent='$d_endnent'
19840 d_endnetent_r='$d_endnetent_r'
19841 d_endpent='$d_endpent'
19842 d_endprotoent_r='$d_endprotoent_r'
19843 d_endpwent='$d_endpwent'
19844 d_endpwent_r='$d_endpwent_r'
19845 d_endsent='$d_endsent'
19846 d_endservent_r='$d_endservent_r'
19847 d_eofnblk='$d_eofnblk'
19848 d_eunice='$d_eunice'
19849 d_fchdir='$d_fchdir'
19850 d_fchmod='$d_fchmod'
19851 d_fchown='$d_fchown'
19852 d_fcntl='$d_fcntl'
19853 d_fcntl_can_lock='$d_fcntl_can_lock'
19854 d_fd_macros='$d_fd_macros'
19855 d_fd_set='$d_fd_set'
19856 d_fds_bits='$d_fds_bits'
19857 d_fgetpos='$d_fgetpos'
19858 d_finite='$d_finite'
19859 d_finitel='$d_finitel'
19860 d_flexfnam='$d_flexfnam'
19861 d_flock='$d_flock'
19862 d_flockproto='$d_flockproto'
19863 d_fork='$d_fork'
19864 d_fp_class='$d_fp_class'
19865 d_fpathconf='$d_fpathconf'
19866 d_fpclass='$d_fpclass'
19867 d_fpclassify='$d_fpclassify'
19868 d_fpclassl='$d_fpclassl'
19869 d_fpos64_t='$d_fpos64_t'
19870 d_frexpl='$d_frexpl'
19871 d_fs_data_s='$d_fs_data_s'
19872 d_fseeko='$d_fseeko'
19873 d_fsetpos='$d_fsetpos'
19874 d_fstatfs='$d_fstatfs'
19875 d_fstatvfs='$d_fstatvfs'
19876 d_fsync='$d_fsync'
19877 d_ftello='$d_ftello'
19878 d_ftime='$d_ftime'
19879 d_getcwd='$d_getcwd'
19880 d_getespwnam='$d_getespwnam'
19881 d_getfsstat='$d_getfsstat'
19882 d_getgrent='$d_getgrent'
19883 d_getgrent_r='$d_getgrent_r'
19884 d_getgrgid_r='$d_getgrgid_r'
19885 d_getgrnam_r='$d_getgrnam_r'
19886 d_getgrps='$d_getgrps'
19887 d_gethbyaddr='$d_gethbyaddr'
19888 d_gethbyname='$d_gethbyname'
19889 d_gethent='$d_gethent'
19890 d_gethname='$d_gethname'
19891 d_gethostbyaddr_r='$d_gethostbyaddr_r'
19892 d_gethostbyname_r='$d_gethostbyname_r'
19893 d_gethostent_r='$d_gethostent_r'
19894 d_gethostprotos='$d_gethostprotos'
19895 d_getitimer='$d_getitimer'
19896 d_getlogin='$d_getlogin'
19897 d_getlogin_r='$d_getlogin_r'
19898 d_getmnt='$d_getmnt'
19899 d_getmntent='$d_getmntent'
19900 d_getnbyaddr='$d_getnbyaddr'
19901 d_getnbyname='$d_getnbyname'
19902 d_getnent='$d_getnent'
19903 d_getnetbyaddr_r='$d_getnetbyaddr_r'
19904 d_getnetbyname_r='$d_getnetbyname_r'
19905 d_getnetent_r='$d_getnetent_r'
19906 d_getnetprotos='$d_getnetprotos'
19907 d_getpagsz='$d_getpagsz'
19908 d_getpbyname='$d_getpbyname'
19909 d_getpbynumber='$d_getpbynumber'
19910 d_getpent='$d_getpent'
19911 d_getpgid='$d_getpgid'
19912 d_getpgrp2='$d_getpgrp2'
19913 d_getpgrp='$d_getpgrp'
19914 d_getppid='$d_getppid'
19915 d_getprior='$d_getprior'
19916 d_getprotobyname_r='$d_getprotobyname_r'
19917 d_getprotobynumber_r='$d_getprotobynumber_r'
19918 d_getprotoent_r='$d_getprotoent_r'
19919 d_getprotoprotos='$d_getprotoprotos'
19920 d_getprpwnam='$d_getprpwnam'
19921 d_getpwent='$d_getpwent'
19922 d_getpwent_r='$d_getpwent_r'
19923 d_getpwnam_r='$d_getpwnam_r'
19924 d_getpwuid_r='$d_getpwuid_r'
19925 d_getsbyname='$d_getsbyname'
19926 d_getsbyport='$d_getsbyport'
19927 d_getsent='$d_getsent'
19928 d_getservbyname_r='$d_getservbyname_r'
19929 d_getservbyport_r='$d_getservbyport_r'
19930 d_getservent_r='$d_getservent_r'
19931 d_getservprotos='$d_getservprotos'
19932 d_getspnam='$d_getspnam'
19933 d_getspnam_r='$d_getspnam_r'
19934 d_gettimeod='$d_gettimeod'
19935 d_gmtime_r='$d_gmtime_r'
19936 d_gnulibc='$d_gnulibc'
19937 d_grpasswd='$d_grpasswd'
19938 d_hasmntopt='$d_hasmntopt'
19939 d_htonl='$d_htonl'
19940 d_index='$d_index'
19941 d_inetaton='$d_inetaton'
19942 d_int64_t='$d_int64_t'
19943 d_isascii='$d_isascii'
19944 d_isfinite='$d_isfinite'
19945 d_isinf='$d_isinf'
19946 d_isnan='$d_isnan'
19947 d_isnanl='$d_isnanl'
19948 d_killpg='$d_killpg'
19949 d_lchown='$d_lchown'
19950 d_ldbl_dig='$d_ldbl_dig'
19951 d_link='$d_link'
19952 d_localtime_r='$d_localtime_r'
19953 d_locconv='$d_locconv'
19954 d_lockf='$d_lockf'
19955 d_longdbl='$d_longdbl'
19956 d_longlong='$d_longlong'
19957 d_lseekproto='$d_lseekproto'
19958 d_lstat='$d_lstat'
19959 d_madvise='$d_madvise'
19960 d_mblen='$d_mblen'
19961 d_mbstowcs='$d_mbstowcs'
19962 d_mbtowc='$d_mbtowc'
19963 d_memchr='$d_memchr'
19964 d_memcmp='$d_memcmp'
19965 d_memcpy='$d_memcpy'
19966 d_memmove='$d_memmove'
19967 d_memset='$d_memset'
19968 d_mkdir='$d_mkdir'
19969 d_mkdtemp='$d_mkdtemp'
19970 d_mkfifo='$d_mkfifo'
19971 d_mkstemp='$d_mkstemp'
19972 d_mkstemps='$d_mkstemps'
19973 d_mktime='$d_mktime'
19974 d_mmap='$d_mmap'
19975 d_modfl='$d_modfl'
19976 d_modfl_pow32_bug='$d_modfl_pow32_bug'
19977 d_modflproto='$d_modflproto'
19978 d_mprotect='$d_mprotect'
19979 d_msg='$d_msg'
19980 d_msg_ctrunc='$d_msg_ctrunc'
19981 d_msg_dontroute='$d_msg_dontroute'
19982 d_msg_oob='$d_msg_oob'
19983 d_msg_peek='$d_msg_peek'
19984 d_msg_proxy='$d_msg_proxy'
19985 d_msgctl='$d_msgctl'
19986 d_msgget='$d_msgget'
19987 d_msghdr_s='$d_msghdr_s'
19988 d_msgrcv='$d_msgrcv'
19989 d_msgsnd='$d_msgsnd'
19990 d_msync='$d_msync'
19991 d_munmap='$d_munmap'
19992 d_mymalloc='$d_mymalloc'
19993 d_nanosleep='$d_nanosleep'
19994 d_nice='$d_nice'
19995 d_nl_langinfo='$d_nl_langinfo'
19996 d_nv_preserves_uv='$d_nv_preserves_uv'
19997 d_off64_t='$d_off64_t'
19998 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
19999 d_oldpthreads='$d_oldpthreads'
20000 d_oldsock='$d_oldsock'
20001 d_open3='$d_open3'
20002 d_pathconf='$d_pathconf'
20003 d_pause='$d_pause'
20004 d_perl_otherlibdirs='$d_perl_otherlibdirs'
20005 d_phostname='$d_phostname'
20006 d_pipe='$d_pipe'
20007 d_poll='$d_poll'
20008 d_portable='$d_portable'
20009 d_procselfexe='$d_procselfexe'
20010 d_pthread_atfork='$d_pthread_atfork'
20011 d_pthread_yield='$d_pthread_yield'
20012 d_pwage='$d_pwage'
20013 d_pwchange='$d_pwchange'
20014 d_pwclass='$d_pwclass'
20015 d_pwcomment='$d_pwcomment'
20016 d_pwexpire='$d_pwexpire'
20017 d_pwgecos='$d_pwgecos'
20018 d_pwpasswd='$d_pwpasswd'
20019 d_pwquota='$d_pwquota'
20020 d_qgcvt='$d_qgcvt'
20021 d_quad='$d_quad'
20022 d_random_r='$d_random_r'
20023 d_readdir64_r='$d_readdir64_r'
20024 d_readdir='$d_readdir'
20025 d_readdir_r='$d_readdir_r'
20026 d_readlink='$d_readlink'
20027 d_readv='$d_readv'
20028 d_recvmsg='$d_recvmsg'
20029 d_rename='$d_rename'
20030 d_rewinddir='$d_rewinddir'
20031 d_rmdir='$d_rmdir'
20032 d_safebcpy='$d_safebcpy'
20033 d_safemcpy='$d_safemcpy'
20034 d_sanemcmp='$d_sanemcmp'
20035 d_sbrkproto='$d_sbrkproto'
20036 d_sched_yield='$d_sched_yield'
20037 d_scm_rights='$d_scm_rights'
20038 d_seekdir='$d_seekdir'
20039 d_select='$d_select'
20040 d_sem='$d_sem'
20041 d_semctl='$d_semctl'
20042 d_semctl_semid_ds='$d_semctl_semid_ds'
20043 d_semctl_semun='$d_semctl_semun'
20044 d_semget='$d_semget'
20045 d_semop='$d_semop'
20046 d_sendmsg='$d_sendmsg'
20047 d_setegid='$d_setegid'
20048 d_seteuid='$d_seteuid'
20049 d_setgrent='$d_setgrent'
20050 d_setgrent_r='$d_setgrent_r'
20051 d_setgrps='$d_setgrps'
20052 d_sethent='$d_sethent'
20053 d_sethostent_r='$d_sethostent_r'
20054 d_setitimer='$d_setitimer'
20055 d_setlinebuf='$d_setlinebuf'
20056 d_setlocale='$d_setlocale'
20057 d_setlocale_r='$d_setlocale_r'
20058 d_setnent='$d_setnent'
20059 d_setnetent_r='$d_setnetent_r'
20060 d_setpent='$d_setpent'
20061 d_setpgid='$d_setpgid'
20062 d_setpgrp2='$d_setpgrp2'
20063 d_setpgrp='$d_setpgrp'
20064 d_setprior='$d_setprior'
20065 d_setproctitle='$d_setproctitle'
20066 d_setprotoent_r='$d_setprotoent_r'
20067 d_setpwent='$d_setpwent'
20068 d_setpwent_r='$d_setpwent_r'
20069 d_setregid='$d_setregid'
20070 d_setresgid='$d_setresgid'
20071 d_setresuid='$d_setresuid'
20072 d_setreuid='$d_setreuid'
20073 d_setrgid='$d_setrgid'
20074 d_setruid='$d_setruid'
20075 d_setsent='$d_setsent'
20076 d_setservent_r='$d_setservent_r'
20077 d_setsid='$d_setsid'
20078 d_setvbuf='$d_setvbuf'
20079 d_sfio='$d_sfio'
20080 d_shm='$d_shm'
20081 d_shmat='$d_shmat'
20082 d_shmatprototype='$d_shmatprototype'
20083 d_shmctl='$d_shmctl'
20084 d_shmdt='$d_shmdt'
20085 d_shmget='$d_shmget'
20086 d_sigaction='$d_sigaction'
20087 d_sigprocmask='$d_sigprocmask'
20088 d_sigsetjmp='$d_sigsetjmp'
20089 d_sockatmark='$d_sockatmark'
20090 d_sockatmarkproto='$d_sockatmarkproto'
20091 d_socket='$d_socket'
20092 d_socklen_t='$d_socklen_t'
20093 d_sockpair='$d_sockpair'
20094 d_socks5_init='$d_socks5_init'
20095 d_sqrtl='$d_sqrtl'
20096 d_srand48_r='$d_srand48_r'
20097 d_srandom_r='$d_srandom_r'
20098 d_sresgproto='$d_sresgproto'
20099 d_sresuproto='$d_sresuproto'
20100 d_statblks='$d_statblks'
20101 d_statfs_f_flags='$d_statfs_f_flags'
20102 d_statfs_s='$d_statfs_s'
20103 d_statvfs='$d_statvfs'
20104 d_stdio_cnt_lval='$d_stdio_cnt_lval'
20105 d_stdio_ptr_lval='$d_stdio_ptr_lval'
20106 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
20107 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
20108 d_stdio_stream_array='$d_stdio_stream_array'
20109 d_stdiobase='$d_stdiobase'
20110 d_stdstdio='$d_stdstdio'
20111 d_strchr='$d_strchr'
20112 d_strcoll='$d_strcoll'
20113 d_strctcpy='$d_strctcpy'
20114 d_strerrm='$d_strerrm'
20115 d_strerror='$d_strerror'
20116 d_strerror_r='$d_strerror_r'
20117 d_strftime='$d_strftime'
20118 d_strtod='$d_strtod'
20119 d_strtol='$d_strtol'
20120 d_strtold='$d_strtold'
20121 d_strtoll='$d_strtoll'
20122 d_strtoq='$d_strtoq'
20123 d_strtoul='$d_strtoul'
20124 d_strtoull='$d_strtoull'
20125 d_strtouq='$d_strtouq'
20126 d_strxfrm='$d_strxfrm'
20127 d_suidsafe='$d_suidsafe'
20128 d_symlink='$d_symlink'
20129 d_syscall='$d_syscall'
20130 d_syscallproto='$d_syscallproto'
20131 d_sysconf='$d_sysconf'
20132 d_sysernlst='$d_sysernlst'
20133 d_syserrlst='$d_syserrlst'
20134 d_system='$d_system'
20135 d_tcgetpgrp='$d_tcgetpgrp'
20136 d_tcsetpgrp='$d_tcsetpgrp'
20137 d_telldir='$d_telldir'
20138 d_telldirproto='$d_telldirproto'
20139 d_time='$d_time'
20140 d_times='$d_times'
20141 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
20142 d_tm_tm_zone='$d_tm_tm_zone'
20143 d_tmpnam_r='$d_tmpnam_r'
20144 d_truncate='$d_truncate'
20145 d_ttyname_r='$d_ttyname_r'
20146 d_tzname='$d_tzname'
20147 d_u32align='$d_u32align'
20148 d_ualarm='$d_ualarm'
20149 d_umask='$d_umask'
20150 d_uname='$d_uname'
20151 d_union_semun='$d_union_semun'
20152 d_unordered='$d_unordered'
20153 d_usleep='$d_usleep'
20154 d_usleepproto='$d_usleepproto'
20155 d_ustat='$d_ustat'
20156 d_vendorarch='$d_vendorarch'
20157 d_vendorbin='$d_vendorbin'
20158 d_vendorlib='$d_vendorlib'
20159 d_vfork='$d_vfork'
20160 d_void_closedir='$d_void_closedir'
20161 d_voidsig='$d_voidsig'
20162 d_voidtty='$d_voidtty'
20163 d_volatile='$d_volatile'
20164 d_vprintf='$d_vprintf'
20165 d_wait4='$d_wait4'
20166 d_waitpid='$d_waitpid'
20167 d_wcstombs='$d_wcstombs'
20168 d_wctomb='$d_wctomb'
20169 d_writev='$d_writev'
20170 d_xenix='$d_xenix'
20171 date='$date'
20172 db_hashtype='$db_hashtype'
20173 db_prefixtype='$db_prefixtype'
20174 db_version_major='$db_version_major'
20175 db_version_minor='$db_version_minor'
20176 db_version_patch='$db_version_patch'
20177 defvoidused='$defvoidused'
20178 direntrytype='$direntrytype'
20179 dlext='$dlext'
20180 dlsrc='$dlsrc'
20181 doublesize='$doublesize'
20182 drand01='$drand01'
20183 drand48_r_proto='$drand48_r_proto'
20184 dynamic_ext='$dynamic_ext'
20185 eagain='$eagain'
20186 ebcdic='$ebcdic'
20187 echo='$echo'
20188 egrep='$egrep'
20189 emacs='$emacs'
20190 endgrent_r_proto='$endgrent_r_proto'
20191 endhostent_r_proto='$endhostent_r_proto'
20192 endnetent_r_proto='$endnetent_r_proto'
20193 endprotoent_r_proto='$endprotoent_r_proto'
20194 endpwent_r_proto='$endpwent_r_proto'
20195 endservent_r_proto='$endservent_r_proto'
20196 eunicefix='$eunicefix'
20197 exe_ext='$exe_ext'
20198 expr='$expr'
20199 extensions='$extensions'
20200 extras='$extras'
20201 fflushNULL='$fflushNULL'
20202 fflushall='$fflushall'
20203 find='$find'
20204 firstmakefile='$firstmakefile'
20205 flex='$flex'
20206 fpossize='$fpossize'
20207 fpostype='$fpostype'
20208 freetype='$freetype'
20209 from='$from'
20210 full_ar='$full_ar'
20211 full_csh='$full_csh'
20212 full_sed='$full_sed'
20213 gccansipedantic='$gccansipedantic'
20214 gccosandvers='$gccosandvers'
20215 gccversion='$gccversion'
20216 getgrent_r_proto='$getgrent_r_proto'
20217 getgrgid_r_proto='$getgrgid_r_proto'
20218 getgrnam_r_proto='$getgrnam_r_proto'
20219 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
20220 gethostbyname_r_proto='$gethostbyname_r_proto'
20221 gethostent_r_proto='$gethostent_r_proto'
20222 getlogin_r_proto='$getlogin_r_proto'
20223 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
20224 getnetbyname_r_proto='$getnetbyname_r_proto'
20225 getnetent_r_proto='$getnetent_r_proto'
20226 getprotobyname_r_proto='$getprotobyname_r_proto'
20227 getprotobynumber_r_proto='$getprotobynumber_r_proto'
20228 getprotoent_r_proto='$getprotoent_r_proto'
20229 getpwent_r_proto='$getpwent_r_proto'
20230 getpwnam_r_proto='$getpwnam_r_proto'
20231 getpwuid_r_proto='$getpwuid_r_proto'
20232 getservbyname_r_proto='$getservbyname_r_proto'
20233 getservbyport_r_proto='$getservbyport_r_proto'
20234 getservent_r_proto='$getservent_r_proto'
20235 getspnam_r_proto='$getspnam_r_proto'
20236 gidformat='$gidformat'
20237 gidsign='$gidsign'
20238 gidsize='$gidsize'
20239 gidtype='$gidtype'
20240 glibpth='$glibpth'
20241 gmake='$gmake'
20242 gmtime_r_proto='$gmtime_r_proto'
20243 gnulibc_version='$gnulibc_version'
20244 grep='$grep'
20245 groupcat='$groupcat'
20246 groupstype='$groupstype'
20247 gzip='$gzip'
20248 h_fcntl='$h_fcntl'
20249 h_sysfile='$h_sysfile'
20250 hint='$hint'
20251 hostcat='$hostcat'
20252 i16size='$i16size'
20253 i16type='$i16type'
20254 i32size='$i32size'
20255 i32type='$i32type'
20256 i64size='$i64size'
20257 i64type='$i64type'
20258 i8size='$i8size'
20259 i8type='$i8type'
20260 i_arpainet='$i_arpainet'
20261 i_bsdioctl='$i_bsdioctl'
20262 i_crypt='$i_crypt'
20263 i_db='$i_db'
20264 i_dbm='$i_dbm'
20265 i_dirent='$i_dirent'
20266 i_dld='$i_dld'
20267 i_dlfcn='$i_dlfcn'
20268 i_fcntl='$i_fcntl'
20269 i_float='$i_float'
20270 i_fp='$i_fp'
20271 i_fp_class='$i_fp_class'
20272 i_gdbm='$i_gdbm'
20273 i_grp='$i_grp'
20274 i_ieeefp='$i_ieeefp'
20275 i_inttypes='$i_inttypes'
20276 i_langinfo='$i_langinfo'
20277 i_libutil='$i_libutil'
20278 i_limits='$i_limits'
20279 i_locale='$i_locale'
20280 i_machcthr='$i_machcthr'
20281 i_malloc='$i_malloc'
20282 i_math='$i_math'
20283 i_memory='$i_memory'
20284 i_mntent='$i_mntent'
20285 i_ndbm='$i_ndbm'
20286 i_netdb='$i_netdb'
20287 i_neterrno='$i_neterrno'
20288 i_netinettcp='$i_netinettcp'
20289 i_niin='$i_niin'
20290 i_poll='$i_poll'
20291 i_prot='$i_prot'
20292 i_pthread='$i_pthread'
20293 i_pwd='$i_pwd'
20294 i_rpcsvcdbm='$i_rpcsvcdbm'
20295 i_sfio='$i_sfio'
20296 i_sgtty='$i_sgtty'
20297 i_shadow='$i_shadow'
20298 i_socks='$i_socks'
20299 i_stdarg='$i_stdarg'
20300 i_stddef='$i_stddef'
20301 i_stdlib='$i_stdlib'
20302 i_string='$i_string'
20303 i_sunmath='$i_sunmath'
20304 i_sysaccess='$i_sysaccess'
20305 i_sysdir='$i_sysdir'
20306 i_sysfile='$i_sysfile'
20307 i_sysfilio='$i_sysfilio'
20308 i_sysin='$i_sysin'
20309 i_sysioctl='$i_sysioctl'
20310 i_syslog='$i_syslog'
20311 i_sysmman='$i_sysmman'
20312 i_sysmode='$i_sysmode'
20313 i_sysmount='$i_sysmount'
20314 i_sysndir='$i_sysndir'
20315 i_sysparam='$i_sysparam'
20316 i_sysresrc='$i_sysresrc'
20317 i_syssecrt='$i_syssecrt'
20318 i_sysselct='$i_sysselct'
20319 i_syssockio='$i_syssockio'
20320 i_sysstat='$i_sysstat'
20321 i_sysstatfs='$i_sysstatfs'
20322 i_sysstatvfs='$i_sysstatvfs'
20323 i_systime='$i_systime'
20324 i_systimek='$i_systimek'
20325 i_systimes='$i_systimes'
20326 i_systypes='$i_systypes'
20327 i_sysuio='$i_sysuio'
20328 i_sysun='$i_sysun'
20329 i_sysutsname='$i_sysutsname'
20330 i_sysvfs='$i_sysvfs'
20331 i_syswait='$i_syswait'
20332 i_termio='$i_termio'
20333 i_termios='$i_termios'
20334 i_time='$i_time'
20335 i_unistd='$i_unistd'
20336 i_ustat='$i_ustat'
20337 i_utime='$i_utime'
20338 i_values='$i_values'
20339 i_varargs='$i_varargs'
20340 i_varhdr='$i_varhdr'
20341 i_vfork='$i_vfork'
20342 ignore_versioned_solibs='$ignore_versioned_solibs'
20343 inc_version_list='$inc_version_list'
20344 inc_version_list_init='$inc_version_list_init'
20345 incpath='$incpath'
20346 inews='$inews'
20347 installarchlib='$installarchlib'
20348 installbin='$installbin'
20349 installman1dir='$installman1dir'
20350 installman3dir='$installman3dir'
20351 installprefix='$installprefix'
20352 installprefixexp='$installprefixexp'
20353 installprivlib='$installprivlib'
20354 installscript='$installscript'
20355 installsitearch='$installsitearch'
20356 installsitebin='$installsitebin'
20357 installsitelib='$installsitelib'
20358 installstyle='$installstyle'
20359 installusrbinperl='$installusrbinperl'
20360 installvendorarch='$installvendorarch'
20361 installvendorbin='$installvendorbin'
20362 installvendorlib='$installvendorlib'
20363 intsize='$intsize'
20364 issymlink='$issymlink'
20365 ivdformat='$ivdformat'
20366 ivsize='$ivsize'
20367 ivtype='$ivtype'
20368 known_extensions='$known_extensions'
20369 ksh='$ksh'
20370 ld='$ld'
20371 lddlflags='$lddlflags'
20372 ldflags='$ldflags'
20373 ldflags_uselargefiles='$ldflags_uselargefiles'
20374 ldlibpthname='$ldlibpthname'
20375 less='$less'
20376 lib_ext='$lib_ext'
20377 libc='$libc'
20378 libperl='$libperl'
20379 libpth='$libpth'
20380 libs='$libs'
20381 libsdirs='$libsdirs'
20382 libsfiles='$libsfiles'
20383 libsfound='$libsfound'
20384 libspath='$libspath'
20385 libswanted='$libswanted'
20386 libswanted_uselargefiles='$libswanted_uselargefiles'
20387 line='$line'
20388 lint='$lint'
20389 lkflags='$lkflags'
20390 ln='$ln'
20391 lns='$lns'
20392 localtime_r_proto='$localtime_r_proto'
20393 locincpth='$locincpth'
20394 loclibpth='$loclibpth'
20395 longdblsize='$longdblsize'
20396 longlongsize='$longlongsize'
20397 longsize='$longsize'
20398 lp='$lp'
20399 lpr='$lpr'
20400 ls='$ls'
20401 lseeksize='$lseeksize'
20402 lseektype='$lseektype'
20403 mail='$mail'
20404 mailx='$mailx'
20405 make='$make'
20406 make_set_make='$make_set_make'
20407 mallocobj='$mallocobj'
20408 mallocsrc='$mallocsrc'
20409 malloctype='$malloctype'
20410 man1dir='$man1dir'
20411 man1direxp='$man1direxp'
20412 man1ext='$man1ext'
20413 man3dir='$man3dir'
20414 man3direxp='$man3direxp'
20415 man3ext='$man3ext'
20416 mips_type='$mips_type'
20417 mkdir='$mkdir'
20418 mmaptype='$mmaptype'
20419 modetype='$modetype'
20420 more='$more'
20421 multiarch='$multiarch'
20422 mv='$mv'
20423 myarchname='$myarchname'
20424 mydomain='$mydomain'
20425 myhostname='$myhostname'
20426 myuname='$myuname'
20427 n='$n'
20428 need_va_copy='$need_va_copy'
20429 netdb_hlen_type='$netdb_hlen_type'
20430 netdb_host_type='$netdb_host_type'
20431 netdb_name_type='$netdb_name_type'
20432 netdb_net_type='$netdb_net_type'
20433 nm='$nm'
20434 nm_opt='$nm_opt'
20435 nm_so_opt='$nm_so_opt'
20436 nonxs_ext='$nonxs_ext'
20437 nroff='$nroff'
20438 nvEUformat='$nvEUformat'
20439 nvFUformat='$nvFUformat'
20440 nvGUformat='$nvGUformat'
20441 nv_preserves_uv_bits='$nv_preserves_uv_bits'
20442 nveformat='$nveformat'
20443 nvfformat='$nvfformat'
20444 nvgformat='$nvgformat'
20445 nvsize='$nvsize'
20446 nvtype='$nvtype'
20447 o_nonblock='$o_nonblock'
20448 obj_ext='$obj_ext'
20449 old_pthread_create_joinable='$old_pthread_create_joinable'
20450 optimize='$optimize'
20451 orderlib='$orderlib'
20452 osname='$osname'
20453 osvers='$osvers'
20454 otherlibdirs='$otherlibdirs'
20455 package='$package'
20456 pager='$pager'
20457 passcat='$passcat'
20458 patchlevel='$patchlevel'
20459 path_sep='$path_sep'
20460 perl5='$perl5'
20461 perl='$perl'
20462 perl_patchlevel='$perl_patchlevel'
20463 perladmin='$perladmin'
20464 perllibs='$perllibs'
20465 perlpath='$perlpath'
20466 pg='$pg'
20467 phostname='$phostname'
20468 pidtype='$pidtype'
20469 plibpth='$plibpth'
20470 pm_apiversion='$pm_apiversion'
20471 pmake='$pmake'
20472 pr='$pr'
20473 prefix='$prefix'
20474 prefixexp='$prefixexp'
20475 privlib='$privlib'
20476 privlibexp='$privlibexp'
20477 procselfexe='$procselfexe'
20478 prototype='$prototype'
20479 ptrsize='$ptrsize'
20480 quadkind='$quadkind'
20481 quadtype='$quadtype'
20482 randbits='$randbits'
20483 randfunc='$randfunc'
20484 random_r_proto='$random_r_proto'
20485 randseedtype='$randseedtype'
20486 ranlib='$ranlib'
20487 rd_nodata='$rd_nodata'
20488 readdir64_r_proto='$readdir64_r_proto'
20489 readdir_r_proto='$readdir_r_proto'
20490 revision='$revision'
20491 rm='$rm'
20492 rmail='$rmail'
20493 run='$run'
20494 runnm='$runnm'
20495 sPRIEUldbl='$sPRIEUldbl'
20496 sPRIFUldbl='$sPRIFUldbl'
20497 sPRIGUldbl='$sPRIGUldbl'
20498 sPRIXU64='$sPRIXU64'
20499 sPRId64='$sPRId64'
20500 sPRIeldbl='$sPRIeldbl'
20501 sPRIfldbl='$sPRIfldbl'
20502 sPRIgldbl='$sPRIgldbl'
20503 sPRIi64='$sPRIi64'
20504 sPRIo64='$sPRIo64'
20505 sPRIu64='$sPRIu64'
20506 sPRIx64='$sPRIx64'
20507 sSCNfldbl='$sSCNfldbl'
20508 sched_yield='$sched_yield'
20509 scriptdir='$scriptdir'
20510 scriptdirexp='$scriptdirexp'
20511 sed='$sed'
20512 seedfunc='$seedfunc'
20513 selectminbits='$selectminbits'
20514 selecttype='$selecttype'
20515 sendmail='$sendmail'
20516 setgrent_r_proto='$setgrent_r_proto'
20517 sethostent_r_proto='$sethostent_r_proto'
20518 setlocale_r_proto='$setlocale_r_proto'
20519 setnetent_r_proto='$setnetent_r_proto'
20520 setprotoent_r_proto='$setprotoent_r_proto'
20521 setpwent_r_proto='$setpwent_r_proto'
20522 setservent_r_proto='$setservent_r_proto'
20523 sh='$sh'
20524 shar='$shar'
20525 sharpbang='$sharpbang'
20526 shmattype='$shmattype'
20527 shortsize='$shortsize'
20528 shrpenv='$shrpenv'
20529 shsharp='$shsharp'
20530 sig_count='$sig_count'
20531 sig_name='$sig_name'
20532 sig_name_init='$sig_name_init'
20533 sig_num='$sig_num'
20534 sig_num_init='$sig_num_init'
20535 sig_size='$sig_size'
20536 signal_t='$signal_t'
20537 sitearch='$sitearch'
20538 sitearchexp='$sitearchexp'
20539 sitebin='$sitebin'
20540 sitebinexp='$sitebinexp'
20541 sitelib='$sitelib'
20542 sitelib_stem='$sitelib_stem'
20543 sitelibexp='$sitelibexp'
20544 siteprefix='$siteprefix'
20545 siteprefixexp='$siteprefixexp'
20546 sizesize='$sizesize'
20547 sizetype='$sizetype'
20548 sleep='$sleep'
20549 smail='$smail'
20550 so='$so'
20551 sockethdr='$sockethdr'
20552 socketlib='$socketlib'
20553 socksizetype='$socksizetype'
20554 sort='$sort'
20555 spackage='$spackage'
20556 spitshell='$spitshell'
20557 srand48_r_proto='$srand48_r_proto'
20558 srandom_r_proto='$srandom_r_proto'
20559 src='$src'
20560 ssizetype='$ssizetype'
20561 startperl='$startperl'
20562 startsh='$startsh'
20563 static_ext='$static_ext'
20564 stdchar='$stdchar'
20565 stdio_base='$stdio_base'
20566 stdio_bufsiz='$stdio_bufsiz'
20567 stdio_cnt='$stdio_cnt'
20568 stdio_filbuf='$stdio_filbuf'
20569 stdio_ptr='$stdio_ptr'
20570 stdio_stream_array='$stdio_stream_array'
20571 strerror_r_proto='$strerror_r_proto'
20572 strings='$strings'
20573 submit='$submit'
20574 subversion='$subversion'
20575 sysman='$sysman'
20576 tail='$tail'
20577 tar='$tar'
20578 targetarch='$targetarch'
20579 tbl='$tbl'
20580 tee='$tee'
20581 test='$test'
20582 timeincl='$timeincl'
20583 timetype='$timetype'
20584 tmpnam_r_proto='$tmpnam_r_proto'
20585 to='$to'
20586 touch='$touch'
20587 tr='$tr'
20588 trnl='$trnl'
20589 troff='$troff'
20590 ttyname_r_proto='$ttyname_r_proto'
20591 u16size='$u16size'
20592 u16type='$u16type'
20593 u32size='$u32size'
20594 u32type='$u32type'
20595 u64size='$u64size'
20596 u64type='$u64type'
20597 u8size='$u8size'
20598 u8type='$u8type'
20599 uidformat='$uidformat'
20600 uidsign='$uidsign'
20601 uidsize='$uidsize'
20602 uidtype='$uidtype'
20603 uname='$uname'
20604 uniq='$uniq'
20605 uquadtype='$uquadtype'
20606 use5005threads='$use5005threads'
20607 use64bitall='$use64bitall'
20608 use64bitint='$use64bitint'
20609 usecrosscompile='$usecrosscompile'
20610 usedl='$usedl'
20611 useithreads='$useithreads'
20612 uselargefiles='$uselargefiles'
20613 uselongdouble='$uselongdouble'
20614 usemorebits='$usemorebits'
20615 usemultiplicity='$usemultiplicity'
20616 usemymalloc='$usemymalloc'
20617 usenm='$usenm'
20618 useopcode='$useopcode'
20619 useperlio='$useperlio'
20620 useposix='$useposix'
20621 usereentrant='$usereentrant'
20622 usesfio='$usesfio'
20623 useshrplib='$useshrplib'
20624 usesocks='$usesocks'
20625 usethreads='$usethreads'
20626 usevendorprefix='$usevendorprefix'
20627 usevfork='$usevfork'
20628 usrinc='$usrinc'
20629 uuname='$uuname'
20630 uvXUformat='$uvXUformat'
20631 uvoformat='$uvoformat'
20632 uvsize='$uvsize'
20633 uvtype='$uvtype'
20634 uvuformat='$uvuformat'
20635 uvxformat='$uvxformat'
20636 vendorarch='$vendorarch'
20637 vendorarchexp='$vendorarchexp'
20638 vendorbin='$vendorbin'
20639 vendorbinexp='$vendorbinexp'
20640 vendorlib='$vendorlib'
20641 vendorlib_stem='$vendorlib_stem'
20642 vendorlibexp='$vendorlibexp'
20643 vendorprefix='$vendorprefix'
20644 vendorprefixexp='$vendorprefixexp'
20645 version='$version'
20646 version_patchlevel_string='$version_patchlevel_string'
20647 versiononly='$versiononly'
20648 vi='$vi'
20649 voidflags='$voidflags'
20650 xlibpth='$xlibpth'
20651 xs_apiversion='$xs_apiversion'
20652 yacc='$yacc'
20653 yaccflags='$yaccflags'
20654 zcat='$zcat'
20655 zip='$zip'
20656 EOT
20657
20658 : Add in command line options if available
20659 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
20660
20661 : add special variables
20662 $test -f $src/patchlevel.h && \
20663 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
20664 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
20665 echo "PERL_CONFIG_SH=true" >>config.sh
20666
20667 : propagate old symbols
20668 if $test -f UU/config.sh; then
20669         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
20670         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
20671         $sort | $uniq -u >UU/oldsyms
20672         set X `cat UU/oldsyms`
20673         shift
20674         case $# in
20675         0) ;;
20676         *)
20677                 cat <<EOM
20678 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
20679 EOM
20680                 echo "# Variables propagated from previous config.sh file." >>config.sh
20681                 for sym in `cat UU/oldsyms`; do
20682                         echo "    Propagating $hint variable "'$'"$sym..."
20683                         eval 'tmp="$'"${sym}"'"'
20684                         echo "$tmp" | \
20685                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
20686                 done
20687                 ;;
20688         esac
20689 fi
20690
20691 : Finish up by extracting the .SH files
20692 case "$alldone" in
20693 exit)
20694         $rm -rf UU
20695         echo "Extraction done."
20696         exit 0
20697         ;;
20698 cont)
20699         ;;
20700 '')
20701         dflt=''
20702         nostick=true
20703         $cat <<EOM
20704
20705 If you'd like to make any changes to the config.sh file before I begin
20706 to configure things, do it as a shell escape now (e.g. !vi config.sh).
20707
20708 EOM
20709         rp="Press return or use a shell escape to edit config.sh:"
20710         . UU/myread
20711         nostick=''
20712         case "$ans" in
20713         '') ;;
20714         *) : in case they cannot read
20715                 sh 1>&4 -c "$ans";;
20716         esac
20717         ;;
20718 esac
20719
20720 : if this fails, just run all the .SH files by hand
20721 . ./config.sh
20722
20723 echo " "
20724 exec 1>&4
20725 pwd=`pwd`
20726 . ./UU/extract
20727 cd "$pwd"
20728
20729 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
20730         dflt=y
20731         case "$silent" in
20732         true) ;;
20733         *)
20734                 $cat <<EOM
20735
20736 Now you need to generate make dependencies by running "$make depend".
20737 You might prefer to run it in background: "$make depend > makedepend.out &"
20738 It can take a while, so you might not want to run it right now.
20739
20740 EOM
20741                 ;;
20742         esac
20743         rp="Run $make depend now?"
20744         . UU/myread
20745         case "$ans" in
20746         y*)
20747                 $make depend && echo "Now you must run '$make'."
20748                 ;;
20749         *)
20750                 echo "You must run '$make depend' then '$make'."
20751                 ;;
20752         esac
20753 elif test -f [Mm]akefile; then
20754         echo " "
20755         echo "Now you must run a $make."
20756 else
20757         echo "Configure done."
20758 fi
20759
20760 if $test -f Policy.sh; then
20761     $cat <<EOM
20762
20763 If you compile $package on a different machine or from a different object
20764 directory, copy the Policy.sh file from this object directory to the
20765 new one before you run Configure -- this will help you with most of
20766 the policy defaults.
20767
20768 EOM
20769 fi
20770 if $test -f config.msg; then
20771     echo "Hmm.  I also noted the following information while running:"
20772     echo " "
20773     $cat config.msg >&4
20774     $rm -f config.msg
20775 fi
20776 $rm -f kit*isdone ark*isdone
20777 $rm -rf UU
20778
20779 : End of Configure
20780