const declaration fixup
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Tue Jan 21 18:59:19 MET 2003 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.org)
25
26 cat >c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat c1$$ c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f c1$$ c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 case "X${MACHTYPE:-nonesuchmach}" in
69                 *cygwin) ;;
70                 *) p_=\; ;;
71                 esac
72         fi
73 fi
74
75 : Proper PATH setting
76 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
77 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
78 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
79 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
80 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
81 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
82 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
83 paths="$paths /sbin /usr/sbin /usr/libexec"
84 paths="$paths /system/gnu_library/bin"
85
86 for p in $paths
87 do
88         case "$p_$PATH$p_" in
89         *$p_$p$p_*) ;;
90         *) test -d $p && PATH=$PATH$p_$p ;;
91         esac
92 done
93
94 PATH=.$p_$PATH
95 export PATH
96
97 : shall we be using ksh?
98 inksh=''
99 needksh=''
100 avoidksh=''
101 newsh=/bin/ksh
102 changesh=''
103 if (PATH=.; alias -x) >/dev/null 2>&1; then
104                 inksh=true
105 fi
106 if test -f /hp-ux -a -f /bin/ksh; then
107         needksh='to avoid sh bug in "here document" expansion'
108 fi
109 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
110         if test X`/usr/bin/uname -v` = X4; then
111                 avoidksh="to avoid AIX 4's /bin/sh"
112                 newsh=/usr/bin/bsh
113         fi
114 fi
115 if test -f /osf_boot -a -f /usr/sbin/setld; then
116         if test X`/usr/bin/uname -s` = XOSF1; then
117                 avoidksh="to avoid Digital UNIX' ksh"
118                 newsh=/bin/sh
119                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
120         fi
121 fi
122 case "$inksh/$needksh" in
123 /[a-z]*)
124                 ENV=''
125                 changesh=true
126                 reason="$needksh"
127         ;;
128 esac
129 case "$inksh/$avoidksh" in
130 true/[a-z]*)
131         changesh=true
132         reason="$avoidksh"
133         ;;
134 esac
135 case "$inksh/$needksh-$avoidksh-" in
136 true/--)
137                 cat <<EOM
138 (I see you are using the Korn shell.  Some ksh's blow up on $me,
139 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
140 EOM
141         ;;
142 esac
143 case "$changesh" in
144 true)
145         export newsh
146         echo "(Feeding myself to $newsh $reason.)"
147         case "$0" in
148         Configure|*/Configure) exec $newsh $0 "$@";;
149         *) exec $newsh Configure "$@";;
150         esac
151         ;;
152 esac
153
154 : if needed set CDPATH to a harmless value that is not chatty
155 : avoid bash 2.02 problems with empty CDPATH.
156 case "$CDPATH" in
157 '')     ;;
158 *)      case "$SHELL" in
159         *bash*) CDPATH='.' ;;
160         *)              CDPATH='' ;;
161         esac
162         ;;
163 esac
164 : Configure runs within the UU subdirectory
165 test -d UU || mkdir UU
166 cd UU && rm -f ./*
167
168
169 ccname=''
170 ccversion=''
171 ccsymbols=''
172 cppccsymbols=''
173 cppsymbols=''
174 from=''
175 run=''
176 targetarch=''
177 to=''
178 usecrosscompile=''
179 perllibs=''
180 dynamic_ext=''
181 extensions=''
182 known_extensions=''
183 nonxs_ext=''
184 static_ext=''
185 useopcode=''
186 useposix=''
187 extras=''
188 d_bsd=''
189 d_eunice=''
190 d_xenix=''
191 eunicefix=''
192 Mcc=''
193 ar=''
194 awk=''
195 bash=''
196 bison=''
197 byacc=''
198 cat=''
199 chgrp=''
200 chmod=''
201 chown=''
202 comm=''
203 compress=''
204 cp=''
205 cpio=''
206 cpp=''
207 csh=''
208 date=''
209 echo=''
210 egrep=''
211 emacs=''
212 expr=''
213 find=''
214 flex=''
215 gmake=''
216 grep=''
217 gzip=''
218 inews=''
219 ksh=''
220 less=''
221 line=''
222 lint=''
223 ln=''
224 lp=''
225 lpr=''
226 ls=''
227 mail=''
228 mailx=''
229 make=''
230 mkdir=''
231 more=''
232 mv=''
233 nm=''
234 nroff=''
235 perl=''
236 pg=''
237 pmake=''
238 pr=''
239 rm=''
240 rmail=''
241 sed=''
242 sendmail=''
243 shar=''
244 sleep=''
245 smail=''
246 sort=''
247 submit=''
248 tail=''
249 tar=''
250 tbl=''
251 tee=''
252 test=''
253 touch=''
254 tr=''
255 troff=''
256 uname=''
257 uniq=''
258 uuname=''
259 vi=''
260 zcat=''
261 zip=''
262 full_ar=''
263 full_sed=''
264 libswanted=''
265 hint=''
266 myuname=''
267 osname=''
268 osvers=''
269 Author=''
270 Date=''
271 Header=''
272 Id=''
273 Locker=''
274 Log=''
275 RCSfile=''
276 Revision=''
277 Source=''
278 State=''
279 _a=''
280 _exe=''
281 _o=''
282 archobjs=''
283 exe_ext=''
284 firstmakefile=''
285 lib_ext=''
286 obj_ext=''
287 path_sep=''
288 afs=''
289 afsroot=''
290 alignbytes=''
291 ansi2knr=''
292 archlib=''
293 archlibexp=''
294 d_archlib=''
295 installarchlib=''
296 archname=''
297 myarchname=''
298 d_atolf=''
299 d_atoll=''
300 baserev=''
301 bin=''
302 binexp=''
303 installbin=''
304 byteorder=''
305 cc=''
306 ccflags=''
307 cppflags=''
308 ldflags=''
309 lkflags=''
310 locincpth=''
311 optimize=''
312 cf_email=''
313 cf_by=''
314 cf_time=''
315 charsize=''
316 contains=''
317 cpp_stuff=''
318 cpplast=''
319 cppminus=''
320 cpprun=''
321 cppstdin=''
322 d__fwalk=''
323 d_access=''
324 d_accessx=''
325 d_alarm=''
326 asctime_r_proto=''
327 d_asctime_r=''
328 d_attribut=''
329 d_bcmp=''
330 d_bcopy=''
331 d_bzero=''
332 d_casti32=''
333 castflags=''
334 d_castneg=''
335 d_chown=''
336 d_chroot=''
337 d_chsize=''
338 d_class=''
339 d_closedir=''
340 d_void_closedir=''
341 d_cmsghdr_s=''
342 d_const=''
343 cryptlib=''
344 d_crypt=''
345 crypt_r_proto=''
346 d_crypt_r=''
347 d_csh=''
348 full_csh=''
349 ctermid_r_proto=''
350 d_ctermid_r=''
351 ctime_r_proto=''
352 d_ctime_r=''
353 d_cuserid=''
354 d_dbl_dig=''
355 d_dbminitproto=''
356 d_difftime=''
357 d_dirfd=''
358 d_dlerror=''
359 d_dlopen=''
360 d_dlsymun=''
361 d_dosuid=''
362 d_suidsafe=''
363 d_drand48_r=''
364 drand48_r_proto=''
365 d_drand48proto=''
366 d_dup2=''
367 d_eaccess=''
368 d_endgrent=''
369 d_endgrent_r=''
370 endgrent_r_proto=''
371 d_endhent=''
372 d_endhostent_r=''
373 endhostent_r_proto=''
374 d_endnent=''
375 d_endnetent_r=''
376 endnetent_r_proto=''
377 d_endpent=''
378 d_endprotoent_r=''
379 endprotoent_r_proto=''
380 d_endpwent=''
381 d_endpwent_r=''
382 endpwent_r_proto=''
383 d_endsent=''
384 d_endservent_r=''
385 endservent_r_proto=''
386 d_fchdir=''
387 d_fchmod=''
388 d_fchown=''
389 d_fcntl=''
390 d_fcntl_can_lock=''
391 d_fd_macros=''
392 d_fd_set=''
393 d_fds_bits=''
394 d_fgetpos=''
395 d_finite=''
396 d_finitel=''
397 d_flexfnam=''
398 d_flock=''
399 d_flockproto=''
400 d_fork=''
401 d_fp_class=''
402 d_fpclass=''
403 d_fpclassify=''
404 d_fpclassl=''
405 d_fpos64_t=''
406 d_frexpl=''
407 d_fs_data_s=''
408 d_fseeko=''
409 d_fsetpos=''
410 d_fstatfs=''
411 d_fsync=''
412 d_ftello=''
413 d_ftime=''
414 d_gettimeod=''
415 d_Gconvert=''
416 d_getcwd=''
417 d_getespwnam=''
418 d_getfsstat=''
419 d_getgrent=''
420 d_getgrent_r=''
421 getgrent_r_proto=''
422 d_getgrgid_r=''
423 getgrgid_r_proto=''
424 d_getgrnam_r=''
425 getgrnam_r_proto=''
426 d_getgrps=''
427 d_gethbyaddr=''
428 d_gethbyname=''
429 d_gethent=''
430 aphostname=''
431 d_gethname=''
432 d_phostname=''
433 d_uname=''
434 d_gethostbyaddr_r=''
435 gethostbyaddr_r_proto=''
436 d_gethostbyname_r=''
437 gethostbyname_r_proto=''
438 d_gethostent_r=''
439 gethostent_r_proto=''
440 d_gethostprotos=''
441 d_getitimer=''
442 d_getlogin=''
443 d_getlogin_r=''
444 getlogin_r_proto=''
445 d_getmnt=''
446 d_getmntent=''
447 d_getnbyaddr=''
448 d_getnbyname=''
449 d_getnent=''
450 d_getnetbyaddr_r=''
451 getnetbyaddr_r_proto=''
452 d_getnetbyname_r=''
453 getnetbyname_r_proto=''
454 d_getnetent_r=''
455 getnetent_r_proto=''
456 d_getnetprotos=''
457 d_getpagsz=''
458 d_getpent=''
459 d_getpgid=''
460 d_getpgrp2=''
461 d_bsdgetpgrp=''
462 d_getpgrp=''
463 d_getppid=''
464 d_getprior=''
465 d_getpbyname=''
466 d_getpbynumber=''
467 d_getprotobyname_r=''
468 getprotobyname_r_proto=''
469 d_getprotobynumber_r=''
470 getprotobynumber_r_proto=''
471 d_getprotoent_r=''
472 getprotoent_r_proto=''
473 d_getprotoprotos=''
474 d_getprpwnam=''
475 d_getpwent=''
476 d_getpwent_r=''
477 getpwent_r_proto=''
478 d_getpwnam_r=''
479 getpwnam_r_proto=''
480 d_getpwuid_r=''
481 getpwuid_r_proto=''
482 d_getsent=''
483 d_getservbyname_r=''
484 getservbyname_r_proto=''
485 d_getservbyport_r=''
486 getservbyport_r_proto=''
487 d_getservent_r=''
488 getservent_r_proto=''
489 d_getservprotos=''
490 d_getspnam=''
491 d_getspnam_r=''
492 getspnam_r_proto=''
493 d_getsbyname=''
494 d_getsbyport=''
495 d_gmtime_r=''
496 gmtime_r_proto=''
497 d_gnulibc=''
498 gnulibc_version=''
499 d_hasmntopt=''
500 d_htonl=''
501 d_inetaton=''
502 d_int64_t=''
503 d_isascii=''
504 d_isfinite=''
505 d_isinf=''
506 d_isnan=''
507 d_isnanl=''
508 d_killpg=''
509 d_lchown=''
510 d_ldbl_dig=''
511 d_link=''
512 d_localtime_r=''
513 localtime_r_proto=''
514 d_locconv=''
515 d_lockf=''
516 d_longdbl=''
517 longdblsize=''
518 d_longlong=''
519 longlongsize=''
520 d_lseekproto=''
521 d_lstat=''
522 d_madvise=''
523 d_mblen=''
524 d_mbstowcs=''
525 d_mbtowc=''
526 d_memchr=''
527 d_memcmp=''
528 d_memcpy=''
529 d_memmove=''
530 d_memset=''
531 d_mkdir=''
532 d_mkdtemp=''
533 d_mkfifo=''
534 d_mkstemp=''
535 d_mkstemps=''
536 d_mktime=''
537 d_mmap=''
538 mmaptype=''
539 d_modfl=''
540 d_modfl_pow32_bug=''
541 d_modflproto=''
542 d_mprotect=''
543 d_msg=''
544 d_msgctl=''
545 d_msgget=''
546 d_msghdr_s=''
547 d_msgrcv=''
548 d_msgsnd=''
549 d_msync=''
550 d_munmap=''
551 d_nanosleep=''
552 d_nice=''
553 d_nl_langinfo=''
554 d_off64_t=''
555 d_open3=''
556 d_fpathconf=''
557 d_pathconf=''
558 d_pause=''
559 d_pipe=''
560 d_poll=''
561 d_portable=''
562 d_procselfexe=''
563 procselfexe=''
564 d_old_pthread_create_joinable=''
565 old_pthread_create_joinable=''
566 d_pthread_atfork=''
567 d_pthread_yield=''
568 d_sched_yield=''
569 sched_yield=''
570 d_qgcvt=''
571 d_random_r=''
572 random_r_proto=''
573 d_readdir64_r=''
574 readdir64_r_proto=''
575 d_readdir=''
576 d_rewinddir=''
577 d_seekdir=''
578 d_telldir=''
579 d_readdir_r=''
580 readdir_r_proto=''
581 d_readlink=''
582 d_readv=''
583 d_recvmsg=''
584 d_rename=''
585 d_rmdir=''
586 d_safebcpy=''
587 d_safemcpy=''
588 d_sanemcmp=''
589 d_sbrkproto=''
590 d_select=''
591 d_sem=''
592 d_semctl=''
593 d_semget=''
594 d_semop=''
595 d_sendmsg=''
596 d_setegid=''
597 d_seteuid=''
598 d_setgrent=''
599 d_setgrent_r=''
600 setgrent_r_proto=''
601 d_setgrps=''
602 d_sethent=''
603 d_sethostent_r=''
604 sethostent_r_proto=''
605 d_setitimer=''
606 d_setlinebuf=''
607 d_setlocale=''
608 d_setlocale_r=''
609 setlocale_r_proto=''
610 d_setnent=''
611 d_setnetent_r=''
612 setnetent_r_proto=''
613 d_setpent=''
614 d_setpgid=''
615 d_setpgrp2=''
616 d_bsdsetpgrp=''
617 d_setpgrp=''
618 d_setprior=''
619 d_setproctitle=''
620 d_setprotoent_r=''
621 setprotoent_r_proto=''
622 d_setpwent=''
623 d_setpwent_r=''
624 setpwent_r_proto=''
625 d_setregid=''
626 d_setresgid=''
627 d_setresuid=''
628 d_setreuid=''
629 d_setrgid=''
630 d_setruid=''
631 d_setsent=''
632 d_setservent_r=''
633 setservent_r_proto=''
634 d_setsid=''
635 d_setvbuf=''
636 d_sfio=''
637 usesfio=''
638 d_shm=''
639 d_shmat=''
640 d_shmatprototype=''
641 shmattype=''
642 d_shmctl=''
643 d_shmdt=''
644 d_shmget=''
645 d_sigaction=''
646 d_sigprocmask=''
647 d_sigsetjmp=''
648 d_sockatmark=''
649 d_sockatmarkproto=''
650 d_msg_ctrunc=''
651 d_msg_dontroute=''
652 d_msg_oob=''
653 d_msg_peek=''
654 d_msg_proxy=''
655 d_oldsock=''
656 d_scm_rights=''
657 d_socket=''
658 d_sockpair=''
659 sockethdr=''
660 socketlib=''
661 d_socklen_t=''
662 d_socks5_init=''
663 d_sqrtl=''
664 d_srand48_r=''
665 srand48_r_proto=''
666 d_srandom_r=''
667 srandom_r_proto=''
668 d_sresgproto=''
669 d_sresuproto=''
670 d_statblks=''
671 d_statfs_f_flags=''
672 d_statfs_s=''
673 d_fstatvfs=''
674 d_statvfs=''
675 d_stdio_cnt_lval=''
676 d_stdio_ptr_lval=''
677 d_stdio_ptr_lval_nochange_cnt=''
678 d_stdio_ptr_lval_sets_cnt=''
679 d_stdiobase=''
680 d_stdstdio=''
681 stdio_base=''
682 stdio_bufsiz=''
683 stdio_cnt=''
684 stdio_filbuf=''
685 stdio_ptr=''
686 d_index=''
687 d_strchr=''
688 d_strcoll=''
689 d_strctcpy=''
690 d_strerrm=''
691 d_strerror=''
692 d_sysernlst=''
693 d_syserrlst=''
694 d_strerror_r=''
695 strerror_r_proto=''
696 d_strftime=''
697 d_strtod=''
698 d_strtol=''
699 d_strtold=''
700 d_strtoll=''
701 d_strtoq=''
702 d_strtoul=''
703 d_strtoull=''
704 d_strtouq=''
705 d_strxfrm=''
706 d_symlink=''
707 d_syscall=''
708 d_syscallproto=''
709 d_sysconf=''
710 d_system=''
711 d_tcgetpgrp=''
712 d_tcsetpgrp=''
713 d_telldirproto=''
714 d_time=''
715 timetype=''
716 clocktype=''
717 d_times=''
718 d_tmpnam_r=''
719 tmpnam_r_proto=''
720 d_truncate=''
721 d_ttyname_r=''
722 ttyname_r_proto=''
723 d_tzname=''
724 d_u32align=''
725 d_ualarm=''
726 d_umask=''
727 d_semctl_semid_ds=''
728 d_semctl_semun=''
729 d_union_semun=''
730 d_unordered=''
731 d_usleep=''
732 d_usleepproto=''
733 d_ustat=''
734 d_vfork=''
735 usevfork=''
736 d_voidsig=''
737 signal_t=''
738 d_volatile=''
739 d_charvspr=''
740 d_vprintf=''
741 d_wait4=''
742 d_waitpid=''
743 d_wcstombs=''
744 d_wctomb=''
745 d_writev=''
746 dlext=''
747 cccdlflags=''
748 ccdlflags=''
749 dlsrc=''
750 ld=''
751 lddlflags=''
752 usedl=''
753 doublesize=''
754 ebcdic=''
755 fflushNULL=''
756 fflushall=''
757 fpossize=''
758 fpostype=''
759 gccansipedantic=''
760 gccosandvers=''
761 gccversion=''
762 gidformat=''
763 gidsign=''
764 gidsize=''
765 gidtype=''
766 groupstype=''
767 h_fcntl=''
768 h_sysfile=''
769 html1dir=''
770 html1direxp=''
771 installhtml1dir=''
772 html3dir=''
773 html3direxp=''
774 installhtml3dir=''
775 i_arpainet=''
776 i_crypt=''
777 db_hashtype=''
778 db_prefixtype=''
779 db_version_major=''
780 db_version_minor=''
781 db_version_patch=''
782 i_db=''
783 i_dbm=''
784 i_rpcsvcdbm=''
785 d_dirnamlen=''
786 direntrytype=''
787 i_dirent=''
788 i_dld=''
789 i_dlfcn=''
790 i_fcntl=''
791 i_float=''
792 i_fp=''
793 i_fp_class=''
794 i_gdbm=''
795 d_grpasswd=''
796 i_grp=''
797 i_ieeefp=''
798 i_inttypes=''
799 i_langinfo=''
800 i_libutil=''
801 i_limits=''
802 i_locale=''
803 i_machcthr=''
804 i_malloc=''
805 i_math=''
806 i_memory=''
807 i_mntent=''
808 i_ndbm=''
809 i_netdb=''
810 i_neterrno=''
811 i_netinettcp=''
812 i_niin=''
813 i_sysin=''
814 i_poll=''
815 i_prot=''
816 i_pthread=''
817 d_pwage=''
818 d_pwchange=''
819 d_pwclass=''
820 d_pwcomment=''
821 d_pwexpire=''
822 d_pwgecos=''
823 d_pwpasswd=''
824 d_pwquota=''
825 i_pwd=''
826 i_sfio=''
827 i_shadow=''
828 i_socks=''
829 i_stddef=''
830 i_stdlib=''
831 i_string=''
832 strings=''
833 i_sunmath=''
834 i_sysaccess=''
835 i_sysdir=''
836 i_sysfile=''
837 d_voidtty=''
838 i_bsdioctl=''
839 i_sysfilio=''
840 i_sysioctl=''
841 i_syssockio=''
842 i_syslog=''
843 i_sysmman=''
844 i_sysmode=''
845 i_sysmount=''
846 i_sysndir=''
847 i_sysparam=''
848 i_sysresrc=''
849 i_syssecrt=''
850 i_sysselct=''
851 i_sysstat=''
852 i_sysstatfs=''
853 i_sysstatvfs=''
854 i_systimes=''
855 i_systypes=''
856 i_sysuio=''
857 i_sysun=''
858 i_sysutsname=''
859 i_sysvfs=''
860 i_syswait=''
861 i_sgtty=''
862 i_termio=''
863 i_termios=''
864 d_tm_tm_gmtoff=''
865 d_tm_tm_zone=''
866 i_systime=''
867 i_systimek=''
868 i_time=''
869 timeincl=''
870 i_unistd=''
871 i_ustat=''
872 i_utime=''
873 i_values=''
874 i_stdarg=''
875 i_varargs=''
876 i_varhdr=''
877 i_vfork=''
878 inc_version_list=''
879 inc_version_list_init=''
880 installprefix=''
881 installprefixexp=''
882 installstyle=''
883 installusrbinperl=''
884 intsize=''
885 longsize=''
886 shortsize=''
887 issymlink=''
888 libc=''
889 ldlibpthname=''
890 libperl=''
891 shrpenv=''
892 useshrplib=''
893 glibpth=''
894 libpth=''
895 loclibpth=''
896 plibpth=''
897 xlibpth=''
898 ignore_versioned_solibs=''
899 libs=''
900 libsdirs=''
901 libsfiles=''
902 libsfound=''
903 libspath=''
904 lns=''
905 d_PRIEUldbl=''
906 d_PRIFUldbl=''
907 d_PRIGUldbl=''
908 d_PRIeldbl=''
909 d_PRIfldbl=''
910 d_PRIgldbl=''
911 d_SCNfldbl=''
912 sPRIEUldbl=''
913 sPRIFUldbl=''
914 sPRIGUldbl=''
915 sPRIeldbl=''
916 sPRIfldbl=''
917 sPRIgldbl=''
918 sSCNfldbl=''
919 lseeksize=''
920 lseektype=''
921 make_set_make=''
922 d_mymalloc=''
923 freetype=''
924 mallocobj=''
925 mallocsrc=''
926 malloctype=''
927 usemymalloc=''
928 installman1dir=''
929 man1dir=''
930 man1direxp=''
931 man1ext=''
932 installman3dir=''
933 man3dir=''
934 man3direxp=''
935 man3ext=''
936 modetype=''
937 multiarch=''
938 mydomain=''
939 myhostname=''
940 phostname=''
941 c=''
942 n=''
943 d_eofnblk=''
944 eagain=''
945 o_nonblock=''
946 rd_nodata=''
947 need_va_copy=''
948 netdb_hlen_type=''
949 netdb_host_type=''
950 netdb_name_type=''
951 netdb_net_type=''
952 groupcat=''
953 hostcat=''
954 passcat=''
955 orderlib=''
956 ranlib=''
957 d_perl_otherlibdirs=''
958 otherlibdirs=''
959 package=''
960 spackage=''
961 pager=''
962 api_revision=''
963 api_subversion=''
964 api_version=''
965 api_versionstring=''
966 patchlevel=''
967 perl_patchlevel=''
968 revision=''
969 subversion=''
970 version=''
971 version_patchlevel_string=''
972 perl5=''
973 perladmin=''
974 perlpath=''
975 d_nv_preserves_uv=''
976 i16size=''
977 i16type=''
978 i32size=''
979 i32type=''
980 i64size=''
981 i64type=''
982 i8size=''
983 i8type=''
984 ivsize=''
985 ivtype=''
986 nv_preserves_uv_bits=''
987 nvsize=''
988 nvtype=''
989 u16size=''
990 u16type=''
991 u32size=''
992 u32type=''
993 u64size=''
994 u64type=''
995 u8size=''
996 u8type=''
997 uvsize=''
998 uvtype=''
999 ivdformat=''
1000 nvEUformat=''
1001 nvFUformat=''
1002 nvGUformat=''
1003 nveformat=''
1004 nvfformat=''
1005 nvgformat=''
1006 uvXUformat=''
1007 uvoformat=''
1008 uvuformat=''
1009 uvxformat=''
1010 pidtype=''
1011 prefix=''
1012 prefixexp=''
1013 installprivlib=''
1014 privlib=''
1015 privlibexp=''
1016 prototype=''
1017 ptrsize=''
1018 d_PRIXU64=''
1019 d_PRId64=''
1020 d_PRIi64=''
1021 d_PRIo64=''
1022 d_PRIu64=''
1023 d_PRIx64=''
1024 sPRIXU64=''
1025 sPRId64=''
1026 sPRIi64=''
1027 sPRIo64=''
1028 sPRIu64=''
1029 sPRIx64=''
1030 d_quad=''
1031 quadkind=''
1032 quadtype=''
1033 uquadtype=''
1034 drand01=''
1035 randbits=''
1036 randfunc=''
1037 randseedtype=''
1038 seedfunc=''
1039 installscript=''
1040 scriptdir=''
1041 scriptdirexp=''
1042 selectminbits=''
1043 selecttype=''
1044 sh=''
1045 sig_count=''
1046 sig_name=''
1047 sig_name_init=''
1048 sig_num=''
1049 sig_num_init=''
1050 sig_size=''
1051 installsitearch=''
1052 sitearch=''
1053 sitearchexp=''
1054 installsitebin=''
1055 sitebin=''
1056 sitebinexp=''
1057 installsitehtml1=''
1058 sitehtml1=''
1059 sitehtml1exp=''
1060 installsitehtml3=''
1061 sitehtml3=''
1062 sitehtml3exp=''
1063 installsitelib=''
1064 sitelib=''
1065 sitelib_stem=''
1066 sitelibexp=''
1067 installsiteman1=''
1068 siteman1=''
1069 siteman1exp=''
1070 installsiteman3=''
1071 siteman3=''
1072 siteman3exp=''
1073 siteprefix=''
1074 siteprefixexp=''
1075 installsitescript=''
1076 sitescript=''
1077 sitescriptexp=''
1078 sizesize=''
1079 sizetype=''
1080 so=''
1081 socksizetype=''
1082 sharpbang=''
1083 shsharp=''
1084 spitshell=''
1085 src=''
1086 ssizetype=''
1087 startperl=''
1088 startsh=''
1089 stdchar=''
1090 d_stdio_stream_array=''
1091 stdio_stream_array=''
1092 sysman=''
1093 trnl=''
1094 uidformat=''
1095 uidsign=''
1096 uidsize=''
1097 uidtype=''
1098 archname64=''
1099 use64bitall=''
1100 use64bitint=''
1101 ccflags_uselargefiles=''
1102 ldflags_uselargefiles=''
1103 libswanted_uselargefiles=''
1104 uselargefiles=''
1105 uselongdouble=''
1106 usemorebits=''
1107 usemultiplicity=''
1108 nm_opt=''
1109 nm_so_opt=''
1110 runnm=''
1111 usenm=''
1112 useperlio=''
1113 usesocks=''
1114 d_oldpthreads=''
1115 use5005threads=''
1116 useithreads=''
1117 usereentrant=''
1118 usethreads=''
1119 incpath=''
1120 mips_type=''
1121 usrinc=''
1122 d_vendorarch=''
1123 installvendorarch=''
1124 vendorarch=''
1125 vendorarchexp=''
1126 d_vendorbin=''
1127 installvendorbin=''
1128 vendorbin=''
1129 vendorbinexp=''
1130 installvendorhtml1=''
1131 vendorhtml1=''
1132 vendorhtml1exp=''
1133 installvendorhtml3=''
1134 vendorhtml3=''
1135 vendorhtml3exp=''
1136 d_vendorlib=''
1137 installvendorlib=''
1138 vendorlib=''
1139 vendorlib_stem=''
1140 vendorlibexp=''
1141 installvendorman1=''
1142 vendorman1=''
1143 vendorman1exp=''
1144 installvendorman3=''
1145 vendorman3=''
1146 vendorman3exp=''
1147 usevendorprefix=''
1148 vendorprefix=''
1149 vendorprefixexp=''
1150 d_vendorscript=''
1151 installvendorscript=''
1152 vendorscript=''
1153 vendorscriptexp=''
1154 versiononly=''
1155 defvoidused=''
1156 voidflags=''
1157 pm_apiversion=''
1158 xs_apiversion=''
1159 yacc=''
1160 yaccflags=''
1161 CONFIG=''
1162
1163 define='define'
1164 undef='undef'
1165 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1166 rmlist=''
1167
1168 : We must find out about Eunice early
1169 eunicefix=':'
1170 if test -f /etc/unixtovms; then
1171         eunicefix=/etc/unixtovms
1172 fi
1173 if test -f /etc/unixtovms.exe; then
1174         eunicefix=/etc/unixtovms.exe
1175 fi
1176
1177 : Set executable suffix now -- needed before hints available
1178 if test -f "/libs/version.library"; then
1179 : Amiga OS
1180     _exe=""
1181 elif test -f "/system/gnu_library/bin/ar.pm"; then
1182 : Stratus VOS
1183     _exe=".pm"
1184 elif test -n "$DJGPP"; then
1185 : DOS DJGPP
1186     _exe=".exe"
1187 elif test -d c:/. ; then
1188 : OS/2 or cygwin
1189     _exe=".exe"
1190 fi
1191
1192 i_whoami=''
1193 ccname=''
1194 ccversion=''
1195 perllibs=''
1196 : set useposix=false in your hint file to disable the POSIX extension.
1197 useposix=true
1198 : set useopcode=false in your hint file to disable the Opcode extension.
1199 useopcode=true
1200 : Trailing extension.  Override this in a hint file, if needed.
1201 : Extra object files, if any, needed on this platform.
1202 archobjs=''
1203 archname=''
1204 : Possible local include directories to search.
1205 : Set locincpth to "" in a hint file to defeat local include searches.
1206 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1207 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1208 :
1209 : no include file wanted by default
1210 inclwanted=''
1211
1212 groupstype=''
1213 libnames=''
1214 : change the next line if compiling for Xenix/286 on Xenix/386
1215 xlibpth='/usr/lib/386 /lib/386'
1216 : Possible local library directories to search.
1217 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1218 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1219
1220 : general looking path for locating libraries
1221 glibpth="/lib /usr/lib $xlibpth"
1222 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1223 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1224 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1225
1226 : Private path used by Configure to find libraries.  Its value
1227 : is prepended to libpth. This variable takes care of special
1228 : machines, like the mips.  Usually, it should be empty.
1229 plibpth=''
1230
1231 : default library list
1232 libswanted=''
1233 : some systems want to use only the non-versioned libso:s
1234 ignore_versioned_solibs=''
1235 siteman1=''
1236 siteman3=''
1237 sitescript=''
1238 archname64=''
1239 ccflags_uselargefiles=''
1240 ldflags_uselargefiles=''
1241 libswanted_uselargefiles=''
1242 : set usemultiplicity on the Configure command line to enable multiplicity.
1243 : set usesocks on the Configure command line to enable socks.
1244 : set usethreads on the Configure command line to enable threads.
1245 usereentrant='undef'
1246 : full support for void wanted by default
1247 defvoidused=15
1248
1249 : List of libraries we want.
1250 : If anyone needs -lnet, put it in a hint file.
1251 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1252 libswanted="$libswanted dld ld sun m c cposix posix"
1253 libswanted="$libswanted ndir dir crypt sec"
1254 libswanted="$libswanted ucb bsd BSD PW x util rt posix4"
1255 : We probably want to search /usr/shlib before most other libraries.
1256 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1257 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1258 glibpth="/usr/shlib $glibpth"
1259 : Do not use vfork unless overridden by a hint file.
1260 usevfork=false
1261
1262 : Find the basic shell for Bourne shell scripts
1263 case "$sh" in
1264 '')
1265         case "$SYSTYPE" in
1266         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1267         *) xxx='/bin/sh';;
1268         esac
1269         if test -f "$xxx"; then
1270                 sh="$xxx"
1271         else
1272                 : Build up a list and do a single loop so we can 'break' out.
1273                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1274                 for xxx in sh bash ksh pdksh ash; do
1275                         for p in $pth; do
1276                                 try="$try ${p}/${xxx}"
1277                         done
1278                 done
1279                 for xxx in $try; do
1280                         if test -f "$xxx"; then
1281                                 sh="$xxx";
1282                                 break
1283                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1284                                 sh="$xxx";
1285                                 break
1286                         elif test -f "$xxx.exe"; then
1287                                 sh="$xxx";
1288                                 break
1289                         fi
1290                 done
1291         fi
1292         ;;
1293 esac
1294
1295 case "$sh" in
1296 '')     cat >&2 <<EOM
1297 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1298
1299 Usually it's in /bin/sh.  How did you even get this far?
1300 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1301 we'll try to straighten this all out.
1302 EOM
1303         exit 1
1304         ;;
1305 esac
1306
1307 : see if sh knows # comments
1308 if `$sh -c '#' >/dev/null 2>&1`; then
1309         shsharp=true
1310         spitshell=cat
1311         xcat=/bin/cat
1312         test -f $xcat$_exe || xcat=/usr/bin/cat
1313         if test ! -f $xcat$_exe; then
1314                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1315                         if test -f $p/cat$_exe; then
1316                                 xcat=$p/cat
1317                                 break
1318                         fi
1319                 done
1320                 if test ! -f $xcat$_exe; then
1321                         echo "Can't find cat anywhere!"
1322                         exit 1
1323                 fi
1324         fi
1325         echo "#!$xcat" >sharp
1326         $eunicefix sharp
1327         chmod +x sharp
1328         ./sharp > today
1329         if test -s today; then
1330                 sharpbang='#!'
1331         else
1332                 echo "#! $xcat" > sharp
1333                 $eunicefix sharp
1334                 chmod +x sharp
1335                 ./sharp > today
1336                 if test -s today; then
1337                         sharpbang='#! '
1338                 else
1339                         sharpbang=': use '
1340                 fi
1341         fi
1342 else
1343         echo " "
1344         echo "Your $sh doesn't grok # comments--I will strip them later on."
1345         shsharp=false
1346         cd ..
1347         echo "exec grep -v '^[  ]*#'" >spitshell
1348         chmod +x spitshell
1349         $eunicefix spitshell
1350         spitshell=`pwd`/spitshell
1351         cd UU
1352         echo "I presume that if # doesn't work, #! won't work either!"
1353         sharpbang=': use '
1354 fi
1355 rm -f sharp today
1356
1357 : figure out how to guarantee sh startup
1358 case "$startsh" in
1359 '') startsh=${sharpbang}${sh} ;;
1360 *)
1361 esac
1362 cat >sharp <<EOSS
1363 $startsh
1364 set abc
1365 test "$?abc" != 1
1366 EOSS
1367
1368 chmod +x sharp
1369 $eunicefix sharp
1370 if ./sharp; then
1371         : echo "Yup, it does."
1372 else
1373         echo "Hmm... '$startsh' does not guarantee sh startup..."
1374         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1375 fi
1376 rm -f sharp
1377
1378
1379 : Save command line options in file UU/cmdline.opt for later use in
1380 : generating config.sh.
1381 cat > cmdline.opt <<EOSH
1382 # Configure command line arguments.
1383 config_arg0='$0'
1384 config_args='$*'
1385 config_argc=$#
1386 EOSH
1387 argn=1
1388 args_exp=''
1389 args_sep=''
1390 for arg in "$@"; do
1391         cat >>cmdline.opt <<EOSH
1392 config_arg$argn='$arg'
1393 EOSH
1394         # Extreme backslashitis: replace each ' by '"'"'
1395         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1396 $arg
1397 EOC
1398         arg_exp=`cat cmdl.opt`
1399         args_exp="$args_exp$args_sep'$arg_exp'"
1400         argn=`expr $argn + 1`
1401         args_sep=' '
1402 done
1403 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1404 # used by ./hints/os2.sh
1405 rm -f cmdl.opt
1406
1407 : produce awk script to parse command line options
1408 cat >options.awk <<'EOF'
1409 BEGIN {
1410         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1411
1412         len = length(optstr);
1413         for (i = 1; i <= len; i++) {
1414                 c = substr(optstr, i, 1);
1415                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1416                 if (a == ":") {
1417                         arg[c] = 1;
1418                         i++;
1419                 }
1420                 opt[c] = 1;
1421         }
1422 }
1423 {
1424         expect = 0;
1425         str = $0;
1426         if (substr(str, 1, 1) != "-") {
1427                 printf("'%s'\n", str);
1428                 next;
1429         }
1430         len = length($0);
1431         for (i = 2; i <= len; i++) {
1432                 c = substr(str, i, 1);
1433                 if (!opt[c]) {
1434                         printf("-%s\n", substr(str, i));
1435                         next;
1436                 }
1437                 printf("-%s\n", c);
1438                 if (arg[c]) {
1439                         if (i < len)
1440                                 printf("'%s'\n", substr(str, i + 1));
1441                         else
1442                                 expect = 1;
1443                         next;
1444                 }
1445         }
1446 }
1447 END {
1448         if (expect)
1449                 print "?";
1450 }
1451 EOF
1452
1453 : process the command line options
1454 set X `for arg in "$@"; do echo "X$arg"; done |
1455         sed -e s/X// | awk -f options.awk`
1456 eval "set $*"
1457 shift
1458 rm -f options.awk
1459
1460 : set up default values
1461 fastread=''
1462 reuseval=false
1463 config_sh=''
1464 alldone=''
1465 error=''
1466 silent=''
1467 extractsh=''
1468 override=''
1469 knowitall=''
1470 rm -f optdef.sh posthint.sh
1471 cat >optdef.sh <<EOS
1472 $startsh
1473 EOS
1474
1475
1476 : option parsing
1477 while test $# -gt 0; do
1478         case "$1" in
1479         -d) shift; fastread=yes;;
1480         -e) shift; alldone=cont;;
1481         -f)
1482                 shift
1483                 cd ..
1484                 if test -r "$1"; then
1485                         config_sh="$1"
1486                 else
1487                         echo "$me: cannot read config file $1." >&2
1488                         error=true
1489                 fi
1490                 cd UU
1491                 shift;;
1492         -h) shift; error=true;;
1493         -r) shift; reuseval=true;;
1494         -s) shift; silent=true; realsilent=true;;
1495         -E) shift; alldone=exit;;
1496         -K) shift; knowitall=true;;
1497         -O) shift; override=true;;
1498         -S) shift; silent=true; extractsh=true;;
1499         -D)
1500                 shift
1501                 case "$1" in
1502                 *=)
1503                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1504                         echo "$me: ignoring -D $1" >&2
1505                         ;;
1506                 *=*) echo "$1" | \
1507                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1508                 *) echo "$1='define'" >> optdef.sh;;
1509                 esac
1510                 shift
1511                 ;;
1512         -U)
1513                 shift
1514                 case "$1" in
1515                 *=) echo "$1" >> optdef.sh;;
1516                 *=*)
1517                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1518                         echo "$me: ignoring -U $1" >&2
1519                         ;;
1520                 *) echo "$1='undef'" >> optdef.sh;;
1521                 esac
1522                 shift
1523                 ;;
1524         -A)
1525             shift
1526             xxx=''
1527             yyy="$1"
1528             zzz=''
1529             uuu=undef
1530             case "$yyy" in
1531             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1532                  case "$zzz" in
1533                  *:*) zzz='' ;;
1534                  *)   xxx=append
1535                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1536                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1537                  esac
1538                  ;;
1539             esac
1540             case "$xxx" in
1541             '')  case "$yyy" in
1542                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1543                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1544                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1545                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1546                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1547                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1548                  esac
1549                  ;;       
1550             esac
1551             case "$xxx" in
1552             append)
1553                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1554             clear)
1555                 echo "$yyy=''"                  >> posthint.sh ;;
1556             define)
1557                 case "$zzz" in
1558                 '') zzz=define ;;
1559                 esac
1560                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1561             eval)
1562                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1563             prepend)
1564                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1565             undef)
1566                 case "$zzz" in
1567                 '') zzz="$uuu" ;;
1568                 esac
1569                 echo "$yyy=$zzz"                >> posthint.sh ;;
1570             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1571             esac
1572             shift
1573             ;;
1574         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1575             exit 0;;
1576         --) break;;
1577         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1578         *) break;;
1579         esac
1580 done
1581
1582 case "$error" in
1583 true)
1584         cat >&2 <<EOM
1585 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1586                  [-U symbol] [-U symbol=] [-A command:symbol...]
1587   -d : use defaults for all answers.
1588   -e : go on without questioning past the production of config.sh.
1589   -f : specify an alternate default configuration file.
1590   -h : print this help message and exit (with an error status).
1591   -r : reuse C symbols value if possible (skips costly nm extraction).
1592   -s : silent mode, only echoes questions and essential information.
1593   -D : define symbol to have some value:
1594          -D symbol         symbol gets the value 'define'
1595          -D symbol=value   symbol gets the value 'value'
1596   -E : stop at the end of questions, after having produced config.sh.
1597   -K : do not use unless you know what you are doing.
1598   -O : let -D and -U override definitions from loaded configuration file.
1599   -S : perform variable substitutions on all .SH files (can mix with -f)
1600   -U : undefine symbol:
1601          -U symbol    symbol gets the value 'undef'
1602          -U symbol=   symbol gets completely empty
1603   -A : manipulate symbol after the platform specific hints have been applied:
1604          -A symbol=value                append " "value to symbol
1605          -A append:symbol=value         append value to symbol
1606          -A define:symbol=value         define symbol to have value
1607          -A clear:symbol                define symbol to be ''
1608          -A define:symbol               define symbol to be 'define'
1609          -A eval:symbol=value           define symbol to be eval of value
1610          -A prepend:symbol=value        prepend value to symbol
1611          -A undef:symbol                define symbol to be 'undef'
1612          -A undef:symbol=               define symbol to be ''
1613   -V : print version number and exit (with a zero status).
1614 EOM
1615         exit 1
1616         ;;
1617 esac
1618
1619 : Sanity checks
1620 case "$fastread$alldone" in
1621 yescont|yesexit) ;;
1622 *)
1623         case "$extractsh" in
1624         true) ;;
1625         *)
1626                 if test ! -t 0; then
1627                         echo "Say 'sh Configure', not 'sh <Configure'"
1628                         exit 1
1629                 fi
1630                 ;;
1631         esac
1632         ;;
1633 esac
1634
1635 exec 4>&1
1636 case "$silent" in
1637 true) exec 1>/dev/null;;
1638 esac
1639
1640 : run the defines and the undefines, if any, but leave the file out there...
1641 touch optdef.sh
1642 . ./optdef.sh
1643 : create the posthint manipulation script and leave the file out there...
1644 touch posthint.sh
1645
1646 : set package name
1647 package=perl5
1648 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1649 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1650 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1651 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1652 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1653 esac
1654
1655 : Some greps do not return status, grrr.
1656 echo "grimblepritz" >grimble
1657 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1658         contains=contains
1659 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1660         contains=grep
1661 else
1662         contains=contains
1663 fi
1664 rm -f grimble
1665 : the following should work in any shell
1666 case "$contains" in
1667 contains*)
1668         echo " "
1669         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1670         cat >contains <<'EOSS'
1671 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1672 EOSS
1673 chmod +x contains
1674 esac
1675
1676 : Find the path to the source tree
1677 case "$src" in
1678 '') case "$0" in
1679     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1680          case "$src" in
1681          /*)    ;;
1682          .)     ;;
1683          *)     src=`cd ../$src && pwd` ;;
1684          esac
1685          ;;
1686     *)   src='.';;
1687     esac;;
1688 esac
1689 case "$src" in
1690 '')     src=/
1691         rsrc=/
1692         ;;
1693 /*) rsrc="$src";;
1694 *) rsrc="../$src";;
1695 esac
1696 if test -f $rsrc/Configure && \
1697         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1698 then
1699    : found it, so we are ok.
1700 else
1701         rsrc=''
1702         for src in . .. ../.. ../../.. ../../../..; do
1703                 if test -f ../$src/Configure && \
1704                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1705                 then
1706                         rsrc=../$src
1707                         break
1708                 fi
1709         done
1710 fi
1711 case "$rsrc" in
1712 '')
1713         cat <<EOM >&4
1714
1715 Sorry, I can't seem to locate the source dir for $package.  Please start
1716 Configure with an explicit path -- i.e. /some/path/Configure.
1717
1718 EOM
1719         exit 1
1720         ;;
1721 ../.)   rsrc='..';;
1722 *)
1723         echo " "
1724         echo "Sources for $package found in \"$src\"." >&4
1725         ;;
1726 esac
1727
1728 : script used to extract .SH files with variable substitutions
1729 cat >extract <<'EOS'
1730 PERL_CONFIG_SH=true
1731 echo "Doing variable substitutions on .SH files..."
1732 if test -f MANIFEST; then
1733         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1734 else
1735         echo "(Looking for .SH files under the source directory.)"
1736         set x `(cd "$src"; find . -name "*.SH" -print)`
1737 fi
1738 shift
1739 case $# in
1740 0) set x `(cd "$src"; echo *.SH)`; shift;;
1741 esac
1742 if test ! -f "$src/$1"; then
1743         shift
1744 fi
1745 mkdir_p='
1746 name=$1;
1747 create="";
1748 while test $name; do
1749         if test ! -d "$name"; then
1750                 create="$name $create";
1751                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1752                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1753         else
1754                 name="";
1755         fi;
1756 done;
1757 for file in $create; do
1758         mkdir $file;
1759 done
1760 '
1761 for file in $*; do
1762         case "$src" in
1763         ".")
1764                 case "$file" in
1765                 */*)
1766                         dir=`expr X$file : 'X\(.*\)/'`
1767                         file=`expr X$file : 'X.*/\(.*\)'`
1768                         (cd "$dir" && . ./$file)
1769                         ;;
1770                 *)
1771                         . ./$file
1772                         ;;
1773                 esac
1774                 ;;
1775         *)
1776                 case "$file" in
1777                 */*)
1778                         dir=`expr X$file : 'X\(.*\)/'`
1779                         file=`expr X$file : 'X.*/\(.*\)'`
1780                         (set x $dir; shift; eval $mkdir_p)
1781                         sh <"$src/$dir/$file"
1782                         ;;
1783                 *)
1784                         sh <"$src/$file"
1785                         ;;
1786                 esac
1787                 ;;
1788         esac
1789 done
1790 if test -f "$src/config_h.SH"; then
1791         if test ! -f config.h; then
1792         : oops, they left it out of MANIFEST, probably, so do it anyway.
1793         . "$src/config_h.SH"
1794         fi
1795 fi
1796 EOS
1797
1798 : extract files and exit if asked to do so
1799 case "$extractsh" in
1800 true)
1801         case "$realsilent" in
1802         true) ;;
1803         *) exec 1>&4;;
1804         esac
1805         case "$config_sh" in
1806         '') config_sh='config.sh';;
1807         esac
1808         echo " "
1809         echo "Fetching answers from $config_sh..."
1810         cd ..
1811         . $config_sh
1812         test "$override" && . ./optdef.sh
1813         echo " "
1814         . UU/extract
1815         rm -rf UU
1816         echo "Extraction done."
1817         exit 0
1818         ;;
1819 esac
1820
1821 : Eunice requires " " instead of "", can you believe it
1822 echo " "
1823 : Here we go...
1824 echo "Beginning of configuration questions for $package."
1825
1826 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1827
1828 : first determine how to suppress newline on echo command
1829 echo " "
1830 echo "Checking echo to see how to suppress newlines..."
1831 (echo "hi there\c" ; echo " ") >.echotmp
1832 if $contains c .echotmp >/dev/null 2>&1 ; then
1833         echo "...using -n."
1834         n='-n'
1835         c=''
1836 else
1837         cat <<'EOM'
1838 ...using \c
1839 EOM
1840         n=''
1841         c='\c'
1842 fi
1843 echo $n "The star should be here-->$c"
1844 echo '*'
1845 rm -f .echotmp
1846
1847 : Now test for existence of everything in MANIFEST
1848 echo " "
1849 if test -f "$rsrc/MANIFEST"; then
1850         echo "First let's make sure your kit is complete.  Checking..." >&4
1851         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1852         rm -f missing
1853         tmppwd=`pwd`
1854         for filelist in x??; do
1855                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1856         done
1857         if test -s missing; then
1858                 cat missing >&4
1859                 cat >&4 <<'EOM'
1860
1861 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1862
1863 You have the option of continuing the configuration process, despite the
1864 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1865 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1866 and contact the author (perlbug@perl.org).
1867
1868 EOM
1869                 echo $n "Continue? [n] $c" >&4
1870                 read ans
1871                 case "$ans" in
1872                 y*)
1873                         echo "Continuing..." >&4
1874                         rm -f missing
1875                         ;;
1876                 *)
1877                         echo "ABORTING..." >&4
1878                         kill $$
1879                         ;;
1880                 esac
1881         else
1882                 echo "Looks good..."
1883         fi
1884 else
1885         echo "There is no MANIFEST file.  I hope your kit is complete !"
1886 fi
1887 rm -f missing x??
1888
1889 echo " "
1890 : Find the appropriate value for a newline for tr
1891 if test -n "$DJGPP"; then
1892        trnl='\012'
1893 fi
1894 if test X"$trnl" = X; then
1895         case "`echo foo|tr '\n' x 2>/dev/null`" in
1896         foox) trnl='\n' ;;
1897         esac
1898 fi
1899 if test X"$trnl" = X; then
1900         case "`echo foo|tr '\012' x 2>/dev/null`" in
1901         foox) trnl='\012' ;;
1902         esac
1903 fi
1904 if test X"$trnl" = X; then
1905        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1906        fooxy) trnl='\n\r' ;;
1907        esac
1908 fi
1909 if test X"$trnl" = X; then
1910         cat <<EOM >&2
1911
1912 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1913
1914 EOM
1915         exit 1
1916 fi
1917
1918 : compute the number of columns on the terminal for proper question formatting
1919 case "$COLUMNS" in
1920 '') COLUMNS='80';;
1921 esac
1922
1923 : set up the echo used in my read
1924 myecho="case \"\$xxxm\" in
1925 '') echo $n \"\$rp $c\" >&4;;
1926 *) case \"\$rp\" in
1927         '') echo $n \"[\$xxxm] $c\";;
1928         *)
1929                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1930                         echo \"\$rp\" >&4
1931                         echo $n \"[\$xxxm] $c\" >&4
1932                 else
1933                         echo $n \"\$rp [\$xxxm] $c\" >&4
1934                 fi
1935                 ;;
1936         esac;;
1937 esac"
1938
1939 : now set up to do reads with possible shell escape and default assignment
1940 cat <<EOSC >myread
1941 $startsh
1942 xxxm=\$dflt
1943 $myecho
1944 ans='!'
1945 case "\$fastread" in
1946 yes) case "\$dflt" in
1947         '') ;;
1948         *) ans='';
1949                 case "\$silent-\$rp" in
1950                 true-) ;;
1951                 *) echo " " >&4;;
1952                 esac;;
1953         esac;;
1954 *) case "\$silent" in
1955         true) case "\$rp" in
1956                 '') ans='';;
1957                 esac;;
1958         esac;;
1959 esac
1960 while expr "X\$ans" : "X!" >/dev/null; do
1961         read answ
1962         set x \$xxxm
1963         shift
1964         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1965         case  "\$answ" in
1966         "!")
1967                 sh 1>&4
1968                 echo " "
1969                 $myecho
1970                 ;;
1971         !*)
1972                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1973                 shift
1974                 sh 1>&4 -c "\$*"
1975                 echo " "
1976                 $myecho
1977                 ;;
1978         "\$ans")
1979                 case "\$ans" in
1980                 \\&*)
1981                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1982                         shift
1983                         case "\$1" in
1984                         -d)
1985                                 fastread=yes
1986                                 echo "(OK, I'll run with -d after this question.)" >&4
1987                                 ;;
1988                         -*)
1989                                 echo "*** Sorry, \$1 not supported yet." >&4
1990                                 ;;
1991                         esac
1992                         $myecho
1993                         ans=!
1994                         ;;
1995                 esac;;
1996         *)
1997                 case "\$aok" in
1998                 y)
1999                         echo "*** Substitution done -- please confirm."
2000                         xxxm="\$ans"
2001                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2002                         xxxm="\$ans"
2003                         ans=!
2004                         ;;
2005                 *)
2006                         echo "*** Error -- try again."
2007                         ans=!
2008                         ;;
2009                 esac
2010                 $myecho
2011                 ;;
2012         esac
2013         case "\$ans\$xxxm\$nostick" in
2014         '')
2015                 ans=!
2016                 $myecho
2017                 ;;
2018         esac
2019 done
2020 case "\$ans" in
2021 '') ans="\$xxxm";;
2022 esac
2023 EOSC
2024
2025 : create .config dir to save info across Configure sessions
2026 test -d ../.config || mkdir ../.config
2027 cat >../.config/README <<EOF
2028 This directory created by Configure to save information that should
2029 persist across sessions for $package.
2030
2031 You may safely delete it if you wish.
2032 EOF
2033
2034 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2035 case "$usedevel" in
2036 $define|true|[yY]*) ;;
2037 *) case "$xversion" in
2038    *[13579])
2039         cat >&4 <<EOH
2040 *** WHOA THERE!!! ***
2041
2042     This is an UNSTABLE DEVELOPMENT release.
2043     The version of this $package distribution is $xversion, that is, odd,
2044     (as opposed to even) and that signifies a development release.
2045     If you want a maintenance release, you want an even-numbered version.
2046
2047     Do ***NOT*** install this into production use.
2048     Data corruption and crashes are possible.
2049
2050     It is most seriously suggested that you do not continue any further
2051     unless you want to help in developing and debugging Perl.
2052
2053     If you *still* want to build perl, you can answer 'y' now,
2054     or pass -Dusedevel to Configure.
2055
2056 EOH
2057         rp='Do you really want to continue?'
2058         dflt='n'
2059         . ./myread
2060         case "$ans" in
2061         [yY]) echo >&4 "Okay, continuing."
2062               usedevel="$define" ;;
2063         *) echo >&4 "Okay, bye."
2064            exit 1
2065            ;;
2066         esac
2067         ;;
2068     esac
2069     ;;
2070 esac
2071 case "$usedevel" in
2072 $define|true|[yY]*)
2073         case "$versiononly" in
2074         '') versiononly="$define" ;;
2075         esac
2076         case "$installusrbinperl" in
2077         '') installusrbinperl="$undef" ;;
2078         esac
2079         ;;
2080 esac
2081
2082 : general instructions
2083 needman=true
2084 firsttime=true
2085 user=`(logname) 2>/dev/null`
2086 case "$user" in
2087 '') user=`whoami 2>&1`;;
2088 esac
2089 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2090         firsttime=false
2091         echo " "
2092         rp='Would you like to see the instructions?'
2093         dflt=n
2094         . ./myread
2095         case "$ans" in
2096         [yY]*) ;;
2097         *) needman=false;;
2098         esac
2099 fi
2100 if $needman; then
2101         cat <<EOH
2102
2103 This installation shell script will examine your system and ask you questions
2104 to determine how the perl5 package should be installed. If you get
2105 stuck on a question, you may use a ! shell escape to start a subshell or
2106 execute a command.  Many of the questions will have default answers in square
2107 brackets; typing carriage return will give you the default.
2108
2109 On some of the questions which ask for file or directory names you are allowed
2110 to use the ~name construct to specify the login directory belonging to "name",
2111 even if you don't have a shell which knows about that.  Questions where this is
2112 allowed will be marked "(~name ok)".
2113
2114 EOH
2115         rp=''
2116         dflt='Type carriage return to continue'
2117         . ./myread
2118         cat <<'EOH'
2119
2120 The prompter used in this script allows you to use shell variables and
2121 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2122 in the default answer, as if the default line was a set of arguments given to a
2123 script shell.  This means you may also use $* to repeat the whole default line,
2124 so you do not have to re-type everything to add something to the default.
2125
2126 Everytime there is a substitution, you will have to confirm.  If there is an
2127 error (e.g. an unmatched backtick), the default answer will remain unchanged
2128 and you will be prompted again.
2129
2130 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2131 the questions and use the computed defaults (or the previous answers if there
2132 was already a config.sh file). Type 'Configure -h' for a list of options.
2133 You may also start interactively and then answer '& -d' at any prompt to turn
2134 on the non-interactive behaviour for the remainder of the execution.
2135
2136 EOH
2137         . ./myread
2138         cat <<EOH
2139
2140 Much effort has been expended to ensure that this shell script will run on any
2141 Unix system.  If despite that it blows up on yours, your best bet is to edit
2142 Configure and run it again.  If you can't run Configure for some reason,
2143 you'll have to generate a config.sh file by hand.  Whatever problems you
2144 have, let me (perlbug@perl.org) know how I blew it.
2145
2146 This installation script affects things in two ways:
2147
2148 1) it may do direct variable substitutions on some of the files included
2149    in this kit.
2150 2) it builds a config.h file for inclusion in C programs.  You may edit
2151    any of these files as the need arises after running this script.
2152
2153 If you make a mistake on a question, there is no easy way to back up to it
2154 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2155 files.  Configure will offer to let you do this before it runs the SH files.
2156
2157 EOH
2158         dflt='Type carriage return to continue'
2159         . ./myread
2160         case "$firsttime" in
2161         true) echo $user >>../.config/instruct;;
2162         esac
2163 fi
2164
2165 : find out where common programs are
2166 echo " "
2167 echo "Locating common programs..." >&4
2168 cat <<EOSC >loc
2169 $startsh
2170 case \$# in
2171 0) exit 1;;
2172 esac
2173 thing=\$1
2174 shift
2175 dflt=\$1
2176 shift
2177 for dir in \$*; do
2178         case "\$thing" in
2179         .)
2180         if test -d \$dir/\$thing; then
2181                 echo \$dir
2182                 exit 0
2183         fi
2184         ;;
2185         *)
2186         for thisthing in \$dir/\$thing; do
2187                 : just loop through to pick last item
2188         done
2189         if test -f \$thisthing; then
2190                 echo \$thisthing
2191                 exit 0
2192         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2193                 echo \$thisthing
2194                 exit 0
2195         elif test -f \$dir/\$thing.exe; then
2196                 if test -n "$DJGPP"; then
2197                         echo \$dir/\$thing.exe
2198                 elif test "$eunicefix" != ":"; then
2199                         : on Eunice apparently
2200                         echo \$dir/\$thing
2201                         exit 0
2202                 fi
2203                 exit 0
2204         fi
2205         ;;
2206         esac
2207 done
2208 echo \$dflt
2209 exit 1
2210 EOSC
2211 chmod +x loc
2212 $eunicefix loc
2213 loclist="
2214 awk
2215 cat
2216 chmod
2217 comm
2218 cp
2219 echo
2220 expr
2221 grep
2222 ls
2223 mkdir
2224 rm
2225 sed
2226 sort
2227 touch
2228 tr
2229 uniq
2230 "
2231 trylist="
2232 Mcc
2233 ar
2234 bison
2235 byacc
2236 cpp
2237 csh
2238 date
2239 egrep
2240 gmake
2241 gzip
2242 less
2243 ln
2244 make
2245 more
2246 nm
2247 nroff
2248 pg
2249 test
2250 uname
2251 zip
2252 "
2253 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2254 pth="$pth /lib /usr/lib"
2255 for file in $loclist; do
2256         eval xxx=\$$file
2257         case "$xxx" in
2258         /*|?:[\\/]*)
2259                 if test -f "$xxx"; then
2260                         : ok
2261                 else
2262                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2263                         xxx=`./loc $file $file $pth`
2264                 fi
2265                 ;;
2266         '') xxx=`./loc $file $file $pth`;;
2267         *) xxx=`./loc $xxx $xxx $pth`;;
2268         esac
2269         eval $file=$xxx$_exe
2270         eval _$file=$xxx
2271         case "$xxx" in
2272         /*)
2273                 echo $file is in $xxx.
2274                 ;;
2275         ?:[\\/]*)
2276                 echo $file is in $xxx.
2277                 ;;
2278         *)
2279                 echo "I don't know where '$file' is, and my life depends on it." >&4
2280                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2281                 exit 1
2282                 ;;
2283         esac
2284 done
2285 echo " "
2286 echo "Don't worry if any of the following aren't found..."
2287 say=offhand
2288 for file in $trylist; do
2289         eval xxx=\$$file
2290         case "$xxx" in
2291         /*|?:[\\/]*)
2292                 if test -f "$xxx"; then
2293                         : ok
2294                 else
2295                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2296                         xxx=`./loc $file $file $pth`
2297                 fi
2298                 ;;
2299         '') xxx=`./loc $file $file $pth`;;
2300         *) xxx=`./loc $xxx $xxx $pth`;;
2301         esac
2302         eval $file=$xxx$_exe
2303         eval _$file=$xxx
2304         case "$xxx" in
2305         /*)
2306                 echo $file is in $xxx.
2307                 ;;
2308         ?:[\\/]*)
2309                 echo $file is in $xxx.
2310                 ;;
2311         *)
2312                 echo "I don't see $file out there, $say."
2313                 say=either
2314                 ;;
2315         esac
2316 done
2317 case "$egrep" in
2318 egrep)
2319         echo "Substituting grep for egrep."
2320         egrep=$grep
2321         _egrep=$grep
2322         ;;
2323 esac
2324 case "$ln" in
2325 ln)
2326         echo "Substituting cp for ln."
2327         ln=$cp
2328         _ln=$cp
2329         ;;
2330 esac
2331 case "$make" in
2332 make)   
2333         case "$gmake" in
2334         gmake)
2335         echo "I can't find make or gmake, and my life depends on it." >&4
2336         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2337         exit 1
2338         ;;
2339         esac
2340         ;;
2341 esac    
2342 case "$gmake" in
2343 gmake)  ;;
2344 *)      # We can't have osname yet.
2345         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2346                 # Assume that gmake, if found, is definitely GNU make
2347                 # and prefer it over the system make.
2348                 echo "Substituting gmake for make."
2349                 make=$gmake
2350                 _make=$gmake
2351         fi
2352         ;;
2353 esac
2354 case "$test" in
2355 test)
2356         echo "Hopefully test is built into your sh."
2357         ;;
2358 *)
2359         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2360                 echo "Using the test built into your sh."
2361                 test=test
2362                 _test=test
2363         fi
2364         ;;
2365 esac
2366 case "$echo" in
2367 echo)
2368         echo "Hopefully echo is built into your sh."
2369         ;;
2370 '') ;;
2371 *)
2372         echo " "
2373 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2374         $echo $n "hi there$c" >foo1
2375         echo $n "hi there$c" >foo2
2376         if cmp foo1 foo2 >/dev/null 2>&1; then
2377                 echo "They are compatible.  In fact, they may be identical."
2378         else
2379                 case "$n" in
2380                 '-n') n='' c='\c';;
2381                 *) n='-n' c='';;
2382                 esac
2383                 cat <<FOO
2384 They are not compatible!  You are probably running ksh on a non-USG system.
2385 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2386 have echo built in and we may have to run some Bourne shell scripts.  That
2387 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2388
2389 FOO
2390                 $echo $n "The star should be here-->$c"
2391                 $echo "*"
2392         fi
2393         $rm -f foo1 foo2
2394         ;;
2395 esac
2396
2397 cat <<EOS >trygcc
2398 $startsh
2399 EOS
2400 cat <<'EOSC' >>trygcc
2401 case "$cc" in
2402 '') ;;
2403 *)  $rm -f try try.*
2404     $cat >try.c <<EOM
2405 int main(int argc, char *argv[]) {
2406   return 0;
2407 }
2408 EOM
2409     if $cc -o try $ccflags $ldflags try.c; then
2410        :
2411     else
2412         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2413         despair=yes
2414         trygcc=yes
2415         case "$cc" in
2416         *gcc*) trygcc=no ;;
2417         esac
2418         case "`$cc -v -c try.c 2>&1`" in
2419         *gcc*) trygcc=no ;;
2420         esac
2421         if $test X"$trygcc" = Xyes; then
2422             if gcc -o try -c try.c; then
2423                 echo " "
2424                 echo "You seem to have a working gcc, though." >&4
2425                 rp="Would you like to use it?"
2426                 dflt=y
2427                 if $test -f myread; then
2428                     . ./myread
2429                 else
2430                     if $test -f UU/myread; then
2431                         . ./UU/myread
2432                     else
2433                         echo "Cannot find myread, sorry.  Aborting." >&2
2434                         exit 1
2435                     fi
2436                 fi  
2437                 case "$ans" in
2438                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2439                        if $test -f usethreads.cbu; then
2440                            $cat >&4 <<EOM 
2441
2442 *** However, any setting of the C compiler flags (e.g. for thread support)
2443 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2444 *** (together with e.g. -Dusethreads).
2445
2446 EOM
2447                        fi;;
2448                 esac
2449             fi
2450         fi
2451     fi
2452     $rm -f try try.*
2453     ;;
2454 esac
2455 EOSC
2456
2457 cat <<EOS >checkcc
2458 $startsh
2459 EOS
2460 cat <<'EOSC' >>checkcc
2461 case "$cc" in        
2462 '') ;;
2463 *)  $rm -f try try.*              
2464     $cat >try.c <<EOM
2465 int main(int argc, char *argv[]) {
2466   return 0;
2467 }
2468 EOM
2469     if $cc -o try $ccflags $ldflags try.c; then
2470        :
2471     else
2472         if $test X"$despair" = Xyes; then
2473            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2474         fi
2475         $cat >&4 <<EOM         
2476 You need to find a working C compiler.
2477 Either (purchase and) install the C compiler supplied by your OS vendor,
2478 or for a free C compiler try http://gcc.gnu.org/
2479 I cannot continue any further, aborting.
2480 EOM
2481         exit 1
2482     fi
2483     $rm -f try try.*
2484     ;;
2485 esac
2486 EOSC
2487
2488 : determine whether symbolic links are supported
2489 echo " "
2490 $touch blurfl
2491 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2492         echo "Symbolic links are supported." >&4
2493         lns="$ln -s"
2494 else
2495         echo "Symbolic links are NOT supported." >&4
2496         lns="$ln"
2497 fi
2498 $rm -f blurfl sym
2499
2500 : determine whether symbolic links are supported
2501 echo " "
2502 case "$lns" in
2503 *"ln"*" -s")
2504         echo "Checking how to test for symbolic links..." >&4
2505         $lns blurfl sym
2506         if $test "X$issymlink" = X; then
2507                 case "$newsh" in
2508                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2509                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2510                 esac
2511                 if test $? = 0; then
2512                         issymlink="test -h"
2513                 else
2514                         echo "Your builtin 'test -h' may be broken." >&4
2515                         case "$test" in
2516                         /*)     ;;
2517                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2518                                 for p in $pth
2519                                 do
2520                                         if test -f "$p/$test"; then
2521                                                 test="$p/$test"
2522                                                 break
2523                                         fi
2524                                 done
2525                                 ;;
2526                         esac
2527                         case "$test" in
2528                         /*)
2529                                 echo "Trying external '$test -h'." >&4
2530                                 issymlink="$test -h"
2531                                 if $test ! -h sym >/dev/null 2>&1; then
2532                                         echo "External '$test -h' is broken, too." >&4
2533                                         issymlink=''
2534                                 fi
2535                                 ;;
2536                         *)      issymlink='' ;;
2537                         esac
2538                 fi              
2539         fi
2540         if $test "X$issymlink" = X; then
2541                 if $test -L sym 2>/dev/null; then
2542                         issymlink="$test -L"
2543                         echo "The builtin '$test -L' worked." >&4
2544                 fi
2545         fi
2546         if $test "X$issymlink" != X; then
2547                 echo "You can test for symbolic links with '$issymlink'." >&4
2548         else
2549                 echo "I do not know how you can test for symbolic links." >&4
2550         fi
2551         $rm -f blurfl sym
2552         ;;
2553 *)      echo "No symbolic links, so not testing for their testing..." >&4
2554         ;;
2555 esac
2556 echo " "
2557
2558
2559 case "$mksymlinks" in
2560 $define|true|[yY]*)
2561         case "$src" in
2562         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2563                 exit 1
2564                 ;;
2565         *)      case "$lns:$issymlink" in
2566                 *"ln"*" -s:"*"test -"?)
2567                         echo "Creating the symbolic links..." >&4
2568                         echo "(First creating the subdirectories...)" >&4
2569                         cd ..
2570                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2571                                 read directory
2572                                 test -z "$directory" && break
2573                                 mkdir -p $directory
2574                         done
2575                         # Sanity check 1.
2576                         if test ! -d t/base; then
2577                                 echo "Failed to create the subdirectories.  Aborting." >&4
2578                                 exit 1
2579                         fi
2580                         echo "(Then creating the symlinks...)" >&4
2581                         awk '{print $1}' $src/MANIFEST | while true; do
2582                                 read filename
2583                                 test -z "$filename" && break
2584                                 if test -f $filename; then
2585                                         if $issymlink $filename; then
2586                                                 rm -f $filename
2587                                         fi
2588                                 fi
2589                                 if test -f $filename; then
2590                                         echo "$filename already exists, not symlinking."
2591                                 else
2592                                         ln -s $src/$filename $filename
2593                                 fi
2594                         done
2595                         # Sanity check 2.
2596                         if test ! -f t/base/lex.t; then
2597                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2598                                 exit 1
2599                         fi
2600                         cd UU
2601                         ;;
2602                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2603                         ;;
2604                 esac
2605                 ;;
2606         esac
2607         ;;
2608 esac
2609
2610
2611 case "$usecrosscompile" in
2612 $define|true|[yY]*)
2613         $echo "Cross-compiling..."
2614         croak=''
2615         case "$cc" in
2616         *-*-gcc) # A cross-compiling gcc, probably.
2617             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2618             ar=$targetarch-ar
2619             # leave out ld, choosing it is more complex
2620             nm=$targetarch-nm
2621             ranlib=$targetarch-ranlib
2622             $echo 'extern int foo;' > try.c
2623             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2624             shift
2625             if $test $# -gt 0; then
2626                 incpth="$incpth $*"
2627                 incpth="`$echo $incpth|$sed 's/^ //'`"
2628                 echo "Guessing incpth '$incpth'." >&4
2629                 for i in $*; do
2630                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2631                     if $test -d $j; then
2632                         libpth="$libpth $j"
2633                     fi
2634                 done   
2635                 libpth="`$echo $libpth|$sed 's/^ //'`"
2636                 echo "Guessing libpth '$libpth'." >&4
2637             fi
2638             $rm -f try.c
2639             ;;
2640         esac
2641         case "$targetarch" in
2642         '') echo "Targetarch not defined." >&4; croak=y ;;
2643         *)  echo "Using targetarch $targetarch." >&4 ;;
2644         esac
2645         case "$incpth" in
2646         '') echo "Incpth not defined." >&4; croak=y ;;
2647         *)  echo "Using incpth '$incpth'." >&4 ;;
2648         esac
2649         case "$libpth" in
2650         '') echo "Libpth not defined." >&4; croak=y ;;
2651         *)  echo "Using libpth '$libpth'." >&4 ;;
2652         esac
2653         case "$usrinc" in
2654         '') for i in $incpth; do
2655                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2656                     usrinc=$i
2657                     echo "Guessing usrinc $usrinc." >&4
2658                     break
2659                 fi
2660             done
2661             case "$usrinc" in
2662             '') echo "Usrinc not defined." >&4; croak=y ;;
2663             esac
2664             ;;
2665         *)  echo "Using usrinc $usrinc." >&4 ;;
2666         esac
2667         case "$targethost" in
2668         '') echo "Targethost not defined." >&4; croak=y ;;
2669         *)  echo "Using targethost $targethost." >&4
2670         esac
2671         locincpth=' '
2672         loclibpth=' '
2673         case "$croak" in
2674         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2675         esac
2676         case "$src" in
2677         /*) run=$src/Cross/run
2678             targetmkdir=$src/Cross/mkdir
2679             to=$src/Cross/to
2680             from=$src/Cross/from
2681             ;;
2682         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2683             run=$pwd/Cross/run
2684             targetmkdir=$pwd/Cross/mkdir
2685             to=$pwd/Cross/to
2686             from=$pwd/Cross/from
2687             ;;
2688         esac
2689         case "$targetrun" in
2690         '') targetrun=ssh ;;
2691         esac
2692         case "$targetto" in
2693         '') targetto=scp ;;
2694         esac
2695         case "$targetfrom" in
2696         '') targetfrom=scp ;;
2697         esac
2698         run=$run-$targetrun
2699         to=$to-$targetto
2700         from=$from-$targetfrom
2701         case "$targetdir" in
2702         '')  targetdir=/tmp
2703              echo "Guessing targetdir $targetdir." >&4
2704              ;;
2705         esac
2706         case "$targetuser" in
2707         '')  targetuser=root
2708              echo "Guessing targetuser $targetuser." >&4
2709              ;;
2710         esac
2711         case "$targetfrom" in
2712         scp)    q=-q ;;
2713         *)      q='' ;;
2714         esac
2715         case "$targetrun" in
2716         ssh|rsh)
2717             cat >$run <<EOF
2718 #!/bin/sh
2719 case "\$1" in
2720 -cwd)
2721   shift
2722   cwd=\$1
2723   shift
2724   ;;
2725 esac
2726 case "\$cwd" in
2727 '') cwd=$targetdir ;;
2728 esac
2729 exe=\$1
2730 shift
2731 if $test ! -f \$exe.xok; then
2732   $to \$exe
2733   $touch \$exe.xok
2734 fi
2735 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2736 EOF
2737             ;;
2738         *)  echo "Unknown targetrun '$targetrun'" >&4
2739             exit 1
2740             ;;
2741         esac
2742         case "$targetmkdir" in
2743         */Cross/mkdir)
2744             cat >$targetmkdir <<EOF
2745 #!/bin/sh
2746 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2747 EOF
2748             $chmod a+rx $targetmkdir
2749             ;;
2750         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2751             exit 1
2752             ;;
2753         esac
2754         case "$targetto" in
2755         scp|rcp)
2756             cat >$to <<EOF
2757 #!/bin/sh
2758 for f in \$@
2759 do
2760   case "\$f" in
2761   /*)
2762     $targetmkdir \`dirname \$f\`
2763     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2764     ;;
2765   *)
2766     $targetmkdir $targetdir/\`dirname \$f\`
2767     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2768     ;;
2769   esac
2770 done
2771 exit 0
2772 EOF
2773             ;;
2774         cp) cat >$to <<EOF
2775 #!/bin/sh
2776 for f in \$@
2777 do
2778   case "\$f" in
2779   /*)
2780     $mkdir -p $targetdir/\`dirname \$f\`
2781     $cp \$f $targetdir/\$f || exit 1
2782     ;;
2783   *)
2784     $targetmkdir $targetdir/\`dirname \$f\`
2785     $cp \$f $targetdir/\$f || exit 1
2786     ;;
2787   esac
2788 done
2789 exit 0
2790 EOF
2791             ;;
2792         *)  echo "Unknown targetto '$targetto'" >&4
2793             exit 1
2794             ;;
2795         esac
2796         case "$targetfrom" in
2797         scp|rcp)
2798           cat >$from <<EOF
2799 #!/bin/sh
2800 for f in \$@
2801 do
2802   $rm -f \$f
2803   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2804 done
2805 exit 0
2806 EOF
2807             ;;
2808         cp) cat >$from <<EOF
2809 #!/bin/sh
2810 for f in \$@
2811 do
2812   $rm -f \$f
2813   cp $targetdir/\$f . || exit 1
2814 done
2815 exit 0
2816 EOF
2817             ;;
2818         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2819             exit 1
2820             ;;
2821         esac
2822         if $test ! -f $run; then
2823             echo "Target 'run' script '$run' not found." >&4
2824         else
2825             $chmod a+rx $run
2826         fi
2827         if $test ! -f $to; then
2828             echo "Target 'to' script '$to' not found." >&4
2829         else
2830             $chmod a+rx $to
2831         fi
2832         if $test ! -f $from; then
2833             echo "Target 'from' script '$from' not found." >&4
2834         else
2835             $chmod a+rx $from
2836         fi
2837         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2838             exit 1
2839         fi
2840         cat >&4 <<EOF
2841 Using '$run' for remote execution,
2842 and '$from' and '$to'
2843 for remote file transfer.
2844 EOF
2845         ;;
2846 *)      run=''
2847         to=:
2848         from=:
2849         usecrosscompile='undef'
2850         targetarch=''
2851         ;;
2852 esac
2853
2854 : see whether [:lower:] and [:upper:] are supported character classes
2855 echo " "
2856 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2857 ABYZ)
2858         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2859         up='[:upper:]'
2860         low='[:lower:]'
2861         ;;
2862 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2863         # (0xc9 and 0xd1), therefore that is a nice testing point.
2864         if test "X$up" = X -o "X$low" = X; then
2865             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2866             ij) up='[A-Z]'
2867                 low='[a-z]'
2868                 ;;
2869             esac
2870         fi
2871         if test "X$up" = X -o "X$low" = X; then
2872             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2873             ij) up='A-Z'
2874                 low='a-z'
2875                 ;;
2876             esac
2877         fi
2878         if test "X$up" = X -o "X$low" = X; then
2879             case "`echo IJ | od -x 2>/dev/null`" in
2880             *C9D1*|*c9d1*)
2881                 echo "Hey, this might be EBCDIC." >&4
2882                 if test "X$up" = X -o "X$low" = X; then
2883                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2884                     ij) up='[A-IJ-RS-Z]'
2885                         low='[a-ij-rs-z]'
2886                         ;;
2887                     esac
2888                 fi
2889                 if test "X$up" = X -o "X$low" = X; then
2890                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2891                     ij) up='A-IJ-RS-Z'
2892                         low='a-ij-rs-z'
2893                         ;;
2894                     esac
2895                 fi
2896                 ;;
2897             esac
2898         fi
2899 esac
2900 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2901 ij)
2902     echo "Using $up and $low to convert case." >&4
2903     ;;
2904 *)
2905     echo "I don't know how to translate letters from upper to lower case." >&4
2906     echo "Your tr is not acting any way I know of." >&4
2907     exit 1
2908     ;;
2909 esac
2910 : set up the translation script tr, must be called with ./tr of course
2911 cat >tr <<EOSC
2912 $startsh
2913 case "\$1\$2" in
2914 '[A-Z][a-z]') exec $tr '$up' '$low';;
2915 '[a-z][A-Z]') exec $tr '$low' '$up';;
2916 esac
2917 exec $tr "\$@"
2918 EOSC
2919 chmod +x tr
2920 $eunicefix tr
2921
2922 : Try to determine whether config.sh was made on this system
2923 case "$config_sh" in
2924 '')
2925 myuname=`$uname -a 2>/dev/null`
2926 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2927 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2928 # because the A-Z/a-z are not consecutive.
2929 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2930         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2931 newmyuname="$myuname"
2932 dflt=n
2933 case "$knowitall" in
2934 '')
2935         if test -f ../config.sh; then
2936                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2937                         eval "`grep myuname= ../config.sh`"
2938                 fi
2939                 if test "X$myuname" = "X$newmyuname"; then
2940                         dflt=y
2941                 fi
2942         fi
2943         ;;
2944 *) dflt=y;;
2945 esac
2946
2947 : Get old answers from old config file if Configure was run on the
2948 : same system, otherwise use the hints.
2949 hint=default
2950 cd ..
2951 if test -f config.sh; then
2952         echo " "
2953         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2954         . UU/myread
2955         case "$ans" in
2956         n*|N*) echo "OK, I'll ignore it."
2957                 mv config.sh config.sh.old
2958                 myuname="$newmyuname"
2959                 ;;
2960         *)  echo "Fetching default answers from your old config.sh file..." >&4
2961                 tmp_n="$n"
2962                 tmp_c="$c"
2963                 tmp_sh="$sh"
2964                 . ./config.sh
2965                 cp config.sh UU
2966                 n="$tmp_n"
2967                 c="$tmp_c"
2968                 : Older versions did not always set $sh.  Catch re-use of such
2969                 : an old config.sh.
2970                 case "$sh" in
2971                 '') sh="$tmp_sh" ;;
2972                 esac
2973                 hint=previous
2974                 ;;
2975         esac
2976 fi
2977 . ./UU/checkcc
2978 if test ! -f config.sh; then
2979         $cat <<EOM
2980
2981 First time through, eh?  I have some defaults handy for some systems
2982 that need some extra help getting the Configure answers right:
2983
2984 EOM
2985         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2986         dflt=''
2987         : Half the following guesses are probably wrong... If you have better
2988         : tests or hints, please send them to perlbug@perl.org
2989         : The metaconfig authors would also appreciate a copy...
2990         $test -f /irix && osname=irix
2991         $test -f /xenix && osname=sco_xenix
2992         $test -f /dynix && osname=dynix
2993         $test -f /dnix && osname=dnix
2994         $test -f /lynx.os && osname=lynxos
2995         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2996         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2997         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2998         $test -f /bin/mips && /bin/mips && osname=mips
2999         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3000                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3001         $test -d /usr/apollo/bin && osname=apollo
3002         $test -f /etc/saf/_sactab && osname=svr4
3003         $test -d /usr/include/minix && osname=minix
3004         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3005         if $test -d /MachTen -o -d /MachTen_Folder; then
3006                 osname=machten
3007                 if $test -x /sbin/version; then
3008                         osvers=`/sbin/version | $awk '{print $2}' |
3009                         $sed -e 's/[A-Za-z]$//'`
3010                 elif $test -x /usr/etc/version; then
3011                         osvers=`/usr/etc/version | $awk '{print $2}' |
3012                         $sed -e 's/[A-Za-z]$//'`
3013                 else
3014                         osvers="$2.$3"
3015                 fi
3016         fi
3017
3018         $test -f /sys/posix.dll &&
3019                 $test -f /usr/bin/what &&
3020                 set X `/usr/bin/what /sys/posix.dll` &&
3021                 $test "$3" = UWIN &&
3022                 osname=uwin &&
3023                 osvers="$5"
3024
3025         if $test -f $uname; then
3026                 set X $myuname
3027                 shift
3028
3029                 case "$5" in
3030                 fps*) osname=fps ;;
3031                 mips*)
3032                         case "$4" in
3033                         umips) osname=umips ;;
3034                         *) osname=mips ;;
3035                         esac;;
3036                 [23]100) osname=mips ;;
3037                 next*) osname=next ;;
3038                 i386*)
3039                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3040                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3041                                 osname='sco'
3042                                 osvers=$tmp
3043                         elif $test -f /etc/kconfig; then
3044                                 osname=isc
3045                                 if test "$lns" = "$ln -s"; then
3046                                         osvers=4
3047                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3048                                         osvers=3
3049                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3050                                         osvers=2
3051                                 fi
3052                         fi
3053                         tmp=''
3054                         ;;
3055                 pc*)
3056                         if test -n "$DJGPP"; then
3057                                 osname=dos
3058                                 osvers=djgpp
3059                         fi
3060                         ;;
3061                 esac
3062
3063                 case "$1" in
3064                 aix) osname=aix
3065                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3066                         case "$tmp" in
3067                         'not found') osvers="$4"."$3" ;;
3068                         '<3240'|'<>3240') osvers=3.2.0 ;;
3069                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3070                         '=3250'|'>3250') osvers=3.2.5 ;;
3071                         *) osvers=$tmp;;
3072                         esac
3073                         ;;
3074                 bsd386) osname=bsd386
3075                         osvers=`$uname -r`
3076                         ;;
3077                 cygwin*) osname=cygwin
3078                         osvers="$3"
3079                         ;;
3080                 *dc.osx) osname=dcosx
3081                         osvers="$3"
3082                         ;;
3083                 dnix) osname=dnix
3084                         osvers="$3"
3085                         ;;
3086                 domainos) osname=apollo
3087                         osvers="$3"
3088                         ;;
3089                 dgux) osname=dgux 
3090                         osvers="$3"
3091                         ;;
3092                 dynixptx*) osname=dynixptx
3093                         osvers=`echo "$4"|sed 's/^v//'`
3094                         ;;
3095                 freebsd) osname=freebsd 
3096                         osvers="$3" ;;
3097                 genix) osname=genix ;;
3098                 hp*) osname=hpux 
3099                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3100                         ;;
3101                 irix*) osname=irix
3102                         case "$3" in
3103                         4*) osvers=4 ;;
3104                         5*) osvers=5 ;;
3105                         *)      osvers="$3" ;;
3106                         esac
3107                         ;;
3108                 linux) osname=linux
3109                         case "$3" in
3110                         *)      osvers="$3" ;;
3111                         esac
3112                         ;;
3113                 MiNT) osname=mint
3114                         ;;
3115                 netbsd*) osname=netbsd
3116                         osvers="$3"
3117                         ;;
3118                 news-os) osvers="$3"
3119                         case "$3" in
3120                         4*) osname=newsos4 ;;
3121                         *) osname=newsos ;;
3122                         esac
3123                         ;;
3124                 next*) osname=next ;;
3125                 nonstop-ux) osname=nonstopux ;;
3126                 openbsd) osname=openbsd
3127                         osvers="$3"
3128                         ;;
3129                 POSIX-BC | posix-bc ) osname=posix-bc
3130                         osvers="$3"
3131                         ;;
3132                 powerux | power_ux | powermax_os | powermaxos | \
3133                 powerunix | power_unix) osname=powerux
3134                         osvers="$3"
3135                         ;;
3136                 qnx) osname=qnx
3137                         osvers="$4"
3138                         ;;
3139                 solaris) osname=solaris
3140                         case "$3" in
3141                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3142                         *)      osvers="$3" ;;
3143                         esac
3144                         ;;
3145                 sunos) osname=sunos
3146                         case "$3" in
3147                         5*) osname=solaris
3148                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3149                         *)      osvers="$3" ;;
3150                         esac
3151                         ;;
3152                 titanos) osname=titanos
3153                         case "$3" in
3154                         1*) osvers=1 ;;
3155                         2*) osvers=2 ;;
3156                         3*) osvers=3 ;;
3157                         4*) osvers=4 ;;
3158                         *)      osvers="$3" ;;
3159                         esac
3160                         ;;
3161                 ultrix) osname=ultrix
3162                         osvers="$3"
3163                         ;;
3164                 osf1|mls+)      case "$5" in
3165                                 alpha)
3166                                         osname=dec_osf
3167                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3168                                         case "$osvers" in
3169                                         [1-9].[0-9]*) ;;
3170                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3171                                         esac
3172                                         ;;
3173                         hp*)    osname=hp_osf1  ;;
3174                         mips)   osname=mips_osf1 ;;
3175                         esac
3176                         ;;
3177                 unixware) osname=svr5
3178                         osvers="$4"
3179                         ;;
3180                 uts)    osname=uts
3181                         osvers="$3"
3182                         ;;
3183                 vos) osvers="$3"
3184                         ;;
3185                 $2) case "$osname" in
3186                         *isc*) ;;
3187                         *freebsd*) ;;
3188                         svr*)
3189                                 : svr4.x or possibly later
3190                                 case "svr$3" in 
3191                                 ${osname}*)
3192                                         osname=svr$3
3193                                         osvers=$4
3194                                         ;;
3195                                 esac
3196                                 case "$osname" in
3197                                 svr4.0)
3198                                         : Check for ESIX
3199                                         if test -f /stand/boot ; then
3200                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3201                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3202                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3203                                                         if test -n "$isesix"; then
3204                                                                 osname=esix4
3205                                                         fi
3206                                                 fi
3207                                         fi
3208                                         ;;
3209                                 esac
3210                                 ;;
3211                         *)      if test -f /etc/systemid; then
3212                                         osname=sco
3213                                         set `echo $3 | $sed 's/\./ /g'` $4
3214                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3215                                                 osvers=$1.$2.$3
3216                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3217                                                 osvers=$1.$2
3218                                         elif $test -f $src/hints/sco_$1.sh; then
3219                                                 osvers=$1
3220                                         fi
3221                                 else
3222                                         case "$osname" in
3223                                         '') : Still unknown.  Probably a generic Sys V.
3224                                                 osname="sysv"
3225                                                 osvers="$3"
3226                                                 ;;
3227                                         esac
3228                                 fi
3229                                 ;;
3230                         esac
3231                         ;;
3232                 *)      case "$osname" in
3233                         '') : Still unknown.  Probably a generic BSD.
3234                                 osname="$1"
3235                                 osvers="$3"
3236                                 ;;
3237                         esac
3238                         ;;
3239                 esac
3240         else
3241                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3242                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3243                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3244                                 osname=news_os
3245                         fi
3246                         $rm -f UU/kernel.what
3247                 elif test -d c:/.; then
3248                         set X $myuname
3249                         osname=os2
3250                         osvers="$5"
3251                 fi
3252         fi
3253         
3254         case "$targetarch" in
3255         '') ;;
3256         *)  hostarch=$osname
3257             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3258             osvers=''
3259             ;;
3260         esac
3261
3262         : Now look for a hint file osname_osvers, unless one has been
3263         : specified already.
3264         case "$hintfile" in
3265         ''|' ')
3266                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3267                 : Also try without trailing minor version numbers.
3268                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3269                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3270                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3271                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3272                 case "$file" in
3273                 '') dflt=none ;;
3274                 *)  case "$osvers" in
3275                         '') dflt=$file
3276                                 ;;
3277                         *)  if $test -f $src/hints/$file.sh ; then
3278                                         dflt=$file
3279                                 elif $test -f $src/hints/$xfile.sh ; then
3280                                         dflt=$xfile
3281                                 elif $test -f $src/hints/$xxfile.sh ; then
3282                                         dflt=$xxfile
3283                                 elif $test -f $src/hints/$xxxfile.sh ; then
3284                                         dflt=$xxxfile
3285                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3286                                         dflt=$xxxxfile
3287                                 elif $test -f "$src/hints/${osname}.sh" ; then
3288                                         dflt="${osname}"
3289                                 else
3290                                         dflt=none
3291                                 fi
3292                                 ;;
3293                         esac
3294                         ;;
3295                 esac
3296                 if $test -f Policy.sh ; then
3297                         case "$dflt" in
3298                         *Policy*) ;;
3299                         none) dflt="Policy" ;;
3300                         *) dflt="Policy $dflt" ;;
3301                         esac
3302                 fi
3303                 ;;
3304         *)
3305                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3306                 ;;
3307         esac
3308
3309         if $test -f Policy.sh ; then
3310                 $cat <<EOM
3311
3312 There's also a Policy hint file available, which should make the
3313 site-specific (policy) questions easier to answer.
3314 EOM
3315
3316         fi
3317
3318         $cat <<EOM
3319
3320 You may give one or more space-separated answers, or "none" if appropriate.
3321 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3322 is a good thing.  DO NOT give a wrong version or a wrong OS.
3323
3324 EOM
3325
3326         rp="Which of these apply, if any?"
3327         . UU/myread
3328         tans=$ans
3329         for file in $tans; do
3330                 if $test X$file = XPolicy -a -f Policy.sh; then
3331                         . Policy.sh
3332                         $cat Policy.sh >> UU/config.sh
3333                 elif $test -f $src/hints/$file.sh; then
3334                         . $src/hints/$file.sh
3335                         $cat $src/hints/$file.sh >> UU/config.sh
3336                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3337                         : nothing
3338                 else
3339                         : Give one chance to correct a possible typo.
3340                         echo "$file.sh does not exist"
3341                         dflt=$file
3342                         rp="hint to use instead?"
3343                         . UU/myread
3344                         for file in $ans; do
3345                                 if $test -f "$src/hints/$file.sh"; then
3346                                         . $src/hints/$file.sh
3347                                         $cat $src/hints/$file.sh >> UU/config.sh
3348                                 elif $test X$ans = X -o X$ans = Xnone ; then
3349                                         : nothing
3350                                 else
3351                                         echo "$file.sh does not exist -- ignored."
3352                                 fi
3353                         done
3354                 fi
3355         done
3356
3357         hint=recommended
3358         : Remember our hint file for later.
3359         if $test -f "$src/hints/$file.sh" ; then
3360                 hintfile="$file"
3361         else
3362                 hintfile=''
3363         fi
3364 fi
3365 cd UU
3366 ;;
3367 *)
3368         echo " "
3369         echo "Fetching default answers from $config_sh..." >&4
3370         tmp_n="$n"
3371         tmp_c="$c"
3372         cd ..
3373         cp $config_sh config.sh 2>/dev/null
3374         chmod +w config.sh
3375         . ./config.sh
3376         cd UU
3377         cp ../config.sh .
3378         n="$tmp_n"
3379         c="$tmp_c"
3380         hint=previous
3381         ;;
3382 esac
3383 test "$override" && . ./optdef.sh
3384
3385 : Restore computed paths
3386 for file in $loclist $trylist; do
3387         eval $file="\$_$file"
3388 done
3389
3390 cat << EOM
3391
3392 Configure uses the operating system name and version to set some defaults.
3393 The default value is probably right if the name rings a bell. Otherwise,
3394 since spelling matters for me, either accept the default or answer "none"
3395 to leave it blank.
3396
3397 EOM
3398 case "$osname" in
3399         ''|' ')
3400                 case "$hintfile" in
3401                 ''|' '|none) dflt=none ;;
3402                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3403                 esac
3404                 ;;
3405         *) dflt="$osname" ;;
3406 esac
3407 rp="Operating system name?"
3408 . ./myread
3409 case "$ans" in
3410 none)  osname='' ;;
3411 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3412 esac
3413 echo " "
3414 case "$osvers" in
3415         ''|' ')
3416                 case "$hintfile" in
3417                 ''|' '|none) dflt=none ;;
3418                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3419                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3420                         case "$dflt" in
3421                         ''|' ') dflt=none ;;
3422                         esac
3423                         ;;
3424                 esac
3425                 ;;
3426         *) dflt="$osvers" ;;
3427 esac
3428 rp="Operating system version?"
3429 . ./myread
3430 case "$ans" in
3431 none)  osvers='' ;;
3432 *) osvers="$ans" ;;
3433 esac
3434
3435
3436 . ./posthint.sh
3437
3438 : who configured the system
3439 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3440 cf_by=`(logname) 2>/dev/null`
3441 case "$cf_by" in
3442 "")
3443         cf_by=`(whoami) 2>/dev/null`
3444         case "$cf_by" in
3445         "") cf_by=unknown ;;
3446         esac ;;
3447 esac
3448
3449 : set up the script used to warn in case of inconsistency
3450 cat <<EOS >whoa
3451 $startsh
3452 EOS
3453 cat <<'EOSC' >>whoa
3454 dflt=y
3455 echo " "
3456 echo "*** WHOA THERE!!! ***" >&4
3457 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3458 rp="    Keep the $hint value?"
3459 . ./myread
3460 case "$ans" in
3461 y) td=$was; tu=$was;;
3462 esac
3463 EOSC
3464
3465 : function used to set $1 to $val
3466 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3467 case "$val$was" in
3468 $define$undef) . ./whoa; eval "$var=\$td";;
3469 $undef$define) . ./whoa; eval "$var=\$tu";;
3470 *) eval "$var=$val";;
3471 esac'
3472
3473 case "$usesocks" in
3474 $define|true|[yY]*)     dflt='y';;
3475 *) dflt='n';;
3476 esac
3477 cat <<EOM
3478
3479 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3480 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3481 to use the PerlIO abstraction layer, this will be implicitly selected.
3482
3483 If this doesn't make any sense to you, just accept the default '$dflt'.
3484 EOM
3485 rp='Build Perl for SOCKS?'
3486 . ./myread
3487 case "$ans" in
3488 y|Y)    val="$define" ;;     
3489 *)      val="$undef" ;;
3490 esac
3491 set usesocks
3492 eval $setvar
3493
3494 case "$usesocks" in
3495 $define|true|[yY]*) useperlio="$define";;
3496 esac
3497
3498 case "$useperlio" in
3499 $define|true|[yY]*|'')  dflt='y';;
3500 *) dflt='n';;
3501 esac
3502 cat <<EOM
3503
3504 Previous version of $package used the standard IO mechanisms as
3505 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3506 alternate IO mechanisms via the PerlIO abstraction layer, but the
3507 stdio mechanism is still available if needed.  The abstraction layer
3508 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3509 Using PerlIO with sfio may cause problems with some extension modules.
3510
3511 If this doesn't make any sense to you, just accept the default '$dflt'.
3512 EOM
3513 rp='Use the PerlIO abstraction layer?'
3514 . ./myread
3515 case "$ans" in
3516 y|Y) 
3517         val="$define"
3518         ;;
3519 *)      
3520         echo "Ok, doing things the stdio way."
3521         val="$undef"
3522         ;;
3523 esac
3524 set useperlio
3525 eval $setvar 
3526
3527 case "$usesocks" in
3528 $define|true|[yY]*)
3529         case "$useperlio" in
3530         $define|true|[yY]*) ;;
3531         *)      cat >&4 <<EOM
3532
3533 You are using the SOCKS proxy protocol library which means that you
3534 should also use the PerlIO layer.  You may be headed for trouble.
3535
3536 EOM
3537                 ;;
3538         esac
3539         ;;
3540 esac
3541
3542         
3543 case "$usethreads" in
3544 $define|true|[yY]*)     dflt='y';;
3545 *)     # Catch case where user specified ithreads or 5005threads but
3546        # forgot -Dusethreads (A.D. 4/2002)
3547        case "$useithreads$use5005threads" in
3548        *$define*)      
3549                 case "$useperlio" in
3550                 "$define")      dflt='y' ;;
3551                 *)              dflt='n' ;;
3552                 esac
3553                 ;;
3554        *)       dflt='n';;
3555        esac
3556        ;;
3557 esac
3558 cat <<EOM
3559
3560 Perl can be built to take advantage of threads on some systems.
3561 To do so, Configure can be run with -Dusethreads.
3562
3563 Note that Perl built with threading support runs slightly slower
3564 and uses more memory than plain Perl. The current implementation
3565 is believed to be stable, but it is fairly new, and so should be
3566 treated with caution.
3567
3568 If this doesn't make any sense to you, just accept the default '$dflt'.
3569 EOM
3570 rp='Build a threading Perl?'
3571 . ./myread
3572 case "$ans" in
3573 y|Y)    val="$define" ;;
3574 *)      val="$undef" ;;
3575 esac
3576 set usethreads
3577 eval $setvar
3578
3579 case "$usethreads" in
3580 $define)
3581         $cat <<EOM
3582
3583 Since release 5.6, Perl has had two different threading implementations,
3584 the newer interpreter-based version (ithreads) with one interpreter per
3585 thread, and the older 5.005 version (5005threads).
3586 The 5005threads version is effectively unmaintained and will probably be
3587 removed in Perl 5.10, so there should be no need to build a Perl using it
3588 unless needed for backwards compatibility with some existing 5.005threads
3589 code.
3590
3591 EOM
3592         : Default to ithreads unless overridden on command line or with
3593         : old config.sh
3594         dflt='y'
3595         case "$use5005threads" in
3596                 $define|true|[yY]*) dflt='n';;
3597         esac
3598         case "$useithreads" in
3599                 $undef|false|[nN]*) dflt='n';;
3600         esac
3601         rp='Use the newer interpreter-based ithreads?'
3602         . ./myread
3603         case "$ans" in
3604         y|Y)    val="$define" ;;
3605         *)      val="$undef" ;;
3606         esac
3607         set useithreads
3608         eval $setvar
3609         : Now set use5005threads to the opposite value.
3610         case "$useithreads" in
3611         $define) val="$undef" ;;
3612         *) val="$define" ;;
3613         esac
3614         set use5005threads
3615         eval $setvar
3616         ;;
3617 *)
3618         useithreads="$undef"
3619         use5005threads="$undef"
3620         ;;
3621 esac
3622
3623 case "$useithreads$use5005threads" in
3624 "$define$define")
3625         $cat >&4 <<EOM
3626
3627 You cannot have both the ithreads and the 5.005 threads enabled
3628 at the same time.  Disabling the 5.005 threads since they are
3629 much less stable than the ithreads.
3630
3631 EOM
3632         use5005threads="$undef"
3633         ;;
3634 esac
3635
3636 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3637         cat >&4 <<EOF
3638 ***
3639 *** To build with ithreads you must also use the PerlIO layer.
3640 *** Cannot continue, aborting.
3641 ***
3642 EOF
3643         exit 1
3644 fi
3645
3646 case "$d_oldpthreads" in
3647 '')     : Configure tests would be welcome here.  For now, assume undef.
3648         val="$undef" ;;
3649 *)      val="$d_oldpthreads" ;;
3650 esac
3651 set d_oldpthreads
3652 eval $setvar
3653
3654
3655 case "$usethreads" in
3656 "$define"|true|[yY]*)
3657 : Look for a hint-file generated 'call-back-unit'.  If the
3658 : user has specified that a threading perl is to be built,
3659 : we may need to set or change some other defaults.
3660         if $test -f usethreads.cbu; then
3661                 echo "Your platform has some specific hints for threaded builds, using them..."
3662                 . ./usethreads.cbu
3663         else
3664                 $cat <<EOM
3665 (Your platform doesn't have any specific hints for threaded builds.
3666  Assuming POSIX threads, then.)
3667 EOM
3668         fi
3669         ;;
3670 esac
3671
3672 cat <<EOM
3673
3674 Perl can be built so that multiple Perl interpreters can coexist
3675 within the same Perl executable.
3676 EOM
3677
3678 case "$useithreads" in
3679 $define)
3680         cat <<EOM
3681 This multiple interpreter support is required for interpreter-based threads.
3682 EOM
3683         val="$define"
3684         ;;
3685 *)      case "$usemultiplicity" in
3686         $define|true|[yY]*)     dflt='y';;
3687         *) dflt='n';;
3688         esac
3689         echo " "
3690         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3691         rp='Build Perl for multiplicity?'
3692         . ./myread
3693         case "$ans" in
3694         y|Y)    val="$define" ;;
3695         *)      val="$undef" ;;
3696         esac
3697         ;;
3698 esac
3699 set usemultiplicity
3700 eval $setvar
3701
3702
3703 case "$usemorebits" in
3704 "$define"|true|[yY]*)
3705         use64bitint="$define"
3706         uselongdouble="$define"
3707         usemorebits="$define"
3708         ;;
3709 *)      usemorebits="$undef"
3710         ;;
3711 esac
3712
3713 : make some quick guesses about what we are up against
3714 echo " "
3715 $echo $n "Hmm...  $c"
3716 echo exit 1 >bsd
3717 echo exit 1 >usg
3718 echo exit 1 >v7
3719 echo exit 1 >osf1
3720 echo exit 1 >eunice
3721 echo exit 1 >xenix
3722 echo exit 1 >venix
3723 echo exit 1 >os2
3724 d_bsd="$undef"
3725 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3726 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3727 then
3728         echo "Looks kind of like an OSF/1 system, but we'll see..."
3729         echo exit 0 >osf1
3730 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3731         xxx=`./loc addbib blurfl $pth`
3732         if $test -f $xxx; then
3733         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3734                 echo exit 0 >bsd
3735                 echo exit 0 >usg
3736         else
3737                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3738                         echo "Looks kind of like an extended USG system, but we'll see..."
3739                 else
3740                         echo "Looks kind of like a USG system, but we'll see..."
3741                 fi
3742                 echo exit 0 >usg
3743         fi
3744 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3745         echo "Looks kind of like a BSD system, but we'll see..."
3746         d_bsd="$define"
3747         echo exit 0 >bsd
3748 else
3749         echo "Looks kind of like a Version 7 system, but we'll see..."
3750         echo exit 0 >v7
3751 fi
3752 case "$eunicefix" in
3753 *unixtovms*)
3754         $cat <<'EOI'
3755 There is, however, a strange, musty smell in the air that reminds me of
3756 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3757 EOI
3758         echo exit 0 >eunice
3759         d_eunice="$define"
3760 : it so happens the Eunice I know will not run shell scripts in Unix format
3761         ;;
3762 *)
3763         echo " "
3764         echo "Congratulations.  You aren't running Eunice."
3765         d_eunice="$undef"
3766         ;;
3767 esac
3768 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3769 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3770 : semicolon as a patch separator
3771 case "$p_" in
3772 :) ;;
3773 *)
3774         $cat <<'EOI'
3775 I have the feeling something is not exactly right, however...don't tell me...
3776 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3777 (Or you may be running DOS with DJGPP.)
3778 EOI
3779         echo exit 0 >os2
3780         ;;
3781 esac
3782 if test -f /xenix; then
3783         echo "Actually, this looks more like a XENIX system..."
3784         echo exit 0 >xenix
3785         d_xenix="$define"
3786 else
3787         echo " "
3788         echo "It's not Xenix..."
3789         d_xenix="$undef"
3790 fi
3791 chmod +x xenix
3792 $eunicefix xenix
3793 if test -f /venix; then
3794         echo "Actually, this looks more like a VENIX system..."
3795         echo exit 0 >venix
3796 else
3797         echo " "
3798         if ./xenix; then
3799                 : null
3800         else
3801                 echo "Nor is it Venix..."
3802         fi
3803 fi
3804 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3805 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3806 $rm -f foo
3807
3808 case "$cc" in
3809 '') dflt=cc;;
3810 *) dflt="$cc";;
3811 esac
3812 rp="Use which C compiler?"
3813 . ./myread
3814 cc="$ans"
3815
3816 : See if they have not cc but they do have gcc
3817 . ./trygcc
3818 : Look for a hint-file generated 'call-back-unit'.  Now that the
3819 : user has specified the compiler, we may need to set or change some
3820 : other defaults.
3821 if $test -f cc.cbu; then
3822     . ./cc.cbu
3823 fi
3824 . ./checkcc
3825
3826 echo " "
3827 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3828 $cat >try.c <<EOM
3829 #include <stdio.h>
3830 int main() {
3831 #ifdef __GNUC__
3832 #ifdef __VERSION__
3833         printf("%s\n", __VERSION__);
3834 #else
3835         printf("%s\n", "1");
3836 #endif
3837 #endif
3838         exit(0);
3839 }
3840 EOM
3841 if $cc -o try $ccflags $ldflags try.c; then
3842         gccversion=`$run ./try`
3843         case "$gccversion" in
3844         '') echo "You are not using GNU cc." ;;
3845         *)  echo "You are using GNU cc $gccversion."
3846             ccname=gcc
3847             ;;
3848         esac
3849 else
3850         echo " "
3851         echo "*** WHOA THERE!!! ***" >&4
3852         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3853         case "$knowitall" in
3854         '')
3855         echo "    You'd better start hunting for one and let me know about it." >&4
3856                 exit 1
3857                 ;;
3858         esac
3859 fi
3860 $rm -f try try.*
3861 case "$gccversion" in
3862 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3863 esac
3864 case "$gccversion" in
3865 '') gccosandvers='' ;;
3866 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3867    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3868    gccshortvers=''
3869    case "$gccosandvers" in
3870    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3871    $osname$osvers) ;; # looking good
3872    $osname*) cat <<EOM >&4
3873
3874 *** WHOA THERE!!! ***
3875
3876     Your gcc has not been compiled for the exact release of
3877     your operating system ($gccosandvers versus $osname$osvers).
3878
3879     In general it is a good idea to keep gcc synchronized with
3880     the operating system because otherwise serious problems
3881     may ensue when trying to compile software, like Perl.
3882
3883     I'm trying to be optimistic here, though, and will continue.
3884     If later during the configuration and build icky compilation
3885     problems appear (headerfile conflicts being the most common
3886     manifestation), I suggest reinstalling the gcc to match
3887     your operating system release.
3888
3889 EOM
3890       ;;
3891    *) gccosandvers='' ;; # failed to parse, better be silent
3892    esac
3893    ;;
3894 esac
3895 case "$ccname" in
3896 '') ccname="$cc" ;;
3897 esac
3898
3899 # gcc 3.* complain about adding -Idirectories that they already know about,
3900 # so we will take those off from locincpth.
3901 case "$gccversion" in
3902 3*)
3903     echo "main(){}">try.c
3904     for incdir in $locincpth; do
3905        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
3906              grep '^c[cp]p*[01]: warning: changing search order '`
3907        if test "X$warn" != X; then
3908            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
3909        fi
3910     done
3911     $rm -f try try.*
3912 esac
3913
3914 : decide how portable to be.  Allow command line overrides.
3915 case "$d_portable" in
3916 "$undef") ;;
3917 *)      d_portable="$define" ;;
3918 esac
3919
3920 : set up shell script to do ~ expansion
3921 cat >filexp <<EOSS
3922 $startsh
3923 : expand filename
3924 case "\$1" in
3925  ~/*|~)
3926         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3927         ;;
3928  ~*)
3929         if $test -f /bin/csh; then
3930                 /bin/csh -f -c "glob \$1"
3931                 failed=\$?
3932                 echo ""
3933                 exit \$failed
3934         else
3935                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3936                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3937                 if $test ! -d "\$dir"; then
3938                         me=\`basename \$0\`
3939                         echo "\$me: can't locate home directory for: \$name" >&2
3940                         exit 1
3941                 fi
3942                 case "\$1" in
3943                 */*)
3944                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3945                         ;;
3946                 *)
3947                         echo \$dir
3948                         ;;
3949                 esac
3950         fi
3951         ;;
3952 *)
3953         echo \$1
3954         ;;
3955 esac
3956 EOSS
3957 chmod +x filexp
3958 $eunicefix filexp
3959
3960 : now set up to get a file name
3961 cat <<EOS >getfile
3962 $startsh
3963 EOS
3964 cat <<'EOSC' >>getfile
3965 tilde=''
3966 fullpath=''
3967 already=''
3968 skip=''
3969 none_ok=''
3970 exp_file=''
3971 nopath_ok=''
3972 orig_rp="$rp"
3973 orig_dflt="$dflt"
3974 case "$gfpth" in
3975 '') gfpth='.' ;;
3976 esac
3977
3978 case "$fn" in
3979 *\(*)
3980         : getfile will accept an answer from the comma-separated list
3981         : enclosed in parentheses even if it does not meet other criteria.
3982         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3983         fn=`echo $fn | sed 's/(.*)//'`
3984         ;;
3985 esac
3986
3987 case "$fn" in
3988 *:*)
3989         loc_file=`expr $fn : '.*:\(.*\)'`
3990         fn=`expr $fn : '\(.*\):.*'`
3991         ;;
3992 esac
3993
3994 case "$fn" in
3995 *~*) tilde=true;;
3996 esac
3997 case "$fn" in
3998 */*) fullpath=true;;
3999 esac
4000 case "$fn" in
4001 *+*) skip=true;;
4002 esac
4003 case "$fn" in
4004 *n*) none_ok=true;;
4005 esac
4006 case "$fn" in
4007 *e*) exp_file=true;;
4008 esac
4009 case "$fn" in
4010 *p*) nopath_ok=true;;
4011 esac
4012
4013 case "$fn" in
4014 *f*) type='File';;
4015 *d*) type='Directory';;
4016 *l*) type='Locate';;
4017 esac
4018
4019 what="$type"
4020 case "$what" in
4021 Locate) what='File';;
4022 esac
4023
4024 case "$exp_file" in
4025 '')
4026         case "$d_portable" in
4027         "$define") ;;
4028         *) exp_file=true;;
4029         esac
4030         ;;
4031 esac
4032
4033 cd ..
4034 while test "$type"; do
4035         redo=''
4036         rp="$orig_rp"
4037         dflt="$orig_dflt"
4038         case "$tilde" in
4039         true) rp="$rp (~name ok)";;
4040         esac
4041         . UU/myread
4042         if test -f UU/getfile.ok && \
4043                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4044         then
4045                 value="$ans"
4046                 ansexp="$ans"
4047                 break
4048         fi
4049         case "$ans" in
4050         none)
4051                 value=''
4052                 ansexp=''
4053                 case "$none_ok" in
4054                 true) type='';;
4055                 esac
4056                 ;;
4057         *)
4058                 case "$tilde" in
4059                 '') value="$ans"
4060                         ansexp="$ans";;
4061                 *)
4062                         value=`UU/filexp $ans`
4063                         case $? in
4064                         0)
4065                                 if test "$ans" != "$value"; then
4066                                         echo "(That expands to $value on this system.)"
4067                                 fi
4068                                 ;;
4069                         *) value="$ans";;
4070                         esac
4071                         ansexp="$value"
4072                         case "$exp_file" in
4073                         '') value="$ans";;
4074                         esac
4075                         ;;
4076                 esac
4077                 case "$fullpath" in
4078                 true)
4079                         case "$ansexp" in
4080                         /*) value="$ansexp" ;;
4081                         [a-zA-Z]:/*) value="$ansexp" ;;
4082                         *)
4083                                 redo=true
4084                                 case "$already" in
4085                                 true)
4086                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4087                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4088                                         ;;
4089                                 *)
4090                                 echo "Please give a full path name, starting with slash." >&4
4091                                         case "$tilde" in
4092                                         true)
4093                                 echo "Note that using ~name is ok provided it expands well." >&4
4094                                                 already=true
4095                                                 ;;
4096                                         esac
4097                                 esac
4098                                 ;;
4099                         esac
4100                         ;;
4101                 esac
4102                 case "$redo" in
4103                 '')
4104                         case "$type" in
4105                         File)
4106                                 for fp in $gfpth; do
4107                                         if test "X$fp" = X.; then
4108                                             pf="$ansexp"
4109                                         else    
4110                                             pf="$fp/$ansexp"
4111                                         fi
4112                                         if test -f "$pf"; then
4113                                                 type=''
4114                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4115                                         then
4116                                                 echo "($value is not a plain file, but that's ok.)"
4117                                                 type=''
4118                                         fi
4119                                         if test X"$type" = X; then
4120                                             value="$pf"
4121                                             break
4122                                         fi
4123                                 done
4124                                 ;;
4125                         Directory)
4126                                 for fp in $gfpth; do
4127                                         if test "X$fp" = X.; then
4128                                             dir="$ans"
4129                                             direxp="$ansexp"
4130                                         else    
4131                                             dir="$fp/$ansexp"
4132                                             direxp="$fp/$ansexp"
4133                                         fi
4134                                         if test -d "$direxp"; then
4135                                                 type=''
4136                                                 value="$dir"
4137                                                 break
4138                                         fi
4139                                 done
4140                                 ;;
4141                         Locate)
4142                                 if test -d "$ansexp"; then
4143                                         echo "(Looking for $loc_file in directory $value.)"
4144                                         value="$value/$loc_file"
4145                                         ansexp="$ansexp/$loc_file"
4146                                 fi
4147                                 if test -f "$ansexp"; then
4148                                         type=''
4149                                 fi
4150                                 case "$nopath_ok" in
4151                                 true)   case "$value" in
4152                                         */*) ;;
4153                                         *)      echo "Assuming $value will be in people's path."
4154                                                 type=''
4155                                                 ;;
4156                                         esac
4157                                         ;;
4158                                 esac
4159                                 ;;
4160                         esac
4161
4162                         case "$skip" in
4163                         true) type='';
4164                         esac
4165
4166                         case "$type" in
4167                         '') ;;
4168                         *)
4169                                 if test "$fastread" = yes; then
4170                                         dflt=y
4171                                 else
4172                                         dflt=n
4173                                 fi
4174                                 rp="$what $value doesn't exist.  Use that name anyway?"
4175                                 . UU/myread
4176                                 dflt=''
4177                                 case "$ans" in
4178                                 y*) type='';;
4179                                 *) echo " ";;
4180                                 esac
4181                                 ;;
4182                         esac
4183                         ;;
4184                 esac
4185                 ;;
4186         esac
4187 done
4188 cd UU
4189 ans="$value"
4190 rp="$orig_rp"
4191 dflt="$orig_dflt"
4192 rm -f getfile.ok
4193 test "X$gfpthkeep" != Xy && gfpth=""
4194 EOSC
4195
4196 : What should the include directory be ?
4197 echo " "
4198 $echo $n "Hmm...  $c"
4199 dflt='/usr/include'
4200 incpath=''
4201 mips_type=''
4202 if $test -f /bin/mips && /bin/mips; then
4203         echo "Looks like a MIPS system..."
4204         $cat >usr.c <<'EOCP'
4205 #ifdef SYSTYPE_BSD43
4206 /bsd43
4207 #endif
4208 EOCP
4209         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4210                 dflt='/bsd43/usr/include'
4211                 incpath='/bsd43'
4212                 mips_type='BSD 4.3'
4213         else
4214                 mips_type='System V'
4215         fi
4216         $rm -f usr.c usr.out
4217         echo "and you're compiling with the $mips_type compiler and libraries."
4218         xxx_prompt=y
4219         echo "exit 0" >mips
4220 else
4221         echo "Doesn't look like a MIPS system."
4222         xxx_prompt=n
4223         echo "exit 1" >mips
4224 fi
4225 chmod +x mips
4226 $eunicefix mips
4227 case "$usrinc" in
4228 '') ;;
4229 *) dflt="$usrinc";;
4230 esac
4231 case "$xxx_prompt" in
4232 y)      fn=d/
4233         echo " "
4234         rp='Where are the include files you want to use?'
4235         . ./getfile
4236         usrinc="$ans"
4237         ;;
4238 *)      usrinc="$dflt"
4239         ;;
4240 esac
4241
4242 : see how we invoke the C preprocessor
4243 echo " "
4244 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4245 cat <<'EOT' >testcpp.c
4246 #define ABC abc
4247 #define XYZ xyz
4248 ABC.XYZ
4249 EOT
4250 cd ..
4251 if test ! -f cppstdin; then
4252         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4253                 # AIX cc -E doesn't show the absolute headerfile
4254                 # locations but we'll cheat by using the -M flag.
4255                 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
4256         else
4257                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4258         fi
4259 else
4260         echo "Keeping your $hint cppstdin wrapper."
4261 fi
4262 chmod 755 cppstdin
4263 wrapper=`pwd`/cppstdin
4264 ok='false'
4265 cd UU
4266
4267 if $test "X$cppstdin" != "X" && \
4268         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4269         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4270 then
4271         echo "You used to use $cppstdin $cppminus so we'll use that again."
4272         case "$cpprun" in
4273         '') echo "But let's see if we can live without a wrapper..." ;;
4274         *)
4275                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4276                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4277                 then
4278                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4279                         ok='true'
4280                 else
4281                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4282                 fi
4283                 ;;
4284         esac
4285 else
4286         case "$cppstdin" in
4287         '') ;;
4288         *)
4289                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4290                 ;;
4291         esac
4292 fi
4293
4294 if $ok; then
4295         : nothing
4296 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4297         $cc -E <testcpp.c >testcpp.out 2>&1; \
4298         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4299         echo "Yup, it does."
4300         x_cpp="$cc -E"
4301         x_minus='';
4302 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4303         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4304         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4305         echo "Yup, it does."
4306         x_cpp="$cc -E"
4307         x_minus='-';
4308 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4309         $cc -P <testcpp.c >testcpp.out 2>&1; \
4310         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4311         echo "Yipee, that works!"
4312         x_cpp="$cc -P"
4313         x_minus='';
4314 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4315         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4316         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4317         echo "At long last!"
4318         x_cpp="$cc -P"
4319         x_minus='-';
4320 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4321         $cpp <testcpp.c >testcpp.out 2>&1; \
4322         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4323         echo "It works!"
4324         x_cpp="$cpp"
4325         x_minus='';
4326 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4327         $cpp - <testcpp.c >testcpp.out 2>&1; \
4328         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4329         echo "Hooray, it works!  I was beginning to wonder."
4330         x_cpp="$cpp"
4331         x_minus='-';
4332 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4333         $wrapper <testcpp.c >testcpp.out 2>&1; \
4334         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4335         x_cpp="$wrapper"
4336         x_minus=''
4337         echo "Eureka!"
4338 else
4339         dflt=''
4340         rp="No dice.  I can't find a C preprocessor.  Name one:"
4341         . ./myread
4342         x_cpp="$ans"
4343         x_minus=''
4344         $x_cpp <testcpp.c >testcpp.out 2>&1
4345         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4346                 echo "OK, that will do." >&4
4347         else
4348 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4349                 exit 1
4350         fi
4351 fi
4352
4353 case "$ok" in
4354 false)
4355         cppstdin="$x_cpp"
4356         cppminus="$x_minus"
4357         cpprun="$x_cpp"
4358         cpplast="$x_minus"
4359         set X $x_cpp
4360         shift
4361         case "$1" in
4362         "$cpp")
4363                 echo "Perhaps can we force $cc -E using a wrapper..."
4364                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4365                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4366                 then
4367                         echo "Yup, we can."
4368                         cppstdin="$wrapper"
4369                         cppminus='';
4370                 else
4371                         echo "Nope, we'll have to live without it..."
4372                 fi
4373                 ;;
4374         esac
4375         case "$cpprun" in
4376         "$wrapper")
4377                 cpprun=''
4378                 cpplast=''
4379                 ;;
4380         esac
4381         ;;
4382 esac
4383
4384 case "$cppstdin" in
4385 "$wrapper"|'cppstdin') ;;
4386 *) $rm -f $wrapper;;
4387 esac
4388 $rm -f testcpp.c testcpp.out
4389
4390 : Set private lib path
4391 case "$plibpth" in
4392 '') if ./mips; then
4393                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4394         fi;;
4395 esac
4396 case "$libpth" in
4397 ' ') dlist='';;
4398 '') dlist="$loclibpth $plibpth $glibpth";;
4399 *) dlist="$libpth";;
4400 esac
4401
4402 : Now check and see which directories actually exist, avoiding duplicates
4403 libpth=''
4404 for xxx in $dlist
4405 do
4406     if $test -d $xxx; then
4407                 case " $libpth " in
4408                 *" $xxx "*) ;;
4409                 *) libpth="$libpth $xxx";;
4410                 esac
4411     fi
4412 done
4413 $cat <<'EOM'
4414
4415 Some systems have incompatible or broken versions of libraries.  Among
4416 the directories listed in the question below, please remove any you
4417 know not to be holding relevant libraries, and add any that are needed.
4418 Say "none" for none.
4419
4420 EOM
4421 case "$libpth" in
4422 '') dflt='none';;
4423 *)
4424         set X $libpth
4425         shift
4426         dflt=${1+"$@"}
4427         ;;
4428 esac
4429 rp="Directories to use for library searches?"
4430 . ./myread
4431 case "$ans" in
4432 none) libpth=' ';;
4433 *) libpth="$ans";;
4434 esac
4435
4436 : compute shared library extension
4437 case "$so" in
4438 '')
4439         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4440                 dflt='sl'
4441         else
4442                 dflt='so'
4443         fi
4444         ;;
4445 *) dflt="$so";;
4446 esac
4447 $cat <<EOM
4448
4449 On some systems, shared libraries may be available.  Answer 'none' if
4450 you want to suppress searching of shared libraries for the remainder
4451 of this configuration.
4452
4453 EOM
4454 rp='What is the file extension used for shared libraries?'
4455 . ./myread
4456 so="$ans"
4457
4458 : Define several unixisms.
4459 : Hints files or command line option can be used to override them.
4460 : The convoluted testing is in case hints files set either the old
4461 : or the new name.
4462 case "$_exe" in
4463 '')     case "$exe_ext" in
4464         '')     ;;
4465         *)      _exe="$exe_ext" ;;
4466         esac
4467         ;;
4468 esac
4469 case "$_a" in
4470 '')     case "$lib_ext" in
4471     '') _a='.a';;
4472         *)      _a="$lib_ext" ;;
4473         esac
4474         ;;
4475 esac
4476 case "$_o" in
4477 '') case "$obj_ext" in
4478         '')     _o='.o';;
4479         *)      _o="$obj_ext";;
4480         esac
4481         ;;
4482 esac
4483 case "$p_" in
4484 '') case "$path_sep" in
4485         '')     p_=':';;
4486         *)      p_="$path_sep";;
4487         esac
4488         ;;
4489 esac
4490 exe_ext=$_exe
4491 lib_ext=$_a
4492 obj_ext=$_o
4493 path_sep=$p_
4494
4495 : Which makefile gets called first.  This is used by make depend.
4496 case "$firstmakefile" in
4497 '') firstmakefile='makefile';;
4498 esac
4499
4500 : Looking for optional libraries
4501 echo " "
4502 echo "Checking for optional libraries..." >&4
4503 case "$libs" in
4504 ' '|'') dflt='';;
4505 *) dflt="$libs";;
4506 esac
4507 case "$libswanted" in
4508 '') libswanted='c_s';;
4509 esac
4510 case "$usesocks" in
4511 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4512 esac
4513 libsfound=''
4514 libsfiles=''
4515 libsdirs=''
4516 libspath=''
4517 for thisdir in $libpth $xlibpth; do
4518   test -d $thisdir && libspath="$libspath $thisdir"
4519 done
4520 for thislib in $libswanted; do
4521         for thisdir in $libspath; do
4522             xxx=''
4523             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4524                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4525                 $test -f "$xxx" && eval $libscheck
4526                 $test -f "$xxx" && libstyle=shared
4527             fi
4528             if test ! -f "$xxx"; then
4529                 xxx=$thisdir/lib$thislib.$so
4530                 $test -f "$xxx" && eval $libscheck
4531                 $test -f "$xxx" && libstyle=shared
4532             fi  
4533             if test ! -f "$xxx"; then
4534                 xxx=$thisdir/lib$thislib$_a
4535                 $test -f "$xxx" && eval $libscheck
4536                 $test -f "$xxx" && libstyle=static
4537             fi
4538             if test ! -f "$xxx"; then
4539                 xxx=$thisdir/$thislib$_a
4540                 $test -f "$xxx" && eval $libscheck
4541                 $test -f "$xxx" && libstyle=static
4542             fi
4543             if test ! -f "$xxx"; then
4544                 xxx=$thisdir/lib${thislib}_s$_a
4545                 $test -f "$xxx" && eval $libscheck
4546                 $test -f "$xxx" && libstyle=static
4547                 $test -f "$xxx" && thislib=${thislib}_s
4548             fi
4549             if test ! -f "$xxx"; then
4550                 xxx=$thisdir/Slib$thislib$_a
4551                 $test -f "$xxx" && eval $libscheck
4552                 $test -f "$xxx" && libstyle=static
4553             fi
4554             if $test -f "$xxx"; then
4555                 case "$libstyle" in
4556                 shared) echo "Found -l$thislib (shared)." ;;
4557                 static) echo "Found -l$thislib." ;;
4558                 *)      echo "Found -l$thislib ($libstyle)." ;;
4559                 esac
4560                 case " $dflt " in
4561                 *"-l$thislib "*);;
4562                 *) dflt="$dflt -l$thislib"
4563                    libsfound="$libsfound $xxx"
4564                    yyy=`basename $xxx`
4565                    libsfiles="$libsfiles $yyy"
4566                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4567                    case " $libsdirs " in
4568                    *" $yyy "*) ;;
4569                    *) libsdirs="$libsdirs $yyy" ;;
4570                    esac
4571                    ;;
4572                 esac
4573                 break
4574             fi  
4575         done
4576         if $test ! -f "$xxx"; then
4577             echo "No -l$thislib."
4578         fi
4579 done
4580 set X $dflt
4581 shift
4582 dflt="$*"
4583 case "$libs" in
4584 '') dflt="$dflt";;
4585 *) dflt="$libs";;
4586 esac
4587 case "$dflt" in
4588 ' '|'') dflt='none';;
4589 esac
4590
4591 $cat <<EOM
4592
4593 In order to compile $package on your machine, a number of libraries
4594 are usually needed.  Include any other special libraries here as well.
4595 Say "none" for none.  The default list is almost always right.
4596 EOM
4597
4598 echo " "
4599 rp="What libraries to use?"
4600 . ./myread
4601 case "$ans" in
4602 none) libs=' ';;
4603 *) libs="$ans";;
4604 esac
4605
4606 : determine optimization, if desired, or use for debug flag also
4607 case "$optimize" in
4608 ' '|$undef) dflt='none';;
4609 '') dflt='-O';;
4610 *) dflt="$optimize";;
4611 esac
4612 $cat <<EOH
4613
4614 By default, $package compiles with the -O flag to use the optimizer.
4615 Alternately, you might want to use the symbolic debugger, which uses
4616 the -g flag (on traditional Unix systems).  Either flag can be
4617 specified here.  To use neither flag, specify the word "none".
4618
4619 EOH
4620 rp="What optimizer/debugger flag should be used?"
4621 . ./myread
4622 optimize="$ans"
4623 case "$optimize" in
4624 'none') optimize=" ";;
4625 esac
4626
4627 dflt=''
4628 : We will not override a previous value, but we might want to
4629 : augment a hint file
4630 case "$hint" in
4631 default|recommended)
4632         case "$gccversion" in
4633         1*) dflt='-fpcc-struct-return' ;;
4634         esac
4635         case "$optimize" in
4636         *-g*) dflt="$dflt -DDEBUGGING";;
4637         esac
4638         case "$gccversion" in
4639         2*) if test -d /etc/conf/kconfig.d &&
4640                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4641                 then
4642                         dflt="$dflt -posix"
4643                 fi
4644                 ;;
4645         esac
4646         case "$gccversion" in
4647         1*) ;;
4648         2.[0-8]*) ;;
4649         ?*)     echo " "
4650                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4651                 echo 'int main(void) { return 0; }' > gcctest.c
4652                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4653                         echo "Yes, it does." 2>&1
4654                         case "$ccflags" in
4655                         *strict-aliasing*) 
4656                                 echo "Leaving current flags $ccflags alone." 2>&1
4657                                 ;;
4658                         *) dflt="$dflt -fno-strict-aliasing" ;;
4659                         esac
4660                 else
4661                         echo "Nope, it doesn't, but that's ok." 2>&1
4662                 fi
4663                 ;;
4664         esac
4665         ;;
4666 esac
4667
4668 case "$mips_type" in
4669 *BSD*|'') inclwanted="$locincpth $usrinc";;
4670 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4671 esac
4672 for thisincl in $inclwanted; do
4673         if $test -d $thisincl; then
4674                 if $test x$thisincl != x$usrinc; then
4675                         case "$dflt" in
4676                         *" -I$thisincl "*);;
4677                         *) dflt="$dflt -I$thisincl ";;
4678                         esac
4679                 fi
4680         fi
4681 done
4682
4683 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4684         xxx=true;
4685 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4686         xxx=true;
4687 else
4688         xxx=false;
4689 fi;
4690 if $xxx; then
4691         case "$dflt" in
4692         *$2*);;
4693         *) dflt="$dflt -D$2";;
4694         esac;
4695 fi'
4696
4697 set signal.h LANGUAGE_C; eval $inctest
4698
4699 case "$usesocks" in
4700 $define)
4701         ccflags="$ccflags -DSOCKS"
4702         ;;
4703 esac
4704
4705 case "$hint" in
4706 default|recommended) dflt="$ccflags $dflt" ;;
4707 *) dflt="$ccflags";;
4708 esac
4709
4710 case "$dflt" in
4711 ''|' ') dflt=none;;
4712 esac
4713
4714 $cat <<EOH
4715
4716 Your C compiler may want other flags.  For this question you should include
4717 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4718 but you should NOT include libraries or ld flags like -lwhatever.  If you
4719 want $package to honor its debug switch, you should include -DDEBUGGING here.
4720 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4721
4722 To use no flags, specify the word "none".
4723
4724 EOH
4725 set X $dflt
4726 shift
4727 dflt=${1+"$@"}
4728 rp="Any additional cc flags?"
4729 . ./myread
4730 case "$ans" in
4731 none) ccflags='';;
4732 *) ccflags="$ans";;
4733 esac
4734
4735 : the following weeds options from ccflags that are of no interest to cpp
4736 case "$cppflags" in
4737 '') cppflags="$ccflags" ;;
4738 *)  cppflags="$cppflags $ccflags" ;;
4739 esac
4740 case "$gccversion" in
4741 1*) cppflags="$cppflags -D__GNUC__"
4742 esac
4743 case "$mips_type" in
4744 '');;
4745 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4746 esac
4747 case "$cppflags" in
4748 '');;
4749 *)
4750         echo " "
4751         echo "Let me guess what the preprocessor flags are..." >&4
4752         set X $cppflags
4753         shift
4754         cppflags=''
4755         $cat >cpp.c <<'EOM'
4756 #define BLURFL foo
4757
4758 BLURFL xx LFRULB
4759 EOM
4760         previous=''
4761         for flag in $*
4762         do
4763                 case "$flag" in
4764                 -*) ftry="$flag";;
4765                 *) ftry="$previous $flag";;
4766                 esac
4767                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4768                         >cpp1.out 2>/dev/null && \
4769                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4770                         >cpp2.out 2>/dev/null && \
4771                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4772                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4773                 then
4774                         cppflags="$cppflags $ftry"
4775                         previous=''
4776                 else
4777                         previous="$flag"
4778                 fi
4779         done
4780         set X $cppflags
4781         shift
4782         cppflags=${1+"$@"}
4783         case "$cppflags" in
4784         *-*)  echo "They appear to be: $cppflags";;
4785         esac
4786         $rm -f cpp.c cpp?.out
4787         ;;
4788 esac
4789
4790 : flags used in final linking phase
4791 case "$ldflags" in
4792 '') if ./venix; then
4793                 dflt='-i -z'
4794         else
4795                 dflt=''
4796         fi
4797         case "$ccflags" in
4798         *-posix*) dflt="$dflt -posix" ;;
4799         esac
4800         ;;
4801 *) dflt="$ldflags";;
4802 esac
4803
4804 : Try to guess additional flags to pick up local libraries.
4805 for thislibdir in $libpth; do
4806         case " $loclibpth " in
4807         *" $thislibdir "*)
4808                 case "$dflt " in 
4809                 *"-L$thislibdir "*) ;;
4810                 *)  dflt="$dflt -L$thislibdir" ;;
4811                 esac
4812                 ;;
4813         esac
4814 done
4815
4816 case "$dflt" in
4817 '') dflt='none' ;;
4818 esac
4819
4820 $cat <<EOH
4821
4822 Your C linker may need flags.  For this question you should
4823 include -L/whatever and any other flags used by the C linker, but you
4824 should NOT include libraries like -lwhatever.
4825
4826 Make sure you include the appropriate -L/path flags if your C linker
4827 does not normally search all of the directories you specified above,
4828 namely
4829         $libpth
4830 To use no flags, specify the word "none".
4831
4832 EOH
4833
4834 rp="Any additional ld flags (NOT including libraries)?"
4835 . ./myread
4836 case "$ans" in
4837 none) ldflags='';;
4838 *) ldflags="$ans";;
4839 esac
4840 rmlist="$rmlist pdp11"
4841
4842 : coherency check
4843 echo " "
4844 echo "Checking your choice of C compiler and flags for coherency..." >&4
4845 $cat > try.c <<'EOF'
4846 #include <stdio.h>
4847 int main() { printf("Ok\n"); exit(0); }
4848 EOF
4849 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4850 shift
4851 $cat >try.msg <<'EOM'
4852 I've tried to compile and run the following simple program:
4853
4854 EOM
4855 $cat try.c >> try.msg
4856
4857 $cat >> try.msg <<EOM
4858
4859 I used the command:
4860
4861         $*
4862         $run ./try
4863
4864 and I got the following output:
4865
4866 EOM
4867 dflt=y
4868 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4869         if $sh -c "$run ./try" >>try.msg 2>&1; then
4870                 xxx=`$run ./try`
4871                 case "$xxx" in
4872                 "Ok") dflt=n ;;
4873                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4874                         case " $libs " in
4875                         *" -lsfio "*)
4876                                 cat >> try.msg <<'EOQS'
4877 If $libs contains -lsfio, and sfio is mis-configured, then it
4878 sometimes (apparently) runs and exits with a 0 status, but with no
4879 output!  It may have to do with sfio's use of _exit vs. exit.
4880
4881 EOQS
4882                                 rp="You have a big problem.  Shall I abort Configure"
4883                                 dflt=y
4884                                 ;;
4885                         esac
4886                         ;;
4887                 esac
4888         else
4889                 echo "The program compiled OK, but exited with status $?." >>try.msg
4890                 rp="You have a problem.  Shall I abort Configure"
4891                 dflt=y
4892         fi
4893 else
4894         echo "I can't compile the test program." >>try.msg
4895         rp="You have a BIG problem.  Shall I abort Configure"
4896         dflt=y
4897 fi
4898 case "$dflt" in
4899 y)
4900         $cat try.msg >&4
4901         case "$knowitall" in
4902         '')
4903                 echo "(The supplied flags or libraries might be incorrect.)"
4904                 ;;
4905         *) dflt=n;;
4906         esac
4907         echo " "
4908         . ./myread
4909         case "$ans" in
4910         n*|N*) ;;
4911         *)      echo "Ok.  Stopping Configure." >&4
4912                 exit 1
4913                 ;;
4914         esac
4915         ;;
4916 n) echo "OK, that should do.";;
4917 esac
4918 $rm -f try try.* core
4919
4920 : define a shorthand compile call
4921 compile='
4922 mc_file=$1;
4923 shift;
4924 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4925 : define a shorthand compile call for compilations that should be ok.
4926 compile_ok='
4927 mc_file=$1;
4928 shift;
4929 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4930
4931 : check for lengths of integral types
4932 echo " "
4933 case "$intsize" in
4934 '')
4935         echo "Checking to see how big your integers are..." >&4
4936         $cat >try.c <<'EOCP'
4937 #include <stdio.h>
4938 int main()
4939 {
4940         printf("intsize=%d;\n", (int)sizeof(int));
4941         printf("longsize=%d;\n", (int)sizeof(long));
4942         printf("shortsize=%d;\n", (int)sizeof(short));
4943         exit(0);
4944 }
4945 EOCP
4946         set try
4947         if eval $compile_ok && $run ./try > /dev/null; then
4948                 eval `$run ./try`
4949                 echo "Your integers are $intsize bytes long."
4950                 echo "Your long integers are $longsize bytes long."
4951                 echo "Your short integers are $shortsize bytes long."
4952         else
4953                 $cat >&4 <<EOM
4954 !
4955 Help! I can't compile and run the intsize test program: please enlighten me!
4956 (This is probably a misconfiguration in your system or libraries, and
4957 you really ought to fix it.  Still, I'll try anyway.)
4958 !
4959 EOM
4960                 dflt=4
4961                 rp="What is the size of an integer (in bytes)?"
4962                 . ./myread
4963                 intsize="$ans"
4964                 dflt=$intsize
4965                 rp="What is the size of a long integer (in bytes)?"
4966                 . ./myread
4967                 longsize="$ans"
4968                 dflt=2
4969                 rp="What is the size of a short integer (in bytes)?"
4970                 . ./myread
4971                 shortsize="$ans"
4972         fi
4973         ;;
4974 esac
4975 $rm -f try try.*
4976
4977 : check for long long
4978 echo " "
4979 echo "Checking to see if you have long long..." >&4
4980 echo 'int main() { long long x = 7; return 0; }' > try.c
4981 set try
4982 if eval $compile; then
4983         val="$define"
4984         echo "You have long long."
4985 else
4986         val="$undef"
4987         echo "You do not have long long."
4988 fi
4989 $rm try.*
4990 set d_longlong
4991 eval $setvar
4992
4993 : check for length of long long
4994 case "${d_longlong}${longlongsize}" in
4995 $define)
4996         echo " "
4997         echo "Checking to see how big your long longs are..." >&4
4998         $cat >try.c <<'EOCP'
4999 #include <stdio.h>
5000 int main()
5001 {
5002     printf("%d\n", (int)sizeof(long long));
5003     return(0);
5004 }
5005 EOCP
5006         set try
5007         if eval $compile_ok; then
5008                 longlongsize=`$run ./try`
5009                 echo "Your long longs are $longlongsize bytes long."
5010         else
5011                 dflt='8'
5012                 echo " "
5013                 echo "(I can't seem to compile the test program.  Guessing...)"
5014                 rp="What is the size of a long long (in bytes)?"
5015                 . ./myread
5016                 longlongsize="$ans"
5017         fi
5018         if $test "X$longsize" = "X$longlongsize"; then
5019                 echo "(That isn't any different from an ordinary long.)"
5020         fi      
5021         ;;
5022 esac
5023 $rm -f try.* try
5024
5025 : determine filename position in cpp output
5026 echo " "
5027 echo "Computing filename position in cpp output for #include directives..." >&4
5028 case "$osname" in
5029 vos) testaccess=-e ;;
5030 *)   testaccess=-r ;;
5031 esac
5032 echo '#include <stdio.h>' > foo.c
5033 $cat >fieldn <<EOF
5034 $startsh
5035 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5036 $grep '^[       ]*#.*stdio\.h' | \
5037 while read cline; do
5038         pos=1
5039         set \$cline
5040         while $test \$# -gt 0; do
5041                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5042                         echo "\$pos"
5043                         exit 0
5044                 fi
5045                 shift
5046                 pos=\`expr \$pos + 1\`
5047         done
5048 done
5049 EOF
5050 chmod +x fieldn
5051 fieldn=`./fieldn`
5052 $rm -f foo.c fieldn
5053 case $fieldn in
5054 '') pos='???';;
5055 1) pos=first;;
5056 2) pos=second;;
5057 3) pos=third;;
5058 *) pos="${fieldn}th";;
5059 esac
5060 echo "Your cpp writes the filename in the $pos field of the line."
5061
5062 case "$osname" in
5063 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5064 *)   cppfilter='' ;;
5065 esac
5066 : locate header file
5067 $cat >findhdr <<EOF
5068 $startsh
5069 wanted=\$1
5070 name=''
5071 for usrincdir in $usrinc
5072 do
5073         if test -f \$usrincdir/\$wanted; then
5074                 echo "\$usrincdir/\$wanted"
5075                 exit 0
5076         fi
5077 done
5078 awkprg='{ print \$$fieldn }'
5079 echo "#include <\$wanted>" > foo\$\$.c
5080 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5081 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5082 while read cline; do
5083         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5084         case "\$name" in
5085         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5086         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5087         *) exit 2;;
5088         esac;
5089 done;
5090 #
5091 # status = 0: grep returned 0 lines, case statement not executed
5092 # status = 1: headerfile found
5093 # status = 2: while loop executed, no headerfile found
5094 #
5095 status=\$?
5096 $rm -f foo\$\$.c;
5097 if test \$status -eq 1; then
5098         exit 0;
5099 fi
5100 exit 1
5101 EOF
5102 chmod +x findhdr
5103
5104 : define an alternate in-header-list? function
5105 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5106 cont=true; xxf="echo \"<\$1> found.\" >&4";
5107 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5108 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5109 esac;
5110 case $# in 4) instead=instead;; *) instead="at last";; esac;
5111 while $test "$cont"; do
5112         xxx=`./findhdr $1`
5113         var=$2; eval "was=\$$2";
5114         if $test "$xxx" && $test -r "$xxx";
5115         then eval $xxf;
5116         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5117                 cont="";
5118         else eval $xxnf;
5119         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5120         set $yyy; shift; shift; yyy=$@;
5121         case $# in 0) cont="";;
5122         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5123                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5124         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5125                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5126         esac;
5127 done;
5128 while $test "$yyy";
5129 do set $yyy; var=$2; eval "was=\$$2";
5130         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5131         set $yyy; shift; shift; yyy=$@;
5132 done'
5133
5134 : see if inttypes.h is available
5135 : we want a real compile instead of Inhdr because some systems
5136 : have an inttypes.h which includes non-existent headers
5137 echo " "
5138 $cat >try.c <<EOCP
5139 #include <inttypes.h>
5140 int main() {
5141         static int32_t foo32 = 0x12345678;
5142 }
5143 EOCP
5144 set try
5145 if eval $compile; then
5146         echo "<inttypes.h> found." >&4
5147         val="$define"
5148 else
5149         echo "<inttypes.h> NOT found." >&4
5150         val="$undef"
5151 fi
5152 $rm -f try.c try
5153 set i_inttypes
5154 eval $setvar
5155
5156 : check for int64_t
5157 echo " "
5158 echo "Checking to see if you have int64_t..." >&4
5159 $cat >try.c <<EOCP
5160 #include <sys/types.h>
5161 #$i_inttypes I_INTTYPES
5162 #ifdef I_INTTYPES
5163 #include <inttypes.h>
5164 #endif
5165 int main() { int64_t x = 7; }
5166 EOCP
5167 set try
5168 if eval $compile; then
5169         val="$define"
5170         echo "You have int64_t."
5171 else
5172         val="$undef"
5173         echo "You do not have int64_t."
5174 fi
5175 $rm -f try try.*
5176 set d_int64_t
5177 eval $setvar
5178
5179
5180 echo " "
5181 echo "Checking which 64-bit integer type we could use..." >&4
5182
5183 case "$intsize" in
5184 8) val=int
5185    set quadtype
5186    eval $setvar
5187    val='"unsigned int"'
5188    set uquadtype
5189    eval $setvar
5190    quadkind=1
5191    ;;
5192 *) case "$longsize" in
5193    8) val=long
5194       set quadtype
5195       eval $setvar
5196       val='"unsigned long"'
5197       set uquadtype
5198       eval $setvar
5199       quadkind=2
5200       ;;
5201    *) case "$d_longlong:$longlongsize" in
5202       define:8)
5203         val='"long long"'
5204         set quadtype
5205         eval $setvar
5206         val='"unsigned long long"'
5207         set uquadtype
5208         eval $setvar
5209         quadkind=3
5210         ;;
5211       *) case "$d_int64_t" in
5212          define)
5213            val=int64_t
5214            set quadtype
5215            eval $setvar
5216            val=uint64_t
5217            set uquadtype
5218            eval $setvar
5219            quadkind=4
5220            ;;
5221          esac
5222          ;;
5223       esac
5224       ;;
5225    esac
5226    ;;
5227 esac
5228
5229 case "$quadtype" in
5230 '')     echo "Alas, no 64-bit integer types in sight." >&4
5231         d_quad="$undef"
5232         ;;
5233 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5234         d_quad="$define"
5235         ;;
5236 esac
5237
5238
5239 case "$uselonglong" in
5240 "$define"|true|[yY]*)
5241         cat <<EOM >&4
5242
5243 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5244 EOM
5245         use64bitint="$define"
5246         ;;
5247 esac                          
5248 case "$use64bits" in
5249 "$define"|true|[yY]*)
5250         cat <<EOM >&4
5251
5252 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5253 EOM
5254         use64bitint="$define"
5255         ;;
5256 esac                          
5257 case "$use64bitints" in
5258 "$define"|true|[yY]*)
5259         cat <<EOM >&4
5260
5261 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5262 EOM
5263         use64bitint="$define"
5264         ;;
5265 esac                          
5266 case "$use64bitsint" in
5267 "$define"|true|[yY]*)
5268         cat <<EOM >&4
5269
5270 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5271 EOM
5272         use64bitint="$define"
5273         ;;
5274 esac                          
5275 case "$uselonglongs" in
5276 "$define"|true|[yY]*)
5277         cat <<EOM >&4
5278
5279 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5280 EOM
5281         use64bitint="$define"
5282         ;;
5283 esac                          
5284 case "$use64bitsall" in
5285 "$define"|true|[yY]*)
5286         cat <<EOM >&4
5287
5288 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5289 EOM
5290         use64bitall="$define"
5291         ;;
5292 esac                          
5293
5294 case "$ccflags" in
5295 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5296 esac
5297 case "$use64bitall" in
5298 "$define"|true|[yY]*) use64bitint="$define" ;;
5299 esac
5300
5301 case "$longsize" in
5302 8) cat <<EOM
5303
5304 You have natively 64-bit long integers.
5305 EOM
5306    val="$define"
5307    ;;
5308 *) case "$use64bitint" in
5309    "$define"|true|[yY]*) dflt='y';;
5310    *) dflt='n';;
5311    esac
5312    case "$d_quad" in
5313    "$define") ;;
5314    *) dflt='n' ;;
5315    esac
5316    cat <<EOM
5317
5318 Perl can be built to take advantage of 64-bit integer types
5319 on some systems.  To do so, Configure can be run with -Duse64bitint.
5320 Choosing this option will most probably introduce binary incompatibilities.
5321
5322 If this doesn't make any sense to you, just accept the default '$dflt'.
5323 (The default has been chosen based on your configuration.)
5324 EOM
5325    rp='Try to use 64-bit integers, if available?'
5326    . ./myread
5327    case "$ans" in
5328    [yY]*) val="$define" ;;
5329    *)     val="$undef"  ;;
5330    esac
5331    ;;
5332 esac
5333 set use64bitint
5334 eval $setvar
5335
5336 case "$use64bitall" in
5337 "$define"|true|[yY]*) dflt='y' ;;
5338 *) case "$longsize" in
5339    8) dflt='y' ;;
5340    *) dflt='n' ;;
5341    esac
5342    ;;
5343 esac    
5344 cat <<EOM
5345
5346 You may also choose to try maximal 64-bitness.  It means using as much
5347 64-bitness as possible on the platform.  This in turn means even more
5348 binary incompatibilities.  On the other hand, your platform may not
5349 have any more 64-bitness available than what you already have chosen.
5350
5351 If this doesn't make any sense to you, just accept the default '$dflt'.
5352 (The default has been chosen based on your configuration.)
5353 EOM
5354 rp='Try to use maximal 64-bit support, if available?'
5355 . ./myread
5356 case "$ans" in
5357 [yY]*) val="$define" ;;
5358 *)     val="$undef"  ;;
5359 esac
5360 set use64bitall
5361 eval $setvar
5362 case "$use64bitall" in
5363 "$define")
5364         case "$use64bitint" in
5365         "$undef")
5366                 cat <<EOM
5367
5368 Since you have chosen a maximally 64-bit build, I'm also turning on
5369 the use of 64-bit integers.
5370 EOM
5371                 use64bitint="$define" ;;
5372         esac
5373         ;;
5374 esac
5375
5376 case "$use64bitint" in
5377 "$define"|true|[yY]*)
5378 : Look for a hint-file generated 'call-back-unit'.  If the
5379 : user has specified that a 64-bit perl is to be built,
5380 : we may need to set or change some other defaults.
5381         if $test -f use64bitint.cbu; then
5382                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5383                 . ./use64bitint.cbu
5384         fi
5385         case "$longsize" in
5386         4) case "$archname64" in
5387            '') archname64=64int ;;
5388            esac
5389            ;;
5390         esac
5391         ;;
5392 esac
5393
5394 case "$use64bitall" in
5395 "$define"|true|[yY]*)
5396 : Look for a hint-file generated 'call-back-unit'.  If the
5397 : user has specified that a maximally 64-bit perl is to be built,
5398 : we may need to set or change some other defaults.
5399         if $test -f use64bitall.cbu; then
5400                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5401                 . ./use64bitall.cbu
5402         fi
5403         case "$longsize" in
5404         4) case "$archname64" in
5405            ''|64int) archname64=64all ;;
5406            esac
5407            ;;
5408         esac
5409         ;;
5410 esac
5411
5412 echo " "
5413 echo "Checking for GNU C Library..." >&4
5414 cat >try.c <<'EOCP'
5415 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
5416    alone are insufficient to distinguish different versions, such as
5417    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
5418    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
5419 */
5420 #include <stdio.h>
5421 int main(void)
5422 {
5423 #ifdef __GLIBC__
5424 #   ifdef __GLIBC_MINOR__
5425 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
5426 #           include <gnu/libc-version.h>
5427             printf("%s\n",  gnu_get_libc_version());
5428 #       else
5429             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
5430 #       endif
5431 #   else
5432         printf("%d\n",  __GLIBC__);
5433 #   endif
5434     return 0;
5435 #else
5436     return 1;
5437 #endif
5438 }
5439 EOCP
5440 set try
5441 if eval $compile_ok && $run ./try > glibc.ver; then
5442         val="$define"
5443         gnulibc_version=`$cat glibc.ver`
5444         echo "You are using the GNU C Library version $gnulibc_version"
5445 else
5446         val="$undef"
5447         gnulibc_version=''
5448         echo "You are not using the GNU C Library"
5449 fi
5450 $rm -f try try.* glibc.ver
5451 set d_gnulibc
5452 eval $setvar
5453
5454 : see if nm is to be used to determine whether a symbol is defined or not
5455 case "$usenm" in
5456 '')
5457         dflt=''
5458         case "$d_gnulibc" in
5459         "$define")
5460                 echo " "
5461                 echo "nm probably won't work on the GNU C Library." >&4
5462                 dflt=n
5463                 ;;
5464         esac
5465         case "$dflt" in
5466         '') 
5467                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
5468                         echo " "
5469                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5470                         echo "'nm' won't be sufficient on this sytem." >&4
5471                         dflt=n
5472                 fi
5473                 ;;
5474         esac
5475         case "$dflt" in
5476         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5477                 if $test $dflt -gt 20; then
5478                         dflt=y
5479                 else
5480                         dflt=n
5481                 fi
5482                 ;;
5483         esac
5484         ;;
5485 *)
5486         case "$usenm" in
5487         true|$define) dflt=y;;
5488         *) dflt=n;;
5489         esac
5490         ;;
5491 esac
5492 $cat <<EOM
5493
5494 I can use $nm to extract the symbols from your C libraries. This
5495 is a time consuming task which may generate huge output on the disk (up
5496 to 3 megabytes) but that should make the symbols extraction faster. The
5497 alternative is to skip the 'nm' extraction part and to compile a small
5498 test program instead to determine whether each symbol is present. If
5499 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5500 this may be the best solution.
5501
5502 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5503
5504 EOM
5505 rp="Shall I use $nm to extract C symbols from the libraries?"
5506 . ./myread
5507 case "$ans" in
5508 [Nn]*) usenm=false;;
5509 *) usenm=true;;
5510 esac
5511
5512 runnm=$usenm
5513 case "$reuseval" in
5514 true) runnm=false;;
5515 esac
5516
5517 : nm options which may be necessary
5518 case "$nm_opt" in
5519 '') if $test -f /mach_boot; then
5520                 nm_opt=''       # Mach
5521         elif $test -d /usr/ccs/lib; then
5522                 nm_opt='-p'     # Solaris (and SunOS?)
5523         elif $test -f /dgux; then
5524                 nm_opt='-p'     # DG-UX
5525         elif $test -f /lib64/rld; then
5526                 nm_opt='-p'     # 64-bit Irix
5527         else
5528                 nm_opt=''
5529         fi;;
5530 esac
5531
5532 : nm options which may be necessary for shared libraries but illegal
5533 : for archive libraries.  Thank you, Linux.
5534 case "$nm_so_opt" in
5535 '')     case "$myuname" in
5536         *linux*)
5537                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5538                         nm_so_opt='--dynamic'
5539                 fi
5540                 ;;
5541         esac
5542         ;;
5543 esac
5544
5545 case "$runnm" in
5546 true)
5547 : get list of predefined functions in a handy place
5548 echo " "
5549 case "$libc" in
5550 '') libc=unknown
5551         case "$libs" in
5552         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5553         esac
5554         ;;
5555 esac
5556 case "$libs" in
5557 '') ;;
5558 *)  for thislib in $libs; do
5559         case "$thislib" in
5560         -lc|-lc_s)
5561                 : Handle C library specially below.
5562                 ;;
5563         -l*)
5564                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5565                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5566                         :
5567                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5568                         :
5569                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5570                         :
5571                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5572                         :
5573                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5574                         :
5575                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5576                         :
5577                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5578                         :
5579                 else
5580                         try=''
5581                 fi
5582                 libnames="$libnames $try"
5583                 ;;
5584         *) libnames="$libnames $thislib" ;;
5585         esac
5586         done
5587         ;;
5588 esac
5589 xxx=normal
5590 case "$libc" in
5591 unknown)
5592         set /lib/libc.$so
5593         for xxx in $libpth; do
5594                 $test -r $1 || set $xxx/libc.$so
5595                 : The messy sed command sorts on library version numbers.
5596                 $test -r $1 || \
5597                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5598                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5599                                 h
5600                                 s/[0-9][0-9]*/0000&/g
5601                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5602                                 G
5603                                 s/\n/ /' | \
5604                          $sort | $sed -e 's/^.* //'`
5605                 eval set \$$#
5606         done
5607         $test -r $1 || set /usr/ccs/lib/libc.$so
5608         $test -r $1 || set /lib/libsys_s$_a
5609         ;;
5610 *)
5611         set blurfl
5612         ;;
5613 esac
5614 if $test -r "$1"; then
5615         echo "Your (shared) C library seems to be in $1."
5616         libc="$1"
5617 elif $test -r /lib/libc && $test -r /lib/clib; then
5618         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5619         xxx=apollo
5620         libc='/lib/clib /lib/libc'
5621         if $test -r /lib/syslib; then
5622                 echo "(Your math library is in /lib/syslib.)"
5623                 libc="$libc /lib/syslib"
5624         fi
5625 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5626         echo "Your C library seems to be in $libc, as you said before."
5627 elif $test -r $incpath/usr/lib/libc$_a; then
5628         libc=$incpath/usr/lib/libc$_a;
5629         echo "Your C library seems to be in $libc.  That's fine."
5630 elif $test -r /lib/libc$_a; then
5631         libc=/lib/libc$_a;
5632         echo "Your C library seems to be in $libc.  You're normal."
5633 else
5634         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5635                 :
5636         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5637                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5638         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5639                 :
5640         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5641                 :
5642         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5643                 :
5644         else
5645                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5646         fi
5647         if $test -r "$tans"; then
5648                 echo "Your C library seems to be in $tans, of all places."
5649                 libc=$tans
5650         else
5651                 libc='blurfl'
5652         fi
5653 fi
5654 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5655         dflt="$libc"
5656         cat <<EOM
5657
5658 If the guess above is wrong (which it might be if you're using a strange
5659 compiler, or your machine supports multiple models), you can override it here.
5660
5661 EOM
5662 else
5663         dflt=''
5664         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5665         cat >&4 <<EOM
5666 I can't seem to find your C library.  I've looked in the following places:
5667
5668 EOM
5669         $sed 's/^/      /' libpath
5670         cat <<EOM
5671
5672 None of these seems to contain your C library. I need to get its name...
5673
5674 EOM
5675 fi
5676 fn=f
5677 rp='Where is your C library?'
5678 . ./getfile
5679 libc="$ans"
5680
5681 echo " "
5682 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5683 set X `cat libnames`
5684 shift
5685 xxx=files
5686 case $# in 1) xxx=file; esac
5687 echo "Extracting names from the following $xxx for later perusal:" >&4
5688 echo " "
5689 $sed 's/^/      /' libnames >&4
5690 echo " "
5691 $echo $n "This may take a while...$c" >&4
5692
5693 for file in $*; do
5694         case $file in
5695         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5696         *) $nm $nm_opt $file 2>/dev/null;;
5697         esac
5698 done >libc.tmp
5699
5700 $echo $n ".$c"
5701 $grep fprintf libc.tmp > libc.ptf
5702 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5703 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
5704 xxx='[ADTSIW]'
5705 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5706         eval $xscan;\
5707         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5708                 eval $xrun
5709 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5710         eval $xscan;\
5711         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5712                 eval $xrun
5713 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5714         eval $xscan;\
5715         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5716                 eval $xrun
5717 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5718         eval $xscan;\
5719         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5720                 eval $xrun
5721 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5722         eval $xscan;\
5723         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5724                 eval $xrun
5725 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5726         eval $xscan;\
5727         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5728                 eval $xrun
5729 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5730                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5731         eval $xscan;\
5732         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5733                 eval $xrun
5734 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5735         eval $xscan;\
5736         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5737                 eval $xrun
5738 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5739         eval $xscan;\
5740         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5741                 eval $xrun
5742 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5743         eval $xscan;\
5744         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5745                 eval $xrun
5746 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5747         eval $xscan;\
5748         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5749                 eval $xrun
5750 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5751         eval $xscan;\
5752         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5753                 eval $xrun
5754 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5755         eval $xscan;\
5756         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5757                 eval $xrun
5758 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5759         eval $xscan;\
5760         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5761                 eval $xrun
5762 else
5763         $nm -p $* 2>/dev/null >libc.tmp
5764         $grep fprintf libc.tmp > libc.ptf
5765         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5766                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5767         then
5768                 nm_opt='-p'
5769                 eval $xrun
5770         else
5771                 echo " "
5772                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5773                 com=''
5774                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5775                         for thisname in $libnames $libc; do
5776                                 $ar t $thisname >>libc.tmp
5777                         done
5778                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5779                         echo "Ok." >&4
5780                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5781                         # Repeat libc to extract forwarders to DLL entries too
5782                         for thisname in $libnames $libc; do
5783                                 $ar tv $thisname >>libc.tmp
5784                                 # Revision 50 of EMX has bug in $ar.
5785                                 # it will not extract forwarders to DLL entries
5786                                 # Use emximp which will extract exactly them.
5787                                 emximp -o tmp.imp $thisname \
5788                                     2>/dev/null && \
5789                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5790                                     < tmp.imp >>libc.tmp
5791                                 $rm tmp.imp
5792                         done
5793                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5794                         echo "Ok." >&4
5795                 else
5796                         echo "$ar didn't seem to work right." >&4
5797                         echo "Maybe this is a Cray...trying bld instead..." >&4
5798                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5799                         then
5800                                 for thisname in $libnames; do
5801                                         bld t $libnames | \
5802                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5803                                         $ar t $thisname >>libc.tmp
5804                                 done
5805                                 echo "Ok." >&4
5806                         else
5807                                 echo "That didn't work either.  Giving up." >&4
5808                                 exit 1
5809                         fi
5810                 fi
5811         fi
5812 fi
5813 nm_extract="$com"
5814 case "$PASE" in
5815 define)
5816     echo " "
5817     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
5818     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
5819     ;;
5820 *)  if $test -f /lib/syscalls.exp; then
5821         echo " "
5822         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5823         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
5824     fi
5825     ;;
5826 esac
5827 ;;
5828 esac
5829 $rm -f libnames libpath
5830
5831 : is a C symbol defined?
5832 csym='tlook=$1;
5833 case "$3" in
5834 -v) tf=libc.tmp; tc=""; tdc="";;
5835 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5836 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5837 esac;
5838 tx=yes;
5839 case "$reuseval-$4" in
5840 true-) ;;
5841 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5842 esac;
5843 case "$tx" in
5844 yes)
5845         case "$runnm" in
5846         true)
5847                 if $contains $tlook $tf >/dev/null 2>&1;
5848                 then tval=true;
5849                 else tval=false;
5850                 fi;;
5851         *)
5852                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5853                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5854                 then tval=true;
5855                 else tval=false;
5856                 fi;
5857                 $rm -f t t.c;;
5858         esac;;
5859 *)
5860         case "$tval" in
5861         $define) tval=true;;
5862         *) tval=false;;
5863         esac;;
5864 esac;
5865 eval "$2=$tval"'
5866
5867 : define an is-in-libc? function
5868 inlibc='echo " "; td=$define; tu=$undef;
5869 sym=$1; var=$2; eval "was=\$$2";
5870 tx=yes;
5871 case "$reuseval$was" in
5872 true) ;;
5873 true*) tx=no;;
5874 esac;
5875 case "$tx" in
5876 yes)
5877         set $sym tres -f;
5878         eval $csym;
5879         case "$tres" in
5880         true)
5881                 echo "$sym() found." >&4;
5882                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5883         *)
5884                 echo "$sym() NOT found." >&4;
5885                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5886         esac;;
5887 *)
5888         case "$was" in
5889         $define) echo "$sym() found." >&4;;
5890         *) echo "$sym() NOT found." >&4;;
5891         esac;;
5892 esac'
5893
5894 : see if sqrtl exists
5895 set sqrtl d_sqrtl
5896 eval $inlibc
5897
5898 hasproto='varname=$1; func=$2; shift; shift;
5899 while $test $# -ge 2; do
5900         case "$1" in
5901         $define) echo "#include <$2>";;
5902         esac ;
5903     shift 2;
5904 done > try.c;
5905 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
5906 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
5907         echo "$func() prototype found.";
5908         val="$define";
5909 else
5910         echo "$func() prototype NOT found.";
5911         val="$undef";
5912 fi;
5913 set $varname;
5914 eval $setvar;
5915 $rm -f try.c tryout.c'
5916
5917 : check for length of double
5918 echo " "
5919 case "$doublesize" in
5920 '')
5921         echo "Checking to see how big your double precision numbers are..." >&4
5922         $cat >try.c <<'EOCP'
5923 #include <stdio.h>
5924 int main()
5925 {
5926     printf("%d\n", (int)sizeof(double));
5927     exit(0);
5928 }
5929 EOCP
5930         set try
5931         if eval $compile_ok; then
5932                 doublesize=`$run ./try`
5933                 echo "Your double is $doublesize bytes long."
5934         else
5935                 dflt='8'
5936                 echo "(I can't seem to compile the test program.  Guessing...)"
5937                 rp="What is the size of a double precision number (in bytes)?"
5938                 . ./myread
5939                 doublesize="$ans"
5940         fi
5941         ;;
5942 esac
5943 $rm -f try.c try
5944
5945 : check for long doubles
5946 echo " "
5947 echo "Checking to see if you have long double..." >&4
5948 echo 'int main() { long double x = 7.0; }' > try.c
5949 set try
5950 if eval $compile; then
5951         val="$define"
5952         echo "You have long double."
5953 else
5954         val="$undef"
5955         echo "You do not have long double."
5956 fi
5957 $rm try.*
5958 set d_longdbl
5959 eval $setvar
5960
5961 : check for length of long double
5962 case "${d_longdbl}${longdblsize}" in
5963 $define)
5964         echo " "
5965         echo "Checking to see how big your long doubles are..." >&4
5966         $cat >try.c <<'EOCP'
5967 #include <stdio.h>
5968 int main()
5969 {
5970         printf("%d\n", sizeof(long double));
5971 }
5972 EOCP
5973         set try
5974         set try
5975         if eval $compile; then
5976                 longdblsize=`$run ./try`
5977                 echo "Your long doubles are $longdblsize bytes long."
5978         else
5979                 dflt='8'
5980                 echo " "
5981                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5982                 rp="What is the size of a long double (in bytes)?"
5983                 . ./myread
5984                 longdblsize="$ans"
5985         fi
5986         if $test "X$doublesize" = "X$longdblsize"; then
5987                 echo "(That isn't any different from an ordinary double.)"
5988         fi      
5989         ;;
5990 esac
5991 $rm -f try.* try
5992
5993 echo " "
5994
5995 if $test X"$d_longdbl" = X"$define"; then
5996
5997 echo "Checking how to print long doubles..." >&4
5998
5999 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
6000         $cat >try.c <<'EOCP'
6001 #include <sys/types.h>
6002 #include <stdio.h>
6003 int main() {
6004   double d = 123.456;
6005   printf("%.3f\n", d);
6006 }
6007 EOCP
6008         set try
6009         if eval $compile; then
6010                 yyy=`$run ./try`
6011                 case "$yyy" in
6012                 123.456)
6013                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
6014                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
6015                         echo "We will use %f."
6016                         ;;
6017                 esac
6018         fi
6019 fi
6020
6021 if $test X"$sPRIfldbl" = X; then
6022         $cat >try.c <<'EOCP'
6023 #include <sys/types.h>
6024 #include <stdio.h>
6025 int main() {
6026   long double d = 123.456;
6027   printf("%.3Lf\n", d);
6028 }
6029 EOCP
6030         set try
6031         if eval $compile; then
6032                 yyy=`$run ./try`
6033                 case "$yyy" in
6034                 123.456)
6035                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
6036                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
6037                         echo "We will use %Lf."
6038                         ;;
6039                 esac
6040         fi
6041 fi
6042
6043 if $test X"$sPRIfldbl" = X; then
6044         $cat >try.c <<'EOCP'
6045 #include <sys/types.h>
6046 #include <stdio.h>
6047 int main() {
6048   long double d = 123.456;
6049   printf("%.3llf\n", d);
6050 }
6051 EOCP
6052         set try
6053         if eval $compile; then
6054                 yyy=`$run ./try`
6055                 case "$yyy" in
6056                 123.456)
6057                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
6058                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
6059                         echo "We will use %llf."
6060                         ;;
6061                 esac
6062         fi
6063 fi
6064
6065 if $test X"$sPRIfldbl" = X; then
6066         $cat >try.c <<'EOCP'
6067 #include <sys/types.h>
6068 #include <stdio.h>
6069 int main() {
6070   long double d = 123.456;
6071   printf("%.3lf\n", d);
6072 }
6073 EOCP
6074         set try
6075         if eval $compile; then
6076                 yyy=`$run ./try`
6077                 case "$yyy" in
6078                 123.456)
6079                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
6080                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
6081                         echo "We will use %lf."
6082                         ;;
6083                 esac
6084         fi
6085 fi
6086
6087 if $test X"$sPRIfldbl" = X; then
6088         echo "Cannot figure out how to print long doubles." >&4
6089 else
6090         sSCNfldbl=$sPRIfldbl    # expect consistency
6091 fi
6092
6093 $rm -f try try.*
6094
6095 fi # d_longdbl
6096
6097 case "$sPRIfldbl" in
6098 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
6099         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
6100         d_SCNfldbl="$undef";
6101         ;;
6102 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
6103         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
6104         d_SCNfldbl="$define";
6105         ;;
6106 esac
6107
6108 : see if modfl exists
6109 set modfl d_modfl
6110 eval $inlibc
6111
6112 : see if prototype for modfl is available
6113 echo " "
6114 set d_modflproto modfl math.h
6115 eval $hasproto
6116
6117 d_modfl_pow32_bug="$undef"
6118
6119 case "$d_longdbl$d_modfl" in
6120 $define$define)
6121         $cat <<EOM
6122 Checking to see whether your modfl() is okay for large values...
6123 EOM
6124 $cat >try.c <<EOCP
6125 #include <math.h> 
6126 #include <stdio.h>
6127 EOCP
6128 if $test "X$d_modflproto" != "X$define"; then
6129         $cat >>try.c <<EOCP
6130 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
6131 long double modfl (long double, long double *);
6132 EOCP
6133 fi
6134 $cat >>try.c <<EOCP
6135 int main() {
6136     long double nv = 4294967303.15;
6137     long double v, w;
6138     v = modfl(nv, &w);         
6139 #ifdef __GLIBC__
6140     printf("glibc");
6141 #endif
6142     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
6143     return 0;
6144 }
6145 EOCP
6146         case "$osname:$gccversion" in
6147         aix:)   saveccflags="$ccflags"
6148                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
6149         esac
6150         set try
6151         if eval $compile; then
6152                 foo=`$run ./try`
6153                 case "$foo" in
6154                 *" 4294967303.150000 1.150000 4294967302.000000")
6155                         echo >&4 "Your modfl() is broken for large values."
6156                         d_modfl_pow32_bug="$define"
6157                         case "$foo" in
6158                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
6159                         ;;
6160                         esac
6161                         ;;
6162                 *" 4294967303.150000 0.150000 4294967303.000000")
6163                         echo >&4 "Your modfl() seems okay for large values."
6164                         ;;
6165                 *)      echo >&4 "I don't understand your modfl() at all."
6166                         d_modfl="$undef"
6167                         ;;
6168                 esac
6169                 $rm -f try.* try core core.try.*
6170         else
6171                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
6172                 d_modfl="$undef"
6173         fi
6174         case "$osname:$gccversion" in
6175         aix:)   ccflags="$saveccflags" ;; # restore
6176         esac
6177         ;;
6178 esac
6179
6180 case "$ccflags" in
6181 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6182 esac
6183
6184 case "$uselongdouble" in
6185 $define|true|[yY]*)     dflt='y';;
6186 *) dflt='n';;
6187 esac
6188 cat <<EOM
6189
6190 Perl can be built to take advantage of long doubles which
6191 (if available) may give more accuracy and range for floating point numbers.
6192
6193 If this doesn't make any sense to you, just accept the default '$dflt'.
6194 EOM
6195 rp='Try to use long doubles if available?'
6196 . ./myread
6197 case "$ans" in
6198 y|Y)    val="$define"   ;;
6199 *)      val="$undef"    ;;
6200 esac
6201 set uselongdouble
6202 eval $setvar
6203
6204 case "$uselongdouble" in
6205 true|[yY]*) uselongdouble="$define" ;;
6206 esac
6207
6208 case "$uselongdouble" in
6209 $define)
6210 : Look for a hint-file generated 'call-back-unit'.  If the
6211 : user has specified that long doubles should be used,
6212 : we may need to set or change some other defaults.
6213         if $test -f uselongdouble.cbu; then
6214                 echo "Your platform has some specific hints for long doubles, using them..."
6215                 . ./uselongdouble.cbu
6216         else
6217                 $cat <<EOM
6218 (Your platform doesn't have any specific hints for long doubles.)
6219 EOM
6220         fi
6221         ;;
6222 esac
6223
6224 message=X
6225 case "$uselongdouble:$d_sqrtl:$d_modfl" in
6226 $define:$define:$define)
6227         : You have both
6228         ;;
6229 $define:$define:$undef)
6230         message="I could not find modfl"
6231         ;;
6232 $define:$undef:$define)
6233         message="I could not find sqrtl"
6234         ;;
6235 $define:$undef:$undef)
6236         message="I found neither sqrtl nor modfl"
6237         ;;
6238 esac
6239
6240 if $test "$message" != X; then
6241         $cat <<EOM >&4
6242
6243 *** You requested the use of long doubles but you do not seem to have
6244 *** the mathematic functions for long doubles.
6245 *** ($message)
6246 *** I'm disabling the use of long doubles.
6247
6248 EOM
6249
6250         uselongdouble=$undef
6251 fi
6252
6253 : determine the architecture name
6254 echo " "
6255 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6256         tarch=`arch`"-$osname"
6257 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6258         if uname -m > tmparch 2>&1 ; then
6259                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6260                         -e 's/$/'"-$osname/" tmparch`
6261         else
6262                 tarch="$osname"
6263         fi
6264         $rm -f tmparch
6265 else
6266         tarch="$osname"
6267 fi
6268 case "$myarchname" in
6269 ''|"$tarch") ;;
6270 *)
6271         echo "(Your architecture name used to be $myarchname.)"
6272         archname=''
6273         ;;
6274 esac
6275 case "$targetarch" in
6276 '') ;;
6277 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6278 esac
6279 myarchname="$tarch"
6280 case "$archname" in
6281 '') dflt="$tarch";;
6282 *) dflt="$archname";;
6283 esac
6284 rp='What is your architecture name'
6285 . ./myread
6286 archname="$ans"
6287 case "$usethreads" in
6288 $define)
6289         echo "Threads selected." >&4
6290         case "$archname" in
6291         *-thread*) echo "...and architecture name already has -thread." >&4
6292                 ;;
6293         *)      archname="$archname-thread"
6294                 echo "...setting architecture name to $archname." >&4
6295                 ;;
6296         esac
6297         ;;
6298 esac
6299 case "$usemultiplicity" in
6300 $define)
6301         echo "Multiplicity selected." >&4
6302         case "$archname" in
6303         *-multi*) echo "...and architecture name already has -multi." >&4
6304                 ;;
6305         *)      archname="$archname-multi"
6306                 echo "...setting architecture name to $archname." >&4
6307                 ;;
6308         esac
6309         ;;
6310 esac
6311 case "$use64bitint$use64bitall" in
6312 *"$define"*)
6313         case "$archname64" in
6314         '')
6315                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6316                 ;;
6317         *)
6318                 case "$use64bitint" in
6319                 "$define") echo "64 bit integers selected." >&4 ;;
6320                 esac
6321                 case "$use64bitall" in
6322                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6323                 esac
6324                 case "$archname" in
6325                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6326                         ;;
6327                 *)      archname="$archname-$archname64"
6328                         echo "...setting architecture name to $archname." >&4
6329                         ;;
6330                 esac
6331                 ;;
6332         esac
6333 esac
6334 case "$uselongdouble" in
6335 $define)
6336         echo "Long doubles selected." >&4
6337         case "$longdblsize" in
6338         $doublesize)
6339                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6340                 ;;
6341         *)
6342                 case "$archname" in
6343                 *-ld*) echo "...and architecture name already has -ld." >&4
6344                         ;;
6345                 *)      archname="$archname-ld"
6346                         echo "...setting architecture name to $archname." >&4
6347                         ;;
6348                 esac
6349                 ;;
6350         esac
6351         ;;
6352 esac
6353 case "$useperlio" in
6354 $define)
6355         echo "Perlio selected." >&4
6356         ;;
6357 *)
6358         echo "Perlio not selected, using stdio." >&4
6359         case "$archname" in
6360         *-stdio*) echo "...and architecture name already has -stdio." >&4
6361                 ;;
6362         *)      archname="$archname-stdio"
6363                 echo "...setting architecture name to $archname." >&4
6364                 ;;
6365         esac
6366         ;;
6367 esac
6368
6369 : determine root of directory hierarchy where package will be installed.
6370 case "$prefix" in
6371 '')
6372         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
6373         ;;
6374 *?/)
6375         dflt=`echo "$prefix" | sed 's/.$//'`
6376         ;;
6377 *)
6378         dflt="$prefix"
6379         ;;
6380 esac
6381 $cat <<EOM
6382
6383 By default, $package will be installed in $dflt/bin, manual pages
6384 under $dflt/man, etc..., i.e. with $dflt as prefix for all
6385 installation directories. Typically this is something like /usr/local.
6386 If you wish to have binaries under /usr/bin but other parts of the
6387 installation under /usr/local, that's ok: you will be prompted
6388 separately for each of the installation directories, the prefix being
6389 only used to set the defaults.
6390
6391 EOM
6392 fn=d~
6393 rp='Installation prefix to use?'
6394 . ./getfile
6395 oldprefix=''
6396 case "$prefix" in
6397 '') ;;
6398 *)
6399         case "$ans" in
6400         "$prefix") ;;
6401         *) oldprefix="$prefix";;
6402         esac
6403         ;;
6404 esac
6405 prefix="$ans"
6406 prefixexp="$ansexp"
6407
6408 case "$afsroot" in
6409 '')     afsroot=/afs ;;
6410 *)      afsroot=$afsroot ;;
6411 esac
6412
6413 : is AFS running?
6414 echo " "
6415 case "$afs" in
6416 $define|true)   afs=true ;;
6417 $undef|false)   afs=false ;;
6418 *)      if test -d $afsroot; then
6419                 afs=true
6420         else
6421                 afs=false
6422         fi
6423         ;;
6424 esac
6425 if $afs; then
6426         echo "AFS may be running... I'll be extra cautious then..." >&4
6427 else
6428         echo "AFS does not seem to be running..." >&4
6429 fi
6430
6431 : determine installation prefix for where package is to be installed.
6432 if $afs; then 
6433 $cat <<EOM
6434
6435 Since you are running AFS, I need to distinguish the directory in which
6436 files will reside from the directory in which they are installed (and from
6437 which they are presumably copied to the former directory by occult means).
6438
6439 EOM
6440         case "$installprefix" in
6441         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6442         *) dflt="$installprefix";;
6443         esac
6444 else
6445 $cat <<EOM
6446
6447 In some special cases, particularly when building $package for distribution,
6448 it is convenient to distinguish the directory in which files should be
6449 installed from the directory ($prefix) in which they will
6450 eventually reside.  For most users, these two directories are the same.
6451
6452 EOM
6453         case "$installprefix" in
6454         '') dflt=$prefix ;;
6455         *) dflt=$installprefix;;
6456         esac
6457 fi
6458 fn=d~
6459 rp='What installation prefix should I use for installing files?'
6460 . ./getfile
6461 installprefix="$ans"
6462 installprefixexp="$ansexp"
6463
6464 : set the prefixit variable, to compute a suitable default value
6465 prefixit='case "$3" in
6466 ""|none)
6467         case "$oldprefix" in
6468         "") eval "$1=\"\$$2\"";;
6469         *)
6470                 case "$3" in
6471                 "") eval "$1=";;
6472                 none)
6473                         eval "tp=\"\$$2\"";
6474                         case "$tp" in
6475                         ""|" ") eval "$1=\"\$$2\"";;
6476                         *) eval "$1=";;
6477                         esac;;
6478                 esac;;
6479         esac;;
6480 *)
6481         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6482         case "$tp" in
6483         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6484         /*-$oldprefix/*|\~*-$oldprefix/*)
6485                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6486         *) eval "$1=\"\$$2\"";;
6487         esac;;
6488 esac'
6489
6490 : get the patchlevel
6491 echo " "
6492 echo "Getting the current patchlevel..." >&4
6493 if $test -r $rsrc/patchlevel.h;then
6494         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6495         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6496         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6497         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6498         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6499         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6500        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6501 else
6502         revision=0
6503         patchlevel=0
6504         subversion=0
6505         api_revision=0
6506         api_version=0
6507         api_subversion=0
6508         perl_patchlevel=0
6509         $echo "(You do not have patchlevel.h.  Eek.)"
6510 fi
6511 if $test -r $rsrc/.patch ; then  
6512         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6513                 perl_patchlevel=`cat $rsrc/.patch`
6514         fi
6515 fi
6516 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
6517 version_patchlevel_string="version $patchlevel subversion $subversion"
6518 case "$perl_patchlevel" in
6519 0|'') ;;
6520 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
6521 esac
6522
6523 $echo "(You have $package $version_patchlevel_string.)"
6524
6525 case "$osname" in
6526 dos|vms)
6527         : XXX Should be a Configure test for double-dots in filenames.
6528         version=`echo $revision $patchlevel $subversion | \
6529                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6530         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6531                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6532         ;;
6533 *)
6534         version=`echo $revision $patchlevel $subversion | \
6535                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6536         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6537                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6538         ;;
6539 esac
6540 : Special case the 5.005_xx maintenance series, which used 5.005
6541 : without any subversion label as a subdirectory in $sitelib
6542 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6543         api_versionstring='5.005'
6544 fi
6545
6546 : determine installation style
6547 : For now, try to deduce it from prefix unless it is already set.
6548 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6549 case "$installstyle" in
6550 '')     case "$prefix" in
6551                 *perl*) dflt='lib';;
6552                 *) dflt='lib/perl5' ;;
6553         esac
6554         ;;
6555 *)      dflt="$installstyle" ;;
6556 esac
6557 : Probably not worth prompting for this since we prompt for all
6558 : the directories individually, and the prompt would be too long and
6559 : confusing anyway.
6560 installstyle=$dflt
6561
6562 : determine where private library files go
6563 : Usual default is /usr/local/lib/perl5/$version.
6564 : Also allow things like /opt/perl/lib/$version, since 
6565 : /opt/perl/lib/perl5... would be redundant.
6566 : The default "style" setting is made in installstyle.U
6567 case "$installstyle" in
6568 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6569 *)       set dflt privlib lib/$version ;;
6570 esac
6571 eval $prefixit
6572 $cat <<EOM
6573
6574 There are some auxiliary files for $package that need to be put into a
6575 private library directory that is accessible by everyone.
6576
6577 EOM
6578 fn=d~+
6579 rp='Pathname where the private library files will reside?'
6580 . ./getfile
6581 privlib="$ans"
6582 privlibexp="$ansexp"
6583 : Change installation prefix, if necessary.
6584 if $test X"$prefix" != X"$installprefix"; then
6585         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6586 else
6587         installprivlib="$privlibexp"
6588 fi
6589
6590 : set the prefixup variable, to restore leading tilda escape
6591 prefixup='case "$prefixexp" in
6592 "$prefix") ;;
6593 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6594 esac'
6595
6596 : determine where public architecture dependent libraries go
6597 set archlib archlib
6598 eval $prefixit
6599 : privlib default is /usr/local/lib/$package/$version
6600 : archlib default is /usr/local/lib/$package/$version/$archname
6601 : privlib may have an optional trailing /share.
6602 tdflt=`echo $privlib | $sed 's,/share$,,'`
6603 tdflt=$tdflt/$archname
6604 case "$archlib" in
6605 '')     dflt=$tdflt
6606         ;;
6607 *)      dflt="$archlib"
6608     ;;
6609 esac
6610 $cat <<EOM
6611
6612 $spackage contains architecture-dependent library files.  If you are
6613 sharing libraries in a heterogeneous environment, you might store
6614 these files in a separate location.  Otherwise, you can just include
6615 them with the rest of the public library files.
6616
6617 EOM
6618 fn=d+~
6619 rp='Where do you want to put the public architecture-dependent libraries?'
6620 . ./getfile
6621 archlib="$ans"
6622 archlibexp="$ansexp"
6623 if $test X"$archlib" = X"$privlib"; then
6624         d_archlib="$undef"
6625 else
6626         d_archlib="$define"
6627 fi
6628 : Change installation prefix, if necessary.
6629 if $test X"$prefix" != X"$installprefix"; then
6630         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6631 else
6632         installarchlib="$archlibexp"
6633 fi
6634
6635 : see if setuid scripts can be secure
6636 $cat <<EOM
6637
6638 Some kernels have a bug that prevents setuid #! scripts from being
6639 secure.  Some sites have disabled setuid #! scripts because of this.
6640
6641 First let's decide if your kernel supports secure setuid #! scripts.
6642 (If setuid #! scripts would be secure but have been disabled anyway,
6643 don't say that they are secure if asked.)
6644
6645 EOM
6646
6647 val="$undef"
6648 if $test -d /dev/fd; then
6649         echo "#!$ls" >reflect
6650         chmod +x,u+s reflect
6651         ./reflect >flect 2>&1
6652         if $contains "/dev/fd" flect >/dev/null; then
6653                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6654                 val="$define"
6655         else
6656                 $cat <<EOM
6657 If you are not sure if they are secure, I can check but I'll need a
6658 username and password different from the one you are using right now.
6659 If you don't have such a username or don't want me to test, simply
6660 enter 'none'.
6661
6662 EOM
6663                 rp='Other username to test security of setuid scripts with?'
6664                 dflt='none'
6665                 . ./myread
6666                 case "$ans" in
6667                 n|none)
6668                         case "$d_suidsafe" in
6669                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6670                                 dflt=n;;
6671                         "$undef")
6672                                 echo "Well, the $hint value is *not* secure." >&4
6673                                 dflt=n;;
6674                         *)      echo "Well, the $hint value *is* secure." >&4
6675                                 dflt=y;;
6676                         esac
6677                         ;;
6678                 *)
6679                         $rm -f reflect flect
6680                         echo "#!$ls" >reflect
6681                         chmod +x,u+s reflect
6682                         echo >flect
6683                         chmod a+w flect
6684                         echo '"su" will (probably) prompt you for '"$ans's password."
6685                         su $ans -c './reflect >flect'
6686                         if $contains "/dev/fd" flect >/dev/null; then
6687                                 echo "Okay, it looks like setuid scripts are secure." >&4
6688                                 dflt=y
6689                         else
6690                                 echo "I don't think setuid scripts are secure." >&4
6691                                 dflt=n
6692                         fi
6693                         ;;
6694                 esac
6695                 rp='Does your kernel have *secure* setuid scripts?'
6696                 . ./myread
6697                 case "$ans" in
6698                 [yY]*)  val="$define";;
6699                 *)      val="$undef";;
6700                 esac
6701         fi
6702 else
6703         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6704         echo "(That's for file descriptors, not floppy disks.)"
6705         val="$undef"
6706 fi
6707 set d_suidsafe
6708 eval $setvar
6709
6710 $rm -f reflect flect
6711
6712 : now see if they want to do setuid emulation
6713 echo " "
6714 val="$undef"
6715 case "$d_suidsafe" in
6716 "$define")
6717         val="$undef"
6718         echo "No need to emulate SUID scripts since they are secure here." >&4
6719         ;;
6720 *)
6721         $cat <<EOM
6722 Some systems have disabled setuid scripts, especially systems where
6723 setuid scripts cannot be secure.  On systems where setuid scripts have
6724 been disabled, the setuid/setgid bits on scripts are currently
6725 useless.  It is possible for $package to detect those bits and emulate
6726 setuid/setgid in a secure fashion.  This emulation will only work if
6727 setuid scripts have been disabled in your kernel.
6728
6729 EOM
6730         case "$d_dosuid" in
6731         "$define") dflt=y ;;
6732         *) dflt=n ;;
6733         esac
6734         rp="Do you want to do setuid/setgid emulation?"
6735         . ./myread
6736         case "$ans" in
6737         [yY]*)  val="$define";;
6738         *)      val="$undef";;
6739         esac
6740         ;;
6741 esac
6742 set d_dosuid
6743 eval $setvar
6744
6745 : see if this is a malloc.h system
6746 : we want a real compile instead of Inhdr because some systems have a
6747 : malloc.h that just gives a compile error saying to use stdlib.h instead
6748 echo " "
6749 $cat >try.c <<EOCP
6750 #include <stdlib.h>
6751 #include <malloc.h>
6752 int main () { return 0; }
6753 EOCP
6754 set try
6755 if eval $compile; then
6756     echo "<malloc.h> found." >&4
6757     val="$define"
6758 else
6759     echo "<malloc.h> NOT found." >&4
6760     val="$undef"
6761 fi
6762 $rm -f try.c try
6763 set i_malloc
6764 eval $setvar
6765
6766 : see if stdlib is available
6767 set stdlib.h i_stdlib
6768 eval $inhdr
6769
6770 : check for void type
6771 echo " "
6772 echo "Checking to see how well your C compiler groks the void type..." >&4
6773 case "$voidflags" in
6774 '')
6775         $cat >try.c <<'EOCP'
6776 #if TRY & 1
6777 void sub() {
6778 #else
6779 sub() {
6780 #endif
6781         extern void moo();      /* function returning void */
6782         void (*goo)();          /* ptr to func returning void */
6783 #if TRY & 8
6784         void *hue;              /* generic ptr */
6785 #endif
6786 #if TRY & 2
6787         void (*foo[10])();
6788 #endif
6789
6790 #if TRY & 4
6791         if(goo == moo) {
6792                 exit(0);
6793         }
6794 #endif
6795         exit(0);
6796 }
6797 int main() { sub(); }
6798 EOCP
6799         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6800                 voidflags=$defvoidused
6801         echo "Good.  It appears to support void to the level $package wants.">&4
6802                 if $contains warning .out >/dev/null 2>&1; then
6803                         echo "However, you might get some warnings that look like this:"
6804                         $cat .out
6805                 fi
6806         else
6807 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6808                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6809                         echo "It supports 1..."
6810                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6811                                 echo "It also supports 2..."
6812                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6813                                         voidflags=7
6814                                         echo "And it supports 4 but not 8 definitely."
6815                                 else
6816                                         echo "It doesn't support 4..."
6817                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6818                                                 voidflags=11
6819                                                 echo "But it supports 8."
6820                                         else
6821                                                 voidflags=3
6822                                                 echo "Neither does it support 8."
6823                                         fi
6824                                 fi
6825                         else
6826                                 echo "It does not support 2..."
6827                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6828                                         voidflags=13
6829                                         echo "But it supports 4 and 8."
6830                                 else
6831                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6832                                                 voidflags=5
6833                                                 echo "And it supports 4 but has not heard about 8."
6834                                         else
6835                                                 echo "However it supports 8 but not 4."
6836                                         fi
6837                                 fi
6838                         fi
6839                 else
6840                         echo "There is no support at all for void."
6841                         voidflags=0
6842                 fi
6843         fi
6844 esac
6845 case "$voidflags" in
6846 "$defvoidused") ;;
6847 *)      $cat >&4 <<'EOM'
6848   Support flag bits are:
6849     1: basic void declarations.
6850     2: arrays of pointers to functions returning void.
6851     4: operations between pointers to and addresses of void functions.
6852     8: generic void pointers.
6853 EOM
6854         dflt="$voidflags";
6855         rp="Your void support flags add up to what?"
6856         . ./myread
6857         voidflags="$ans"
6858         ;;
6859 esac
6860 $rm -f try.* .out
6861
6862 : check for length of pointer
6863 echo " "
6864 case "$ptrsize" in
6865 '')
6866         echo "Checking to see how big your pointers are..." >&4
6867         if test "$voidflags" -gt 7; then
6868                 echo '#define VOID_PTR char *' > try.c
6869         else
6870                 echo '#define VOID_PTR void *' > try.c
6871         fi
6872         $cat >>try.c <<'EOCP'
6873 #include <stdio.h>
6874 int main()
6875 {
6876     printf("%d\n", (int)sizeof(VOID_PTR));
6877     exit(0);
6878 }
6879 EOCP
6880         set try
6881         if eval $compile_ok; then
6882                 ptrsize=`$run ./try`
6883                 echo "Your pointers are $ptrsize bytes long."
6884         else
6885                 dflt='4'
6886                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6887                 rp="What is the size of a pointer (in bytes)?"
6888                 . ./myread
6889                 ptrsize="$ans"
6890         fi
6891         ;;
6892 esac
6893 $rm -f try.c try
6894 case "$use64bitall" in
6895 "$define"|true|[yY]*)
6896         case "$ptrsize" in
6897         4)      cat <<EOM >&4
6898
6899 *** You have chosen a maximally 64-bit build, but your pointers
6900 *** are only 4 bytes wide, disabling maximal 64-bitness.
6901
6902 EOM
6903                 use64bitall="$undef"
6904                 case "$use64bitint" in
6905                 "$define"|true|[yY]*) ;;
6906                 *)      cat <<EOM >&4
6907
6908 *** Downgrading from maximal 64-bitness to using 64-bit integers.
6909
6910 EOM
6911                         use64bitint="$define"
6912                         ;;
6913                 esac
6914                 ;;
6915         esac
6916         ;;
6917 esac
6918
6919
6920 : determine which malloc to compile in
6921 echo " "
6922 case "$usemymalloc" in
6923 [yY]*|true|$define)     dflt='y' ;;
6924 [nN]*|false|$undef)     dflt='n' ;;
6925 *)      case "$ptrsize" in
6926         4) dflt='y' ;;
6927         *) dflt='n' ;;
6928         esac
6929         ;;
6930 esac
6931 rp="Do you wish to attempt to use the malloc that comes with $package?"
6932 . ./myread
6933 usemymalloc="$ans"
6934 case "$ans" in
6935 y*|true)
6936         usemymalloc='y'
6937         mallocsrc='malloc.c'
6938         mallocobj="malloc$_o"
6939         d_mymalloc="$define"
6940         case "$libs" in
6941         *-lmalloc*)
6942                 : Remove malloc from list of libraries to use
6943                 echo "Removing unneeded -lmalloc from library list" >&4
6944                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6945                 shift
6946                 libs="$*"
6947                 echo "libs = $libs" >&4
6948                 ;;
6949         esac
6950         ;;
6951 *)
6952         usemymalloc='n'
6953         mallocsrc=''
6954         mallocobj=''
6955         d_mymalloc="$undef"
6956         ;;
6957 esac
6958
6959 : compute the return types of malloc and free
6960 echo " "
6961 $cat >malloc.c <<END
6962 #$i_malloc I_MALLOC
6963 #$i_stdlib I_STDLIB
6964 #include <stdio.h>
6965 #include <sys/types.h>
6966 #ifdef I_MALLOC
6967 #include <malloc.h>
6968 #endif
6969 #ifdef I_STDLIB
6970 #include <stdlib.h>
6971 #endif
6972 #ifdef TRY_MALLOC
6973 void *malloc();
6974 #endif
6975 #ifdef TRY_FREE
6976 void free();
6977 #endif
6978 END
6979 case "$malloctype" in
6980 '')
6981         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6982                 malloctype='void *'
6983         else
6984                 malloctype='char *'
6985         fi
6986         ;;
6987 esac
6988 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6989
6990 case "$freetype" in
6991 '')
6992         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6993                 freetype='void'
6994         else
6995                 freetype='int'
6996         fi
6997         ;;
6998 esac
6999 echo "Your system uses $freetype free(), it would seem." >&4
7000 $rm -f malloc.[co]
7001 $cat <<EOM
7002
7003 After $package is installed, you may wish to install various
7004 add-on modules and utilities.  Typically, these add-ons will
7005 be installed under $prefix with the rest
7006 of this package.  However, you may wish to install such add-ons
7007 elsewhere under a different prefix.
7008
7009 If you do not wish to put everything under a single prefix, that's
7010 ok.  You will be prompted for the individual locations; this siteprefix
7011 is only used to suggest the defaults.
7012
7013 The default should be fine for most people.
7014
7015 EOM
7016 fn=d~+
7017 rp='Installation prefix to use for add-on modules and utilities?'
7018 : XXX Here might be another good place for an installstyle setting.
7019 case "$siteprefix" in
7020 '') dflt=$prefix ;;
7021 *)  dflt=$siteprefix ;;
7022 esac
7023 . ./getfile
7024 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7025 oldsiteprefix=''
7026 case "$siteprefix" in
7027 '') ;;
7028 *)      case "$ans" in
7029         "$prefix") ;;
7030         *) oldsiteprefix="$prefix";;
7031         esac
7032         ;;
7033 esac
7034 siteprefix="$ans"
7035 siteprefixexp="$ansexp"
7036
7037 : determine where site specific libraries go.
7038 : Usual default is /usr/local/lib/perl5/site_perl/$version
7039 : The default "style" setting is made in installstyle.U
7040 : XXX No longer works with Prefixit stuff.
7041 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7042 case "$sitelib" in
7043 '') case "$installstyle" in
7044         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7045         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7046         esac
7047         ;;
7048 *)      dflt="$sitelib"
7049         ;;
7050 esac
7051 $cat <<EOM
7052
7053 The installation process will create a directory for
7054 site-specific extensions and modules.  Most users find it convenient
7055 to place all site-specific files in this directory rather than in the
7056 main distribution directory.
7057
7058 EOM
7059 fn=d~+
7060 rp='Pathname for the site-specific library files?'
7061 . ./getfile
7062 sitelib="$ans"
7063 sitelibexp="$ansexp"
7064 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7065 : Change installation prefix, if necessary.
7066 if $test X"$prefix" != X"$installprefix"; then
7067         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
7068 else
7069         installsitelib="$sitelibexp"
7070 fi
7071
7072 : determine where site specific architecture-dependent libraries go.
7073 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7074 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7075 : sitelib may have an optional trailing /share.
7076 case "$sitearch" in
7077 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7078         dflt="$dflt/$archname"
7079         ;;
7080 *)      dflt="$sitearch"
7081         ;;
7082 esac
7083 set sitearch sitearch none
7084 eval $prefixit
7085 $cat <<EOM
7086
7087 The installation process will also create a directory for
7088 architecture-dependent site-specific extensions and modules.
7089
7090 EOM
7091 fn=d~+
7092 rp='Pathname for the site-specific architecture-dependent library files?'
7093 . ./getfile
7094 sitearch="$ans"
7095 sitearchexp="$ansexp"
7096 : Change installation prefix, if necessary.
7097 if $test X"$prefix" != X"$installprefix"; then
7098         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
7099 else
7100         installsitearch="$sitearchexp"
7101 fi
7102
7103 $cat <<EOM
7104
7105 The installation process will also create a directory for
7106 vendor-supplied add-ons.  Vendors who supply perl with their system
7107 may find it convenient to place all vendor-supplied files in this
7108 directory rather than in the main distribution directory.  This will
7109 ease upgrades between binary-compatible maintenance versions of perl.
7110
7111 Of course you may also use these directories in whatever way you see
7112 fit.  For example, you might use them to access modules shared over a
7113 company-wide network.
7114
7115 The default answer should be fine for most people.
7116 This causes further questions about vendor add-ons to be skipped
7117 and no vendor-specific directories will be configured for perl.
7118
7119 EOM
7120 rp='Do you want to configure vendor-specific add-on directories?'
7121 case "$usevendorprefix" in
7122 define|true|[yY]*) dflt=y ;;
7123 *)      : User may have set vendorprefix directly on Configure command line.
7124         case "$vendorprefix" in
7125         ''|' ') dflt=n ;;
7126         *)      dflt=y ;;
7127         esac
7128         ;;
7129 esac
7130 . ./myread
7131 case "$ans" in
7132 [yY]*)  fn=d~+
7133         rp='Installation prefix to use for vendor-supplied add-ons?'
7134         case "$vendorprefix" in
7135         '') dflt='' ;;
7136         *)  dflt=$vendorprefix ;;
7137         esac
7138         . ./getfile
7139         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7140         oldvendorprefix=''
7141         case "$vendorprefix" in
7142         '') ;;
7143         *)      case "$ans" in
7144                 "$prefix") ;;
7145                 *) oldvendorprefix="$prefix";;
7146                 esac
7147                 ;;
7148         esac
7149         usevendorprefix="$define"
7150         vendorprefix="$ans"
7151         vendorprefixexp="$ansexp"
7152         ;;
7153 *)      usevendorprefix="$undef"
7154         vendorprefix=''
7155         vendorprefixexp=''
7156         ;;
7157 esac
7158
7159 case "$vendorprefix" in
7160 '')     d_vendorlib="$undef"
7161         vendorlib=''
7162         vendorlibexp=''
7163         ;;
7164 *)      d_vendorlib="$define"
7165         : determine where vendor-supplied modules go.
7166         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7167         case "$vendorlib" in
7168         '')
7169                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7170                 case "$installstyle" in
7171                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7172                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7173                 esac
7174                 ;;
7175         *)      dflt="$vendorlib"
7176                 ;;
7177         esac
7178         fn=d~+
7179         rp='Pathname for the vendor-supplied library files?'
7180         . ./getfile
7181         vendorlib="$ans"
7182         vendorlibexp="$ansexp"
7183         ;;
7184 esac
7185 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7186 : Change installation prefix, if necessary.
7187 if $test X"$prefix" != X"$installprefix"; then
7188         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
7189 else
7190         installvendorlib="$vendorlibexp"
7191 fi
7192
7193 case "$vendorprefix" in
7194 '')     d_vendorarch="$undef"
7195         vendorarch=''
7196         vendorarchexp=''
7197         ;;
7198 *)      d_vendorarch="$define"
7199         : determine where vendor-supplied architecture-dependent libraries go.
7200         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7201         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7202         : vendorlib may have an optional trailing /share.
7203         case "$vendorarch" in
7204         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7205                 dflt="$dflt/$archname"
7206                 ;;
7207         *)      dflt="$vendorarch" ;;
7208         esac
7209         fn=d~+
7210         rp='Pathname for vendor-supplied architecture-dependent files?'
7211         . ./getfile
7212         vendorarch="$ans"
7213         vendorarchexp="$ansexp"
7214         ;;
7215 esac
7216 : Change installation prefix, if necessary.
7217 if $test X"$prefix" != X"$installprefix"; then
7218         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
7219 else
7220         installvendorarch="$vendorarchexp"
7221 fi
7222
7223 : Final catch-all directories to search
7224 $cat <<EOM
7225
7226 Lastly, you can have perl look in other directories for extensions and
7227 modules in addition to those already specified.
7228 These directories will be searched after 
7229         $sitearch 
7230         $sitelib 
7231 EOM
7232 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7233 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7234 echo ' '
7235 case "$otherlibdirs" in
7236 ''|' ') dflt='none' ;;
7237 *)      dflt="$otherlibdirs" ;;
7238 esac
7239 $cat <<EOM
7240 Enter a colon-separated set of extra paths to include in perl's @INC
7241 search path, or enter 'none' for no extra paths.
7242
7243 EOM
7244
7245 rp='Colon-separated list of additional directories for perl to search?'
7246 . ./myread
7247 case "$ans" in
7248 ' '|''|none)    otherlibdirs=' ' ;;     
7249 *)      otherlibdirs="$ans" ;;
7250 esac
7251 case "$otherlibdirs" in
7252 ' ') val=$undef ;;
7253 *)      val=$define ;;
7254 esac
7255 set d_perl_otherlibdirs
7256 eval $setvar
7257
7258 : Cruising for prototypes
7259 echo " "
7260 echo "Checking out function prototypes..." >&4
7261 $cat >prototype.c <<'EOCP'
7262 int main(int argc, char *argv[]) {
7263         exit(0);}
7264 EOCP
7265 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7266         echo "Your C compiler appears to support function prototypes."
7267         val="$define"
7268 else
7269         echo "Your C compiler doesn't seem to understand function prototypes."
7270         val="$undef"
7271 fi
7272 set prototype
7273 eval $setvar
7274 $rm -f prototype*
7275
7276 case "$prototype" in
7277 "$define") ;;
7278 *)      ansi2knr='ansi2knr'
7279         echo " "
7280         cat <<EOM >&4
7281
7282 $me:  FATAL ERROR:
7283 This version of $package can only be compiled by a compiler that 
7284 understands function prototypes.  Unfortunately, your C compiler 
7285         $cc $ccflags
7286 doesn't seem to understand them.  Sorry about that.
7287
7288 If GNU cc is available for your system, perhaps you could try that instead.  
7289
7290 Eventually, we hope to support building Perl with pre-ANSI compilers.
7291 If you would like to help in that effort, please contact <perlbug@perl.org>.
7292
7293 Aborting Configure now.
7294 EOM
7295         exit 2
7296         ;;
7297 esac
7298
7299 : determine where public executables go
7300 echo " "
7301 set dflt bin bin
7302 eval $prefixit
7303 fn=d~
7304 rp='Pathname where the public executables will reside?'
7305 . ./getfile
7306 if $test "X$ansexp" != "X$binexp"; then
7307         installbin=''
7308 fi
7309 bin="$ans"
7310 binexp="$ansexp"
7311 : Change installation prefix, if necessary.
7312 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7313 if $test X"$prefix" != X"$installprefix"; then
7314         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
7315 else
7316         installbin="$binexp"
7317 fi
7318
7319 echo " "
7320 case "$extras" in
7321 '') dflt='n';;
7322 *) dflt='y';;
7323 esac
7324 cat <<EOM
7325 Perl can be built with extra modules or bundles of modules which
7326 will be fetched from the CPAN and installed alongside Perl.
7327
7328 Notice that you will need access to the CPAN; either via the Internet,
7329 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7330 be asked later to configure the CPAN.pm module which will in turn do
7331 the installation of the rest of the extra modules or bundles.)
7332
7333 Notice also that if the modules require any external software such as
7334 libraries and headers (the libz library and the zlib.h header for the
7335 Compress::Zlib module, for example) you MUST have any such software
7336 already installed, this configuration process will NOT install such
7337 things for you.
7338
7339 If this doesn't make any sense to you, just accept the default '$dflt'.
7340 EOM
7341 rp='Install any extra modules (y or n)?'
7342 . ./myread
7343 case "$ans" in
7344 y|Y)
7345         cat <<EOM
7346
7347 Please list any extra modules or bundles to be installed from CPAN,
7348 with spaces between the names.  The names can be in any format the
7349 'install' command of CPAN.pm will understand.  (Answer 'none',
7350 without the quotes, to install no extra modules or bundles.)
7351 EOM
7352         rp='Extras?'
7353         dflt="$extras"
7354         . ./myread
7355         extras="$ans"
7356 esac
7357 case "$extras" in
7358 ''|'none')
7359         val=''
7360         $rm -f ../extras.lst
7361         ;;
7362 *)      echo "(Saving the list of extras for later...)"
7363         echo "$extras" > ../extras.lst
7364         val="'$extras'"
7365         ;;
7366 esac
7367 set extras
7368 eval $setvar
7369 echo " "
7370
7371 : determine where html pages for programs go
7372 set html1dir html1dir none
7373 eval $prefixit
7374 $cat <<EOM
7375
7376 If you wish to install html files for programs in $spackage, indicate 
7377 the appropriate directory here.  To skip installing html files,
7378 answer "none".
7379 EOM
7380 case "$html1dir" in
7381 ''|none|$undef|' ') dflt=none ;;
7382 *) dflt=$html1dir ;;
7383 esac
7384 fn=dn+~
7385 rp="Directory for the main $spackage html pages?"
7386 . ./getfile
7387 html1dir="$ans"
7388 html1direxp="$ansexp"
7389 : Use ' ' for none so value is preserved next time through Configure
7390 $test X"$html1dir" = "X" && html1dir=' '
7391 : Change installation prefix, if necessary.
7392 if $test X"$prefix" != X"$installprefix"; then
7393         installhtml1dir=`echo $html1direxp | sed "s#^$prefix#$installprefix#"`
7394 else
7395         installhtml1dir="$html1direxp"
7396 fi
7397
7398 : determine where html pages for libraries and modules go
7399 set html3dir html3dir none
7400 eval $prefixit
7401 $cat <<EOM
7402
7403 If you wish to install html files for modules associated with $spackage,
7404 indicate the appropriate directory here.  To skip installing html files,
7405 answer "none".
7406 EOM
7407 : There is no obvious default.  If they have specified html1dir, then
7408 : try to key off that, possibly changing .../html1 into .../html3.
7409 case "$html3dir" in
7410 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7411 *) dflt=$html3dir ;;
7412 esac
7413 fn=dn+~
7414 rp="Directory for the $spackage module html pages?"
7415 . ./getfile
7416 html3dir="$ans"
7417 html3direxp="$ansexp"
7418 : Use ' ' for none so value is preserved next time through Configure
7419 $test X"$html3dir" = "X" && html3dir=' '
7420 : Change installation prefix, if necessary.
7421 if $test X"$prefix" != X"$installprefix"; then
7422         installhtml3dir=`echo $html3direxp | sed "s#^$prefix#$installprefix#"`
7423 else
7424         installhtml3dir="$html3direxp"
7425 fi
7426
7427 : Find perl5.005 or later.
7428 echo "Looking for a previously installed perl5.005 or later... "
7429 case "$perl5" in
7430 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7431                 : Check if this perl is recent and can load a simple module
7432                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7433                         perl5=$tdir/perl
7434                         break;
7435                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7436                         perl5=$tdir/perl5
7437                         break;
7438                 fi
7439         done
7440         ;;
7441 *)      perl5="$perl5"
7442         ;;
7443 esac
7444 case "$perl5" in
7445 '')     echo "None found.  That's ok.";;
7446 *)      echo "Using $perl5." ;;
7447 esac
7448
7449 : Determine list of previous versions to include in @INC
7450 $cat > getverlist <<EOPL
7451 #!$perl5 -w
7452 use File::Basename;
7453 \$api_versionstring = "$api_versionstring";
7454 \$version = "$version";
7455 \$stem = "$sitelib_stem";
7456 \$archname = "$archname";
7457 EOPL
7458         $cat >> getverlist <<'EOPL'
7459 # Can't have leading @ because metaconfig interprets it as a command!
7460 ;@inc_version_list=();
7461 # XXX Redo to do opendir/readdir? 
7462 if (-d $stem) {
7463     chdir($stem);
7464     ;@candidates = glob("5.*");
7465 }
7466 else {
7467     ;@candidates = ();
7468 }
7469
7470 # XXX ToDo:  These comparisons must be reworked when two-digit
7471 # subversions come along, so that 5.7.10 compares as greater than
7472 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
7473 # widespread that we can use the built-in version vectors rather
7474 # than reinventing them here.  For 5.6.0, however, we must
7475 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
7476 foreach $d (@candidates) {
7477     if ($d lt $version) {
7478         if ($d ge $api_versionstring) {
7479             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
7480         }
7481         elsif ($d ge "5.005") {
7482             unshift(@inc_version_list, grep { -d } $d);
7483         }
7484     }
7485     else {
7486         # Skip newer version.  I.e. don't look in
7487         # 5.7.0 if we're installing 5.6.1.
7488     }
7489 }
7490
7491 if (@inc_version_list) {
7492     print join(' ', @inc_version_list);
7493 }
7494 else {
7495     # Blank space to preserve value for next Configure run.
7496     print " ";
7497 }
7498 EOPL
7499 chmod +x getverlist
7500 case "$inc_version_list" in
7501 '')     if test -x "$perl5$exe_ext"; then
7502                 dflt=`$perl5 getverlist`
7503         else
7504                 dflt='none'
7505         fi
7506         ;;
7507 $undef) dflt='none' ;;
7508 *)  eval dflt=\"$inc_version_list\" ;;
7509 esac
7510 case "$dflt" in
7511 ''|' ') dflt=none ;;
7512 esac
7513 case "$dflt" in
7514 5.005) dflt=none ;;
7515 esac
7516 $cat <<EOM
7517
7518 In order to ease the process of upgrading, this version of perl 
7519 can be configured to use modules built and installed with earlier 
7520 versions of perl that were installed under $prefix.  Specify here
7521 the list of earlier versions that this version of perl should check.
7522 If Configure detected no earlier versions of perl installed under
7523 $prefix, then the list will be empty.  Answer 'none' to tell perl
7524 to not search earlier versions.
7525
7526 The default should almost always be sensible, so if you're not sure,
7527 just accept the default.
7528 EOM
7529
7530 rp='List of earlier versions to include in @INC?'
7531 . ./myread
7532 case "$ans" in
7533 [Nn]one|''|' ') inc_version_list=' ' ;;
7534 *) inc_version_list="$ans" ;;
7535 esac
7536 case "$inc_version_list" in
7537 ''|' ') 
7538         inc_version_list_init='0';;
7539 *)      inc_version_list_init=`echo $inc_version_list |
7540                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7541         ;;
7542 esac
7543 $rm -f getverlist
7544
7545 : determine whether to install perl also as /usr/bin/perl
7546
7547 echo " "
7548 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7549         $cat <<EOM
7550 Many scripts expect perl to be installed as /usr/bin/perl.
7551
7552 If you want to, I can install the perl you are about to compile
7553 as /usr/bin/perl (in addition to $bin/perl).
7554 EOM
7555         if test -f /usr/bin/perl; then
7556             $cat <<EOM
7557
7558 However, please note that because you already have a /usr/bin/perl,
7559 overwriting that with a new Perl would very probably cause problems.
7560 Therefore I'm assuming you don't want to do that (unless you insist).
7561
7562 EOM
7563             case "$installusrbinperl" in
7564             "$define"|[yY]*)    dflt='y';;
7565             *)                  dflt='n';;
7566             esac
7567         else
7568             $cat <<EOM
7569
7570 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7571
7572 EOM
7573             case "$installusrbinperl" in
7574             "$undef"|[nN]*)     dflt='n';;
7575             *)                  dflt='y';;
7576             esac
7577         fi
7578         rp="Do you want to install perl as /usr/bin/perl?"
7579         . ./myread
7580         case "$ans" in
7581         [yY]*)  val="$define";;
7582         *)      val="$undef" ;;
7583         esac
7584 else
7585         val="$undef"
7586 fi
7587 set installusrbinperl
7588 eval $setvar
7589
7590 : see if dld is available
7591 set dld.h i_dld
7592 eval $inhdr
7593
7594 : see if dlopen exists
7595 xxx_runnm="$runnm"
7596 runnm=false
7597 set dlopen d_dlopen
7598 eval $inlibc
7599 runnm="$xxx_runnm"
7600
7601 : determine which dynamic loading, if any, to compile in
7602 echo " "
7603 dldir="ext/DynaLoader"
7604 case "$usedl" in
7605 $define|y|true)
7606         dflt='y'
7607         usedl="$define"
7608         ;;
7609 $undef|n|false)
7610         dflt='n'
7611         usedl="$undef"
7612         ;;
7613 *) 
7614         dflt='n'
7615         case "$d_dlopen" in
7616             $define) dflt='y' ;;
7617         esac
7618         case "$i_dld" in
7619             $define) dflt='y' ;;
7620         esac
7621         : Does a dl_xxx.xs file exist for this operating system
7622         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7623         ;;
7624 esac
7625 rp="Do you wish to use dynamic loading?"
7626 . ./myread
7627 usedl="$ans"
7628 case "$ans" in
7629 y*) usedl="$define"
7630         case "$dlsrc" in
7631         '')
7632                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7633                         dflt="$dldir/dl_${osname}.xs"
7634                 elif $test "$d_dlopen" = "$define" ; then
7635                         dflt="$dldir/dl_dlopen.xs"
7636                 elif $test "$i_dld" = "$define" ; then
7637                         dflt="$dldir/dl_dld.xs"
7638                 else
7639                         dflt=''
7640                 fi
7641                 ;;
7642         *)      dflt="$dldir/$dlsrc"
7643                 ;;
7644         esac
7645     echo "The following dynamic loading files are available:"
7646         : Can not go over to $dldir because getfile has path hard-coded in.
7647         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7648         rp="Source file to use for dynamic loading"
7649         fn="fne"
7650         gfpth="$src"
7651         . ./getfile
7652         usedl="$define"
7653         : emulate basename
7654         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7655
7656         $cat << EOM
7657
7658 Some systems may require passing special flags to $cc -c to
7659 compile modules that will be used to create a shared library.
7660 To use no flags, say "none".
7661
7662 EOM
7663     case "$cccdlflags" in
7664     '') case "$gccversion" in
7665                 '') case "$osname" in
7666                         hpux)   dflt='+z' ;;
7667                         next)   dflt='none' ;;
7668                         irix*)  dflt='-KPIC' ;;
7669                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7670                         sunos)  dflt='-pic' ;;
7671                         *)      dflt='none' ;;
7672                     esac
7673                         ;;
7674                 *)  case "$osname" in
7675                         darwin) dflt='none' ;;
7676                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7677                         *)      dflt='-fpic' ;;
7678                     esac ;;
7679             esac ;;
7680         ' ') dflt='none' ;;
7681     *)  dflt="$cccdlflags" ;;
7682     esac
7683     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7684     . ./myread
7685     case "$ans" in
7686     none) cccdlflags=' ' ;;
7687     *) cccdlflags="$ans" ;;
7688     esac
7689
7690     cat << EOM
7691
7692 Some systems use ld to create libraries that can be dynamically loaded,
7693 while other systems (such as those using ELF) use $cc.
7694
7695 EOM
7696         case "$ld" in
7697         '')     $cat >try.c <<'EOM'
7698 /* Test for whether ELF binaries are produced */
7699 #include <fcntl.h>
7700 #include <stdlib.h>
7701 int main() {
7702         char b[4];
7703         int i = open("a.out",O_RDONLY);
7704         if(i == -1) 
7705                 exit(1); /* fail */
7706         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7707                 exit(0); /* succeed (yes, it's ELF) */
7708         else
7709                 exit(1); /* fail */
7710 }
7711 EOM
7712                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7713                         cat <<EOM
7714 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7715 EOM
7716                         dflt="$cc"
7717                 else
7718                         echo "I'll use ld to build dynamic libraries."
7719                         dflt='ld'
7720                 fi
7721                 rm -f try.c a.out
7722                 ;;
7723         *)      dflt="$ld"
7724                 ;;
7725         esac
7726
7727     rp="What command should be used to create dynamic libraries?"
7728     . ./myread
7729         ld="$ans"
7730
7731     cat << EOM
7732
7733 Some systems may require passing special flags to $ld to create a
7734 library that can be dynamically loaded.  If your ld flags include
7735 -L/other/path options to locate libraries outside your loader's normal
7736 search path, you may need to specify those -L options here as well.  To
7737 use no flags, say "none".
7738
7739 EOM
7740     case "$lddlflags" in
7741     '') case "$osname" in
7742                         beos) dflt='-nostart' ;;
7743                         hpux) dflt='-b';
7744                               case "$gccversion" in
7745                               '') dflt="$dflt +vnocompatwarnings" ;;
7746                               esac
7747                               ;;        
7748                         linux|irix*)    dflt='-shared' ;;
7749                         next)  dflt='none' ;;
7750                         solaris) dflt='-G' ;;
7751                         sunos) dflt='-assert nodefinitions' ;;
7752                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7753                 *)     dflt='none' ;;
7754                         esac
7755                         ;;
7756     *) dflt="$lddlflags" ;;
7757     esac
7758
7759         : Try to guess additional flags to pick up local libraries.
7760         : Be careful not to append to a plain 'none'
7761         case "$dflt" in
7762         none) dflt='' ;;
7763         esac
7764         for thisflag in $ldflags; do
7765                 case "$thisflag" in
7766                 -L*|-R*|-Wl,-R*)
7767                         case " $dflt " in
7768                         *" $thisflag "*) ;;
7769                         *) dflt="$dflt $thisflag" ;;
7770                         esac
7771                         ;;
7772                 esac
7773         done
7774
7775         case "$dflt" in
7776         ''|' ') dflt='none' ;;
7777         esac
7778
7779     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7780     . ./myread
7781     case "$ans" in
7782     none) lddlflags=' ' ;;
7783     *) lddlflags="$ans" ;;
7784     esac
7785
7786         cat <<EOM
7787
7788 Some systems may require passing special flags to $cc to indicate that
7789 the resulting executable will use dynamic linking.  To use no flags,
7790 say "none".
7791
7792 EOM
7793     case "$ccdlflags" in
7794     '') case "$osname" in
7795                 hpux)   dflt='-Wl,-E' ;;
7796                 linux)  dflt='-rdynamic' ;;
7797                 next)   dflt='none' ;;
7798                 sunos)  dflt='none' ;;
7799                 *)      dflt='none' ;;
7800             esac ;;
7801     ' ')  dflt='none' ;;
7802     *)  dflt="$ccdlflags" ;;
7803     esac
7804     rp="Any special flags to pass to $cc to use dynamic linking?"
7805     . ./myread
7806     case "$ans" in
7807     none) ccdlflags=' ' ;;
7808     *) ccdlflags="$ans" ;;
7809     esac
7810     ;;
7811 *)  usedl="$undef"
7812         ld='ld'
7813     dlsrc='dl_none.xs'
7814     lddlflags=''
7815     ccdlflags=''
7816     ;;
7817 esac
7818
7819 also=''
7820 case "$usedl" in
7821 $undef)
7822         # No dynamic loading being used, so don't bother even to prompt.
7823         useshrplib='false'
7824         ;;
7825 *)      case "$useshrplib" in
7826         '')     case "$osname" in
7827                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7828                         dflt=y
7829                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7830                         ;;
7831                 next*)
7832                         case "$osvers" in
7833                         4*)     dflt=y
7834                                 also='Building a shared libperl is needed for MAB support.'
7835                                 ;;
7836                         *)      dflt=n
7837                                 ;;
7838                         esac
7839                         ;;
7840                 *)      dflt=n
7841                         ;;
7842                 esac
7843                 ;;
7844         $define|true|[Yy]*)
7845                 dflt=y
7846                 ;;
7847         *)      dflt=n
7848                 ;;
7849         esac
7850         $cat << EOM
7851
7852 The perl executable is normally obtained by linking perlmain.c with
7853 libperl${_a}, any static extensions (usually just DynaLoader), and
7854 any other libraries needed on this system (such as -lm, etc.).  Since
7855 your system supports dynamic loading, it is probably possible to build
7856 a shared libperl.$so.  If you will have more than one executable linked
7857 to libperl.$so, this will significantly reduce the size of each
7858 executable, but it may have a noticeable affect on performance.  The
7859 default is probably sensible for your system.
7860 $also
7861
7862 EOM
7863         rp="Build a shared libperl.$so (y/n)"
7864         . ./myread
7865         case "$ans" in
7866         true|$define|[Yy]*)
7867                 useshrplib='true'  ;;
7868         *)      useshrplib='false' ;;
7869         esac
7870         ;;
7871 esac
7872
7873 case "$useshrplib" in
7874 true)
7875         case "$libperl" in
7876         '')
7877                 # Figure out a good name for libperl.so.  Since it gets stored in
7878                 # a version-specific architecture-dependent library, the version
7879                 # number isn't really that important, except for making cc/ld happy.
7880                 #
7881                 # A name such as libperl.so.3.1
7882                 majmin="libperl.$so.$patchlevel.$subversion"
7883                 # A name such as libperl.so.301
7884                 majonly=`echo $patchlevel $subversion |
7885                         $awk '{printf "%d%02d", $1, $2}'`
7886                 majonly=libperl.$so.$majonly
7887                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7888                 # rely on figuring it out from the naming of libc.
7889                 case "${osname}${osvers}" in
7890                 next4*)
7891                         dflt=libperl.5.$so
7892                         # XXX How handle the --version stuff for MAB?
7893                         ;;
7894                 linux*)  # ld won't link with a bare -lperl otherwise.
7895                         dflt=libperl.$so
7896                         ;;
7897                 cygwin*) # ld links against an importlib
7898                         dflt=libperl$lib_ext
7899                         ;;
7900                 *)      # Try to guess based on whether libc has major.minor.
7901                         case "$libc" in
7902                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7903                         *libc.$so.[0-9]*) dflt=$majonly ;;
7904                         *)      dflt=libperl.$so ;;
7905                         esac
7906                         ;;
7907                 esac
7908                 ;;
7909         *)      dflt=$libperl
7910                 ;;
7911         esac
7912         cat << EOM
7913
7914 I need to select a good name for the shared libperl.  If your system uses
7915 library names with major and minor numbers, then you might want something
7916 like $majmin.  Alternatively, if your system uses a single version
7917 number for shared libraries, then you might want to use $majonly.
7918 Or, your system might be quite happy with a simple libperl.$so.
7919
7920 Since the shared libperl will get installed into a version-specific
7921 architecture-dependent directory, the version number of the shared perl
7922 library probably isn't important, so the default should be o.k.
7923
7924 EOM
7925         rp='What name do you want to give to the shared libperl?'
7926         . ./myread
7927         libperl=$ans
7928         echo "Ok, I'll use $libperl"
7929         ;;
7930 *)
7931         libperl="libperl${_a}"
7932         ;;
7933 esac
7934
7935 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7936 case "$shrpdir" in
7937 '') ;;
7938 *)      $cat >&4 <<EOM
7939 WARNING:  Use of the shrpdir variable for the installation location of
7940 the shared $libperl is not supported.  It was never documented and
7941 will not work in this version.  Let me (perlbug@perl.org)
7942 know of any problems this may cause.
7943
7944 EOM
7945         case "$shrpdir" in
7946         "$archlibexp/CORE")
7947                 $cat >&4 <<EOM
7948 But your current setting of $shrpdir is
7949 the default anyway, so it's harmless.
7950 EOM
7951                 ;;
7952         *)
7953                 $cat >&4 <<EOM
7954 Further, your current attempted setting of $shrpdir
7955 conflicts with the value of $archlibexp/CORE
7956 that installperl will use.
7957 EOM
7958                 ;;
7959         esac
7960         ;;
7961 esac
7962
7963 # How will the perl executable find the installed shared $libperl?
7964 # Add $xxx to ccdlflags.
7965 # If we can't figure out a command-line option, use $shrpenv to
7966 # set env LD_RUN_PATH.  The main perl makefile uses this.
7967 shrpdir=$archlibexp/CORE
7968 xxx=''
7969 tmp_shrpenv=''
7970 if "$useshrplib"; then
7971     case "$osname" in 
7972         aix)
7973                 # We'll set it in Makefile.SH...
7974                 ;;
7975         solaris)
7976                 xxx="-R $shrpdir"
7977                 ;;
7978         freebsd|netbsd|openbsd)
7979                 xxx="-Wl,-R$shrpdir"
7980                 ;;
7981         bsdos|linux|irix*|dec_osf)
7982                 xxx="-Wl,-rpath,$shrpdir"
7983                 ;;
7984         next)
7985                 # next doesn't like the default...
7986                 ;;
7987         beos)
7988                 # beos doesn't like the default, either.
7989                 ;;
7990         hpux*)
7991                 # hpux doesn't like the default, either.
7992                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7993                 ;;
7994         *)
7995                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7996                 ;;
7997         esac
7998         case "$xxx" in
7999         '') ;;
8000         *)      
8001                 # Only add $xxx if it isn't already in ccdlflags.
8002                 case " $ccdlflags " in
8003                 *" $xxx "*)     ;;
8004                 *)      ccdlflags="$ccdlflags $xxx"
8005                         cat <<EOM >&4
8006
8007 Adding $xxx to the flags
8008 passed to $ld so that the perl executable will find the 
8009 installed shared $libperl.
8010
8011 EOM
8012                         ;;
8013                 esac
8014                 ;;
8015         esac
8016 fi
8017 # Fix ccdlflags in AIX for building external extensions.
8018 # (For building Perl itself bare -bE:perl.exp is needed,
8019 #  Makefile.SH takes care of this.)
8020 case "$osname" in
8021 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8022 esac
8023 # Respect a hint or command-line value.
8024 case "$shrpenv" in
8025 '') shrpenv="$tmp_shrpenv" ;;
8026 esac
8027 case "$ldlibpthname" in
8028 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8029 none)   ldlibpthname='' ;;
8030 esac
8031
8032 : determine where manual pages are on this system
8033 echo " "
8034 case "$sysman" in
8035 '') 
8036         syspath='/usr/share/man/man1 /usr/man/man1'
8037         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8038         syspath="$syspath /usr/man/u_man/man1"
8039         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8040         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8041         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8042         sysman=`./loc . /usr/man/man1 $syspath`
8043         ;;
8044 esac
8045 if $test -d "$sysman"; then
8046         echo "System manual is in $sysman." >&4
8047 else
8048         echo "Could not find manual pages in source form." >&4
8049 fi
8050
8051 : determine where manual pages go
8052 set man1dir man1dir none
8053 eval $prefixit
8054 $cat <<EOM
8055
8056 $spackage has manual pages available in source form.
8057 EOM
8058 case "$nroff" in
8059 nroff)
8060         echo "However, you don't have nroff, so they're probably useless to you."
8061         case "$man1dir" in
8062         '') man1dir="none";;
8063         esac;;
8064 esac
8065 echo "If you don't want the manual sources installed, answer 'none'."
8066 case "$man1dir" in
8067 ' ') dflt=none
8068         ;;
8069 '')
8070         lookpath="$prefixexp/share/man/man1"
8071         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8072         lookpath="$lookpath $prefixexp/man/p_man/man1"
8073         lookpath="$lookpath $prefixexp/man/u_man/man1"
8074         lookpath="$lookpath $prefixexp/man/man.1"
8075         case "$sysman" in
8076         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8077         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8078         esac
8079         set dflt
8080         eval $prefixup
8081         ;;
8082 *)  dflt="$man1dir"
8083         ;;
8084 esac
8085 echo " "
8086 fn=dn+~
8087 rp="Where do the main $spackage manual pages (source) go?"
8088 . ./getfile
8089 if $test "X$man1direxp" != "X$ansexp"; then
8090         installman1dir=''
8091 fi
8092 man1dir="$ans"
8093 man1direxp="$ansexp"
8094 case "$man1dir" in
8095 '')     man1dir=' '
8096         installman1dir='';;
8097 esac
8098
8099 : Change installation prefix, if necessary.
8100 if $test X"$prefix" != X"$installprefix"; then
8101         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
8102 else
8103         installman1dir="$man1direxp"
8104 fi
8105
8106 : What suffix to use on installed man pages
8107
8108 case "$man1dir" in
8109 ' ')
8110         man1ext='0'
8111         ;;
8112 *)
8113         rp="What suffix should be used for the main $spackage man pages?"
8114         case "$man1ext" in
8115         '')     case "$man1dir" in
8116                 *1)  dflt=1 ;;
8117                 *1p) dflt=1p ;;
8118                 *1pm) dflt=1pm ;;
8119                 *l) dflt=l;;
8120                 *n) dflt=n;;
8121                 *o) dflt=o;;
8122                 *p) dflt=p;;
8123                 *C) dflt=C;;
8124                 *L) dflt=L;;
8125                 *L1) dflt=L1;;
8126                 *) dflt=1;;
8127                 esac
8128                 ;;
8129         *)      dflt="$man1ext";;
8130         esac
8131         . ./myread
8132         man1ext="$ans"
8133         ;;
8134 esac
8135
8136 : see if we can have long filenames
8137 echo " "
8138 first=123456789abcdef
8139 $rm -f $first
8140 if (echo hi >$first) 2>/dev/null; then
8141         if $test -f 123456789abcde; then
8142                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8143                 val="$undef"
8144         else
8145                 echo 'You can have filenames longer than 14 characters.'>&4
8146                 val="$define"
8147         fi
8148 else
8149         $cat <<'EOM'
8150 You can't have filenames longer than 14 chars.
8151 You can't even think about them!
8152 EOM
8153         val="$undef"
8154 fi 
8155 set d_flexfnam
8156 eval $setvar
8157 $rm -rf 123456789abcde*
8158
8159 : determine where library module manual pages go
8160 set man3dir man3dir none
8161 eval $prefixit
8162 $cat <<EOM
8163
8164 $spackage has manual pages for many of the library modules.
8165 EOM
8166
8167 case "$nroff" in
8168 nroff)
8169         $cat <<'EOM'
8170 However, you don't have nroff, so they're probably useless to you.
8171 EOM
8172         case "$man3dir" in
8173         '') man3dir="none";;
8174         esac;;
8175 esac
8176
8177 case "$d_flexfnam" in
8178 undef)
8179         $cat <<'EOM'
8180 However, your system can't handle the long file names like File::Basename.3. 
8181 EOM
8182         case "$man3dir" in
8183         '') man3dir="none";;
8184         esac;;
8185 esac
8186
8187 echo "If you don't want the manual sources installed, answer 'none'."
8188 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8189 case "$man3dir" in
8190 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8191         if $test -d "$privlib/man/man3"; then
8192                 cat <<EOM >&4
8193
8194 WARNING:  Previous versions of perl installed man3 pages into
8195 $privlib/man/man3.  This version will suggest a 
8196 new default of $dflt.  
8197 EOM
8198                 tdflt=$dflt
8199                 dflt='n'
8200                 rp='Do you wish to preserve the old behavior?(y/n)'
8201                 . ./myread
8202                 case "$ans" in
8203                 y*) dflt="$privlib/man/man3" ;;
8204                 *)  dflt=$tdflt ;;
8205                 esac
8206     fi
8207         ;;
8208 *)      dflt="$man3dir" ;;
8209 esac
8210 case "$dflt" in
8211 ' ') dflt=none ;;
8212 esac
8213 echo " "
8214 fn=dn+~
8215 rp="Where do the $package library man pages (source) go?"
8216 . ./getfile
8217 man3dir="$ans"
8218 man3direxp="$ansexp"
8219 case "$man3dir" in
8220 '')     man3dir=' '
8221         installman3dir='';;
8222 esac
8223
8224 : Change installation prefix, if necessary.
8225 if $test X"$prefix" != X"$installprefix"; then
8226         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8227 else
8228         installman3dir="$man3direxp"
8229 fi
8230
8231 : What suffix to use on installed man pages
8232 case "$man3dir" in
8233 ' ')
8234         man3ext='0'
8235         ;;
8236 *)
8237         rp="What suffix should be used for the $package library man pages?"
8238         case "$man3ext" in
8239         '')     case "$man3dir" in
8240                 *3)  dflt=3 ;;
8241                 *3p) dflt=3p ;;
8242                 *3pm) dflt=3pm ;;
8243                 *l) dflt=l;;
8244                 *n) dflt=n;;
8245                 *o) dflt=o;;
8246                 *p) dflt=p;;
8247                 *C) dflt=C;;
8248                 *L) dflt=L;;
8249                 *L3) dflt=L3;;
8250                 *) dflt=3;;
8251                 esac
8252                 ;;
8253         *)      dflt="$man3ext";;
8254         esac
8255         . ./myread
8256         man3ext="$ans"
8257         ;;
8258 esac
8259
8260 : see if we have to deal with yellow pages, now NIS.
8261 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8262         if $test -f /usr/etc/nibindd; then
8263                 echo " "
8264                 echo "I'm fairly confident you're on a NeXT."
8265                 echo " "
8266                 rp='Do you get the hosts file via NetInfo?'
8267                 dflt=y
8268                 case "$hostcat" in
8269                 nidump*) ;;
8270                 '') ;;
8271                 *) dflt=n;;
8272                 esac
8273                 . ./myread
8274                 case "$ans" in
8275                 y*) hostcat='nidump hosts .';;
8276                 *)      case "$hostcat" in
8277                         nidump*) hostcat='';;
8278                         esac
8279                         ;;
8280                 esac
8281         fi
8282         case "$hostcat" in
8283         nidump*) ;;
8284         *)
8285                 case "$hostcat" in
8286                 *ypcat*) dflt=y;;
8287                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8288                                 dflt=y
8289                         else
8290                                 dflt=n
8291                         fi;;
8292                 *) dflt=n;;
8293                 esac
8294                 echo " "
8295                 rp='Are you getting the hosts file via yellow pages?'
8296                 . ./myread
8297                 case "$ans" in
8298                 y*) hostcat='ypcat hosts';;
8299                 *) hostcat='cat /etc/hosts';;
8300                 esac
8301                 ;;
8302         esac
8303 fi
8304 case "$hostcat" in
8305 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8306 esac
8307 case "$groupcat" in
8308 '') test -f /etc/group && groupcat='cat /etc/group';;
8309 esac
8310 case "$passcat" in
8311 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8312 esac
8313
8314 : now get the host name
8315 echo " "
8316 echo "Figuring out host name..." >&4
8317 case "$myhostname" in
8318 '') cont=true
8319         echo 'Maybe "hostname" will work...'
8320         if tans=`sh -c hostname 2>&1` ; then
8321                 myhostname=$tans
8322                 phostname=hostname
8323                 cont=''
8324         fi
8325         ;;
8326 *) cont='';;
8327 esac
8328 if $test "$cont"; then
8329         if ./xenix; then
8330                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8331                 if tans=`cat /etc/systemid 2>&1` ; then
8332                         myhostname=$tans
8333                         phostname='cat /etc/systemid'
8334                         echo "Whadyaknow.  Xenix always was a bit strange..."
8335                         cont=''
8336                 fi
8337         elif $test -r /etc/systemid; then
8338                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8339         fi
8340 fi
8341 if $test "$cont"; then
8342         echo 'No, maybe "uuname -l" will work...'
8343         if tans=`sh -c 'uuname -l' 2>&1` ; then
8344                 myhostname=$tans
8345                 phostname='uuname -l'
8346         else
8347                 echo 'Strange.  Maybe "uname -n" will work...'
8348                 if tans=`sh -c 'uname -n' 2>&1` ; then
8349                         myhostname=$tans
8350                         phostname='uname -n'
8351                 else
8352                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8353                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8354                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8355                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8356                         else
8357                                 case "$myhostname" in
8358                                 '') echo "Does this machine have an identity crisis or something?"
8359                                         phostname='';;
8360                                 *)
8361                                         echo "Well, you said $myhostname before..."
8362                                         phostname='echo $myhostname';;
8363                                 esac
8364                         fi
8365                 fi
8366         fi
8367 fi
8368 case "$myhostname" in
8369 '') myhostname=noname ;;
8370 esac
8371 : you do not want to know about this
8372 set $myhostname
8373 myhostname=$1
8374
8375 : verify guess
8376 if $test "$myhostname" ; then
8377         dflt=y
8378         rp='Your host name appears to be "'$myhostname'".'" Right?"
8379         . ./myread
8380         case "$ans" in
8381         y*) ;;
8382         *) myhostname='';;
8383         esac
8384 fi
8385
8386 : bad guess or no guess
8387 while $test "X$myhostname" = X ; do
8388         dflt=''
8389         rp="Please type the (one word) name of your host:"
8390         . ./myread
8391         myhostname="$ans"
8392 done
8393
8394 : translate upper to lower if necessary
8395 case "$myhostname" in
8396 *[A-Z]*)
8397         echo "(Normalizing case in your host name)"
8398         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8399         ;;
8400 esac
8401
8402 case "$myhostname" in
8403 *.*)
8404         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8405         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8406         echo "(Trimming domain name from host name--host name is now $myhostname)"
8407         ;;
8408 *) case "$mydomain" in
8409         '')
8410                 {
8411                         test "X$hostcat" = "Xypcat hosts" &&
8412                         ypmatch "$myhostname" hosts 2>/dev/null |\
8413                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8414                         $test -s hosts
8415                 } || {
8416                         test "X$hostcat" != "X" &&
8417                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8418                                         /[       ]$myhostname[  . ]/p" > hosts
8419                 }
8420                 tmp_re="[       . ]"
8421                 if $test -f hosts; then
8422                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8423                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8424                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8425                                 hosts | $sort | $uniq | \
8426                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8427                         case `$echo X$dflt` in
8428                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8429                                 dflt=.
8430                                 ;;
8431                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8432                                 ;;
8433                         esac
8434                 else
8435                         echo "(I cannot locate a hosts database anywhere)"
8436                         dflt=.
8437                 fi
8438                 case "$dflt" in
8439                 .)
8440                         tans=`./loc resolv.conf X /etc /usr/etc`
8441                         if $test -f "$tans"; then
8442                                 echo "(Attempting domain name extraction from $tans)"
8443                                 dflt=.`$sed -n -e 's/   / /g' \
8444                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8445                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8446                                 case "$dflt" in
8447                                 .) dflt=.`$sed -n -e 's/        / /g' \
8448                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8449                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8450                                         ;;
8451                                 esac
8452                         fi
8453                         ;;
8454                 esac
8455                 case "$dflt" in
8456                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8457                         dflt=.`sh -c domainname 2>/dev/null`
8458                         case "$dflt" in
8459                         '') dflt='.';;
8460                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8461                         esac
8462                         ;;
8463                 esac
8464                 case "$dflt$osname" in
8465                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8466                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8467                         ;;
8468                 esac
8469                 case "$dflt" in
8470                 .) echo "(Lost all hope -- silly guess then)"
8471                         dflt='.nonet'
8472                         ;;
8473                 esac
8474                 $rm -f hosts
8475                 ;;
8476         *) dflt="$mydomain";;
8477         esac;;
8478 esac
8479 echo " "
8480 rp="What is your domain name?"
8481 . ./myread
8482 tans="$ans"
8483 case "$ans" in
8484 '') ;;
8485 .*) ;;
8486 *) tans=".$tans";;
8487 esac
8488 mydomain="$tans"
8489
8490 : translate upper to lower if necessary
8491 case "$mydomain" in
8492 *[A-Z]*)
8493         echo "(Normalizing case in your domain name)"
8494         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8495         ;;
8496 esac
8497
8498 : a little sanity check here
8499 case "$phostname" in
8500 '') ;;
8501 *)
8502         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8503         $myhostname$mydomain|$myhostname) ;;
8504         *)
8505                 case "$phostname" in
8506                 sed*)
8507                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8508                         ;;
8509                 *)
8510                         echo "(That doesn't agree with your $phostname command, by the way.)"
8511                         ;;
8512                 esac
8513         ;;
8514         esac
8515         ;;
8516 esac
8517
8518 $cat <<EOM
8519
8520 I need to get your e-mail address in Internet format if possible, i.e.
8521 something like user@host.domain. Please answer accurately since I have
8522 no easy means to double check it. The default value provided below
8523 is most probably close to reality but may not be valid from outside
8524 your organization...
8525
8526 EOM
8527 cont=x
8528 while test "$cont"; do
8529         case "$cf_email" in
8530         '') dflt="$cf_by@$myhostname$mydomain";;
8531         *) dflt="$cf_email";;
8532         esac
8533         rp='What is your e-mail address?'
8534         . ./myread
8535         cf_email="$ans"
8536         case "$cf_email" in
8537         *@*.*) cont='' ;;
8538         *)
8539                 rp='Address does not look like an Internet one.  Use it anyway?'
8540                 case "$fastread" in
8541                 yes) dflt=y ;;
8542                 *) dflt=n ;;
8543                 esac
8544                 . ./myread
8545                 case "$ans" in
8546                 y*) cont='' ;;
8547                 *) echo " " ;;
8548                 esac
8549                 ;;
8550         esac
8551 done
8552
8553 $cat <<EOM
8554
8555 If you or somebody else will be maintaining perl at your site, please
8556 fill in the correct e-mail address here so that they may be contacted
8557 if necessary. Currently, the "perlbug" program included with perl
8558 will send mail to this address in addition to perlbug@perl.org. You may
8559 enter "none" for no administrator.
8560
8561 EOM
8562 case "$perladmin" in
8563 '') dflt="$cf_email";;
8564 *) dflt="$perladmin";;
8565 esac
8566 rp='Perl administrator e-mail address'
8567 . ./myread
8568 perladmin="$ans"
8569
8570 : determine whether to only install version-specific parts.
8571 echo " "
8572 $cat <<EOM
8573 Do you want to install only the version-specific parts of the perl
8574 distribution?  Usually you do *not* want to do this.
8575 EOM
8576 case "$versiononly" in
8577 "$define"|[Yy]*|true) dflt='y' ;;
8578 *) dflt='n';
8579 esac
8580 rp="Do you want to install only the version-specific parts of perl?"
8581 . ./myread
8582 case "$ans" in
8583 [yY]*)  val="$define";;
8584 *)      val="$undef" ;;
8585 esac
8586 set versiononly
8587 eval $setvar
8588
8589 case "$versiononly" in
8590 "$define") inc_version_list=''
8591            inc_version_list_init=0
8592            ;;
8593 esac
8594
8595 : figure out how to guarantee perl startup
8596 case "$startperl" in
8597 '')
8598         case "$sharpbang" in
8599         *!)
8600                 $cat <<EOH
8601
8602 I can use the #! construct to start perl on your system. This will
8603 make startup of perl scripts faster, but may cause problems if you
8604 want to share those scripts and perl is not in a standard place
8605 ($binexp/perl) on all your platforms. The alternative is to force
8606 a shell by starting the script with a single ':' character.
8607
8608 EOH
8609                 case "$versiononly" in
8610                 "$define")      dflt="$binexp/perl$version";;  
8611                 *)              dflt="$binexp/perl";;
8612                 esac
8613                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8614                 . ./myread
8615                 case "$ans" in
8616                 none)   startperl=": # use perl";;
8617                 *)      startperl="#!$ans"
8618                         if $test 30 -lt `echo "$ans" | wc -c`; then
8619                                 $cat >&4 <<EOM
8620
8621 WARNING:  Some systems limit the #! command to 32 characters.
8622 If you experience difficulty running Perl scripts with #!, try
8623 installing Perl in a directory with a shorter pathname.
8624
8625 EOM
8626                         fi ;;
8627                 esac
8628                 ;;
8629         *) startperl=": # use perl"
8630                 ;;
8631         esac
8632         ;;
8633 esac
8634 echo "I'll use $startperl to start perl scripts."
8635
8636 : figure best path for perl in scripts
8637 case "$perlpath" in
8638 '')
8639         case "$versiononly" in
8640         "$define")      perlpath="$binexp/perl$version";;
8641         *)              perlpath="$binexp/perl";;
8642         esac
8643         case "$startperl" in
8644         *!*) ;;
8645         *)
8646                 $cat <<EOH
8647
8648 I will use the "eval 'exec'" idiom to start Perl on your system.
8649 I can use the full path of your Perl binary for this purpose, but
8650 doing so may cause problems if you want to share those scripts and
8651 Perl is not always in a standard place ($binexp/perl).
8652
8653 EOH
8654                 dflt="$binexp/perl"
8655                 rp="What path shall I use in \"eval 'exec'\"?"
8656                 . ./myread
8657                 perlpath="$ans"
8658                 ;;
8659         esac
8660         ;;
8661 esac
8662 case "$startperl" in
8663 *!*)    ;;
8664 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8665 esac
8666
8667 : determine where public executable scripts go
8668 set scriptdir scriptdir
8669 eval $prefixit
8670 case "$scriptdir" in
8671 '')
8672         dflt="$bin"
8673         : guess some guesses
8674         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8675         $test -d /usr/share/bin     && dflt=/usr/share/bin
8676         $test -d /usr/local/script  && dflt=/usr/local/script
8677         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8678         $test -d $prefixexp/script  && dflt=$prefixexp/script
8679         set dflt
8680         eval $prefixup
8681         ;;
8682 *)  dflt="$scriptdir"
8683         ;;
8684 esac
8685 $cat <<EOM
8686  
8687 Some installations have a separate directory just for executable scripts so
8688 that they can mount it across multiple architectures but keep the scripts in
8689 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8690 Or you might just lump your scripts in with all your other executables.
8691  
8692 EOM
8693 fn=d~
8694 rp='Where do you keep publicly executable scripts?'
8695 . ./getfile
8696 if $test "X$ansexp" != "X$scriptdirexp"; then
8697         installscript=''
8698 fi
8699 scriptdir="$ans"
8700 scriptdirexp="$ansexp"
8701 : Change installation prefix, if necessary.
8702 if $test X"$prefix" != X"$installprefix"; then
8703         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8704 else
8705         installscript="$scriptdirexp"
8706 fi
8707
8708 : determine where add-on public executables go
8709 case "$sitebin" in
8710 '')     dflt=$siteprefix/bin ;;
8711 *)      dflt=$sitebin ;;
8712 esac
8713 fn=d~
8714 rp='Pathname where the add-on public executables should be installed?'
8715 . ./getfile
8716 sitebin="$ans"
8717 sitebinexp="$ansexp"
8718 : Change installation prefix, if necessary.
8719 if $test X"$prefix" != X"$installprefix"; then
8720         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8721 else
8722         installsitebin="$sitebinexp"
8723 fi
8724
8725 : determine where add-on html pages go
8726 : There is no standard location, so try to copy the previously-selected 
8727 : directory structure for the core html pages.
8728 case "$sitehtml1" in
8729 '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8730 *)      dflt=$sitehtml1 ;;
8731 esac
8732 case "$dflt" in
8733 ''|' ') dflt=none ;;
8734 esac
8735 fn=dn+~
8736 rp='Pathname where the site-specific html pages should be installed?'
8737 . ./getfile
8738 sitehtml1="$ans"
8739 sitehtml1exp="$ansexp"
8740 : Use ' ' for none so value is preserved next time through Configure
8741 $test X"$sitehtml1" = "X" && sitehtml1=' '
8742 : Change installation prefix, if necessary.
8743 if $test X"$prefix" != X"$installprefix"; then
8744         installsitehtml1=`echo "$sitehtml1exp" | $sed "s#^$prefix#$installprefix#"`
8745 else
8746         installsitehtml1="$sitehtml1exp"
8747 fi
8748
8749 : determine where add-on library html pages go
8750 : There is no standard location, so try to copy the previously-selected
8751 : directory structure for the core html pages.
8752 case "$sitehtml3" in
8753 '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8754 *)      dflt=$sitehtml3 ;;
8755 esac
8756 case "$dflt" in
8757 ''|' ') dflt=none ;;
8758 esac
8759 fn=dn+~
8760 rp='Pathname where the site-specific library html pages should be installed?'
8761 . ./getfile
8762 sitehtml3="$ans"
8763 sitehtml3exp="$ansexp"
8764 : Use ' ' for none so value is preserved next time through Configure
8765 $test X"$sitehtml3" = "X" && sitehtml3=' '
8766 : Change installation prefix, if necessary.
8767 if $test X"$prefix" != X"$installprefix"; then
8768         installsitehtml3=`echo "$sitehtml3exp" | $sed "s#^$prefix#$installprefix#"`
8769 else
8770         installsitehtml3="$sitehtml3exp"
8771 fi
8772
8773 : determine where add-on manual pages go
8774 case "$siteman1" in
8775 '')     dflt=`echo "$man1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8776 *)      dflt=$siteman1 ;;
8777 esac
8778 case "$dflt" in
8779 ''|' ') dflt=none ;;
8780 esac
8781 fn=dn+~
8782 rp='Pathname where the site-specific manual pages should be installed?'
8783 . ./getfile
8784 siteman1="$ans"
8785 siteman1exp="$ansexp"
8786 : Use ' ' for none so value is preserved next time through Configure
8787 $test X"$siteman1" = "X" && siteman1=' '
8788 : Change installation prefix, if necessary.
8789 if $test X"$prefix" != X"$installprefix"; then
8790         installsiteman1=`echo "$siteman1exp" | $sed "s#^$prefix#$installprefix#"`
8791 else
8792         installsiteman1="$siteman1exp"
8793 fi
8794
8795 : determine where add-on library man pages go
8796 case "$siteman3" in
8797 '')     dflt=`echo "$man3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8798 *)      dflt=$siteman3 ;;
8799 esac
8800 case "$dflt" in
8801 ''|' ') dflt=none ;;
8802 esac
8803 fn=dn+~
8804 rp='Pathname where the site-specific library manual pages should be installed?'
8805 . ./getfile
8806 siteman3="$ans"
8807 siteman3exp="$ansexp"
8808 : Use ' ' for none so value is preserved next time through Configure
8809 $test X"$siteman3" = "X" && siteman3=' '
8810 : Change installation prefix, if necessary.
8811 if $test X"$prefix" != X"$installprefix"; then
8812         installsiteman3=`echo "$siteman3exp" | $sed "s#^$prefix#$installprefix#"`
8813 else
8814         installsiteman3="$siteman3exp"
8815 fi
8816
8817 : determine where add-on public executable scripts go
8818 case "$sitescript" in
8819 '')     dflt=$siteprefix/script
8820         $test -d $dflt || dflt=$sitebin ;;
8821 *)  dflt="$sitescript" ;;
8822 esac
8823 fn=d~+
8824 rp='Pathname where add-on public executable scripts should be installed?'
8825 . ./getfile
8826 sitescript="$ans"
8827 sitescriptexp="$ansexp"
8828 : Change installation prefix, if necessary.
8829 if $test X"$prefix" != X"$installprefix"; then
8830         installsitescript=`echo $sitescriptexp | sed "s#^$prefix#$installprefix#"`
8831 else
8832         installsitescript="$sitescriptexp"
8833 fi
8834
8835 : define an is-a-typedef? function
8836 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8837 case "$inclist" in
8838 "") inclist="sys/types.h";;
8839 esac;
8840 eval "varval=\$$var";
8841 case "$varval" in
8842 "")
8843         $rm -f temp.c;
8844         for inc in $inclist; do
8845                 echo "#include <$inc>" >>temp.c;
8846         done;
8847         echo "#ifdef $type" >> temp.c;
8848         echo "printf(\"We have $type\");" >> temp.c;
8849         echo "#endif" >> temp.c;
8850         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8851         if $contains $type temp.E >/dev/null 2>&1; then
8852                 eval "$var=\$type";
8853         else
8854                 eval "$var=\$def";
8855         fi;
8856         $rm -f temp.?;;
8857 *) eval "$var=\$varval";;
8858 esac'
8859
8860 : define an is-a-typedef? function that prompts if the type is not available.
8861 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8862 case "$inclist" in
8863 "") inclist="sys/types.h";;
8864 esac;
8865 eval "varval=\$$var";
8866 case "$varval" in
8867 "")
8868         $rm -f temp.c;
8869         for inc in $inclist; do
8870                 echo "#include <$inc>" >>temp.c;
8871         done;
8872         echo "#ifdef $type" >> temp.c;
8873         echo "printf(\"We have $type\");" >> temp.c;
8874         echo "#endif" >> temp.c;
8875         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8876         echo " " ;
8877         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8878         if $contains $type temp.E >/dev/null 2>&1; then
8879                 echo "$type found." >&4;
8880                 eval "$var=\$type";
8881         else
8882                 echo "$type NOT found." >&4;
8883                 dflt="$def";
8884                 . ./myread ;
8885                 eval "$var=\$ans";
8886         fi;
8887         $rm -f temp.?;;
8888 *) eval "$var=\$varval";;
8889 esac'
8890
8891 : see what type lseek is declared as in the kernel
8892 rp="What is the type used for lseek's offset on this system?"
8893 set off_t lseektype long stdio.h sys/types.h
8894 eval $typedef_ask
8895
8896 echo " "
8897 echo "Checking to see how big your file offsets are..." >&4
8898 $cat >try.c <<EOCP
8899 #include <sys/types.h>
8900 #include <stdio.h>
8901 int main()
8902 {
8903     printf("%d\n", (int)sizeof($lseektype));
8904     return(0); 
8905 }
8906 EOCP
8907 set try
8908 if eval $compile_ok; then
8909         lseeksize=`$run ./try`
8910         echo "Your file offsets are $lseeksize bytes long."
8911 else
8912         dflt=$longsize
8913         echo " "
8914         echo "(I can't seem to compile the test program.  Guessing...)"
8915         rp="What is the size of your file offsets (in bytes)?"
8916         . ./myread
8917         lseeksize="$ans"
8918 fi
8919 $rm -f try.c try
8920
8921 : see what type file positions are declared as in the library
8922 rp="What is the type for file position used by fsetpos()?"
8923 set fpos_t fpostype long stdio.h sys/types.h
8924 eval $typedef_ask
8925
8926 echo " "
8927 case "$fpostype" in
8928 *_t) zzz="$fpostype"    ;;
8929 *)   zzz="fpos_t"       ;;
8930 esac
8931 echo "Checking the size of $zzz..." >&4 
8932 cat > try.c <<EOCP
8933 #include <sys/types.h>
8934 #include <stdio.h>
8935 int main() {
8936     printf("%d\n", (int)sizeof($fpostype));
8937     exit(0);
8938 }
8939 EOCP
8940 set try
8941 if eval $compile_ok; then
8942         yyy=`$run ./try`
8943         case "$yyy" in
8944         '')     fpossize=4
8945                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8946                 ;;
8947         *)      fpossize=$yyy
8948                 echo "Your $zzz is $fpossize bytes long."
8949                 ;;
8950         esac
8951 else
8952         dflt="$longsize"
8953         echo " " >&4
8954         echo "(I can't compile the test program.  Guessing...)" >&4
8955         rp="What is the size of your file positions (in bytes)?"
8956         . ./myread
8957         fpossize="$ans"
8958 fi
8959
8960
8961
8962 # Backward compatibility (uselfs is deprecated).
8963 case "$uselfs" in
8964 "$define"|true|[yY]*)
8965         cat <<EOM >&4
8966
8967 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8968 EOM
8969         uselargefiles="$define"
8970         ;;
8971 esac                          
8972
8973 case "$lseeksize:$fpossize" in
8974 8:8) cat <<EOM
8975
8976 You can have files larger than 2 gigabytes.
8977 EOM
8978    val="$define" ;;
8979 *)    case "$uselargefiles" in
8980    "$undef"|false|[nN]*) dflt='n' ;;
8981    *)   dflt='y' ;;
8982    esac
8983    cat <<EOM
8984
8985 Perl can be built to understand large files (files larger than 2 gigabytes)
8986 on some systems.  To do so, Configure can be run with -Duselargefiles.
8987
8988 If this doesn't make any sense to you, just accept the default '$dflt'.
8989 EOM
8990    rp='Try to understand large files, if available?'
8991    . ./myread
8992    case "$ans" in
8993    y|Y)         val="$define" ;;
8994    *)           val="$undef"  ;;
8995    esac
8996    ;;
8997 esac
8998 set uselargefiles
8999 eval $setvar
9000 case "$uselargefiles" in
9001 "$define")
9002 : Look for a hint-file generated 'call-back-unit'.  If the
9003 : user has specified that a large files perl is to be built,
9004 : we may need to set or change some other defaults.
9005         if $test -f uselargefiles.cbu; then
9006                 echo "Your platform has some specific hints for large file builds, using them..."
9007                 . ./uselargefiles.cbu
9008                 echo " "
9009                 echo "Rechecking to see how big your file offsets are..." >&4
9010                 $cat >try.c <<EOCP
9011 #include <sys/types.h>
9012 #include <stdio.h>
9013 int main()
9014 {
9015     printf("%d\n", (int)sizeof($lseektype));
9016     return(0); 
9017 }
9018 EOCP
9019                 set try
9020                 if eval $compile_ok; then
9021                         lseeksize=`$run ./try`
9022                         $echo "Your file offsets are now $lseeksize bytes long."
9023                 else
9024                         dflt="$lseeksize"
9025                         echo " "
9026                         echo "(I can't seem to compile the test program.  Guessing...)"
9027                         rp="What is the size of your file offsets (in bytes)?"
9028                         . ./myread
9029                         lseeksize="$ans"
9030                 fi
9031                 case "$fpostype" in
9032                 *_t) zzz="$fpostype"    ;;
9033                 *)   zzz="fpos_t"       ;;
9034                 esac
9035                 $echo $n "Rechecking the size of $zzz...$c" >&4 
9036                 $cat > try.c <<EOCP
9037 #include <sys/types.h>
9038 #include <stdio.h>
9039 int main() {
9040     printf("%d\n", (int)sizeof($fpostype));
9041     exit(0);
9042 }
9043 EOCP
9044                 set try
9045                 if eval $compile_ok; then
9046                         yyy=`$run ./try`
9047                         dflt="$lseeksize"
9048                         case "$yyy" in
9049                         '')     echo " "
9050                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9051                                 ;;
9052                         *)      fpossize=$yyy
9053                                 echo " $fpossize bytes." >&4
9054                                 ;;
9055                         esac
9056                 else
9057                         dflt="$fpossize"
9058                         echo " "
9059                         echo "(I can't compile the test program.  Guessing...)" >&4
9060                         rp="What is the size of your file positions (in bytes)?"
9061                         . ./myread
9062                         fpossize="$ans"
9063                 fi
9064                 $rm -f try.c try
9065         fi
9066         ;;
9067 esac
9068
9069 case "$vendorprefix" in
9070 '')     d_vendorbin="$undef"
9071         vendorbin=''
9072         vendorbinexp=''
9073         ;;
9074 *)      d_vendorbin="$define"
9075         : determine where vendor-supplied executables go.
9076         case "$vendorbin" in
9077         '') dflt=$vendorprefix/bin ;;
9078         *)      dflt="$vendorbin" ;;
9079         esac
9080         fn=d~+
9081         rp='Pathname for the vendor-supplied executables directory?'
9082         . ./getfile
9083         vendorbin="$ans"
9084         vendorbinexp="$ansexp"
9085         ;;
9086 esac
9087 : Change installation prefix, if necessary.
9088 if $test X"$prefix" != X"$installprefix"; then
9089         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
9090 else
9091         installvendorbin="$vendorbinexp"
9092 fi
9093
9094 case "$vendorprefix" in
9095 '')     vendorhtml1=''
9096         vendorhtml1exp=''
9097         ;;
9098 *)      : determine where vendor-supplied html pages go.
9099         : There is no standard location, so try to copy the previously-selected
9100         : directory structure for the core html pages.
9101         : XXX Better default suggestions would be welcome.
9102         case "$vendorhtml1" in
9103         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9104         *)      dflt=$vendorhtml1 ;;
9105         esac
9106         case "$dflt" in
9107         ''|' ') dflt=none ;;
9108         esac
9109         fn=dn+~
9110         rp='Pathname for the vendor-supplied html pages?'
9111         . ./getfile
9112         vendorhtml1="$ans"
9113         vendorhtml1exp="$ansexp"
9114         ;;
9115 esac
9116 : Use ' ' for none so value is preserved next time through Configure
9117 $test X"$vendorhtml1" = "X" && vendorhtml1=' '
9118 : Change installation prefix, if necessary.
9119 if $test X"$prefix" != X"$installprefix"; then
9120         installvendorhtml1=`echo $vendorhtml1exp | $sed "s#^$prefix#$installprefix#"`
9121 else
9122         installvendorhtml1="$vendorhtml1exp"
9123 fi
9124
9125 case "$vendorprefix" in
9126 '')     vendorhtml3=''
9127         vendorhtml3exp=''
9128         ;;
9129 *)      : determine where vendor-supplied module html pages go.
9130         : There is no standard location, so try to copy the previously-selected
9131         : directory structure for the core html pages.
9132         : XXX Better default suggestions would be welcome.
9133         case "$vendorhtml3" in
9134         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9135         *)      dflt=$vendorhtml3 ;;
9136         esac
9137         case "$dflt" in
9138         ''|' ') dflt=none ;;
9139         esac
9140         fn=dn+~
9141         rp='Pathname for the vendor-supplied html pages?'
9142         . ./getfile
9143         vendorhtml3="$ans"
9144         vendorhtml3exp="$ansexp"
9145         ;;
9146 esac
9147 : Use ' ' for none so value is preserved next time through Configure
9148 $test X"$vendorhtml3" = "X" && vendorhtml3=' '
9149 : Change installation prefix, if necessary.
9150 if $test X"$prefix" != X"$installprefix"; then
9151         installvendorhtml3=`echo $vendorhtml3exp | $sed "s#^$prefix#$installprefix#"`
9152 else
9153         installvendorhtml3="$vendorhtml3exp"
9154 fi
9155
9156 case "$vendorprefix" in
9157 '')     vendorman1=''
9158         vendorman1exp=''
9159         ;;
9160 *)      : determine where vendor-supplied manual pages go.
9161         case "$vendorman1" in
9162         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9163         *)      dflt=$vendorman1 ;;
9164         esac
9165         case "$dflt" in
9166         ''|' ') dflt=none ;;
9167         esac
9168         fn=nd~+
9169         rp='Pathname for the vendor-supplied manual section 1 pages?'
9170         . ./getfile
9171         vendorman1="$ans"
9172         vendorman1exp="$ansexp"
9173         ;;
9174 esac
9175 : Use ' ' for none so value is preserved next time through Configure
9176 $test X"$vendorman1" = "X" && vendorman1=' '
9177 : Change installation prefix, if necessary.
9178 if $test X"$prefix" != X"$installprefix"; then
9179         installvendorman1=`echo "$vendorman1exp" | $sed "s#^$prefix#$installprefix#"`
9180 else
9181         installvendorman1="$vendorman1exp"
9182 fi
9183
9184 case "$vendorprefix" in
9185 '')     vendorman3=''
9186         vendorman3exp=''
9187         ;;
9188 *)      : determine where vendor-supplied module manual pages go.
9189         case "$vendorman3" in
9190         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9191         *)      dflt=$vendorman3 ;;
9192         esac
9193         case "$dflt" in
9194         ''|' ') dflt=none ;;
9195         esac
9196         fn=nd~+
9197         rp='Pathname for the vendor-supplied manual section 3 pages?'
9198         . ./getfile
9199         vendorman3="$ans"
9200         vendorman3exp="$ansexp"
9201         ;;
9202 esac
9203 : Use ' ' for none so value is preserved next time through Configure
9204 $test X"$vendorman3" = "X" && vendorman3=' '
9205 : Change installation prefix, if necessary.
9206 if $test X"$prefix" != X"$installprefix"; then
9207         installvendorman3=`echo "$vendorman3exp" | $sed "s#^$prefix#$installprefix#"`
9208 else
9209         installvendorman3="$vendorman3exp"
9210 fi
9211
9212 case "$vendorprefix" in
9213 '')     d_vendorscript="$undef"
9214         vendorscript=''
9215         vendorscriptexp=''
9216         ;;
9217 *)      d_vendorscript="$define"
9218         : determine where vendor-supplied scripts go.
9219         case "$vendorscript" in
9220         '')     dflt=$vendorprefix/script
9221                 $test -d $dflt || dflt=$vendorbin ;;
9222         *)  dflt="$vendorscript" ;;
9223         esac
9224         $cat <<EOM
9225
9226 The installation process will create a directory for 
9227 vendor-supplied scripts.
9228
9229 EOM
9230         fn=d~+
9231         rp='Pathname for the vendor-supplied scripts directory?'
9232         . ./getfile
9233         vendorscript="$ans"
9234         vendorscriptexp="$ansexp"
9235         ;;
9236 esac
9237 : Change installation prefix, if necessary.
9238 if $test X"$prefix" != X"$installprefix"; then
9239         installvendorscript=`echo $vendorscriptexp | $sed "s#^$prefix#$installprefix#"`
9240 else
9241         installvendorscript="$vendorscriptexp"
9242 fi
9243
9244 : see if qgcvt exists
9245 set qgcvt d_qgcvt
9246 eval $inlibc
9247
9248 : Check how to convert floats to strings.
9249
9250 if test "X$d_Gconvert" = X; then
9251
9252 echo " "
9253 echo "Checking for an efficient way to convert floats to strings."
9254 echo " " > try.c
9255 case "$uselongdouble" in
9256 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9257 esac
9258 case "$d_longdbl" in
9259 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9260 esac
9261 case "$d_PRIgldbl" in
9262 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9263 esac
9264 $cat >>try.c <<EOP
9265 #ifdef TRY_gconvert
9266 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9267 char *myname = "gconvert";
9268 #endif
9269 #ifdef TRY_gcvt
9270 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9271 char *myname = "gcvt";
9272 #endif
9273 #ifdef TRY_qgcvt
9274 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9275 char *myname = "qgcvt";
9276 #define DOUBLETYPE long double
9277 #endif
9278 #ifdef TRY_sprintf
9279 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9280 #ifdef HAS_PRIgldbl
9281 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9282 #else
9283 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9284 #endif
9285 #else
9286 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9287 #endif
9288 char *myname = "sprintf";
9289 #endif
9290
9291 #ifndef DOUBLETYPE
9292 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9293 #define DOUBLETYPE long double
9294 #else
9295 #define DOUBLETYPE double
9296 #endif
9297 #endif
9298
9299 #include <stdio.h>
9300
9301 #define I_STDLIB $i_stdlib
9302 #ifdef I_STDLIB
9303 #include <stdlib.h>
9304 #endif
9305
9306 int
9307 checkit(expect, got)
9308 char *expect;
9309 char *got;
9310 {
9311     if (strcmp(expect, got)) {
9312                 printf("%s oddity:  Expected %s, got %s\n",
9313                         myname, expect, got);
9314                 exit(1);
9315         }
9316 }
9317
9318 int main()
9319
9320         char buf[64]; 
9321         buf[63] = '\0';
9322
9323         /* This must be 1st test on (which?) platform */
9324         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9325         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9326         checkit("0.1", buf);
9327
9328         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9329         checkit("0.01", buf);
9330
9331         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9332         checkit("0.001", buf);
9333
9334         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9335         checkit("0.0001", buf);
9336
9337         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9338         if (strlen(buf) > 5)
9339             checkit("9e-005", buf); /* for Microsoft ?? */
9340         else
9341             checkit("9e-05", buf);
9342
9343         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9344         checkit("1", buf);
9345
9346         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9347         checkit("1.1", buf);
9348
9349         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9350         checkit("1.01", buf);
9351
9352         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9353         checkit("1.001", buf);
9354
9355         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9356         checkit("1.0001", buf);
9357
9358         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9359         checkit("1.00001", buf);
9360
9361         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9362         checkit("1.000001", buf);
9363
9364         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9365         checkit("0", buf);
9366
9367         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9368         checkit("-1", buf);
9369
9370         /* Some Linux gcvt's give 1.e+5 here. */
9371         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9372         checkit("100000", buf);
9373         
9374         /* Some Linux gcvt's give -1.e+5 here. */
9375         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9376         checkit("-100000", buf);
9377
9378         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9379         checkit("123.456", buf);
9380
9381         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9382         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9383         /* 34 should be enough to scare even long double
9384          * places into using the e notation. */
9385         if (strlen(buf) > 5)
9386             checkit("1e+034", buf); /* for Microsoft */
9387         else
9388             checkit("1e+34", buf);
9389
9390         /* For Perl, if you add additional tests here, also add them to
9391          * t/base/num.t for benefit of platforms not using Configure or
9392          * overriding d_Gconvert */
9393
9394         exit(0);
9395 }
9396 EOP
9397 : first add preferred functions to our list
9398 xxx_list=""
9399 for xxx_convert in $gconvert_preference; do
9400     case $xxx_convert in
9401     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9402     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9403     esac 
9404 done
9405 : then add any others
9406 for xxx_convert in gconvert gcvt sprintf; do
9407     case "$xxx_list" in
9408     *$xxx_convert*) ;;
9409     *) xxx_list="$xxx_list $xxx_convert" ;;
9410     esac 
9411 done
9412
9413 case "$d_longdbl$uselongdouble" in
9414 "$define$define")
9415     : again, add prefered functions to our list first
9416     xxx_ld_list=""
9417     for xxx_convert in $gconvert_ld_preference; do
9418         case $xxx_convert in
9419         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9420         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9421         esac
9422     done
9423     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9424     for xxx_convert in qgcvt sprintf $xxx_list; do
9425         case "$xxx_ld_list" in
9426         $xxx_convert*|*" $xxx_convert"*) ;;
9427         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9428         esac
9429     done
9430     : if sprintf cannot do long doubles, move it to the end
9431     if test "$d_PRIgldbl" != "$define"; then
9432         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9433     fi
9434     : if no qgcvt, remove it
9435     if test "$d_qgcvt" != "$define"; then
9436         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9437     fi
9438     : use the ld_list
9439     xxx_list="$xxx_ld_list"
9440     ;;
9441 esac
9442
9443 for xxx_convert in $xxx_list; do
9444         echo "Trying $xxx_convert..."
9445         $rm -f try try$_o
9446         set try -DTRY_$xxx_convert
9447         if eval $compile; then
9448                 echo "$xxx_convert() found." >&4
9449                 if $run ./try; then
9450                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9451                         break;
9452                 else
9453                         echo "...But $xxx_convert didn't work as I expected."
9454                         xxx_convert=''
9455                 fi
9456         else
9457                 echo "$xxx_convert NOT found." >&4
9458         fi
9459 done
9460
9461 if test X$xxx_convert = X; then
9462     echo "*** WHOA THERE!!! ***" >&4
9463     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9464     xxx_convert=sprintf
9465 fi
9466
9467 case "$xxx_convert" in
9468 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9469 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9470 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9471 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9472    "$define$define$define")
9473       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9474    "$define$define$undef")
9475       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9476    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9477    esac
9478    ;;  
9479 esac
9480
9481 fi
9482
9483 : see if _fwalk exists
9484 set fwalk d__fwalk
9485 eval $inlibc
9486
9487 : Initialize h_fcntl
9488 h_fcntl=false
9489
9490 : Initialize h_sysfile
9491 h_sysfile=false
9492
9493 : access call always available on UNIX
9494 set access d_access
9495 eval $inlibc
9496
9497 : locate the flags for 'access()'
9498 case "$d_access" in
9499 "$define")
9500         echo " "
9501         $cat >access.c <<'EOCP'
9502 #include <sys/types.h>
9503 #ifdef I_FCNTL
9504 #include <fcntl.h>
9505 #endif
9506 #ifdef I_SYS_FILE
9507 #include <sys/file.h>
9508 #endif
9509 #ifdef I_UNISTD
9510 #include <unistd.h>
9511 #endif
9512 int main() {
9513         exit(R_OK);
9514 }
9515 EOCP
9516         : check sys/file.h first, no particular reason here
9517         if $test `./findhdr sys/file.h` && \
9518                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9519                 h_sysfile=true;
9520                 echo "<sys/file.h> defines the *_OK access constants." >&4
9521         elif $test `./findhdr fcntl.h` && \
9522                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9523                 h_fcntl=true;
9524                 echo "<fcntl.h> defines the *_OK access constants." >&4
9525         elif $test `./findhdr unistd.h` && \
9526                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9527                 echo "<unistd.h> defines the *_OK access constants." >&4
9528         else
9529                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9530         fi
9531         ;;
9532 esac
9533 $rm -f access*
9534
9535 : see if accessx exists
9536 set accessx d_accessx
9537 eval $inlibc
9538
9539 : see if alarm exists
9540 set alarm d_alarm
9541 eval $inlibc
9542
9543 : see if POSIX threads are available
9544 set pthread.h i_pthread
9545 eval $inhdr
9546
9547 : define a fucntion to check prototypes
9548 $cat > protochk <<EOSH
9549 $startsh
9550 cc="$cc"
9551 optimize="$optimize"
9552 ccflags="$ccflags"
9553 prototype="$prototype"
9554 define="$define"
9555 rm=$rm
9556 usethreads=$usethreads
9557 i_pthread=$i_pthread
9558 pthread_h_first=$pthread_h_first
9559 EOSH
9560
9561 $cat >> protochk <<'EOSH'
9562
9563 $rm -f try.c
9564 foo="$1"
9565 shift
9566 while test $# -ge 2; do
9567         case "$1" in
9568                 $define) echo "#include <$2>" >> try.c ;;
9569                 literal) echo "$2" >> try.c ;;
9570         esac
9571     # Extra magic for the benefit of systems that need pthread.h
9572     # to be included early to correctly detect threadsafe functions.
9573     # Such functions must guarantee themselves, though, that the usethreads
9574     # and i_pthread have been defined, before calling protochk.
9575     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9576         echo "#include <pthread.h>" >> try.c
9577         pthread_h_done=yes
9578     fi
9579     shift 2
9580 done
9581 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9582 cat >> try.c <<'EOCP'
9583 #ifdef CAN_PROTOTYPE
9584 #define _(args) args
9585 #else
9586 #define _(args) ()
9587 #endif
9588 EOCP
9589 echo "$foo" >> try.c
9590 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9591 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9592 status=$?
9593 $rm -f try.[co]
9594 exit $status
9595 EOSH
9596 chmod +x protochk
9597 $eunicefix protochk
9598
9599 : see if sys/types.h has to be included
9600 set sys/types.h i_systypes
9601 eval $inhdr
9602
9603 : see if sys/select.h has to be included
9604 set sys/select.h i_sysselct
9605 eval $inhdr
9606
9607 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9608 while $test $# -ge 2; do
9609         case "$1" in
9610         $define) echo "#include <$2>";;
9611         esac ;
9612     shift 2;
9613 done > try.c;
9614 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9615 set try;
9616 if eval $compile; then
9617         val="$define";
9618 else
9619         val="$undef";
9620 fi;
9621 set $varname;
9622 eval $setvar;
9623 $rm -f try.c try.o'
9624
9625 : see if we should include time.h, sys/time.h, or both
9626 echo " "
9627 if test "X$timeincl" = X; then
9628         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9629         $echo $n "I'm now running the test program...$c"
9630         $cat >try.c <<'EOCP'
9631 #include <sys/types.h>
9632 #ifdef I_TIME
9633 #include <time.h>
9634 #endif
9635 #ifdef I_SYSTIME
9636 #ifdef SYSTIMEKERNEL
9637 #define KERNEL
9638 #endif
9639 #include <sys/time.h>
9640 #endif
9641 #ifdef I_SYSSELECT
9642 #include <sys/select.h>
9643 #endif
9644 int main()
9645 {
9646         struct tm foo;
9647 #ifdef S_TIMEVAL
9648         struct timeval bar;
9649 #endif
9650 #ifdef S_TIMEZONE
9651         struct timezone tzp;
9652 #endif
9653         if (foo.tm_sec == foo.tm_sec)
9654                 exit(0);
9655 #ifdef S_TIMEVAL
9656         if (bar.tv_sec == bar.tv_sec)
9657                 exit(0);
9658 #endif
9659         exit(1);
9660 }
9661 EOCP
9662         flags=''
9663         for s_timezone in '-DS_TIMEZONE' ''; do
9664         sysselect=''
9665         for s_timeval in '-DS_TIMEVAL' ''; do
9666         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9667         for i_time in '' '-DI_TIME'; do
9668         for i_systime in '-DI_SYSTIME' ''; do
9669                 case "$flags" in
9670                 '') $echo $n ".$c"
9671                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9672                         if eval $compile; then
9673                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9674                                 shift
9675                                 flags="$*"
9676                                 echo " "
9677                                 $echo $n "Succeeded with $flags$c"
9678                         fi
9679                         ;;
9680                 esac
9681         done
9682         done
9683         done
9684         done
9685         done
9686         timeincl=''
9687         echo " "
9688         case "$flags" in
9689         *SYSTIMEKERNEL*) i_systimek="$define"
9690                 timeincl=`./findhdr sys/time.h`
9691                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9692         *) i_systimek="$undef";;
9693         esac
9694         case "$flags" in
9695         *I_TIME*) i_time="$define"
9696                 timeincl=`./findhdr time.h`" $timeincl"
9697                 echo "We'll include <time.h>." >&4;;
9698         *) i_time="$undef";;
9699         esac
9700         case "$flags" in
9701         *I_SYSTIME*) i_systime="$define"
9702                 timeincl=`./findhdr sys/time.h`" $timeincl"
9703                 echo "We'll include <sys/time.h>." >&4;;
9704         *) i_systime="$undef";;
9705         esac
9706         $rm -f try.c try
9707 fi
9708 : see if struct tm knows about tm_zone
9709 case "$i_systime$i_time" in
9710 *$define*) 
9711         echo " "
9712         echo "Checking to see if your struct tm has tm_zone field..." >&4
9713         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9714         eval $hasfield
9715         ;;
9716 *)      val="$undef"
9717         set d_tm_tm_zone
9718         eval $setvar
9719         ;;
9720 esac
9721 case "$d_tm_tm_zone" in
9722 "$define")      echo "Yes, it does."   ;;
9723 *)              echo "No, it doesn't." ;;
9724 esac
9725 : see if struct tm knows about tm_gmtoff
9726 case "$i_systime$i_time" in
9727 *$define*) 
9728         echo " "
9729         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9730         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9731         eval $hasfield
9732         ;;
9733 *)      val="$undef"
9734         set d_tm_tm_gmtoff
9735         eval $setvar
9736         ;;
9737 esac
9738 case "$d_tm_tm_gmtoff" in
9739 "$define")      echo "Yes, it does."   ;;
9740 *)              echo "No, it doesn't." ;;
9741 esac
9742
9743 : see if asctime_r exists
9744 set asctime_r d_asctime_r
9745 eval $inlibc
9746 case "$d_asctime_r" in
9747 "$define")
9748         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9749         case "$d_asctime_r_proto:$usethreads" in
9750         ":define")      d_asctime_r_proto=define
9751                 set d_asctime_r_proto asctime_r $hdrs
9752                 eval $hasproto ;;
9753         *)      ;;
9754         esac
9755         case "$d_asctime_r_proto" in
9756         define)
9757         case "$asctime_r_proto" in
9758         ''|0) try='char* asctime_r(const struct tm*, char*);'
9759         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9760         esac
9761         case "$asctime_r_proto" in
9762         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9763         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9764         esac
9765         case "$asctime_r_proto" in
9766         ''|0) try='int asctime_r(const struct tm*, char*);'
9767         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9768         esac
9769         case "$asctime_r_proto" in
9770         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9771         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9772         esac
9773         case "$asctime_r_proto" in
9774         ''|0)   d_asctime_r=undef
9775                 asctime_r_proto=0
9776                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9777         * )     case "$asctime_r_proto" in
9778                 REENTRANT_PROTO*) ;;
9779                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9780                 esac
9781                 echo "Prototype: $try" ;;
9782         esac
9783         ;;
9784         *)      case "$usethreads" in
9785                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9786                 esac
9787                 d_asctime_r=undef
9788                 asctime_r_proto=0
9789                 ;;
9790         esac
9791         ;;
9792 *)      asctime_r_proto=0
9793         ;;
9794 esac
9795
9796 : see if atolf exists
9797 set atolf d_atolf
9798 eval $inlibc
9799
9800 : see if atoll exists
9801 set atoll d_atoll
9802 eval $inlibc
9803
9804 : Look for GNU-cc style attribute checking
9805 echo " "
9806 echo "Checking whether your compiler can handle __attribute__ ..." >&4
9807 $cat >attrib.c <<'EOCP'
9808 #include <stdio.h>
9809 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
9810 EOCP
9811 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9812         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9813                 echo "Your C compiler doesn't fully support __attribute__."
9814                 val="$undef"
9815         else
9816                 echo "Your C compiler supports __attribute__."
9817                 val="$define"
9818         fi
9819 else
9820         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9821         val="$undef"
9822 fi
9823 set d_attribut
9824 eval $setvar
9825 $rm -f attrib*
9826
9827 : see if bcmp exists
9828 set bcmp d_bcmp
9829 eval $inlibc
9830
9831 : see if bcopy exists
9832 set bcopy d_bcopy
9833 eval $inlibc
9834
9835 : see if this is a unistd.h system
9836 set unistd.h i_unistd
9837 eval $inhdr
9838
9839 : see if getpgrp exists
9840 set getpgrp d_getpgrp
9841 eval $inlibc
9842
9843 case "$d_getpgrp" in
9844 "$define")
9845         echo " "
9846         echo "Checking to see which flavor of getpgrp is in use..."
9847         $cat >try.c <<EOP
9848 #$i_unistd I_UNISTD
9849 #include <sys/types.h>
9850 #ifdef I_UNISTD
9851 #  include <unistd.h>
9852 #endif
9853 int main()
9854 {
9855         if (getuid() == 0) {
9856                 printf("(I see you are running Configure as super-user...)\n");
9857                 setuid(1);
9858         }
9859 #ifdef TRY_BSD_PGRP
9860         if (getpgrp(1) == 0)
9861                 exit(0);
9862 #else
9863         if (getpgrp() > 0)
9864                 exit(0);
9865 #endif
9866         exit(1);
9867 }
9868 EOP
9869         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9870                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
9871                 val="$define"
9872         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9873                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
9874                 val="$undef"
9875         else
9876                 echo "I can't seem to compile and run the test program."
9877                 if ./usg; then
9878                         xxx="a USG one, i.e. you use getpgrp()."
9879                 else
9880                         # SVR4 systems can appear rather BSD-ish.
9881                         case "$i_unistd" in
9882                         $undef)
9883                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
9884                                 val="$define"
9885                                 ;;
9886                         $define)
9887                                 xxx="probably a USG one, i.e. you use getpgrp()."
9888                                 val="$undef"
9889                                 ;;
9890                         esac
9891                 fi
9892                 echo "Assuming your getpgrp is $xxx" >&4
9893         fi
9894         ;;
9895 *) val="$undef";;
9896 esac
9897 set d_bsdgetpgrp
9898 eval $setvar
9899 $rm -f try try.*
9900
9901 : see if setpgrp exists
9902 set setpgrp d_setpgrp
9903 eval $inlibc
9904
9905 case "$d_setpgrp" in
9906 "$define")
9907         echo " "
9908         echo "Checking to see which flavor of setpgrp is in use..."
9909         $cat >try.c <<EOP
9910 #$i_unistd I_UNISTD
9911 #include <sys/types.h>
9912 #ifdef I_UNISTD
9913 #  include <unistd.h>
9914 #endif
9915 int main()
9916 {
9917         if (getuid() == 0) {
9918                 printf("(I see you are running Configure as super-user...)\n");
9919                 setuid(1);
9920         }
9921 #ifdef TRY_BSD_PGRP
9922         if (-1 == setpgrp(1, 1))
9923                 exit(0);
9924 #else
9925         if (setpgrp() != -1)
9926                 exit(0);
9927 #endif
9928         exit(1);
9929 }
9930 EOP
9931         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9932                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
9933                 val="$define"
9934         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9935                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
9936                 val="$undef"
9937         else
9938                 echo "(I can't seem to compile and run the test program.)"
9939                 if ./usg; then
9940                         xxx="a USG one, i.e. you use setpgrp()."
9941                 else
9942                         # SVR4 systems can appear rather BSD-ish.
9943                         case "$i_unistd" in
9944                         $undef)
9945                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
9946                                 val="$define"
9947                                 ;;
9948                         $define)
9949                                 xxx="probably a USG one, i.e. you use setpgrp()."
9950                                 val="$undef"
9951                                 ;;
9952                         esac
9953                 fi
9954                 echo "Assuming your setpgrp is $xxx" >&4
9955         fi
9956         ;;
9957 *) val="$undef";;
9958 esac
9959 set d_bsdsetpgrp
9960 eval $setvar
9961 $rm -f try try.*
9962 : see if bzero exists
9963 set bzero d_bzero
9964 eval $inlibc
9965
9966 : see if signal is declared as pointer to function returning int or void
9967 echo " "
9968 xxx=`./findhdr signal.h`
9969 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
9970 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
9971         echo "You have int (*signal())() instead of void." >&4
9972         val="$undef"
9973 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
9974         echo "You have void (*signal())()." >&4
9975         val="$define"
9976 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
9977         echo "You have int (*signal())() instead of void." >&4
9978         val="$undef"
9979 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
9980         echo "You have void (*signal())()." >&4
9981         val="$define"
9982 else
9983         case "$d_voidsig" in
9984         '')
9985         echo "I can't determine whether signal handler returns void or int..." >&4
9986                 dflt=void
9987                 rp="What type does your signal handler return?"
9988                 . ./myread
9989                 case "$ans" in
9990                 v*) val="$define";;
9991                 *) val="$undef";;
9992                 esac;;
9993         "$define")
9994                 echo "As you already told me, signal handler returns void." >&4
9995                 val="$define"
9996                 ;;
9997         *)      echo "As you already told me, signal handler returns int." >&4
9998                 val="$undef"
9999                 ;;
10000         esac
10001 fi
10002 set d_voidsig
10003 eval $setvar
10004 case "$d_voidsig" in
10005 "$define") signal_t="void";;
10006 *) signal_t="int";;
10007 esac
10008 $rm -f $$.tmp
10009
10010 : check for ability to cast large floats to 32-bit ints.
10011 echo " "
10012 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10013 if $test "$intsize" -ge 4; then
10014         xxx=int
10015 else
10016         xxx=long
10017 fi
10018 $cat >try.c <<EOCP
10019 #include <stdio.h>
10020 #include <sys/types.h>
10021 #include <signal.h>
10022 $signal_t blech(s) int s; { exit(3); }
10023 int main()
10024 {
10025         $xxx i32;
10026         double f, g;
10027         int result = 0;
10028         char str[16];
10029         signal(SIGFPE, blech);
10030
10031         /* Don't let compiler optimize the test away.  Store the number 
10032            in a writable string for gcc to pass to sscanf under HP/UX.
10033         */
10034         sprintf(str, "2147483647");
10035         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10036         g = 10 * f;
10037         i32  = ($xxx) g;
10038
10039         /* x86 processors will probably give 0x8000 0000, which is a
10040        sign change.  We don't want that.  We want to mimic SPARC
10041            behavior here, which is to preserve the sign and give
10042            back 0x7fff ffff.
10043         */
10044         if (i32 != ($xxx) f)
10045                 result |= 1;
10046         exit(result);
10047 }
10048 EOCP
10049 set try
10050 if eval $compile_ok; then
10051         $run ./try
10052         yyy=$?
10053 else
10054         echo "(I can't seem to compile the test program--assuming it can't)"
10055         yyy=1
10056 fi
10057 case "$yyy" in
10058 0)      val="$define"
10059         echo "Yup, it can."
10060         ;;
10061 *)      val="$undef"
10062         echo "Nope, it can't."
10063         ;;
10064 esac
10065 set d_casti32
10066 eval $setvar
10067 $rm -f try try.*
10068
10069 : check for ability to cast negative floats to unsigned
10070 echo " "
10071 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10072 $cat >try.c <<EOCP
10073 #include <stdio.h>
10074 #include <sys/types.h>
10075 #include <signal.h>
10076 $signal_t blech(s) int s; { exit(7); }
10077 $signal_t blech_in_list(s) int s; { exit(4); }
10078 unsigned long dummy_long(p) unsigned long p; { return p; }
10079 unsigned int dummy_int(p) unsigned int p; { return p; }
10080 unsigned short dummy_short(p) unsigned short p; { return p; }
10081 int main()
10082 {
10083         double f;
10084         unsigned long along;
10085         unsigned int aint;
10086         unsigned short ashort;
10087         int result = 0;
10088         char str[16];
10089         
10090         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10091            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10092            optimized the whole file away
10093         */
10094         /* Store the number in a writable string for gcc to pass to 
10095            sscanf under HP/UX.
10096         */
10097         sprintf(str, "-123");
10098         sscanf(str, "%lf", &f);  /* f = -123.; */
10099
10100         signal(SIGFPE, blech);
10101         along = (unsigned long)f;
10102         aint = (unsigned int)f;
10103         ashort = (unsigned short)f;
10104         if (along != (unsigned long)-123)
10105                 result |= 1;
10106         if (aint != (unsigned int)-123)
10107                 result |= 1;
10108         if (ashort != (unsigned short)-123)
10109                 result |= 1;
10110         sprintf(str, "1073741824.");
10111         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10112         f = f + f;
10113         along = 0;
10114         along = (unsigned long)f;
10115         if (along != 0x80000000)
10116                 result |= 2;
10117         f -= 1.;
10118         along = 0;
10119         along = (unsigned long)f;
10120         if (along != 0x7fffffff)
10121                 result |= 1;
10122         f += 2.;
10123         along = 0;
10124         along = (unsigned long)f;
10125         if (along != 0x80000001)
10126                 result |= 2;
10127         if (result)
10128                 exit(result);
10129         signal(SIGFPE, blech_in_list);
10130         sprintf(str, "123.");
10131         sscanf(str, "%lf", &f);  /* f = 123.; */
10132         along = dummy_long((unsigned long)f);
10133         aint = dummy_int((unsigned int)f);
10134         ashort = dummy_short((unsigned short)f);
10135         if (along != (unsigned long)123)
10136                 result |= 4;
10137         if (aint != (unsigned int)123)
10138                 result |= 4;
10139         if (ashort != (unsigned short)123)
10140                 result |= 4;
10141         exit(result);
10142
10143 }
10144 EOCP
10145 set try
10146 if eval $compile_ok; then
10147         $run ./try
10148         castflags=$?
10149 else
10150         echo "(I can't seem to compile the test program--assuming it can't)"
10151         castflags=7
10152 fi
10153 case "$castflags" in
10154 0)      val="$define"
10155         echo "Yup, it can."
10156         ;;
10157 *)      val="$undef"
10158         echo "Nope, it can't."
10159         ;;
10160 esac
10161 set d_castneg
10162 eval $setvar
10163 $rm -f try.*
10164
10165 : see if vprintf exists
10166 echo " "
10167 if set vprintf val -f d_vprintf; eval $csym; $val; then
10168         echo 'vprintf() found.' >&4
10169         val="$define"
10170         $cat >try.c <<'EOF'
10171 #include <varargs.h>
10172
10173 int main() { xxx("foo"); }
10174
10175 xxx(va_alist)
10176 va_dcl
10177 {
10178         va_list args;
10179         char buf[10];
10180
10181         va_start(args);
10182         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10183 }
10184 EOF
10185         set try
10186         if eval $compile && $run ./try; then
10187                 echo "Your vsprintf() returns (int)." >&4
10188                 val2="$undef"
10189         else
10190                 echo "Your vsprintf() returns (char*)." >&4
10191                 val2="$define"
10192         fi
10193 else
10194         echo 'vprintf() NOT found.' >&4
10195                 val="$undef"
10196                 val2="$undef"
10197 fi
10198 $rm -f try try.*
10199 set d_vprintf
10200 eval $setvar
10201 val=$val2
10202 set d_charvspr
10203 eval $setvar
10204
10205 : see if chown exists
10206 set chown d_chown
10207 eval $inlibc
10208
10209 : see if chroot exists
10210 set chroot d_chroot
10211 eval $inlibc
10212
10213 : see if chsize exists
10214 set chsize d_chsize
10215 eval $inlibc
10216
10217 : see if class exists
10218 set class d_class
10219 eval $inlibc
10220
10221 hasstruct='varname=$1; struct=$2; shift; shift;
10222 while $test $# -ge 2; do
10223         case "$1" in
10224         $define) echo "#include <$2>";;
10225         esac ;
10226     shift 2;
10227 done > try.c;
10228 echo "int main () { struct $struct foo; }" >> try.c;
10229 set try;
10230 if eval $compile; then
10231         val="$define";
10232 else
10233         val="$undef";
10234 fi;
10235 set $varname;
10236 eval $setvar;
10237 $rm -f try.c try.o'
10238
10239 socketlib=''
10240 sockethdr=''
10241 : see whether socket exists
10242 echo " "
10243 $echo $n "Hmm... $c" >&4
10244 if set socket val -f d_socket; eval $csym; $val; then
10245         echo "Looks like you have Berkeley networking support." >&4
10246         d_socket="$define"
10247         if set setsockopt val -f; eval $csym; $val; then
10248                 d_oldsock="$undef"
10249         else
10250                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10251                 d_oldsock="$define"
10252         fi
10253 else
10254         if $contains socklib libc.list >/dev/null 2>&1; then
10255                 echo "Looks like you have Berkeley networking support." >&4
10256                 d_socket="$define"
10257                 : we will have to assume that it supports the 4.2 BSD interface
10258                 d_oldsock="$undef"
10259         else
10260                 echo "You don't have Berkeley networking in libc$_a..." >&4
10261                 if test "X$d_socket" = "X$define"; then
10262                    echo "...but you seem to believe that you have sockets." >&4
10263                 else
10264                         for net in net socket
10265                         do
10266                                 if test -f /usr/lib/lib$net$_a; then
10267                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10268                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10269                                         if $contains socket libc.list >/dev/null 2>&1; then
10270                                                 d_socket="$define"
10271                                                 socketlib="-l$net"
10272                                                 case "$net" in
10273                                                 net)
10274                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10275                                                         sockethdr="-I/usr/netinclude"
10276                                                         ;;
10277                                                 esac
10278                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10279                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10280                                                         d_oldsock="$undef"
10281                                                 else
10282                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10283                                                         d_oldsock="$define"
10284                                                 fi
10285                                                 break
10286                                         fi
10287                                 fi
10288                         done
10289                         if test "X$d_socket" != "X$define"; then
10290                            echo "or anywhere else I see." >&4
10291                            d_socket="$undef"
10292                            d_oldsock="$undef"
10293                         fi
10294                 fi
10295         fi
10296 fi
10297
10298 : see if socketpair exists
10299 set socketpair d_sockpair
10300 eval $inlibc
10301
10302
10303 echo " "
10304 echo "Checking the availability of certain socket constants..." >&4
10305 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10306         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10307         $cat >try.c <<EOF
10308 #include <sys/types.h>
10309 #include <sys/socket.h>
10310 int main() {
10311     int i = $ENUM;
10312 }
10313 EOF
10314         val="$undef"
10315         set try; if eval $compile; then
10316                 val="$define"
10317         fi
10318         set d_${enum}; eval $setvar
10319         $rm -f try.c try
10320 done
10321
10322 : see if this is a sys/uio.h system
10323 set sys/uio.h i_sysuio
10324 eval $inhdr
10325
10326
10327 echo " "
10328 echo "Checking to see if your system supports struct cmsghdr..." >&4
10329 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10330 eval $hasstruct
10331 case "$d_cmsghdr_s" in
10332 "$define")      echo "Yes, it does."   ;;
10333 *)              echo "No, it doesn't." ;;
10334 esac
10335
10336
10337 : check for const keyword
10338 echo " "
10339 echo 'Checking to see if your C compiler knows about "const"...' >&4
10340 $cat >const.c <<'EOCP'
10341 typedef struct spug { int drokk; } spug;
10342 main()
10343 {
10344         const char *foo;
10345         const spug y;
10346 }
10347 EOCP
10348 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10349         val="$define"
10350         echo "Yup, it does."
10351 else
10352         val="$undef"
10353         echo "Nope, it doesn't."
10354 fi
10355 set d_const
10356 eval $setvar
10357
10358 : see if crypt exists
10359 echo " "
10360 set crypt d_crypt
10361 eval $inlibc
10362 case "$d_crypt" in
10363 $define) cryptlib='' ;;
10364 *)      if set crypt val -f d_crypt; eval $csym; $val; then
10365                 echo 'crypt() found.' >&4
10366                 val="$define"
10367                 cryptlib=''
10368         else
10369                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10370                 if $test -z "$cryptlib"; then
10371                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10372                 else
10373                         cryptlib=-lcrypt
10374                 fi
10375                 if $test -z "$cryptlib"; then
10376                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10377                 else
10378                         cryptlib=-lcrypt
10379                 fi
10380                 if $test -z "$cryptlib"; then
10381                         cryptlib=`./loc libcrypt$_a "" $libpth`
10382                 else
10383                         cryptlib=-lcrypt
10384                 fi
10385                 if $test -z "$cryptlib"; then
10386                         echo 'crypt() NOT found.' >&4
10387                         val="$undef"
10388                 else
10389                         val="$define"
10390                 fi
10391         fi
10392         set d_crypt
10393         eval $setvar
10394         ;;
10395 esac
10396
10397 : see if this is a crypt.h system
10398 set crypt.h i_crypt
10399 eval $inhdr
10400
10401 : see if crypt_r exists
10402 set crypt_r d_crypt_r
10403 eval $inlibc
10404 case "$d_crypt_r" in
10405 "$define")
10406         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10407         case "$d_crypt_r_proto:$usethreads" in
10408         ":define")      d_crypt_r_proto=define
10409                 set d_crypt_r_proto crypt_r $hdrs
10410                 eval $hasproto ;;
10411         *)      ;;
10412         esac
10413         case "$d_crypt_r_proto" in
10414         define)
10415         case "$crypt_r_proto" in
10416         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10417         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10418         esac
10419         case "$crypt_r_proto" in
10420         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10421         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10422         esac
10423         case "$crypt_r_proto" in
10424         ''|0)   d_crypt_r=undef
10425                 crypt_r_proto=0
10426                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10427         * )     case "$crypt_r_proto" in
10428                 REENTRANT_PROTO*) ;;
10429                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10430                 esac
10431                 echo "Prototype: $try" ;;
10432         esac
10433         ;;
10434         *)      case "$usethreads" in
10435                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10436                 esac
10437                 d_crypt_r=undef
10438                 crypt_r_proto=0
10439                 ;;
10440         esac
10441         ;;
10442 *)      crypt_r_proto=0
10443         ;;
10444 esac
10445
10446 : get csh whereabouts
10447 case "$csh" in
10448 'csh') val="$undef" ;;
10449 *) val="$define" ;;
10450 esac
10451 set d_csh
10452 eval $setvar
10453 : Respect a hint or command line value for full_csh.
10454 case "$full_csh" in
10455 '') full_csh=$csh ;;
10456 esac
10457
10458 : see if ctermid_r exists
10459 set ctermid_r d_ctermid_r
10460 eval $inlibc
10461 case "$d_ctermid_r" in
10462 "$define")
10463         hdrs="$i_systypes sys/types.h define stdio.h "
10464         case "$d_ctermid_r_proto:$usethreads" in
10465         ":define")      d_ctermid_r_proto=define
10466                 set d_ctermid_r_proto ctermid_r $hdrs
10467                 eval $hasproto ;;
10468         *)      ;;
10469         esac
10470         case "$d_ctermid_r_proto" in
10471         define)
10472         case "$ctermid_r_proto" in
10473         ''|0) try='char* ctermid_r(char*);'
10474         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10475         esac
10476         case "$ctermid_r_proto" in
10477         ''|0)   d_ctermid_r=undef
10478                 ctermid_r_proto=0
10479                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10480         * )     case "$ctermid_r_proto" in
10481                 REENTRANT_PROTO*) ;;
10482                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10483                 esac
10484                 echo "Prototype: $try" ;;
10485         esac
10486         ;;
10487         *)      case "$usethreads" in
10488                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10489                 esac
10490                 d_ctermid_r=undef
10491                 ctermid_r_proto=0
10492                 ;;
10493         esac
10494         ;;
10495 *)      ctermid_r_proto=0
10496         ;;
10497 esac
10498
10499 : see if ctime_r exists
10500 set ctime_r d_ctime_r
10501 eval $inlibc
10502 case "$d_ctime_r" in
10503 "$define")
10504         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10505         case "$d_ctime_r_proto:$usethreads" in
10506         ":define")      d_ctime_r_proto=define
10507                 set d_ctime_r_proto ctime_r $hdrs
10508                 eval $hasproto ;;
10509         *)      ;;
10510         esac
10511         case "$d_ctime_r_proto" in
10512         define)
10513         case "$ctime_r_proto" in
10514         ''|0) try='char* ctime_r(const time_t*, char*);'
10515         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10516         esac
10517         case "$ctime_r_proto" in
10518         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10519         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10520         esac
10521         case "$ctime_r_proto" in
10522         ''|0) try='int ctime_r(const time_t*, char*);'
10523         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10524         esac
10525         case "$ctime_r_proto" in
10526         ''|0) try='int ctime_r(const time_t*, char*, int);'
10527         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10528         esac
10529         case "$ctime_r_proto" in
10530         ''|0)   d_ctime_r=undef
10531                 ctime_r_proto=0
10532                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10533         * )     case "$ctime_r_proto" in
10534                 REENTRANT_PROTO*) ;;
10535                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10536                 esac
10537                 echo "Prototype: $try" ;;
10538         esac
10539         ;;
10540         *)      case "$usethreads" in
10541                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10542                 esac
10543                 d_ctime_r=undef
10544                 ctime_r_proto=0
10545                 ;;
10546         esac
10547         ;;
10548 *)      ctime_r_proto=0
10549         ;;
10550 esac
10551
10552 : see if cuserid exists
10553 set cuserid d_cuserid
10554 eval $inlibc
10555
10556 : see if this is a limits.h system
10557 set limits.h i_limits
10558 eval $inhdr
10559
10560 : see if this is a float.h system
10561 set float.h i_float
10562 eval $inhdr
10563
10564 : See if number of significant digits in a double precision number is known
10565 echo " "
10566 $cat >dbl_dig.c <<EOM
10567 #$i_limits I_LIMITS
10568 #$i_float I_FLOAT
10569 #ifdef I_LIMITS
10570 #include <limits.h>
10571 #endif
10572 #ifdef I_FLOAT
10573 #include <float.h>
10574 #endif
10575 #ifdef DBL_DIG
10576 printf("Contains DBL_DIG");
10577 #endif
10578 EOM
10579 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10580 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10581         echo "DBL_DIG found." >&4
10582         val="$define"
10583 else
10584         echo "DBL_DIG NOT found." >&4
10585         val="$undef"
10586 fi
10587 $rm -f dbl_dig.?
10588 set d_dbl_dig
10589 eval $setvar
10590
10591 : see if dbm.h is available
10592 : see if dbmclose exists
10593 set dbmclose d_dbmclose
10594 eval $inlibc
10595
10596 case "$d_dbmclose" in
10597 $define)
10598         set dbm.h i_dbm
10599         eval $inhdr
10600         case "$i_dbm" in
10601         $define)
10602                 val="$undef"
10603                 set i_rpcsvcdbm
10604                 eval $setvar
10605                 ;;
10606         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10607                 eval $inhdr
10608                 ;;
10609         esac
10610         ;;
10611 *)      echo "We won't be including <dbm.h>"
10612         val="$undef"
10613         set i_dbm
10614         eval $setvar
10615         val="$undef"
10616         set i_rpcsvcdbm
10617         eval $setvar
10618         ;;
10619 esac
10620
10621 : see if prototype for dbminit is available
10622 echo " "
10623 set d_dbminitproto dbminit $i_dbm dbm.h
10624 eval $hasproto
10625
10626 : see if difftime exists
10627 set difftime d_difftime
10628 eval $inlibc
10629
10630 : see if this is a dirent system
10631 echo " "
10632 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10633         val="$define"
10634         echo "<dirent.h> found." >&4
10635 else
10636         val="$undef"
10637         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10638                 echo "<sys/dir.h> found." >&4
10639                 echo " "
10640         else
10641                 xinc=`./findhdr sys/ndir.h`
10642         fi
10643         echo "<dirent.h> NOT found." >&4
10644 fi
10645 set i_dirent
10646 eval $setvar
10647
10648 : Look for type of directory structure.
10649 echo " "
10650 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10651
10652 case "$direntrytype" in
10653 ''|' ')
10654         case "$i_dirent" in
10655         $define) guess1='struct dirent' ;;
10656         *) guess1='struct direct'  ;;
10657         esac
10658         ;;
10659 *)      guess1="$direntrytype"
10660         ;;
10661 esac
10662
10663 case "$guess1" in
10664 'struct dirent') guess2='struct direct' ;;
10665 *) guess2='struct dirent' ;;
10666 esac
10667                 
10668 if $contains "$guess1" try.c >/dev/null 2>&1; then
10669         direntrytype="$guess1"
10670         echo "Your directory entries are $direntrytype." >&4
10671 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10672         direntrytype="$guess2"
10673         echo "Your directory entries seem to be $direntrytype." >&4
10674 else
10675         echo "I don't recognize your system's directory entries." >&4
10676         rp="What type is used for directory entries on this system?"
10677         dflt="$guess1"
10678         . ./myread
10679         direntrytype="$ans"
10680 fi
10681 $rm -f try.c
10682
10683
10684 : see if the directory entry stores field length
10685 echo " "
10686 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10687 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10688         echo "Good, your directory entry keeps length information in d_namlen." >&4
10689         val="$define"
10690 else
10691         echo "Your directory entry does not know about the d_namlen field." >&4
10692         val="$undef"
10693 fi
10694 set d_dirnamlen
10695 eval $setvar
10696 $rm -f try.c
10697
10698 : see if this is an sysdir system
10699 set sys/dir.h i_sysdir
10700 eval $inhdr
10701
10702 : see if this is an sysndir system
10703 set sys/ndir.h i_sysndir
10704 eval $inhdr
10705
10706 : Look for dirfd
10707 echo " "
10708 $cat >dirfd.c <<EOM
10709 #include <stdio.h>
10710 #$i_dirent I_DIRENT             /**/
10711 #$i_sysdir I_SYS_DIR            /**/
10712 #$i_sysndir I_SYS_NDIR          /**/
10713 #$i_systypes I_SYS_TYPES        /**/
10714 #if defined(I_SYS_TYPES)
10715 #include <sys/types.h>
10716 #endif
10717 #if defined(I_DIRENT)
10718 #include <dirent.h>
10719 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10720 #include <sys/dir.h>
10721 #endif
10722 #else
10723 #ifdef I_SYS_NDIR
10724 #include <sys/ndir.h>
10725 #else
10726 #ifdef I_SYS_DIR
10727 #ifdef hp9000s500
10728 #include <ndir.h>       /* may be wrong in the future */
10729 #else
10730 #include <sys/dir.h>
10731 #endif
10732 #endif
10733 #endif
10734 #endif 
10735 int main() {
10736         DIR *dirp = opendir(".");
10737         if (dirfd(dirp) >= 0)
10738                 exit(0);
10739         else
10740                 exit(1);
10741 }
10742 EOM
10743 set dirfd
10744 if eval $compile; then
10745         val="$define"
10746 fi
10747 case "$val" in
10748 $define)        echo "dirfd() found." >&4       ;;
10749 *)              echo "dirfd() NOT found." >&4   ;;
10750 esac
10751 set d_dirfd
10752 eval $setvar
10753 $rm -f dirfd*
10754
10755 : see if dlerror exists
10756 xxx_runnm="$runnm"
10757 runnm=false
10758 set dlerror d_dlerror
10759 eval $inlibc
10760 runnm="$xxx_runnm"
10761
10762 : see if dlfcn is available
10763 set dlfcn.h i_dlfcn
10764 eval $inhdr
10765
10766 case "$usedl" in
10767 $define|y|true)
10768         $cat << EOM
10769
10770 On a few systems, the dynamically loaded modules that perl generates and uses
10771 will need a different extension than shared libs. The default will probably
10772 be appropriate.
10773
10774 EOM
10775         case "$dlext" in
10776         '')     dflt="$so" ;;
10777         *)      dflt="$dlext" ;;
10778         esac
10779         rp='What is the extension of dynamically loaded modules'
10780         . ./myread
10781         dlext="$ans"
10782         ;;
10783 *)
10784         dlext="none"
10785         ;;
10786 esac
10787
10788 : Check if dlsym need a leading underscore
10789 echo " "
10790 val="$undef"
10791
10792 case "$dlsrc" in
10793 dl_dlopen.xs)
10794         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
10795         $cat >dyna.c <<'EOM'
10796 fred () { }
10797 EOM
10798
10799 $cat >fred.c<<EOM
10800
10801 #include <stdio.h>
10802 #$i_dlfcn I_DLFCN
10803 #ifdef I_DLFCN
10804 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
10805 #else
10806 #include <sys/types.h>
10807 #include <nlist.h>
10808 #include <link.h>
10809 #endif
10810
10811 extern int fred() ;
10812
10813 int main()
10814 {
10815     void * handle ;
10816     void * symbol ;
10817 #ifndef RTLD_LAZY
10818     int mode = 1 ;
10819 #else
10820     int mode = RTLD_LAZY ;
10821 #endif
10822     handle = dlopen("./dyna.$dlext", mode) ;
10823     if (handle == NULL) {
10824         printf ("1\n") ;
10825         fflush (stdout) ;
10826         exit(0);
10827     }
10828     symbol = dlsym(handle, "fred") ;
10829     if (symbol == NULL) {
10830         /* try putting a leading underscore */
10831         symbol = dlsym(handle, "_fred") ;
10832         if (symbol == NULL) {
10833             printf ("2\n") ;
10834             fflush (stdout) ;
10835             exit(0);
10836         }
10837         printf ("3\n") ;
10838     }
10839     else
10840         printf ("4\n") ;
10841     fflush (stdout) ;
10842     exit(0);
10843 }
10844 EOM
10845         : Call the object file tmp-dyna.o in case dlext=o.
10846         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
10847                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
10848                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
10849                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
10850                 xxx=`$run ./fred`
10851                 case $xxx in
10852                 1)      echo "Test program failed using dlopen." >&4
10853                         echo "Perhaps you should not use dynamic loading." >&4;;
10854                 2)      echo "Test program failed using dlsym." >&4
10855                         echo "Perhaps you should not use dynamic loading." >&4;;
10856                 3)      echo "dlsym needs a leading underscore" >&4
10857                         val="$define" ;;
10858                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
10859                 esac
10860         else
10861                 echo "I can't compile and run the test program." >&4
10862                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
10863         fi
10864         ;;
10865 esac
10866                 
10867 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
10868
10869 set d_dlsymun
10870 eval $setvar
10871
10872 : see if drand48_r exists
10873 set drand48_r d_drand48_r
10874 eval $inlibc
10875 case "$d_drand48_r" in
10876 "$define")
10877         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
10878         case "$d_drand48_r_proto:$usethreads" in
10879         ":define")      d_drand48_r_proto=define
10880                 set d_drand48_r_proto drand48_r $hdrs
10881                 eval $hasproto ;;
10882         *)      ;;
10883         esac
10884         case "$d_drand48_r_proto" in
10885         define)
10886         case "$drand48_r_proto" in
10887         ''|0) try='int drand48_r(struct drand48_data*, double*);'
10888         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
10889         esac
10890         case "$drand48_r_proto" in
10891         ''|0)   d_drand48_r=undef
10892                 drand48_r_proto=0
10893                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10894         * )     case "$drand48_r_proto" in
10895                 REENTRANT_PROTO*) ;;
10896                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
10897                 esac
10898                 echo "Prototype: $try" ;;
10899         esac
10900         ;;
10901         *)      case "$usethreads" in
10902                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
10903                 esac
10904                 d_drand48_r=undef
10905                 drand48_r_proto=0
10906                 ;;
10907         esac
10908         ;;
10909 *)      drand48_r_proto=0
10910         ;;
10911 esac
10912
10913 : see if prototype for drand48 is available
10914 echo " "
10915 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
10916 eval $hasproto
10917
10918 : see if dup2 exists
10919 set dup2 d_dup2
10920 eval $inlibc
10921
10922 : see if eaccess exists
10923 set eaccess d_eaccess
10924 eval $inlibc
10925
10926 : see if endgrent exists
10927 set endgrent d_endgrent
10928 eval $inlibc
10929
10930 : see if this is an grp system
10931 set grp.h i_grp
10932 eval $inhdr
10933
10934 case "$i_grp" in
10935 $define)
10936         xxx=`./findhdr grp.h`
10937         $cppstdin $cppflags $cppminus < $xxx >$$.h
10938
10939         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10940                 val="$define"
10941         else
10942                 val="$undef"
10943         fi
10944         set d_grpasswd
10945         eval $setvar
10946
10947         $rm -f $$.h
10948         ;;
10949 *)
10950         val="$undef";
10951         set d_grpasswd; eval $setvar
10952         ;;
10953 esac
10954
10955 : see if endgrent_r exists
10956 set endgrent_r d_endgrent_r
10957 eval $inlibc
10958 case "$d_endgrent_r" in
10959 "$define")
10960         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
10961         case "$d_endgrent_r_proto:$usethreads" in
10962         ":define")      d_endgrent_r_proto=define
10963                 set d_endgrent_r_proto endgrent_r $hdrs
10964                 eval $hasproto ;;
10965         *)      ;;
10966         esac
10967         case "$d_endgrent_r_proto" in
10968         define)
10969         case "$endgrent_r_proto" in
10970         ''|0) try='int endgrent_r(FILE**);'
10971         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
10972         esac
10973         case "$endgrent_r_proto" in
10974         ''|0) try='void endgrent_r(FILE**);'
10975         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
10976         esac
10977         case "$endgrent_r_proto" in
10978         ''|0)   d_endgrent_r=undef
10979                 endgrent_r_proto=0
10980                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10981         * )     case "$endgrent_r_proto" in
10982                 REENTRANT_PROTO*) ;;
10983                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
10984                 esac
10985                 echo "Prototype: $try" ;;
10986         esac
10987         ;;
10988         *)      case "$usethreads" in
10989                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
10990                 esac
10991                 d_endgrent_r=undef
10992                 endgrent_r_proto=0
10993                 ;;
10994         esac
10995         ;;
10996 *)      endgrent_r_proto=0
10997         ;;
10998 esac
10999
11000 : see if endhostent exists
11001 set endhostent d_endhent
11002 eval $inlibc
11003
11004 : see if this is a netdb.h system
11005 set netdb.h i_netdb
11006 eval $inhdr
11007
11008 : see if endhostent_r exists
11009 set endhostent_r d_endhostent_r
11010 eval $inlibc
11011 case "$d_endhostent_r" in
11012 "$define")
11013         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11014         case "$d_endhostent_r_proto:$usethreads" in
11015         ":define")      d_endhostent_r_proto=define
11016                 set d_endhostent_r_proto endhostent_r $hdrs
11017                 eval $hasproto ;;
11018         *)      ;;
11019         esac
11020         case "$d_endhostent_r_proto" in
11021         define)
11022         case "$endhostent_r_proto" in
11023         ''|0) try='int endhostent_r(struct hostent_data*);'
11024         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11025         esac
11026         case "$endhostent_r_proto" in
11027         ''|0) try='void endhostent_r(struct hostent_data*);'
11028         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11029         esac
11030         case "$endhostent_r_proto" in
11031         ''|0)   d_endhostent_r=undef
11032                 endhostent_r_proto=0
11033                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11034         * )     case "$endhostent_r_proto" in
11035                 REENTRANT_PROTO*) ;;
11036                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11037                 esac
11038                 echo "Prototype: $try" ;;
11039         esac
11040         ;;
11041         *)      case "$usethreads" in
11042                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11043                 esac
11044                 d_endhostent_r=undef
11045                 endhostent_r_proto=0
11046                 ;;
11047         esac
11048         ;;
11049 *)      endhostent_r_proto=0
11050         ;;
11051 esac
11052
11053 : see if endnetent exists
11054 set endnetent d_endnent
11055 eval $inlibc
11056
11057 : see if endnetent_r exists
11058 set endnetent_r d_endnetent_r
11059 eval $inlibc
11060 case "$d_endnetent_r" in
11061 "$define")
11062         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11063         case "$d_endnetent_r_proto:$usethreads" in
11064         ":define")      d_endnetent_r_proto=define
11065                 set d_endnetent_r_proto endnetent_r $hdrs
11066                 eval $hasproto ;;
11067         *)      ;;
11068         esac
11069         case "$d_endnetent_r_proto" in
11070         define)
11071         case "$endnetent_r_proto" in
11072         ''|0) try='int endnetent_r(struct netent_data*);'
11073         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11074         esac
11075         case "$endnetent_r_proto" in
11076         ''|0) try='void endnetent_r(struct netent_data*);'
11077         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11078         esac
11079         case "$endnetent_r_proto" in
11080         ''|0)   d_endnetent_r=undef
11081                 endnetent_r_proto=0
11082                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11083         * )     case "$endnetent_r_proto" in
11084                 REENTRANT_PROTO*) ;;
11085                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11086                 esac
11087                 echo "Prototype: $try" ;;
11088         esac
11089         ;;
11090         *)      case "$usethreads" in
11091                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11092                 esac
11093                 d_endnetent_r=undef
11094                 endnetent_r_proto=0
11095                 ;;
11096         esac
11097         ;;
11098 *)      endnetent_r_proto=0
11099         ;;
11100 esac
11101
11102 : see if endprotoent exists
11103 set endprotoent d_endpent
11104 eval $inlibc
11105
11106 : see if endprotoent_r exists
11107 set endprotoent_r d_endprotoent_r
11108 eval $inlibc
11109 case "$d_endprotoent_r" in
11110 "$define")
11111         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11112         case "$d_endprotoent_r_proto:$usethreads" in
11113         ":define")      d_endprotoent_r_proto=define
11114                 set d_endprotoent_r_proto endprotoent_r $hdrs
11115                 eval $hasproto ;;
11116         *)      ;;
11117         esac
11118         case "$d_endprotoent_r_proto" in
11119         define)
11120         case "$endprotoent_r_proto" in
11121         ''|0) try='int endprotoent_r(struct protoent_data*);'
11122         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11123         esac
11124         case "$endprotoent_r_proto" in
11125         ''|0) try='void endprotoent_r(struct protoent_data*);'
11126         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11127         esac
11128         case "$endprotoent_r_proto" in
11129         ''|0)   d_endprotoent_r=undef
11130                 endprotoent_r_proto=0
11131                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11132         * )     case "$endprotoent_r_proto" in
11133                 REENTRANT_PROTO*) ;;
11134                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11135                 esac
11136                 echo "Prototype: $try" ;;
11137         esac
11138         ;;
11139         *)      case "$usethreads" in
11140                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11141                 esac
11142                 d_endprotoent_r=undef
11143                 endprotoent_r_proto=0
11144                 ;;
11145         esac
11146         ;;
11147 *)      endprotoent_r_proto=0
11148         ;;
11149 esac
11150
11151 : see if endpwent exists
11152 set endpwent d_endpwent
11153 eval $inlibc
11154
11155 : see if this is a pwd.h system
11156 set pwd.h i_pwd
11157 eval $inhdr
11158
11159 case "$i_pwd" in
11160 $define)
11161         xxx=`./findhdr pwd.h`
11162         $cppstdin $cppflags $cppminus < $xxx >$$.h
11163
11164         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11165                 val="$define"
11166         else
11167                 val="$undef"
11168         fi
11169         set d_pwquota
11170         eval $setvar
11171
11172         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11173                 val="$define"
11174         else
11175                 val="$undef"
11176         fi
11177         set d_pwage
11178         eval $setvar
11179
11180         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11181                 val="$define"
11182         else
11183                 val="$undef"
11184         fi
11185         set d_pwchange
11186         eval $setvar
11187
11188         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11189                 val="$define"
11190         else
11191                 val="$undef"
11192         fi
11193         set d_pwclass
11194         eval $setvar
11195
11196         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11197                 val="$define"
11198         else
11199                 val="$undef"
11200         fi
11201         set d_pwexpire
11202         eval $setvar
11203
11204         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11205                 val="$define"
11206         else
11207                 val="$undef"
11208         fi
11209         set d_pwcomment
11210         eval $setvar
11211
11212         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11213                 val="$define"
11214         else
11215                 val="$undef"
11216         fi
11217         set d_pwgecos
11218         eval $setvar
11219
11220         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11221                 val="$define"
11222         else
11223                 val="$undef"
11224         fi
11225         set d_pwpasswd
11226         eval $setvar
11227
11228         $rm -f $$.h
11229         ;;
11230 *)
11231         val="$undef"; 
11232         set d_pwquota; eval $setvar
11233         set d_pwage; eval $setvar
11234         set d_pwchange; eval $setvar
11235         set d_pwclass; eval $setvar
11236         set d_pwexpire; eval $setvar
11237         set d_pwcomment; eval $setvar
11238         set d_pwgecos; eval $setvar
11239         set d_pwpasswd; eval $setvar
11240         ;;
11241 esac
11242
11243 : see if endpwent_r exists
11244 set endpwent_r d_endpwent_r
11245 eval $inlibc
11246 case "$d_endpwent_r" in
11247 "$define")
11248         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11249         case "$d_endpwent_r_proto:$usethreads" in
11250         ":define")      d_endpwent_r_proto=define
11251                 set d_endpwent_r_proto endpwent_r $hdrs
11252                 eval $hasproto ;;
11253         *)      ;;
11254         esac
11255         case "$d_endpwent_r_proto" in
11256         define)
11257         case "$endpwent_r_proto" in
11258         ''|0) try='int endpwent_r(FILE**);'
11259         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11260         esac
11261         case "$endpwent_r_proto" in
11262         ''|0) try='void endpwent_r(FILE**);'
11263         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11264         esac
11265         case "$endpwent_r_proto" in
11266         ''|0)   d_endpwent_r=undef
11267                 endpwent_r_proto=0
11268                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11269         * )     case "$endpwent_r_proto" in
11270                 REENTRANT_PROTO*) ;;
11271                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11272                 esac
11273                 echo "Prototype: $try" ;;
11274         esac
11275         ;;
11276         *)      case "$usethreads" in
11277                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11278                 esac
11279                 d_endpwent_r=undef
11280                 endpwent_r_proto=0
11281                 ;;
11282         esac
11283         ;;
11284 *)      endpwent_r_proto=0
11285         ;;
11286 esac
11287
11288 : see if endservent exists
11289 set endservent d_endsent
11290 eval $inlibc
11291
11292 : see if endservent_r exists
11293 set endservent_r d_endservent_r
11294 eval $inlibc
11295 case "$d_endservent_r" in
11296 "$define")
11297         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11298         case "$d_endservent_r_proto:$usethreads" in
11299         ":define")      d_endservent_r_proto=define
11300                 set d_endservent_r_proto endservent_r $hdrs
11301                 eval $hasproto ;;
11302         *)      ;;
11303         esac
11304         case "$d_endservent_r_proto" in
11305         define)
11306         case "$endservent_r_proto" in
11307         ''|0) try='int endservent_r(struct servent_data*);'
11308         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11309         esac
11310         case "$endservent_r_proto" in
11311         ''|0) try='void endservent_r(struct servent_data*);'
11312         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11313         esac
11314         case "$endservent_r_proto" in
11315         ''|0)   d_endservent_r=undef
11316                 endservent_r_proto=0
11317                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11318         * )     case "$endservent_r_proto" in
11319                 REENTRANT_PROTO*) ;;
11320                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11321                 esac
11322                 echo "Prototype: $try" ;;
11323         esac
11324         ;;
11325         *)      case "$usethreads" in
11326                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11327                 esac
11328                 d_endservent_r=undef
11329                 endservent_r_proto=0
11330                 ;;
11331         esac
11332         ;;
11333 *)      endservent_r_proto=0
11334         ;;
11335 esac
11336
11337 : Locate the flags for 'open()'
11338 echo " "
11339 $cat >try.c <<'EOCP'
11340 #include <sys/types.h>
11341 #ifdef I_FCNTL
11342 #include <fcntl.h>
11343 #endif
11344 #ifdef I_SYS_FILE
11345 #include <sys/file.h>
11346 #endif
11347 int main() {
11348         if(O_RDONLY);
11349 #ifdef O_TRUNC
11350         exit(0);
11351 #else
11352         exit(1);
11353 #endif
11354 }
11355 EOCP
11356 : check sys/file.h first to get FREAD on Sun
11357 if $test `./findhdr sys/file.h` && \
11358                 set try -DI_SYS_FILE && eval $compile; then
11359         h_sysfile=true;
11360         echo "<sys/file.h> defines the O_* constants..." >&4
11361         if $run ./try; then
11362                 echo "and you have the 3 argument form of open()." >&4
11363                 val="$define"
11364         else
11365                 echo "but not the 3 argument form of open().  Oh, well." >&4
11366                 val="$undef"
11367         fi
11368 elif $test `./findhdr fcntl.h` && \
11369                 set try -DI_FCNTL && eval $compile; then
11370         h_fcntl=true;
11371         echo "<fcntl.h> defines the O_* constants..." >&4
11372         if $run ./try; then
11373                 echo "and you have the 3 argument form of open()." >&4
11374                 val="$define"
11375         else
11376                 echo "but not the 3 argument form of open().  Oh, well." >&4
11377                 val="$undef"
11378         fi
11379 else
11380         val="$undef"
11381         echo "I can't find the O_* constant definitions!  You got problems." >&4
11382 fi
11383 set d_open3
11384 eval $setvar
11385 $rm -f try try.*
11386
11387 : see which of string.h or strings.h is needed
11388 echo " "
11389 strings=`./findhdr string.h`
11390 if $test "$strings" && $test -r "$strings"; then
11391         echo "Using <string.h> instead of <strings.h>." >&4
11392         val="$define"
11393 else
11394         val="$undef"
11395         strings=`./findhdr strings.h`
11396         if $test "$strings" && $test -r "$strings"; then
11397                 echo "Using <strings.h> instead of <string.h>." >&4
11398         else
11399                 echo "No string header found -- You'll surely have problems." >&4
11400         fi
11401 fi
11402 set i_string
11403 eval $setvar
11404 case "$i_string" in
11405 "$undef") strings=`./findhdr strings.h`;;
11406 *)        strings=`./findhdr string.h`;;
11407 esac
11408
11409 : see if this is a sys/file.h system
11410 val=''
11411 set sys/file.h val
11412 eval $inhdr
11413
11414 : do we need to include sys/file.h ?
11415 case "$val" in
11416 "$define")
11417         echo " "
11418         if $h_sysfile; then
11419                 val="$define"
11420                 echo "We'll be including <sys/file.h>." >&4
11421         else
11422                 val="$undef"
11423                 echo "We won't be including <sys/file.h>." >&4
11424         fi
11425         ;;
11426 *)
11427         h_sysfile=false
11428         ;;
11429 esac
11430 set i_sysfile
11431 eval $setvar
11432
11433 : see if fcntl.h is there
11434 val=''
11435 set fcntl.h val
11436 eval $inhdr
11437
11438 : see if we can include fcntl.h
11439 case "$val" in
11440 "$define")
11441         echo " "
11442         if $h_fcntl; then
11443                 val="$define"
11444                 echo "We'll be including <fcntl.h>." >&4
11445         else
11446                 val="$undef"
11447                 if $h_sysfile; then
11448         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11449                 else
11450                         echo "We won't be including <fcntl.h>." >&4
11451                 fi
11452         fi
11453         ;;
11454 *)
11455         h_fcntl=false
11456         val="$undef"
11457         ;;
11458 esac
11459 set i_fcntl
11460 eval $setvar
11461
11462 : check for non-blocking I/O stuff
11463 case "$h_sysfile" in
11464 true) echo "#include <sys/file.h>" > head.c;;
11465 *)
11466        case "$h_fcntl" in
11467        true) echo "#include <fcntl.h>" > head.c;;
11468        *) echo "#include <sys/fcntl.h>" > head.c;;
11469        esac
11470        ;;
11471 esac
11472 echo " "
11473 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11474 case "$o_nonblock" in
11475 '')
11476         $cat head.c > try.c
11477         $cat >>try.c <<EOCP
11478 #include <stdio.h>
11479 #include <stdlib.h>
11480 #$i_fcntl I_FCNTL
11481 #ifdef I_FCNTL
11482 #include <fcntl.h>
11483 #endif
11484 int main() {
11485 #ifdef O_NONBLOCK
11486         printf("O_NONBLOCK\n");
11487         exit(0);
11488 #endif
11489 #ifdef O_NDELAY
11490         printf("O_NDELAY\n");
11491         exit(0);
11492 #endif
11493 #ifdef FNDELAY
11494         printf("FNDELAY\n");
11495         exit(0);
11496 #endif
11497         exit(0);
11498 }
11499 EOCP
11500         set try
11501         if eval $compile_ok; then
11502                 o_nonblock=`$run ./try`
11503                 case "$o_nonblock" in
11504                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11505                 *) echo "Seems like we can use $o_nonblock.";;
11506                 esac
11507         else
11508                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11509         fi
11510         ;;
11511 *) echo "Using $hint value $o_nonblock.";;
11512 esac
11513 $rm -f try try.* .out core
11514
11515 echo " "
11516 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11517 case "$eagain" in
11518 '')
11519         $cat head.c > try.c
11520         $cat >>try.c <<EOCP
11521 #include <errno.h>
11522 #include <sys/types.h>
11523 #include <signal.h>
11524 #include <stdio.h> 
11525 #include <stdlib.h> 
11526 #$i_fcntl I_FCNTL
11527 #ifdef I_FCNTL
11528 #include <fcntl.h>
11529 #endif
11530 #define MY_O_NONBLOCK $o_nonblock
11531 #ifndef errno  /* XXX need better Configure test */
11532 extern int errno;
11533 #endif
11534 #$i_unistd I_UNISTD
11535 #ifdef I_UNISTD
11536 #include <unistd.h>
11537 #endif
11538 #$i_string I_STRING
11539 #ifdef I_STRING
11540 #include <string.h>
11541 #else
11542 #include <strings.h>
11543 #endif
11544 $signal_t blech(x) int x; { exit(3); }
11545 EOCP
11546         $cat >> try.c <<'EOCP'
11547 int main()
11548 {
11549         int pd[2];
11550         int pu[2];
11551         char buf[1];
11552         char string[100];
11553
11554         pipe(pd);       /* Down: child -> parent */
11555         pipe(pu);       /* Up: parent -> child */
11556         if (0 != fork()) {
11557                 int ret;
11558                 close(pd[1]);   /* Parent reads from pd[0] */
11559                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11560 #ifdef F_SETFL
11561                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11562                         exit(1);
11563 #else
11564                 exit(4);
11565 #endif
11566                 signal(SIGALRM, blech);
11567                 alarm(5);
11568                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11569                         exit(2);
11570                 sprintf(string, "%d\n", ret);
11571                 write(2, string, strlen(string));
11572                 alarm(0);
11573 #ifdef EAGAIN
11574                 if (errno == EAGAIN) {
11575                         printf("EAGAIN\n");
11576                         goto ok;
11577                 }
11578 #endif
11579 #ifdef EWOULDBLOCK
11580                 if (errno == EWOULDBLOCK)
11581                         printf("EWOULDBLOCK\n");
11582 #endif
11583         ok:
11584                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11585                 sleep(2);                               /* Give it time to close our pipe */
11586                 alarm(5);
11587                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11588                 alarm(0);
11589                 sprintf(string, "%d\n", ret);
11590                 write(4, string, strlen(string));
11591                 exit(0);
11592         }
11593
11594         close(pd[0]);                   /* We write to pd[1] */
11595         close(pu[1]);                   /* We read from pu[0] */
11596         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11597         close(pd[1]);                   /* Pipe pd is now fully closed! */
11598         exit(0);                                /* Bye bye, thank you for playing! */
11599 }
11600 EOCP
11601         set try
11602         if eval $compile_ok; then
11603                 echo "$startsh" >mtry
11604                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11605                 chmod +x mtry
11606                 ./mtry >/dev/null 2>&1
11607                 case $? in
11608                 0) eagain=`$cat try.out`;;
11609                 1) echo "Could not perform non-blocking setting!";;
11610                 2) echo "I did a successful read() for something that was not there!";;
11611                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11612                 4) echo "Could not find F_SETFL!";;
11613                 *) echo "Something terribly wrong happened during testing.";;
11614                 esac
11615                 rd_nodata=`$cat try.ret`
11616                 echo "A read() system call with no data present returns $rd_nodata."
11617                 case "$rd_nodata" in
11618                 0|-1) ;;
11619                 *)
11620                         echo "(That's peculiar, fixing that to be -1.)"
11621                         rd_nodata=-1
11622                         ;;
11623                 esac
11624                 case "$eagain" in
11625                 '')
11626                         echo "Forcing errno EAGAIN on read() with no data available."
11627                         eagain=EAGAIN
11628                         ;;
11629                 *)
11630                         echo "Your read() sets errno to $eagain when no data is available."
11631                         ;;
11632                 esac
11633                 status=`$cat try.err`
11634                 case "$status" in
11635                 0) echo "And it correctly returns 0 to signal EOF.";;
11636                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11637                 *) echo "However, your read() returns '$status' on EOF??";;
11638                 esac
11639                 val="$define"
11640                 if test "$status" = "$rd_nodata"; then
11641                         echo "WARNING: you can't distinguish between EOF and no data!"
11642                         val="$undef"
11643                 fi
11644         else
11645                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11646                 eagain=EAGAIN
11647         fi
11648         set d_eofnblk
11649         eval $setvar
11650         ;;
11651 *)
11652         echo "Using $hint value $eagain."
11653         echo "Your read() returns $rd_nodata when no data is present."
11654         case "$d_eofnblk" in
11655         "$define") echo "And you can see EOF because read() returns 0.";;
11656         "$undef") echo "But you can't see EOF status from read() returned value.";;
11657         *)
11658                 echo "(Assuming you can't see EOF status from read anyway.)"
11659                 d_eofnblk=$undef
11660                 ;;
11661         esac
11662         ;;
11663 esac
11664 $rm -f try try.* .out core head.c mtry
11665
11666 : see if fchdir exists
11667 set fchdir d_fchdir
11668 eval $inlibc
11669
11670 : see if fchmod exists
11671 set fchmod d_fchmod
11672 eval $inlibc
11673
11674 : see if fchown exists
11675 set fchown d_fchown
11676 eval $inlibc
11677
11678 : see if this is an fcntl system
11679 set fcntl d_fcntl
11680 eval $inlibc
11681
11682 echo " "
11683 : See if fcntl-based locking works.
11684 $cat >try.c <<EOCP
11685 #include <stdlib.h>
11686 #include <unistd.h>
11687 #include <fcntl.h>
11688 #include <signal.h>
11689 $signal_t blech(x) int x; { exit(3); }
11690 int main() {
11691 #if defined(F_SETLK) && defined(F_SETLKW)
11692      struct flock flock;
11693      int retval, fd;
11694      fd = open("try.c", O_RDONLY);
11695      flock.l_type = F_RDLCK;
11696      flock.l_whence = SEEK_SET;
11697      flock.l_start = flock.l_len = 0;
11698      signal(SIGALRM, blech);
11699      alarm(10);
11700      retval = fcntl(fd, F_SETLK, &flock);
11701      close(fd);
11702      (retval < 0 ? exit(2) : exit(0));
11703 #else
11704      exit(2);
11705 #endif
11706 }
11707 EOCP
11708 echo "Checking if fcntl-based file locking works... "
11709 case "$d_fcntl" in
11710 "$define")
11711         set try
11712         if eval $compile_ok; then
11713                 if $run ./try; then
11714                         echo "Yes, it seems to work."
11715                         val="$define"
11716                 else
11717                         echo "Nope, it didn't work."
11718                         val="$undef"
11719                         case "$?" in
11720                         3) $cat >&4 <<EOM
11721 ***
11722 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
11723 *** This is (almost) impossible.
11724 *** If your NFS lock daemons are not feeling well, something like
11725 *** this may happen, please investigate.  Cannot continue, aborting.
11726 ***
11727 EOM
11728                                 exit 1
11729                                 ;;
11730                         esac
11731                 fi
11732         else
11733                 echo "I'm unable to compile the test program, so I'll assume not."
11734                 val="$undef"
11735         fi
11736         ;;
11737 *) val="$undef";
11738         echo "Nope, since you don't even have fcntl()."
11739         ;;
11740 esac
11741 set d_fcntl_can_lock
11742 eval $setvar
11743 $rm -f try*
11744
11745
11746 : check for fd_set items
11747 $cat <<EOM
11748
11749 Checking to see how well your C compiler handles fd_set and friends ...
11750 EOM
11751 $cat >try.c <<EOCP
11752 #$i_systime I_SYS_TIME
11753 #$i_sysselct I_SYS_SELECT
11754 #$d_socket HAS_SOCKET
11755 #include <sys/types.h>
11756 #ifdef HAS_SOCKET
11757 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
11758 #endif
11759 #ifdef I_SYS_TIME
11760 #include <sys/time.h>
11761 #endif
11762 #ifdef I_SYS_SELECT
11763 #include <sys/select.h>
11764 #endif
11765 int main() {
11766         fd_set fds;
11767
11768 #ifdef TRYBITS
11769         if(fds.fds_bits);
11770 #endif
11771
11772 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
11773         exit(0);
11774 #else
11775         exit(1);
11776 #endif
11777 }
11778 EOCP
11779 set try -DTRYBITS
11780 if eval $compile; then
11781         d_fds_bits="$define"
11782         d_fd_set="$define"
11783         echo "Well, your system knows about the normal fd_set typedef..." >&4
11784         if $run ./try; then
11785                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
11786                 d_fd_macros="$define"
11787         else
11788                 $cat >&4 <<'EOM'
11789 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
11790 EOM
11791                 d_fd_macros="$undef"
11792         fi
11793 else
11794         $cat <<'EOM'
11795 Hmm, your compiler has some difficulty with fd_set.  Checking further...
11796 EOM
11797         set try
11798         if eval $compile; then
11799                 d_fds_bits="$undef"
11800                 d_fd_set="$define"
11801                 echo "Well, your system has some sort of fd_set available..." >&4
11802                 if $run ./try; then
11803                         echo "and you have the normal fd_set macros." >&4
11804                         d_fd_macros="$define"
11805                 else
11806                         $cat <<'EOM'
11807 but not the normal fd_set macros!  Gross!  More work for me...
11808 EOM
11809                         d_fd_macros="$undef"
11810                 fi
11811         else
11812         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
11813                 d_fd_set="$undef"
11814                 d_fds_bits="$undef"
11815                 d_fd_macros="$undef"
11816         fi
11817 fi
11818 $rm -f try try.*
11819
11820 : see if fgetpos exists
11821 set fgetpos d_fgetpos
11822 eval $inlibc
11823
11824 : see if finite exists
11825 set finite d_finite
11826 eval $inlibc
11827
11828 : see if finitel exists
11829 set finitel d_finitel
11830 eval $inlibc
11831
11832 : see if flock exists
11833 set flock d_flock
11834 eval $inlibc
11835
11836 : see if prototype for flock is available
11837 echo " "
11838 set d_flockproto flock $i_sysfile sys/file.h
11839 eval $hasproto
11840
11841 : see if fork exists
11842 set fork d_fork
11843 eval $inlibc
11844
11845 : see if fp_class exists
11846 set fp_class d_fp_class
11847 eval $inlibc
11848
11849 : see if pathconf exists
11850 set pathconf d_pathconf
11851 eval $inlibc
11852
11853 : see if fpathconf exists
11854 set fpathconf d_fpathconf
11855 eval $inlibc
11856
11857 : see if fpclass exists
11858 set fpclass d_fpclass
11859 eval $inlibc
11860
11861 : see if fpclassify exists
11862 set fpclassify d_fpclassify
11863 eval $inlibc
11864
11865 : see if fpclassl exists
11866 set fpclassl d_fpclassl
11867 eval $inlibc
11868
11869
11870 : check for fpos64_t
11871 echo " "
11872 echo "Checking to see if you have fpos64_t..." >&4
11873 $cat >try.c <<EOCP
11874 #include <stdio.h>
11875 int main() { fpos64_t x = 7; }
11876 EOCP
11877 set try
11878 if eval $compile; then
11879         val="$define"
11880         echo "You have fpos64_t."
11881 else
11882         val="$undef"
11883         echo "You do not have fpos64_t."
11884         case "$fpossize" in
11885         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
11886         esac
11887 fi
11888 $rm -f try.* try
11889 set d_fpos64_t
11890 eval $setvar
11891
11892 : see if frexpl exists
11893 set frexpl d_frexpl
11894 eval $inlibc
11895
11896 : see if this is a sys/param system
11897 set sys/param.h i_sysparam
11898 eval $inhdr
11899
11900 : see if this is a sys/mount.h system
11901 set sys/mount.h i_sysmount
11902 eval $inhdr
11903
11904
11905 echo " "
11906 echo "Checking to see if your system supports struct fs_data..." >&4
11907 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
11908 eval $hasstruct
11909 case "$d_fs_data_s" in
11910 "$define")      echo "Yes, it does."   ;;
11911 *)              echo "No, it doesn't." ;;
11912 esac
11913
11914 : see if fseeko exists
11915 set fseeko d_fseeko
11916 eval $inlibc
11917 case "$longsize" in
11918 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
11919 esac
11920
11921 : see if fsetpos exists
11922 set fsetpos d_fsetpos
11923 eval $inlibc
11924
11925
11926 : see if fstatfs exists
11927 set fstatfs d_fstatfs
11928 eval $inlibc
11929
11930
11931 : see if statvfs exists
11932 set statvfs d_statvfs
11933 eval $inlibc
11934
11935 : see if fstatvfs exists
11936 set fstatvfs d_fstatvfs
11937 eval $inlibc
11938
11939
11940 : see if fsync exists
11941 set fsync d_fsync
11942 eval $inlibc
11943
11944 : see if ftello exists
11945 set ftello d_ftello
11946 eval $inlibc
11947 case "$longsize" in
11948 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
11949 esac
11950
11951 : see if getcwd exists
11952 set getcwd d_getcwd
11953 eval $inlibc
11954
11955 : see if getespwnam exists
11956 set getespwnam d_getespwnam
11957 eval $inlibc
11958
11959
11960 : see if getfsstat exists
11961 set getfsstat d_getfsstat
11962 eval $inlibc
11963
11964 : see if getgrent exists
11965 set getgrent d_getgrent
11966 eval $inlibc
11967
11968 : see if getgrent_r exists
11969 set getgrent_r d_getgrent_r
11970 eval $inlibc
11971 case "$d_getgrent_r" in
11972 "$define")
11973         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11974         case "$d_getgrent_r_proto:$usethreads" in
11975         ":define")      d_getgrent_r_proto=define
11976                 set d_getgrent_r_proto getgrent_r $hdrs
11977                 eval $hasproto ;;
11978         *)      ;;
11979         esac
11980         case "$d_getgrent_r_proto" in
11981         define)
11982         case "$getgrent_r_proto" in
11983         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
11984         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
11985         esac
11986         case "$getgrent_r_proto" in
11987         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
11988         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
11989         esac
11990         case "$getgrent_r_proto" in
11991         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
11992         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
11993         esac
11994         case "$getgrent_r_proto" in
11995         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
11996         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
11997         esac
11998         case "$getgrent_r_proto" in
11999         ''|0) try='int getgrent_r(struct group*, char*, int);'
12000         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12001         esac
12002         case "$getgrent_r_proto" in
12003         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12004         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12005         esac
12006         case "$getgrent_r_proto" in
12007         ''|0)   d_getgrent_r=undef
12008                 getgrent_r_proto=0
12009                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
12010         * )     case "$getgrent_r_proto" in
12011                 REENTRANT_PROTO*) ;;
12012                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12013                 esac
12014                 echo "Prototype: $try" ;;
12015         esac
12016         ;;
12017         *)      case "$usethreads" in
12018                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12019                 esac
12020                 d_getgrent_r=undef
12021                 getgrent_r_proto=0
12022                 ;;
12023         esac
12024         ;;
12025 *)      getgrent_r_proto=0
12026         ;;
12027 esac
12028
12029 : see if getgrgid_r exists
12030 set getgrgid_r d_getgrgid_r
12031 eval $inlibc
12032 case "$d_getgrgid_r" in
12033 "$define")
12034         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12035         case "$d_getgrgid_r_proto:$usethreads" in
12036         ":define")      d_getgrgid_r_proto=define
12037                 set d_getgrgid_r_proto getgrgid_r $hdrs
12038                 eval $hasproto ;;
12039         *)      ;;
12040         esac
12041         case "$d_getgrgid_r_proto" in
12042         define)
12043         case "$getgrgid_r_proto" in
12044         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12045         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12046         esac
12047         case "$getgrgid_r_proto" in
12048         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12049         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12050         esac
12051         case "$getgrgid_r_proto" in
12052         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12053         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12054         esac
12055         case "$getgrgid_r_proto" in
12056         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12057         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12058         esac
12059         case "$getgrgid_r_proto" in
12060         ''|0)   d_getgrgid_r=undef
12061                 getgrgid_r_proto=0
12062                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
12063         * )     case "$getgrgid_r_proto" in
12064                 REENTRANT_PROTO*) ;;
12065                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12066                 esac
12067                 echo "Prototype: $try" ;;
12068         esac
12069         ;;
12070         *)      case "$usethreads" in
12071                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12072                 esac
12073                 d_getgrgid_r=undef
12074                 getgrgid_r_proto=0
12075                 ;;
12076         esac
12077         ;;
12078 *)      getgrgid_r_proto=0
12079         ;;
12080 esac
12081
12082 : see if getgrnam_r exists
12083 set getgrnam_r d_getgrnam_r
12084 eval $inlibc
12085 case "$d_getgrnam_r" in
12086 "$define")
12087         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12088         case "$d_getgrnam_r_proto:$usethreads" in
12089         ":define")      d_getgrnam_r_proto=define
12090                 set d_getgrnam_r_proto getgrnam_r $hdrs
12091                 eval $hasproto ;;
12092         *)      ;;
12093         esac
12094         case "$d_getgrnam_r_proto" in
12095         define)
12096         case "$getgrnam_r_proto" in
12097         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12098         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12099         esac
12100         case "$getgrnam_r_proto" in
12101         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12102         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12103         esac
12104         case "$getgrnam_r_proto" in
12105         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12106         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12107         esac
12108         case "$getgrnam_r_proto" in
12109         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12110         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12111         esac
12112         case "$getgrnam_r_proto" in
12113         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12114         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12115         esac
12116         case "$getgrnam_r_proto" in
12117         ''|0)   d_getgrnam_r=undef
12118                 getgrnam_r_proto=0
12119                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
12120         * )     case "$getgrnam_r_proto" in
12121                 REENTRANT_PROTO*) ;;
12122                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12123                 esac
12124                 echo "Prototype: $try" ;;
12125         esac
12126         ;;
12127         *)      case "$usethreads" in
12128                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12129                 esac
12130                 d_getgrnam_r=undef
12131                 getgrnam_r_proto=0
12132                 ;;
12133         esac
12134         ;;
12135 *)      getgrnam_r_proto=0
12136         ;;
12137 esac
12138
12139 : see if gethostbyaddr exists
12140 set gethostbyaddr d_gethbyaddr
12141 eval $inlibc
12142
12143 : see if gethostbyname exists
12144 set gethostbyname d_gethbyname
12145 eval $inlibc
12146
12147 : see if gethostent exists
12148 set gethostent d_gethent
12149 eval $inlibc
12150
12151 : see how we will look up host name
12152 echo " "
12153 call=''
12154 if set gethostname val -f d_gethname; eval $csym; $val; then
12155         echo 'gethostname() found.' >&4
12156         d_gethname="$define"
12157         call=gethostname
12158 fi
12159 if set uname val -f d_uname; eval $csym; $val; then
12160         if ./xenix; then
12161                 $cat <<'EOM'
12162 uname() was found, but you're running xenix, and older versions of xenix
12163 have a broken uname(). If you don't really know whether your xenix is old
12164 enough to have a broken system call, use the default answer.
12165
12166 EOM
12167                 dflt=y
12168                 case "$d_uname" in
12169                 "$define") dflt=n;;
12170                 esac
12171                 rp='Is your uname() broken?'
12172                 . ./myread
12173                 case "$ans" in
12174                 n*) d_uname="$define"; call=uname;;
12175                 esac
12176         else
12177                 echo 'uname() found.' >&4
12178                 d_uname="$define"
12179                 case "$call" in
12180                 '') call=uname ;;
12181                 esac
12182         fi
12183 fi
12184 case "$d_gethname" in
12185 '') d_gethname="$undef";;
12186 esac
12187 case "$d_uname" in
12188 '') d_uname="$undef";;
12189 esac
12190 case "$d_uname$d_gethname" in
12191 *define*)
12192         dflt=n
12193         cat <<EOM
12194  
12195 Every now and then someone has a $call() that lies about the hostname
12196 but can't be fixed for political or economic reasons.  If you wish, I can
12197 pretend $call() isn't there and maybe compute hostname at run-time
12198 thanks to the '$phostname' command.
12199
12200 EOM
12201         rp="Shall I ignore $call() from now on?"
12202         . ./myread
12203         case "$ans" in
12204         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12205         esac;;
12206 esac
12207 case "$phostname" in
12208 '') aphostname='';;
12209 *) case "$aphostname" in
12210         /*) ;;
12211         *) set X $phostname
12212                 shift
12213                 file=$1
12214                 shift
12215                 file=`./loc $file $file $pth`
12216                 aphostname=`echo $file $*`
12217                 ;;
12218         esac
12219         ;;
12220 esac
12221 case "$d_uname$d_gethname" in
12222 *define*) ;;
12223 *)
12224         case "$phostname" in
12225         '')
12226                 echo "There will be no way for $package to get your hostname." >&4;;
12227         *)
12228         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12229                 ;;
12230         esac;;
12231 esac
12232 case "$d_phostname" in
12233 '') d_phostname="$undef";;
12234 esac
12235
12236 : see if gethostbyaddr_r exists
12237 set gethostbyaddr_r d_gethostbyaddr_r
12238 eval $inlibc
12239 case "$d_gethostbyaddr_r" in
12240 "$define")
12241         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12242         case "$d_gethostbyaddr_r_proto:$usethreads" in
12243         ":define")      d_gethostbyaddr_r_proto=define
12244                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12245                 eval $hasproto ;;
12246         *)      ;;
12247         esac
12248         case "$d_gethostbyaddr_r_proto" in
12249         define)
12250         case "$gethostbyaddr_r_proto" in
12251         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12252         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12253         esac
12254         case "$gethostbyaddr_r_proto" in
12255         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12256         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12257         esac
12258         case "$gethostbyaddr_r_proto" in
12259         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12260         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12261         esac
12262         case "$gethostbyaddr_r_proto" in
12263         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12264         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12265         esac
12266         case "$gethostbyaddr_r_proto" in
12267         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12268         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12269         esac
12270         case "$gethostbyaddr_r_proto" in
12271         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12272         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12273         esac
12274         case "$gethostbyaddr_r_proto" in
12275         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12276         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12277         esac
12278         case "$gethostbyaddr_r_proto" in
12279         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12280         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12281         esac
12282         case "$gethostbyaddr_r_proto" in
12283         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
12284         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
12285         esac
12286         case "$gethostbyaddr_r_proto" in
12287         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
12288         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
12289         esac
12290         case "$gethostbyaddr_r_proto" in
12291         ''|0)   d_gethostbyaddr_r=undef
12292                 gethostbyaddr_r_proto=0
12293                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
12294         * )     case "$gethostbyaddr_r_proto" in
12295                 REENTRANT_PROTO*) ;;
12296                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
12297                 esac
12298                 echo "Prototype: $try" ;;
12299         esac
12300         ;;
12301         *)      case "$usethreads" in
12302                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
12303                 esac
12304                 d_gethostbyaddr_r=undef
12305                 gethostbyaddr_r_proto=0
12306                 ;;
12307         esac
12308         ;;
12309 *)      gethostbyaddr_r_proto=0
12310         ;;
12311 esac
12312
12313 : see if gethostbyname_r exists
12314 set gethostbyname_r d_gethostbyname_r
12315 eval $inlibc
12316 case "$d_gethostbyname_r" in
12317 "$define")
12318         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12319         case "$d_gethostbyname_r_proto:$usethreads" in
12320         ":define")      d_gethostbyname_r_proto=define
12321                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
12322                 eval $hasproto ;;
12323         *)      ;;
12324         esac
12325         case "$d_gethostbyname_r_proto" in
12326         define)
12327         case "$gethostbyname_r_proto" in
12328         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
12329         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
12330         esac
12331         case "$gethostbyname_r_proto" in
12332         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
12333         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
12334         esac
12335         case "$gethostbyname_r_proto" in
12336         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
12337         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
12338         esac
12339         case "$gethostbyname_r_proto" in
12340         ''|0)   d_gethostbyname_r=undef
12341                 gethostbyname_r_proto=0
12342                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
12343         * )     case "$gethostbyname_r_proto" in
12344                 REENTRANT_PROTO*) ;;
12345                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
12346                 esac
12347                 echo "Prototype: $try" ;;
12348         esac
12349         ;;
12350         *)      case "$usethreads" in
12351                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
12352                 esac
12353                 d_gethostbyname_r=undef
12354                 gethostbyname_r_proto=0
12355                 ;;
12356         esac
12357         ;;
12358 *)      gethostbyname_r_proto=0
12359         ;;
12360 esac
12361
12362 : see if gethostent_r exists
12363 set gethostent_r d_gethostent_r
12364 eval $inlibc
12365 case "$d_gethostent_r" in
12366 "$define")
12367         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12368         case "$d_gethostent_r_proto:$usethreads" in
12369         ":define")      d_gethostent_r_proto=define
12370                 set d_gethostent_r_proto gethostent_r $hdrs
12371                 eval $hasproto ;;
12372         *)      ;;
12373         esac
12374         case "$d_gethostent_r_proto" in
12375         define)
12376         case "$gethostent_r_proto" in
12377         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
12378         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
12379         esac
12380         case "$gethostent_r_proto" in
12381         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
12382         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
12383         esac
12384         case "$gethostent_r_proto" in
12385         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
12386         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
12387         esac
12388         case "$gethostent_r_proto" in
12389         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
12390         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
12391         esac
12392         case "$gethostent_r_proto" in
12393         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
12394         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
12395         esac
12396         case "$gethostent_r_proto" in
12397         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
12398         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
12399         esac
12400         case "$gethostent_r_proto" in
12401         ''|0)   d_gethostent_r=undef
12402                 gethostent_r_proto=0
12403                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
12404         * )     case "$gethostent_r_proto" in
12405                 REENTRANT_PROTO*) ;;
12406                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
12407                 esac
12408                 echo "Prototype: $try" ;;
12409         esac
12410         ;;
12411         *)      case "$usethreads" in
12412                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
12413                 esac
12414                 d_gethostent_r=undef
12415                 gethostent_r_proto=0
12416                 ;;
12417         esac
12418         ;;
12419 *)      gethostent_r_proto=0
12420         ;;
12421 esac
12422
12423 : see if prototypes for various gethostxxx netdb.h functions are available
12424 echo " "
12425 set d_gethostprotos gethostent $i_netdb netdb.h
12426 eval $hasproto
12427
12428 : see if getitimer exists
12429 set getitimer d_getitimer
12430 eval $inlibc
12431
12432 : see if getlogin exists
12433 set getlogin d_getlogin
12434 eval $inlibc
12435
12436 : see if getlogin_r exists
12437 set getlogin_r d_getlogin_r
12438 eval $inlibc
12439 case "$d_getlogin_r" in
12440 "$define")
12441         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
12442         case "$d_getlogin_r_proto:$usethreads" in
12443         ":define")      d_getlogin_r_proto=define
12444                 set d_getlogin_r_proto getlogin_r $hdrs
12445                 eval $hasproto ;;
12446         *)      ;;
12447         esac
12448         case "$d_getlogin_r_proto" in
12449         define)
12450         case "$getlogin_r_proto" in
12451         ''|0) try='int getlogin_r(char*, size_t);'
12452         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
12453         esac
12454         case "$getlogin_r_proto" in
12455         ''|0) try='int getlogin_r(char*, int);'
12456         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
12457         esac
12458         case "$getlogin_r_proto" in
12459         ''|0) try='char* getlogin_r(char*, size_t);'
12460         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
12461         esac
12462         case "$getlogin_r_proto" in
12463         ''|0) try='char* getlogin_r(char*, int);'
12464         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
12465         esac
12466         case "$getlogin_r_proto" in
12467         ''|0)   d_getlogin_r=undef
12468                 getlogin_r_proto=0
12469                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
12470         * )     case "$getlogin_r_proto" in
12471                 REENTRANT_PROTO*) ;;
12472                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
12473                 esac
12474                 echo "Prototype: $try" ;;
12475         esac
12476         ;;
12477         *)      case "$usethreads" in
12478                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
12479                 esac
12480                 d_getlogin_r=undef
12481                 getlogin_r_proto=0
12482                 ;;
12483         esac
12484         ;;
12485 *)      getlogin_r_proto=0
12486         ;;
12487 esac
12488
12489 : see if getmnt exists
12490 set getmnt d_getmnt
12491 eval $inlibc
12492
12493 : see if getmntent exists
12494 set getmntent d_getmntent
12495 eval $inlibc
12496
12497 : see if getnetbyaddr exists
12498 set getnetbyaddr d_getnbyaddr
12499 eval $inlibc
12500
12501 : see if getnetbyname exists
12502 set getnetbyname d_getnbyname
12503 eval $inlibc
12504
12505 : see if getnetent exists
12506 set getnetent d_getnent
12507 eval $inlibc
12508
12509 : see if getnetbyaddr_r exists
12510 set getnetbyaddr_r d_getnetbyaddr_r
12511 eval $inlibc
12512 case "$d_getnetbyaddr_r" in
12513 "$define")
12514         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12515         case "$d_getnetbyaddr_r_proto:$usethreads" in
12516         ":define")      d_getnetbyaddr_r_proto=define
12517                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
12518                 eval $hasproto ;;
12519         *)      ;;
12520         esac
12521         case "$d_getnetbyaddr_r_proto" in
12522         define)
12523         case "$getnetbyaddr_r_proto" in
12524         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
12525         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
12526         esac
12527         case "$getnetbyaddr_r_proto" in
12528         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
12529         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
12530         esac
12531         case "$getnetbyaddr_r_proto" in
12532         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
12533         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
12534         esac
12535         case "$getnetbyaddr_r_proto" in
12536         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
12537         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
12538         esac
12539         case "$getnetbyaddr_r_proto" in
12540         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
12541         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
12542         esac
12543         case "$getnetbyaddr_r_proto" in
12544         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
12545         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
12546         esac
12547         case "$getnetbyaddr_r_proto" in
12548         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
12549         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
12550         esac
12551         case "$getnetbyaddr_r_proto" in
12552         ''|0)   d_getnetbyaddr_r=undef
12553                 getnetbyaddr_r_proto=0
12554                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
12555         * )     case "$getnetbyaddr_r_proto" in
12556                 REENTRANT_PROTO*) ;;
12557                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
12558                 esac
12559                 echo "Prototype: $try" ;;
12560         esac
12561         ;;
12562         *)      case "$usethreads" in
12563                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
12564                 esac
12565                 d_getnetbyaddr_r=undef
12566                 getnetbyaddr_r_proto=0
12567                 ;;
12568         esac
12569         ;;
12570 *)      getnetbyaddr_r_proto=0
12571         ;;
12572 esac
12573
12574 : see if getnetbyname_r exists
12575 set getnetbyname_r d_getnetbyname_r
12576 eval $inlibc
12577 case "$d_getnetbyname_r" in
12578 "$define")
12579         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12580         case "$d_getnetbyname_r_proto:$usethreads" in
12581         ":define")      d_getnetbyname_r_proto=define
12582                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
12583                 eval $hasproto ;;
12584         *)      ;;
12585         esac
12586         case "$d_getnetbyname_r_proto" in
12587         define)
12588         case "$getnetbyname_r_proto" in
12589         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
12590         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
12591         esac
12592         case "$getnetbyname_r_proto" in
12593         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
12594         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
12595         esac
12596         case "$getnetbyname_r_proto" in
12597         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
12598         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
12599         esac
12600         case "$getnetbyname_r_proto" in
12601         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
12602         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
12603         esac
12604         case "$getnetbyname_r_proto" in
12605         ''|0)   d_getnetbyname_r=undef
12606                 getnetbyname_r_proto=0
12607                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
12608         * )     case "$getnetbyname_r_proto" in
12609                 REENTRANT_PROTO*) ;;
12610                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
12611                 esac
12612                 echo "Prototype: $try" ;;
12613         esac
12614         ;;
12615         *)      case "$usethreads" in
12616                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
12617                 esac
12618                 d_getnetbyname_r=undef
12619                 getnetbyname_r_proto=0
12620                 ;;
12621         esac
12622         ;;
12623 *)      getnetbyname_r_proto=0
12624         ;;
12625 esac
12626
12627 : see if getnetent_r exists
12628 set getnetent_r d_getnetent_r
12629 eval $inlibc
12630 case "$d_getnetent_r" in
12631 "$define")
12632         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12633         case "$d_getnetent_r_proto:$usethreads" in
12634         ":define")      d_getnetent_r_proto=define
12635                 set d_getnetent_r_proto getnetent_r $hdrs
12636                 eval $hasproto ;;
12637         *)      ;;
12638         esac
12639         case "$d_getnetent_r_proto" in
12640         define)
12641         case "$getnetent_r_proto" in
12642         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
12643         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
12644         esac
12645         case "$getnetent_r_proto" in
12646         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
12647         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
12648         esac
12649         case "$getnetent_r_proto" in
12650         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
12651         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
12652         esac
12653         case "$getnetent_r_proto" in
12654         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
12655         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
12656         esac
12657         case "$getnetent_r_proto" in
12658         ''|0) try='int getnetent_r(struct netent*, char*, int);'
12659         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
12660         esac
12661         case "$getnetent_r_proto" in
12662         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
12663         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
12664         esac
12665         case "$getnetent_r_proto" in
12666         ''|0)   d_getnetent_r=undef
12667                 getnetent_r_proto=0
12668                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
12669         * )     case "$getnetent_r_proto" in
12670                 REENTRANT_PROTO*) ;;
12671                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
12672                 esac
12673                 echo "Prototype: $try" ;;
12674         esac
12675         ;;
12676         *)      case "$usethreads" in
12677                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
12678                 esac
12679                 d_getnetent_r=undef
12680                 getnetent_r_proto=0
12681                 ;;
12682         esac
12683         ;;
12684 *)      getnetent_r_proto=0
12685         ;;
12686 esac
12687
12688 : see if prototypes for various getnetxxx netdb.h functions are available
12689 echo " "
12690 set d_getnetprotos getnetent $i_netdb netdb.h
12691 eval $hasproto
12692
12693 : see if getpagesize exists
12694 set getpagesize d_getpagsz
12695 eval $inlibc
12696
12697
12698 : see if getprotobyname exists
12699 set getprotobyname d_getpbyname
12700 eval $inlibc
12701
12702 : see if getprotobynumber exists
12703 set getprotobynumber d_getpbynumber
12704 eval $inlibc
12705
12706 : see if getprotoent exists
12707 set getprotoent d_getpent
12708 eval $inlibc
12709
12710 : see if getpgid exists
12711 set getpgid d_getpgid
12712 eval $inlibc
12713
12714 : see if getpgrp2 exists
12715 set getpgrp2 d_getpgrp2
12716 eval $inlibc
12717
12718 : see if getppid exists
12719 set getppid d_getppid
12720 eval $inlibc
12721
12722 : see if getpriority exists
12723 set getpriority d_getprior
12724 eval $inlibc
12725
12726 : see if getprotobyname_r exists
12727 set getprotobyname_r d_getprotobyname_r
12728 eval $inlibc
12729 case "$d_getprotobyname_r" in
12730 "$define")
12731         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12732         case "$d_getprotobyname_r_proto:$usethreads" in
12733         ":define")      d_getprotobyname_r_proto=define
12734                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
12735                 eval $hasproto ;;
12736         *)      ;;
12737         esac
12738         case "$d_getprotobyname_r_proto" in
12739         define)
12740         case "$getprotobyname_r_proto" in
12741         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
12742         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
12743         esac
12744         case "$getprotobyname_r_proto" in
12745         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
12746         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
12747         esac
12748         case "$getprotobyname_r_proto" in
12749         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
12750         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
12751         esac
12752         case "$getprotobyname_r_proto" in
12753         ''|0)   d_getprotobyname_r=undef
12754                 getprotobyname_r_proto=0
12755                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
12756         * )     case "$getprotobyname_r_proto" in
12757                 REENTRANT_PROTO*) ;;
12758                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
12759                 esac
12760                 echo "Prototype: $try" ;;
12761         esac
12762         ;;
12763         *)      case "$usethreads" in
12764                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
12765                 esac
12766                 d_getprotobyname_r=undef
12767                 getprotobyname_r_proto=0
12768                 ;;
12769         esac
12770         ;;
12771 *)      getprotobyname_r_proto=0
12772         ;;
12773 esac
12774
12775 : see if getprotobynumber_r exists
12776 set getprotobynumber_r d_getprotobynumber_r
12777 eval $inlibc
12778 case "$d_getprotobynumber_r" in
12779 "$define")
12780         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12781         case "$d_getprotobynumber_r_proto:$usethreads" in
12782         ":define")      d_getprotobynumber_r_proto=define
12783                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
12784                 eval $hasproto ;;
12785         *)      ;;
12786         esac
12787         case "$d_getprotobynumber_r_proto" in
12788         define)
12789         case "$getprotobynumber_r_proto" in
12790         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
12791         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
12792         esac
12793         case "$getprotobynumber_r_proto" in
12794         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
12795         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
12796         esac
12797         case "$getprotobynumber_r_proto" in
12798         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
12799         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
12800         esac
12801         case "$getprotobynumber_r_proto" in
12802         ''|0)   d_getprotobynumber_r=undef
12803                 getprotobynumber_r_proto=0
12804                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
12805         * )     case "$getprotobynumber_r_proto" in
12806                 REENTRANT_PROTO*) ;;
12807                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
12808                 esac
12809                 echo "Prototype: $try" ;;
12810         esac
12811         ;;
12812         *)      case "$usethreads" in
12813                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
12814                 esac
12815                 d_getprotobynumber_r=undef
12816                 getprotobynumber_r_proto=0
12817                 ;;
12818         esac
12819         ;;
12820 *)      getprotobynumber_r_proto=0
12821         ;;
12822 esac
12823
12824 : see if getprotoent_r exists
12825 set getprotoent_r d_getprotoent_r
12826 eval $inlibc
12827 case "$d_getprotoent_r" in
12828 "$define")
12829         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12830         case "$d_getprotoent_r_proto:$usethreads" in
12831         ":define")      d_getprotoent_r_proto=define
12832                 set d_getprotoent_r_proto getprotoent_r $hdrs
12833                 eval $hasproto ;;
12834         *)      ;;
12835         esac
12836         case "$d_getprotoent_r_proto" in
12837         define)
12838         case "$getprotoent_r_proto" in
12839         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
12840         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
12841         esac
12842         case "$getprotoent_r_proto" in
12843         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
12844         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
12845         esac
12846         case "$getprotoent_r_proto" in
12847         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
12848         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
12849         esac
12850         case "$getprotoent_r_proto" in
12851         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
12852         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
12853         esac
12854         case "$getprotoent_r_proto" in
12855         ''|0)   d_getprotoent_r=undef
12856                 getprotoent_r_proto=0
12857                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
12858         * )     case "$getprotoent_r_proto" in
12859                 REENTRANT_PROTO*) ;;
12860                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
12861                 esac
12862                 echo "Prototype: $try" ;;
12863         esac
12864         ;;
12865         *)      case "$usethreads" in
12866                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
12867                 esac
12868                 d_getprotoent_r=undef
12869                 getprotoent_r_proto=0
12870                 ;;
12871         esac
12872         ;;
12873 *)      getprotoent_r_proto=0
12874         ;;
12875 esac
12876
12877 : see if prototypes for various getprotoxxx netdb.h functions are available
12878 echo " "
12879 set d_getprotoprotos getprotoent $i_netdb netdb.h
12880 eval $hasproto
12881
12882 : see if getprpwnam exists
12883 set getprpwnam d_getprpwnam
12884 eval $inlibc
12885
12886 : see if getpwent exists
12887 set getpwent d_getpwent
12888 eval $inlibc
12889
12890 : see if getpwent_r exists
12891 set getpwent_r d_getpwent_r
12892 eval $inlibc
12893 case "$d_getpwent_r" in
12894 "$define")
12895         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12896         case "$d_getpwent_r_proto:$usethreads" in
12897         ":define")      d_getpwent_r_proto=define
12898                 set d_getpwent_r_proto getpwent_r $hdrs
12899                 eval $hasproto ;;
12900         *)      ;;
12901         esac
12902         case "$d_getpwent_r_proto" in
12903         define)
12904         case "$getpwent_r_proto" in
12905         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
12906         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
12907         esac
12908         case "$getpwent_r_proto" in
12909         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
12910         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
12911         esac
12912         case "$getpwent_r_proto" in
12913         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
12914         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
12915         esac
12916         case "$getpwent_r_proto" in
12917         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
12918         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
12919         esac
12920         case "$getpwent_r_proto" in
12921         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
12922         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
12923         esac
12924         case "$getpwent_r_proto" in
12925         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
12926         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
12927         esac
12928         case "$getpwent_r_proto" in
12929         ''|0)   d_getpwent_r=undef
12930                 getpwent_r_proto=0
12931                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
12932         * )     case "$getpwent_r_proto" in
12933                 REENTRANT_PROTO*) ;;
12934                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
12935                 esac
12936                 echo "Prototype: $try" ;;
12937         esac
12938         ;;
12939         *)      case "$usethreads" in
12940                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
12941                 esac
12942                 d_getpwent_r=undef
12943                 getpwent_r_proto=0
12944                 ;;
12945         esac
12946         ;;
12947 *)      getpwent_r_proto=0
12948         ;;
12949 esac
12950
12951 : see if getpwnam_r exists
12952 set getpwnam_r d_getpwnam_r
12953 eval $inlibc
12954 case "$d_getpwnam_r" in
12955 "$define")
12956         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12957         case "$d_getpwnam_r_proto:$usethreads" in
12958         ":define")      d_getpwnam_r_proto=define
12959                 set d_getpwnam_r_proto getpwnam_r $hdrs
12960                 eval $hasproto ;;
12961         *)      ;;
12962         esac
12963         case "$d_getpwnam_r_proto" in
12964         define)
12965         case "$getpwnam_r_proto" in
12966         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
12967         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
12968         esac
12969         case "$getpwnam_r_proto" in
12970         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
12971         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
12972         esac
12973         case "$getpwnam_r_proto" in
12974         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
12975         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
12976         esac
12977         case "$getpwnam_r_proto" in
12978         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
12979         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
12980         esac
12981         case "$getpwnam_r_proto" in
12982         ''|0)   d_getpwnam_r=undef
12983                 getpwnam_r_proto=0
12984                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
12985         * )     case "$getpwnam_r_proto" in
12986                 REENTRANT_PROTO*) ;;
12987                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
12988                 esac
12989                 echo "Prototype: $try" ;;
12990         esac
12991         ;;
12992         *)      case "$usethreads" in
12993                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
12994                 esac
12995                 d_getpwnam_r=undef
12996                 getpwnam_r_proto=0
12997                 ;;
12998         esac
12999         ;;
13000 *)      getpwnam_r_proto=0
13001         ;;
13002 esac
13003
13004 : see if getpwuid_r exists
13005 set getpwuid_r d_getpwuid_r
13006 eval $inlibc
13007 case "$d_getpwuid_r" in
13008 "$define")
13009         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13010         case "$d_getpwuid_r_proto:$usethreads" in
13011         ":define")      d_getpwuid_r_proto=define
13012                 set d_getpwuid_r_proto getpwuid_r $hdrs
13013                 eval $hasproto ;;
13014         *)      ;;
13015         esac
13016         case "$d_getpwuid_r_proto" in
13017         define)
13018         case "$getpwuid_r_proto" in
13019         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13020         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13021         esac
13022         case "$getpwuid_r_proto" in
13023         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13024         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13025         esac
13026         case "$getpwuid_r_proto" in
13027         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13028         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13029         esac
13030         case "$getpwuid_r_proto" in
13031         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13032         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13033         esac
13034         case "$getpwuid_r_proto" in
13035         ''|0)   d_getpwuid_r=undef
13036                 getpwuid_r_proto=0
13037                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
13038         * )     case "$getpwuid_r_proto" in
13039                 REENTRANT_PROTO*) ;;
13040                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13041                 esac
13042                 echo "Prototype: $try" ;;
13043         esac
13044         ;;
13045         *)      case "$usethreads" in
13046                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13047                 esac
13048                 d_getpwuid_r=undef
13049                 getpwuid_r_proto=0
13050                 ;;
13051         esac
13052         ;;
13053 *)      getpwuid_r_proto=0
13054         ;;
13055 esac
13056
13057
13058 : see if getservbyname exists
13059 set getservbyname d_getsbyname
13060 eval $inlibc
13061
13062 : see if getservbyport exists
13063 set getservbyport d_getsbyport
13064 eval $inlibc
13065
13066 : see if getservent exists
13067 set getservent d_getsent
13068 eval $inlibc
13069
13070 : see if getservbyname_r exists
13071 set getservbyname_r d_getservbyname_r
13072 eval $inlibc
13073 case "$d_getservbyname_r" in
13074 "$define")
13075         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13076         case "$d_getservbyname_r_proto:$usethreads" in
13077         ":define")      d_getservbyname_r_proto=define
13078                 set d_getservbyname_r_proto getservbyname_r $hdrs
13079                 eval $hasproto ;;
13080         *)      ;;
13081         esac
13082         case "$d_getservbyname_r_proto" in
13083         define)
13084         case "$getservbyname_r_proto" in
13085         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13086         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13087         esac
13088         case "$getservbyname_r_proto" in
13089         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13090         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13091         esac
13092         case "$getservbyname_r_proto" in
13093         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13094         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13095         esac
13096         case "$getservbyname_r_proto" in
13097         ''|0)   d_getservbyname_r=undef
13098                 getservbyname_r_proto=0
13099                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
13100         * )     case "$getservbyname_r_proto" in
13101                 REENTRANT_PROTO*) ;;
13102                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13103                 esac
13104                 echo "Prototype: $try" ;;
13105         esac
13106         ;;
13107         *)      case "$usethreads" in
13108                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13109                 esac
13110                 d_getservbyname_r=undef
13111                 getservbyname_r_proto=0
13112                 ;;
13113         esac
13114         ;;
13115 *)      getservbyname_r_proto=0
13116         ;;
13117 esac
13118
13119 : see if getservbyport_r exists
13120 set getservbyport_r d_getservbyport_r
13121 eval $inlibc
13122 case "$d_getservbyport_r" in
13123 "$define")
13124         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13125         case "$d_getservbyport_r_proto:$usethreads" in
13126         ":define")      d_getservbyport_r_proto=define
13127                 set d_getservbyport_r_proto getservbyport_r $hdrs
13128                 eval $hasproto ;;
13129         *)      ;;
13130         esac
13131         case "$d_getservbyport_r_proto" in
13132         define)
13133         case "$getservbyport_r_proto" in
13134         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13135         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13136         esac
13137         case "$getservbyport_r_proto" in
13138         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13139         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13140         esac
13141         case "$getservbyport_r_proto" in
13142         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13143         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13144         esac
13145         case "$getservbyport_r_proto" in
13146         ''|0)   d_getservbyport_r=undef
13147                 getservbyport_r_proto=0
13148                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
13149         * )     case "$getservbyport_r_proto" in
13150                 REENTRANT_PROTO*) ;;
13151                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13152                 esac
13153                 echo "Prototype: $try" ;;
13154         esac
13155         ;;
13156         *)      case "$usethreads" in
13157                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13158                 esac
13159                 d_getservbyport_r=undef
13160                 getservbyport_r_proto=0
13161                 ;;
13162         esac
13163         ;;
13164 *)      getservbyport_r_proto=0
13165         ;;
13166 esac
13167
13168 : see if getservent_r exists
13169 set getservent_r d_getservent_r
13170 eval $inlibc
13171 case "$d_getservent_r" in
13172 "$define")
13173         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13174         case "$d_getservent_r_proto:$usethreads" in
13175         ":define")      d_getservent_r_proto=define
13176                 set d_getservent_r_proto getservent_r $hdrs
13177                 eval $hasproto ;;
13178         *)      ;;
13179         esac
13180         case "$d_getservent_r_proto" in
13181         define)
13182         case "$getservent_r_proto" in
13183         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13184         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13185         esac
13186         case "$getservent_r_proto" in
13187         ''|0) try='int getservent_r(struct servent*, char*, int);'
13188         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13189         esac
13190         case "$getservent_r_proto" in
13191         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13192         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13193         esac
13194         case "$getservent_r_proto" in
13195         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13196         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13197         esac
13198         case "$getservent_r_proto" in
13199         ''|0)   d_getservent_r=undef
13200                 getservent_r_proto=0
13201                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
13202         * )     case "$getservent_r_proto" in
13203                 REENTRANT_PROTO*) ;;
13204                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13205                 esac
13206                 echo "Prototype: $try" ;;
13207         esac
13208         ;;
13209         *)      case "$usethreads" in
13210                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13211                 esac
13212                 d_getservent_r=undef
13213                 getservent_r_proto=0
13214                 ;;
13215         esac
13216         ;;
13217 *)      getservent_r_proto=0
13218         ;;
13219 esac
13220
13221 : see if prototypes for various getservxxx netdb.h functions are available
13222 echo " "
13223 set d_getservprotos getservent $i_netdb netdb.h
13224 eval $hasproto
13225
13226 : see if getspnam exists
13227 set getspnam d_getspnam
13228 eval $inlibc
13229
13230 : see if this is a shadow.h system
13231 set shadow.h i_shadow
13232 eval $inhdr
13233
13234 : see if getspnam_r exists
13235 set getspnam_r d_getspnam_r
13236 eval $inlibc
13237 case "$d_getspnam_r" in
13238 "$define")
13239         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
13240         case "$d_getspnam_r_proto:$usethreads" in
13241         ":define")      d_getspnam_r_proto=define
13242                 set d_getspnam_r_proto getspnam_r $hdrs
13243                 eval $hasproto ;;
13244         *)      ;;
13245         esac
13246         case "$d_getspnam_r_proto" in
13247         define)
13248         case "$getspnam_r_proto" in
13249         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13250         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13251         esac
13252         case "$getspnam_r_proto" in
13253         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13254         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13255         esac
13256         case "$getspnam_r_proto" in
13257         ''|0)   d_getspnam_r=undef
13258                 getspnam_r_proto=0
13259                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
13260         * )     case "$getspnam_r_proto" in
13261                 REENTRANT_PROTO*) ;;
13262                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13263                 esac
13264                 echo "Prototype: $try" ;;
13265         esac
13266         ;;
13267         *)      case "$usethreads" in
13268                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13269                 esac
13270                 d_getspnam_r=undef
13271                 getspnam_r_proto=0
13272                 ;;
13273         esac
13274         ;;
13275 *)      getspnam_r_proto=0
13276         ;;
13277 esac
13278
13279 : see if gettimeofday or ftime exists
13280 set gettimeofday d_gettimeod
13281 eval $inlibc
13282 case "$d_gettimeod" in
13283 "$undef")
13284         set ftime d_ftime 
13285         eval $inlibc
13286         ;;
13287 *)
13288         val="$undef"; set d_ftime; eval $setvar
13289         ;;
13290 esac
13291 case "$d_gettimeod$d_ftime" in
13292 "$undef$undef")
13293         echo " "
13294         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
13295         ;;
13296 esac
13297
13298 : see if gmtime_r exists
13299 set gmtime_r d_gmtime_r
13300 eval $inlibc
13301 case "$d_gmtime_r" in
13302 "$define")
13303         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13304         case "$d_gmtime_r_proto:$usethreads" in
13305         ":define")      d_gmtime_r_proto=define
13306                 set d_gmtime_r_proto gmtime_r $hdrs
13307                 eval $hasproto ;;
13308         *)      ;;
13309         esac
13310         case "$d_gmtime_r_proto" in
13311         define)
13312         case "$gmtime_r_proto" in
13313         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
13314         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
13315         esac
13316         case "$gmtime_r_proto" in
13317         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
13318         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
13319         esac
13320         case "$gmtime_r_proto" in
13321         ''|0)   d_gmtime_r=undef
13322                 gmtime_r_proto=0
13323                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
13324         * )     case "$gmtime_r_proto" in
13325                 REENTRANT_PROTO*) ;;
13326                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
13327                 esac
13328                 echo "Prototype: $try" ;;
13329         esac
13330         ;;
13331         *)      case "$usethreads" in
13332                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
13333                 esac
13334                 d_gmtime_r=undef
13335                 gmtime_r_proto=0
13336                 ;;
13337         esac
13338         ;;
13339 *)      gmtime_r_proto=0
13340         ;;
13341 esac
13342
13343 : see if hasmntopt exists
13344 set hasmntopt d_hasmntopt
13345 eval $inlibc
13346
13347 : see if this is a netinet/in.h or sys/in.h system
13348 set netinet/in.h i_niin sys/in.h i_sysin
13349 eval $inhdr
13350
13351 : see if arpa/inet.h has to be included
13352 set arpa/inet.h i_arpainet
13353 eval $inhdr
13354
13355 : see if htonl --and friends-- exists
13356 val=''
13357 set htonl val
13358 eval $inlibc
13359
13360 : Maybe they are macros.
13361 case "$val" in
13362 $undef)
13363         $cat >htonl.c <<EOM
13364 #include <stdio.h>
13365 #include <sys/types.h>
13366 #$i_niin I_NETINET_IN
13367 #$i_sysin I_SYS_IN
13368 #$i_arpainet I_ARPA_INET
13369 #ifdef I_NETINET_IN
13370 #include <netinet/in.h>
13371 #endif
13372 #ifdef I_SYS_IN
13373 #include <sys/in.h>
13374 #endif
13375 #ifdef I_ARPA_INET
13376 #include <arpa/inet.h>
13377 #endif
13378 #ifdef htonl
13379 printf("Defined as a macro.");
13380 #endif
13381 EOM
13382         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
13383         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
13384                 val="$define"
13385                 echo "But it seems to be defined as a macro." >&4
13386         fi
13387         $rm -f htonl.?
13388         ;;
13389 esac
13390 set d_htonl
13391 eval $setvar
13392
13393 : index or strchr
13394 echo " "
13395 if set index val -f; eval $csym; $val; then
13396         if set strchr val -f d_strchr; eval $csym; $val; then
13397                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
13398                         val="$define"
13399                         vali="$undef"
13400                         echo "strchr() found." >&4
13401                 else
13402                         val="$undef"
13403                         vali="$define"
13404                         echo "index() found." >&4
13405                 fi
13406         else
13407                 val="$undef"
13408                 vali="$define"
13409                 echo "index() found." >&4
13410         fi
13411 else
13412         if set strchr val -f d_strchr; eval $csym; $val; then
13413                 val="$define"
13414                 vali="$undef"
13415                 echo "strchr() found." >&4
13416         else
13417                 echo "No index() or strchr() found!" >&4
13418                 val="$undef"
13419                 vali="$undef"
13420         fi
13421 fi
13422 set d_strchr; eval $setvar
13423 val="$vali"
13424 set d_index; eval $setvar
13425
13426 : check whether inet_aton exists
13427 set inet_aton d_inetaton
13428 eval $inlibc
13429
13430 : Look for isascii
13431 echo " "
13432 $cat >isascii.c <<'EOCP'
13433 #include <stdio.h>
13434 #include <ctype.h>
13435 int main() {
13436         int c = 'A';
13437         if (isascii(c))
13438                 exit(0);
13439         else
13440                 exit(1);
13441 }
13442 EOCP
13443 set isascii
13444 if eval $compile; then
13445         echo "isascii() found." >&4
13446         val="$define"
13447 else
13448         echo "isascii() NOT found." >&4
13449         val="$undef"
13450 fi
13451 set d_isascii
13452 eval $setvar
13453 $rm -f isascii*
13454
13455 : see if isfinite exists
13456 set isfinite d_isfinite
13457 eval $inlibc
13458
13459 : see if isinf exists
13460 set isinf d_isinf
13461 eval $inlibc
13462
13463 : see if isnan exists
13464 set isnan d_isnan
13465 eval $inlibc
13466
13467 : see if isnanl exists
13468 set isnanl d_isnanl
13469 eval $inlibc
13470
13471 : see if killpg exists
13472 set killpg d_killpg
13473 eval $inlibc
13474
13475 : see if lchown exists
13476 echo " "
13477 $cat > try.c <<'EOCP'
13478 /* System header to define __stub macros and hopefully few prototypes,
13479     which can conflict with char lchown(); below.  */
13480 #include <assert.h>
13481 /* Override any gcc2 internal prototype to avoid an error.  */
13482 /* We use char because int might match the return type of a gcc2
13483    builtin and then its argument prototype would still apply.  */
13484 char lchown();
13485 int main() {
13486     /*  The GNU C library defines this for functions which it implements
13487         to always fail with ENOSYS.  Some functions are actually named
13488         something starting with __ and the normal name is an alias.  */
13489 #if defined (__stub_lchown) || defined (__stub___lchown)
13490 choke me
13491 #else
13492 lchown();
13493 #endif
13494 ; return 0; }
13495 EOCP
13496 set try
13497 if eval $compile; then
13498     $echo "lchown() found." >&4
13499     val="$define"
13500 else
13501     $echo "lchown() NOT found." >&4
13502     val="$undef"
13503 fi
13504 set d_lchown
13505 eval $setvar
13506
13507 : See if number of significant digits in a double precision number is known
13508 echo " "
13509 $cat >ldbl_dig.c <<EOM
13510 #$i_limits I_LIMITS
13511 #$i_float I_FLOAT
13512 #ifdef I_LIMITS
13513 #include <limits.h>
13514 #endif
13515 #ifdef I_FLOAT
13516 #include <float.h>
13517 #endif
13518 #ifdef LDBL_DIG
13519 printf("Contains LDBL_DIG");
13520 #endif
13521 EOM
13522 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
13523 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
13524         echo "LDBL_DIG found." >&4
13525         val="$define"
13526 else
13527         echo "LDBL_DIG NOT found." >&4
13528         val="$undef"
13529 fi
13530 $rm -f ldbl_dig.?
13531 set d_ldbl_dig
13532 eval $setvar
13533
13534 : see if link exists
13535 set link d_link
13536 eval $inlibc
13537
13538 : see if localtime_r exists
13539 set localtime_r d_localtime_r
13540 eval $inlibc
13541 case "$d_localtime_r" in
13542 "$define")
13543         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13544         case "$d_localtime_r_proto:$usethreads" in
13545         ":define")      d_localtime_r_proto=define
13546                 set d_localtime_r_proto localtime_r $hdrs
13547                 eval $hasproto ;;
13548         *)      ;;
13549         esac
13550         case "$d_localtime_r_proto" in
13551         define)
13552         case "$localtime_r_proto" in
13553         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
13554         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
13555         esac
13556         case "$localtime_r_proto" in
13557         ''|0) try='int localtime_r(const time_t*, struct tm*);'
13558         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
13559         esac
13560         case "$localtime_r_proto" in
13561         ''|0)   d_localtime_r=undef
13562                 localtime_r_proto=0
13563                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
13564         * )     case "$localtime_r_proto" in
13565                 REENTRANT_PROTO*) ;;
13566                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
13567                 esac
13568                 echo "Prototype: $try" ;;
13569         esac
13570         ;;
13571         *)      case "$usethreads" in
13572                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
13573                 esac
13574                 d_localtime_r=undef
13575                 localtime_r_proto=0
13576                 ;;
13577         esac
13578         ;;
13579 *)      localtime_r_proto=0
13580         ;;
13581 esac
13582
13583 : see if localeconv exists
13584 set localeconv d_locconv
13585 eval $inlibc
13586
13587 : see if lockf exists
13588 set lockf d_lockf
13589 eval $inlibc
13590
13591 : see if prototype for lseek is available
13592 echo " "
13593 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
13594 eval $hasproto
13595
13596 : see if lstat exists
13597 set lstat d_lstat
13598 eval $inlibc
13599
13600 : see if madvise exists
13601 set madvise d_madvise
13602 eval $inlibc
13603
13604 : see if mblen exists
13605 set mblen d_mblen
13606 eval $inlibc
13607
13608 : see if mbstowcs exists
13609 set mbstowcs d_mbstowcs
13610 eval $inlibc
13611
13612 : see if mbtowc exists
13613 set mbtowc d_mbtowc
13614 eval $inlibc
13615
13616 : see if memchr exists
13617 set memchr d_memchr
13618 eval $inlibc
13619
13620 : see if memcmp exists
13621 set memcmp d_memcmp
13622 eval $inlibc
13623
13624 : see if memcpy exists
13625 set memcpy d_memcpy
13626 eval $inlibc
13627
13628 : see if memmove exists
13629 set memmove d_memmove
13630 eval $inlibc
13631
13632 : see if memset exists
13633 set memset d_memset
13634 eval $inlibc
13635
13636 : see if mkdir exists
13637 set mkdir d_mkdir
13638 eval $inlibc
13639
13640 : see if mkdtemp exists
13641 set mkdtemp d_mkdtemp
13642 eval $inlibc
13643
13644 : see if mkfifo exists
13645 set mkfifo d_mkfifo
13646 eval $inlibc
13647
13648 : see if mkstemp exists
13649 set mkstemp d_mkstemp
13650 eval $inlibc
13651
13652 : see if mkstemps exists
13653 set mkstemps d_mkstemps
13654 eval $inlibc
13655
13656 : see if mktime exists
13657 set mktime d_mktime
13658 eval $inlibc
13659
13660 : see if this is a sys/mman.h system
13661 set sys/mman.h i_sysmman
13662 eval $inhdr
13663
13664 : see if mmap exists
13665 set mmap d_mmap
13666 eval $inlibc
13667 : see what shmat returns
13668 : default to something harmless
13669 mmaptype='void *'
13670 case "$i_sysmman$d_mmap" in
13671 "$define$define")
13672         $cat >mmap.c <<'END'
13673 #include <sys/mman.h>
13674 void *mmap();
13675 END
13676         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
13677                 mmaptype='void *'
13678         else
13679                 mmaptype='caddr_t'
13680         fi
13681         echo "and it returns ($mmaptype)." >&4
13682         ;;
13683 esac
13684
13685
13686
13687 : see if mprotect exists
13688 set mprotect d_mprotect
13689 eval $inlibc
13690
13691 : see if msgctl exists
13692 set msgctl d_msgctl
13693 eval $inlibc
13694
13695 : see if msgget exists
13696 set msgget d_msgget
13697 eval $inlibc
13698
13699 : see if msgsnd exists
13700 set msgsnd d_msgsnd
13701 eval $inlibc
13702
13703 : see if msgrcv exists
13704 set msgrcv d_msgrcv
13705 eval $inlibc
13706
13707 : see how much of the 'msg*(2)' library is present.
13708 h_msg=true
13709 echo " "
13710 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
13711 *"$undef"*) h_msg=false;;
13712 esac
13713 case "$osname" in
13714 freebsd)
13715     case "`ipcs 2>&1`" in
13716     "SVID messages"*"not configured"*)
13717         echo "Your $osname does not have the msg*(2) configured." >&4
13718         h_msg=false
13719         val="$undef"
13720         set msgctl d_msgctl
13721         eval $setvar
13722         set msgget d_msgget
13723         eval $setvar
13724         set msgsnd d_msgsnd
13725         eval $setvar
13726         set msgrcv d_msgrcv
13727         eval $setvar
13728         ;;
13729     esac
13730     ;;
13731 esac
13732 : we could also check for sys/ipc.h ...
13733 if $h_msg && $test `./findhdr sys/msg.h`; then
13734         echo "You have the full msg*(2) library." >&4
13735         val="$define"
13736 else
13737         echo "You don't have the full msg*(2) library." >&4
13738         val="$undef"
13739 fi
13740 set d_msg
13741 eval $setvar
13742
13743
13744 echo " "
13745 echo "Checking to see if your system supports struct msghdr..." >&4
13746 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
13747 eval $hasstruct
13748 case "$d_msghdr_s" in
13749 "$define")      echo "Yes, it does."   ;;
13750 *)              echo "No, it doesn't." ;;
13751 esac
13752
13753
13754 : see if msync exists
13755 set msync d_msync
13756 eval $inlibc
13757
13758 : see if munmap exists
13759 set munmap d_munmap
13760 eval $inlibc
13761
13762 : see if nanosleep exists
13763 set nanosleep d_nanosleep
13764 eval $inlibc
13765
13766 : see if nice exists
13767 set nice d_nice
13768 eval $inlibc
13769
13770 : see if this is a langinfo.h system
13771 set langinfo.h i_langinfo
13772 eval $inhdr
13773
13774 : see if nl_langinfo exists
13775 set nl_langinfo d_nl_langinfo
13776 eval $inlibc
13777
13778 : check for length of character
13779 echo " "
13780 case "$charsize" in
13781 '')
13782         echo "Checking to see how big your characters are (hey, you never know)..." >&4
13783         $cat >try.c <<'EOCP'
13784 #include <stdio.h>
13785 int main()
13786 {
13787     printf("%d\n", (int)sizeof(char));
13788     exit(0);
13789 }
13790 EOCP
13791         set try
13792         if eval $compile_ok; then
13793                 dflt=`$run ./try`
13794         else
13795                 dflt='1'
13796                 echo "(I can't seem to compile the test program.  Guessing...)"
13797         fi
13798         ;;
13799 *)
13800         dflt="$charsize"
13801         ;;
13802 esac
13803 rp="What is the size of a character (in bytes)?"
13804 . ./myread
13805 charsize="$ans"
13806 $rm -f try.c try
13807
13808 : check for volatile keyword
13809 echo " "
13810 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
13811 $cat >try.c <<'EOCP'
13812 main()
13813 {
13814         typedef struct _goo_struct goo_struct;
13815         goo_struct * volatile goo = ((goo_struct *)0);
13816         struct _goo_struct {
13817                 long long_int;
13818                 int reg_int;
13819                 char char_var;
13820         };
13821         typedef unsigned short foo_t;
13822         char *volatile foo;
13823         volatile int bar;
13824         volatile foo_t blech;
13825         foo = foo;
13826 }
13827 EOCP
13828 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
13829         val="$define"
13830         echo "Yup, it does."
13831 else
13832         val="$undef"
13833         echo "Nope, it doesn't."
13834 fi
13835 set d_volatile
13836 eval $setvar
13837 $rm -f try.*
13838
13839
13840 echo " "
13841 $echo "Choosing the C types to be used for Perl's internal types..." >&4
13842
13843 case "$use64bitint:$d_quad:$quadtype" in
13844 define:define:?*)
13845         ivtype="$quadtype"
13846         uvtype="$uquadtype"
13847         ivsize=8
13848         uvsize=8
13849         ;;
13850 *)      ivtype="long"
13851         uvtype="unsigned long"
13852         ivsize=$longsize
13853         uvsize=$longsize
13854         ;;
13855 esac
13856
13857 case "$uselongdouble:$d_longdbl" in
13858 define:define)
13859         nvtype="long double"
13860         nvsize=$longdblsize
13861         ;;
13862 *)      nvtype=double
13863         nvsize=$doublesize
13864         ;;
13865 esac
13866
13867 $echo "(IV will be "$ivtype", $ivsize bytes)"
13868 $echo "(UV will be "$uvtype", $uvsize bytes)"
13869 $echo "(NV will be "$nvtype", $nvsize bytes)"
13870
13871 $cat >try.c <<EOCP
13872 #$i_inttypes I_INTTYPES
13873 #ifdef I_INTTYPES
13874 #include <inttypes.h>
13875 #endif
13876 #include <stdio.h>
13877 int main() {
13878 #ifdef INT8
13879    int8_t i =  INT8_MAX;
13880   uint8_t u = UINT8_MAX;
13881   printf("int8_t\n");
13882 #endif
13883 #ifdef INT16
13884    int16_t i =  INT16_MAX;
13885   uint16_t i = UINT16_MAX;
13886   printf("int16_t\n");
13887 #endif
13888 #ifdef INT32
13889    int32_t i =  INT32_MAX;
13890   uint32_t u = UINT32_MAX;
13891   printf("int32_t\n");
13892 #endif
13893 }
13894 EOCP
13895
13896 case "$i8type" in
13897 '')     case "$charsize" in
13898         1)      i8type=char
13899                 u8type="unsigned char"
13900                 i8size=$charsize
13901                 u8size=$charsize
13902                 ;;
13903         esac
13904         ;;
13905 esac
13906 case "$i8type" in
13907 '')     set try -DINT8
13908         if eval $compile; then
13909                 case "`$run ./try`" in
13910                 int8_t) i8type=int8_t
13911                         u8type=uint8_t
13912                         i8size=1
13913                         u8size=1
13914                         ;;
13915                 esac
13916         fi
13917         ;;
13918 esac
13919 case "$i8type" in
13920 '')     if $test $charsize -ge 1; then
13921                 i8type=char
13922                 u8type="unsigned char"
13923                 i8size=$charsize
13924                 u8size=$charsize
13925         fi
13926         ;;
13927 esac
13928
13929 case "$i16type" in
13930 '')     case "$shortsize" in
13931         2)      i16type=short
13932                 u16type="unsigned short"
13933                 i16size=$shortsize
13934                 u16size=$shortsize
13935                 ;;
13936         esac
13937         ;;
13938 esac
13939 case "$i16type" in
13940 '')     set try -DINT16
13941         if eval $compile; then
13942                 case "`$run ./try`" in
13943                 int16_t)
13944                         i16type=int16_t
13945                         u16type=uint16_t
13946                         i16size=2
13947                         u16size=2
13948                         ;;
13949                 esac
13950         fi
13951         ;;
13952 esac
13953 case "$i16type" in
13954 '')     if $test $shortsize -ge 2; then
13955                 i16type=short
13956                 u16type="unsigned short"
13957                 i16size=$shortsize
13958                 u16size=$shortsize
13959         fi
13960         ;;
13961 esac
13962
13963 case "$i32type" in
13964 '')     case "$longsize" in
13965         4)      i32type=long
13966                 u32type="unsigned long"
13967                 i32size=$longsize
13968                 u32size=$longsize
13969                 ;;
13970         *)      case "$intsize" in
13971                 4)      i32type=int
13972                         u32type="unsigned int"
13973                         i32size=$intsize
13974                         u32size=$intsize
13975                         ;;
13976                 esac
13977                 ;;
13978         esac
13979         ;;
13980 esac
13981 case "$i32type" in
13982 '')     set try -DINT32
13983         if eval $compile; then
13984                 case "`$run ./try`" in
13985                 int32_t)
13986                         i32type=int32_t
13987                         u32type=uint32_t
13988                         i32size=4
13989                         u32size=4
13990                         ;;
13991                 esac
13992         fi
13993         ;;
13994 esac
13995 case "$i32type" in
13996 '')     if $test $intsize -ge 4; then
13997                 i32type=int
13998                 u32type="unsigned int"
13999                 i32size=$intsize
14000                 u32size=$intsize
14001         fi
14002         ;;
14003 esac
14004
14005 case "$i64type" in
14006 '')     case "$d_quad:$quadtype" in
14007         define:?*)
14008                 i64type="$quadtype"
14009                 u64type="$uquadtype"
14010                 i64size=8
14011                 u64size=8
14012                 ;;
14013         esac
14014         ;;
14015 esac
14016
14017 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14018 : volatile so that the compiler has to store it out to memory.
14019 if test X"$d_volatile" = X"$define"; then
14020         volatile=volatile
14021 fi
14022 $cat <<EOP >try.c
14023 #include <stdio.h>
14024 #include <sys/types.h>
14025 #include <signal.h>
14026 #ifdef SIGFPE
14027 $volatile int bletched = 0;
14028 $signal_t blech(s) int s; { bletched = 1; }
14029 #endif
14030 int main() {
14031     $uvtype u = 0;
14032     $nvtype d;
14033     int     n = 8 * $uvsize;
14034     int     i;
14035 #ifdef SIGFPE
14036     signal(SIGFPE, blech);
14037 #endif
14038
14039     for (i = 0; i < n; i++) {
14040       u = u << 1 | ($uvtype)1;
14041       d = ($nvtype)u;
14042       if (($uvtype)d != u)
14043         break;
14044       if (d <= 0)
14045         break;
14046       d = ($nvtype)(u - 1);
14047       if (($uvtype)d != (u - 1))
14048         break;
14049 #ifdef SIGFPE
14050       if (bletched) {
14051         break;
14052 #endif
14053       } 
14054     }
14055     printf("%d\n", ((i == n) ? -n : i));
14056     exit(0);
14057 }
14058 EOP
14059 set try
14060
14061 d_nv_preserves_uv="$undef"
14062 if eval $compile; then
14063         nv_preserves_uv_bits="`$run ./try`"
14064 fi
14065 case "$nv_preserves_uv_bits" in
14066 \-[1-9]*)       
14067         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14068         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
14069         d_nv_preserves_uv="$define"
14070         ;;
14071 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
14072         d_nv_preserves_uv="$undef" ;;
14073 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
14074         nv_preserves_uv_bits="$undef" ;;
14075 esac
14076
14077 $rm -f try.* try
14078
14079
14080 : check for off64_t
14081 echo " "
14082 echo "Checking to see if you have off64_t..." >&4
14083 $cat >try.c <<EOCP
14084 #include <sys/types.h>
14085 #include <unistd.h>
14086 int main() { off64_t x = 7; }
14087 EOCP
14088 set try
14089 if eval $compile; then
14090         val="$define"
14091         echo "You have off64_t."
14092 else
14093         val="$undef"
14094         echo "You do not have off64_t."
14095         case "$lseeksize" in
14096         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
14097         esac
14098 fi
14099 $rm -f try.* try
14100 set d_off64_t
14101 eval $setvar
14102
14103 : how to create joinable pthreads
14104 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
14105         echo " "
14106         echo "Checking what constant to use for creating joinable pthreads..." >&4 
14107         $cat >try.c <<'EOCP'
14108 #include <pthread.h>
14109 int main() {
14110     int detachstate = JOINABLE;
14111 }
14112 EOCP
14113         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
14114         if eval $compile; then
14115                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
14116                 val="$undef" # Yes, undef.
14117                 set d_old_pthread_create_joinable
14118                 eval $setvar
14119                 val=""
14120                 set old_pthread_create_joinable
14121                 eval $setvar
14122         else
14123                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
14124                 if eval $compile; then
14125                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
14126                         val="$define"
14127                         set d_old_pthread_create_joinable
14128                         eval $setvar
14129                         val=PTHREAD_CREATE_UNDETACHED
14130                         set old_pthread_create_joinable
14131                         eval $setvar
14132                 else            
14133                         set try -DJOINABLE=__UNDETACHED
14134                         if eval $compile; then
14135                                 echo "You seem to use __UNDETACHED." >&4
14136                                 val="$define"
14137                                 set d_old_pthread_create_joinable
14138                                 eval $setvar
14139                                 val=__UNDETACHED
14140                                 set old_pthread_create_joinable
14141                                 eval $setvar
14142                         else
14143                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
14144                                 val="$define"
14145                                 set d_old_pthread_create_joinable
14146                                 eval $setvar
14147                                 val=0
14148                                 set old_pthread_create_joinable
14149                                 eval $setvar
14150                         fi
14151                 fi
14152         fi
14153         $rm -f try try.*
14154 else
14155     d_old_pthread_create_joinable="$undef"
14156     old_pthread_create_joinable=""
14157 fi
14158
14159 : see if pause exists
14160 set pause d_pause
14161 eval $inlibc
14162
14163 : see if pipe exists
14164 set pipe d_pipe
14165 eval $inlibc
14166
14167 : see if poll exists
14168 set poll d_poll
14169 eval $inlibc
14170
14171 : see if readlink exists
14172 set readlink d_readlink
14173 eval $inlibc
14174
14175 echo " "
14176 procselfexe=''
14177 val="$undef"
14178 case "$d_readlink" in
14179 "$define")
14180         if $issymlink /proc/self/exe ; then
14181                 $ls -l /proc/self/exe > reflect
14182                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
14183                         echo "You have Linux-like /proc/self/exe."
14184                         procselfexe='"/proc/self/exe"'
14185                         val="$define"
14186                 fi
14187         fi
14188         if $issymlink /proc/curproc/file ; then
14189                 $ls -l /proc/curproc/file > reflect
14190                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
14191                         echo "You have BSD-like /proc/curproc/file."
14192                         procselfexe='"/proc/curproc/file"'
14193                         val="$define"
14194                 fi
14195         fi
14196         ;;
14197 esac
14198 $rm -f reflect
14199 set d_procselfexe
14200 eval $setvar
14201
14202 : see whether the pthread_atfork exists
14203 $cat >try.c <<EOP
14204 #include <pthread.h>
14205 #include <stdio.h>
14206 int main() {
14207 #ifdef  PTHREAD_ATFORK
14208         pthread_atfork(NULL,NULL,NULL);
14209 #endif
14210 }
14211 EOP
14212
14213 : see if pthread_atfork exists
14214 set try -DPTHREAD_ATFORK
14215 if eval $compile; then
14216     val="$define"
14217 else
14218     val="$undef"
14219 fi
14220 case "$usethreads" in
14221 $define)
14222         case "$val" in
14223         $define) echo 'pthread_atfork found.' >&4        ;;
14224         *)       echo 'pthread_atfork NOT found.' >&4    ;;
14225         esac
14226 esac
14227 set d_pthread_atfork
14228 eval $setvar
14229
14230
14231 : see whether the various POSIXish _yields exist
14232 $cat >try.c <<EOP
14233 #include <pthread.h>
14234 #include <stdio.h>
14235 int main() {
14236 #ifdef SCHED_YIELD
14237         sched_yield();
14238 #else
14239 #ifdef PTHREAD_YIELD
14240         pthread_yield();
14241 #else
14242 #ifdef PTHREAD_YIELD_NULL
14243         pthread_yield(NULL);
14244 #endif
14245 #endif
14246 #endif
14247 }
14248 EOP
14249 : see if sched_yield exists
14250 set try -DSCHED_YIELD
14251 if eval $compile; then
14252     val="$define"
14253     sched_yield='sched_yield()'
14254 else
14255     val="$undef"
14256 fi
14257 case "$usethreads" in
14258 $define)
14259         case "$val" in
14260         $define) echo 'sched_yield() found.' >&4        ;;
14261         *)       echo 'sched_yield() NOT found.' >&4    ;;
14262         esac
14263 esac
14264 set d_sched_yield
14265 eval $setvar
14266
14267 : see if pthread_yield exists
14268 set try -DPTHREAD_YIELD
14269 if eval $compile; then
14270     val="$define"
14271     case "$sched_yield" in
14272     '') sched_yield='pthread_yield()' ;;
14273     esac
14274 else
14275     set try -DPTHREAD_YIELD_NULL
14276     if eval $compile; then
14277         val="$define"
14278         case "$sched_yield" in
14279         '') sched_yield='pthread_yield(NULL)' ;;
14280         esac
14281     else
14282         val="$undef"
14283     fi
14284 fi
14285 case "$usethreads" in
14286 $define)
14287         case "$val" in
14288         $define) echo 'pthread_yield() found.' >&4      ;;
14289         *)       echo 'pthread_yield() NOT found.' >&4  ;;
14290         esac
14291         ;;
14292 esac
14293 set d_pthread_yield
14294 eval $setvar
14295
14296 case "$sched_yield" in
14297 '') sched_yield=undef ;;
14298 esac
14299
14300 $rm -f try try.*
14301
14302 : see if random_r exists
14303 set random_r d_random_r
14304 eval $inlibc
14305 case "$d_random_r" in
14306 "$define")
14307         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
14308         case "$d_random_r_proto:$usethreads" in
14309         ":define")      d_random_r_proto=define
14310                 set d_random_r_proto random_r $hdrs
14311                 eval $hasproto ;;
14312         *)      ;;
14313         esac
14314         case "$d_random_r_proto" in
14315         define)
14316         case "$random_r_proto" in
14317         ''|0) try='int random_r(int*, struct random_data*);'
14318         ./protochk "extern $try" $hdrs && random_r_proto=I_TS ;;
14319         esac
14320         case "$random_r_proto" in
14321         ''|0)   d_random_r=undef
14322                 random_r_proto=0
14323                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
14324         * )     case "$random_r_proto" in
14325                 REENTRANT_PROTO*) ;;
14326                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
14327                 esac
14328                 echo "Prototype: $try" ;;
14329         esac
14330         ;;
14331         *)      case "$usethreads" in
14332                 define) echo "random_r has no prototype, not using it." >&4 ;;
14333                 esac
14334                 d_random_r=undef
14335                 random_r_proto=0
14336                 ;;
14337         esac
14338         ;;
14339 *)      random_r_proto=0
14340         ;;
14341 esac
14342
14343 : see if readdir and friends exist
14344 set readdir d_readdir
14345 eval $inlibc
14346 set seekdir d_seekdir
14347 eval $inlibc
14348 set telldir d_telldir
14349 eval $inlibc
14350 set rewinddir d_rewinddir
14351 eval $inlibc
14352
14353 : see if readdir64_r exists
14354 set readdir64_r d_readdir64_r
14355 eval $inlibc
14356 case "$d_readdir64_r" in
14357 "$define")
14358         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
14359         case "$d_readdir64_r_proto:$usethreads" in
14360         ":define")      d_readdir64_r_proto=define
14361                 set d_readdir64_r_proto readdir64_r $hdrs
14362                 eval $hasproto ;;
14363         *)      ;;
14364         esac
14365         case "$d_readdir64_r_proto" in
14366         define)
14367         case "$readdir64_r_proto" in
14368         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
14369         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
14370         esac
14371         case "$readdir64_r_proto" in
14372         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
14373         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
14374         esac
14375         case "$readdir64_r_proto" in
14376         ''|0)   d_readdir64_r=undef
14377                 readdir64_r_proto=0
14378                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
14379         * )     case "$readdir64_r_proto" in
14380                 REENTRANT_PROTO*) ;;
14381                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
14382                 esac
14383                 echo "Prototype: $try" ;;
14384         esac
14385         ;;
14386         *)      case "$usethreads" in
14387                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
14388                 esac
14389                 d_readdir64_r=undef
14390                 readdir64_r_proto=0
14391                 ;;
14392         esac
14393         ;;
14394 *)      readdir64_r_proto=0
14395         ;;
14396 esac
14397
14398 : see if readdir_r exists
14399 set readdir_r d_readdir_r
14400 eval $inlibc
14401 case "$d_readdir_r" in
14402 "$define")
14403         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
14404         case "$d_readdir_r_proto:$usethreads" in
14405         ":define")      d_readdir_r_proto=define
14406                 set d_readdir_r_proto readdir_r $hdrs
14407                 eval $hasproto ;;
14408         *)      ;;
14409         esac
14410         case "$d_readdir_r_proto" in
14411         define)
14412         case "$readdir_r_proto" in
14413         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
14414         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
14415         esac
14416         case "$readdir_r_proto" in
14417         ''|0) try='int readdir_r(DIR*, struct dirent*);'
14418         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
14419         esac
14420         case "$readdir_r_proto" in
14421         ''|0)   d_readdir_r=undef
14422                 readdir_r_proto=0
14423                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
14424         * )     case "$readdir_r_proto" in
14425                 REENTRANT_PROTO*) ;;
14426                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
14427                 esac
14428                 echo "Prototype: $try" ;;
14429         esac
14430         ;;
14431         *)      case "$usethreads" in
14432                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
14433                 esac
14434                 d_readdir_r=undef
14435                 readdir_r_proto=0
14436                 ;;
14437         esac
14438         ;;
14439 *)      readdir_r_proto=0
14440         ;;
14441 esac
14442
14443 : see if readv exists
14444 set readv d_readv
14445 eval $inlibc
14446
14447 : see if recvmsg exists
14448 set recvmsg d_recvmsg
14449 eval $inlibc
14450
14451 : see if rename exists
14452 set rename d_rename
14453 eval $inlibc
14454
14455 : see if rmdir exists
14456 set rmdir d_rmdir
14457 eval $inlibc
14458
14459 : see if memory.h is available.
14460 val=''
14461 set memory.h val
14462 eval $inhdr
14463
14464 : See if it conflicts with string.h
14465 case "$val" in
14466 $define)
14467         case "$strings" in
14468         '') ;;
14469         *)
14470                 $cppstdin $cppflags $cppminus < $strings > mem.h
14471                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
14472                         echo " "
14473                         echo "We won't be including <memory.h>."
14474                         val="$undef"
14475                 fi
14476                 $rm -f mem.h
14477                 ;;
14478         esac
14479 esac
14480 set i_memory
14481 eval $setvar
14482
14483 : can bcopy handle overlapping blocks?
14484 echo " "
14485 val="$undef"
14486 case "$d_memmove" in
14487 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
14488 *)      case "$d_bcopy" in
14489         "$define")
14490                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
14491                 $cat >try.c <<EOCP
14492 #$i_memory I_MEMORY
14493 #$i_stdlib I_STDLIB
14494 #$i_string I_STRING
14495 #$i_unistd I_UNISTD
14496 EOCP
14497         $cat >>try.c <<'EOCP'
14498 #include <stdio.h>
14499 #ifdef I_MEMORY
14500 #  include <memory.h>
14501 #endif
14502 #ifdef I_STDLIB
14503 #  include <stdlib.h>
14504 #endif
14505 #ifdef I_STRING
14506 #  include <string.h>
14507 #else
14508 #  include <strings.h>
14509 #endif
14510 #ifdef I_UNISTD
14511 #  include <unistd.h>  /* Needed for NetBSD */
14512 #endif
14513 int main()
14514 {
14515 char buf[128], abc[128];
14516 char *b;
14517 int len;
14518 int off;
14519 int align;
14520
14521 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14522    try to store the string in read-only memory. */
14523 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
14524
14525 for (align = 7; align >= 0; align--) {
14526         for (len = 36; len; len--) {
14527                 b = buf+align;
14528                 bcopy(abc, b, len);
14529                 for (off = 1; off <= len; off++) {
14530                         bcopy(b, b+off, len);
14531                         bcopy(b+off, b, len);
14532                         if (bcmp(b, abc, len))
14533                                 exit(1);
14534                 }
14535         }
14536 }
14537 exit(0);
14538 }
14539 EOCP
14540                 set try
14541                 if eval $compile_ok; then
14542                         if ./try 2>/dev/null; then
14543                                 echo "Yes, it can."
14544                                 val="$define"
14545                         else
14546                                 echo "It can't, sorry."
14547                         fi
14548                 else
14549                         echo "(I can't compile the test program, so we'll assume not...)"
14550                 fi
14551                 ;;
14552         esac
14553         $rm -f try.* try core
14554         ;;
14555 esac
14556 set d_safebcpy
14557 eval $setvar
14558
14559 : can memcpy handle overlapping blocks?
14560 echo " "
14561 val="$undef"
14562 case "$d_memmove" in
14563 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
14564 *)      case "$d_memcpy" in
14565         "$define")
14566                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
14567                 $cat >try.c <<EOCP
14568 #$i_memory I_MEMORY
14569 #$i_stdlib I_STDLIB
14570 #$i_string I_STRING
14571 #$i_unistd I_UNISTD
14572 EOCP
14573         $cat >>try.c <<'EOCP'
14574 #include <stdio.h>
14575 #ifdef I_MEMORY
14576 #  include <memory.h>
14577 #endif
14578 #ifdef I_STDLIB
14579 #  include <stdlib.h>
14580 #endif
14581 #ifdef I_STRING
14582 #  include <string.h>
14583 #else
14584 #  include <strings.h>
14585 #endif
14586 #ifdef I_UNISTD
14587 #  include <unistd.h>  /* Needed for NetBSD */
14588 #endif
14589 int main()
14590 {
14591 char buf[128], abc[128];
14592 char *b;
14593 int len;
14594 int off;
14595 int align;
14596
14597 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14598    try to store the string in read-only memory. */
14599 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
14600
14601 for (align = 7; align >= 0; align--) {
14602         for (len = 36; len; len--) {
14603                 b = buf+align;
14604                 memcpy(b, abc, len);
14605                 for (off = 1; off <= len; off++) {
14606                         memcpy(b+off, b, len);
14607                         memcpy(b, b+off, len);
14608                         if (memcmp(b, abc, len))
14609                                 exit(1);
14610                 }
14611         }
14612 }
14613 exit(0);
14614 }
14615 EOCP
14616                 set try
14617                 if eval $compile_ok; then
14618                         if ./try 2>/dev/null; then
14619                                 echo "Yes, it can."
14620                                 val="$define"
14621                         else
14622                                 echo "It can't, sorry."
14623                         fi
14624                 else
14625                         echo "(I can't compile the test program, so we'll assume not...)"
14626                 fi
14627                 ;;
14628         esac
14629         $rm -f try.* try core
14630         ;;
14631 esac
14632 set d_safemcpy
14633 eval $setvar
14634
14635 : can memcmp be trusted to compare relative magnitude?
14636 val="$undef"
14637 case "$d_memcmp" in
14638 "$define")
14639         echo " "
14640         echo "Checking if your memcmp() can compare relative magnitude..." >&4
14641         $cat >try.c <<EOCP
14642 #$i_memory I_MEMORY
14643 #$i_stdlib I_STDLIB
14644 #$i_string I_STRING
14645 #$i_unistd I_UNISTD
14646 EOCP
14647         $cat >>try.c <<'EOCP'
14648 #include <stdio.h>
14649 #ifdef I_MEMORY
14650 #  include <memory.h>
14651 #endif
14652 #ifdef I_STDLIB
14653 #  include <stdlib.h>
14654 #endif
14655 #ifdef I_STRING
14656 #  include <string.h>
14657 #else
14658 #  include <strings.h>
14659 #endif
14660 #ifdef I_UNISTD
14661 #  include <unistd.h>  /* Needed for NetBSD */
14662 #endif
14663 int main()
14664 {
14665 char a = -1;
14666 char b = 0;
14667 if ((a < b) && memcmp(&a, &b, 1) < 0)
14668         exit(1);
14669 exit(0);
14670 }
14671 EOCP
14672         set try
14673         if eval $compile_ok; then
14674                 if $run ./try 2>/dev/null; then
14675                         echo "Yes, it can."
14676                         val="$define"
14677                 else
14678                         echo "No, it can't (it uses signed chars)."
14679                 fi
14680         else
14681                 echo "(I can't compile the test program, so we'll assume not...)"
14682         fi
14683         ;;
14684 esac
14685 $rm -f try.* try core
14686 set d_sanemcmp
14687 eval $setvar
14688
14689 : see if prototype for sbrk is available
14690 echo " "
14691 set d_sbrkproto sbrk $i_unistd unistd.h
14692 eval $hasproto
14693
14694 : see if select exists
14695 set select d_select
14696 eval $inlibc
14697
14698 : see if semctl exists
14699 set semctl d_semctl
14700 eval $inlibc
14701
14702 : see if semget exists
14703 set semget d_semget
14704 eval $inlibc
14705
14706 : see if semop exists
14707 set semop d_semop
14708 eval $inlibc
14709
14710 : see how much of the 'sem*(2)' library is present.
14711 h_sem=true
14712 echo " "
14713 case "$d_semctl$d_semget$d_semop" in
14714 *"$undef"*) h_sem=false;;
14715 esac
14716 case "$osname" in
14717 freebsd)
14718     case "`ipcs 2>&1`" in
14719     "SVID messages"*"not configured"*)
14720         echo "Your $osname does not have the sem*(2) configured." >&4
14721         h_sem=false
14722         val="$undef"
14723         set semctl d_semctl
14724         eval $setvar
14725         set semget d_semget
14726         eval $setvar
14727         set semop d_semop
14728         eval $setvar
14729         ;;
14730     esac
14731     ;;
14732 esac
14733 : we could also check for sys/ipc.h ...
14734 if $h_sem && $test `./findhdr sys/sem.h`; then
14735         echo "You have the full sem*(2) library." >&4
14736         val="$define"
14737 else
14738         echo "You don't have the full sem*(2) library." >&4
14739         val="$undef"
14740 fi
14741 set d_sem
14742 eval $setvar
14743
14744 : see whether sys/sem.h defines union semun
14745 echo " "
14746 $cat > try.c <<'END'
14747 #include <sys/types.h>
14748 #include <sys/ipc.h>
14749 #include <sys/sem.h>
14750 int main () { union semun semun; semun.buf = 0; }
14751 END
14752 set try
14753 if eval $compile; then
14754     echo "You have union semun in <sys/sem.h>." >&4
14755     val="$define"
14756 else
14757     echo "You do not have union semun in <sys/sem.h>." >&4
14758     val="$undef"
14759 fi
14760 $rm -f try try.c try.h
14761 set d_union_semun
14762 eval $setvar
14763
14764 : see how to do semctl IPC_STAT
14765 case "$d_sem" in
14766 $define)
14767     : see whether semctl IPC_STAT can use union semun
14768     echo " "
14769     $cat > try.h <<END
14770 #ifndef S_IRUSR
14771 #   ifdef S_IREAD
14772 #       define S_IRUSR S_IREAD
14773 #       define S_IWUSR S_IWRITE
14774 #       define S_IXUSR S_IEXEC
14775 #   else
14776 #       define S_IRUSR 0400
14777 #       define S_IWUSR 0200
14778 #       define S_IXUSR 0100
14779 #   endif
14780 #   define S_IRGRP (S_IRUSR>>3)
14781 #   define S_IWGRP (S_IWUSR>>3)
14782 #   define S_IXGRP (S_IXUSR>>3)
14783 #   define S_IROTH (S_IRUSR>>6)
14784 #   define S_IWOTH (S_IWUSR>>6)
14785 #   define S_IXOTH (S_IXUSR>>6)
14786 #endif
14787 #ifndef S_IRWXU
14788 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
14789 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
14790 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
14791 #endif
14792 END
14793
14794     $cat > try.c <<END
14795 #include <sys/types.h>
14796 #include <sys/ipc.h>
14797 #include <sys/sem.h>
14798 #include <sys/stat.h>
14799 #include <stdio.h>
14800 #include <errno.h>
14801 #include "try.h"
14802 #ifndef errno
14803 extern int errno;
14804 #endif
14805 #$d_union_semun HAS_UNION_SEMUN
14806 int main() {
14807     union semun
14808 #ifndef HAS_UNION_SEMUN
14809     {
14810         int val;
14811         struct semid_ds *buf;
14812         unsigned short *array;
14813     }
14814 #endif
14815     arg;
14816     int sem, st;
14817
14818 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
14819     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14820     if (sem > -1) {
14821         struct semid_ds argbuf;
14822         arg.buf = &argbuf;
14823 #       ifdef IPC_STAT
14824         st = semctl(sem, 0, IPC_STAT, arg);
14825         if (st == 0)
14826             printf("semun\n");
14827         else
14828 #       endif /* IPC_STAT */
14829             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14830 #       ifdef IPC_RMID
14831         if (semctl(sem, 0, IPC_RMID, arg) != 0)
14832 #       endif /* IPC_RMID */
14833             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14834     } else
14835 #endif /* IPC_PRIVATE && ... */
14836         printf("semget failed: errno = %d\n", errno);
14837   return 0;
14838 }
14839 END
14840     val="$undef"
14841     set try
14842     if eval $compile; then
14843         xxx=`$run ./try`
14844         case "$xxx" in
14845         semun) val="$define" ;;
14846         esac
14847     fi
14848     $rm -f try try.c
14849     set d_semctl_semun
14850     eval $setvar
14851     case "$d_semctl_semun" in
14852     $define)
14853         echo "You can use union semun for semctl IPC_STAT." >&4
14854         also='also'
14855         ;;
14856     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
14857         also=''
14858         ;;
14859     esac
14860
14861     : see whether semctl IPC_STAT can use struct semid_ds pointer
14862     $cat > try.c <<'END'
14863 #include <sys/types.h>
14864 #include <sys/ipc.h>
14865 #include <sys/sem.h>
14866 #include <sys/stat.h>
14867 #include "try.h"
14868 #include <stdio.h>
14869 #include <errno.h>
14870 #ifndef errno
14871 extern int errno;
14872 #endif
14873 int main() {
14874     struct semid_ds arg;
14875     int sem, st;
14876
14877 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
14878     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14879     if (sem > -1) {
14880 #       ifdef IPC_STAT
14881         st = semctl(sem, 0, IPC_STAT, &arg);
14882         if (st == 0)
14883             printf("semid_ds\n");
14884         else
14885 #       endif /* IPC_STAT */
14886             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14887 #       ifdef IPC_RMID
14888         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
14889 #       endif /* IPC_RMID */
14890             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14891     } else
14892 #endif /* IPC_PRIVATE && ... */
14893         printf("semget failed: errno = %d\n", errno);
14894
14895     return 0;
14896 }
14897 END
14898     val="$undef"
14899     set try
14900     if eval $compile; then
14901         xxx=`$run ./try`
14902         case "$xxx" in
14903         semid_ds) val="$define" ;;
14904         esac
14905     fi
14906     $rm -f try try.c
14907     set d_semctl_semid_ds
14908     eval $setvar
14909     case "$d_semctl_semid_ds" in
14910     $define)
14911         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
14912         ;;
14913     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
14914         ;;
14915     esac
14916     $rm -f try.h
14917     ;;
14918 *)  val="$undef"
14919
14920     # We do not have the full sem*(2) library, so assume we can not
14921     # use either.
14922
14923     set d_semctl_semun
14924     eval $setvar
14925
14926     set d_semctl_semid_ds
14927     eval $setvar
14928     ;;
14929 esac
14930
14931 : see if sendmsg exists
14932 set sendmsg d_sendmsg
14933 eval $inlibc
14934
14935 : see if setegid exists
14936 set setegid d_setegid
14937 eval $inlibc
14938
14939 : see if seteuid exists
14940 set seteuid d_seteuid
14941 eval $inlibc
14942
14943 : see if setgrent exists
14944 set setgrent d_setgrent
14945 eval $inlibc
14946
14947 : see if setgrent_r exists
14948 set setgrent_r d_setgrent_r
14949 eval $inlibc
14950 case "$d_setgrent_r" in
14951 "$define")
14952         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14953         case "$d_setgrent_r_proto:$usethreads" in
14954         ":define")      d_setgrent_r_proto=define
14955                 set d_setgrent_r_proto setgrent_r $hdrs
14956                 eval $hasproto ;;
14957         *)      ;;
14958         esac
14959         case "$d_setgrent_r_proto" in
14960         define)
14961         case "$setgrent_r_proto" in
14962         ''|0) try='int setgrent_r(FILE**);'
14963         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
14964         esac
14965         case "$setgrent_r_proto" in
14966         ''|0) try='void setgrent_r(FILE**);'
14967         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
14968         esac
14969         case "$setgrent_r_proto" in
14970         ''|0)   d_setgrent_r=undef
14971                 setgrent_r_proto=0
14972                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
14973         * )     case "$setgrent_r_proto" in
14974                 REENTRANT_PROTO*) ;;
14975                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
14976                 esac
14977                 echo "Prototype: $try" ;;
14978         esac
14979         ;;
14980         *)      case "$usethreads" in
14981                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
14982                 esac
14983                 d_setgrent_r=undef
14984                 setgrent_r_proto=0
14985                 ;;
14986         esac
14987         ;;
14988 *)      setgrent_r_proto=0
14989         ;;
14990 esac
14991
14992 : see if sethostent exists
14993 set sethostent d_sethent
14994 eval $inlibc
14995
14996 : see if sethostent_r exists
14997 set sethostent_r d_sethostent_r
14998 eval $inlibc
14999 case "$d_sethostent_r" in
15000 "$define")
15001         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15002         case "$d_sethostent_r_proto:$usethreads" in
15003         ":define")      d_sethostent_r_proto=define
15004                 set d_sethostent_r_proto sethostent_r $hdrs
15005                 eval $hasproto ;;
15006         *)      ;;
15007         esac
15008         case "$d_sethostent_r_proto" in
15009         define)
15010         case "$sethostent_r_proto" in
15011         ''|0) try='int sethostent_r(int, struct hostent_data*);'
15012         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
15013         esac
15014         case "$sethostent_r_proto" in
15015         ''|0) try='void sethostent_r(int, struct hostent_data*);'
15016         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
15017         esac
15018         case "$sethostent_r_proto" in
15019         ''|0)   d_sethostent_r=undef
15020                 sethostent_r_proto=0
15021                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
15022         * )     case "$sethostent_r_proto" in
15023                 REENTRANT_PROTO*) ;;
15024                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
15025                 esac
15026                 echo "Prototype: $try" ;;
15027         esac
15028         ;;
15029         *)      case "$usethreads" in
15030                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
15031                 esac
15032                 d_sethostent_r=undef
15033                 sethostent_r_proto=0
15034                 ;;
15035         esac
15036         ;;
15037 *)      sethostent_r_proto=0
15038         ;;
15039 esac
15040
15041 : see if setitimer exists
15042 set setitimer d_setitimer
15043 eval $inlibc
15044
15045 : see if setlinebuf exists
15046 set setlinebuf d_setlinebuf
15047 eval $inlibc
15048
15049 : see if setlocale exists
15050 set setlocale d_setlocale
15051 eval $inlibc
15052
15053 : see if locale.h is available
15054 set locale.h i_locale
15055 eval $inhdr
15056
15057 : see if setlocale_r exists
15058 set setlocale_r d_setlocale_r
15059 eval $inlibc
15060 case "$d_setlocale_r" in
15061 "$define")
15062         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
15063         case "$d_setlocale_r_proto:$usethreads" in
15064         ":define")      d_setlocale_r_proto=define
15065                 set d_setlocale_r_proto setlocale_r $hdrs
15066                 eval $hasproto ;;
15067         *)      ;;
15068         esac
15069         case "$d_setlocale_r_proto" in
15070         define)
15071         case "$setlocale_r_proto" in
15072         ''|0) try='int setlocale_r(int, const char*, char*, int);'
15073         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
15074         esac
15075         case "$setlocale_r_proto" in
15076         ''|0)   d_setlocale_r=undef
15077                 setlocale_r_proto=0
15078                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
15079         * )     case "$setlocale_r_proto" in
15080                 REENTRANT_PROTO*) ;;
15081                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
15082                 esac
15083                 echo "Prototype: $try" ;;
15084         esac
15085         ;;
15086         *)      case "$usethreads" in
15087                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
15088                 esac
15089                 d_setlocale_r=undef
15090                 setlocale_r_proto=0
15091                 ;;
15092         esac
15093         ;;
15094 *)      setlocale_r_proto=0
15095         ;;
15096 esac
15097
15098 : see if setnetent exists
15099 set setnetent d_setnent
15100 eval $inlibc
15101
15102 : see if setnetent_r exists
15103 set setnetent_r d_setnetent_r
15104 eval $inlibc
15105 case "$d_setnetent_r" in
15106 "$define")
15107         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15108         case "$d_setnetent_r_proto:$usethreads" in
15109         ":define")      d_setnetent_r_proto=define
15110                 set d_setnetent_r_proto setnetent_r $hdrs
15111                 eval $hasproto ;;
15112         *)      ;;
15113         esac
15114         case "$d_setnetent_r_proto" in
15115         define)
15116         case "$setnetent_r_proto" in
15117         ''|0) try='int setnetent_r(int, struct netent_data*);'
15118         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
15119         esac
15120         case "$setnetent_r_proto" in
15121         ''|0) try='void setnetent_r(int, struct netent_data*);'
15122         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
15123         esac
15124         case "$setnetent_r_proto" in
15125         ''|0)   d_setnetent_r=undef
15126                 setnetent_r_proto=0
15127                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
15128         * )     case "$setnetent_r_proto" in
15129                 REENTRANT_PROTO*) ;;
15130                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
15131                 esac
15132                 echo "Prototype: $try" ;;
15133         esac
15134         ;;
15135         *)      case "$usethreads" in
15136                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
15137                 esac
15138                 d_setnetent_r=undef
15139                 setnetent_r_proto=0
15140                 ;;
15141         esac
15142         ;;
15143 *)      setnetent_r_proto=0
15144         ;;
15145 esac
15146
15147 : see if setprotoent exists
15148 set setprotoent d_setpent
15149 eval $inlibc
15150
15151 : see if setpgid exists
15152 set setpgid d_setpgid
15153 eval $inlibc
15154
15155 : see if setpgrp2 exists
15156 set setpgrp2 d_setpgrp2
15157 eval $inlibc
15158
15159 : see if setpriority exists
15160 set setpriority d_setprior
15161 eval $inlibc
15162
15163 : see if setproctitle exists
15164 set setproctitle d_setproctitle
15165 eval $inlibc
15166
15167 : see if setprotoent_r exists
15168 set setprotoent_r d_setprotoent_r
15169 eval $inlibc
15170 case "$d_setprotoent_r" in
15171 "$define")
15172         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15173         case "$d_setprotoent_r_proto:$usethreads" in
15174         ":define")      d_setprotoent_r_proto=define
15175                 set d_setprotoent_r_proto setprotoent_r $hdrs
15176                 eval $hasproto ;;
15177         *)      ;;
15178         esac
15179         case "$d_setprotoent_r_proto" in
15180         define)
15181         case "$setprotoent_r_proto" in
15182         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
15183         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
15184         esac
15185         case "$setprotoent_r_proto" in
15186         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
15187         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
15188         esac
15189         case "$setprotoent_r_proto" in
15190         ''|0)   d_setprotoent_r=undef
15191                 setprotoent_r_proto=0
15192                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
15193         * )     case "$setprotoent_r_proto" in
15194                 REENTRANT_PROTO*) ;;
15195                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
15196                 esac
15197                 echo "Prototype: $try" ;;
15198         esac
15199         ;;
15200         *)      case "$usethreads" in
15201                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
15202                 esac
15203                 d_setprotoent_r=undef
15204                 setprotoent_r_proto=0
15205                 ;;
15206         esac
15207         ;;
15208 *)      setprotoent_r_proto=0
15209         ;;
15210 esac
15211
15212 : see if setpwent exists
15213 set setpwent d_setpwent
15214 eval $inlibc
15215
15216 : see if setpwent_r exists
15217 set setpwent_r d_setpwent_r
15218 eval $inlibc
15219 case "$d_setpwent_r" in
15220 "$define")
15221         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15222         case "$d_setpwent_r_proto:$usethreads" in
15223         ":define")      d_setpwent_r_proto=define
15224                 set d_setpwent_r_proto setpwent_r $hdrs
15225                 eval $hasproto ;;
15226         *)      ;;
15227         esac
15228         case "$d_setpwent_r_proto" in
15229         define)
15230         case "$setpwent_r_proto" in
15231         ''|0) try='int setpwent_r(FILE**);'
15232         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
15233         esac
15234         case "$setpwent_r_proto" in
15235         ''|0) try='void setpwent_r(FILE**);'
15236         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
15237         esac
15238         case "$setpwent_r_proto" in
15239         ''|0)   d_setpwent_r=undef
15240                 setpwent_r_proto=0
15241                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
15242         * )     case "$setpwent_r_proto" in
15243                 REENTRANT_PROTO*) ;;
15244                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
15245                 esac
15246                 echo "Prototype: $try" ;;
15247         esac
15248         ;;
15249         *)      case "$usethreads" in
15250                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
15251                 esac
15252                 d_setpwent_r=undef
15253                 setpwent_r_proto=0
15254                 ;;
15255         esac
15256         ;;
15257 *)      setpwent_r_proto=0
15258         ;;
15259 esac
15260
15261 : see if setregid exists
15262 set setregid d_setregid
15263 eval $inlibc
15264 set setresgid d_setresgid
15265 eval $inlibc
15266
15267 : see if setreuid exists
15268 set setreuid d_setreuid
15269 eval $inlibc
15270 set setresuid d_setresuid
15271 eval $inlibc
15272
15273 : see if setrgid exists
15274 set setrgid d_setrgid
15275 eval $inlibc
15276
15277 : see if setruid exists
15278 set setruid d_setruid
15279 eval $inlibc
15280
15281 : see if setservent exists
15282 set setservent d_setsent
15283 eval $inlibc
15284
15285 : see if setservent_r exists
15286 set setservent_r d_setservent_r
15287 eval $inlibc
15288 case "$d_setservent_r" in
15289 "$define")
15290         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15291         case "$d_setservent_r_proto:$usethreads" in
15292         ":define")      d_setservent_r_proto=define
15293                 set d_setservent_r_proto setservent_r $hdrs
15294                 eval $hasproto ;;
15295         *)      ;;
15296         esac
15297         case "$d_setservent_r_proto" in
15298         define)
15299         case "$setservent_r_proto" in
15300         ''|0) try='int setservent_r(int, struct servent_data*);'
15301         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
15302         esac
15303         case "$setservent_r_proto" in
15304         ''|0) try='void setservent_r(int, struct servent_data*);'
15305         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
15306         esac
15307         case "$setservent_r_proto" in
15308         ''|0)   d_setservent_r=undef
15309                 setservent_r_proto=0
15310                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
15311         * )     case "$setservent_r_proto" in
15312                 REENTRANT_PROTO*) ;;
15313                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
15314                 esac
15315                 echo "Prototype: $try" ;;
15316         esac
15317         ;;
15318         *)      case "$usethreads" in
15319                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
15320                 esac
15321                 d_setservent_r=undef
15322                 setservent_r_proto=0
15323                 ;;
15324         esac
15325         ;;
15326 *)      setservent_r_proto=0
15327         ;;
15328 esac
15329
15330 : see if setsid exists
15331 set setsid d_setsid
15332 eval $inlibc
15333
15334 : see if setvbuf exists
15335 set setvbuf d_setvbuf
15336 eval $inlibc
15337
15338 : see if sfio.h is available
15339 set sfio.h i_sfio
15340 eval $inhdr
15341
15342
15343 : see if sfio library is available
15344 case "$i_sfio" in
15345 $define)
15346         val=''
15347         set sfreserve val
15348         eval $inlibc
15349         ;;
15350 *)
15351         val="$undef"
15352         ;;
15353 esac
15354 : Ok, but do we want to use it.
15355 case "$val" in
15356 $define)
15357         case "$usesfio" in
15358         true|$define|[yY]*) dflt='y';;
15359         *) dflt='n';;
15360         esac
15361         echo "$package can use the sfio library, but it is experimental."
15362         case "$useperlio" in
15363         "$undef")
15364             echo "For sfio also the PerlIO abstraction layer is needed."
15365             echo "Earlier you said you wouldn't want that."
15366             ;;
15367         esac
15368         rp="You seem to have sfio available, do you want to try using it?"
15369         . ./myread
15370         case "$ans" in
15371         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
15372                 useperlio="$define"
15373                 val="$define"
15374                 ;;
15375         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
15376                 val="$undef"
15377                 ;;
15378         esac
15379         ;;
15380 *)      case "$usesfio" in
15381         true|$define|[yY]*)
15382                 echo "Sorry, cannot find sfio on this machine." >&4
15383                 echo "Ignoring your setting of usesfio=$usesfio." >&4
15384                 val="$undef"
15385                 ;;
15386         esac
15387         ;;
15388 esac
15389 set d_sfio
15390 eval $setvar
15391 case "$d_sfio" in
15392 $define) usesfio='true';;
15393 *) usesfio='false';;
15394 esac
15395 case "$d_sfio" in
15396 $define) ;;
15397 *)      : Remove sfio from list of libraries to use
15398         case "$libs" in
15399         *-lsfio*)
15400                 echo "Removing unneeded -lsfio from library list" >&4
15401                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
15402                 shift
15403                 libs="$*"
15404                 echo "libs = $libs" >&4
15405                 ;;
15406         esac
15407 ;;
15408 esac
15409
15410
15411 : see if shmctl exists
15412 set shmctl d_shmctl
15413 eval $inlibc
15414
15415 : see if shmget exists
15416 set shmget d_shmget
15417 eval $inlibc
15418
15419 : see if shmat exists
15420 set shmat d_shmat
15421 eval $inlibc
15422 : see what shmat returns
15423 case "$d_shmat" in
15424 "$define")
15425         $cat >shmat.c <<'END'
15426 #include <sys/shm.h>
15427 void *shmat();
15428 END
15429         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
15430                 shmattype='void *'
15431         else
15432                 shmattype='char *'
15433         fi
15434         echo "and it returns ($shmattype)." >&4
15435         : see if a prototype for shmat is available
15436         xxx=`./findhdr sys/shm.h`
15437         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
15438         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
15439                 val="$define"
15440         else
15441                 val="$undef"
15442         fi
15443         $rm -f shmat.[co]
15444         ;;
15445 *)
15446         val="$undef"
15447         ;;
15448 esac
15449 set d_shmatprototype
15450 eval $setvar
15451
15452 : see if shmdt exists
15453 set shmdt d_shmdt
15454 eval $inlibc
15455
15456 : see how much of the 'shm*(2)' library is present.
15457 h_shm=true
15458 echo " "
15459 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
15460 *"$undef"*) h_shm=false;;
15461 esac
15462 case "$osname" in
15463 freebsd)
15464     case "`ipcs 2>&1`" in
15465     "SVID shared memory"*"not configured"*)
15466         echo "Your $osname does not have the shm*(2) configured." >&4
15467         h_shm=false
15468         val="$undef"
15469         set shmctl d_shmctl
15470         evat $setvar
15471         set shmget d_shmget
15472         evat $setvar
15473         set shmat d_shmat
15474         evat $setvar
15475         set shmdt d_shmdt
15476         evat $setvar
15477         ;;
15478     esac
15479     ;;
15480 esac
15481 : we could also check for sys/ipc.h ...
15482 if $h_shm && $test `./findhdr sys/shm.h`; then
15483         echo "You have the full shm*(2) library." >&4
15484         val="$define"
15485 else
15486         echo "You don't have the full shm*(2) library." >&4
15487         val="$undef"
15488 fi
15489 set d_shm
15490 eval $setvar
15491
15492 echo " "
15493 : see if we have sigaction
15494 if set sigaction val -f d_sigaction; eval $csym; $val; then
15495         echo 'sigaction() found.' >&4
15496         $cat > try.c <<'EOP'
15497 #include <stdio.h>
15498 #include <sys/types.h>
15499 #include <signal.h>
15500 int main()
15501 {
15502     struct sigaction act, oact;
15503     act.sa_flags = 0;
15504     oact.sa_handler = 0;
15505     /* so that act and oact are used */
15506     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
15507 }
15508 EOP
15509         set try
15510         if eval $compile_ok; then
15511                 val="$define"
15512         else
15513                 echo "But you don't seem to have a useable struct sigaction." >&4
15514                 val="$undef"
15515         fi
15516 else
15517         echo 'sigaction NOT found.' >&4
15518         val="$undef"
15519 fi
15520 set d_sigaction; eval $setvar
15521 $rm -f try try$_o try.c
15522
15523 : see if sigprocmask exists
15524 set sigprocmask d_sigprocmask
15525 eval $inlibc
15526
15527 : see if sigsetjmp exists
15528 echo " "
15529 case "$d_sigsetjmp" in
15530 '')
15531         $cat >try.c <<'EOP'
15532 #include <setjmp.h>
15533 sigjmp_buf env;
15534 int set = 1;
15535 int main()
15536 {
15537         if (sigsetjmp(env,1))
15538                 exit(set);
15539         set = 0;
15540         siglongjmp(env, 1);
15541         exit(1);
15542 }
15543 EOP
15544         set try
15545         if eval $compile; then
15546                 if $run ./try >/dev/null 2>&1; then
15547                         echo "POSIX sigsetjmp found." >&4
15548                         val="$define"
15549                 else
15550                         $cat >&4 <<EOM
15551 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
15552 I'll ignore them.
15553 EOM
15554                         val="$undef"
15555                 fi
15556         else
15557                 echo "sigsetjmp not found." >&4
15558                 val="$undef"
15559         fi
15560         ;;
15561 *) val="$d_sigsetjmp"
15562         case "$d_sigsetjmp" in
15563         $define) echo "POSIX sigsetjmp found." >&4;;
15564         $undef) echo "sigsetjmp not found." >&4;;
15565         esac
15566         ;;
15567 esac
15568 set d_sigsetjmp
15569 eval $setvar
15570 $rm -f try.c try
15571
15572 : see if sockatmark exists
15573 set sockatmark d_sockatmark
15574 eval $inlibc
15575
15576 : see if prototype for sockatmark is available
15577 echo " "
15578 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
15579 eval $hasproto
15580
15581 : see if socks5_init exists
15582 set socks5_init d_socks5_init
15583 eval $inlibc
15584
15585 : see if srand48_r exists
15586 set srand48_r d_srand48_r
15587 eval $inlibc
15588 case "$d_srand48_r" in
15589 "$define")
15590         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15591         case "$d_srand48_r_proto:$usethreads" in
15592         ":define")      d_srand48_r_proto=define
15593                 set d_srand48_r_proto srand48_r $hdrs
15594                 eval $hasproto ;;
15595         *)      ;;
15596         esac
15597         case "$d_srand48_r_proto" in
15598         define)
15599         case "$srand48_r_proto" in
15600         ''|0) try='int srand48_r(long, struct drand48_data*);'
15601         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
15602         esac
15603         case "$srand48_r_proto" in
15604         ''|0)   d_srand48_r=undef
15605                 srand48_r_proto=0
15606                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
15607         * )     case "$srand48_r_proto" in
15608                 REENTRANT_PROTO*) ;;
15609                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
15610                 esac
15611                 echo "Prototype: $try" ;;
15612         esac
15613         ;;
15614         *)      case "$usethreads" in
15615                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
15616                 esac
15617                 d_srand48_r=undef
15618                 srand48_r_proto=0
15619                 ;;
15620         esac
15621         ;;
15622 *)      srand48_r_proto=0
15623         ;;
15624 esac
15625
15626 : see if srandom_r exists
15627 set srandom_r d_srandom_r
15628 eval $inlibc
15629 case "$d_srandom_r" in
15630 "$define")
15631         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15632         case "$d_srandom_r_proto:$usethreads" in
15633         ":define")      d_srandom_r_proto=define
15634                 set d_srandom_r_proto srandom_r $hdrs
15635                 eval $hasproto ;;
15636         *)      ;;
15637         esac
15638         case "$d_srandom_r_proto" in
15639         define)
15640         case "$srandom_r_proto" in
15641         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
15642         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
15643         esac
15644         case "$srandom_r_proto" in
15645         ''|0)   d_srandom_r=undef
15646                 srandom_r_proto=0
15647                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
15648         * )     case "$srandom_r_proto" in
15649                 REENTRANT_PROTO*) ;;
15650                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
15651                 esac
15652                 echo "Prototype: $try" ;;
15653         esac
15654         ;;
15655         *)      case "$usethreads" in
15656                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
15657                 esac
15658                 d_srandom_r=undef
15659                 srandom_r_proto=0
15660                 ;;
15661         esac
15662         ;;
15663 *)      srandom_r_proto=0
15664         ;;
15665 esac
15666
15667 : see if prototype for setresgid is available
15668 echo " "
15669 set d_sresgproto setresgid $i_unistd unistd.h
15670 eval $hasproto
15671
15672 : see if prototype for setresuid is available
15673 echo " "
15674 set d_sresuproto setresuid $i_unistd unistd.h
15675 eval $hasproto
15676
15677 : see if sys/stat.h is available
15678 set sys/stat.h i_sysstat
15679 eval $inhdr
15680
15681
15682 : see if stat knows about block sizes
15683 echo " "
15684 echo "Checking to see if your struct stat has st_blocks field..." >&4
15685 set d_statblks stat st_blocks $i_sysstat sys/stat.h
15686 eval $hasfield
15687
15688
15689 : see if this is a sys/vfs.h system
15690 set sys/vfs.h i_sysvfs
15691 eval $inhdr
15692
15693
15694 : see if this is a sys/statfs.h system
15695 set sys/statfs.h i_sysstatfs
15696 eval $inhdr
15697
15698
15699 echo " "
15700 echo "Checking to see if your system supports struct statfs..." >&4
15701 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
15702 eval $hasstruct
15703 case "$d_statfs_s" in
15704 "$define")      echo "Yes, it does."   ;;
15705 *)              echo "No, it doesn't." ;;
15706 esac
15707
15708
15709
15710 : see if struct statfs knows about f_flags
15711 case "$d_statfs_s" in
15712 define) 
15713         echo " "
15714         echo "Checking to see if your struct statfs has f_flags field..." >&4
15715         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
15716         eval $hasfield
15717         ;;
15718 *)      val="$undef"
15719         set d_statfs_f_flags
15720         eval $setvar
15721         ;;
15722 esac
15723 case "$d_statfs_f_flags" in
15724 "$define")      echo "Yes, it does."   ;;
15725 *)              echo "No, it doesn't." ;;
15726 esac
15727
15728 : see if _ptr and _cnt from stdio act std
15729 echo " "
15730
15731 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
15732         echo "(Looks like you have stdio.h from BSD.)"
15733         case "$stdio_ptr" in
15734         '') stdio_ptr='((fp)->_p)'
15735                 ptr_lval=$define
15736                 ;;
15737         *)      ptr_lval=$d_stdio_ptr_lval;;
15738         esac
15739         case "$stdio_cnt" in
15740         '') stdio_cnt='((fp)->_r)'
15741                 cnt_lval=$define
15742                 ;;
15743         *)      cnt_lval=$d_stdio_cnt_lval;;
15744         esac
15745         case "$stdio_base" in
15746         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
15747         esac
15748         case "$stdio_bufsiz" in
15749         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
15750         esac
15751 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
15752         echo "(Looks like you have stdio.h from Linux.)"
15753         case "$stdio_ptr" in
15754         '') stdio_ptr='((fp)->_IO_read_ptr)'
15755                 ptr_lval=$define
15756                 ;;
15757         *)      ptr_lval=$d_stdio_ptr_lval;;
15758         esac
15759         case "$stdio_cnt" in
15760         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
15761                 cnt_lval=$undef
15762                 ;;
15763         *)      cnt_lval=$d_stdio_cnt_lval;;
15764         esac
15765         case "$stdio_base" in
15766         '') stdio_base='((fp)->_IO_read_base)';;
15767         esac
15768         case "$stdio_bufsiz" in
15769         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
15770         esac
15771 else
15772         case "$stdio_ptr" in
15773         '') stdio_ptr='((fp)->_ptr)'
15774                 ptr_lval=$define
15775                 ;;
15776         *)      ptr_lval=$d_stdio_ptr_lval;;
15777         esac
15778         case "$stdio_cnt" in
15779         '') stdio_cnt='((fp)->_cnt)'
15780                 cnt_lval=$define
15781                 ;;
15782         *)      cnt_lval=$d_stdio_cnt_lval;;
15783         esac
15784         case "$stdio_base" in
15785         '') stdio_base='((fp)->_base)';;
15786         esac
15787         case "$stdio_bufsiz" in
15788         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
15789         esac
15790 fi
15791
15792 : test whether _ptr and _cnt really work
15793 echo "Checking how std your stdio is..." >&4
15794 $cat >try.c <<EOP
15795 #include <stdio.h>
15796 #define FILE_ptr(fp)    $stdio_ptr
15797 #define FILE_cnt(fp)    $stdio_cnt
15798 int main() {
15799         FILE *fp = fopen("try.c", "r");
15800         char c = getc(fp);
15801         if (
15802                 18 <= FILE_cnt(fp) &&
15803                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15804         )
15805                 exit(0);
15806         exit(1);
15807 }
15808 EOP
15809 val="$undef"
15810 set try
15811 if eval $compile && $to try.c; then
15812         if $run ./try; then
15813                 echo "Your stdio acts pretty std."
15814                 val="$define"
15815         else
15816                 echo "Your stdio isn't very std."
15817         fi
15818 else
15819         echo "Your stdio doesn't appear very std."
15820 fi
15821 $rm -f try.c try
15822
15823 # glibc 2.2.90 and above apparently change stdio streams so Perl's
15824 # direct buffer manipulation no longer works.  The Configure tests
15825 # should be changed to correctly detect this, but until then,
15826 # the following check should at least let perl compile and run.
15827 # (This quick fix should be updated before 5.8.1.)
15828 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
15829 # A. Dougherty, June 3, 2002.
15830 case "$d_gnulibc" in
15831 $define)
15832         case "$gnulibc_version" in
15833         2.[01]*)  ;;
15834         2.2) ;;
15835         2.2.[0-9]) ;;
15836         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
15837                 val="$undef"
15838                 ;;
15839         esac
15840         ;;
15841 esac
15842 set d_stdstdio
15843 eval $setvar
15844
15845 : Can _ptr be used as an lvalue?
15846 case "$d_stdstdio$ptr_lval" in
15847 $define$define) val=$define ;;
15848 *) val=$undef ;;
15849 esac
15850 set d_stdio_ptr_lval
15851 eval $setvar
15852
15853 : Can _cnt be used as an lvalue?
15854 case "$d_stdstdio$cnt_lval" in
15855 $define$define) val=$define ;;
15856 *) val=$undef ;;
15857 esac
15858 set d_stdio_cnt_lval
15859 eval $setvar
15860
15861
15862 : test whether setting _ptr sets _cnt as a side effect
15863 d_stdio_ptr_lval_sets_cnt="$undef"
15864 d_stdio_ptr_lval_nochange_cnt="$undef"
15865 case "$d_stdio_ptr_lval$d_stdstdio" in
15866 $define$define)
15867         echo "Checking to see what happens if we set the stdio ptr..." >&4
15868 $cat >try.c <<EOP
15869 #include <stdio.h>
15870 /* Can we scream? */
15871 /* Eat dust sed :-) */
15872 /* In the buffer space, no one can hear you scream. */
15873 #define FILE_ptr(fp)    $stdio_ptr
15874 #define FILE_cnt(fp)    $stdio_cnt
15875 #include <sys/types.h>
15876 int main() {
15877         FILE *fp = fopen("try.c", "r");
15878         int c;
15879         char *ptr;
15880         size_t cnt;
15881         if (!fp) {
15882             puts("Fail even to read");
15883             exit(1);
15884         }
15885         c = getc(fp); /* Read away the first # */
15886         if (c == EOF) {
15887             puts("Fail even to read");
15888             exit(1);
15889         }
15890         if (!(
15891                 18 <= FILE_cnt(fp) &&
15892                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15893         )) {
15894                 puts("Fail even to read");
15895                 exit (1);
15896         }
15897         ptr = (char*) FILE_ptr(fp);
15898         cnt = (size_t)FILE_cnt(fp);
15899
15900         FILE_ptr(fp) += 42;
15901
15902         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
15903                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
15904                 exit (1);
15905         }
15906         if (FILE_cnt(fp) <= 20) {
15907                 printf ("Fail (<20 chars to test)");
15908                 exit (1);
15909         }
15910         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
15911                 puts("Fail compare");
15912                 exit (1);
15913         }
15914         if (cnt == FILE_cnt(fp)) {
15915                 puts("Pass_unchanged");
15916                 exit (0);
15917         }       
15918         if (FILE_cnt(fp) == (cnt - 42)) {
15919                 puts("Pass_changed");
15920                 exit (0);
15921         }
15922         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
15923         return 1;
15924
15925 }
15926 EOP
15927         set try
15928         if eval $compile && $to try.c; then
15929                 case `$run ./try` in
15930                 Pass_changed)
15931                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
15932                         d_stdio_ptr_lval_sets_cnt="$define" ;;
15933                 Pass_unchanged)
15934                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
15935                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
15936                 Fail*)
15937                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
15938                 *)
15939                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
15940         esac
15941         else
15942                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
15943         fi
15944         $rm -f try.c try
15945         ;;
15946 esac
15947
15948 : see if _base is also standard
15949 val="$undef"
15950 case "$d_stdstdio" in
15951 $define)
15952         $cat >try.c <<EOP
15953 #include <stdio.h>
15954 #define FILE_base(fp)   $stdio_base
15955 #define FILE_bufsiz(fp) $stdio_bufsiz
15956 int main() {
15957         FILE *fp = fopen("try.c", "r");
15958         char c = getc(fp);
15959         if (
15960                 19 <= FILE_bufsiz(fp) &&
15961                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
15962         )
15963                 exit(0);
15964         exit(1);
15965 }
15966 EOP
15967         set try
15968         if eval $compile && $to try.c; then
15969                 if $run ./try; then
15970                         echo "And its _base field acts std."
15971                         val="$define"
15972                 else
15973                         echo "But its _base field isn't std."
15974                 fi
15975         else
15976                 echo "However, it seems to be lacking the _base field."
15977         fi
15978         $rm -f try.c try
15979         ;;
15980 esac
15981 set d_stdiobase
15982 eval $setvar
15983
15984 $cat >&4 <<EOM
15985 Checking how to access stdio streams by file descriptor number...
15986 EOM
15987 case "$stdio_stream_array" in
15988 '')     $cat >try.c <<EOCP
15989 #include <stdio.h>
15990 int main() {
15991   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
15992     printf("yes\n");
15993 }
15994 EOCP
15995         for s in _iob __iob __sF
15996         do
15997                 set try -DSTDIO_STREAM_ARRAY=$s
15998                 if eval $compile; then
15999                         case "`$run ./try`" in
16000                         yes)    stdio_stream_array=$s; break ;;
16001                         esac
16002                 fi
16003         done
16004         $rm -f try.* try$exe_ext
16005 esac
16006 case "$stdio_stream_array" in
16007 '')     $cat >&4 <<EOM
16008 I can't figure out how to access stdio streams by file descriptor number.
16009 EOM
16010         d_stdio_stream_array="$undef"
16011         ;;
16012 *)      $cat >&4 <<EOM
16013 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16014 EOM
16015         d_stdio_stream_array="$define"
16016         ;;
16017 esac
16018
16019 : see if strcoll exists
16020 set strcoll d_strcoll
16021 eval $inlibc
16022
16023 : check for structure copying
16024 echo " "
16025 echo "Checking to see if your C compiler can copy structs..." >&4
16026 $cat >try.c <<'EOCP'
16027 main()
16028 {
16029         struct blurfl {
16030                 int dyick;
16031         } foo, bar;
16032
16033         foo = bar;
16034 }
16035 EOCP
16036 if $cc -c try.c >/dev/null 2>&1 ; then
16037         val="$define"
16038         echo "Yup, it can."
16039 else
16040         val="$undef"
16041         echo "Nope, it can't."
16042 fi
16043 set d_strctcpy
16044 eval $setvar
16045 $rm -f try.*
16046
16047 : see if strerror and/or sys_errlist[] exist
16048 echo " "
16049 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16050     if set strerror val -f d_strerror; eval $csym; $val; then
16051                 echo 'strerror() found.' >&4
16052                 d_strerror="$define"
16053                 d_strerrm='strerror(e)'
16054                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16055                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
16056                         d_syserrlst="$define"
16057                 else
16058                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16059                         d_syserrlst="$undef"
16060                 fi
16061     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16062                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16063                 echo 'strerror() found in string header.' >&4
16064                 d_strerror="$define"
16065                 d_strerrm='strerror(e)'
16066                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16067                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16068                                 d_syserrlst="$define"
16069                 else
16070                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
16071                         d_syserrlst="$undef"
16072                 fi
16073     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16074                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16075                 d_strerror="$undef"
16076                 d_syserrlst="$define"
16077                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16078     else
16079                 echo 'strerror() and sys_errlist[] NOT found.' >&4
16080                 d_strerror="$undef"
16081                 d_syserrlst="$undef"
16082                 d_strerrm='"unknown"'
16083     fi
16084 fi
16085
16086 : see if strerror_r exists
16087 set strerror_r d_strerror_r
16088 eval $inlibc
16089 case "$d_strerror_r" in
16090 "$define")
16091         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
16092         case "$d_strerror_r_proto:$usethreads" in
16093         ":define")      d_strerror_r_proto=define
16094                 set d_strerror_r_proto strerror_r $hdrs
16095                 eval $hasproto ;;
16096         *)      ;;
16097         esac
16098         case "$d_strerror_r_proto" in
16099         define)
16100         case "$strerror_r_proto" in
16101         ''|0) try='int strerror_r(int, char*, size_t);'
16102         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
16103         esac
16104         case "$strerror_r_proto" in
16105         ''|0) try='int strerror_r(int, char*, int);'
16106         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
16107         esac
16108         case "$strerror_r_proto" in
16109         ''|0) try='char* strerror_r(int, char*, size_t);'
16110         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
16111         esac
16112         case "$strerror_r_proto" in
16113         ''|0)   d_strerror_r=undef
16114                 strerror_r_proto=0
16115                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
16116         * )     case "$strerror_r_proto" in
16117                 REENTRANT_PROTO*) ;;
16118                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
16119                 esac
16120                 echo "Prototype: $try" ;;
16121         esac
16122         ;;
16123         *)      case "$usethreads" in
16124                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
16125                 esac
16126                 d_strerror_r=undef
16127                 strerror_r_proto=0
16128                 ;;
16129         esac
16130         ;;
16131 *)      strerror_r_proto=0
16132         ;;
16133 esac
16134
16135 : see if strftime exists
16136 set strftime d_strftime
16137 eval $inlibc
16138
16139 : see if strtod exists
16140 set strtod d_strtod
16141 eval $inlibc
16142
16143 : see if strtol exists
16144 set strtol d_strtol
16145 eval $inlibc
16146
16147 : see if strtold exists
16148 set strtold d_strtold
16149 eval $inlibc
16150
16151 : see if strtoll exists
16152 set strtoll d_strtoll
16153 eval $inlibc
16154
16155 case "$d_longlong-$d_strtoll" in
16156 "$define-$define")
16157         $cat <<EOM
16158 Checking whether your strtoll() works okay...
16159 EOM
16160         $cat >try.c <<'EOCP'
16161 #include <errno.h>
16162 #ifdef __hpux
16163 #define strtoll __strtoll
16164 #endif
16165 #ifdef __EMX__
16166 #define strtoll _strtoll
16167 #endif
16168 #include <stdio.h>
16169 extern long long int strtoll(char *s, char **, int); 
16170 static int bad = 0;
16171 int check(char *s, long long ell, int een) {
16172         long long gll;
16173         errno = 0;
16174         gll = strtoll(s, 0, 10);
16175         if (!((gll == ell) && (errno == een)))
16176                 bad++;
16177 }
16178 int main() {
16179         check(" 1",                                      1LL, 0);
16180         check(" 0",                                      0LL, 0);
16181         check("-1",                                     -1LL, 0);
16182         check("-9223372036854775808", -9223372036854775808LL, 0);
16183         check("-9223372036854775808", -9223372036854775808LL, 0);
16184         check(" 9223372036854775807",  9223372036854775807LL, 0);
16185         check("-9223372036854775808", -9223372036854775808LL, 0);
16186         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
16187         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
16188         if (!bad)
16189                 printf("ok\n");
16190 }
16191 EOCP
16192         set try
16193         if eval $compile; then
16194                 yyy=`$run ./try`
16195                 case "$yyy" in
16196                 ok) echo "Your strtoll() seems to be working okay." ;;
16197                 *) cat <<EOM >&4
16198 Your strtoll() doesn't seem to be working okay.
16199 EOM
16200                    d_strtoll="$undef"
16201                    ;;
16202                 esac
16203         else
16204                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16205                 d_strtoll="$undef"
16206         fi
16207         ;;
16208 esac
16209
16210 : see if strtoq exists
16211 set strtoq d_strtoq
16212 eval $inlibc
16213
16214 : see if strtoul exists
16215 set strtoul d_strtoul
16216 eval $inlibc
16217
16218 case "$d_strtoul" in
16219 "$define")
16220         $cat <<EOM
16221 Checking whether your strtoul() works okay...
16222 EOM
16223         $cat >try.c <<'EOCP'
16224 #include <errno.h>
16225 #include <stdio.h>
16226 extern unsigned long int strtoul(char *s, char **, int); 
16227 static int bad = 0;
16228 void check(char *s, unsigned long eul, int een) {
16229         unsigned long gul;
16230         errno = 0;
16231         gul = strtoul(s, 0, 10);
16232         if (!((gul == eul) && (errno == een)))
16233                 bad++;
16234 }
16235 int main() {
16236         check(" 1", 1L, 0);
16237         check(" 0", 0L, 0);
16238 EOCP
16239         case "$longsize" in
16240         8)
16241             $cat >>try.c <<'EOCP'
16242         check("18446744073709551615", 18446744073709551615UL, 0);
16243         check("18446744073709551616", 18446744073709551615UL, ERANGE);
16244 #if 0 /* strtoul() for /^-/ strings is undefined. */
16245         check("-1", 18446744073709551615UL, 0);
16246         check("-18446744073709551614", 2, 0);
16247         check("-18446744073709551615", 1, 0);
16248         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
16249         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
16250 #endif
16251 EOCP
16252                 ;;
16253         4)
16254                     $cat >>try.c <<'EOCP'
16255         check("4294967295", 4294967295UL, 0);
16256         check("4294967296", 4294967295UL, ERANGE);
16257 #if 0 /* strtoul() for /^-/ strings is undefined. */
16258         check("-1", 4294967295UL, 0);
16259         check("-4294967294", 2, 0);
16260         check("-4294967295", 1, 0);
16261         check("-4294967296", 4294967295UL, ERANGE);
16262         check("-4294967297", 4294967295UL, ERANGE);
16263 #endif
16264 EOCP
16265                 ;;
16266         *)
16267 : Should we write these tests to be more portable by sprintf-ing
16268 : ~0 and then manipulating that char string as input for strtol?
16269                 ;;
16270         esac
16271         $cat >>try.c <<'EOCP'
16272         if (!bad)
16273                 printf("ok\n");
16274         return 0;
16275 }
16276 EOCP
16277         set try
16278         if eval $compile; then
16279                 case "`$run ./try`" in
16280                 ok) echo "Your strtoul() seems to be working okay." ;;
16281                 *) cat <<EOM >&4
16282 Your strtoul() doesn't seem to be working okay.
16283 EOM
16284                    d_strtoul="$undef"
16285                    ;;
16286                 esac
16287         fi
16288         ;;
16289 esac
16290
16291 : see if strtoull exists
16292 set strtoull d_strtoull
16293 eval $inlibc
16294
16295 case "$d_longlong-$d_strtoull" in
16296 "$define-$define")
16297         $cat <<EOM
16298 Checking whether your strtoull() works okay...
16299 EOM
16300         $cat >try.c <<'EOCP'
16301 #include <errno.h>
16302 #ifdef __hpux
16303 #define strtoull __strtoull
16304 #endif
16305 #include <stdio.h>
16306 extern unsigned long long int strtoull(char *s, char **, int); 
16307 static int bad = 0;
16308 int check(char *s, long long eull, int een) {
16309         long long gull;
16310         errno = 0;
16311         gull = strtoull(s, 0, 10);
16312         if (!((gull == eull) && (errno == een)))
16313                 bad++;
16314 }
16315 int main() {
16316         check(" 1",                                        1LL, 0);
16317         check(" 0",                                        0LL, 0);
16318         check("18446744073709551615",  18446744073709551615ULL, 0);
16319         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
16320 #if 0 /* strtoull() for /^-/ strings is undefined. */
16321         check("-1",                    18446744073709551615ULL, 0);
16322         check("-18446744073709551614",                     2LL, 0);
16323         check("-18446744073709551615",                     1LL, 0);
16324         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16325         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
16326 #endif
16327         if (!bad)
16328                 printf("ok\n");
16329 }
16330 EOCP
16331         set try
16332         if eval $compile; then
16333                 case "`$run ./try`" in
16334                 ok) echo "Your strtoull() seems to be working okay." ;;
16335                 *) cat <<EOM >&4
16336 Your strtoull() doesn't seem to be working okay.
16337 EOM
16338                    d_strtoull="$undef"
16339                    ;;
16340                 esac
16341         fi
16342         ;;
16343 esac
16344
16345 : see if strtouq exists
16346 set strtouq d_strtouq
16347 eval $inlibc
16348
16349 case "$d_strtouq" in
16350 "$define")
16351         $cat <<EOM
16352 Checking whether your strtouq() works okay...
16353 EOM
16354         $cat >try.c <<'EOCP'
16355 #include <errno.h>
16356 #include <stdio.h>
16357 extern unsigned long long int strtouq(char *s, char **, int); 
16358 static int bad = 0;
16359 void check(char *s, unsigned long long eull, int een) {
16360         unsigned long long gull;
16361         errno = 0;
16362         gull = strtouq(s, 0, 10);
16363         if (!((gull == eull) && (errno == een)))
16364                 bad++;
16365 }
16366 int main() {
16367         check(" 1",                                        1LL, 0);
16368         check(" 0",                                        0LL, 0);
16369         check("18446744073709551615",  18446744073709551615ULL, 0);
16370         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
16371 #if 0 /* strtouq() for /^-/ strings is undefined. */
16372         check("-1",                    18446744073709551615ULL, 0);
16373         check("-18446744073709551614",                     2LL, 0);
16374         check("-18446744073709551615",                     1LL, 0);
16375         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16376         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
16377 #endif
16378         if (!bad)
16379                 printf("ok\n");
16380         return 0;
16381 }
16382 EOCP
16383         set try
16384         if eval $compile; then
16385                 case "`$run ./try`" in
16386                 ok) echo "Your strtouq() seems to be working okay." ;;
16387                 *) cat <<EOM >&4
16388 Your strtouq() doesn't seem to be working okay.
16389 EOM
16390                    d_strtouq="$undef"
16391                    ;;
16392                 esac
16393         fi
16394         ;;
16395 esac
16396
16397 : see if strxfrm exists
16398 set strxfrm d_strxfrm
16399 eval $inlibc
16400
16401 : see if symlink exists
16402 set symlink d_symlink
16403 eval $inlibc
16404
16405 : see if syscall exists
16406 set syscall d_syscall
16407 eval $inlibc
16408
16409 : see if prototype for syscall is available
16410 echo " "
16411 set d_syscallproto syscall $i_unistd unistd.h
16412 eval $hasproto
16413
16414 : see if sysconf exists
16415 set sysconf d_sysconf
16416 eval $inlibc
16417
16418 : see if system exists
16419 set system d_system
16420 eval $inlibc
16421
16422 : see if tcgetpgrp exists
16423 set tcgetpgrp d_tcgetpgrp
16424 eval $inlibc
16425
16426 : see if tcsetpgrp exists
16427 set tcsetpgrp d_tcsetpgrp
16428 eval $inlibc
16429
16430 : see if prototype for telldir is available
16431 echo " "
16432 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
16433 eval $hasproto
16434
16435 : see if time exists
16436 echo " "
16437 if test "X$d_time" = X -o X"$timetype" = X; then
16438     if set time val -f d_time; eval $csym; $val; then
16439                 echo 'time() found.' >&4
16440                 val="$define"
16441                 rp="What is the type returned by time() on this system?"
16442                 set time_t timetype long stdio.h sys/types.h
16443                 eval $typedef_ask
16444     else
16445                 echo 'time() not found, hope that will do.' >&4
16446                 val="$undef"
16447                 timetype='int';
16448     fi
16449     set d_time
16450     eval $setvar
16451 fi
16452
16453 : see if this is a sys/times.h system
16454 set sys/times.h i_systimes
16455 eval $inhdr
16456
16457 : see if times exists
16458 echo " "
16459 if set times val -f d_times; eval $csym; $val; then
16460         echo 'times() found.' >&4
16461         d_times="$define"
16462         inc=''
16463         case "$i_systimes" in
16464         "$define") inc='sys/times.h';;
16465         esac
16466         rp="What is the type returned by times() on this system?"
16467         set clock_t clocktype long stdio.h sys/types.h $inc
16468         eval $typedef_ask
16469 else
16470         echo 'times() NOT found, hope that will do.' >&4
16471         d_times="$undef"
16472         clocktype='int'
16473 fi
16474
16475 : see if tmpnam_r exists
16476 set tmpnam_r d_tmpnam_r
16477 eval $inlibc
16478 case "$d_tmpnam_r" in
16479 "$define")
16480         hdrs="$i_systypes sys/types.h define stdio.h "
16481         case "$d_tmpnam_r_proto:$usethreads" in
16482         ":define")      d_tmpnam_r_proto=define
16483                 set d_tmpnam_r_proto tmpnam_r $hdrs
16484                 eval $hasproto ;;
16485         *)      ;;
16486         esac
16487         case "$d_tmpnam_r_proto" in
16488         define)
16489         case "$tmpnam_r_proto" in
16490         ''|0) try='char* tmpnam_r(char*);'
16491         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
16492         esac
16493         case "$tmpnam_r_proto" in
16494         ''|0)   d_tmpnam_r=undef
16495                 tmpnam_r_proto=0
16496                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
16497         * )     case "$tmpnam_r_proto" in
16498                 REENTRANT_PROTO*) ;;
16499                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
16500                 esac
16501                 echo "Prototype: $try" ;;
16502         esac
16503         ;;
16504         *)      case "$usethreads" in
16505                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
16506                 esac
16507                 d_tmpnam_r=undef
16508                 tmpnam_r_proto=0
16509                 ;;
16510         esac
16511         ;;
16512 *)      tmpnam_r_proto=0
16513         ;;
16514 esac
16515
16516 : see if truncate exists
16517 set truncate d_truncate
16518 eval $inlibc
16519
16520 : see if ttyname_r exists
16521 set ttyname_r d_ttyname_r
16522 eval $inlibc
16523 case "$d_ttyname_r" in
16524 "$define")
16525         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
16526         case "$d_ttyname_r_proto:$usethreads" in
16527         ":define")      d_ttyname_r_proto=define
16528                 set d_ttyname_r_proto ttyname_r $hdrs
16529                 eval $hasproto ;;
16530         *)      ;;
16531         esac
16532         case "$d_ttyname_r_proto" in
16533         define)
16534         case "$ttyname_r_proto" in
16535         ''|0) try='int ttyname_r(int, char*, size_t);'
16536         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
16537         esac
16538         case "$ttyname_r_proto" in
16539         ''|0) try='int ttyname_r(int, char*, int);'
16540         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
16541         esac
16542         case "$ttyname_r_proto" in
16543         ''|0) try='char* ttyname_r(int, char*, int);'
16544         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
16545         esac
16546         case "$ttyname_r_proto" in
16547         ''|0)   d_ttyname_r=undef
16548                 ttyname_r_proto=0
16549                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
16550         * )     case "$ttyname_r_proto" in
16551                 REENTRANT_PROTO*) ;;
16552                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
16553                 esac
16554                 echo "Prototype: $try" ;;
16555         esac
16556         ;;
16557         *)      case "$usethreads" in
16558                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
16559                 esac
16560                 d_ttyname_r=undef
16561                 ttyname_r_proto=0
16562                 ;;
16563         esac
16564         ;;
16565 *)      ttyname_r_proto=0
16566         ;;
16567 esac
16568
16569 : see if tzname[] exists
16570 echo " "
16571 if set tzname val -a d_tzname; eval $csym; $val; then
16572         val="$define"
16573         echo 'tzname[] found.' >&4
16574 else
16575         val="$undef"
16576         echo 'tzname[] NOT found.' >&4
16577 fi
16578 set d_tzname
16579 eval $setvar
16580
16581 case "$osname" in
16582 next|rhapsody|darwin) multiarch="$define" ;;
16583 esac
16584 case "$multiarch" in
16585 ''|[nN]*) multiarch="$undef" ;;
16586 esac
16587
16588 : check for ordering of bytes in a UV
16589 echo " "
16590 case "$usecrosscompile$multiarch" in
16591 *$define*)
16592         $cat <<EOM
16593 You seem to be either cross-compiling or doing a multiarchitecture build,
16594 skipping the byteorder check.
16595
16596 EOM
16597         byteorder='ffff'
16598         ;;
16599 *)
16600         case "$byteorder" in
16601         '')
16602                 $cat <<'EOM'
16603 In the following, larger digits indicate more significance.  A big-endian
16604 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
16605 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
16606 machines may have weird orders like 3412.  A Cray will report 87654321,
16607 an Alpha will report 12345678. If the test program works the default is
16608 probably right.
16609 I'm now running the test program...
16610 EOM
16611                 $cat >try.c <<EOCP
16612 #include <stdio.h>
16613 #include <sys/types.h>
16614 typedef $uvtype UV;
16615 int main()
16616 {
16617         int i;
16618         union {
16619                 UV l;
16620                 char c[$uvsize];
16621         } u;
16622
16623         if ($uvsize > 4)
16624                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
16625         else
16626                 u.l = (UV)0x04030201;
16627         for (i = 0; i < $uvsize; i++)
16628                 printf("%c", u.c[i]+'0');
16629         printf("\n");
16630         exit(0);
16631 }
16632 EOCP
16633                 xxx_prompt=y
16634                 set try
16635                 if eval $compile && ./try > /dev/null; then
16636                         dflt=`$run ./try`
16637                         case "$dflt" in
16638                         [1-4][1-4][1-4][1-4]|12345678|87654321)
16639                                 echo "(The test program ran ok.)"
16640                                 echo "byteorder=$dflt"
16641                                 xxx_prompt=n
16642                         ;;
16643                         ????|????????) echo "(The test program ran ok.)" ;;
16644                         *) echo "(The test program didn't run right for some reason.)" ;;
16645                         esac
16646                 else
16647                         dflt='4321'
16648                         cat <<'EOM'
16649 (I can't seem to compile the test program.  Guessing big-endian...)
16650 EOM
16651                 fi
16652                 case "$xxx_prompt" in
16653                 y)
16654                         rp="What is the order of bytes in $uvtype?"
16655                         . ./myread
16656                         byteorder="$ans"
16657                         ;;
16658                 *)      byteorder=$dflt
16659                         ;;
16660                 esac
16661                 ;;
16662         esac
16663         $rm -f try.c try
16664         ;;
16665 esac
16666
16667
16668 $cat <<EOM
16669
16670 Checking to see whether you can access character data unalignedly...
16671 EOM
16672 case "$d_u32align" in
16673 '')   $cat >try.c <<EOCP
16674 #include <stdio.h>
16675 #define U32 $u32type
16676 #define BYTEORDER 0x$byteorder
16677 #define U8 $u8type
16678 #include <signal.h>
16679 #ifdef SIGBUS
16680 $signal_t bletch(s) int s; { exit(4); }
16681 #endif
16682 int main() {
16683 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
16684     U8 buf[8];
16685     U32 *up;
16686     int i;
16687
16688     if (sizeof(U32) != 4) {
16689         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
16690         exit(1);
16691     }
16692
16693     fflush(stdout);
16694
16695 #ifdef SIGBUS
16696     signal(SIGBUS, bletch);
16697 #endif
16698
16699     buf[0] = 0;
16700     buf[1] = 0;
16701     buf[2] = 0;
16702     buf[3] = 1;
16703     buf[5] = 0;
16704     buf[6] = 0;
16705     buf[7] = 0;
16706     buf[8] = 1;
16707
16708     for (i = 0; i < 4; i++) {
16709         up = (U32*)(buf + i);
16710         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
16711                (*up == 1 << (8*(3-i)))  /* little-endian */
16712               )
16713            )
16714         {
16715             printf("read failed (%x)\n", *up);
16716             exit(2);
16717         }
16718     }
16719
16720     /* write test */
16721     for (i = 0; i < 4; i++) {
16722         up = (U32*)(buf + i);
16723         *up = 0xBeef;
16724         if (*up != 0xBeef) {
16725             printf("write failed (%x)\n", *up);
16726             exit(3);
16727         }
16728     }
16729
16730     exit(0);
16731 #else
16732     printf("1\n");
16733     exit(1);
16734 #endif
16735     return 0;
16736 }
16737 EOCP
16738 set try
16739 if eval $compile_ok; then
16740         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
16741         $run ./try 2>&1 >/dev/null
16742         case "$?" in
16743         0)      cat >&4 <<EOM
16744 You can access character data pretty unalignedly.
16745 EOM
16746                 d_u32align="$undef"
16747                 ;;
16748         *)      cat >&4 <<EOM
16749 It seems that you must access character data in an aligned manner.
16750 EOM
16751                 d_u32align="$define"
16752                 ;;
16753         esac
16754 else
16755         rp='Can you access character data at unaligned addresses?'
16756         dflt='n'
16757         . ./myread
16758         case "$ans" in
16759         [yY]*)  d_u32align="$undef"  ;;
16760         *)      d_u32align="$define" ;;
16761         esac
16762 fi
16763 $rm -f core core.try.* try.core
16764 ;;
16765 esac
16766
16767 : see if ualarm exists
16768 set ualarm d_ualarm
16769 eval $inlibc
16770
16771 : see if umask exists
16772 set umask d_umask
16773 eval $inlibc
16774
16775 : see if unordered exists
16776 set unordered d_unordered
16777 eval $inlibc
16778
16779 : see if usleep exists
16780 set usleep d_usleep
16781 eval $inlibc
16782
16783 : see if prototype for usleep is available
16784 echo " "
16785 set d_usleepproto usleep $i_unistd unistd.h
16786 eval $hasproto
16787
16788 : see if ustat exists
16789 set ustat d_ustat
16790 eval $inlibc
16791
16792 : backward compatibility for d_hvfork
16793 if test X$d_hvfork != X; then
16794         d_vfork="$d_hvfork"
16795         d_hvfork=''
16796 fi
16797 : see if there is a vfork
16798 val=''
16799 set vfork val
16800 eval $inlibc
16801
16802 : Ok, but do we want to use it. vfork is reportedly unreliable in 
16803 : perl on Solaris 2.x, and probably elsewhere.
16804 case "$val" in
16805 $define)
16806         echo " "
16807         case "$usevfork" in
16808         false) dflt='n';;
16809         *) dflt='y';;
16810         esac
16811         cat <<'EOM'
16812  
16813 Perl can only use a vfork() that doesn't suffer from strict
16814 restrictions on calling functions or modifying global data in
16815 the child.  For example, glibc-2.1 contains such a vfork()
16816 that is unsuitable.  If your system provides a proper fork()
16817 call, chances are that you do NOT want perl to use vfork().
16818
16819 EOM
16820         rp="Do you still want to use vfork()?"
16821         . ./myread
16822         case "$ans" in
16823         y|Y) ;;
16824         *)
16825                 echo "Ok, we won't use vfork()."
16826                 val="$undef"
16827                 ;;
16828         esac
16829         ;;
16830 esac
16831 set d_vfork
16832 eval $setvar
16833 case "$d_vfork" in
16834 $define) usevfork='true';;
16835 *) usevfork='false';;
16836 esac
16837
16838 : see if closedir exists
16839 set closedir d_closedir
16840 eval $inlibc
16841
16842 case "$d_closedir" in
16843 "$define")
16844         echo " "
16845         echo "Checking whether closedir() returns a status..." >&4
16846         cat > try.c <<EOM
16847 #$i_dirent I_DIRENT             /**/
16848 #$i_sysdir I_SYS_DIR            /**/
16849 #$i_sysndir I_SYS_NDIR          /**/
16850 #$i_systypes I_SYS_TYPES        /**/
16851
16852 #if defined(I_SYS_TYPES)
16853 #include <sys/types.h>
16854 #endif
16855 #if defined(I_DIRENT)
16856 #include <dirent.h>
16857 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
16858 #include <sys/dir.h>
16859 #endif
16860 #else
16861 #ifdef I_SYS_NDIR
16862 #include <sys/ndir.h>
16863 #else
16864 #ifdef I_SYS_DIR
16865 #ifdef hp9000s500
16866 #include <ndir.h>       /* may be wrong in the future */
16867 #else
16868 #include <sys/dir.h>
16869 #endif
16870 #endif
16871 #endif
16872 #endif 
16873 int main() { return closedir(opendir(".")); }
16874 EOM
16875         set try
16876         if eval $compile_ok; then
16877                 if $run ./try > /dev/null 2>&1 ; then
16878                         echo "Yes, it does."
16879                         val="$undef"
16880                 else
16881                         echo "No, it doesn't."
16882                         val="$define"
16883                 fi
16884         else
16885                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16886                 val="$define"
16887         fi
16888         ;;
16889 *)
16890         val="$undef";
16891         ;;
16892 esac
16893 set d_void_closedir
16894 eval $setvar
16895 $rm -f try try.*
16896 : see if there is a wait4
16897 set wait4 d_wait4
16898 eval $inlibc
16899
16900 : see if waitpid exists
16901 set waitpid d_waitpid
16902 eval $inlibc
16903
16904 : see if wcstombs exists
16905 set wcstombs d_wcstombs
16906 eval $inlibc
16907
16908 : see if wctomb exists
16909 set wctomb d_wctomb
16910 eval $inlibc
16911
16912 : see if writev exists
16913 set writev d_writev
16914 eval $inlibc
16915
16916 : preserve RCS keywords in files with variable substitution, grrr
16917 Date='$Date'
16918 Id='$Id'
16919 Log='$Log'
16920 RCSfile='$RCSfile'
16921 Revision='$Revision'
16922
16923 : check for alignment requirements
16924 echo " "
16925 case "$usecrosscompile$multiarch" in
16926 *$define*)
16927         $cat <<EOM
16928 You seem to be either cross-compiling or doing a multiarchitecture build,
16929 skipping the memory alignment check.
16930
16931 EOM
16932         case "$alignbytes" in
16933         '') alignbytes=8 ;;
16934         esac
16935         ;;
16936 *)
16937         case "$alignbytes" in
16938         '') echo "Checking alignment constraints..." >&4
16939                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
16940                         $cat >try.c <<'EOCP'
16941 typedef long double NV;
16942 EOCP
16943                 else
16944                         $cat >try.c <<'EOCP'
16945 typedef double NV;
16946 EOCP
16947                 fi
16948                 $cat >>try.c <<'EOCP'
16949 #include <stdio.h>
16950 struct foobar {
16951         char foo;
16952         NV bar;
16953 } try_algn;
16954 int main()
16955 {
16956     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
16957     return(0);
16958 }
16959 EOCP
16960                 set try
16961                 if eval $compile_ok; then
16962                         dflt=`$run ./try`
16963                 else
16964                         dflt='8'
16965                         echo "(I can't seem to compile the test program...)"
16966                 fi
16967                 ;;
16968         *) dflt="$alignbytes"
16969                 ;;
16970         esac
16971         rp="Doubles must be aligned on a how-many-byte boundary?"
16972         . ./myread
16973         alignbytes="$ans"
16974         $rm -f try.c try
16975         ;;
16976 esac
16977
16978
16979 : set the base revision
16980 baserev=5.0
16981
16982 : how do we catenate cpp tokens here?
16983 echo " "
16984 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
16985 $cat >cpp_stuff.c <<'EOCP'
16986 #define RCAT(a,b)a/**/b
16987 #define ACAT(a,b)a ## b
16988 RCAT(Rei,ser)
16989 ACAT(Cir,cus)
16990 EOCP
16991 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
16992 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
16993         echo "Oh!  Smells like ANSI's been here." >&4
16994         echo "We can catify or stringify, separately or together!"
16995         cpp_stuff=42
16996 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
16997         echo "Ah, yes!  The good old days!" >&4
16998         echo "However, in the good old days we don't know how to stringify and"
16999         echo "catify at the same time."
17000         cpp_stuff=1
17001 else
17002         $cat >&4 <<EOM
17003 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
17004 to have to edit the values of CAT[2-5] in config.h...
17005 EOM
17006         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17007 fi
17008 $rm -f cpp_stuff.*
17009
17010 : see if this is a db.h system
17011 set db.h i_db
17012 eval $inhdr
17013
17014 case "$i_db" in
17015 $define)
17016         : Check db version.
17017         echo " "
17018         echo "Checking Berkeley DB version ..." >&4
17019         $cat >try.c <<EOCP
17020 #$d_const HASCONST
17021 #ifndef HASCONST
17022 #define const
17023 #endif
17024 #include <sys/types.h>
17025 #include <stdio.h>
17026 #include <db.h>
17027 int main(int argc, char *argv[])
17028 {
17029 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17030     int Major, Minor, Patch ;
17031     unsigned long Version ;
17032     (void)db_version(&Major, &Minor, &Patch) ;
17033     if (argc == 2) {
17034         printf("%d %d %d %d %d %d\n",
17035                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17036                Major, Minor, Patch);
17037         exit(0);
17038     }
17039     printf("You have Berkeley DB Version 2 or greater.\n");
17040
17041     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17042                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17043     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17044                 Major, Minor, Patch) ;
17045
17046     /* check that db.h & libdb are compatible */
17047     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
17048         printf("db.h and libdb are incompatible.\n") ;
17049         exit(3);        
17050     }
17051
17052     printf("db.h and libdb are compatible.\n") ;
17053
17054     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17055                 + DB_VERSION_PATCH ;
17056
17057     /* needs to be >= 2.3.4 */
17058     if (Version < 2003004) {
17059     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
17060         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
17061         exit(2);        
17062     }
17063
17064     exit(0);
17065 #else
17066 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
17067     if (argc == 2) {
17068         printf("1 0 0\n");
17069         exit(0);
17070     }
17071     printf("You have Berkeley DB Version 1.\n");
17072     exit(0);    /* DB version < 2: the coast is clear. */
17073 #else
17074     exit(1);    /* <db.h> not Berkeley DB? */
17075 #endif
17076 #endif
17077 }
17078 EOCP
17079         set try
17080         if eval $compile_ok && $run ./try; then
17081                 echo 'Looks OK.' >&4
17082                 set `$run ./try 1`
17083                 db_version_major=$1
17084                 db_version_minor=$2
17085                 db_version_patch=$3
17086         else
17087                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
17088                 i_db=$undef
17089                 case " $libs " in
17090                 *"-ldb "*)
17091                         : Remove db from list of libraries to use
17092                         echo "Removing unusable -ldb from library list" >&4
17093                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
17094                         shift
17095                         libs="$*"
17096                         echo "libs = $libs" >&4
17097                         ;;
17098                 esac
17099         fi
17100         $rm -f try.*
17101         ;;
17102 esac
17103
17104 case "$i_db" in
17105 define)
17106         : Check the return type needed for hash 
17107         echo " "
17108         echo "Checking return type needed for hash for Berkeley DB ..." >&4
17109         $cat >try.c <<EOCP
17110 #$d_const HASCONST
17111 #ifndef HASCONST
17112 #define const
17113 #endif
17114 #include <sys/types.h>
17115 #include <db.h>
17116
17117 #ifndef DB_VERSION_MAJOR
17118 u_int32_t hash_cb (ptr, size)
17119 const void *ptr;
17120 size_t size;
17121 {
17122 }
17123 HASHINFO info;
17124 int main()
17125 {
17126         info.hash = hash_cb;
17127 }
17128 #endif
17129 EOCP
17130         if $cc $ccflags -c try.c >try.out 2>&1 ; then
17131                 if $contains warning try.out >>/dev/null 2>&1 ; then
17132                         db_hashtype='int'
17133                 else
17134                         db_hashtype='u_int32_t'
17135                 fi
17136         else
17137                 : XXX Maybe we should just give up here.
17138                 db_hashtype=u_int32_t
17139                 $cat try.out >&4
17140                 echo "Help:  I can't seem to compile the db test program." >&4
17141                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
17142         fi
17143         $rm -f try.*
17144         echo "Your version of Berkeley DB uses $db_hashtype for hash."
17145         ;;
17146 *)      db_hashtype=u_int32_t
17147         ;;
17148 esac
17149 case "$i_db" in
17150 define)
17151         : Check the return type needed for prefix 
17152         echo " "
17153         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
17154         cat >try.c <<EOCP
17155 #$d_const HASCONST
17156 #ifndef HASCONST
17157 #define const
17158 #endif
17159 #include <sys/types.h>
17160 #include <db.h>
17161
17162 #ifndef DB_VERSION_MAJOR
17163 size_t prefix_cb (key1, key2)
17164 const DBT *key1;
17165 const DBT *key2;
17166 {
17167 }
17168 BTREEINFO info;
17169 int main()
17170 {
17171         info.prefix = prefix_cb;
17172 }
17173 #endif
17174 EOCP
17175         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
17176                 if $contains warning try.out >>/dev/null 2>&1 ; then
17177                         db_prefixtype='int'
17178                 else
17179                         db_prefixtype='size_t'
17180                 fi
17181         else
17182                 db_prefixtype='size_t'
17183                 : XXX Maybe we should just give up here.
17184                 $cat try.out >&4
17185                 echo "Help:  I can't seem to compile the db test program." >&4
17186                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
17187         fi
17188         $rm -f try.*
17189         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
17190         ;;
17191 *)      db_prefixtype='size_t'
17192         ;;
17193 esac
17194
17195
17196 : How can we generate normalized random numbers ?
17197 echo " "
17198 echo "Looking for a random number function..." >&4
17199 case "$randfunc" in
17200 '')
17201         if set drand48 val -f; eval $csym; $val; then
17202                 dflt="drand48"
17203                 echo "Good, found drand48()." >&4
17204         elif set random val -f; eval $csym; $val; then
17205                 dflt="random"
17206                 echo "OK, found random()." >&4
17207         else
17208                 dflt="rand"
17209                 echo "Yick, looks like I have to use rand()." >&4
17210         fi
17211         echo " "
17212         ;;
17213 *)
17214         dflt="$randfunc"
17215         ;;
17216 esac
17217 cont=true
17218
17219 case "$ccflags" in
17220 *-Dmy_rand=*|*-Dmy_srand=*)
17221         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
17222         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
17223         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
17224         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
17225         ;;
17226 esac
17227
17228 while $test "$cont"; do
17229         rp="Use which function to generate random numbers?"
17230         . ./myread
17231         if $test "$ans" = "$dflt"; then
17232                 : null
17233         else
17234                 randbits=''
17235         fi
17236         randfunc="$ans"
17237         if set $ans val -f; eval $csym; $val; then
17238                 cont=''
17239         else
17240                 dflt=y
17241                 rp="I cannot find function $ans. Use that name anyway?"
17242                 . ./myread
17243                 dflt=rand
17244                 case "$ans" in
17245                         [yY]*) cont='';;
17246                 esac
17247         fi
17248         case "$cont" in
17249         '')
17250                 case "$randfunc" in
17251                 drand48)
17252                         drand01="drand48()"
17253                         seedfunc="srand48"
17254                         randbits=48
17255                         randseedtype=long
17256                         ;;
17257                 rand|random)
17258                         case "$randbits" in
17259                         '')
17260 echo "Checking to see how many bits your $randfunc() function produces..." >&4
17261                                 $cat >try.c <<EOCP
17262 #$i_unistd I_UNISTD
17263 #$i_stdlib I_STDLIB
17264 #include <stdio.h>
17265 #ifdef I_UNISTD
17266 #  include <unistd.h>
17267 #endif
17268 #ifdef I_STDLIB
17269 #  include <stdlib.h>
17270 #endif
17271 int main()
17272 {
17273         register int i;
17274         register unsigned long tmp;
17275         register unsigned long max = 0L;
17276
17277         for (i = 1000; i; i--) {
17278                 tmp = (unsigned long) $randfunc();
17279                 if (tmp > max) max = tmp;
17280         }
17281         for (i = 0; max; i++)
17282                 max /= 2;
17283         printf("%d\n",i);
17284 }
17285 EOCP
17286                                 set try
17287                                 if eval $compile_ok; then
17288                                         dflt=`try`
17289                                 else
17290                                         dflt='?'
17291                                         echo "(I can't seem to compile the test program...)"
17292                                 fi
17293                                 ;;
17294                         *)
17295                                 dflt="$randbits"
17296                                 ;;
17297                         esac
17298                         rp="How many bits does your $randfunc() function produce?"
17299                         . ./myread
17300                         randbits="$ans"
17301                         $rm -f try.c try
17302                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17303                         seedfunc="s$randfunc"
17304                         randseedtype=unsigned
17305                         ;;
17306                 *)
17307                         dflt="31"
17308                         rp="How many bits does your $randfunc() function produce?"
17309                         . ./myread
17310                         randbits="$ans"
17311                         seedfunc="s$randfunc"
17312                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17313                         if set $seedfunc val -f; eval $csym; $val; then
17314                                 echo "(Using $seedfunc() to seed random generator)"
17315                         else
17316                                 echo "(Warning: no $seedfunc() to seed random generator)"
17317                                 seedfunc=rand
17318                         fi
17319                         randseedtype=unsigned
17320                         ;;
17321                 esac
17322                 ;;
17323         esac
17324 done
17325
17326 echo " "
17327 echo "Determining whether or not we are on an EBCDIC system..." >&4
17328 $cat >try.c <<'EOM'
17329 int main()
17330 {
17331   if ('M'==0xd4) return 0;
17332   return 1;
17333 }
17334 EOM
17335
17336 val=$undef
17337 set try
17338 if eval $compile_ok; then
17339         if $run ./try; then
17340                 echo "You seem to speak EBCDIC." >&4
17341                 val="$define"
17342         else
17343                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
17344         fi
17345 else
17346         echo "I'm unable to compile the test program." >&4
17347         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
17348 fi
17349 $rm -f try try.*
17350 set ebcdic
17351 eval $setvar
17352
17353 echo " "
17354 $cat >&4 <<EOM
17355 Checking how to flush all pending stdio output...
17356 EOM
17357 # I only know how to find the first 32 possibly open files on SunOS.
17358 # See also hints/sunos_4_1.sh and util.c  --AD
17359 case "$osname" in
17360 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
17361 esac
17362 $cat >>try.c <<EOCP
17363 #include <stdio.h>
17364 #$i_unistd I_UNISTD
17365 #ifdef I_UNISTD
17366 # include <unistd.h>
17367 #endif
17368 #$d_sysconf HAS_SYSCONF
17369 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
17370 #ifdef HAS_STDIO_STREAM_ARRAY
17371 # define STDIO_STREAM_ARRAY $stdio_stream_array
17372 #endif
17373 int main() {
17374   FILE* p;
17375   unlink("try.out");
17376   p = fopen("try.out", "w");
17377 #ifdef TRY_FPUTC
17378   fputc('x', p);
17379 #else
17380 # ifdef TRY_FPRINTF
17381   fprintf(p, "x");
17382 # endif
17383 #endif
17384 #ifdef TRY_FFLUSH_NULL
17385   fflush(NULL);
17386 #endif
17387 #ifdef TRY_FFLUSH_ALL
17388   {
17389     long open_max = -1;
17390 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
17391     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
17392 # else
17393 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
17394     open_max = sysconf(_SC_OPEN_MAX);
17395 #  else
17396 #   ifdef FOPEN_MAX
17397     open_max = FOPEN_MAX;
17398 #   else
17399 #    ifdef OPEN_MAX
17400     open_max = OPEN_MAX;
17401 #    else
17402 #     ifdef _NFILE
17403     open_max = _NFILE;
17404 #     endif
17405 #    endif
17406 #   endif
17407 #  endif
17408 # endif 
17409 # ifdef HAS_STDIO_STREAM_ARRAY
17410     if (open_max > 0) {
17411       long i;
17412       for (i = 0; i < open_max; i++)
17413             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
17414                 STDIO_STREAM_ARRAY[i]._file < open_max &&
17415                 STDIO_STREAM_ARRAY[i]._flag)
17416                 fflush(&STDIO_STREAM_ARRAY[i]);
17417     }   
17418   }
17419 # endif
17420 #endif
17421   _exit(42);
17422 }
17423 EOCP
17424 : first we have to find out how _not_ to flush
17425 $to try.c
17426 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
17427     output=''
17428     set try -DTRY_FPUTC
17429     if eval $compile; then
17430             $run ./try 2>/dev/null
17431             code="$?"
17432             $from try.out
17433             if $test ! -s try.out -a "X$code" = X42; then
17434                 output=-DTRY_FPUTC
17435             fi
17436     fi
17437     case "$output" in
17438     '')
17439             set try -DTRY_FPRINTF
17440             if eval $compile; then
17441                     $run ./try 2>/dev/null
17442                     code="$?"
17443                     $from try.out
17444                     if $test ! -s try.out -a "X$code" = X42; then
17445                         output=-DTRY_FPRINTF
17446                     fi
17447             fi
17448         ;;
17449     esac
17450 fi
17451 : check for fflush NULL behaviour
17452 case "$fflushNULL" in
17453 '')     set try -DTRY_FFLUSH_NULL $output
17454         if eval $compile; then
17455                 $run ./try 2>/dev/null
17456                 code="$?"
17457                 $from try.out
17458                 if $test -s try.out -a "X$code" = X42; then
17459                         fflushNULL="`$cat try.out`"
17460                 else
17461                         if $test "X$code" != X42; then
17462                                 $cat >&4 <<EOM
17463 (If this test failed, don't worry, we'll try another method shortly.)
17464 EOM
17465                         fi
17466                 fi
17467         fi
17468         $rm -f core try.core core.try.*
17469         case "$fflushNULL" in
17470         x)      $cat >&4 <<EOM
17471 Your fflush(NULL) works okay for output streams.
17472 Let's see if it clobbers input pipes...
17473 EOM
17474 # As of mid-March 2000 all versions of Solaris appear to have a stdio
17475 # bug that improperly flushes the input end of pipes.  So we avoid the
17476 # autoflush on fork/system/exec support for now. :-(
17477 $cat >tryp.c <<EOCP
17478 #include <stdio.h>
17479 int
17480 main(int argc, char **argv)
17481 {
17482     char buf[1024];
17483     int i;
17484     char *bp = buf;
17485     while (1) {
17486         while ((i = getc(stdin)) != -1
17487                && (*bp++ = i) != '\n'
17488                && bp < &buf[1024])
17489         /* DO NOTHING */ ;
17490         *bp = '\0';
17491         fprintf(stdout, "%s", buf);
17492         fflush(NULL);
17493         if (i == -1)
17494             return 0;
17495         bp = buf;
17496     }
17497 }
17498 EOCP
17499                 fflushNULL="$define"
17500                 set tryp
17501                 if eval $compile; then
17502                     $rm -f tryp.out
17503                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17504                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
17505                        $cat >&4 <<EOM
17506 fflush(NULL) seems to behave okay with input streams.
17507 EOM
17508                         fflushNULL="$define"
17509                     else
17510                         $cat >&4 <<EOM
17511 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
17512 EOM
17513                         fflushNULL="$undef"
17514                     fi
17515                 fi
17516                 $rm -f core tryp.c tryp.core core.tryp.*
17517                 ;;
17518         '')     $cat >&4 <<EOM
17519 Your fflush(NULL) isn't working (contrary to ANSI C).
17520 EOM
17521                 fflushNULL="$undef"
17522                 ;;
17523         *)      $cat >&4 <<EOM
17524 Cannot figure out whether your fflush(NULL) works or not.
17525 I'm assuming it doesn't (contrary to ANSI C).
17526 EOM
17527                 fflushNULL="$undef"
17528                 ;;
17529         esac
17530         ;;
17531 $define|true|[yY]*)
17532         fflushNULL="$define"
17533         ;;
17534 *)
17535         fflushNULL="$undef"
17536         ;;
17537 esac
17538 : check explicit looping only if NULL did not work, and if the pipe
17539 : bug does not show up on an explicit flush too
17540 case "$fflushNULL" in
17541 "$undef")
17542         $cat >tryp.c <<EOCP
17543 #include <stdio.h>
17544 int
17545 main(int argc, char **argv)
17546 {
17547     char buf[1024];
17548     int i;
17549     char *bp = buf;
17550     while (1) {
17551         while ((i = getc(stdin)) != -1
17552                && (*bp++ = i) != '\n'
17553                && bp < &buf[1024])
17554         /* DO NOTHING */ ;
17555         *bp = '\0';
17556         fprintf(stdout, "%s", buf);
17557         fflush(stdin);
17558         if (i == -1)
17559             return 0;
17560         bp = buf;
17561     }
17562 }
17563 EOCP
17564         set tryp
17565         if eval $compile; then
17566             $rm -f tryp.out
17567             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17568             if cmp tryp.c tryp.out >/dev/null 2>&1; then
17569                $cat >&4 <<EOM
17570 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
17571 EOM
17572                 : now check for fflushall behaviour
17573                 case "$fflushall" in
17574                 '')     set try -DTRY_FFLUSH_ALL $output
17575                         if eval $compile; then
17576                                 $cat >&4 <<EOM
17577 (Now testing the other method--but note that this also may fail.)
17578 EOM
17579                                 $run ./try 2>/dev/null
17580                                 code=$?
17581                                 $from try.out
17582                                 if $test -s try.out -a "X$code" = X42; then
17583                                         fflushall="`$cat try.out`"
17584                                 fi
17585                         fi
17586                         $rm -f core try.core core.try.*
17587                         case "$fflushall" in
17588                         x)      $cat >&4 <<EOM
17589 Whew. Flushing explicitly all the stdio streams works.
17590 EOM
17591                                 fflushall="$define"
17592                                 ;;
17593                         '')     $cat >&4 <<EOM
17594 Sigh. Flushing explicitly all the stdio streams doesn't work.
17595 EOM
17596                                 fflushall="$undef"
17597                                 ;;
17598                         *)      $cat >&4 <<EOM
17599 Cannot figure out whether flushing stdio streams explicitly works or not.
17600 I'm assuming it doesn't.
17601 EOM
17602                                 fflushall="$undef"
17603                                 ;;
17604                         esac
17605                         ;;
17606                 "$define"|true|[yY]*)
17607                         fflushall="$define"
17608                         ;;
17609                 *)
17610                         fflushall="$undef"
17611                         ;;
17612                 esac
17613             else
17614                 $cat >&4 <<EOM
17615 All is futile.  Even fflush(stdin) clobbers input pipes!
17616 EOM
17617                 fflushall="$undef"
17618             fi
17619         else
17620             fflushall="$undef"
17621         fi
17622         $rm -f core tryp.c tryp.core core.tryp.*
17623         ;;
17624 *)      fflushall="$undef"
17625         ;;
17626 esac
17627
17628 case "$fflushNULL$fflushall" in
17629 undefundef)
17630         $cat <<EOM
17631 OK, I give up.  I cannot figure out how to flush pending stdio output.
17632 We won't be flushing handles at all before fork/exec/popen.
17633 EOM
17634         ;;
17635 esac
17636 $rm -f try.* try$exe_ext
17637
17638 : Store the full pathname to the ar program for use in the C program
17639 : Respect a hint or command line value for full_ar.
17640 case "$full_ar" in
17641 '') full_ar=$ar ;;
17642 esac
17643
17644 : Store the full pathname to the sed program for use in the C program
17645 full_sed=$sed
17646
17647 : see what type gids are declared as in the kernel
17648 echo " "
17649 echo "Looking for the type for group ids returned by getgid()."
17650 set gid_t gidtype xxx stdio.h sys/types.h
17651 eval $typedef
17652 case "$gidtype" in
17653 xxx)
17654         xxx=`./findhdr sys/user.h`
17655         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
17656         case $1 in
17657         unsigned) dflt="$1 $2" ;;
17658         *) dflt="$1" ;;
17659         esac
17660         ;;
17661 *) dflt="$gidtype";;
17662 esac
17663 case "$gidtype" in
17664 gid_t) echo "gid_t found." ;;
17665 *)      rp="What is the type for group ids returned by getgid()?"
17666         . ./myread
17667         gidtype="$ans"
17668         ;;
17669 esac
17670
17671 echo " "
17672 case "$gidtype" in
17673 *_t) zzz="$gidtype"     ;;
17674 *)   zzz="gid"          ;;
17675 esac
17676 echo "Checking the size of $zzz..." >&4 
17677 cat > try.c <<EOCP
17678 #include <sys/types.h>
17679 #include <stdio.h>
17680 int main() {
17681     printf("%d\n", (int)sizeof($gidtype));
17682     exit(0);
17683 }
17684 EOCP
17685 set try
17686 if eval $compile_ok; then
17687         yyy=`$run ./try`
17688         case "$yyy" in
17689         '')     gidsize=4
17690                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
17691                 ;;
17692         *)      gidsize=$yyy
17693                 echo "Your $zzz is $gidsize bytes long."
17694                 ;;
17695         esac
17696 else
17697         gidsize=4
17698         echo "(I can't compile the test program--guessing $gidsize.)" >&4
17699 fi
17700
17701
17702 echo " "
17703 case "$gidtype" in
17704 *_t) zzz="$gidtype"     ;;
17705 *)   zzz="gid"          ;;
17706 esac
17707 echo "Checking the sign of $zzz..." >&4 
17708 cat > try.c <<EOCP
17709 #include <sys/types.h>
17710 #include <stdio.h>
17711 int main() {
17712         $gidtype foo = -1;
17713         if (foo < 0)
17714                 printf("-1\n");
17715         else
17716                 printf("1\n");
17717 }
17718 EOCP
17719 set try
17720 if eval $compile; then
17721         yyy=`$run ./try`
17722         case "$yyy" in
17723         '')     gidsign=1
17724                 echo "(I can't execute the test program--guessing unsigned.)" >&4
17725                 ;;
17726         *)      gidsign=$yyy
17727                 case "$gidsign" in
17728                  1) echo "Your $zzz is unsigned." ;;
17729                 -1) echo "Your $zzz is signed."   ;;
17730                 esac
17731                 ;;
17732         esac
17733 else
17734         gidsign=1
17735         echo "(I can't compile the test program--guessing unsigned.)" >&4
17736 fi
17737
17738
17739 echo " "
17740
17741 if $test X"$quadtype" != X; then
17742
17743 echo "Checking how to print 64-bit integers..." >&4
17744
17745 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
17746         $cat >try.c <<'EOCP'
17747 #include <sys/types.h>
17748 #include <stdio.h>
17749 int main() {
17750   int q = 12345678901;
17751   printf("%ld\n", q);
17752 }
17753 EOCP
17754         set try
17755         if eval $compile; then
17756                 yyy=`$run ./try`
17757                 case "$yyy" in
17758                 12345678901)
17759                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
17760                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
17761                         echo "We will use %d."
17762                         ;;
17763                 esac
17764         fi
17765 fi
17766
17767 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
17768         $cat >try.c <<'EOCP'
17769 #include <sys/types.h>
17770 #include <stdio.h>
17771 int main() {
17772   long q = 12345678901;
17773   printf("%ld\n", q);
17774 }
17775 EOCP
17776         set try
17777         if eval $compile; then
17778                 yyy=`$run ./try`
17779                 case "$yyy" in
17780                 12345678901)
17781                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
17782                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
17783                         echo "We will use %ld."
17784                         ;;
17785                 esac
17786         fi
17787 fi
17788
17789 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
17790         $cat >try.c <<'EOCP'
17791 #include <sys/types.h>
17792 #include <inttypes.h>
17793 #include <stdio.h>
17794 int main() {
17795   int64_t q = 12345678901;
17796   printf("%" PRId64 "\n", q);
17797 }
17798 EOCP
17799         set try
17800         if eval $compile; then
17801                 yyy=`$run ./try`
17802                 case "$yyy" in
17803                 12345678901)
17804                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
17805                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
17806                         echo "We will use the C9X style."
17807                         ;;
17808                 esac
17809         fi
17810 fi
17811
17812 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17813         $cat >try.c <<EOCP
17814 #include <sys/types.h>
17815 #include <stdio.h>
17816 int main() {
17817   $quadtype q = 12345678901;
17818   printf("%Ld\n", q);
17819 }
17820 EOCP
17821         set try
17822         if eval $compile; then
17823                 yyy=`$run ./try`
17824                 case "$yyy" in
17825                 12345678901)
17826                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
17827                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
17828                         echo "We will use %Ld."
17829                         ;;
17830                 esac
17831         fi
17832 fi
17833
17834 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
17835         $cat >try.c <<'EOCP'
17836 #include <sys/types.h>
17837 #include <stdio.h>
17838 int main() {
17839   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
17840   printf("%lld\n", q);
17841 }
17842 EOCP
17843         set try
17844         if eval $compile; then
17845                 yyy=`$run ./try`
17846                 case "$yyy" in
17847                 12345678901)
17848                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
17849                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
17850                         echo "We will use the %lld style."
17851                         ;;
17852                 esac
17853         fi
17854 fi
17855
17856 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17857         $cat >try.c <<EOCP
17858 #include <sys/types.h>
17859 #include <stdio.h>
17860 int main() {
17861   $quadtype q = 12345678901;
17862   printf("%qd\n", q);
17863 }
17864 EOCP
17865         set try
17866         if eval $compile; then
17867                 yyy=`$run ./try`
17868                 case "$yyy" in
17869                 12345678901)
17870                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
17871                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
17872                         echo "We will use %qd."
17873                         ;;
17874                 esac
17875         fi
17876 fi
17877
17878 if $test X"$sPRId64" = X; then
17879         echo "Cannot figure out how to print 64-bit integers." >&4
17880 fi
17881
17882 $rm -f try try.*
17883
17884 fi
17885
17886 case "$sPRId64" in
17887 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
17888         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
17889         ;;
17890 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
17891         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
17892         ;;
17893 esac
17894
17895
17896 echo " "
17897 $echo "Checking the format strings to be used for Perl's internal types..." >&4
17898
17899 if $test X"$ivsize" = X8; then
17900         ivdformat="$sPRId64"
17901         uvuformat="$sPRIu64"
17902         uvoformat="$sPRIo64"
17903         uvxformat="$sPRIx64"
17904         uvXUformat="$sPRIXU64"
17905 else
17906         if $test X"$ivsize" = X"$longsize"; then
17907                 ivdformat='"ld"'
17908                 uvuformat='"lu"'
17909                 uvoformat='"lo"'
17910                 uvxformat='"lx"'
17911                 uvXUformat='"lX"'
17912         else
17913                 if $test X"$ivsize" = X"$intsize"; then
17914                         ivdformat='"d"'
17915                         uvuformat='"u"'
17916                         uvoformat='"o"'
17917                         uvxformat='"x"'
17918                         uvXUformat='"X"'
17919                 else
17920                         : far out
17921                         if $test X"$ivsize" = X"$shortsize"; then
17922                                 ivdformat='"hd"'
17923                                 uvuformat='"hu"'
17924                                 uvoformat='"ho"'
17925                                 uvxformat='"hx"'
17926                                 uvXUformat='"hX"'
17927                         fi
17928                 fi
17929         fi
17930 fi
17931
17932 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
17933         nveformat="$sPRIeldbl"
17934         nvfformat="$sPRIfldbl"
17935         nvgformat="$sPRIgldbl"
17936         nvEUformat="$sPRIEUldbl"
17937         nvFUformat="$sPRIFUldbl"
17938         nvGUformat="$sPRIGUldbl"
17939 else
17940         nveformat='"e"'
17941         nvfformat='"f"'
17942         nvgformat='"g"'
17943         nvEUformat='"E"'
17944         nvFUformat='"F"'
17945         nvGUformat='"G"'
17946 fi
17947
17948 case "$ivdformat" in
17949 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
17950     exit 1
17951     ;;
17952 esac
17953
17954
17955 echo " "
17956 $echo "Checking the format string to be used for gids..." >&4
17957
17958 case "$gidsign" in
17959 -1)     if $test X"$gidsize" = X"$ivsize"; then
17960                 gidformat="$ivdformat"
17961         else
17962                 if $test X"$gidsize" = X"$longsize"; then
17963                         gidformat='"ld"'
17964                 else
17965                         if $test X"$gidsize" = X"$intsize"; then
17966                                 gidformat='"d"'
17967                         else
17968                                 if $test X"$gidsize" = X"$shortsize"; then
17969                                         gidformat='"hd"'
17970                                 fi
17971                         fi
17972                 fi
17973         fi
17974         ;;
17975 *)      if $test X"$gidsize" = X"$uvsize"; then
17976                 gidformat="$uvuformat"
17977         else
17978                 if $test X"$gidsize" = X"$longsize"; then
17979                         gidformat='"lu"'
17980                 else
17981                         if $test X"$gidsize" = X"$intsize"; then
17982                                 gidformat='"u"'
17983                         else
17984                                 if $test X"$gidsize" = X"$shortsize"; then
17985                                         gidformat='"hu"'
17986                                 fi
17987                         fi
17988                 fi
17989         fi
17990         ;;
17991 esac
17992
17993 : see if getgroups exists
17994 set getgroups d_getgrps
17995 eval $inlibc
17996
17997 : see if setgroups exists
17998 set setgroups d_setgrps
17999 eval $inlibc
18000
18001
18002 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18003 echo " "
18004 case "$d_getgrps$d_setgrps" in
18005 *define*)
18006         case "$groupstype" in
18007         '') dflt="$gidtype" ;;
18008         *)  dflt="$groupstype" ;;
18009         esac
18010         $cat <<EOM
18011 What type of pointer is the second argument to getgroups() and setgroups()?
18012 Usually this is the same as group ids, $gidtype, but not always.
18013
18014 EOM
18015         rp='What type pointer is the second argument to getgroups() and setgroups()?'
18016         . ./myread
18017         groupstype="$ans"
18018         ;;
18019 *)  groupstype="$gidtype";;
18020 esac
18021
18022 echo " "
18023 echo "Checking if your $make program sets \$(MAKE)..." >&4
18024 case "$make_set_make" in
18025 '')
18026         $sed 's/^X //' > testmake.mak << 'EOF'
18027 Xall:
18028 X       @echo 'maketemp="$(MAKE)"'
18029 EOF
18030         case "`$make -f testmake.mak 2>/dev/null`" in
18031         *maketemp=*) make_set_make='#' ;;
18032         *)      make_set_make="MAKE=$make" ;;
18033         esac
18034         $rm -f testmake.mak
18035         ;;
18036 esac
18037 case "$make_set_make" in
18038 '#') echo "Yup, it does.";;
18039 *) echo "Nope, it doesn't.";;
18040 esac
18041
18042 : see what type is used for mode_t
18043 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
18044 set mode_t modetype int stdio.h sys/types.h
18045 eval $typedef_ask
18046
18047 : see if stdarg is available
18048 echo " "
18049 if $test `./findhdr stdarg.h`; then
18050         echo "<stdarg.h> found." >&4
18051         valstd="$define"
18052 else
18053         echo "<stdarg.h> NOT found." >&4
18054         valstd="$undef"
18055 fi
18056
18057 : see if varags is available
18058 echo " "
18059 if $test `./findhdr varargs.h`; then
18060         echo "<varargs.h> found." >&4
18061 else
18062         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
18063 fi
18064
18065 : set up the varargs testing programs
18066 $cat > varargs.c <<EOP
18067 #ifdef I_STDARG
18068 #include <stdarg.h>
18069 #endif
18070 #ifdef I_VARARGS
18071 #include <varargs.h>
18072 #endif
18073
18074 #ifdef I_STDARG
18075 int f(char *p, ...)
18076 #else
18077 int f(va_alist)
18078 va_dcl
18079 #endif
18080 {
18081         va_list ap;
18082 #ifndef I_STDARG
18083         char *p;
18084 #endif
18085 #ifdef I_STDARG
18086         va_start(ap,p);
18087 #else
18088         va_start(ap);
18089         p = va_arg(ap, char *);
18090 #endif
18091         va_end(ap);
18092 }
18093 EOP
18094 $cat > varargs <<EOP
18095 $startsh
18096 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
18097         echo "true"
18098 else
18099         echo "false"
18100 fi
18101 $rm -f varargs$_o
18102 EOP
18103 chmod +x varargs
18104
18105 : now check which varargs header should be included
18106 echo " "
18107 i_varhdr=''
18108 case "$valstd" in
18109 "$define")
18110         if `./varargs I_STDARG`; then
18111                 val='stdarg.h'
18112         elif `./varargs I_VARARGS`; then
18113                 val='varargs.h'
18114         fi
18115         ;;
18116 *)
18117         if `./varargs I_VARARGS`; then
18118                 val='varargs.h'
18119         fi
18120         ;;
18121 esac
18122 case "$val" in
18123 '')
18124 echo "I could not find the definition for va_dcl... You have problems..." >&4
18125         val="$undef"; set i_stdarg; eval $setvar
18126         val="$undef"; set i_varargs; eval $setvar
18127         ;;
18128 *) 
18129         set i_varhdr
18130         eval $setvar
18131         case "$i_varhdr" in
18132         stdarg.h)
18133                 val="$define"; set i_stdarg; eval $setvar
18134                 val="$undef"; set i_varargs; eval $setvar
18135                 ;;
18136         varargs.h)
18137                 val="$undef"; set i_stdarg; eval $setvar
18138                 val="$define"; set i_varargs; eval $setvar
18139                 ;;
18140         esac
18141         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
18142 esac
18143 $rm -f varargs*
18144
18145 : see if we need va_copy
18146 echo " "
18147 case "$i_stdarg" in
18148 "$define")
18149         $cat >try.c <<EOCP
18150 #include <stdarg.h>
18151 #include <stdio.h>
18152 #$i_stdlib I_STDLIB
18153 #ifdef I_STDLIB
18154 #include <stdlib.h>
18155 #endif
18156 #include <signal.h>
18157
18158 int
18159 ivfprintf(FILE *f, const char *fmt, va_list *valp)
18160 {
18161   return vfprintf(f, fmt, *valp);
18162 }
18163  
18164 int    
18165 myvfprintf(FILE *f, const  char *fmt, va_list val)
18166 {
18167   return ivfprintf(f, fmt, &val);
18168 }
18169       
18170 int
18171 myprintf(char *fmt, ...) 
18172 {
18173   va_list val;
18174   va_start(val, fmt);
18175   return myvfprintf(stdout, fmt, val); 
18176 }         
18177
18178 int
18179 main(int ac, char **av)
18180 {
18181   signal(SIGSEGV, exit);
18182
18183   myprintf("%s%cs all right, then\n", "that", '\'');                            
18184   exit(0);      
18185 }
18186 EOCP
18187         set try
18188         if eval $compile && $run ./try 2>&1 >/dev/null; then
18189                 case "`$run ./try`" in
18190                 "that's all right, then")
18191                         okay=yes
18192                         ;;
18193                 esac
18194         fi
18195         case "$okay" in
18196         yes)    echo "It seems that you don't need va_copy()." >&4
18197                 need_va_copy="$undef"
18198                 ;;
18199         *)      echo "It seems that va_copy() or similar will be needed." >&4
18200                 need_va_copy="$define"
18201                 ;;
18202         esac
18203         $rm -f try.* core core.* *.core *.core.*
18204         ;;
18205 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
18206         ;;
18207 esac
18208
18209 : see what type is used for size_t
18210 rp="What is the type used for the length parameter for string functions?"
18211 set size_t sizetype 'unsigned int' stdio.h sys/types.h
18212 eval $typedef_ask
18213
18214 : check for type of arguments to gethostbyaddr. 
18215 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
18216         case "$d_gethbyaddr" in
18217         $define)
18218                 $cat <<EOM
18219
18220 Checking to see what type of arguments are accepted by gethostbyaddr().
18221 EOM
18222                 hdrs="$define sys/types.h
18223                         $d_socket sys/socket.h 
18224                         $i_niin netinet/in.h 
18225                         $i_netdb netdb.h
18226                         $i_unistd unistd.h"
18227                 : The first arg can 'char *' or 'void *'
18228                 : The second arg is some of integral type
18229                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
18230                         for yyy in size_t long int; do
18231                                 case "$netdb_host_type" in
18232                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
18233                                         if ./protochk "$try" $hdrs; then
18234                                                 echo "Your system accepts $xxx for the first arg."
18235                                                 echo "...and $yyy for the second arg."
18236                                                 netdb_host_type="$xxx"
18237                                                 netdb_hlen_type="$yyy"
18238                                         fi
18239                                         ;;
18240                                 esac
18241                         done
18242                 done
18243                 : In case none of those worked, prompt the user.
18244                 case "$netdb_host_type" in
18245                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
18246                         dflt='char *'
18247                         . ./myread
18248                         netdb_host_type=$ans
18249                         rp='What is the type for the 2nd argument to gethostbyaddr?'
18250                         dflt="$sizetype"
18251                         . ./myread
18252                         netdb_hlen_type=$ans
18253                         ;;
18254                 esac
18255                 ;;
18256         *)      : no gethostbyaddr, so pick harmless defaults
18257                 netdb_host_type='char *'
18258                 netdb_hlen_type="$sizetype"
18259                 ;;
18260         esac
18261         # Remove the "const" if needed. -- but then we'll have a 
18262         # prototype clash!
18263         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
18264 fi
18265
18266 : check for type of argument to gethostbyname. 
18267 if test "X$netdb_name_type" = X ; then
18268         case "$d_gethbyname" in
18269         $define)
18270                 $cat <<EOM
18271
18272 Checking to see what type of argument is accepted by gethostbyname().
18273 EOM
18274                 hdrs="$define sys/types.h
18275                         $d_socket sys/socket.h 
18276                         $i_niin netinet/in.h 
18277                         $i_netdb netdb.h
18278                         $i_unistd unistd.h"
18279                 for xxx in "const char *" "char *"; do
18280                         case "$netdb_name_type" in
18281                         '')     try="extern struct hostent *gethostbyname($xxx);"
18282                                 if ./protochk "$try" $hdrs; then
18283                                         echo "Your system accepts $xxx."
18284                                         netdb_name_type="$xxx"
18285                                 fi
18286                                 ;;
18287                         esac
18288                 done
18289                 : In case none of those worked, prompt the user.
18290                 case "$netdb_name_type" in
18291                 '')     rp='What is the type for the 1st argument to gethostbyname?'
18292                         dflt='char *'
18293                         . ./myread
18294                         netdb_name_type=$ans
18295                         ;;
18296                 esac
18297                 ;;
18298         *)      : no gethostbyname, so pick harmless default
18299                 netdb_name_type='char *'
18300                 ;;
18301         esac
18302 fi
18303
18304 : check for type of 1st argument to getnetbyaddr. 
18305 if test "X$netdb_net_type" = X ; then
18306         case "$d_getnbyaddr" in
18307         $define)
18308                 $cat <<EOM
18309
18310 Checking to see what type of 1st argument is accepted by getnetbyaddr().
18311 EOM
18312                 hdrs="$define sys/types.h
18313                         $d_socket sys/socket.h 
18314                         $i_niin netinet/in.h 
18315                         $i_netdb netdb.h
18316                         $i_unistd unistd.h"
18317                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
18318                         case "$netdb_net_type" in
18319                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
18320                                 if ./protochk "$try" $hdrs; then
18321                                         echo "Your system accepts $xxx."
18322                                         netdb_net_type="$xxx"
18323                                 fi
18324                                 ;;
18325                         esac
18326                 done
18327                 : In case none of those worked, prompt the user.
18328                 case "$netdb_net_type" in
18329                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
18330                         dflt='long'
18331                         . ./myread
18332                         netdb_net_type=$ans
18333                         ;;
18334                 esac
18335                 ;;
18336         *)      : no getnetbyaddr, so pick harmless default
18337                 netdb_net_type='long'
18338                 ;;
18339         esac
18340 fi
18341 : locate the preferred pager for this system
18342 fn=f/
18343 case "$pager" in
18344 '')
18345         dflt=''
18346         case "$pg" in
18347         /*) dflt=$pg;;
18348         [a-zA-Z]:/*) dflt=$pg;;
18349         esac
18350         case "$more" in
18351         /*) dflt=$more;;
18352         [a-zA-Z]:/*) dflt=$more;;
18353         esac
18354         case "$less" in
18355         /*) dflt=$less;;
18356         [a-zA-Z]:/*) dflt=$less;;
18357         esac
18358         case "$dflt" in
18359         '') dflt=/usr/ucb/more;;
18360         esac
18361         ;;
18362 *)      dflt="$pager"
18363         : Instruct ./getfile to trust the hinted or previous pager value,
18364         : even if it does not begin with a slash.  For example, on os2,
18365         : pager might be cmd /c more.  See comments in UU/getfile.
18366         fn="f/($pager)"
18367         ;;
18368 esac
18369 echo " "
18370 rp='What pager is used on your system?'
18371 . ./getfile
18372 pager="$ans"
18373
18374 : see what type pids are declared as in the kernel
18375 rp="What is the type of process ids on this system?"
18376 set pid_t pidtype int stdio.h sys/types.h
18377 eval $typedef_ask
18378
18379 : Find earliest binary compatible site_perl subdirectory perl can use.
18380 xs_apiversion=$version # The current site_perl version.
18381 : Find earliest pure perl site_perl subdirectory perl can use.
18382 : The versioned directories started at 5.005.
18383 pm_apiversion='5.005'
18384
18385 : see if ar generates random libraries by itself
18386 echo " "
18387 echo "Checking how to generate random libraries on your machine..." >&4
18388 echo 'int bar1() { return bar2(); }' > bar1.c
18389 echo 'int bar2() { return 2; }' > bar2.c
18390 $cat > foo.c <<'EOP'
18391 int main() { printf("%d\n", bar1()); exit(0); }
18392 EOP
18393 $cc $ccflags -c bar1.c >/dev/null 2>&1
18394 $cc $ccflags -c bar2.c >/dev/null 2>&1
18395 $cc $ccflags -c foo.c >/dev/null 2>&1
18396 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
18397 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
18398         $run ./foobar >/dev/null 2>&1; then
18399         echo "$ar appears to generate random libraries itself."
18400         orderlib=false
18401         ranlib=":"
18402 elif $ar ts bar$_a >/dev/null 2>&1 &&
18403         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
18404         $run ./foobar >/dev/null 2>&1; then
18405                 echo "a table of contents needs to be added with '$ar ts'."
18406                 orderlib=false
18407                 ranlib="$ar ts"
18408 else
18409         case "$ranlib" in
18410         :) ranlib='';;
18411         '')
18412                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
18413                 $test -f $ranlib || ranlib=''
18414                 ;;
18415         esac
18416         if $test -n "$ranlib"; then
18417                 echo "your system has '$ranlib'; we'll use that."
18418                 orderlib=false
18419         else
18420                 echo "your system doesn't seem to support random libraries"
18421                 echo "so we'll use lorder and tsort to order the libraries."
18422                 orderlib=true
18423                 ranlib=":"
18424         fi
18425 fi
18426 $rm -f foo* bar* 
18427
18428 : check for type of arguments to select. 
18429 case "$selecttype" in
18430 '') case "$d_select" in
18431         $define)
18432                 echo " "
18433                 $cat <<EOM
18434 Checking to see what type of arguments are accepted by select().
18435 EOM
18436                 hdrs="$define sys/types.h
18437                         $i_systime sys/time.h 
18438                         $i_sysselct sys/select.h
18439                         $d_socket sys/socket.h"
18440                 : The first arg can be int, unsigned, or size_t
18441                 : The last arg may or may not be 'const'
18442                 val=''
18443                 : void pointer has been seen but using that
18444                 : breaks the selectminbits test
18445                 for xxx in 'fd_set *' 'int *'; do
18446                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
18447                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
18448                                         case "$val" in
18449                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
18450                                                 if ./protochk "$try" $hdrs; then
18451                                                         echo "Your system accepts $xxx."
18452                                                         val="$xxx"
18453                                                 fi
18454                                                 ;;
18455                                         esac
18456                                 done
18457                         done
18458                 done
18459                 case "$val" in
18460                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
18461                         case "$d_fd_set" in
18462                                 $define) dflt="fd_set *" ;;
18463                                 *)              dflt="int *" ;;
18464                         esac
18465                         . ./myread
18466                         val=$ans
18467                         ;;
18468                 esac
18469                 selecttype="$val"
18470                 ;;
18471         *)      : no select, so pick a harmless default
18472                 selecttype='int *'
18473                 ;;
18474         esac
18475         ;;
18476 esac
18477
18478 : check for the select 'width'
18479 case "$selectminbits" in
18480 '') case "$d_select" in
18481         $define)
18482                 $cat <<EOM
18483
18484 Checking to see on how many bits at a time your select() operates...
18485 EOM
18486                 $cat >try.c <<EOCP
18487 #include <sys/types.h>
18488 #$i_time I_TIME
18489 #$i_systime I_SYS_TIME
18490 #$i_systimek I_SYS_TIME_KERNEL
18491 #ifdef I_TIME
18492 #   include <time.h>
18493 #endif
18494 #ifdef I_SYS_TIME
18495 #   ifdef I_SYS_TIME_KERNEL
18496 #       define KERNEL
18497 #   endif
18498 #   include <sys/time.h>
18499 #   ifdef I_SYS_TIME_KERNEL
18500 #       undef KERNEL
18501 #   endif
18502 #endif
18503 #$i_sysselct I_SYS_SELECT
18504 #ifdef I_SYS_SELECT
18505 #include <sys/select.h>
18506 #endif
18507 #$d_socket HAS_SOCKET
18508 #ifdef HAS_SOCKET
18509 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
18510 #endif
18511 #include <stdio.h>
18512 $selecttype b;
18513 #define S sizeof(*(b))
18514 #define MINBITS 64
18515 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
18516 #define NBITS  (NBYTES * 8)
18517 int main() {
18518     char s[NBYTES];
18519     struct timeval t;
18520     int i;
18521     FILE* fp;
18522     int fd;
18523
18524     fclose(stdin);
18525     fp = fopen("try.c", "r");
18526     if (fp == 0)
18527       exit(1);
18528     fd = fileno(fp);
18529     if (fd < 0)
18530       exit(2);
18531     b = ($selecttype)s;
18532     for (i = 0; i < NBITS; i++)
18533         FD_SET(i, b);
18534     t.tv_sec  = 0;
18535     t.tv_usec = 0;
18536     select(fd + 1, b, 0, 0, &t);
18537     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
18538     printf("%d\n", i + 1);
18539     return 0;
18540 }
18541 EOCP
18542                 set try
18543                 if eval $compile_ok; then
18544                         selectminbits=`$run ./try`
18545                         case "$selectminbits" in
18546                         '')     cat >&4 <<EOM
18547 Cannot figure out on how many bits at a time your select() operates.
18548 I'll play safe and guess it is 32 bits.
18549 EOM
18550                                 selectminbits=32
18551                                 bits="32 bits"
18552                                 ;;
18553                         1)      bits="1 bit" ;;
18554                         *)      bits="$selectminbits bits" ;;
18555                         esac
18556                         echo "Your select() operates on $bits at a time." >&4
18557                 else
18558                         rp='What is the minimum number of bits your select() operates on?'
18559                         case "$byteorder" in
18560                         1234|12345678)  dflt=32 ;;
18561                         *)              dflt=1  ;;
18562                         esac
18563                         . ./myread
18564                         val=$ans
18565                         selectminbits="$val"
18566                 fi
18567                 $rm -f try.* try
18568                 ;;
18569         *)      : no select, so pick a harmless default
18570                 selectminbits='32'
18571                 ;;
18572         esac
18573         ;;
18574 esac
18575
18576 : Trace out the files included by signal.h, then look for SIGxxx names.
18577 : Remove SIGARRAYSIZE used by HPUX.
18578 : Remove SIGSTKSIZE used by Linux.
18579 : Remove SIGSTKSZ used by Posix.
18580 : Remove SIGTYP void lines used by OS2.
18581 : Some cpps, like os390, dont give the file name anywhere
18582 if [ "X$fieldn" = X ]; then
18583         : Just make some guesses.  We check them later.
18584         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
18585 else
18586         xxx=`echo '#include <signal.h>' |
18587         $cppstdin $cppminus $cppflags 2>/dev/null |
18588         $grep '^[       ]*#.*include' | 
18589         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
18590 fi
18591 : Check this list of files to be sure we have parsed the cpp output ok.
18592 : This will also avoid potentially non-existent files, such 
18593 : as ../foo/bar.h
18594 xxxfiles=''
18595 for xx in $xxx /dev/null ; do
18596         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
18597 done
18598 : If we have found no files, at least try signal.h
18599 case "$xxxfiles" in
18600 '')     xxxfiles=`./findhdr signal.h` ;;
18601 esac
18602 xxx=`awk '
18603 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
18604         print substr($2, 4, 20)
18605 }
18606 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
18607         print substr($3, 4, 20)
18608 }' $xxxfiles`
18609 : Append some common names just in case the awk scan failed.
18610 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
18611 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
18612 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
18613 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
18614 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
18615
18616 : generate a few handy files for later
18617 $cat > signal.c <<'EOCP'
18618 #include <sys/types.h>
18619 #include <signal.h>
18620 #include <stdio.h>
18621 int main() {
18622
18623 /* Strange style to avoid deeply-nested #if/#else/#endif */
18624 #ifndef NSIG
18625 #  ifdef _NSIG
18626 #    define NSIG (_NSIG)
18627 #  endif
18628 #endif
18629
18630 #ifndef NSIG
18631 #  ifdef SIGMAX
18632 #    define NSIG (SIGMAX+1)
18633 #  endif
18634 #endif
18635
18636 #ifndef NSIG
18637 #  ifdef SIG_MAX
18638 #    define NSIG (SIG_MAX+1)
18639 #  endif
18640 #endif
18641
18642 #ifndef NSIG
18643 #  ifdef MAXSIG
18644 #    define NSIG (MAXSIG+1)
18645 #  endif
18646 #endif
18647
18648 #ifndef NSIG
18649 #  ifdef MAX_SIG
18650 #    define NSIG (MAX_SIG+1)
18651 #  endif
18652 #endif
18653
18654 #ifndef NSIG
18655 #  ifdef SIGARRAYSIZE
18656 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
18657 #  endif
18658 #endif
18659
18660 #ifndef NSIG
18661 #  ifdef _sys_nsig
18662 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
18663 #  endif
18664 #endif
18665
18666 /* Default to some arbitrary number that's big enough to get most
18667    of the common signals.
18668 */
18669 #ifndef NSIG
18670 #    define NSIG 50
18671 #endif
18672
18673 printf("NSIG %d\n", NSIG);
18674
18675 #ifndef JUST_NSIG
18676
18677 EOCP
18678
18679 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
18680 {
18681         printf "#ifdef SIG"; printf $1; printf "\n"
18682         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
18683         printf $1; printf ");\n"
18684         printf "#endif\n"
18685 }
18686 END {
18687         printf "#endif /* JUST_NSIG */\n";
18688         printf "exit(0);\n}\n";
18689 }
18690 ' >>signal.c
18691 $cat >signal.awk <<'EOP'
18692 BEGIN { ndups = 0 }
18693 $1 ~ /^NSIG$/ { nsig = $2 }
18694 ($1 !~ /^NSIG$/) && (NF == 2) {
18695     if ($2 > maxsig) { maxsig = $2 }
18696     if (sig_name[$2]) {
18697         dup_name[ndups] = $1
18698         dup_num[ndups] = $2
18699         ndups++ 
18700     }
18701     else {
18702         sig_name[$2] = $1
18703         sig_num[$2] = $2
18704     }
18705 }
18706 END { 
18707     if (nsig == 0) {
18708         nsig = maxsig + 1
18709     }
18710     printf("NSIG %d\n", nsig);
18711     for (n = 1; n < nsig; n++) {
18712         if (sig_name[n]) {
18713             printf("%s %d\n", sig_name[n], sig_num[n])
18714         }
18715         else {
18716             printf("NUM%d %d\n", n, n) 
18717         }
18718     }
18719     for (n = 0; n < ndups; n++) {
18720         printf("%s %d\n", dup_name[n], dup_num[n])
18721     }
18722 }
18723 EOP
18724 $cat >signal_cmd <<EOS
18725 $startsh
18726 if $test -s signal.lst; then
18727     echo "Using your existing signal.lst file"
18728         exit 0
18729 fi
18730 xxx="$xxx"
18731 EOS
18732 $cat >>signal_cmd <<'EOS'
18733
18734 set signal
18735 if eval $compile_ok; then
18736         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
18737 else
18738         echo "(I can't seem be able to compile the whole test program)" >&4
18739         echo "(I'll try it in little pieces.)" >&4
18740         set signal -DJUST_NSIG
18741         if eval $compile_ok; then
18742                 $run ./signal$_exe > signal.nsg
18743                 $cat signal.nsg
18744         else
18745                 echo "I can't seem to figure out how many signals you have." >&4
18746                 echo "Guessing 50." >&4
18747                 echo 'NSIG 50' > signal.nsg
18748         fi
18749         : Now look at all the signal names, one at a time.
18750         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
18751                 $cat > signal.c <<EOCP
18752 #include <sys/types.h>
18753 #include <signal.h>
18754 #include <stdio.h>
18755 int main() {
18756 printf("$xx %d\n", SIG${xx});
18757 return 0;
18758 }
18759 EOCP
18760                 set signal
18761                 if eval $compile; then
18762                         echo "SIG${xx} found."
18763                         $run ./signal$_exe  >> signal.ls1
18764                 else
18765                         echo "SIG${xx} NOT found."
18766                 fi
18767         done
18768         if $test -s signal.ls1; then
18769                 $cat signal.nsg signal.ls1 |
18770                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
18771         fi
18772
18773 fi
18774 if $test -s signal.lst; then
18775         :
18776 else
18777         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
18778         echo 'kill -l' >signal
18779         set X `csh -f <signal`
18780         $rm -f signal
18781         shift
18782         case $# in
18783         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
18784         esac
18785         echo $@ | $tr ' ' $trnl | \
18786             $awk '{ printf "%s %d\n", $1, ++s; }
18787                   END { printf "NSIG %d\n", ++s }' >signal.lst
18788 fi
18789 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
18790 EOS
18791 chmod a+x signal_cmd
18792 $eunicefix signal_cmd
18793
18794 : generate list of signal names
18795 echo " "
18796 case "$sig_name_init" in
18797 '') doinit=yes ;;
18798 *)  case "$sig_num_init" in
18799     ''|*,*) doinit=yes ;;
18800     esac ;;
18801 esac
18802 case "$doinit" in
18803 yes)
18804         echo "Generating a list of signal names and numbers..." >&4
18805         . ./signal_cmd
18806         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
18807         sig_name=`$awk 'BEGIN { printf "ZERO " }
18808                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
18809         sig_num=`$awk  'BEGIN { printf "0 " }
18810                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
18811         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
18812                              !/^NSIG/   { printf "\"%s\", ", $1 }
18813                              END        { printf "0\n" }' signal.lst`
18814         sig_num_init=`$awk  'BEGIN      { printf "0, " }
18815                              !/^NSIG/   { printf "%d, ", $2}
18816                              END        { printf "0\n"}' signal.lst`
18817         ;;
18818 esac
18819 echo "The following $sig_count signals are available:"
18820 echo " "
18821 echo $sig_name | $awk \
18822 'BEGIN { linelen = 0 }
18823 {
18824         for (i = 1; i <= NF; i++) {
18825                 name = "SIG" $i " "
18826                 linelen = linelen + length(name)
18827                 if (linelen > 70) {
18828                         printf "\n"
18829                         linelen = length(name)
18830                 }
18831                 printf "%s", name
18832         }
18833         printf "\n"
18834 }'
18835 sig_size=`echo $sig_name | awk '{print NF}'`
18836 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
18837
18838 echo " "
18839 case "$sizetype" in
18840 *_t) zzz="$sizetype"    ;;
18841 *)   zzz="filesize"     ;;
18842 esac
18843 echo "Checking the size of $zzz..." >&4 
18844 cat > try.c <<EOCP
18845 #include <sys/types.h>
18846 #include <stdio.h>
18847 int main() {
18848     printf("%d\n", (int)sizeof($sizetype));
18849     exit(0);
18850 }
18851 EOCP
18852 set try
18853 if eval $compile_ok; then
18854         yyy=`$run ./try`
18855         case "$yyy" in
18856         '')     sizesize=4
18857                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
18858                 ;;
18859         *)      sizesize=$yyy
18860                 echo "Your $zzz size is $sizesize bytes."
18861                 ;;
18862         esac
18863 else
18864         sizesize=4
18865         echo "(I can't compile the test program--guessing $sizesize.)" >&4
18866 fi
18867
18868
18869 : check for socklen_t
18870 echo " "
18871 echo "Checking to see if you have socklen_t..." >&4
18872 $cat >try.c <<EOCP
18873 #include <sys/types.h>
18874 #$d_socket HAS_SOCKET
18875 #ifdef HAS_SOCKET
18876 #include <sys/socket.h>
18877 #endif
18878 int main() { socklen_t x = 16; }
18879 EOCP
18880 set try
18881 if eval $compile; then
18882         val="$define"
18883         echo "You have socklen_t."
18884 else
18885         val="$undef"
18886         echo "You do not have socklen_t."
18887         case "$sizetype" in
18888         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
18889         esac
18890 fi
18891 $rm -f try try.*
18892 set d_socklen_t
18893 eval $setvar
18894
18895 : see if this is a socks.h system
18896 set socks.h i_socks
18897 eval $inhdr
18898
18899 : check for type of the size argument to socket calls
18900 case "$d_socket" in
18901 "$define")
18902         $cat <<EOM
18903
18904 Checking to see what type is the last argument of accept().
18905 EOM
18906         yyy=''
18907         case "$d_socklen_t" in
18908         "$define") yyy="$yyy socklen_t"
18909         esac
18910         yyy="$yyy $sizetype int long unsigned"
18911         for xxx in $yyy; do
18912                 case "$socksizetype" in
18913                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
18914                         case "$usesocks" in
18915                         "$define")
18916                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
18917                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18918                                         socksizetype="$xxx"
18919                                 fi
18920                                 ;;
18921                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
18922                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18923                                         socksizetype="$xxx"
18924                                 fi
18925                                 ;;
18926                         esac
18927                         ;;
18928                 esac
18929         done
18930 : In case none of those worked, prompt the user.
18931         case "$socksizetype" in
18932         '')     rp='What is the type for socket address structure sizes?'
18933                 dflt='int'
18934                 . ./myread
18935                 socksizetype=$ans
18936                 ;;
18937         esac
18938         ;;
18939 *)      : no sockets, so pick relatively harmless default
18940         socksizetype='int'
18941         ;;
18942 esac
18943
18944 : see what type is used for signed size_t
18945 set ssize_t ssizetype int stdio.h sys/types.h
18946 eval $typedef
18947 dflt="$ssizetype"
18948 $cat > try.c <<EOM
18949 #include <stdio.h>
18950 #include <sys/types.h>
18951 #define Size_t $sizetype
18952 #define SSize_t $dflt
18953 int main()
18954 {
18955         if (sizeof(Size_t) == sizeof(SSize_t))
18956                 printf("$dflt\n");
18957         else if (sizeof(Size_t) == sizeof(int))
18958                 printf("int\n");
18959         else 
18960                 printf("long\n");
18961         exit(0);
18962 }
18963 EOM
18964 echo " "
18965 set try
18966 if eval $compile_ok && $run ./try > /dev/null; then
18967         ssizetype=`$run ./try`
18968         echo "I'll be using $ssizetype for functions returning a byte count." >&4
18969 else
18970         $cat >&4 <<EOM
18971 Help! I can't compile and run the ssize_t test program: please enlighten me!
18972 (This is probably a misconfiguration in your system or libraries, and
18973 you really ought to fix it.  Still, I'll try anyway.)
18974
18975 I need a type that is the same size as $sizetype, but is guaranteed to
18976 be signed.  Common values are ssize_t, int and long.
18977
18978 EOM
18979         rp="What signed type is the same size as $sizetype?"
18980         . ./myread
18981         ssizetype="$ans"
18982 fi
18983 $rm -f try try.*
18984
18985 : see what type of char stdio uses.
18986 echo " "
18987 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
18988 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
18989         echo "Your stdio uses unsigned chars." >&4
18990         stdchar="unsigned char"
18991 else
18992         echo "Your stdio uses signed chars." >&4
18993         stdchar="char"
18994 fi
18995 $rm -f stdioh
18996
18997
18998
18999 : see what type uids are declared as in the kernel
19000 echo " "
19001 echo "Looking for the type for user ids returned by getuid()."
19002 set uid_t uidtype xxx stdio.h sys/types.h
19003 eval $typedef
19004 case "$uidtype" in
19005 xxx)
19006         xxx=`./findhdr sys/user.h`
19007         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
19008         case $1 in
19009         unsigned) dflt="$1 $2" ;;
19010         *) dflt="$1" ;;
19011         esac
19012         ;;
19013 *) dflt="$uidtype";;
19014 esac
19015 case "$uidtype" in
19016 uid_t)  echo "uid_t found." ;;
19017 *)      rp="What is the type for user ids returned by getuid()?"
19018         . ./myread
19019         uidtype="$ans"
19020         ;;
19021 esac
19022
19023 echo " "
19024 case "$uidtype" in
19025 *_t) zzz="$uidtype"     ;;
19026 *)   zzz="uid"          ;;
19027 esac
19028 echo "Checking the size of $zzz..." >&4 
19029 cat > try.c <<EOCP
19030 #include <sys/types.h>
19031 #include <stdio.h>
19032 int main() {
19033     printf("%d\n", (int)sizeof($uidtype));
19034     exit(0);
19035 }
19036 EOCP
19037 set try
19038 if eval $compile_ok; then
19039         yyy=`$run ./try`
19040         case "$yyy" in
19041         '')     uidsize=4
19042                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
19043                 ;;
19044         *)      uidsize=$yyy
19045                 echo "Your $zzz is $uidsize bytes long."
19046                 ;;
19047         esac
19048 else
19049         uidsize=4
19050         echo "(I can't compile the test program--guessing $uidsize.)" >&4
19051 fi
19052
19053 echo " "
19054 case "$uidtype" in
19055 *_t) zzz="$uidtype"     ;;
19056 *)   zzz="uid"          ;;
19057 esac
19058 echo "Checking the sign of $zzz..." >&4
19059 cat > try.c <<EOCP
19060 #include <sys/types.h>
19061 #include <stdio.h>
19062 int main() {
19063         $uidtype foo = -1;
19064         if (foo < 0)
19065                 printf("-1\n");
19066         else
19067                 printf("1\n");
19068 }
19069 EOCP
19070 set try
19071 if eval $compile; then
19072         yyy=`$run ./try`
19073         case "$yyy" in
19074         '')     uidsign=1
19075                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19076                 ;;
19077         *)      uidsign=$yyy
19078                 case "$uidsign" in
19079                  1) echo "Your $zzz is unsigned." ;;
19080                 -1) echo "Your $zzz is signed."   ;;
19081                 esac
19082                 ;;
19083         esac
19084 else
19085         uidsign=1
19086         echo "(I can't compile the test program--guessing unsigned.)" >&4
19087 fi
19088
19089
19090
19091 echo " "
19092 $echo "Checking the format string to be used for uids..." >&4
19093
19094 case "$uidsign" in
19095 -1)     if $test X"$uidsize" = X"$ivsize"; then
19096                 uidformat="$ivdformat"
19097         else
19098                 if $test X"$uidsize" = X"$longsize"; then
19099                         uidformat='"ld"'
19100                 else
19101                         if $test X"$uidsize" = X"$intsize"; then
19102                                 uidformat='"d"'
19103                         else
19104                                 if $test X"$uidsize" = X"$shortsize"; then
19105                                         uidformat='"hd"'
19106                                 fi
19107                         fi
19108                 fi
19109         fi
19110         ;;
19111 *)      if $test X"$uidsize" = X"$uvsize"; then
19112                 uidformat="$uvuformat"
19113         else
19114                 if $test X"$uidsize" = X"$longsize"; then
19115                         uidformat='"lu"'
19116                 else
19117                         if $test X"$uidsize" = X"$intsize"; then
19118                                 uidformat='"u"'
19119                         else
19120                                 if $test X"$uidsize" = X"$shortsize"; then
19121                                         uidformat='"hu"'
19122                                 fi
19123                         fi
19124                 fi
19125         fi
19126         ;;
19127 esac
19128
19129 : determine compiler compiler
19130 case "$yacc" in
19131 '')
19132         dflt=yacc;;
19133 *)
19134         dflt="$yacc";;
19135 esac
19136 echo " "
19137 comp='yacc'
19138 if $test -f "$byacc$_exe"; then
19139         dflt="$byacc"
19140         comp="byacc or $comp"
19141 fi
19142 if $test -f "$bison$_exe"; then
19143         comp="$comp or bison -y"
19144 fi
19145 rp="Which compiler compiler ($comp) shall I use?"
19146 . ./myread
19147 yacc="$ans"
19148 case "$yacc" in
19149 *bis*)
19150         case "$yacc" in
19151         *-y*) ;;
19152         *)
19153                 yacc="$yacc -y"
19154                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
19155                 ;;
19156         esac
19157         ;;
19158 esac
19159
19160 : see if this is a fp.h system
19161 set fp.h i_fp
19162 eval $inhdr
19163
19164 : see if this is a fp_class.h system
19165 set fp_class.h i_fp_class
19166 eval $inhdr
19167
19168 : see if this is a ieeefp.h system
19169 case "$i_ieeefp" in
19170 '' ) set ieeefp.h i_ieeefp
19171      eval $inhdr
19172      ;;
19173 esac
19174
19175 : see if this is a libutil.h system
19176 set libutil.h i_libutil
19177 eval $inhdr
19178
19179 : see if mach cthreads are available
19180 if test "X$usethreads" = "X$define"; then
19181         set mach/cthreads.h i_machcthr
19182         eval $inhdr
19183 else
19184         i_machcthr="$undef"
19185 fi
19186
19187
19188
19189 : see if this is a math.h system
19190 set math.h i_math
19191 eval $inhdr
19192
19193 : see if this is a mntent.h system
19194 set mntent.h i_mntent
19195 eval $inhdr
19196
19197 : see if ndbm.h is available
19198 set ndbm.h t_ndbm
19199 eval $inhdr
19200
19201 case "$t_ndbm" in
19202 $undef)
19203     # Some Linux distributions such as RedHat 7.1 put the
19204     # ndbm.h header in /usr/include/gdbm/ndbm.h.
19205     if $test -f /usr/include/gdbm/ndbm.h; then
19206         echo '<gdbm/ndbm.h> found.'
19207         ccflags="$ccflags -I/usr/include/gdbm"
19208         cppflags="$cppflags -I/usr/include/gdbm"
19209         t_ndbm=$define
19210     fi
19211     ;;
19212 esac
19213
19214 case "$t_ndbm" in
19215 $define)
19216         : see if dbm_open exists
19217         set dbm_open d_dbm_open
19218         eval $inlibc
19219         case "$d_dbm_open" in
19220         $undef)
19221                 t_ndbm="$undef"
19222                 echo "We won't be including <ndbm.h>"
19223                 ;;
19224         esac
19225         ;;
19226 esac
19227 val="$t_ndbm"
19228 set i_ndbm
19229 eval $setvar
19230
19231 : see if net/errno.h is available
19232 val=''
19233 set net/errno.h val
19234 eval $inhdr
19235
19236 : Unfortunately, it causes problems on some systems.  Arrgh.
19237 case "$val" in
19238 $define)
19239         cat > try.c <<'EOM'
19240 #include <stdio.h>
19241 #include <errno.h>
19242 #include <net/errno.h>
19243 int func()
19244 {
19245         return ENOTSOCK;
19246 }
19247 EOM
19248         if $cc $ccflags -c try.c >/dev/null 2>&1; then
19249                 echo "We'll be including <net/errno.h>." >&4
19250         else
19251                 echo "We won't be including <net/errno.h>." >&4
19252                 val="$undef"
19253         fi
19254         $rm -f try.* try
19255         ;;
19256 esac
19257 set i_neterrno
19258 eval $setvar
19259
19260 : see if netinet/tcp.h is available
19261 set netinet/tcp.h i_netinettcp
19262 eval $inhdr
19263
19264 : see if this is a poll.h system
19265 set poll.h i_poll
19266 eval $inhdr
19267
19268 : see if this is a prot.h system
19269 set prot.h i_prot
19270 eval $inhdr
19271
19272 echo " "
19273 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
19274 $cat <<'EOSH' > Cppsym.know
19275 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
19276 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
19277 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
19278 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
19279 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
19280 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
19281 bull c cadmus clipper CMU COFF COMPILER_VERSION
19282 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
19283 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
19284 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
19285 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
19286 GLIBC GLIBC_MINOR
19287 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
19288 H3050R H3050RX hbullx20 hcx host_mips
19289 hp200 hp300 hp700 HP700 hp800 hp9000
19290 hp9000s200 hp9000s300 hp9000s400 hp9000s500
19291 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
19292 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
19293 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
19294 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
19295 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
19296 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
19297 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
19298 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
19299 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
19300 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
19301 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
19302 MATH_HAS_NO_SIDE_EFFECTS
19303 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
19304 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
19305 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
19306 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
19307 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
19308 NetBSD news1500 news1700 news1800 news1900 news3700
19309 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
19310 ns32016 ns32332 ns32k nsc32000
19311 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
19312 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
19313 pc532 pdp11 PGC PIC plexus PORTAR posix
19314 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
19315 POSIX_C_SOURCE POSIX_SOURCE POWER
19316 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
19317 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
19318 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
19319 sony sony_news sonyrisc sparc sparclite spectrum
19320 stardent stdc STDC_EXT stratos sun sun3 sun386
19321 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
19322 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
19323 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
19324 sysV68 sysV88 Tek4132 Tek4300 titan
19325 TM3200 TM5400 TM5600
19326 tower tower32 tower32_200 tower32_600 tower32_700
19327 tower32_800 tower32_850 tss
19328 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
19329 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
19330 unix UNIX95 UNIX99 unixpc unos
19331 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
19332 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
19333 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
19334 USGr4 USGr4_2
19335 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
19336 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
19337 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
19338 z8000
19339 EOSH
19340 # Maybe put other stuff here too.
19341 cat <<EOSH >>Cppsym.know
19342 $osname
19343 EOSH
19344 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
19345 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
19346 $cat Cppsym.know > Cppsym.c
19347 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
19348 $rm -f Cppsym.a Cppsym.b Cppsym.c
19349 cat <<EOSH > Cppsym
19350 $startsh
19351 if $test \$# -gt 0; then
19352     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
19353     if $test -s Cppsym.got; then
19354         $rm -f Cppsym.got
19355         exit 0
19356     fi
19357     $rm -f Cppsym.got
19358     exit 1
19359 else
19360     $tr " " "$trnl" | ./Cppsym.try
19361     exit 0
19362 fi
19363 EOSH
19364 chmod +x Cppsym
19365 $eunicefix Cppsym
19366 cat <<EOSH > Cppsym.try
19367 $startsh
19368 cat <<'EOCP' > try.c
19369 #include <stdio.h>
19370 int main() {
19371 EOCP
19372 $awk \\
19373 EOSH
19374 cat <<'EOSH' >> Cppsym.try
19375 'length($1) > 0 {
19376     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
19377     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
19378     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
19379     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
19380 }'       >> try.c
19381 echo 'return 0;}' >> try.c
19382 EOSH
19383 cat <<EOSH >> Cppsym.try
19384 ccflags="$ccflags"
19385 case "$osname-$gccversion" in
19386 irix-) ccflags="\$ccflags -woff 1178" ;;
19387 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
19388 esac
19389 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
19390 EOSH
19391 chmod +x Cppsym.try
19392 $eunicefix Cppsym.try
19393 ./Cppsym < Cppsym.know > Cppsym.true
19394 : now check the C compiler for additional symbols
19395 postprocess_cc_v=''
19396 case "$osname" in
19397 aix) postprocess_cc_v="|$tr , ' '" ;;
19398 esac
19399 $cat >ccsym <<EOS
19400 $startsh
19401 $cat >tmp.c <<EOF
19402 extern int foo;
19403 EOF
19404 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
19405 do
19406         case "\$i" in
19407         -D*) echo "\$i" | $sed 's/^-D//';;
19408         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
19409         esac
19410 done
19411 $rm -f try.c
19412 EOS
19413 postprocess_cc_v=''
19414 chmod +x ccsym
19415 $eunicefix ccsym
19416 ./ccsym > ccsym1.raw
19417 if $test -s ccsym1.raw; then
19418        $sort ccsym1.raw | $uniq >ccsym.raw
19419 else
19420        mv ccsym1.raw ccsym.raw
19421 fi
19422
19423 $awk '/\=/ { print $0; next }
19424         { print $0"=1" }' ccsym.raw >ccsym.list
19425 $awk '/\=/ { print $0; next }
19426         { print $0"=1" }' Cppsym.true >ccsym.true
19427 $comm -13 ccsym.true ccsym.list >ccsym.own
19428 $comm -12 ccsym.true ccsym.list >ccsym.com
19429 $comm -23 ccsym.true ccsym.list >ccsym.cpp
19430 also=''
19431 if $test -z ccsym.raw; then
19432         echo "Your C compiler doesn't seem to define any symbols!" >&4
19433         echo " "
19434         echo "However, your C preprocessor defines the following symbols:"
19435         $cat Cppsym.true
19436         ccsymbols=''
19437         cppsymbols=`$cat Cppsym.true`
19438         cppsymbols=`echo $cppsymbols`
19439         cppccsymbols="$cppsymbols"
19440 else
19441         if $test -s ccsym.com; then
19442                 echo "Your C compiler and pre-processor define these symbols:"
19443                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
19444                 also='also '
19445                 symbols='ones'
19446                 cppccsymbols=`$cat ccsym.com`
19447                 cppccsymbols=`echo $cppccsymbols`
19448                 $test "$silent" || sleep 1
19449         fi
19450         if $test -s ccsym.cpp; then
19451                 $test "$also" && echo " "
19452                 echo "Your C pre-processor ${also}defines the following symbols:"
19453                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
19454                 also='further '
19455                 cppsymbols=`$cat ccsym.cpp`
19456                 cppsymbols=`echo $cppsymbols`
19457                 $test "$silent" || sleep 1
19458         fi
19459         if $test -s ccsym.own; then
19460                 $test "$also" && echo " "
19461                 echo "Your C compiler ${also}defines the following cpp symbols:"
19462                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
19463                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
19464                 ccsymbols=`$cat ccsym.own`
19465                 ccsymbols=`echo $ccsymbols`
19466                 $test "$silent" || sleep 1
19467         fi
19468 fi
19469
19470 : see if this is a termio system
19471 val="$undef"
19472 val2="$undef"
19473 val3="$undef"
19474 if $test `./findhdr termios.h`; then
19475         set tcsetattr i_termios
19476         eval $inlibc
19477         val3="$i_termios"
19478 fi
19479 echo " "
19480 case "$val3" in
19481 "$define") echo "You have POSIX termios.h... good!" >&4;;
19482 *) if ./Cppsym pyr; then
19483                 case "`/bin/universe`" in
19484                 ucb) if $test `./findhdr sgtty.h`; then
19485                                 val2="$define"
19486                                 echo "<sgtty.h> found." >&4
19487                         else
19488                                 echo "System is pyramid with BSD universe."
19489                                 echo "<sgtty.h> not found--you could have problems." >&4
19490                         fi;;
19491                 *) if $test `./findhdr termio.h`; then
19492                                 val="$define"
19493                                 echo "<termio.h> found." >&4
19494                         else
19495                                 echo "System is pyramid with USG universe."
19496                                 echo "<termio.h> not found--you could have problems." >&4
19497                         fi;;
19498                 esac
19499         elif ./usg; then
19500                 if $test `./findhdr termio.h`; then
19501                         echo "<termio.h> found." >&4
19502                         val="$define"
19503                 elif $test `./findhdr sgtty.h`; then
19504                         echo "<sgtty.h> found." >&4
19505                         val2="$define"
19506                 else
19507 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
19508                 fi
19509         else
19510                 if $test `./findhdr sgtty.h`; then
19511                         echo "<sgtty.h> found." >&4
19512                         val2="$define"
19513                 elif $test `./findhdr termio.h`; then
19514                         echo "<termio.h> found." >&4
19515                         val="$define"
19516                 else
19517 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
19518                 fi
19519         fi;;
19520 esac
19521 set i_termio; eval $setvar
19522 val=$val2; set i_sgtty; eval $setvar
19523 val=$val3; set i_termios; eval $setvar
19524
19525 : see if stddef is available
19526 set stddef.h i_stddef
19527 eval $inhdr
19528
19529 : see if this is a sunmath.h system
19530 set sunmath.h i_sunmath
19531 eval $inhdr
19532
19533 : see if sys/access.h is available
19534 set sys/access.h i_sysaccess
19535 eval $inhdr
19536
19537 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
19538 set sys/filio.h i_sysfilio
19539 eval $inhdr
19540 echo " "
19541 if $test `./findhdr sys/ioctl.h`; then
19542         val="$define"
19543         echo '<sys/ioctl.h> found.' >&4
19544 else
19545         val="$undef"
19546         if $test $i_sysfilio = "$define"; then
19547             echo '<sys/ioctl.h> NOT found.' >&4
19548         else
19549                 $test $i_sgtty = "$define" && xxx="sgtty.h"
19550                 $test $i_termio = "$define" && xxx="termio.h"
19551                 $test $i_termios = "$define" && xxx="termios.h"
19552 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
19553         fi
19554 fi
19555 set i_sysioctl
19556 eval $setvar
19557
19558 : see if socket ioctl defs are in sys/sockio.h
19559 echo " "
19560 xxx=`./findhdr sys/sockio.h`
19561 if $test "$xxx"; then
19562         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
19563                 val="$define"
19564                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
19565         else
19566                 val="$undef"
19567                 echo "No socket ioctls found in <sys/sockio.h>." >&4
19568         fi
19569 else
19570         val="$undef"
19571         $cat <<EOM
19572 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
19573 EOM
19574 fi
19575 set i_syssockio
19576 eval $setvar
19577
19578
19579 : see if this is a syslog.h system
19580 set syslog.h i_syslog
19581 eval $inhdr
19582
19583
19584 : see if this is a sys/mode.h system
19585 set sys/mode.h i_sysmode
19586 eval $inhdr
19587
19588 : see if sys/resource.h has to be included
19589 set sys/resource.h i_sysresrc
19590 eval $inhdr
19591
19592 : see if sys/security.h is available
19593 set sys/security.h i_syssecrt
19594 eval $inhdr
19595
19596 : see if this is a sys/statvfs.h system
19597 set sys/statvfs.h i_sysstatvfs
19598 eval $inhdr
19599
19600 : see if this is a sys/un.h system
19601 set sys/un.h i_sysun
19602 eval $inhdr
19603
19604
19605 : see if this is a sys/utsname.h system
19606 set sys/utsname.h i_sysutsname
19607 eval $inhdr
19608
19609 : see if this is a syswait system
19610 set sys/wait.h i_syswait
19611 eval $inhdr
19612
19613 : see if this is a ustat.h system
19614 set ustat.h i_ustat
19615 eval $inhdr
19616
19617 : see if this is an utime system
19618 set utime.h i_utime
19619 eval $inhdr
19620
19621 : see if this is a values.h system
19622 set values.h i_values
19623 eval $inhdr
19624
19625 : see if this is a vfork system
19626 case "$d_vfork" in
19627 "$define")
19628         set vfork.h i_vfork
19629         eval $inhdr
19630         ;;
19631 *)
19632         i_vfork="$undef"
19633         ;;
19634 esac
19635
19636 : see if gdbm.h is available
19637 set gdbm.h t_gdbm
19638 eval $inhdr
19639 case "$t_gdbm" in
19640 $define)
19641         : see if gdbm_open exists
19642         set gdbm_open d_gdbm_open
19643         eval $inlibc
19644         case "$d_gdbm_open" in
19645         $undef)
19646                 t_gdbm="$undef"
19647                 echo "We won't be including <gdbm.h>"
19648                 ;;
19649         esac
19650         ;;
19651 esac
19652 val="$t_gdbm"
19653 set i_gdbm
19654 eval $setvar
19655
19656 echo " "
19657 echo "Looking for extensions..." >&4
19658 : If we are using the old config.sh, known_extensions may contain
19659 : old or inaccurate or duplicate values.
19660 known_extensions=''
19661 nonxs_extensions=''
19662 : We do not use find because it might not be available.
19663 : We do not just use MANIFEST because the user may have dropped
19664 : some additional extensions into the source tree and expect them
19665 : to be built.
19666
19667 : Function to recursively find available extensions, ignoring DynaLoader
19668 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
19669 find_extensions='
19670     for xxx in *; do
19671        case "$xxx" in
19672            DynaLoader|dynaload) ;;
19673            *)
19674            if $test -f $xxx/$xxx.xs; then
19675                known_extensions="$known_extensions $1$xxx";
19676            elif $test -f $xxx/Makefile.PL; then
19677                nonxs_extensions="$nonxs_extensions $1$xxx";
19678            else
19679                if $test -d $xxx -a $# -lt 10; then
19680                    set $1$xxx/ $*;
19681                    cd "$xxx";
19682                    eval $find_extensions;
19683                    cd ..;
19684                    shift;
19685                fi;
19686            fi
19687            ;;
19688        esac;
19689     done'
19690 tdir=`pwd`
19691 cd "$rsrc/ext"
19692 set X
19693 shift
19694 eval $find_extensions
19695 # Special case:  Add in threads/shared since it is not picked up by the
19696 # recursive find above (and adding in general recursive finding breaks
19697 # SDBM_File/sdbm).  A.D.  10/25/2001.
19698 known_extensions="$known_extensions threads/shared"
19699 set X $nonxs_extensions
19700 shift
19701 nonxs_extensions="$*"
19702 set X $known_extensions
19703 shift
19704 known_extensions="$*"
19705 cd "$tdir"
19706
19707 : Now see which are supported on this system.
19708 avail_ext=''
19709 for xxx in $known_extensions ; do
19710         case "$xxx" in
19711         DB_File|db_file)
19712                 case "$i_db" in
19713                 $define) avail_ext="$avail_ext $xxx" ;;
19714                 esac
19715                 ;;
19716         GDBM_File|gdbm_fil)
19717                 case "$i_gdbm" in 
19718                 $define) avail_ext="$avail_ext $xxx" ;;
19719                 esac
19720                 ;;
19721         I18N/Langinfo|i18n_lan)
19722                 case "$i_langinfo$d_nl_langinfo" in 
19723                 $define$define) avail_ext="$avail_ext $xxx" ;;
19724                 esac
19725                 ;;
19726         NDBM_File|ndbm_fil)
19727                 case "$i_ndbm" in
19728                 $define)
19729                     case "$osname-$use64bitint" in
19730                     hpux-define)
19731                         case "$libs" in
19732                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
19733                         esac
19734                         ;;
19735                     *) avail_ext="$avail_ext $xxx" ;;
19736                     esac
19737                     ;;
19738                 esac
19739                 ;;
19740         ODBM_File|odbm_fil) 
19741                 case "${i_dbm}${i_rpcsvcdbm}" in
19742                 *"${define}"*)
19743                     case "$osname-$use64bitint" in
19744                     hpux-define)
19745                         case "$libs" in
19746                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
19747                         esac
19748                         ;;
19749                     *) avail_ext="$avail_ext $xxx" ;;
19750                     esac
19751                     ;;
19752                 esac
19753                 ;;
19754         POSIX|posix)
19755                 case "$useposix" in
19756                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19757                 esac
19758                 ;;
19759         Opcode|opcode)
19760                 case "$useopcode" in
19761                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19762                 esac
19763                 ;;
19764         Socket|socket)
19765                 case "$d_socket" in 
19766                 true|$define|y)
19767                     case "$osname" in
19768                     beos) ;; # not unless BONE
19769                     *) avail_ext="$avail_ext $xxx" ;;
19770                     esac
19771                     ;;
19772                 esac
19773                 ;;
19774         Sys/Syslog|sys/syslog)
19775                 : XXX syslog requires socket
19776                 case "$d_socket" in 
19777                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
19778                 esac
19779                 ;;
19780         Thread|thread)
19781                 case "$usethreads" in
19782                 true|$define|y)
19783                         case "$useithreads" in
19784                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
19785                         esac
19786                 esac
19787                 ;;
19788         XS/APItest|xs/apitest)
19789                 # This is just for testing.  Skip it unless we have dynamic loading.
19790
19791                 case "$usedl" in
19792                 $define) avail_ext="$avail_ext $xxx" ;;
19793                 esac
19794                 ;;
19795         XS/Typemap|xs/typemap)
19796                 # This is just for testing.  Skip it unless we have dynamic loading.
19797                 case "$usedl" in
19798                 $define) avail_ext="$avail_ext $xxx" ;;
19799                 esac
19800                 ;;
19801         threads|threads/shared)
19802                 # threads and threads::shared are special cases.
19803                 # To stop people from asking "Perl 5.8.0 was supposed
19804                 # to have this new fancy threads implementation but my
19805                 # perl doesn't have it" and from people trying to
19806                 # (re)install the threads module using CPAN.pm and
19807                 # CPAN.pm then offering to reinstall Perl 5.8.0,
19808                 # the threads.pm and threads/shared.pm will always be
19809                 # there, croaking informatively ("you need to rebuild
19810                 # all of Perl with threads, sorry") when threads haven't
19811                 # been compiled in.
19812                 # --jhi
19813                 avail_ext="$avail_ext $xxx"
19814                 ;;
19815         IPC/SysV|ipc/sysv)
19816                 : XXX Do we need a useipcsysv variable here
19817                 case "${d_msg}${d_sem}${d_shm}" in 
19818                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
19819                 esac
19820                 ;;
19821         *)      avail_ext="$avail_ext $xxx"
19822                 ;;
19823         esac
19824 done
19825
19826 set X $avail_ext
19827 shift
19828 avail_ext="$*"
19829
19830 : Now see which nonxs extensions are supported on this system.
19831 : For now assume all are.
19832 nonxs_ext=''
19833 for xxx in $nonxs_extensions ; do
19834         case "$xxx" in
19835         *)      nonxs_ext="$nonxs_ext $xxx"
19836                 ;;
19837         esac
19838 done
19839
19840 set X $nonxs_ext
19841 shift
19842 nonxs_ext="$*"
19843
19844 case $usedl in
19845 $define)
19846         $cat <<EOM
19847 A number of extensions are supplied with $package.  You may choose to
19848 compile these extensions for dynamic loading (the default), compile
19849 them into the $package executable (static loading), or not include
19850 them at all.  Answer "none" to include no extensions.
19851 Note that DynaLoader is always built and need not be mentioned here.
19852
19853 EOM
19854         case "$dynamic_ext" in
19855         '')
19856                 : Exclude those listed in static_ext
19857                 dflt=''
19858                 for xxx in $avail_ext; do
19859                         case " $static_ext " in
19860                         *" $xxx "*) ;;
19861                         *) dflt="$dflt $xxx" ;;
19862                         esac
19863                 done
19864                 set X $dflt
19865                 shift
19866                 dflt="$*"
19867                 ;;
19868         *)      dflt="$dynamic_ext"
19869                 # Perhaps we are reusing an old out-of-date config.sh.
19870                 case "$hint" in
19871                 previous)
19872                         if test X"$dynamic_ext" != X"$avail_ext"; then
19873                                 $cat <<EOM
19874 NOTICE:  Your previous config.sh list may be incorrect. 
19875 The extensions now available to you are 
19876         ${avail_ext}
19877 but the default list from your previous config.sh is
19878         ${dynamic_ext} 
19879
19880 EOM
19881                         fi
19882                         ;;
19883                 esac
19884                 ;;
19885         esac
19886         case "$dflt" in
19887         '')     dflt=none;;
19888         esac
19889         rp="What extensions do you wish to load dynamically?"
19890         . ./myread
19891         case "$ans" in
19892         none) dynamic_ext=' ' ;;
19893         *) dynamic_ext="$ans" ;;
19894         esac
19895
19896         case "$static_ext" in
19897         '')
19898                 : Exclude those already listed in dynamic linking
19899                 dflt=''
19900                 for xxx in $avail_ext; do
19901                         case " $dynamic_ext " in
19902                         *" $xxx "*) ;;
19903                         *) dflt="$dflt $xxx" ;;
19904                         esac
19905                 done
19906                 set X $dflt
19907                 shift
19908                 dflt="$*"
19909                 ;;
19910         *)  dflt="$static_ext" 
19911                 ;;
19912         esac
19913
19914         case "$dflt" in
19915         '')     dflt=none;;
19916         esac
19917         rp="What extensions do you wish to load statically?"
19918         . ./myread
19919         case "$ans" in
19920         none) static_ext=' ' ;;
19921         *) static_ext="$ans" ;;
19922         esac
19923         ;;
19924 *)
19925         $cat <<EOM
19926 A number of extensions are supplied with $package.  Answer "none" 
19927 to include no extensions. 
19928 Note that DynaLoader is always built and need not be mentioned here.
19929
19930 EOM
19931         case "$static_ext" in
19932         '') dflt="$avail_ext" ;;
19933         *)      dflt="$static_ext"
19934                 # Perhaps we are reusing an old out-of-date config.sh.
19935                 case "$hint" in
19936                 previous)
19937                         if test X"$static_ext" != X"$avail_ext"; then
19938                                 $cat <<EOM
19939 NOTICE:  Your previous config.sh list may be incorrect. 
19940 The extensions now available to you are 
19941         ${avail_ext}
19942 but the default list from your previous config.sh is
19943         ${static_ext} 
19944
19945 EOM
19946                         fi
19947                         ;;
19948                 esac
19949                 ;;
19950         esac
19951         : Exclude those that are not xs extensions
19952         case "$dflt" in
19953         '')     dflt=none;;
19954         esac
19955         rp="What extensions do you wish to include?"
19956         . ./myread
19957         case "$ans" in
19958         none) static_ext=' ' ;;
19959         *) static_ext="$ans" ;;
19960         esac
19961         ;;
19962 esac
19963 #        
19964 # Encode is a special case.  If we are building Encode as a static
19965 # extension, we need to explicitly list its subextensions as well.
19966 # For other nested extensions, this is handled automatically by
19967 # the appropriate Makefile.PL.
19968 case " $static_ext " in
19969         *" Encode "*) # Add the subextensions of Encode
19970         cd "$rsrc/ext"
19971         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
19972                 static_ext="$static_ext Encode/$xxx"
19973         done
19974         cd "$tdir"
19975         ;;
19976 esac
19977
19978 set X $dynamic_ext $static_ext $nonxs_ext
19979 shift
19980 extensions="$*"
19981
19982 : Remove libraries needed only for extensions
19983 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
19984 : The exception is SunOS 4.x, which needs them.
19985 case "${osname}X${osvers}" in
19986 sunos*X4*)
19987     perllibs="$libs"
19988     ;;
19989 *) case "$usedl" in
19990     $define|true|[yY]*)
19991             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
19992             shift
19993             perllibs="$*"
19994             ;;
19995     *)  perllibs="$libs"
19996             ;;
19997     esac
19998     ;;
19999 esac
20000
20001 : Remove build directory name from cppstdin so it can be used from
20002 : either the present location or the final installed location.
20003 echo " "
20004 : Get out of the UU directory to get correct path name.
20005 cd ..
20006 case "$cppstdin" in
20007 `pwd`/cppstdin)
20008         echo "Stripping down cppstdin path name"
20009         cppstdin=cppstdin
20010         ;;
20011 esac
20012 cd UU
20013
20014 : end of configuration questions
20015 echo " "
20016 echo "End of configuration questions."
20017 echo " "
20018
20019 : back to where it started
20020 if test -d ../UU; then
20021         cd ..
20022 fi
20023
20024 : configuration may be patched via a 'config.arch' file
20025 if $test -f config.arch; then
20026         echo "I see a config.arch file, loading it."
20027         . ./config.arch
20028 fi
20029
20030 : configuration may be patched via a 'config.over' file
20031 if $test -f config.over; then
20032         echo " "
20033         dflt=y
20034         rp='I see a config.over file.  Do you wish to load it?'
20035         . UU/myread
20036         case "$ans" in
20037         n*) echo "OK, I'll ignore it.";;
20038         *)      . ./config.over
20039                 echo "Configuration override changes have been loaded."
20040                 ;;
20041         esac
20042 fi
20043
20044 : in case they want portability, strip down executable paths
20045 case "$d_portable" in
20046 "$define")
20047         echo " "
20048         echo "Stripping down executable paths..." >&4
20049         for file in $loclist $trylist; do
20050                 eval temp=\$$file
20051                 eval $file=`basename $temp`
20052         done
20053         ;;
20054 esac
20055
20056 : create config.sh file
20057 echo " "
20058 echo "Creating config.sh..." >&4
20059 $spitshell <<EOT >config.sh
20060 $startsh
20061 #
20062 # This file was produced by running the Configure script. It holds all the
20063 # definitions figured out by Configure. Should you modify one of these values,
20064 # do not forget to propagate your changes by running "Configure -der". You may
20065 # instead choose to run each of the .SH files by yourself, or "Configure -S".
20066 #
20067
20068 # Package name      : $package
20069 # Source directory  : $src
20070 # Configuration time: $cf_time
20071 # Configured by     : $cf_by
20072 # Target system     : $myuname
20073
20074 Author='$Author'
20075 Date='$Date'
20076 Header='$Header'
20077 Id='$Id'
20078 Locker='$Locker'
20079 Log='$Log'
20080 Mcc='$Mcc'
20081 RCSfile='$RCSfile'
20082 Revision='$Revision'
20083 Source='$Source'
20084 State='$State'
20085 _a='$_a'
20086 _exe='$_exe'
20087 _o='$_o'
20088 afs='$afs'
20089 afsroot='$afsroot'
20090 alignbytes='$alignbytes'
20091 ansi2knr='$ansi2knr'
20092 aphostname='$aphostname'
20093 api_revision='$api_revision'
20094 api_subversion='$api_subversion'
20095 api_version='$api_version'
20096 api_versionstring='$api_versionstring'
20097 ar='$ar'
20098 archlib='$archlib'
20099 archlibexp='$archlibexp'
20100 archname64='$archname64'
20101 archname='$archname'
20102 archobjs='$archobjs'
20103 asctime_r_proto='$asctime_r_proto'
20104 awk='$awk'
20105 baserev='$baserev'
20106 bash='$bash'
20107 bin='$bin'
20108 binexp='$binexp'
20109 bison='$bison'
20110 byacc='$byacc'
20111 byteorder='$byteorder'
20112 c='$c'
20113 castflags='$castflags'
20114 cat='$cat'
20115 cc='$cc'
20116 cccdlflags='$cccdlflags'
20117 ccdlflags='$ccdlflags'
20118 ccflags='$ccflags'
20119 ccflags_uselargefiles='$ccflags_uselargefiles'
20120 ccname='$ccname'
20121 ccsymbols='$ccsymbols'
20122 ccversion='$ccversion'
20123 cf_by='$cf_by'
20124 cf_email='$cf_email'
20125 cf_time='$cf_time'
20126 charsize='$charsize'
20127 chgrp='$chgrp'
20128 chmod='$chmod'
20129 chown='$chown'
20130 clocktype='$clocktype'
20131 comm='$comm'
20132 compress='$compress'
20133 contains='$contains'
20134 cp='$cp'
20135 cpio='$cpio'
20136 cpp='$cpp'
20137 cpp_stuff='$cpp_stuff'
20138 cppccsymbols='$cppccsymbols'
20139 cppflags='$cppflags'
20140 cpplast='$cpplast'
20141 cppminus='$cppminus'
20142 cpprun='$cpprun'
20143 cppstdin='$cppstdin'
20144 cppsymbols='$cppsymbols'
20145 crypt_r_proto='$crypt_r_proto'
20146 cryptlib='$cryptlib'
20147 csh='$csh'
20148 ctermid_r_proto='$ctermid_r_proto'
20149 ctime_r_proto='$ctime_r_proto'
20150 d_Gconvert='$d_Gconvert'
20151 d_PRIEUldbl='$d_PRIEUldbl'
20152 d_PRIFUldbl='$d_PRIFUldbl'
20153 d_PRIGUldbl='$d_PRIGUldbl'
20154 d_PRIXU64='$d_PRIXU64'
20155 d_PRId64='$d_PRId64'
20156 d_PRIeldbl='$d_PRIeldbl'
20157 d_PRIfldbl='$d_PRIfldbl'
20158 d_PRIgldbl='$d_PRIgldbl'
20159 d_PRIi64='$d_PRIi64'
20160 d_PRIo64='$d_PRIo64'
20161 d_PRIu64='$d_PRIu64'
20162 d_PRIx64='$d_PRIx64'
20163 d_SCNfldbl='$d_SCNfldbl'
20164 d__fwalk='$d__fwalk'
20165 d_access='$d_access'
20166 d_accessx='$d_accessx'
20167 d_alarm='$d_alarm'
20168 d_archlib='$d_archlib'
20169 d_asctime_r='$d_asctime_r'
20170 d_atolf='$d_atolf'
20171 d_atoll='$d_atoll'
20172 d_attribut='$d_attribut'
20173 d_bcmp='$d_bcmp'
20174 d_bcopy='$d_bcopy'
20175 d_bsd='$d_bsd'
20176 d_bsdgetpgrp='$d_bsdgetpgrp'
20177 d_bsdsetpgrp='$d_bsdsetpgrp'
20178 d_bzero='$d_bzero'
20179 d_casti32='$d_casti32'
20180 d_castneg='$d_castneg'
20181 d_charvspr='$d_charvspr'
20182 d_chown='$d_chown'
20183 d_chroot='$d_chroot'
20184 d_chsize='$d_chsize'
20185 d_class='$d_class'
20186 d_closedir='$d_closedir'
20187 d_cmsghdr_s='$d_cmsghdr_s'
20188 d_const='$d_const'
20189 d_crypt='$d_crypt'
20190 d_crypt_r='$d_crypt_r'
20191 d_csh='$d_csh'
20192 d_ctermid_r='$d_ctermid_r'
20193 d_ctime_r='$d_ctime_r'
20194 d_cuserid='$d_cuserid'
20195 d_dbl_dig='$d_dbl_dig'
20196 d_dbminitproto='$d_dbminitproto'
20197 d_difftime='$d_difftime'
20198 d_dirfd='$d_dirfd'
20199 d_dirnamlen='$d_dirnamlen'
20200 d_dlerror='$d_dlerror'
20201 d_dlopen='$d_dlopen'
20202 d_dlsymun='$d_dlsymun'
20203 d_dosuid='$d_dosuid'
20204 d_drand48_r='$d_drand48_r'
20205 d_drand48proto='$d_drand48proto'
20206 d_dup2='$d_dup2'
20207 d_eaccess='$d_eaccess'
20208 d_endgrent='$d_endgrent'
20209 d_endgrent_r='$d_endgrent_r'
20210 d_endhent='$d_endhent'
20211 d_endhostent_r='$d_endhostent_r'
20212 d_endnent='$d_endnent'
20213 d_endnetent_r='$d_endnetent_r'
20214 d_endpent='$d_endpent'
20215 d_endprotoent_r='$d_endprotoent_r'
20216 d_endpwent='$d_endpwent'
20217 d_endpwent_r='$d_endpwent_r'
20218 d_endsent='$d_endsent'
20219 d_endservent_r='$d_endservent_r'
20220 d_eofnblk='$d_eofnblk'
20221 d_eunice='$d_eunice'
20222 d_fchdir='$d_fchdir'
20223 d_fchmod='$d_fchmod'
20224 d_fchown='$d_fchown'
20225 d_fcntl='$d_fcntl'
20226 d_fcntl_can_lock='$d_fcntl_can_lock'
20227 d_fd_macros='$d_fd_macros'
20228 d_fd_set='$d_fd_set'
20229 d_fds_bits='$d_fds_bits'
20230 d_fgetpos='$d_fgetpos'
20231 d_finite='$d_finite'
20232 d_finitel='$d_finitel'
20233 d_flexfnam='$d_flexfnam'
20234 d_flock='$d_flock'
20235 d_flockproto='$d_flockproto'
20236 d_fork='$d_fork'
20237 d_fp_class='$d_fp_class'
20238 d_fpathconf='$d_fpathconf'
20239 d_fpclass='$d_fpclass'
20240 d_fpclassify='$d_fpclassify'
20241 d_fpclassl='$d_fpclassl'
20242 d_fpos64_t='$d_fpos64_t'
20243 d_frexpl='$d_frexpl'
20244 d_fs_data_s='$d_fs_data_s'
20245 d_fseeko='$d_fseeko'
20246 d_fsetpos='$d_fsetpos'
20247 d_fstatfs='$d_fstatfs'
20248 d_fstatvfs='$d_fstatvfs'
20249 d_fsync='$d_fsync'
20250 d_ftello='$d_ftello'
20251 d_ftime='$d_ftime'
20252 d_getcwd='$d_getcwd'
20253 d_getespwnam='$d_getespwnam'
20254 d_getfsstat='$d_getfsstat'
20255 d_getgrent='$d_getgrent'
20256 d_getgrent_r='$d_getgrent_r'
20257 d_getgrgid_r='$d_getgrgid_r'
20258 d_getgrnam_r='$d_getgrnam_r'
20259 d_getgrps='$d_getgrps'
20260 d_gethbyaddr='$d_gethbyaddr'
20261 d_gethbyname='$d_gethbyname'
20262 d_gethent='$d_gethent'
20263 d_gethname='$d_gethname'
20264 d_gethostbyaddr_r='$d_gethostbyaddr_r'
20265 d_gethostbyname_r='$d_gethostbyname_r'
20266 d_gethostent_r='$d_gethostent_r'
20267 d_gethostprotos='$d_gethostprotos'
20268 d_getitimer='$d_getitimer'
20269 d_getlogin='$d_getlogin'
20270 d_getlogin_r='$d_getlogin_r'
20271 d_getmnt='$d_getmnt'
20272 d_getmntent='$d_getmntent'
20273 d_getnbyaddr='$d_getnbyaddr'
20274 d_getnbyname='$d_getnbyname'
20275 d_getnent='$d_getnent'
20276 d_getnetbyaddr_r='$d_getnetbyaddr_r'
20277 d_getnetbyname_r='$d_getnetbyname_r'
20278 d_getnetent_r='$d_getnetent_r'
20279 d_getnetprotos='$d_getnetprotos'
20280 d_getpagsz='$d_getpagsz'
20281 d_getpbyname='$d_getpbyname'
20282 d_getpbynumber='$d_getpbynumber'
20283 d_getpent='$d_getpent'
20284 d_getpgid='$d_getpgid'
20285 d_getpgrp2='$d_getpgrp2'
20286 d_getpgrp='$d_getpgrp'
20287 d_getppid='$d_getppid'
20288 d_getprior='$d_getprior'
20289 d_getprotobyname_r='$d_getprotobyname_r'
20290 d_getprotobynumber_r='$d_getprotobynumber_r'
20291 d_getprotoent_r='$d_getprotoent_r'
20292 d_getprotoprotos='$d_getprotoprotos'
20293 d_getprpwnam='$d_getprpwnam'
20294 d_getpwent='$d_getpwent'
20295 d_getpwent_r='$d_getpwent_r'
20296 d_getpwnam_r='$d_getpwnam_r'
20297 d_getpwuid_r='$d_getpwuid_r'
20298 d_getsbyname='$d_getsbyname'
20299 d_getsbyport='$d_getsbyport'
20300 d_getsent='$d_getsent'
20301 d_getservbyname_r='$d_getservbyname_r'
20302 d_getservbyport_r='$d_getservbyport_r'
20303 d_getservent_r='$d_getservent_r'
20304 d_getservprotos='$d_getservprotos'
20305 d_getspnam='$d_getspnam'
20306 d_getspnam_r='$d_getspnam_r'
20307 d_gettimeod='$d_gettimeod'
20308 d_gmtime_r='$d_gmtime_r'
20309 d_gnulibc='$d_gnulibc'
20310 d_grpasswd='$d_grpasswd'
20311 d_hasmntopt='$d_hasmntopt'
20312 d_htonl='$d_htonl'
20313 d_index='$d_index'
20314 d_inetaton='$d_inetaton'
20315 d_int64_t='$d_int64_t'
20316 d_isascii='$d_isascii'
20317 d_isfinite='$d_isfinite'
20318 d_isinf='$d_isinf'
20319 d_isnan='$d_isnan'
20320 d_isnanl='$d_isnanl'
20321 d_killpg='$d_killpg'
20322 d_lchown='$d_lchown'
20323 d_ldbl_dig='$d_ldbl_dig'
20324 d_link='$d_link'
20325 d_localtime_r='$d_localtime_r'
20326 d_locconv='$d_locconv'
20327 d_lockf='$d_lockf'
20328 d_longdbl='$d_longdbl'
20329 d_longlong='$d_longlong'
20330 d_lseekproto='$d_lseekproto'
20331 d_lstat='$d_lstat'
20332 d_madvise='$d_madvise'
20333 d_mblen='$d_mblen'
20334 d_mbstowcs='$d_mbstowcs'
20335 d_mbtowc='$d_mbtowc'
20336 d_memchr='$d_memchr'
20337 d_memcmp='$d_memcmp'
20338 d_memcpy='$d_memcpy'
20339 d_memmove='$d_memmove'
20340 d_memset='$d_memset'
20341 d_mkdir='$d_mkdir'
20342 d_mkdtemp='$d_mkdtemp'
20343 d_mkfifo='$d_mkfifo'
20344 d_mkstemp='$d_mkstemp'
20345 d_mkstemps='$d_mkstemps'
20346 d_mktime='$d_mktime'
20347 d_mmap='$d_mmap'
20348 d_modfl='$d_modfl'
20349 d_modfl_pow32_bug='$d_modfl_pow32_bug'
20350 d_modflproto='$d_modflproto'
20351 d_mprotect='$d_mprotect'
20352 d_msg='$d_msg'
20353 d_msg_ctrunc='$d_msg_ctrunc'
20354 d_msg_dontroute='$d_msg_dontroute'
20355 d_msg_oob='$d_msg_oob'
20356 d_msg_peek='$d_msg_peek'
20357 d_msg_proxy='$d_msg_proxy'
20358 d_msgctl='$d_msgctl'
20359 d_msgget='$d_msgget'
20360 d_msghdr_s='$d_msghdr_s'
20361 d_msgrcv='$d_msgrcv'
20362 d_msgsnd='$d_msgsnd'
20363 d_msync='$d_msync'
20364 d_munmap='$d_munmap'
20365 d_mymalloc='$d_mymalloc'
20366 d_nanosleep='$d_nanosleep'
20367 d_nice='$d_nice'
20368 d_nl_langinfo='$d_nl_langinfo'
20369 d_nv_preserves_uv='$d_nv_preserves_uv'
20370 d_off64_t='$d_off64_t'
20371 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
20372 d_oldpthreads='$d_oldpthreads'
20373 d_oldsock='$d_oldsock'
20374 d_open3='$d_open3'
20375 d_pathconf='$d_pathconf'
20376 d_pause='$d_pause'
20377 d_perl_otherlibdirs='$d_perl_otherlibdirs'
20378 d_phostname='$d_phostname'
20379 d_pipe='$d_pipe'
20380 d_poll='$d_poll'
20381 d_portable='$d_portable'
20382 d_procselfexe='$d_procselfexe'
20383 d_pthread_atfork='$d_pthread_atfork'
20384 d_pthread_yield='$d_pthread_yield'
20385 d_pwage='$d_pwage'
20386 d_pwchange='$d_pwchange'
20387 d_pwclass='$d_pwclass'
20388 d_pwcomment='$d_pwcomment'
20389 d_pwexpire='$d_pwexpire'
20390 d_pwgecos='$d_pwgecos'
20391 d_pwpasswd='$d_pwpasswd'
20392 d_pwquota='$d_pwquota'
20393 d_qgcvt='$d_qgcvt'
20394 d_quad='$d_quad'
20395 d_random_r='$d_random_r'
20396 d_readdir64_r='$d_readdir64_r'
20397 d_readdir='$d_readdir'
20398 d_readdir_r='$d_readdir_r'
20399 d_readlink='$d_readlink'
20400 d_readv='$d_readv'
20401 d_recvmsg='$d_recvmsg'
20402 d_rename='$d_rename'
20403 d_rewinddir='$d_rewinddir'
20404 d_rmdir='$d_rmdir'
20405 d_safebcpy='$d_safebcpy'
20406 d_safemcpy='$d_safemcpy'
20407 d_sanemcmp='$d_sanemcmp'
20408 d_sbrkproto='$d_sbrkproto'
20409 d_sched_yield='$d_sched_yield'
20410 d_scm_rights='$d_scm_rights'
20411 d_seekdir='$d_seekdir'
20412 d_select='$d_select'
20413 d_sem='$d_sem'
20414 d_semctl='$d_semctl'
20415 d_semctl_semid_ds='$d_semctl_semid_ds'
20416 d_semctl_semun='$d_semctl_semun'
20417 d_semget='$d_semget'
20418 d_semop='$d_semop'
20419 d_sendmsg='$d_sendmsg'
20420 d_setegid='$d_setegid'
20421 d_seteuid='$d_seteuid'
20422 d_setgrent='$d_setgrent'
20423 d_setgrent_r='$d_setgrent_r'
20424 d_setgrps='$d_setgrps'
20425 d_sethent='$d_sethent'
20426 d_sethostent_r='$d_sethostent_r'
20427 d_setitimer='$d_setitimer'
20428 d_setlinebuf='$d_setlinebuf'
20429 d_setlocale='$d_setlocale'
20430 d_setlocale_r='$d_setlocale_r'
20431 d_setnent='$d_setnent'
20432 d_setnetent_r='$d_setnetent_r'
20433 d_setpent='$d_setpent'
20434 d_setpgid='$d_setpgid'
20435 d_setpgrp2='$d_setpgrp2'
20436 d_setpgrp='$d_setpgrp'
20437 d_setprior='$d_setprior'
20438 d_setproctitle='$d_setproctitle'
20439 d_setprotoent_r='$d_setprotoent_r'
20440 d_setpwent='$d_setpwent'
20441 d_setpwent_r='$d_setpwent_r'
20442 d_setregid='$d_setregid'
20443 d_setresgid='$d_setresgid'
20444 d_setresuid='$d_setresuid'
20445 d_setreuid='$d_setreuid'
20446 d_setrgid='$d_setrgid'
20447 d_setruid='$d_setruid'
20448 d_setsent='$d_setsent'
20449 d_setservent_r='$d_setservent_r'
20450 d_setsid='$d_setsid'
20451 d_setvbuf='$d_setvbuf'
20452 d_sfio='$d_sfio'
20453 d_shm='$d_shm'
20454 d_shmat='$d_shmat'
20455 d_shmatprototype='$d_shmatprototype'
20456 d_shmctl='$d_shmctl'
20457 d_shmdt='$d_shmdt'
20458 d_shmget='$d_shmget'
20459 d_sigaction='$d_sigaction'
20460 d_sigprocmask='$d_sigprocmask'
20461 d_sigsetjmp='$d_sigsetjmp'
20462 d_sockatmark='$d_sockatmark'
20463 d_sockatmarkproto='$d_sockatmarkproto'
20464 d_socket='$d_socket'
20465 d_socklen_t='$d_socklen_t'
20466 d_sockpair='$d_sockpair'
20467 d_socks5_init='$d_socks5_init'
20468 d_sqrtl='$d_sqrtl'
20469 d_srand48_r='$d_srand48_r'
20470 d_srandom_r='$d_srandom_r'
20471 d_sresgproto='$d_sresgproto'
20472 d_sresuproto='$d_sresuproto'
20473 d_statblks='$d_statblks'
20474 d_statfs_f_flags='$d_statfs_f_flags'
20475 d_statfs_s='$d_statfs_s'
20476 d_statvfs='$d_statvfs'
20477 d_stdio_cnt_lval='$d_stdio_cnt_lval'
20478 d_stdio_ptr_lval='$d_stdio_ptr_lval'
20479 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
20480 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
20481 d_stdio_stream_array='$d_stdio_stream_array'
20482 d_stdiobase='$d_stdiobase'
20483 d_stdstdio='$d_stdstdio'
20484 d_strchr='$d_strchr'
20485 d_strcoll='$d_strcoll'
20486 d_strctcpy='$d_strctcpy'
20487 d_strerrm='$d_strerrm'
20488 d_strerror='$d_strerror'
20489 d_strerror_r='$d_strerror_r'
20490 d_strftime='$d_strftime'
20491 d_strtod='$d_strtod'
20492 d_strtol='$d_strtol'
20493 d_strtold='$d_strtold'
20494 d_strtoll='$d_strtoll'
20495 d_strtoq='$d_strtoq'
20496 d_strtoul='$d_strtoul'
20497 d_strtoull='$d_strtoull'
20498 d_strtouq='$d_strtouq'
20499 d_strxfrm='$d_strxfrm'
20500 d_suidsafe='$d_suidsafe'
20501 d_symlink='$d_symlink'
20502 d_syscall='$d_syscall'
20503 d_syscallproto='$d_syscallproto'
20504 d_sysconf='$d_sysconf'
20505 d_sysernlst='$d_sysernlst'
20506 d_syserrlst='$d_syserrlst'
20507 d_system='$d_system'
20508 d_tcgetpgrp='$d_tcgetpgrp'
20509 d_tcsetpgrp='$d_tcsetpgrp'
20510 d_telldir='$d_telldir'
20511 d_telldirproto='$d_telldirproto'
20512 d_time='$d_time'
20513 d_times='$d_times'
20514 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
20515 d_tm_tm_zone='$d_tm_tm_zone'
20516 d_tmpnam_r='$d_tmpnam_r'
20517 d_truncate='$d_truncate'
20518 d_ttyname_r='$d_ttyname_r'
20519 d_tzname='$d_tzname'
20520 d_u32align='$d_u32align'
20521 d_ualarm='$d_ualarm'
20522 d_umask='$d_umask'
20523 d_uname='$d_uname'
20524 d_union_semun='$d_union_semun'
20525 d_unordered='$d_unordered'
20526 d_usleep='$d_usleep'
20527 d_usleepproto='$d_usleepproto'
20528 d_ustat='$d_ustat'
20529 d_vendorarch='$d_vendorarch'
20530 d_vendorbin='$d_vendorbin'
20531 d_vendorlib='$d_vendorlib'
20532 d_vendorscript='$d_vendorscript'
20533 d_vfork='$d_vfork'
20534 d_void_closedir='$d_void_closedir'
20535 d_voidsig='$d_voidsig'
20536 d_voidtty='$d_voidtty'
20537 d_volatile='$d_volatile'
20538 d_vprintf='$d_vprintf'
20539 d_wait4='$d_wait4'
20540 d_waitpid='$d_waitpid'
20541 d_wcstombs='$d_wcstombs'
20542 d_wctomb='$d_wctomb'
20543 d_writev='$d_writev'
20544 d_xenix='$d_xenix'
20545 date='$date'
20546 db_hashtype='$db_hashtype'
20547 db_prefixtype='$db_prefixtype'
20548 db_version_major='$db_version_major'
20549 db_version_minor='$db_version_minor'
20550 db_version_patch='$db_version_patch'
20551 defvoidused='$defvoidused'
20552 direntrytype='$direntrytype'
20553 dlext='$dlext'
20554 dlsrc='$dlsrc'
20555 doublesize='$doublesize'
20556 drand01='$drand01'
20557 drand48_r_proto='$drand48_r_proto'
20558 dynamic_ext='$dynamic_ext'
20559 eagain='$eagain'
20560 ebcdic='$ebcdic'
20561 echo='$echo'
20562 egrep='$egrep'
20563 emacs='$emacs'
20564 endgrent_r_proto='$endgrent_r_proto'
20565 endhostent_r_proto='$endhostent_r_proto'
20566 endnetent_r_proto='$endnetent_r_proto'
20567 endprotoent_r_proto='$endprotoent_r_proto'
20568 endpwent_r_proto='$endpwent_r_proto'
20569 endservent_r_proto='$endservent_r_proto'
20570 eunicefix='$eunicefix'
20571 exe_ext='$exe_ext'
20572 expr='$expr'
20573 extensions='$extensions'
20574 extras='$extras'
20575 fflushNULL='$fflushNULL'
20576 fflushall='$fflushall'
20577 find='$find'
20578 firstmakefile='$firstmakefile'
20579 flex='$flex'
20580 fpossize='$fpossize'
20581 fpostype='$fpostype'
20582 freetype='$freetype'
20583 from='$from'
20584 full_ar='$full_ar'
20585 full_csh='$full_csh'
20586 full_sed='$full_sed'
20587 gccansipedantic='$gccansipedantic'
20588 gccosandvers='$gccosandvers'
20589 gccversion='$gccversion'
20590 getgrent_r_proto='$getgrent_r_proto'
20591 getgrgid_r_proto='$getgrgid_r_proto'
20592 getgrnam_r_proto='$getgrnam_r_proto'
20593 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
20594 gethostbyname_r_proto='$gethostbyname_r_proto'
20595 gethostent_r_proto='$gethostent_r_proto'
20596 getlogin_r_proto='$getlogin_r_proto'
20597 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
20598 getnetbyname_r_proto='$getnetbyname_r_proto'
20599 getnetent_r_proto='$getnetent_r_proto'
20600 getprotobyname_r_proto='$getprotobyname_r_proto'
20601 getprotobynumber_r_proto='$getprotobynumber_r_proto'
20602 getprotoent_r_proto='$getprotoent_r_proto'
20603 getpwent_r_proto='$getpwent_r_proto'
20604 getpwnam_r_proto='$getpwnam_r_proto'
20605 getpwuid_r_proto='$getpwuid_r_proto'
20606 getservbyname_r_proto='$getservbyname_r_proto'
20607 getservbyport_r_proto='$getservbyport_r_proto'
20608 getservent_r_proto='$getservent_r_proto'
20609 getspnam_r_proto='$getspnam_r_proto'
20610 gidformat='$gidformat'
20611 gidsign='$gidsign'
20612 gidsize='$gidsize'
20613 gidtype='$gidtype'
20614 glibpth='$glibpth'
20615 gmake='$gmake'
20616 gmtime_r_proto='$gmtime_r_proto'
20617 gnulibc_version='$gnulibc_version'
20618 grep='$grep'
20619 groupcat='$groupcat'
20620 groupstype='$groupstype'
20621 gzip='$gzip'
20622 h_fcntl='$h_fcntl'
20623 h_sysfile='$h_sysfile'
20624 hint='$hint'
20625 hostcat='$hostcat'
20626 html1dir='$html1dir'
20627 html1direxp='$html1direxp'
20628 html3dir='$html3dir'
20629 html3direxp='$html3direxp'
20630 i16size='$i16size'
20631 i16type='$i16type'
20632 i32size='$i32size'
20633 i32type='$i32type'
20634 i64size='$i64size'
20635 i64type='$i64type'
20636 i8size='$i8size'
20637 i8type='$i8type'
20638 i_arpainet='$i_arpainet'
20639 i_bsdioctl='$i_bsdioctl'
20640 i_crypt='$i_crypt'
20641 i_db='$i_db'
20642 i_dbm='$i_dbm'
20643 i_dirent='$i_dirent'
20644 i_dld='$i_dld'
20645 i_dlfcn='$i_dlfcn'
20646 i_fcntl='$i_fcntl'
20647 i_float='$i_float'
20648 i_fp='$i_fp'
20649 i_fp_class='$i_fp_class'
20650 i_gdbm='$i_gdbm'
20651 i_grp='$i_grp'
20652 i_ieeefp='$i_ieeefp'
20653 i_inttypes='$i_inttypes'
20654 i_langinfo='$i_langinfo'
20655 i_libutil='$i_libutil'
20656 i_limits='$i_limits'
20657 i_locale='$i_locale'
20658 i_machcthr='$i_machcthr'
20659 i_malloc='$i_malloc'
20660 i_math='$i_math'
20661 i_memory='$i_memory'
20662 i_mntent='$i_mntent'
20663 i_ndbm='$i_ndbm'
20664 i_netdb='$i_netdb'
20665 i_neterrno='$i_neterrno'
20666 i_netinettcp='$i_netinettcp'
20667 i_niin='$i_niin'
20668 i_poll='$i_poll'
20669 i_prot='$i_prot'
20670 i_pthread='$i_pthread'
20671 i_pwd='$i_pwd'
20672 i_rpcsvcdbm='$i_rpcsvcdbm'
20673 i_sfio='$i_sfio'
20674 i_sgtty='$i_sgtty'
20675 i_shadow='$i_shadow'
20676 i_socks='$i_socks'
20677 i_stdarg='$i_stdarg'
20678 i_stddef='$i_stddef'
20679 i_stdlib='$i_stdlib'
20680 i_string='$i_string'
20681 i_sunmath='$i_sunmath'
20682 i_sysaccess='$i_sysaccess'
20683 i_sysdir='$i_sysdir'
20684 i_sysfile='$i_sysfile'
20685 i_sysfilio='$i_sysfilio'
20686 i_sysin='$i_sysin'
20687 i_sysioctl='$i_sysioctl'
20688 i_syslog='$i_syslog'
20689 i_sysmman='$i_sysmman'
20690 i_sysmode='$i_sysmode'
20691 i_sysmount='$i_sysmount'
20692 i_sysndir='$i_sysndir'
20693 i_sysparam='$i_sysparam'
20694 i_sysresrc='$i_sysresrc'
20695 i_syssecrt='$i_syssecrt'
20696 i_sysselct='$i_sysselct'
20697 i_syssockio='$i_syssockio'
20698 i_sysstat='$i_sysstat'
20699 i_sysstatfs='$i_sysstatfs'
20700 i_sysstatvfs='$i_sysstatvfs'
20701 i_systime='$i_systime'
20702 i_systimek='$i_systimek'
20703 i_systimes='$i_systimes'
20704 i_systypes='$i_systypes'
20705 i_sysuio='$i_sysuio'
20706 i_sysun='$i_sysun'
20707 i_sysutsname='$i_sysutsname'
20708 i_sysvfs='$i_sysvfs'
20709 i_syswait='$i_syswait'
20710 i_termio='$i_termio'
20711 i_termios='$i_termios'
20712 i_time='$i_time'
20713 i_unistd='$i_unistd'
20714 i_ustat='$i_ustat'
20715 i_utime='$i_utime'
20716 i_values='$i_values'
20717 i_varargs='$i_varargs'
20718 i_varhdr='$i_varhdr'
20719 i_vfork='$i_vfork'
20720 ignore_versioned_solibs='$ignore_versioned_solibs'
20721 inc_version_list='$inc_version_list'
20722 inc_version_list_init='$inc_version_list_init'
20723 incpath='$incpath'
20724 inews='$inews'
20725 installarchlib='$installarchlib'
20726 installbin='$installbin'
20727 installhtml1dir='$installhtml1dir'
20728 installhtml3dir='$installhtml3dir'
20729 installman1dir='$installman1dir'
20730 installman3dir='$installman3dir'
20731 installprefix='$installprefix'
20732 installprefixexp='$installprefixexp'
20733 installprivlib='$installprivlib'
20734 installscript='$installscript'
20735 installsitearch='$installsitearch'
20736 installsitebin='$installsitebin'
20737 installsitehtml1='$installsitehtml1'
20738 installsitehtml3='$installsitehtml3'
20739 installsitelib='$installsitelib'
20740 installsiteman1='$installsiteman1'
20741 installsiteman3='$installsiteman3'
20742 installsitescript='$installsitescript'
20743 installstyle='$installstyle'
20744 installusrbinperl='$installusrbinperl'
20745 installvendorarch='$installvendorarch'
20746 installvendorbin='$installvendorbin'
20747 installvendorhtml1='$installvendorhtml1'
20748 installvendorhtml3='$installvendorhtml3'
20749 installvendorlib='$installvendorlib'
20750 installvendorman1='$installvendorman1'
20751 installvendorman3='$installvendorman3'
20752 installvendorscript='$installvendorscript'
20753 intsize='$intsize'
20754 issymlink='$issymlink'
20755 ivdformat='$ivdformat'
20756 ivsize='$ivsize'
20757 ivtype='$ivtype'
20758 known_extensions='$known_extensions'
20759 ksh='$ksh'
20760 ld='$ld'
20761 lddlflags='$lddlflags'
20762 ldflags='$ldflags'
20763 ldflags_uselargefiles='$ldflags_uselargefiles'
20764 ldlibpthname='$ldlibpthname'
20765 less='$less'
20766 lib_ext='$lib_ext'
20767 libc='$libc'
20768 libperl='$libperl'
20769 libpth='$libpth'
20770 libs='$libs'
20771 libsdirs='$libsdirs'
20772 libsfiles='$libsfiles'
20773 libsfound='$libsfound'
20774 libspath='$libspath'
20775 libswanted='$libswanted'
20776 libswanted_uselargefiles='$libswanted_uselargefiles'
20777 line='$line'
20778 lint='$lint'
20779 lkflags='$lkflags'
20780 ln='$ln'
20781 lns='$lns'
20782 localtime_r_proto='$localtime_r_proto'
20783 locincpth='$locincpth'
20784 loclibpth='$loclibpth'
20785 longdblsize='$longdblsize'
20786 longlongsize='$longlongsize'
20787 longsize='$longsize'
20788 lp='$lp'
20789 lpr='$lpr'
20790 ls='$ls'
20791 lseeksize='$lseeksize'
20792 lseektype='$lseektype'
20793 mail='$mail'
20794 mailx='$mailx'
20795 make='$make'
20796 make_set_make='$make_set_make'
20797 mallocobj='$mallocobj'
20798 mallocsrc='$mallocsrc'
20799 malloctype='$malloctype'
20800 man1dir='$man1dir'
20801 man1direxp='$man1direxp'
20802 man1ext='$man1ext'
20803 man3dir='$man3dir'
20804 man3direxp='$man3direxp'
20805 man3ext='$man3ext'
20806 mips_type='$mips_type'
20807 mkdir='$mkdir'
20808 mmaptype='$mmaptype'
20809 modetype='$modetype'
20810 more='$more'
20811 multiarch='$multiarch'
20812 mv='$mv'
20813 myarchname='$myarchname'
20814 mydomain='$mydomain'
20815 myhostname='$myhostname'
20816 myuname='$myuname'
20817 n='$n'
20818 need_va_copy='$need_va_copy'
20819 netdb_hlen_type='$netdb_hlen_type'
20820 netdb_host_type='$netdb_host_type'
20821 netdb_name_type='$netdb_name_type'
20822 netdb_net_type='$netdb_net_type'
20823 nm='$nm'
20824 nm_opt='$nm_opt'
20825 nm_so_opt='$nm_so_opt'
20826 nonxs_ext='$nonxs_ext'
20827 nroff='$nroff'
20828 nvEUformat='$nvEUformat'
20829 nvFUformat='$nvFUformat'
20830 nvGUformat='$nvGUformat'
20831 nv_preserves_uv_bits='$nv_preserves_uv_bits'
20832 nveformat='$nveformat'
20833 nvfformat='$nvfformat'
20834 nvgformat='$nvgformat'
20835 nvsize='$nvsize'
20836 nvtype='$nvtype'
20837 o_nonblock='$o_nonblock'
20838 obj_ext='$obj_ext'
20839 old_pthread_create_joinable='$old_pthread_create_joinable'
20840 optimize='$optimize'
20841 orderlib='$orderlib'
20842 osname='$osname'
20843 osvers='$osvers'
20844 otherlibdirs='$otherlibdirs'
20845 package='$package'
20846 pager='$pager'
20847 passcat='$passcat'
20848 patchlevel='$patchlevel'
20849 path_sep='$path_sep'
20850 perl5='$perl5'
20851 perl='$perl'
20852 perl_patchlevel='$perl_patchlevel'
20853 perladmin='$perladmin'
20854 perllibs='$perllibs'
20855 perlpath='$perlpath'
20856 pg='$pg'
20857 phostname='$phostname'
20858 pidtype='$pidtype'
20859 plibpth='$plibpth'
20860 pm_apiversion='$pm_apiversion'
20861 pmake='$pmake'
20862 pr='$pr'
20863 prefix='$prefix'
20864 prefixexp='$prefixexp'
20865 privlib='$privlib'
20866 privlibexp='$privlibexp'
20867 procselfexe='$procselfexe'
20868 prototype='$prototype'
20869 ptrsize='$ptrsize'
20870 quadkind='$quadkind'
20871 quadtype='$quadtype'
20872 randbits='$randbits'
20873 randfunc='$randfunc'
20874 random_r_proto='$random_r_proto'
20875 randseedtype='$randseedtype'
20876 ranlib='$ranlib'
20877 rd_nodata='$rd_nodata'
20878 readdir64_r_proto='$readdir64_r_proto'
20879 readdir_r_proto='$readdir_r_proto'
20880 revision='$revision'
20881 rm='$rm'
20882 rmail='$rmail'
20883 run='$run'
20884 runnm='$runnm'
20885 sPRIEUldbl='$sPRIEUldbl'
20886 sPRIFUldbl='$sPRIFUldbl'
20887 sPRIGUldbl='$sPRIGUldbl'
20888 sPRIXU64='$sPRIXU64'
20889 sPRId64='$sPRId64'
20890 sPRIeldbl='$sPRIeldbl'
20891 sPRIfldbl='$sPRIfldbl'
20892 sPRIgldbl='$sPRIgldbl'
20893 sPRIi64='$sPRIi64'
20894 sPRIo64='$sPRIo64'
20895 sPRIu64='$sPRIu64'
20896 sPRIx64='$sPRIx64'
20897 sSCNfldbl='$sSCNfldbl'
20898 sched_yield='$sched_yield'
20899 scriptdir='$scriptdir'
20900 scriptdirexp='$scriptdirexp'
20901 sed='$sed'
20902 seedfunc='$seedfunc'
20903 selectminbits='$selectminbits'
20904 selecttype='$selecttype'
20905 sendmail='$sendmail'
20906 setgrent_r_proto='$setgrent_r_proto'
20907 sethostent_r_proto='$sethostent_r_proto'
20908 setlocale_r_proto='$setlocale_r_proto'
20909 setnetent_r_proto='$setnetent_r_proto'
20910 setprotoent_r_proto='$setprotoent_r_proto'
20911 setpwent_r_proto='$setpwent_r_proto'
20912 setservent_r_proto='$setservent_r_proto'
20913 sh='$sh'
20914 shar='$shar'
20915 sharpbang='$sharpbang'
20916 shmattype='$shmattype'
20917 shortsize='$shortsize'
20918 shrpenv='$shrpenv'
20919 shsharp='$shsharp'
20920 sig_count='$sig_count'
20921 sig_name='$sig_name'
20922 sig_name_init='$sig_name_init'
20923 sig_num='$sig_num'
20924 sig_num_init='$sig_num_init'
20925 sig_size='$sig_size'
20926 signal_t='$signal_t'
20927 sitearch='$sitearch'
20928 sitearchexp='$sitearchexp'
20929 sitebin='$sitebin'
20930 sitebinexp='$sitebinexp'
20931 sitehtml1='$sitehtml1'
20932 sitehtml1exp='$sitehtml1exp'
20933 sitehtml3='$sitehtml3'
20934 sitehtml3exp='$sitehtml3exp'
20935 sitelib='$sitelib'
20936 sitelib_stem='$sitelib_stem'
20937 sitelibexp='$sitelibexp'
20938 siteman1='$siteman1'
20939 siteman1exp='$siteman1exp'
20940 siteman3='$siteman3'
20941 siteman3exp='$siteman3exp'
20942 siteprefix='$siteprefix'
20943 siteprefixexp='$siteprefixexp'
20944 sitescript='$sitescript'
20945 sitescriptexp='$sitescriptexp'
20946 sizesize='$sizesize'
20947 sizetype='$sizetype'
20948 sleep='$sleep'
20949 smail='$smail'
20950 so='$so'
20951 sockethdr='$sockethdr'
20952 socketlib='$socketlib'
20953 socksizetype='$socksizetype'
20954 sort='$sort'
20955 spackage='$spackage'
20956 spitshell='$spitshell'
20957 srand48_r_proto='$srand48_r_proto'
20958 srandom_r_proto='$srandom_r_proto'
20959 src='$src'
20960 ssizetype='$ssizetype'
20961 startperl='$startperl'
20962 startsh='$startsh'
20963 static_ext='$static_ext'
20964 stdchar='$stdchar'
20965 stdio_base='$stdio_base'
20966 stdio_bufsiz='$stdio_bufsiz'
20967 stdio_cnt='$stdio_cnt'
20968 stdio_filbuf='$stdio_filbuf'
20969 stdio_ptr='$stdio_ptr'
20970 stdio_stream_array='$stdio_stream_array'
20971 strerror_r_proto='$strerror_r_proto'
20972 strings='$strings'
20973 submit='$submit'
20974 subversion='$subversion'
20975 sysman='$sysman'
20976 tail='$tail'
20977 tar='$tar'
20978 targetarch='$targetarch'
20979 tbl='$tbl'
20980 tee='$tee'
20981 test='$test'
20982 timeincl='$timeincl'
20983 timetype='$timetype'
20984 tmpnam_r_proto='$tmpnam_r_proto'
20985 to='$to'
20986 touch='$touch'
20987 tr='$tr'
20988 trnl='$trnl'
20989 troff='$troff'
20990 ttyname_r_proto='$ttyname_r_proto'
20991 u16size='$u16size'
20992 u16type='$u16type'
20993 u32size='$u32size'
20994 u32type='$u32type'
20995 u64size='$u64size'
20996 u64type='$u64type'
20997 u8size='$u8size'
20998 u8type='$u8type'
20999 uidformat='$uidformat'
21000 uidsign='$uidsign'
21001 uidsize='$uidsize'
21002 uidtype='$uidtype'
21003 uname='$uname'
21004 uniq='$uniq'
21005 uquadtype='$uquadtype'
21006 use5005threads='$use5005threads'
21007 use64bitall='$use64bitall'
21008 use64bitint='$use64bitint'
21009 usecrosscompile='$usecrosscompile'
21010 usedl='$usedl'
21011 useithreads='$useithreads'
21012 uselargefiles='$uselargefiles'
21013 uselongdouble='$uselongdouble'
21014 usemorebits='$usemorebits'
21015 usemultiplicity='$usemultiplicity'
21016 usemymalloc='$usemymalloc'
21017 usenm='$usenm'
21018 useopcode='$useopcode'
21019 useperlio='$useperlio'
21020 useposix='$useposix'
21021 usereentrant='$usereentrant'
21022 usesfio='$usesfio'
21023 useshrplib='$useshrplib'
21024 usesocks='$usesocks'
21025 usethreads='$usethreads'
21026 usevendorprefix='$usevendorprefix'
21027 usevfork='$usevfork'
21028 usrinc='$usrinc'
21029 uuname='$uuname'
21030 uvXUformat='$uvXUformat'
21031 uvoformat='$uvoformat'
21032 uvsize='$uvsize'
21033 uvtype='$uvtype'
21034 uvuformat='$uvuformat'
21035 uvxformat='$uvxformat'
21036 vendorarch='$vendorarch'
21037 vendorarchexp='$vendorarchexp'
21038 vendorbin='$vendorbin'
21039 vendorbinexp='$vendorbinexp'
21040 vendorhtml1='$vendorhtml1'
21041 vendorhtml1exp='$vendorhtml1exp'
21042 vendorhtml3='$vendorhtml3'
21043 vendorhtml3exp='$vendorhtml3exp'
21044 vendorlib='$vendorlib'
21045 vendorlib_stem='$vendorlib_stem'
21046 vendorlibexp='$vendorlibexp'
21047 vendorman1='$vendorman1'
21048 vendorman1exp='$vendorman1exp'
21049 vendorman3='$vendorman3'
21050 vendorman3exp='$vendorman3exp'
21051 vendorprefix='$vendorprefix'
21052 vendorprefixexp='$vendorprefixexp'
21053 vendorscript='$vendorscript'
21054 vendorscriptexp='$vendorscriptexp'
21055 version='$version'
21056 version_patchlevel_string='$version_patchlevel_string'
21057 versiononly='$versiononly'
21058 vi='$vi'
21059 voidflags='$voidflags'
21060 xlibpth='$xlibpth'
21061 xs_apiversion='$xs_apiversion'
21062 yacc='$yacc'
21063 yaccflags='$yaccflags'
21064 zcat='$zcat'
21065 zip='$zip'
21066 EOT
21067
21068 : Add in command line options if available
21069 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21070
21071 : add special variables
21072 $test -f $src/patchlevel.h && \
21073 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
21074 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
21075 echo "PERL_CONFIG_SH=true" >>config.sh
21076
21077 : propagate old symbols
21078 if $test -f UU/config.sh; then
21079         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
21080         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
21081         $sort | $uniq -u >UU/oldsyms
21082         set X `cat UU/oldsyms`
21083         shift
21084         case $# in
21085         0) ;;
21086         *)
21087                 cat <<EOM
21088 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
21089 EOM
21090                 echo "# Variables propagated from previous config.sh file." >>config.sh
21091                 for sym in `cat UU/oldsyms`; do
21092                         echo "    Propagating $hint variable "'$'"$sym..."
21093                         eval 'tmp="$'"${sym}"'"'
21094                         echo "$tmp" | \
21095                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
21096                 done
21097                 ;;
21098         esac
21099 fi
21100
21101 : Finish up by extracting the .SH files
21102 case "$alldone" in
21103 exit)
21104         $rm -rf UU
21105         echo "Extraction done."
21106         exit 0
21107         ;;
21108 cont)
21109         ;;
21110 '')
21111         dflt=''
21112         nostick=true
21113         $cat <<EOM
21114
21115 If you'd like to make any changes to the config.sh file before I begin
21116 to configure things, do it as a shell escape now (e.g. !vi config.sh).
21117
21118 EOM
21119         rp="Press return or use a shell escape to edit config.sh:"
21120         . UU/myread
21121         nostick=''
21122         case "$ans" in
21123         '') ;;
21124         *) : in case they cannot read
21125                 sh 1>&4 -c "$ans";;
21126         esac
21127         ;;
21128 esac
21129
21130 : if this fails, just run all the .SH files by hand
21131 . ./config.sh
21132
21133 echo " "
21134 exec 1>&4
21135 pwd=`pwd`
21136 . ./UU/extract
21137 cd "$pwd"
21138
21139 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
21140         dflt=y
21141         case "$silent" in
21142         true) ;;
21143         *)
21144                 $cat <<EOM
21145
21146 Now you need to generate make dependencies by running "$make depend".
21147 You might prefer to run it in background: "$make depend > makedepend.out &"
21148 It can take a while, so you might not want to run it right now.
21149
21150 EOM
21151                 ;;
21152         esac
21153         rp="Run $make depend now?"
21154         . UU/myread
21155         case "$ans" in
21156         y*)
21157                 $make depend && echo "Now you must run '$make'."
21158                 ;;
21159         *)
21160                 echo "You must run '$make depend' then '$make'."
21161                 ;;
21162         esac
21163 elif test -f [Mm]akefile; then
21164         echo " "
21165         echo "Now you must run a $make."
21166 else
21167         echo "Configure done."
21168 fi
21169
21170 if $test -f Policy.sh; then
21171     $cat <<EOM
21172
21173 If you compile $package on a different machine or from a different object
21174 directory, copy the Policy.sh file from this object directory to the
21175 new one before you run Configure -- this will help you with most of
21176 the policy defaults.
21177
21178 EOM
21179 fi
21180 if $test -f config.msg; then
21181     echo "Hmm.  I also noted the following information while running:"
21182     echo " "
21183     $cat config.msg >&4
21184     $rm -f config.msg
21185 fi
21186 $rm -f kit*isdone ark*isdone
21187 $rm -rf UU
21188
21189 : End of Configure
21190