sv_2pv_flags and ROK and UTF8 flags
[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 Thu Aug  1 18:53:48 CEST 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_nice=''
552 d_nl_langinfo=''
553 d_off64_t=''
554 d_open3=''
555 d_fpathconf=''
556 d_pathconf=''
557 d_pause=''
558 d_pipe=''
559 d_poll=''
560 d_portable=''
561 d_procselfexe=''
562 procselfexe=''
563 d_old_pthread_create_joinable=''
564 old_pthread_create_joinable=''
565 d_pthread_atfork=''
566 d_pthread_yield=''
567 d_sched_yield=''
568 sched_yield=''
569 d_qgcvt=''
570 d_random_r=''
571 random_r_proto=''
572 d_readdir64_r=''
573 readdir64_r_proto=''
574 d_readdir=''
575 d_rewinddir=''
576 d_seekdir=''
577 d_telldir=''
578 d_readdir_r=''
579 readdir_r_proto=''
580 d_readlink=''
581 d_readv=''
582 d_recvmsg=''
583 d_rename=''
584 d_rmdir=''
585 d_safebcpy=''
586 d_safemcpy=''
587 d_sanemcmp=''
588 d_sbrkproto=''
589 d_select=''
590 d_sem=''
591 d_semctl=''
592 d_semget=''
593 d_semop=''
594 d_sendmsg=''
595 d_setegid=''
596 d_seteuid=''
597 d_setgrent=''
598 d_setgrent_r=''
599 setgrent_r_proto=''
600 d_setgrps=''
601 d_sethent=''
602 d_sethostent_r=''
603 sethostent_r_proto=''
604 d_setitimer=''
605 d_setlinebuf=''
606 d_setlocale=''
607 d_setlocale_r=''
608 setlocale_r_proto=''
609 d_setnent=''
610 d_setnetent_r=''
611 setnetent_r_proto=''
612 d_setpent=''
613 d_setpgid=''
614 d_setpgrp2=''
615 d_bsdsetpgrp=''
616 d_setpgrp=''
617 d_setprior=''
618 d_setproctitle=''
619 d_setprotoent_r=''
620 setprotoent_r_proto=''
621 d_setpwent=''
622 d_setpwent_r=''
623 setpwent_r_proto=''
624 d_setregid=''
625 d_setresgid=''
626 d_setresuid=''
627 d_setreuid=''
628 d_setrgid=''
629 d_setruid=''
630 d_setsent=''
631 d_setservent_r=''
632 setservent_r_proto=''
633 d_setsid=''
634 d_setvbuf=''
635 d_sfio=''
636 usesfio=''
637 d_shm=''
638 d_shmat=''
639 d_shmatprototype=''
640 shmattype=''
641 d_shmctl=''
642 d_shmdt=''
643 d_shmget=''
644 d_sigaction=''
645 d_sigprocmask=''
646 d_sigsetjmp=''
647 d_sockatmark=''
648 d_sockatmarkproto=''
649 d_msg_ctrunc=''
650 d_msg_dontroute=''
651 d_msg_oob=''
652 d_msg_peek=''
653 d_msg_proxy=''
654 d_oldsock=''
655 d_scm_rights=''
656 d_socket=''
657 d_sockpair=''
658 sockethdr=''
659 socketlib=''
660 d_socklen_t=''
661 d_socks5_init=''
662 d_sqrtl=''
663 d_srand48_r=''
664 srand48_r_proto=''
665 d_srandom_r=''
666 srandom_r_proto=''
667 d_sresgproto=''
668 d_sresuproto=''
669 d_statblks=''
670 d_statfs_f_flags=''
671 d_statfs_s=''
672 d_fstatvfs=''
673 d_statvfs=''
674 d_stdio_cnt_lval=''
675 d_stdio_ptr_lval=''
676 d_stdio_ptr_lval_nochange_cnt=''
677 d_stdio_ptr_lval_sets_cnt=''
678 d_stdiobase=''
679 d_stdstdio=''
680 stdio_base=''
681 stdio_bufsiz=''
682 stdio_cnt=''
683 stdio_filbuf=''
684 stdio_ptr=''
685 d_index=''
686 d_strchr=''
687 d_strcoll=''
688 d_strctcpy=''
689 d_strerrm=''
690 d_strerror=''
691 d_sysernlst=''
692 d_syserrlst=''
693 d_strerror_r=''
694 strerror_r_proto=''
695 d_strftime=''
696 d_strtod=''
697 d_strtol=''
698 d_strtold=''
699 d_strtoll=''
700 d_strtoq=''
701 d_strtoul=''
702 d_strtoull=''
703 d_strtouq=''
704 d_strxfrm=''
705 d_symlink=''
706 d_syscall=''
707 d_syscallproto=''
708 d_sysconf=''
709 d_system=''
710 d_tcgetpgrp=''
711 d_tcsetpgrp=''
712 d_telldirproto=''
713 d_time=''
714 timetype=''
715 clocktype=''
716 d_times=''
717 d_tmpnam_r=''
718 tmpnam_r_proto=''
719 d_truncate=''
720 d_ttyname_r=''
721 ttyname_r_proto=''
722 d_tzname=''
723 d_u32align=''
724 d_ualarm=''
725 d_umask=''
726 d_semctl_semid_ds=''
727 d_semctl_semun=''
728 d_union_semun=''
729 d_unordered=''
730 d_usleep=''
731 d_usleepproto=''
732 d_ustat=''
733 d_vfork=''
734 usevfork=''
735 d_voidsig=''
736 signal_t=''
737 d_volatile=''
738 d_charvspr=''
739 d_vprintf=''
740 d_wait4=''
741 d_waitpid=''
742 d_wcstombs=''
743 d_wctomb=''
744 d_writev=''
745 dlext=''
746 cccdlflags=''
747 ccdlflags=''
748 dlsrc=''
749 ld=''
750 lddlflags=''
751 usedl=''
752 doublesize=''
753 ebcdic=''
754 fflushNULL=''
755 fflushall=''
756 fpossize=''
757 fpostype=''
758 gccosandvers=''
759 gccversion=''
760 gidformat=''
761 gidsign=''
762 gidsize=''
763 gidtype=''
764 groupstype=''
765 h_fcntl=''
766 h_sysfile=''
767 i_arpainet=''
768 i_crypt=''
769 db_hashtype=''
770 db_prefixtype=''
771 db_version_major=''
772 db_version_minor=''
773 db_version_patch=''
774 i_db=''
775 i_dbm=''
776 i_rpcsvcdbm=''
777 d_dirnamlen=''
778 direntrytype=''
779 i_dirent=''
780 i_dld=''
781 i_dlfcn=''
782 i_fcntl=''
783 i_float=''
784 i_fp=''
785 i_fp_class=''
786 i_gdbm=''
787 d_grpasswd=''
788 i_grp=''
789 i_ieeefp=''
790 i_inttypes=''
791 i_langinfo=''
792 i_libutil=''
793 i_limits=''
794 i_locale=''
795 i_machcthr=''
796 i_malloc=''
797 i_math=''
798 i_memory=''
799 i_mntent=''
800 i_ndbm=''
801 i_netdb=''
802 i_neterrno=''
803 i_netinettcp=''
804 i_niin=''
805 i_sysin=''
806 i_poll=''
807 i_prot=''
808 i_pthread=''
809 d_pwage=''
810 d_pwchange=''
811 d_pwclass=''
812 d_pwcomment=''
813 d_pwexpire=''
814 d_pwgecos=''
815 d_pwpasswd=''
816 d_pwquota=''
817 i_pwd=''
818 i_sfio=''
819 i_shadow=''
820 i_socks=''
821 i_stddef=''
822 i_stdlib=''
823 i_string=''
824 strings=''
825 i_sunmath=''
826 i_sysaccess=''
827 i_sysdir=''
828 i_sysfile=''
829 d_voidtty=''
830 i_bsdioctl=''
831 i_sysfilio=''
832 i_sysioctl=''
833 i_syssockio=''
834 i_syslog=''
835 i_sysmman=''
836 i_sysmode=''
837 i_sysmount=''
838 i_sysndir=''
839 i_sysparam=''
840 i_sysresrc=''
841 i_syssecrt=''
842 i_sysselct=''
843 i_sysstat=''
844 i_sysstatfs=''
845 i_sysstatvfs=''
846 i_systimes=''
847 i_systypes=''
848 i_sysuio=''
849 i_sysun=''
850 i_sysutsname=''
851 i_sysvfs=''
852 i_syswait=''
853 i_sgtty=''
854 i_termio=''
855 i_termios=''
856 d_tm_tm_gmtoff=''
857 d_tm_tm_zone=''
858 i_systime=''
859 i_systimek=''
860 i_time=''
861 timeincl=''
862 i_unistd=''
863 i_ustat=''
864 i_utime=''
865 i_values=''
866 i_stdarg=''
867 i_varargs=''
868 i_varhdr=''
869 i_vfork=''
870 inc_version_list=''
871 inc_version_list_init=''
872 installprefix=''
873 installprefixexp=''
874 installstyle=''
875 installusrbinperl=''
876 intsize=''
877 longsize=''
878 shortsize=''
879 issymlink=''
880 libc=''
881 ldlibpthname=''
882 libperl=''
883 shrpenv=''
884 useshrplib=''
885 glibpth=''
886 libpth=''
887 loclibpth=''
888 plibpth=''
889 xlibpth=''
890 ignore_versioned_solibs=''
891 libs=''
892 libsdirs=''
893 libsfiles=''
894 libsfound=''
895 libspath=''
896 lns=''
897 d_PRIEUldbl=''
898 d_PRIFUldbl=''
899 d_PRIGUldbl=''
900 d_PRIeldbl=''
901 d_PRIfldbl=''
902 d_PRIgldbl=''
903 d_SCNfldbl=''
904 sPRIEUldbl=''
905 sPRIFUldbl=''
906 sPRIGUldbl=''
907 sPRIeldbl=''
908 sPRIfldbl=''
909 sPRIgldbl=''
910 sSCNfldbl=''
911 lseeksize=''
912 lseektype=''
913 make_set_make=''
914 d_mymalloc=''
915 freetype=''
916 mallocobj=''
917 mallocsrc=''
918 malloctype=''
919 usemymalloc=''
920 installman1dir=''
921 man1dir=''
922 man1direxp=''
923 man1ext=''
924 installman3dir=''
925 man3dir=''
926 man3direxp=''
927 man3ext=''
928 modetype=''
929 multiarch=''
930 mydomain=''
931 myhostname=''
932 phostname=''
933 c=''
934 n=''
935 d_eofnblk=''
936 eagain=''
937 o_nonblock=''
938 rd_nodata=''
939 need_va_copy=''
940 netdb_hlen_type=''
941 netdb_host_type=''
942 netdb_name_type=''
943 netdb_net_type=''
944 groupcat=''
945 hostcat=''
946 passcat=''
947 orderlib=''
948 ranlib=''
949 d_perl_otherlibdirs=''
950 otherlibdirs=''
951 package=''
952 spackage=''
953 pager=''
954 api_revision=''
955 api_subversion=''
956 api_version=''
957 api_versionstring=''
958 patchlevel=''
959 perl_patchlevel=''
960 revision=''
961 subversion=''
962 version=''
963 version_patchlevel_string=''
964 perl5=''
965 perladmin=''
966 perlpath=''
967 d_nv_preserves_uv=''
968 i16size=''
969 i16type=''
970 i32size=''
971 i32type=''
972 i64size=''
973 i64type=''
974 i8size=''
975 i8type=''
976 ivsize=''
977 ivtype=''
978 nv_preserves_uv_bits=''
979 nvsize=''
980 nvtype=''
981 u16size=''
982 u16type=''
983 u32size=''
984 u32type=''
985 u64size=''
986 u64type=''
987 u8size=''
988 u8type=''
989 uvsize=''
990 uvtype=''
991 ivdformat=''
992 nvEUformat=''
993 nvFUformat=''
994 nvGUformat=''
995 nveformat=''
996 nvfformat=''
997 nvgformat=''
998 uvXUformat=''
999 uvoformat=''
1000 uvuformat=''
1001 uvxformat=''
1002 pidtype=''
1003 prefix=''
1004 prefixexp=''
1005 installprivlib=''
1006 privlib=''
1007 privlibexp=''
1008 prototype=''
1009 ptrsize=''
1010 d_PRIXU64=''
1011 d_PRId64=''
1012 d_PRIi64=''
1013 d_PRIo64=''
1014 d_PRIu64=''
1015 d_PRIx64=''
1016 sPRIXU64=''
1017 sPRId64=''
1018 sPRIi64=''
1019 sPRIo64=''
1020 sPRIu64=''
1021 sPRIx64=''
1022 d_quad=''
1023 quadkind=''
1024 quadtype=''
1025 uquadtype=''
1026 drand01=''
1027 randbits=''
1028 randfunc=''
1029 randseedtype=''
1030 seedfunc=''
1031 installscript=''
1032 scriptdir=''
1033 scriptdirexp=''
1034 selectminbits=''
1035 selecttype=''
1036 sh=''
1037 sig_count=''
1038 sig_name=''
1039 sig_name_init=''
1040 sig_num=''
1041 sig_num_init=''
1042 sig_size=''
1043 installsitearch=''
1044 sitearch=''
1045 sitearchexp=''
1046 installsitebin=''
1047 sitebin=''
1048 sitebinexp=''
1049 installsitelib=''
1050 sitelib=''
1051 sitelib_stem=''
1052 sitelibexp=''
1053 siteprefix=''
1054 siteprefixexp=''
1055 sizesize=''
1056 sizetype=''
1057 so=''
1058 socksizetype=''
1059 sharpbang=''
1060 shsharp=''
1061 spitshell=''
1062 src=''
1063 ssizetype=''
1064 startperl=''
1065 startsh=''
1066 stdchar=''
1067 d_stdio_stream_array=''
1068 stdio_stream_array=''
1069 sysman=''
1070 trnl=''
1071 uidformat=''
1072 uidsign=''
1073 uidsize=''
1074 uidtype=''
1075 archname64=''
1076 use64bitall=''
1077 use64bitint=''
1078 ccflags_uselargefiles=''
1079 ldflags_uselargefiles=''
1080 libswanted_uselargefiles=''
1081 uselargefiles=''
1082 uselongdouble=''
1083 usemorebits=''
1084 usemultiplicity=''
1085 nm_opt=''
1086 nm_so_opt=''
1087 runnm=''
1088 usenm=''
1089 useperlio=''
1090 usesocks=''
1091 d_oldpthreads=''
1092 use5005threads=''
1093 useithreads=''
1094 usereentrant=''
1095 usethreads=''
1096 incpath=''
1097 mips_type=''
1098 usrinc=''
1099 d_vendorarch=''
1100 installvendorarch=''
1101 vendorarch=''
1102 vendorarchexp=''
1103 d_vendorbin=''
1104 installvendorbin=''
1105 vendorbin=''
1106 vendorbinexp=''
1107 d_vendorlib=''
1108 installvendorlib=''
1109 vendorlib=''
1110 vendorlib_stem=''
1111 vendorlibexp=''
1112 usevendorprefix=''
1113 vendorprefix=''
1114 vendorprefixexp=''
1115 versiononly=''
1116 defvoidused=''
1117 voidflags=''
1118 pm_apiversion=''
1119 xs_apiversion=''
1120 yacc=''
1121 yaccflags=''
1122 CONFIG=''
1123
1124 define='define'
1125 undef='undef'
1126 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1127 rmlist=''
1128
1129 : We must find out about Eunice early
1130 eunicefix=':'
1131 if test -f /etc/unixtovms; then
1132         eunicefix=/etc/unixtovms
1133 fi
1134 if test -f /etc/unixtovms.exe; then
1135         eunicefix=/etc/unixtovms.exe
1136 fi
1137
1138 : Set executable suffix now -- needed before hints available
1139 if test -f "/libs/version.library"; then
1140 : Amiga OS
1141     _exe=""
1142 elif test -f "/system/gnu_library/bin/ar.pm"; then
1143 : Stratus VOS
1144     _exe=".pm"
1145 elif test -n "$DJGPP"; then
1146 : DOS DJGPP
1147     _exe=".exe"
1148 elif test -d c:/. ; then
1149 : OS/2 or cygwin
1150     _exe=".exe"
1151 fi
1152
1153 i_whoami=''
1154 : Possible local include directories to search.
1155 : Set locincpth to "" in a hint file to defeat local include searches.
1156 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1157 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1158 :
1159 : no include file wanted by default
1160 inclwanted=''
1161
1162 : Trailing extension.  Override this in a hint file, if needed.
1163 : Extra object files, if any, needed on this platform.
1164 archobjs=''
1165 groupstype=''
1166 libnames=''
1167 : change the next line if compiling for Xenix/286 on Xenix/386
1168 xlibpth='/usr/lib/386 /lib/386'
1169 : Possible local library directories to search.
1170 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1171 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1172
1173 : general looking path for locating libraries
1174 glibpth="/lib /usr/lib $xlibpth"
1175 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1176 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1177 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1178
1179 : Private path used by Configure to find libraries.  Its value
1180 : is prepended to libpth. This variable takes care of special
1181 : machines, like the mips.  Usually, it should be empty.
1182 plibpth=''
1183
1184 : default library list
1185 libswanted=''
1186 : some systems want to use only the non-versioned libso:s
1187 ignore_versioned_solibs=''
1188 : full support for void wanted by default
1189 defvoidused=15
1190
1191 ccname=''
1192 ccversion=''
1193 perllibs=''
1194 : set useposix=false in your hint file to disable the POSIX extension.
1195 useposix=true
1196 : set useopcode=false in your hint file to disable the Opcode extension.
1197 useopcode=true
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 archname=''
1205 : set usethreads on the Configure command line to enable threads.
1206 usereentrant='undef'
1207 : List of libraries we want.
1208 : If anyone needs -lnet, put it in a hint file.
1209 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1210 libswanted="$libswanted dld ld sun m c cposix posix"
1211 libswanted="$libswanted ndir dir crypt sec"
1212 libswanted="$libswanted ucb bsd BSD PW x util"
1213 : We probably want to search /usr/shlib before most other libraries.
1214 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1215 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1216 glibpth="/usr/shlib $glibpth"
1217 : Do not use vfork unless overridden by a hint file.
1218 usevfork=false
1219
1220 : Find the basic shell for Bourne shell scripts
1221 case "$sh" in
1222 '')
1223         case "$SYSTYPE" in
1224         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1225         *) xxx='/bin/sh';;
1226         esac
1227         if test -f "$xxx"; then
1228                 sh="$xxx"
1229         else
1230                 : Build up a list and do a single loop so we can 'break' out.
1231                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1232                 for xxx in sh bash ksh pdksh ash; do
1233                         for p in $pth; do
1234                                 try="$try ${p}/${xxx}"
1235                         done
1236                 done
1237                 for xxx in $try; do
1238                         if test -f "$xxx"; then
1239                                 sh="$xxx";
1240                                 break
1241                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1242                                 sh="$xxx";
1243                                 break
1244                         elif test -f "$xxx.exe"; then
1245                                 sh="$xxx";
1246                                 break
1247                         fi
1248                 done
1249         fi
1250         ;;
1251 esac
1252
1253 case "$sh" in
1254 '')     cat >&2 <<EOM
1255 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1256
1257 Usually it's in /bin/sh.  How did you even get this far?
1258 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1259 we'll try to straighten this all out.
1260 EOM
1261         exit 1
1262         ;;
1263 esac
1264
1265 : see if sh knows # comments
1266 if `$sh -c '#' >/dev/null 2>&1`; then
1267         shsharp=true
1268         spitshell=cat
1269         xcat=/bin/cat
1270         test -f $xcat$_exe || xcat=/usr/bin/cat
1271         if test ! -f $xcat$_exe; then
1272                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1273                         if test -f $p/cat$_exe; then
1274                                 xcat=$p/cat
1275                                 break
1276                         fi
1277                 done
1278                 if test ! -f $xcat$_exe; then
1279                         echo "Can't find cat anywhere!"
1280                         exit 1
1281                 fi
1282         fi
1283         echo "#!$xcat" >sharp
1284         $eunicefix sharp
1285         chmod +x sharp
1286         ./sharp > today
1287         if test -s today; then
1288                 sharpbang='#!'
1289         else
1290                 echo "#! $xcat" > sharp
1291                 $eunicefix sharp
1292                 chmod +x sharp
1293                 ./sharp > today
1294                 if test -s today; then
1295                         sharpbang='#! '
1296                 else
1297                         sharpbang=': use '
1298                 fi
1299         fi
1300 else
1301         echo " "
1302         echo "Your $sh doesn't grok # comments--I will strip them later on."
1303         shsharp=false
1304         cd ..
1305         echo "exec grep -v '^[  ]*#'" >spitshell
1306         chmod +x spitshell
1307         $eunicefix spitshell
1308         spitshell=`pwd`/spitshell
1309         cd UU
1310         echo "I presume that if # doesn't work, #! won't work either!"
1311         sharpbang=': use '
1312 fi
1313 rm -f sharp today
1314
1315 : figure out how to guarantee sh startup
1316 case "$startsh" in
1317 '') startsh=${sharpbang}${sh} ;;
1318 *)
1319 esac
1320 cat >sharp <<EOSS
1321 $startsh
1322 set abc
1323 test "$?abc" != 1
1324 EOSS
1325
1326 chmod +x sharp
1327 $eunicefix sharp
1328 if ./sharp; then
1329         : echo "Yup, it does."
1330 else
1331         echo "Hmm... '$startsh' does not guarantee sh startup..."
1332         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1333 fi
1334 rm -f sharp
1335
1336
1337 : Save command line options in file UU/cmdline.opt for later use in
1338 : generating config.sh.
1339 cat > cmdline.opt <<EOSH
1340 # Configure command line arguments.
1341 config_arg0='$0'
1342 config_args='$*'
1343 config_argc=$#
1344 EOSH
1345 argn=1
1346 args_exp=''
1347 args_sep=''
1348 for arg in "$@"; do
1349         cat >>cmdline.opt <<EOSH
1350 config_arg$argn='$arg'
1351 EOSH
1352         # Extreme backslashitis: replace each ' by '"'"'
1353         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1354 $arg
1355 EOC
1356         arg_exp=`cat cmdl.opt`
1357         args_exp="$args_exp$args_sep'$arg_exp'"
1358         argn=`expr $argn + 1`
1359         args_sep=' '
1360 done
1361 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1362 # used by ./hints/os2.sh
1363 rm -f cmdl.opt
1364
1365 : produce awk script to parse command line options
1366 cat >options.awk <<'EOF'
1367 BEGIN {
1368         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1369
1370         len = length(optstr);
1371         for (i = 1; i <= len; i++) {
1372                 c = substr(optstr, i, 1);
1373                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1374                 if (a == ":") {
1375                         arg[c] = 1;
1376                         i++;
1377                 }
1378                 opt[c] = 1;
1379         }
1380 }
1381 {
1382         expect = 0;
1383         str = $0;
1384         if (substr(str, 1, 1) != "-") {
1385                 printf("'%s'\n", str);
1386                 next;
1387         }
1388         len = length($0);
1389         for (i = 2; i <= len; i++) {
1390                 c = substr(str, i, 1);
1391                 if (!opt[c]) {
1392                         printf("-%s\n", substr(str, i));
1393                         next;
1394                 }
1395                 printf("-%s\n", c);
1396                 if (arg[c]) {
1397                         if (i < len)
1398                                 printf("'%s'\n", substr(str, i + 1));
1399                         else
1400                                 expect = 1;
1401                         next;
1402                 }
1403         }
1404 }
1405 END {
1406         if (expect)
1407                 print "?";
1408 }
1409 EOF
1410
1411 : process the command line options
1412 set X `for arg in "$@"; do echo "X$arg"; done |
1413         sed -e s/X// | awk -f options.awk`
1414 eval "set $*"
1415 shift
1416 rm -f options.awk
1417
1418 : set up default values
1419 fastread=''
1420 reuseval=false
1421 config_sh=''
1422 alldone=''
1423 error=''
1424 silent=''
1425 extractsh=''
1426 override=''
1427 knowitall=''
1428 rm -f optdef.sh posthint.sh
1429 cat >optdef.sh <<EOS
1430 $startsh
1431 EOS
1432
1433
1434 : option parsing
1435 while test $# -gt 0; do
1436         case "$1" in
1437         -d) shift; fastread=yes;;
1438         -e) shift; alldone=cont;;
1439         -f)
1440                 shift
1441                 cd ..
1442                 if test -r "$1"; then
1443                         config_sh="$1"
1444                 else
1445                         echo "$me: cannot read config file $1." >&2
1446                         error=true
1447                 fi
1448                 cd UU
1449                 shift;;
1450         -h) shift; error=true;;
1451         -r) shift; reuseval=true;;
1452         -s) shift; silent=true; realsilent=true;;
1453         -E) shift; alldone=exit;;
1454         -K) shift; knowitall=true;;
1455         -O) shift; override=true;;
1456         -S) shift; silent=true; extractsh=true;;
1457         -D)
1458                 shift
1459                 case "$1" in
1460                 *=)
1461                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1462                         echo "$me: ignoring -D $1" >&2
1463                         ;;
1464                 *=*) echo "$1" | \
1465                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1466                 *) echo "$1='define'" >> optdef.sh;;
1467                 esac
1468                 shift
1469                 ;;
1470         -U)
1471                 shift
1472                 case "$1" in
1473                 *=) echo "$1" >> optdef.sh;;
1474                 *=*)
1475                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1476                         echo "$me: ignoring -U $1" >&2
1477                         ;;
1478                 *) echo "$1='undef'" >> optdef.sh;;
1479                 esac
1480                 shift
1481                 ;;
1482         -A)
1483             shift
1484             xxx=''
1485             yyy="$1"
1486             zzz=''
1487             uuu=undef
1488             case "$yyy" in
1489             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1490                  case "$zzz" in
1491                  *:*) zzz='' ;;
1492                  *)   xxx=append
1493                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1494                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1495                  esac
1496                  ;;
1497             esac
1498             case "$xxx" in
1499             '')  case "$yyy" in
1500                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1501                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1502                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1503                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1504                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1505                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1506                  esac
1507                  ;;       
1508             esac
1509             case "$xxx" in
1510             append)
1511                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1512             clear)
1513                 echo "$yyy=''"                  >> posthint.sh ;;
1514             define)
1515                 case "$zzz" in
1516                 '') zzz=define ;;
1517                 esac
1518                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1519             eval)
1520                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1521             prepend)
1522                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1523             undef)
1524                 case "$zzz" in
1525                 '') zzz="$uuu" ;;
1526                 esac
1527                 echo "$yyy=$zzz"                >> posthint.sh ;;
1528             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1529             esac
1530             shift
1531             ;;
1532         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1533             exit 0;;
1534         --) break;;
1535         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1536         *) break;;
1537         esac
1538 done
1539
1540 case "$error" in
1541 true)
1542         cat >&2 <<EOM
1543 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1544                  [-U symbol] [-U symbol=] [-A command:symbol...]
1545   -d : use defaults for all answers.
1546   -e : go on without questioning past the production of config.sh.
1547   -f : specify an alternate default configuration file.
1548   -h : print this help message and exit (with an error status).
1549   -r : reuse C symbols value if possible (skips costly nm extraction).
1550   -s : silent mode, only echoes questions and essential information.
1551   -D : define symbol to have some value:
1552          -D symbol         symbol gets the value 'define'
1553          -D symbol=value   symbol gets the value 'value'
1554   -E : stop at the end of questions, after having produced config.sh.
1555   -K : do not use unless you know what you are doing.
1556   -O : let -D and -U override definitions from loaded configuration file.
1557   -S : perform variable substitutions on all .SH files (can mix with -f)
1558   -U : undefine symbol:
1559          -U symbol    symbol gets the value 'undef'
1560          -U symbol=   symbol gets completely empty
1561   -A : manipulate symbol after the platform specific hints have been applied:
1562          -A symbol=value                append " "value to symbol
1563          -A append:symbol=value         append value to symbol
1564          -A define:symbol=value         define symbol to have value
1565          -A clear:symbol                define symbol to be ''
1566          -A define:symbol               define symbol to be 'define'
1567          -A eval:symbol=value           define symbol to be eval of value
1568          -A prepend:symbol=value        prepend value to symbol
1569          -A undef:symbol                define symbol to be 'undef'
1570          -A undef:symbol=               define symbol to be ''
1571   -V : print version number and exit (with a zero status).
1572 EOM
1573         exit 1
1574         ;;
1575 esac
1576
1577 : Sanity checks
1578 case "$fastread$alldone" in
1579 yescont|yesexit) ;;
1580 *)
1581         case "$extractsh" in
1582         true) ;;
1583         *)
1584                 if test ! -t 0; then
1585                         echo "Say 'sh Configure', not 'sh <Configure'"
1586                         exit 1
1587                 fi
1588                 ;;
1589         esac
1590         ;;
1591 esac
1592
1593 exec 4>&1
1594 case "$silent" in
1595 true) exec 1>/dev/null;;
1596 esac
1597
1598 : run the defines and the undefines, if any, but leave the file out there...
1599 touch optdef.sh
1600 . ./optdef.sh
1601 : create the posthint manipulation script and leave the file out there...
1602 touch posthint.sh
1603
1604 : set package name
1605 package=perl5
1606 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1607 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1608 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1609 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1610 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1611 esac
1612
1613 : Some greps do not return status, grrr.
1614 echo "grimblepritz" >grimble
1615 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1616         contains=contains
1617 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1618         contains=grep
1619 else
1620         contains=contains
1621 fi
1622 rm -f grimble
1623 : the following should work in any shell
1624 case "$contains" in
1625 contains*)
1626         echo " "
1627         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1628         cat >contains <<'EOSS'
1629 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1630 EOSS
1631 chmod +x contains
1632 esac
1633
1634 : Find the path to the source tree
1635 case "$src" in
1636 '') case "$0" in
1637     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1638          case "$src" in
1639          /*)    ;;
1640          .)     ;;
1641          *)     src=`cd ../$src && pwd` ;;
1642          esac
1643          ;;
1644     *)   src='.';;
1645     esac;;
1646 esac
1647 case "$src" in
1648 '')     src=/
1649         rsrc=/
1650         ;;
1651 /*) rsrc="$src";;
1652 *) rsrc="../$src";;
1653 esac
1654 if test -f $rsrc/Configure && \
1655         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1656 then
1657    : found it, so we are ok.
1658 else
1659         rsrc=''
1660         for src in . .. ../.. ../../.. ../../../..; do
1661                 if test -f ../$src/Configure && \
1662                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1663                 then
1664                         rsrc=../$src
1665                         break
1666                 fi
1667         done
1668 fi
1669 case "$rsrc" in
1670 '')
1671         cat <<EOM >&4
1672
1673 Sorry, I can't seem to locate the source dir for $package.  Please start
1674 Configure with an explicit path -- i.e. /some/path/Configure.
1675
1676 EOM
1677         exit 1
1678         ;;
1679 ../.)   rsrc='..';;
1680 *)
1681         echo " "
1682         echo "Sources for $package found in \"$src\"." >&4
1683         ;;
1684 esac
1685
1686 : script used to extract .SH files with variable substitutions
1687 cat >extract <<'EOS'
1688 PERL_CONFIG_SH=true
1689 echo "Doing variable substitutions on .SH files..."
1690 if test -f MANIFEST; then
1691         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1692 else
1693         echo "(Looking for .SH files under the source directory.)"
1694         set x `(cd "$src"; find . -name "*.SH" -print)`
1695 fi
1696 shift
1697 case $# in
1698 0) set x `(cd "$src"; echo *.SH)`; shift;;
1699 esac
1700 if test ! -f "$src/$1"; then
1701         shift
1702 fi
1703 mkdir_p='
1704 name=$1;
1705 create="";
1706 while test $name; do
1707         if test ! -d "$name"; then
1708                 create="$name $create";
1709                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1710                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1711         else
1712                 name="";
1713         fi;
1714 done;
1715 for file in $create; do
1716         mkdir $file;
1717 done
1718 '
1719 for file in $*; do
1720         case "$src" in
1721         ".")
1722                 case "$file" in
1723                 */*)
1724                         dir=`expr X$file : 'X\(.*\)/'`
1725                         file=`expr X$file : 'X.*/\(.*\)'`
1726                         (cd "$dir" && . ./$file)
1727                         ;;
1728                 *)
1729                         . ./$file
1730                         ;;
1731                 esac
1732                 ;;
1733         *)
1734                 case "$file" in
1735                 */*)
1736                         dir=`expr X$file : 'X\(.*\)/'`
1737                         file=`expr X$file : 'X.*/\(.*\)'`
1738                         (set x $dir; shift; eval $mkdir_p)
1739                         sh <"$src/$dir/$file"
1740                         ;;
1741                 *)
1742                         sh <"$src/$file"
1743                         ;;
1744                 esac
1745                 ;;
1746         esac
1747 done
1748 if test -f "$src/config_h.SH"; then
1749         if test ! -f config.h; then
1750         : oops, they left it out of MANIFEST, probably, so do it anyway.
1751         . "$src/config_h.SH"
1752         fi
1753 fi
1754 EOS
1755
1756 : extract files and exit if asked to do so
1757 case "$extractsh" in
1758 true)
1759         case "$realsilent" in
1760         true) ;;
1761         *) exec 1>&4;;
1762         esac
1763         case "$config_sh" in
1764         '') config_sh='config.sh';;
1765         esac
1766         echo " "
1767         echo "Fetching answers from $config_sh..."
1768         cd ..
1769         . $config_sh
1770         test "$override" && . ./optdef.sh
1771         echo " "
1772         . UU/extract
1773         rm -rf UU
1774         echo "Extraction done."
1775         exit 0
1776         ;;
1777 esac
1778
1779 : Eunice requires " " instead of "", can you believe it
1780 echo " "
1781 : Here we go...
1782 echo "Beginning of configuration questions for $package."
1783
1784 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1785
1786 : first determine how to suppress newline on echo command
1787 echo " "
1788 echo "Checking echo to see how to suppress newlines..."
1789 (echo "hi there\c" ; echo " ") >.echotmp
1790 if $contains c .echotmp >/dev/null 2>&1 ; then
1791         echo "...using -n."
1792         n='-n'
1793         c=''
1794 else
1795         cat <<'EOM'
1796 ...using \c
1797 EOM
1798         n=''
1799         c='\c'
1800 fi
1801 echo $n "The star should be here-->$c"
1802 echo '*'
1803 rm -f .echotmp
1804
1805 : Now test for existence of everything in MANIFEST
1806 echo " "
1807 if test -f "$rsrc/MANIFEST"; then
1808         echo "First let's make sure your kit is complete.  Checking..." >&4
1809         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1810         rm -f missing
1811         tmppwd=`pwd`
1812         for filelist in x??; do
1813                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1814         done
1815         if test -s missing; then
1816                 cat missing >&4
1817                 cat >&4 <<'EOM'
1818
1819 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1820
1821 You have the option of continuing the configuration process, despite the
1822 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1823 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1824 and contact the author (perlbug@perl.org).
1825
1826 EOM
1827                 echo $n "Continue? [n] $c" >&4
1828                 read ans
1829                 case "$ans" in
1830                 y*)
1831                         echo "Continuing..." >&4
1832                         rm -f missing
1833                         ;;
1834                 *)
1835                         echo "ABORTING..." >&4
1836                         kill $$
1837                         ;;
1838                 esac
1839         else
1840                 echo "Looks good..."
1841         fi
1842 else
1843         echo "There is no MANIFEST file.  I hope your kit is complete !"
1844 fi
1845 rm -f missing x??
1846
1847 echo " "
1848 : Find the appropriate value for a newline for tr
1849 if test -n "$DJGPP"; then
1850        trnl='\012'
1851 fi
1852 if test X"$trnl" = X; then
1853         case "`echo foo|tr '\n' x 2>/dev/null`" in
1854         foox) trnl='\n' ;;
1855         esac
1856 fi
1857 if test X"$trnl" = X; then
1858         case "`echo foo|tr '\012' x 2>/dev/null`" in
1859         foox) trnl='\012' ;;
1860         esac
1861 fi
1862 if test X"$trnl" = X; then
1863        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1864        fooxy) trnl='\n\r' ;;
1865        esac
1866 fi
1867 if test X"$trnl" = X; then
1868         cat <<EOM >&2
1869
1870 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1871
1872 EOM
1873         exit 1
1874 fi
1875
1876 : compute the number of columns on the terminal for proper question formatting
1877 case "$COLUMNS" in
1878 '') COLUMNS='80';;
1879 esac
1880
1881 : set up the echo used in my read
1882 myecho="case \"\$xxxm\" in
1883 '') echo $n \"\$rp $c\" >&4;;
1884 *) case \"\$rp\" in
1885         '') echo $n \"[\$xxxm] $c\";;
1886         *)
1887                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1888                         echo \"\$rp\" >&4
1889                         echo $n \"[\$xxxm] $c\" >&4
1890                 else
1891                         echo $n \"\$rp [\$xxxm] $c\" >&4
1892                 fi
1893                 ;;
1894         esac;;
1895 esac"
1896
1897 : now set up to do reads with possible shell escape and default assignment
1898 cat <<EOSC >myread
1899 $startsh
1900 xxxm=\$dflt
1901 $myecho
1902 ans='!'
1903 case "\$fastread" in
1904 yes) case "\$dflt" in
1905         '') ;;
1906         *) ans='';
1907                 case "\$silent-\$rp" in
1908                 true-) ;;
1909                 *) echo " " >&4;;
1910                 esac;;
1911         esac;;
1912 *) case "\$silent" in
1913         true) case "\$rp" in
1914                 '') ans='';;
1915                 esac;;
1916         esac;;
1917 esac
1918 while expr "X\$ans" : "X!" >/dev/null; do
1919         read answ
1920         set x \$xxxm
1921         shift
1922         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1923         case  "\$answ" in
1924         "!")
1925                 sh 1>&4
1926                 echo " "
1927                 $myecho
1928                 ;;
1929         !*)
1930                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1931                 shift
1932                 sh 1>&4 -c "\$*"
1933                 echo " "
1934                 $myecho
1935                 ;;
1936         "\$ans")
1937                 case "\$ans" in
1938                 \\&*)
1939                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1940                         shift
1941                         case "\$1" in
1942                         -d)
1943                                 fastread=yes
1944                                 echo "(OK, I'll run with -d after this question.)" >&4
1945                                 ;;
1946                         -*)
1947                                 echo "*** Sorry, \$1 not supported yet." >&4
1948                                 ;;
1949                         esac
1950                         $myecho
1951                         ans=!
1952                         ;;
1953                 esac;;
1954         *)
1955                 case "\$aok" in
1956                 y)
1957                         echo "*** Substitution done -- please confirm."
1958                         xxxm="\$ans"
1959                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1960                         xxxm="\$ans"
1961                         ans=!
1962                         ;;
1963                 *)
1964                         echo "*** Error -- try again."
1965                         ans=!
1966                         ;;
1967                 esac
1968                 $myecho
1969                 ;;
1970         esac
1971         case "\$ans\$xxxm\$nostick" in
1972         '')
1973                 ans=!
1974                 $myecho
1975                 ;;
1976         esac
1977 done
1978 case "\$ans" in
1979 '') ans="\$xxxm";;
1980 esac
1981 EOSC
1982
1983 : create .config dir to save info across Configure sessions
1984 test -d ../.config || mkdir ../.config
1985 cat >../.config/README <<EOF
1986 This directory created by Configure to save information that should
1987 persist across sessions for $package.
1988
1989 You may safely delete it if you wish.
1990 EOF
1991
1992 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1993 case "$usedevel" in
1994 $define|true|[yY]*) ;;
1995 *) case "$xversion" in
1996    *[13579])
1997         cat >&4 <<EOH
1998 *** WHOA THERE!!! ***
1999
2000     This is an UNSTABLE DEVELOPMENT release.
2001     The version of this $package distribution is $xversion, that is, odd,
2002     (as opposed to even) and that signifies a development release.
2003     If you want a maintenance release, you want an even-numbered version.
2004
2005     Do ***NOT*** install this into production use.
2006     Data corruption and crashes are possible.
2007
2008     It is most seriously suggested that you do not continue any further
2009     unless you want to help in developing and debugging Perl.
2010
2011     If you *still* want to build perl, you can answer 'y' now,
2012     or pass -Dusedevel to Configure.
2013
2014 EOH
2015         rp='Do you really want to continue?'
2016         dflt='n'
2017         . ./myread
2018         case "$ans" in
2019         [yY]) echo >&4 "Okay, continuing."
2020               usedevel="$define" ;;
2021         *) echo >&4 "Okay, bye."
2022            exit 1
2023            ;;
2024         esac
2025         ;;
2026     esac
2027     ;;
2028 esac
2029 case "$usedevel" in
2030 $define|true|[yY]*)
2031         case "$versiononly" in
2032         '') versiononly="$define" ;;
2033         esac
2034         case "$installusrbinperl" in
2035         '') installusrbinperl="$undef" ;;
2036         esac
2037         ;;
2038 esac
2039
2040 : general instructions
2041 needman=true
2042 firsttime=true
2043 user=`(logname) 2>/dev/null`
2044 case "$user" in
2045 '') user=`whoami 2>&1`;;
2046 esac
2047 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2048         firsttime=false
2049         echo " "
2050         rp='Would you like to see the instructions?'
2051         dflt=n
2052         . ./myread
2053         case "$ans" in
2054         [yY]*) ;;
2055         *) needman=false;;
2056         esac
2057 fi
2058 if $needman; then
2059         cat <<EOH
2060
2061 This installation shell script will examine your system and ask you questions
2062 to determine how the perl5 package should be installed. If you get
2063 stuck on a question, you may use a ! shell escape to start a subshell or
2064 execute a command.  Many of the questions will have default answers in square
2065 brackets; typing carriage return will give you the default.
2066
2067 On some of the questions which ask for file or directory names you are allowed
2068 to use the ~name construct to specify the login directory belonging to "name",
2069 even if you don't have a shell which knows about that.  Questions where this is
2070 allowed will be marked "(~name ok)".
2071
2072 EOH
2073         rp=''
2074         dflt='Type carriage return to continue'
2075         . ./myread
2076         cat <<'EOH'
2077
2078 The prompter used in this script allows you to use shell variables and
2079 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2080 in the default answer, as if the default line was a set of arguments given to a
2081 script shell.  This means you may also use $* to repeat the whole default line,
2082 so you do not have to re-type everything to add something to the default.
2083
2084 Everytime there is a substitution, you will have to confirm.  If there is an
2085 error (e.g. an unmatched backtick), the default answer will remain unchanged
2086 and you will be prompted again.
2087
2088 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2089 the questions and use the computed defaults (or the previous answers if there
2090 was already a config.sh file). Type 'Configure -h' for a list of options.
2091 You may also start interactively and then answer '& -d' at any prompt to turn
2092 on the non-interactive behaviour for the remainder of the execution.
2093
2094 EOH
2095         . ./myread
2096         cat <<EOH
2097
2098 Much effort has been expended to ensure that this shell script will run on any
2099 Unix system.  If despite that it blows up on yours, your best bet is to edit
2100 Configure and run it again.  If you can't run Configure for some reason,
2101 you'll have to generate a config.sh file by hand.  Whatever problems you
2102 have, let me (perlbug@perl.org) know how I blew it.
2103
2104 This installation script affects things in two ways:
2105
2106 1) it may do direct variable substitutions on some of the files included
2107    in this kit.
2108 2) it builds a config.h file for inclusion in C programs.  You may edit
2109    any of these files as the need arises after running this script.
2110
2111 If you make a mistake on a question, there is no easy way to back up to it
2112 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2113 files.  Configure will offer to let you do this before it runs the SH files.
2114
2115 EOH
2116         dflt='Type carriage return to continue'
2117         . ./myread
2118         case "$firsttime" in
2119         true) echo $user >>../.config/instruct;;
2120         esac
2121 fi
2122
2123 : find out where common programs are
2124 echo " "
2125 echo "Locating common programs..." >&4
2126 cat <<EOSC >loc
2127 $startsh
2128 case \$# in
2129 0) exit 1;;
2130 esac
2131 thing=\$1
2132 shift
2133 dflt=\$1
2134 shift
2135 for dir in \$*; do
2136         case "\$thing" in
2137         .)
2138         if test -d \$dir/\$thing; then
2139                 echo \$dir
2140                 exit 0
2141         fi
2142         ;;
2143         *)
2144         for thisthing in \$dir/\$thing; do
2145                 : just loop through to pick last item
2146         done
2147         if test -f \$thisthing; then
2148                 echo \$thisthing
2149                 exit 0
2150         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2151                 echo \$thisthing
2152                 exit 0
2153         elif test -f \$dir/\$thing.exe; then
2154                 if test -n "$DJGPP"; then
2155                         echo \$dir/\$thing.exe
2156                 else
2157                         : on Eunice apparently
2158                         echo \$dir/\$thing
2159                 fi
2160                 exit 0
2161         fi
2162         ;;
2163         esac
2164 done
2165 echo \$dflt
2166 exit 1
2167 EOSC
2168 chmod +x loc
2169 $eunicefix loc
2170 loclist="
2171 awk
2172 cat
2173 chmod
2174 comm
2175 cp
2176 echo
2177 expr
2178 grep
2179 ls
2180 mkdir
2181 rm
2182 sed
2183 sort
2184 touch
2185 tr
2186 uniq
2187 "
2188 trylist="
2189 Mcc
2190 ar
2191 bison
2192 byacc
2193 cpp
2194 csh
2195 date
2196 egrep
2197 gmake
2198 gzip
2199 less
2200 ln
2201 make
2202 more
2203 nm
2204 nroff
2205 pg
2206 test
2207 uname
2208 zip
2209 "
2210 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2211 pth="$pth /lib /usr/lib"
2212 for file in $loclist; do
2213         eval xxx=\$$file
2214         case "$xxx" in
2215         /*|?:[\\/]*)
2216                 if test -f "$xxx"; then
2217                         : ok
2218                 else
2219                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2220                         xxx=`./loc $file $file $pth`
2221                 fi
2222                 ;;
2223         '') xxx=`./loc $file $file $pth`;;
2224         *) xxx=`./loc $xxx $xxx $pth`;;
2225         esac
2226         eval $file=$xxx$_exe
2227         eval _$file=$xxx
2228         case "$xxx" in
2229         /*)
2230                 echo $file is in $xxx.
2231                 ;;
2232         ?:[\\/]*)
2233                 echo $file is in $xxx.
2234                 ;;
2235         *)
2236                 echo "I don't know where '$file' is, and my life depends on it." >&4
2237                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2238                 exit 1
2239                 ;;
2240         esac
2241 done
2242 echo " "
2243 echo "Don't worry if any of the following aren't found..."
2244 say=offhand
2245 for file in $trylist; do
2246         eval xxx=\$$file
2247         case "$xxx" in
2248         /*|?:[\\/]*)
2249                 if test -f "$xxx"; then
2250                         : ok
2251                 else
2252                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2253                         xxx=`./loc $file $file $pth`
2254                 fi
2255                 ;;
2256         '') xxx=`./loc $file $file $pth`;;
2257         *) xxx=`./loc $xxx $xxx $pth`;;
2258         esac
2259         eval $file=$xxx$_exe
2260         eval _$file=$xxx
2261         case "$xxx" in
2262         /*)
2263                 echo $file is in $xxx.
2264                 ;;
2265         ?:[\\/]*)
2266                 echo $file is in $xxx.
2267                 ;;
2268         *)
2269                 echo "I don't see $file out there, $say."
2270                 say=either
2271                 ;;
2272         esac
2273 done
2274 case "$egrep" in
2275 egrep)
2276         echo "Substituting grep for egrep."
2277         egrep=$grep
2278         _egrep=$grep
2279         ;;
2280 esac
2281 case "$ln" in
2282 ln)
2283         echo "Substituting cp for ln."
2284         ln=$cp
2285         _ln=$cp
2286         ;;
2287 esac
2288 case "$make" in
2289 make)   
2290         case "$gmake" in
2291         gmake)
2292         echo "I can't find make or gmake, and my life depends on it." >&4
2293         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2294         exit 1
2295         ;;
2296         esac
2297         ;;
2298 esac    
2299 case "$gmake" in
2300 gmake)  ;;
2301 *)      # We can't have osname yet.
2302         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2303                 # Assume that gmake, if found, is definitely GNU make
2304                 # and prefer it over the system make.
2305                 echo "Substituting gmake for make."
2306                 make=$gmake
2307                 _make=$gmake
2308         fi
2309         ;;
2310 esac
2311 case "$test" in
2312 test)
2313         echo "Hopefully test is built into your sh."
2314         ;;
2315 *)
2316         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2317                 echo "Using the test built into your sh."
2318                 test=test
2319                 _test=test
2320         fi
2321         ;;
2322 esac
2323 case "$echo" in
2324 echo)
2325         echo "Hopefully echo is built into your sh."
2326         ;;
2327 '') ;;
2328 *)
2329         echo " "
2330 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2331         $echo $n "hi there$c" >foo1
2332         echo $n "hi there$c" >foo2
2333         if cmp foo1 foo2 >/dev/null 2>&1; then
2334                 echo "They are compatible.  In fact, they may be identical."
2335         else
2336                 case "$n" in
2337                 '-n') n='' c='\c';;
2338                 *) n='-n' c='';;
2339                 esac
2340                 cat <<FOO
2341 They are not compatible!  You are probably running ksh on a non-USG system.
2342 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2343 have echo built in and we may have to run some Bourne shell scripts.  That
2344 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2345
2346 FOO
2347                 $echo $n "The star should be here-->$c"
2348                 $echo "*"
2349         fi
2350         $rm -f foo1 foo2
2351         ;;
2352 esac
2353
2354 cat <<EOS >trygcc
2355 $startsh
2356 EOS
2357 cat <<'EOSC' >>trygcc
2358 case "$cc" in
2359 '') ;;
2360 *)  $rm -f try try.*
2361     $cat >try.c <<EOM
2362 int main(int argc, char *argv[]) {
2363   return 0;
2364 }
2365 EOM
2366     if $cc -o try $ccflags $ldflags try.c; then
2367        :
2368     else
2369         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2370         despair=yes
2371         trygcc=yes
2372         case "$cc" in
2373         *gcc*) trygcc=no ;;
2374         esac
2375         case "`$cc -v -c try.c 2>&1`" in
2376         *gcc*) trygcc=no ;;
2377         esac
2378         if $test X"$trygcc" = Xyes; then
2379             if gcc -o try -c try.c; then
2380                 echo " "
2381                 echo "You seem to have a working gcc, though." >&4
2382                 rp="Would you like to use it?"
2383                 dflt=y
2384                 if $test -f myread; then
2385                     . ./myread
2386                 else
2387                     if $test -f UU/myread; then
2388                         . ./UU/myread
2389                     else
2390                         echo "Cannot find myread, sorry.  Aborting." >&2
2391                         exit 1
2392                     fi
2393                 fi  
2394                 case "$ans" in
2395                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2396                        if $test -f usethreads.cbu; then
2397                            $cat >&4 <<EOM 
2398
2399 *** However, any setting of the C compiler flags (e.g. for thread support)
2400 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2401 *** (together with e.g. -Dusethreads).
2402
2403 EOM
2404                        fi;;
2405                 esac
2406             fi
2407         fi
2408     fi
2409     $rm -f try try.*
2410     ;;
2411 esac
2412 EOSC
2413
2414 cat <<EOS >checkcc
2415 $startsh
2416 EOS
2417 cat <<'EOSC' >>checkcc
2418 case "$cc" in        
2419 '') ;;
2420 *)  $rm -f try try.*              
2421     $cat >try.c <<EOM
2422 int main(int argc, char *argv[]) {
2423   return 0;
2424 }
2425 EOM
2426     if $cc -o try $ccflags $ldflags try.c; then
2427        :
2428     else
2429         if $test X"$despair" = Xyes; then
2430            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2431         fi
2432         $cat >&4 <<EOM         
2433 You need to find a working C compiler.
2434 Either (purchase and) install the C compiler supplied by your OS vendor,
2435 or for a free C compiler try http://gcc.gnu.org/
2436 I cannot continue any further, aborting.
2437 EOM
2438         exit 1
2439     fi
2440     $rm -f try try.*
2441     ;;
2442 esac
2443 EOSC
2444
2445 : determine whether symbolic links are supported
2446 echo " "
2447 $touch blurfl
2448 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2449         echo "Symbolic links are supported." >&4
2450         lns="$ln -s"
2451 else
2452         echo "Symbolic links are NOT supported." >&4
2453         lns="$ln"
2454 fi
2455 $rm -f blurfl sym
2456
2457 : determine whether symbolic links are supported
2458 echo " "
2459 case "$lns" in
2460 *"ln"*" -s")
2461         echo "Checking how to test for symbolic links..." >&4
2462         $lns blurfl sym
2463         if $test "X$issymlink" = X; then
2464                 case "$newsh" in
2465                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2466                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2467                 esac
2468                 if test $? = 0; then
2469                         issymlink="test -h"
2470                 else
2471                         echo "Your builtin 'test -h' may be broken." >&4
2472                         case "$test" in
2473                         /*)     ;;
2474                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2475                                 for p in $pth
2476                                 do
2477                                         if test -f "$p/$test"; then
2478                                                 test="$p/$test"
2479                                                 break
2480                                         fi
2481                                 done
2482                                 ;;
2483                         esac
2484                         case "$test" in
2485                         /*)
2486                                 echo "Trying external '$test -h'." >&4
2487                                 issymlink="$test -h"
2488                                 if $test ! -h sym >/dev/null 2>&1; then
2489                                         echo "External '$test -h' is broken, too." >&4
2490                                         issymlink=''
2491                                 fi
2492                                 ;;
2493                         *)      issymlink='' ;;
2494                         esac
2495                 fi              
2496         fi
2497         if $test "X$issymlink" = X; then
2498                 if $test -L sym 2>/dev/null; then
2499                         issymlink="$test -L"
2500                         echo "The builtin '$test -L' worked." >&4
2501                 fi
2502         fi
2503         if $test "X$issymlink" != X; then
2504                 echo "You can test for symbolic links with '$issymlink'." >&4
2505         else
2506                 echo "I do not know how you can test for symbolic links." >&4
2507         fi
2508         $rm -f blurfl sym
2509         ;;
2510 *)      echo "No symbolic links, so not testing for their testing..." >&4
2511         ;;
2512 esac
2513 echo " "
2514
2515
2516 case "$mksymlinks" in
2517 $define|true|[yY]*)
2518         case "$src" in
2519         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2520                 exit 1
2521                 ;;
2522         *)      case "$lns:$issymlink" in
2523                 *"ln"*" -s:"*"test -"?)
2524                         echo "Creating the symbolic links..." >&4
2525                         echo "(First creating the subdirectories...)" >&4
2526                         cd ..
2527                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2528                                 read directory
2529                                 test -z "$directory" && break
2530                                 mkdir -p $directory
2531                         done
2532                         # Sanity check 1.
2533                         if test ! -d t/base; then
2534                                 echo "Failed to create the subdirectories.  Aborting." >&4
2535                                 exit 1
2536                         fi
2537                         echo "(Then creating the symlinks...)" >&4
2538                         awk '{print $1}' $src/MANIFEST | while true; do
2539                                 read filename
2540                                 test -z "$filename" && break
2541                                 if test -f $filename; then
2542                                         if $issymlink $filename; then
2543                                                 rm -f $filename
2544                                         fi
2545                                 fi
2546                                 if test -f $filename; then
2547                                         echo "$filename already exists, not symlinking."
2548                                 else
2549                                         ln -s $src/$filename $filename
2550                                 fi
2551                         done
2552                         # Sanity check 2.
2553                         if test ! -f t/base/lex.t; then
2554                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2555                                 exit 1
2556                         fi
2557                         cd UU
2558                         ;;
2559                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2560                         ;;
2561                 esac
2562                 ;;
2563         esac
2564         ;;
2565 esac
2566
2567
2568 case "$usecrosscompile" in
2569 $define|true|[yY]*)
2570         $echo "Cross-compiling..."
2571         croak=''
2572         case "$cc" in
2573         *-*-gcc) # A cross-compiling gcc, probably.
2574             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2575             ar=$targetarch-ar
2576             # leave out ld, choosing it is more complex
2577             nm=$targetarch-nm
2578             ranlib=$targetarch-ranlib
2579             $echo 'extern int foo;' > try.c
2580             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2581             shift
2582             if $test $# -gt 0; then
2583                 incpth="$incpth $*"
2584                 incpth="`$echo $incpth|$sed 's/^ //'`"
2585                 echo "Guessing incpth '$incpth'." >&4
2586                 for i in $*; do
2587                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2588                     if $test -d $j; then
2589                         libpth="$libpth $j"
2590                     fi
2591                 done   
2592                 libpth="`$echo $libpth|$sed 's/^ //'`"
2593                 echo "Guessing libpth '$libpth'." >&4
2594             fi
2595             $rm -f try.c
2596             ;;
2597         esac
2598         case "$targetarch" in
2599         '') echo "Targetarch not defined." >&4; croak=y ;;
2600         *)  echo "Using targetarch $targetarch." >&4 ;;
2601         esac
2602         case "$incpth" in
2603         '') echo "Incpth not defined." >&4; croak=y ;;
2604         *)  echo "Using incpth '$incpth'." >&4 ;;
2605         esac
2606         case "$libpth" in
2607         '') echo "Libpth not defined." >&4; croak=y ;;
2608         *)  echo "Using libpth '$libpth'." >&4 ;;
2609         esac
2610         case "$usrinc" in
2611         '') for i in $incpth; do
2612                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2613                     usrinc=$i
2614                     echo "Guessing usrinc $usrinc." >&4
2615                     break
2616                 fi
2617             done
2618             case "$usrinc" in
2619             '') echo "Usrinc not defined." >&4; croak=y ;;
2620             esac
2621             ;;
2622         *)  echo "Using usrinc $usrinc." >&4 ;;
2623         esac
2624         case "$targethost" in
2625         '') echo "Targethost not defined." >&4; croak=y ;;
2626         *)  echo "Using targethost $targethost." >&4
2627         esac
2628         locincpth=' '
2629         loclibpth=' '
2630         case "$croak" in
2631         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2632         esac
2633         case "$src" in
2634         /*) run=$src/Cross/run
2635             targetmkdir=$src/Cross/mkdir
2636             to=$src/Cross/to
2637             from=$src/Cross/from
2638             ;;
2639         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2640             run=$pwd/Cross/run
2641             targetmkdir=$pwd/Cross/mkdir
2642             to=$pwd/Cross/to
2643             from=$pwd/Cross/from
2644             ;;
2645         esac
2646         case "$targetrun" in
2647         '') targetrun=ssh ;;
2648         esac
2649         case "$targetto" in
2650         '') targetto=scp ;;
2651         esac
2652         case "$targetfrom" in
2653         '') targetfrom=scp ;;
2654         esac
2655         run=$run-$targetrun
2656         to=$to-$targetto
2657         from=$from-$targetfrom
2658         case "$targetdir" in
2659         '')  targetdir=/tmp
2660              echo "Guessing targetdir $targetdir." >&4
2661              ;;
2662         esac
2663         case "$targetuser" in
2664         '')  targetuser=root
2665              echo "Guessing targetuser $targetuser." >&4
2666              ;;
2667         esac
2668         case "$targetfrom" in
2669         scp)    q=-q ;;
2670         *)      q='' ;;
2671         esac
2672         case "$targetrun" in
2673         ssh|rsh)
2674             cat >$run <<EOF
2675 #!/bin/sh
2676 case "\$1" in
2677 -cwd)
2678   shift
2679   cwd=\$1
2680   shift
2681   ;;
2682 esac
2683 case "\$cwd" in
2684 '') cwd=$targetdir ;;
2685 esac
2686 exe=\$1
2687 shift
2688 if $test ! -f \$exe.xok; then
2689   $to \$exe
2690   $touch \$exe.xok
2691 fi
2692 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2693 EOF
2694             ;;
2695         *)  echo "Unknown targetrun '$targetrun'" >&4
2696             exit 1
2697             ;;
2698         esac
2699         case "$targetmkdir" in
2700         */Cross/mkdir)
2701             cat >$targetmkdir <<EOF
2702 #!/bin/sh
2703 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2704 EOF
2705             $chmod a+rx $targetmkdir
2706             ;;
2707         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2708             exit 1
2709             ;;
2710         esac
2711         case "$targetto" in
2712         scp|rcp)
2713             cat >$to <<EOF
2714 #!/bin/sh
2715 for f in \$@
2716 do
2717   case "\$f" in
2718   /*)
2719     $targetmkdir \`dirname \$f\`
2720     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2721     ;;
2722   *)
2723     $targetmkdir $targetdir/\`dirname \$f\`
2724     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2725     ;;
2726   esac
2727 done
2728 exit 0
2729 EOF
2730             ;;
2731         cp) cat >$to <<EOF
2732 #!/bin/sh
2733 for f in \$@
2734 do
2735   case "\$f" in
2736   /*)
2737     $mkdir -p $targetdir/\`dirname \$f\`
2738     $cp \$f $targetdir/\$f || exit 1
2739     ;;
2740   *)
2741     $targetmkdir $targetdir/\`dirname \$f\`
2742     $cp \$f $targetdir/\$f || exit 1
2743     ;;
2744   esac
2745 done
2746 exit 0
2747 EOF
2748             ;;
2749         *)  echo "Unknown targetto '$targetto'" >&4
2750             exit 1
2751             ;;
2752         esac
2753         case "$targetfrom" in
2754         scp|rcp)
2755           cat >$from <<EOF
2756 #!/bin/sh
2757 for f in \$@
2758 do
2759   $rm -f \$f
2760   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2761 done
2762 exit 0
2763 EOF
2764             ;;
2765         cp) cat >$from <<EOF
2766 #!/bin/sh
2767 for f in \$@
2768 do
2769   $rm -f \$f
2770   cp $targetdir/\$f . || exit 1
2771 done
2772 exit 0
2773 EOF
2774             ;;
2775         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2776             exit 1
2777             ;;
2778         esac
2779         if $test ! -f $run; then
2780             echo "Target 'run' script '$run' not found." >&4
2781         else
2782             $chmod a+rx $run
2783         fi
2784         if $test ! -f $to; then
2785             echo "Target 'to' script '$to' not found." >&4
2786         else
2787             $chmod a+rx $to
2788         fi
2789         if $test ! -f $from; then
2790             echo "Target 'from' script '$from' not found." >&4
2791         else
2792             $chmod a+rx $from
2793         fi
2794         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2795             exit 1
2796         fi
2797         cat >&4 <<EOF
2798 Using '$run' for remote execution,
2799 and '$from' and '$to'
2800 for remote file transfer.
2801 EOF
2802         ;;
2803 *)      run=''
2804         to=:
2805         from=:
2806         usecrosscompile='undef'
2807         targetarch=''
2808         ;;
2809 esac
2810
2811 : see whether [:lower:] and [:upper:] are supported character classes
2812 echo " "
2813 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2814 ABYZ)
2815         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2816         up='[:upper:]'
2817         low='[:lower:]'
2818         ;;
2819 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2820         # (0xc9 and 0xd1), therefore that is a nice testing point.
2821         if test "X$up" = X -o "X$low" = X; then
2822             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2823             ij) up='[A-Z]'
2824                 low='[a-z]'
2825                 ;;
2826             esac
2827         fi
2828         if test "X$up" = X -o "X$low" = X; then
2829             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2830             ij) up='A-Z'
2831                 low='a-z'
2832                 ;;
2833             esac
2834         fi
2835         if test "X$up" = X -o "X$low" = X; then
2836             case "`echo IJ | od -x 2>/dev/null`" in
2837             *C9D1*|*c9d1*)
2838                 echo "Hey, this might be EBCDIC." >&4
2839                 if test "X$up" = X -o "X$low" = X; then
2840                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2841                     ij) up='[A-IJ-RS-Z]'
2842                         low='[a-ij-rs-z]'
2843                         ;;
2844                     esac
2845                 fi
2846                 if test "X$up" = X -o "X$low" = X; then
2847                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2848                     ij) up='A-IJ-RS-Z'
2849                         low='a-ij-rs-z'
2850                         ;;
2851                     esac
2852                 fi
2853                 ;;
2854             esac
2855         fi
2856 esac
2857 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2858 ij)
2859     echo "Using $up and $low to convert case." >&4
2860     ;;
2861 *)
2862     echo "I don't know how to translate letters from upper to lower case." >&4
2863     echo "Your tr is not acting any way I know of." >&4
2864     exit 1
2865     ;;
2866 esac
2867 : set up the translation script tr, must be called with ./tr of course
2868 cat >tr <<EOSC
2869 $startsh
2870 case "\$1\$2" in
2871 '[A-Z][a-z]') exec $tr '$up' '$low';;
2872 '[a-z][A-Z]') exec $tr '$low' '$up';;
2873 esac
2874 exec $tr "\$@"
2875 EOSC
2876 chmod +x tr
2877 $eunicefix tr
2878
2879 : Try to determine whether config.sh was made on this system
2880 case "$config_sh" in
2881 '')
2882 myuname=`$uname -a 2>/dev/null`
2883 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2884 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2885 # because the A-Z/a-z are not consecutive.
2886 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2887         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2888 newmyuname="$myuname"
2889 dflt=n
2890 case "$knowitall" in
2891 '')
2892         if test -f ../config.sh; then
2893                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2894                         eval "`grep myuname= ../config.sh`"
2895                 fi
2896                 if test "X$myuname" = "X$newmyuname"; then
2897                         dflt=y
2898                 fi
2899         fi
2900         ;;
2901 *) dflt=y;;
2902 esac
2903
2904 : Get old answers from old config file if Configure was run on the
2905 : same system, otherwise use the hints.
2906 hint=default
2907 cd ..
2908 if test -f config.sh; then
2909         echo " "
2910         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2911         . UU/myread
2912         case "$ans" in
2913         n*|N*) echo "OK, I'll ignore it."
2914                 mv config.sh config.sh.old
2915                 myuname="$newmyuname"
2916                 ;;
2917         *)  echo "Fetching default answers from your old config.sh file..." >&4
2918                 tmp_n="$n"
2919                 tmp_c="$c"
2920                 tmp_sh="$sh"
2921                 . ./config.sh
2922                 cp config.sh UU
2923                 n="$tmp_n"
2924                 c="$tmp_c"
2925                 : Older versions did not always set $sh.  Catch re-use of such
2926                 : an old config.sh.
2927                 case "$sh" in
2928                 '') sh="$tmp_sh" ;;
2929                 esac
2930                 hint=previous
2931                 ;;
2932         esac
2933 fi
2934 . ./UU/checkcc
2935 if test ! -f config.sh; then
2936         $cat <<EOM
2937
2938 First time through, eh?  I have some defaults handy for some systems
2939 that need some extra help getting the Configure answers right:
2940
2941 EOM
2942         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2943         dflt=''
2944         : Half the following guesses are probably wrong... If you have better
2945         : tests or hints, please send them to perlbug@perl.org
2946         : The metaconfig authors would also appreciate a copy...
2947         $test -f /irix && osname=irix
2948         $test -f /xenix && osname=sco_xenix
2949         $test -f /dynix && osname=dynix
2950         $test -f /dnix && osname=dnix
2951         $test -f /lynx.os && osname=lynxos
2952         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2953         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2954         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2955         $test -f /bin/mips && /bin/mips && osname=mips
2956         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2957                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2958         $test -d /usr/apollo/bin && osname=apollo
2959         $test -f /etc/saf/_sactab && osname=svr4
2960         $test -d /usr/include/minix && osname=minix
2961         $test -f /system/gnu_library/bin/ar.pm && osname=vos
2962         if $test -d /MachTen -o -d /MachTen_Folder; then
2963                 osname=machten
2964                 if $test -x /sbin/version; then
2965                         osvers=`/sbin/version | $awk '{print $2}' |
2966                         $sed -e 's/[A-Za-z]$//'`
2967                 elif $test -x /usr/etc/version; then
2968                         osvers=`/usr/etc/version | $awk '{print $2}' |
2969                         $sed -e 's/[A-Za-z]$//'`
2970                 else
2971                         osvers="$2.$3"
2972                 fi
2973         fi
2974
2975         $test -f /sys/posix.dll &&
2976                 $test -f /usr/bin/what &&
2977                 set X `/usr/bin/what /sys/posix.dll` &&
2978                 $test "$3" = UWIN &&
2979                 osname=uwin &&
2980                 osvers="$5"
2981
2982         if $test -f $uname; then
2983                 set X $myuname
2984                 shift
2985
2986                 case "$5" in
2987                 fps*) osname=fps ;;
2988                 mips*)
2989                         case "$4" in
2990                         umips) osname=umips ;;
2991                         *) osname=mips ;;
2992                         esac;;
2993                 [23]100) osname=mips ;;
2994                 next*) osname=next ;;
2995                 i386*)
2996                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2997                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2998                                 osname='sco'
2999                                 osvers=$tmp
3000                         elif $test -f /etc/kconfig; then
3001                                 osname=isc
3002                                 if test "$lns" = "$ln -s"; then
3003                                         osvers=4
3004                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3005                                         osvers=3
3006                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3007                                         osvers=2
3008                                 fi
3009                         fi
3010                         tmp=''
3011                         ;;
3012                 pc*)
3013                         if test -n "$DJGPP"; then
3014                                 osname=dos
3015                                 osvers=djgpp
3016                         fi
3017                         ;;
3018                 esac
3019
3020                 case "$1" in
3021                 aix) osname=aix
3022                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3023                         case "$tmp" in
3024                         'not found') osvers="$4"."$3" ;;
3025                         '<3240'|'<>3240') osvers=3.2.0 ;;
3026                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3027                         '=3250'|'>3250') osvers=3.2.5 ;;
3028                         *) osvers=$tmp;;
3029                         esac
3030                         ;;
3031                 bsd386) osname=bsd386
3032                         osvers=`$uname -r`
3033                         ;;
3034                 cygwin*) osname=cygwin
3035                         osvers="$3"
3036                         ;;
3037                 *dc.osx) osname=dcosx
3038                         osvers="$3"
3039                         ;;
3040                 dnix) osname=dnix
3041                         osvers="$3"
3042                         ;;
3043                 domainos) osname=apollo
3044                         osvers="$3"
3045                         ;;
3046                 dgux) osname=dgux 
3047                         osvers="$3"
3048                         ;;
3049                 dynixptx*) osname=dynixptx
3050                         osvers=`echo "$4"|sed 's/^v//'`
3051                         ;;
3052                 freebsd) osname=freebsd 
3053                         osvers="$3" ;;
3054                 genix) osname=genix ;;
3055                 hp*) osname=hpux 
3056                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3057                         ;;
3058                 irix*) osname=irix
3059                         case "$3" in
3060                         4*) osvers=4 ;;
3061                         5*) osvers=5 ;;
3062                         *)      osvers="$3" ;;
3063                         esac
3064                         ;;
3065                 linux) osname=linux
3066                         case "$3" in
3067                         *)      osvers="$3" ;;
3068                         esac
3069                         ;;
3070                 MiNT) osname=mint
3071                         ;;
3072                 netbsd*) osname=netbsd
3073                         osvers="$3"
3074                         ;;
3075                 news-os) osvers="$3"
3076                         case "$3" in
3077                         4*) osname=newsos4 ;;
3078                         *) osname=newsos ;;
3079                         esac
3080                         ;;
3081                 next*) osname=next ;;
3082                 nonstop-ux) osname=nonstopux ;;
3083                 openbsd) osname=openbsd
3084                         osvers="$3"
3085                         ;;
3086                 POSIX-BC | posix-bc ) osname=posix-bc
3087                         osvers="$3"
3088                         ;;
3089                 powerux | power_ux | powermax_os | powermaxos | \
3090                 powerunix | power_unix) osname=powerux
3091                         osvers="$3"
3092                         ;;
3093                 qnx) osname=qnx
3094                         osvers="$4"
3095                         ;;
3096                 solaris) osname=solaris
3097                         case "$3" in
3098                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3099                         *)      osvers="$3" ;;
3100                         esac
3101                         ;;
3102                 sunos) osname=sunos
3103                         case "$3" in
3104                         5*) osname=solaris
3105                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3106                         *)      osvers="$3" ;;
3107                         esac
3108                         ;;
3109                 titanos) osname=titanos
3110                         case "$3" in
3111                         1*) osvers=1 ;;
3112                         2*) osvers=2 ;;
3113                         3*) osvers=3 ;;
3114                         4*) osvers=4 ;;
3115                         *)      osvers="$3" ;;
3116                         esac
3117                         ;;
3118                 ultrix) osname=ultrix
3119                         osvers="$3"
3120                         ;;
3121                 osf1|mls+)      case "$5" in
3122                                 alpha)
3123                                         osname=dec_osf
3124                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3125                                         case "$osvers" in
3126                                         [1-9].[0-9]*) ;;
3127                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3128                                         esac
3129                                         ;;
3130                         hp*)    osname=hp_osf1  ;;
3131                         mips)   osname=mips_osf1 ;;
3132                         esac
3133                         ;;
3134                 unixware) osname=svr5
3135                         osvers="$4"
3136                         ;;
3137                 uts)    osname=uts
3138                         osvers="$3"
3139                         ;;
3140                 vos) osvers="$3"
3141                         ;;
3142                 $2) case "$osname" in
3143                         *isc*) ;;
3144                         *freebsd*) ;;
3145                         svr*)
3146                                 : svr4.x or possibly later
3147                                 case "svr$3" in 
3148                                 ${osname}*)
3149                                         osname=svr$3
3150                                         osvers=$4
3151                                         ;;
3152                                 esac
3153                                 case "$osname" in
3154                                 svr4.0)
3155                                         : Check for ESIX
3156                                         if test -f /stand/boot ; then
3157                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3158                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3159                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3160                                                         if test -n "$isesix"; then
3161                                                                 osname=esix4
3162                                                         fi
3163                                                 fi
3164                                         fi
3165                                         ;;
3166                                 esac
3167                                 ;;
3168                         *)      if test -f /etc/systemid; then
3169                                         osname=sco
3170                                         set `echo $3 | $sed 's/\./ /g'` $4
3171                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3172                                                 osvers=$1.$2.$3
3173                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3174                                                 osvers=$1.$2
3175                                         elif $test -f $src/hints/sco_$1.sh; then
3176                                                 osvers=$1
3177                                         fi
3178                                 else
3179                                         case "$osname" in
3180                                         '') : Still unknown.  Probably a generic Sys V.
3181                                                 osname="sysv"
3182                                                 osvers="$3"
3183                                                 ;;
3184                                         esac
3185                                 fi
3186                                 ;;
3187                         esac
3188                         ;;
3189                 *)      case "$osname" in
3190                         '') : Still unknown.  Probably a generic BSD.
3191                                 osname="$1"
3192                                 osvers="$3"
3193                                 ;;
3194                         esac
3195                         ;;
3196                 esac
3197         else
3198                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3199                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3200                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3201                                 osname=news_os
3202                         fi
3203                         $rm -f UU/kernel.what
3204                 elif test -d c:/.; then
3205                         set X $myuname
3206                         osname=os2
3207                         osvers="$5"
3208                 fi
3209         fi
3210         
3211         case "$targetarch" in
3212         '') ;;
3213         *)  hostarch=$osname
3214             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3215             osvers=''
3216             ;;
3217         esac
3218
3219         : Now look for a hint file osname_osvers, unless one has been
3220         : specified already.
3221         case "$hintfile" in
3222         ''|' ')
3223                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3224                 : Also try without trailing minor version numbers.
3225                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3226                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3227                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3228                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3229                 case "$file" in
3230                 '') dflt=none ;;
3231                 *)  case "$osvers" in
3232                         '') dflt=$file
3233                                 ;;
3234                         *)  if $test -f $src/hints/$file.sh ; then
3235                                         dflt=$file
3236                                 elif $test -f $src/hints/$xfile.sh ; then
3237                                         dflt=$xfile
3238                                 elif $test -f $src/hints/$xxfile.sh ; then
3239                                         dflt=$xxfile
3240                                 elif $test -f $src/hints/$xxxfile.sh ; then
3241                                         dflt=$xxxfile
3242                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3243                                         dflt=$xxxxfile
3244                                 elif $test -f "$src/hints/${osname}.sh" ; then
3245                                         dflt="${osname}"
3246                                 else
3247                                         dflt=none
3248                                 fi
3249                                 ;;
3250                         esac
3251                         ;;
3252                 esac
3253                 if $test -f Policy.sh ; then
3254                         case "$dflt" in
3255                         *Policy*) ;;
3256                         none) dflt="Policy" ;;
3257                         *) dflt="Policy $dflt" ;;
3258                         esac
3259                 fi
3260                 ;;
3261         *)
3262                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3263                 ;;
3264         esac
3265
3266         if $test -f Policy.sh ; then
3267                 $cat <<EOM
3268
3269 There's also a Policy hint file available, which should make the
3270 site-specific (policy) questions easier to answer.
3271 EOM
3272
3273         fi
3274
3275         $cat <<EOM
3276
3277 You may give one or more space-separated answers, or "none" if appropriate.
3278 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3279 is a good thing.  DO NOT give a wrong version or a wrong OS.
3280
3281 EOM
3282
3283         rp="Which of these apply, if any?"
3284         . UU/myread
3285         tans=$ans
3286         for file in $tans; do
3287                 if $test X$file = XPolicy -a -f Policy.sh; then
3288                         . Policy.sh
3289                         $cat Policy.sh >> UU/config.sh
3290                 elif $test -f $src/hints/$file.sh; then
3291                         . $src/hints/$file.sh
3292                         $cat $src/hints/$file.sh >> UU/config.sh
3293                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3294                         : nothing
3295                 else
3296                         : Give one chance to correct a possible typo.
3297                         echo "$file.sh does not exist"
3298                         dflt=$file
3299                         rp="hint to use instead?"
3300                         . UU/myread
3301                         for file in $ans; do
3302                                 if $test -f "$src/hints/$file.sh"; then
3303                                         . $src/hints/$file.sh
3304                                         $cat $src/hints/$file.sh >> UU/config.sh
3305                                 elif $test X$ans = X -o X$ans = Xnone ; then
3306                                         : nothing
3307                                 else
3308                                         echo "$file.sh does not exist -- ignored."
3309                                 fi
3310                         done
3311                 fi
3312         done
3313
3314         hint=recommended
3315         : Remember our hint file for later.
3316         if $test -f "$src/hints/$file.sh" ; then
3317                 hintfile="$file"
3318         else
3319                 hintfile=''
3320         fi
3321 fi
3322 cd UU
3323 ;;
3324 *)
3325         echo " "
3326         echo "Fetching default answers from $config_sh..." >&4
3327         tmp_n="$n"
3328         tmp_c="$c"
3329         cd ..
3330         cp $config_sh config.sh 2>/dev/null
3331         chmod +w config.sh
3332         . ./config.sh
3333         cd UU
3334         cp ../config.sh .
3335         n="$tmp_n"
3336         c="$tmp_c"
3337         hint=previous
3338         ;;
3339 esac
3340 test "$override" && . ./optdef.sh
3341
3342 : Restore computed paths
3343 for file in $loclist $trylist; do
3344         eval $file="\$_$file"
3345 done
3346
3347 cat << EOM
3348
3349 Configure uses the operating system name and version to set some defaults.
3350 The default value is probably right if the name rings a bell. Otherwise,
3351 since spelling matters for me, either accept the default or answer "none"
3352 to leave it blank.
3353
3354 EOM
3355 case "$osname" in
3356         ''|' ')
3357                 case "$hintfile" in
3358                 ''|' '|none) dflt=none ;;
3359                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3360                 esac
3361                 ;;
3362         *) dflt="$osname" ;;
3363 esac
3364 rp="Operating system name?"
3365 . ./myread
3366 case "$ans" in
3367 none)  osname='' ;;
3368 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3369 esac
3370 echo " "
3371 case "$osvers" in
3372         ''|' ')
3373                 case "$hintfile" in
3374                 ''|' '|none) dflt=none ;;
3375                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3376                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3377                         case "$dflt" in
3378                         ''|' ') dflt=none ;;
3379                         esac
3380                         ;;
3381                 esac
3382                 ;;
3383         *) dflt="$osvers" ;;
3384 esac
3385 rp="Operating system version?"
3386 . ./myread
3387 case "$ans" in
3388 none)  osvers='' ;;
3389 *) osvers="$ans" ;;
3390 esac
3391
3392
3393 . ./posthint.sh
3394
3395 : who configured the system
3396 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3397 cf_by=`(logname) 2>/dev/null`
3398 case "$cf_by" in
3399 "")
3400         cf_by=`(whoami) 2>/dev/null`
3401         case "$cf_by" in
3402         "") cf_by=unknown ;;
3403         esac ;;
3404 esac
3405
3406 : set up the script used to warn in case of inconsistency
3407 cat <<EOS >whoa
3408 $startsh
3409 EOS
3410 cat <<'EOSC' >>whoa
3411 dflt=y
3412 echo " "
3413 echo "*** WHOA THERE!!! ***" >&4
3414 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3415 rp="    Keep the $hint value?"
3416 . ./myread
3417 case "$ans" in
3418 y) td=$was; tu=$was;;
3419 esac
3420 EOSC
3421
3422 : function used to set $1 to $val
3423 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3424 case "$val$was" in
3425 $define$undef) . ./whoa; eval "$var=\$td";;
3426 $undef$define) . ./whoa; eval "$var=\$tu";;
3427 *) eval "$var=$val";;
3428 esac'
3429
3430 case "$usesocks" in
3431 $define|true|[yY]*)     dflt='y';;
3432 *) dflt='n';;
3433 esac
3434 cat <<EOM
3435
3436 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3437 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3438 to use the PerlIO abstraction layer, this will be implicitly selected.
3439
3440 If this doesn't make any sense to you, just accept the default '$dflt'.
3441 EOM
3442 rp='Build Perl for SOCKS?'
3443 . ./myread
3444 case "$ans" in
3445 y|Y)    val="$define" ;;     
3446 *)      val="$undef" ;;
3447 esac
3448 set usesocks
3449 eval $setvar
3450
3451 case "$usesocks" in
3452 $define|true|[yY]*) useperlio="$define";;
3453 esac
3454
3455 case "$useperlio" in
3456 $define|true|[yY]*|'')  dflt='y';;
3457 *) dflt='n';;
3458 esac
3459 cat <<EOM
3460
3461 Previous version of $package used the standard IO mechanisms as
3462 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3463 alternate IO mechanisms via the PerlIO abstraction layer, but the
3464 stdio mechanism is still available if needed.  The abstraction layer
3465 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3466 Using PerlIO with sfio may cause problems with some extension modules.
3467
3468 If this doesn't make any sense to you, just accept the default '$dflt'.
3469 EOM
3470 rp='Use the PerlIO abstraction layer?'
3471 . ./myread
3472 case "$ans" in
3473 y|Y) 
3474         val="$define"
3475         ;;
3476 *)      
3477         echo "Ok, doing things the stdio way."
3478         val="$undef"
3479         ;;
3480 esac
3481 set useperlio
3482 eval $setvar 
3483
3484 case "$usesocks" in
3485 $define|true|[yY]*)
3486         case "$useperlio" in
3487         $define|true|[yY]*) ;;
3488         *)      cat >&4 <<EOM
3489
3490 You are using the SOCKS proxy protocol library which means that you
3491 should also use the PerlIO layer.  You may be headed for trouble.
3492
3493 EOM
3494                 ;;
3495         esac
3496         ;;
3497 esac
3498
3499         
3500 case "$usethreads" in
3501 $define|true|[yY]*)     dflt='y';;
3502 *)     # Catch case where user specified ithreads or 5005threads but
3503        # forgot -Dusethreads (A.D. 4/2002)
3504        case "$useithreads$use5005threads" in
3505        *$define*)      
3506                 case "$useperlio" in
3507                 "$define")      dflt='y' ;;
3508                 *)              dflt='n' ;;
3509                 esac
3510                 ;;
3511        *)       dflt='n';;
3512        esac
3513        ;;
3514 esac
3515 cat <<EOM
3516
3517 Perl can be built to take advantage of threads on some systems.
3518 To do so, Configure can be run with -Dusethreads.
3519
3520 Note that Perl built with threading support runs slightly slower
3521 and uses more memory than plain Perl. The current implementation
3522 is believed to be stable, but it is fairly new, and so should be
3523 treated with caution.
3524
3525 If this doesn't make any sense to you, just accept the default '$dflt'.
3526 EOM
3527 rp='Build a threading Perl?'
3528 . ./myread
3529 case "$ans" in
3530 y|Y)    val="$define" ;;
3531 *)      val="$undef" ;;
3532 esac
3533 set usethreads
3534 eval $setvar
3535
3536 case "$usethreads" in
3537 $define)
3538         $cat <<EOM
3539
3540 Since release 5.6, Perl has had two different threading implementations,
3541 the newer interpreter-based version (ithreads) with one interpreter per
3542 thread, and the older 5.005 version (5005threads).
3543 The 5005threads version is effectively unmaintained and will probably be
3544 removed in Perl 5.10, so there should be no need to build a Perl using it
3545 unless needed for backwards compatibility with some existing 5.005threads
3546 code.
3547
3548 EOM
3549         : Default to ithreads unless overridden on command line or with
3550         : old config.sh
3551         dflt='y'
3552         case "$use5005threads" in
3553                 $define|true|[yY]*) dflt='n';;
3554         esac
3555         case "$useithreads" in
3556                 $undef|false|[nN]*) dflt='n';;
3557         esac
3558         rp='Use the newer interpreter-based ithreads?'
3559         . ./myread
3560         case "$ans" in
3561         y|Y)    val="$define" ;;
3562         *)      val="$undef" ;;
3563         esac
3564         set useithreads
3565         eval $setvar
3566         : Now set use5005threads to the opposite value.
3567         case "$useithreads" in
3568         $define) val="$undef" ;;
3569         *) val="$define" ;;
3570         esac
3571         set use5005threads
3572         eval $setvar
3573         ;;
3574 *)
3575         useithreads="$undef"
3576         use5005threads="$undef"
3577         ;;
3578 esac
3579
3580 case "$useithreads$use5005threads" in
3581 "$define$define")
3582         $cat >&4 <<EOM
3583
3584 You cannot have both the ithreads and the 5.005 threads enabled
3585 at the same time.  Disabling the 5.005 threads since they are
3586 much less stable than the ithreads.
3587
3588 EOM
3589         use5005threads="$undef"
3590         ;;
3591 esac
3592
3593 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3594         cat >&4 <<EOF
3595 ***
3596 *** To build with ithreads you must also use the PerlIO layer.
3597 *** Cannot continue, aborting.
3598 ***
3599 EOF
3600         exit 1
3601 fi
3602
3603 case "$d_oldpthreads" in
3604 '')     : Configure tests would be welcome here.  For now, assume undef.
3605         val="$undef" ;;
3606 *)      val="$d_oldpthreads" ;;
3607 esac
3608 set d_oldpthreads
3609 eval $setvar
3610
3611
3612 case "$usethreads" in
3613 "$define"|true|[yY]*)
3614 : Look for a hint-file generated 'call-back-unit'.  If the
3615 : user has specified that a threading perl is to be built,
3616 : we may need to set or change some other defaults.
3617         if $test -f usethreads.cbu; then
3618                 echo "Your platform has some specific hints for threaded builds, using them..."
3619                 . ./usethreads.cbu
3620         else
3621                 $cat <<EOM
3622 (Your platform doesn't have any specific hints for threaded builds.
3623  Assuming POSIX threads, then.)
3624 EOM
3625         fi
3626         ;;
3627 esac
3628
3629 cat <<EOM
3630
3631 Perl can be built so that multiple Perl interpreters can coexist
3632 within the same Perl executable.
3633 EOM
3634
3635 case "$useithreads" in
3636 $define)
3637         cat <<EOM
3638 This multiple interpreter support is required for interpreter-based threads.
3639 EOM
3640         val="$define"
3641         ;;
3642 *)      case "$usemultiplicity" in
3643         $define|true|[yY]*)     dflt='y';;
3644         *) dflt='n';;
3645         esac
3646         echo " "
3647         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3648         rp='Build Perl for multiplicity?'
3649         . ./myread
3650         case "$ans" in
3651         y|Y)    val="$define" ;;
3652         *)      val="$undef" ;;
3653         esac
3654         ;;
3655 esac
3656 set usemultiplicity
3657 eval $setvar
3658
3659
3660 case "$usemorebits" in
3661 "$define"|true|[yY]*)
3662         use64bitint="$define"
3663         uselongdouble="$define"
3664         usemorebits="$define"
3665         ;;
3666 *)      usemorebits="$undef"
3667         ;;
3668 esac
3669
3670 : make some quick guesses about what we are up against
3671 echo " "
3672 $echo $n "Hmm...  $c"
3673 echo exit 1 >bsd
3674 echo exit 1 >usg
3675 echo exit 1 >v7
3676 echo exit 1 >osf1
3677 echo exit 1 >eunice
3678 echo exit 1 >xenix
3679 echo exit 1 >venix
3680 echo exit 1 >os2
3681 d_bsd="$undef"
3682 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3683 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3684 then
3685         echo "Looks kind of like an OSF/1 system, but we'll see..."
3686         echo exit 0 >osf1
3687 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3688         xxx=`./loc addbib blurfl $pth`
3689         if $test -f $xxx; then
3690         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3691                 echo exit 0 >bsd
3692                 echo exit 0 >usg
3693         else
3694                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3695                         echo "Looks kind of like an extended USG system, but we'll see..."
3696                 else
3697                         echo "Looks kind of like a USG system, but we'll see..."
3698                 fi
3699                 echo exit 0 >usg
3700         fi
3701 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3702         echo "Looks kind of like a BSD system, but we'll see..."
3703         d_bsd="$define"
3704         echo exit 0 >bsd
3705 else
3706         echo "Looks kind of like a Version 7 system, but we'll see..."
3707         echo exit 0 >v7
3708 fi
3709 case "$eunicefix" in
3710 *unixtovms*)
3711         $cat <<'EOI'
3712 There is, however, a strange, musty smell in the air that reminds me of
3713 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3714 EOI
3715         echo exit 0 >eunice
3716         d_eunice="$define"
3717 : it so happens the Eunice I know will not run shell scripts in Unix format
3718         ;;
3719 *)
3720         echo " "
3721         echo "Congratulations.  You aren't running Eunice."
3722         d_eunice="$undef"
3723         ;;
3724 esac
3725 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3726 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3727 : semicolon as a patch separator
3728 case "$p_" in
3729 :) ;;
3730 *)
3731         $cat <<'EOI'
3732 I have the feeling something is not exactly right, however...don't tell me...
3733 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3734 (Or you may be running DOS with DJGPP.)
3735 EOI
3736         echo exit 0 >os2
3737         ;;
3738 esac
3739 if test -f /xenix; then
3740         echo "Actually, this looks more like a XENIX system..."
3741         echo exit 0 >xenix
3742         d_xenix="$define"
3743 else
3744         echo " "
3745         echo "It's not Xenix..."
3746         d_xenix="$undef"
3747 fi
3748 chmod +x xenix
3749 $eunicefix xenix
3750 if test -f /venix; then
3751         echo "Actually, this looks more like a VENIX system..."
3752         echo exit 0 >venix
3753 else
3754         echo " "
3755         if ./xenix; then
3756                 : null
3757         else
3758                 echo "Nor is it Venix..."
3759         fi
3760 fi
3761 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3762 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3763 $rm -f foo
3764
3765 case "$cc" in
3766 '') dflt=cc;;
3767 *) dflt="$cc";;
3768 esac
3769 rp="Use which C compiler?"
3770 . ./myread
3771 cc="$ans"
3772
3773 : See if they have not cc but they do have gcc
3774 . ./trygcc
3775 : Look for a hint-file generated 'call-back-unit'.  Now that the
3776 : user has specified the compiler, we may need to set or change some
3777 : other defaults.
3778 if $test -f cc.cbu; then
3779     . ./cc.cbu
3780 fi
3781 . ./checkcc
3782
3783 echo " "
3784 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3785 $cat >try.c <<EOM
3786 #include <stdio.h>
3787 int main() {
3788 #ifdef __GNUC__
3789 #ifdef __VERSION__
3790         printf("%s\n", __VERSION__);
3791 #else
3792         printf("%s\n", "1");
3793 #endif
3794 #endif
3795         exit(0);
3796 }
3797 EOM
3798 if $cc -o try $ccflags $ldflags try.c; then
3799         gccversion=`$run ./try`
3800         case "$gccversion" in
3801         '') echo "You are not using GNU cc." ;;
3802         *)  echo "You are using GNU cc $gccversion."
3803             ccname=gcc  
3804             ;;
3805         esac
3806 else
3807         echo " "
3808         echo "*** WHOA THERE!!! ***" >&4
3809         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3810         case "$knowitall" in
3811         '')
3812         echo "    You'd better start hunting for one and let me know about it." >&4
3813                 exit 1
3814                 ;;
3815         esac
3816 fi
3817 $rm -f try try.*
3818 case "$gccversion" in
3819 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3820 esac
3821 case "$gccversion" in
3822 '') gccosandvers='' ;;
3823 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3824    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3825    gccshortvers=''
3826    case "$gccosandvers" in
3827    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3828    $osname$osvers) ;; # looking good
3829    $osname*) cat <<EOM >&4
3830
3831 *** WHOA THERE!!! ***
3832
3833     Your gcc has not been compiled for the exact release of
3834     your operating system ($gccosandvers versus $osname$osvers).
3835
3836     In general it is a good idea to keep gcc synchronized with
3837     the operating system because otherwise serious problems
3838     may ensue when trying to compile software, like Perl.
3839
3840     I'm trying to be optimistic here, though, and will continue.
3841     If later during the configuration and build icky compilation
3842     problems appear (headerfile conflicts being the most common
3843     manifestation), I suggest reinstalling the gcc to match
3844     your operating system release.
3845
3846 EOM
3847       ;;
3848    *) gccosandvers='' ;; # failed to parse, better be silent
3849    esac
3850    ;;
3851 esac
3852 case "$ccname" in
3853 '') ccname="$cc" ;;
3854 esac
3855
3856 # gcc 3.1 complains about adding -Idirectories that it already knows about,
3857 # so we will take those off from locincpth.
3858 case "$gccversion" in
3859 3*)
3860     echo "main(){}">try.c
3861     for incdir in `$cc -v -c try.c 2>&1 | \
3862        sed '1,/^#include <\.\.\.>/d;/^End of search list/,$d;s/^ //'` ; do
3863        locincpth=`echo $locincpth | sed s!$incdir!!`
3864     done
3865     $rm -f try try.*
3866 esac
3867
3868 : decide how portable to be.  Allow command line overrides.
3869 case "$d_portable" in
3870 "$undef") ;;
3871 *)      d_portable="$define" ;;
3872 esac
3873
3874 : set up shell script to do ~ expansion
3875 cat >filexp <<EOSS
3876 $startsh
3877 : expand filename
3878 case "\$1" in
3879  ~/*|~)
3880         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3881         ;;
3882  ~*)
3883         if $test -f /bin/csh; then
3884                 /bin/csh -f -c "glob \$1"
3885                 failed=\$?
3886                 echo ""
3887                 exit \$failed
3888         else
3889                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3890                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3891                 if $test ! -d "\$dir"; then
3892                         me=\`basename \$0\`
3893                         echo "\$me: can't locate home directory for: \$name" >&2
3894                         exit 1
3895                 fi
3896                 case "\$1" in
3897                 */*)
3898                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3899                         ;;
3900                 *)
3901                         echo \$dir
3902                         ;;
3903                 esac
3904         fi
3905         ;;
3906 *)
3907         echo \$1
3908         ;;
3909 esac
3910 EOSS
3911 chmod +x filexp
3912 $eunicefix filexp
3913
3914 : now set up to get a file name
3915 cat <<EOS >getfile
3916 $startsh
3917 EOS
3918 cat <<'EOSC' >>getfile
3919 tilde=''
3920 fullpath=''
3921 already=''
3922 skip=''
3923 none_ok=''
3924 exp_file=''
3925 nopath_ok=''
3926 orig_rp="$rp"
3927 orig_dflt="$dflt"
3928 case "$gfpth" in
3929 '') gfpth='.' ;;
3930 esac
3931
3932 case "$fn" in
3933 *\(*)
3934         : getfile will accept an answer from the comma-separated list
3935         : enclosed in parentheses even if it does not meet other criteria.
3936         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3937         fn=`echo $fn | sed 's/(.*)//'`
3938         ;;
3939 esac
3940
3941 case "$fn" in
3942 *:*)
3943         loc_file=`expr $fn : '.*:\(.*\)'`
3944         fn=`expr $fn : '\(.*\):.*'`
3945         ;;
3946 esac
3947
3948 case "$fn" in
3949 *~*) tilde=true;;
3950 esac
3951 case "$fn" in
3952 */*) fullpath=true;;
3953 esac
3954 case "$fn" in
3955 *+*) skip=true;;
3956 esac
3957 case "$fn" in
3958 *n*) none_ok=true;;
3959 esac
3960 case "$fn" in
3961 *e*) exp_file=true;;
3962 esac
3963 case "$fn" in
3964 *p*) nopath_ok=true;;
3965 esac
3966
3967 case "$fn" in
3968 *f*) type='File';;
3969 *d*) type='Directory';;
3970 *l*) type='Locate';;
3971 esac
3972
3973 what="$type"
3974 case "$what" in
3975 Locate) what='File';;
3976 esac
3977
3978 case "$exp_file" in
3979 '')
3980         case "$d_portable" in
3981         "$define") ;;
3982         *) exp_file=true;;
3983         esac
3984         ;;
3985 esac
3986
3987 cd ..
3988 while test "$type"; do
3989         redo=''
3990         rp="$orig_rp"
3991         dflt="$orig_dflt"
3992         case "$tilde" in
3993         true) rp="$rp (~name ok)";;
3994         esac
3995         . UU/myread
3996         if test -f UU/getfile.ok && \
3997                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3998         then
3999                 value="$ans"
4000                 ansexp="$ans"
4001                 break
4002         fi
4003         case "$ans" in
4004         none)
4005                 value=''
4006                 ansexp=''
4007                 case "$none_ok" in
4008                 true) type='';;
4009                 esac
4010                 ;;
4011         *)
4012                 case "$tilde" in
4013                 '') value="$ans"
4014                         ansexp="$ans";;
4015                 *)
4016                         value=`UU/filexp $ans`
4017                         case $? in
4018                         0)
4019                                 if test "$ans" != "$value"; then
4020                                         echo "(That expands to $value on this system.)"
4021                                 fi
4022                                 ;;
4023                         *) value="$ans";;
4024                         esac
4025                         ansexp="$value"
4026                         case "$exp_file" in
4027                         '') value="$ans";;
4028                         esac
4029                         ;;
4030                 esac
4031                 case "$fullpath" in
4032                 true)
4033                         case "$ansexp" in
4034                         /*) value="$ansexp" ;;
4035                         [a-zA-Z]:/*) value="$ansexp" ;;
4036                         *)
4037                                 redo=true
4038                                 case "$already" in
4039                                 true)
4040                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4041                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4042                                         ;;
4043                                 *)
4044                                 echo "Please give a full path name, starting with slash." >&4
4045                                         case "$tilde" in
4046                                         true)
4047                                 echo "Note that using ~name is ok provided it expands well." >&4
4048                                                 already=true
4049                                                 ;;
4050                                         esac
4051                                 esac
4052                                 ;;
4053                         esac
4054                         ;;
4055                 esac
4056                 case "$redo" in
4057                 '')
4058                         case "$type" in
4059                         File)
4060                                 for fp in $gfpth; do
4061                                         if test "X$fp" = X.; then
4062                                             pf="$ansexp"
4063                                         else    
4064                                             pf="$fp/$ansexp"
4065                                         fi
4066                                         if test -f "$pf"; then
4067                                                 type=''
4068                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4069                                         then
4070                                                 echo "($value is not a plain file, but that's ok.)"
4071                                                 type=''
4072                                         fi
4073                                         if test X"$type" = X; then
4074                                             value="$pf"
4075                                             break
4076                                         fi
4077                                 done
4078                                 ;;
4079                         Directory)
4080                                 for fp in $gfpth; do
4081                                         if test "X$fp" = X.; then
4082                                             dir="$ans"
4083                                             direxp="$ansexp"
4084                                         else    
4085                                             dir="$fp/$ansexp"
4086                                             direxp="$fp/$ansexp"
4087                                         fi
4088                                         if test -d "$direxp"; then
4089                                                 type=''
4090                                                 value="$dir"
4091                                                 break
4092                                         fi
4093                                 done
4094                                 ;;
4095                         Locate)
4096                                 if test -d "$ansexp"; then
4097                                         echo "(Looking for $loc_file in directory $value.)"
4098                                         value="$value/$loc_file"
4099                                         ansexp="$ansexp/$loc_file"
4100                                 fi
4101                                 if test -f "$ansexp"; then
4102                                         type=''
4103                                 fi
4104                                 case "$nopath_ok" in
4105                                 true)   case "$value" in
4106                                         */*) ;;
4107                                         *)      echo "Assuming $value will be in people's path."
4108                                                 type=''
4109                                                 ;;
4110                                         esac
4111                                         ;;
4112                                 esac
4113                                 ;;
4114                         esac
4115
4116                         case "$skip" in
4117                         true) type='';
4118                         esac
4119
4120                         case "$type" in
4121                         '') ;;
4122                         *)
4123                                 if test "$fastread" = yes; then
4124                                         dflt=y
4125                                 else
4126                                         dflt=n
4127                                 fi
4128                                 rp="$what $value doesn't exist.  Use that name anyway?"
4129                                 . UU/myread
4130                                 dflt=''
4131                                 case "$ans" in
4132                                 y*) type='';;
4133                                 *) echo " ";;
4134                                 esac
4135                                 ;;
4136                         esac
4137                         ;;
4138                 esac
4139                 ;;
4140         esac
4141 done
4142 cd UU
4143 ans="$value"
4144 rp="$orig_rp"
4145 dflt="$orig_dflt"
4146 rm -f getfile.ok
4147 test "X$gfpthkeep" != Xy && gfpth=""
4148 EOSC
4149
4150 : What should the include directory be ?
4151 echo " "
4152 $echo $n "Hmm...  $c"
4153 dflt='/usr/include'
4154 incpath=''
4155 mips_type=''
4156 if $test -f /bin/mips && /bin/mips; then
4157         echo "Looks like a MIPS system..."
4158         $cat >usr.c <<'EOCP'
4159 #ifdef SYSTYPE_BSD43
4160 /bsd43
4161 #endif
4162 EOCP
4163         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4164                 dflt='/bsd43/usr/include'
4165                 incpath='/bsd43'
4166                 mips_type='BSD 4.3'
4167         else
4168                 mips_type='System V'
4169         fi
4170         $rm -f usr.c usr.out
4171         echo "and you're compiling with the $mips_type compiler and libraries."
4172         xxx_prompt=y
4173         echo "exit 0" >mips
4174 else
4175         echo "Doesn't look like a MIPS system."
4176         xxx_prompt=n
4177         echo "exit 1" >mips
4178 fi
4179 chmod +x mips
4180 $eunicefix mips
4181 case "$usrinc" in
4182 '') ;;
4183 *) dflt="$usrinc";;
4184 esac
4185 case "$xxx_prompt" in
4186 y)      fn=d/
4187         echo " "
4188         rp='Where are the include files you want to use?'
4189         . ./getfile
4190         usrinc="$ans"
4191         ;;
4192 *)      usrinc="$dflt"
4193         ;;
4194 esac
4195
4196 : see how we invoke the C preprocessor
4197 echo " "
4198 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4199 cat <<'EOT' >testcpp.c
4200 #define ABC abc
4201 #define XYZ xyz
4202 ABC.XYZ
4203 EOT
4204 cd ..
4205 if test ! -f cppstdin; then
4206         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4207                 # AIX cc -E doesn't show the absolute headerfile
4208                 # locations but we'll cheat by using the -M flag.
4209                 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
4210         else
4211                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4212         fi
4213 else
4214         echo "Keeping your $hint cppstdin wrapper."
4215 fi
4216 chmod 755 cppstdin
4217 wrapper=`pwd`/cppstdin
4218 ok='false'
4219 cd UU
4220
4221 if $test "X$cppstdin" != "X" && \
4222         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4223         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4224 then
4225         echo "You used to use $cppstdin $cppminus so we'll use that again."
4226         case "$cpprun" in
4227         '') echo "But let's see if we can live without a wrapper..." ;;
4228         *)
4229                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4230                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4231                 then
4232                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4233                         ok='true'
4234                 else
4235                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4236                 fi
4237                 ;;
4238         esac
4239 else
4240         case "$cppstdin" in
4241         '') ;;
4242         *)
4243                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4244                 ;;
4245         esac
4246 fi
4247
4248 if $ok; then
4249         : nothing
4250 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4251         $cc -E <testcpp.c >testcpp.out 2>&1; \
4252         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4253         echo "Yup, it does."
4254         x_cpp="$cc -E"
4255         x_minus='';
4256 elif echo 'Nope...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"' -P" will work...'; \
4263         $cc -P <testcpp.c >testcpp.out 2>&1; \
4264         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4265         echo "Yipee, that works!"
4266         x_cpp="$cc -P"
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 "At long last!"
4272         x_cpp="$cc -P"
4273         x_minus='-';
4274 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4275         $cpp <testcpp.c >testcpp.out 2>&1; \
4276         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4277         echo "It works!"
4278         x_cpp="$cpp"
4279         x_minus='';
4280 elif echo 'Nixed again...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 "Hooray, it works!  I was beginning to wonder."
4284         x_cpp="$cpp"
4285         x_minus='-';
4286 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4287         $wrapper <testcpp.c >testcpp.out 2>&1; \
4288         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4289         x_cpp="$wrapper"
4290         x_minus=''
4291         echo "Eureka!"
4292 else
4293         dflt=''
4294         rp="No dice.  I can't find a C preprocessor.  Name one:"
4295         . ./myread
4296         x_cpp="$ans"
4297         x_minus=''
4298         $x_cpp <testcpp.c >testcpp.out 2>&1
4299         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4300                 echo "OK, that will do." >&4
4301         else
4302 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4303                 exit 1
4304         fi
4305 fi
4306
4307 case "$ok" in
4308 false)
4309         cppstdin="$x_cpp"
4310         cppminus="$x_minus"
4311         cpprun="$x_cpp"
4312         cpplast="$x_minus"
4313         set X $x_cpp
4314         shift
4315         case "$1" in
4316         "$cpp")
4317                 echo "Perhaps can we force $cc -E using a wrapper..."
4318                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4319                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4320                 then
4321                         echo "Yup, we can."
4322                         cppstdin="$wrapper"
4323                         cppminus='';
4324                 else
4325                         echo "Nope, we'll have to live without it..."
4326                 fi
4327                 ;;
4328         esac
4329         case "$cpprun" in
4330         "$wrapper")
4331                 cpprun=''
4332                 cpplast=''
4333                 ;;
4334         esac
4335         ;;
4336 esac
4337
4338 case "$cppstdin" in
4339 "$wrapper"|'cppstdin') ;;
4340 *) $rm -f $wrapper;;
4341 esac
4342 $rm -f testcpp.c testcpp.out
4343
4344 : Set private lib path
4345 case "$plibpth" in
4346 '') if ./mips; then
4347                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4348         fi;;
4349 esac
4350 case "$libpth" in
4351 ' ') dlist='';;
4352 '') dlist="$loclibpth $plibpth $glibpth";;
4353 *) dlist="$libpth";;
4354 esac
4355
4356 : Now check and see which directories actually exist, avoiding duplicates
4357 libpth=''
4358 for xxx in $dlist
4359 do
4360     if $test -d $xxx; then
4361                 case " $libpth " in
4362                 *" $xxx "*) ;;
4363                 *) libpth="$libpth $xxx";;
4364                 esac
4365     fi
4366 done
4367 $cat <<'EOM'
4368
4369 Some systems have incompatible or broken versions of libraries.  Among
4370 the directories listed in the question below, please remove any you
4371 know not to be holding relevant libraries, and add any that are needed.
4372 Say "none" for none.
4373
4374 EOM
4375 case "$libpth" in
4376 '') dflt='none';;
4377 *)
4378         set X $libpth
4379         shift
4380         dflt=${1+"$@"}
4381         ;;
4382 esac
4383 rp="Directories to use for library searches?"
4384 . ./myread
4385 case "$ans" in
4386 none) libpth=' ';;
4387 *) libpth="$ans";;
4388 esac
4389
4390 : compute shared library extension
4391 case "$so" in
4392 '')
4393         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4394                 dflt='sl'
4395         else
4396                 dflt='so'
4397         fi
4398         ;;
4399 *) dflt="$so";;
4400 esac
4401 $cat <<EOM
4402
4403 On some systems, shared libraries may be available.  Answer 'none' if
4404 you want to suppress searching of shared libraries for the remainder
4405 of this configuration.
4406
4407 EOM
4408 rp='What is the file extension used for shared libraries?'
4409 . ./myread
4410 so="$ans"
4411
4412 : Define several unixisms.
4413 : Hints files or command line option can be used to override them.
4414 : The convoluted testing is in case hints files set either the old
4415 : or the new name.
4416 case "$_exe" in
4417 '')     case "$exe_ext" in
4418         '')     ;;
4419         *)      _exe="$exe_ext" ;;
4420         esac
4421         ;;
4422 esac
4423 case "$_a" in
4424 '')     case "$lib_ext" in
4425     '') _a='.a';;
4426         *)      _a="$lib_ext" ;;
4427         esac
4428         ;;
4429 esac
4430 case "$_o" in
4431 '') case "$obj_ext" in
4432         '')     _o='.o';;
4433         *)      _o="$obj_ext";;
4434         esac
4435         ;;
4436 esac
4437 case "$p_" in
4438 '') case "$path_sep" in
4439         '')     p_=':';;
4440         *)      p_="$path_sep";;
4441         esac
4442         ;;
4443 esac
4444 exe_ext=$_exe
4445 lib_ext=$_a
4446 obj_ext=$_o
4447 path_sep=$p_
4448
4449 : Which makefile gets called first.  This is used by make depend.
4450 case "$firstmakefile" in
4451 '') firstmakefile='makefile';;
4452 esac
4453
4454 : Looking for optional libraries
4455 echo " "
4456 echo "Checking for optional libraries..." >&4
4457 case "$libs" in
4458 ' '|'') dflt='';;
4459 *) dflt="$libs";;
4460 esac
4461 case "$libswanted" in
4462 '') libswanted='c_s';;
4463 esac
4464 case "$usesocks" in
4465 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4466 esac
4467 libsfound=''
4468 libsfiles=''
4469 libsdirs=''
4470 libspath=''
4471 for thisdir in $libpth $xlibpth; do
4472   test -d $thisdir && libspath="$libspath $thisdir"
4473 done
4474 for thislib in $libswanted; do
4475         for thisdir in $libspath; do
4476             xxx=''
4477             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4478                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4479                 $test -f "$xxx" && eval $libscheck
4480                 $test -f "$xxx" && libstyle=shared
4481             fi
4482             if test ! -f "$xxx"; then
4483                 xxx=$thisdir/lib$thislib.$so
4484                 $test -f "$xxx" && eval $libscheck
4485                 $test -f "$xxx" && libstyle=shared
4486             fi  
4487             if test ! -f "$xxx"; then
4488                 xxx=$thisdir/lib$thislib$_a
4489                 $test -f "$xxx" && eval $libscheck
4490                 $test -f "$xxx" && libstyle=static
4491             fi
4492             if test ! -f "$xxx"; then
4493                 xxx=$thisdir/$thislib$_a
4494                 $test -f "$xxx" && eval $libscheck
4495                 $test -f "$xxx" && libstyle=static
4496             fi
4497             if test ! -f "$xxx"; then
4498                 xxx=$thisdir/lib${thislib}_s$_a
4499                 $test -f "$xxx" && eval $libscheck
4500                 $test -f "$xxx" && libstyle=static
4501                 $test -f "$xxx" && thislib=${thislib}_s
4502             fi
4503             if test ! -f "$xxx"; then
4504                 xxx=$thisdir/Slib$thislib$_a
4505                 $test -f "$xxx" && eval $libscheck
4506                 $test -f "$xxx" && libstyle=static
4507             fi
4508             if $test -f "$xxx"; then
4509                 case "$libstyle" in
4510                 shared) echo "Found -l$thislib (shared)." ;;
4511                 static) echo "Found -l$thislib." ;;
4512                 *)      echo "Found -l$thislib ($libstyle)." ;;
4513                 esac
4514                 case " $dflt " in
4515                 *"-l$thislib "*);;
4516                 *) dflt="$dflt -l$thislib"
4517                    libsfound="$libsfound $xxx"
4518                    yyy=`basename $xxx`
4519                    libsfiles="$libsfiles $yyy"
4520                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4521                    case " $libsdirs " in
4522                    *" $yyy "*) ;;
4523                    *) libsdirs="$libsdirs $yyy" ;;
4524                    esac
4525                    ;;
4526                 esac
4527                 break
4528             fi  
4529         done
4530         if $test ! -f "$xxx"; then
4531             echo "No -l$thislib."
4532         fi
4533 done
4534 set X $dflt
4535 shift
4536 dflt="$*"
4537 case "$libs" in
4538 '') dflt="$dflt";;
4539 *) dflt="$libs";;
4540 esac
4541 case "$dflt" in
4542 ' '|'') dflt='none';;
4543 esac
4544
4545 $cat <<EOM
4546
4547 In order to compile $package on your machine, a number of libraries
4548 are usually needed.  Include any other special libraries here as well.
4549 Say "none" for none.  The default list is almost always right.
4550 EOM
4551
4552 echo " "
4553 rp="What libraries to use?"
4554 . ./myread
4555 case "$ans" in
4556 none) libs=' ';;
4557 *) libs="$ans";;
4558 esac
4559
4560 : determine optimization, if desired, or use for debug flag also
4561 case "$optimize" in
4562 ' '|$undef) dflt='none';;
4563 '') dflt='-O';;
4564 *) dflt="$optimize";;
4565 esac
4566 $cat <<EOH
4567
4568 By default, $package compiles with the -O flag to use the optimizer.
4569 Alternately, you might want to use the symbolic debugger, which uses
4570 the -g flag (on traditional Unix systems).  Either flag can be
4571 specified here.  To use neither flag, specify the word "none".
4572
4573 EOH
4574 rp="What optimizer/debugger flag should be used?"
4575 . ./myread
4576 optimize="$ans"
4577 case "$optimize" in
4578 'none') optimize=" ";;
4579 esac
4580
4581 dflt=''
4582 : We will not override a previous value, but we might want to
4583 : augment a hint file
4584 case "$hint" in
4585 default|recommended)
4586         case "$gccversion" in
4587         1*) dflt='-fpcc-struct-return' ;;
4588         esac
4589         case "$optimize" in
4590         *-g*) dflt="$dflt -DDEBUGGING";;
4591         esac
4592         case "$gccversion" in
4593         2*) if test -d /etc/conf/kconfig.d &&
4594                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4595                 then
4596                         dflt="$dflt -posix"
4597                 fi
4598                 ;;
4599         esac
4600         case "$gccversion" in
4601         1*) ;;
4602         2.[0-8]*) ;;
4603         ?*)     echo " "
4604                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4605                 echo 'int main(void) { return 0; }' > gcctest.c
4606                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4607                         echo "Yes, it does." 2>&1
4608                         case "$ccflags" in
4609                         *strict-aliasing*) 
4610                                 echo "Leaving current flags $ccflags alone." 2>&1
4611                                 ;;
4612                         *) dflt="$dflt -fno-strict-aliasing" ;;
4613                         esac
4614                 else
4615                         echo "Nope, it doesn't, but that's ok." 2>&1
4616                 fi
4617                 ;;
4618         esac
4619         ;;
4620 esac
4621
4622 case "$mips_type" in
4623 *BSD*|'') inclwanted="$locincpth $usrinc";;
4624 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4625 esac
4626 for thisincl in $inclwanted; do
4627         if $test -d $thisincl; then
4628                 if $test x$thisincl != x$usrinc; then
4629                         case "$dflt" in
4630                         *" -I$thisincl "*);;
4631                         *) dflt="$dflt -I$thisincl ";;
4632                         esac
4633                 fi
4634         fi
4635 done
4636
4637 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4638         xxx=true;
4639 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4640         xxx=true;
4641 else
4642         xxx=false;
4643 fi;
4644 if $xxx; then
4645         case "$dflt" in
4646         *$2*);;
4647         *) dflt="$dflt -D$2";;
4648         esac;
4649 fi'
4650
4651 set signal.h LANGUAGE_C; eval $inctest
4652
4653 case "$usesocks" in
4654 $define)
4655         ccflags="$ccflags -DSOCKS"
4656         ;;
4657 esac
4658
4659 case "$hint" in
4660 default|recommended) dflt="$ccflags $dflt" ;;
4661 *) dflt="$ccflags";;
4662 esac
4663
4664 case "$dflt" in
4665 ''|' ') dflt=none;;
4666 esac
4667
4668 $cat <<EOH
4669
4670 Your C compiler may want other flags.  For this question you should include
4671 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4672 but you should NOT include libraries or ld flags like -lwhatever.  If you
4673 want $package to honor its debug switch, you should include -DDEBUGGING here.
4674 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4675
4676 To use no flags, specify the word "none".
4677
4678 EOH
4679 set X $dflt
4680 shift
4681 dflt=${1+"$@"}
4682 rp="Any additional cc flags?"
4683 . ./myread
4684 case "$ans" in
4685 none) ccflags='';;
4686 *) ccflags="$ans";;
4687 esac
4688
4689 : the following weeds options from ccflags that are of no interest to cpp
4690 case "$cppflags" in
4691 '') cppflags="$ccflags" ;;
4692 *)  cppflags="$cppflags $ccflags" ;;
4693 esac
4694 case "$gccversion" in
4695 1*) cppflags="$cppflags -D__GNUC__"
4696 esac
4697 case "$mips_type" in
4698 '');;
4699 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4700 esac
4701 case "$cppflags" in
4702 '');;
4703 *)
4704         echo " "
4705         echo "Let me guess what the preprocessor flags are..." >&4
4706         set X $cppflags
4707         shift
4708         cppflags=''
4709         $cat >cpp.c <<'EOM'
4710 #define BLURFL foo
4711
4712 BLURFL xx LFRULB
4713 EOM
4714         previous=''
4715         for flag in $*
4716         do
4717                 case "$flag" in
4718                 -*) ftry="$flag";;
4719                 *) ftry="$previous $flag";;
4720                 esac
4721                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4722                         >cpp1.out 2>/dev/null && \
4723                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4724                         >cpp2.out 2>/dev/null && \
4725                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4726                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4727                 then
4728                         cppflags="$cppflags $ftry"
4729                         previous=''
4730                 else
4731                         previous="$flag"
4732                 fi
4733         done
4734         set X $cppflags
4735         shift
4736         cppflags=${1+"$@"}
4737         case "$cppflags" in
4738         *-*)  echo "They appear to be: $cppflags";;
4739         esac
4740         $rm -f cpp.c cpp?.out
4741         ;;
4742 esac
4743
4744 : flags used in final linking phase
4745 case "$ldflags" in
4746 '') if ./venix; then
4747                 dflt='-i -z'
4748         else
4749                 dflt=''
4750         fi
4751         case "$ccflags" in
4752         *-posix*) dflt="$dflt -posix" ;;
4753         esac
4754         ;;
4755 *) dflt="$ldflags";;
4756 esac
4757
4758 : Try to guess additional flags to pick up local libraries.
4759 for thislibdir in $libpth; do
4760         case " $loclibpth " in
4761         *" $thislibdir "*)
4762                 case "$dflt " in 
4763                 *"-L$thislibdir "*) ;;
4764                 *)  dflt="$dflt -L$thislibdir" ;;
4765                 esac
4766                 ;;
4767         esac
4768 done
4769
4770 case "$dflt" in
4771 '') dflt='none' ;;
4772 esac
4773
4774 $cat <<EOH
4775
4776 Your C linker may need flags.  For this question you should
4777 include -L/whatever and any other flags used by the C linker, but you
4778 should NOT include libraries like -lwhatever.
4779
4780 Make sure you include the appropriate -L/path flags if your C linker
4781 does not normally search all of the directories you specified above,
4782 namely
4783         $libpth
4784 To use no flags, specify the word "none".
4785
4786 EOH
4787
4788 rp="Any additional ld flags (NOT including libraries)?"
4789 . ./myread
4790 case "$ans" in
4791 none) ldflags='';;
4792 *) ldflags="$ans";;
4793 esac
4794 rmlist="$rmlist pdp11"
4795
4796 : coherency check
4797 echo " "
4798 echo "Checking your choice of C compiler and flags for coherency..." >&4
4799 $cat > try.c <<'EOF'
4800 #include <stdio.h>
4801 int main() { printf("Ok\n"); exit(0); }
4802 EOF
4803 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4804 shift
4805 $cat >try.msg <<'EOM'
4806 I've tried to compile and run the following simple program:
4807
4808 EOM
4809 $cat try.c >> try.msg
4810
4811 $cat >> try.msg <<EOM
4812
4813 I used the command:
4814
4815         $*
4816         $run ./try
4817
4818 and I got the following output:
4819
4820 EOM
4821 dflt=y
4822 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4823         if $sh -c "$run ./try" >>try.msg 2>&1; then
4824                 xxx=`$run ./try`
4825                 case "$xxx" in
4826                 "Ok") dflt=n ;;
4827                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4828                         case " $libs " in
4829                         *" -lsfio "*)
4830                                 cat >> try.msg <<'EOQS'
4831 If $libs contains -lsfio, and sfio is mis-configured, then it
4832 sometimes (apparently) runs and exits with a 0 status, but with no
4833 output!  It may have to do with sfio's use of _exit vs. exit.
4834
4835 EOQS
4836                                 rp="You have a big problem.  Shall I abort Configure"
4837                                 dflt=y
4838                                 ;;
4839                         esac
4840                         ;;
4841                 esac
4842         else
4843                 echo "The program compiled OK, but exited with status $?." >>try.msg
4844                 rp="You have a problem.  Shall I abort Configure"
4845                 dflt=y
4846         fi
4847 else
4848         echo "I can't compile the test program." >>try.msg
4849         rp="You have a BIG problem.  Shall I abort Configure"
4850         dflt=y
4851 fi
4852 case "$dflt" in
4853 y)
4854         $cat try.msg >&4
4855         case "$knowitall" in
4856         '')
4857                 echo "(The supplied flags or libraries might be incorrect.)"
4858                 ;;
4859         *) dflt=n;;
4860         esac
4861         echo " "
4862         . ./myread
4863         case "$ans" in
4864         n*|N*) ;;
4865         *)      echo "Ok.  Stopping Configure." >&4
4866                 exit 1
4867                 ;;
4868         esac
4869         ;;
4870 n) echo "OK, that should do.";;
4871 esac
4872 $rm -f try try.* core
4873
4874 : define a shorthand compile call
4875 compile='
4876 mc_file=$1;
4877 shift;
4878 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4879 : define a shorthand compile call for compilations that should be ok.
4880 compile_ok='
4881 mc_file=$1;
4882 shift;
4883 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4884
4885 : check for lengths of integral types
4886 echo " "
4887 case "$intsize" in
4888 '')
4889         echo "Checking to see how big your integers are..." >&4
4890         $cat >try.c <<'EOCP'
4891 #include <stdio.h>
4892 int main()
4893 {
4894         printf("intsize=%d;\n", (int)sizeof(int));
4895         printf("longsize=%d;\n", (int)sizeof(long));
4896         printf("shortsize=%d;\n", (int)sizeof(short));
4897         exit(0);
4898 }
4899 EOCP
4900         set try
4901         if eval $compile_ok && $run ./try > /dev/null; then
4902                 eval `$run ./try`
4903                 echo "Your integers are $intsize bytes long."
4904                 echo "Your long integers are $longsize bytes long."
4905                 echo "Your short integers are $shortsize bytes long."
4906         else
4907                 $cat >&4 <<EOM
4908 !
4909 Help! I can't compile and run the intsize test program: please enlighten me!
4910 (This is probably a misconfiguration in your system or libraries, and
4911 you really ought to fix it.  Still, I'll try anyway.)
4912 !
4913 EOM
4914                 dflt=4
4915                 rp="What is the size of an integer (in bytes)?"
4916                 . ./myread
4917                 intsize="$ans"
4918                 dflt=$intsize
4919                 rp="What is the size of a long integer (in bytes)?"
4920                 . ./myread
4921                 longsize="$ans"
4922                 dflt=2
4923                 rp="What is the size of a short integer (in bytes)?"
4924                 . ./myread
4925                 shortsize="$ans"
4926         fi
4927         ;;
4928 esac
4929 $rm -f try try.*
4930
4931 : check for long long
4932 echo " "
4933 echo "Checking to see if you have long long..." >&4
4934 echo 'int main() { long long x = 7; return 0; }' > try.c
4935 set try
4936 if eval $compile; then
4937         val="$define"
4938         echo "You have long long."
4939 else
4940         val="$undef"
4941         echo "You do not have long long."
4942 fi
4943 $rm try.*
4944 set d_longlong
4945 eval $setvar
4946
4947 : check for length of long long
4948 case "${d_longlong}${longlongsize}" in
4949 $define)
4950         echo " "
4951         echo "Checking to see how big your long longs are..." >&4
4952         $cat >try.c <<'EOCP'
4953 #include <stdio.h>
4954 int main()
4955 {
4956     printf("%d\n", (int)sizeof(long long));
4957     return(0);
4958 }
4959 EOCP
4960         set try
4961         if eval $compile_ok; then
4962                 longlongsize=`$run ./try`
4963                 echo "Your long longs are $longlongsize bytes long."
4964         else
4965                 dflt='8'
4966                 echo " "
4967                 echo "(I can't seem to compile the test program.  Guessing...)"
4968                 rp="What is the size of a long long (in bytes)?"
4969                 . ./myread
4970                 longlongsize="$ans"
4971         fi
4972         if $test "X$longsize" = "X$longlongsize"; then
4973                 echo "(That isn't any different from an ordinary long.)"
4974         fi      
4975         ;;
4976 esac
4977 $rm -f try.* try
4978
4979 : determine filename position in cpp output
4980 echo " "
4981 echo "Computing filename position in cpp output for #include directives..." >&4
4982 case "$osname" in
4983 vos) testaccess=-e ;;
4984 *)   testaccess=-r ;;
4985 esac
4986 echo '#include <stdio.h>' > foo.c
4987 $cat >fieldn <<EOF
4988 $startsh
4989 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4990 $grep '^[       ]*#.*stdio\.h' | \
4991 while read cline; do
4992         pos=1
4993         set \$cline
4994         while $test \$# -gt 0; do
4995                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
4996                         echo "\$pos"
4997                         exit 0
4998                 fi
4999                 shift
5000                 pos=\`expr \$pos + 1\`
5001         done
5002 done
5003 EOF
5004 chmod +x fieldn
5005 fieldn=`./fieldn`
5006 $rm -f foo.c fieldn
5007 case $fieldn in
5008 '') pos='???';;
5009 1) pos=first;;
5010 2) pos=second;;
5011 3) pos=third;;
5012 *) pos="${fieldn}th";;
5013 esac
5014 echo "Your cpp writes the filename in the $pos field of the line."
5015
5016 case "$osname" in
5017 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5018 *)   cppfilter='' ;;
5019 esac
5020 : locate header file
5021 $cat >findhdr <<EOF
5022 $startsh
5023 wanted=\$1
5024 name=''
5025 for usrincdir in $usrinc
5026 do
5027         if test -f \$usrincdir/\$wanted; then
5028                 echo "\$usrincdir/\$wanted"
5029                 exit 0
5030         fi
5031 done
5032 awkprg='{ print \$$fieldn }'
5033 echo "#include <\$wanted>" > foo\$\$.c
5034 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5035 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5036 while read cline; do
5037         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5038         case "\$name" in
5039         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5040         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5041         *) exit 2;;
5042         esac;
5043 done;
5044 #
5045 # status = 0: grep returned 0 lines, case statement not executed
5046 # status = 1: headerfile found
5047 # status = 2: while loop executed, no headerfile found
5048 #
5049 status=\$?
5050 $rm -f foo\$\$.c;
5051 if test \$status -eq 1; then
5052         exit 0;
5053 fi
5054 exit 1
5055 EOF
5056 chmod +x findhdr
5057
5058 : define an alternate in-header-list? function
5059 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5060 cont=true; xxf="echo \"<\$1> found.\" >&4";
5061 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5062 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5063 esac;
5064 case $# in 4) instead=instead;; *) instead="at last";; esac;
5065 while $test "$cont"; do
5066         xxx=`./findhdr $1`
5067         var=$2; eval "was=\$$2";
5068         if $test "$xxx" && $test -r "$xxx";
5069         then eval $xxf;
5070         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5071                 cont="";
5072         else eval $xxnf;
5073         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5074         set $yyy; shift; shift; yyy=$@;
5075         case $# in 0) cont="";;
5076         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5077                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5078         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5079                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5080         esac;
5081 done;
5082 while $test "$yyy";
5083 do set $yyy; var=$2; eval "was=\$$2";
5084         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5085         set $yyy; shift; shift; yyy=$@;
5086 done'
5087
5088 : see if inttypes.h is available
5089 : we want a real compile instead of Inhdr because some systems
5090 : have an inttypes.h which includes non-existent headers
5091 echo " "
5092 $cat >try.c <<EOCP
5093 #include <inttypes.h>
5094 int main() {
5095         static int32_t foo32 = 0x12345678;
5096 }
5097 EOCP
5098 set try
5099 if eval $compile; then
5100         echo "<inttypes.h> found." >&4
5101         val="$define"
5102 else
5103         echo "<inttypes.h> NOT found." >&4
5104         val="$undef"
5105 fi
5106 $rm -f try.c try
5107 set i_inttypes
5108 eval $setvar
5109
5110 : check for int64_t
5111 echo " "
5112 echo "Checking to see if you have int64_t..." >&4
5113 $cat >try.c <<EOCP
5114 #include <sys/types.h>
5115 #$i_inttypes I_INTTYPES
5116 #ifdef I_INTTYPES
5117 #include <inttypes.h>
5118 #endif
5119 int main() { int64_t x = 7; }
5120 EOCP
5121 set try
5122 if eval $compile; then
5123         val="$define"
5124         echo "You have int64_t."
5125 else
5126         val="$undef"
5127         echo "You do not have int64_t."
5128 fi
5129 $rm -f try try.*
5130 set d_int64_t
5131 eval $setvar
5132
5133
5134 echo " "
5135 echo "Checking which 64-bit integer type we could use..." >&4
5136
5137 case "$intsize" in
5138 8) val=int
5139    set quadtype
5140    eval $setvar
5141    val='"unsigned int"'
5142    set uquadtype
5143    eval $setvar
5144    quadkind=1
5145    ;;
5146 *) case "$longsize" in
5147    8) val=long
5148       set quadtype
5149       eval $setvar
5150       val='"unsigned long"'
5151       set uquadtype
5152       eval $setvar
5153       quadkind=2
5154       ;;
5155    *) case "$d_longlong:$longlongsize" in
5156       define:8)
5157         val='"long long"'
5158         set quadtype
5159         eval $setvar
5160         val='"unsigned long long"'
5161         set uquadtype
5162         eval $setvar
5163         quadkind=3
5164         ;;
5165       *) case "$d_int64_t" in
5166          define)
5167            val=int64_t
5168            set quadtype
5169            eval $setvar
5170            val=uint64_t
5171            set uquadtype
5172            eval $setvar
5173            quadkind=4
5174            ;;
5175          esac
5176          ;;
5177       esac
5178       ;;
5179    esac
5180    ;;
5181 esac
5182
5183 case "$quadtype" in
5184 '')     echo "Alas, no 64-bit integer types in sight." >&4
5185         d_quad="$undef"
5186         ;;
5187 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5188         d_quad="$define"
5189         ;;
5190 esac
5191
5192
5193 case "$uselonglong" in
5194 "$define"|true|[yY]*)
5195         cat <<EOM >&4
5196
5197 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5198 EOM
5199         use64bitint="$define"
5200         ;;
5201 esac                          
5202 case "$use64bits" in
5203 "$define"|true|[yY]*)
5204         cat <<EOM >&4
5205
5206 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5207 EOM
5208         use64bitint="$define"
5209         ;;
5210 esac                          
5211 case "$use64bitints" in
5212 "$define"|true|[yY]*)
5213         cat <<EOM >&4
5214
5215 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5216 EOM
5217         use64bitint="$define"
5218         ;;
5219 esac                          
5220 case "$use64bitsint" in
5221 "$define"|true|[yY]*)
5222         cat <<EOM >&4
5223
5224 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5225 EOM
5226         use64bitint="$define"
5227         ;;
5228 esac                          
5229 case "$uselonglongs" in
5230 "$define"|true|[yY]*)
5231         cat <<EOM >&4
5232
5233 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5234 EOM
5235         use64bitint="$define"
5236         ;;
5237 esac                          
5238 case "$use64bitsall" in
5239 "$define"|true|[yY]*)
5240         cat <<EOM >&4
5241
5242 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5243 EOM
5244         use64bitall="$define"
5245         ;;
5246 esac                          
5247
5248 case "$ccflags" in
5249 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5250 esac
5251 case "$use64bitall" in
5252 "$define"|true|[yY]*) use64bitint="$define" ;;
5253 esac
5254
5255 case "$longsize" in
5256 8) cat <<EOM
5257
5258 You have natively 64-bit long integers.
5259 EOM
5260    val="$define"
5261    ;;
5262 *) case "$use64bitint" in
5263    "$define"|true|[yY]*) dflt='y';;
5264    *) dflt='n';;
5265    esac
5266    case "$d_quad" in
5267    "$define") ;;
5268    *) dflt='n' ;;
5269    esac
5270    cat <<EOM
5271
5272 Perl can be built to take advantage of 64-bit integer types
5273 on some systems.  To do so, Configure can be run with -Duse64bitint.
5274 Choosing this option will most probably introduce binary incompatibilities.
5275
5276 If this doesn't make any sense to you, just accept the default '$dflt'.
5277 (The default has been chosen based on your configuration.)
5278 EOM
5279    rp='Try to use 64-bit integers, if available?'
5280    . ./myread
5281    case "$ans" in
5282    [yY]*) val="$define" ;;
5283    *)     val="$undef"  ;;
5284    esac
5285    ;;
5286 esac
5287 set use64bitint
5288 eval $setvar
5289
5290 case "$use64bitall" in
5291 "$define"|true|[yY]*) dflt='y' ;;
5292 *) case "$longsize" in
5293    8) dflt='y' ;;
5294    *) dflt='n' ;;
5295    esac
5296    ;;
5297 esac    
5298 cat <<EOM
5299
5300 You may also choose to try maximal 64-bitness.  It means using as much
5301 64-bitness as possible on the platform.  This in turn means even more
5302 binary incompatibilities.  On the other hand, your platform may not
5303 have any more 64-bitness available than what you already have chosen.
5304
5305 If this doesn't make any sense to you, just accept the default '$dflt'.
5306 (The default has been chosen based on your configuration.)
5307 EOM
5308 rp='Try to use maximal 64-bit support, if available?'
5309 . ./myread
5310 case "$ans" in
5311 [yY]*) val="$define" ;;
5312 *)     val="$undef"  ;;
5313 esac
5314 set use64bitall
5315 eval $setvar
5316 case "$use64bitall" in
5317 "$define")
5318         case "$use64bitint" in
5319         "$undef")
5320                 cat <<EOM
5321
5322 Since you have chosen a maximally 64-bit build, I'm also turning on
5323 the use of 64-bit integers.
5324 EOM
5325                 use64bitint="$define" ;;
5326         esac
5327         ;;
5328 esac
5329
5330 case "$use64bitint" in
5331 "$define"|true|[yY]*)
5332 : Look for a hint-file generated 'call-back-unit'.  If the
5333 : user has specified that a 64-bit perl is to be built,
5334 : we may need to set or change some other defaults.
5335         if $test -f use64bitint.cbu; then
5336                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5337                 . ./use64bitint.cbu
5338         fi
5339         case "$longsize" in
5340         4) case "$archname64" in
5341            '') archname64=64int ;;
5342            esac
5343            ;;
5344         esac
5345         ;;
5346 esac
5347
5348 case "$use64bitall" in
5349 "$define"|true|[yY]*)
5350 : Look for a hint-file generated 'call-back-unit'.  If the
5351 : user has specified that a maximally 64-bit perl is to be built,
5352 : we may need to set or change some other defaults.
5353         if $test -f use64bitall.cbu; then
5354                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5355                 . ./use64bitall.cbu
5356         fi
5357         case "$longsize" in
5358         4) case "$archname64" in
5359            ''|64int) archname64=64all ;;
5360            esac
5361            ;;
5362         esac
5363         ;;
5364 esac
5365
5366 echo " "
5367 echo "Checking for GNU C Library..." >&4
5368 cat >try.c <<'EOCP'
5369 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
5370    alone are insufficient to distinguish different versions, such as
5371    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
5372    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
5373 */
5374 #include <stdio.h>
5375 int main(void)
5376 {
5377 #ifdef __GLIBC__
5378 #   ifdef __GLIBC_MINOR__
5379 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
5380 #           include <gnu/libc-version.h>
5381             printf("%s\n",  gnu_get_libc_version());
5382 #       else
5383             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
5384 #       endif
5385 #   else
5386         printf("%d\n",  __GLIBC__);
5387 #   endif
5388     return 0;
5389 #else
5390     return 1;
5391 #endif
5392 }
5393 EOCP
5394 set try
5395 if eval $compile_ok && $run ./try > glibc.ver; then
5396         val="$define"
5397         gnulibc_version=`$cat glibc.ver`
5398         echo "You are using the GNU C Library version $gnulibc_version"
5399 else
5400         val="$undef"
5401         gnulibc_version=''
5402         echo "You are not using the GNU C Library"
5403 fi
5404 $rm -f try try.* glibc.ver
5405 set d_gnulibc
5406 eval $setvar
5407
5408 : see if nm is to be used to determine whether a symbol is defined or not
5409 case "$usenm" in
5410 '')
5411         dflt=''
5412         case "$d_gnulibc" in
5413         "$define")
5414                 echo " "
5415                 echo "nm probably won't work on the GNU C Library." >&4
5416                 dflt=n
5417                 ;;
5418         esac
5419         case "$dflt" in
5420         '') 
5421                 if $test "$osname" = aix -a "X$PASE" != "$Xdefine" -a ! -f /lib/syscalls.exp; then
5422                         echo " "
5423                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5424                         echo "'nm' won't be sufficient on this sytem." >&4
5425                         dflt=n
5426                 fi
5427                 ;;
5428         esac
5429         case "$dflt" in
5430         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5431                 if $test $dflt -gt 20; then
5432                         dflt=y
5433                 else
5434                         dflt=n
5435                 fi
5436                 ;;
5437         esac
5438         ;;
5439 *)
5440         case "$usenm" in
5441         true|$define) dflt=y;;
5442         *) dflt=n;;
5443         esac
5444         ;;
5445 esac
5446 $cat <<EOM
5447
5448 I can use $nm to extract the symbols from your C libraries. This
5449 is a time consuming task which may generate huge output on the disk (up
5450 to 3 megabytes) but that should make the symbols extraction faster. The
5451 alternative is to skip the 'nm' extraction part and to compile a small
5452 test program instead to determine whether each symbol is present. If
5453 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5454 this may be the best solution.
5455
5456 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5457
5458 EOM
5459 rp="Shall I use $nm to extract C symbols from the libraries?"
5460 . ./myread
5461 case "$ans" in
5462 [Nn]*) usenm=false;;
5463 *) usenm=true;;
5464 esac
5465
5466 runnm=$usenm
5467 case "$reuseval" in
5468 true) runnm=false;;
5469 esac
5470
5471 : nm options which may be necessary
5472 case "$nm_opt" in
5473 '') if $test -f /mach_boot; then
5474                 nm_opt=''       # Mach
5475         elif $test -d /usr/ccs/lib; then
5476                 nm_opt='-p'     # Solaris (and SunOS?)
5477         elif $test -f /dgux; then
5478                 nm_opt='-p'     # DG-UX
5479         elif $test -f /lib64/rld; then
5480                 nm_opt='-p'     # 64-bit Irix
5481         else
5482                 nm_opt=''
5483         fi;;
5484 esac
5485
5486 : nm options which may be necessary for shared libraries but illegal
5487 : for archive libraries.  Thank you, Linux.
5488 case "$nm_so_opt" in
5489 '')     case "$myuname" in
5490         *linux*)
5491                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5492                         nm_so_opt='--dynamic'
5493                 fi
5494                 ;;
5495         esac
5496         ;;
5497 esac
5498
5499 case "$runnm" in
5500 true)
5501 : get list of predefined functions in a handy place
5502 echo " "
5503 case "$libc" in
5504 '') libc=unknown
5505         case "$libs" in
5506         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5507         esac
5508         ;;
5509 esac
5510 case "$libs" in
5511 '') ;;
5512 *)  for thislib in $libs; do
5513         case "$thislib" in
5514         -lc|-lc_s)
5515                 : Handle C library specially below.
5516                 ;;
5517         -l*)
5518                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5519                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5520                         :
5521                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5522                         :
5523                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5524                         :
5525                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5526                         :
5527                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5528                         :
5529                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5530                         :
5531                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5532                         :
5533                 else
5534                         try=''
5535                 fi
5536                 libnames="$libnames $try"
5537                 ;;
5538         *) libnames="$libnames $thislib" ;;
5539         esac
5540         done
5541         ;;
5542 esac
5543 xxx=normal
5544 case "$libc" in
5545 unknown)
5546         set /lib/libc.$so
5547         for xxx in $libpth; do
5548                 $test -r $1 || set $xxx/libc.$so
5549                 : The messy sed command sorts on library version numbers.
5550                 $test -r $1 || \
5551                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5552                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5553                                 h
5554                                 s/[0-9][0-9]*/0000&/g
5555                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5556                                 G
5557                                 s/\n/ /' | \
5558                          $sort | $sed -e 's/^.* //'`
5559                 eval set \$$#
5560         done
5561         $test -r $1 || set /usr/ccs/lib/libc.$so
5562         $test -r $1 || set /lib/libsys_s$_a
5563         ;;
5564 *)
5565         set blurfl
5566         ;;
5567 esac
5568 if $test -r "$1"; then
5569         echo "Your (shared) C library seems to be in $1."
5570         libc="$1"
5571 elif $test -r /lib/libc && $test -r /lib/clib; then
5572         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5573         xxx=apollo
5574         libc='/lib/clib /lib/libc'
5575         if $test -r /lib/syslib; then
5576                 echo "(Your math library is in /lib/syslib.)"
5577                 libc="$libc /lib/syslib"
5578         fi
5579 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5580         echo "Your C library seems to be in $libc, as you said before."
5581 elif $test -r $incpath/usr/lib/libc$_a; then
5582         libc=$incpath/usr/lib/libc$_a;
5583         echo "Your C library seems to be in $libc.  That's fine."
5584 elif $test -r /lib/libc$_a; then
5585         libc=/lib/libc$_a;
5586         echo "Your C library seems to be in $libc.  You're normal."
5587 else
5588         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5589                 :
5590         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5591                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5592         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5593                 :
5594         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5595                 :
5596         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5597                 :
5598         else
5599                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5600         fi
5601         if $test -r "$tans"; then
5602                 echo "Your C library seems to be in $tans, of all places."
5603                 libc=$tans
5604         else
5605                 libc='blurfl'
5606         fi
5607 fi
5608 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5609         dflt="$libc"
5610         cat <<EOM
5611
5612 If the guess above is wrong (which it might be if you're using a strange
5613 compiler, or your machine supports multiple models), you can override it here.
5614
5615 EOM
5616 else
5617         dflt=''
5618         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5619         cat >&4 <<EOM
5620 I can't seem to find your C library.  I've looked in the following places:
5621
5622 EOM
5623         $sed 's/^/      /' libpath
5624         cat <<EOM
5625
5626 None of these seems to contain your C library. I need to get its name...
5627
5628 EOM
5629 fi
5630 fn=f
5631 rp='Where is your C library?'
5632 . ./getfile
5633 libc="$ans"
5634
5635 echo " "
5636 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5637 set X `cat libnames`
5638 shift
5639 xxx=files
5640 case $# in 1) xxx=file; esac
5641 echo "Extracting names from the following $xxx for later perusal:" >&4
5642 echo " "
5643 $sed 's/^/      /' libnames >&4
5644 echo " "
5645 $echo $n "This may take a while...$c" >&4
5646
5647 for file in $*; do
5648         case $file in
5649         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5650         *) $nm $nm_opt $file 2>/dev/null;;
5651         esac
5652 done >libc.tmp
5653
5654 $echo $n ".$c"
5655 $grep fprintf libc.tmp > libc.ptf
5656 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5657 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
5658 xxx='[ADTSIW]'
5659 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5660         eval $xscan;\
5661         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5662                 eval $xrun
5663 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5664         eval $xscan;\
5665         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5666                 eval $xrun
5667 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5668         eval $xscan;\
5669         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5670                 eval $xrun
5671 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5672         eval $xscan;\
5673         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5674                 eval $xrun
5675 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5676         eval $xscan;\
5677         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5678                 eval $xrun
5679 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5680         eval $xscan;\
5681         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5682                 eval $xrun
5683 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5684                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5685         eval $xscan;\
5686         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5687                 eval $xrun
5688 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5689         eval $xscan;\
5690         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5691                 eval $xrun
5692 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5693         eval $xscan;\
5694         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5695                 eval $xrun
5696 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5697         eval $xscan;\
5698         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5699                 eval $xrun
5700 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5701         eval $xscan;\
5702         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5703                 eval $xrun
5704 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5705         eval $xscan;\
5706         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5707                 eval $xrun
5708 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5709         eval $xscan;\
5710         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5711                 eval $xrun
5712 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5713         eval $xscan;\
5714         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5715                 eval $xrun
5716 else
5717         $nm -p $* 2>/dev/null >libc.tmp
5718         $grep fprintf libc.tmp > libc.ptf
5719         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5720                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5721         then
5722                 nm_opt='-p'
5723                 eval $xrun
5724         else
5725                 echo " "
5726                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5727                 com=''
5728                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5729                         for thisname in $libnames $libc; do
5730                                 $ar t $thisname >>libc.tmp
5731                         done
5732                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5733                         echo "Ok." >&4
5734                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5735                         # Repeat libc to extract forwarders to DLL entries too
5736                         for thisname in $libnames $libc; do
5737                                 $ar tv $thisname >>libc.tmp
5738                                 # Revision 50 of EMX has bug in $ar.
5739                                 # it will not extract forwarders to DLL entries
5740                                 # Use emximp which will extract exactly them.
5741                                 emximp -o tmp.imp $thisname \
5742                                     2>/dev/null && \
5743                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5744                                     < tmp.imp >>libc.tmp
5745                                 $rm tmp.imp
5746                         done
5747                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5748                         echo "Ok." >&4
5749                 else
5750                         echo "$ar didn't seem to work right." >&4
5751                         echo "Maybe this is a Cray...trying bld instead..." >&4
5752                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5753                         then
5754                                 for thisname in $libnames; do
5755                                         bld t $libnames | \
5756                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5757                                         $ar t $thisname >>libc.tmp
5758                                 done
5759                                 echo "Ok." >&4
5760                         else
5761                                 echo "That didn't work either.  Giving up." >&4
5762                                 exit 1
5763                         fi
5764                 fi
5765         fi
5766 fi
5767 nm_extract="$com"
5768 case "$PASE" in
5769 define)
5770     echo " "
5771     echo "Since you are compiling for PASE, extracting more symbols from libc.a...">&4
5772     nm -Tv /lib/libc.a | grep '^\.[a-z]' | awk '$2 == "T" {print $1}' | sed 's/^.//' >> libc.list
5773     ;;
5774 *)  if $test -f /lib/syscalls.exp; then
5775         echo " "
5776         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5777         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
5778     fi
5779     ;;
5780 esac
5781 ;;
5782 esac
5783 $rm -f libnames libpath
5784
5785 : is a C symbol defined?
5786 csym='tlook=$1;
5787 case "$3" in
5788 -v) tf=libc.tmp; tc=""; tdc="";;
5789 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5790 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5791 esac;
5792 tx=yes;
5793 case "$reuseval-$4" in
5794 true-) ;;
5795 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5796 esac;
5797 case "$tx" in
5798 yes)
5799         case "$runnm" in
5800         true)
5801                 if $contains $tlook $tf >/dev/null 2>&1;
5802                 then tval=true;
5803                 else tval=false;
5804                 fi;;
5805         *)
5806                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5807                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5808                 then tval=true;
5809                 else tval=false;
5810                 fi;
5811                 $rm -f t t.c;;
5812         esac;;
5813 *)
5814         case "$tval" in
5815         $define) tval=true;;
5816         *) tval=false;;
5817         esac;;
5818 esac;
5819 eval "$2=$tval"'
5820
5821 : define an is-in-libc? function
5822 inlibc='echo " "; td=$define; tu=$undef;
5823 sym=$1; var=$2; eval "was=\$$2";
5824 tx=yes;
5825 case "$reuseval$was" in
5826 true) ;;
5827 true*) tx=no;;
5828 esac;
5829 case "$tx" in
5830 yes)
5831         set $sym tres -f;
5832         eval $csym;
5833         case "$tres" in
5834         true)
5835                 echo "$sym() found." >&4;
5836                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5837         *)
5838                 echo "$sym() NOT found." >&4;
5839                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5840         esac;;
5841 *)
5842         case "$was" in
5843         $define) echo "$sym() found." >&4;;
5844         *) echo "$sym() NOT found." >&4;;
5845         esac;;
5846 esac'
5847
5848 : see if sqrtl exists
5849 set sqrtl d_sqrtl
5850 eval $inlibc
5851
5852 : check for length of double
5853 echo " "
5854 case "$doublesize" in
5855 '')
5856         echo "Checking to see how big your double precision numbers are..." >&4
5857         $cat >try.c <<'EOCP'
5858 #include <stdio.h>
5859 int main()
5860 {
5861     printf("%d\n", (int)sizeof(double));
5862     exit(0);
5863 }
5864 EOCP
5865         set try
5866         if eval $compile_ok; then
5867                 doublesize=`$run ./try`
5868                 echo "Your double is $doublesize bytes long."
5869         else
5870                 dflt='8'
5871                 echo "(I can't seem to compile the test program.  Guessing...)"
5872                 rp="What is the size of a double precision number (in bytes)?"
5873                 . ./myread
5874                 doublesize="$ans"
5875         fi
5876         ;;
5877 esac
5878 $rm -f try.c try
5879
5880 : check for long doubles
5881 echo " "
5882 echo "Checking to see if you have long double..." >&4
5883 echo 'int main() { long double x = 7.0; }' > try.c
5884 set try
5885 if eval $compile; then
5886         val="$define"
5887         echo "You have long double."
5888 else
5889         val="$undef"
5890         echo "You do not have long double."
5891 fi
5892 $rm try.*
5893 set d_longdbl
5894 eval $setvar
5895
5896 : check for length of long double
5897 case "${d_longdbl}${longdblsize}" in
5898 $define)
5899         echo " "
5900         echo "Checking to see how big your long doubles are..." >&4
5901         $cat >try.c <<'EOCP'
5902 #include <stdio.h>
5903 int main()
5904 {
5905         printf("%d\n", sizeof(long double));
5906 }
5907 EOCP
5908         set try
5909         set try
5910         if eval $compile; then
5911                 longdblsize=`$run ./try`
5912                 echo "Your long doubles are $longdblsize bytes long."
5913         else
5914                 dflt='8'
5915                 echo " "
5916                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5917                 rp="What is the size of a long double (in bytes)?"
5918                 . ./myread
5919                 longdblsize="$ans"
5920         fi
5921         if $test "X$doublesize" = "X$longdblsize"; then
5922                 echo "(That isn't any different from an ordinary double.)"
5923         fi      
5924         ;;
5925 esac
5926 $rm -f try.* try
5927
5928 echo " "
5929
5930 if $test X"$d_longdbl" = X"$define"; then
5931
5932 echo "Checking how to print long doubles..." >&4
5933
5934 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
5935         $cat >try.c <<'EOCP'
5936 #include <sys/types.h>
5937 #include <stdio.h>
5938 int main() {
5939   double d = 123.456;
5940   printf("%.3f\n", d);
5941 }
5942 EOCP
5943         set try
5944         if eval $compile; then
5945                 yyy=`$run ./try`
5946                 case "$yyy" in
5947                 123.456)
5948                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
5949                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
5950                         echo "We will use %f."
5951                         ;;
5952                 esac
5953         fi
5954 fi
5955
5956 if $test X"$sPRIfldbl" = X; then
5957         $cat >try.c <<'EOCP'
5958 #include <sys/types.h>
5959 #include <stdio.h>
5960 int main() {
5961   long double d = 123.456;
5962   printf("%.3Lf\n", d);
5963 }
5964 EOCP
5965         set try
5966         if eval $compile; then
5967                 yyy=`$run ./try`
5968                 case "$yyy" in
5969                 123.456)
5970                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
5971                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
5972                         echo "We will use %Lf."
5973                         ;;
5974                 esac
5975         fi
5976 fi
5977
5978 if $test X"$sPRIfldbl" = X; then
5979         $cat >try.c <<'EOCP'
5980 #include <sys/types.h>
5981 #include <stdio.h>
5982 int main() {
5983   long double d = 123.456;
5984   printf("%.3llf\n", d);
5985 }
5986 EOCP
5987         set try
5988         if eval $compile; then
5989                 yyy=`$run ./try`
5990                 case "$yyy" in
5991                 123.456)
5992                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
5993                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
5994                         echo "We will use %llf."
5995                         ;;
5996                 esac
5997         fi
5998 fi
5999
6000 if $test X"$sPRIfldbl" = X; then
6001         $cat >try.c <<'EOCP'
6002 #include <sys/types.h>
6003 #include <stdio.h>
6004 int main() {
6005   long double d = 123.456;
6006   printf("%.3lf\n", d);
6007 }
6008 EOCP
6009         set try
6010         if eval $compile; then
6011                 yyy=`$run ./try`
6012                 case "$yyy" in
6013                 123.456)
6014                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
6015                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
6016                         echo "We will use %lf."
6017                         ;;
6018                 esac
6019         fi
6020 fi
6021
6022 if $test X"$sPRIfldbl" = X; then
6023         echo "Cannot figure out how to print long doubles." >&4
6024 else
6025         sSCNfldbl=$sPRIfldbl    # expect consistency
6026 fi
6027
6028 $rm -f try try.*
6029
6030 fi # d_longdbl
6031
6032 case "$sPRIfldbl" in
6033 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
6034         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
6035         d_SCNfldbl="$undef";
6036         ;;
6037 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
6038         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
6039         d_SCNfldbl="$define";
6040         ;;
6041 esac
6042
6043 : see if modfl exists
6044 set modfl d_modfl
6045 eval $inlibc
6046
6047
6048 hasproto='varname=$1; func=$2; shift; shift;
6049 while $test $# -ge 2; do
6050         case "$1" in
6051         $define) echo "#include <$2>";;
6052         esac ;
6053     shift 2;
6054 done > try.c;
6055 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
6056 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
6057         echo "$func() prototype found.";
6058         val="$define";
6059 else
6060         echo "$func() prototype NOT found.";
6061         val="$undef";
6062 fi;
6063 set $varname;
6064 eval $setvar;
6065 $rm -f try.c tryout.c'
6066
6067 : see if prototype for modfl is available
6068 echo " "
6069 set d_modflproto modfl math.h
6070 eval $hasproto
6071
6072 d_modfl_pow32_bug="$undef"
6073
6074 case "$d_longdbl$d_modfl" in
6075 $define$define)
6076         $cat <<EOM
6077 Checking to see whether your modfl() is okay for large values...
6078 EOM
6079 $cat >try.c <<EOCP
6080 #include <math.h> 
6081 #include <stdio.h>
6082 EOCP
6083 if $test "X$d_modflproto" != "X$define"; then
6084         $cat >>try.c <<EOCP
6085 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
6086 long double modfl (long double, long double *);
6087 EOCP
6088 fi
6089 $cat >>try.c <<EOCP
6090 int main() {
6091     long double nv = 4294967303.15;
6092     long double v, w;
6093     v = modfl(nv, &w);         
6094 #ifdef __GLIBC__
6095     printf("glibc");
6096 #endif
6097     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
6098     return 0;
6099 }
6100 EOCP
6101         case "$osname:$gccversion" in
6102         aix:)   saveccflags="$ccflags"
6103                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
6104         esac
6105         set try
6106         if eval $compile; then
6107                 foo=`$run ./try`
6108                 case "$foo" in
6109                 *" 4294967303.150000 1.150000 4294967302.000000")
6110                         echo >&4 "Your modfl() is broken for large values."
6111                         d_modfl_pow32_bug="$define"
6112                         case "$foo" in
6113                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
6114                         ;;
6115                         esac
6116                         ;;
6117                 *" 4294967303.150000 0.150000 4294967303.000000")
6118                         echo >&4 "Your modfl() seems okay for large values."
6119                         ;;
6120                 *)      echo >&4 "I don't understand your modfl() at all."
6121                         d_modfl="$undef"
6122                         ;;
6123                 esac
6124                 $rm -f try.* try core core.try.*
6125         else
6126                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
6127                 d_modfl="$undef"
6128         fi
6129         case "$osname:$gccversion" in
6130         aix:)   ccflags="$saveccflags" ;; # restore
6131         esac
6132         ;;
6133 esac
6134
6135 case "$ccflags" in
6136 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6137 esac
6138
6139 case "$uselongdouble" in
6140 $define|true|[yY]*)     dflt='y';;
6141 *) dflt='n';;
6142 esac
6143 cat <<EOM
6144
6145 Perl can be built to take advantage of long doubles which
6146 (if available) may give more accuracy and range for floating point numbers.
6147
6148 If this doesn't make any sense to you, just accept the default '$dflt'.
6149 EOM
6150 rp='Try to use long doubles if available?'
6151 . ./myread
6152 case "$ans" in
6153 y|Y)    val="$define"   ;;
6154 *)      val="$undef"    ;;
6155 esac
6156 set uselongdouble
6157 eval $setvar
6158
6159 case "$uselongdouble" in
6160 true|[yY]*) uselongdouble="$define" ;;
6161 esac
6162
6163 case "$uselongdouble" in
6164 $define)
6165 : Look for a hint-file generated 'call-back-unit'.  If the
6166 : user has specified that long doubles should be used,
6167 : we may need to set or change some other defaults.
6168         if $test -f uselongdouble.cbu; then
6169                 echo "Your platform has some specific hints for long doubles, using them..."
6170                 . ./uselongdouble.cbu
6171         else
6172                 $cat <<EOM
6173 (Your platform doesn't have any specific hints for long doubles.)
6174 EOM
6175         fi
6176         ;;
6177 esac
6178
6179 message=X
6180 case "$uselongdouble:$d_sqrtl:$d_modfl" in
6181 $define:$define:$define)
6182         : You have both
6183         ;;
6184 $define:$define:$undef)
6185         message="I could not find modfl"
6186         ;;
6187 $define:$undef:$define)
6188         message="I could not find sqrtl"
6189         ;;
6190 $define:$undef:$undef)
6191         message="I found neither sqrtl nor modfl"
6192         ;;
6193 esac
6194
6195 if $test "$message" != X; then
6196         $cat <<EOM >&4
6197
6198 *** You requested the use of long doubles but you do not seem to have
6199 *** the mathematic functions for long doubles.
6200 *** ($message)
6201 *** I'm disabling the use of long doubles.
6202
6203 EOM
6204
6205         uselongdouble=$undef
6206 fi
6207
6208 : determine the architecture name
6209 echo " "
6210 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6211         tarch=`arch`"-$osname"
6212 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6213         if uname -m > tmparch 2>&1 ; then
6214                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6215                         -e 's/$/'"-$osname/" tmparch`
6216         else
6217                 tarch="$osname"
6218         fi
6219         $rm -f tmparch
6220 else
6221         tarch="$osname"
6222 fi
6223 case "$myarchname" in
6224 ''|"$tarch") ;;
6225 *)
6226         echo "(Your architecture name used to be $myarchname.)"
6227         archname=''
6228         ;;
6229 esac
6230 case "$targetarch" in
6231 '') ;;
6232 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6233 esac
6234 myarchname="$tarch"
6235 case "$archname" in
6236 '') dflt="$tarch";;
6237 *) dflt="$archname";;
6238 esac
6239 rp='What is your architecture name'
6240 . ./myread
6241 archname="$ans"
6242 case "$usethreads" in
6243 $define)
6244         echo "Threads selected." >&4
6245         case "$archname" in
6246         *-thread*) echo "...and architecture name already has -thread." >&4
6247                 ;;
6248         *)      archname="$archname-thread"
6249                 echo "...setting architecture name to $archname." >&4
6250                 ;;
6251         esac
6252         ;;
6253 esac
6254 case "$usemultiplicity" in
6255 $define)
6256         echo "Multiplicity selected." >&4
6257         case "$archname" in
6258         *-multi*) echo "...and architecture name already has -multi." >&4
6259                 ;;
6260         *)      archname="$archname-multi"
6261                 echo "...setting architecture name to $archname." >&4
6262                 ;;
6263         esac
6264         ;;
6265 esac
6266 case "$use64bitint$use64bitall" in
6267 *"$define"*)
6268         case "$archname64" in
6269         '')
6270                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6271                 ;;
6272         *)
6273                 case "$use64bitint" in
6274                 "$define") echo "64 bit integers selected." >&4 ;;
6275                 esac
6276                 case "$use64bitall" in
6277                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6278                 esac
6279                 case "$archname" in
6280                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6281                         ;;
6282                 *)      archname="$archname-$archname64"
6283                         echo "...setting architecture name to $archname." >&4
6284                         ;;
6285                 esac
6286                 ;;
6287         esac
6288 esac
6289 case "$uselongdouble" in
6290 $define)
6291         echo "Long doubles selected." >&4
6292         case "$longdblsize" in
6293         $doublesize)
6294                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6295                 ;;
6296         *)
6297                 case "$archname" in
6298                 *-ld*) echo "...and architecture name already has -ld." >&4
6299                         ;;
6300                 *)      archname="$archname-ld"
6301                         echo "...setting architecture name to $archname." >&4
6302                         ;;
6303                 esac
6304                 ;;
6305         esac
6306         ;;
6307 esac
6308 case "$useperlio" in
6309 $define)
6310         echo "Perlio selected." >&4
6311         ;;
6312 *)
6313         echo "Perlio not selected, using stdio." >&4
6314         case "$archname" in
6315         *-stdio*) echo "...and architecture name already has -stdio." >&4
6316                 ;;
6317         *)      archname="$archname-stdio"
6318                 echo "...setting architecture name to $archname." >&4
6319                 ;;
6320         esac
6321         ;;
6322 esac
6323
6324 : determine root of directory hierarchy where package will be installed.
6325 case "$prefix" in
6326 '')
6327         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
6328         ;;
6329 *?/)
6330         dflt=`echo "$prefix" | sed 's/.$//'`
6331         ;;
6332 *)
6333         dflt="$prefix"
6334         ;;
6335 esac
6336 $cat <<EOM
6337
6338 By default, $package will be installed in $dflt/bin, manual pages
6339 under $dflt/man, etc..., i.e. with $dflt as prefix for all
6340 installation directories. Typically this is something like /usr/local.
6341 If you wish to have binaries under /usr/bin but other parts of the
6342 installation under /usr/local, that's ok: you will be prompted
6343 separately for each of the installation directories, the prefix being
6344 only used to set the defaults.
6345
6346 EOM
6347 fn=d~
6348 rp='Installation prefix to use?'
6349 . ./getfile
6350 oldprefix=''
6351 case "$prefix" in
6352 '') ;;
6353 *)
6354         case "$ans" in
6355         "$prefix") ;;
6356         *) oldprefix="$prefix";;
6357         esac
6358         ;;
6359 esac
6360 prefix="$ans"
6361 prefixexp="$ansexp"
6362
6363 case "$afsroot" in
6364 '')     afsroot=/afs ;;
6365 *)      afsroot=$afsroot ;;
6366 esac
6367
6368 : is AFS running?
6369 echo " "
6370 case "$afs" in
6371 $define|true)   afs=true ;;
6372 $undef|false)   afs=false ;;
6373 *)      if test -d $afsroot; then
6374                 afs=true
6375         else
6376                 afs=false
6377         fi
6378         ;;
6379 esac
6380 if $afs; then
6381         echo "AFS may be running... I'll be extra cautious then..." >&4
6382 else
6383         echo "AFS does not seem to be running..." >&4
6384 fi
6385
6386 : determine installation prefix for where package is to be installed.
6387 if $afs; then 
6388 $cat <<EOM
6389
6390 Since you are running AFS, I need to distinguish the directory in which
6391 files will reside from the directory in which they are installed (and from
6392 which they are presumably copied to the former directory by occult means).
6393
6394 EOM
6395         case "$installprefix" in
6396         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6397         *) dflt="$installprefix";;
6398         esac
6399 else
6400 $cat <<EOM
6401
6402 In some special cases, particularly when building $package for distribution,
6403 it is convenient to distinguish between the directory in which files should 
6404 be installed from the directory ($prefix) in which they 
6405 will eventually reside.  For most users, these two directories are the same.
6406
6407 EOM
6408         case "$installprefix" in
6409         '') dflt=$prefix ;;
6410         *) dflt=$installprefix;;
6411         esac
6412 fi
6413 fn=d~
6414 rp='What installation prefix should I use for installing files?'
6415 . ./getfile
6416 installprefix="$ans"
6417 installprefixexp="$ansexp"
6418
6419 : set the prefixit variable, to compute a suitable default value
6420 prefixit='case "$3" in
6421 ""|none)
6422         case "$oldprefix" in
6423         "") eval "$1=\"\$$2\"";;
6424         *)
6425                 case "$3" in
6426                 "") eval "$1=";;
6427                 none)
6428                         eval "tp=\"\$$2\"";
6429                         case "$tp" in
6430                         ""|" ") eval "$1=\"\$$2\"";;
6431                         *) eval "$1=";;
6432                         esac;;
6433                 esac;;
6434         esac;;
6435 *)
6436         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6437         case "$tp" in
6438         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6439         /*-$oldprefix/*|\~*-$oldprefix/*)
6440                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6441         *) eval "$1=\"\$$2\"";;
6442         esac;;
6443 esac'
6444
6445 : get the patchlevel
6446 echo " "
6447 echo "Getting the current patchlevel..." >&4
6448 if $test -r $rsrc/patchlevel.h;then
6449         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6450         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6451         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6452         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6453         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6454         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6455        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6456 else
6457         revision=0
6458         patchlevel=0
6459         subversion=0
6460         api_revision=0
6461         api_version=0
6462         api_subversion=0
6463         perl_patchlevel=0
6464         $echo "(You do not have patchlevel.h.  Eek.)"
6465 fi
6466 if $test -r $rsrc/.patch ; then  
6467         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6468                 perl_patchlevel=`cat $rsrc/.patch`
6469         fi
6470 fi
6471 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
6472 version_patchlevel_string="version $patchlevel subversion $subversion"
6473 case "$perl_patchlevel" in
6474 0|'') ;;
6475 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
6476 esac
6477
6478 $echo "(You have $package $version_patchlevel_string.)"
6479
6480 case "$osname" in
6481 dos|vms)
6482         : XXX Should be a Configure test for double-dots in filenames.
6483         version=`echo $revision $patchlevel $subversion | \
6484                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6485         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6486                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6487         ;;
6488 *)
6489         version=`echo $revision $patchlevel $subversion | \
6490                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6491         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6492                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6493         ;;
6494 esac
6495 : Special case the 5.005_xx maintenance series, which used 5.005
6496 : without any subversion label as a subdirectory in $sitelib
6497 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6498         api_versionstring='5.005'
6499 fi
6500
6501 : determine installation style
6502 : For now, try to deduce it from prefix unless it is already set.
6503 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6504 case "$installstyle" in
6505 '')     case "$prefix" in
6506                 *perl*) dflt='lib';;
6507                 *) dflt='lib/perl5' ;;
6508         esac
6509         ;;
6510 *)      dflt="$installstyle" ;;
6511 esac
6512 : Probably not worth prompting for this since we prompt for all
6513 : the directories individually, and the prompt would be too long and
6514 : confusing anyway.
6515 installstyle=$dflt
6516
6517 : determine where private library files go
6518 : Usual default is /usr/local/lib/perl5/$version.
6519 : Also allow things like /opt/perl/lib/$version, since 
6520 : /opt/perl/lib/perl5... would be redundant.
6521 : The default "style" setting is made in installstyle.U
6522 case "$installstyle" in
6523 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6524 *)       set dflt privlib lib/$version ;;
6525 esac
6526 eval $prefixit
6527 $cat <<EOM
6528
6529 There are some auxiliary files for $package that need to be put into a
6530 private library directory that is accessible by everyone.
6531
6532 EOM
6533 fn=d~+
6534 rp='Pathname where the private library files will reside?'
6535 . ./getfile
6536 privlib="$ans"
6537 privlibexp="$ansexp"
6538 : Change installation prefix, if necessary.
6539 if $test X"$prefix" != X"$installprefix"; then
6540         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6541 else
6542         installprivlib="$privlibexp"
6543 fi
6544
6545 : set the prefixup variable, to restore leading tilda escape
6546 prefixup='case "$prefixexp" in
6547 "$prefix") ;;
6548 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6549 esac'
6550
6551 : determine where public architecture dependent libraries go
6552 set archlib archlib
6553 eval $prefixit
6554 : privlib default is /usr/local/lib/$package/$version
6555 : archlib default is /usr/local/lib/$package/$version/$archname
6556 : privlib may have an optional trailing /share.
6557 tdflt=`echo $privlib | $sed 's,/share$,,'`
6558 tdflt=$tdflt/$archname
6559 case "$archlib" in
6560 '')     dflt=$tdflt
6561         ;;
6562 *)      dflt="$archlib"
6563     ;;
6564 esac
6565 $cat <<EOM
6566
6567 $spackage contains architecture-dependent library files.  If you are
6568 sharing libraries in a heterogeneous environment, you might store
6569 these files in a separate location.  Otherwise, you can just include
6570 them with the rest of the public library files.
6571
6572 EOM
6573 fn=d+~
6574 rp='Where do you want to put the public architecture-dependent libraries?'
6575 . ./getfile
6576 archlib="$ans"
6577 archlibexp="$ansexp"
6578 if $test X"$archlib" = X"$privlib"; then
6579         d_archlib="$undef"
6580 else
6581         d_archlib="$define"
6582 fi
6583 : Change installation prefix, if necessary.
6584 if $test X"$prefix" != X"$installprefix"; then
6585         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6586 else
6587         installarchlib="$archlibexp"
6588 fi
6589
6590 : see if setuid scripts can be secure
6591 $cat <<EOM
6592
6593 Some kernels have a bug that prevents setuid #! scripts from being
6594 secure.  Some sites have disabled setuid #! scripts because of this.
6595
6596 First let's decide if your kernel supports secure setuid #! scripts.
6597 (If setuid #! scripts would be secure but have been disabled anyway,
6598 don't say that they are secure if asked.)
6599
6600 EOM
6601
6602 val="$undef"
6603 if $test -d /dev/fd; then
6604         echo "#!$ls" >reflect
6605         chmod +x,u+s reflect
6606         ./reflect >flect 2>&1
6607         if $contains "/dev/fd" flect >/dev/null; then
6608                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6609                 val="$define"
6610         else
6611                 $cat <<EOM
6612 If you are not sure if they are secure, I can check but I'll need a
6613 username and password different from the one you are using right now.
6614 If you don't have such a username or don't want me to test, simply
6615 enter 'none'.
6616
6617 EOM
6618                 rp='Other username to test security of setuid scripts with?'
6619                 dflt='none'
6620                 . ./myread
6621                 case "$ans" in
6622                 n|none)
6623                         case "$d_suidsafe" in
6624                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6625                                 dflt=n;;
6626                         "$undef")
6627                                 echo "Well, the $hint value is *not* secure." >&4
6628                                 dflt=n;;
6629                         *)      echo "Well, the $hint value *is* secure." >&4
6630                                 dflt=y;;
6631                         esac
6632                         ;;
6633                 *)
6634                         $rm -f reflect flect
6635                         echo "#!$ls" >reflect
6636                         chmod +x,u+s reflect
6637                         echo >flect
6638                         chmod a+w flect
6639                         echo '"su" will (probably) prompt you for '"$ans's password."
6640                         su $ans -c './reflect >flect'
6641                         if $contains "/dev/fd" flect >/dev/null; then
6642                                 echo "Okay, it looks like setuid scripts are secure." >&4
6643                                 dflt=y
6644                         else
6645                                 echo "I don't think setuid scripts are secure." >&4
6646                                 dflt=n
6647                         fi
6648                         ;;
6649                 esac
6650                 rp='Does your kernel have *secure* setuid scripts?'
6651                 . ./myread
6652                 case "$ans" in
6653                 [yY]*)  val="$define";;
6654                 *)      val="$undef";;
6655                 esac
6656         fi
6657 else
6658         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6659         echo "(That's for file descriptors, not floppy disks.)"
6660         val="$undef"
6661 fi
6662 set d_suidsafe
6663 eval $setvar
6664
6665 $rm -f reflect flect
6666
6667 : now see if they want to do setuid emulation
6668 echo " "
6669 val="$undef"
6670 case "$d_suidsafe" in
6671 "$define")
6672         val="$undef"
6673         echo "No need to emulate SUID scripts since they are secure here." >&4
6674         ;;
6675 *)
6676         $cat <<EOM
6677 Some systems have disabled setuid scripts, especially systems where
6678 setuid scripts cannot be secure.  On systems where setuid scripts have
6679 been disabled, the setuid/setgid bits on scripts are currently
6680 useless.  It is possible for $package to detect those bits and emulate
6681 setuid/setgid in a secure fashion.  This emulation will only work if
6682 setuid scripts have been disabled in your kernel.
6683
6684 EOM
6685         case "$d_dosuid" in
6686         "$define") dflt=y ;;
6687         *) dflt=n ;;
6688         esac
6689         rp="Do you want to do setuid/setgid emulation?"
6690         . ./myread
6691         case "$ans" in
6692         [yY]*)  val="$define";;
6693         *)      val="$undef";;
6694         esac
6695         ;;
6696 esac
6697 set d_dosuid
6698 eval $setvar
6699
6700 : see if this is a malloc.h system
6701 set malloc.h i_malloc
6702 eval $inhdr
6703
6704 : see if stdlib is available
6705 set stdlib.h i_stdlib
6706 eval $inhdr
6707
6708 : check for void type
6709 echo " "
6710 echo "Checking to see how well your C compiler groks the void type..." >&4
6711 case "$voidflags" in
6712 '')
6713         $cat >try.c <<'EOCP'
6714 #if TRY & 1
6715 void sub() {
6716 #else
6717 sub() {
6718 #endif
6719         extern void moo();      /* function returning void */
6720         void (*goo)();          /* ptr to func returning void */
6721 #if TRY & 8
6722         void *hue;              /* generic ptr */
6723 #endif
6724 #if TRY & 2
6725         void (*foo[10])();
6726 #endif
6727
6728 #if TRY & 4
6729         if(goo == moo) {
6730                 exit(0);
6731         }
6732 #endif
6733         exit(0);
6734 }
6735 int main() { sub(); }
6736 EOCP
6737         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6738                 voidflags=$defvoidused
6739         echo "Good.  It appears to support void to the level $package wants.">&4
6740                 if $contains warning .out >/dev/null 2>&1; then
6741                         echo "However, you might get some warnings that look like this:"
6742                         $cat .out
6743                 fi
6744         else
6745 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6746                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6747                         echo "It supports 1..."
6748                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6749                                 echo "It also supports 2..."
6750                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6751                                         voidflags=7
6752                                         echo "And it supports 4 but not 8 definitely."
6753                                 else
6754                                         echo "It doesn't support 4..."
6755                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6756                                                 voidflags=11
6757                                                 echo "But it supports 8."
6758                                         else
6759                                                 voidflags=3
6760                                                 echo "Neither does it support 8."
6761                                         fi
6762                                 fi
6763                         else
6764                                 echo "It does not support 2..."
6765                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6766                                         voidflags=13
6767                                         echo "But it supports 4 and 8."
6768                                 else
6769                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6770                                                 voidflags=5
6771                                                 echo "And it supports 4 but has not heard about 8."
6772                                         else
6773                                                 echo "However it supports 8 but not 4."
6774                                         fi
6775                                 fi
6776                         fi
6777                 else
6778                         echo "There is no support at all for void."
6779                         voidflags=0
6780                 fi
6781         fi
6782 esac
6783 case "$voidflags" in
6784 "$defvoidused") ;;
6785 *)      $cat >&4 <<'EOM'
6786   Support flag bits are:
6787     1: basic void declarations.
6788     2: arrays of pointers to functions returning void.
6789     4: operations between pointers to and addresses of void functions.
6790     8: generic void pointers.
6791 EOM
6792         dflt="$voidflags";
6793         rp="Your void support flags add up to what?"
6794         . ./myread
6795         voidflags="$ans"
6796         ;;
6797 esac
6798 $rm -f try.* .out
6799
6800 : check for length of pointer
6801 echo " "
6802 case "$ptrsize" in
6803 '')
6804         echo "Checking to see how big your pointers are..." >&4
6805         if test "$voidflags" -gt 7; then
6806                 echo '#define VOID_PTR char *' > try.c
6807         else
6808                 echo '#define VOID_PTR void *' > try.c
6809         fi
6810         $cat >>try.c <<'EOCP'
6811 #include <stdio.h>
6812 int main()
6813 {
6814     printf("%d\n", (int)sizeof(VOID_PTR));
6815     exit(0);
6816 }
6817 EOCP
6818         set try
6819         if eval $compile_ok; then
6820                 ptrsize=`$run ./try`
6821                 echo "Your pointers are $ptrsize bytes long."
6822         else
6823                 dflt='4'
6824                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6825                 rp="What is the size of a pointer (in bytes)?"
6826                 . ./myread
6827                 ptrsize="$ans"
6828         fi
6829         ;;
6830 esac
6831 $rm -f try.c try
6832 case "$use64bitall" in
6833 "$define"|true|[yY]*)
6834         case "$ptrsize" in
6835         4)      cat <<EOM >&4
6836
6837 *** You have chosen a maximally 64-bit build, but your pointers
6838 *** are only 4 bytes wide, disabling maximal 64-bitness.
6839
6840 EOM
6841                 use64bitall="$undef"
6842                 case "$use64bitint" in
6843                 "$define"|true|[yY]*) ;;
6844                 *)      cat <<EOM >&4
6845
6846 *** Downgrading from maximal 64-bitness to using 64-bit integers.
6847
6848 EOM
6849                         use64bitint="$define"
6850                         ;;
6851                 esac
6852                 ;;
6853         esac
6854         ;;
6855 esac
6856
6857
6858 : determine which malloc to compile in
6859 echo " "
6860 case "$usemymalloc" in
6861 [yY]*|true|$define)     dflt='y' ;;
6862 [nN]*|false|$undef)     dflt='n' ;;
6863 *)      case "$ptrsize" in
6864         4) dflt='y' ;;
6865         *) dflt='n' ;;
6866         esac
6867         ;;
6868 esac
6869 rp="Do you wish to attempt to use the malloc that comes with $package?"
6870 . ./myread
6871 usemymalloc="$ans"
6872 case "$ans" in
6873 y*|true)
6874         usemymalloc='y'
6875         mallocsrc='malloc.c'
6876         mallocobj="malloc$_o"
6877         d_mymalloc="$define"
6878         case "$libs" in
6879         *-lmalloc*)
6880                 : Remove malloc from list of libraries to use
6881                 echo "Removing unneeded -lmalloc from library list" >&4
6882                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6883                 shift
6884                 libs="$*"
6885                 echo "libs = $libs" >&4
6886                 ;;
6887         esac
6888         ;;
6889 *)
6890         usemymalloc='n'
6891         mallocsrc=''
6892         mallocobj=''
6893         d_mymalloc="$undef"
6894         ;;
6895 esac
6896
6897 : compute the return types of malloc and free
6898 echo " "
6899 $cat >malloc.c <<END
6900 #$i_malloc I_MALLOC
6901 #$i_stdlib I_STDLIB
6902 #include <stdio.h>
6903 #include <sys/types.h>
6904 #ifdef I_MALLOC
6905 #include <malloc.h>
6906 #endif
6907 #ifdef I_STDLIB
6908 #include <stdlib.h>
6909 #endif
6910 #ifdef TRY_MALLOC
6911 void *malloc();
6912 #endif
6913 #ifdef TRY_FREE
6914 void free();
6915 #endif
6916 END
6917 case "$malloctype" in
6918 '')
6919         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6920                 malloctype='void *'
6921         else
6922                 malloctype='char *'
6923         fi
6924         ;;
6925 esac
6926 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6927
6928 case "$freetype" in
6929 '')
6930         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6931                 freetype='void'
6932         else
6933                 freetype='int'
6934         fi
6935         ;;
6936 esac
6937 echo "Your system uses $freetype free(), it would seem." >&4
6938 $rm -f malloc.[co]
6939 $cat <<EOM
6940
6941 After $package is installed, you may wish to install various
6942 add-on modules and utilities.  Typically, these add-ons will
6943 be installed under $prefix with the rest
6944 of this package.  However, you may wish to install such add-ons
6945 elsewhere under a different prefix.
6946
6947 If you do not wish to put everything under a single prefix, that's
6948 ok.  You will be prompted for the individual locations; this siteprefix
6949 is only used to suggest the defaults.
6950
6951 The default should be fine for most people.
6952
6953 EOM
6954 fn=d~+
6955 rp='Installation prefix to use for add-on modules and utilities?'
6956 : XXX Here might be another good place for an installstyle setting.
6957 case "$siteprefix" in
6958 '') dflt=$prefix ;;
6959 *)  dflt=$siteprefix ;;
6960 esac
6961 . ./getfile
6962 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6963 oldsiteprefix=''
6964 case "$siteprefix" in
6965 '') ;;
6966 *)      case "$ans" in
6967         "$prefix") ;;
6968         *) oldsiteprefix="$prefix";;
6969         esac
6970         ;;
6971 esac
6972 siteprefix="$ans"
6973 siteprefixexp="$ansexp"
6974
6975 : determine where site specific libraries go.
6976 : Usual default is /usr/local/lib/perl5/site_perl/$version
6977 : The default "style" setting is made in installstyle.U
6978 : XXX No longer works with Prefixit stuff.
6979 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6980 case "$sitelib" in
6981 '') case "$installstyle" in
6982         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6983         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6984         esac
6985         ;;
6986 *)      dflt="$sitelib"
6987         ;;
6988 esac
6989 $cat <<EOM
6990
6991 The installation process will create a directory for
6992 site-specific extensions and modules.  Most users find it convenient
6993 to place all site-specific files in this directory rather than in the
6994 main distribution directory.
6995
6996 EOM
6997 fn=d~+
6998 rp='Pathname for the site-specific library files?'
6999 . ./getfile
7000 sitelib="$ans"
7001 sitelibexp="$ansexp"
7002 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7003 : Change installation prefix, if necessary.
7004 if $test X"$prefix" != X"$installprefix"; then
7005         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
7006 else
7007         installsitelib="$sitelibexp"
7008 fi
7009
7010 : determine where site specific architecture-dependent libraries go.
7011 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7012 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7013 : sitelib may have an optional trailing /share.
7014 case "$sitearch" in
7015 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7016         dflt="$dflt/$archname"
7017         ;;
7018 *)      dflt="$sitearch"
7019         ;;
7020 esac
7021 set sitearch sitearch none
7022 eval $prefixit
7023 $cat <<EOM
7024
7025 The installation process will also create a directory for
7026 architecture-dependent site-specific extensions and modules.
7027
7028 EOM
7029 fn=d~+
7030 rp='Pathname for the site-specific architecture-dependent library files?'
7031 . ./getfile
7032 sitearch="$ans"
7033 sitearchexp="$ansexp"
7034 : Change installation prefix, if necessary.
7035 if $test X"$prefix" != X"$installprefix"; then
7036         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
7037 else
7038         installsitearch="$sitearchexp"
7039 fi
7040
7041 $cat <<EOM
7042
7043 The installation process will also create a directory for
7044 vendor-supplied add-ons.  Vendors who supply perl with their system
7045 may find it convenient to place all vendor-supplied files in this
7046 directory rather than in the main distribution directory.  This will
7047 ease upgrades between binary-compatible maintenance versions of perl.
7048
7049 Of course you may also use these directories in whatever way you see
7050 fit.  For example, you might use them to access modules shared over a
7051 company-wide network.
7052
7053 The default answer should be fine for most people.
7054 This causes further questions about vendor add-ons to be skipped
7055 and no vendor-specific directories will be configured for perl.
7056
7057 EOM
7058 rp='Do you want to configure vendor-specific add-on directories?'
7059 case "$usevendorprefix" in
7060 define|true|[yY]*) dflt=y ;;
7061 *)      : User may have set vendorprefix directly on Configure command line.
7062         case "$vendorprefix" in
7063         ''|' ') dflt=n ;;
7064         *)      dflt=y ;;
7065         esac
7066         ;;
7067 esac
7068 . ./myread
7069 case "$ans" in
7070 [yY]*)  fn=d~+
7071         rp='Installation prefix to use for vendor-supplied add-ons?'
7072         case "$vendorprefix" in
7073         '') dflt='' ;;
7074         *)  dflt=$vendorprefix ;;
7075         esac
7076         . ./getfile
7077         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7078         oldvendorprefix=''
7079         case "$vendorprefix" in
7080         '') ;;
7081         *)      case "$ans" in
7082                 "$prefix") ;;
7083                 *) oldvendorprefix="$prefix";;
7084                 esac
7085                 ;;
7086         esac
7087         usevendorprefix="$define"
7088         vendorprefix="$ans"
7089         vendorprefixexp="$ansexp"
7090         ;;
7091 *)      usevendorprefix="$undef"
7092         vendorprefix=''
7093         vendorprefixexp=''
7094         ;;
7095 esac
7096
7097 case "$vendorprefix" in
7098 '')     d_vendorlib="$undef"
7099         vendorlib=''
7100         vendorlibexp=''
7101         ;;
7102 *)      d_vendorlib="$define"
7103         : determine where vendor-supplied modules go.
7104         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7105         case "$vendorlib" in
7106         '')
7107                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7108                 case "$installstyle" in
7109                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7110                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7111                 esac
7112                 ;;
7113         *)      dflt="$vendorlib"
7114                 ;;
7115         esac
7116         fn=d~+
7117         rp='Pathname for the vendor-supplied library files?'
7118         . ./getfile
7119         vendorlib="$ans"
7120         vendorlibexp="$ansexp"
7121         ;;
7122 esac
7123 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7124 : Change installation prefix, if necessary.
7125 if $test X"$prefix" != X"$installprefix"; then
7126         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
7127 else
7128         installvendorlib="$vendorlibexp"
7129 fi
7130
7131 case "$vendorprefix" in
7132 '')     d_vendorarch="$undef"
7133         vendorarch=''
7134         vendorarchexp=''
7135         ;;
7136 *)      d_vendorarch="$define"
7137         : determine where vendor-supplied architecture-dependent libraries go.
7138         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7139         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7140         : vendorlib may have an optional trailing /share.
7141         case "$vendorarch" in
7142         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7143                 dflt="$dflt/$archname"
7144                 ;;
7145         *)      dflt="$vendorarch" ;;
7146         esac
7147         fn=d~+
7148         rp='Pathname for vendor-supplied architecture-dependent files?'
7149         . ./getfile
7150         vendorarch="$ans"
7151         vendorarchexp="$ansexp"
7152         ;;
7153 esac
7154 : Change installation prefix, if necessary.
7155 if $test X"$prefix" != X"$installprefix"; then
7156         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
7157 else
7158         installvendorarch="$vendorarchexp"
7159 fi
7160
7161 : Final catch-all directories to search
7162 $cat <<EOM
7163
7164 Lastly, you can have perl look in other directories for extensions and
7165 modules in addition to those already specified.
7166 These directories will be searched after 
7167         $sitearch 
7168         $sitelib 
7169 EOM
7170 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7171 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7172 echo ' '
7173 case "$otherlibdirs" in
7174 ''|' ') dflt='none' ;;
7175 *)      dflt="$otherlibdirs" ;;
7176 esac
7177 $cat <<EOM
7178 Enter a colon-separated set of extra paths to include in perl's @INC
7179 search path, or enter 'none' for no extra paths.
7180
7181 EOM
7182
7183 rp='Colon-separated list of additional directories for perl to search?'
7184 . ./myread
7185 case "$ans" in
7186 ' '|''|none)    otherlibdirs=' ' ;;     
7187 *)      otherlibdirs="$ans" ;;
7188 esac
7189 case "$otherlibdirs" in
7190 ' ') val=$undef ;;
7191 *)      val=$define ;;
7192 esac
7193 set d_perl_otherlibdirs
7194 eval $setvar
7195
7196 : Cruising for prototypes
7197 echo " "
7198 echo "Checking out function prototypes..." >&4
7199 $cat >prototype.c <<'EOCP'
7200 int main(int argc, char *argv[]) {
7201         exit(0);}
7202 EOCP
7203 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7204         echo "Your C compiler appears to support function prototypes."
7205         val="$define"
7206 else
7207         echo "Your C compiler doesn't seem to understand function prototypes."
7208         val="$undef"
7209 fi
7210 set prototype
7211 eval $setvar
7212 $rm -f prototype*
7213
7214 case "$prototype" in
7215 "$define") ;;
7216 *)      ansi2knr='ansi2knr'
7217         echo " "
7218         cat <<EOM >&4
7219
7220 $me:  FATAL ERROR:
7221 This version of $package can only be compiled by a compiler that 
7222 understands function prototypes.  Unfortunately, your C compiler 
7223         $cc $ccflags
7224 doesn't seem to understand them.  Sorry about that.
7225
7226 If GNU cc is available for your system, perhaps you could try that instead.  
7227
7228 Eventually, we hope to support building Perl with pre-ANSI compilers.
7229 If you would like to help in that effort, please contact <perlbug@perl.org>.
7230
7231 Aborting Configure now.
7232 EOM
7233         exit 2
7234         ;;
7235 esac
7236
7237 : determine where public executables go
7238 echo " "
7239 set dflt bin bin
7240 eval $prefixit
7241 fn=d~
7242 rp='Pathname where the public executables will reside?'
7243 . ./getfile
7244 if $test "X$ansexp" != "X$binexp"; then
7245         installbin=''
7246 fi
7247 bin="$ans"
7248 binexp="$ansexp"
7249 : Change installation prefix, if necessary.
7250 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7251 if $test X"$prefix" != X"$installprefix"; then
7252         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
7253 else
7254         installbin="$binexp"
7255 fi
7256
7257 echo " "
7258 case "$extras" in
7259 '') dflt='n';;
7260 *) dflt='y';;
7261 esac
7262 cat <<EOM
7263 Perl can be built with extra modules or bundles of modules which
7264 will be fetched from the CPAN and installed alongside Perl.
7265
7266 Notice that you will need access to the CPAN; either via the Internet,
7267 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7268 be asked later to configure the CPAN.pm module which will in turn do
7269 the installation of the rest of the extra modules or bundles.)
7270
7271 Notice also that if the modules require any external software such as
7272 libraries and headers (the libz library and the zlib.h header for the
7273 Compress::Zlib module, for example) you MUST have any such software
7274 already installed, this configuration process will NOT install such
7275 things for you.
7276
7277 If this doesn't make any sense to you, just accept the default '$dflt'.
7278 EOM
7279 rp='Install any extra modules (y or n)?'
7280 . ./myread
7281 case "$ans" in
7282 y|Y)
7283         cat <<EOM
7284
7285 Please list any extra modules or bundles to be installed from CPAN,
7286 with spaces between the names.  The names can be in any format the
7287 'install' command of CPAN.pm will understand.  (Answer 'none',
7288 without the quotes, to install no extra modules or bundles.)
7289 EOM
7290         rp='Extras?'
7291         dflt="$extras"
7292         . ./myread
7293         extras="$ans"
7294 esac
7295 case "$extras" in
7296 ''|'none')
7297         val=''
7298         $rm -f ../extras.lst
7299         ;;
7300 *)      echo "(Saving the list of extras for later...)"
7301         echo "$extras" > ../extras.lst
7302         val="'$extras'"
7303         ;;
7304 esac
7305 set extras
7306 eval $setvar
7307 echo " "
7308
7309 : Find perl5.005 or later.
7310 echo "Looking for a previously installed perl5.005 or later... "
7311 case "$perl5" in
7312 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7313                 : Check if this perl is recent and can load a simple module
7314                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7315                         perl5=$tdir/perl
7316                         break;
7317                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7318                         perl5=$tdir/perl5
7319                         break;
7320                 fi
7321         done
7322         ;;
7323 *)      perl5="$perl5"
7324         ;;
7325 esac
7326 case "$perl5" in
7327 '')     echo "None found.  That's ok.";;
7328 *)      echo "Using $perl5." ;;
7329 esac
7330
7331 : Determine list of previous versions to include in @INC
7332 $cat > getverlist <<EOPL
7333 #!$perl5 -w
7334 use File::Basename;
7335 \$api_versionstring = "$api_versionstring";
7336 \$version = "$version";
7337 \$stem = "$sitelib_stem";
7338 \$archname = "$archname";
7339 EOPL
7340         $cat >> getverlist <<'EOPL'
7341 # Can't have leading @ because metaconfig interprets it as a command!
7342 ;@inc_version_list=();
7343 # XXX Redo to do opendir/readdir? 
7344 if (-d $stem) {
7345     chdir($stem);
7346     ;@candidates = glob("5.*");
7347 }
7348 else {
7349     ;@candidates = ();
7350 }
7351
7352 # XXX ToDo:  These comparisons must be reworked when two-digit
7353 # subversions come along, so that 5.7.10 compares as greater than
7354 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
7355 # widespread that we can use the built-in version vectors rather
7356 # than reinventing them here.  For 5.6.0, however, we must
7357 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
7358 foreach $d (@candidates) {
7359     if ($d lt $version) {
7360         if ($d ge $api_versionstring) {
7361             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
7362         }
7363         elsif ($d ge "5.005") {
7364             unshift(@inc_version_list, grep { -d } $d);
7365         }
7366     }
7367     else {
7368         # Skip newer version.  I.e. don't look in
7369         # 5.7.0 if we're installing 5.6.1.
7370     }
7371 }
7372
7373 if (@inc_version_list) {
7374     print join(' ', @inc_version_list);
7375 }
7376 else {
7377     # Blank space to preserve value for next Configure run.
7378     print " ";
7379 }
7380 EOPL
7381 chmod +x getverlist
7382 case "$inc_version_list" in
7383 '')     if test -x "$perl5$exe_ext"; then
7384                 dflt=`$perl5 getverlist`
7385         else
7386                 dflt='none'
7387         fi
7388         ;;
7389 $undef) dflt='none' ;;
7390 *)  eval dflt=\"$inc_version_list\" ;;
7391 esac
7392 case "$dflt" in
7393 ''|' ') dflt=none ;;
7394 esac
7395 case "$dflt" in
7396 5.005) dflt=none ;;
7397 esac
7398 $cat <<EOM
7399
7400 In order to ease the process of upgrading, this version of perl 
7401 can be configured to use modules built and installed with earlier 
7402 versions of perl that were installed under $prefix.  Specify here
7403 the list of earlier versions that this version of perl should check.
7404 If Configure detected no earlier versions of perl installed under
7405 $prefix, then the list will be empty.  Answer 'none' to tell perl
7406 to not search earlier versions.
7407
7408 The default should almost always be sensible, so if you're not sure,
7409 just accept the default.
7410 EOM
7411
7412 rp='List of earlier versions to include in @INC?'
7413 . ./myread
7414 case "$ans" in
7415 [Nn]one|''|' ') inc_version_list=' ' ;;
7416 *) inc_version_list="$ans" ;;
7417 esac
7418 case "$inc_version_list" in
7419 ''|' ') 
7420         inc_version_list_init='0';;
7421 *)      inc_version_list_init=`echo $inc_version_list |
7422                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7423         ;;
7424 esac
7425 $rm -f getverlist
7426
7427 : determine whether to install perl also as /usr/bin/perl
7428
7429 echo " "
7430 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7431         $cat <<EOM
7432 Many scripts expect perl to be installed as /usr/bin/perl.
7433 I can install the perl you are about to compile also as /usr/bin/perl
7434 (in addition to $installbin/perl).
7435 EOM
7436         case "$installusrbinperl" in
7437         "$undef"|[nN]*) dflt='n';;
7438         *)              dflt='y';;
7439         esac
7440         rp="Do you want to install perl as /usr/bin/perl?"
7441         . ./myread
7442         case "$ans" in
7443         [yY]*)  val="$define";;
7444         *)      val="$undef" ;;
7445         esac
7446 else
7447         val="$undef"
7448 fi
7449 set installusrbinperl
7450 eval $setvar
7451
7452 : see if dld is available
7453 set dld.h i_dld
7454 eval $inhdr
7455
7456 : see if dlopen exists
7457 xxx_runnm="$runnm"
7458 runnm=false
7459 set dlopen d_dlopen
7460 eval $inlibc
7461 runnm="$xxx_runnm"
7462
7463 : determine which dynamic loading, if any, to compile in
7464 echo " "
7465 dldir="ext/DynaLoader"
7466 case "$usedl" in
7467 $define|y|true)
7468         dflt='y'
7469         usedl="$define"
7470         ;;
7471 $undef|n|false)
7472         dflt='n'
7473         usedl="$undef"
7474         ;;
7475 *) 
7476         dflt='n'
7477         case "$d_dlopen" in
7478             $define) dflt='y' ;;
7479         esac
7480         case "$i_dld" in
7481             $define) dflt='y' ;;
7482         esac
7483         : Does a dl_xxx.xs file exist for this operating system
7484         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7485         ;;
7486 esac
7487 rp="Do you wish to use dynamic loading?"
7488 . ./myread
7489 usedl="$ans"
7490 case "$ans" in
7491 y*) usedl="$define"
7492         case "$dlsrc" in
7493         '')
7494                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7495                         dflt="$dldir/dl_${osname}.xs"
7496                 elif $test "$d_dlopen" = "$define" ; then
7497                         dflt="$dldir/dl_dlopen.xs"
7498                 elif $test "$i_dld" = "$define" ; then
7499                         dflt="$dldir/dl_dld.xs"
7500                 else
7501                         dflt=''
7502                 fi
7503                 ;;
7504         *)      dflt="$dldir/$dlsrc"
7505                 ;;
7506         esac
7507     echo "The following dynamic loading files are available:"
7508         : Can not go over to $dldir because getfile has path hard-coded in.
7509         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7510         rp="Source file to use for dynamic loading"
7511         fn="fne"
7512         gfpth="$src"
7513         . ./getfile
7514         usedl="$define"
7515         : emulate basename
7516         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7517
7518         $cat << EOM
7519
7520 Some systems may require passing special flags to $cc -c to
7521 compile modules that will be used to create a shared library.
7522 To use no flags, say "none".
7523
7524 EOM
7525     case "$cccdlflags" in
7526     '') case "$gccversion" in
7527                 '') case "$osname" in
7528                         hpux)   dflt='+z' ;;
7529                         next)   dflt='none' ;;
7530                         irix*)  dflt='-KPIC' ;;
7531                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7532                         sunos)  dflt='-pic' ;;
7533                         *)      dflt='none' ;;
7534                     esac
7535                         ;;
7536                 *)  case "$osname" in
7537                         darwin) dflt='none' ;;
7538                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7539                         *)      dflt='-fpic' ;;
7540                     esac ;;
7541             esac ;;
7542         ' ') dflt='none' ;;
7543     *)  dflt="$cccdlflags" ;;
7544     esac
7545     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7546     . ./myread
7547     case "$ans" in
7548     none) cccdlflags=' ' ;;
7549     *) cccdlflags="$ans" ;;
7550     esac
7551
7552     cat << EOM
7553
7554 Some systems use ld to create libraries that can be dynamically loaded,
7555 while other systems (such as those using ELF) use $cc.
7556
7557 EOM
7558         case "$ld" in
7559         '')     $cat >try.c <<'EOM'
7560 /* Test for whether ELF binaries are produced */
7561 #include <fcntl.h>
7562 #include <stdlib.h>
7563 int main() {
7564         char b[4];
7565         int i = open("a.out",O_RDONLY);
7566         if(i == -1) 
7567                 exit(1); /* fail */
7568         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7569                 exit(0); /* succeed (yes, it's ELF) */
7570         else
7571                 exit(1); /* fail */
7572 }
7573 EOM
7574                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7575                         cat <<EOM
7576 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7577 EOM
7578                         dflt="$cc"
7579                 else
7580                         echo "I'll use ld to build dynamic libraries."
7581                         dflt='ld'
7582                 fi
7583                 rm -f try.c a.out
7584                 ;;
7585         *)      dflt="$ld"
7586                 ;;
7587         esac
7588
7589     rp="What command should be used to create dynamic libraries?"
7590     . ./myread
7591         ld="$ans"
7592
7593     cat << EOM
7594
7595 Some systems may require passing special flags to $ld to create a
7596 library that can be dynamically loaded.  If your ld flags include
7597 -L/other/path options to locate libraries outside your loader's normal
7598 search path, you may need to specify those -L options here as well.  To
7599 use no flags, say "none".
7600
7601 EOM
7602     case "$lddlflags" in
7603     '') case "$osname" in
7604                         beos) dflt='-nostart' ;;
7605                         hpux) dflt='-b';
7606                               case "$gccversion" in
7607                               '') dflt="$dflt +vnocompatwarnings" ;;
7608                               esac
7609                               ;;        
7610                         linux|irix*)    dflt='-shared' ;;
7611                         next)  dflt='none' ;;
7612                         solaris) dflt='-G' ;;
7613                         sunos) dflt='-assert nodefinitions' ;;
7614                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7615                 *)     dflt='none' ;;
7616                         esac
7617                         ;;
7618     *) dflt="$lddlflags" ;;
7619     esac
7620
7621         : Try to guess additional flags to pick up local libraries.
7622         : Be careful not to append to a plain 'none'
7623         case "$dflt" in
7624         none) dflt='' ;;
7625         esac
7626         for thisflag in $ldflags; do
7627                 case "$thisflag" in
7628                 -L*|-R*|-Wl,-R*)
7629                         case " $dflt " in
7630                         *" $thisflag "*) ;;
7631                         *) dflt="$dflt $thisflag" ;;
7632                         esac
7633                         ;;
7634                 esac
7635         done
7636
7637         case "$dflt" in
7638         ''|' ') dflt='none' ;;
7639         esac
7640
7641     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7642     . ./myread
7643     case "$ans" in
7644     none) lddlflags=' ' ;;
7645     *) lddlflags="$ans" ;;
7646     esac
7647
7648         cat <<EOM
7649
7650 Some systems may require passing special flags to $cc to indicate that
7651 the resulting executable will use dynamic linking.  To use no flags,
7652 say "none".
7653
7654 EOM
7655     case "$ccdlflags" in
7656     '') case "$osname" in
7657                 hpux)   dflt='-Wl,-E' ;;
7658                 linux)  dflt='-rdynamic' ;;
7659                 next)   dflt='none' ;;
7660                 sunos)  dflt='none' ;;
7661                 *)      dflt='none' ;;
7662             esac ;;
7663     ' ')  dflt='none' ;;
7664     *)  dflt="$ccdlflags" ;;
7665     esac
7666     rp="Any special flags to pass to $cc to use dynamic linking?"
7667     . ./myread
7668     case "$ans" in
7669     none) ccdlflags=' ' ;;
7670     *) ccdlflags="$ans" ;;
7671     esac
7672     ;;
7673 *)  usedl="$undef"
7674         ld='ld'
7675     dlsrc='dl_none.xs'
7676     lddlflags=''
7677     ccdlflags=''
7678     ;;
7679 esac
7680
7681 also=''
7682 case "$usedl" in
7683 $undef)
7684         # No dynamic loading being used, so don't bother even to prompt.
7685         useshrplib='false'
7686         ;;
7687 *)      case "$useshrplib" in
7688         '')     case "$osname" in
7689                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7690                         dflt=y
7691                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7692                         ;;
7693                 next*)
7694                         case "$osvers" in
7695                         4*)     dflt=y
7696                                 also='Building a shared libperl is needed for MAB support.'
7697                                 ;;
7698                         *)      dflt=n
7699                                 ;;
7700                         esac
7701                         ;;
7702                 *)      dflt=n
7703                         ;;
7704                 esac
7705                 ;;
7706         $define|true|[Yy]*)
7707                 dflt=y
7708                 ;;
7709         *)      dflt=n
7710                 ;;
7711         esac
7712         $cat << EOM
7713
7714 The perl executable is normally obtained by linking perlmain.c with
7715 libperl${_a}, any static extensions (usually just DynaLoader), and
7716 any other libraries needed on this system (such as -lm, etc.).  Since
7717 your system supports dynamic loading, it is probably possible to build
7718 a shared libperl.$so.  If you will have more than one executable linked
7719 to libperl.$so, this will significantly reduce the size of each
7720 executable, but it may have a noticeable affect on performance.  The
7721 default is probably sensible for your system.
7722 $also
7723
7724 EOM
7725         rp="Build a shared libperl.$so (y/n)"
7726         . ./myread
7727         case "$ans" in
7728         true|$define|[Yy]*)
7729                 useshrplib='true'  ;;
7730         *)      useshrplib='false' ;;
7731         esac
7732         ;;
7733 esac
7734
7735 case "$useshrplib" in
7736 true)
7737         case "$libperl" in
7738         '')
7739                 # Figure out a good name for libperl.so.  Since it gets stored in
7740                 # a version-specific architecture-dependent library, the version
7741                 # number isn't really that important, except for making cc/ld happy.
7742                 #
7743                 # A name such as libperl.so.3.1
7744                 majmin="libperl.$so.$patchlevel.$subversion"
7745                 # A name such as libperl.so.301
7746                 majonly=`echo $patchlevel $subversion |
7747                         $awk '{printf "%d%02d", $1, $2}'`
7748                 majonly=libperl.$so.$majonly
7749                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7750                 # rely on figuring it out from the naming of libc.
7751                 case "${osname}${osvers}" in
7752                 next4*)
7753                         dflt=libperl.5.$so
7754                         # XXX How handle the --version stuff for MAB?
7755                         ;;
7756                 linux*)  # ld won't link with a bare -lperl otherwise.
7757                         dflt=libperl.$so
7758                         ;;
7759                 cygwin*) # ld links against an importlib
7760                         dflt=libperl$lib_ext
7761                         ;;
7762                 *)      # Try to guess based on whether libc has major.minor.
7763                         case "$libc" in
7764                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7765                         *libc.$so.[0-9]*) dflt=$majonly ;;
7766                         *)      dflt=libperl.$so ;;
7767                         esac
7768                         ;;
7769                 esac
7770                 ;;
7771         *)      dflt=$libperl
7772                 ;;
7773         esac
7774         cat << EOM
7775
7776 I need to select a good name for the shared libperl.  If your system uses
7777 library names with major and minor numbers, then you might want something
7778 like $majmin.  Alternatively, if your system uses a single version
7779 number for shared libraries, then you might want to use $majonly.
7780 Or, your system might be quite happy with a simple libperl.$so.
7781
7782 Since the shared libperl will get installed into a version-specific
7783 architecture-dependent directory, the version number of the shared perl
7784 library probably isn't important, so the default should be o.k.
7785
7786 EOM
7787         rp='What name do you want to give to the shared libperl?'
7788         . ./myread
7789         libperl=$ans
7790         echo "Ok, I'll use $libperl"
7791         ;;
7792 *)
7793         libperl="libperl${_a}"
7794         ;;
7795 esac
7796
7797 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7798 case "$shrpdir" in
7799 '') ;;
7800 *)      $cat >&4 <<EOM
7801 WARNING:  Use of the shrpdir variable for the installation location of
7802 the shared $libperl is not supported.  It was never documented and
7803 will not work in this version.  Let me (perlbug@perl.org)
7804 know of any problems this may cause.
7805
7806 EOM
7807         case "$shrpdir" in
7808         "$archlibexp/CORE")
7809                 $cat >&4 <<EOM
7810 But your current setting of $shrpdir is
7811 the default anyway, so it's harmless.
7812 EOM
7813                 ;;
7814         *)
7815                 $cat >&4 <<EOM
7816 Further, your current attempted setting of $shrpdir
7817 conflicts with the value of $archlibexp/CORE
7818 that installperl will use.
7819 EOM
7820                 ;;
7821         esac
7822         ;;
7823 esac
7824
7825 # How will the perl executable find the installed shared $libperl?
7826 # Add $xxx to ccdlflags.
7827 # If we can't figure out a command-line option, use $shrpenv to
7828 # set env LD_RUN_PATH.  The main perl makefile uses this.
7829 shrpdir=$archlibexp/CORE
7830 xxx=''
7831 tmp_shrpenv=''
7832 if "$useshrplib"; then
7833     case "$osname" in 
7834         aix)
7835                 # We'll set it in Makefile.SH...
7836                 ;;
7837         solaris)
7838                 xxx="-R $shrpdir"
7839                 ;;
7840         freebsd|netbsd)
7841                 xxx="-Wl,-R$shrpdir"
7842                 ;;
7843         bsdos|linux|irix*|dec_osf)
7844                 xxx="-Wl,-rpath,$shrpdir"
7845                 ;;
7846         next)
7847                 # next doesn't like the default...
7848                 ;;
7849         beos)
7850                 # beos doesn't like the default, either.
7851                 ;;
7852         hpux*)
7853                 # hpux doesn't like the default, either.
7854                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7855                 ;;
7856         *)
7857                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7858                 ;;
7859         esac
7860         case "$xxx" in
7861         '') ;;
7862         *)      
7863                 # Only add $xxx if it isn't already in ccdlflags.
7864                 case " $ccdlflags " in
7865                 *" $xxx "*)     ;;
7866                 *)      ccdlflags="$ccdlflags $xxx"
7867                         cat <<EOM >&4
7868
7869 Adding $xxx to the flags
7870 passed to $ld so that the perl executable will find the 
7871 installed shared $libperl.
7872
7873 EOM
7874                         ;;
7875                 esac
7876                 ;;
7877         esac
7878 fi
7879 # Fix ccdlflags in AIX for building external extensions.
7880 # (For building Perl itself bare -bE:perl.exp is needed,
7881 #  Makefile.SH takes care of this.)
7882 case "$osname" in
7883 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7884 esac
7885 # Respect a hint or command-line value.
7886 case "$shrpenv" in
7887 '') shrpenv="$tmp_shrpenv" ;;
7888 esac
7889 case "$ldlibpthname" in
7890 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7891 none)   ldlibpthname='' ;;
7892 esac
7893
7894 : determine where manual pages are on this system
7895 echo " "
7896 case "$sysman" in
7897 '') 
7898         syspath='/usr/share/man/man1 /usr/man/man1'
7899         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7900         syspath="$syspath /usr/man/u_man/man1"
7901         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7902         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7903         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7904         sysman=`./loc . /usr/man/man1 $syspath`
7905         ;;
7906 esac
7907 if $test -d "$sysman"; then
7908         echo "System manual is in $sysman." >&4
7909 else
7910         echo "Could not find manual pages in source form." >&4
7911 fi
7912
7913 : determine where manual pages go
7914 set man1dir man1dir none
7915 eval $prefixit
7916 $cat <<EOM
7917
7918 $spackage has manual pages available in source form.
7919 EOM
7920 case "$nroff" in
7921 nroff)
7922         echo "However, you don't have nroff, so they're probably useless to you."
7923         case "$man1dir" in
7924         '') man1dir="none";;
7925         esac;;
7926 esac
7927 echo "If you don't want the manual sources installed, answer 'none'."
7928 case "$man1dir" in
7929 ' ') dflt=none
7930         ;;
7931 '')
7932         lookpath="$prefixexp/share/man/man1"
7933         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7934         lookpath="$lookpath $prefixexp/man/p_man/man1"
7935         lookpath="$lookpath $prefixexp/man/u_man/man1"
7936         lookpath="$lookpath $prefixexp/man/man.1"
7937         case "$sysman" in
7938         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7939         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7940         esac
7941         set dflt
7942         eval $prefixup
7943         ;;
7944 *)  dflt="$man1dir"
7945         ;;
7946 esac
7947 echo " "
7948 fn=dn+~
7949 rp="Where do the main $spackage manual pages (source) go?"
7950 . ./getfile
7951 if $test "X$man1direxp" != "X$ansexp"; then
7952         installman1dir=''
7953 fi
7954 man1dir="$ans"
7955 man1direxp="$ansexp"
7956 case "$man1dir" in
7957 '')     man1dir=' '
7958         installman1dir='';;
7959 esac
7960
7961 : Change installation prefix, if necessary.
7962 if $test X"$prefix" != X"$installprefix"; then
7963         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7964 else
7965         installman1dir="$man1direxp"
7966 fi
7967
7968 : What suffix to use on installed man pages
7969
7970 case "$man1dir" in
7971 ' ')
7972         man1ext='0'
7973         ;;
7974 *)
7975         rp="What suffix should be used for the main $spackage man pages?"
7976         case "$man1ext" in
7977         '')     case "$man1dir" in
7978                 *1)  dflt=1 ;;
7979                 *1p) dflt=1p ;;
7980                 *1pm) dflt=1pm ;;
7981                 *l) dflt=l;;
7982                 *n) dflt=n;;
7983                 *o) dflt=o;;
7984                 *p) dflt=p;;
7985                 *C) dflt=C;;
7986                 *L) dflt=L;;
7987                 *L1) dflt=L1;;
7988                 *) dflt=1;;
7989                 esac
7990                 ;;
7991         *)      dflt="$man1ext";;
7992         esac
7993         . ./myread
7994         man1ext="$ans"
7995         ;;
7996 esac
7997
7998 : see if we can have long filenames
7999 echo " "
8000 first=123456789abcdef
8001 $rm -f $first
8002 if (echo hi >$first) 2>/dev/null; then
8003         if $test -f 123456789abcde; then
8004                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8005                 val="$undef"
8006         else
8007                 echo 'You can have filenames longer than 14 characters.'>&4
8008                 val="$define"
8009         fi
8010 else
8011         $cat <<'EOM'
8012 You can't have filenames longer than 14 chars.
8013 You can't even think about them!
8014 EOM
8015         val="$undef"
8016 fi 
8017 set d_flexfnam
8018 eval $setvar
8019 $rm -rf 123456789abcde*
8020
8021 : determine where library module manual pages go
8022 set man3dir man3dir none
8023 eval $prefixit
8024 $cat <<EOM
8025
8026 $spackage has manual pages for many of the library modules.
8027 EOM
8028
8029 case "$nroff" in
8030 nroff)
8031         $cat <<'EOM'
8032 However, you don't have nroff, so they're probably useless to you.
8033 EOM
8034         case "$man3dir" in
8035         '') man3dir="none";;
8036         esac;;
8037 esac
8038
8039 case "$d_flexfnam" in
8040 undef)
8041         $cat <<'EOM'
8042 However, your system can't handle the long file names like File::Basename.3. 
8043 EOM
8044         case "$man3dir" in
8045         '') man3dir="none";;
8046         esac;;
8047 esac
8048
8049 echo "If you don't want the manual sources installed, answer 'none'."
8050 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8051 case "$man3dir" in
8052 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8053         if $test -d "$privlib/man/man3"; then
8054                 cat <<EOM >&4
8055
8056 WARNING:  Previous versions of perl installed man3 pages into
8057 $privlib/man/man3.  This version will suggest a 
8058 new default of $dflt.  
8059 EOM
8060                 tdflt=$dflt
8061                 dflt='n'
8062                 rp='Do you wish to preserve the old behavior?(y/n)'
8063                 . ./myread
8064                 case "$ans" in
8065                 y*) dflt="$privlib/man/man3" ;;
8066                 *)  dflt=$tdflt ;;
8067                 esac
8068     fi
8069         ;;
8070 *)      dflt="$man3dir" ;;
8071 esac
8072 case "$dflt" in
8073 ' ') dflt=none ;;
8074 esac
8075 echo " "
8076 fn=dn+~
8077 rp="Where do the $package library man pages (source) go?"
8078 . ./getfile
8079 man3dir="$ans"
8080 man3direxp="$ansexp"
8081 case "$man3dir" in
8082 '')     man3dir=' '
8083         installman3dir='';;
8084 esac
8085
8086 : Change installation prefix, if necessary.
8087 if $test X"$prefix" != X"$installprefix"; then
8088         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8089 else
8090         installman3dir="$man3direxp"
8091 fi
8092
8093 : What suffix to use on installed man pages
8094 case "$man3dir" in
8095 ' ')
8096         man3ext='0'
8097         ;;
8098 *)
8099         rp="What suffix should be used for the $package library man pages?"
8100         case "$man3ext" in
8101         '')     case "$man3dir" in
8102                 *3)  dflt=3 ;;
8103                 *3p) dflt=3p ;;
8104                 *3pm) dflt=3pm ;;
8105                 *l) dflt=l;;
8106                 *n) dflt=n;;
8107                 *o) dflt=o;;
8108                 *p) dflt=p;;
8109                 *C) dflt=C;;
8110                 *L) dflt=L;;
8111                 *L3) dflt=L3;;
8112                 *) dflt=3;;
8113                 esac
8114                 ;;
8115         *)      dflt="$man3ext";;
8116         esac
8117         . ./myread
8118         man3ext="$ans"
8119         ;;
8120 esac
8121
8122 : see if we have to deal with yellow pages, now NIS.
8123 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8124         if $test -f /usr/etc/nibindd; then
8125                 echo " "
8126                 echo "I'm fairly confident you're on a NeXT."
8127                 echo " "
8128                 rp='Do you get the hosts file via NetInfo?'
8129                 dflt=y
8130                 case "$hostcat" in
8131                 nidump*) ;;
8132                 '') ;;
8133                 *) dflt=n;;
8134                 esac
8135                 . ./myread
8136                 case "$ans" in
8137                 y*) hostcat='nidump hosts .';;
8138                 *)      case "$hostcat" in
8139                         nidump*) hostcat='';;
8140                         esac
8141                         ;;
8142                 esac
8143         fi
8144         case "$hostcat" in
8145         nidump*) ;;
8146         *)
8147                 case "$hostcat" in
8148                 *ypcat*) dflt=y;;
8149                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8150                                 dflt=y
8151                         else
8152                                 dflt=n
8153                         fi;;
8154                 *) dflt=n;;
8155                 esac
8156                 echo " "
8157                 rp='Are you getting the hosts file via yellow pages?'
8158                 . ./myread
8159                 case "$ans" in
8160                 y*) hostcat='ypcat hosts';;
8161                 *) hostcat='cat /etc/hosts';;
8162                 esac
8163                 ;;
8164         esac
8165 fi
8166 case "$hostcat" in
8167 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8168 esac
8169 case "$groupcat" in
8170 '') test -f /etc/group && groupcat='cat /etc/group';;
8171 esac
8172 case "$passcat" in
8173 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8174 esac
8175
8176 : now get the host name
8177 echo " "
8178 echo "Figuring out host name..." >&4
8179 case "$myhostname" in
8180 '') cont=true
8181         echo 'Maybe "hostname" will work...'
8182         if tans=`sh -c hostname 2>&1` ; then
8183                 myhostname=$tans
8184                 phostname=hostname
8185                 cont=''
8186         fi
8187         ;;
8188 *) cont='';;
8189 esac
8190 if $test "$cont"; then
8191         if ./xenix; then
8192                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8193                 if tans=`cat /etc/systemid 2>&1` ; then
8194                         myhostname=$tans
8195                         phostname='cat /etc/systemid'
8196                         echo "Whadyaknow.  Xenix always was a bit strange..."
8197                         cont=''
8198                 fi
8199         elif $test -r /etc/systemid; then
8200                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8201         fi
8202 fi
8203 if $test "$cont"; then
8204         echo 'No, maybe "uuname -l" will work...'
8205         if tans=`sh -c 'uuname -l' 2>&1` ; then
8206                 myhostname=$tans
8207                 phostname='uuname -l'
8208         else
8209                 echo 'Strange.  Maybe "uname -n" will work...'
8210                 if tans=`sh -c 'uname -n' 2>&1` ; then
8211                         myhostname=$tans
8212                         phostname='uname -n'
8213                 else
8214                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8215                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8216                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8217                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8218                         else
8219                                 case "$myhostname" in
8220                                 '') echo "Does this machine have an identity crisis or something?"
8221                                         phostname='';;
8222                                 *)
8223                                         echo "Well, you said $myhostname before..."
8224                                         phostname='echo $myhostname';;
8225                                 esac
8226                         fi
8227                 fi
8228         fi
8229 fi
8230 case "$myhostname" in
8231 '') myhostname=noname ;;
8232 esac
8233 : you do not want to know about this
8234 set $myhostname
8235 myhostname=$1
8236
8237 : verify guess
8238 if $test "$myhostname" ; then
8239         dflt=y
8240         rp='Your host name appears to be "'$myhostname'".'" Right?"
8241         . ./myread
8242         case "$ans" in
8243         y*) ;;
8244         *) myhostname='';;
8245         esac
8246 fi
8247
8248 : bad guess or no guess
8249 while $test "X$myhostname" = X ; do
8250         dflt=''
8251         rp="Please type the (one word) name of your host:"
8252         . ./myread
8253         myhostname="$ans"
8254 done
8255
8256 : translate upper to lower if necessary
8257 case "$myhostname" in
8258 *[A-Z]*)
8259         echo "(Normalizing case in your host name)"
8260         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8261         ;;
8262 esac
8263
8264 case "$myhostname" in
8265 *.*)
8266         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8267         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8268         echo "(Trimming domain name from host name--host name is now $myhostname)"
8269         ;;
8270 *) case "$mydomain" in
8271         '')
8272                 {
8273                         test "X$hostcat" = "Xypcat hosts" &&
8274                         ypmatch "$myhostname" hosts 2>/dev/null |\
8275                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8276                         $test -s hosts
8277                 } || {
8278                         test "X$hostcat" != "X" &&
8279                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8280                                         /[       ]$myhostname[  . ]/p" > hosts
8281                 }
8282                 tmp_re="[       . ]"
8283                 if $test -f hosts; then
8284                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8285                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8286                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8287                                 hosts | $sort | $uniq | \
8288                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8289                         case `$echo X$dflt` in
8290                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8291                                 dflt=.
8292                                 ;;
8293                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8294                                 ;;
8295                         esac
8296                 else
8297                         echo "(I cannot locate a hosts database anywhere)"
8298                         dflt=.
8299                 fi
8300                 case "$dflt" in
8301                 .)
8302                         tans=`./loc resolv.conf X /etc /usr/etc`
8303                         if $test -f "$tans"; then
8304                                 echo "(Attempting domain name extraction from $tans)"
8305                                 dflt=.`$sed -n -e 's/   / /g' \
8306                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8307                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8308                                 case "$dflt" in
8309                                 .) dflt=.`$sed -n -e 's/        / /g' \
8310                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8311                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8312                                         ;;
8313                                 esac
8314                         fi
8315                         ;;
8316                 esac
8317                 case "$dflt" in
8318                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8319                         dflt=.`sh -c domainname 2>/dev/null`
8320                         case "$dflt" in
8321                         '') dflt='.';;
8322                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8323                         esac
8324                         ;;
8325                 esac
8326                 case "$dflt$osname" in
8327                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8328                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8329                         ;;
8330                 esac
8331                 case "$dflt" in
8332                 .) echo "(Lost all hope -- silly guess then)"
8333                         dflt='.nonet'
8334                         ;;
8335                 esac
8336                 $rm -f hosts
8337                 ;;
8338         *) dflt="$mydomain";;
8339         esac;;
8340 esac
8341 echo " "
8342 rp="What is your domain name?"
8343 . ./myread
8344 tans="$ans"
8345 case "$ans" in
8346 '') ;;
8347 .*) ;;
8348 *) tans=".$tans";;
8349 esac
8350 mydomain="$tans"
8351
8352 : translate upper to lower if necessary
8353 case "$mydomain" in
8354 *[A-Z]*)
8355         echo "(Normalizing case in your domain name)"
8356         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8357         ;;
8358 esac
8359
8360 : a little sanity check here
8361 case "$phostname" in
8362 '') ;;
8363 *)
8364         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8365         $myhostname$mydomain|$myhostname) ;;
8366         *)
8367                 case "$phostname" in
8368                 sed*)
8369                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8370                         ;;
8371                 *)
8372                         echo "(That doesn't agree with your $phostname command, by the way.)"
8373                         ;;
8374                 esac
8375         ;;
8376         esac
8377         ;;
8378 esac
8379
8380 $cat <<EOM
8381
8382 I need to get your e-mail address in Internet format if possible, i.e.
8383 something like user@host.domain. Please answer accurately since I have
8384 no easy means to double check it. The default value provided below
8385 is most probably close to reality but may not be valid from outside
8386 your organization...
8387
8388 EOM
8389 cont=x
8390 while test "$cont"; do
8391         case "$cf_email" in
8392         '') dflt="$cf_by@$myhostname$mydomain";;
8393         *) dflt="$cf_email";;
8394         esac
8395         rp='What is your e-mail address?'
8396         . ./myread
8397         cf_email="$ans"
8398         case "$cf_email" in
8399         *@*.*) cont='' ;;
8400         *)
8401                 rp='Address does not look like an Internet one.  Use it anyway?'
8402                 case "$fastread" in
8403                 yes) dflt=y ;;
8404                 *) dflt=n ;;
8405                 esac
8406                 . ./myread
8407                 case "$ans" in
8408                 y*) cont='' ;;
8409                 *) echo " " ;;
8410                 esac
8411                 ;;
8412         esac
8413 done
8414
8415 $cat <<EOM
8416
8417 If you or somebody else will be maintaining perl at your site, please
8418 fill in the correct e-mail address here so that they may be contacted
8419 if necessary. Currently, the "perlbug" program included with perl
8420 will send mail to this address in addition to perlbug@perl.org. You may
8421 enter "none" for no administrator.
8422
8423 EOM
8424 case "$perladmin" in
8425 '') dflt="$cf_email";;
8426 *) dflt="$perladmin";;
8427 esac
8428 rp='Perl administrator e-mail address'
8429 . ./myread
8430 perladmin="$ans"
8431
8432 : determine whether to only install version-specific parts.
8433 echo " "
8434 $cat <<EOM
8435 Do you want to install only the version-specific parts of the perl
8436 distribution?  Usually you do *not* want to do this.
8437 EOM
8438 case "$versiononly" in
8439 "$define"|[Yy]*|true) dflt='y' ;;
8440 *) dflt='n';
8441 esac
8442 rp="Do you want to install only the version-specific parts of perl?"
8443 . ./myread
8444 case "$ans" in
8445 [yY]*)  val="$define";;
8446 *)      val="$undef" ;;
8447 esac
8448 set versiononly
8449 eval $setvar
8450
8451 case "$versiononly" in
8452 "$define") inc_version_list=''
8453            inc_version_list_init=0
8454            ;;
8455 esac
8456
8457 : figure out how to guarantee perl startup
8458 case "$startperl" in
8459 '')
8460         case "$sharpbang" in
8461         *!)
8462                 $cat <<EOH
8463
8464 I can use the #! construct to start perl on your system. This will
8465 make startup of perl scripts faster, but may cause problems if you
8466 want to share those scripts and perl is not in a standard place
8467 ($binexp/perl) on all your platforms. The alternative is to force
8468 a shell by starting the script with a single ':' character.
8469
8470 EOH
8471                 case "$versiononly" in
8472                 "$define")      dflt="$binexp/perl$version";;  
8473                 *)              dflt="$binexp/perl";;
8474                 esac
8475                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8476                 . ./myread
8477                 case "$ans" in
8478                 none)   startperl=": # use perl";;
8479                 *)      startperl="#!$ans"
8480                         if $test 30 -lt `echo "$ans" | wc -c`; then
8481                                 $cat >&4 <<EOM
8482
8483 WARNING:  Some systems limit the #! command to 32 characters.
8484 If you experience difficulty running Perl scripts with #!, try
8485 installing Perl in a directory with a shorter pathname.
8486
8487 EOM
8488                         fi ;;
8489                 esac
8490                 ;;
8491         *) startperl=": # use perl"
8492                 ;;
8493         esac
8494         ;;
8495 esac
8496 echo "I'll use $startperl to start perl scripts."
8497
8498 : figure best path for perl in scripts
8499 case "$perlpath" in
8500 '')
8501         case "$versiononly" in
8502         "$define")      perlpath="$binexp/perl$version";;
8503         *)              perlpath="$binexp/perl";;
8504         esac
8505         case "$startperl" in
8506         *!*) ;;
8507         *)
8508                 $cat <<EOH
8509
8510 I will use the "eval 'exec'" idiom to start Perl on your system.
8511 I can use the full path of your Perl binary for this purpose, but
8512 doing so may cause problems if you want to share those scripts and
8513 Perl is not always in a standard place ($binexp/perl).
8514
8515 EOH
8516                 dflt="$binexp/perl"
8517                 rp="What path shall I use in \"eval 'exec'\"?"
8518                 . ./myread
8519                 perlpath="$ans"
8520                 ;;
8521         esac
8522         ;;
8523 esac
8524 case "$startperl" in
8525 *!*)    ;;
8526 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8527 esac
8528
8529 : determine where public executable scripts go
8530 set scriptdir scriptdir
8531 eval $prefixit
8532 case "$scriptdir" in
8533 '')
8534         dflt="$bin"
8535         : guess some guesses
8536         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8537         $test -d /usr/share/bin     && dflt=/usr/share/bin
8538         $test -d /usr/local/script  && dflt=/usr/local/script
8539         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8540         $test -d $prefixexp/script  && dflt=$prefixexp/script
8541         set dflt
8542         eval $prefixup
8543         ;;
8544 *)  dflt="$scriptdir"
8545         ;;
8546 esac
8547 $cat <<EOM
8548  
8549 Some installations have a separate directory just for executable scripts so
8550 that they can mount it across multiple architectures but keep the scripts in
8551 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8552 Or you might just lump your scripts in with all your other executables.
8553  
8554 EOM
8555 fn=d~
8556 rp='Where do you keep publicly executable scripts?'
8557 . ./getfile
8558 if $test "X$ansexp" != "X$scriptdirexp"; then
8559         installscript=''
8560 fi
8561 scriptdir="$ans"
8562 scriptdirexp="$ansexp"
8563 : Change installation prefix, if necessary.
8564 if $test X"$prefix" != X"$installprefix"; then
8565         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8566 else
8567         installscript="$scriptdirexp"
8568 fi
8569
8570 : determine where add-on public executables go
8571 case "$sitebin" in
8572 '')     dflt=$siteprefix/bin ;;
8573 *)      dflt=$sitebin ;;
8574 esac
8575 fn=d~
8576 rp='Pathname where the add-on public executables should be installed?'
8577 . ./getfile
8578 sitebin="$ans"
8579 sitebinexp="$ansexp"
8580 : Change installation prefix, if necessary.
8581 if $test X"$prefix" != X"$installprefix"; then
8582         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8583 else
8584         installsitebin="$sitebinexp"
8585 fi
8586
8587 : define an is-a-typedef? function
8588 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8589 case "$inclist" in
8590 "") inclist="sys/types.h";;
8591 esac;
8592 eval "varval=\$$var";
8593 case "$varval" in
8594 "")
8595         $rm -f temp.c;
8596         for inc in $inclist; do
8597                 echo "#include <$inc>" >>temp.c;
8598         done;
8599         echo "#ifdef $type" >> temp.c;
8600         echo "printf(\"We have $type\");" >> temp.c;
8601         echo "#endif" >> temp.c;
8602         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8603         if $contains $type temp.E >/dev/null 2>&1; then
8604                 eval "$var=\$type";
8605         else
8606                 eval "$var=\$def";
8607         fi;
8608         $rm -f temp.?;;
8609 *) eval "$var=\$varval";;
8610 esac'
8611
8612 : define an is-a-typedef? function that prompts if the type is not available.
8613 typedef_ask='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         echo " " ;
8629         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8630         if $contains $type temp.E >/dev/null 2>&1; then
8631                 echo "$type found." >&4;
8632                 eval "$var=\$type";
8633         else
8634                 echo "$type NOT found." >&4;
8635                 dflt="$def";
8636                 . ./myread ;
8637                 eval "$var=\$ans";
8638         fi;
8639         $rm -f temp.?;;
8640 *) eval "$var=\$varval";;
8641 esac'
8642
8643 : see what type lseek is declared as in the kernel
8644 rp="What is the type used for lseek's offset on this system?"
8645 set off_t lseektype long stdio.h sys/types.h
8646 eval $typedef_ask
8647
8648 echo " "
8649 echo "Checking to see how big your file offsets are..." >&4
8650 $cat >try.c <<EOCP
8651 #include <sys/types.h>
8652 #include <stdio.h>
8653 int main()
8654 {
8655     printf("%d\n", (int)sizeof($lseektype));
8656     return(0); 
8657 }
8658 EOCP
8659 set try
8660 if eval $compile_ok; then
8661         lseeksize=`$run ./try`
8662         echo "Your file offsets are $lseeksize bytes long."
8663 else
8664         dflt=$longsize
8665         echo " "
8666         echo "(I can't seem to compile the test program.  Guessing...)"
8667         rp="What is the size of your file offsets (in bytes)?"
8668         . ./myread
8669         lseeksize="$ans"
8670 fi
8671 $rm -f try.c try
8672
8673 : see what type file positions are declared as in the library
8674 rp="What is the type for file position used by fsetpos()?"
8675 set fpos_t fpostype long stdio.h sys/types.h
8676 eval $typedef_ask
8677
8678 echo " "
8679 case "$fpostype" in
8680 *_t) zzz="$fpostype"    ;;
8681 *)   zzz="fpos_t"       ;;
8682 esac
8683 echo "Checking the size of $zzz..." >&4 
8684 cat > try.c <<EOCP
8685 #include <sys/types.h>
8686 #include <stdio.h>
8687 int main() {
8688     printf("%d\n", (int)sizeof($fpostype));
8689     exit(0);
8690 }
8691 EOCP
8692 set try
8693 if eval $compile_ok; then
8694         yyy=`$run ./try`
8695         case "$yyy" in
8696         '')     fpossize=4
8697                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8698                 ;;
8699         *)      fpossize=$yyy
8700                 echo "Your $zzz is $fpossize bytes long."
8701                 ;;
8702         esac
8703 else
8704         dflt="$longsize"
8705         echo " " >&4
8706         echo "(I can't compile the test program.  Guessing...)" >&4
8707         rp="What is the size of your file positions (in bytes)?"
8708         . ./myread
8709         fpossize="$ans"
8710 fi
8711
8712
8713
8714 # Backward compatibility (uselfs is deprecated).
8715 case "$uselfs" in
8716 "$define"|true|[yY]*)
8717         cat <<EOM >&4
8718
8719 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8720 EOM
8721         uselargefiles="$define"
8722         ;;
8723 esac                          
8724
8725 case "$lseeksize:$fpossize" in
8726 8:8) cat <<EOM
8727
8728 You can have files larger than 2 gigabytes.
8729 EOM
8730    val="$define" ;;
8731 *)    case "$uselargefiles" in
8732    "$undef"|false|[nN]*) dflt='n' ;;
8733    *)   dflt='y' ;;
8734    esac
8735    cat <<EOM
8736
8737 Perl can be built to understand large files (files larger than 2 gigabytes)
8738 on some systems.  To do so, Configure can be run with -Duselargefiles.
8739
8740 If this doesn't make any sense to you, just accept the default '$dflt'.
8741 EOM
8742    rp='Try to understand large files, if available?'
8743    . ./myread
8744    case "$ans" in
8745    y|Y)         val="$define" ;;
8746    *)           val="$undef"  ;;
8747    esac
8748    ;;
8749 esac
8750 set uselargefiles
8751 eval $setvar
8752 case "$uselargefiles" in
8753 "$define")
8754 : Look for a hint-file generated 'call-back-unit'.  If the
8755 : user has specified that a large files perl is to be built,
8756 : we may need to set or change some other defaults.
8757         if $test -f uselargefiles.cbu; then
8758                 echo "Your platform has some specific hints for large file builds, using them..."
8759                 . ./uselargefiles.cbu
8760                 echo " "
8761                 echo "Rechecking to see how big your file offsets are..." >&4
8762                 $cat >try.c <<EOCP
8763 #include <sys/types.h>
8764 #include <stdio.h>
8765 int main()
8766 {
8767     printf("%d\n", (int)sizeof($lseektype));
8768     return(0); 
8769 }
8770 EOCP
8771                 set try
8772                 if eval $compile_ok; then
8773                         lseeksize=`$run ./try`
8774                         $echo "Your file offsets are now $lseeksize bytes long."
8775                 else
8776                         dflt="$lseeksize"
8777                         echo " "
8778                         echo "(I can't seem to compile the test program.  Guessing...)"
8779                         rp="What is the size of your file offsets (in bytes)?"
8780                         . ./myread
8781                         lseeksize="$ans"
8782                 fi
8783                 case "$fpostype" in
8784                 *_t) zzz="$fpostype"    ;;
8785                 *)   zzz="fpos_t"       ;;
8786                 esac
8787                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8788                 $cat > try.c <<EOCP
8789 #include <sys/types.h>
8790 #include <stdio.h>
8791 int main() {
8792     printf("%d\n", (int)sizeof($fpostype));
8793     exit(0);
8794 }
8795 EOCP
8796                 set try
8797                 if eval $compile_ok; then
8798                         yyy=`$run ./try`
8799                         dflt="$lseeksize"
8800                         case "$yyy" in
8801                         '')     echo " "
8802                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8803                                 ;;
8804                         *)      fpossize=$yyy
8805                                 echo " $fpossize bytes." >&4
8806                                 ;;
8807                         esac
8808                 else
8809                         dflt="$fpossize"
8810                         echo " "
8811                         echo "(I can't compile the test program.  Guessing...)" >&4
8812                         rp="What is the size of your file positions (in bytes)?"
8813                         . ./myread
8814                         fpossize="$ans"
8815                 fi
8816                 $rm -f try.c try
8817         fi
8818         ;;
8819 esac
8820
8821 case "$vendorprefix" in
8822 '')     d_vendorbin="$undef"
8823         vendorbin=''
8824         vendorbinexp=''
8825         ;;
8826 *)      d_vendorbin="$define"
8827         : determine where vendor-supplied executables go.
8828         case "$vendorbin" in
8829         '') dflt=$vendorprefix/bin ;;
8830         *)      dflt="$vendorbin" ;;
8831         esac
8832         fn=d~+
8833         rp='Pathname for the vendor-supplied executables directory?'
8834         . ./getfile
8835         vendorbin="$ans"
8836         vendorbinexp="$ansexp"
8837         ;;
8838 esac
8839 : Change installation prefix, if necessary.
8840 if $test X"$prefix" != X"$installprefix"; then
8841         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8842 else
8843         installvendorbin="$vendorbinexp"
8844 fi
8845
8846 : see if qgcvt exists
8847 set qgcvt d_qgcvt
8848 eval $inlibc
8849
8850 : Check how to convert floats to strings.
8851
8852 if test "X$d_Gconvert" = X; then
8853
8854 echo " "
8855 echo "Checking for an efficient way to convert floats to strings."
8856 echo " " > try.c
8857 case "$uselongdouble" in
8858 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8859 esac
8860 case "$d_longdbl" in
8861 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8862 esac
8863 case "$d_PRIgldbl" in
8864 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
8865 esac
8866 $cat >>try.c <<EOP
8867 #ifdef TRY_gconvert
8868 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8869 char *myname = "gconvert";
8870 #endif
8871 #ifdef TRY_gcvt
8872 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8873 char *myname = "gcvt";
8874 #endif
8875 #ifdef TRY_qgcvt
8876 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8877 char *myname = "qgcvt";
8878 #define DOUBLETYPE long double
8879 #endif
8880 #ifdef TRY_sprintf
8881 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8882 #ifdef HAS_PRIgldbl
8883 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8884 #else
8885 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
8886 #endif
8887 #else
8888 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8889 #endif
8890 char *myname = "sprintf";
8891 #endif
8892
8893 #ifndef DOUBLETYPE
8894 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8895 #define DOUBLETYPE long double
8896 #else
8897 #define DOUBLETYPE double
8898 #endif
8899 #endif
8900
8901 #include <stdio.h>
8902
8903 #define I_STDLIB $i_stdlib
8904 #ifdef I_STDLIB
8905 #include <stdlib.h>
8906 #endif
8907
8908 int
8909 checkit(expect, got)
8910 char *expect;
8911 char *got;
8912 {
8913     if (strcmp(expect, got)) {
8914                 printf("%s oddity:  Expected %s, got %s\n",
8915                         myname, expect, got);
8916                 exit(1);
8917         }
8918 }
8919
8920 int main()
8921
8922         char buf[64]; 
8923         buf[63] = '\0';
8924
8925         /* This must be 1st test on (which?) platform */
8926         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8927         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8928         checkit("0.1", buf);
8929
8930         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
8931         checkit("0.01", buf);
8932
8933         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
8934         checkit("0.001", buf);
8935
8936         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
8937         checkit("0.0001", buf);
8938
8939         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
8940         if (strlen(buf) > 5)
8941             checkit("9e-005", buf); /* for Microsoft ?? */
8942         else
8943             checkit("9e-05", buf);
8944
8945         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
8946         checkit("1", buf);
8947
8948         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
8949         checkit("1.1", buf);
8950
8951         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
8952         checkit("1.01", buf);
8953
8954         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
8955         checkit("1.001", buf);
8956
8957         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
8958         checkit("1.0001", buf);
8959
8960         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
8961         checkit("1.00001", buf);
8962
8963         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
8964         checkit("1.000001", buf);
8965
8966         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
8967         checkit("0", buf);
8968
8969         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
8970         checkit("-1", buf);
8971
8972         /* Some Linux gcvt's give 1.e+5 here. */
8973         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
8974         checkit("100000", buf);
8975         
8976         /* Some Linux gcvt's give -1.e+5 here. */
8977         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
8978         checkit("-100000", buf);
8979
8980         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
8981         checkit("123.456", buf);
8982
8983         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
8984         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
8985         /* 34 should be enough to scare even long double
8986          * places into using the e notation. */
8987         if (strlen(buf) > 5)
8988             checkit("1e+034", buf); /* for Microsoft */
8989         else
8990             checkit("1e+34", buf);
8991
8992         /* For Perl, if you add additional tests here, also add them to
8993          * t/base/num.t for benefit of platforms not using Configure or
8994          * overriding d_Gconvert */
8995
8996         exit(0);
8997 }
8998 EOP
8999 : first add preferred functions to our list
9000 xxx_list=""
9001 for xxx_convert in $gconvert_preference; do
9002     case $xxx_convert in
9003     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9004     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9005     esac 
9006 done
9007 : then add any others
9008 for xxx_convert in gconvert gcvt sprintf; do
9009     case "$xxx_list" in
9010     *$xxx_convert*) ;;
9011     *) xxx_list="$xxx_list $xxx_convert" ;;
9012     esac 
9013 done
9014
9015 case "$d_longdbl$uselongdouble" in
9016 "$define$define")
9017     : again, add prefered functions to our list first
9018     xxx_ld_list=""
9019     for xxx_convert in $gconvert_ld_preference; do
9020         case $xxx_convert in
9021         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9022         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9023         esac
9024     done
9025     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9026     for xxx_convert in qgcvt sprintf $xxx_list; do
9027         case "$xxx_ld_list" in
9028         $xxx_convert*|*" $xxx_convert"*) ;;
9029         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9030         esac
9031     done
9032     : if sprintf cannot do long doubles, move it to the end
9033     if test "$d_PRIgldbl" != "$define"; then
9034         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9035     fi
9036     : if no qgcvt, remove it
9037     if test "$d_qgcvt" != "$define"; then
9038         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9039     fi
9040     : use the ld_list
9041     xxx_list="$xxx_ld_list"
9042     ;;
9043 esac
9044
9045 for xxx_convert in $xxx_list; do
9046         echo "Trying $xxx_convert..."
9047         $rm -f try try$_o
9048         set try -DTRY_$xxx_convert
9049         if eval $compile; then
9050                 echo "$xxx_convert() found." >&4
9051                 if $run ./try; then
9052                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9053                         break;
9054                 else
9055                         echo "...But $xxx_convert didn't work as I expected."
9056                         xxx_convert=''
9057                 fi
9058         else
9059                 echo "$xxx_convert NOT found." >&4
9060         fi
9061 done
9062
9063 if test X$xxx_convert = X; then
9064     echo "*** WHOA THERE!!! ***" >&4
9065     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9066     xxx_convert=sprintf
9067 fi
9068
9069 case "$xxx_convert" in
9070 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9071 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9072 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9073 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9074    "$define$define$define")
9075       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9076    "$define$define$undef")
9077       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9078    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9079    esac
9080    ;;  
9081 esac
9082
9083 fi
9084
9085 : see if _fwalk exists
9086 set fwalk d__fwalk
9087 eval $inlibc
9088
9089 : Initialize h_fcntl
9090 h_fcntl=false
9091
9092 : Initialize h_sysfile
9093 h_sysfile=false
9094
9095 : access call always available on UNIX
9096 set access d_access
9097 eval $inlibc
9098
9099 : locate the flags for 'access()'
9100 case "$d_access" in
9101 "$define")
9102         echo " "
9103         $cat >access.c <<'EOCP'
9104 #include <sys/types.h>
9105 #ifdef I_FCNTL
9106 #include <fcntl.h>
9107 #endif
9108 #ifdef I_SYS_FILE
9109 #include <sys/file.h>
9110 #endif
9111 #ifdef I_UNISTD
9112 #include <unistd.h>
9113 #endif
9114 int main() {
9115         exit(R_OK);
9116 }
9117 EOCP
9118         : check sys/file.h first, no particular reason here
9119         if $test `./findhdr sys/file.h` && \
9120                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9121                 h_sysfile=true;
9122                 echo "<sys/file.h> defines the *_OK access constants." >&4
9123         elif $test `./findhdr fcntl.h` && \
9124                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9125                 h_fcntl=true;
9126                 echo "<fcntl.h> defines the *_OK access constants." >&4
9127         elif $test `./findhdr unistd.h` && \
9128                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9129                 echo "<unistd.h> defines the *_OK access constants." >&4
9130         else
9131                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9132         fi
9133         ;;
9134 esac
9135 $rm -f access*
9136
9137 : see if accessx exists
9138 set accessx d_accessx
9139 eval $inlibc
9140
9141 : see if alarm exists
9142 set alarm d_alarm
9143 eval $inlibc
9144
9145 : see if POSIX threads are available
9146 set pthread.h i_pthread
9147 eval $inhdr
9148
9149 : define a fucntion to check prototypes
9150 $cat > protochk <<EOSH
9151 $startsh
9152 cc="$cc"
9153 optimize="$optimize"
9154 ccflags="$ccflags"
9155 prototype="$prototype"
9156 define="$define"
9157 rm=$rm
9158 usethreads=$usethreads
9159 i_pthread=$i_pthread
9160 pthread_h_first=$pthread_h_first
9161 EOSH
9162
9163 $cat >> protochk <<'EOSH'
9164
9165 $rm -f try.c
9166 foo="$1"
9167 shift
9168 while test $# -ge 2; do
9169         case "$1" in
9170                 $define) echo "#include <$2>" >> try.c ;;
9171                 literal) echo "$2" >> try.c ;;
9172         esac
9173     # Extra magic for the benefit of systems that need pthread.h
9174     # to be included early to correctly detect threadsafe functions.
9175     # Such functions must guarantee themselves, though, that the usethreads
9176     # and i_pthread have been defined, before calling protochk.
9177     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9178         echo "#include <pthread.h>" >> try.c
9179         pthread_h_done=yes
9180     fi
9181     shift 2
9182 done
9183 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9184 cat >> try.c <<'EOCP'
9185 #ifdef CAN_PROTOTYPE
9186 #define _(args) args
9187 #else
9188 #define _(args) ()
9189 #endif
9190 EOCP
9191 echo "$foo" >> try.c
9192 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9193 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9194 status=$?
9195 $rm -f try.[co]
9196 exit $status
9197 EOSH
9198 chmod +x protochk
9199 $eunicefix protochk
9200
9201 : see if sys/types.h has to be included
9202 set sys/types.h i_systypes
9203 eval $inhdr
9204
9205 : see if sys/select.h has to be included
9206 set sys/select.h i_sysselct
9207 eval $inhdr
9208
9209 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9210 while $test $# -ge 2; do
9211         case "$1" in
9212         $define) echo "#include <$2>";;
9213         esac ;
9214     shift 2;
9215 done > try.c;
9216 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9217 set try;
9218 if eval $compile; then
9219         val="$define";
9220 else
9221         val="$undef";
9222 fi;
9223 set $varname;
9224 eval $setvar;
9225 $rm -f try.c try.o'
9226
9227 : see if we should include time.h, sys/time.h, or both
9228 echo " "
9229 if test "X$timeincl" = X; then
9230         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9231         $echo $n "I'm now running the test program...$c"
9232         $cat >try.c <<'EOCP'
9233 #include <sys/types.h>
9234 #ifdef I_TIME
9235 #include <time.h>
9236 #endif
9237 #ifdef I_SYSTIME
9238 #ifdef SYSTIMEKERNEL
9239 #define KERNEL
9240 #endif
9241 #include <sys/time.h>
9242 #endif
9243 #ifdef I_SYSSELECT
9244 #include <sys/select.h>
9245 #endif
9246 int main()
9247 {
9248         struct tm foo;
9249 #ifdef S_TIMEVAL
9250         struct timeval bar;
9251 #endif
9252 #ifdef S_TIMEZONE
9253         struct timezone tzp;
9254 #endif
9255         if (foo.tm_sec == foo.tm_sec)
9256                 exit(0);
9257 #ifdef S_TIMEVAL
9258         if (bar.tv_sec == bar.tv_sec)
9259                 exit(0);
9260 #endif
9261         exit(1);
9262 }
9263 EOCP
9264         flags=''
9265         for s_timezone in '-DS_TIMEZONE' ''; do
9266         sysselect=''
9267         for s_timeval in '-DS_TIMEVAL' ''; do
9268         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9269         for i_time in '' '-DI_TIME'; do
9270         for i_systime in '-DI_SYSTIME' ''; do
9271                 case "$flags" in
9272                 '') $echo $n ".$c"
9273                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9274                         if eval $compile; then
9275                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9276                                 shift
9277                                 flags="$*"
9278                                 echo " "
9279                                 $echo $n "Succeeded with $flags$c"
9280                         fi
9281                         ;;
9282                 esac
9283         done
9284         done
9285         done
9286         done
9287         done
9288         timeincl=''
9289         echo " "
9290         case "$flags" in
9291         *SYSTIMEKERNEL*) i_systimek="$define"
9292                 timeincl=`./findhdr sys/time.h`
9293                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9294         *) i_systimek="$undef";;
9295         esac
9296         case "$flags" in
9297         *I_TIME*) i_time="$define"
9298                 timeincl=`./findhdr time.h`" $timeincl"
9299                 echo "We'll include <time.h>." >&4;;
9300         *) i_time="$undef";;
9301         esac
9302         case "$flags" in
9303         *I_SYSTIME*) i_systime="$define"
9304                 timeincl=`./findhdr sys/time.h`" $timeincl"
9305                 echo "We'll include <sys/time.h>." >&4;;
9306         *) i_systime="$undef";;
9307         esac
9308         $rm -f try.c try
9309 fi
9310 : see if struct tm knows about tm_zone
9311 case "$i_systime$i_time" in
9312 *$define*) 
9313         echo " "
9314         echo "Checking to see if your struct tm has tm_zone field..." >&4
9315         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9316         eval $hasfield
9317         ;;
9318 *)      val="$undef"
9319         set d_tm_tm_zone
9320         eval $setvar
9321         ;;
9322 esac
9323 case "$d_tm_tm_zone" in
9324 "$define")      echo "Yes, it does."   ;;
9325 *)              echo "No, it doesn't." ;;
9326 esac
9327 : see if struct tm knows about tm_gmtoff
9328 case "$i_systime$i_time" in
9329 *$define*) 
9330         echo " "
9331         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9332         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9333         eval $hasfield
9334         ;;
9335 *)      val="$undef"
9336         set d_tm_tm_gmtoff
9337         eval $setvar
9338         ;;
9339 esac
9340 case "$d_tm_tm_gmtoff" in
9341 "$define")      echo "Yes, it does."   ;;
9342 *)              echo "No, it doesn't." ;;
9343 esac
9344
9345 : see if asctime_r exists
9346 set asctime_r d_asctime_r
9347 eval $inlibc
9348 case "$d_asctime_r" in
9349 "$define")
9350         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9351         case "$d_asctime_r_proto:$usethreads" in
9352         ":define")      d_asctime_r_proto=define
9353                 set d_asctime_r_proto asctime_r $hdrs
9354                 eval $hasproto ;;
9355         *)      ;;
9356         esac
9357         case "$d_asctime_r_proto" in
9358         define)
9359         case "$asctime_r_proto" in
9360         ''|0) try='char* asctime_r(const struct tm*, char*);'
9361         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9362         esac
9363         case "$asctime_r_proto" in
9364         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9365         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9366         esac
9367         case "$asctime_r_proto" in
9368         ''|0) try='int asctime_r(const struct tm*, char*);'
9369         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9370         esac
9371         case "$asctime_r_proto" in
9372         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9373         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9374         esac
9375         case "$asctime_r_proto" in
9376         ''|0)   d_asctime_r=undef
9377                 asctime_r_proto=0
9378                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9379         * )     case "$asctime_r_proto" in
9380                 REENTRANT_PROTO*) ;;
9381                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9382                 esac
9383                 echo "Prototype: $try" ;;
9384         esac
9385         ;;
9386         *)      case "$usethreads" in
9387                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9388                 esac
9389                 d_asctime_r=undef
9390                 asctime_r_proto=0
9391                 ;;
9392         esac
9393         ;;
9394 *)      asctime_r_proto=0
9395         ;;
9396 esac
9397
9398 : see if atolf exists
9399 set atolf d_atolf
9400 eval $inlibc
9401
9402 : see if atoll exists
9403 set atoll d_atoll
9404 eval $inlibc
9405
9406 : Look for GNU-cc style attribute checking
9407 echo " "
9408 echo "Checking whether your compiler can handle __attribute__ ..." >&4
9409 $cat >attrib.c <<'EOCP'
9410 #include <stdio.h>
9411 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
9412 EOCP
9413 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9414         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9415                 echo "Your C compiler doesn't fully support __attribute__."
9416                 val="$undef"
9417         else
9418                 echo "Your C compiler supports __attribute__."
9419                 val="$define"
9420         fi
9421 else
9422         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9423         val="$undef"
9424 fi
9425 set d_attribut
9426 eval $setvar
9427 $rm -f attrib*
9428
9429 : see if bcmp exists
9430 set bcmp d_bcmp
9431 eval $inlibc
9432
9433 : see if bcopy exists
9434 set bcopy d_bcopy
9435 eval $inlibc
9436
9437 : see if this is a unistd.h system
9438 set unistd.h i_unistd
9439 eval $inhdr
9440
9441 : see if getpgrp exists
9442 set getpgrp d_getpgrp
9443 eval $inlibc
9444
9445 case "$d_getpgrp" in
9446 "$define")
9447         echo " "
9448         echo "Checking to see which flavor of getpgrp is in use..."
9449         $cat >try.c <<EOP
9450 #$i_unistd I_UNISTD
9451 #include <sys/types.h>
9452 #ifdef I_UNISTD
9453 #  include <unistd.h>
9454 #endif
9455 int main()
9456 {
9457         if (getuid() == 0) {
9458                 printf("(I see you are running Configure as super-user...)\n");
9459                 setuid(1);
9460         }
9461 #ifdef TRY_BSD_PGRP
9462         if (getpgrp(1) == 0)
9463                 exit(0);
9464 #else
9465         if (getpgrp() > 0)
9466                 exit(0);
9467 #endif
9468         exit(1);
9469 }
9470 EOP
9471         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9472                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
9473                 val="$define"
9474         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9475                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
9476                 val="$undef"
9477         else
9478                 echo "I can't seem to compile and run the test program."
9479                 if ./usg; then
9480                         xxx="a USG one, i.e. you use getpgrp()."
9481                 else
9482                         # SVR4 systems can appear rather BSD-ish.
9483                         case "$i_unistd" in
9484                         $undef)
9485                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
9486                                 val="$define"
9487                                 ;;
9488                         $define)
9489                                 xxx="probably a USG one, i.e. you use getpgrp()."
9490                                 val="$undef"
9491                                 ;;
9492                         esac
9493                 fi
9494                 echo "Assuming your getpgrp is $xxx" >&4
9495         fi
9496         ;;
9497 *) val="$undef";;
9498 esac
9499 set d_bsdgetpgrp
9500 eval $setvar
9501 $rm -f try try.*
9502
9503 : see if setpgrp exists
9504 set setpgrp d_setpgrp
9505 eval $inlibc
9506
9507 case "$d_setpgrp" in
9508 "$define")
9509         echo " "
9510         echo "Checking to see which flavor of setpgrp is in use..."
9511         $cat >try.c <<EOP
9512 #$i_unistd I_UNISTD
9513 #include <sys/types.h>
9514 #ifdef I_UNISTD
9515 #  include <unistd.h>
9516 #endif
9517 int main()
9518 {
9519         if (getuid() == 0) {
9520                 printf("(I see you are running Configure as super-user...)\n");
9521                 setuid(1);
9522         }
9523 #ifdef TRY_BSD_PGRP
9524         if (-1 == setpgrp(1, 1))
9525                 exit(0);
9526 #else
9527         if (setpgrp() != -1)
9528                 exit(0);
9529 #endif
9530         exit(1);
9531 }
9532 EOP
9533         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9534                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
9535                 val="$define"
9536         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9537                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
9538                 val="$undef"
9539         else
9540                 echo "(I can't seem to compile and run the test program.)"
9541                 if ./usg; then
9542                         xxx="a USG one, i.e. you use setpgrp()."
9543                 else
9544                         # SVR4 systems can appear rather BSD-ish.
9545                         case "$i_unistd" in
9546                         $undef)
9547                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
9548                                 val="$define"
9549                                 ;;
9550                         $define)
9551                                 xxx="probably a USG one, i.e. you use setpgrp()."
9552                                 val="$undef"
9553                                 ;;
9554                         esac
9555                 fi
9556                 echo "Assuming your setpgrp is $xxx" >&4
9557         fi
9558         ;;
9559 *) val="$undef";;
9560 esac
9561 set d_bsdsetpgrp
9562 eval $setvar
9563 $rm -f try try.*
9564 : see if bzero exists
9565 set bzero d_bzero
9566 eval $inlibc
9567
9568 : see if signal is declared as pointer to function returning int or void
9569 echo " "
9570 xxx=`./findhdr signal.h`
9571 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
9572 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
9573         echo "You have int (*signal())() instead of void." >&4
9574         val="$undef"
9575 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
9576         echo "You have void (*signal())()." >&4
9577         val="$define"
9578 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
9579         echo "You have int (*signal())() instead of void." >&4
9580         val="$undef"
9581 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
9582         echo "You have void (*signal())()." >&4
9583         val="$define"
9584 else
9585         case "$d_voidsig" in
9586         '')
9587         echo "I can't determine whether signal handler returns void or int..." >&4
9588                 dflt=void
9589                 rp="What type does your signal handler return?"
9590                 . ./myread
9591                 case "$ans" in
9592                 v*) val="$define";;
9593                 *) val="$undef";;
9594                 esac;;
9595         "$define")
9596                 echo "As you already told me, signal handler returns void." >&4
9597                 val="$define"
9598                 ;;
9599         *)      echo "As you already told me, signal handler returns int." >&4
9600                 val="$undef"
9601                 ;;
9602         esac
9603 fi
9604 set d_voidsig
9605 eval $setvar
9606 case "$d_voidsig" in
9607 "$define") signal_t="void";;
9608 *) signal_t="int";;
9609 esac
9610 $rm -f $$.tmp
9611
9612 : check for ability to cast large floats to 32-bit ints.
9613 echo " "
9614 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
9615 if $test "$intsize" -ge 4; then
9616         xxx=int
9617 else
9618         xxx=long
9619 fi
9620 $cat >try.c <<EOCP
9621 #include <stdio.h>
9622 #include <sys/types.h>
9623 #include <signal.h>
9624 $signal_t blech(s) int s; { exit(3); }
9625 int main()
9626 {
9627         $xxx i32;
9628         double f, g;
9629         int result = 0;
9630         char str[16];
9631         signal(SIGFPE, blech);
9632
9633         /* Don't let compiler optimize the test away.  Store the number 
9634            in a writable string for gcc to pass to sscanf under HP/UX.
9635         */
9636         sprintf(str, "2147483647");
9637         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
9638         g = 10 * f;
9639         i32  = ($xxx) g;
9640
9641         /* x86 processors will probably give 0x8000 0000, which is a
9642        sign change.  We don't want that.  We want to mimic SPARC
9643            behavior here, which is to preserve the sign and give
9644            back 0x7fff ffff.
9645         */
9646         if (i32 != ($xxx) f)
9647                 result |= 1;
9648         exit(result);
9649 }
9650 EOCP
9651 set try
9652 if eval $compile_ok; then
9653         $run ./try
9654         yyy=$?
9655 else
9656         echo "(I can't seem to compile the test program--assuming it can't)"
9657         yyy=1
9658 fi
9659 case "$yyy" in
9660 0)      val="$define"
9661         echo "Yup, it can."
9662         ;;
9663 *)      val="$undef"
9664         echo "Nope, it can't."
9665         ;;
9666 esac
9667 set d_casti32
9668 eval $setvar
9669 $rm -f try try.*
9670
9671 : check for ability to cast negative floats to unsigned
9672 echo " "
9673 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
9674 $cat >try.c <<EOCP
9675 #include <stdio.h>
9676 #include <sys/types.h>
9677 #include <signal.h>
9678 $signal_t blech(s) int s; { exit(7); }
9679 $signal_t blech_in_list(s) int s; { exit(4); }
9680 unsigned long dummy_long(p) unsigned long p; { return p; }
9681 unsigned int dummy_int(p) unsigned int p; { return p; }
9682 unsigned short dummy_short(p) unsigned short p; { return p; }
9683 int main()
9684 {
9685         double f;
9686         unsigned long along;
9687         unsigned int aint;
9688         unsigned short ashort;
9689         int result = 0;
9690         char str[16];
9691         
9692         /* Frustrate gcc-2.7.2's optimizer which failed this test with
9693            a direct f = -123. assignment.  gcc-2.8.0 reportedly
9694            optimized the whole file away
9695         */
9696         /* Store the number in a writable string for gcc to pass to 
9697            sscanf under HP/UX.
9698         */
9699         sprintf(str, "-123");
9700         sscanf(str, "%lf", &f);  /* f = -123.; */
9701
9702         signal(SIGFPE, blech);
9703         along = (unsigned long)f;
9704         aint = (unsigned int)f;
9705         ashort = (unsigned short)f;
9706         if (along != (unsigned long)-123)
9707                 result |= 1;
9708         if (aint != (unsigned int)-123)
9709                 result |= 1;
9710         if (ashort != (unsigned short)-123)
9711                 result |= 1;
9712         sprintf(str, "1073741824.");
9713         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
9714         f = f + f;
9715         along = 0;
9716         along = (unsigned long)f;
9717         if (along != 0x80000000)
9718                 result |= 2;
9719         f -= 1.;
9720         along = 0;
9721         along = (unsigned long)f;
9722         if (along != 0x7fffffff)
9723                 result |= 1;
9724         f += 2.;
9725         along = 0;
9726         along = (unsigned long)f;
9727         if (along != 0x80000001)
9728                 result |= 2;
9729         if (result)
9730                 exit(result);
9731         signal(SIGFPE, blech_in_list);
9732         sprintf(str, "123.");
9733         sscanf(str, "%lf", &f);  /* f = 123.; */
9734         along = dummy_long((unsigned long)f);
9735         aint = dummy_int((unsigned int)f);
9736         ashort = dummy_short((unsigned short)f);
9737         if (along != (unsigned long)123)
9738                 result |= 4;
9739         if (aint != (unsigned int)123)
9740                 result |= 4;
9741         if (ashort != (unsigned short)123)
9742                 result |= 4;
9743         exit(result);
9744
9745 }
9746 EOCP
9747 set try
9748 if eval $compile_ok; then
9749         $run ./try
9750         castflags=$?
9751 else
9752         echo "(I can't seem to compile the test program--assuming it can't)"
9753         castflags=7
9754 fi
9755 case "$castflags" in
9756 0)      val="$define"
9757         echo "Yup, it can."
9758         ;;
9759 *)      val="$undef"
9760         echo "Nope, it can't."
9761         ;;
9762 esac
9763 set d_castneg
9764 eval $setvar
9765 $rm -f try.*
9766
9767 : see if vprintf exists
9768 echo " "
9769 if set vprintf val -f d_vprintf; eval $csym; $val; then
9770         echo 'vprintf() found.' >&4
9771         val="$define"
9772         $cat >try.c <<'EOF'
9773 #include <varargs.h>
9774
9775 int main() { xxx("foo"); }
9776
9777 xxx(va_alist)
9778 va_dcl
9779 {
9780         va_list args;
9781         char buf[10];
9782
9783         va_start(args);
9784         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
9785 }
9786 EOF
9787         set try
9788         if eval $compile && $run ./try; then
9789                 echo "Your vsprintf() returns (int)." >&4
9790                 val2="$undef"
9791         else
9792                 echo "Your vsprintf() returns (char*)." >&4
9793                 val2="$define"
9794         fi
9795 else
9796         echo 'vprintf() NOT found.' >&4
9797                 val="$undef"
9798                 val2="$undef"
9799 fi
9800 $rm -f try try.*
9801 set d_vprintf
9802 eval $setvar
9803 val=$val2
9804 set d_charvspr
9805 eval $setvar
9806
9807 : see if chown exists
9808 set chown d_chown
9809 eval $inlibc
9810
9811 : see if chroot exists
9812 set chroot d_chroot
9813 eval $inlibc
9814
9815 : see if chsize exists
9816 set chsize d_chsize
9817 eval $inlibc
9818
9819 : see if class exists
9820 set class d_class
9821 eval $inlibc
9822
9823 hasstruct='varname=$1; struct=$2; shift; shift;
9824 while $test $# -ge 2; do
9825         case "$1" in
9826         $define) echo "#include <$2>";;
9827         esac ;
9828     shift 2;
9829 done > try.c;
9830 echo "int main () { struct $struct foo; }" >> try.c;
9831 set try;
9832 if eval $compile; then
9833         val="$define";
9834 else
9835         val="$undef";
9836 fi;
9837 set $varname;
9838 eval $setvar;
9839 $rm -f try.c try.o'
9840
9841 socketlib=''
9842 sockethdr=''
9843 : see whether socket exists
9844 echo " "
9845 $echo $n "Hmm... $c" >&4
9846 if set socket val -f d_socket; eval $csym; $val; then
9847         echo "Looks like you have Berkeley networking support." >&4
9848         d_socket="$define"
9849         if set setsockopt val -f; eval $csym; $val; then
9850                 d_oldsock="$undef"
9851         else
9852                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9853                 d_oldsock="$define"
9854         fi
9855 else
9856         if $contains socklib libc.list >/dev/null 2>&1; then
9857                 echo "Looks like you have Berkeley networking support." >&4
9858                 d_socket="$define"
9859                 : we will have to assume that it supports the 4.2 BSD interface
9860                 d_oldsock="$undef"
9861         else
9862                 echo "You don't have Berkeley networking in libc$_a..." >&4
9863                 if test "X$d_socket" = "X$define"; then
9864                    echo "...but you seem to believe that you have sockets." >&4
9865                 else
9866                         for net in net socket
9867                         do
9868                                 if test -f /usr/lib/lib$net$_a; then
9869                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9870                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9871                                         if $contains socket libc.list >/dev/null 2>&1; then
9872                                                 d_socket="$define"
9873                                                 socketlib="-l$net"
9874                                                 case "$net" in
9875                                                 net)
9876                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9877                                                         sockethdr="-I/usr/netinclude"
9878                                                         ;;
9879                                                 esac
9880                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
9881                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9882                                                         d_oldsock="$undef"
9883                                                 else
9884                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9885                                                         d_oldsock="$define"
9886                                                 fi
9887                                                 break
9888                                         fi
9889                                 fi
9890                         done
9891                         if test "X$d_socket" != "X$define"; then
9892                            echo "or anywhere else I see." >&4
9893                            d_socket="$undef"
9894                            d_oldsock="$undef"
9895                         fi
9896                 fi
9897         fi
9898 fi
9899
9900 : see if socketpair exists
9901 set socketpair d_sockpair
9902 eval $inlibc
9903
9904
9905 echo " "
9906 echo "Checking the availability of certain socket constants..." >&4
9907 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9908         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9909         $cat >try.c <<EOF
9910 #include <sys/types.h>
9911 #include <sys/socket.h>
9912 int main() {
9913     int i = $ENUM;
9914 }
9915 EOF
9916         val="$undef"
9917         set try; if eval $compile; then
9918                 val="$define"
9919         fi
9920         set d_${enum}; eval $setvar
9921         $rm -f try.c try
9922 done
9923
9924 : see if this is a sys/uio.h system
9925 set sys/uio.h i_sysuio
9926 eval $inhdr
9927
9928
9929 echo " "
9930 echo "Checking to see if your system supports struct cmsghdr..." >&4
9931 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
9932 eval $hasstruct
9933 case "$d_cmsghdr_s" in
9934 "$define")      echo "Yes, it does."   ;;
9935 *)              echo "No, it doesn't." ;;
9936 esac
9937
9938
9939 : check for const keyword
9940 echo " "
9941 echo 'Checking to see if your C compiler knows about "const"...' >&4
9942 $cat >const.c <<'EOCP'
9943 typedef struct spug { int drokk; } spug;
9944 main()
9945 {
9946         const char *foo;
9947         const spug y;
9948 }
9949 EOCP
9950 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
9951         val="$define"
9952         echo "Yup, it does."
9953 else
9954         val="$undef"
9955         echo "Nope, it doesn't."
9956 fi
9957 set d_const
9958 eval $setvar
9959
9960 : see if crypt exists
9961 echo " "
9962 set crypt d_crypt
9963 eval $inlibc
9964 case "$d_crypt" in
9965 $define) cryptlib='' ;;
9966 *)      if set crypt val -f d_crypt; eval $csym; $val; then
9967                 echo 'crypt() found.' >&4
9968                 val="$define"
9969                 cryptlib=''
9970         else
9971                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
9972                 if $test -z "$cryptlib"; then
9973                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
9974                 else
9975                         cryptlib=-lcrypt
9976                 fi
9977                 if $test -z "$cryptlib"; then
9978                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
9979                 else
9980                         cryptlib=-lcrypt
9981                 fi
9982                 if $test -z "$cryptlib"; then
9983                         cryptlib=`./loc libcrypt$_a "" $libpth`
9984                 else
9985                         cryptlib=-lcrypt
9986                 fi
9987                 if $test -z "$cryptlib"; then
9988                         echo 'crypt() NOT found.' >&4
9989                         val="$undef"
9990                 else
9991                         val="$define"
9992                 fi
9993         fi
9994         set d_crypt
9995         eval $setvar
9996         ;;
9997 esac
9998
9999 : see if this is a crypt.h system
10000 set crypt.h i_crypt
10001 eval $inhdr
10002
10003 : see if crypt_r exists
10004 set crypt_r d_crypt_r
10005 eval $inlibc
10006 case "$d_crypt_r" in
10007 "$define")
10008         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10009         case "$d_crypt_r_proto:$usethreads" in
10010         ":define")      d_crypt_r_proto=define
10011                 set d_crypt_r_proto crypt_r $hdrs
10012                 eval $hasproto ;;
10013         *)      ;;
10014         esac
10015         case "$d_crypt_r_proto" in
10016         define)
10017         case "$crypt_r_proto" in
10018         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10019         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10020         esac
10021         case "$crypt_r_proto" in
10022         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10023         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10024         esac
10025         case "$crypt_r_proto" in
10026         ''|0)   d_crypt_r=undef
10027                 crypt_r_proto=0
10028                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10029         * )     case "$crypt_r_proto" in
10030                 REENTRANT_PROTO*) ;;
10031                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10032                 esac
10033                 echo "Prototype: $try" ;;
10034         esac
10035         ;;
10036         *)      case "$usethreads" in
10037                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10038                 esac
10039                 d_crypt_r=undef
10040                 crypt_r_proto=0
10041                 ;;
10042         esac
10043         ;;
10044 *)      crypt_r_proto=0
10045         ;;
10046 esac
10047
10048 : get csh whereabouts
10049 case "$csh" in
10050 'csh') val="$undef" ;;
10051 *) val="$define" ;;
10052 esac
10053 set d_csh
10054 eval $setvar
10055 : Respect a hint or command line value for full_csh.
10056 case "$full_csh" in
10057 '') full_csh=$csh ;;
10058 esac
10059
10060 : see if ctermid_r exists
10061 set ctermid_r d_ctermid_r
10062 eval $inlibc
10063 case "$d_ctermid_r" in
10064 "$define")
10065         hdrs="$i_systypes sys/types.h define stdio.h "
10066         case "$d_ctermid_r_proto:$usethreads" in
10067         ":define")      d_ctermid_r_proto=define
10068                 set d_ctermid_r_proto ctermid_r $hdrs
10069                 eval $hasproto ;;
10070         *)      ;;
10071         esac
10072         case "$d_ctermid_r_proto" in
10073         define)
10074         case "$ctermid_r_proto" in
10075         ''|0) try='char* ctermid_r(char*);'
10076         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10077         esac
10078         case "$ctermid_r_proto" in
10079         ''|0)   d_ctermid_r=undef
10080                 ctermid_r_proto=0
10081                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10082         * )     case "$ctermid_r_proto" in
10083                 REENTRANT_PROTO*) ;;
10084                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10085                 esac
10086                 echo "Prototype: $try" ;;
10087         esac
10088         ;;
10089         *)      case "$usethreads" in
10090                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10091                 esac
10092                 d_ctermid_r=undef
10093                 ctermid_r_proto=0
10094                 ;;
10095         esac
10096         ;;
10097 *)      ctermid_r_proto=0
10098         ;;
10099 esac
10100
10101 : see if ctime_r exists
10102 set ctime_r d_ctime_r
10103 eval $inlibc
10104 case "$d_ctime_r" in
10105 "$define")
10106         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10107         case "$d_ctime_r_proto:$usethreads" in
10108         ":define")      d_ctime_r_proto=define
10109                 set d_ctime_r_proto ctime_r $hdrs
10110                 eval $hasproto ;;
10111         *)      ;;
10112         esac
10113         case "$d_ctime_r_proto" in
10114         define)
10115         case "$ctime_r_proto" in
10116         ''|0) try='char* ctime_r(const time_t*, char*);'
10117         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10118         esac
10119         case "$ctime_r_proto" in
10120         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10121         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10122         esac
10123         case "$ctime_r_proto" in
10124         ''|0) try='int ctime_r(const time_t*, char*);'
10125         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10126         esac
10127         case "$ctime_r_proto" in
10128         ''|0) try='int ctime_r(const time_t*, char*, int);'
10129         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10130         esac
10131         case "$ctime_r_proto" in
10132         ''|0)   d_ctime_r=undef
10133                 ctime_r_proto=0
10134                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10135         * )     case "$ctime_r_proto" in
10136                 REENTRANT_PROTO*) ;;
10137                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10138                 esac
10139                 echo "Prototype: $try" ;;
10140         esac
10141         ;;
10142         *)      case "$usethreads" in
10143                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10144                 esac
10145                 d_ctime_r=undef
10146                 ctime_r_proto=0
10147                 ;;
10148         esac
10149         ;;
10150 *)      ctime_r_proto=0
10151         ;;
10152 esac
10153
10154 : see if cuserid exists
10155 set cuserid d_cuserid
10156 eval $inlibc
10157
10158 : see if this is a limits.h system
10159 set limits.h i_limits
10160 eval $inhdr
10161
10162 : see if this is a float.h system
10163 set float.h i_float
10164 eval $inhdr
10165
10166 : See if number of significant digits in a double precision number is known
10167 echo " "
10168 $cat >dbl_dig.c <<EOM
10169 #$i_limits I_LIMITS
10170 #$i_float I_FLOAT
10171 #ifdef I_LIMITS
10172 #include <limits.h>
10173 #endif
10174 #ifdef I_FLOAT
10175 #include <float.h>
10176 #endif
10177 #ifdef DBL_DIG
10178 printf("Contains DBL_DIG");
10179 #endif
10180 EOM
10181 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10182 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10183         echo "DBL_DIG found." >&4
10184         val="$define"
10185 else
10186         echo "DBL_DIG NOT found." >&4
10187         val="$undef"
10188 fi
10189 $rm -f dbl_dig.?
10190 set d_dbl_dig
10191 eval $setvar
10192
10193 : see if dbm.h is available
10194 : see if dbmclose exists
10195 set dbmclose d_dbmclose
10196 eval $inlibc
10197
10198 case "$d_dbmclose" in
10199 $define)
10200         set dbm.h i_dbm
10201         eval $inhdr
10202         case "$i_dbm" in
10203         $define)
10204                 val="$undef"
10205                 set i_rpcsvcdbm
10206                 eval $setvar
10207                 ;;
10208         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10209                 eval $inhdr
10210                 ;;
10211         esac
10212         ;;
10213 *)      echo "We won't be including <dbm.h>"
10214         val="$undef"
10215         set i_dbm
10216         eval $setvar
10217         val="$undef"
10218         set i_rpcsvcdbm
10219         eval $setvar
10220         ;;
10221 esac
10222
10223 : see if prototype for dbminit is available
10224 echo " "
10225 set d_dbminitproto dbminit $i_dbm dbm.h
10226 eval $hasproto
10227
10228 : see if difftime exists
10229 set difftime d_difftime
10230 eval $inlibc
10231
10232 : see if this is a dirent system
10233 echo " "
10234 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10235         val="$define"
10236         echo "<dirent.h> found." >&4
10237 else
10238         val="$undef"
10239         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10240                 echo "<sys/dir.h> found." >&4
10241                 echo " "
10242         else
10243                 xinc=`./findhdr sys/ndir.h`
10244         fi
10245         echo "<dirent.h> NOT found." >&4
10246 fi
10247 set i_dirent
10248 eval $setvar
10249
10250 : Look for type of directory structure.
10251 echo " "
10252 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10253
10254 case "$direntrytype" in
10255 ''|' ')
10256         case "$i_dirent" in
10257         $define) guess1='struct dirent' ;;
10258         *) guess1='struct direct'  ;;
10259         esac
10260         ;;
10261 *)      guess1="$direntrytype"
10262         ;;
10263 esac
10264
10265 case "$guess1" in
10266 'struct dirent') guess2='struct direct' ;;
10267 *) guess2='struct dirent' ;;
10268 esac
10269                 
10270 if $contains "$guess1" try.c >/dev/null 2>&1; then
10271         direntrytype="$guess1"
10272         echo "Your directory entries are $direntrytype." >&4
10273 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10274         direntrytype="$guess2"
10275         echo "Your directory entries seem to be $direntrytype." >&4
10276 else
10277         echo "I don't recognize your system's directory entries." >&4
10278         rp="What type is used for directory entries on this system?"
10279         dflt="$guess1"
10280         . ./myread
10281         direntrytype="$ans"
10282 fi
10283 $rm -f try.c
10284
10285
10286 : see if the directory entry stores field length
10287 echo " "
10288 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10289 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10290         echo "Good, your directory entry keeps length information in d_namlen." >&4
10291         val="$define"
10292 else
10293         echo "Your directory entry does not know about the d_namlen field." >&4
10294         val="$undef"
10295 fi
10296 set d_dirnamlen
10297 eval $setvar
10298 $rm -f try.c
10299
10300 : see if this is an sysdir system
10301 set sys/dir.h i_sysdir
10302 eval $inhdr
10303
10304 : see if this is an sysndir system
10305 set sys/ndir.h i_sysndir
10306 eval $inhdr
10307
10308 : Look for dirfd
10309 echo " "
10310 $cat >dirfd.c <<EOM
10311 #include <stdio.h>
10312 #$i_dirent I_DIRENT             /**/
10313 #$i_sysdir I_SYS_DIR            /**/
10314 #$i_sysndir I_SYS_NDIR          /**/
10315 #$i_systypes I_SYS_TYPES        /**/
10316 #if defined(I_SYS_TYPES)
10317 #include <sys/types.h>
10318 #endif
10319 #if defined(I_DIRENT)
10320 #include <dirent.h>
10321 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10322 #include <sys/dir.h>
10323 #endif
10324 #else
10325 #ifdef I_SYS_NDIR
10326 #include <sys/ndir.h>
10327 #else
10328 #ifdef I_SYS_DIR
10329 #ifdef hp9000s500
10330 #include <ndir.h>       /* may be wrong in the future */
10331 #else
10332 #include <sys/dir.h>
10333 #endif
10334 #endif
10335 #endif
10336 #endif 
10337 int main() {
10338         DIR *dirp = opendir(".");
10339         if (dirfd(dirp) >= 0)
10340                 exit(0);
10341         else
10342                 exit(1);
10343 }
10344 EOM
10345 set dirfd
10346 if eval $compile; then
10347         val="$define"
10348 fi
10349 case "$val" in
10350 $define)        echo "dirfd() found." >&4       ;;
10351 *)              echo "dirfd() NOT found." >&4   ;;
10352 esac
10353 set d_dirfd
10354 eval $setvar
10355 $rm -f dirfd*
10356
10357 : see if dlerror exists
10358 xxx_runnm="$runnm"
10359 runnm=false
10360 set dlerror d_dlerror
10361 eval $inlibc
10362 runnm="$xxx_runnm"
10363
10364 : see if dlfcn is available
10365 set dlfcn.h i_dlfcn
10366 eval $inhdr
10367
10368 case "$usedl" in
10369 $define|y|true)
10370         $cat << EOM
10371
10372 On a few systems, the dynamically loaded modules that perl generates and uses
10373 will need a different extension than shared libs. The default will probably
10374 be appropriate.
10375
10376 EOM
10377         case "$dlext" in
10378         '')     dflt="$so" ;;
10379         *)      dflt="$dlext" ;;
10380         esac
10381         rp='What is the extension of dynamically loaded modules'
10382         . ./myread
10383         dlext="$ans"
10384         ;;
10385 *)
10386         dlext="none"
10387         ;;
10388 esac
10389
10390 : Check if dlsym need a leading underscore
10391 echo " "
10392 val="$undef"
10393
10394 case "$dlsrc" in
10395 dl_dlopen.xs)
10396         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
10397         $cat >dyna.c <<'EOM'
10398 fred () { }
10399 EOM
10400
10401 $cat >fred.c<<EOM
10402
10403 #include <stdio.h>
10404 #$i_dlfcn I_DLFCN
10405 #ifdef I_DLFCN
10406 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
10407 #else
10408 #include <sys/types.h>
10409 #include <nlist.h>
10410 #include <link.h>
10411 #endif
10412
10413 extern int fred() ;
10414
10415 int main()
10416 {
10417     void * handle ;
10418     void * symbol ;
10419 #ifndef RTLD_LAZY
10420     int mode = 1 ;
10421 #else
10422     int mode = RTLD_LAZY ;
10423 #endif
10424     handle = dlopen("./dyna.$dlext", mode) ;
10425     if (handle == NULL) {
10426         printf ("1\n") ;
10427         fflush (stdout) ;
10428         exit(0);
10429     }
10430     symbol = dlsym(handle, "fred") ;
10431     if (symbol == NULL) {
10432         /* try putting a leading underscore */
10433         symbol = dlsym(handle, "_fred") ;
10434         if (symbol == NULL) {
10435             printf ("2\n") ;
10436             fflush (stdout) ;
10437             exit(0);
10438         }
10439         printf ("3\n") ;
10440     }
10441     else
10442         printf ("4\n") ;
10443     fflush (stdout) ;
10444     exit(0);
10445 }
10446 EOM
10447         : Call the object file tmp-dyna.o in case dlext=o.
10448         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
10449                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
10450                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
10451                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
10452                 xxx=`$run ./fred`
10453                 case $xxx in
10454                 1)      echo "Test program failed using dlopen." >&4
10455                         echo "Perhaps you should not use dynamic loading." >&4;;
10456                 2)      echo "Test program failed using dlsym." >&4
10457                         echo "Perhaps you should not use dynamic loading." >&4;;
10458                 3)      echo "dlsym needs a leading underscore" >&4
10459                         val="$define" ;;
10460                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
10461                 esac
10462         else
10463                 echo "I can't compile and run the test program." >&4
10464                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
10465         fi
10466         ;;
10467 esac
10468                 
10469 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
10470
10471 set d_dlsymun
10472 eval $setvar
10473
10474 : see if drand48_r exists
10475 set drand48_r d_drand48_r
10476 eval $inlibc
10477 case "$d_drand48_r" in
10478 "$define")
10479         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
10480         case "$d_drand48_r_proto:$usethreads" in
10481         ":define")      d_drand48_r_proto=define
10482                 set d_drand48_r_proto drand48_r $hdrs
10483                 eval $hasproto ;;
10484         *)      ;;
10485         esac
10486         case "$d_drand48_r_proto" in
10487         define)
10488         case "$drand48_r_proto" in
10489         ''|0) try='int drand48_r(struct drand48_data*, double*);'
10490         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
10491         esac
10492         case "$drand48_r_proto" in
10493         ''|0)   d_drand48_r=undef
10494                 drand48_r_proto=0
10495                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10496         * )     case "$drand48_r_proto" in
10497                 REENTRANT_PROTO*) ;;
10498                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
10499                 esac
10500                 echo "Prototype: $try" ;;
10501         esac
10502         ;;
10503         *)      case "$usethreads" in
10504                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
10505                 esac
10506                 d_drand48_r=undef
10507                 drand48_r_proto=0
10508                 ;;
10509         esac
10510         ;;
10511 *)      drand48_r_proto=0
10512         ;;
10513 esac
10514
10515 : see if prototype for drand48 is available
10516 echo " "
10517 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
10518 eval $hasproto
10519
10520 : see if dup2 exists
10521 set dup2 d_dup2
10522 eval $inlibc
10523
10524 : see if eaccess exists
10525 set eaccess d_eaccess
10526 eval $inlibc
10527
10528 : see if endgrent exists
10529 set endgrent d_endgrent
10530 eval $inlibc
10531
10532 : see if this is an grp system
10533 set grp.h i_grp
10534 eval $inhdr
10535
10536 case "$i_grp" in
10537 $define)
10538         xxx=`./findhdr grp.h`
10539         $cppstdin $cppflags $cppminus < $xxx >$$.h
10540
10541         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10542                 val="$define"
10543         else
10544                 val="$undef"
10545         fi
10546         set d_grpasswd
10547         eval $setvar
10548
10549         $rm -f $$.h
10550         ;;
10551 *)
10552         val="$undef";
10553         set d_grpasswd; eval $setvar
10554         ;;
10555 esac
10556
10557 : see if endgrent_r exists
10558 set endgrent_r d_endgrent_r
10559 eval $inlibc
10560 case "$d_endgrent_r" in
10561 "$define")
10562         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
10563         case "$d_endgrent_r_proto:$usethreads" in
10564         ":define")      d_endgrent_r_proto=define
10565                 set d_endgrent_r_proto endgrent_r $hdrs
10566                 eval $hasproto ;;
10567         *)      ;;
10568         esac
10569         case "$d_endgrent_r_proto" in
10570         define)
10571         case "$endgrent_r_proto" in
10572         ''|0) try='int endgrent_r(FILE**);'
10573         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
10574         esac
10575         case "$endgrent_r_proto" in
10576         ''|0) try='void endgrent_r(FILE**);'
10577         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
10578         esac
10579         case "$endgrent_r_proto" in
10580         ''|0)   d_endgrent_r=undef
10581                 endgrent_r_proto=0
10582                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10583         * )     case "$endgrent_r_proto" in
10584                 REENTRANT_PROTO*) ;;
10585                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
10586                 esac
10587                 echo "Prototype: $try" ;;
10588         esac
10589         ;;
10590         *)      case "$usethreads" in
10591                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
10592                 esac
10593                 d_endgrent_r=undef
10594                 endgrent_r_proto=0
10595                 ;;
10596         esac
10597         ;;
10598 *)      endgrent_r_proto=0
10599         ;;
10600 esac
10601
10602 : see if endhostent exists
10603 set endhostent d_endhent
10604 eval $inlibc
10605
10606 : see if this is a netdb.h system
10607 set netdb.h i_netdb
10608 eval $inhdr
10609
10610 : see if endhostent_r exists
10611 set endhostent_r d_endhostent_r
10612 eval $inlibc
10613 case "$d_endhostent_r" in
10614 "$define")
10615         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10616         case "$d_endhostent_r_proto:$usethreads" in
10617         ":define")      d_endhostent_r_proto=define
10618                 set d_endhostent_r_proto endhostent_r $hdrs
10619                 eval $hasproto ;;
10620         *)      ;;
10621         esac
10622         case "$d_endhostent_r_proto" in
10623         define)
10624         case "$endhostent_r_proto" in
10625         ''|0) try='int endhostent_r(struct hostent_data*);'
10626         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
10627         esac
10628         case "$endhostent_r_proto" in
10629         ''|0) try='void endhostent_r(struct hostent_data*);'
10630         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
10631         esac
10632         case "$endhostent_r_proto" in
10633         ''|0)   d_endhostent_r=undef
10634                 endhostent_r_proto=0
10635                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10636         * )     case "$endhostent_r_proto" in
10637                 REENTRANT_PROTO*) ;;
10638                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
10639                 esac
10640                 echo "Prototype: $try" ;;
10641         esac
10642         ;;
10643         *)      case "$usethreads" in
10644                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
10645                 esac
10646                 d_endhostent_r=undef
10647                 endhostent_r_proto=0
10648                 ;;
10649         esac
10650         ;;
10651 *)      endhostent_r_proto=0
10652         ;;
10653 esac
10654
10655 : see if endnetent exists
10656 set endnetent d_endnent
10657 eval $inlibc
10658
10659 : see if endnetent_r exists
10660 set endnetent_r d_endnetent_r
10661 eval $inlibc
10662 case "$d_endnetent_r" in
10663 "$define")
10664         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10665         case "$d_endnetent_r_proto:$usethreads" in
10666         ":define")      d_endnetent_r_proto=define
10667                 set d_endnetent_r_proto endnetent_r $hdrs
10668                 eval $hasproto ;;
10669         *)      ;;
10670         esac
10671         case "$d_endnetent_r_proto" in
10672         define)
10673         case "$endnetent_r_proto" in
10674         ''|0) try='int endnetent_r(struct netent_data*);'
10675         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
10676         esac
10677         case "$endnetent_r_proto" in
10678         ''|0) try='void endnetent_r(struct netent_data*);'
10679         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
10680         esac
10681         case "$endnetent_r_proto" in
10682         ''|0)   d_endnetent_r=undef
10683                 endnetent_r_proto=0
10684                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10685         * )     case "$endnetent_r_proto" in
10686                 REENTRANT_PROTO*) ;;
10687                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
10688                 esac
10689                 echo "Prototype: $try" ;;
10690         esac
10691         ;;
10692         *)      case "$usethreads" in
10693                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
10694                 esac
10695                 d_endnetent_r=undef
10696                 endnetent_r_proto=0
10697                 ;;
10698         esac
10699         ;;
10700 *)      endnetent_r_proto=0
10701         ;;
10702 esac
10703
10704 : see if endprotoent exists
10705 set endprotoent d_endpent
10706 eval $inlibc
10707
10708 : see if endprotoent_r exists
10709 set endprotoent_r d_endprotoent_r
10710 eval $inlibc
10711 case "$d_endprotoent_r" in
10712 "$define")
10713         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10714         case "$d_endprotoent_r_proto:$usethreads" in
10715         ":define")      d_endprotoent_r_proto=define
10716                 set d_endprotoent_r_proto endprotoent_r $hdrs
10717                 eval $hasproto ;;
10718         *)      ;;
10719         esac
10720         case "$d_endprotoent_r_proto" in
10721         define)
10722         case "$endprotoent_r_proto" in
10723         ''|0) try='int endprotoent_r(struct protoent_data*);'
10724         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
10725         esac
10726         case "$endprotoent_r_proto" in
10727         ''|0) try='void endprotoent_r(struct protoent_data*);'
10728         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
10729         esac
10730         case "$endprotoent_r_proto" in
10731         ''|0)   d_endprotoent_r=undef
10732                 endprotoent_r_proto=0
10733                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10734         * )     case "$endprotoent_r_proto" in
10735                 REENTRANT_PROTO*) ;;
10736                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
10737                 esac
10738                 echo "Prototype: $try" ;;
10739         esac
10740         ;;
10741         *)      case "$usethreads" in
10742                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
10743                 esac
10744                 d_endprotoent_r=undef
10745                 endprotoent_r_proto=0
10746                 ;;
10747         esac
10748         ;;
10749 *)      endprotoent_r_proto=0
10750         ;;
10751 esac
10752
10753 : see if endpwent exists
10754 set endpwent d_endpwent
10755 eval $inlibc
10756
10757 : see if this is a pwd.h system
10758 set pwd.h i_pwd
10759 eval $inhdr
10760
10761 case "$i_pwd" in
10762 $define)
10763         xxx=`./findhdr pwd.h`
10764         $cppstdin $cppflags $cppminus < $xxx >$$.h
10765
10766         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10767                 val="$define"
10768         else
10769                 val="$undef"
10770         fi
10771         set d_pwquota
10772         eval $setvar
10773
10774         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10775                 val="$define"
10776         else
10777                 val="$undef"
10778         fi
10779         set d_pwage
10780         eval $setvar
10781
10782         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10783                 val="$define"
10784         else
10785                 val="$undef"
10786         fi
10787         set d_pwchange
10788         eval $setvar
10789
10790         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10791                 val="$define"
10792         else
10793                 val="$undef"
10794         fi
10795         set d_pwclass
10796         eval $setvar
10797
10798         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10799                 val="$define"
10800         else
10801                 val="$undef"
10802         fi
10803         set d_pwexpire
10804         eval $setvar
10805
10806         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10807                 val="$define"
10808         else
10809                 val="$undef"
10810         fi
10811         set d_pwcomment
10812         eval $setvar
10813
10814         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10815                 val="$define"
10816         else
10817                 val="$undef"
10818         fi
10819         set d_pwgecos
10820         eval $setvar
10821
10822         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10823                 val="$define"
10824         else
10825                 val="$undef"
10826         fi
10827         set d_pwpasswd
10828         eval $setvar
10829
10830         $rm -f $$.h
10831         ;;
10832 *)
10833         val="$undef"; 
10834         set d_pwquota; eval $setvar
10835         set d_pwage; eval $setvar
10836         set d_pwchange; eval $setvar
10837         set d_pwclass; eval $setvar
10838         set d_pwexpire; eval $setvar
10839         set d_pwcomment; eval $setvar
10840         set d_pwgecos; eval $setvar
10841         set d_pwpasswd; eval $setvar
10842         ;;
10843 esac
10844
10845 : see if endpwent_r exists
10846 set endpwent_r d_endpwent_r
10847 eval $inlibc
10848 case "$d_endpwent_r" in
10849 "$define")
10850         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
10851         case "$d_endpwent_r_proto:$usethreads" in
10852         ":define")      d_endpwent_r_proto=define
10853                 set d_endpwent_r_proto endpwent_r $hdrs
10854                 eval $hasproto ;;
10855         *)      ;;
10856         esac
10857         case "$d_endpwent_r_proto" in
10858         define)
10859         case "$endpwent_r_proto" in
10860         ''|0) try='int endpwent_r(FILE**);'
10861         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
10862         esac
10863         case "$endpwent_r_proto" in
10864         ''|0) try='void endpwent_r(FILE**);'
10865         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
10866         esac
10867         case "$endpwent_r_proto" in
10868         ''|0)   d_endpwent_r=undef
10869                 endpwent_r_proto=0
10870                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10871         * )     case "$endpwent_r_proto" in
10872                 REENTRANT_PROTO*) ;;
10873                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
10874                 esac
10875                 echo "Prototype: $try" ;;
10876         esac
10877         ;;
10878         *)      case "$usethreads" in
10879                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
10880                 esac
10881                 d_endpwent_r=undef
10882                 endpwent_r_proto=0
10883                 ;;
10884         esac
10885         ;;
10886 *)      endpwent_r_proto=0
10887         ;;
10888 esac
10889
10890 : see if endservent exists
10891 set endservent d_endsent
10892 eval $inlibc
10893
10894 : see if endservent_r exists
10895 set endservent_r d_endservent_r
10896 eval $inlibc
10897 case "$d_endservent_r" in
10898 "$define")
10899         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10900         case "$d_endservent_r_proto:$usethreads" in
10901         ":define")      d_endservent_r_proto=define
10902                 set d_endservent_r_proto endservent_r $hdrs
10903                 eval $hasproto ;;
10904         *)      ;;
10905         esac
10906         case "$d_endservent_r_proto" in
10907         define)
10908         case "$endservent_r_proto" in
10909         ''|0) try='int endservent_r(struct servent_data*);'
10910         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
10911         esac
10912         case "$endservent_r_proto" in
10913         ''|0) try='void endservent_r(struct servent_data*);'
10914         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
10915         esac
10916         case "$endservent_r_proto" in
10917         ''|0)   d_endservent_r=undef
10918                 endservent_r_proto=0
10919                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10920         * )     case "$endservent_r_proto" in
10921                 REENTRANT_PROTO*) ;;
10922                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
10923                 esac
10924                 echo "Prototype: $try" ;;
10925         esac
10926         ;;
10927         *)      case "$usethreads" in
10928                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
10929                 esac
10930                 d_endservent_r=undef
10931                 endservent_r_proto=0
10932                 ;;
10933         esac
10934         ;;
10935 *)      endservent_r_proto=0
10936         ;;
10937 esac
10938
10939 : Locate the flags for 'open()'
10940 echo " "
10941 $cat >try.c <<'EOCP'
10942 #include <sys/types.h>
10943 #ifdef I_FCNTL
10944 #include <fcntl.h>
10945 #endif
10946 #ifdef I_SYS_FILE
10947 #include <sys/file.h>
10948 #endif
10949 int main() {
10950         if(O_RDONLY);
10951 #ifdef O_TRUNC
10952         exit(0);
10953 #else
10954         exit(1);
10955 #endif
10956 }
10957 EOCP
10958 : check sys/file.h first to get FREAD on Sun
10959 if $test `./findhdr sys/file.h` && \
10960                 set try -DI_SYS_FILE && eval $compile; then
10961         h_sysfile=true;
10962         echo "<sys/file.h> defines the O_* constants..." >&4
10963         if $run ./try; then
10964                 echo "and you have the 3 argument form of open()." >&4
10965                 val="$define"
10966         else
10967                 echo "but not the 3 argument form of open().  Oh, well." >&4
10968                 val="$undef"
10969         fi
10970 elif $test `./findhdr fcntl.h` && \
10971                 set try -DI_FCNTL && eval $compile; then
10972         h_fcntl=true;
10973         echo "<fcntl.h> defines the O_* constants..." >&4
10974         if $run ./try; then
10975                 echo "and you have the 3 argument form of open()." >&4
10976                 val="$define"
10977         else
10978                 echo "but not the 3 argument form of open().  Oh, well." >&4
10979                 val="$undef"
10980         fi
10981 else
10982         val="$undef"
10983         echo "I can't find the O_* constant definitions!  You got problems." >&4
10984 fi
10985 set d_open3
10986 eval $setvar
10987 $rm -f try try.*
10988
10989 : see which of string.h or strings.h is needed
10990 echo " "
10991 strings=`./findhdr string.h`
10992 if $test "$strings" && $test -r "$strings"; then
10993         echo "Using <string.h> instead of <strings.h>." >&4
10994         val="$define"
10995 else
10996         val="$undef"
10997         strings=`./findhdr strings.h`
10998         if $test "$strings" && $test -r "$strings"; then
10999                 echo "Using <strings.h> instead of <string.h>." >&4
11000         else
11001                 echo "No string header found -- You'll surely have problems." >&4
11002         fi
11003 fi
11004 set i_string
11005 eval $setvar
11006 case "$i_string" in
11007 "$undef") strings=`./findhdr strings.h`;;
11008 *)        strings=`./findhdr string.h`;;
11009 esac
11010
11011 : see if this is a sys/file.h system
11012 val=''
11013 set sys/file.h val
11014 eval $inhdr
11015
11016 : do we need to include sys/file.h ?
11017 case "$val" in
11018 "$define")
11019         echo " "
11020         if $h_sysfile; then
11021                 val="$define"
11022                 echo "We'll be including <sys/file.h>." >&4
11023         else
11024                 val="$undef"
11025                 echo "We won't be including <sys/file.h>." >&4
11026         fi
11027         ;;
11028 *)
11029         h_sysfile=false
11030         ;;
11031 esac
11032 set i_sysfile
11033 eval $setvar
11034
11035 : see if fcntl.h is there
11036 val=''
11037 set fcntl.h val
11038 eval $inhdr
11039
11040 : see if we can include fcntl.h
11041 case "$val" in
11042 "$define")
11043         echo " "
11044         if $h_fcntl; then
11045                 val="$define"
11046                 echo "We'll be including <fcntl.h>." >&4
11047         else
11048                 val="$undef"
11049                 if $h_sysfile; then
11050         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11051                 else
11052                         echo "We won't be including <fcntl.h>." >&4
11053                 fi
11054         fi
11055         ;;
11056 *)
11057         h_fcntl=false
11058         val="$undef"
11059         ;;
11060 esac
11061 set i_fcntl
11062 eval $setvar
11063
11064 : check for non-blocking I/O stuff
11065 case "$h_sysfile" in
11066 true) echo "#include <sys/file.h>" > head.c;;
11067 *)
11068        case "$h_fcntl" in
11069        true) echo "#include <fcntl.h>" > head.c;;
11070        *) echo "#include <sys/fcntl.h>" > head.c;;
11071        esac
11072        ;;
11073 esac
11074 echo " "
11075 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11076 case "$o_nonblock" in
11077 '')
11078         $cat head.c > try.c
11079         $cat >>try.c <<EOCP
11080 #include <stdio.h>
11081 #include <stdlib.h>
11082 #$i_fcntl I_FCNTL
11083 #ifdef I_FCNTL
11084 #include <fcntl.h>
11085 #endif
11086 int main() {
11087 #ifdef O_NONBLOCK
11088         printf("O_NONBLOCK\n");
11089         exit(0);
11090 #endif
11091 #ifdef O_NDELAY
11092         printf("O_NDELAY\n");
11093         exit(0);
11094 #endif
11095 #ifdef FNDELAY
11096         printf("FNDELAY\n");
11097         exit(0);
11098 #endif
11099         exit(0);
11100 }
11101 EOCP
11102         set try
11103         if eval $compile_ok; then
11104                 o_nonblock=`$run ./try`
11105                 case "$o_nonblock" in
11106                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11107                 *) echo "Seems like we can use $o_nonblock.";;
11108                 esac
11109         else
11110                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11111         fi
11112         ;;
11113 *) echo "Using $hint value $o_nonblock.";;
11114 esac
11115 $rm -f try try.* .out core
11116
11117 echo " "
11118 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11119 case "$eagain" in
11120 '')
11121         $cat head.c > try.c
11122         $cat >>try.c <<EOCP
11123 #include <errno.h>
11124 #include <sys/types.h>
11125 #include <signal.h>
11126 #include <stdio.h> 
11127 #include <stdlib.h> 
11128 #$i_fcntl I_FCNTL
11129 #ifdef I_FCNTL
11130 #include <fcntl.h>
11131 #endif
11132 #define MY_O_NONBLOCK $o_nonblock
11133 #ifndef errno  /* XXX need better Configure test */
11134 extern int errno;
11135 #endif
11136 #$i_unistd I_UNISTD
11137 #ifdef I_UNISTD
11138 #include <unistd.h>
11139 #endif
11140 #$i_string I_STRING
11141 #ifdef I_STRING
11142 #include <string.h>
11143 #else
11144 #include <strings.h>
11145 #endif
11146 $signal_t blech(x) int x; { exit(3); }
11147 EOCP
11148         $cat >> try.c <<'EOCP'
11149 int main()
11150 {
11151         int pd[2];
11152         int pu[2];
11153         char buf[1];
11154         char string[100];
11155
11156         pipe(pd);       /* Down: child -> parent */
11157         pipe(pu);       /* Up: parent -> child */
11158         if (0 != fork()) {
11159                 int ret;
11160                 close(pd[1]);   /* Parent reads from pd[0] */
11161                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11162 #ifdef F_SETFL
11163                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11164                         exit(1);
11165 #else
11166                 exit(4);
11167 #endif
11168                 signal(SIGALRM, blech);
11169                 alarm(5);
11170                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11171                         exit(2);
11172                 sprintf(string, "%d\n", ret);
11173                 write(2, string, strlen(string));
11174                 alarm(0);
11175 #ifdef EAGAIN
11176                 if (errno == EAGAIN) {
11177                         printf("EAGAIN\n");
11178                         goto ok;
11179                 }
11180 #endif
11181 #ifdef EWOULDBLOCK
11182                 if (errno == EWOULDBLOCK)
11183                         printf("EWOULDBLOCK\n");
11184 #endif
11185         ok:
11186                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11187                 sleep(2);                               /* Give it time to close our pipe */
11188                 alarm(5);
11189                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11190                 alarm(0);
11191                 sprintf(string, "%d\n", ret);
11192                 write(4, string, strlen(string));
11193                 exit(0);
11194         }
11195
11196         close(pd[0]);                   /* We write to pd[1] */
11197         close(pu[1]);                   /* We read from pu[0] */
11198         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11199         close(pd[1]);                   /* Pipe pd is now fully closed! */
11200         exit(0);                                /* Bye bye, thank you for playing! */
11201 }
11202 EOCP
11203         set try
11204         if eval $compile_ok; then
11205                 echo "$startsh" >mtry
11206                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11207                 chmod +x mtry
11208                 ./mtry >/dev/null 2>&1
11209                 case $? in
11210                 0) eagain=`$cat try.out`;;
11211                 1) echo "Could not perform non-blocking setting!";;
11212                 2) echo "I did a successful read() for something that was not there!";;
11213                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11214                 4) echo "Could not find F_SETFL!";;
11215                 *) echo "Something terribly wrong happened during testing.";;
11216                 esac
11217                 rd_nodata=`$cat try.ret`
11218                 echo "A read() system call with no data present returns $rd_nodata."
11219                 case "$rd_nodata" in
11220                 0|-1) ;;
11221                 *)
11222                         echo "(That's peculiar, fixing that to be -1.)"
11223                         rd_nodata=-1
11224                         ;;
11225                 esac
11226                 case "$eagain" in
11227                 '')
11228                         echo "Forcing errno EAGAIN on read() with no data available."
11229                         eagain=EAGAIN
11230                         ;;
11231                 *)
11232                         echo "Your read() sets errno to $eagain when no data is available."
11233                         ;;
11234                 esac
11235                 status=`$cat try.err`
11236                 case "$status" in
11237                 0) echo "And it correctly returns 0 to signal EOF.";;
11238                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11239                 *) echo "However, your read() returns '$status' on EOF??";;
11240                 esac
11241                 val="$define"
11242                 if test "$status" = "$rd_nodata"; then
11243                         echo "WARNING: you can't distinguish between EOF and no data!"
11244                         val="$undef"
11245                 fi
11246         else
11247                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11248                 eagain=EAGAIN
11249         fi
11250         set d_eofnblk
11251         eval $setvar
11252         ;;
11253 *)
11254         echo "Using $hint value $eagain."
11255         echo "Your read() returns $rd_nodata when no data is present."
11256         case "$d_eofnblk" in
11257         "$define") echo "And you can see EOF because read() returns 0.";;
11258         "$undef") echo "But you can't see EOF status from read() returned value.";;
11259         *)
11260                 echo "(Assuming you can't see EOF status from read anyway.)"
11261                 d_eofnblk=$undef
11262                 ;;
11263         esac
11264         ;;
11265 esac
11266 $rm -f try try.* .out core head.c mtry
11267
11268 : see if fchdir exists
11269 set fchdir d_fchdir
11270 eval $inlibc
11271
11272 : see if fchmod exists
11273 set fchmod d_fchmod
11274 eval $inlibc
11275
11276 : see if fchown exists
11277 set fchown d_fchown
11278 eval $inlibc
11279
11280 : see if this is an fcntl system
11281 set fcntl d_fcntl
11282 eval $inlibc
11283
11284 echo " "
11285 : See if fcntl-based locking works.
11286 $cat >try.c <<EOCP
11287 #include <stdlib.h>
11288 #include <unistd.h>
11289 #include <fcntl.h>
11290 #include <signal.h>
11291 $signal_t blech(x) int x; { exit(3); }
11292 int main() {
11293 #if defined(F_SETLK) && defined(F_SETLKW)
11294      struct flock flock;
11295      int retval, fd;
11296      fd = open("try.c", O_RDONLY);
11297      flock.l_type = F_RDLCK;
11298      flock.l_whence = SEEK_SET;
11299      flock.l_start = flock.l_len = 0;
11300      signal(SIGALRM, blech);
11301      alarm(10);
11302      retval = fcntl(fd, F_SETLK, &flock);
11303      close(fd);
11304      (retval < 0 ? exit(2) : exit(0));
11305 #else
11306      exit(2);
11307 #endif
11308 }
11309 EOCP
11310 echo "Checking if fcntl-based file locking works... "
11311 case "$d_fcntl" in
11312 "$define")
11313         set try
11314         if eval $compile_ok; then
11315                 if $run ./try; then
11316                         echo "Yes, it seems to work."
11317                         val="$define"
11318                 else
11319                         echo "Nope, it didn't work."
11320                         val="$undef"
11321                         case "$?" in
11322                         3) $cat >&4 <<EOM
11323 ***
11324 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
11325 *** This is (almost) impossible.
11326 *** If your NFS lock daemons are not feeling well, something like
11327 *** this may happen, please investigate.  Cannot continue, aborting.
11328 ***
11329 EOM
11330                                 exit 1
11331                                 ;;
11332                         esac
11333                 fi
11334         else
11335                 echo "I'm unable to compile the test program, so I'll assume not."
11336                 val="$undef"
11337         fi
11338         ;;
11339 *) val="$undef";
11340         echo "Nope, since you don't even have fcntl()."
11341         ;;
11342 esac
11343 set d_fcntl_can_lock
11344 eval $setvar
11345 $rm -f try*
11346
11347
11348 : check for fd_set items
11349 $cat <<EOM
11350
11351 Checking to see how well your C compiler handles fd_set and friends ...
11352 EOM
11353 $cat >try.c <<EOCP
11354 #$i_systime I_SYS_TIME
11355 #$i_sysselct I_SYS_SELECT
11356 #$d_socket HAS_SOCKET
11357 #include <sys/types.h>
11358 #ifdef HAS_SOCKET
11359 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
11360 #endif
11361 #ifdef I_SYS_TIME
11362 #include <sys/time.h>
11363 #endif
11364 #ifdef I_SYS_SELECT
11365 #include <sys/select.h>
11366 #endif
11367 int main() {
11368         fd_set fds;
11369
11370 #ifdef TRYBITS
11371         if(fds.fds_bits);
11372 #endif
11373
11374 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
11375         exit(0);
11376 #else
11377         exit(1);
11378 #endif
11379 }
11380 EOCP
11381 set try -DTRYBITS
11382 if eval $compile; then
11383         d_fds_bits="$define"
11384         d_fd_set="$define"
11385         echo "Well, your system knows about the normal fd_set typedef..." >&4
11386         if $run ./try; then
11387                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
11388                 d_fd_macros="$define"
11389         else
11390                 $cat >&4 <<'EOM'
11391 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
11392 EOM
11393                 d_fd_macros="$undef"
11394         fi
11395 else
11396         $cat <<'EOM'
11397 Hmm, your compiler has some difficulty with fd_set.  Checking further...
11398 EOM
11399         set try
11400         if eval $compile; then
11401                 d_fds_bits="$undef"
11402                 d_fd_set="$define"
11403                 echo "Well, your system has some sort of fd_set available..." >&4
11404                 if $run ./try; then
11405                         echo "and you have the normal fd_set macros." >&4
11406                         d_fd_macros="$define"
11407                 else
11408                         $cat <<'EOM'
11409 but not the normal fd_set macros!  Gross!  More work for me...
11410 EOM
11411                         d_fd_macros="$undef"
11412                 fi
11413         else
11414         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
11415                 d_fd_set="$undef"
11416                 d_fds_bits="$undef"
11417                 d_fd_macros="$undef"
11418         fi
11419 fi
11420 $rm -f try try.*
11421
11422 : see if fgetpos exists
11423 set fgetpos d_fgetpos
11424 eval $inlibc
11425
11426 : see if finite exists
11427 set finite d_finite
11428 eval $inlibc
11429
11430 : see if finitel exists
11431 set finitel d_finitel
11432 eval $inlibc
11433
11434 : see if flock exists
11435 set flock d_flock
11436 eval $inlibc
11437
11438 : see if prototype for flock is available
11439 echo " "
11440 set d_flockproto flock $i_sysfile sys/file.h
11441 eval $hasproto
11442
11443 : see if fork exists
11444 set fork d_fork
11445 eval $inlibc
11446
11447 : see if fp_class exists
11448 set fp_class d_fp_class
11449 eval $inlibc
11450
11451 : see if pathconf exists
11452 set pathconf d_pathconf
11453 eval $inlibc
11454
11455 : see if fpathconf exists
11456 set fpathconf d_fpathconf
11457 eval $inlibc
11458
11459 : see if fpclass exists
11460 set fpclass d_fpclass
11461 eval $inlibc
11462
11463 : see if fpclassify exists
11464 set fpclassify d_fpclassify
11465 eval $inlibc
11466
11467 : see if fpclassl exists
11468 set fpclassl d_fpclassl
11469 eval $inlibc
11470
11471
11472 : check for fpos64_t
11473 echo " "
11474 echo "Checking to see if you have fpos64_t..." >&4
11475 $cat >try.c <<EOCP
11476 #include <stdio.h>
11477 int main() { fpos64_t x = 7; }
11478 EOCP
11479 set try
11480 if eval $compile; then
11481         val="$define"
11482         echo "You have fpos64_t."
11483 else
11484         val="$undef"
11485         echo "You do not have fpos64_t."
11486         case "$fpossize" in
11487         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
11488         esac
11489 fi
11490 $rm -f try.* try
11491 set d_fpos64_t
11492 eval $setvar
11493
11494 : see if frexpl exists
11495 set frexpl d_frexpl
11496 eval $inlibc
11497
11498 : see if this is a sys/param system
11499 set sys/param.h i_sysparam
11500 eval $inhdr
11501
11502 : see if this is a sys/mount.h system
11503 set sys/mount.h i_sysmount
11504 eval $inhdr
11505
11506
11507 echo " "
11508 echo "Checking to see if your system supports struct fs_data..." >&4
11509 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
11510 eval $hasstruct
11511 case "$d_fs_data_s" in
11512 "$define")      echo "Yes, it does."   ;;
11513 *)              echo "No, it doesn't." ;;
11514 esac
11515
11516 : see if fseeko exists
11517 set fseeko d_fseeko
11518 eval $inlibc
11519 case "$longsize" in
11520 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
11521 esac
11522
11523 : see if fsetpos exists
11524 set fsetpos d_fsetpos
11525 eval $inlibc
11526
11527
11528 : see if fstatfs exists
11529 set fstatfs d_fstatfs
11530 eval $inlibc
11531
11532
11533 : see if statvfs exists
11534 set statvfs d_statvfs
11535 eval $inlibc
11536
11537 : see if fstatvfs exists
11538 set fstatvfs d_fstatvfs
11539 eval $inlibc
11540
11541
11542 : see if fsync exists
11543 set fsync d_fsync
11544 eval $inlibc
11545
11546 : see if ftello exists
11547 set ftello d_ftello
11548 eval $inlibc
11549 case "$longsize" in
11550 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
11551 esac
11552
11553 : see if getcwd exists
11554 set getcwd d_getcwd
11555 eval $inlibc
11556
11557 : see if getespwnam exists
11558 set getespwnam d_getespwnam
11559 eval $inlibc
11560
11561
11562 : see if getfsstat exists
11563 set getfsstat d_getfsstat
11564 eval $inlibc
11565
11566 : see if getgrent exists
11567 set getgrent d_getgrent
11568 eval $inlibc
11569
11570 : see if getgrent_r exists
11571 set getgrent_r d_getgrent_r
11572 eval $inlibc
11573 case "$d_getgrent_r" in
11574 "$define")
11575         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11576         case "$d_getgrent_r_proto:$usethreads" in
11577         ":define")      d_getgrent_r_proto=define
11578                 set d_getgrent_r_proto getgrent_r $hdrs
11579                 eval $hasproto ;;
11580         *)      ;;
11581         esac
11582         case "$d_getgrent_r_proto" in
11583         define)
11584         case "$getgrent_r_proto" in
11585         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
11586         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
11587         esac
11588         case "$getgrent_r_proto" in
11589         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
11590         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
11591         esac
11592         case "$getgrent_r_proto" in
11593         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
11594         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
11595         esac
11596         case "$getgrent_r_proto" in
11597         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
11598         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
11599         esac
11600         case "$getgrent_r_proto" in
11601         ''|0) try='int getgrent_r(struct group*, char*, int);'
11602         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
11603         esac
11604         case "$getgrent_r_proto" in
11605         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
11606         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
11607         esac
11608         case "$getgrent_r_proto" in
11609         ''|0)   d_getgrent_r=undef
11610                 getgrent_r_proto=0
11611                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
11612         * )     case "$getgrent_r_proto" in
11613                 REENTRANT_PROTO*) ;;
11614                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
11615                 esac
11616                 echo "Prototype: $try" ;;
11617         esac
11618         ;;
11619         *)      case "$usethreads" in
11620                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
11621                 esac
11622                 d_getgrent_r=undef
11623                 getgrent_r_proto=0
11624                 ;;
11625         esac
11626         ;;
11627 *)      getgrent_r_proto=0
11628         ;;
11629 esac
11630
11631 : see if getgrgid_r exists
11632 set getgrgid_r d_getgrgid_r
11633 eval $inlibc
11634 case "$d_getgrgid_r" in
11635 "$define")
11636         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11637         case "$d_getgrgid_r_proto:$usethreads" in
11638         ":define")      d_getgrgid_r_proto=define
11639                 set d_getgrgid_r_proto getgrgid_r $hdrs
11640                 eval $hasproto ;;
11641         *)      ;;
11642         esac
11643         case "$d_getgrgid_r_proto" in
11644         define)
11645         case "$getgrgid_r_proto" in
11646         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
11647         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
11648         esac
11649         case "$getgrgid_r_proto" in
11650         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
11651         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
11652         esac
11653         case "$getgrgid_r_proto" in
11654         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
11655         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
11656         esac
11657         case "$getgrgid_r_proto" in
11658         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
11659         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
11660         esac
11661         case "$getgrgid_r_proto" in
11662         ''|0)   d_getgrgid_r=undef
11663                 getgrgid_r_proto=0
11664                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
11665         * )     case "$getgrgid_r_proto" in
11666                 REENTRANT_PROTO*) ;;
11667                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
11668                 esac
11669                 echo "Prototype: $try" ;;
11670         esac
11671         ;;
11672         *)      case "$usethreads" in
11673                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
11674                 esac
11675                 d_getgrgid_r=undef
11676                 getgrgid_r_proto=0
11677                 ;;
11678         esac
11679         ;;
11680 *)      getgrgid_r_proto=0
11681         ;;
11682 esac
11683
11684 : see if getgrnam_r exists
11685 set getgrnam_r d_getgrnam_r
11686 eval $inlibc
11687 case "$d_getgrnam_r" in
11688 "$define")
11689         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11690         case "$d_getgrnam_r_proto:$usethreads" in
11691         ":define")      d_getgrnam_r_proto=define
11692                 set d_getgrnam_r_proto getgrnam_r $hdrs
11693                 eval $hasproto ;;
11694         *)      ;;
11695         esac
11696         case "$d_getgrnam_r_proto" in
11697         define)
11698         case "$getgrnam_r_proto" in
11699         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
11700         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
11701         esac
11702         case "$getgrnam_r_proto" in
11703         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
11704         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
11705         esac
11706         case "$getgrnam_r_proto" in
11707         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
11708         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
11709         esac
11710         case "$getgrnam_r_proto" in
11711         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
11712         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
11713         esac
11714         case "$getgrnam_r_proto" in
11715         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
11716         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
11717         esac
11718         case "$getgrnam_r_proto" in
11719         ''|0)   d_getgrnam_r=undef
11720                 getgrnam_r_proto=0
11721                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
11722         * )     case "$getgrnam_r_proto" in
11723                 REENTRANT_PROTO*) ;;
11724                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
11725                 esac
11726                 echo "Prototype: $try" ;;
11727         esac
11728         ;;
11729         *)      case "$usethreads" in
11730                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
11731                 esac
11732                 d_getgrnam_r=undef
11733                 getgrnam_r_proto=0
11734                 ;;
11735         esac
11736         ;;
11737 *)      getgrnam_r_proto=0
11738         ;;
11739 esac
11740
11741 : see if gethostbyaddr exists
11742 set gethostbyaddr d_gethbyaddr
11743 eval $inlibc
11744
11745 : see if gethostbyname exists
11746 set gethostbyname d_gethbyname
11747 eval $inlibc
11748
11749 : see if gethostent exists
11750 set gethostent d_gethent
11751 eval $inlibc
11752
11753 : see how we will look up host name
11754 echo " "
11755 call=''
11756 if set gethostname val -f d_gethname; eval $csym; $val; then
11757         echo 'gethostname() found.' >&4
11758         d_gethname="$define"
11759         call=gethostname
11760 fi
11761 if set uname val -f d_uname; eval $csym; $val; then
11762         if ./xenix; then
11763                 $cat <<'EOM'
11764 uname() was found, but you're running xenix, and older versions of xenix
11765 have a broken uname(). If you don't really know whether your xenix is old
11766 enough to have a broken system call, use the default answer.
11767
11768 EOM
11769                 dflt=y
11770                 case "$d_uname" in
11771                 "$define") dflt=n;;
11772                 esac
11773                 rp='Is your uname() broken?'
11774                 . ./myread
11775                 case "$ans" in
11776                 n*) d_uname="$define"; call=uname;;
11777                 esac
11778         else
11779                 echo 'uname() found.' >&4
11780                 d_uname="$define"
11781                 case "$call" in
11782                 '') call=uname ;;
11783                 esac
11784         fi
11785 fi
11786 case "$d_gethname" in
11787 '') d_gethname="$undef";;
11788 esac
11789 case "$d_uname" in
11790 '') d_uname="$undef";;
11791 esac
11792 case "$d_uname$d_gethname" in
11793 *define*)
11794         dflt=n
11795         cat <<EOM
11796  
11797 Every now and then someone has a $call() that lies about the hostname
11798 but can't be fixed for political or economic reasons.  If you wish, I can
11799 pretend $call() isn't there and maybe compute hostname at run-time
11800 thanks to the '$phostname' command.
11801
11802 EOM
11803         rp="Shall I ignore $call() from now on?"
11804         . ./myread
11805         case "$ans" in
11806         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
11807         esac;;
11808 esac
11809 case "$phostname" in
11810 '') aphostname='';;
11811 *) case "$aphostname" in
11812         /*) ;;
11813         *) set X $phostname
11814                 shift
11815                 file=$1
11816                 shift
11817                 file=`./loc $file $file $pth`
11818                 aphostname=`echo $file $*`
11819                 ;;
11820         esac
11821         ;;
11822 esac
11823 case "$d_uname$d_gethname" in
11824 *define*) ;;
11825 *)
11826         case "$phostname" in
11827         '')
11828                 echo "There will be no way for $package to get your hostname." >&4;;
11829         *)
11830         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
11831                 ;;
11832         esac;;
11833 esac
11834 case "$d_phostname" in
11835 '') d_phostname="$undef";;
11836 esac
11837
11838 : see if gethostbyaddr_r exists
11839 set gethostbyaddr_r d_gethostbyaddr_r
11840 eval $inlibc
11841 case "$d_gethostbyaddr_r" in
11842 "$define")
11843         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11844         case "$d_gethostbyaddr_r_proto:$usethreads" in
11845         ":define")      d_gethostbyaddr_r_proto=define
11846                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
11847                 eval $hasproto ;;
11848         *)      ;;
11849         esac
11850         case "$d_gethostbyaddr_r_proto" in
11851         define)
11852         case "$gethostbyaddr_r_proto" in
11853         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
11854         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
11855         esac
11856         case "$gethostbyaddr_r_proto" in
11857         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
11858         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
11859         esac
11860         case "$gethostbyaddr_r_proto" in
11861         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
11862         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
11863         esac
11864         case "$gethostbyaddr_r_proto" in
11865         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
11866         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
11867         esac
11868         case "$gethostbyaddr_r_proto" in
11869         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
11870         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
11871         esac
11872         case "$gethostbyaddr_r_proto" in
11873         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
11874         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
11875         esac
11876         case "$gethostbyaddr_r_proto" in
11877         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
11878         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
11879         esac
11880         case "$gethostbyaddr_r_proto" in
11881         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
11882         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
11883         esac
11884         case "$gethostbyaddr_r_proto" in
11885         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
11886         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
11887         esac
11888         case "$gethostbyaddr_r_proto" in
11889         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
11890         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
11891         esac
11892         case "$gethostbyaddr_r_proto" in
11893         ''|0)   d_gethostbyaddr_r=undef
11894                 gethostbyaddr_r_proto=0
11895                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
11896         * )     case "$gethostbyaddr_r_proto" in
11897                 REENTRANT_PROTO*) ;;
11898                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
11899                 esac
11900                 echo "Prototype: $try" ;;
11901         esac
11902         ;;
11903         *)      case "$usethreads" in
11904                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
11905                 esac
11906                 d_gethostbyaddr_r=undef
11907                 gethostbyaddr_r_proto=0
11908                 ;;
11909         esac
11910         ;;
11911 *)      gethostbyaddr_r_proto=0
11912         ;;
11913 esac
11914
11915 : see if gethostbyname_r exists
11916 set gethostbyname_r d_gethostbyname_r
11917 eval $inlibc
11918 case "$d_gethostbyname_r" in
11919 "$define")
11920         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11921         case "$d_gethostbyname_r_proto:$usethreads" in
11922         ":define")      d_gethostbyname_r_proto=define
11923                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
11924                 eval $hasproto ;;
11925         *)      ;;
11926         esac
11927         case "$d_gethostbyname_r_proto" in
11928         define)
11929         case "$gethostbyname_r_proto" in
11930         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
11931         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
11932         esac
11933         case "$gethostbyname_r_proto" in
11934         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
11935         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
11936         esac
11937         case "$gethostbyname_r_proto" in
11938         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
11939         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
11940         esac
11941         case "$gethostbyname_r_proto" in
11942         ''|0)   d_gethostbyname_r=undef
11943                 gethostbyname_r_proto=0
11944                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
11945         * )     case "$gethostbyname_r_proto" in
11946                 REENTRANT_PROTO*) ;;
11947                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
11948                 esac
11949                 echo "Prototype: $try" ;;
11950         esac
11951         ;;
11952         *)      case "$usethreads" in
11953                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
11954                 esac
11955                 d_gethostbyname_r=undef
11956                 gethostbyname_r_proto=0
11957                 ;;
11958         esac
11959         ;;
11960 *)      gethostbyname_r_proto=0
11961         ;;
11962 esac
11963
11964 : see if gethostent_r exists
11965 set gethostent_r d_gethostent_r
11966 eval $inlibc
11967 case "$d_gethostent_r" in
11968 "$define")
11969         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11970         case "$d_gethostent_r_proto:$usethreads" in
11971         ":define")      d_gethostent_r_proto=define
11972                 set d_gethostent_r_proto gethostent_r $hdrs
11973                 eval $hasproto ;;
11974         *)      ;;
11975         esac
11976         case "$d_gethostent_r_proto" in
11977         define)
11978         case "$gethostent_r_proto" in
11979         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
11980         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
11981         esac
11982         case "$gethostent_r_proto" in
11983         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
11984         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
11985         esac
11986         case "$gethostent_r_proto" in
11987         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
11988         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
11989         esac
11990         case "$gethostent_r_proto" in
11991         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
11992         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
11993         esac
11994         case "$gethostent_r_proto" in
11995         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
11996         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
11997         esac
11998         case "$gethostent_r_proto" in
11999         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
12000         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
12001         esac
12002         case "$gethostent_r_proto" in
12003         ''|0)   d_gethostent_r=undef
12004                 gethostent_r_proto=0
12005                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
12006         * )     case "$gethostent_r_proto" in
12007                 REENTRANT_PROTO*) ;;
12008                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
12009                 esac
12010                 echo "Prototype: $try" ;;
12011         esac
12012         ;;
12013         *)      case "$usethreads" in
12014                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
12015                 esac
12016                 d_gethostent_r=undef
12017                 gethostent_r_proto=0
12018                 ;;
12019         esac
12020         ;;
12021 *)      gethostent_r_proto=0
12022         ;;
12023 esac
12024
12025 : see if prototypes for various gethostxxx netdb.h functions are available
12026 echo " "
12027 set d_gethostprotos gethostent $i_netdb netdb.h
12028 eval $hasproto
12029
12030 : see if getitimer exists
12031 set getitimer d_getitimer
12032 eval $inlibc
12033
12034 : see if getlogin exists
12035 set getlogin d_getlogin
12036 eval $inlibc
12037
12038 : see if getlogin_r exists
12039 set getlogin_r d_getlogin_r
12040 eval $inlibc
12041 case "$d_getlogin_r" in
12042 "$define")
12043         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
12044         case "$d_getlogin_r_proto:$usethreads" in
12045         ":define")      d_getlogin_r_proto=define
12046                 set d_getlogin_r_proto getlogin_r $hdrs
12047                 eval $hasproto ;;
12048         *)      ;;
12049         esac
12050         case "$d_getlogin_r_proto" in
12051         define)
12052         case "$getlogin_r_proto" in
12053         ''|0) try='int getlogin_r(char*, size_t);'
12054         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
12055         esac
12056         case "$getlogin_r_proto" in
12057         ''|0) try='int getlogin_r(char*, int);'
12058         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
12059         esac
12060         case "$getlogin_r_proto" in
12061         ''|0) try='char* getlogin_r(char*, size_t);'
12062         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
12063         esac
12064         case "$getlogin_r_proto" in
12065         ''|0) try='char* getlogin_r(char*, int);'
12066         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
12067         esac
12068         case "$getlogin_r_proto" in
12069         ''|0)   d_getlogin_r=undef
12070                 getlogin_r_proto=0
12071                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
12072         * )     case "$getlogin_r_proto" in
12073                 REENTRANT_PROTO*) ;;
12074                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
12075                 esac
12076                 echo "Prototype: $try" ;;
12077         esac
12078         ;;
12079         *)      case "$usethreads" in
12080                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
12081                 esac
12082                 d_getlogin_r=undef
12083                 getlogin_r_proto=0
12084                 ;;
12085         esac
12086         ;;
12087 *)      getlogin_r_proto=0
12088         ;;
12089 esac
12090
12091 : see if getmnt exists
12092 set getmnt d_getmnt
12093 eval $inlibc
12094
12095 : see if getmntent exists
12096 set getmntent d_getmntent
12097 eval $inlibc
12098
12099 : see if getnetbyaddr exists
12100 set getnetbyaddr d_getnbyaddr
12101 eval $inlibc
12102
12103 : see if getnetbyname exists
12104 set getnetbyname d_getnbyname
12105 eval $inlibc
12106
12107 : see if getnetent exists
12108 set getnetent d_getnent
12109 eval $inlibc
12110
12111 : see if getnetbyaddr_r exists
12112 set getnetbyaddr_r d_getnetbyaddr_r
12113 eval $inlibc
12114 case "$d_getnetbyaddr_r" in
12115 "$define")
12116         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12117         case "$d_getnetbyaddr_r_proto:$usethreads" in
12118         ":define")      d_getnetbyaddr_r_proto=define
12119                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
12120                 eval $hasproto ;;
12121         *)      ;;
12122         esac
12123         case "$d_getnetbyaddr_r_proto" in
12124         define)
12125         case "$getnetbyaddr_r_proto" in
12126         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
12127         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
12128         esac
12129         case "$getnetbyaddr_r_proto" in
12130         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
12131         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
12132         esac
12133         case "$getnetbyaddr_r_proto" in
12134         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
12135         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
12136         esac
12137         case "$getnetbyaddr_r_proto" in
12138         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
12139         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
12140         esac
12141         case "$getnetbyaddr_r_proto" in
12142         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
12143         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
12144         esac
12145         case "$getnetbyaddr_r_proto" in
12146         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
12147         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
12148         esac
12149         case "$getnetbyaddr_r_proto" in
12150         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
12151         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
12152         esac
12153         case "$getnetbyaddr_r_proto" in
12154         ''|0)   d_getnetbyaddr_r=undef
12155                 getnetbyaddr_r_proto=0
12156                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
12157         * )     case "$getnetbyaddr_r_proto" in
12158                 REENTRANT_PROTO*) ;;
12159                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
12160                 esac
12161                 echo "Prototype: $try" ;;
12162         esac
12163         ;;
12164         *)      case "$usethreads" in
12165                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
12166                 esac
12167                 d_getnetbyaddr_r=undef
12168                 getnetbyaddr_r_proto=0
12169                 ;;
12170         esac
12171         ;;
12172 *)      getnetbyaddr_r_proto=0
12173         ;;
12174 esac
12175
12176 : see if getnetbyname_r exists
12177 set getnetbyname_r d_getnetbyname_r
12178 eval $inlibc
12179 case "$d_getnetbyname_r" in
12180 "$define")
12181         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12182         case "$d_getnetbyname_r_proto:$usethreads" in
12183         ":define")      d_getnetbyname_r_proto=define
12184                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
12185                 eval $hasproto ;;
12186         *)      ;;
12187         esac
12188         case "$d_getnetbyname_r_proto" in
12189         define)
12190         case "$getnetbyname_r_proto" in
12191         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
12192         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
12193         esac
12194         case "$getnetbyname_r_proto" in
12195         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
12196         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
12197         esac
12198         case "$getnetbyname_r_proto" in
12199         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
12200         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
12201         esac
12202         case "$getnetbyname_r_proto" in
12203         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
12204         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
12205         esac
12206         case "$getnetbyname_r_proto" in
12207         ''|0)   d_getnetbyname_r=undef
12208                 getnetbyname_r_proto=0
12209                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
12210         * )     case "$getnetbyname_r_proto" in
12211                 REENTRANT_PROTO*) ;;
12212                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
12213                 esac
12214                 echo "Prototype: $try" ;;
12215         esac
12216         ;;
12217         *)      case "$usethreads" in
12218                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
12219                 esac
12220                 d_getnetbyname_r=undef
12221                 getnetbyname_r_proto=0
12222                 ;;
12223         esac
12224         ;;
12225 *)      getnetbyname_r_proto=0
12226         ;;
12227 esac
12228
12229 : see if getnetent_r exists
12230 set getnetent_r d_getnetent_r
12231 eval $inlibc
12232 case "$d_getnetent_r" in
12233 "$define")
12234         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12235         case "$d_getnetent_r_proto:$usethreads" in
12236         ":define")      d_getnetent_r_proto=define
12237                 set d_getnetent_r_proto getnetent_r $hdrs
12238                 eval $hasproto ;;
12239         *)      ;;
12240         esac
12241         case "$d_getnetent_r_proto" in
12242         define)
12243         case "$getnetent_r_proto" in
12244         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
12245         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
12246         esac
12247         case "$getnetent_r_proto" in
12248         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
12249         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
12250         esac
12251         case "$getnetent_r_proto" in
12252         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
12253         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
12254         esac
12255         case "$getnetent_r_proto" in
12256         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
12257         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
12258         esac
12259         case "$getnetent_r_proto" in
12260         ''|0) try='int getnetent_r(struct netent*, char*, int);'
12261         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
12262         esac
12263         case "$getnetent_r_proto" in
12264         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
12265         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
12266         esac
12267         case "$getnetent_r_proto" in
12268         ''|0)   d_getnetent_r=undef
12269                 getnetent_r_proto=0
12270                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
12271         * )     case "$getnetent_r_proto" in
12272                 REENTRANT_PROTO*) ;;
12273                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
12274                 esac
12275                 echo "Prototype: $try" ;;
12276         esac
12277         ;;
12278         *)      case "$usethreads" in
12279                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
12280                 esac
12281                 d_getnetent_r=undef
12282                 getnetent_r_proto=0
12283                 ;;
12284         esac
12285         ;;
12286 *)      getnetent_r_proto=0
12287         ;;
12288 esac
12289
12290 : see if prototypes for various getnetxxx netdb.h functions are available
12291 echo " "
12292 set d_getnetprotos getnetent $i_netdb netdb.h
12293 eval $hasproto
12294
12295 : see if getpagesize exists
12296 set getpagesize d_getpagsz
12297 eval $inlibc
12298
12299
12300 : see if getprotobyname exists
12301 set getprotobyname d_getpbyname
12302 eval $inlibc
12303
12304 : see if getprotobynumber exists
12305 set getprotobynumber d_getpbynumber
12306 eval $inlibc
12307
12308 : see if getprotoent exists
12309 set getprotoent d_getpent
12310 eval $inlibc
12311
12312 : see if getpgid exists
12313 set getpgid d_getpgid
12314 eval $inlibc
12315
12316 : see if getpgrp2 exists
12317 set getpgrp2 d_getpgrp2
12318 eval $inlibc
12319
12320 : see if getppid exists
12321 set getppid d_getppid
12322 eval $inlibc
12323
12324 : see if getpriority exists
12325 set getpriority d_getprior
12326 eval $inlibc
12327
12328 : see if getprotobyname_r exists
12329 set getprotobyname_r d_getprotobyname_r
12330 eval $inlibc
12331 case "$d_getprotobyname_r" in
12332 "$define")
12333         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12334         case "$d_getprotobyname_r_proto:$usethreads" in
12335         ":define")      d_getprotobyname_r_proto=define
12336                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
12337                 eval $hasproto ;;
12338         *)      ;;
12339         esac
12340         case "$d_getprotobyname_r_proto" in
12341         define)
12342         case "$getprotobyname_r_proto" in
12343         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
12344         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
12345         esac
12346         case "$getprotobyname_r_proto" in
12347         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
12348         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
12349         esac
12350         case "$getprotobyname_r_proto" in
12351         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
12352         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
12353         esac
12354         case "$getprotobyname_r_proto" in
12355         ''|0)   d_getprotobyname_r=undef
12356                 getprotobyname_r_proto=0
12357                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
12358         * )     case "$getprotobyname_r_proto" in
12359                 REENTRANT_PROTO*) ;;
12360                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
12361                 esac
12362                 echo "Prototype: $try" ;;
12363         esac
12364         ;;
12365         *)      case "$usethreads" in
12366                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
12367                 esac
12368                 d_getprotobyname_r=undef
12369                 getprotobyname_r_proto=0
12370                 ;;
12371         esac
12372         ;;
12373 *)      getprotobyname_r_proto=0
12374         ;;
12375 esac
12376
12377 : see if getprotobynumber_r exists
12378 set getprotobynumber_r d_getprotobynumber_r
12379 eval $inlibc
12380 case "$d_getprotobynumber_r" in
12381 "$define")
12382         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12383         case "$d_getprotobynumber_r_proto:$usethreads" in
12384         ":define")      d_getprotobynumber_r_proto=define
12385                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
12386                 eval $hasproto ;;
12387         *)      ;;
12388         esac
12389         case "$d_getprotobynumber_r_proto" in
12390         define)
12391         case "$getprotobynumber_r_proto" in
12392         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
12393         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
12394         esac
12395         case "$getprotobynumber_r_proto" in
12396         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
12397         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
12398         esac
12399         case "$getprotobynumber_r_proto" in
12400         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
12401         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
12402         esac
12403         case "$getprotobynumber_r_proto" in
12404         ''|0)   d_getprotobynumber_r=undef
12405                 getprotobynumber_r_proto=0
12406                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
12407         * )     case "$getprotobynumber_r_proto" in
12408                 REENTRANT_PROTO*) ;;
12409                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
12410                 esac
12411                 echo "Prototype: $try" ;;
12412         esac
12413         ;;
12414         *)      case "$usethreads" in
12415                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
12416                 esac
12417                 d_getprotobynumber_r=undef
12418                 getprotobynumber_r_proto=0
12419                 ;;
12420         esac
12421         ;;
12422 *)      getprotobynumber_r_proto=0
12423         ;;
12424 esac
12425
12426 : see if getprotoent_r exists
12427 set getprotoent_r d_getprotoent_r
12428 eval $inlibc
12429 case "$d_getprotoent_r" in
12430 "$define")
12431         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12432         case "$d_getprotoent_r_proto:$usethreads" in
12433         ":define")      d_getprotoent_r_proto=define
12434                 set d_getprotoent_r_proto getprotoent_r $hdrs
12435                 eval $hasproto ;;
12436         *)      ;;
12437         esac
12438         case "$d_getprotoent_r_proto" in
12439         define)
12440         case "$getprotoent_r_proto" in
12441         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
12442         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
12443         esac
12444         case "$getprotoent_r_proto" in
12445         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
12446         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
12447         esac
12448         case "$getprotoent_r_proto" in
12449         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
12450         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
12451         esac
12452         case "$getprotoent_r_proto" in
12453         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
12454         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
12455         esac
12456         case "$getprotoent_r_proto" in
12457         ''|0)   d_getprotoent_r=undef
12458                 getprotoent_r_proto=0
12459                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
12460         * )     case "$getprotoent_r_proto" in
12461                 REENTRANT_PROTO*) ;;
12462                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
12463                 esac
12464                 echo "Prototype: $try" ;;
12465         esac
12466         ;;
12467         *)      case "$usethreads" in
12468                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
12469                 esac
12470                 d_getprotoent_r=undef
12471                 getprotoent_r_proto=0
12472                 ;;
12473         esac
12474         ;;
12475 *)      getprotoent_r_proto=0
12476         ;;
12477 esac
12478
12479 : see if prototypes for various getprotoxxx netdb.h functions are available
12480 echo " "
12481 set d_getprotoprotos getprotoent $i_netdb netdb.h
12482 eval $hasproto
12483
12484 : see if getprpwnam exists
12485 set getprpwnam d_getprpwnam
12486 eval $inlibc
12487
12488 : see if getpwent exists
12489 set getpwent d_getpwent
12490 eval $inlibc
12491
12492 : see if getpwent_r exists
12493 set getpwent_r d_getpwent_r
12494 eval $inlibc
12495 case "$d_getpwent_r" in
12496 "$define")
12497         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12498         case "$d_getpwent_r_proto:$usethreads" in
12499         ":define")      d_getpwent_r_proto=define
12500                 set d_getpwent_r_proto getpwent_r $hdrs
12501                 eval $hasproto ;;
12502         *)      ;;
12503         esac
12504         case "$d_getpwent_r_proto" in
12505         define)
12506         case "$getpwent_r_proto" in
12507         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
12508         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
12509         esac
12510         case "$getpwent_r_proto" in
12511         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
12512         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
12513         esac
12514         case "$getpwent_r_proto" in
12515         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
12516         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
12517         esac
12518         case "$getpwent_r_proto" in
12519         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
12520         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
12521         esac
12522         case "$getpwent_r_proto" in
12523         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
12524         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
12525         esac
12526         case "$getpwent_r_proto" in
12527         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
12528         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
12529         esac
12530         case "$getpwent_r_proto" in
12531         ''|0)   d_getpwent_r=undef
12532                 getpwent_r_proto=0
12533                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
12534         * )     case "$getpwent_r_proto" in
12535                 REENTRANT_PROTO*) ;;
12536                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
12537                 esac
12538                 echo "Prototype: $try" ;;
12539         esac
12540         ;;
12541         *)      case "$usethreads" in
12542                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
12543                 esac
12544                 d_getpwent_r=undef
12545                 getpwent_r_proto=0
12546                 ;;
12547         esac
12548         ;;
12549 *)      getpwent_r_proto=0
12550         ;;
12551 esac
12552
12553 : see if getpwnam_r exists
12554 set getpwnam_r d_getpwnam_r
12555 eval $inlibc
12556 case "$d_getpwnam_r" in
12557 "$define")
12558         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12559         case "$d_getpwnam_r_proto:$usethreads" in
12560         ":define")      d_getpwnam_r_proto=define
12561                 set d_getpwnam_r_proto getpwnam_r $hdrs
12562                 eval $hasproto ;;
12563         *)      ;;
12564         esac
12565         case "$d_getpwnam_r_proto" in
12566         define)
12567         case "$getpwnam_r_proto" in
12568         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
12569         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
12570         esac
12571         case "$getpwnam_r_proto" in
12572         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
12573         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
12574         esac
12575         case "$getpwnam_r_proto" in
12576         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
12577         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
12578         esac
12579         case "$getpwnam_r_proto" in
12580         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
12581         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
12582         esac
12583         case "$getpwnam_r_proto" in
12584         ''|0)   d_getpwnam_r=undef
12585                 getpwnam_r_proto=0
12586                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
12587         * )     case "$getpwnam_r_proto" in
12588                 REENTRANT_PROTO*) ;;
12589                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
12590                 esac
12591                 echo "Prototype: $try" ;;
12592         esac
12593         ;;
12594         *)      case "$usethreads" in
12595                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
12596                 esac
12597                 d_getpwnam_r=undef
12598                 getpwnam_r_proto=0
12599                 ;;
12600         esac
12601         ;;
12602 *)      getpwnam_r_proto=0
12603         ;;
12604 esac
12605
12606 : see if getpwuid_r exists
12607 set getpwuid_r d_getpwuid_r
12608 eval $inlibc
12609 case "$d_getpwuid_r" in
12610 "$define")
12611         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12612         case "$d_getpwuid_r_proto:$usethreads" in
12613         ":define")      d_getpwuid_r_proto=define
12614                 set d_getpwuid_r_proto getpwuid_r $hdrs
12615                 eval $hasproto ;;
12616         *)      ;;
12617         esac
12618         case "$d_getpwuid_r_proto" in
12619         define)
12620         case "$getpwuid_r_proto" in
12621         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
12622         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
12623         esac
12624         case "$getpwuid_r_proto" in
12625         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
12626         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
12627         esac
12628         case "$getpwuid_r_proto" in
12629         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
12630         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
12631         esac
12632         case "$getpwuid_r_proto" in
12633         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
12634         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
12635         esac
12636         case "$getpwuid_r_proto" in
12637         ''|0)   d_getpwuid_r=undef
12638                 getpwuid_r_proto=0
12639                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
12640         * )     case "$getpwuid_r_proto" in
12641                 REENTRANT_PROTO*) ;;
12642                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
12643                 esac
12644                 echo "Prototype: $try" ;;
12645         esac
12646         ;;
12647         *)      case "$usethreads" in
12648                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
12649                 esac
12650                 d_getpwuid_r=undef
12651                 getpwuid_r_proto=0
12652                 ;;
12653         esac
12654         ;;
12655 *)      getpwuid_r_proto=0
12656         ;;
12657 esac
12658
12659
12660 : see if getservbyname exists
12661 set getservbyname d_getsbyname
12662 eval $inlibc
12663
12664 : see if getservbyport exists
12665 set getservbyport d_getsbyport
12666 eval $inlibc
12667
12668 : see if getservent exists
12669 set getservent d_getsent
12670 eval $inlibc
12671
12672 : see if getservbyname_r exists
12673 set getservbyname_r d_getservbyname_r
12674 eval $inlibc
12675 case "$d_getservbyname_r" in
12676 "$define")
12677         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12678         case "$d_getservbyname_r_proto:$usethreads" in
12679         ":define")      d_getservbyname_r_proto=define
12680                 set d_getservbyname_r_proto getservbyname_r $hdrs
12681                 eval $hasproto ;;
12682         *)      ;;
12683         esac
12684         case "$d_getservbyname_r_proto" in
12685         define)
12686         case "$getservbyname_r_proto" in
12687         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
12688         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
12689         esac
12690         case "$getservbyname_r_proto" in
12691         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
12692         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
12693         esac
12694         case "$getservbyname_r_proto" in
12695         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
12696         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
12697         esac
12698         case "$getservbyname_r_proto" in
12699         ''|0)   d_getservbyname_r=undef
12700                 getservbyname_r_proto=0
12701                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
12702         * )     case "$getservbyname_r_proto" in
12703                 REENTRANT_PROTO*) ;;
12704                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
12705                 esac
12706                 echo "Prototype: $try" ;;
12707         esac
12708         ;;
12709         *)      case "$usethreads" in
12710                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
12711                 esac
12712                 d_getservbyname_r=undef
12713                 getservbyname_r_proto=0
12714                 ;;
12715         esac
12716         ;;
12717 *)      getservbyname_r_proto=0
12718         ;;
12719 esac
12720
12721 : see if getservbyport_r exists
12722 set getservbyport_r d_getservbyport_r
12723 eval $inlibc
12724 case "$d_getservbyport_r" in
12725 "$define")
12726         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12727         case "$d_getservbyport_r_proto:$usethreads" in
12728         ":define")      d_getservbyport_r_proto=define
12729                 set d_getservbyport_r_proto getservbyport_r $hdrs
12730                 eval $hasproto ;;
12731         *)      ;;
12732         esac
12733         case "$d_getservbyport_r_proto" in
12734         define)
12735         case "$getservbyport_r_proto" in
12736         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
12737         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
12738         esac
12739         case "$getservbyport_r_proto" in
12740         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
12741         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
12742         esac
12743         case "$getservbyport_r_proto" in
12744         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
12745         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
12746         esac
12747         case "$getservbyport_r_proto" in
12748         ''|0)   d_getservbyport_r=undef
12749                 getservbyport_r_proto=0
12750                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
12751         * )     case "$getservbyport_r_proto" in
12752                 REENTRANT_PROTO*) ;;
12753                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
12754                 esac
12755                 echo "Prototype: $try" ;;
12756         esac
12757         ;;
12758         *)      case "$usethreads" in
12759                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
12760                 esac
12761                 d_getservbyport_r=undef
12762                 getservbyport_r_proto=0
12763                 ;;
12764         esac
12765         ;;
12766 *)      getservbyport_r_proto=0
12767         ;;
12768 esac
12769
12770 : see if getservent_r exists
12771 set getservent_r d_getservent_r
12772 eval $inlibc
12773 case "$d_getservent_r" in
12774 "$define")
12775         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12776         case "$d_getservent_r_proto:$usethreads" in
12777         ":define")      d_getservent_r_proto=define
12778                 set d_getservent_r_proto getservent_r $hdrs
12779                 eval $hasproto ;;
12780         *)      ;;
12781         esac
12782         case "$d_getservent_r_proto" in
12783         define)
12784         case "$getservent_r_proto" in
12785         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
12786         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
12787         esac
12788         case "$getservent_r_proto" in
12789         ''|0) try='int getservent_r(struct servent*, char*, int);'
12790         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
12791         esac
12792         case "$getservent_r_proto" in
12793         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
12794         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
12795         esac
12796         case "$getservent_r_proto" in
12797         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
12798         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
12799         esac
12800         case "$getservent_r_proto" in
12801         ''|0)   d_getservent_r=undef
12802                 getservent_r_proto=0
12803                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
12804         * )     case "$getservent_r_proto" in
12805                 REENTRANT_PROTO*) ;;
12806                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
12807                 esac
12808                 echo "Prototype: $try" ;;
12809         esac
12810         ;;
12811         *)      case "$usethreads" in
12812                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
12813                 esac
12814                 d_getservent_r=undef
12815                 getservent_r_proto=0
12816                 ;;
12817         esac
12818         ;;
12819 *)      getservent_r_proto=0
12820         ;;
12821 esac
12822
12823 : see if prototypes for various getservxxx netdb.h functions are available
12824 echo " "
12825 set d_getservprotos getservent $i_netdb netdb.h
12826 eval $hasproto
12827
12828 : see if getspnam exists
12829 set getspnam d_getspnam
12830 eval $inlibc
12831
12832 : see if this is a shadow.h system
12833 set shadow.h i_shadow
12834 eval $inhdr
12835
12836 : see if getspnam_r exists
12837 set getspnam_r d_getspnam_r
12838 eval $inlibc
12839 case "$d_getspnam_r" in
12840 "$define")
12841         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
12842         case "$d_getspnam_r_proto:$usethreads" in
12843         ":define")      d_getspnam_r_proto=define
12844                 set d_getspnam_r_proto getspnam_r $hdrs
12845                 eval $hasproto ;;
12846         *)      ;;
12847         esac
12848         case "$d_getspnam_r_proto" in
12849         define)
12850         case "$getspnam_r_proto" in
12851         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
12852         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
12853         esac
12854         case "$getspnam_r_proto" in
12855         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
12856         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
12857         esac
12858         case "$getspnam_r_proto" in
12859         ''|0)   d_getspnam_r=undef
12860                 getspnam_r_proto=0
12861                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
12862         * )     case "$getspnam_r_proto" in
12863                 REENTRANT_PROTO*) ;;
12864                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
12865                 esac
12866                 echo "Prototype: $try" ;;
12867         esac
12868         ;;
12869         *)      case "$usethreads" in
12870                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
12871                 esac
12872                 d_getspnam_r=undef
12873                 getspnam_r_proto=0
12874                 ;;
12875         esac
12876         ;;
12877 *)      getspnam_r_proto=0
12878         ;;
12879 esac
12880
12881 : see if gettimeofday or ftime exists
12882 set gettimeofday d_gettimeod
12883 eval $inlibc
12884 case "$d_gettimeod" in
12885 "$undef")
12886         set ftime d_ftime 
12887         eval $inlibc
12888         ;;
12889 *)
12890         val="$undef"; set d_ftime; eval $setvar
12891         ;;
12892 esac
12893 case "$d_gettimeod$d_ftime" in
12894 "$undef$undef")
12895         echo " "
12896         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
12897         ;;
12898 esac
12899
12900 : see if gmtime_r exists
12901 set gmtime_r d_gmtime_r
12902 eval $inlibc
12903 case "$d_gmtime_r" in
12904 "$define")
12905         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12906         case "$d_gmtime_r_proto:$usethreads" in
12907         ":define")      d_gmtime_r_proto=define
12908                 set d_gmtime_r_proto gmtime_r $hdrs
12909                 eval $hasproto ;;
12910         *)      ;;
12911         esac
12912         case "$d_gmtime_r_proto" in
12913         define)
12914         case "$gmtime_r_proto" in
12915         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
12916         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
12917         esac
12918         case "$gmtime_r_proto" in
12919         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
12920         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
12921         esac
12922         case "$gmtime_r_proto" in
12923         ''|0)   d_gmtime_r=undef
12924                 gmtime_r_proto=0
12925                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
12926         * )     case "$gmtime_r_proto" in
12927                 REENTRANT_PROTO*) ;;
12928                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
12929                 esac
12930                 echo "Prototype: $try" ;;
12931         esac
12932         ;;
12933         *)      case "$usethreads" in
12934                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
12935                 esac
12936                 d_gmtime_r=undef
12937                 gmtime_r_proto=0
12938                 ;;
12939         esac
12940         ;;
12941 *)      gmtime_r_proto=0
12942         ;;
12943 esac
12944
12945 : see if hasmntopt exists
12946 set hasmntopt d_hasmntopt
12947 eval $inlibc
12948
12949 : see if this is a netinet/in.h or sys/in.h system
12950 set netinet/in.h i_niin sys/in.h i_sysin
12951 eval $inhdr
12952
12953 : see if arpa/inet.h has to be included
12954 set arpa/inet.h i_arpainet
12955 eval $inhdr
12956
12957 : see if htonl --and friends-- exists
12958 val=''
12959 set htonl val
12960 eval $inlibc
12961
12962 : Maybe they are macros.
12963 case "$val" in
12964 $undef)
12965         $cat >htonl.c <<EOM
12966 #include <stdio.h>
12967 #include <sys/types.h>
12968 #$i_niin I_NETINET_IN
12969 #$i_sysin I_SYS_IN
12970 #$i_arpainet I_ARPA_INET
12971 #ifdef I_NETINET_IN
12972 #include <netinet/in.h>
12973 #endif
12974 #ifdef I_SYS_IN
12975 #include <sys/in.h>
12976 #endif
12977 #ifdef I_ARPA_INET
12978 #include <arpa/inet.h>
12979 #endif
12980 #ifdef htonl
12981 printf("Defined as a macro.");
12982 #endif
12983 EOM
12984         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
12985         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
12986                 val="$define"
12987                 echo "But it seems to be defined as a macro." >&4
12988         fi
12989         $rm -f htonl.?
12990         ;;
12991 esac
12992 set d_htonl
12993 eval $setvar
12994
12995 : index or strchr
12996 echo " "
12997 if set index val -f; eval $csym; $val; then
12998         if set strchr val -f d_strchr; eval $csym; $val; then
12999                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
13000                         val="$define"
13001                         vali="$undef"
13002                         echo "strchr() found." >&4
13003                 else
13004                         val="$undef"
13005                         vali="$define"
13006                         echo "index() found." >&4
13007                 fi
13008         else
13009                 val="$undef"
13010                 vali="$define"
13011                 echo "index() found." >&4
13012         fi
13013 else
13014         if set strchr val -f d_strchr; eval $csym; $val; then
13015                 val="$define"
13016                 vali="$undef"
13017                 echo "strchr() found." >&4
13018         else
13019                 echo "No index() or strchr() found!" >&4
13020                 val="$undef"
13021                 vali="$undef"
13022         fi
13023 fi
13024 set d_strchr; eval $setvar
13025 val="$vali"
13026 set d_index; eval $setvar
13027
13028 : check whether inet_aton exists
13029 set inet_aton d_inetaton
13030 eval $inlibc
13031
13032 : Look for isascii
13033 echo " "
13034 $cat >isascii.c <<'EOCP'
13035 #include <stdio.h>
13036 #include <ctype.h>
13037 int main() {
13038         int c = 'A';
13039         if (isascii(c))
13040                 exit(0);
13041         else
13042                 exit(1);
13043 }
13044 EOCP
13045 set isascii
13046 if eval $compile; then
13047         echo "isascii() found." >&4
13048         val="$define"
13049 else
13050         echo "isascii() NOT found." >&4
13051         val="$undef"
13052 fi
13053 set d_isascii
13054 eval $setvar
13055 $rm -f isascii*
13056
13057 : see if isfinite exists
13058 set isfinite d_isfinite
13059 eval $inlibc
13060
13061 : see if isinf exists
13062 set isinf d_isinf
13063 eval $inlibc
13064
13065 : see if isnan exists
13066 set isnan d_isnan
13067 eval $inlibc
13068
13069 : see if isnanl exists
13070 set isnanl d_isnanl
13071 eval $inlibc
13072
13073 : see if killpg exists
13074 set killpg d_killpg
13075 eval $inlibc
13076
13077 : see if lchown exists
13078 echo " "
13079 $cat > try.c <<'EOCP'
13080 /* System header to define __stub macros and hopefully few prototypes,
13081     which can conflict with char lchown(); below.  */
13082 #include <assert.h>
13083 /* Override any gcc2 internal prototype to avoid an error.  */
13084 /* We use char because int might match the return type of a gcc2
13085    builtin and then its argument prototype would still apply.  */
13086 char lchown();
13087 int main() {
13088     /*  The GNU C library defines this for functions which it implements
13089         to always fail with ENOSYS.  Some functions are actually named
13090         something starting with __ and the normal name is an alias.  */
13091 #if defined (__stub_lchown) || defined (__stub___lchown)
13092 choke me
13093 #else
13094 lchown();
13095 #endif
13096 ; return 0; }
13097 EOCP
13098 set try
13099 if eval $compile; then
13100     $echo "lchown() found." >&4
13101     val="$define"
13102 else
13103     $echo "lchown() NOT found." >&4
13104     val="$undef"
13105 fi
13106 set d_lchown
13107 eval $setvar
13108
13109 : See if number of significant digits in a double precision number is known
13110 echo " "
13111 $cat >ldbl_dig.c <<EOM
13112 #$i_limits I_LIMITS
13113 #$i_float I_FLOAT
13114 #ifdef I_LIMITS
13115 #include <limits.h>
13116 #endif
13117 #ifdef I_FLOAT
13118 #include <float.h>
13119 #endif
13120 #ifdef LDBL_DIG
13121 printf("Contains LDBL_DIG");
13122 #endif
13123 EOM
13124 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
13125 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
13126         echo "LDBL_DIG found." >&4
13127         val="$define"
13128 else
13129         echo "LDBL_DIG NOT found." >&4
13130         val="$undef"
13131 fi
13132 $rm -f ldbl_dig.?
13133 set d_ldbl_dig
13134 eval $setvar
13135
13136 : see if link exists
13137 set link d_link
13138 eval $inlibc
13139
13140 : see if localtime_r exists
13141 set localtime_r d_localtime_r
13142 eval $inlibc
13143 case "$d_localtime_r" in
13144 "$define")
13145         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13146         case "$d_localtime_r_proto:$usethreads" in
13147         ":define")      d_localtime_r_proto=define
13148                 set d_localtime_r_proto localtime_r $hdrs
13149                 eval $hasproto ;;
13150         *)      ;;
13151         esac
13152         case "$d_localtime_r_proto" in
13153         define)
13154         case "$localtime_r_proto" in
13155         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
13156         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
13157         esac
13158         case "$localtime_r_proto" in
13159         ''|0) try='int localtime_r(const time_t*, struct tm*);'
13160         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
13161         esac
13162         case "$localtime_r_proto" in
13163         ''|0)   d_localtime_r=undef
13164                 localtime_r_proto=0
13165                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
13166         * )     case "$localtime_r_proto" in
13167                 REENTRANT_PROTO*) ;;
13168                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
13169                 esac
13170                 echo "Prototype: $try" ;;
13171         esac
13172         ;;
13173         *)      case "$usethreads" in
13174                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
13175                 esac
13176                 d_localtime_r=undef
13177                 localtime_r_proto=0
13178                 ;;
13179         esac
13180         ;;
13181 *)      localtime_r_proto=0
13182         ;;
13183 esac
13184
13185 : see if localeconv exists
13186 set localeconv d_locconv
13187 eval $inlibc
13188
13189 : see if lockf exists
13190 set lockf d_lockf
13191 eval $inlibc
13192
13193 : see if prototype for lseek is available
13194 echo " "
13195 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
13196 eval $hasproto
13197
13198 : see if lstat exists
13199 set lstat d_lstat
13200 eval $inlibc
13201
13202 : see if madvise exists
13203 set madvise d_madvise
13204 eval $inlibc
13205
13206 : see if mblen exists
13207 set mblen d_mblen
13208 eval $inlibc
13209
13210 : see if mbstowcs exists
13211 set mbstowcs d_mbstowcs
13212 eval $inlibc
13213
13214 : see if mbtowc exists
13215 set mbtowc d_mbtowc
13216 eval $inlibc
13217
13218 : see if memchr exists
13219 set memchr d_memchr
13220 eval $inlibc
13221
13222 : see if memcmp exists
13223 set memcmp d_memcmp
13224 eval $inlibc
13225
13226 : see if memcpy exists
13227 set memcpy d_memcpy
13228 eval $inlibc
13229
13230 : see if memmove exists
13231 set memmove d_memmove
13232 eval $inlibc
13233
13234 : see if memset exists
13235 set memset d_memset
13236 eval $inlibc
13237
13238 : see if mkdir exists
13239 set mkdir d_mkdir
13240 eval $inlibc
13241
13242 : see if mkdtemp exists
13243 set mkdtemp d_mkdtemp
13244 eval $inlibc
13245
13246 : see if mkfifo exists
13247 set mkfifo d_mkfifo
13248 eval $inlibc
13249
13250 : see if mkstemp exists
13251 set mkstemp d_mkstemp
13252 eval $inlibc
13253
13254 : see if mkstemps exists
13255 set mkstemps d_mkstemps
13256 eval $inlibc
13257
13258 : see if mktime exists
13259 set mktime d_mktime
13260 eval $inlibc
13261
13262 : see if this is a sys/mman.h system
13263 set sys/mman.h i_sysmman
13264 eval $inhdr
13265
13266 : see if mmap exists
13267 set mmap d_mmap
13268 eval $inlibc
13269 : see what shmat returns
13270 : default to something harmless
13271 mmaptype='void *'
13272 case "$i_sysmman$d_mmap" in
13273 "$define$define")
13274         $cat >mmap.c <<'END'
13275 #include <sys/mman.h>
13276 void *mmap();
13277 END
13278         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
13279                 mmaptype='void *'
13280         else
13281                 mmaptype='caddr_t'
13282         fi
13283         echo "and it returns ($mmaptype)." >&4
13284         ;;
13285 esac
13286
13287
13288
13289 : see if mprotect exists
13290 set mprotect d_mprotect
13291 eval $inlibc
13292
13293 : see if msgctl exists
13294 set msgctl d_msgctl
13295 eval $inlibc
13296
13297 : see if msgget exists
13298 set msgget d_msgget
13299 eval $inlibc
13300
13301 : see if msgsnd exists
13302 set msgsnd d_msgsnd
13303 eval $inlibc
13304
13305 : see if msgrcv exists
13306 set msgrcv d_msgrcv
13307 eval $inlibc
13308
13309 : see how much of the 'msg*(2)' library is present.
13310 h_msg=true
13311 echo " "
13312 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
13313 *"$undef"*) h_msg=false;;
13314 esac
13315 case "$osname" in
13316 freebsd)
13317     case "`ipcs 2>&1`" in
13318     "SVID messages"*"not configured"*)
13319         echo "Your $osname does not have the msg*(2) configured." >&4
13320         h_msg=false
13321         val="$undef"
13322         set msgctl d_msgctl
13323         eval $setvar
13324         set msgget d_msgget
13325         eval $setvar
13326         set msgsnd d_msgsnd
13327         eval $setvar
13328         set msgrcv d_msgrcv
13329         eval $setvar
13330         ;;
13331     esac
13332     ;;
13333 esac
13334 : we could also check for sys/ipc.h ...
13335 if $h_msg && $test `./findhdr sys/msg.h`; then
13336         echo "You have the full msg*(2) library." >&4
13337         val="$define"
13338 else
13339         echo "You don't have the full msg*(2) library." >&4
13340         val="$undef"
13341 fi
13342 set d_msg
13343 eval $setvar
13344
13345
13346 echo " "
13347 echo "Checking to see if your system supports struct msghdr..." >&4
13348 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
13349 eval $hasstruct
13350 case "$d_msghdr_s" in
13351 "$define")      echo "Yes, it does."   ;;
13352 *)              echo "No, it doesn't." ;;
13353 esac
13354
13355
13356 : see if msync exists
13357 set msync d_msync
13358 eval $inlibc
13359
13360 : see if munmap exists
13361 set munmap d_munmap
13362 eval $inlibc
13363
13364 : see if nice exists
13365 set nice d_nice
13366 eval $inlibc
13367
13368 : see if this is a langinfo.h system
13369 set langinfo.h i_langinfo
13370 eval $inhdr
13371
13372 : see if nl_langinfo exists
13373 set nl_langinfo d_nl_langinfo
13374 eval $inlibc
13375
13376 : check for length of character
13377 echo " "
13378 case "$charsize" in
13379 '')
13380         echo "Checking to see how big your characters are (hey, you never know)..." >&4
13381         $cat >try.c <<'EOCP'
13382 #include <stdio.h>
13383 int main()
13384 {
13385     printf("%d\n", (int)sizeof(char));
13386     exit(0);
13387 }
13388 EOCP
13389         set try
13390         if eval $compile_ok; then
13391                 dflt=`$run ./try`
13392         else
13393                 dflt='1'
13394                 echo "(I can't seem to compile the test program.  Guessing...)"
13395         fi
13396         ;;
13397 *)
13398         dflt="$charsize"
13399         ;;
13400 esac
13401 rp="What is the size of a character (in bytes)?"
13402 . ./myread
13403 charsize="$ans"
13404 $rm -f try.c try
13405
13406 : check for volatile keyword
13407 echo " "
13408 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
13409 $cat >try.c <<'EOCP'
13410 main()
13411 {
13412         typedef struct _goo_struct goo_struct;
13413         goo_struct * volatile goo = ((goo_struct *)0);
13414         struct _goo_struct {
13415                 long long_int;
13416                 int reg_int;
13417                 char char_var;
13418         };
13419         typedef unsigned short foo_t;
13420         char *volatile foo;
13421         volatile int bar;
13422         volatile foo_t blech;
13423         foo = foo;
13424 }
13425 EOCP
13426 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
13427         val="$define"
13428         echo "Yup, it does."
13429 else
13430         val="$undef"
13431         echo "Nope, it doesn't."
13432 fi
13433 set d_volatile
13434 eval $setvar
13435 $rm -f try.*
13436
13437
13438 echo " "
13439 $echo "Choosing the C types to be used for Perl's internal types..." >&4
13440
13441 case "$use64bitint:$d_quad:$quadtype" in
13442 define:define:?*)
13443         ivtype="$quadtype"
13444         uvtype="$uquadtype"
13445         ivsize=8
13446         uvsize=8
13447         ;;
13448 *)      ivtype="long"
13449         uvtype="unsigned long"
13450         ivsize=$longsize
13451         uvsize=$longsize
13452         ;;
13453 esac
13454
13455 case "$uselongdouble:$d_longdbl" in
13456 define:define)
13457         nvtype="long double"
13458         nvsize=$longdblsize
13459         ;;
13460 *)      nvtype=double
13461         nvsize=$doublesize
13462         ;;
13463 esac
13464
13465 $echo "(IV will be "$ivtype", $ivsize bytes)"
13466 $echo "(UV will be "$uvtype", $uvsize bytes)"
13467 $echo "(NV will be "$nvtype", $nvsize bytes)"
13468
13469 $cat >try.c <<EOCP
13470 #$i_inttypes I_INTTYPES
13471 #ifdef I_INTTYPES
13472 #include <inttypes.h>
13473 #endif
13474 #include <stdio.h>
13475 int main() {
13476 #ifdef INT8
13477    int8_t i =  INT8_MAX;
13478   uint8_t u = UINT8_MAX;
13479   printf("int8_t\n");
13480 #endif
13481 #ifdef INT16
13482    int16_t i =  INT16_MAX;
13483   uint16_t i = UINT16_MAX;
13484   printf("int16_t\n");
13485 #endif
13486 #ifdef INT32
13487    int32_t i =  INT32_MAX;
13488   uint32_t u = UINT32_MAX;
13489   printf("int32_t\n");
13490 #endif
13491 }
13492 EOCP
13493
13494 case "$i8type" in
13495 '')     case "$charsize" in
13496         1)      i8type=char
13497                 u8type="unsigned char"
13498                 i8size=$charsize
13499                 u8size=$charsize
13500                 ;;
13501         esac
13502         ;;
13503 esac
13504 case "$i8type" in
13505 '')     set try -DINT8
13506         if eval $compile; then
13507                 case "`$run ./try`" in
13508                 int8_t) i8type=int8_t
13509                         u8type=uint8_t
13510                         i8size=1
13511                         u8size=1
13512                         ;;
13513                 esac
13514         fi
13515         ;;
13516 esac
13517 case "$i8type" in
13518 '')     if $test $charsize -ge 1; then
13519                 i8type=char
13520                 u8type="unsigned char"
13521                 i8size=$charsize
13522                 u8size=$charsize
13523         fi
13524         ;;
13525 esac
13526
13527 case "$i16type" in
13528 '')     case "$shortsize" in
13529         2)      i16type=short
13530                 u16type="unsigned short"
13531                 i16size=$shortsize
13532                 u16size=$shortsize
13533                 ;;
13534         esac
13535         ;;
13536 esac
13537 case "$i16type" in
13538 '')     set try -DINT16
13539         if eval $compile; then
13540                 case "`$run ./try`" in
13541                 int16_t)
13542                         i16type=int16_t
13543                         u16type=uint16_t
13544                         i16size=2
13545                         u16size=2
13546                         ;;
13547                 esac
13548         fi
13549         ;;
13550 esac
13551 case "$i16type" in
13552 '')     if $test $shortsize -ge 2; then
13553                 i16type=short
13554                 u16type="unsigned short"
13555                 i16size=$shortsize
13556                 u16size=$shortsize
13557         fi
13558         ;;
13559 esac
13560
13561 case "$i32type" in
13562 '')     case "$longsize" in
13563         4)      i32type=long
13564                 u32type="unsigned long"
13565                 i32size=$longsize
13566                 u32size=$longsize
13567                 ;;
13568         *)      case "$intsize" in
13569                 4)      i32type=int
13570                         u32type="unsigned int"
13571                         i32size=$intsize
13572                         u32size=$intsize
13573                         ;;
13574                 esac
13575                 ;;
13576         esac
13577         ;;
13578 esac
13579 case "$i32type" in
13580 '')     set try -DINT32
13581         if eval $compile; then
13582                 case "`$run ./try`" in
13583                 int32_t)
13584                         i32type=int32_t
13585                         u32type=uint32_t
13586                         i32size=4
13587                         u32size=4
13588                         ;;
13589                 esac
13590         fi
13591         ;;
13592 esac
13593 case "$i32type" in
13594 '')     if $test $intsize -ge 4; then
13595                 i32type=int
13596                 u32type="unsigned int"
13597                 i32size=$intsize
13598                 u32size=$intsize
13599         fi
13600         ;;
13601 esac
13602
13603 case "$i64type" in
13604 '')     case "$d_quad:$quadtype" in
13605         define:?*)
13606                 i64type="$quadtype"
13607                 u64type="$uquadtype"
13608                 i64size=8
13609                 u64size=8
13610                 ;;
13611         esac
13612         ;;
13613 esac
13614
13615 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
13616 : volatile so that the compiler has to store it out to memory.
13617 if test X"$d_volatile" = X"$define"; then
13618         volatile=volatile
13619 fi
13620 $cat <<EOP >try.c
13621 #include <stdio.h>
13622 #include <sys/types.h>
13623 #include <signal.h>
13624 #ifdef SIGFPE
13625 $volatile int bletched = 0;
13626 $signal_t blech(s) int s; { bletched = 1; }
13627 #endif
13628 int main() {
13629     $uvtype u = 0;
13630     $nvtype d;
13631     int     n = 8 * $uvsize;
13632     int     i;
13633 #ifdef SIGFPE
13634     signal(SIGFPE, blech);
13635 #endif
13636
13637     for (i = 0; i < n; i++) {
13638       u = u << 1 | ($uvtype)1;
13639       d = ($nvtype)u;
13640       if (($uvtype)d != u)
13641         break;
13642       if (d <= 0)
13643         break;
13644       d = ($nvtype)(u - 1);
13645       if (($uvtype)d != (u - 1))
13646         break;
13647 #ifdef SIGFPE
13648       if (bletched) {
13649         break;
13650 #endif
13651       } 
13652     }
13653     printf("%d\n", ((i == n) ? -n : i));
13654     exit(0);
13655 }
13656 EOP
13657 set try
13658
13659 d_nv_preserves_uv="$undef"
13660 if eval $compile; then
13661         nv_preserves_uv_bits="`$run ./try`"
13662 fi
13663 case "$nv_preserves_uv_bits" in
13664 \-[1-9]*)       
13665         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
13666         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
13667         d_nv_preserves_uv="$define"
13668         ;;
13669 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
13670         d_nv_preserves_uv="$undef" ;;
13671 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
13672         nv_preserves_uv_bits="$undef" ;;
13673 esac
13674
13675 $rm -f try.* try
13676
13677
13678 : check for off64_t
13679 echo " "
13680 echo "Checking to see if you have off64_t..." >&4
13681 $cat >try.c <<EOCP
13682 #include <sys/types.h>
13683 #include <unistd.h>
13684 int main() { off64_t x = 7; }
13685 EOCP
13686 set try
13687 if eval $compile; then
13688         val="$define"
13689         echo "You have off64_t."
13690 else
13691         val="$undef"
13692         echo "You do not have off64_t."
13693         case "$lseeksize" in
13694         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
13695         esac
13696 fi
13697 $rm -f try.* try
13698 set d_off64_t
13699 eval $setvar
13700
13701 : how to create joinable pthreads
13702 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
13703         echo " "
13704         echo "Checking what constant to use for creating joinable pthreads..." >&4 
13705         $cat >try.c <<'EOCP'
13706 #include <pthread.h>
13707 int main() {
13708     int detachstate = JOINABLE;
13709 }
13710 EOCP
13711         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
13712         if eval $compile; then
13713                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
13714                 val="$undef" # Yes, undef.
13715                 set d_old_pthread_create_joinable
13716                 eval $setvar
13717                 val=""
13718                 set old_pthread_create_joinable
13719                 eval $setvar
13720         else
13721                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
13722                 if eval $compile; then
13723                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
13724                         val="$define"
13725                         set d_old_pthread_create_joinable
13726                         eval $setvar
13727                         val=PTHREAD_CREATE_UNDETACHED
13728                         set old_pthread_create_joinable
13729                         eval $setvar
13730                 else            
13731                         set try -DJOINABLE=__UNDETACHED
13732                         if eval $compile; then
13733                                 echo "You seem to use __UNDETACHED." >&4
13734                                 val="$define"
13735                                 set d_old_pthread_create_joinable
13736                                 eval $setvar
13737                                 val=__UNDETACHED
13738                                 set old_pthread_create_joinable
13739                                 eval $setvar
13740                         else
13741                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
13742                                 val="$define"
13743                                 set d_old_pthread_create_joinable
13744                                 eval $setvar
13745                                 val=0
13746                                 set old_pthread_create_joinable
13747                                 eval $setvar
13748                         fi
13749                 fi
13750         fi
13751         $rm -f try try.*
13752 else
13753     d_old_pthread_create_joinable="$undef"
13754     old_pthread_create_joinable=""
13755 fi
13756
13757 : see if pause exists
13758 set pause d_pause
13759 eval $inlibc
13760
13761 : see if pipe exists
13762 set pipe d_pipe
13763 eval $inlibc
13764
13765 : see if poll exists
13766 set poll d_poll
13767 eval $inlibc
13768
13769 : see if readlink exists
13770 set readlink d_readlink
13771 eval $inlibc
13772
13773 echo " "
13774 procselfexe=''
13775 val="$undef"
13776 case "$d_readlink" in
13777 "$define")
13778         if $issymlink /proc/self/exe ; then
13779                 $ls -l /proc/self/exe > reflect
13780                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13781                         echo "You have Linux-like /proc/self/exe."
13782                         procselfexe='"/proc/self/exe"'
13783                         val="$define"
13784                 fi
13785         fi
13786         if $issymlink /proc/curproc/file ; then
13787                 $ls -l /proc/curproc/file > reflect
13788                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13789                         echo "You have BSD-like /proc/curproc/file."
13790                         procselfexe='"/proc/curproc/file"'
13791                         val="$define"
13792                 fi
13793         fi
13794         ;;
13795 esac
13796 $rm -f reflect
13797 set d_procselfexe
13798 eval $setvar
13799
13800 : see whether the pthread_atfork exists
13801 $cat >try.c <<EOP
13802 #include <pthread.h>
13803 #include <stdio.h>
13804 int main() {
13805 #ifdef  PTHREAD_ATFORK
13806         pthread_atfork(NULL,NULL,NULL);
13807 #endif
13808 }
13809 EOP
13810
13811 : see if pthread_atfork exists
13812 set try -DPTHREAD_ATFORK
13813 if eval $compile; then
13814     val="$define"
13815 else
13816     val="$undef"
13817 fi
13818 case "$usethreads" in
13819 $define)
13820         case "$val" in
13821         $define) echo 'pthread_atfork found.' >&4        ;;
13822         *)       echo 'pthread_atfork NOT found.' >&4    ;;
13823         esac
13824 esac
13825 set d_pthread_atfork
13826 eval $setvar
13827
13828
13829 : see whether the various POSIXish _yields exist
13830 $cat >try.c <<EOP
13831 #include <pthread.h>
13832 #include <stdio.h>
13833 int main() {
13834 #ifdef SCHED_YIELD
13835         sched_yield();
13836 #else
13837 #ifdef PTHREAD_YIELD
13838         pthread_yield();
13839 #else
13840 #ifdef PTHREAD_YIELD_NULL
13841         pthread_yield(NULL);
13842 #endif
13843 #endif
13844 #endif
13845 }
13846 EOP
13847 : see if sched_yield exists
13848 set try -DSCHED_YIELD
13849 if eval $compile; then
13850     val="$define"
13851     sched_yield='sched_yield()'
13852 else
13853     val="$undef"
13854 fi
13855 case "$usethreads" in
13856 $define)
13857         case "$val" in
13858         $define) echo 'sched_yield() found.' >&4        ;;
13859         *)       echo 'sched_yield() NOT found.' >&4    ;;
13860         esac
13861 esac
13862 set d_sched_yield
13863 eval $setvar
13864
13865 : see if pthread_yield exists
13866 set try -DPTHREAD_YIELD
13867 if eval $compile; then
13868     val="$define"
13869     case "$sched_yield" in
13870     '') sched_yield='pthread_yield()' ;;
13871     esac
13872 else
13873     set try -DPTHREAD_YIELD_NULL
13874     if eval $compile; then
13875         val="$define"
13876         case "$sched_yield" in
13877         '') sched_yield='pthread_yield(NULL)' ;;
13878         esac
13879     else
13880         val="$undef"
13881     fi
13882 fi
13883 case "$usethreads" in
13884 $define)
13885         case "$val" in
13886         $define) echo 'pthread_yield() found.' >&4      ;;
13887         *)       echo 'pthread_yield() NOT found.' >&4  ;;
13888         esac
13889         ;;
13890 esac
13891 set d_pthread_yield
13892 eval $setvar
13893
13894 case "$sched_yield" in
13895 '') sched_yield=undef ;;
13896 esac
13897
13898 $rm -f try try.*
13899
13900 : see if random_r exists
13901 set random_r d_random_r
13902 eval $inlibc
13903 case "$d_random_r" in
13904 "$define")
13905         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
13906         case "$d_random_r_proto:$usethreads" in
13907         ":define")      d_random_r_proto=define
13908                 set d_random_r_proto random_r $hdrs
13909                 eval $hasproto ;;
13910         *)      ;;
13911         esac
13912         case "$d_random_r_proto" in
13913         define)
13914         case "$random_r_proto" in
13915         ''|0) try='int random_r(int*, struct random_data*);'
13916         ./protochk "extern $try" $hdrs && random_r_proto=I_TS ;;
13917         esac
13918         case "$random_r_proto" in
13919         ''|0)   d_random_r=undef
13920                 random_r_proto=0
13921                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
13922         * )     case "$random_r_proto" in
13923                 REENTRANT_PROTO*) ;;
13924                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
13925                 esac
13926                 echo "Prototype: $try" ;;
13927         esac
13928         ;;
13929         *)      case "$usethreads" in
13930                 define) echo "random_r has no prototype, not using it." >&4 ;;
13931                 esac
13932                 d_random_r=undef
13933                 random_r_proto=0
13934                 ;;
13935         esac
13936         ;;
13937 *)      random_r_proto=0
13938         ;;
13939 esac
13940
13941 : see if readdir and friends exist
13942 set readdir d_readdir
13943 eval $inlibc
13944 set seekdir d_seekdir
13945 eval $inlibc
13946 set telldir d_telldir
13947 eval $inlibc
13948 set rewinddir d_rewinddir
13949 eval $inlibc
13950
13951 : see if readdir64_r exists
13952 set readdir64_r d_readdir64_r
13953 eval $inlibc
13954 case "$d_readdir64_r" in
13955 "$define")
13956         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
13957         case "$d_readdir64_r_proto:$usethreads" in
13958         ":define")      d_readdir64_r_proto=define
13959                 set d_readdir64_r_proto readdir64_r $hdrs
13960                 eval $hasproto ;;
13961         *)      ;;
13962         esac
13963         case "$d_readdir64_r_proto" in
13964         define)
13965         case "$readdir64_r_proto" in
13966         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
13967         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
13968         esac
13969         case "$readdir64_r_proto" in
13970         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
13971         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
13972         esac
13973         case "$readdir64_r_proto" in
13974         ''|0)   d_readdir64_r=undef
13975                 readdir64_r_proto=0
13976                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
13977         * )     case "$readdir64_r_proto" in
13978                 REENTRANT_PROTO*) ;;
13979                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
13980                 esac
13981                 echo "Prototype: $try" ;;
13982         esac
13983         ;;
13984         *)      case "$usethreads" in
13985                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
13986                 esac
13987                 d_readdir64_r=undef
13988                 readdir64_r_proto=0
13989                 ;;
13990         esac
13991         ;;
13992 *)      readdir64_r_proto=0
13993         ;;
13994 esac
13995
13996 : see if readdir_r exists
13997 set readdir_r d_readdir_r
13998 eval $inlibc
13999 case "$d_readdir_r" in
14000 "$define")
14001         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
14002         case "$d_readdir_r_proto:$usethreads" in
14003         ":define")      d_readdir_r_proto=define
14004                 set d_readdir_r_proto readdir_r $hdrs
14005                 eval $hasproto ;;
14006         *)      ;;
14007         esac
14008         case "$d_readdir_r_proto" in
14009         define)
14010         case "$readdir_r_proto" in
14011         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
14012         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
14013         esac
14014         case "$readdir_r_proto" in
14015         ''|0) try='int readdir_r(DIR*, struct dirent*);'
14016         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
14017         esac
14018         case "$readdir_r_proto" in
14019         ''|0)   d_readdir_r=undef
14020                 readdir_r_proto=0
14021                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
14022         * )     case "$readdir_r_proto" in
14023                 REENTRANT_PROTO*) ;;
14024                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
14025                 esac
14026                 echo "Prototype: $try" ;;
14027         esac
14028         ;;
14029         *)      case "$usethreads" in
14030                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
14031                 esac
14032                 d_readdir_r=undef
14033                 readdir_r_proto=0
14034                 ;;
14035         esac
14036         ;;
14037 *)      readdir_r_proto=0
14038         ;;
14039 esac
14040
14041 : see if readv exists
14042 set readv d_readv
14043 eval $inlibc
14044
14045 : see if recvmsg exists
14046 set recvmsg d_recvmsg
14047 eval $inlibc
14048
14049 : see if rename exists
14050 set rename d_rename
14051 eval $inlibc
14052
14053 : see if rmdir exists
14054 set rmdir d_rmdir
14055 eval $inlibc
14056
14057 : see if memory.h is available.
14058 val=''
14059 set memory.h val
14060 eval $inhdr
14061
14062 : See if it conflicts with string.h
14063 case "$val" in
14064 $define)
14065         case "$strings" in
14066         '') ;;
14067         *)
14068                 $cppstdin $cppflags $cppminus < $strings > mem.h
14069                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
14070                         echo " "
14071                         echo "We won't be including <memory.h>."
14072                         val="$undef"
14073                 fi
14074                 $rm -f mem.h
14075                 ;;
14076         esac
14077 esac
14078 set i_memory
14079 eval $setvar
14080
14081 : can bcopy handle overlapping blocks?
14082 echo " "
14083 val="$undef"
14084 case "$d_memmove" in
14085 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
14086 *)      case "$d_bcopy" in
14087         "$define")
14088                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
14089                 $cat >try.c <<EOCP
14090 #$i_memory I_MEMORY
14091 #$i_stdlib I_STDLIB
14092 #$i_string I_STRING
14093 #$i_unistd I_UNISTD
14094 EOCP
14095         $cat >>try.c <<'EOCP'
14096 #include <stdio.h>
14097 #ifdef I_MEMORY
14098 #  include <memory.h>
14099 #endif
14100 #ifdef I_STDLIB
14101 #  include <stdlib.h>
14102 #endif
14103 #ifdef I_STRING
14104 #  include <string.h>
14105 #else
14106 #  include <strings.h>
14107 #endif
14108 #ifdef I_UNISTD
14109 #  include <unistd.h>  /* Needed for NetBSD */
14110 #endif
14111 int main()
14112 {
14113 char buf[128], abc[128];
14114 char *b;
14115 int len;
14116 int off;
14117 int align;
14118
14119 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14120    try to store the string in read-only memory. */
14121 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
14122
14123 for (align = 7; align >= 0; align--) {
14124         for (len = 36; len; len--) {
14125                 b = buf+align;
14126                 bcopy(abc, b, len);
14127                 for (off = 1; off <= len; off++) {
14128                         bcopy(b, b+off, len);
14129                         bcopy(b+off, b, len);
14130                         if (bcmp(b, abc, len))
14131                                 exit(1);
14132                 }
14133         }
14134 }
14135 exit(0);
14136 }
14137 EOCP
14138                 set try
14139                 if eval $compile_ok; then
14140                         if ./try 2>/dev/null; then
14141                                 echo "Yes, it can."
14142                                 val="$define"
14143                         else
14144                                 echo "It can't, sorry."
14145                         fi
14146                 else
14147                         echo "(I can't compile the test program, so we'll assume not...)"
14148                 fi
14149                 ;;
14150         esac
14151         $rm -f try.* try core
14152         ;;
14153 esac
14154 set d_safebcpy
14155 eval $setvar
14156
14157 : can memcpy handle overlapping blocks?
14158 echo " "
14159 val="$undef"
14160 case "$d_memmove" in
14161 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
14162 *)      case "$d_memcpy" in
14163         "$define")
14164                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
14165                 $cat >try.c <<EOCP
14166 #$i_memory I_MEMORY
14167 #$i_stdlib I_STDLIB
14168 #$i_string I_STRING
14169 #$i_unistd I_UNISTD
14170 EOCP
14171         $cat >>try.c <<'EOCP'
14172 #include <stdio.h>
14173 #ifdef I_MEMORY
14174 #  include <memory.h>
14175 #endif
14176 #ifdef I_STDLIB
14177 #  include <stdlib.h>
14178 #endif
14179 #ifdef I_STRING
14180 #  include <string.h>
14181 #else
14182 #  include <strings.h>
14183 #endif
14184 #ifdef I_UNISTD
14185 #  include <unistd.h>  /* Needed for NetBSD */
14186 #endif
14187 int main()
14188 {
14189 char buf[128], abc[128];
14190 char *b;
14191 int len;
14192 int off;
14193 int align;
14194
14195 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14196    try to store the string in read-only memory. */
14197 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
14198
14199 for (align = 7; align >= 0; align--) {
14200         for (len = 36; len; len--) {
14201                 b = buf+align;
14202                 memcpy(b, abc, len);
14203                 for (off = 1; off <= len; off++) {
14204                         memcpy(b+off, b, len);
14205                         memcpy(b, b+off, len);
14206                         if (memcmp(b, abc, len))
14207                                 exit(1);
14208                 }
14209         }
14210 }
14211 exit(0);
14212 }
14213 EOCP
14214                 set try
14215                 if eval $compile_ok; then
14216                         if ./try 2>/dev/null; then
14217                                 echo "Yes, it can."
14218                                 val="$define"
14219                         else
14220                                 echo "It can't, sorry."
14221                         fi
14222                 else
14223                         echo "(I can't compile the test program, so we'll assume not...)"
14224                 fi
14225                 ;;
14226         esac
14227         $rm -f try.* try core
14228         ;;
14229 esac
14230 set d_safemcpy
14231 eval $setvar
14232
14233 : can memcmp be trusted to compare relative magnitude?
14234 val="$undef"
14235 case "$d_memcmp" in
14236 "$define")
14237         echo " "
14238         echo "Checking if your memcmp() can compare relative magnitude..." >&4
14239         $cat >try.c <<EOCP
14240 #$i_memory I_MEMORY
14241 #$i_stdlib I_STDLIB
14242 #$i_string I_STRING
14243 #$i_unistd I_UNISTD
14244 EOCP
14245         $cat >>try.c <<'EOCP'
14246 #include <stdio.h>
14247 #ifdef I_MEMORY
14248 #  include <memory.h>
14249 #endif
14250 #ifdef I_STDLIB
14251 #  include <stdlib.h>
14252 #endif
14253 #ifdef I_STRING
14254 #  include <string.h>
14255 #else
14256 #  include <strings.h>
14257 #endif
14258 #ifdef I_UNISTD
14259 #  include <unistd.h>  /* Needed for NetBSD */
14260 #endif
14261 int main()
14262 {
14263 char a = -1;
14264 char b = 0;
14265 if ((a < b) && memcmp(&a, &b, 1) < 0)
14266         exit(1);
14267 exit(0);
14268 }
14269 EOCP
14270         set try
14271         if eval $compile_ok; then
14272                 if $run ./try 2>/dev/null; then
14273                         echo "Yes, it can."
14274                         val="$define"
14275                 else
14276                         echo "No, it can't (it uses signed chars)."
14277                 fi
14278         else
14279                 echo "(I can't compile the test program, so we'll assume not...)"
14280         fi
14281         ;;
14282 esac
14283 $rm -f try.* try core
14284 set d_sanemcmp
14285 eval $setvar
14286
14287 : see if prototype for sbrk is available
14288 echo " "
14289 set d_sbrkproto sbrk $i_unistd unistd.h
14290 eval $hasproto
14291
14292 : see if select exists
14293 set select d_select
14294 eval $inlibc
14295
14296 : see if semctl exists
14297 set semctl d_semctl
14298 eval $inlibc
14299
14300 : see if semget exists
14301 set semget d_semget
14302 eval $inlibc
14303
14304 : see if semop exists
14305 set semop d_semop
14306 eval $inlibc
14307
14308 : see how much of the 'sem*(2)' library is present.
14309 h_sem=true
14310 echo " "
14311 case "$d_semctl$d_semget$d_semop" in
14312 *"$undef"*) h_sem=false;;
14313 esac
14314 case "$osname" in
14315 freebsd)
14316     case "`ipcs 2>&1`" in
14317     "SVID messages"*"not configured"*)
14318         echo "Your $osname does not have the sem*(2) configured." >&4
14319         h_sem=false
14320         val="$undef"
14321         set semctl d_semctl
14322         eval $setvar
14323         set semget d_semget
14324         eval $setvar
14325         set semop d_semop
14326         eval $setvar
14327         ;;
14328     esac
14329     ;;
14330 esac
14331 : we could also check for sys/ipc.h ...
14332 if $h_sem && $test `./findhdr sys/sem.h`; then
14333         echo "You have the full sem*(2) library." >&4
14334         val="$define"
14335 else
14336         echo "You don't have the full sem*(2) library." >&4
14337         val="$undef"
14338 fi
14339 set d_sem
14340 eval $setvar
14341
14342 : see whether sys/sem.h defines union semun
14343 echo " "
14344 $cat > try.c <<'END'
14345 #include <sys/types.h>
14346 #include <sys/ipc.h>
14347 #include <sys/sem.h>
14348 int main () { union semun semun; semun.buf = 0; }
14349 END
14350 set try
14351 if eval $compile; then
14352     echo "You have union semun in <sys/sem.h>." >&4
14353     val="$define"
14354 else
14355     echo "You do not have union semun in <sys/sem.h>." >&4
14356     val="$undef"
14357 fi
14358 $rm -f try try.c try.h
14359 set d_union_semun
14360 eval $setvar
14361
14362 : see how to do semctl IPC_STAT
14363 case "$d_sem" in
14364 $define)
14365     : see whether semctl IPC_STAT can use union semun
14366     echo " "
14367     $cat > try.h <<END
14368 #ifndef S_IRUSR
14369 #   ifdef S_IREAD
14370 #       define S_IRUSR S_IREAD
14371 #       define S_IWUSR S_IWRITE
14372 #       define S_IXUSR S_IEXEC
14373 #   else
14374 #       define S_IRUSR 0400
14375 #       define S_IWUSR 0200
14376 #       define S_IXUSR 0100
14377 #   endif
14378 #   define S_IRGRP (S_IRUSR>>3)
14379 #   define S_IWGRP (S_IWUSR>>3)
14380 #   define S_IXGRP (S_IXUSR>>3)
14381 #   define S_IROTH (S_IRUSR>>6)
14382 #   define S_IWOTH (S_IWUSR>>6)
14383 #   define S_IXOTH (S_IXUSR>>6)
14384 #endif
14385 #ifndef S_IRWXU
14386 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
14387 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
14388 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
14389 #endif
14390 END
14391
14392     $cat > try.c <<END
14393 #include <sys/types.h>
14394 #include <sys/ipc.h>
14395 #include <sys/sem.h>
14396 #include <sys/stat.h>
14397 #include <stdio.h>
14398 #include <errno.h>
14399 #include "try.h"
14400 #ifndef errno
14401 extern int errno;
14402 #endif
14403 #$d_union_semun HAS_UNION_SEMUN
14404 int main() {
14405     union semun
14406 #ifndef HAS_UNION_SEMUN
14407     {
14408         int val;
14409         struct semid_ds *buf;
14410         unsigned short *array;
14411     }
14412 #endif
14413     arg;
14414     int sem, st;
14415
14416 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
14417     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14418     if (sem > -1) {
14419         struct semid_ds argbuf;
14420         arg.buf = &argbuf;
14421 #       ifdef IPC_STAT
14422         st = semctl(sem, 0, IPC_STAT, arg);
14423         if (st == 0)
14424             printf("semun\n");
14425         else
14426 #       endif /* IPC_STAT */
14427             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14428 #       ifdef IPC_RMID
14429         if (semctl(sem, 0, IPC_RMID, arg) != 0)
14430 #       endif /* IPC_RMID */
14431             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14432     } else
14433 #endif /* IPC_PRIVATE && ... */
14434         printf("semget failed: errno = %d\n", errno);
14435   return 0;
14436 }
14437 END
14438     val="$undef"
14439     set try
14440     if eval $compile; then
14441         xxx=`$run ./try`
14442         case "$xxx" in
14443         semun) val="$define" ;;
14444         esac
14445     fi
14446     $rm -f try try.c
14447     set d_semctl_semun
14448     eval $setvar
14449     case "$d_semctl_semun" in
14450     $define)
14451         echo "You can use union semun for semctl IPC_STAT." >&4
14452         also='also'
14453         ;;
14454     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
14455         also=''
14456         ;;
14457     esac
14458
14459     : see whether semctl IPC_STAT can use struct semid_ds pointer
14460     $cat > try.c <<'END'
14461 #include <sys/types.h>
14462 #include <sys/ipc.h>
14463 #include <sys/sem.h>
14464 #include <sys/stat.h>
14465 #include "try.h"
14466 #include <stdio.h>
14467 #include <errno.h>
14468 #ifndef errno
14469 extern int errno;
14470 #endif
14471 int main() {
14472     struct semid_ds arg;
14473     int sem, st;
14474
14475 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
14476     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14477     if (sem > -1) {
14478 #       ifdef IPC_STAT
14479         st = semctl(sem, 0, IPC_STAT, &arg);
14480         if (st == 0)
14481             printf("semid_ds\n");
14482         else
14483 #       endif /* IPC_STAT */
14484             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14485 #       ifdef IPC_RMID
14486         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
14487 #       endif /* IPC_RMID */
14488             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14489     } else
14490 #endif /* IPC_PRIVATE && ... */
14491         printf("semget failed: errno = %d\n", errno);
14492
14493     return 0;
14494 }
14495 END
14496     val="$undef"
14497     set try
14498     if eval $compile; then
14499         xxx=`$run ./try`
14500         case "$xxx" in
14501         semid_ds) val="$define" ;;
14502         esac
14503     fi
14504     $rm -f try try.c
14505     set d_semctl_semid_ds
14506     eval $setvar
14507     case "$d_semctl_semid_ds" in
14508     $define)
14509         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
14510         ;;
14511     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
14512         ;;
14513     esac
14514     $rm -f try.h
14515     ;;
14516 *)  val="$undef"
14517
14518     # We do not have the full sem*(2) library, so assume we can not
14519     # use either.
14520
14521     set d_semctl_semun
14522     eval $setvar
14523
14524     set d_semctl_semid_ds
14525     eval $setvar
14526     ;;
14527 esac
14528
14529 : see if sendmsg exists
14530 set sendmsg d_sendmsg
14531 eval $inlibc
14532
14533 : see if setegid exists
14534 set setegid d_setegid
14535 eval $inlibc
14536
14537 : see if seteuid exists
14538 set seteuid d_seteuid
14539 eval $inlibc
14540
14541 : see if setgrent exists
14542 set setgrent d_setgrent
14543 eval $inlibc
14544
14545 : see if setgrent_r exists
14546 set setgrent_r d_setgrent_r
14547 eval $inlibc
14548 case "$d_setgrent_r" in
14549 "$define")
14550         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14551         case "$d_setgrent_r_proto:$usethreads" in
14552         ":define")      d_setgrent_r_proto=define
14553                 set d_setgrent_r_proto setgrent_r $hdrs
14554                 eval $hasproto ;;
14555         *)      ;;
14556         esac
14557         case "$d_setgrent_r_proto" in
14558         define)
14559         case "$setgrent_r_proto" in
14560         ''|0) try='int setgrent_r(FILE**);'
14561         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
14562         esac
14563         case "$setgrent_r_proto" in
14564         ''|0) try='void setgrent_r(FILE**);'
14565         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
14566         esac
14567         case "$setgrent_r_proto" in
14568         ''|0)   d_setgrent_r=undef
14569                 setgrent_r_proto=0
14570                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
14571         * )     case "$setgrent_r_proto" in
14572                 REENTRANT_PROTO*) ;;
14573                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
14574                 esac
14575                 echo "Prototype: $try" ;;
14576         esac
14577         ;;
14578         *)      case "$usethreads" in
14579                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
14580                 esac
14581                 d_setgrent_r=undef
14582                 setgrent_r_proto=0
14583                 ;;
14584         esac
14585         ;;
14586 *)      setgrent_r_proto=0
14587         ;;
14588 esac
14589
14590 : see if sethostent exists
14591 set sethostent d_sethent
14592 eval $inlibc
14593
14594 : see if sethostent_r exists
14595 set sethostent_r d_sethostent_r
14596 eval $inlibc
14597 case "$d_sethostent_r" in
14598 "$define")
14599         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14600         case "$d_sethostent_r_proto:$usethreads" in
14601         ":define")      d_sethostent_r_proto=define
14602                 set d_sethostent_r_proto sethostent_r $hdrs
14603                 eval $hasproto ;;
14604         *)      ;;
14605         esac
14606         case "$d_sethostent_r_proto" in
14607         define)
14608         case "$sethostent_r_proto" in
14609         ''|0) try='int sethostent_r(int, struct hostent_data*);'
14610         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
14611         esac
14612         case "$sethostent_r_proto" in
14613         ''|0) try='void sethostent_r(int, struct hostent_data*);'
14614         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
14615         esac
14616         case "$sethostent_r_proto" in
14617         ''|0)   d_sethostent_r=undef
14618                 sethostent_r_proto=0
14619                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
14620         * )     case "$sethostent_r_proto" in
14621                 REENTRANT_PROTO*) ;;
14622                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
14623                 esac
14624                 echo "Prototype: $try" ;;
14625         esac
14626         ;;
14627         *)      case "$usethreads" in
14628                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
14629                 esac
14630                 d_sethostent_r=undef
14631                 sethostent_r_proto=0
14632                 ;;
14633         esac
14634         ;;
14635 *)      sethostent_r_proto=0
14636         ;;
14637 esac
14638
14639 : see if setitimer exists
14640 set setitimer d_setitimer
14641 eval $inlibc
14642
14643 : see if setlinebuf exists
14644 set setlinebuf d_setlinebuf
14645 eval $inlibc
14646
14647 : see if setlocale exists
14648 set setlocale d_setlocale
14649 eval $inlibc
14650
14651 : see if locale.h is available
14652 set locale.h i_locale
14653 eval $inhdr
14654
14655 : see if setlocale_r exists
14656 set setlocale_r d_setlocale_r
14657 eval $inlibc
14658 case "$d_setlocale_r" in
14659 "$define")
14660         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
14661         case "$d_setlocale_r_proto:$usethreads" in
14662         ":define")      d_setlocale_r_proto=define
14663                 set d_setlocale_r_proto setlocale_r $hdrs
14664                 eval $hasproto ;;
14665         *)      ;;
14666         esac
14667         case "$d_setlocale_r_proto" in
14668         define)
14669         case "$setlocale_r_proto" in
14670         ''|0) try='int setlocale_r(int, const char*, char*, int);'
14671         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
14672         esac
14673         case "$setlocale_r_proto" in
14674         ''|0)   d_setlocale_r=undef
14675                 setlocale_r_proto=0
14676                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
14677         * )     case "$setlocale_r_proto" in
14678                 REENTRANT_PROTO*) ;;
14679                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
14680                 esac
14681                 echo "Prototype: $try" ;;
14682         esac
14683         ;;
14684         *)      case "$usethreads" in
14685                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
14686                 esac
14687                 d_setlocale_r=undef
14688                 setlocale_r_proto=0
14689                 ;;
14690         esac
14691         ;;
14692 *)      setlocale_r_proto=0
14693         ;;
14694 esac
14695
14696 : see if setnetent exists
14697 set setnetent d_setnent
14698 eval $inlibc
14699
14700 : see if setnetent_r exists
14701 set setnetent_r d_setnetent_r
14702 eval $inlibc
14703 case "$d_setnetent_r" in
14704 "$define")
14705         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14706         case "$d_setnetent_r_proto:$usethreads" in
14707         ":define")      d_setnetent_r_proto=define
14708                 set d_setnetent_r_proto setnetent_r $hdrs
14709                 eval $hasproto ;;
14710         *)      ;;
14711         esac
14712         case "$d_setnetent_r_proto" in
14713         define)
14714         case "$setnetent_r_proto" in
14715         ''|0) try='int setnetent_r(int, struct netent_data*);'
14716         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
14717         esac
14718         case "$setnetent_r_proto" in
14719         ''|0) try='void setnetent_r(int, struct netent_data*);'
14720         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
14721         esac
14722         case "$setnetent_r_proto" in
14723         ''|0)   d_setnetent_r=undef
14724                 setnetent_r_proto=0
14725                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
14726         * )     case "$setnetent_r_proto" in
14727                 REENTRANT_PROTO*) ;;
14728                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
14729                 esac
14730                 echo "Prototype: $try" ;;
14731         esac
14732         ;;
14733         *)      case "$usethreads" in
14734                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
14735                 esac
14736                 d_setnetent_r=undef
14737                 setnetent_r_proto=0
14738                 ;;
14739         esac
14740         ;;
14741 *)      setnetent_r_proto=0
14742         ;;
14743 esac
14744
14745 : see if setprotoent exists
14746 set setprotoent d_setpent
14747 eval $inlibc
14748
14749 : see if setpgid exists
14750 set setpgid d_setpgid
14751 eval $inlibc
14752
14753 : see if setpgrp2 exists
14754 set setpgrp2 d_setpgrp2
14755 eval $inlibc
14756
14757 : see if setpriority exists
14758 set setpriority d_setprior
14759 eval $inlibc
14760
14761 : see if setproctitle exists
14762 set setproctitle d_setproctitle
14763 eval $inlibc
14764
14765 : see if setprotoent_r exists
14766 set setprotoent_r d_setprotoent_r
14767 eval $inlibc
14768 case "$d_setprotoent_r" in
14769 "$define")
14770         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14771         case "$d_setprotoent_r_proto:$usethreads" in
14772         ":define")      d_setprotoent_r_proto=define
14773                 set d_setprotoent_r_proto setprotoent_r $hdrs
14774                 eval $hasproto ;;
14775         *)      ;;
14776         esac
14777         case "$d_setprotoent_r_proto" in
14778         define)
14779         case "$setprotoent_r_proto" in
14780         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
14781         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
14782         esac
14783         case "$setprotoent_r_proto" in
14784         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
14785         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
14786         esac
14787         case "$setprotoent_r_proto" in
14788         ''|0)   d_setprotoent_r=undef
14789                 setprotoent_r_proto=0
14790                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
14791         * )     case "$setprotoent_r_proto" in
14792                 REENTRANT_PROTO*) ;;
14793                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
14794                 esac
14795                 echo "Prototype: $try" ;;
14796         esac
14797         ;;
14798         *)      case "$usethreads" in
14799                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
14800                 esac
14801                 d_setprotoent_r=undef
14802                 setprotoent_r_proto=0
14803                 ;;
14804         esac
14805         ;;
14806 *)      setprotoent_r_proto=0
14807         ;;
14808 esac
14809
14810 : see if setpwent exists
14811 set setpwent d_setpwent
14812 eval $inlibc
14813
14814 : see if setpwent_r exists
14815 set setpwent_r d_setpwent_r
14816 eval $inlibc
14817 case "$d_setpwent_r" in
14818 "$define")
14819         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14820         case "$d_setpwent_r_proto:$usethreads" in
14821         ":define")      d_setpwent_r_proto=define
14822                 set d_setpwent_r_proto setpwent_r $hdrs
14823                 eval $hasproto ;;
14824         *)      ;;
14825         esac
14826         case "$d_setpwent_r_proto" in
14827         define)
14828         case "$setpwent_r_proto" in
14829         ''|0) try='int setpwent_r(FILE**);'
14830         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
14831         esac
14832         case "$setpwent_r_proto" in
14833         ''|0) try='void setpwent_r(FILE**);'
14834         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
14835         esac
14836         case "$setpwent_r_proto" in
14837         ''|0)   d_setpwent_r=undef
14838                 setpwent_r_proto=0
14839                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
14840         * )     case "$setpwent_r_proto" in
14841                 REENTRANT_PROTO*) ;;
14842                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
14843                 esac
14844                 echo "Prototype: $try" ;;
14845         esac
14846         ;;
14847         *)      case "$usethreads" in
14848                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
14849                 esac
14850                 d_setpwent_r=undef
14851                 setpwent_r_proto=0
14852                 ;;
14853         esac
14854         ;;
14855 *)      setpwent_r_proto=0
14856         ;;
14857 esac
14858
14859 : see if setregid exists
14860 set setregid d_setregid
14861 eval $inlibc
14862 set setresgid d_setresgid
14863 eval $inlibc
14864
14865 : see if setreuid exists
14866 set setreuid d_setreuid
14867 eval $inlibc
14868 set setresuid d_setresuid
14869 eval $inlibc
14870
14871 : see if setrgid exists
14872 set setrgid d_setrgid
14873 eval $inlibc
14874
14875 : see if setruid exists
14876 set setruid d_setruid
14877 eval $inlibc
14878
14879 : see if setservent exists
14880 set setservent d_setsent
14881 eval $inlibc
14882
14883 : see if setservent_r exists
14884 set setservent_r d_setservent_r
14885 eval $inlibc
14886 case "$d_setservent_r" in
14887 "$define")
14888         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14889         case "$d_setservent_r_proto:$usethreads" in
14890         ":define")      d_setservent_r_proto=define
14891                 set d_setservent_r_proto setservent_r $hdrs
14892                 eval $hasproto ;;
14893         *)      ;;
14894         esac
14895         case "$d_setservent_r_proto" in
14896         define)
14897         case "$setservent_r_proto" in
14898         ''|0) try='int setservent_r(int, struct servent_data*);'
14899         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
14900         esac
14901         case "$setservent_r_proto" in
14902         ''|0) try='void setservent_r(int, struct servent_data*);'
14903         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
14904         esac
14905         case "$setservent_r_proto" in
14906         ''|0)   d_setservent_r=undef
14907                 setservent_r_proto=0
14908                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
14909         * )     case "$setservent_r_proto" in
14910                 REENTRANT_PROTO*) ;;
14911                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
14912                 esac
14913                 echo "Prototype: $try" ;;
14914         esac
14915         ;;
14916         *)      case "$usethreads" in
14917                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
14918                 esac
14919                 d_setservent_r=undef
14920                 setservent_r_proto=0
14921                 ;;
14922         esac
14923         ;;
14924 *)      setservent_r_proto=0
14925         ;;
14926 esac
14927
14928 : see if setsid exists
14929 set setsid d_setsid
14930 eval $inlibc
14931
14932 : see if setvbuf exists
14933 set setvbuf d_setvbuf
14934 eval $inlibc
14935
14936 : see if sfio.h is available
14937 set sfio.h i_sfio
14938 eval $inhdr
14939
14940
14941 : see if sfio library is available
14942 case "$i_sfio" in
14943 $define)
14944         val=''
14945         set sfreserve val
14946         eval $inlibc
14947         ;;
14948 *)
14949         val="$undef"
14950         ;;
14951 esac
14952 : Ok, but do we want to use it.
14953 case "$val" in
14954 $define)
14955         case "$usesfio" in
14956         true|$define|[yY]*) dflt='y';;
14957         *) dflt='n';;
14958         esac
14959         echo "$package can use the sfio library, but it is experimental."
14960         case "$useperlio" in
14961         "$undef")
14962             echo "For sfio also the PerlIO abstraction layer is needed."
14963             echo "Earlier you said you wouldn't want that."
14964             ;;
14965         esac
14966         rp="You seem to have sfio available, do you want to try using it?"
14967         . ./myread
14968         case "$ans" in
14969         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
14970                 useperlio="$define"
14971                 val="$define"
14972                 ;;
14973         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
14974                 val="$undef"
14975                 ;;
14976         esac
14977         ;;
14978 *)      case "$usesfio" in
14979         true|$define|[yY]*)
14980                 echo "Sorry, cannot find sfio on this machine." >&4
14981                 echo "Ignoring your setting of usesfio=$usesfio." >&4
14982                 val="$undef"
14983                 ;;
14984         esac
14985         ;;
14986 esac
14987 set d_sfio
14988 eval $setvar
14989 case "$d_sfio" in
14990 $define) usesfio='true';;
14991 *) usesfio='false';;
14992 esac
14993 case "$d_sfio" in
14994 $define) ;;
14995 *)      : Remove sfio from list of libraries to use
14996         case "$libs" in
14997         *-lsfio*)
14998                 echo "Removing unneeded -lsfio from library list" >&4
14999                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
15000                 shift
15001                 libs="$*"
15002                 echo "libs = $libs" >&4
15003                 ;;
15004         esac
15005 ;;
15006 esac
15007
15008
15009 : see if shmctl exists
15010 set shmctl d_shmctl
15011 eval $inlibc
15012
15013 : see if shmget exists
15014 set shmget d_shmget
15015 eval $inlibc
15016
15017 : see if shmat exists
15018 set shmat d_shmat
15019 eval $inlibc
15020 : see what shmat returns
15021 case "$d_shmat" in
15022 "$define")
15023         $cat >shmat.c <<'END'
15024 #include <sys/shm.h>
15025 void *shmat();
15026 END
15027         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
15028                 shmattype='void *'
15029         else
15030                 shmattype='char *'
15031         fi
15032         echo "and it returns ($shmattype)." >&4
15033         : see if a prototype for shmat is available
15034         xxx=`./findhdr sys/shm.h`
15035         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
15036         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
15037                 val="$define"
15038         else
15039                 val="$undef"
15040         fi
15041         $rm -f shmat.[co]
15042         ;;
15043 *)
15044         val="$undef"
15045         ;;
15046 esac
15047 set d_shmatprototype
15048 eval $setvar
15049
15050 : see if shmdt exists
15051 set shmdt d_shmdt
15052 eval $inlibc
15053
15054 : see how much of the 'shm*(2)' library is present.
15055 h_shm=true
15056 echo " "
15057 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
15058 *"$undef"*) h_shm=false;;
15059 esac
15060 case "$osname" in
15061 freebsd)
15062     case "`ipcs 2>&1`" in
15063     "SVID shared memory"*"not configured"*)
15064         echo "Your $osname does not have the shm*(2) configured." >&4
15065         h_shm=false
15066         val="$undef"
15067         set shmctl d_shmctl
15068         evat $setvar
15069         set shmget d_shmget
15070         evat $setvar
15071         set shmat d_shmat
15072         evat $setvar
15073         set shmdt d_shmdt
15074         evat $setvar
15075         ;;
15076     esac
15077     ;;
15078 esac
15079 : we could also check for sys/ipc.h ...
15080 if $h_shm && $test `./findhdr sys/shm.h`; then
15081         echo "You have the full shm*(2) library." >&4
15082         val="$define"
15083 else
15084         echo "You don't have the full shm*(2) library." >&4
15085         val="$undef"
15086 fi
15087 set d_shm
15088 eval $setvar
15089
15090 echo " "
15091 : see if we have sigaction
15092 if set sigaction val -f d_sigaction; eval $csym; $val; then
15093         echo 'sigaction() found.' >&4
15094         $cat > try.c <<'EOP'
15095 #include <stdio.h>
15096 #include <sys/types.h>
15097 #include <signal.h>
15098 int main()
15099 {
15100     struct sigaction act, oact;
15101     act.sa_flags = 0;
15102     oact.sa_handler = 0;
15103     /* so that act and oact are used */
15104     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
15105 }
15106 EOP
15107         set try
15108         if eval $compile_ok; then
15109                 val="$define"
15110         else
15111                 echo "But you don't seem to have a useable struct sigaction." >&4
15112                 val="$undef"
15113         fi
15114 else
15115         echo 'sigaction NOT found.' >&4
15116         val="$undef"
15117 fi
15118 set d_sigaction; eval $setvar
15119 $rm -f try try$_o try.c
15120
15121 : see if sigprocmask exists
15122 set sigprocmask d_sigprocmask
15123 eval $inlibc
15124
15125 : see if sigsetjmp exists
15126 echo " "
15127 case "$d_sigsetjmp" in
15128 '')
15129         $cat >try.c <<'EOP'
15130 #include <setjmp.h>
15131 sigjmp_buf env;
15132 int set = 1;
15133 int main()
15134 {
15135         if (sigsetjmp(env,1))
15136                 exit(set);
15137         set = 0;
15138         siglongjmp(env, 1);
15139         exit(1);
15140 }
15141 EOP
15142         set try
15143         if eval $compile; then
15144                 if $run ./try >/dev/null 2>&1; then
15145                         echo "POSIX sigsetjmp found." >&4
15146                         val="$define"
15147                 else
15148                         $cat >&4 <<EOM
15149 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
15150 I'll ignore them.
15151 EOM
15152                         val="$undef"
15153                 fi
15154         else
15155                 echo "sigsetjmp not found." >&4
15156                 val="$undef"
15157         fi
15158         ;;
15159 *) val="$d_sigsetjmp"
15160         case "$d_sigsetjmp" in
15161         $define) echo "POSIX sigsetjmp found." >&4;;
15162         $undef) echo "sigsetjmp not found." >&4;;
15163         esac
15164         ;;
15165 esac
15166 set d_sigsetjmp
15167 eval $setvar
15168 $rm -f try.c try
15169
15170 : see if sockatmark exists
15171 set sockatmark d_sockatmark
15172 eval $inlibc
15173
15174 : see if prototype for sockatmark is available
15175 echo " "
15176 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
15177 eval $hasproto
15178
15179 : see if socks5_init exists
15180 set socks5_init d_socks5_init
15181 eval $inlibc
15182
15183 : see if srand48_r exists
15184 set srand48_r d_srand48_r
15185 eval $inlibc
15186 case "$d_srand48_r" in
15187 "$define")
15188         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15189         case "$d_srand48_r_proto:$usethreads" in
15190         ":define")      d_srand48_r_proto=define
15191                 set d_srand48_r_proto srand48_r $hdrs
15192                 eval $hasproto ;;
15193         *)      ;;
15194         esac
15195         case "$d_srand48_r_proto" in
15196         define)
15197         case "$srand48_r_proto" in
15198         ''|0) try='int srand48_r(long, struct drand48_data*);'
15199         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
15200         esac
15201         case "$srand48_r_proto" in
15202         ''|0)   d_srand48_r=undef
15203                 srand48_r_proto=0
15204                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
15205         * )     case "$srand48_r_proto" in
15206                 REENTRANT_PROTO*) ;;
15207                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
15208                 esac
15209                 echo "Prototype: $try" ;;
15210         esac
15211         ;;
15212         *)      case "$usethreads" in
15213                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
15214                 esac
15215                 d_srand48_r=undef
15216                 srand48_r_proto=0
15217                 ;;
15218         esac
15219         ;;
15220 *)      srand48_r_proto=0
15221         ;;
15222 esac
15223
15224 : see if srandom_r exists
15225 set srandom_r d_srandom_r
15226 eval $inlibc
15227 case "$d_srandom_r" in
15228 "$define")
15229         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15230         case "$d_srandom_r_proto:$usethreads" in
15231         ":define")      d_srandom_r_proto=define
15232                 set d_srandom_r_proto srandom_r $hdrs
15233                 eval $hasproto ;;
15234         *)      ;;
15235         esac
15236         case "$d_srandom_r_proto" in
15237         define)
15238         case "$srandom_r_proto" in
15239         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
15240         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
15241         esac
15242         case "$srandom_r_proto" in
15243         ''|0)   d_srandom_r=undef
15244                 srandom_r_proto=0
15245                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
15246         * )     case "$srandom_r_proto" in
15247                 REENTRANT_PROTO*) ;;
15248                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
15249                 esac
15250                 echo "Prototype: $try" ;;
15251         esac
15252         ;;
15253         *)      case "$usethreads" in
15254                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
15255                 esac
15256                 d_srandom_r=undef
15257                 srandom_r_proto=0
15258                 ;;
15259         esac
15260         ;;
15261 *)      srandom_r_proto=0
15262         ;;
15263 esac
15264
15265 : see if prototype for setresgid is available
15266 echo " "
15267 set d_sresgproto setresgid $i_unistd unistd.h
15268 eval $hasproto
15269
15270 : see if prototype for setresuid is available
15271 echo " "
15272 set d_sresuproto setresuid $i_unistd unistd.h
15273 eval $hasproto
15274
15275 : see if sys/stat.h is available
15276 set sys/stat.h i_sysstat
15277 eval $inhdr
15278
15279
15280 : see if stat knows about block sizes
15281 echo " "
15282 echo "Checking to see if your struct stat has st_blocks field..." >&4
15283 set d_statblks stat st_blocks $i_sysstat sys/stat.h
15284 eval $hasfield
15285
15286
15287 : see if this is a sys/vfs.h system
15288 set sys/vfs.h i_sysvfs
15289 eval $inhdr
15290
15291
15292 : see if this is a sys/statfs.h system
15293 set sys/statfs.h i_sysstatfs
15294 eval $inhdr
15295
15296
15297 echo " "
15298 echo "Checking to see if your system supports struct statfs..." >&4
15299 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
15300 eval $hasstruct
15301 case "$d_statfs_s" in
15302 "$define")      echo "Yes, it does."   ;;
15303 *)              echo "No, it doesn't." ;;
15304 esac
15305
15306
15307
15308 : see if struct statfs knows about f_flags
15309 case "$d_statfs_s" in
15310 define) 
15311         echo " "
15312         echo "Checking to see if your struct statfs has f_flags field..." >&4
15313         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
15314         eval $hasfield
15315         ;;
15316 *)      val="$undef"
15317         set d_statfs_f_flags
15318         eval $setvar
15319         ;;
15320 esac
15321 case "$d_statfs_f_flags" in
15322 "$define")      echo "Yes, it does."   ;;
15323 *)              echo "No, it doesn't." ;;
15324 esac
15325
15326 : see if _ptr and _cnt from stdio act std
15327 echo " "
15328
15329 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
15330         echo "(Looks like you have stdio.h from BSD.)"
15331         case "$stdio_ptr" in
15332         '') stdio_ptr='((fp)->_p)'
15333                 ptr_lval=$define
15334                 ;;
15335         *)      ptr_lval=$d_stdio_ptr_lval;;
15336         esac
15337         case "$stdio_cnt" in
15338         '') stdio_cnt='((fp)->_r)'
15339                 cnt_lval=$define
15340                 ;;
15341         *)      cnt_lval=$d_stdio_cnt_lval;;
15342         esac
15343         case "$stdio_base" in
15344         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
15345         esac
15346         case "$stdio_bufsiz" in
15347         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
15348         esac
15349 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
15350         echo "(Looks like you have stdio.h from Linux.)"
15351         case "$stdio_ptr" in
15352         '') stdio_ptr='((fp)->_IO_read_ptr)'
15353                 ptr_lval=$define
15354                 ;;
15355         *)      ptr_lval=$d_stdio_ptr_lval;;
15356         esac
15357         case "$stdio_cnt" in
15358         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
15359                 cnt_lval=$undef
15360                 ;;
15361         *)      cnt_lval=$d_stdio_cnt_lval;;
15362         esac
15363         case "$stdio_base" in
15364         '') stdio_base='((fp)->_IO_read_base)';;
15365         esac
15366         case "$stdio_bufsiz" in
15367         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
15368         esac
15369 else
15370         case "$stdio_ptr" in
15371         '') stdio_ptr='((fp)->_ptr)'
15372                 ptr_lval=$define
15373                 ;;
15374         *)      ptr_lval=$d_stdio_ptr_lval;;
15375         esac
15376         case "$stdio_cnt" in
15377         '') stdio_cnt='((fp)->_cnt)'
15378                 cnt_lval=$define
15379                 ;;
15380         *)      cnt_lval=$d_stdio_cnt_lval;;
15381         esac
15382         case "$stdio_base" in
15383         '') stdio_base='((fp)->_base)';;
15384         esac
15385         case "$stdio_bufsiz" in
15386         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
15387         esac
15388 fi
15389
15390 : test whether _ptr and _cnt really work
15391 echo "Checking how std your stdio is..." >&4
15392 $cat >try.c <<EOP
15393 #include <stdio.h>
15394 #define FILE_ptr(fp)    $stdio_ptr
15395 #define FILE_cnt(fp)    $stdio_cnt
15396 int main() {
15397         FILE *fp = fopen("try.c", "r");
15398         char c = getc(fp);
15399         if (
15400                 18 <= FILE_cnt(fp) &&
15401                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15402         )
15403                 exit(0);
15404         exit(1);
15405 }
15406 EOP
15407 val="$undef"
15408 set try
15409 if eval $compile && $to try.c; then
15410         if $run ./try; then
15411                 echo "Your stdio acts pretty std."
15412                 val="$define"
15413         else
15414                 echo "Your stdio isn't very std."
15415         fi
15416 else
15417         echo "Your stdio doesn't appear very std."
15418 fi
15419 $rm -f try.c try
15420
15421 # glibc 2.2.90 and above apparently change stdio streams so Perl's
15422 # direct buffer manipulation no longer works.  The Configure tests
15423 # should be changed to correctly detect this, but until then,
15424 # the following check should at least let perl compile and run.
15425 # (This quick fix should be updated before 5.8.1.)
15426 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
15427 # A. Dougherty, June 3, 2002.
15428 case "$d_gnulibc" in
15429 $define)
15430         case "$gnulibc_version" in
15431         2.[01]*)  ;;
15432         2.2) ;;
15433         2.2.[0-9]) ;;
15434         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
15435                 val="$undef"
15436                 ;;
15437         esac
15438         ;;
15439 esac
15440 set d_stdstdio
15441 eval $setvar
15442
15443 : Can _ptr be used as an lvalue?
15444 case "$d_stdstdio$ptr_lval" in
15445 $define$define) val=$define ;;
15446 *) val=$undef ;;
15447 esac
15448 set d_stdio_ptr_lval
15449 eval $setvar
15450
15451 : Can _cnt be used as an lvalue?
15452 case "$d_stdstdio$cnt_lval" in
15453 $define$define) val=$define ;;
15454 *) val=$undef ;;
15455 esac
15456 set d_stdio_cnt_lval
15457 eval $setvar
15458
15459
15460 : test whether setting _ptr sets _cnt as a side effect
15461 d_stdio_ptr_lval_sets_cnt="$undef"
15462 d_stdio_ptr_lval_nochange_cnt="$undef"
15463 case "$d_stdio_ptr_lval$d_stdstdio" in
15464 $define$define)
15465         echo "Checking to see what happens if we set the stdio ptr..." >&4
15466 $cat >try.c <<EOP
15467 #include <stdio.h>
15468 /* Can we scream? */
15469 /* Eat dust sed :-) */
15470 /* In the buffer space, no one can hear you scream. */
15471 #define FILE_ptr(fp)    $stdio_ptr
15472 #define FILE_cnt(fp)    $stdio_cnt
15473 #include <sys/types.h>
15474 int main() {
15475         FILE *fp = fopen("try.c", "r");
15476         int c;
15477         char *ptr;
15478         size_t cnt;
15479         if (!fp) {
15480             puts("Fail even to read");
15481             exit(1);
15482         }
15483         c = getc(fp); /* Read away the first # */
15484         if (c == EOF) {
15485             puts("Fail even to read");
15486             exit(1);
15487         }
15488         if (!(
15489                 18 <= FILE_cnt(fp) &&
15490                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15491         )) {
15492                 puts("Fail even to read");
15493                 exit (1);
15494         }
15495         ptr = (char*) FILE_ptr(fp);
15496         cnt = (size_t)FILE_cnt(fp);
15497
15498         FILE_ptr(fp) += 42;
15499
15500         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
15501                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
15502                 exit (1);
15503         }
15504         if (FILE_cnt(fp) <= 20) {
15505                 printf ("Fail (<20 chars to test)");
15506                 exit (1);
15507         }
15508         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
15509                 puts("Fail compare");
15510                 exit (1);
15511         }
15512         if (cnt == FILE_cnt(fp)) {
15513                 puts("Pass_unchanged");
15514                 exit (0);
15515         }       
15516         if (FILE_cnt(fp) == (cnt - 42)) {
15517                 puts("Pass_changed");
15518                 exit (0);
15519         }
15520         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
15521         return 1;
15522
15523 }
15524 EOP
15525         set try
15526         if eval $compile && $to try.c; then
15527                 case `$run ./try` in
15528                 Pass_changed)
15529                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
15530                         d_stdio_ptr_lval_sets_cnt="$define" ;;
15531                 Pass_unchanged)
15532                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
15533                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
15534                 Fail*)
15535                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
15536                 *)
15537                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
15538         esac
15539         else
15540                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
15541         fi
15542         $rm -f try.c try
15543         ;;
15544 esac
15545
15546 : see if _base is also standard
15547 val="$undef"
15548 case "$d_stdstdio" in
15549 $define)
15550         $cat >try.c <<EOP
15551 #include <stdio.h>
15552 #define FILE_base(fp)   $stdio_base
15553 #define FILE_bufsiz(fp) $stdio_bufsiz
15554 int main() {
15555         FILE *fp = fopen("try.c", "r");
15556         char c = getc(fp);
15557         if (
15558                 19 <= FILE_bufsiz(fp) &&
15559                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
15560         )
15561                 exit(0);
15562         exit(1);
15563 }
15564 EOP
15565         set try
15566         if eval $compile && $to try.c; then
15567                 if $run ./try; then
15568                         echo "And its _base field acts std."
15569                         val="$define"
15570                 else
15571                         echo "But its _base field isn't std."
15572                 fi
15573         else
15574                 echo "However, it seems to be lacking the _base field."
15575         fi
15576         $rm -f try.c try
15577         ;;
15578 esac
15579 set d_stdiobase
15580 eval $setvar
15581
15582 $cat >&4 <<EOM
15583 Checking how to access stdio streams by file descriptor number...
15584 EOM
15585 case "$stdio_stream_array" in
15586 '')     $cat >try.c <<EOCP
15587 #include <stdio.h>
15588 int main() {
15589   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
15590     printf("yes\n");
15591 }
15592 EOCP
15593         for s in _iob __iob __sF
15594         do
15595                 set try -DSTDIO_STREAM_ARRAY=$s
15596                 if eval $compile; then
15597                         case "`$run ./try`" in
15598                         yes)    stdio_stream_array=$s; break ;;
15599                         esac
15600                 fi
15601         done
15602         $rm -f try.* try$exe_ext
15603 esac
15604 case "$stdio_stream_array" in
15605 '')     $cat >&4 <<EOM
15606 I can't figure out how to access stdio streams by file descriptor number.
15607 EOM
15608         d_stdio_stream_array="$undef"
15609         ;;
15610 *)      $cat >&4 <<EOM
15611 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
15612 EOM
15613         d_stdio_stream_array="$define"
15614         ;;
15615 esac
15616
15617 : see if strcoll exists
15618 set strcoll d_strcoll
15619 eval $inlibc
15620
15621 : check for structure copying
15622 echo " "
15623 echo "Checking to see if your C compiler can copy structs..." >&4
15624 $cat >try.c <<'EOCP'
15625 main()
15626 {
15627         struct blurfl {
15628                 int dyick;
15629         } foo, bar;
15630
15631         foo = bar;
15632 }
15633 EOCP
15634 if $cc -c try.c >/dev/null 2>&1 ; then
15635         val="$define"
15636         echo "Yup, it can."
15637 else
15638         val="$undef"
15639         echo "Nope, it can't."
15640 fi
15641 set d_strctcpy
15642 eval $setvar
15643 $rm -f try.*
15644
15645 : see if strerror and/or sys_errlist[] exist
15646 echo " "
15647 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
15648     if set strerror val -f d_strerror; eval $csym; $val; then
15649                 echo 'strerror() found.' >&4
15650                 d_strerror="$define"
15651                 d_strerrm='strerror(e)'
15652                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
15653                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
15654                         d_syserrlst="$define"
15655                 else
15656                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
15657                         d_syserrlst="$undef"
15658                 fi
15659     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
15660                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
15661                 echo 'strerror() found in string header.' >&4
15662                 d_strerror="$define"
15663                 d_strerrm='strerror(e)'
15664                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
15665                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
15666                                 d_syserrlst="$define"
15667                 else
15668                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
15669                         d_syserrlst="$undef"
15670                 fi
15671     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
15672                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
15673                 d_strerror="$undef"
15674                 d_syserrlst="$define"
15675                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
15676     else
15677                 echo 'strerror() and sys_errlist[] NOT found.' >&4
15678                 d_strerror="$undef"
15679                 d_syserrlst="$undef"
15680                 d_strerrm='"unknown"'
15681     fi
15682 fi
15683
15684 : see if strerror_r exists
15685 set strerror_r d_strerror_r
15686 eval $inlibc
15687 case "$d_strerror_r" in
15688 "$define")
15689         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
15690         case "$d_strerror_r_proto:$usethreads" in
15691         ":define")      d_strerror_r_proto=define
15692                 set d_strerror_r_proto strerror_r $hdrs
15693                 eval $hasproto ;;
15694         *)      ;;
15695         esac
15696         case "$d_strerror_r_proto" in
15697         define)
15698         case "$strerror_r_proto" in
15699         ''|0) try='int strerror_r(int, char*, size_t);'
15700         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
15701         esac
15702         case "$strerror_r_proto" in
15703         ''|0) try='int strerror_r(int, char*, int);'
15704         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
15705         esac
15706         case "$strerror_r_proto" in
15707         ''|0) try='char* strerror_r(int, char*, size_t);'
15708         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
15709         esac
15710         case "$strerror_r_proto" in
15711         ''|0)   d_strerror_r=undef
15712                 strerror_r_proto=0
15713                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
15714         * )     case "$strerror_r_proto" in
15715                 REENTRANT_PROTO*) ;;
15716                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
15717                 esac
15718                 echo "Prototype: $try" ;;
15719         esac
15720         ;;
15721         *)      case "$usethreads" in
15722                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
15723                 esac
15724                 d_strerror_r=undef
15725                 strerror_r_proto=0
15726                 ;;
15727         esac
15728         ;;
15729 *)      strerror_r_proto=0
15730         ;;
15731 esac
15732
15733 : see if strftime exists
15734 set strftime d_strftime
15735 eval $inlibc
15736
15737 : see if strtod exists
15738 set strtod d_strtod
15739 eval $inlibc
15740
15741 : see if strtol exists
15742 set strtol d_strtol
15743 eval $inlibc
15744
15745 : see if strtold exists
15746 set strtold d_strtold
15747 eval $inlibc
15748
15749 : see if strtoll exists
15750 set strtoll d_strtoll
15751 eval $inlibc
15752
15753 case "$d_longlong-$d_strtoll" in
15754 "$define-$define")
15755         $cat <<EOM
15756 Checking whether your strtoll() works okay...
15757 EOM
15758         $cat >try.c <<'EOCP'
15759 #include <errno.h>
15760 #ifdef __hpux
15761 #define strtoll __strtoll
15762 #endif
15763 #ifdef __EMX__
15764 #define strtoll _strtoll
15765 #endif
15766 #include <stdio.h>
15767 extern long long int strtoll(char *s, char **, int); 
15768 static int bad = 0;
15769 int check(char *s, long long ell, int een) {
15770         long long gll;
15771         errno = 0;
15772         gll = strtoll(s, 0, 10);
15773         if (!((gll == ell) && (errno == een)))
15774                 bad++;
15775 }
15776 int main() {
15777         check(" 1",                                      1LL, 0);
15778         check(" 0",                                      0LL, 0);
15779         check("-1",                                     -1LL, 0);
15780         check("-9223372036854775808", -9223372036854775808LL, 0);
15781         check("-9223372036854775808", -9223372036854775808LL, 0);
15782         check(" 9223372036854775807",  9223372036854775807LL, 0);
15783         check("-9223372036854775808", -9223372036854775808LL, 0);
15784         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
15785         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
15786         if (!bad)
15787                 printf("ok\n");
15788 }
15789 EOCP
15790         set try
15791         if eval $compile; then
15792                 yyy=`$run ./try`
15793                 case "$yyy" in
15794                 ok) echo "Your strtoll() seems to be working okay." ;;
15795                 *) cat <<EOM >&4
15796 Your strtoll() doesn't seem to be working okay.
15797 EOM
15798                    d_strtoll="$undef"
15799                    ;;
15800                 esac
15801         else
15802                 echo "(I can't seem to compile the test program--assuming it doesn't)"
15803                 d_strtoll="$undef"
15804         fi
15805         ;;
15806 esac
15807
15808 : see if strtoq exists
15809 set strtoq d_strtoq
15810 eval $inlibc
15811
15812 : see if strtoul exists
15813 set strtoul d_strtoul
15814 eval $inlibc
15815
15816 case "$d_strtoul" in
15817 "$define")
15818         $cat <<EOM
15819 Checking whether your strtoul() works okay...
15820 EOM
15821         $cat >try.c <<'EOCP'
15822 #include <errno.h>
15823 #include <stdio.h>
15824 extern unsigned long int strtoul(char *s, char **, int); 
15825 static int bad = 0;
15826 void check(char *s, unsigned long eul, int een) {
15827         unsigned long gul;
15828         errno = 0;
15829         gul = strtoul(s, 0, 10);
15830         if (!((gul == eul) && (errno == een)))
15831                 bad++;
15832 }
15833 int main() {
15834         check(" 1", 1L, 0);
15835         check(" 0", 0L, 0);
15836 EOCP
15837         case "$longsize" in
15838         8)
15839             $cat >>try.c <<'EOCP'
15840         check("18446744073709551615", 18446744073709551615UL, 0);
15841         check("18446744073709551616", 18446744073709551615UL, ERANGE);
15842 #if 0 /* strtoul() for /^-/ strings is undefined. */
15843         check("-1", 18446744073709551615UL, 0);
15844         check("-18446744073709551614", 2, 0);
15845         check("-18446744073709551615", 1, 0);
15846         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
15847         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
15848 #endif
15849 EOCP
15850                 ;;
15851         4)
15852                     $cat >>try.c <<'EOCP'
15853         check("4294967295", 4294967295UL, 0);
15854         check("4294967296", 4294967295UL, ERANGE);
15855 #if 0 /* strtoul() for /^-/ strings is undefined. */
15856         check("-1", 4294967295UL, 0);
15857         check("-4294967294", 2, 0);
15858         check("-4294967295", 1, 0);
15859         check("-4294967296", 4294967295UL, ERANGE);
15860         check("-4294967297", 4294967295UL, ERANGE);
15861 #endif
15862 EOCP
15863                 ;;
15864         *)
15865 : Should we write these tests to be more portable by sprintf-ing
15866 : ~0 and then manipulating that char string as input for strtol?
15867                 ;;
15868         esac
15869         $cat >>try.c <<'EOCP'
15870         if (!bad)
15871                 printf("ok\n");
15872         return 0;
15873 }
15874 EOCP
15875         set try
15876         if eval $compile; then
15877                 case "`$run ./try`" in
15878                 ok) echo "Your strtoul() seems to be working okay." ;;
15879                 *) cat <<EOM >&4
15880 Your strtoul() doesn't seem to be working okay.
15881 EOM
15882                    d_strtoul="$undef"
15883                    ;;
15884                 esac
15885         fi
15886         ;;
15887 esac
15888
15889 : see if strtoull exists
15890 set strtoull d_strtoull
15891 eval $inlibc
15892
15893 case "$d_longlong-$d_strtoull" in
15894 "$define-$define")
15895         $cat <<EOM
15896 Checking whether your strtoull() works okay...
15897 EOM
15898         $cat >try.c <<'EOCP'
15899 #include <errno.h>
15900 #ifdef __hpux
15901 #define strtoull __strtoull
15902 #endif
15903 #include <stdio.h>
15904 extern unsigned long long int strtoull(char *s, char **, int); 
15905 static int bad = 0;
15906 int check(char *s, long long eull, int een) {
15907         long long gull;
15908         errno = 0;
15909         gull = strtoull(s, 0, 10);
15910         if (!((gull == eull) && (errno == een)))
15911                 bad++;
15912 }
15913 int main() {
15914         check(" 1",                                        1LL, 0);
15915         check(" 0",                                        0LL, 0);
15916         check("18446744073709551615",  18446744073709551615ULL, 0);
15917         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
15918 #if 0 /* strtoull() for /^-/ strings is undefined. */
15919         check("-1",                    18446744073709551615ULL, 0);
15920         check("-18446744073709551614",                     2LL, 0);
15921         check("-18446744073709551615",                     1LL, 0);
15922         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
15923         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
15924 #endif
15925         if (!bad)
15926                 printf("ok\n");
15927 }
15928 EOCP
15929         set try
15930         if eval $compile; then
15931                 case "`$run ./try`" in
15932                 ok) echo "Your strtoull() seems to be working okay." ;;
15933                 *) cat <<EOM >&4
15934 Your strtoull() doesn't seem to be working okay.
15935 EOM
15936                    d_strtoull="$undef"
15937                    ;;
15938                 esac
15939         fi
15940         ;;
15941 esac
15942
15943 : see if strtouq exists
15944 set strtouq d_strtouq
15945 eval $inlibc
15946
15947 case "$d_strtouq" in
15948 "$define")
15949         $cat <<EOM
15950 Checking whether your strtouq() works okay...
15951 EOM
15952         $cat >try.c <<'EOCP'
15953 #include <errno.h>
15954 #include <stdio.h>
15955 extern unsigned long long int strtouq(char *s, char **, int); 
15956 static int bad = 0;
15957 void check(char *s, unsigned long long eull, int een) {
15958         unsigned long long gull;
15959         errno = 0;
15960         gull = strtouq(s, 0, 10);
15961         if (!((gull == eull) && (errno == een)))
15962                 bad++;
15963 }
15964 int main() {
15965         check(" 1",                                        1LL, 0);
15966         check(" 0",                                        0LL, 0);
15967         check("18446744073709551615",  18446744073709551615ULL, 0);
15968         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
15969 #if 0 /* strtouq() for /^-/ strings is undefined. */
15970         check("-1",                    18446744073709551615ULL, 0);
15971         check("-18446744073709551614",                     2LL, 0);
15972         check("-18446744073709551615",                     1LL, 0);
15973         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
15974         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
15975 #endif
15976         if (!bad)
15977                 printf("ok\n");
15978         return 0;
15979 }
15980 EOCP
15981         set try
15982         if eval $compile; then
15983                 case "`$run ./try`" in
15984                 ok) echo "Your strtouq() seems to be working okay." ;;
15985                 *) cat <<EOM >&4
15986 Your strtouq() doesn't seem to be working okay.
15987 EOM
15988                    d_strtouq="$undef"
15989                    ;;
15990                 esac
15991         fi
15992         ;;
15993 esac
15994
15995 : see if strxfrm exists
15996 set strxfrm d_strxfrm
15997 eval $inlibc
15998
15999 : see if symlink exists
16000 set symlink d_symlink
16001 eval $inlibc
16002
16003 : see if syscall exists
16004 set syscall d_syscall
16005 eval $inlibc
16006
16007 : see if prototype for syscall is available
16008 echo " "
16009 set d_syscallproto syscall $i_unistd unistd.h
16010 eval $hasproto
16011
16012 : see if sysconf exists
16013 set sysconf d_sysconf
16014 eval $inlibc
16015
16016 : see if system exists
16017 set system d_system
16018 eval $inlibc
16019
16020 : see if tcgetpgrp exists
16021 set tcgetpgrp d_tcgetpgrp
16022 eval $inlibc
16023
16024 : see if tcsetpgrp exists
16025 set tcsetpgrp d_tcsetpgrp
16026 eval $inlibc
16027
16028 : see if prototype for telldir is available
16029 echo " "
16030 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
16031 eval $hasproto
16032
16033 : see if time exists
16034 echo " "
16035 if test "X$d_time" = X -o X"$timetype" = X; then
16036     if set time val -f d_time; eval $csym; $val; then
16037                 echo 'time() found.' >&4
16038                 val="$define"
16039                 rp="What is the type returned by time() on this system?"
16040                 set time_t timetype long stdio.h sys/types.h
16041                 eval $typedef_ask
16042     else
16043                 echo 'time() not found, hope that will do.' >&4
16044                 val="$undef"
16045                 timetype='int';
16046     fi
16047     set d_time
16048     eval $setvar
16049 fi
16050
16051 : see if this is a sys/times.h system
16052 set sys/times.h i_systimes
16053 eval $inhdr
16054
16055 : see if times exists
16056 echo " "
16057 if set times val -f d_times; eval $csym; $val; then
16058         echo 'times() found.' >&4
16059         d_times="$define"
16060         inc=''
16061         case "$i_systimes" in
16062         "$define") inc='sys/times.h';;
16063         esac
16064         rp="What is the type returned by times() on this system?"
16065         set clock_t clocktype long stdio.h sys/types.h $inc
16066         eval $typedef_ask
16067 else
16068         echo 'times() NOT found, hope that will do.' >&4
16069         d_times="$undef"
16070         clocktype='int'
16071 fi
16072
16073 : see if tmpnam_r exists
16074 set tmpnam_r d_tmpnam_r
16075 eval $inlibc
16076 case "$d_tmpnam_r" in
16077 "$define")
16078         hdrs="$i_systypes sys/types.h define stdio.h "
16079         case "$d_tmpnam_r_proto:$usethreads" in
16080         ":define")      d_tmpnam_r_proto=define
16081                 set d_tmpnam_r_proto tmpnam_r $hdrs
16082                 eval $hasproto ;;
16083         *)      ;;
16084         esac
16085         case "$d_tmpnam_r_proto" in
16086         define)
16087         case "$tmpnam_r_proto" in
16088         ''|0) try='char* tmpnam_r(char*);'
16089         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
16090         esac
16091         case "$tmpnam_r_proto" in
16092         ''|0)   d_tmpnam_r=undef
16093                 tmpnam_r_proto=0
16094                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
16095         * )     case "$tmpnam_r_proto" in
16096                 REENTRANT_PROTO*) ;;
16097                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
16098                 esac
16099                 echo "Prototype: $try" ;;
16100         esac
16101         ;;
16102         *)      case "$usethreads" in
16103                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
16104                 esac
16105                 d_tmpnam_r=undef
16106                 tmpnam_r_proto=0
16107                 ;;
16108         esac
16109         ;;
16110 *)      tmpnam_r_proto=0
16111         ;;
16112 esac
16113
16114 : see if truncate exists
16115 set truncate d_truncate
16116 eval $inlibc
16117
16118 : see if ttyname_r exists
16119 set ttyname_r d_ttyname_r
16120 eval $inlibc
16121 case "$d_ttyname_r" in
16122 "$define")
16123         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
16124         case "$d_ttyname_r_proto:$usethreads" in
16125         ":define")      d_ttyname_r_proto=define
16126                 set d_ttyname_r_proto ttyname_r $hdrs
16127                 eval $hasproto ;;
16128         *)      ;;
16129         esac
16130         case "$d_ttyname_r_proto" in
16131         define)
16132         case "$ttyname_r_proto" in
16133         ''|0) try='int ttyname_r(int, char*, size_t);'
16134         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
16135         esac
16136         case "$ttyname_r_proto" in
16137         ''|0) try='int ttyname_r(int, char*, int);'
16138         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
16139         esac
16140         case "$ttyname_r_proto" in
16141         ''|0) try='char* ttyname_r(int, char*, int);'
16142         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
16143         esac
16144         case "$ttyname_r_proto" in
16145         ''|0)   d_ttyname_r=undef
16146                 ttyname_r_proto=0
16147                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
16148         * )     case "$ttyname_r_proto" in
16149                 REENTRANT_PROTO*) ;;
16150                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
16151                 esac
16152                 echo "Prototype: $try" ;;
16153         esac
16154         ;;
16155         *)      case "$usethreads" in
16156                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
16157                 esac
16158                 d_ttyname_r=undef
16159                 ttyname_r_proto=0
16160                 ;;
16161         esac
16162         ;;
16163 *)      ttyname_r_proto=0
16164         ;;
16165 esac
16166
16167 : see if tzname[] exists
16168 echo " "
16169 if set tzname val -a d_tzname; eval $csym; $val; then
16170         val="$define"
16171         echo 'tzname[] found.' >&4
16172 else
16173         val="$undef"
16174         echo 'tzname[] NOT found.' >&4
16175 fi
16176 set d_tzname
16177 eval $setvar
16178
16179 case "$osname" in
16180 next|rhapsody|darwin) multiarch="$define" ;;
16181 esac
16182 case "$multiarch" in
16183 ''|[nN]*) multiarch="$undef" ;;
16184 esac
16185
16186 : check for ordering of bytes in a UV
16187 echo " "
16188 case "$usecrosscompile$multiarch" in
16189 *$define*)
16190         $cat <<EOM
16191 You seem to be either cross-compiling or doing a multiarchitecture build,
16192 skipping the byteorder check.
16193
16194 EOM
16195         byteorder='ffff'
16196         ;;
16197 *)
16198         case "$byteorder" in
16199         '')
16200                 $cat <<'EOM'
16201 In the following, larger digits indicate more significance.  A big-endian
16202 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
16203 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
16204 machines may have weird orders like 3412.  A Cray will report 87654321,
16205 an Alpha will report 12345678. If the test program works the default is
16206 probably right.
16207 I'm now running the test program...
16208 EOM
16209                 $cat >try.c <<EOCP
16210 #include <stdio.h>
16211 #include <sys/types.h>
16212 typedef $uvtype UV;
16213 int main()
16214 {
16215         int i;
16216         union {
16217                 UV l;
16218                 char c[$uvsize];
16219         } u;
16220
16221         if ($uvsize > 4)
16222                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
16223         else
16224                 u.l = (UV)0x04030201;
16225         for (i = 0; i < $uvsize; i++)
16226                 printf("%c", u.c[i]+'0');
16227         printf("\n");
16228         exit(0);
16229 }
16230 EOCP
16231                 xxx_prompt=y
16232                 set try
16233                 if eval $compile && ./try > /dev/null; then
16234                         dflt=`$run ./try`
16235                         case "$dflt" in
16236                         [1-4][1-4][1-4][1-4]|12345678|87654321)
16237                                 echo "(The test program ran ok.)"
16238                                 echo "byteorder=$dflt"
16239                                 xxx_prompt=n
16240                         ;;
16241                         ????|????????) echo "(The test program ran ok.)" ;;
16242                         *) echo "(The test program didn't run right for some reason.)" ;;
16243                         esac
16244                 else
16245                         dflt='4321'
16246                         cat <<'EOM'
16247 (I can't seem to compile the test program.  Guessing big-endian...)
16248 EOM
16249                 fi
16250                 case "$xxx_prompt" in
16251                 y)
16252                         rp="What is the order of bytes in $uvtype?"
16253                         . ./myread
16254                         byteorder="$ans"
16255                         ;;
16256                 *)      byteorder=$dflt
16257                         ;;
16258                 esac
16259                 ;;
16260         esac
16261         $rm -f try.c try
16262         ;;
16263 esac
16264
16265
16266 $cat <<EOM
16267
16268 Checking to see whether you can access character data unalignedly...
16269 EOM
16270 case "$d_u32align" in
16271 '')   $cat >try.c <<EOCP
16272 #include <stdio.h>
16273 #define U32 $u32type
16274 #define BYTEORDER 0x$byteorder
16275 #define U8 $u8type
16276 #include <signal.h>
16277 #ifdef SIGBUS
16278 $signal_t bletch(s) int s; { exit(4); }
16279 #endif
16280 int main() {
16281 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
16282     U8 buf[8];
16283     U32 *up;
16284     int i;
16285
16286     if (sizeof(U32) != 4) {
16287         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
16288         exit(1);
16289     }
16290
16291     fflush(stdout);
16292
16293 #ifdef SIGBUS
16294     signal(SIGBUS, bletch);
16295 #endif
16296
16297     buf[0] = 0;
16298     buf[1] = 0;
16299     buf[2] = 0;
16300     buf[3] = 1;
16301     buf[5] = 0;
16302     buf[6] = 0;
16303     buf[7] = 0;
16304     buf[8] = 1;
16305
16306     for (i = 0; i < 4; i++) {
16307         up = (U32*)(buf + i);
16308         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
16309                (*up == 1 << (8*(3-i)))  /* little-endian */
16310               )
16311            )
16312         {
16313             printf("read failed (%x)\n", *up);
16314             exit(2);
16315         }
16316     }
16317
16318     /* write test */
16319     for (i = 0; i < 4; i++) {
16320         up = (U32*)(buf + i);
16321         *up = 0xBeef;
16322         if (*up != 0xBeef) {
16323             printf("write failed (%x)\n", *up);
16324             exit(3);
16325         }
16326     }
16327
16328     exit(0);
16329 #else
16330     printf("1\n");
16331     exit(1);
16332 #endif
16333     return 0;
16334 }
16335 EOCP
16336 set try
16337 if eval $compile_ok; then
16338         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
16339         $run ./try 2>&1 >/dev/null
16340         case "$?" in
16341         0)      cat >&4 <<EOM
16342 You can access character data pretty unalignedly.
16343 EOM
16344                 d_u32align="$undef"
16345                 ;;
16346         *)      cat >&4 <<EOM
16347 It seems that you must access character data in an aligned manner.
16348 EOM
16349                 d_u32align="$define"
16350                 ;;
16351         esac
16352 else
16353         rp='Can you access character data at unaligned addresses?'
16354         dflt='n'
16355         . ./myread
16356         case "$ans" in
16357         [yY]*)  d_u32align="$undef"  ;;
16358         *)      d_u32align="$define" ;;
16359         esac
16360 fi
16361 $rm -f core core.try.* try.core
16362 ;;
16363 esac
16364
16365 : see if ualarm exists
16366 set ualarm d_ualarm
16367 eval $inlibc
16368
16369 : see if umask exists
16370 set umask d_umask
16371 eval $inlibc
16372
16373 : see if unordered exists
16374 set unordered d_unordered
16375 eval $inlibc
16376
16377 : see if usleep exists
16378 set usleep d_usleep
16379 eval $inlibc
16380
16381 : see if prototype for usleep is available
16382 echo " "
16383 set d_usleepproto usleep $i_unistd unistd.h
16384 eval $hasproto
16385
16386 : see if ustat exists
16387 set ustat d_ustat
16388 eval $inlibc
16389
16390 : backward compatibility for d_hvfork
16391 if test X$d_hvfork != X; then
16392         d_vfork="$d_hvfork"
16393         d_hvfork=''
16394 fi
16395 : see if there is a vfork
16396 val=''
16397 set vfork val
16398 eval $inlibc
16399
16400 : Ok, but do we want to use it. vfork is reportedly unreliable in 
16401 : perl on Solaris 2.x, and probably elsewhere.
16402 case "$val" in
16403 $define)
16404         echo " "
16405         case "$usevfork" in
16406         false) dflt='n';;
16407         *) dflt='y';;
16408         esac
16409         cat <<'EOM'
16410  
16411 Perl can only use a vfork() that doesn't suffer from strict
16412 restrictions on calling functions or modifying global data in
16413 the child.  For example, glibc-2.1 contains such a vfork()
16414 that is unsuitable.  If your system provides a proper fork()
16415 call, chances are that you do NOT want perl to use vfork().
16416
16417 EOM
16418         rp="Do you still want to use vfork()?"
16419         . ./myread
16420         case "$ans" in
16421         y|Y) ;;
16422         *)
16423                 echo "Ok, we won't use vfork()."
16424                 val="$undef"
16425                 ;;
16426         esac
16427         ;;
16428 esac
16429 set d_vfork
16430 eval $setvar
16431 case "$d_vfork" in
16432 $define) usevfork='true';;
16433 *) usevfork='false';;
16434 esac
16435
16436 : see if closedir exists
16437 set closedir d_closedir
16438 eval $inlibc
16439
16440 case "$d_closedir" in
16441 "$define")
16442         echo " "
16443         echo "Checking whether closedir() returns a status..." >&4
16444         cat > try.c <<EOM
16445 #$i_dirent I_DIRENT             /**/
16446 #$i_sysdir I_SYS_DIR            /**/
16447 #$i_sysndir I_SYS_NDIR          /**/
16448 #$i_systypes I_SYS_TYPES        /**/
16449
16450 #if defined(I_SYS_TYPES)
16451 #include <sys/types.h>
16452 #endif
16453 #if defined(I_DIRENT)
16454 #include <dirent.h>
16455 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
16456 #include <sys/dir.h>
16457 #endif
16458 #else
16459 #ifdef I_SYS_NDIR
16460 #include <sys/ndir.h>
16461 #else
16462 #ifdef I_SYS_DIR
16463 #ifdef hp9000s500
16464 #include <ndir.h>       /* may be wrong in the future */
16465 #else
16466 #include <sys/dir.h>
16467 #endif
16468 #endif
16469 #endif
16470 #endif 
16471 int main() { return closedir(opendir(".")); }
16472 EOM
16473         set try
16474         if eval $compile_ok; then
16475                 if $run ./try > /dev/null 2>&1 ; then
16476                         echo "Yes, it does."
16477                         val="$undef"
16478                 else
16479                         echo "No, it doesn't."
16480                         val="$define"
16481                 fi
16482         else
16483                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16484                 val="$define"
16485         fi
16486         ;;
16487 *)
16488         val="$undef";
16489         ;;
16490 esac
16491 set d_void_closedir
16492 eval $setvar
16493 $rm -f try try.*
16494 : see if there is a wait4
16495 set wait4 d_wait4
16496 eval $inlibc
16497
16498 : see if waitpid exists
16499 set waitpid d_waitpid
16500 eval $inlibc
16501
16502 : see if wcstombs exists
16503 set wcstombs d_wcstombs
16504 eval $inlibc
16505
16506 : see if wctomb exists
16507 set wctomb d_wctomb
16508 eval $inlibc
16509
16510 : see if writev exists
16511 set writev d_writev
16512 eval $inlibc
16513
16514 : preserve RCS keywords in files with variable substitution, grrr
16515 Date='$Date'
16516 Id='$Id'
16517 Log='$Log'
16518 RCSfile='$RCSfile'
16519 Revision='$Revision'
16520
16521 : check for alignment requirements
16522 echo " "
16523 case "$usecrosscompile$multiarch" in
16524 *$define*)
16525         $cat <<EOM
16526 You seem to be either cross-compiling or doing a multiarchitecture build,
16527 skipping the memory alignment check.
16528
16529 EOM
16530         case "$alignbytes" in
16531         '') alignbytes=8 ;;
16532         esac
16533         ;;
16534 *)
16535         case "$alignbytes" in
16536         '') echo "Checking alignment constraints..." >&4
16537                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
16538                         $cat >try.c <<'EOCP'
16539 typedef long double NV;
16540 EOCP
16541                 else
16542                         $cat >try.c <<'EOCP'
16543 typedef double NV;
16544 EOCP
16545                 fi
16546                 $cat >>try.c <<'EOCP'
16547 #include <stdio.h>
16548 struct foobar {
16549         char foo;
16550         NV bar;
16551 } try_algn;
16552 int main()
16553 {
16554     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
16555     return(0);
16556 }
16557 EOCP
16558                 set try
16559                 if eval $compile_ok; then
16560                         dflt=`$run ./try`
16561                 else
16562                         dflt='8'
16563                         echo "(I can't seem to compile the test program...)"
16564                 fi
16565                 ;;
16566         *) dflt="$alignbytes"
16567                 ;;
16568         esac
16569         rp="Doubles must be aligned on a how-many-byte boundary?"
16570         . ./myread
16571         alignbytes="$ans"
16572         $rm -f try.c try
16573         ;;
16574 esac
16575
16576
16577 : set the base revision
16578 baserev=5.0
16579
16580 : how do we catenate cpp tokens here?
16581 echo " "
16582 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
16583 $cat >cpp_stuff.c <<'EOCP'
16584 #define RCAT(a,b)a/**/b
16585 #define ACAT(a,b)a ## b
16586 RCAT(Rei,ser)
16587 ACAT(Cir,cus)
16588 EOCP
16589 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
16590 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
16591         echo "Oh!  Smells like ANSI's been here." >&4
16592         echo "We can catify or stringify, separately or together!"
16593         cpp_stuff=42
16594 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
16595         echo "Ah, yes!  The good old days!" >&4
16596         echo "However, in the good old days we don't know how to stringify and"
16597         echo "catify at the same time."
16598         cpp_stuff=1
16599 else
16600         $cat >&4 <<EOM
16601 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
16602 to have to edit the values of CAT[2-5] in config.h...
16603 EOM
16604         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
16605 fi
16606 $rm -f cpp_stuff.*
16607
16608 : see if this is a db.h system
16609 set db.h i_db
16610 eval $inhdr
16611
16612 case "$i_db" in
16613 $define)
16614         : Check db version.
16615         echo " "
16616         echo "Checking Berkeley DB version ..." >&4
16617         $cat >try.c <<EOCP
16618 #$d_const HASCONST
16619 #ifndef HASCONST
16620 #define const
16621 #endif
16622 #include <sys/types.h>
16623 #include <stdio.h>
16624 #include <db.h>
16625 int main(int argc, char *argv[])
16626 {
16627 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
16628     int Major, Minor, Patch ;
16629     unsigned long Version ;
16630     (void)db_version(&Major, &Minor, &Patch) ;
16631     if (argc == 2) {
16632         printf("%d %d %d %d %d %d\n",
16633                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
16634                Major, Minor, Patch);
16635         exit(0);
16636     }
16637     printf("You have Berkeley DB Version 2 or greater.\n");
16638
16639     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
16640                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
16641     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
16642                 Major, Minor, Patch) ;
16643
16644     /* check that db.h & libdb are compatible */
16645     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
16646         printf("db.h and libdb are incompatible.\n") ;
16647         exit(3);        
16648     }
16649
16650     printf("db.h and libdb are compatible.\n") ;
16651
16652     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
16653                 + DB_VERSION_PATCH ;
16654
16655     /* needs to be >= 2.3.4 */
16656     if (Version < 2003004) {
16657     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
16658         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
16659         exit(2);        
16660     }
16661
16662     exit(0);
16663 #else
16664 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
16665     if (argc == 2) {
16666         printf("1 0 0\n");
16667         exit(0);
16668     }
16669     printf("You have Berkeley DB Version 1.\n");
16670     exit(0);    /* DB version < 2: the coast is clear. */
16671 #else
16672     exit(1);    /* <db.h> not Berkeley DB? */
16673 #endif
16674 #endif
16675 }
16676 EOCP
16677         set try
16678         if eval $compile_ok && $run ./try; then
16679                 echo 'Looks OK.' >&4
16680                 set `$run ./try 1`
16681                 db_version_major=$1
16682                 db_version_minor=$2
16683                 db_version_patch=$3
16684         else
16685                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
16686                 i_db=$undef
16687                 case " $libs " in
16688                 *"-ldb "*)
16689                         : Remove db from list of libraries to use
16690                         echo "Removing unusable -ldb from library list" >&4
16691                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
16692                         shift
16693                         libs="$*"
16694                         echo "libs = $libs" >&4
16695                         ;;
16696                 esac
16697         fi
16698         $rm -f try.*
16699         ;;
16700 esac
16701
16702 case "$i_db" in
16703 define)
16704         : Check the return type needed for hash 
16705         echo " "
16706         echo "Checking return type needed for hash for Berkeley DB ..." >&4
16707         $cat >try.c <<EOCP
16708 #$d_const HASCONST
16709 #ifndef HASCONST
16710 #define const
16711 #endif
16712 #include <sys/types.h>
16713 #include <db.h>
16714
16715 #ifndef DB_VERSION_MAJOR
16716 u_int32_t hash_cb (ptr, size)
16717 const void *ptr;
16718 size_t size;
16719 {
16720 }
16721 HASHINFO info;
16722 int main()
16723 {
16724         info.hash = hash_cb;
16725 }
16726 #endif
16727 EOCP
16728         if $cc $ccflags -c try.c >try.out 2>&1 ; then
16729                 if $contains warning try.out >>/dev/null 2>&1 ; then
16730                         db_hashtype='int'
16731                 else
16732                         db_hashtype='u_int32_t'
16733                 fi
16734         else
16735                 : XXX Maybe we should just give up here.
16736                 db_hashtype=u_int32_t
16737                 $cat try.out >&4
16738                 echo "Help:  I can't seem to compile the db test program." >&4
16739                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
16740         fi
16741         $rm -f try.*
16742         echo "Your version of Berkeley DB uses $db_hashtype for hash."
16743         ;;
16744 *)      db_hashtype=u_int32_t
16745         ;;
16746 esac
16747 case "$i_db" in
16748 define)
16749         : Check the return type needed for prefix 
16750         echo " "
16751         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
16752         cat >try.c <<EOCP
16753 #$d_const HASCONST
16754 #ifndef HASCONST
16755 #define const
16756 #endif
16757 #include <sys/types.h>
16758 #include <db.h>
16759
16760 #ifndef DB_VERSION_MAJOR
16761 size_t prefix_cb (key1, key2)
16762 const DBT *key1;
16763 const DBT *key2;
16764 {
16765 }
16766 BTREEINFO info;
16767 int main()
16768 {
16769         info.prefix = prefix_cb;
16770 }
16771 #endif
16772 EOCP
16773         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
16774                 if $contains warning try.out >>/dev/null 2>&1 ; then
16775                         db_prefixtype='int'
16776                 else
16777                         db_prefixtype='size_t'
16778                 fi
16779         else
16780                 db_prefixtype='size_t'
16781                 : XXX Maybe we should just give up here.
16782                 $cat try.out >&4
16783                 echo "Help:  I can't seem to compile the db test program." >&4
16784                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
16785         fi
16786         $rm -f try.*
16787         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
16788         ;;
16789 *)      db_prefixtype='size_t'
16790         ;;
16791 esac
16792
16793
16794 : How can we generate normalized random numbers ?
16795 echo " "
16796 echo "Looking for a random number function..." >&4
16797 case "$randfunc" in
16798 '')
16799         if set drand48 val -f; eval $csym; $val; then
16800                 dflt="drand48"
16801                 echo "Good, found drand48()." >&4
16802         elif set random val -f; eval $csym; $val; then
16803                 dflt="random"
16804                 echo "OK, found random()." >&4
16805         else
16806                 dflt="rand"
16807                 echo "Yick, looks like I have to use rand()." >&4
16808         fi
16809         echo " "
16810         ;;
16811 *)
16812         dflt="$randfunc"
16813         ;;
16814 esac
16815 cont=true
16816
16817 case "$ccflags" in
16818 *-Dmy_rand=*|*-Dmy_srand=*)
16819         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
16820         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
16821         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
16822         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
16823         ;;
16824 esac
16825
16826 while $test "$cont"; do
16827         rp="Use which function to generate random numbers?"
16828         . ./myread
16829         if $test "$ans" = "$dflt"; then
16830                 : null
16831         else
16832                 randbits=''
16833         fi
16834         randfunc="$ans"
16835         if set $ans val -f; eval $csym; $val; then
16836                 cont=''
16837         else
16838                 dflt=y
16839                 rp="I cannot find function $ans. Use that name anyway?"
16840                 . ./myread
16841                 dflt=rand
16842                 case "$ans" in
16843                         [yY]*) cont='';;
16844                 esac
16845         fi
16846         case "$cont" in
16847         '')
16848                 case "$randfunc" in
16849                 drand48)
16850                         drand01="drand48()"
16851                         seedfunc="srand48"
16852                         randbits=48
16853                         randseedtype=long
16854                         ;;
16855                 rand|random)
16856                         case "$randbits" in
16857                         '')
16858 echo "Checking to see how many bits your $randfunc() function produces..." >&4
16859                                 $cat >try.c <<EOCP
16860 #$i_unistd I_UNISTD
16861 #$i_stdlib I_STDLIB
16862 #include <stdio.h>
16863 #ifdef I_UNISTD
16864 #  include <unistd.h>
16865 #endif
16866 #ifdef I_STDLIB
16867 #  include <stdlib.h>
16868 #endif
16869 int main()
16870 {
16871         register int i;
16872         register unsigned long tmp;
16873         register unsigned long max = 0L;
16874
16875         for (i = 1000; i; i--) {
16876                 tmp = (unsigned long) $randfunc();
16877                 if (tmp > max) max = tmp;
16878         }
16879         for (i = 0; max; i++)
16880                 max /= 2;
16881         printf("%d\n",i);
16882 }
16883 EOCP
16884                                 set try
16885                                 if eval $compile_ok; then
16886                                         dflt=`try`
16887                                 else
16888                                         dflt='?'
16889                                         echo "(I can't seem to compile the test program...)"
16890                                 fi
16891                                 ;;
16892                         *)
16893                                 dflt="$randbits"
16894                                 ;;
16895                         esac
16896                         rp="How many bits does your $randfunc() function produce?"
16897                         . ./myread
16898                         randbits="$ans"
16899                         $rm -f try.c try
16900                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
16901                         seedfunc="s$randfunc"
16902                         randseedtype=unsigned
16903                         ;;
16904                 *)
16905                         dflt="31"
16906                         rp="How many bits does your $randfunc() function produce?"
16907                         . ./myread
16908                         randbits="$ans"
16909                         seedfunc="s$randfunc"
16910                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
16911                         if set $seedfunc val -f; eval $csym; $val; then
16912                                 echo "(Using $seedfunc() to seed random generator)"
16913                         else
16914                                 echo "(Warning: no $seedfunc() to seed random generator)"
16915                                 seedfunc=rand
16916                         fi
16917                         randseedtype=unsigned
16918                         ;;
16919                 esac
16920                 ;;
16921         esac
16922 done
16923
16924 echo " "
16925 echo "Determining whether or not we are on an EBCDIC system..." >&4
16926 $cat >try.c <<'EOM'
16927 int main()
16928 {
16929   if ('M'==0xd4) return 0;
16930   return 1;
16931 }
16932 EOM
16933
16934 val=$undef
16935 set try
16936 if eval $compile_ok; then
16937         if $run ./try; then
16938                 echo "You seem to speak EBCDIC." >&4
16939                 val="$define"
16940         else
16941                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
16942         fi
16943 else
16944         echo "I'm unable to compile the test program." >&4
16945         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
16946 fi
16947 $rm -f try try.*
16948 set ebcdic
16949 eval $setvar
16950
16951 echo " "
16952 $cat >&4 <<EOM
16953 Checking how to flush all pending stdio output...
16954 EOM
16955 # I only know how to find the first 32 possibly open files on SunOS.
16956 # See also hints/sunos_4_1.sh and util.c  --AD
16957 case "$osname" in
16958 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
16959 esac
16960 $cat >>try.c <<EOCP
16961 #include <stdio.h>
16962 #$i_unistd I_UNISTD
16963 #ifdef I_UNISTD
16964 # include <unistd.h>
16965 #endif
16966 #$d_sysconf HAS_SYSCONF
16967 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
16968 #ifdef HAS_STDIO_STREAM_ARRAY
16969 # define STDIO_STREAM_ARRAY $stdio_stream_array
16970 #endif
16971 int main() {
16972   FILE* p;
16973   unlink("try.out");
16974   p = fopen("try.out", "w");
16975 #ifdef TRY_FPUTC
16976   fputc('x', p);
16977 #else
16978 # ifdef TRY_FPRINTF
16979   fprintf(p, "x");
16980 # endif
16981 #endif
16982 #ifdef TRY_FFLUSH_NULL
16983   fflush(NULL);
16984 #endif
16985 #ifdef TRY_FFLUSH_ALL
16986   {
16987     long open_max = -1;
16988 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
16989     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
16990 # else
16991 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
16992     open_max = sysconf(_SC_OPEN_MAX);
16993 #  else
16994 #   ifdef FOPEN_MAX
16995     open_max = FOPEN_MAX;
16996 #   else
16997 #    ifdef OPEN_MAX
16998     open_max = OPEN_MAX;
16999 #    else
17000 #     ifdef _NFILE
17001     open_max = _NFILE;
17002 #     endif
17003 #    endif
17004 #   endif
17005 #  endif
17006 # endif 
17007 # ifdef HAS_STDIO_STREAM_ARRAY
17008     if (open_max > 0) {
17009       long i;
17010       for (i = 0; i < open_max; i++)
17011             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
17012                 STDIO_STREAM_ARRAY[i]._file < open_max &&
17013                 STDIO_STREAM_ARRAY[i]._flag)
17014                 fflush(&STDIO_STREAM_ARRAY[i]);
17015     }   
17016   }
17017 # endif
17018 #endif
17019   _exit(42);
17020 }
17021 EOCP
17022 : first we have to find out how _not_ to flush
17023 $to try.c
17024 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
17025     output=''
17026     set try -DTRY_FPUTC
17027     if eval $compile; then
17028             $run ./try 2>/dev/null
17029             code="$?"
17030             $from try.out
17031             if $test ! -s try.out -a "X$code" = X42; then
17032                 output=-DTRY_FPUTC
17033             fi
17034     fi
17035     case "$output" in
17036     '')
17037             set try -DTRY_FPRINTF
17038             if eval $compile; then
17039                     $run ./try 2>/dev/null
17040                     code="$?"
17041                     $from try.out
17042                     if $test ! -s try.out -a "X$code" = X42; then
17043                         output=-DTRY_FPRINTF
17044                     fi
17045             fi
17046         ;;
17047     esac
17048 fi
17049 : check for fflush NULL behaviour
17050 case "$fflushNULL" in
17051 '')     set try -DTRY_FFLUSH_NULL $output
17052         if eval $compile; then
17053                 $run ./try 2>/dev/null
17054                 code="$?"
17055                 $from try.out
17056                 if $test -s try.out -a "X$code" = X42; then
17057                         fflushNULL="`$cat try.out`"
17058                 else
17059                         if $test "X$code" != X42; then
17060                                 $cat >&4 <<EOM
17061 (If this test failed, don't worry, we'll try another method shortly.)
17062 EOM
17063                         fi
17064                 fi
17065         fi
17066         $rm -f core try.core core.try.*
17067         case "$fflushNULL" in
17068         x)      $cat >&4 <<EOM
17069 Your fflush(NULL) works okay for output streams.
17070 Let's see if it clobbers input pipes...
17071 EOM
17072 # As of mid-March 2000 all versions of Solaris appear to have a stdio
17073 # bug that improperly flushes the input end of pipes.  So we avoid the
17074 # autoflush on fork/system/exec support for now. :-(
17075 $cat >tryp.c <<EOCP
17076 #include <stdio.h>
17077 int
17078 main(int argc, char **argv)
17079 {
17080     char buf[1024];
17081     int i;
17082     char *bp = buf;
17083     while (1) {
17084         while ((i = getc(stdin)) != -1
17085                && (*bp++ = i) != '\n'
17086                && bp < &buf[1024])
17087         /* DO NOTHING */ ;
17088         *bp = '\0';
17089         fprintf(stdout, "%s", buf);
17090         fflush(NULL);
17091         if (i == -1)
17092             return 0;
17093         bp = buf;
17094     }
17095 }
17096 EOCP
17097                 fflushNULL="$define"
17098                 set tryp
17099                 if eval $compile; then
17100                     $rm -f tryp.out
17101                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17102                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
17103                        $cat >&4 <<EOM
17104 fflush(NULL) seems to behave okay with input streams.
17105 EOM
17106                         fflushNULL="$define"
17107                     else
17108                         $cat >&4 <<EOM
17109 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
17110 EOM
17111                         fflushNULL="$undef"
17112                     fi
17113                 fi
17114                 $rm -f core tryp.c tryp.core core.tryp.*
17115                 ;;
17116         '')     $cat >&4 <<EOM
17117 Your fflush(NULL) isn't working (contrary to ANSI C).
17118 EOM
17119                 fflushNULL="$undef"
17120                 ;;
17121         *)      $cat >&4 <<EOM
17122 Cannot figure out whether your fflush(NULL) works or not.
17123 I'm assuming it doesn't (contrary to ANSI C).
17124 EOM
17125                 fflushNULL="$undef"
17126                 ;;
17127         esac
17128         ;;
17129 $define|true|[yY]*)
17130         fflushNULL="$define"
17131         ;;
17132 *)
17133         fflushNULL="$undef"
17134         ;;
17135 esac
17136 : check explicit looping only if NULL did not work, and if the pipe
17137 : bug does not show up on an explicit flush too
17138 case "$fflushNULL" in
17139 "$undef")
17140         $cat >tryp.c <<EOCP
17141 #include <stdio.h>
17142 int
17143 main(int argc, char **argv)
17144 {
17145     char buf[1024];
17146     int i;
17147     char *bp = buf;
17148     while (1) {
17149         while ((i = getc(stdin)) != -1
17150                && (*bp++ = i) != '\n'
17151                && bp < &buf[1024])
17152         /* DO NOTHING */ ;
17153         *bp = '\0';
17154         fprintf(stdout, "%s", buf);
17155         fflush(stdin);
17156         if (i == -1)
17157             return 0;
17158         bp = buf;
17159     }
17160 }
17161 EOCP
17162         set tryp
17163         if eval $compile; then
17164             $rm -f tryp.out
17165             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17166             if cmp tryp.c tryp.out >/dev/null 2>&1; then
17167                $cat >&4 <<EOM
17168 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
17169 EOM
17170                 : now check for fflushall behaviour
17171                 case "$fflushall" in
17172                 '')     set try -DTRY_FFLUSH_ALL $output
17173                         if eval $compile; then
17174                                 $cat >&4 <<EOM
17175 (Now testing the other method--but note that this also may fail.)
17176 EOM
17177                                 $run ./try 2>/dev/null
17178                                 code=$?
17179                                 $from try.out
17180                                 if $test -s try.out -a "X$code" = X42; then
17181                                         fflushall="`$cat try.out`"
17182                                 fi
17183                         fi
17184                         $rm -f core try.core core.try.*
17185                         case "$fflushall" in
17186                         x)      $cat >&4 <<EOM
17187 Whew. Flushing explicitly all the stdio streams works.
17188 EOM
17189                                 fflushall="$define"
17190                                 ;;
17191                         '')     $cat >&4 <<EOM
17192 Sigh. Flushing explicitly all the stdio streams doesn't work.
17193 EOM
17194                                 fflushall="$undef"
17195                                 ;;
17196                         *)      $cat >&4 <<EOM
17197 Cannot figure out whether flushing stdio streams explicitly works or not.
17198 I'm assuming it doesn't.
17199 EOM
17200                                 fflushall="$undef"
17201                                 ;;
17202                         esac
17203                         ;;
17204                 "$define"|true|[yY]*)
17205                         fflushall="$define"
17206                         ;;
17207                 *)
17208                         fflushall="$undef"
17209                         ;;
17210                 esac
17211             else
17212                 $cat >&4 <<EOM
17213 All is futile.  Even fflush(stdin) clobbers input pipes!
17214 EOM
17215                 fflushall="$undef"
17216             fi
17217         else
17218             fflushall="$undef"
17219         fi
17220         $rm -f core tryp.c tryp.core core.tryp.*
17221         ;;
17222 *)      fflushall="$undef"
17223         ;;
17224 esac
17225
17226 case "$fflushNULL$fflushall" in
17227 undefundef)
17228         $cat <<EOM
17229 OK, I give up.  I cannot figure out how to flush pending stdio output.
17230 We won't be flushing handles at all before fork/exec/popen.
17231 EOM
17232         ;;
17233 esac
17234 $rm -f try.* try$exe_ext
17235
17236 : Store the full pathname to the ar program for use in the C program
17237 : Respect a hint or command line value for full_ar.
17238 case "$full_ar" in
17239 '') full_ar=$ar ;;
17240 esac
17241
17242 : Store the full pathname to the sed program for use in the C program
17243 full_sed=$sed
17244
17245 : see what type gids are declared as in the kernel
17246 echo " "
17247 echo "Looking for the type for group ids returned by getgid()."
17248 set gid_t gidtype xxx stdio.h sys/types.h
17249 eval $typedef
17250 case "$gidtype" in
17251 xxx)
17252         xxx=`./findhdr sys/user.h`
17253         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
17254         case $1 in
17255         unsigned) dflt="$1 $2" ;;
17256         *) dflt="$1" ;;
17257         esac
17258         ;;
17259 *) dflt="$gidtype";;
17260 esac
17261 case "$gidtype" in
17262 gid_t) echo "gid_t found." ;;
17263 *)      rp="What is the type for group ids returned by getgid()?"
17264         . ./myread
17265         gidtype="$ans"
17266         ;;
17267 esac
17268
17269 echo " "
17270 case "$gidtype" in
17271 *_t) zzz="$gidtype"     ;;
17272 *)   zzz="gid"          ;;
17273 esac
17274 echo "Checking the size of $zzz..." >&4 
17275 cat > try.c <<EOCP
17276 #include <sys/types.h>
17277 #include <stdio.h>
17278 int main() {
17279     printf("%d\n", (int)sizeof($gidtype));
17280     exit(0);
17281 }
17282 EOCP
17283 set try
17284 if eval $compile_ok; then
17285         yyy=`$run ./try`
17286         case "$yyy" in
17287         '')     gidsize=4
17288                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
17289                 ;;
17290         *)      gidsize=$yyy
17291                 echo "Your $zzz is $gidsize bytes long."
17292                 ;;
17293         esac
17294 else
17295         gidsize=4
17296         echo "(I can't compile the test program--guessing $gidsize.)" >&4
17297 fi
17298
17299
17300 echo " "
17301 case "$gidtype" in
17302 *_t) zzz="$gidtype"     ;;
17303 *)   zzz="gid"          ;;
17304 esac
17305 echo "Checking the sign of $zzz..." >&4 
17306 cat > try.c <<EOCP
17307 #include <sys/types.h>
17308 #include <stdio.h>
17309 int main() {
17310         $gidtype foo = -1;
17311         if (foo < 0)
17312                 printf("-1\n");
17313         else
17314                 printf("1\n");
17315 }
17316 EOCP
17317 set try
17318 if eval $compile; then
17319         yyy=`$run ./try`
17320         case "$yyy" in
17321         '')     gidsign=1
17322                 echo "(I can't execute the test program--guessing unsigned.)" >&4
17323                 ;;
17324         *)      gidsign=$yyy
17325                 case "$gidsign" in
17326                  1) echo "Your $zzz is unsigned." ;;
17327                 -1) echo "Your $zzz is signed."   ;;
17328                 esac
17329                 ;;
17330         esac
17331 else
17332         gidsign=1
17333         echo "(I can't compile the test program--guessing unsigned.)" >&4
17334 fi
17335
17336
17337 echo " "
17338
17339 if $test X"$quadtype" != X; then
17340
17341 echo "Checking how to print 64-bit integers..." >&4
17342
17343 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
17344         $cat >try.c <<'EOCP'
17345 #include <sys/types.h>
17346 #include <stdio.h>
17347 int main() {
17348   int q = 12345678901;
17349   printf("%ld\n", q);
17350 }
17351 EOCP
17352         set try
17353         if eval $compile; then
17354                 yyy=`$run ./try`
17355                 case "$yyy" in
17356                 12345678901)
17357                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
17358                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
17359                         echo "We will use %d."
17360                         ;;
17361                 esac
17362         fi
17363 fi
17364
17365 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
17366         $cat >try.c <<'EOCP'
17367 #include <sys/types.h>
17368 #include <stdio.h>
17369 int main() {
17370   long q = 12345678901;
17371   printf("%ld\n", q);
17372 }
17373 EOCP
17374         set try
17375         if eval $compile; then
17376                 yyy=`$run ./try`
17377                 case "$yyy" in
17378                 12345678901)
17379                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
17380                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
17381                         echo "We will use %ld."
17382                         ;;
17383                 esac
17384         fi
17385 fi
17386
17387 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
17388         $cat >try.c <<'EOCP'
17389 #include <sys/types.h>
17390 #include <inttypes.h>
17391 #include <stdio.h>
17392 int main() {
17393   int64_t q = 12345678901;
17394   printf("%" PRId64 "\n", q);
17395 }
17396 EOCP
17397         set try
17398         if eval $compile; then
17399                 yyy=`$run ./try`
17400                 case "$yyy" in
17401                 12345678901)
17402                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
17403                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
17404                         echo "We will use the C9X style."
17405                         ;;
17406                 esac
17407         fi
17408 fi
17409
17410 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17411         $cat >try.c <<EOCP
17412 #include <sys/types.h>
17413 #include <stdio.h>
17414 int main() {
17415   $quadtype q = 12345678901;
17416   printf("%Ld\n", q);
17417 }
17418 EOCP
17419         set try
17420         if eval $compile; then
17421                 yyy=`$run ./try`
17422                 case "$yyy" in
17423                 12345678901)
17424                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
17425                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
17426                         echo "We will use %Ld."
17427                         ;;
17428                 esac
17429         fi
17430 fi
17431
17432 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
17433         $cat >try.c <<'EOCP'
17434 #include <sys/types.h>
17435 #include <stdio.h>
17436 int main() {
17437   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
17438   printf("%lld\n", q);
17439 }
17440 EOCP
17441         set try
17442         if eval $compile; then
17443                 yyy=`$run ./try`
17444                 case "$yyy" in
17445                 12345678901)
17446                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
17447                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
17448                         echo "We will use the %lld style."
17449                         ;;
17450                 esac
17451         fi
17452 fi
17453
17454 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17455         $cat >try.c <<EOCP
17456 #include <sys/types.h>
17457 #include <stdio.h>
17458 int main() {
17459   $quadtype q = 12345678901;
17460   printf("%qd\n", q);
17461 }
17462 EOCP
17463         set try
17464         if eval $compile; then
17465                 yyy=`$run ./try`
17466                 case "$yyy" in
17467                 12345678901)
17468                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
17469                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
17470                         echo "We will use %qd."
17471                         ;;
17472                 esac
17473         fi
17474 fi
17475
17476 if $test X"$sPRId64" = X; then
17477         echo "Cannot figure out how to print 64-bit integers." >&4
17478 fi
17479
17480 $rm -f try try.*
17481
17482 fi
17483
17484 case "$sPRId64" in
17485 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
17486         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
17487         ;;
17488 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
17489         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
17490         ;;
17491 esac
17492
17493
17494 echo " "
17495 $echo "Checking the format strings to be used for Perl's internal types..." >&4
17496
17497 if $test X"$ivsize" = X8; then
17498         ivdformat="$sPRId64"
17499         uvuformat="$sPRIu64"
17500         uvoformat="$sPRIo64"
17501         uvxformat="$sPRIx64"
17502         uvXUformat="$sPRIXU64"
17503 else
17504         if $test X"$ivsize" = X"$longsize"; then
17505                 ivdformat='"ld"'
17506                 uvuformat='"lu"'
17507                 uvoformat='"lo"'
17508                 uvxformat='"lx"'
17509                 uvXUformat='"lX"'
17510         else
17511                 if $test X"$ivsize" = X"$intsize"; then
17512                         ivdformat='"d"'
17513                         uvuformat='"u"'
17514                         uvoformat='"o"'
17515                         uvxformat='"x"'
17516                         uvXUformat='"X"'
17517                 else
17518                         : far out
17519                         if $test X"$ivsize" = X"$shortsize"; then
17520                                 ivdformat='"hd"'
17521                                 uvuformat='"hu"'
17522                                 uvoformat='"ho"'
17523                                 uvxformat='"hx"'
17524                                 uvXUformat='"hX"'
17525                         fi
17526                 fi
17527         fi
17528 fi
17529
17530 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
17531         nveformat="$sPRIeldbl"
17532         nvfformat="$sPRIfldbl"
17533         nvgformat="$sPRIgldbl"
17534         nvEUformat="$sPRIEUldbl"
17535         nvFUformat="$sPRIFUldbl"
17536         nvGUformat="$sPRIGUldbl"
17537 else
17538         nveformat='"e"'
17539         nvfformat='"f"'
17540         nvgformat='"g"'
17541         nvEUformat='"E"'
17542         nvFUformat='"F"'
17543         nvGUformat='"G"'
17544 fi
17545
17546 case "$ivdformat" in
17547 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
17548     exit 1
17549     ;;
17550 esac
17551
17552
17553 echo " "
17554 $echo "Checking the format string to be used for gids..." >&4
17555
17556 case "$gidsign" in
17557 -1)     if $test X"$gidsize" = X"$ivsize"; then
17558                 gidformat="$ivdformat"
17559         else
17560                 if $test X"$gidsize" = X"$longsize"; then
17561                         gidformat='"ld"'
17562                 else
17563                         if $test X"$gidsize" = X"$intsize"; then
17564                                 gidformat='"d"'
17565                         else
17566                                 if $test X"$gidsize" = X"$shortsize"; then
17567                                         gidformat='"hd"'
17568                                 fi
17569                         fi
17570                 fi
17571         fi
17572         ;;
17573 *)      if $test X"$gidsize" = X"$uvsize"; then
17574                 gidformat="$uvuformat"
17575         else
17576                 if $test X"$gidsize" = X"$longsize"; then
17577                         gidformat='"lu"'
17578                 else
17579                         if $test X"$gidsize" = X"$intsize"; then
17580                                 gidformat='"u"'
17581                         else
17582                                 if $test X"$gidsize" = X"$shortsize"; then
17583                                         gidformat='"hu"'
17584                                 fi
17585                         fi
17586                 fi
17587         fi
17588         ;;
17589 esac
17590
17591 : see if getgroups exists
17592 set getgroups d_getgrps
17593 eval $inlibc
17594
17595 : see if setgroups exists
17596 set setgroups d_setgrps
17597 eval $inlibc
17598
17599
17600 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
17601 echo " "
17602 case "$d_getgrps$d_setgrps" in
17603 *define*)
17604         case "$groupstype" in
17605         '') dflt="$gidtype" ;;
17606         *)  dflt="$groupstype" ;;
17607         esac
17608         $cat <<EOM
17609 What type of pointer is the second argument to getgroups() and setgroups()?
17610 Usually this is the same as group ids, $gidtype, but not always.
17611
17612 EOM
17613         rp='What type pointer is the second argument to getgroups() and setgroups()?'
17614         . ./myread
17615         groupstype="$ans"
17616         ;;
17617 *)  groupstype="$gidtype";;
17618 esac
17619
17620 echo " "
17621 echo "Checking if your $make program sets \$(MAKE)..." >&4
17622 case "$make_set_make" in
17623 '')
17624         $sed 's/^X //' > testmake.mak << 'EOF'
17625 Xall:
17626 X       @echo 'maketemp="$(MAKE)"'
17627 EOF
17628         case "`$make -f testmake.mak 2>/dev/null`" in
17629         *maketemp=*) make_set_make='#' ;;
17630         *)      make_set_make="MAKE=$make" ;;
17631         esac
17632         $rm -f testmake.mak
17633         ;;
17634 esac
17635 case "$make_set_make" in
17636 '#') echo "Yup, it does.";;
17637 *) echo "Nope, it doesn't.";;
17638 esac
17639
17640 : see what type is used for mode_t
17641 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
17642 set mode_t modetype int stdio.h sys/types.h
17643 eval $typedef_ask
17644
17645 : see if stdarg is available
17646 echo " "
17647 if $test `./findhdr stdarg.h`; then
17648         echo "<stdarg.h> found." >&4
17649         valstd="$define"
17650 else
17651         echo "<stdarg.h> NOT found." >&4
17652         valstd="$undef"
17653 fi
17654
17655 : see if varags is available
17656 echo " "
17657 if $test `./findhdr varargs.h`; then
17658         echo "<varargs.h> found." >&4
17659 else
17660         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
17661 fi
17662
17663 : set up the varargs testing programs
17664 $cat > varargs.c <<EOP
17665 #ifdef I_STDARG
17666 #include <stdarg.h>
17667 #endif
17668 #ifdef I_VARARGS
17669 #include <varargs.h>
17670 #endif
17671
17672 #ifdef I_STDARG
17673 int f(char *p, ...)
17674 #else
17675 int f(va_alist)
17676 va_dcl
17677 #endif
17678 {
17679         va_list ap;
17680 #ifndef I_STDARG
17681         char *p;
17682 #endif
17683 #ifdef I_STDARG
17684         va_start(ap,p);
17685 #else
17686         va_start(ap);
17687         p = va_arg(ap, char *);
17688 #endif
17689         va_end(ap);
17690 }
17691 EOP
17692 $cat > varargs <<EOP
17693 $startsh
17694 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
17695         echo "true"
17696 else
17697         echo "false"
17698 fi
17699 $rm -f varargs$_o
17700 EOP
17701 chmod +x varargs
17702
17703 : now check which varargs header should be included
17704 echo " "
17705 i_varhdr=''
17706 case "$valstd" in
17707 "$define")
17708         if `./varargs I_STDARG`; then
17709                 val='stdarg.h'
17710         elif `./varargs I_VARARGS`; then
17711                 val='varargs.h'
17712         fi
17713         ;;
17714 *)
17715         if `./varargs I_VARARGS`; then
17716                 val='varargs.h'
17717         fi
17718         ;;
17719 esac
17720 case "$val" in
17721 '')
17722 echo "I could not find the definition for va_dcl... You have problems..." >&4
17723         val="$undef"; set i_stdarg; eval $setvar
17724         val="$undef"; set i_varargs; eval $setvar
17725         ;;
17726 *) 
17727         set i_varhdr
17728         eval $setvar
17729         case "$i_varhdr" in
17730         stdarg.h)
17731                 val="$define"; set i_stdarg; eval $setvar
17732                 val="$undef"; set i_varargs; eval $setvar
17733                 ;;
17734         varargs.h)
17735                 val="$undef"; set i_stdarg; eval $setvar
17736                 val="$define"; set i_varargs; eval $setvar
17737                 ;;
17738         esac
17739         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
17740 esac
17741 $rm -f varargs*
17742
17743 : see if we need va_copy
17744 echo " "
17745 case "$i_stdarg" in
17746 "$define")
17747         $cat >try.c <<EOCP
17748 #include <stdarg.h>
17749 #include <stdio.h>
17750 #$i_stdlib I_STDLIB
17751 #ifdef I_STDLIB
17752 #include <stdlib.h>
17753 #endif
17754 #include <signal.h>
17755
17756 int
17757 ivfprintf(FILE *f, const char *fmt, va_list *valp)
17758 {
17759   return vfprintf(f, fmt, *valp);
17760 }
17761  
17762 int    
17763 myvfprintf(FILE *f, const  char *fmt, va_list val)
17764 {
17765   return ivfprintf(f, fmt, &val);
17766 }
17767       
17768 int
17769 myprintf(char *fmt, ...) 
17770 {
17771   va_list val;
17772   va_start(val, fmt);
17773   return myvfprintf(stdout, fmt, val); 
17774 }         
17775
17776 int
17777 main(int ac, char **av)
17778 {
17779   signal(SIGSEGV, exit);
17780
17781   myprintf("%s%cs all right, then\n", "that", '\'');                            
17782   exit(0);      
17783 }
17784 EOCP
17785         set try
17786         if eval $compile && $run ./try 2>&1 >/dev/null; then
17787                 case "`$run ./try`" in
17788                 "that's all right, then")
17789                         okay=yes
17790                         ;;
17791                 esac
17792         fi
17793         case "$okay" in
17794         yes)    echo "It seems that you don't need va_copy()." >&4
17795                 need_va_copy="$undef"
17796                 ;;
17797         *)      echo "It seems that va_copy() or similar will be needed." >&4
17798                 need_va_copy="$define"
17799                 ;;
17800         esac
17801         $rm -f try.* core core.* *.core *.core.*
17802         ;;
17803 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
17804         ;;
17805 esac
17806
17807 : see what type is used for size_t
17808 rp="What is the type used for the length parameter for string functions?"
17809 set size_t sizetype 'unsigned int' stdio.h sys/types.h
17810 eval $typedef_ask
17811
17812 : check for type of arguments to gethostbyaddr. 
17813 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
17814         case "$d_gethbyaddr" in
17815         $define)
17816                 $cat <<EOM
17817
17818 Checking to see what type of arguments are accepted by gethostbyaddr().
17819 EOM
17820                 hdrs="$define sys/types.h
17821                         $d_socket sys/socket.h 
17822                         $i_niin netinet/in.h 
17823                         $i_netdb netdb.h
17824                         $i_unistd unistd.h"
17825                 : The first arg can 'char *' or 'void *'
17826                 : The second arg is some of integral type
17827                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
17828                         for yyy in size_t long int; do
17829                                 case "$netdb_host_type" in
17830                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
17831                                         if ./protochk "$try" $hdrs; then
17832                                                 echo "Your system accepts $xxx for the first arg."
17833                                                 echo "...and $yyy for the second arg."
17834                                                 netdb_host_type="$xxx"
17835                                                 netdb_hlen_type="$yyy"
17836                                         fi
17837                                         ;;
17838                                 esac
17839                         done
17840                 done
17841                 : In case none of those worked, prompt the user.
17842                 case "$netdb_host_type" in
17843                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
17844                         dflt='char *'
17845                         . ./myread
17846                         netdb_host_type=$ans
17847                         rp='What is the type for the 2nd argument to gethostbyaddr?'
17848                         dflt="$sizetype"
17849                         . ./myread
17850                         netdb_hlen_type=$ans
17851                         ;;
17852                 esac
17853                 ;;
17854         *)      : no gethostbyaddr, so pick harmless defaults
17855                 netdb_host_type='char *'
17856                 netdb_hlen_type="$sizetype"
17857                 ;;
17858         esac
17859         # Remove the "const" if needed. -- but then we'll have a 
17860         # prototype clash!
17861         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
17862 fi
17863
17864 : check for type of argument to gethostbyname. 
17865 if test "X$netdb_name_type" = X ; then
17866         case "$d_gethbyname" in
17867         $define)
17868                 $cat <<EOM
17869
17870 Checking to see what type of argument is accepted by gethostbyname().
17871 EOM
17872                 hdrs="$define sys/types.h
17873                         $d_socket sys/socket.h 
17874                         $i_niin netinet/in.h 
17875                         $i_netdb netdb.h
17876                         $i_unistd unistd.h"
17877                 for xxx in "const char *" "char *"; do
17878                         case "$netdb_name_type" in
17879                         '')     try="extern struct hostent *gethostbyname($xxx);"
17880                                 if ./protochk "$try" $hdrs; then
17881                                         echo "Your system accepts $xxx."
17882                                         netdb_name_type="$xxx"
17883                                 fi
17884                                 ;;
17885                         esac
17886                 done
17887                 : In case none of those worked, prompt the user.
17888                 case "$netdb_name_type" in
17889                 '')     rp='What is the type for the 1st argument to gethostbyname?'
17890                         dflt='char *'
17891                         . ./myread
17892                         netdb_name_type=$ans
17893                         ;;
17894                 esac
17895                 ;;
17896         *)      : no gethostbyname, so pick harmless default
17897                 netdb_name_type='char *'
17898                 ;;
17899         esac
17900 fi
17901
17902 : check for type of 1st argument to getnetbyaddr. 
17903 if test "X$netdb_net_type" = X ; then
17904         case "$d_getnbyaddr" in
17905         $define)
17906                 $cat <<EOM
17907
17908 Checking to see what type of 1st argument is accepted by getnetbyaddr().
17909 EOM
17910                 hdrs="$define sys/types.h
17911                         $d_socket sys/socket.h 
17912                         $i_niin netinet/in.h 
17913                         $i_netdb netdb.h
17914                         $i_unistd unistd.h"
17915                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
17916                         case "$netdb_net_type" in
17917                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
17918                                 if ./protochk "$try" $hdrs; then
17919                                         echo "Your system accepts $xxx."
17920                                         netdb_net_type="$xxx"
17921                                 fi
17922                                 ;;
17923                         esac
17924                 done
17925                 : In case none of those worked, prompt the user.
17926                 case "$netdb_net_type" in
17927                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
17928                         dflt='long'
17929                         . ./myread
17930                         netdb_net_type=$ans
17931                         ;;
17932                 esac
17933                 ;;
17934         *)      : no getnetbyaddr, so pick harmless default
17935                 netdb_net_type='long'
17936                 ;;
17937         esac
17938 fi
17939 : locate the preferred pager for this system
17940 fn=f/
17941 case "$pager" in
17942 '')
17943         dflt=''
17944         case "$pg" in
17945         /*) dflt=$pg;;
17946         [a-zA-Z]:/*) dflt=$pg;;
17947         esac
17948         case "$more" in
17949         /*) dflt=$more;;
17950         [a-zA-Z]:/*) dflt=$more;;
17951         esac
17952         case "$less" in
17953         /*) dflt=$less;;
17954         [a-zA-Z]:/*) dflt=$less;;
17955         esac
17956         case "$dflt" in
17957         '') dflt=/usr/ucb/more;;
17958         esac
17959         ;;
17960 *)      dflt="$pager"
17961         : Instruct ./getfile to trust the hinted or previous pager value,
17962         : even if it does not begin with a slash.  For example, on os2,
17963         : pager might be cmd /c more.  See comments in UU/getfile.
17964         fn="f/($pager)"
17965         ;;
17966 esac
17967 echo " "
17968 rp='What pager is used on your system?'
17969 . ./getfile
17970 pager="$ans"
17971
17972 : see what type pids are declared as in the kernel
17973 rp="What is the type of process ids on this system?"
17974 set pid_t pidtype int stdio.h sys/types.h
17975 eval $typedef_ask
17976
17977 : Find earliest binary compatible site_perl subdirectory perl can use.
17978 xs_apiversion=$version # The current site_perl version.
17979 : Find earliest pure perl site_perl subdirectory perl can use.
17980 : The versioned directories started at 5.005.
17981 pm_apiversion='5.005'
17982
17983 : see if ar generates random libraries by itself
17984 echo " "
17985 echo "Checking how to generate random libraries on your machine..." >&4
17986 echo 'int bar1() { return bar2(); }' > bar1.c
17987 echo 'int bar2() { return 2; }' > bar2.c
17988 $cat > foo.c <<'EOP'
17989 int main() { printf("%d\n", bar1()); exit(0); }
17990 EOP
17991 $cc $ccflags -c bar1.c >/dev/null 2>&1
17992 $cc $ccflags -c bar2.c >/dev/null 2>&1
17993 $cc $ccflags -c foo.c >/dev/null 2>&1
17994 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
17995 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
17996         $run ./foobar >/dev/null 2>&1; then
17997         echo "$ar appears to generate random libraries itself."
17998         orderlib=false
17999         ranlib=":"
18000 elif $ar ts bar$_a >/dev/null 2>&1 &&
18001         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
18002         $run ./foobar >/dev/null 2>&1; then
18003                 echo "a table of contents needs to be added with '$ar ts'."
18004                 orderlib=false
18005                 ranlib="$ar ts"
18006 else
18007         case "$ranlib" in
18008         :) ranlib='';;
18009         '')
18010                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
18011                 $test -f $ranlib || ranlib=''
18012                 ;;
18013         esac
18014         if $test -n "$ranlib"; then
18015                 echo "your system has '$ranlib'; we'll use that."
18016                 orderlib=false
18017         else
18018                 echo "your system doesn't seem to support random libraries"
18019                 echo "so we'll use lorder and tsort to order the libraries."
18020                 orderlib=true
18021                 ranlib=":"
18022         fi
18023 fi
18024 $rm -f foo* bar* 
18025
18026 : check for type of arguments to select. 
18027 case "$selecttype" in
18028 '') case "$d_select" in
18029         $define)
18030                 echo " "
18031                 $cat <<EOM
18032 Checking to see what type of arguments are accepted by select().
18033 EOM
18034                 hdrs="$define sys/types.h
18035                         $i_systime sys/time.h 
18036                         $i_sysselct sys/select.h
18037                         $d_socket sys/socket.h"
18038                 : The first arg can be int, unsigned, or size_t
18039                 : The last arg may or may not be 'const'
18040                 val=''
18041                 : void pointer has been seen but using that
18042                 : breaks the selectminbits test
18043                 for xxx in 'fd_set *' 'int *'; do
18044                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
18045                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
18046                                         case "$val" in
18047                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
18048                                                 if ./protochk "$try" $hdrs; then
18049                                                         echo "Your system accepts $xxx."
18050                                                         val="$xxx"
18051                                                 fi
18052                                                 ;;
18053                                         esac
18054                                 done
18055                         done
18056                 done
18057                 case "$val" in
18058                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
18059                         case "$d_fd_set" in
18060                                 $define) dflt="fd_set *" ;;
18061                                 *)              dflt="int *" ;;
18062                         esac
18063                         . ./myread
18064                         val=$ans
18065                         ;;
18066                 esac
18067                 selecttype="$val"
18068                 ;;
18069         *)      : no select, so pick a harmless default
18070                 selecttype='int *'
18071                 ;;
18072         esac
18073         ;;
18074 esac
18075
18076 : check for the select 'width'
18077 case "$selectminbits" in
18078 '') case "$d_select" in
18079         $define)
18080                 $cat <<EOM
18081
18082 Checking to see on how many bits at a time your select() operates...
18083 EOM
18084                 $cat >try.c <<EOCP
18085 #include <sys/types.h>
18086 #$i_time I_TIME
18087 #$i_systime I_SYS_TIME
18088 #$i_systimek I_SYS_TIME_KERNEL
18089 #ifdef I_TIME
18090 #   include <time.h>
18091 #endif
18092 #ifdef I_SYS_TIME
18093 #   ifdef I_SYS_TIME_KERNEL
18094 #       define KERNEL
18095 #   endif
18096 #   include <sys/time.h>
18097 #   ifdef I_SYS_TIME_KERNEL
18098 #       undef KERNEL
18099 #   endif
18100 #endif
18101 #$i_sysselct I_SYS_SELECT
18102 #ifdef I_SYS_SELECT
18103 #include <sys/select.h>
18104 #endif
18105 #$d_socket HAS_SOCKET
18106 #ifdef HAS_SOCKET
18107 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
18108 #endif
18109 #include <stdio.h>
18110 $selecttype b;
18111 #define S sizeof(*(b))
18112 #define MINBITS 64
18113 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
18114 #define NBITS  (NBYTES * 8)
18115 int main() {
18116     char s[NBYTES];
18117     struct timeval t;
18118     int i;
18119     FILE* fp;
18120     int fd;
18121
18122     fclose(stdin);
18123     fp = fopen("try.c", "r");
18124     if (fp == 0)
18125       exit(1);
18126     fd = fileno(fp);
18127     if (fd < 0)
18128       exit(2);
18129     b = ($selecttype)s;
18130     for (i = 0; i < NBITS; i++)
18131         FD_SET(i, b);
18132     t.tv_sec  = 0;
18133     t.tv_usec = 0;
18134     select(fd + 1, b, 0, 0, &t);
18135     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
18136     printf("%d\n", i + 1);
18137     return 0;
18138 }
18139 EOCP
18140                 set try
18141                 if eval $compile_ok; then
18142                         selectminbits=`$run ./try`
18143                         case "$selectminbits" in
18144                         '')     cat >&4 <<EOM
18145 Cannot figure out on how many bits at a time your select() operates.
18146 I'll play safe and guess it is 32 bits.
18147 EOM
18148                                 selectminbits=32
18149                                 bits="32 bits"
18150                                 ;;
18151                         1)      bits="1 bit" ;;
18152                         *)      bits="$selectminbits bits" ;;
18153                         esac
18154                         echo "Your select() operates on $bits at a time." >&4
18155                 else
18156                         rp='What is the minimum number of bits your select() operates on?'
18157                         case "$byteorder" in
18158                         1234|12345678)  dflt=32 ;;
18159                         *)              dflt=1  ;;
18160                         esac
18161                         . ./myread
18162                         val=$ans
18163                         selectminbits="$val"
18164                 fi
18165                 $rm -f try.* try
18166                 ;;
18167         *)      : no select, so pick a harmless default
18168                 selectminbits='32'
18169                 ;;
18170         esac
18171         ;;
18172 esac
18173
18174 : Trace out the files included by signal.h, then look for SIGxxx names.
18175 : Remove SIGARRAYSIZE used by HPUX.
18176 : Remove SIGSTKSIZE used by Linux.
18177 : Remove SIGSTKSZ used by Posix.
18178 : Remove SIGTYP void lines used by OS2.
18179 : Some cpps, like os390, dont give the file name anywhere
18180 if [ "X$fieldn" = X ]; then
18181         : Just make some guesses.  We check them later.
18182         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
18183 else
18184         xxx=`echo '#include <signal.h>' |
18185         $cppstdin $cppminus $cppflags 2>/dev/null |
18186         $grep '^[       ]*#.*include' | 
18187         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
18188 fi
18189 : Check this list of files to be sure we have parsed the cpp output ok.
18190 : This will also avoid potentially non-existent files, such 
18191 : as ../foo/bar.h
18192 xxxfiles=''
18193 for xx in $xxx /dev/null ; do
18194         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
18195 done
18196 : If we have found no files, at least try signal.h
18197 case "$xxxfiles" in
18198 '')     xxxfiles=`./findhdr signal.h` ;;
18199 esac
18200 xxx=`awk '
18201 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
18202         print substr($2, 4, 20)
18203 }
18204 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
18205         print substr($3, 4, 20)
18206 }' $xxxfiles`
18207 : Append some common names just in case the awk scan failed.
18208 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
18209 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
18210 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
18211 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
18212 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
18213
18214 : generate a few handy files for later
18215 $cat > signal.c <<'EOCP'
18216 #include <sys/types.h>
18217 #include <signal.h>
18218 #include <stdio.h>
18219 int main() {
18220
18221 /* Strange style to avoid deeply-nested #if/#else/#endif */
18222 #ifndef NSIG
18223 #  ifdef _NSIG
18224 #    define NSIG (_NSIG)
18225 #  endif
18226 #endif
18227
18228 #ifndef NSIG
18229 #  ifdef SIGMAX
18230 #    define NSIG (SIGMAX+1)
18231 #  endif
18232 #endif
18233
18234 #ifndef NSIG
18235 #  ifdef SIG_MAX
18236 #    define NSIG (SIG_MAX+1)
18237 #  endif
18238 #endif
18239
18240 #ifndef NSIG
18241 #  ifdef MAXSIG
18242 #    define NSIG (MAXSIG+1)
18243 #  endif
18244 #endif
18245
18246 #ifndef NSIG
18247 #  ifdef MAX_SIG
18248 #    define NSIG (MAX_SIG+1)
18249 #  endif
18250 #endif
18251
18252 #ifndef NSIG
18253 #  ifdef SIGARRAYSIZE
18254 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
18255 #  endif
18256 #endif
18257
18258 #ifndef NSIG
18259 #  ifdef _sys_nsig
18260 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
18261 #  endif
18262 #endif
18263
18264 /* Default to some arbitrary number that's big enough to get most
18265    of the common signals.
18266 */
18267 #ifndef NSIG
18268 #    define NSIG 50
18269 #endif
18270
18271 printf("NSIG %d\n", NSIG);
18272
18273 #ifndef JUST_NSIG
18274
18275 EOCP
18276
18277 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
18278 {
18279         printf "#ifdef SIG"; printf $1; printf "\n"
18280         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
18281         printf $1; printf ");\n"
18282         printf "#endif\n"
18283 }
18284 END {
18285         printf "#endif /* JUST_NSIG */\n";
18286         printf "exit(0);\n}\n";
18287 }
18288 ' >>signal.c
18289 $cat >signal.awk <<'EOP'
18290 BEGIN { ndups = 0 }
18291 $1 ~ /^NSIG$/ { nsig = $2 }
18292 ($1 !~ /^NSIG$/) && (NF == 2) {
18293     if ($2 > maxsig) { maxsig = $2 }
18294     if (sig_name[$2]) {
18295         dup_name[ndups] = $1
18296         dup_num[ndups] = $2
18297         ndups++ 
18298     }
18299     else {
18300         sig_name[$2] = $1
18301         sig_num[$2] = $2
18302     }
18303 }
18304 END { 
18305     if (nsig == 0) {
18306         nsig = maxsig + 1
18307     }
18308     printf("NSIG %d\n", nsig);
18309     for (n = 1; n < nsig; n++) {
18310         if (sig_name[n]) {
18311             printf("%s %d\n", sig_name[n], sig_num[n])
18312         }
18313         else {
18314             printf("NUM%d %d\n", n, n) 
18315         }
18316     }
18317     for (n = 0; n < ndups; n++) {
18318         printf("%s %d\n", dup_name[n], dup_num[n])
18319     }
18320 }
18321 EOP
18322 $cat >signal_cmd <<EOS
18323 $startsh
18324 if $test -s signal.lst; then
18325     echo "Using your existing signal.lst file"
18326         exit 0
18327 fi
18328 xxx="$xxx"
18329 EOS
18330 $cat >>signal_cmd <<'EOS'
18331
18332 set signal
18333 if eval $compile_ok; then
18334         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
18335 else
18336         echo "(I can't seem be able to compile the whole test program)" >&4
18337         echo "(I'll try it in little pieces.)" >&4
18338         set signal -DJUST_NSIG
18339         if eval $compile_ok; then
18340                 $run ./signal$_exe > signal.nsg
18341                 $cat signal.nsg
18342         else
18343                 echo "I can't seem to figure out how many signals you have." >&4
18344                 echo "Guessing 50." >&4
18345                 echo 'NSIG 50' > signal.nsg
18346         fi
18347         : Now look at all the signal names, one at a time.
18348         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
18349                 $cat > signal.c <<EOCP
18350 #include <sys/types.h>
18351 #include <signal.h>
18352 #include <stdio.h>
18353 int main() {
18354 printf("$xx %d\n", SIG${xx});
18355 return 0;
18356 }
18357 EOCP
18358                 set signal
18359                 if eval $compile; then
18360                         echo "SIG${xx} found."
18361                         $run ./signal$_exe  >> signal.ls1
18362                 else
18363                         echo "SIG${xx} NOT found."
18364                 fi
18365         done
18366         if $test -s signal.ls1; then
18367                 $cat signal.nsg signal.ls1 |
18368                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
18369         fi
18370
18371 fi
18372 if $test -s signal.lst; then
18373         :
18374 else
18375         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
18376         echo 'kill -l' >signal
18377         set X `csh -f <signal`
18378         $rm -f signal
18379         shift
18380         case $# in
18381         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
18382         esac
18383         echo $@ | $tr ' ' $trnl | \
18384             $awk '{ printf "%s %d\n", $1, ++s; }
18385                   END { printf "NSIG %d\n", ++s }' >signal.lst
18386 fi
18387 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
18388 EOS
18389 chmod a+x signal_cmd
18390 $eunicefix signal_cmd
18391
18392 : generate list of signal names
18393 echo " "
18394 case "$sig_name_init" in
18395 '') doinit=yes ;;
18396 *)  case "$sig_num_init" in
18397     ''|*,*) doinit=yes ;;
18398     esac ;;
18399 esac
18400 case "$doinit" in
18401 yes)
18402         echo "Generating a list of signal names and numbers..." >&4
18403         . ./signal_cmd
18404         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
18405         sig_name=`$awk 'BEGIN { printf "ZERO " }
18406                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
18407         sig_num=`$awk  'BEGIN { printf "0 " }
18408                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
18409         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
18410                              !/^NSIG/   { printf "\"%s\", ", $1 }
18411                              END        { printf "0\n" }' signal.lst`
18412         sig_num_init=`$awk  'BEGIN      { printf "0, " }
18413                              !/^NSIG/   { printf "%d, ", $2}
18414                              END        { printf "0\n"}' signal.lst`
18415         ;;
18416 esac
18417 echo "The following $sig_count signals are available:"
18418 echo " "
18419 echo $sig_name | $awk \
18420 'BEGIN { linelen = 0 }
18421 {
18422         for (i = 1; i <= NF; i++) {
18423                 name = "SIG" $i " "
18424                 linelen = linelen + length(name)
18425                 if (linelen > 70) {
18426                         printf "\n"
18427                         linelen = length(name)
18428                 }
18429                 printf "%s", name
18430         }
18431         printf "\n"
18432 }'
18433 sig_size=`echo $sig_name | awk '{print NF}'`
18434 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
18435
18436 echo " "
18437 case "$sizetype" in
18438 *_t) zzz="$sizetype"    ;;
18439 *)   zzz="filesize"     ;;
18440 esac
18441 echo "Checking the size of $zzz..." >&4 
18442 cat > try.c <<EOCP
18443 #include <sys/types.h>
18444 #include <stdio.h>
18445 int main() {
18446     printf("%d\n", (int)sizeof($sizetype));
18447     exit(0);
18448 }
18449 EOCP
18450 set try
18451 if eval $compile_ok; then
18452         yyy=`$run ./try`
18453         case "$yyy" in
18454         '')     sizesize=4
18455                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
18456                 ;;
18457         *)      sizesize=$yyy
18458                 echo "Your $zzz size is $sizesize bytes."
18459                 ;;
18460         esac
18461 else
18462         sizesize=4
18463         echo "(I can't compile the test program--guessing $sizesize.)" >&4
18464 fi
18465
18466
18467 : check for socklen_t
18468 echo " "
18469 echo "Checking to see if you have socklen_t..." >&4
18470 $cat >try.c <<EOCP
18471 #include <sys/types.h>
18472 #$d_socket HAS_SOCKET
18473 #ifdef HAS_SOCKET
18474 #include <sys/socket.h>
18475 #endif
18476 int main() { socklen_t x = 16; }
18477 EOCP
18478 set try
18479 if eval $compile; then
18480         val="$define"
18481         echo "You have socklen_t."
18482 else
18483         val="$undef"
18484         echo "You do not have socklen_t."
18485         case "$sizetype" in
18486         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
18487         esac
18488 fi
18489 $rm -f try try.*
18490 set d_socklen_t
18491 eval $setvar
18492
18493 : see if this is a socks.h system
18494 set socks.h i_socks
18495 eval $inhdr
18496
18497 : check for type of the size argument to socket calls
18498 case "$d_socket" in
18499 "$define")
18500         $cat <<EOM
18501
18502 Checking to see what type is the last argument of accept().
18503 EOM
18504         yyy=''
18505         case "$d_socklen_t" in
18506         "$define") yyy="$yyy socklen_t"
18507         esac
18508         yyy="$yyy $sizetype int long unsigned"
18509         for xxx in $yyy; do
18510                 case "$socksizetype" in
18511                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
18512                         case "$usesocks" in
18513                         "$define")
18514                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
18515                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18516                                         socksizetype="$xxx"
18517                                 fi
18518                                 ;;
18519                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
18520                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18521                                         socksizetype="$xxx"
18522                                 fi
18523                                 ;;
18524                         esac
18525                         ;;
18526                 esac
18527         done
18528 : In case none of those worked, prompt the user.
18529         case "$socksizetype" in
18530         '')     rp='What is the type for socket address structure sizes?'
18531                 dflt='int'
18532                 . ./myread
18533                 socksizetype=$ans
18534                 ;;
18535         esac
18536         ;;
18537 *)      : no sockets, so pick relatively harmless default
18538         socksizetype='int'
18539         ;;
18540 esac
18541
18542 : see what type is used for signed size_t
18543 set ssize_t ssizetype int stdio.h sys/types.h
18544 eval $typedef
18545 dflt="$ssizetype"
18546 $cat > try.c <<EOM
18547 #include <stdio.h>
18548 #include <sys/types.h>
18549 #define Size_t $sizetype
18550 #define SSize_t $dflt
18551 int main()
18552 {
18553         if (sizeof(Size_t) == sizeof(SSize_t))
18554                 printf("$dflt\n");
18555         else if (sizeof(Size_t) == sizeof(int))
18556                 printf("int\n");
18557         else 
18558                 printf("long\n");
18559         exit(0);
18560 }
18561 EOM
18562 echo " "
18563 set try
18564 if eval $compile_ok && $run ./try > /dev/null; then
18565         ssizetype=`$run ./try`
18566         echo "I'll be using $ssizetype for functions returning a byte count." >&4
18567 else
18568         $cat >&4 <<EOM
18569 Help! I can't compile and run the ssize_t test program: please enlighten me!
18570 (This is probably a misconfiguration in your system or libraries, and
18571 you really ought to fix it.  Still, I'll try anyway.)
18572
18573 I need a type that is the same size as $sizetype, but is guaranteed to
18574 be signed.  Common values are ssize_t, int and long.
18575
18576 EOM
18577         rp="What signed type is the same size as $sizetype?"
18578         . ./myread
18579         ssizetype="$ans"
18580 fi
18581 $rm -f try try.*
18582
18583 : see what type of char stdio uses.
18584 echo " "
18585 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
18586 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
18587         echo "Your stdio uses unsigned chars." >&4
18588         stdchar="unsigned char"
18589 else
18590         echo "Your stdio uses signed chars." >&4
18591         stdchar="char"
18592 fi
18593 $rm -f stdioh
18594
18595
18596
18597 : see what type uids are declared as in the kernel
18598 echo " "
18599 echo "Looking for the type for user ids returned by getuid()."
18600 set uid_t uidtype xxx stdio.h sys/types.h
18601 eval $typedef
18602 case "$uidtype" in
18603 xxx)
18604         xxx=`./findhdr sys/user.h`
18605         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18606         case $1 in
18607         unsigned) dflt="$1 $2" ;;
18608         *) dflt="$1" ;;
18609         esac
18610         ;;
18611 *) dflt="$uidtype";;
18612 esac
18613 case "$uidtype" in
18614 uid_t)  echo "uid_t found." ;;
18615 *)      rp="What is the type for user ids returned by getuid()?"
18616         . ./myread
18617         uidtype="$ans"
18618         ;;
18619 esac
18620
18621 echo " "
18622 case "$uidtype" in
18623 *_t) zzz="$uidtype"     ;;
18624 *)   zzz="uid"          ;;
18625 esac
18626 echo "Checking the size of $zzz..." >&4 
18627 cat > try.c <<EOCP
18628 #include <sys/types.h>
18629 #include <stdio.h>
18630 int main() {
18631     printf("%d\n", (int)sizeof($uidtype));
18632     exit(0);
18633 }
18634 EOCP
18635 set try
18636 if eval $compile_ok; then
18637         yyy=`$run ./try`
18638         case "$yyy" in
18639         '')     uidsize=4
18640                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
18641                 ;;
18642         *)      uidsize=$yyy
18643                 echo "Your $zzz is $uidsize bytes long."
18644                 ;;
18645         esac
18646 else
18647         uidsize=4
18648         echo "(I can't compile the test program--guessing $uidsize.)" >&4
18649 fi
18650
18651 echo " "
18652 case "$uidtype" in
18653 *_t) zzz="$uidtype"     ;;
18654 *)   zzz="uid"          ;;
18655 esac
18656 echo "Checking the sign of $zzz..." >&4
18657 cat > try.c <<EOCP
18658 #include <sys/types.h>
18659 #include <stdio.h>
18660 int main() {
18661         $uidtype foo = -1;
18662         if (foo < 0)
18663                 printf("-1\n");
18664         else
18665                 printf("1\n");
18666 }
18667 EOCP
18668 set try
18669 if eval $compile; then
18670         yyy=`$run ./try`
18671         case "$yyy" in
18672         '')     uidsign=1
18673                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18674                 ;;
18675         *)      uidsign=$yyy
18676                 case "$uidsign" in
18677                  1) echo "Your $zzz is unsigned." ;;
18678                 -1) echo "Your $zzz is signed."   ;;
18679                 esac
18680                 ;;
18681         esac
18682 else
18683         uidsign=1
18684         echo "(I can't compile the test program--guessing unsigned.)" >&4
18685 fi
18686
18687
18688
18689 echo " "
18690 $echo "Checking the format string to be used for uids..." >&4
18691
18692 case "$uidsign" in
18693 -1)     if $test X"$uidsize" = X"$ivsize"; then
18694                 uidformat="$ivdformat"
18695         else
18696                 if $test X"$uidsize" = X"$longsize"; then
18697                         uidformat='"ld"'
18698                 else
18699                         if $test X"$uidsize" = X"$intsize"; then
18700                                 uidformat='"d"'
18701                         else
18702                                 if $test X"$uidsize" = X"$shortsize"; then
18703                                         uidformat='"hd"'
18704                                 fi
18705                         fi
18706                 fi
18707         fi
18708         ;;
18709 *)      if $test X"$uidsize" = X"$uvsize"; then
18710                 uidformat="$uvuformat"
18711         else
18712                 if $test X"$uidsize" = X"$longsize"; then
18713                         uidformat='"lu"'
18714                 else
18715                         if $test X"$uidsize" = X"$intsize"; then
18716                                 uidformat='"u"'
18717                         else
18718                                 if $test X"$uidsize" = X"$shortsize"; then
18719                                         uidformat='"hu"'
18720                                 fi
18721                         fi
18722                 fi
18723         fi
18724         ;;
18725 esac
18726
18727 : determine compiler compiler
18728 case "$yacc" in
18729 '')
18730         dflt=yacc;;
18731 *)
18732         dflt="$yacc";;
18733 esac
18734 echo " "
18735 comp='yacc'
18736 if $test -f "$byacc$_exe"; then
18737         dflt="$byacc"
18738         comp="byacc or $comp"
18739 fi
18740 if $test -f "$bison$_exe"; then
18741         comp="$comp or bison -y"
18742 fi
18743 rp="Which compiler compiler ($comp) shall I use?"
18744 . ./myread
18745 yacc="$ans"
18746 case "$yacc" in
18747 *bis*)
18748         case "$yacc" in
18749         *-y*) ;;
18750         *)
18751                 yacc="$yacc -y"
18752                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
18753                 ;;
18754         esac
18755         ;;
18756 esac
18757
18758 : see if this is a fp.h system
18759 set fp.h i_fp
18760 eval $inhdr
18761
18762 : see if this is a fp_class.h system
18763 set fp_class.h i_fp_class
18764 eval $inhdr
18765
18766 : see if this is a ieeefp.h system
18767 case "$i_ieeefp" in
18768 '' ) set ieeefp.h i_ieeefp
18769      eval $inhdr
18770      ;;
18771 esac
18772
18773 : see if this is a libutil.h system
18774 set libutil.h i_libutil
18775 eval $inhdr
18776
18777 : see if mach cthreads are available
18778 if test "X$usethreads" = "X$define"; then
18779         set mach/cthreads.h i_machcthr
18780         eval $inhdr
18781 else
18782         i_machcthr="$undef"
18783 fi
18784
18785
18786
18787 : see if this is a math.h system
18788 set math.h i_math
18789 eval $inhdr
18790
18791 : see if this is a mntent.h system
18792 set mntent.h i_mntent
18793 eval $inhdr
18794
18795 : see if ndbm.h is available
18796 set ndbm.h t_ndbm
18797 eval $inhdr
18798
18799 case "$t_ndbm" in
18800 $undef)
18801     # Some Linux distributions such as RedHat 7.1 put the
18802     # ndbm.h header in /usr/include/gdbm/ndbm.h.
18803     if $test -f /usr/include/gdbm/ndbm.h; then
18804         echo '<gdbm/ndbm.h> found.'
18805         ccflags="$ccflags -I/usr/include/gdbm"
18806         cppflags="$cppflags -I/usr/include/gdbm"
18807         t_ndbm=$define
18808     fi
18809     ;;
18810 esac
18811
18812 case "$t_ndbm" in
18813 $define)
18814         : see if dbm_open exists
18815         set dbm_open d_dbm_open
18816         eval $inlibc
18817         case "$d_dbm_open" in
18818         $undef)
18819                 t_ndbm="$undef"
18820                 echo "We won't be including <ndbm.h>"
18821                 ;;
18822         esac
18823         ;;
18824 esac
18825 val="$t_ndbm"
18826 set i_ndbm
18827 eval $setvar
18828
18829 : see if net/errno.h is available
18830 val=''
18831 set net/errno.h val
18832 eval $inhdr
18833
18834 : Unfortunately, it causes problems on some systems.  Arrgh.
18835 case "$val" in
18836 $define)
18837         cat > try.c <<'EOM'
18838 #include <stdio.h>
18839 #include <errno.h>
18840 #include <net/errno.h>
18841 int func()
18842 {
18843         return ENOTSOCK;
18844 }
18845 EOM
18846         if $cc $ccflags -c try.c >/dev/null 2>&1; then
18847                 echo "We'll be including <net/errno.h>." >&4
18848         else
18849                 echo "We won't be including <net/errno.h>." >&4
18850                 val="$undef"
18851         fi
18852         $rm -f try.* try
18853         ;;
18854 esac
18855 set i_neterrno
18856 eval $setvar
18857
18858 : see if netinet/tcp.h is available
18859 set netinet/tcp.h i_netinettcp
18860 eval $inhdr
18861
18862 : see if this is a poll.h system
18863 set poll.h i_poll
18864 eval $inhdr
18865
18866 : see if this is a prot.h system
18867 set prot.h i_prot
18868 eval $inhdr
18869
18870 echo " "
18871 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
18872 $cat <<'EOSH' > Cppsym.know
18873 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
18874 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
18875 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
18876 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
18877 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
18878 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
18879 bull c cadmus clipper CMU COFF COMPILER_VERSION
18880 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
18881 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
18882 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
18883 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
18884 GLIBC GLIBC_MINOR
18885 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
18886 H3050R H3050RX hbullx20 hcx host_mips
18887 hp200 hp300 hp700 HP700 hp800 hp9000
18888 hp9000s200 hp9000s300 hp9000s400 hp9000s500
18889 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
18890 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
18891 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
18892 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
18893 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
18894 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
18895 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
18896 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
18897 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
18898 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
18899 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
18900 MATH_HAS_NO_SIDE_EFFECTS
18901 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
18902 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
18903 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
18904 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
18905 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
18906 NetBSD news1500 news1700 news1800 news1900 news3700
18907 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
18908 ns32016 ns32332 ns32k nsc32000
18909 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
18910 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
18911 pc532 pdp11 PGC PIC plexus PORTAR posix
18912 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
18913 POSIX_C_SOURCE POSIX_SOURCE POWER
18914 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
18915 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
18916 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
18917 sony sony_news sonyrisc sparc sparclite spectrum
18918 stardent stdc STDC_EXT stratos sun sun3 sun386
18919 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
18920 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
18921 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
18922 sysV68 sysV88 Tek4132 Tek4300 titan
18923 TM3200 TM5400 TM5600
18924 tower tower32 tower32_200 tower32_600 tower32_700
18925 tower32_800 tower32_850 tss
18926 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
18927 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
18928 unix UNIX95 UNIX99 unixpc unos
18929 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
18930 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
18931 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
18932 USGr4 USGr4_2
18933 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
18934 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
18935 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
18936 z8000
18937 EOSH
18938 # Maybe put other stuff here too.
18939 cat <<EOSH >>Cppsym.know
18940 $osname
18941 EOSH
18942 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
18943 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
18944 $cat Cppsym.know > Cppsym.c
18945 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
18946 $rm -f Cppsym.a Cppsym.b Cppsym.c
18947 cat <<EOSH > Cppsym
18948 $startsh
18949 if $test \$# -gt 0; then
18950     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
18951     if $test -s Cppsym.got; then
18952         $rm -f Cppsym.got
18953         exit 0
18954     fi
18955     $rm -f Cppsym.got
18956     exit 1
18957 else
18958     $tr " " "$trnl" | ./Cppsym.try
18959     exit 0
18960 fi
18961 EOSH
18962 chmod +x Cppsym
18963 $eunicefix Cppsym
18964 cat <<EOSH > Cppsym.try
18965 $startsh
18966 cat <<'EOCP' > try.c
18967 #include <stdio.h>
18968 int main() {
18969 EOCP
18970 $awk \\
18971 EOSH
18972 cat <<'EOSH' >> Cppsym.try
18973 'length($1) > 0 {
18974     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
18975     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
18976     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
18977     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
18978 }'       >> try.c
18979 echo 'return 0;}' >> try.c
18980 EOSH
18981 cat <<EOSH >> Cppsym.try
18982 ccflags="$ccflags"
18983 case "$osname-$gccversion" in
18984 irix-) ccflags="\$ccflags -woff 1178" ;;
18985 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
18986 esac
18987 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
18988 EOSH
18989 chmod +x Cppsym.try
18990 $eunicefix Cppsym.try
18991 ./Cppsym < Cppsym.know > Cppsym.true
18992 : now check the C compiler for additional symbols
18993 postprocess_cc_v=''
18994 case "$osname" in
18995 aix) postprocess_cc_v="|$tr , ' '" ;;
18996 esac
18997 $cat >ccsym <<EOS
18998 $startsh
18999 $cat >tmp.c <<EOF
19000 extern int foo;
19001 EOF
19002 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
19003 do
19004         case "\$i" in
19005         -D*) echo "\$i" | $sed 's/^-D//';;
19006         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
19007         esac
19008 done
19009 $rm -f try.c
19010 EOS
19011 postprocess_cc_v=''
19012 chmod +x ccsym
19013 $eunicefix ccsym
19014 ./ccsym > ccsym1.raw
19015 if $test -s ccsym1.raw; then
19016        $sort ccsym1.raw | $uniq >ccsym.raw
19017 else
19018        mv ccsym1.raw ccsym.raw
19019 fi
19020
19021 $awk '/\=/ { print $0; next }
19022         { print $0"=1" }' ccsym.raw >ccsym.list
19023 $awk '/\=/ { print $0; next }
19024         { print $0"=1" }' Cppsym.true >ccsym.true
19025 $comm -13 ccsym.true ccsym.list >ccsym.own
19026 $comm -12 ccsym.true ccsym.list >ccsym.com
19027 $comm -23 ccsym.true ccsym.list >ccsym.cpp
19028 also=''
19029 if $test -z ccsym.raw; then
19030         echo "Your C compiler doesn't seem to define any symbols!" >&4
19031         echo " "
19032         echo "However, your C preprocessor defines the following symbols:"
19033         $cat Cppsym.true
19034         ccsymbols=''
19035         cppsymbols=`$cat Cppsym.true`
19036         cppsymbols=`echo $cppsymbols`
19037         cppccsymbols="$cppsymbols"
19038 else
19039         if $test -s ccsym.com; then
19040                 echo "Your C compiler and pre-processor define these symbols:"
19041                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
19042                 also='also '
19043                 symbols='ones'
19044                 cppccsymbols=`$cat ccsym.com`
19045                 cppccsymbols=`echo $cppccsymbols`
19046                 $test "$silent" || sleep 1
19047         fi
19048         if $test -s ccsym.cpp; then
19049                 $test "$also" && echo " "
19050                 echo "Your C pre-processor ${also}defines the following symbols:"
19051                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
19052                 also='further '
19053                 cppsymbols=`$cat ccsym.cpp`
19054                 cppsymbols=`echo $cppsymbols`
19055                 $test "$silent" || sleep 1
19056         fi
19057         if $test -s ccsym.own; then
19058                 $test "$also" && echo " "
19059                 echo "Your C compiler ${also}defines the following cpp symbols:"
19060                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
19061                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
19062                 ccsymbols=`$cat ccsym.own`
19063                 ccsymbols=`echo $ccsymbols`
19064                 $test "$silent" || sleep 1
19065         fi
19066 fi
19067
19068 : see if this is a termio system
19069 val="$undef"
19070 val2="$undef"
19071 val3="$undef"
19072 if $test `./findhdr termios.h`; then
19073         set tcsetattr i_termios
19074         eval $inlibc
19075         val3="$i_termios"
19076 fi
19077 echo " "
19078 case "$val3" in
19079 "$define") echo "You have POSIX termios.h... good!" >&4;;
19080 *) if ./Cppsym pyr; then
19081                 case "`/bin/universe`" in
19082                 ucb) if $test `./findhdr sgtty.h`; then
19083                                 val2="$define"
19084                                 echo "<sgtty.h> found." >&4
19085                         else
19086                                 echo "System is pyramid with BSD universe."
19087                                 echo "<sgtty.h> not found--you could have problems." >&4
19088                         fi;;
19089                 *) if $test `./findhdr termio.h`; then
19090                                 val="$define"
19091                                 echo "<termio.h> found." >&4
19092                         else
19093                                 echo "System is pyramid with USG universe."
19094                                 echo "<termio.h> not found--you could have problems." >&4
19095                         fi;;
19096                 esac
19097         elif ./usg; then
19098                 if $test `./findhdr termio.h`; then
19099                         echo "<termio.h> found." >&4
19100                         val="$define"
19101                 elif $test `./findhdr sgtty.h`; then
19102                         echo "<sgtty.h> found." >&4
19103                         val2="$define"
19104                 else
19105 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
19106                 fi
19107         else
19108                 if $test `./findhdr sgtty.h`; then
19109                         echo "<sgtty.h> found." >&4
19110                         val2="$define"
19111                 elif $test `./findhdr termio.h`; then
19112                         echo "<termio.h> found." >&4
19113                         val="$define"
19114                 else
19115 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
19116                 fi
19117         fi;;
19118 esac
19119 set i_termio; eval $setvar
19120 val=$val2; set i_sgtty; eval $setvar
19121 val=$val3; set i_termios; eval $setvar
19122
19123 : see if stddef is available
19124 set stddef.h i_stddef
19125 eval $inhdr
19126
19127 : see if this is a sunmath.h system
19128 set sunmath.h i_sunmath
19129 eval $inhdr
19130
19131 : see if sys/access.h is available
19132 set sys/access.h i_sysaccess
19133 eval $inhdr
19134
19135 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
19136 set sys/filio.h i_sysfilio
19137 eval $inhdr
19138 echo " "
19139 if $test `./findhdr sys/ioctl.h`; then
19140         val="$define"
19141         echo '<sys/ioctl.h> found.' >&4
19142 else
19143         val="$undef"
19144         if $test $i_sysfilio = "$define"; then
19145             echo '<sys/ioctl.h> NOT found.' >&4
19146         else
19147                 $test $i_sgtty = "$define" && xxx="sgtty.h"
19148                 $test $i_termio = "$define" && xxx="termio.h"
19149                 $test $i_termios = "$define" && xxx="termios.h"
19150 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
19151         fi
19152 fi
19153 set i_sysioctl
19154 eval $setvar
19155
19156 : see if socket ioctl defs are in sys/sockio.h
19157 echo " "
19158 xxx=`./findhdr sys/sockio.h`
19159 if $test "$xxx"; then
19160         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
19161                 val="$define"
19162                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
19163         else
19164                 val="$undef"
19165                 echo "No socket ioctls found in <sys/sockio.h>." >&4
19166         fi
19167 else
19168         val="$undef"
19169         $cat <<EOM
19170 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
19171 EOM
19172 fi
19173 set i_syssockio
19174 eval $setvar
19175
19176
19177 : see if this is a syslog.h system
19178 set syslog.h i_syslog
19179 eval $inhdr
19180
19181
19182 : see if this is a sys/mode.h system
19183 set sys/mode.h i_sysmode
19184 eval $inhdr
19185
19186 : see if sys/resource.h has to be included
19187 set sys/resource.h i_sysresrc
19188 eval $inhdr
19189
19190 : see if sys/security.h is available
19191 set sys/security.h i_syssecrt
19192 eval $inhdr
19193
19194 : see if this is a sys/statvfs.h system
19195 set sys/statvfs.h i_sysstatvfs
19196 eval $inhdr
19197
19198 : see if this is a sys/un.h system
19199 set sys/un.h i_sysun
19200 eval $inhdr
19201
19202
19203 : see if this is a sys/utsname.h system
19204 set sys/utsname.h i_sysutsname
19205 eval $inhdr
19206
19207 : see if this is a syswait system
19208 set sys/wait.h i_syswait
19209 eval $inhdr
19210
19211 : see if this is a ustat.h system
19212 set ustat.h i_ustat
19213 eval $inhdr
19214
19215 : see if this is an utime system
19216 set utime.h i_utime
19217 eval $inhdr
19218
19219 : see if this is a values.h system
19220 set values.h i_values
19221 eval $inhdr
19222
19223 : see if this is a vfork system
19224 case "$d_vfork" in
19225 "$define")
19226         set vfork.h i_vfork
19227         eval $inhdr
19228         ;;
19229 *)
19230         i_vfork="$undef"
19231         ;;
19232 esac
19233
19234 : see if gdbm.h is available
19235 set gdbm.h t_gdbm
19236 eval $inhdr
19237 case "$t_gdbm" in
19238 $define)
19239         : see if gdbm_open exists
19240         set gdbm_open d_gdbm_open
19241         eval $inlibc
19242         case "$d_gdbm_open" in
19243         $undef)
19244                 t_gdbm="$undef"
19245                 echo "We won't be including <gdbm.h>"
19246                 ;;
19247         esac
19248         ;;
19249 esac
19250 val="$t_gdbm"
19251 set i_gdbm
19252 eval $setvar
19253
19254 echo " "
19255 echo "Looking for extensions..." >&4
19256 : If we are using the old config.sh, known_extensions may contain
19257 : old or inaccurate or duplicate values.
19258 known_extensions=''
19259 nonxs_extensions=''
19260 : We do not use find because it might not be available.
19261 : We do not just use MANIFEST because the user may have dropped
19262 : some additional extensions into the source tree and expect them
19263 : to be built.
19264
19265 : Function to recursively find available extensions, ignoring DynaLoader
19266 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
19267 find_extensions='
19268     for xxx in *; do
19269        case "$xxx" in
19270            DynaLoader|dynaload) ;;
19271            *)
19272            if $test -f $xxx/$xxx.xs; then
19273                known_extensions="$known_extensions $1$xxx";
19274            elif $test -f $xxx/Makefile.PL; then
19275                nonxs_extensions="$nonxs_extensions $1$xxx";
19276            else
19277                if $test -d $xxx -a $# -lt 10; then
19278                    set $1$xxx/ $*;
19279                    cd "$xxx";
19280                    eval $find_extensions;
19281                    cd ..;
19282                    shift;
19283                fi;
19284            fi
19285            ;;
19286        esac;
19287     done'
19288 tdir=`pwd`
19289 cd "$rsrc/ext"
19290 set X
19291 shift
19292 eval $find_extensions
19293 # Special case:  Add in threads/shared since it is not picked up by the
19294 # recursive find above (and adding in general recursive finding breaks
19295 # SDBM_File/sdbm).  A.D.  10/25/2001.
19296 known_extensions="$known_extensions threads/shared"
19297 set X $nonxs_extensions
19298 shift
19299 nonxs_extensions="$*"
19300 set X $known_extensions
19301 shift
19302 known_extensions="$*"
19303 cd "$tdir"
19304
19305 : Now see which are supported on this system.
19306 avail_ext=''
19307 for xxx in $known_extensions ; do
19308         case "$xxx" in
19309         DB_File|db_file)
19310                 case "$i_db" in
19311                 $define) avail_ext="$avail_ext $xxx" ;;
19312                 esac
19313                 ;;
19314         GDBM_File|gdbm_fil)
19315                 case "$i_gdbm" in 
19316                 $define) avail_ext="$avail_ext $xxx" ;;
19317                 esac
19318                 ;;
19319         I18N/Langinfo|i18n_lan)
19320                 case "$i_langinfo$d_nl_langinfo" in 
19321                 $define$define) avail_ext="$avail_ext $xxx" ;;
19322                 esac
19323                 ;;
19324         NDBM_File|ndbm_fil)
19325                 case "$i_ndbm" in
19326                 $define)
19327                     case "$osname-$use64bitint" in
19328                     hpux-define)
19329                         case "$libs" in
19330                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
19331                         esac
19332                         ;;
19333                     *) avail_ext="$avail_ext $xxx" ;;
19334                     esac
19335                     ;;
19336                 esac
19337                 ;;
19338         ODBM_File|odbm_fil) 
19339                 case "${i_dbm}${i_rpcsvcdbm}" in
19340                 *"${define}"*)
19341                     case "$osname-$use64bitint" in
19342                     hpux-define)
19343                         case "$libs" in
19344                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
19345                         esac
19346                         ;;
19347                     *) avail_ext="$avail_ext $xxx" ;;
19348                     esac
19349                     ;;
19350                 esac
19351                 ;;
19352         POSIX|posix)
19353                 case "$useposix" in
19354                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19355                 esac
19356                 ;;
19357         Opcode|opcode)
19358                 case "$useopcode" in
19359                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19360                 esac
19361                 ;;
19362         Socket|socket)
19363                 case "$d_socket" in 
19364                 true|$define|y)
19365                     case "$osname" in
19366                     beos) ;; # not unless BONE
19367                     *) avail_ext="$avail_ext $xxx" ;;
19368                     esac
19369                     ;;
19370                 esac
19371                 ;;
19372         Sys/Syslog|sys/syslog)
19373                 : XXX syslog requires socket
19374                 case "$d_socket" in 
19375                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
19376                 esac
19377                 ;;
19378         Thread|thread)
19379                 case "$usethreads" in
19380                 true|$define|y)
19381                         case "$useithreads" in
19382                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
19383                         esac
19384                 esac
19385                 ;;
19386         XS/APItest|xs/apitest)
19387                 # This is just for testing.  Skip it unless we have dynamic loading.
19388
19389                 case "$usedl" in
19390                 $define) avail_ext="$avail_ext $xxx" ;;
19391                 esac
19392                 ;;
19393         XS/Typemap|xs/typemap)
19394                 # This is just for testing.  Skip it unless we have dynamic loading.
19395                 case "$usedl" in
19396                 $define) avail_ext="$avail_ext $xxx" ;;
19397                 esac
19398                 ;;
19399         threads|threads/shared)
19400                 # threads and threads::shared are special cases.
19401                 # To stop people from asking "Perl 5.8.0 was supposed
19402                 # to have this new fancy threads implementation but my
19403                 # perl doesn't have it" and from people trying to
19404                 # (re)install the threads module using CPAN.pm and
19405                 # CPAN.pm then offering to reinstall Perl 5.8.0,
19406                 # the threads.pm and threads/shared.pm will always be
19407                 # there, croaking informatively ("you need to rebuild
19408                 # all of Perl with threads, sorry") when threads haven't
19409                 # been compiled in.
19410                 # --jhi
19411                 avail_ext="$avail_ext $xxx"
19412                 ;;
19413         IPC/SysV|ipc/sysv)
19414                 : XXX Do we need a useipcsysv variable here
19415                 case "${d_msg}${d_sem}${d_shm}" in 
19416                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
19417                 esac
19418                 ;;
19419         *)      avail_ext="$avail_ext $xxx"
19420                 ;;
19421         esac
19422 done
19423
19424 set X $avail_ext
19425 shift
19426 avail_ext="$*"
19427
19428 : Now see which nonxs extensions are supported on this system.
19429 : For now assume all are.
19430 nonxs_ext=''
19431 for xxx in $nonxs_extensions ; do
19432         case "$xxx" in
19433         *)      nonxs_ext="$nonxs_ext $xxx"
19434                 ;;
19435         esac
19436 done
19437
19438 set X $nonxs_ext
19439 shift
19440 nonxs_ext="$*"
19441
19442 case $usedl in
19443 $define)
19444         $cat <<EOM
19445 A number of extensions are supplied with $package.  You may choose to
19446 compile these extensions for dynamic loading (the default), compile
19447 them into the $package executable (static loading), or not include
19448 them at all.  Answer "none" to include no extensions.
19449 Note that DynaLoader is always built and need not be mentioned here.
19450
19451 EOM
19452         case "$dynamic_ext" in
19453         '')
19454                 : Exclude those listed in static_ext
19455                 dflt=''
19456                 for xxx in $avail_ext; do
19457                         case " $static_ext " in
19458                         *" $xxx "*) ;;
19459                         *) dflt="$dflt $xxx" ;;
19460                         esac
19461                 done
19462                 set X $dflt
19463                 shift
19464                 dflt="$*"
19465                 ;;
19466         *)      dflt="$dynamic_ext"
19467                 # Perhaps we are reusing an old out-of-date config.sh.
19468                 case "$hint" in
19469                 previous)
19470                         if test X"$dynamic_ext" != X"$avail_ext"; then
19471                                 $cat <<EOM
19472 NOTICE:  Your previous config.sh list may be incorrect. 
19473 The extensions now available to you are 
19474         ${avail_ext}
19475 but the default list from your previous config.sh is
19476         ${dynamic_ext} 
19477
19478 EOM
19479                         fi
19480                         ;;
19481                 esac
19482                 ;;
19483         esac
19484         case "$dflt" in
19485         '')     dflt=none;;
19486         esac
19487         rp="What extensions do you wish to load dynamically?"
19488         . ./myread
19489         case "$ans" in
19490         none) dynamic_ext=' ' ;;
19491         *) dynamic_ext="$ans" ;;
19492         esac
19493
19494         case "$static_ext" in
19495         '')
19496                 : Exclude those already listed in dynamic linking
19497                 dflt=''
19498                 for xxx in $avail_ext; do
19499                         case " $dynamic_ext " in
19500                         *" $xxx "*) ;;
19501                         *) dflt="$dflt $xxx" ;;
19502                         esac
19503                 done
19504                 set X $dflt
19505                 shift
19506                 dflt="$*"
19507                 ;;
19508         *)  dflt="$static_ext" 
19509                 ;;
19510         esac
19511
19512         case "$dflt" in
19513         '')     dflt=none;;
19514         esac
19515         rp="What extensions do you wish to load statically?"
19516         . ./myread
19517         case "$ans" in
19518         none) static_ext=' ' ;;
19519         *) static_ext="$ans" ;;
19520         esac
19521         ;;
19522 *)
19523         $cat <<EOM
19524 A number of extensions are supplied with $package.  Answer "none" 
19525 to include no extensions. 
19526 Note that DynaLoader is always built and need not be mentioned here.
19527
19528 EOM
19529         case "$static_ext" in
19530         '') dflt="$avail_ext" ;;
19531         *)      dflt="$static_ext"
19532                 # Perhaps we are reusing an old out-of-date config.sh.
19533                 case "$hint" in
19534                 previous)
19535                         if test X"$static_ext" != X"$avail_ext"; then
19536                                 $cat <<EOM
19537 NOTICE:  Your previous config.sh list may be incorrect. 
19538 The extensions now available to you are 
19539         ${avail_ext}
19540 but the default list from your previous config.sh is
19541         ${static_ext} 
19542
19543 EOM
19544                         fi
19545                         ;;
19546                 esac
19547                 ;;
19548         esac
19549         : Exclude those that are not xs extensions
19550         case "$dflt" in
19551         '')     dflt=none;;
19552         esac
19553         rp="What extensions do you wish to include?"
19554         . ./myread
19555         case "$ans" in
19556         none) static_ext=' ' ;;
19557         *) static_ext="$ans" ;;
19558         esac
19559         ;;
19560 esac
19561 #        
19562 # Encode is a special case.  If we are building Encode as a static
19563 # extension, we need to explicitly list its subextensions as well.
19564 # For other nested extensions, this is handled automatically by
19565 # the appropriate Makefile.PL.
19566 case " $static_ext " in
19567         *" Encode "*) # Add the subextensions of Encode
19568         cd "$rsrc/ext"
19569         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
19570                 static_ext="$static_ext Encode/$xxx"
19571         done
19572         cd "$tdir"
19573         ;;
19574 esac
19575
19576 set X $dynamic_ext $static_ext $nonxs_ext
19577 shift
19578 extensions="$*"
19579
19580 : Remove libraries needed only for extensions
19581 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
19582 : The exception is SunOS 4.x, which needs them.
19583 case "${osname}X${osvers}" in
19584 sunos*X4*)
19585     perllibs="$libs"
19586     ;;
19587 *) case "$usedl" in
19588     $define|true|[yY]*)
19589             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
19590             shift
19591             perllibs="$*"
19592             ;;
19593     *)  perllibs="$libs"
19594             ;;
19595     esac
19596     ;;
19597 esac
19598
19599 : Remove build directory name from cppstdin so it can be used from
19600 : either the present location or the final installed location.
19601 echo " "
19602 : Get out of the UU directory to get correct path name.
19603 cd ..
19604 case "$cppstdin" in
19605 `pwd`/cppstdin)
19606         echo "Stripping down cppstdin path name"
19607         cppstdin=cppstdin
19608         ;;
19609 esac
19610 cd UU
19611
19612 : end of configuration questions
19613 echo " "
19614 echo "End of configuration questions."
19615 echo " "
19616
19617 : back to where it started
19618 if test -d ../UU; then
19619         cd ..
19620 fi
19621
19622 : configuration may be patched via a 'config.arch' file
19623 if $test -f config.arch; then
19624         echo "I see a config.arch file, loading it."
19625         . ./config.arch
19626 fi
19627
19628 : configuration may be patched via a 'config.over' file
19629 if $test -f config.over; then
19630         echo " "
19631         dflt=y
19632         rp='I see a config.over file.  Do you wish to load it?'
19633         . UU/myread
19634         case "$ans" in
19635         n*) echo "OK, I'll ignore it.";;
19636         *)      . ./config.over
19637                 echo "Configuration override changes have been loaded."
19638                 ;;
19639         esac
19640 fi
19641
19642 : in case they want portability, strip down executable paths
19643 case "$d_portable" in
19644 "$define")
19645         echo " "
19646         echo "Stripping down executable paths..." >&4
19647         for file in $loclist $trylist; do
19648                 eval temp=\$$file
19649                 eval $file=`basename $temp`
19650         done
19651         ;;
19652 esac
19653
19654 : create config.sh file
19655 echo " "
19656 echo "Creating config.sh..." >&4
19657 $spitshell <<EOT >config.sh
19658 $startsh
19659 #
19660 # This file was produced by running the Configure script. It holds all the
19661 # definitions figured out by Configure. Should you modify one of these values,
19662 # do not forget to propagate your changes by running "Configure -der". You may
19663 # instead choose to run each of the .SH files by yourself, or "Configure -S".
19664 #
19665
19666 # Package name      : $package
19667 # Source directory  : $src
19668 # Configuration time: $cf_time
19669 # Configured by     : $cf_by
19670 # Target system     : $myuname
19671
19672 Author='$Author'
19673 Date='$Date'
19674 Header='$Header'
19675 Id='$Id'
19676 Locker='$Locker'
19677 Log='$Log'
19678 Mcc='$Mcc'
19679 RCSfile='$RCSfile'
19680 Revision='$Revision'
19681 Source='$Source'
19682 State='$State'
19683 _a='$_a'
19684 _exe='$_exe'
19685 _o='$_o'
19686 afs='$afs'
19687 afsroot='$afsroot'
19688 alignbytes='$alignbytes'
19689 ansi2knr='$ansi2knr'
19690 aphostname='$aphostname'
19691 api_revision='$api_revision'
19692 api_subversion='$api_subversion'
19693 api_version='$api_version'
19694 api_versionstring='$api_versionstring'
19695 ar='$ar'
19696 archlib='$archlib'
19697 archlibexp='$archlibexp'
19698 archname64='$archname64'
19699 archname='$archname'
19700 archobjs='$archobjs'
19701 asctime_r_proto='$asctime_r_proto'
19702 awk='$awk'
19703 baserev='$baserev'
19704 bash='$bash'
19705 bin='$bin'
19706 binexp='$binexp'
19707 bison='$bison'
19708 byacc='$byacc'
19709 byteorder='$byteorder'
19710 c='$c'
19711 castflags='$castflags'
19712 cat='$cat'
19713 cc='$cc'
19714 cccdlflags='$cccdlflags'
19715 ccdlflags='$ccdlflags'
19716 ccflags='$ccflags'
19717 ccflags_uselargefiles='$ccflags_uselargefiles'
19718 ccname='$ccname'
19719 ccsymbols='$ccsymbols'
19720 ccversion='$ccversion'
19721 cf_by='$cf_by'
19722 cf_email='$cf_email'
19723 cf_time='$cf_time'
19724 charsize='$charsize'
19725 chgrp='$chgrp'
19726 chmod='$chmod'
19727 chown='$chown'
19728 clocktype='$clocktype'
19729 comm='$comm'
19730 compress='$compress'
19731 contains='$contains'
19732 cp='$cp'
19733 cpio='$cpio'
19734 cpp='$cpp'
19735 cpp_stuff='$cpp_stuff'
19736 cppccsymbols='$cppccsymbols'
19737 cppflags='$cppflags'
19738 cpplast='$cpplast'
19739 cppminus='$cppminus'
19740 cpprun='$cpprun'
19741 cppstdin='$cppstdin'
19742 cppsymbols='$cppsymbols'
19743 crypt_r_proto='$crypt_r_proto'
19744 cryptlib='$cryptlib'
19745 csh='$csh'
19746 ctermid_r_proto='$ctermid_r_proto'
19747 ctime_r_proto='$ctime_r_proto'
19748 d_Gconvert='$d_Gconvert'
19749 d_PRIEUldbl='$d_PRIEUldbl'
19750 d_PRIFUldbl='$d_PRIFUldbl'
19751 d_PRIGUldbl='$d_PRIGUldbl'
19752 d_PRIXU64='$d_PRIXU64'
19753 d_PRId64='$d_PRId64'
19754 d_PRIeldbl='$d_PRIeldbl'
19755 d_PRIfldbl='$d_PRIfldbl'
19756 d_PRIgldbl='$d_PRIgldbl'
19757 d_PRIi64='$d_PRIi64'
19758 d_PRIo64='$d_PRIo64'
19759 d_PRIu64='$d_PRIu64'
19760 d_PRIx64='$d_PRIx64'
19761 d_SCNfldbl='$d_SCNfldbl'
19762 d__fwalk='$d__fwalk'
19763 d_access='$d_access'
19764 d_accessx='$d_accessx'
19765 d_alarm='$d_alarm'
19766 d_archlib='$d_archlib'
19767 d_asctime_r='$d_asctime_r'
19768 d_atolf='$d_atolf'
19769 d_atoll='$d_atoll'
19770 d_attribut='$d_attribut'
19771 d_bcmp='$d_bcmp'
19772 d_bcopy='$d_bcopy'
19773 d_bsd='$d_bsd'
19774 d_bsdgetpgrp='$d_bsdgetpgrp'
19775 d_bsdsetpgrp='$d_bsdsetpgrp'
19776 d_bzero='$d_bzero'
19777 d_casti32='$d_casti32'
19778 d_castneg='$d_castneg'
19779 d_charvspr='$d_charvspr'
19780 d_chown='$d_chown'
19781 d_chroot='$d_chroot'
19782 d_chsize='$d_chsize'
19783 d_class='$d_class'
19784 d_closedir='$d_closedir'
19785 d_cmsghdr_s='$d_cmsghdr_s'
19786 d_const='$d_const'
19787 d_crypt='$d_crypt'
19788 d_crypt_r='$d_crypt_r'
19789 d_csh='$d_csh'
19790 d_ctermid_r='$d_ctermid_r'
19791 d_ctime_r='$d_ctime_r'
19792 d_cuserid='$d_cuserid'
19793 d_dbl_dig='$d_dbl_dig'
19794 d_dbminitproto='$d_dbminitproto'
19795 d_difftime='$d_difftime'
19796 d_dirfd='$d_dirfd'
19797 d_dirnamlen='$d_dirnamlen'
19798 d_dlerror='$d_dlerror'
19799 d_dlopen='$d_dlopen'
19800 d_dlsymun='$d_dlsymun'
19801 d_dosuid='$d_dosuid'
19802 d_drand48_r='$d_drand48_r'
19803 d_drand48proto='$d_drand48proto'
19804 d_dup2='$d_dup2'
19805 d_eaccess='$d_eaccess'
19806 d_endgrent='$d_endgrent'
19807 d_endgrent_r='$d_endgrent_r'
19808 d_endhent='$d_endhent'
19809 d_endhostent_r='$d_endhostent_r'
19810 d_endnent='$d_endnent'
19811 d_endnetent_r='$d_endnetent_r'
19812 d_endpent='$d_endpent'
19813 d_endprotoent_r='$d_endprotoent_r'
19814 d_endpwent='$d_endpwent'
19815 d_endpwent_r='$d_endpwent_r'
19816 d_endsent='$d_endsent'
19817 d_endservent_r='$d_endservent_r'
19818 d_eofnblk='$d_eofnblk'
19819 d_eunice='$d_eunice'
19820 d_fchdir='$d_fchdir'
19821 d_fchmod='$d_fchmod'
19822 d_fchown='$d_fchown'
19823 d_fcntl='$d_fcntl'
19824 d_fcntl_can_lock='$d_fcntl_can_lock'
19825 d_fd_macros='$d_fd_macros'
19826 d_fd_set='$d_fd_set'
19827 d_fds_bits='$d_fds_bits'
19828 d_fgetpos='$d_fgetpos'
19829 d_finite='$d_finite'
19830 d_finitel='$d_finitel'
19831 d_flexfnam='$d_flexfnam'
19832 d_flock='$d_flock'
19833 d_flockproto='$d_flockproto'
19834 d_fork='$d_fork'
19835 d_fp_class='$d_fp_class'
19836 d_fpathconf='$d_fpathconf'
19837 d_fpclass='$d_fpclass'
19838 d_fpclassify='$d_fpclassify'
19839 d_fpclassl='$d_fpclassl'
19840 d_fpos64_t='$d_fpos64_t'
19841 d_frexpl='$d_frexpl'
19842 d_fs_data_s='$d_fs_data_s'
19843 d_fseeko='$d_fseeko'
19844 d_fsetpos='$d_fsetpos'
19845 d_fstatfs='$d_fstatfs'
19846 d_fstatvfs='$d_fstatvfs'
19847 d_fsync='$d_fsync'
19848 d_ftello='$d_ftello'
19849 d_ftime='$d_ftime'
19850 d_getcwd='$d_getcwd'
19851 d_getespwnam='$d_getespwnam'
19852 d_getfsstat='$d_getfsstat'
19853 d_getgrent='$d_getgrent'
19854 d_getgrent_r='$d_getgrent_r'
19855 d_getgrgid_r='$d_getgrgid_r'
19856 d_getgrnam_r='$d_getgrnam_r'
19857 d_getgrps='$d_getgrps'
19858 d_gethbyaddr='$d_gethbyaddr'
19859 d_gethbyname='$d_gethbyname'
19860 d_gethent='$d_gethent'
19861 d_gethname='$d_gethname'
19862 d_gethostbyaddr_r='$d_gethostbyaddr_r'
19863 d_gethostbyname_r='$d_gethostbyname_r'
19864 d_gethostent_r='$d_gethostent_r'
19865 d_gethostprotos='$d_gethostprotos'
19866 d_getitimer='$d_getitimer'
19867 d_getlogin='$d_getlogin'
19868 d_getlogin_r='$d_getlogin_r'
19869 d_getmnt='$d_getmnt'
19870 d_getmntent='$d_getmntent'
19871 d_getnbyaddr='$d_getnbyaddr'
19872 d_getnbyname='$d_getnbyname'
19873 d_getnent='$d_getnent'
19874 d_getnetbyaddr_r='$d_getnetbyaddr_r'
19875 d_getnetbyname_r='$d_getnetbyname_r'
19876 d_getnetent_r='$d_getnetent_r'
19877 d_getnetprotos='$d_getnetprotos'
19878 d_getpagsz='$d_getpagsz'
19879 d_getpbyname='$d_getpbyname'
19880 d_getpbynumber='$d_getpbynumber'
19881 d_getpent='$d_getpent'
19882 d_getpgid='$d_getpgid'
19883 d_getpgrp2='$d_getpgrp2'
19884 d_getpgrp='$d_getpgrp'
19885 d_getppid='$d_getppid'
19886 d_getprior='$d_getprior'
19887 d_getprotobyname_r='$d_getprotobyname_r'
19888 d_getprotobynumber_r='$d_getprotobynumber_r'
19889 d_getprotoent_r='$d_getprotoent_r'
19890 d_getprotoprotos='$d_getprotoprotos'
19891 d_getprpwnam='$d_getprpwnam'
19892 d_getpwent='$d_getpwent'
19893 d_getpwent_r='$d_getpwent_r'
19894 d_getpwnam_r='$d_getpwnam_r'
19895 d_getpwuid_r='$d_getpwuid_r'
19896 d_getsbyname='$d_getsbyname'
19897 d_getsbyport='$d_getsbyport'
19898 d_getsent='$d_getsent'
19899 d_getservbyname_r='$d_getservbyname_r'
19900 d_getservbyport_r='$d_getservbyport_r'
19901 d_getservent_r='$d_getservent_r'
19902 d_getservprotos='$d_getservprotos'
19903 d_getspnam='$d_getspnam'
19904 d_getspnam_r='$d_getspnam_r'
19905 d_gettimeod='$d_gettimeod'
19906 d_gmtime_r='$d_gmtime_r'
19907 d_gnulibc='$d_gnulibc'
19908 d_grpasswd='$d_grpasswd'
19909 d_hasmntopt='$d_hasmntopt'
19910 d_htonl='$d_htonl'
19911 d_index='$d_index'
19912 d_inetaton='$d_inetaton'
19913 d_int64_t='$d_int64_t'
19914 d_isascii='$d_isascii'
19915 d_isfinite='$d_isfinite'
19916 d_isinf='$d_isinf'
19917 d_isnan='$d_isnan'
19918 d_isnanl='$d_isnanl'
19919 d_killpg='$d_killpg'
19920 d_lchown='$d_lchown'
19921 d_ldbl_dig='$d_ldbl_dig'
19922 d_link='$d_link'
19923 d_localtime_r='$d_localtime_r'
19924 d_locconv='$d_locconv'
19925 d_lockf='$d_lockf'
19926 d_longdbl='$d_longdbl'
19927 d_longlong='$d_longlong'
19928 d_lseekproto='$d_lseekproto'
19929 d_lstat='$d_lstat'
19930 d_madvise='$d_madvise'
19931 d_mblen='$d_mblen'
19932 d_mbstowcs='$d_mbstowcs'
19933 d_mbtowc='$d_mbtowc'
19934 d_memchr='$d_memchr'
19935 d_memcmp='$d_memcmp'
19936 d_memcpy='$d_memcpy'
19937 d_memmove='$d_memmove'
19938 d_memset='$d_memset'
19939 d_mkdir='$d_mkdir'
19940 d_mkdtemp='$d_mkdtemp'
19941 d_mkfifo='$d_mkfifo'
19942 d_mkstemp='$d_mkstemp'
19943 d_mkstemps='$d_mkstemps'
19944 d_mktime='$d_mktime'
19945 d_mmap='$d_mmap'
19946 d_modfl='$d_modfl'
19947 d_modfl_pow32_bug='$d_modfl_pow32_bug'
19948 d_modflproto='$d_modflproto'
19949 d_mprotect='$d_mprotect'
19950 d_msg='$d_msg'
19951 d_msg_ctrunc='$d_msg_ctrunc'
19952 d_msg_dontroute='$d_msg_dontroute'
19953 d_msg_oob='$d_msg_oob'
19954 d_msg_peek='$d_msg_peek'
19955 d_msg_proxy='$d_msg_proxy'
19956 d_msgctl='$d_msgctl'
19957 d_msgget='$d_msgget'
19958 d_msghdr_s='$d_msghdr_s'
19959 d_msgrcv='$d_msgrcv'
19960 d_msgsnd='$d_msgsnd'
19961 d_msync='$d_msync'
19962 d_munmap='$d_munmap'
19963 d_mymalloc='$d_mymalloc'
19964 d_nice='$d_nice'
19965 d_nl_langinfo='$d_nl_langinfo'
19966 d_nv_preserves_uv='$d_nv_preserves_uv'
19967 d_off64_t='$d_off64_t'
19968 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
19969 d_oldpthreads='$d_oldpthreads'
19970 d_oldsock='$d_oldsock'
19971 d_open3='$d_open3'
19972 d_pathconf='$d_pathconf'
19973 d_pause='$d_pause'
19974 d_perl_otherlibdirs='$d_perl_otherlibdirs'
19975 d_phostname='$d_phostname'
19976 d_pipe='$d_pipe'
19977 d_poll='$d_poll'
19978 d_portable='$d_portable'
19979 d_procselfexe='$d_procselfexe'
19980 d_pthread_atfork='$d_pthread_atfork'
19981 d_pthread_yield='$d_pthread_yield'
19982 d_pwage='$d_pwage'
19983 d_pwchange='$d_pwchange'
19984 d_pwclass='$d_pwclass'
19985 d_pwcomment='$d_pwcomment'
19986 d_pwexpire='$d_pwexpire'
19987 d_pwgecos='$d_pwgecos'
19988 d_pwpasswd='$d_pwpasswd'
19989 d_pwquota='$d_pwquota'
19990 d_qgcvt='$d_qgcvt'
19991 d_quad='$d_quad'
19992 d_random_r='$d_random_r'
19993 d_readdir64_r='$d_readdir64_r'
19994 d_readdir='$d_readdir'
19995 d_readdir_r='$d_readdir_r'
19996 d_readlink='$d_readlink'
19997 d_readv='$d_readv'
19998 d_recvmsg='$d_recvmsg'
19999 d_rename='$d_rename'
20000 d_rewinddir='$d_rewinddir'
20001 d_rmdir='$d_rmdir'
20002 d_safebcpy='$d_safebcpy'
20003 d_safemcpy='$d_safemcpy'
20004 d_sanemcmp='$d_sanemcmp'
20005 d_sbrkproto='$d_sbrkproto'
20006 d_sched_yield='$d_sched_yield'
20007 d_scm_rights='$d_scm_rights'
20008 d_seekdir='$d_seekdir'
20009 d_select='$d_select'
20010 d_sem='$d_sem'
20011 d_semctl='$d_semctl'
20012 d_semctl_semid_ds='$d_semctl_semid_ds'
20013 d_semctl_semun='$d_semctl_semun'
20014 d_semget='$d_semget'
20015 d_semop='$d_semop'
20016 d_sendmsg='$d_sendmsg'
20017 d_setegid='$d_setegid'
20018 d_seteuid='$d_seteuid'
20019 d_setgrent='$d_setgrent'
20020 d_setgrent_r='$d_setgrent_r'
20021 d_setgrps='$d_setgrps'
20022 d_sethent='$d_sethent'
20023 d_sethostent_r='$d_sethostent_r'
20024 d_setitimer='$d_setitimer'
20025 d_setlinebuf='$d_setlinebuf'
20026 d_setlocale='$d_setlocale'
20027 d_setlocale_r='$d_setlocale_r'
20028 d_setnent='$d_setnent'
20029 d_setnetent_r='$d_setnetent_r'
20030 d_setpent='$d_setpent'
20031 d_setpgid='$d_setpgid'
20032 d_setpgrp2='$d_setpgrp2'
20033 d_setpgrp='$d_setpgrp'
20034 d_setprior='$d_setprior'
20035 d_setproctitle='$d_setproctitle'
20036 d_setprotoent_r='$d_setprotoent_r'
20037 d_setpwent='$d_setpwent'
20038 d_setpwent_r='$d_setpwent_r'
20039 d_setregid='$d_setregid'
20040 d_setresgid='$d_setresgid'
20041 d_setresuid='$d_setresuid'
20042 d_setreuid='$d_setreuid'
20043 d_setrgid='$d_setrgid'
20044 d_setruid='$d_setruid'
20045 d_setsent='$d_setsent'
20046 d_setservent_r='$d_setservent_r'
20047 d_setsid='$d_setsid'
20048 d_setvbuf='$d_setvbuf'
20049 d_sfio='$d_sfio'
20050 d_shm='$d_shm'
20051 d_shmat='$d_shmat'
20052 d_shmatprototype='$d_shmatprototype'
20053 d_shmctl='$d_shmctl'
20054 d_shmdt='$d_shmdt'
20055 d_shmget='$d_shmget'
20056 d_sigaction='$d_sigaction'
20057 d_sigprocmask='$d_sigprocmask'
20058 d_sigsetjmp='$d_sigsetjmp'
20059 d_sockatmark='$d_sockatmark'
20060 d_sockatmarkproto='$d_sockatmarkproto'
20061 d_socket='$d_socket'
20062 d_socklen_t='$d_socklen_t'
20063 d_sockpair='$d_sockpair'
20064 d_socks5_init='$d_socks5_init'
20065 d_sqrtl='$d_sqrtl'
20066 d_srand48_r='$d_srand48_r'
20067 d_srandom_r='$d_srandom_r'
20068 d_sresgproto='$d_sresgproto'
20069 d_sresuproto='$d_sresuproto'
20070 d_statblks='$d_statblks'
20071 d_statfs_f_flags='$d_statfs_f_flags'
20072 d_statfs_s='$d_statfs_s'
20073 d_statvfs='$d_statvfs'
20074 d_stdio_cnt_lval='$d_stdio_cnt_lval'
20075 d_stdio_ptr_lval='$d_stdio_ptr_lval'
20076 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
20077 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
20078 d_stdio_stream_array='$d_stdio_stream_array'
20079 d_stdiobase='$d_stdiobase'
20080 d_stdstdio='$d_stdstdio'
20081 d_strchr='$d_strchr'
20082 d_strcoll='$d_strcoll'
20083 d_strctcpy='$d_strctcpy'
20084 d_strerrm='$d_strerrm'
20085 d_strerror='$d_strerror'
20086 d_strerror_r='$d_strerror_r'
20087 d_strftime='$d_strftime'
20088 d_strtod='$d_strtod'
20089 d_strtol='$d_strtol'
20090 d_strtold='$d_strtold'
20091 d_strtoll='$d_strtoll'
20092 d_strtoq='$d_strtoq'
20093 d_strtoul='$d_strtoul'
20094 d_strtoull='$d_strtoull'
20095 d_strtouq='$d_strtouq'
20096 d_strxfrm='$d_strxfrm'
20097 d_suidsafe='$d_suidsafe'
20098 d_symlink='$d_symlink'
20099 d_syscall='$d_syscall'
20100 d_syscallproto='$d_syscallproto'
20101 d_sysconf='$d_sysconf'
20102 d_sysernlst='$d_sysernlst'
20103 d_syserrlst='$d_syserrlst'
20104 d_system='$d_system'
20105 d_tcgetpgrp='$d_tcgetpgrp'
20106 d_tcsetpgrp='$d_tcsetpgrp'
20107 d_telldir='$d_telldir'
20108 d_telldirproto='$d_telldirproto'
20109 d_time='$d_time'
20110 d_times='$d_times'
20111 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
20112 d_tm_tm_zone='$d_tm_tm_zone'
20113 d_tmpnam_r='$d_tmpnam_r'
20114 d_truncate='$d_truncate'
20115 d_ttyname_r='$d_ttyname_r'
20116 d_tzname='$d_tzname'
20117 d_u32align='$d_u32align'
20118 d_ualarm='$d_ualarm'
20119 d_umask='$d_umask'
20120 d_uname='$d_uname'
20121 d_union_semun='$d_union_semun'
20122 d_unordered='$d_unordered'
20123 d_usleep='$d_usleep'
20124 d_usleepproto='$d_usleepproto'
20125 d_ustat='$d_ustat'
20126 d_vendorarch='$d_vendorarch'
20127 d_vendorbin='$d_vendorbin'
20128 d_vendorlib='$d_vendorlib'
20129 d_vfork='$d_vfork'
20130 d_void_closedir='$d_void_closedir'
20131 d_voidsig='$d_voidsig'
20132 d_voidtty='$d_voidtty'
20133 d_volatile='$d_volatile'
20134 d_vprintf='$d_vprintf'
20135 d_wait4='$d_wait4'
20136 d_waitpid='$d_waitpid'
20137 d_wcstombs='$d_wcstombs'
20138 d_wctomb='$d_wctomb'
20139 d_writev='$d_writev'
20140 d_xenix='$d_xenix'
20141 date='$date'
20142 db_hashtype='$db_hashtype'
20143 db_prefixtype='$db_prefixtype'
20144 db_version_major='$db_version_major'
20145 db_version_minor='$db_version_minor'
20146 db_version_patch='$db_version_patch'
20147 defvoidused='$defvoidused'
20148 direntrytype='$direntrytype'
20149 dlext='$dlext'
20150 dlsrc='$dlsrc'
20151 doublesize='$doublesize'
20152 drand01='$drand01'
20153 drand48_r_proto='$drand48_r_proto'
20154 dynamic_ext='$dynamic_ext'
20155 eagain='$eagain'
20156 ebcdic='$ebcdic'
20157 echo='$echo'
20158 egrep='$egrep'
20159 emacs='$emacs'
20160 endgrent_r_proto='$endgrent_r_proto'
20161 endhostent_r_proto='$endhostent_r_proto'
20162 endnetent_r_proto='$endnetent_r_proto'
20163 endprotoent_r_proto='$endprotoent_r_proto'
20164 endpwent_r_proto='$endpwent_r_proto'
20165 endservent_r_proto='$endservent_r_proto'
20166 eunicefix='$eunicefix'
20167 exe_ext='$exe_ext'
20168 expr='$expr'
20169 extensions='$extensions'
20170 extras='$extras'
20171 fflushNULL='$fflushNULL'
20172 fflushall='$fflushall'
20173 find='$find'
20174 firstmakefile='$firstmakefile'
20175 flex='$flex'
20176 fpossize='$fpossize'
20177 fpostype='$fpostype'
20178 freetype='$freetype'
20179 from='$from'
20180 full_ar='$full_ar'
20181 full_csh='$full_csh'
20182 full_sed='$full_sed'
20183 gccosandvers='$gccosandvers'
20184 gccversion='$gccversion'
20185 getgrent_r_proto='$getgrent_r_proto'
20186 getgrgid_r_proto='$getgrgid_r_proto'
20187 getgrnam_r_proto='$getgrnam_r_proto'
20188 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
20189 gethostbyname_r_proto='$gethostbyname_r_proto'
20190 gethostent_r_proto='$gethostent_r_proto'
20191 getlogin_r_proto='$getlogin_r_proto'
20192 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
20193 getnetbyname_r_proto='$getnetbyname_r_proto'
20194 getnetent_r_proto='$getnetent_r_proto'
20195 getprotobyname_r_proto='$getprotobyname_r_proto'
20196 getprotobynumber_r_proto='$getprotobynumber_r_proto'
20197 getprotoent_r_proto='$getprotoent_r_proto'
20198 getpwent_r_proto='$getpwent_r_proto'
20199 getpwnam_r_proto='$getpwnam_r_proto'
20200 getpwuid_r_proto='$getpwuid_r_proto'
20201 getservbyname_r_proto='$getservbyname_r_proto'
20202 getservbyport_r_proto='$getservbyport_r_proto'
20203 getservent_r_proto='$getservent_r_proto'
20204 getspnam_r_proto='$getspnam_r_proto'
20205 gidformat='$gidformat'
20206 gidsign='$gidsign'
20207 gidsize='$gidsize'
20208 gidtype='$gidtype'
20209 glibpth='$glibpth'
20210 gmake='$gmake'
20211 gmtime_r_proto='$gmtime_r_proto'
20212 gnulibc_version='$gnulibc_version'
20213 grep='$grep'
20214 groupcat='$groupcat'
20215 groupstype='$groupstype'
20216 gzip='$gzip'
20217 h_fcntl='$h_fcntl'
20218 h_sysfile='$h_sysfile'
20219 hint='$hint'
20220 hostcat='$hostcat'
20221 i16size='$i16size'
20222 i16type='$i16type'
20223 i32size='$i32size'
20224 i32type='$i32type'
20225 i64size='$i64size'
20226 i64type='$i64type'
20227 i8size='$i8size'
20228 i8type='$i8type'
20229 i_arpainet='$i_arpainet'
20230 i_bsdioctl='$i_bsdioctl'
20231 i_crypt='$i_crypt'
20232 i_db='$i_db'
20233 i_dbm='$i_dbm'
20234 i_dirent='$i_dirent'
20235 i_dld='$i_dld'
20236 i_dlfcn='$i_dlfcn'
20237 i_fcntl='$i_fcntl'
20238 i_float='$i_float'
20239 i_fp='$i_fp'
20240 i_fp_class='$i_fp_class'
20241 i_gdbm='$i_gdbm'
20242 i_grp='$i_grp'
20243 i_ieeefp='$i_ieeefp'
20244 i_inttypes='$i_inttypes'
20245 i_langinfo='$i_langinfo'
20246 i_libutil='$i_libutil'
20247 i_limits='$i_limits'
20248 i_locale='$i_locale'
20249 i_machcthr='$i_machcthr'
20250 i_malloc='$i_malloc'
20251 i_math='$i_math'
20252 i_memory='$i_memory'
20253 i_mntent='$i_mntent'
20254 i_ndbm='$i_ndbm'
20255 i_netdb='$i_netdb'
20256 i_neterrno='$i_neterrno'
20257 i_netinettcp='$i_netinettcp'
20258 i_niin='$i_niin'
20259 i_poll='$i_poll'
20260 i_prot='$i_prot'
20261 i_pthread='$i_pthread'
20262 i_pwd='$i_pwd'
20263 i_rpcsvcdbm='$i_rpcsvcdbm'
20264 i_sfio='$i_sfio'
20265 i_sgtty='$i_sgtty'
20266 i_shadow='$i_shadow'
20267 i_socks='$i_socks'
20268 i_stdarg='$i_stdarg'
20269 i_stddef='$i_stddef'
20270 i_stdlib='$i_stdlib'
20271 i_string='$i_string'
20272 i_sunmath='$i_sunmath'
20273 i_sysaccess='$i_sysaccess'
20274 i_sysdir='$i_sysdir'
20275 i_sysfile='$i_sysfile'
20276 i_sysfilio='$i_sysfilio'
20277 i_sysin='$i_sysin'
20278 i_sysioctl='$i_sysioctl'
20279 i_syslog='$i_syslog'
20280 i_sysmman='$i_sysmman'
20281 i_sysmode='$i_sysmode'
20282 i_sysmount='$i_sysmount'
20283 i_sysndir='$i_sysndir'
20284 i_sysparam='$i_sysparam'
20285 i_sysresrc='$i_sysresrc'
20286 i_syssecrt='$i_syssecrt'
20287 i_sysselct='$i_sysselct'
20288 i_syssockio='$i_syssockio'
20289 i_sysstat='$i_sysstat'
20290 i_sysstatfs='$i_sysstatfs'
20291 i_sysstatvfs='$i_sysstatvfs'
20292 i_systime='$i_systime'
20293 i_systimek='$i_systimek'
20294 i_systimes='$i_systimes'
20295 i_systypes='$i_systypes'
20296 i_sysuio='$i_sysuio'
20297 i_sysun='$i_sysun'
20298 i_sysutsname='$i_sysutsname'
20299 i_sysvfs='$i_sysvfs'
20300 i_syswait='$i_syswait'
20301 i_termio='$i_termio'
20302 i_termios='$i_termios'
20303 i_time='$i_time'
20304 i_unistd='$i_unistd'
20305 i_ustat='$i_ustat'
20306 i_utime='$i_utime'
20307 i_values='$i_values'
20308 i_varargs='$i_varargs'
20309 i_varhdr='$i_varhdr'
20310 i_vfork='$i_vfork'
20311 ignore_versioned_solibs='$ignore_versioned_solibs'
20312 inc_version_list='$inc_version_list'
20313 inc_version_list_init='$inc_version_list_init'
20314 incpath='$incpath'
20315 inews='$inews'
20316 installarchlib='$installarchlib'
20317 installbin='$installbin'
20318 installman1dir='$installman1dir'
20319 installman3dir='$installman3dir'
20320 installprefix='$installprefix'
20321 installprefixexp='$installprefixexp'
20322 installprivlib='$installprivlib'
20323 installscript='$installscript'
20324 installsitearch='$installsitearch'
20325 installsitebin='$installsitebin'
20326 installsitelib='$installsitelib'
20327 installstyle='$installstyle'
20328 installusrbinperl='$installusrbinperl'
20329 installvendorarch='$installvendorarch'
20330 installvendorbin='$installvendorbin'
20331 installvendorlib='$installvendorlib'
20332 intsize='$intsize'
20333 issymlink='$issymlink'
20334 ivdformat='$ivdformat'
20335 ivsize='$ivsize'
20336 ivtype='$ivtype'
20337 known_extensions='$known_extensions'
20338 ksh='$ksh'
20339 ld='$ld'
20340 lddlflags='$lddlflags'
20341 ldflags='$ldflags'
20342 ldflags_uselargefiles='$ldflags_uselargefiles'
20343 ldlibpthname='$ldlibpthname'
20344 less='$less'
20345 lib_ext='$lib_ext'
20346 libc='$libc'
20347 libperl='$libperl'
20348 libpth='$libpth'
20349 libs='$libs'
20350 libsdirs='$libsdirs'
20351 libsfiles='$libsfiles'
20352 libsfound='$libsfound'
20353 libspath='$libspath'
20354 libswanted='$libswanted'
20355 libswanted_uselargefiles='$libswanted_uselargefiles'
20356 line='$line'
20357 lint='$lint'
20358 lkflags='$lkflags'
20359 ln='$ln'
20360 lns='$lns'
20361 localtime_r_proto='$localtime_r_proto'
20362 locincpth='$locincpth'
20363 loclibpth='$loclibpth'
20364 longdblsize='$longdblsize'
20365 longlongsize='$longlongsize'
20366 longsize='$longsize'
20367 lp='$lp'
20368 lpr='$lpr'
20369 ls='$ls'
20370 lseeksize='$lseeksize'
20371 lseektype='$lseektype'
20372 mail='$mail'
20373 mailx='$mailx'
20374 make='$make'
20375 make_set_make='$make_set_make'
20376 mallocobj='$mallocobj'
20377 mallocsrc='$mallocsrc'
20378 malloctype='$malloctype'
20379 man1dir='$man1dir'
20380 man1direxp='$man1direxp'
20381 man1ext='$man1ext'
20382 man3dir='$man3dir'
20383 man3direxp='$man3direxp'
20384 man3ext='$man3ext'
20385 mips_type='$mips_type'
20386 mkdir='$mkdir'
20387 mmaptype='$mmaptype'
20388 modetype='$modetype'
20389 more='$more'
20390 multiarch='$multiarch'
20391 mv='$mv'
20392 myarchname='$myarchname'
20393 mydomain='$mydomain'
20394 myhostname='$myhostname'
20395 myuname='$myuname'
20396 n='$n'
20397 need_va_copy='$need_va_copy'
20398 netdb_hlen_type='$netdb_hlen_type'
20399 netdb_host_type='$netdb_host_type'
20400 netdb_name_type='$netdb_name_type'
20401 netdb_net_type='$netdb_net_type'
20402 nm='$nm'
20403 nm_opt='$nm_opt'
20404 nm_so_opt='$nm_so_opt'
20405 nonxs_ext='$nonxs_ext'
20406 nroff='$nroff'
20407 nvEUformat='$nvEUformat'
20408 nvFUformat='$nvFUformat'
20409 nvGUformat='$nvGUformat'
20410 nv_preserves_uv_bits='$nv_preserves_uv_bits'
20411 nveformat='$nveformat'
20412 nvfformat='$nvfformat'
20413 nvgformat='$nvgformat'
20414 nvsize='$nvsize'
20415 nvtype='$nvtype'
20416 o_nonblock='$o_nonblock'
20417 obj_ext='$obj_ext'
20418 old_pthread_create_joinable='$old_pthread_create_joinable'
20419 optimize='$optimize'
20420 orderlib='$orderlib'
20421 osname='$osname'
20422 osvers='$osvers'
20423 otherlibdirs='$otherlibdirs'
20424 package='$package'
20425 pager='$pager'
20426 passcat='$passcat'
20427 patchlevel='$patchlevel'
20428 path_sep='$path_sep'
20429 perl5='$perl5'
20430 perl='$perl'
20431 perl_patchlevel='$perl_patchlevel'
20432 perladmin='$perladmin'
20433 perllibs='$perllibs'
20434 perlpath='$perlpath'
20435 pg='$pg'
20436 phostname='$phostname'
20437 pidtype='$pidtype'
20438 plibpth='$plibpth'
20439 pm_apiversion='$pm_apiversion'
20440 pmake='$pmake'
20441 pr='$pr'
20442 prefix='$prefix'
20443 prefixexp='$prefixexp'
20444 privlib='$privlib'
20445 privlibexp='$privlibexp'
20446 procselfexe='$procselfexe'
20447 prototype='$prototype'
20448 ptrsize='$ptrsize'
20449 quadkind='$quadkind'
20450 quadtype='$quadtype'
20451 randbits='$randbits'
20452 randfunc='$randfunc'
20453 random_r_proto='$random_r_proto'
20454 randseedtype='$randseedtype'
20455 ranlib='$ranlib'
20456 rd_nodata='$rd_nodata'
20457 readdir64_r_proto='$readdir64_r_proto'
20458 readdir_r_proto='$readdir_r_proto'
20459 revision='$revision'
20460 rm='$rm'
20461 rmail='$rmail'
20462 run='$run'
20463 runnm='$runnm'
20464 sPRIEUldbl='$sPRIEUldbl'
20465 sPRIFUldbl='$sPRIFUldbl'
20466 sPRIGUldbl='$sPRIGUldbl'
20467 sPRIXU64='$sPRIXU64'
20468 sPRId64='$sPRId64'
20469 sPRIeldbl='$sPRIeldbl'
20470 sPRIfldbl='$sPRIfldbl'
20471 sPRIgldbl='$sPRIgldbl'
20472 sPRIi64='$sPRIi64'
20473 sPRIo64='$sPRIo64'
20474 sPRIu64='$sPRIu64'
20475 sPRIx64='$sPRIx64'
20476 sSCNfldbl='$sSCNfldbl'
20477 sched_yield='$sched_yield'
20478 scriptdir='$scriptdir'
20479 scriptdirexp='$scriptdirexp'
20480 sed='$sed'
20481 seedfunc='$seedfunc'
20482 selectminbits='$selectminbits'
20483 selecttype='$selecttype'
20484 sendmail='$sendmail'
20485 setgrent_r_proto='$setgrent_r_proto'
20486 sethostent_r_proto='$sethostent_r_proto'
20487 setlocale_r_proto='$setlocale_r_proto'
20488 setnetent_r_proto='$setnetent_r_proto'
20489 setprotoent_r_proto='$setprotoent_r_proto'
20490 setpwent_r_proto='$setpwent_r_proto'
20491 setservent_r_proto='$setservent_r_proto'
20492 sh='$sh'
20493 shar='$shar'
20494 sharpbang='$sharpbang'
20495 shmattype='$shmattype'
20496 shortsize='$shortsize'
20497 shrpenv='$shrpenv'
20498 shsharp='$shsharp'
20499 sig_count='$sig_count'
20500 sig_name='$sig_name'
20501 sig_name_init='$sig_name_init'
20502 sig_num='$sig_num'
20503 sig_num_init='$sig_num_init'
20504 sig_size='$sig_size'
20505 signal_t='$signal_t'
20506 sitearch='$sitearch'
20507 sitearchexp='$sitearchexp'
20508 sitebin='$sitebin'
20509 sitebinexp='$sitebinexp'
20510 sitelib='$sitelib'
20511 sitelib_stem='$sitelib_stem'
20512 sitelibexp='$sitelibexp'
20513 siteprefix='$siteprefix'
20514 siteprefixexp='$siteprefixexp'
20515 sizesize='$sizesize'
20516 sizetype='$sizetype'
20517 sleep='$sleep'
20518 smail='$smail'
20519 so='$so'
20520 sockethdr='$sockethdr'
20521 socketlib='$socketlib'
20522 socksizetype='$socksizetype'
20523 sort='$sort'
20524 spackage='$spackage'
20525 spitshell='$spitshell'
20526 srand48_r_proto='$srand48_r_proto'
20527 srandom_r_proto='$srandom_r_proto'
20528 src='$src'
20529 ssizetype='$ssizetype'
20530 startperl='$startperl'
20531 startsh='$startsh'
20532 static_ext='$static_ext'
20533 stdchar='$stdchar'
20534 stdio_base='$stdio_base'
20535 stdio_bufsiz='$stdio_bufsiz'
20536 stdio_cnt='$stdio_cnt'
20537 stdio_filbuf='$stdio_filbuf'
20538 stdio_ptr='$stdio_ptr'
20539 stdio_stream_array='$stdio_stream_array'
20540 strerror_r_proto='$strerror_r_proto'
20541 strings='$strings'
20542 submit='$submit'
20543 subversion='$subversion'
20544 sysman='$sysman'
20545 tail='$tail'
20546 tar='$tar'
20547 targetarch='$targetarch'
20548 tbl='$tbl'
20549 tee='$tee'
20550 test='$test'
20551 timeincl='$timeincl'
20552 timetype='$timetype'
20553 tmpnam_r_proto='$tmpnam_r_proto'
20554 to='$to'
20555 touch='$touch'
20556 tr='$tr'
20557 trnl='$trnl'
20558 troff='$troff'
20559 ttyname_r_proto='$ttyname_r_proto'
20560 u16size='$u16size'
20561 u16type='$u16type'
20562 u32size='$u32size'
20563 u32type='$u32type'
20564 u64size='$u64size'
20565 u64type='$u64type'
20566 u8size='$u8size'
20567 u8type='$u8type'
20568 uidformat='$uidformat'
20569 uidsign='$uidsign'
20570 uidsize='$uidsize'
20571 uidtype='$uidtype'
20572 uname='$uname'
20573 uniq='$uniq'
20574 uquadtype='$uquadtype'
20575 use5005threads='$use5005threads'
20576 use64bitall='$use64bitall'
20577 use64bitint='$use64bitint'
20578 usecrosscompile='$usecrosscompile'
20579 usedl='$usedl'
20580 useithreads='$useithreads'
20581 uselargefiles='$uselargefiles'
20582 uselongdouble='$uselongdouble'
20583 usemorebits='$usemorebits'
20584 usemultiplicity='$usemultiplicity'
20585 usemymalloc='$usemymalloc'
20586 usenm='$usenm'
20587 useopcode='$useopcode'
20588 useperlio='$useperlio'
20589 useposix='$useposix'
20590 usereentrant='$usereentrant'
20591 usesfio='$usesfio'
20592 useshrplib='$useshrplib'
20593 usesocks='$usesocks'
20594 usethreads='$usethreads'
20595 usevendorprefix='$usevendorprefix'
20596 usevfork='$usevfork'
20597 usrinc='$usrinc'
20598 uuname='$uuname'
20599 uvXUformat='$uvXUformat'
20600 uvoformat='$uvoformat'
20601 uvsize='$uvsize'
20602 uvtype='$uvtype'
20603 uvuformat='$uvuformat'
20604 uvxformat='$uvxformat'
20605 vendorarch='$vendorarch'
20606 vendorarchexp='$vendorarchexp'
20607 vendorbin='$vendorbin'
20608 vendorbinexp='$vendorbinexp'
20609 vendorlib='$vendorlib'
20610 vendorlib_stem='$vendorlib_stem'
20611 vendorlibexp='$vendorlibexp'
20612 vendorprefix='$vendorprefix'
20613 vendorprefixexp='$vendorprefixexp'
20614 version='$version'
20615 version_patchlevel_string='$version_patchlevel_string'
20616 versiononly='$versiononly'
20617 vi='$vi'
20618 voidflags='$voidflags'
20619 xlibpth='$xlibpth'
20620 xs_apiversion='$xs_apiversion'
20621 yacc='$yacc'
20622 yaccflags='$yaccflags'
20623 zcat='$zcat'
20624 zip='$zip'
20625 EOT
20626
20627 : Add in command line options if available
20628 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
20629
20630 : add special variables
20631 $test -f $src/patchlevel.h && \
20632 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
20633 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
20634 echo "PERL_CONFIG_SH=true" >>config.sh
20635
20636 : propagate old symbols
20637 if $test -f UU/config.sh; then
20638         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
20639         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
20640         $sort | $uniq -u >UU/oldsyms
20641         set X `cat UU/oldsyms`
20642         shift
20643         case $# in
20644         0) ;;
20645         *)
20646                 cat <<EOM
20647 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
20648 EOM
20649                 echo "# Variables propagated from previous config.sh file." >>config.sh
20650                 for sym in `cat UU/oldsyms`; do
20651                         echo "    Propagating $hint variable "'$'"$sym..."
20652                         eval 'tmp="$'"${sym}"'"'
20653                         echo "$tmp" | \
20654                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
20655                 done
20656                 ;;
20657         esac
20658 fi
20659
20660 : Finish up by extracting the .SH files
20661 case "$alldone" in
20662 exit)
20663         $rm -rf UU
20664         echo "Extraction done."
20665         exit 0
20666         ;;
20667 cont)
20668         ;;
20669 '')
20670         dflt=''
20671         nostick=true
20672         $cat <<EOM
20673
20674 If you'd like to make any changes to the config.sh file before I begin
20675 to configure things, do it as a shell escape now (e.g. !vi config.sh).
20676
20677 EOM
20678         rp="Press return or use a shell escape to edit config.sh:"
20679         . UU/myread
20680         nostick=''
20681         case "$ans" in
20682         '') ;;
20683         *) : in case they cannot read
20684                 sh 1>&4 -c "$ans";;
20685         esac
20686         ;;
20687 esac
20688
20689 : if this fails, just run all the .SH files by hand
20690 . ./config.sh
20691
20692 echo " "
20693 exec 1>&4
20694 pwd=`pwd`
20695 . ./UU/extract
20696 cd "$pwd"
20697
20698 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
20699         dflt=y
20700         case "$silent" in
20701         true) ;;
20702         *)
20703                 $cat <<EOM
20704
20705 Now you need to generate make dependencies by running "$make depend".
20706 You might prefer to run it in background: "$make depend > makedepend.out &"
20707 It can take a while, so you might not want to run it right now.
20708
20709 EOM
20710                 ;;
20711         esac
20712         rp="Run $make depend now?"
20713         . UU/myread
20714         case "$ans" in
20715         y*)
20716                 $make depend && echo "Now you must run '$make'."
20717                 ;;
20718         *)
20719                 echo "You must run '$make depend' then '$make'."
20720                 ;;
20721         esac
20722 elif test -f [Mm]akefile; then
20723         echo " "
20724         echo "Now you must run a $make."
20725 else
20726         echo "Configure done."
20727 fi
20728
20729 if $test -f Policy.sh; then
20730     $cat <<EOM
20731
20732 If you compile $package on a different machine or from a different object
20733 directory, copy the Policy.sh file from this object directory to the
20734 new one before you run Configure -- this will help you with most of
20735 the policy defaults.
20736
20737 EOM
20738 fi
20739 if $test -f config.msg; then
20740     echo "Hmm.  I also noted the following information while running:"
20741     echo " "
20742     $cat config.msg >&4
20743     $rm -f config.msg
20744 fi
20745 $rm -f kit*isdone ark*isdone
20746 $rm -rf UU
20747
20748 : End of Configure
20749