This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
PerlIO/XS interface routine and doc updates from
[perl5.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Thu May  2 01:39:49 EET DST 2002 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.org)
25
26 cat >c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat c1$$ c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f c1$$ c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 case "X${MACHTYPE:-nonesuchmach}" in
69                 *cygwin) ;;
70                 *) p_=\; ;;
71                 esac
72         fi
73 fi
74
75 : Proper PATH setting
76 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
77 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
78 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
79 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
80 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
81 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
82 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
83 paths="$paths /sbin /usr/sbin /usr/libexec"
84 paths="$paths /system/gnu_library/bin"
85
86 for p in $paths
87 do
88         case "$p_$PATH$p_" in
89         *$p_$p$p_*) ;;
90         *) test -d $p && PATH=$PATH$p_$p ;;
91         esac
92 done
93
94 PATH=.$p_$PATH
95 export PATH
96
97 : shall we be using ksh?
98 inksh=''
99 needksh=''
100 avoidksh=''
101 newsh=/bin/ksh
102 changesh=''
103 if (PATH=.; alias -x) >/dev/null 2>&1; then
104                 inksh=true
105 fi
106 if test -f /hp-ux -a -f /bin/ksh; then
107         needksh='to avoid sh bug in "here document" expansion'
108 fi
109 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
110         if test X`/usr/bin/uname -v` = X4; then
111                 avoidksh="to avoid AIX 4's /bin/sh"
112                 newsh=/usr/bin/bsh
113         fi
114 fi
115 if test -f /osf_boot -a -f /usr/sbin/setld; then
116         if test X`/usr/bin/uname -s` = XOSF1; then
117                 avoidksh="to avoid Digital UNIX' ksh"
118                 newsh=/bin/sh
119                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
120         fi
121 fi
122 case "$inksh/$needksh" in
123 /[a-z]*)
124                 ENV=''
125                 changesh=true
126                 reason="$needksh"
127         ;;
128 esac
129 case "$inksh/$avoidksh" in
130 true/[a-z]*)
131         changesh=true
132         reason="$avoidksh"
133         ;;
134 esac
135 case "$inksh/$needksh-$avoidksh-" in
136 true/--)
137                 cat <<EOM
138 (I see you are using the Korn shell.  Some ksh's blow up on $me,
139 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
140 EOM
141         ;;
142 esac
143 case "$changesh" in
144 true)
145         export newsh
146         echo "(Feeding myself to $newsh $reason.)"
147         case "$0" in
148         Configure|*/Configure) exec $newsh $0 "$@";;
149         *) exec $newsh Configure "$@";;
150         esac
151         ;;
152 esac
153
154 : if needed set CDPATH to a harmless value that is not chatty
155 : avoid bash 2.02 problems with empty CDPATH.
156 case "$CDPATH" in
157 '')     ;;
158 *)      case "$SHELL" in
159         *bash*) CDPATH='.' ;;
160         *)              CDPATH='' ;;
161         esac
162         ;;
163 esac
164 : Configure runs within the UU subdirectory
165 test -d UU || mkdir UU
166 cd UU && rm -f ./*
167
168
169 ccname=''
170 ccversion=''
171 ccsymbols=''
172 cppccsymbols=''
173 cppsymbols=''
174 from=''
175 run=''
176 targetarch=''
177 to=''
178 usecrosscompile=''
179 perllibs=''
180 dynamic_ext=''
181 extensions=''
182 known_extensions=''
183 nonxs_ext=''
184 static_ext=''
185 useopcode=''
186 useposix=''
187 extras=''
188 d_bsd=''
189 d_eunice=''
190 d_xenix=''
191 eunicefix=''
192 Mcc=''
193 ar=''
194 awk=''
195 bash=''
196 bison=''
197 byacc=''
198 cat=''
199 chgrp=''
200 chmod=''
201 chown=''
202 comm=''
203 compress=''
204 cp=''
205 cpio=''
206 cpp=''
207 csh=''
208 date=''
209 echo=''
210 egrep=''
211 emacs=''
212 expr=''
213 find=''
214 flex=''
215 gmake=''
216 grep=''
217 gzip=''
218 inews=''
219 ksh=''
220 less=''
221 line=''
222 lint=''
223 ln=''
224 lp=''
225 lpr=''
226 ls=''
227 mail=''
228 mailx=''
229 make=''
230 mkdir=''
231 more=''
232 mv=''
233 nm=''
234 nroff=''
235 perl=''
236 pg=''
237 pmake=''
238 pr=''
239 rm=''
240 rmail=''
241 sed=''
242 sendmail=''
243 shar=''
244 sleep=''
245 smail=''
246 sort=''
247 submit=''
248 tail=''
249 tar=''
250 tbl=''
251 tee=''
252 test=''
253 touch=''
254 tr=''
255 troff=''
256 uname=''
257 uniq=''
258 uuname=''
259 vi=''
260 zcat=''
261 zip=''
262 full_ar=''
263 full_sed=''
264 libswanted=''
265 hint=''
266 myuname=''
267 osname=''
268 osvers=''
269 Author=''
270 Date=''
271 Header=''
272 Id=''
273 Locker=''
274 Log=''
275 RCSfile=''
276 Revision=''
277 Source=''
278 State=''
279 _a=''
280 _exe=''
281 _o=''
282 archobjs=''
283 exe_ext=''
284 firstmakefile=''
285 lib_ext=''
286 obj_ext=''
287 path_sep=''
288 afs=''
289 afsroot=''
290 alignbytes=''
291 ansi2knr=''
292 archlib=''
293 archlibexp=''
294 d_archlib=''
295 installarchlib=''
296 archname=''
297 myarchname=''
298 d_atolf=''
299 d_atoll=''
300 baserev=''
301 bin=''
302 binexp=''
303 installbin=''
304 byteorder=''
305 cc=''
306 ccflags=''
307 cppflags=''
308 ldflags=''
309 lkflags=''
310 locincpth=''
311 optimize=''
312 cf_email=''
313 cf_by=''
314 cf_time=''
315 charsize=''
316 contains=''
317 cpp_stuff=''
318 cpplast=''
319 cppminus=''
320 cpprun=''
321 cppstdin=''
322 d__fwalk=''
323 d_access=''
324 d_accessx=''
325 d_alarm=''
326 asctime_r_proto=''
327 d_asctime_r=''
328 d_attribut=''
329 d_bcmp=''
330 d_bcopy=''
331 d_bzero=''
332 d_casti32=''
333 castflags=''
334 d_castneg=''
335 d_chown=''
336 d_chroot=''
337 d_chsize=''
338 d_class=''
339 d_closedir=''
340 d_void_closedir=''
341 d_cmsghdr_s=''
342 d_const=''
343 cryptlib=''
344 d_crypt=''
345 crypt_r_proto=''
346 d_crypt_r=''
347 d_csh=''
348 full_csh=''
349 ctermid_r_proto=''
350 d_ctermid_r=''
351 ctime_r_proto=''
352 d_ctime_r=''
353 d_cuserid=''
354 d_dbl_dig=''
355 d_dbminitproto=''
356 d_difftime=''
357 d_dirfd=''
358 d_dlerror=''
359 d_dlopen=''
360 d_dlsymun=''
361 d_dosuid=''
362 d_suidsafe=''
363 d_drand48_r=''
364 drand48_r_proto=''
365 d_drand48proto=''
366 d_dup2=''
367 d_eaccess=''
368 d_endgrent=''
369 d_endgrent_r=''
370 endgrent_r_proto=''
371 d_endhent=''
372 d_endhostent_r=''
373 endhostent_r_proto=''
374 d_endnent=''
375 d_endnetent_r=''
376 endnetent_r_proto=''
377 d_endpent=''
378 d_endprotoent_r=''
379 endprotoent_r_proto=''
380 d_endpwent=''
381 d_endpwent_r=''
382 endpwent_r_proto=''
383 d_endsent=''
384 d_endservent_r=''
385 endservent_r_proto=''
386 d_fchdir=''
387 d_fchmod=''
388 d_fchown=''
389 d_fcntl=''
390 d_fcntl_can_lock=''
391 d_fd_macros=''
392 d_fd_set=''
393 d_fds_bits=''
394 d_fgetpos=''
395 d_finite=''
396 d_finitel=''
397 d_flexfnam=''
398 d_flock=''
399 d_flockproto=''
400 d_fork=''
401 d_fp_class=''
402 d_fpclass=''
403 d_fpclassify=''
404 d_fpclassl=''
405 d_fpos64_t=''
406 d_frexpl=''
407 d_fs_data_s=''
408 d_fseeko=''
409 d_fsetpos=''
410 d_fstatfs=''
411 d_fsync=''
412 d_ftello=''
413 d_ftime=''
414 d_gettimeod=''
415 d_Gconvert=''
416 d_getcwd=''
417 d_getespwnam=''
418 d_getfsstat=''
419 d_getgrent=''
420 d_getgrent_r=''
421 getgrent_r_proto=''
422 d_getgrgid_r=''
423 getgrgid_r_proto=''
424 d_getgrnam_r=''
425 getgrnam_r_proto=''
426 d_getgrps=''
427 d_gethbyaddr=''
428 d_gethbyname=''
429 d_gethent=''
430 aphostname=''
431 d_gethname=''
432 d_phostname=''
433 d_uname=''
434 d_gethostbyaddr_r=''
435 gethostbyaddr_r_proto=''
436 d_gethostbyname_r=''
437 gethostbyname_r_proto=''
438 d_gethostent_r=''
439 gethostent_r_proto=''
440 d_gethostprotos=''
441 d_getitimer=''
442 d_getlogin=''
443 d_getlogin_r=''
444 getlogin_r_proto=''
445 d_getmnt=''
446 d_getmntent=''
447 d_getnbyaddr=''
448 d_getnbyname=''
449 d_getnent=''
450 d_getnetbyaddr_r=''
451 getnetbyaddr_r_proto=''
452 d_getnetbyname_r=''
453 getnetbyname_r_proto=''
454 d_getnetent_r=''
455 getnetent_r_proto=''
456 d_getnetprotos=''
457 d_getpagsz=''
458 d_getpent=''
459 d_getpgid=''
460 d_getpgrp2=''
461 d_bsdgetpgrp=''
462 d_getpgrp=''
463 d_getppid=''
464 d_getprior=''
465 d_getpbyname=''
466 d_getpbynumber=''
467 d_getprotobyname_r=''
468 getprotobyname_r_proto=''
469 d_getprotobynumber_r=''
470 getprotobynumber_r_proto=''
471 d_getprotoent_r=''
472 getprotoent_r_proto=''
473 d_getprotoprotos=''
474 d_getprpwnam=''
475 d_getpwent=''
476 d_getpwent_r=''
477 getpwent_r_proto=''
478 d_getpwnam_r=''
479 getpwnam_r_proto=''
480 d_getpwuid_r=''
481 getpwuid_r_proto=''
482 d_getsent=''
483 d_getservbyname_r=''
484 getservbyname_r_proto=''
485 d_getservbyport_r=''
486 getservbyport_r_proto=''
487 d_getservent_r=''
488 getservent_r_proto=''
489 d_getservprotos=''
490 d_getspnam=''
491 d_getspnam_r=''
492 getspnam_r_proto=''
493 d_getsbyname=''
494 d_getsbyport=''
495 d_gmtime_r=''
496 gmtime_r_proto=''
497 d_gnulibc=''
498 d_hasmntopt=''
499 d_htonl=''
500 d_inetaton=''
501 d_int64_t=''
502 d_isascii=''
503 d_isfinite=''
504 d_isinf=''
505 d_isnan=''
506 d_isnanl=''
507 d_killpg=''
508 d_lchown=''
509 d_ldbl_dig=''
510 d_link=''
511 d_localtime_r=''
512 localtime_r_proto=''
513 d_locconv=''
514 d_lockf=''
515 d_longdbl=''
516 longdblsize=''
517 d_longlong=''
518 longlongsize=''
519 d_lseekproto=''
520 d_lstat=''
521 d_madvise=''
522 d_mblen=''
523 d_mbstowcs=''
524 d_mbtowc=''
525 d_memchr=''
526 d_memcmp=''
527 d_memcpy=''
528 d_memmove=''
529 d_memset=''
530 d_mkdir=''
531 d_mkdtemp=''
532 d_mkfifo=''
533 d_mkstemp=''
534 d_mkstemps=''
535 d_mktime=''
536 d_mmap=''
537 mmaptype=''
538 d_modfl=''
539 d_modfl_pow32_bug=''
540 d_mprotect=''
541 d_msg=''
542 d_msgctl=''
543 d_msgget=''
544 d_msghdr_s=''
545 d_msgrcv=''
546 d_msgsnd=''
547 d_msync=''
548 d_munmap=''
549 d_nice=''
550 d_nl_langinfo=''
551 d_off64_t=''
552 d_open3=''
553 d_fpathconf=''
554 d_pathconf=''
555 d_pause=''
556 d_pipe=''
557 d_poll=''
558 d_portable=''
559 d_procselfexe=''
560 procselfexe=''
561 d_old_pthread_create_joinable=''
562 old_pthread_create_joinable=''
563 d_pthread_atfork=''
564 d_pthread_yield=''
565 d_sched_yield=''
566 sched_yield=''
567 d_qgcvt=''
568 d_random_r=''
569 random_r_proto=''
570 d_readdir64_r=''
571 readdir64_r_proto=''
572 d_readdir=''
573 d_rewinddir=''
574 d_seekdir=''
575 d_telldir=''
576 d_readdir_r=''
577 readdir_r_proto=''
578 d_readlink=''
579 d_readv=''
580 d_recvmsg=''
581 d_rename=''
582 d_rmdir=''
583 d_safebcpy=''
584 d_safemcpy=''
585 d_sanemcmp=''
586 d_sbrkproto=''
587 d_select=''
588 d_sem=''
589 d_semctl=''
590 d_semget=''
591 d_semop=''
592 d_sendmsg=''
593 d_setegid=''
594 d_seteuid=''
595 d_setgrent=''
596 d_setgrent_r=''
597 setgrent_r_proto=''
598 d_setgrps=''
599 d_sethent=''
600 d_sethostent_r=''
601 sethostent_r_proto=''
602 d_setitimer=''
603 d_setlinebuf=''
604 d_setlocale=''
605 d_setlocale_r=''
606 setlocale_r_proto=''
607 d_setnent=''
608 d_setnetent_r=''
609 setnetent_r_proto=''
610 d_setpent=''
611 d_setpgid=''
612 d_setpgrp2=''
613 d_bsdsetpgrp=''
614 d_setpgrp=''
615 d_setprior=''
616 d_setproctitle=''
617 d_setprotoent_r=''
618 setprotoent_r_proto=''
619 d_setpwent=''
620 d_setpwent_r=''
621 setpwent_r_proto=''
622 d_setregid=''
623 d_setresgid=''
624 d_setresuid=''
625 d_setreuid=''
626 d_setrgid=''
627 d_setruid=''
628 d_setsent=''
629 d_setservent_r=''
630 setservent_r_proto=''
631 d_setsid=''
632 d_setvbuf=''
633 d_sfio=''
634 usesfio=''
635 d_shm=''
636 d_shmat=''
637 d_shmatprototype=''
638 shmattype=''
639 d_shmctl=''
640 d_shmdt=''
641 d_shmget=''
642 d_sigaction=''
643 d_sigprocmask=''
644 d_sigsetjmp=''
645 d_sockatmark=''
646 d_sockatmarkproto=''
647 d_msg_ctrunc=''
648 d_msg_dontroute=''
649 d_msg_oob=''
650 d_msg_peek=''
651 d_msg_proxy=''
652 d_oldsock=''
653 d_scm_rights=''
654 d_socket=''
655 d_sockpair=''
656 sockethdr=''
657 socketlib=''
658 d_socklen_t=''
659 d_socks5_init=''
660 d_sqrtl=''
661 d_srand48_r=''
662 srand48_r_proto=''
663 d_srandom_r=''
664 srandom_r_proto=''
665 d_sresgproto=''
666 d_sresuproto=''
667 d_statblks=''
668 d_statfs_f_flags=''
669 d_statfs_s=''
670 d_fstatvfs=''
671 d_statvfs=''
672 d_stdio_cnt_lval=''
673 d_stdio_ptr_lval=''
674 d_stdio_ptr_lval_nochange_cnt=''
675 d_stdio_ptr_lval_sets_cnt=''
676 d_stdiobase=''
677 d_stdstdio=''
678 stdio_base=''
679 stdio_bufsiz=''
680 stdio_cnt=''
681 stdio_filbuf=''
682 stdio_ptr=''
683 d_index=''
684 d_strchr=''
685 d_strcoll=''
686 d_strctcpy=''
687 d_strerrm=''
688 d_strerror=''
689 d_sysernlst=''
690 d_syserrlst=''
691 d_strerror_r=''
692 strerror_r_proto=''
693 d_strftime=''
694 d_strtod=''
695 d_strtol=''
696 d_strtold=''
697 d_strtoll=''
698 d_strtoq=''
699 d_strtoul=''
700 d_strtoull=''
701 d_strtouq=''
702 d_strxfrm=''
703 d_symlink=''
704 d_syscall=''
705 d_syscallproto=''
706 d_sysconf=''
707 d_system=''
708 d_tcgetpgrp=''
709 d_tcsetpgrp=''
710 d_telldirproto=''
711 d_time=''
712 timetype=''
713 clocktype=''
714 d_times=''
715 d_tmpnam_r=''
716 tmpnam_r_proto=''
717 d_truncate=''
718 d_ttyname_r=''
719 ttyname_r_proto=''
720 d_tzname=''
721 d_u32align=''
722 d_ualarm=''
723 d_umask=''
724 d_semctl_semid_ds=''
725 d_semctl_semun=''
726 d_union_semun=''
727 d_unordered=''
728 d_usleep=''
729 d_usleepproto=''
730 d_ustat=''
731 d_vfork=''
732 usevfork=''
733 d_voidsig=''
734 signal_t=''
735 d_volatile=''
736 d_charvspr=''
737 d_vprintf=''
738 d_wait4=''
739 d_waitpid=''
740 d_wcstombs=''
741 d_wctomb=''
742 d_writev=''
743 dlext=''
744 cccdlflags=''
745 ccdlflags=''
746 dlsrc=''
747 ld=''
748 lddlflags=''
749 usedl=''
750 doublesize=''
751 ebcdic=''
752 fflushNULL=''
753 fflushall=''
754 fpossize=''
755 fpostype=''
756 gccosandvers=''
757 gccversion=''
758 gidformat=''
759 gidsign=''
760 gidsize=''
761 gidtype=''
762 groupstype=''
763 h_fcntl=''
764 h_sysfile=''
765 i_arpainet=''
766 i_crypt=''
767 db_hashtype=''
768 db_prefixtype=''
769 db_version_major=''
770 db_version_minor=''
771 db_version_patch=''
772 i_db=''
773 i_dbm=''
774 i_rpcsvcdbm=''
775 d_dirnamlen=''
776 direntrytype=''
777 i_dirent=''
778 i_dld=''
779 i_dlfcn=''
780 i_fcntl=''
781 i_float=''
782 i_fp=''
783 i_fp_class=''
784 i_gdbm=''
785 d_grpasswd=''
786 i_grp=''
787 i_ieeefp=''
788 i_inttypes=''
789 i_langinfo=''
790 i_libutil=''
791 i_limits=''
792 i_locale=''
793 i_machcthr=''
794 i_malloc=''
795 i_math=''
796 i_memory=''
797 i_mntent=''
798 i_ndbm=''
799 i_netdb=''
800 i_neterrno=''
801 i_netinettcp=''
802 i_niin=''
803 i_sysin=''
804 i_poll=''
805 i_prot=''
806 i_pthread=''
807 d_pwage=''
808 d_pwchange=''
809 d_pwclass=''
810 d_pwcomment=''
811 d_pwexpire=''
812 d_pwgecos=''
813 d_pwpasswd=''
814 d_pwquota=''
815 i_pwd=''
816 i_sfio=''
817 i_shadow=''
818 i_socks=''
819 i_stddef=''
820 i_stdlib=''
821 i_string=''
822 strings=''
823 i_sunmath=''
824 i_sysaccess=''
825 i_sysdir=''
826 i_sysfile=''
827 d_voidtty=''
828 i_bsdioctl=''
829 i_sysfilio=''
830 i_sysioctl=''
831 i_syssockio=''
832 i_syslog=''
833 i_sysmman=''
834 i_sysmode=''
835 i_sysmount=''
836 i_sysndir=''
837 i_sysparam=''
838 i_sysresrc=''
839 i_syssecrt=''
840 i_sysselct=''
841 i_sysstat=''
842 i_sysstatfs=''
843 i_sysstatvfs=''
844 i_systimes=''
845 i_systypes=''
846 i_sysuio=''
847 i_sysun=''
848 i_sysutsname=''
849 i_sysvfs=''
850 i_syswait=''
851 i_sgtty=''
852 i_termio=''
853 i_termios=''
854 d_tm_tm_gmtoff=''
855 d_tm_tm_zone=''
856 i_systime=''
857 i_systimek=''
858 i_time=''
859 timeincl=''
860 i_unistd=''
861 i_ustat=''
862 i_utime=''
863 i_values=''
864 i_stdarg=''
865 i_varargs=''
866 i_varhdr=''
867 i_vfork=''
868 inc_version_list=''
869 inc_version_list_init=''
870 installprefix=''
871 installprefixexp=''
872 installstyle=''
873 installusrbinperl=''
874 intsize=''
875 longsize=''
876 shortsize=''
877 issymlink=''
878 libc=''
879 ldlibpthname=''
880 libperl=''
881 shrpenv=''
882 useshrplib=''
883 glibpth=''
884 libpth=''
885 loclibpth=''
886 plibpth=''
887 xlibpth=''
888 ignore_versioned_solibs=''
889 libs=''
890 libsdirs=''
891 libsfiles=''
892 libsfound=''
893 libspath=''
894 lns=''
895 d_PRIEUldbl=''
896 d_PRIFUldbl=''
897 d_PRIGUldbl=''
898 d_PRIeldbl=''
899 d_PRIfldbl=''
900 d_PRIgldbl=''
901 d_SCNfldbl=''
902 sPRIEUldbl=''
903 sPRIFUldbl=''
904 sPRIGUldbl=''
905 sPRIeldbl=''
906 sPRIfldbl=''
907 sPRIgldbl=''
908 sSCNfldbl=''
909 lseeksize=''
910 lseektype=''
911 make_set_make=''
912 d_mymalloc=''
913 freetype=''
914 mallocobj=''
915 mallocsrc=''
916 malloctype=''
917 usemymalloc=''
918 installman1dir=''
919 man1dir=''
920 man1direxp=''
921 man1ext=''
922 installman3dir=''
923 man3dir=''
924 man3direxp=''
925 man3ext=''
926 modetype=''
927 multiarch=''
928 mydomain=''
929 myhostname=''
930 phostname=''
931 c=''
932 n=''
933 d_eofnblk=''
934 eagain=''
935 o_nonblock=''
936 rd_nodata=''
937 need_va_copy=''
938 netdb_hlen_type=''
939 netdb_host_type=''
940 netdb_name_type=''
941 netdb_net_type=''
942 groupcat=''
943 hostcat=''
944 passcat=''
945 orderlib=''
946 ranlib=''
947 d_perl_otherlibdirs=''
948 otherlibdirs=''
949 package=''
950 spackage=''
951 pager=''
952 api_revision=''
953 api_subversion=''
954 api_version=''
955 api_versionstring=''
956 patchlevel=''
957 perl_patchlevel=''
958 revision=''
959 subversion=''
960 version=''
961 version_patchlevel_string=''
962 perl5=''
963 perladmin=''
964 perlpath=''
965 d_nv_preserves_uv=''
966 i16size=''
967 i16type=''
968 i32size=''
969 i32type=''
970 i64size=''
971 i64type=''
972 i8size=''
973 i8type=''
974 ivsize=''
975 ivtype=''
976 nv_preserves_uv_bits=''
977 nvsize=''
978 nvtype=''
979 u16size=''
980 u16type=''
981 u32size=''
982 u32type=''
983 u64size=''
984 u64type=''
985 u8size=''
986 u8type=''
987 uvsize=''
988 uvtype=''
989 ivdformat=''
990 nvEUformat=''
991 nvFUformat=''
992 nvGUformat=''
993 nveformat=''
994 nvfformat=''
995 nvgformat=''
996 uvXUformat=''
997 uvoformat=''
998 uvuformat=''
999 uvxformat=''
1000 pidtype=''
1001 prefix=''
1002 prefixexp=''
1003 installprivlib=''
1004 privlib=''
1005 privlibexp=''
1006 prototype=''
1007 ptrsize=''
1008 d_PRIXU64=''
1009 d_PRId64=''
1010 d_PRIi64=''
1011 d_PRIo64=''
1012 d_PRIu64=''
1013 d_PRIx64=''
1014 sPRIXU64=''
1015 sPRId64=''
1016 sPRIi64=''
1017 sPRIo64=''
1018 sPRIu64=''
1019 sPRIx64=''
1020 d_quad=''
1021 quadkind=''
1022 quadtype=''
1023 uquadtype=''
1024 drand01=''
1025 randbits=''
1026 randfunc=''
1027 randseedtype=''
1028 seedfunc=''
1029 installscript=''
1030 scriptdir=''
1031 scriptdirexp=''
1032 selectminbits=''
1033 selecttype=''
1034 sh=''
1035 sig_count=''
1036 sig_name=''
1037 sig_name_init=''
1038 sig_num=''
1039 sig_num_init=''
1040 sig_size=''
1041 installsitearch=''
1042 sitearch=''
1043 sitearchexp=''
1044 installsitebin=''
1045 sitebin=''
1046 sitebinexp=''
1047 installsitelib=''
1048 sitelib=''
1049 sitelib_stem=''
1050 sitelibexp=''
1051 siteprefix=''
1052 siteprefixexp=''
1053 sizesize=''
1054 sizetype=''
1055 so=''
1056 socksizetype=''
1057 sharpbang=''
1058 shsharp=''
1059 spitshell=''
1060 src=''
1061 ssizetype=''
1062 startperl=''
1063 startsh=''
1064 stdchar=''
1065 d_stdio_stream_array=''
1066 stdio_stream_array=''
1067 sysman=''
1068 trnl=''
1069 uidformat=''
1070 uidsign=''
1071 uidsize=''
1072 uidtype=''
1073 archname64=''
1074 use64bitall=''
1075 use64bitint=''
1076 ccflags_uselargefiles=''
1077 ldflags_uselargefiles=''
1078 libswanted_uselargefiles=''
1079 uselargefiles=''
1080 uselongdouble=''
1081 usemorebits=''
1082 usemultiplicity=''
1083 nm_opt=''
1084 nm_so_opt=''
1085 runnm=''
1086 usenm=''
1087 useperlio=''
1088 usesocks=''
1089 d_oldpthreads=''
1090 use5005threads=''
1091 useithreads=''
1092 usereentrant=''
1093 usethreads=''
1094 incpath=''
1095 mips_type=''
1096 usrinc=''
1097 d_vendorarch=''
1098 installvendorarch=''
1099 vendorarch=''
1100 vendorarchexp=''
1101 d_vendorbin=''
1102 installvendorbin=''
1103 vendorbin=''
1104 vendorbinexp=''
1105 d_vendorlib=''
1106 installvendorlib=''
1107 vendorlib=''
1108 vendorlib_stem=''
1109 vendorlibexp=''
1110 usevendorprefix=''
1111 vendorprefix=''
1112 vendorprefixexp=''
1113 versiononly=''
1114 defvoidused=''
1115 voidflags=''
1116 pm_apiversion=''
1117 xs_apiversion=''
1118 yacc=''
1119 yaccflags=''
1120 CONFIG=''
1121
1122 define='define'
1123 undef='undef'
1124 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1125 rmlist=''
1126
1127 : We must find out about Eunice early
1128 eunicefix=':'
1129 if test -f /etc/unixtovms; then
1130         eunicefix=/etc/unixtovms
1131 fi
1132 if test -f /etc/unixtovms.exe; then
1133         eunicefix=/etc/unixtovms.exe
1134 fi
1135
1136 : Set executable suffix now -- needed before hints available
1137 if test -f "/libs/version.library"; then
1138 : Amiga OS
1139     _exe=""
1140 elif test -f "/system/gnu_library/bin/ar.pm"; then
1141 : Stratus VOS
1142     _exe=".pm"
1143 elif test -n "$DJGPP"; then
1144 : DOS DJGPP
1145     _exe=".exe"
1146 elif test -d c:/. ; then
1147 : OS/2 or cygwin
1148     _exe=".exe"
1149 fi
1150
1151 i_whoami=''
1152 ccname=''
1153 ccversion=''
1154 perllibs=''
1155 : set useposix=false in your hint file to disable the POSIX extension.
1156 useposix=true
1157 : set useopcode=false in your hint file to disable the Opcode extension.
1158 useopcode=true
1159 : Trailing extension.  Override this in a hint file, if needed.
1160 : Extra object files, if any, needed on this platform.
1161 archobjs=''
1162 archname=''
1163 : Possible local include directories to search.
1164 : Set locincpth to "" in a hint file to defeat local include searches.
1165 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1166 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1167 :
1168 : no include file wanted by default
1169 inclwanted=''
1170
1171 groupstype=''
1172 libnames=''
1173 : change the next line if compiling for Xenix/286 on Xenix/386
1174 xlibpth='/usr/lib/386 /lib/386'
1175 : Possible local library directories to search.
1176 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1177 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1178
1179 : general looking path for locating libraries
1180 glibpth="/lib /usr/lib $xlibpth"
1181 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1182 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1183 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1184
1185 : Private path used by Configure to find libraries.  Its value
1186 : is prepended to libpth. This variable takes care of special
1187 : machines, like the mips.  Usually, it should be empty.
1188 plibpth=''
1189
1190 : default library list
1191 libswanted=''
1192 : some systems want to use only the non-versioned libso:s
1193 ignore_versioned_solibs=''
1194 archname64=''
1195 ccflags_uselargefiles=''
1196 ldflags_uselargefiles=''
1197 libswanted_uselargefiles=''
1198 : set usemultiplicity on the Configure command line to enable multiplicity.
1199 : set usesocks on the Configure command line to enable socks.
1200 : set usethreads on the Configure command line to enable threads.
1201 usereentrant='undef'
1202 : full support for void wanted by default
1203 defvoidused=15
1204
1205 : List of libraries we want.
1206 : If anyone needs -lnet, put it in a hint file.
1207 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1208 libswanted="$libswanted dld ld sun m c cposix posix"
1209 libswanted="$libswanted ndir dir crypt sec"
1210 libswanted="$libswanted ucb bsd BSD PW x util"
1211 : We probably want to search /usr/shlib before most other libraries.
1212 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1213 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1214 glibpth="/usr/shlib $glibpth"
1215 : Do not use vfork unless overridden by a hint file.
1216 usevfork=false
1217
1218 : Find the basic shell for Bourne shell scripts
1219 case "$sh" in
1220 '')
1221         case "$SYSTYPE" in
1222         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1223         *) xxx='/bin/sh';;
1224         esac
1225         if test -f "$xxx"; then
1226                 sh="$xxx"
1227         else
1228                 : Build up a list and do a single loop so we can 'break' out.
1229                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1230                 for xxx in sh bash ksh pdksh ash; do
1231                         for p in $pth; do
1232                                 try="$try ${p}/${xxx}"
1233                         done
1234                 done
1235                 for xxx in $try; do
1236                         if test -f "$xxx"; then
1237                                 sh="$xxx";
1238                                 break
1239                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1240                                 sh="$xxx";
1241                                 break
1242                         elif test -f "$xxx.exe"; then
1243                                 sh="$xxx";
1244                                 break
1245                         fi
1246                 done
1247         fi
1248         ;;
1249 esac
1250
1251 case "$sh" in
1252 '')     cat >&2 <<EOM
1253 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1254
1255 Usually it's in /bin/sh.  How did you even get this far?
1256 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1257 we'll try to straighten this all out.
1258 EOM
1259         exit 1
1260         ;;
1261 esac
1262
1263 : see if sh knows # comments
1264 if `$sh -c '#' >/dev/null 2>&1`; then
1265         shsharp=true
1266         spitshell=cat
1267         xcat=/bin/cat
1268         test -f $xcat$_exe || xcat=/usr/bin/cat
1269         if test ! -f $xcat$_exe; then
1270                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1271                         if test -f $p/cat$_exe; then
1272                                 xcat=$p/cat
1273                                 break
1274                         fi
1275                 done
1276                 if test ! -f $xcat$_exe; then
1277                         echo "Can't find cat anywhere!"
1278                         exit 1
1279                 fi
1280         fi
1281         echo "#!$xcat" >sharp
1282         $eunicefix sharp
1283         chmod +x sharp
1284         ./sharp > today
1285         if test -s today; then
1286                 sharpbang='#!'
1287         else
1288                 echo "#! $xcat" > sharp
1289                 $eunicefix sharp
1290                 chmod +x sharp
1291                 ./sharp > today
1292                 if test -s today; then
1293                         sharpbang='#! '
1294                 else
1295                         sharpbang=': use '
1296                 fi
1297         fi
1298 else
1299         echo " "
1300         echo "Your $sh doesn't grok # comments--I will strip them later on."
1301         shsharp=false
1302         cd ..
1303         echo "exec grep -v '^[  ]*#'" >spitshell
1304         chmod +x spitshell
1305         $eunicefix spitshell
1306         spitshell=`pwd`/spitshell
1307         cd UU
1308         echo "I presume that if # doesn't work, #! won't work either!"
1309         sharpbang=': use '
1310 fi
1311 rm -f sharp today
1312
1313 : figure out how to guarantee sh startup
1314 case "$startsh" in
1315 '') startsh=${sharpbang}${sh} ;;
1316 *)
1317 esac
1318 cat >sharp <<EOSS
1319 $startsh
1320 set abc
1321 test "$?abc" != 1
1322 EOSS
1323
1324 chmod +x sharp
1325 $eunicefix sharp
1326 if ./sharp; then
1327         : echo "Yup, it does."
1328 else
1329         echo "Hmm... '$startsh' does not guarantee sh startup..."
1330         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1331 fi
1332 rm -f sharp
1333
1334
1335 : Save command line options in file UU/cmdline.opt for later use in
1336 : generating config.sh.
1337 cat > cmdline.opt <<EOSH
1338 # Configure command line arguments.
1339 config_arg0='$0'
1340 config_args='$*'
1341 config_argc=$#
1342 EOSH
1343 argn=1
1344 args_exp=''
1345 args_sep=''
1346 for arg in "$@"; do
1347         cat >>cmdline.opt <<EOSH
1348 config_arg$argn='$arg'
1349 EOSH
1350         # Extreme backslashitis: replace each ' by '"'"'
1351         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1352 $arg
1353 EOC
1354         arg_exp=`cat cmdl.opt`
1355         args_exp="$args_exp$args_sep'$arg_exp'"
1356         argn=`expr $argn + 1`
1357         args_sep=' '
1358 done
1359 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1360 # used by ./hints/os2.sh
1361 rm -f cmdl.opt
1362
1363 : produce awk script to parse command line options
1364 cat >options.awk <<'EOF'
1365 BEGIN {
1366         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1367
1368         len = length(optstr);
1369         for (i = 1; i <= len; i++) {
1370                 c = substr(optstr, i, 1);
1371                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1372                 if (a == ":") {
1373                         arg[c] = 1;
1374                         i++;
1375                 }
1376                 opt[c] = 1;
1377         }
1378 }
1379 {
1380         expect = 0;
1381         str = $0;
1382         if (substr(str, 1, 1) != "-") {
1383                 printf("'%s'\n", str);
1384                 next;
1385         }
1386         len = length($0);
1387         for (i = 2; i <= len; i++) {
1388                 c = substr(str, i, 1);
1389                 if (!opt[c]) {
1390                         printf("-%s\n", substr(str, i));
1391                         next;
1392                 }
1393                 printf("-%s\n", c);
1394                 if (arg[c]) {
1395                         if (i < len)
1396                                 printf("'%s'\n", substr(str, i + 1));
1397                         else
1398                                 expect = 1;
1399                         next;
1400                 }
1401         }
1402 }
1403 END {
1404         if (expect)
1405                 print "?";
1406 }
1407 EOF
1408
1409 : process the command line options
1410 set X `for arg in "$@"; do echo "X$arg"; done |
1411         sed -e s/X// | awk -f options.awk`
1412 eval "set $*"
1413 shift
1414 rm -f options.awk
1415
1416 : set up default values
1417 fastread=''
1418 reuseval=false
1419 config_sh=''
1420 alldone=''
1421 error=''
1422 silent=''
1423 extractsh=''
1424 override=''
1425 knowitall=''
1426 rm -f optdef.sh posthint.sh
1427 cat >optdef.sh <<EOS
1428 $startsh
1429 EOS
1430
1431
1432 : option parsing
1433 while test $# -gt 0; do
1434         case "$1" in
1435         -d) shift; fastread=yes;;
1436         -e) shift; alldone=cont;;
1437         -f)
1438                 shift
1439                 cd ..
1440                 if test -r "$1"; then
1441                         config_sh="$1"
1442                 else
1443                         echo "$me: cannot read config file $1." >&2
1444                         error=true
1445                 fi
1446                 cd UU
1447                 shift;;
1448         -h) shift; error=true;;
1449         -r) shift; reuseval=true;;
1450         -s) shift; silent=true; realsilent=true;;
1451         -E) shift; alldone=exit;;
1452         -K) shift; knowitall=true;;
1453         -O) shift; override=true;;
1454         -S) shift; silent=true; extractsh=true;;
1455         -D)
1456                 shift
1457                 case "$1" in
1458                 *=)
1459                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1460                         echo "$me: ignoring -D $1" >&2
1461                         ;;
1462                 *=*) echo "$1" | \
1463                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1464                 *) echo "$1='define'" >> optdef.sh;;
1465                 esac
1466                 shift
1467                 ;;
1468         -U)
1469                 shift
1470                 case "$1" in
1471                 *=) echo "$1" >> optdef.sh;;
1472                 *=*)
1473                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1474                         echo "$me: ignoring -U $1" >&2
1475                         ;;
1476                 *) echo "$1='undef'" >> optdef.sh;;
1477                 esac
1478                 shift
1479                 ;;
1480         -A)
1481             shift
1482             xxx=''
1483             yyy="$1"
1484             zzz=''
1485             uuu=undef
1486             case "$yyy" in
1487             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1488                  case "$zzz" in
1489                  *:*) zzz='' ;;
1490                  *)   xxx=append
1491                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1492                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1493                  esac
1494                  ;;
1495             esac
1496             case "$xxx" in
1497             '')  case "$yyy" in
1498                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1499                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1500                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1501                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1502                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1503                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1504                  esac
1505                  ;;       
1506             esac
1507             case "$xxx" in
1508             append)
1509                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1510             clear)
1511                 echo "$yyy=''"                  >> posthint.sh ;;
1512             define)
1513                 case "$zzz" in
1514                 '') zzz=define ;;
1515                 esac
1516                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1517             eval)
1518                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1519             prepend)
1520                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1521             undef)
1522                 case "$zzz" in
1523                 '') zzz="$uuu" ;;
1524                 esac
1525                 echo "$yyy=$zzz"                >> posthint.sh ;;
1526             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1527             esac
1528             shift
1529             ;;
1530         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1531             exit 0;;
1532         --) break;;
1533         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1534         *) break;;
1535         esac
1536 done
1537
1538 case "$error" in
1539 true)
1540         cat >&2 <<EOM
1541 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1542                  [-U symbol] [-U symbol=] [-A command:symbol...]
1543   -d : use defaults for all answers.
1544   -e : go on without questioning past the production of config.sh.
1545   -f : specify an alternate default configuration file.
1546   -h : print this help message and exit (with an error status).
1547   -r : reuse C symbols value if possible (skips costly nm extraction).
1548   -s : silent mode, only echoes questions and essential information.
1549   -D : define symbol to have some value:
1550          -D symbol         symbol gets the value 'define'
1551          -D symbol=value   symbol gets the value 'value'
1552   -E : stop at the end of questions, after having produced config.sh.
1553   -K : do not use unless you know what you are doing.
1554   -O : let -D and -U override definitions from loaded configuration file.
1555   -S : perform variable substitutions on all .SH files (can mix with -f)
1556   -U : undefine symbol:
1557          -U symbol    symbol gets the value 'undef'
1558          -U symbol=   symbol gets completely empty
1559   -A : manipulate symbol after the platform specific hints have been applied:
1560          -A symbol=value                append " "value to symbol
1561          -A append:symbol=value         append value to symbol
1562          -A define:symbol=value         define symbol to have value
1563          -A clear:symbol                define symbol to be ''
1564          -A define:symbol               define symbol to be 'define'
1565          -A eval:symbol=value           define symbol to be eval of value
1566          -A prepend:symbol=value        prepend value to symbol
1567          -A undef:symbol                define symbol to be 'undef'
1568          -A undef:symbol=               define symbol to be ''
1569   -V : print version number and exit (with a zero status).
1570 EOM
1571         exit 1
1572         ;;
1573 esac
1574
1575 : Sanity checks
1576 case "$fastread$alldone" in
1577 yescont|yesexit) ;;
1578 *)
1579         case "$extractsh" in
1580         true) ;;
1581         *)
1582                 if test ! -t 0; then
1583                         echo "Say 'sh Configure', not 'sh <Configure'"
1584                         exit 1
1585                 fi
1586                 ;;
1587         esac
1588         ;;
1589 esac
1590
1591 exec 4>&1
1592 case "$silent" in
1593 true) exec 1>/dev/null;;
1594 esac
1595
1596 : run the defines and the undefines, if any, but leave the file out there...
1597 touch optdef.sh
1598 . ./optdef.sh
1599 : create the posthint manipulation script and leave the file out there...
1600 touch posthint.sh
1601
1602 : set package name
1603 package=perl5
1604 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1605 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1606 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1607 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1608 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1609 esac
1610
1611 : Some greps do not return status, grrr.
1612 echo "grimblepritz" >grimble
1613 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1614         contains=contains
1615 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1616         contains=grep
1617 else
1618         contains=contains
1619 fi
1620 rm -f grimble
1621 : the following should work in any shell
1622 case "$contains" in
1623 contains*)
1624         echo " "
1625         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1626         cat >contains <<'EOSS'
1627 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1628 EOSS
1629 chmod +x contains
1630 esac
1631
1632 : Find the path to the source tree
1633 case "$src" in
1634 '') case "$0" in
1635     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1636          case "$src" in
1637          /*)    ;;
1638          .)     ;;
1639          *)     src=`cd ../$src && pwd` ;;
1640          esac
1641          ;;
1642     *)   src='.';;
1643     esac;;
1644 esac
1645 case "$src" in
1646 '')     src=/
1647         rsrc=/
1648         ;;
1649 /*) rsrc="$src";;
1650 *) rsrc="../$src";;
1651 esac
1652 if test -f $rsrc/Configure && \
1653         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1654 then
1655    : found it, so we are ok.
1656 else
1657         rsrc=''
1658         for src in . .. ../.. ../../.. ../../../..; do
1659                 if test -f ../$src/Configure && \
1660                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1661                 then
1662                         rsrc=../$src
1663                         break
1664                 fi
1665         done
1666 fi
1667 case "$rsrc" in
1668 '')
1669         cat <<EOM >&4
1670
1671 Sorry, I can't seem to locate the source dir for $package.  Please start
1672 Configure with an explicit path -- i.e. /some/path/Configure.
1673
1674 EOM
1675         exit 1
1676         ;;
1677 ../.)   rsrc='..';;
1678 *)
1679         echo " "
1680         echo "Sources for $package found in \"$src\"." >&4
1681         ;;
1682 esac
1683
1684 : script used to extract .SH files with variable substitutions
1685 cat >extract <<'EOS'
1686 PERL_CONFIG_SH=true
1687 echo "Doing variable substitutions on .SH files..."
1688 if test -f MANIFEST; then
1689         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1690 else
1691         echo "(Looking for .SH files under the source directory.)"
1692         set x `(cd "$src"; find . -name "*.SH" -print)`
1693 fi
1694 shift
1695 case $# in
1696 0) set x `(cd "$src"; echo *.SH)`; shift;;
1697 esac
1698 if test ! -f "$src/$1"; then
1699         shift
1700 fi
1701 mkdir_p='
1702 name=$1;
1703 create="";
1704 while test $name; do
1705         if test ! -d "$name"; then
1706                 create="$name $create";
1707                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1708                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1709         else
1710                 name="";
1711         fi;
1712 done;
1713 for file in $create; do
1714         mkdir $file;
1715 done
1716 '
1717 for file in $*; do
1718         case "$src" in
1719         ".")
1720                 case "$file" in
1721                 */*)
1722                         dir=`expr X$file : 'X\(.*\)/'`
1723                         file=`expr X$file : 'X.*/\(.*\)'`
1724                         (cd "$dir" && . ./$file)
1725                         ;;
1726                 *)
1727                         . ./$file
1728                         ;;
1729                 esac
1730                 ;;
1731         *)
1732                 case "$file" in
1733                 */*)
1734                         dir=`expr X$file : 'X\(.*\)/'`
1735                         file=`expr X$file : 'X.*/\(.*\)'`
1736                         (set x $dir; shift; eval $mkdir_p)
1737                         sh <"$src/$dir/$file"
1738                         ;;
1739                 *)
1740                         sh <"$src/$file"
1741                         ;;
1742                 esac
1743                 ;;
1744         esac
1745 done
1746 if test -f "$src/config_h.SH"; then
1747         if test ! -f config.h; then
1748         : oops, they left it out of MANIFEST, probably, so do it anyway.
1749         . "$src/config_h.SH"
1750         fi
1751 fi
1752 EOS
1753
1754 : extract files and exit if asked to do so
1755 case "$extractsh" in
1756 true)
1757         case "$realsilent" in
1758         true) ;;
1759         *) exec 1>&4;;
1760         esac
1761         case "$config_sh" in
1762         '') config_sh='config.sh';;
1763         esac
1764         echo " "
1765         echo "Fetching answers from $config_sh..."
1766         cd ..
1767         . $config_sh
1768         test "$override" && . ./optdef.sh
1769         echo " "
1770         . UU/extract
1771         rm -rf UU
1772         echo "Extraction done."
1773         exit 0
1774         ;;
1775 esac
1776
1777 : Eunice requires " " instead of "", can you believe it
1778 echo " "
1779 : Here we go...
1780 echo "Beginning of configuration questions for $package."
1781
1782 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1783
1784 : first determine how to suppress newline on echo command
1785 echo " "
1786 echo "Checking echo to see how to suppress newlines..."
1787 (echo "hi there\c" ; echo " ") >.echotmp
1788 if $contains c .echotmp >/dev/null 2>&1 ; then
1789         echo "...using -n."
1790         n='-n'
1791         c=''
1792 else
1793         cat <<'EOM'
1794 ...using \c
1795 EOM
1796         n=''
1797         c='\c'
1798 fi
1799 echo $n "The star should be here-->$c"
1800 echo '*'
1801 rm -f .echotmp
1802
1803 : Now test for existence of everything in MANIFEST
1804 echo " "
1805 if test -f "$rsrc/MANIFEST"; then
1806         echo "First let's make sure your kit is complete.  Checking..." >&4
1807         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1808         rm -f missing
1809         tmppwd=`pwd`
1810         for filelist in x??; do
1811                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1812         done
1813         if test -s missing; then
1814                 cat missing >&4
1815                 cat >&4 <<'EOM'
1816
1817 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1818
1819 You have the option of continuing the configuration process, despite the
1820 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1821 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1822 and contact the author (perlbug@perl.org).
1823
1824 EOM
1825                 echo $n "Continue? [n] $c" >&4
1826                 read ans
1827                 case "$ans" in
1828                 y*)
1829                         echo "Continuing..." >&4
1830                         rm -f missing
1831                         ;;
1832                 *)
1833                         echo "ABORTING..." >&4
1834                         kill $$
1835                         ;;
1836                 esac
1837         else
1838                 echo "Looks good..."
1839         fi
1840 else
1841         echo "There is no MANIFEST file.  I hope your kit is complete !"
1842 fi
1843 rm -f missing x??
1844
1845 echo " "
1846 : Find the appropriate value for a newline for tr
1847 if test -n "$DJGPP"; then
1848        trnl='\012'
1849 fi
1850 if test X"$trnl" = X; then
1851         case "`echo foo|tr '\n' x 2>/dev/null`" in
1852         foox) trnl='\n' ;;
1853         esac
1854 fi
1855 if test X"$trnl" = X; then
1856         case "`echo foo|tr '\012' x 2>/dev/null`" in
1857         foox) trnl='\012' ;;
1858         esac
1859 fi
1860 if test X"$trnl" = X; then
1861         cat <<EOM >&2
1862
1863 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1864
1865 EOM
1866         exit 1
1867 fi
1868
1869 : compute the number of columns on the terminal for proper question formatting
1870 case "$COLUMNS" in
1871 '') COLUMNS='80';;
1872 esac
1873
1874 : set up the echo used in my read
1875 myecho="case \"\$xxxm\" in
1876 '') echo $n \"\$rp $c\" >&4;;
1877 *) case \"\$rp\" in
1878         '') echo $n \"[\$xxxm] $c\";;
1879         *)
1880                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1881                         echo \"\$rp\" >&4
1882                         echo $n \"[\$xxxm] $c\" >&4
1883                 else
1884                         echo $n \"\$rp [\$xxxm] $c\" >&4
1885                 fi
1886                 ;;
1887         esac;;
1888 esac"
1889
1890 : now set up to do reads with possible shell escape and default assignment
1891 cat <<EOSC >myread
1892 $startsh
1893 xxxm=\$dflt
1894 $myecho
1895 ans='!'
1896 case "\$fastread" in
1897 yes) case "\$dflt" in
1898         '') ;;
1899         *) ans='';
1900                 case "\$silent-\$rp" in
1901                 true-) ;;
1902                 *) echo " " >&4;;
1903                 esac;;
1904         esac;;
1905 *) case "\$silent" in
1906         true) case "\$rp" in
1907                 '') ans='';;
1908                 esac;;
1909         esac;;
1910 esac
1911 while expr "X\$ans" : "X!" >/dev/null; do
1912         read answ
1913         set x \$xxxm
1914         shift
1915         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1916         case  "\$answ" in
1917         "!")
1918                 sh 1>&4
1919                 echo " "
1920                 $myecho
1921                 ;;
1922         !*)
1923                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1924                 shift
1925                 sh 1>&4 -c "\$*"
1926                 echo " "
1927                 $myecho
1928                 ;;
1929         "\$ans")
1930                 case "\$ans" in
1931                 \\&*)
1932                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1933                         shift
1934                         case "\$1" in
1935                         -d)
1936                                 fastread=yes
1937                                 echo "(OK, I'll run with -d after this question.)" >&4
1938                                 ;;
1939                         -*)
1940                                 echo "*** Sorry, \$1 not supported yet." >&4
1941                                 ;;
1942                         esac
1943                         $myecho
1944                         ans=!
1945                         ;;
1946                 esac;;
1947         *)
1948                 case "\$aok" in
1949                 y)
1950                         echo "*** Substitution done -- please confirm."
1951                         xxxm="\$ans"
1952                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1953                         xxxm="\$ans"
1954                         ans=!
1955                         ;;
1956                 *)
1957                         echo "*** Error -- try again."
1958                         ans=!
1959                         ;;
1960                 esac
1961                 $myecho
1962                 ;;
1963         esac
1964         case "\$ans\$xxxm\$nostick" in
1965         '')
1966                 ans=!
1967                 $myecho
1968                 ;;
1969         esac
1970 done
1971 case "\$ans" in
1972 '') ans="\$xxxm";;
1973 esac
1974 EOSC
1975
1976 : create .config dir to save info across Configure sessions
1977 test -d ../.config || mkdir ../.config
1978 cat >../.config/README <<EOF
1979 This directory created by Configure to save information that should
1980 persist across sessions for $package.
1981
1982 You may safely delete it if you wish.
1983 EOF
1984
1985 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1986 case "$usedevel" in
1987 $define|true|[yY]*) ;;
1988 *) case "$xversion" in
1989    *[13579])
1990         cat >&4 <<EOH
1991 *** WHOA THERE!!! ***
1992
1993     This is an UNSTABLE DEVELOPMENT release.
1994     The version of this $package distribution is $xversion, that is, odd,
1995     (as opposed to even) and that signifies a development release.
1996     If you want a maintenance release, you want an even-numbered version.
1997
1998     Do ***NOT*** install this into production use.
1999     Data corruption and crashes are possible.
2000
2001     It is most seriously suggested that you do not continue any further
2002     unless you want to help in developing and debugging Perl.
2003
2004     If you *still* want to build perl, you can answer 'y' now,
2005     or pass -Dusedevel to Configure.
2006
2007 EOH
2008         rp='Do you really want to continue?'
2009         dflt='n'
2010         . ./myread
2011         case "$ans" in
2012         [yY]) echo >&4 "Okay, continuing."
2013               usedevel="$define" ;;
2014         *) echo >&4 "Okay, bye."
2015            exit 1
2016            ;;
2017         esac
2018         ;;
2019     esac
2020     ;;
2021 esac
2022 case "$usedevel" in
2023 $define|true|[yY]*)
2024         case "$versiononly" in
2025         '') versiononly="$define" ;;
2026         esac
2027         case "$installusrbinperl" in
2028         '') installusrbinperl="$undef" ;;
2029         esac
2030         ;;
2031 esac
2032
2033 : general instructions
2034 needman=true
2035 firsttime=true
2036 user=`(logname) 2>/dev/null`
2037 case "$user" in
2038 '') user=`whoami 2>&1`;;
2039 esac
2040 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2041         firsttime=false
2042         echo " "
2043         rp='Would you like to see the instructions?'
2044         dflt=n
2045         . ./myread
2046         case "$ans" in
2047         [yY]*) ;;
2048         *) needman=false;;
2049         esac
2050 fi
2051 if $needman; then
2052         cat <<EOH
2053
2054 This installation shell script will examine your system and ask you questions
2055 to determine how the perl5 package should be installed. If you get
2056 stuck on a question, you may use a ! shell escape to start a subshell or
2057 execute a command.  Many of the questions will have default answers in square
2058 brackets; typing carriage return will give you the default.
2059
2060 On some of the questions which ask for file or directory names you are allowed
2061 to use the ~name construct to specify the login directory belonging to "name",
2062 even if you don't have a shell which knows about that.  Questions where this is
2063 allowed will be marked "(~name ok)".
2064
2065 EOH
2066         rp=''
2067         dflt='Type carriage return to continue'
2068         . ./myread
2069         cat <<'EOH'
2070
2071 The prompter used in this script allows you to use shell variables and
2072 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2073 in the default answer, as if the default line was a set of arguments given to a
2074 script shell.  This means you may also use $* to repeat the whole default line,
2075 so you do not have to re-type everything to add something to the default.
2076
2077 Everytime there is a substitution, you will have to confirm.  If there is an
2078 error (e.g. an unmatched backtick), the default answer will remain unchanged
2079 and you will be prompted again.
2080
2081 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2082 the questions and use the computed defaults (or the previous answers if there
2083 was already a config.sh file). Type 'Configure -h' for a list of options.
2084 You may also start interactively and then answer '& -d' at any prompt to turn
2085 on the non-interactive behaviour for the remainder of the execution.
2086
2087 EOH
2088         . ./myread
2089         cat <<EOH
2090
2091 Much effort has been expended to ensure that this shell script will run on any
2092 Unix system.  If despite that it blows up on yours, your best bet is to edit
2093 Configure and run it again.  If you can't run Configure for some reason,
2094 you'll have to generate a config.sh file by hand.  Whatever problems you
2095 have, let me (perlbug@perl.org) know how I blew it.
2096
2097 This installation script affects things in two ways:
2098
2099 1) it may do direct variable substitutions on some of the files included
2100    in this kit.
2101 2) it builds a config.h file for inclusion in C programs.  You may edit
2102    any of these files as the need arises after running this script.
2103
2104 If you make a mistake on a question, there is no easy way to back up to it
2105 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2106 files.  Configure will offer to let you do this before it runs the SH files.
2107
2108 EOH
2109         dflt='Type carriage return to continue'
2110         . ./myread
2111         case "$firsttime" in
2112         true) echo $user >>../.config/instruct;;
2113         esac
2114 fi
2115
2116 : find out where common programs are
2117 echo " "
2118 echo "Locating common programs..." >&4
2119 cat <<EOSC >loc
2120 $startsh
2121 case \$# in
2122 0) exit 1;;
2123 esac
2124 thing=\$1
2125 shift
2126 dflt=\$1
2127 shift
2128 for dir in \$*; do
2129         case "\$thing" in
2130         .)
2131         if test -d \$dir/\$thing; then
2132                 echo \$dir
2133                 exit 0
2134         fi
2135         ;;
2136         *)
2137         for thisthing in \$dir/\$thing; do
2138                 : just loop through to pick last item
2139         done
2140         if test -f \$thisthing; then
2141                 echo \$thisthing
2142                 exit 0
2143         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2144                 echo \$thisthing
2145                 exit 0
2146         elif test -f \$dir/\$thing.exe; then
2147                 if test -n "$DJGPP"; then
2148                         echo \$dir/\$thing.exe
2149                 else
2150                         : on Eunice apparently
2151                         echo \$dir/\$thing
2152                 fi
2153                 exit 0
2154         fi
2155         ;;
2156         esac
2157 done
2158 echo \$dflt
2159 exit 1
2160 EOSC
2161 chmod +x loc
2162 $eunicefix loc
2163 loclist="
2164 awk
2165 cat
2166 chmod
2167 comm
2168 cp
2169 echo
2170 expr
2171 grep
2172 ls
2173 mkdir
2174 rm
2175 sed
2176 sort
2177 touch
2178 tr
2179 uniq
2180 "
2181 trylist="
2182 Mcc
2183 ar
2184 bison
2185 byacc
2186 cpp
2187 csh
2188 date
2189 egrep
2190 gmake
2191 gzip
2192 less
2193 ln
2194 make
2195 more
2196 nm
2197 nroff
2198 pg
2199 test
2200 uname
2201 zip
2202 "
2203 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2204 pth="$pth /lib /usr/lib"
2205 for file in $loclist; do
2206         eval xxx=\$$file
2207         case "$xxx" in
2208         /*|?:[\\/]*)
2209                 if test -f "$xxx"; then
2210                         : ok
2211                 else
2212                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2213                         xxx=`./loc $file $file $pth`
2214                 fi
2215                 ;;
2216         '') xxx=`./loc $file $file $pth`;;
2217         *) xxx=`./loc $xxx $xxx $pth`;;
2218         esac
2219         eval $file=$xxx$_exe
2220         eval _$file=$xxx
2221         case "$xxx" in
2222         /*)
2223                 echo $file is in $xxx.
2224                 ;;
2225         ?:[\\/]*)
2226                 echo $file is in $xxx.
2227                 ;;
2228         *)
2229                 echo "I don't know where '$file' is, and my life depends on it." >&4
2230                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2231                 exit 1
2232                 ;;
2233         esac
2234 done
2235 echo " "
2236 echo "Don't worry if any of the following aren't found..."
2237 say=offhand
2238 for file in $trylist; do
2239         eval xxx=\$$file
2240         case "$xxx" in
2241         /*|?:[\\/]*)
2242                 if test -f "$xxx"; then
2243                         : ok
2244                 else
2245                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2246                         xxx=`./loc $file $file $pth`
2247                 fi
2248                 ;;
2249         '') xxx=`./loc $file $file $pth`;;
2250         *) xxx=`./loc $xxx $xxx $pth`;;
2251         esac
2252         eval $file=$xxx$_exe
2253         eval _$file=$xxx
2254         case "$xxx" in
2255         /*)
2256                 echo $file is in $xxx.
2257                 ;;
2258         ?:[\\/]*)
2259                 echo $file is in $xxx.
2260                 ;;
2261         *)
2262                 echo "I don't see $file out there, $say."
2263                 say=either
2264                 ;;
2265         esac
2266 done
2267 case "$egrep" in
2268 egrep)
2269         echo "Substituting grep for egrep."
2270         egrep=$grep
2271         _egrep=$grep
2272         ;;
2273 esac
2274 case "$ln" in
2275 ln)
2276         echo "Substituting cp for ln."
2277         ln=$cp
2278         _ln=$cp
2279         ;;
2280 esac
2281 case "$make" in
2282 make)   
2283         case "$gmake" in
2284         gmake)
2285         echo "I can't find make or gmake, and my life depends on it." >&4
2286         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2287         exit 1
2288         ;;
2289         esac
2290         ;;
2291 esac    
2292 case "$gmake" in
2293 gmake)  ;;
2294 *)      # We can't have osname yet.
2295         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2296                 # Assume that gmake, if found, is definitely GNU make
2297                 # and prefer it over the system make.
2298                 echo "Substituting gmake for make."
2299                 make=$gmake
2300                 _make=$gmake
2301         fi
2302         ;;
2303 esac
2304 case "$test" in
2305 test)
2306         echo "Hopefully test is built into your sh."
2307         ;;
2308 *)
2309         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2310                 echo "Using the test built into your sh."
2311                 test=test
2312                 _test=test
2313         fi
2314         ;;
2315 esac
2316 case "$echo" in
2317 echo)
2318         echo "Hopefully echo is built into your sh."
2319         ;;
2320 '') ;;
2321 *)
2322         echo " "
2323 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2324         $echo $n "hi there$c" >foo1
2325         echo $n "hi there$c" >foo2
2326         if cmp foo1 foo2 >/dev/null 2>&1; then
2327                 echo "They are compatible.  In fact, they may be identical."
2328         else
2329                 case "$n" in
2330                 '-n') n='' c='\c';;
2331                 *) n='-n' c='';;
2332                 esac
2333                 cat <<FOO
2334 They are not compatible!  You are probably running ksh on a non-USG system.
2335 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2336 have echo built in and we may have to run some Bourne shell scripts.  That
2337 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2338
2339 FOO
2340                 $echo $n "The star should be here-->$c"
2341                 $echo "*"
2342         fi
2343         $rm -f foo1 foo2
2344         ;;
2345 esac
2346
2347 cat <<EOS >trygcc
2348 $startsh
2349 EOS
2350 cat <<'EOSC' >>trygcc
2351 case "$cc" in
2352 '') ;;
2353 *)  $rm -f try try.*
2354     $cat >try.c <<EOM
2355 int main(int argc, char *argv[]) {
2356   return 0;
2357 }
2358 EOM
2359     if $cc -o try $ccflags $ldflags try.c; then
2360        :
2361     else
2362         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2363         despair=yes
2364         trygcc=yes
2365         case "$cc" in
2366         *gcc*) trygcc=no ;;
2367         esac
2368         case "`$cc -v -c try.c 2>&1`" in
2369         *gcc*) trygcc=no ;;
2370         esac
2371         if $test X"$trygcc" = Xyes; then
2372             if gcc -o try -c try.c; then
2373                 echo " "
2374                 echo "You seem to have a working gcc, though." >&4
2375                 rp="Would you like to use it?"
2376                 dflt=y
2377                 if $test -f myread; then
2378                     . ./myread
2379                 else
2380                     if $test -f UU/myread; then
2381                         . ./UU/myread
2382                     else
2383                         echo "Cannot find myread, sorry.  Aborting." >&2
2384                         exit 1
2385                     fi
2386                 fi  
2387                 case "$ans" in
2388                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2389                        if $test -f usethreads.cbu; then
2390                            $cat >&4 <<EOM 
2391
2392 *** However, any setting of the C compiler flags (e.g. for thread support)
2393 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2394 *** (together with e.g. -Dusethreads).
2395
2396 EOM
2397                        fi;;
2398                 esac
2399             fi
2400         fi
2401     fi
2402     $rm -f try try.*
2403     ;;
2404 esac
2405 EOSC
2406
2407 cat <<EOS >checkcc
2408 $startsh
2409 EOS
2410 cat <<'EOSC' >>checkcc
2411 case "$cc" in        
2412 '') ;;
2413 *)  $rm -f try try.*              
2414     $cat >try.c <<EOM
2415 int main(int argc, char *argv[]) {
2416   return 0;
2417 }
2418 EOM
2419     if $cc -o try $ccflags $ldflags try.c; then
2420        :
2421     else
2422         if $test X"$despair" = Xyes; then
2423            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2424         fi
2425         $cat >&4 <<EOM         
2426 You need to find a working C compiler.
2427 Either (purchase and) install the C compiler supplied by your OS vendor,
2428 or for a free C compiler try http://gcc.gnu.org/
2429 I cannot continue any further, aborting.
2430 EOM
2431         exit 1
2432     fi
2433     $rm -f try try.*
2434     ;;
2435 esac
2436 EOSC
2437
2438 : determine whether symbolic links are supported
2439 echo " "
2440 $touch blurfl
2441 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2442         echo "Symbolic links are supported." >&4
2443         lns="$ln -s"
2444 else
2445         echo "Symbolic links are NOT supported." >&4
2446         lns="$ln"
2447 fi
2448 $rm -f blurfl sym
2449
2450 : determine whether symbolic links are supported
2451 echo " "
2452 case "$lns" in
2453 *"ln"*" -s")
2454         echo "Checking how to test for symbolic links..." >&4
2455         $lns blurfl sym
2456         if $test "X$issymlink" = X; then
2457                 case "$newsh" in
2458                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2459                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2460                 esac
2461                 if test $? = 0; then
2462                         issymlink="test -h"
2463                 else
2464                         echo "Your builtin 'test -h' may be broken." >&4
2465                         case "$test" in
2466                         /*)     ;;
2467                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2468                                 for p in $pth
2469                                 do
2470                                         if test -f "$p/$test"; then
2471                                                 test="$p/$test"
2472                                                 break
2473                                         fi
2474                                 done
2475                                 ;;
2476                         esac
2477                         case "$test" in
2478                         /*)
2479                                 echo "Trying external '$test -h'." >&4
2480                                 issymlink="$test -h"
2481                                 if $test ! -h sym >/dev/null 2>&1; then
2482                                         echo "External '$test -h' is broken, too." >&4
2483                                         issymlink=''
2484                                 fi
2485                                 ;;
2486                         *)      issymlink='' ;;
2487                         esac
2488                 fi              
2489         fi
2490         if $test "X$issymlink" = X; then
2491                 if $test -L sym 2>/dev/null; then
2492                         issymlink="$test -L"
2493                         echo "The builtin '$test -L' worked." >&4
2494                 fi
2495         fi
2496         if $test "X$issymlink" != X; then
2497                 echo "You can test for symbolic links with '$issymlink'." >&4
2498         else
2499                 echo "I do not know how you can test for symbolic links." >&4
2500         fi
2501         $rm -f blurfl sym
2502         ;;
2503 *)      echo "No symbolic links, so not testing for their testing..." >&4
2504         ;;
2505 esac
2506 echo " "
2507
2508
2509 case "$mksymlinks" in
2510 $define|true|[yY]*)
2511         case "$src" in
2512         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2513                 exit 1
2514                 ;;
2515         *)      case "$lns:$issymlink" in
2516                 *"ln"*" -s:"*"test -"?)
2517                         echo "Creating the symbolic links..." >&4
2518                         echo "(First creating the subdirectories...)" >&4
2519                         cd ..
2520                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2521                                 read directory
2522                                 test -z "$directory" && break
2523                                 mkdir -p $directory
2524                         done
2525                         # Sanity check 1.
2526                         if test ! -d t/base; then
2527                                 echo "Failed to create the subdirectories.  Aborting." >&4
2528                                 exit 1
2529                         fi
2530                         echo "(Then creating the symlinks...)" >&4
2531                         awk '{print $1}' $src/MANIFEST | while true; do
2532                                 read filename
2533                                 test -z "$filename" && break
2534                                 if test -f $filename; then
2535                                         if $issymlink $filename; then
2536                                                 rm -f $filename
2537                                         fi
2538                                 fi
2539                                 if test -f $filename; then
2540                                         echo "$filename already exists, not symlinking."
2541                                 else
2542                                         ln -s $src/$filename $filename
2543                                 fi
2544                         done
2545                         # Sanity check 2.
2546                         if test ! -f t/base/lex.t; then
2547                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2548                                 exit 1
2549                         fi
2550                         cd UU
2551                         ;;
2552                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2553                         ;;
2554                 esac
2555                 ;;
2556         esac
2557         ;;
2558 esac
2559
2560
2561 case "$usecrosscompile" in
2562 $define|true|[yY]*)
2563         $echo "Cross-compiling..."
2564         croak=''
2565         case "$cc" in
2566         *-*-gcc) # A cross-compiling gcc, probably.
2567             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2568             ar=$targetarch-ar
2569             # leave out ld, choosing it is more complex
2570             nm=$targetarch-nm
2571             ranlib=$targetarch-ranlib
2572             $echo 'extern int foo;' > try.c
2573             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2574             shift
2575             if $test $# -gt 0; then
2576                 incpth="$incpth $*"
2577                 incpth="`$echo $incpth|$sed 's/^ //'`"
2578                 echo "Guessing incpth '$incpth'." >&4
2579                 for i in $*; do
2580                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2581                     if $test -d $j; then
2582                         libpth="$libpth $j"
2583                     fi
2584                 done   
2585                 libpth="`$echo $libpth|$sed 's/^ //'`"
2586                 echo "Guessing libpth '$libpth'." >&4
2587             fi
2588             $rm -f try.c
2589             ;;
2590         esac
2591         case "$targetarch" in
2592         '') echo "Targetarch not defined." >&4; croak=y ;;
2593         *)  echo "Using targetarch $targetarch." >&4 ;;
2594         esac
2595         case "$incpth" in
2596         '') echo "Incpth not defined." >&4; croak=y ;;
2597         *)  echo "Using incpth '$incpth'." >&4 ;;
2598         esac
2599         case "$libpth" in
2600         '') echo "Libpth not defined." >&4; croak=y ;;
2601         *)  echo "Using libpth '$libpth'." >&4 ;;
2602         esac
2603         case "$usrinc" in
2604         '') for i in $incpth; do
2605                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2606                     usrinc=$i
2607                     echo "Guessing usrinc $usrinc." >&4
2608                     break
2609                 fi
2610             done
2611             case "$usrinc" in
2612             '') echo "Usrinc not defined." >&4; croak=y ;;
2613             esac
2614             ;;
2615         *)  echo "Using usrinc $usrinc." >&4 ;;
2616         esac
2617         case "$targethost" in
2618         '') echo "Targethost not defined." >&4; croak=y ;;
2619         *)  echo "Using targethost $targethost." >&4
2620         esac
2621         locincpth=' '
2622         loclibpth=' '
2623         case "$croak" in
2624         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2625         esac
2626         case "$src" in
2627         /*) run=$src/Cross/run
2628             targetmkdir=$src/Cross/mkdir
2629             to=$src/Cross/to
2630             from=$src/Cross/from
2631             ;;
2632         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2633             run=$pwd/Cross/run
2634             targetmkdir=$pwd/Cross/mkdir
2635             to=$pwd/Cross/to
2636             from=$pwd/Cross/from
2637             ;;
2638         esac
2639         case "$targetrun" in
2640         '') targetrun=ssh ;;
2641         esac
2642         case "$targetto" in
2643         '') targetto=scp ;;
2644         esac
2645         case "$targetfrom" in
2646         '') targetfrom=scp ;;
2647         esac
2648         run=$run-$targetrun
2649         to=$to-$targetto
2650         from=$from-$targetfrom
2651         case "$targetdir" in
2652         '')  targetdir=/tmp
2653              echo "Guessing targetdir $targetdir." >&4
2654              ;;
2655         esac
2656         case "$targetuser" in
2657         '')  targetuser=root
2658              echo "Guessing targetuser $targetuser." >&4
2659              ;;
2660         esac
2661         case "$targetfrom" in
2662         scp)    q=-q ;;
2663         *)      q='' ;;
2664         esac
2665         case "$targetrun" in
2666         ssh|rsh)
2667             cat >$run <<EOF
2668 #!/bin/sh
2669 case "\$1" in
2670 -cwd)
2671   shift
2672   cwd=\$1
2673   shift
2674   ;;
2675 esac
2676 case "\$cwd" in
2677 '') cwd=$targetdir ;;
2678 esac
2679 exe=\$1
2680 shift
2681 if $test ! -f \$exe.xok; then
2682   $to \$exe
2683   $touch \$exe.xok
2684 fi
2685 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2686 EOF
2687             ;;
2688         *)  echo "Unknown targetrun '$targetrun'" >&4
2689             exit 1
2690             ;;
2691         esac
2692         case "$targetmkdir" in
2693         */Cross/mkdir)
2694             cat >$targetmkdir <<EOF
2695 #!/bin/sh
2696 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2697 EOF
2698             $chmod a+rx $targetmkdir
2699             ;;
2700         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2701             exit 1
2702             ;;
2703         esac
2704         case "$targetto" in
2705         scp|rcp)
2706             cat >$to <<EOF
2707 #!/bin/sh
2708 for f in \$@
2709 do
2710   case "\$f" in
2711   /*)
2712     $targetmkdir \`dirname \$f\`
2713     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2714     ;;
2715   *)
2716     $targetmkdir $targetdir/\`dirname \$f\`
2717     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2718     ;;
2719   esac
2720 done
2721 exit 0
2722 EOF
2723             ;;
2724         cp) cat >$to <<EOF
2725 #!/bin/sh
2726 for f in \$@
2727 do
2728   case "\$f" in
2729   /*)
2730     $mkdir -p $targetdir/\`dirname \$f\`
2731     $cp \$f $targetdir/\$f || exit 1
2732     ;;
2733   *)
2734     $targetmkdir $targetdir/\`dirname \$f\`
2735     $cp \$f $targetdir/\$f || exit 1
2736     ;;
2737   esac
2738 done
2739 exit 0
2740 EOF
2741             ;;
2742         *)  echo "Unknown targetto '$targetto'" >&4
2743             exit 1
2744             ;;
2745         esac
2746         case "$targetfrom" in
2747         scp|rcp)
2748           cat >$from <<EOF
2749 #!/bin/sh
2750 for f in \$@
2751 do
2752   $rm -f \$f
2753   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2754 done
2755 exit 0
2756 EOF
2757             ;;
2758         cp) cat >$from <<EOF
2759 #!/bin/sh
2760 for f in \$@
2761 do
2762   $rm -f \$f
2763   cp $targetdir/\$f . || exit 1
2764 done
2765 exit 0
2766 EOF
2767             ;;
2768         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2769             exit 1
2770             ;;
2771         esac
2772         if $test ! -f $run; then
2773             echo "Target 'run' script '$run' not found." >&4
2774         else
2775             $chmod a+rx $run
2776         fi
2777         if $test ! -f $to; then
2778             echo "Target 'to' script '$to' not found." >&4
2779         else
2780             $chmod a+rx $to
2781         fi
2782         if $test ! -f $from; then
2783             echo "Target 'from' script '$from' not found." >&4
2784         else
2785             $chmod a+rx $from
2786         fi
2787         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2788             exit 1
2789         fi
2790         cat >&4 <<EOF
2791 Using '$run' for remote execution,
2792 and '$from' and '$to'
2793 for remote file transfer.
2794 EOF
2795         ;;
2796 *)      run=''
2797         to=:
2798         from=:
2799         usecrosscompile='undef'
2800         targetarch=''
2801         ;;
2802 esac
2803
2804 : see whether [:lower:] and [:upper:] are supported character classes
2805 echo " "
2806 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2807 ABYZ)
2808         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2809         up='[:upper:]'
2810         low='[:lower:]'
2811         ;;
2812 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2813         # (0xc9 and 0xd1), therefore that is a nice testing point.
2814         if test "X$up" = X -o "X$low" = X; then
2815             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2816             ij) up='[A-Z]'
2817                 low='[a-z]'
2818                 ;;
2819             esac
2820         fi
2821         if test "X$up" = X -o "X$low" = X; then
2822             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2823             ij) up='A-Z'
2824                 low='a-z'
2825                 ;;
2826             esac
2827         fi
2828         if test "X$up" = X -o "X$low" = X; then
2829             case "`echo IJ | od -x 2>/dev/null`" in
2830             *C9D1*|*c9d1*)
2831                 echo "Hey, this might be EBCDIC." >&4
2832                 if test "X$up" = X -o "X$low" = X; then
2833                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2834                     ij) up='[A-IJ-RS-Z]'
2835                         low='[a-ij-rs-z]'
2836                         ;;
2837                     esac
2838                 fi
2839                 if test "X$up" = X -o "X$low" = X; then
2840                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2841                     ij) up='A-IJ-RS-Z'
2842                         low='a-ij-rs-z'
2843                         ;;
2844                     esac
2845                 fi
2846                 ;;
2847             esac
2848         fi
2849 esac
2850 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2851 ij)
2852     echo "Using $up and $low to convert case." >&4
2853     ;;
2854 *)
2855     echo "I don't know how to translate letters from upper to lower case." >&4
2856     echo "Your tr is not acting any way I know of." >&4
2857     exit 1
2858     ;;
2859 esac
2860 : set up the translation script tr, must be called with ./tr of course
2861 cat >tr <<EOSC
2862 $startsh
2863 case "\$1\$2" in
2864 '[A-Z][a-z]') exec $tr '$up' '$low';;
2865 '[a-z][A-Z]') exec $tr '$low' '$up';;
2866 esac
2867 exec $tr "\$@"
2868 EOSC
2869 chmod +x tr
2870 $eunicefix tr
2871
2872 : Try to determine whether config.sh was made on this system
2873 case "$config_sh" in
2874 '')
2875 myuname=`$uname -a 2>/dev/null`
2876 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2877 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2878 # because the A-Z/a-z are not consecutive.
2879 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2880         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2881 newmyuname="$myuname"
2882 dflt=n
2883 case "$knowitall" in
2884 '')
2885         if test -f ../config.sh; then
2886                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2887                         eval "`grep myuname= ../config.sh`"
2888                 fi
2889                 if test "X$myuname" = "X$newmyuname"; then
2890                         dflt=y
2891                 fi
2892         fi
2893         ;;
2894 *) dflt=y;;
2895 esac
2896
2897 : Get old answers from old config file if Configure was run on the
2898 : same system, otherwise use the hints.
2899 hint=default
2900 cd ..
2901 if test -f config.sh; then
2902         echo " "
2903         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2904         . UU/myread
2905         case "$ans" in
2906         n*|N*) echo "OK, I'll ignore it."
2907                 mv config.sh config.sh.old
2908                 myuname="$newmyuname"
2909                 ;;
2910         *)  echo "Fetching default answers from your old config.sh file..." >&4
2911                 tmp_n="$n"
2912                 tmp_c="$c"
2913                 tmp_sh="$sh"
2914                 . ./config.sh
2915                 cp config.sh UU
2916                 n="$tmp_n"
2917                 c="$tmp_c"
2918                 : Older versions did not always set $sh.  Catch re-use of such
2919                 : an old config.sh.
2920                 case "$sh" in
2921                 '') sh="$tmp_sh" ;;
2922                 esac
2923                 hint=previous
2924                 ;;
2925         esac
2926 fi
2927 . ./UU/checkcc
2928 if test ! -f config.sh; then
2929         $cat <<EOM
2930
2931 First time through, eh?  I have some defaults handy for some systems
2932 that need some extra help getting the Configure answers right:
2933
2934 EOM
2935         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2936         dflt=''
2937         : Half the following guesses are probably wrong... If you have better
2938         : tests or hints, please send them to perlbug@perl.org
2939         : The metaconfig authors would also appreciate a copy...
2940         $test -f /irix && osname=irix
2941         $test -f /xenix && osname=sco_xenix
2942         $test -f /dynix && osname=dynix
2943         $test -f /dnix && osname=dnix
2944         $test -f /lynx.os && osname=lynxos
2945         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2946         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2947         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2948         $test -f /bin/mips && /bin/mips && osname=mips
2949         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2950                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2951         $test -d /usr/apollo/bin && osname=apollo
2952         $test -f /etc/saf/_sactab && osname=svr4
2953         $test -d /usr/include/minix && osname=minix
2954         $test -f /system/gnu_library/bin/ar.pm && osname=vos
2955         if $test -d /MachTen -o -d /MachTen_Folder; then
2956                 osname=machten
2957                 if $test -x /sbin/version; then
2958                         osvers=`/sbin/version | $awk '{print $2}' |
2959                         $sed -e 's/[A-Za-z]$//'`
2960                 elif $test -x /usr/etc/version; then
2961                         osvers=`/usr/etc/version | $awk '{print $2}' |
2962                         $sed -e 's/[A-Za-z]$//'`
2963                 else
2964                         osvers="$2.$3"
2965                 fi
2966         fi
2967
2968         $test -f /sys/posix.dll &&
2969                 $test -f /usr/bin/what &&
2970                 set X `/usr/bin/what /sys/posix.dll` &&
2971                 $test "$3" = UWIN &&
2972                 osname=uwin &&
2973                 osvers="$5"
2974
2975         if $test -f $uname; then
2976                 set X $myuname
2977                 shift
2978
2979                 case "$5" in
2980                 fps*) osname=fps ;;
2981                 mips*)
2982                         case "$4" in
2983                         umips) osname=umips ;;
2984                         *) osname=mips ;;
2985                         esac;;
2986                 [23]100) osname=mips ;;
2987                 next*) osname=next ;;
2988                 i386*)
2989                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2990                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2991                                 osname='sco'
2992                                 osvers=$tmp
2993                         elif $test -f /etc/kconfig; then
2994                                 osname=isc
2995                                 if test "$lns" = "$ln -s"; then
2996                                         osvers=4
2997                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2998                                         osvers=3
2999                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3000                                         osvers=2
3001                                 fi
3002                         fi
3003                         tmp=''
3004                         ;;
3005                 pc*)
3006                         if test -n "$DJGPP"; then
3007                                 osname=dos
3008                                 osvers=djgpp
3009                         fi
3010                         ;;
3011                 esac
3012
3013                 case "$1" in
3014                 aix) osname=aix
3015                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3016                         case "$tmp" in
3017                         'not found') osvers="$4"."$3" ;;
3018                         '<3240'|'<>3240') osvers=3.2.0 ;;
3019                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3020                         '=3250'|'>3250') osvers=3.2.5 ;;
3021                         *) osvers=$tmp;;
3022                         esac
3023                         ;;
3024                 bsd386) osname=bsd386
3025                         osvers=`$uname -r`
3026                         ;;
3027                 cygwin*) osname=cygwin
3028                         osvers="$3"
3029                         ;;
3030                 *dc.osx) osname=dcosx
3031                         osvers="$3"
3032                         ;;
3033                 dnix) osname=dnix
3034                         osvers="$3"
3035                         ;;
3036                 domainos) osname=apollo
3037                         osvers="$3"
3038                         ;;
3039                 dgux) osname=dgux 
3040                         osvers="$3"
3041                         ;;
3042                 dynixptx*) osname=dynixptx
3043                         osvers=`echo "$4"|sed 's/^v//'`
3044                         ;;
3045                 freebsd) osname=freebsd 
3046                         osvers="$3" ;;
3047                 genix) osname=genix ;;
3048                 hp*) osname=hpux 
3049                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3050                         ;;
3051                 irix*) osname=irix
3052                         case "$3" in
3053                         4*) osvers=4 ;;
3054                         5*) osvers=5 ;;
3055                         *)      osvers="$3" ;;
3056                         esac
3057                         ;;
3058                 linux) osname=linux
3059                         case "$3" in
3060                         *)      osvers="$3" ;;
3061                         esac
3062                         ;;
3063                 MiNT) osname=mint
3064                         ;;
3065                 netbsd*) osname=netbsd
3066                         osvers="$3"
3067                         ;;
3068                 news-os) osvers="$3"
3069                         case "$3" in
3070                         4*) osname=newsos4 ;;
3071                         *) osname=newsos ;;
3072                         esac
3073                         ;;
3074                 next*) osname=next ;;
3075                 nonstop-ux) osname=nonstopux ;;
3076                 openbsd) osname=openbsd
3077                         osvers="$3"
3078                         ;;
3079                 POSIX-BC | posix-bc ) osname=posix-bc
3080                         osvers="$3"
3081                         ;;
3082                 powerux | power_ux | powermax_os | powermaxos | \
3083                 powerunix | power_unix) osname=powerux
3084                         osvers="$3"
3085                         ;;
3086                 qnx) osname=qnx
3087                         osvers="$4"
3088                         ;;
3089                 solaris) osname=solaris
3090                         case "$3" in
3091                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3092                         *)      osvers="$3" ;;
3093                         esac
3094                         ;;
3095                 sunos) osname=sunos
3096                         case "$3" in
3097                         5*) osname=solaris
3098                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3099                         *)      osvers="$3" ;;
3100                         esac
3101                         ;;
3102                 titanos) osname=titanos
3103                         case "$3" in
3104                         1*) osvers=1 ;;
3105                         2*) osvers=2 ;;
3106                         3*) osvers=3 ;;
3107                         4*) osvers=4 ;;
3108                         *)      osvers="$3" ;;
3109                         esac
3110                         ;;
3111                 ultrix) osname=ultrix
3112                         osvers="$3"
3113                         ;;
3114                 osf1|mls+)      case "$5" in
3115                                 alpha)
3116                                         osname=dec_osf
3117                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3118                                         case "$osvers" in
3119                                         [1-9].[0-9]*) ;;
3120                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3121                                         esac
3122                                         ;;
3123                         hp*)    osname=hp_osf1  ;;
3124                         mips)   osname=mips_osf1 ;;
3125                         esac
3126                         ;;
3127                 unixware) osname=svr5
3128                         osvers="$4"
3129                         ;;
3130                 uts)    osname=uts
3131                         osvers="$3"
3132                         ;;
3133                 vos) osvers="$3"
3134                         ;;
3135                 $2) case "$osname" in
3136                         *isc*) ;;
3137                         *freebsd*) ;;
3138                         svr*)
3139                                 : svr4.x or possibly later
3140                                 case "svr$3" in 
3141                                 ${osname}*)
3142                                         osname=svr$3
3143                                         osvers=$4
3144                                         ;;
3145                                 esac
3146                                 case "$osname" in
3147                                 svr4.0)
3148                                         : Check for ESIX
3149                                         if test -f /stand/boot ; then
3150                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3151                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3152                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3153                                                         if test -n "$isesix"; then
3154                                                                 osname=esix4
3155                                                         fi
3156                                                 fi
3157                                         fi
3158                                         ;;
3159                                 esac
3160                                 ;;
3161                         *)      if test -f /etc/systemid; then
3162                                         osname=sco
3163                                         set `echo $3 | $sed 's/\./ /g'` $4
3164                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3165                                                 osvers=$1.$2.$3
3166                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3167                                                 osvers=$1.$2
3168                                         elif $test -f $src/hints/sco_$1.sh; then
3169                                                 osvers=$1
3170                                         fi
3171                                 else
3172                                         case "$osname" in
3173                                         '') : Still unknown.  Probably a generic Sys V.
3174                                                 osname="sysv"
3175                                                 osvers="$3"
3176                                                 ;;
3177                                         esac
3178                                 fi
3179                                 ;;
3180                         esac
3181                         ;;
3182                 *)      case "$osname" in
3183                         '') : Still unknown.  Probably a generic BSD.
3184                                 osname="$1"
3185                                 osvers="$3"
3186                                 ;;
3187                         esac
3188                         ;;
3189                 esac
3190         else
3191                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3192                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3193                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3194                                 osname=news_os
3195                         fi
3196                         $rm -f UU/kernel.what
3197                 elif test -d c:/.; then
3198                         set X $myuname
3199                         osname=os2
3200                         osvers="$5"
3201                 fi
3202         fi
3203         
3204         case "$targetarch" in
3205         '') ;;
3206         *)  hostarch=$osname
3207             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3208             osvers=''
3209             ;;
3210         esac
3211
3212         : Now look for a hint file osname_osvers, unless one has been
3213         : specified already.
3214         case "$hintfile" in
3215         ''|' ')
3216                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3217                 : Also try without trailing minor version numbers.
3218                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3219                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3220                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3221                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3222                 case "$file" in
3223                 '') dflt=none ;;
3224                 *)  case "$osvers" in
3225                         '') dflt=$file
3226                                 ;;
3227                         *)  if $test -f $src/hints/$file.sh ; then
3228                                         dflt=$file
3229                                 elif $test -f $src/hints/$xfile.sh ; then
3230                                         dflt=$xfile
3231                                 elif $test -f $src/hints/$xxfile.sh ; then
3232                                         dflt=$xxfile
3233                                 elif $test -f $src/hints/$xxxfile.sh ; then
3234                                         dflt=$xxxfile
3235                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3236                                         dflt=$xxxxfile
3237                                 elif $test -f "$src/hints/${osname}.sh" ; then
3238                                         dflt="${osname}"
3239                                 else
3240                                         dflt=none
3241                                 fi
3242                                 ;;
3243                         esac
3244                         ;;
3245                 esac
3246                 if $test -f Policy.sh ; then
3247                         case "$dflt" in
3248                         *Policy*) ;;
3249                         none) dflt="Policy" ;;
3250                         *) dflt="Policy $dflt" ;;
3251                         esac
3252                 fi
3253                 ;;
3254         *)
3255                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3256                 ;;
3257         esac
3258
3259         if $test -f Policy.sh ; then
3260                 $cat <<EOM
3261
3262 There's also a Policy hint file available, which should make the
3263 site-specific (policy) questions easier to answer.
3264 EOM
3265
3266         fi
3267
3268         $cat <<EOM
3269
3270 You may give one or more space-separated answers, or "none" if appropriate.
3271 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3272 is a good thing.  DO NOT give a wrong version or a wrong OS.
3273
3274 EOM
3275
3276         rp="Which of these apply, if any?"
3277         . UU/myread
3278         tans=$ans
3279         for file in $tans; do
3280                 if $test X$file = XPolicy -a -f Policy.sh; then
3281                         . Policy.sh
3282                         $cat Policy.sh >> UU/config.sh
3283                 elif $test -f $src/hints/$file.sh; then
3284                         . $src/hints/$file.sh
3285                         $cat $src/hints/$file.sh >> UU/config.sh
3286                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3287                         : nothing
3288                 else
3289                         : Give one chance to correct a possible typo.
3290                         echo "$file.sh does not exist"
3291                         dflt=$file
3292                         rp="hint to use instead?"
3293                         . UU/myread
3294                         for file in $ans; do
3295                                 if $test -f "$src/hints/$file.sh"; then
3296                                         . $src/hints/$file.sh
3297                                         $cat $src/hints/$file.sh >> UU/config.sh
3298                                 elif $test X$ans = X -o X$ans = Xnone ; then
3299                                         : nothing
3300                                 else
3301                                         echo "$file.sh does not exist -- ignored."
3302                                 fi
3303                         done
3304                 fi
3305         done
3306
3307         hint=recommended
3308         : Remember our hint file for later.
3309         if $test -f "$src/hints/$file.sh" ; then
3310                 hintfile="$file"
3311         else
3312                 hintfile=''
3313         fi
3314 fi
3315 cd UU
3316 ;;
3317 *)
3318         echo " "
3319         echo "Fetching default answers from $config_sh..." >&4
3320         tmp_n="$n"
3321         tmp_c="$c"
3322         cd ..
3323         cp $config_sh config.sh 2>/dev/null
3324         chmod +w config.sh
3325         . ./config.sh
3326         cd UU
3327         cp ../config.sh .
3328         n="$tmp_n"
3329         c="$tmp_c"
3330         hint=previous
3331         ;;
3332 esac
3333 test "$override" && . ./optdef.sh
3334
3335 : Restore computed paths
3336 for file in $loclist $trylist; do
3337         eval $file="\$_$file"
3338 done
3339
3340 cat << EOM
3341
3342 Configure uses the operating system name and version to set some defaults.
3343 The default value is probably right if the name rings a bell. Otherwise,
3344 since spelling matters for me, either accept the default or answer "none"
3345 to leave it blank.
3346
3347 EOM
3348 case "$osname" in
3349         ''|' ')
3350                 case "$hintfile" in
3351                 ''|' '|none) dflt=none ;;
3352                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3353                 esac
3354                 ;;
3355         *) dflt="$osname" ;;
3356 esac
3357 rp="Operating system name?"
3358 . ./myread
3359 case "$ans" in
3360 none)  osname='' ;;
3361 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3362 esac
3363 echo " "
3364 case "$osvers" in
3365         ''|' ')
3366                 case "$hintfile" in
3367                 ''|' '|none) dflt=none ;;
3368                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3369                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3370                         case "$dflt" in
3371                         ''|' ') dflt=none ;;
3372                         esac
3373                         ;;
3374                 esac
3375                 ;;
3376         *) dflt="$osvers" ;;
3377 esac
3378 rp="Operating system version?"
3379 . ./myread
3380 case "$ans" in
3381 none)  osvers='' ;;
3382 *) osvers="$ans" ;;
3383 esac
3384
3385
3386 . ./posthint.sh
3387
3388 : who configured the system
3389 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3390 cf_by=`(logname) 2>/dev/null`
3391 case "$cf_by" in
3392 "")
3393         cf_by=`(whoami) 2>/dev/null`
3394         case "$cf_by" in
3395         "") cf_by=unknown ;;
3396         esac ;;
3397 esac
3398
3399 : set up the script used to warn in case of inconsistency
3400 cat <<EOS >whoa
3401 $startsh
3402 EOS
3403 cat <<'EOSC' >>whoa
3404 dflt=y
3405 echo " "
3406 echo "*** WHOA THERE!!! ***" >&4
3407 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3408 rp="    Keep the $hint value?"
3409 . ./myread
3410 case "$ans" in
3411 y) td=$was; tu=$was;;
3412 esac
3413 EOSC
3414
3415 : function used to set $1 to $val
3416 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3417 case "$val$was" in
3418 $define$undef) . ./whoa; eval "$var=\$td";;
3419 $undef$define) . ./whoa; eval "$var=\$tu";;
3420 *) eval "$var=$val";;
3421 esac'
3422
3423 case "$usethreads" in
3424 $define|true|[yY]*)     dflt='y';;
3425 *)     # Catch case where user specified ithreads or 5005threads but
3426        # forgot -Dusethreads (A.D. 4/2002)
3427        case "$useithreads$use5005threads" in
3428        *$define*)      dflt='y' ;;
3429        *)      dflt='n';;
3430        esac
3431        ;;
3432 esac
3433 cat <<EOM
3434
3435 Perl can be built to take advantage of threads on some systems.
3436 To do so, Configure can be run with -Dusethreads.
3437
3438 Note that threading is a highly experimental feature, and
3439 some known race conditions still remain.  If you choose to try
3440 it, be very sure to not actually deploy it for production
3441 purposes.  README.threads has more details, and is required
3442 reading if you enable threads.
3443
3444 If this doesn't make any sense to you, just accept the default '$dflt'.
3445 EOM
3446 rp='Build a threading Perl?'
3447 . ./myread
3448 case "$ans" in
3449 y|Y)    val="$define" ;;
3450 *)      val="$undef" ;;
3451 esac
3452 set usethreads
3453 eval $setvar
3454
3455 case "$usethreads" in
3456 $define)
3457         $cat <<EOM
3458
3459 As of release 5.6, Perl has two different threading implementations,
3460 an interpreter-based version (ithreads) with one interpreter per
3461 thread, and the 5.005 version (5005threads).  Both implementations
3462 are considered experimental, but since 5.8 ithreads somewhat less so.
3463 The 5005threads is effectively unmaintained.
3464
3465 EOM
3466         : Default to ithreads unless overridden on command line or with
3467         : old config.sh
3468         dflt='y'
3469         case "$use5005threads" in
3470                 $define|true|[yY]*) dflt='n';;
3471         esac
3472         case "$useithreads" in
3473                 $undef|false|[nN]*) dflt='n';;
3474         esac
3475         rp='Use interpreter-based ithreads?'
3476         . ./myread
3477         case "$ans" in
3478         y|Y)    val="$define" ;;
3479         *)      val="$undef" ;;
3480         esac
3481         set useithreads
3482         eval $setvar
3483         : Now set use5005threads to the opposite value.
3484         case "$useithreads" in
3485         $define) val="$undef" ;;
3486         *) val="$define" ;;
3487         esac
3488         set use5005threads
3489         eval $setvar
3490         ;;
3491 *)
3492         useithreads="$undef"
3493         use5005threads="$undef"
3494         ;;
3495 esac
3496
3497 case "$useithreads$use5005threads" in
3498 "$define$define")
3499         $cat >&4 <<EOM
3500
3501 You cannot have both the ithreads and the 5.005 threads enabled
3502 at the same time.  Disabling the 5.005 threads since they are
3503 much less stable than the ithreads.
3504
3505 EOM
3506         use5005threads="$undef"
3507         ;;
3508 esac
3509
3510 case "$d_oldpthreads" in
3511 '')     : Configure tests would be welcome here.  For now, assume undef.
3512         val="$undef" ;;
3513 *)      val="$d_oldpthreads" ;;
3514 esac
3515 set d_oldpthreads
3516 eval $setvar
3517
3518
3519 case "$usethreads" in
3520 "$define"|true|[yY]*)
3521 : Look for a hint-file generated 'call-back-unit'.  If the
3522 : user has specified that a threading perl is to be built,
3523 : we may need to set or change some other defaults.
3524         if $test -f usethreads.cbu; then
3525                 echo "Your platform has some specific hints for threaded builds, using them..."
3526                 . ./usethreads.cbu
3527         else
3528                 $cat <<EOM
3529 (Your platform doesn't have any specific hints for threaded builds.
3530  Assuming POSIX threads, then.)
3531 EOM
3532         fi
3533         ;;
3534 esac
3535
3536 cat <<EOM
3537
3538 Perl can be built so that multiple Perl interpreters can coexist
3539 within the same Perl executable.
3540 EOM
3541
3542 case "$useithreads" in
3543 $define)
3544         cat <<EOM
3545 This multiple interpreter support is required for interpreter-based threads.
3546 EOM
3547         val="$define"
3548         ;;
3549 *)      case "$usemultiplicity" in
3550         $define|true|[yY]*)     dflt='y';;
3551         *) dflt='n';;
3552         esac
3553         echo " "
3554         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3555         rp='Build Perl for multiplicity?'
3556         . ./myread
3557         case "$ans" in
3558         y|Y)    val="$define" ;;
3559         *)      val="$undef" ;;
3560         esac
3561         ;;
3562 esac
3563 set usemultiplicity
3564 eval $setvar
3565
3566
3567 case "$usemorebits" in
3568 "$define"|true|[yY]*)
3569         use64bitint="$define"
3570         uselongdouble="$define"
3571         usemorebits="$define"
3572         ;;
3573 *)      usemorebits="$undef"
3574         ;;
3575 esac
3576
3577 : make some quick guesses about what we are up against
3578 echo " "
3579 $echo $n "Hmm...  $c"
3580 echo exit 1 >bsd
3581 echo exit 1 >usg
3582 echo exit 1 >v7
3583 echo exit 1 >osf1
3584 echo exit 1 >eunice
3585 echo exit 1 >xenix
3586 echo exit 1 >venix
3587 echo exit 1 >os2
3588 d_bsd="$undef"
3589 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3590 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3591 then
3592         echo "Looks kind of like an OSF/1 system, but we'll see..."
3593         echo exit 0 >osf1
3594 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3595         xxx=`./loc addbib blurfl $pth`
3596         if $test -f $xxx; then
3597         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3598                 echo exit 0 >bsd
3599                 echo exit 0 >usg
3600         else
3601                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3602                         echo "Looks kind of like an extended USG system, but we'll see..."
3603                 else
3604                         echo "Looks kind of like a USG system, but we'll see..."
3605                 fi
3606                 echo exit 0 >usg
3607         fi
3608 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3609         echo "Looks kind of like a BSD system, but we'll see..."
3610         d_bsd="$define"
3611         echo exit 0 >bsd
3612 else
3613         echo "Looks kind of like a Version 7 system, but we'll see..."
3614         echo exit 0 >v7
3615 fi
3616 case "$eunicefix" in
3617 *unixtovms*)
3618         $cat <<'EOI'
3619 There is, however, a strange, musty smell in the air that reminds me of
3620 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3621 EOI
3622         echo exit 0 >eunice
3623         d_eunice="$define"
3624 : it so happens the Eunice I know will not run shell scripts in Unix format
3625         ;;
3626 *)
3627         echo " "
3628         echo "Congratulations.  You aren't running Eunice."
3629         d_eunice="$undef"
3630         ;;
3631 esac
3632 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3633 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3634 : semicolon as a patch separator
3635 case "$p_" in
3636 :) ;;
3637 *)
3638         $cat <<'EOI'
3639 I have the feeling something is not exactly right, however...don't tell me...
3640 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3641 (Or you may be running DOS with DJGPP.)
3642 EOI
3643         echo exit 0 >os2
3644         ;;
3645 esac
3646 if test -f /xenix; then
3647         echo "Actually, this looks more like a XENIX system..."
3648         echo exit 0 >xenix
3649         d_xenix="$define"
3650 else
3651         echo " "
3652         echo "It's not Xenix..."
3653         d_xenix="$undef"
3654 fi
3655 chmod +x xenix
3656 $eunicefix xenix
3657 if test -f /venix; then
3658         echo "Actually, this looks more like a VENIX system..."
3659         echo exit 0 >venix
3660 else
3661         echo " "
3662         if ./xenix; then
3663                 : null
3664         else
3665                 echo "Nor is it Venix..."
3666         fi
3667 fi
3668 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3669 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3670 $rm -f foo
3671
3672 case "$cc" in
3673 '') dflt=cc;;
3674 *) dflt="$cc";;
3675 esac
3676 rp="Use which C compiler?"
3677 . ./myread
3678 cc="$ans"
3679
3680 : See if they have not cc but they do have gcc
3681 . ./trygcc
3682 : Look for a hint-file generated 'call-back-unit'.  Now that the
3683 : user has specified the compiler, we may need to set or change some
3684 : other defaults.
3685 if $test -f cc.cbu; then
3686     . ./cc.cbu
3687 fi
3688 . ./checkcc
3689
3690 echo " "
3691 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3692 $cat >try.c <<EOM
3693 #include <stdio.h>
3694 int main() {
3695 #ifdef __GNUC__
3696 #ifdef __VERSION__
3697         printf("%s\n", __VERSION__);
3698 #else
3699         printf("%s\n", "1");
3700 #endif
3701 #endif
3702         exit(0);
3703 }
3704 EOM
3705 if $cc -o try $ccflags $ldflags try.c; then
3706         gccversion=`$run ./try`
3707         case "$gccversion" in
3708         '') echo "You are not using GNU cc." ;;
3709         *)  echo "You are using GNU cc $gccversion."
3710             ccname=gcc  
3711             ;;
3712         esac
3713 else
3714         echo " "
3715         echo "*** WHOA THERE!!! ***" >&4
3716         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3717         case "$knowitall" in
3718         '')
3719         echo "    You'd better start hunting for one and let me know about it." >&4
3720                 exit 1
3721                 ;;
3722         esac
3723 fi
3724 $rm -f try try.*
3725 case "$gccversion" in
3726 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3727 esac
3728 case "$gccversion" in
3729 '') gccosandvers='' ;;
3730 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3731    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3732    gccshortvers=''
3733    case "$gccosandvers" in
3734    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3735    $osname$osvers) ;; # looking good
3736    $osname*) cat <<EOM >&4
3737
3738 *** WHOA THERE!!! ***
3739
3740     Your gcc has not been compiled for the exact release of
3741     your operating system ($gccosandvers versus $osname$osvers).
3742
3743     In general it is a good idea to keep gcc synchronized with
3744     the operating system because otherwise serious problems
3745     may ensue when trying to compile software, like Perl.
3746
3747     I'm trying to be optimistic here, though, and will continue.
3748     If later during the configuration and build icky compilation
3749     problems appear (headerfile conflicts being the most common
3750     manifestation), I suggest reinstalling the gcc to match
3751     your operating system release.
3752
3753 EOM
3754       ;;
3755    *) gccosandvers='' ;; # failed to parse, better be silent
3756    esac
3757    ;;
3758 esac
3759 case "$ccname" in
3760 '') ccname="$cc" ;;
3761 esac
3762
3763
3764 : decide how portable to be.  Allow command line overrides.
3765 case "$d_portable" in
3766 "$undef") ;;
3767 *)      d_portable="$define" ;;
3768 esac
3769
3770 : set up shell script to do ~ expansion
3771 cat >filexp <<EOSS
3772 $startsh
3773 : expand filename
3774 case "\$1" in
3775  ~/*|~)
3776         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3777         ;;
3778  ~*)
3779         if $test -f /bin/csh; then
3780                 /bin/csh -f -c "glob \$1"
3781                 failed=\$?
3782                 echo ""
3783                 exit \$failed
3784         else
3785                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3786                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3787                 if $test ! -d "\$dir"; then
3788                         me=\`basename \$0\`
3789                         echo "\$me: can't locate home directory for: \$name" >&2
3790                         exit 1
3791                 fi
3792                 case "\$1" in
3793                 */*)
3794                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3795                         ;;
3796                 *)
3797                         echo \$dir
3798                         ;;
3799                 esac
3800         fi
3801         ;;
3802 *)
3803         echo \$1
3804         ;;
3805 esac
3806 EOSS
3807 chmod +x filexp
3808 $eunicefix filexp
3809
3810 : now set up to get a file name
3811 cat <<EOS >getfile
3812 $startsh
3813 EOS
3814 cat <<'EOSC' >>getfile
3815 tilde=''
3816 fullpath=''
3817 already=''
3818 skip=''
3819 none_ok=''
3820 exp_file=''
3821 nopath_ok=''
3822 orig_rp="$rp"
3823 orig_dflt="$dflt"
3824 case "$gfpth" in
3825 '') gfpth='.' ;;
3826 esac
3827
3828 case "$fn" in
3829 *\(*)
3830         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3831         fn=`echo $fn | sed 's/(.*)//'`
3832         ;;
3833 esac
3834
3835 case "$fn" in
3836 *:*)
3837         loc_file=`expr $fn : '.*:\(.*\)'`
3838         fn=`expr $fn : '\(.*\):.*'`
3839         ;;
3840 esac
3841
3842 case "$fn" in
3843 *~*) tilde=true;;
3844 esac
3845 case "$fn" in
3846 */*) fullpath=true;;
3847 esac
3848 case "$fn" in
3849 *+*) skip=true;;
3850 esac
3851 case "$fn" in
3852 *n*) none_ok=true;;
3853 esac
3854 case "$fn" in
3855 *e*) exp_file=true;;
3856 esac
3857 case "$fn" in
3858 *p*) nopath_ok=true;;
3859 esac
3860
3861 case "$fn" in
3862 *f*) type='File';;
3863 *d*) type='Directory';;
3864 *l*) type='Locate';;
3865 esac
3866
3867 what="$type"
3868 case "$what" in
3869 Locate) what='File';;
3870 esac
3871
3872 case "$exp_file" in
3873 '')
3874         case "$d_portable" in
3875         "$define") ;;
3876         *) exp_file=true;;
3877         esac
3878         ;;
3879 esac
3880
3881 cd ..
3882 while test "$type"; do
3883         redo=''
3884         rp="$orig_rp"
3885         dflt="$orig_dflt"
3886         case "$tilde" in
3887         true) rp="$rp (~name ok)";;
3888         esac
3889         . UU/myread
3890         if test -f UU/getfile.ok && \
3891                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3892         then
3893                 value="$ans"
3894                 ansexp="$ans"
3895                 break
3896         fi
3897         case "$ans" in
3898         none)
3899                 value=''
3900                 ansexp=''
3901                 case "$none_ok" in
3902                 true) type='';;
3903                 esac
3904                 ;;
3905         *)
3906                 case "$tilde" in
3907                 '') value="$ans"
3908                         ansexp="$ans";;
3909                 *)
3910                         value=`UU/filexp $ans`
3911                         case $? in
3912                         0)
3913                                 if test "$ans" != "$value"; then
3914                                         echo "(That expands to $value on this system.)"
3915                                 fi
3916                                 ;;
3917                         *) value="$ans";;
3918                         esac
3919                         ansexp="$value"
3920                         case "$exp_file" in
3921                         '') value="$ans";;
3922                         esac
3923                         ;;
3924                 esac
3925                 case "$fullpath" in
3926                 true)
3927                         case "$ansexp" in
3928                         /*) value="$ansexp" ;;
3929                         [a-zA-Z]:/*) value="$ansexp" ;;
3930                         *)
3931                                 redo=true
3932                                 case "$already" in
3933                                 true)
3934                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3935                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3936                                         ;;
3937                                 *)
3938                                 echo "Please give a full path name, starting with slash." >&4
3939                                         case "$tilde" in
3940                                         true)
3941                                 echo "Note that using ~name is ok provided it expands well." >&4
3942                                                 already=true
3943                                                 ;;
3944                                         esac
3945                                 esac
3946                                 ;;
3947                         esac
3948                         ;;
3949                 esac
3950                 case "$redo" in
3951                 '')
3952                         case "$type" in
3953                         File)
3954                                 for fp in $gfpth; do
3955                                         if test "X$fp" = X.; then
3956                                             pf="$ansexp"
3957                                         else    
3958                                             pf="$fp/$ansexp"
3959                                         fi
3960                                         if test -f "$pf"; then
3961                                                 type=''
3962                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3963                                         then
3964                                                 echo "($value is not a plain file, but that's ok.)"
3965                                                 type=''
3966                                         fi
3967                                         if test X"$type" = X; then
3968                                             value="$pf"
3969                                             break
3970                                         fi
3971                                 done
3972                                 ;;
3973                         Directory)
3974                                 for fp in $gfpth; do
3975                                         if test "X$fp" = X.; then
3976                                             dir="$ans"
3977                                             direxp="$ansexp"
3978                                         else    
3979                                             dir="$fp/$ansexp"
3980                                             direxp="$fp/$ansexp"
3981                                         fi
3982                                         if test -d "$direxp"; then
3983                                                 type=''
3984                                                 value="$dir"
3985                                                 break
3986                                         fi
3987                                 done
3988                                 ;;
3989                         Locate)
3990                                 if test -d "$ansexp"; then
3991                                         echo "(Looking for $loc_file in directory $value.)"
3992                                         value="$value/$loc_file"
3993                                         ansexp="$ansexp/$loc_file"
3994                                 fi
3995                                 if test -f "$ansexp"; then
3996                                         type=''
3997                                 fi
3998                                 case "$nopath_ok" in
3999                                 true)   case "$value" in
4000                                         */*) ;;
4001                                         *)      echo "Assuming $value will be in people's path."
4002                                                 type=''
4003                                                 ;;
4004                                         esac
4005                                         ;;
4006                                 esac
4007                                 ;;
4008                         esac
4009
4010                         case "$skip" in
4011                         true) type='';
4012                         esac
4013
4014                         case "$type" in
4015                         '') ;;
4016                         *)
4017                                 if test "$fastread" = yes; then
4018                                         dflt=y
4019                                 else
4020                                         dflt=n
4021                                 fi
4022                                 rp="$what $value doesn't exist.  Use that name anyway?"
4023                                 . UU/myread
4024                                 dflt=''
4025                                 case "$ans" in
4026                                 y*) type='';;
4027                                 *) echo " ";;
4028                                 esac
4029                                 ;;
4030                         esac
4031                         ;;
4032                 esac
4033                 ;;
4034         esac
4035 done
4036 cd UU
4037 ans="$value"
4038 rp="$orig_rp"
4039 dflt="$orig_dflt"
4040 rm -f getfile.ok
4041 test "X$gfpthkeep" != Xy && gfpth=""
4042 EOSC
4043
4044 : What should the include directory be ?
4045 echo " "
4046 $echo $n "Hmm...  $c"
4047 dflt='/usr/include'
4048 incpath=''
4049 mips_type=''
4050 if $test -f /bin/mips && /bin/mips; then
4051         echo "Looks like a MIPS system..."
4052         $cat >usr.c <<'EOCP'
4053 #ifdef SYSTYPE_BSD43
4054 /bsd43
4055 #endif
4056 EOCP
4057         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4058                 dflt='/bsd43/usr/include'
4059                 incpath='/bsd43'
4060                 mips_type='BSD 4.3'
4061         else
4062                 mips_type='System V'
4063         fi
4064         $rm -f usr.c usr.out
4065         echo "and you're compiling with the $mips_type compiler and libraries."
4066         xxx_prompt=y
4067         echo "exit 0" >mips
4068 else
4069         echo "Doesn't look like a MIPS system."
4070         xxx_prompt=n
4071         echo "exit 1" >mips
4072 fi
4073 chmod +x mips
4074 $eunicefix mips
4075 case "$usrinc" in
4076 '') ;;
4077 *) dflt="$usrinc";;
4078 esac
4079 case "$xxx_prompt" in
4080 y)      fn=d/
4081         echo " "
4082         rp='Where are the include files you want to use?'
4083         . ./getfile
4084         usrinc="$ans"
4085         ;;
4086 *)      usrinc="$dflt"
4087         ;;
4088 esac
4089
4090 : see how we invoke the C preprocessor
4091 echo " "
4092 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4093 cat <<'EOT' >testcpp.c
4094 #define ABC abc
4095 #define XYZ xyz
4096 ABC.XYZ
4097 EOT
4098 cd ..
4099 if test ! -f cppstdin; then
4100         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4101                 # AIX cc -E doesn't show the absolute headerfile
4102                 # locations but we'll cheat by using the -M flag.
4103                 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
4104         else
4105                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4106         fi
4107 else
4108         echo "Keeping your $hint cppstdin wrapper."
4109 fi
4110 chmod 755 cppstdin
4111 wrapper=`pwd`/cppstdin
4112 ok='false'
4113 cd UU
4114
4115 if $test "X$cppstdin" != "X" && \
4116         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4117         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4118 then
4119         echo "You used to use $cppstdin $cppminus so we'll use that again."
4120         case "$cpprun" in
4121         '') echo "But let's see if we can live without a wrapper..." ;;
4122         *)
4123                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4124                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4125                 then
4126                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4127                         ok='true'
4128                 else
4129                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4130                 fi
4131                 ;;
4132         esac
4133 else
4134         case "$cppstdin" in
4135         '') ;;
4136         *)
4137                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4138                 ;;
4139         esac
4140 fi
4141
4142 if $ok; then
4143         : nothing
4144 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4145         $cc -E <testcpp.c >testcpp.out 2>&1; \
4146         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4147         echo "Yup, it does."
4148         x_cpp="$cc -E"
4149         x_minus='';
4150 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4151         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4152         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4153         echo "Yup, it does."
4154         x_cpp="$cc -E"
4155         x_minus='-';
4156 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4157         $cc -P <testcpp.c >testcpp.out 2>&1; \
4158         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4159         echo "Yipee, that works!"
4160         x_cpp="$cc -P"
4161         x_minus='';
4162 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4163         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4164         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4165         echo "At long last!"
4166         x_cpp="$cc -P"
4167         x_minus='-';
4168 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4169         $cpp <testcpp.c >testcpp.out 2>&1; \
4170         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4171         echo "It works!"
4172         x_cpp="$cpp"
4173         x_minus='';
4174 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4175         $cpp - <testcpp.c >testcpp.out 2>&1; \
4176         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4177         echo "Hooray, it works!  I was beginning to wonder."
4178         x_cpp="$cpp"
4179         x_minus='-';
4180 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4181         $wrapper <testcpp.c >testcpp.out 2>&1; \
4182         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4183         x_cpp="$wrapper"
4184         x_minus=''
4185         echo "Eureka!"
4186 else
4187         dflt=''
4188         rp="No dice.  I can't find a C preprocessor.  Name one:"
4189         . ./myread
4190         x_cpp="$ans"
4191         x_minus=''
4192         $x_cpp <testcpp.c >testcpp.out 2>&1
4193         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4194                 echo "OK, that will do." >&4
4195         else
4196 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4197                 exit 1
4198         fi
4199 fi
4200
4201 case "$ok" in
4202 false)
4203         cppstdin="$x_cpp"
4204         cppminus="$x_minus"
4205         cpprun="$x_cpp"
4206         cpplast="$x_minus"
4207         set X $x_cpp
4208         shift
4209         case "$1" in
4210         "$cpp")
4211                 echo "Perhaps can we force $cc -E using a wrapper..."
4212                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4213                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4214                 then
4215                         echo "Yup, we can."
4216                         cppstdin="$wrapper"
4217                         cppminus='';
4218                 else
4219                         echo "Nope, we'll have to live without it..."
4220                 fi
4221                 ;;
4222         esac
4223         case "$cpprun" in
4224         "$wrapper")
4225                 cpprun=''
4226                 cpplast=''
4227                 ;;
4228         esac
4229         ;;
4230 esac
4231
4232 case "$cppstdin" in
4233 "$wrapper"|'cppstdin') ;;
4234 *) $rm -f $wrapper;;
4235 esac
4236 $rm -f testcpp.c testcpp.out
4237
4238 : Set private lib path
4239 case "$plibpth" in
4240 '') if ./mips; then
4241                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4242         fi;;
4243 esac
4244 case "$libpth" in
4245 ' ') dlist='';;
4246 '') dlist="$loclibpth $plibpth $glibpth";;
4247 *) dlist="$libpth";;
4248 esac
4249
4250 : Now check and see which directories actually exist, avoiding duplicates
4251 libpth=''
4252 for xxx in $dlist
4253 do
4254     if $test -d $xxx; then
4255                 case " $libpth " in
4256                 *" $xxx "*) ;;
4257                 *) libpth="$libpth $xxx";;
4258                 esac
4259     fi
4260 done
4261 $cat <<'EOM'
4262
4263 Some systems have incompatible or broken versions of libraries.  Among
4264 the directories listed in the question below, please remove any you
4265 know not to be holding relevant libraries, and add any that are needed.
4266 Say "none" for none.
4267
4268 EOM
4269 case "$libpth" in
4270 '') dflt='none';;
4271 *)
4272         set X $libpth
4273         shift
4274         dflt=${1+"$@"}
4275         ;;
4276 esac
4277 rp="Directories to use for library searches?"
4278 . ./myread
4279 case "$ans" in
4280 none) libpth=' ';;
4281 *) libpth="$ans";;
4282 esac
4283
4284 : compute shared library extension
4285 case "$so" in
4286 '')
4287         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4288                 dflt='sl'
4289         else
4290                 dflt='so'
4291         fi
4292         ;;
4293 *) dflt="$so";;
4294 esac
4295 $cat <<EOM
4296
4297 On some systems, shared libraries may be available.  Answer 'none' if
4298 you want to suppress searching of shared libraries for the remainder
4299 of this configuration.
4300
4301 EOM
4302 rp='What is the file extension used for shared libraries?'
4303 . ./myread
4304 so="$ans"
4305
4306 : Define several unixisms.
4307 : Hints files or command line option can be used to override them.
4308 : The convoluted testing is in case hints files set either the old
4309 : or the new name.
4310 case "$_exe" in
4311 '')     case "$exe_ext" in
4312         '')     ;;
4313         *)      _exe="$exe_ext" ;;
4314         esac
4315         ;;
4316 esac
4317 case "$_a" in
4318 '')     case "$lib_ext" in
4319     '') _a='.a';;
4320         *)      _a="$lib_ext" ;;
4321         esac
4322         ;;
4323 esac
4324 case "$_o" in
4325 '') case "$obj_ext" in
4326         '')     _o='.o';;
4327         *)      _o="$obj_ext";;
4328         esac
4329         ;;
4330 esac
4331 case "$p_" in
4332 '') case "$path_sep" in
4333         '')     p_=':';;
4334         *)      p_="$path_sep";;
4335         esac
4336         ;;
4337 esac
4338 exe_ext=$_exe
4339 lib_ext=$_a
4340 obj_ext=$_o
4341 path_sep=$p_
4342
4343 : Which makefile gets called first.  This is used by make depend.
4344 case "$firstmakefile" in
4345 '') firstmakefile='makefile';;
4346 esac
4347
4348 case "$usesocks" in
4349 $define|true|[yY]*)     dflt='y';;
4350 *) dflt='n';;
4351 esac
4352 cat <<EOM
4353
4354 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4355 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4356 to use the PerlIO abstraction layer, this will be implicitly selected.
4357
4358 If this doesn't make any sense to you, just accept the default '$dflt'.
4359 EOM
4360 rp='Build Perl for SOCKS?'
4361 . ./myread
4362 case "$ans" in
4363 y|Y)    val="$define" ;;     
4364 *)      val="$undef" ;;
4365 esac
4366 set usesocks
4367 eval $setvar
4368
4369 case "$usesocks" in
4370 $define|true|[yY]*) useperlio="$define";;
4371 esac
4372
4373 : Looking for optional libraries
4374 echo " "
4375 echo "Checking for optional libraries..." >&4
4376 case "$libs" in
4377 ' '|'') dflt='';;
4378 *) dflt="$libs";;
4379 esac
4380 case "$libswanted" in
4381 '') libswanted='c_s';;
4382 esac
4383 case "$usesocks" in
4384 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4385 esac
4386 libsfound=''
4387 libsfiles=''
4388 libsdirs=''
4389 libspath=''
4390 for thisdir in $libpth $xlibpth; do
4391   test -d $thisdir && libspath="$libspath $thisdir"
4392 done
4393 for thislib in $libswanted; do
4394         for thisdir in $libspath; do
4395             xxx=''
4396             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4397                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4398                 $test -f "$xxx" && eval $libscheck
4399                 $test -f "$xxx" && libstyle=shared
4400             fi
4401             if test ! -f "$xxx"; then
4402                 xxx=$thisdir/lib$thislib.$so
4403                 $test -f "$xxx" && eval $libscheck
4404                 $test -f "$xxx" && libstyle=shared
4405             fi  
4406             if test ! -f "$xxx"; then
4407                 xxx=$thisdir/lib$thislib$_a
4408                 $test -f "$xxx" && eval $libscheck
4409                 $test -f "$xxx" && libstyle=static
4410             fi
4411             if test ! -f "$xxx"; then
4412                 xxx=$thisdir/$thislib$_a
4413                 $test -f "$xxx" && eval $libscheck
4414                 $test -f "$xxx" && libstyle=static
4415             fi
4416             if test ! -f "$xxx"; then
4417                 xxx=$thisdir/lib${thislib}_s$_a
4418                 $test -f "$xxx" && eval $libscheck
4419                 $test -f "$xxx" && libstyle=static
4420                 $test -f "$xxx" && thislib=${thislib}_s
4421             fi
4422             if test ! -f "$xxx"; then
4423                 xxx=$thisdir/Slib$thislib$_a
4424                 $test -f "$xxx" && eval $libscheck
4425                 $test -f "$xxx" && libstyle=static
4426             fi
4427             if $test -f "$xxx"; then
4428                 case "$libstyle" in
4429                 shared) echo "Found -l$thislib (shared)." ;;
4430                 static) echo "Found -l$thislib." ;;
4431                 *)      echo "Found -l$thislib ($libstyle)." ;;
4432                 esac
4433                 case " $dflt " in
4434                 *"-l$thislib "*);;
4435                 *) dflt="$dflt -l$thislib"
4436                    libsfound="$libsfound $xxx"
4437                    yyy=`basename $xxx`
4438                    libsfiles="$libsfiles $yyy"
4439                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4440                    case " $libsdirs " in
4441                    *" $yyy "*) ;;
4442                    *) libsdirs="$libsdirs $yyy" ;;
4443                    esac
4444                    ;;
4445                 esac
4446                 break
4447             fi  
4448         done
4449         if $test ! -f "$xxx"; then
4450             echo "No -l$thislib."
4451         fi
4452 done
4453 set X $dflt
4454 shift
4455 dflt="$*"
4456 case "$libs" in
4457 '') dflt="$dflt";;
4458 *) dflt="$libs";;
4459 esac
4460 case "$dflt" in
4461 ' '|'') dflt='none';;
4462 esac
4463
4464 $cat <<EOM
4465
4466 In order to compile $package on your machine, a number of libraries
4467 are usually needed.  Include any other special libraries here as well.
4468 Say "none" for none.  The default list is almost always right.
4469 EOM
4470
4471 echo " "
4472 rp="What libraries to use?"
4473 . ./myread
4474 case "$ans" in
4475 none) libs=' ';;
4476 *) libs="$ans";;
4477 esac
4478
4479 : determine optimization, if desired, or use for debug flag also
4480 case "$optimize" in
4481 ' '|$undef) dflt='none';;
4482 '') dflt='-O';;
4483 *) dflt="$optimize";;
4484 esac
4485 $cat <<EOH
4486
4487 By default, $package compiles with the -O flag to use the optimizer.
4488 Alternately, you might want to use the symbolic debugger, which uses
4489 the -g flag (on traditional Unix systems).  Either flag can be
4490 specified here.  To use neither flag, specify the word "none".
4491
4492 EOH
4493 rp="What optimizer/debugger flag should be used?"
4494 . ./myread
4495 optimize="$ans"
4496 case "$optimize" in
4497 'none') optimize=" ";;
4498 esac
4499
4500 dflt=''
4501 : We will not override a previous value, but we might want to
4502 : augment a hint file
4503 case "$hint" in
4504 default|recommended)
4505         case "$gccversion" in
4506         1*) dflt='-fpcc-struct-return' ;;
4507         esac
4508         case "$optimize" in
4509         *-g*) dflt="$dflt -DDEBUGGING";;
4510         esac
4511         case "$gccversion" in
4512         2*) if test -d /etc/conf/kconfig.d &&
4513                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4514                 then
4515                         dflt="$dflt -posix"
4516                 fi
4517                 ;;
4518         esac
4519         case "$gccversion" in
4520         1*) ;;
4521         2.[0-8]*) ;;
4522         ?*)     echo " "
4523                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4524                 echo 'int main(void) { return 0; }' > gcctest.c
4525                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4526                         echo "Yes, it does." 2>&1
4527                         case "$ccflags" in
4528                         *strict-aliasing*) 
4529                                 echo "Leaving current flags $ccflags alone." 2>&1
4530                                 ;;
4531                         *) dflt="$dflt -fno-strict-aliasing" ;;
4532                         esac
4533                 else
4534                         echo "Nope, it doesn't, but that's ok." 2>&1
4535                 fi
4536                 ;;
4537         esac
4538         ;;
4539 esac
4540
4541 case "$mips_type" in
4542 *BSD*|'') inclwanted="$locincpth $usrinc";;
4543 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4544 esac
4545 for thisincl in $inclwanted; do
4546         if $test -d $thisincl; then
4547                 if $test x$thisincl != x$usrinc; then
4548                         case "$dflt" in
4549                         *" -I$thisincl "*);;
4550                         *) dflt="$dflt -I$thisincl ";;
4551                         esac
4552                 fi
4553         fi
4554 done
4555
4556 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4557         xxx=true;
4558 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4559         xxx=true;
4560 else
4561         xxx=false;
4562 fi;
4563 if $xxx; then
4564         case "$dflt" in
4565         *$2*);;
4566         *) dflt="$dflt -D$2";;
4567         esac;
4568 fi'
4569
4570 set signal.h LANGUAGE_C; eval $inctest
4571
4572 case "$usesocks" in
4573 $define)
4574         ccflags="$ccflags -DSOCKS"
4575         ;;
4576 esac
4577
4578 case "$hint" in
4579 default|recommended) dflt="$ccflags $dflt" ;;
4580 *) dflt="$ccflags";;
4581 esac
4582
4583 case "$dflt" in
4584 ''|' ') dflt=none;;
4585 esac
4586
4587 $cat <<EOH
4588
4589 Your C compiler may want other flags.  For this question you should include
4590 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4591 but you should NOT include libraries or ld flags like -lwhatever.  If you
4592 want $package to honor its debug switch, you should include -DDEBUGGING here.
4593 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4594
4595 To use no flags, specify the word "none".
4596
4597 EOH
4598 set X $dflt
4599 shift
4600 dflt=${1+"$@"}
4601 rp="Any additional cc flags?"
4602 . ./myread
4603 case "$ans" in
4604 none) ccflags='';;
4605 *) ccflags="$ans";;
4606 esac
4607
4608 : the following weeds options from ccflags that are of no interest to cpp
4609 case "$cppflags" in
4610 '') cppflags="$ccflags" ;;
4611 *)  cppflags="$cppflags $ccflags" ;;
4612 esac
4613 case "$gccversion" in
4614 1*) cppflags="$cppflags -D__GNUC__"
4615 esac
4616 case "$mips_type" in
4617 '');;
4618 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4619 esac
4620 case "$cppflags" in
4621 '');;
4622 *)
4623         echo " "
4624         echo "Let me guess what the preprocessor flags are..." >&4
4625         set X $cppflags
4626         shift
4627         cppflags=''
4628         $cat >cpp.c <<'EOM'
4629 #define BLURFL foo
4630
4631 BLURFL xx LFRULB
4632 EOM
4633         previous=''
4634         for flag in $*
4635         do
4636                 case "$flag" in
4637                 -*) ftry="$flag";;
4638                 *) ftry="$previous $flag";;
4639                 esac
4640                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4641                         >cpp1.out 2>/dev/null && \
4642                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4643                         >cpp2.out 2>/dev/null && \
4644                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4645                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4646                 then
4647                         cppflags="$cppflags $ftry"
4648                         previous=''
4649                 else
4650                         previous="$flag"
4651                 fi
4652         done
4653         set X $cppflags
4654         shift
4655         cppflags=${1+"$@"}
4656         case "$cppflags" in
4657         *-*)  echo "They appear to be: $cppflags";;
4658         esac
4659         $rm -f cpp.c cpp?.out
4660         ;;
4661 esac
4662
4663 : flags used in final linking phase
4664 case "$ldflags" in
4665 '') if ./venix; then
4666                 dflt='-i -z'
4667         else
4668                 dflt=''
4669         fi
4670         case "$ccflags" in
4671         *-posix*) dflt="$dflt -posix" ;;
4672         esac
4673         ;;
4674 *) dflt="$ldflags";;
4675 esac
4676
4677 : Try to guess additional flags to pick up local libraries.
4678 for thislibdir in $libpth; do
4679         case " $loclibpth " in
4680         *" $thislibdir "*)
4681                 case "$dflt " in 
4682                 *"-L$thislibdir "*) ;;
4683                 *)  dflt="$dflt -L$thislibdir" ;;
4684                 esac
4685                 ;;
4686         esac
4687 done
4688
4689 case "$dflt" in
4690 '') dflt='none' ;;
4691 esac
4692
4693 $cat <<EOH
4694
4695 Your C linker may need flags.  For this question you should
4696 include -L/whatever and any other flags used by the C linker, but you
4697 should NOT include libraries like -lwhatever.
4698
4699 Make sure you include the appropriate -L/path flags if your C linker
4700 does not normally search all of the directories you specified above,
4701 namely
4702         $libpth
4703 To use no flags, specify the word "none".
4704
4705 EOH
4706
4707 rp="Any additional ld flags (NOT including libraries)?"
4708 . ./myread
4709 case "$ans" in
4710 none) ldflags='';;
4711 *) ldflags="$ans";;
4712 esac
4713 rmlist="$rmlist pdp11"
4714
4715 : coherency check
4716 echo " "
4717 echo "Checking your choice of C compiler and flags for coherency..." >&4
4718 $cat > try.c <<'EOF'
4719 #include <stdio.h>
4720 int main() { printf("Ok\n"); exit(0); }
4721 EOF
4722 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4723 shift
4724 $cat >try.msg <<'EOM'
4725 I've tried to compile and run the following simple program:
4726
4727 EOM
4728 $cat try.c >> try.msg
4729
4730 $cat >> try.msg <<EOM
4731
4732 I used the command:
4733
4734         $*
4735         $run ./try
4736
4737 and I got the following output:
4738
4739 EOM
4740 dflt=y
4741 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4742         if $sh -c "$run ./try" >>try.msg 2>&1; then
4743                 xxx=`$run ./try`
4744                 case "$xxx" in
4745                 "Ok") dflt=n ;;
4746                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4747                         case " $libs " in
4748                         *" -lsfio "*)
4749                                 cat >> try.msg <<'EOQS'
4750 If $libs contains -lsfio, and sfio is mis-configured, then it
4751 sometimes (apparently) runs and exits with a 0 status, but with no
4752 output!  It may have to do with sfio's use of _exit vs. exit.
4753
4754 EOQS
4755                                 rp="You have a big problem.  Shall I abort Configure"
4756                                 dflt=y
4757                                 ;;
4758                         esac
4759                         ;;
4760                 esac
4761         else
4762                 echo "The program compiled OK, but exited with status $?." >>try.msg
4763                 rp="You have a problem.  Shall I abort Configure"
4764                 dflt=y
4765         fi
4766 else
4767         echo "I can't compile the test program." >>try.msg
4768         rp="You have a BIG problem.  Shall I abort Configure"
4769         dflt=y
4770 fi
4771 case "$dflt" in
4772 y)
4773         $cat try.msg >&4
4774         case "$knowitall" in
4775         '')
4776                 echo "(The supplied flags or libraries might be incorrect.)"
4777                 ;;
4778         *) dflt=n;;
4779         esac
4780         echo " "
4781         . ./myread
4782         case "$ans" in
4783         n*|N*) ;;
4784         *)      echo "Ok.  Stopping Configure." >&4
4785                 exit 1
4786                 ;;
4787         esac
4788         ;;
4789 n) echo "OK, that should do.";;
4790 esac
4791 $rm -f try try.* core
4792
4793 : define a shorthand compile call
4794 compile='
4795 mc_file=$1;
4796 shift;
4797 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4798 : define a shorthand compile call for compilations that should be ok.
4799 compile_ok='
4800 mc_file=$1;
4801 shift;
4802 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4803
4804 : check for lengths of integral types
4805 echo " "
4806 case "$intsize" in
4807 '')
4808         echo "Checking to see how big your integers are..." >&4
4809         $cat >try.c <<'EOCP'
4810 #include <stdio.h>
4811 int main()
4812 {
4813         printf("intsize=%d;\n", (int)sizeof(int));
4814         printf("longsize=%d;\n", (int)sizeof(long));
4815         printf("shortsize=%d;\n", (int)sizeof(short));
4816         exit(0);
4817 }
4818 EOCP
4819         set try
4820         if eval $compile_ok && $run ./try > /dev/null; then
4821                 eval `$run ./try`
4822                 echo "Your integers are $intsize bytes long."
4823                 echo "Your long integers are $longsize bytes long."
4824                 echo "Your short integers are $shortsize bytes long."
4825         else
4826                 $cat >&4 <<EOM
4827 !
4828 Help! I can't compile and run the intsize test program: please enlighten me!
4829 (This is probably a misconfiguration in your system or libraries, and
4830 you really ought to fix it.  Still, I'll try anyway.)
4831 !
4832 EOM
4833                 dflt=4
4834                 rp="What is the size of an integer (in bytes)?"
4835                 . ./myread
4836                 intsize="$ans"
4837                 dflt=$intsize
4838                 rp="What is the size of a long integer (in bytes)?"
4839                 . ./myread
4840                 longsize="$ans"
4841                 dflt=2
4842                 rp="What is the size of a short integer (in bytes)?"
4843                 . ./myread
4844                 shortsize="$ans"
4845         fi
4846         ;;
4847 esac
4848 $rm -f try try.*
4849
4850 : check for void type
4851 echo " "
4852 echo "Checking to see how well your C compiler groks the void type..." >&4
4853 case "$voidflags" in
4854 '')
4855         $cat >try.c <<'EOCP'
4856 #if TRY & 1
4857 void sub() {
4858 #else
4859 sub() {
4860 #endif
4861         extern void moo();      /* function returning void */
4862         void (*goo)();          /* ptr to func returning void */
4863 #if TRY & 8
4864         void *hue;              /* generic ptr */
4865 #endif
4866 #if TRY & 2
4867         void (*foo[10])();
4868 #endif
4869
4870 #if TRY & 4
4871         if(goo == moo) {
4872                 exit(0);
4873         }
4874 #endif
4875         exit(0);
4876 }
4877 int main() { sub(); }
4878 EOCP
4879         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4880                 voidflags=$defvoidused
4881         echo "Good.  It appears to support void to the level $package wants.">&4
4882                 if $contains warning .out >/dev/null 2>&1; then
4883                         echo "However, you might get some warnings that look like this:"
4884                         $cat .out
4885                 fi
4886         else
4887 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
4888                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4889                         echo "It supports 1..."
4890                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4891                                 echo "It also supports 2..."
4892                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4893                                         voidflags=7
4894                                         echo "And it supports 4 but not 8 definitely."
4895                                 else
4896                                         echo "It doesn't support 4..."
4897                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4898                                                 voidflags=11
4899                                                 echo "But it supports 8."
4900                                         else
4901                                                 voidflags=3
4902                                                 echo "Neither does it support 8."
4903                                         fi
4904                                 fi
4905                         else
4906                                 echo "It does not support 2..."
4907                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4908                                         voidflags=13
4909                                         echo "But it supports 4 and 8."
4910                                 else
4911                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4912                                                 voidflags=5
4913                                                 echo "And it supports 4 but has not heard about 8."
4914                                         else
4915                                                 echo "However it supports 8 but not 4."
4916                                         fi
4917                                 fi
4918                         fi
4919                 else
4920                         echo "There is no support at all for void."
4921                         voidflags=0
4922                 fi
4923         fi
4924 esac
4925 case "$voidflags" in
4926 "$defvoidused") ;;
4927 *)      $cat >&4 <<'EOM'
4928   Support flag bits are:
4929     1: basic void declarations.
4930     2: arrays of pointers to functions returning void.
4931     4: operations between pointers to and addresses of void functions.
4932     8: generic void pointers.
4933 EOM
4934         dflt="$voidflags";
4935         rp="Your void support flags add up to what?"
4936         . ./myread
4937         voidflags="$ans"
4938         ;;
4939 esac
4940 $rm -f try.* .out
4941
4942 : check for length of pointer
4943 echo " "
4944 case "$ptrsize" in
4945 '')
4946         echo "Checking to see how big your pointers are..." >&4
4947         if test "$voidflags" -gt 7; then
4948                 echo '#define VOID_PTR char *' > try.c
4949         else
4950                 echo '#define VOID_PTR void *' > try.c
4951         fi
4952         $cat >>try.c <<'EOCP'
4953 #include <stdio.h>
4954 int main()
4955 {
4956     printf("%d\n", (int)sizeof(VOID_PTR));
4957     exit(0);
4958 }
4959 EOCP
4960         set try
4961         if eval $compile_ok; then
4962                 ptrsize=`$run ./try`
4963                 echo "Your pointers are $ptrsize bytes long."
4964         else
4965                 dflt='4'
4966                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
4967                 rp="What is the size of a pointer (in bytes)?"
4968                 . ./myread
4969                 ptrsize="$ans"
4970         fi
4971         ;;
4972 esac
4973 $rm -f try.c try
4974
4975 : check for long long
4976 echo " "
4977 echo "Checking to see if you have long long..." >&4
4978 echo 'int main() { long long x = 7; return 0; }' > try.c
4979 set try
4980 if eval $compile; then
4981         val="$define"
4982         echo "You have long long."
4983 else
4984         val="$undef"
4985         echo "You do not have long long."
4986 fi
4987 $rm try.*
4988 set d_longlong
4989 eval $setvar
4990
4991 : check for length of long long
4992 case "${d_longlong}${longlongsize}" in
4993 $define)
4994         echo " "
4995         echo "Checking to see how big your long longs are..." >&4
4996         $cat >try.c <<'EOCP'
4997 #include <stdio.h>
4998 int main()
4999 {
5000     printf("%d\n", (int)sizeof(long long));
5001     return(0);
5002 }
5003 EOCP
5004         set try
5005         if eval $compile_ok; then
5006                 longlongsize=`$run ./try`
5007                 echo "Your long longs are $longlongsize bytes long."
5008         else
5009                 dflt='8'
5010                 echo " "
5011                 echo "(I can't seem to compile the test program.  Guessing...)"
5012                 rp="What is the size of a long long (in bytes)?"
5013                 . ./myread
5014                 longlongsize="$ans"
5015         fi
5016         if $test "X$longsize" = "X$longlongsize"; then
5017                 echo "(That isn't any different from an ordinary long.)"
5018         fi      
5019         ;;
5020 esac
5021 $rm -f try.* try
5022
5023 : determine filename position in cpp output
5024 echo " "
5025 echo "Computing filename position in cpp output for #include directives..." >&4
5026 case "$osname" in
5027 vos) testaccess=-e ;;
5028 *)   testaccess=-r ;;
5029 esac
5030 echo '#include <stdio.h>' > foo.c
5031 $cat >fieldn <<EOF
5032 $startsh
5033 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5034 $grep '^[       ]*#.*stdio\.h' | \
5035 while read cline; do
5036         pos=1
5037         set \$cline
5038         while $test \$# -gt 0; do
5039                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5040                         echo "\$pos"
5041                         exit 0
5042                 fi
5043                 shift
5044                 pos=\`expr \$pos + 1\`
5045         done
5046 done
5047 EOF
5048 chmod +x fieldn
5049 fieldn=`./fieldn`
5050 $rm -f foo.c fieldn
5051 case $fieldn in
5052 '') pos='???';;
5053 1) pos=first;;
5054 2) pos=second;;
5055 3) pos=third;;
5056 *) pos="${fieldn}th";;
5057 esac
5058 echo "Your cpp writes the filename in the $pos field of the line."
5059
5060 case "$osname" in
5061 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5062 *)   cppfilter='' ;;
5063 esac
5064 : locate header file
5065 $cat >findhdr <<EOF
5066 $startsh
5067 wanted=\$1
5068 name=''
5069 for usrincdir in $usrinc
5070 do
5071         if test -f \$usrincdir/\$wanted; then
5072                 echo "\$usrincdir/\$wanted"
5073                 exit 0
5074         fi
5075 done
5076 awkprg='{ print \$$fieldn }'
5077 echo "#include <\$wanted>" > foo\$\$.c
5078 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5079 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5080 while read cline; do
5081         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5082         case "\$name" in
5083         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5084         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5085         *) exit 2;;
5086         esac;
5087 done;
5088 #
5089 # status = 0: grep returned 0 lines, case statement not executed
5090 # status = 1: headerfile found
5091 # status = 2: while loop executed, no headerfile found
5092 #
5093 status=\$?
5094 $rm -f foo\$\$.c;
5095 if test \$status -eq 1; then
5096         exit 0;
5097 fi
5098 exit 1
5099 EOF
5100 chmod +x findhdr
5101
5102 : define an alternate in-header-list? function
5103 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5104 cont=true; xxf="echo \"<\$1> found.\" >&4";
5105 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5106 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5107 esac;
5108 case $# in 4) instead=instead;; *) instead="at last";; esac;
5109 while $test "$cont"; do
5110         xxx=`./findhdr $1`
5111         var=$2; eval "was=\$$2";
5112         if $test "$xxx" && $test -r "$xxx";
5113         then eval $xxf;
5114         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5115                 cont="";
5116         else eval $xxnf;
5117         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5118         set $yyy; shift; shift; yyy=$@;
5119         case $# in 0) cont="";;
5120         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5121                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5122         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5123                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5124         esac;
5125 done;
5126 while $test "$yyy";
5127 do set $yyy; var=$2; eval "was=\$$2";
5128         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5129         set $yyy; shift; shift; yyy=$@;
5130 done'
5131
5132 : see if inttypes.h is available
5133 : we want a real compile instead of Inhdr because some systems
5134 : have an inttypes.h which includes non-existent headers
5135 echo " "
5136 $cat >try.c <<EOCP
5137 #include <inttypes.h>
5138 int main() {
5139         static int32_t foo32 = 0x12345678;
5140 }
5141 EOCP
5142 set try
5143 if eval $compile; then
5144         echo "<inttypes.h> found." >&4
5145         val="$define"
5146 else
5147         echo "<inttypes.h> NOT found." >&4
5148         val="$undef"
5149 fi
5150 $rm -f try.c try
5151 set i_inttypes
5152 eval $setvar
5153
5154 : check for int64_t
5155 echo " "
5156 echo "Checking to see if you have int64_t..." >&4
5157 $cat >try.c <<EOCP
5158 #include <sys/types.h>
5159 #$i_inttypes I_INTTYPES
5160 #ifdef I_INTTYPES
5161 #include <inttypes.h>
5162 #endif
5163 int main() { int64_t x = 7; }
5164 EOCP
5165 set try
5166 if eval $compile; then
5167         val="$define"
5168         echo "You have int64_t."
5169 else
5170         val="$undef"
5171         echo "You do not have int64_t."
5172 fi
5173 $rm -f try try.*
5174 set d_int64_t
5175 eval $setvar
5176
5177
5178 echo " "
5179 echo "Checking which 64-bit integer type we could use..." >&4
5180
5181 case "$intsize" in
5182 8) val=int
5183    set quadtype
5184    eval $setvar
5185    val='"unsigned int"'
5186    set uquadtype
5187    eval $setvar
5188    quadkind=1
5189    ;;
5190 *) case "$longsize" in
5191    8) val=long
5192       set quadtype
5193       eval $setvar
5194       val='"unsigned long"'
5195       set uquadtype
5196       eval $setvar
5197       quadkind=2
5198       ;;
5199    *) case "$d_longlong:$longlongsize" in
5200       define:8)
5201         val='"long long"'
5202         set quadtype
5203         eval $setvar
5204         val='"unsigned long long"'
5205         set uquadtype
5206         eval $setvar
5207         quadkind=3
5208         ;;
5209       *) case "$d_int64_t" in
5210          define)
5211            val=int64_t
5212            set quadtype
5213            eval $setvar
5214            val=uint64_t
5215            set uquadtype
5216            eval $setvar
5217            quadkind=4
5218            ;;
5219          esac
5220          ;;
5221       esac
5222       ;;
5223    esac
5224    ;;
5225 esac
5226
5227 case "$quadtype" in
5228 '')     echo "Alas, no 64-bit integer types in sight." >&4
5229         d_quad="$undef"
5230         ;;
5231 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5232         d_quad="$define"
5233         ;;
5234 esac
5235
5236
5237 case "$uselonglong" in
5238 "$define"|true|[yY]*)
5239         cat <<EOM >&4
5240
5241 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5242 EOM
5243         use64bitint="$define"
5244         ;;
5245 esac                          
5246 case "$use64bits" in
5247 "$define"|true|[yY]*)
5248         cat <<EOM >&4
5249
5250 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5251 EOM
5252         use64bitint="$define"
5253         ;;
5254 esac                          
5255 case "$use64bitints" in
5256 "$define"|true|[yY]*)
5257         cat <<EOM >&4
5258
5259 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5260 EOM
5261         use64bitint="$define"
5262         ;;
5263 esac                          
5264 case "$use64bitsint" in
5265 "$define"|true|[yY]*)
5266         cat <<EOM >&4
5267
5268 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5269 EOM
5270         use64bitint="$define"
5271         ;;
5272 esac                          
5273 case "$uselonglongs" in
5274 "$define"|true|[yY]*)
5275         cat <<EOM >&4
5276
5277 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5278 EOM
5279         use64bitint="$define"
5280         ;;
5281 esac                          
5282 case "$use64bitsall" in
5283 "$define"|true|[yY]*)
5284         cat <<EOM >&4
5285
5286 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5287 EOM
5288         use64bitall="$define"
5289         ;;
5290 esac                          
5291
5292 case "$ccflags" in
5293 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5294 esac
5295 case "$use64bitall" in
5296 "$define"|true|[yY]*) use64bitint="$define" ;;
5297 esac
5298
5299 case "$longsize" in
5300 8) cat <<EOM
5301
5302 You have natively 64-bit long integers.
5303 EOM
5304    val="$define"
5305    ;;
5306 *) case "$use64bitint" in
5307    "$define"|true|[yY]*) dflt='y';;
5308    *) dflt='n';;
5309    esac
5310    case "$d_quad" in
5311    "$define") ;;
5312    *) dflt='n' ;;
5313    esac
5314    cat <<EOM
5315
5316 Perl can be built to take advantage of 64-bit integer types
5317 on some systems.  To do so, Configure can be run with -Duse64bitint.
5318 Choosing this option will most probably introduce binary incompatibilities.
5319
5320 If this doesn't make any sense to you, just accept the default '$dflt'.
5321 (The default has been chosen based on your configuration.)
5322 EOM
5323    rp='Try to use 64-bit integers, if available?'
5324    . ./myread
5325    case "$ans" in
5326    [yY]*) val="$define" ;;
5327    *)     val="$undef"  ;;
5328    esac
5329    ;;
5330 esac
5331 set use64bitint
5332 eval $setvar
5333
5334 case "$use64bitall" in
5335 "$define"|true|[yY]*) dflt='y' ;;
5336 *) case "$longsize" in
5337    8) dflt='y' ;;
5338    *) dflt='n' ;;
5339    esac
5340    ;;
5341 esac    
5342 cat <<EOM
5343
5344 You may also choose to try maximal 64-bitness.  It means using as much
5345 64-bitness as possible on the platform.  This in turn means even more
5346 binary incompatibilities.  On the other hand, your platform may not
5347 have any more 64-bitness available than what you already have chosen.
5348
5349 If this doesn't make any sense to you, just accept the default '$dflt'.
5350 (The default has been chosen based on your configuration.)
5351 EOM
5352 rp='Try to use maximal 64-bit support, if available?'
5353 . ./myread
5354 case "$ans" in
5355 [yY]*) val="$define" ;;
5356 *)     val="$undef"  ;;
5357 esac
5358 set use64bitall
5359 eval $setvar
5360 case "$use64bitall" in
5361 "$define")
5362         case "$use64bitint" in
5363         "$undef")
5364                 cat <<EOM
5365
5366 Since you have chosen a maximally 64-bit build, I'm also turning on
5367 the use of 64-bit integers.
5368 EOM
5369                 use64bitint="$define" ;;
5370         esac
5371         ;;
5372 esac
5373
5374 case "$use64bitall" in
5375 "$define"|true|[yY]*)
5376         case "$ptrsize" in
5377         4)      cat <<EOM >&4
5378
5379 *** You have chosen a maximally 64-bit build, but your pointers
5380 *** are only 4 bytes wide, disabling maximal 64-bitness.
5381
5382 EOM
5383                 use64bitall="$undef"
5384                 case "$use64bitint" in
5385                 "$define"|true|[yY]*) ;;
5386                 *)      cat <<EOM >&4
5387
5388 *** Downgrading from maximal 64-bitness to using 64-bit integers.
5389
5390 EOM
5391                         use64bitint="$define"
5392                         ;;
5393                 esac
5394                 ;;
5395         esac
5396         ;;
5397 esac
5398
5399 case "$use64bitint" in
5400 "$define"|true|[yY]*)
5401 : Look for a hint-file generated 'call-back-unit'.  If the
5402 : user has specified that a 64-bit perl is to be built,
5403 : we may need to set or change some other defaults.
5404         if $test -f use64bitint.cbu; then
5405                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5406                 . ./use64bitint.cbu
5407         fi
5408         case "$longsize" in
5409         4) case "$archname64" in
5410            '') archname64=64int ;;
5411            esac
5412            ;;
5413         esac
5414         ;;
5415 esac
5416
5417 case "$use64bitall" in
5418 "$define"|true|[yY]*)
5419 : Look for a hint-file generated 'call-back-unit'.  If the
5420 : user has specified that a maximally 64-bit perl is to be built,
5421 : we may need to set or change some other defaults.
5422         if $test -f use64bitall.cbu; then
5423                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5424                 . ./use64bitall.cbu
5425         fi
5426         case "$longsize" in
5427         4) case "$archname64" in
5428            ''|64int) archname64=64all ;;
5429            esac
5430            ;;
5431         esac
5432         ;;
5433 esac
5434
5435 echo " "
5436 echo "Checking for GNU C Library..." >&4
5437 cat >try.c <<EOM
5438 #include <stdio.h>
5439 int main()
5440 {
5441 #ifdef __GLIBC__
5442     exit(0);
5443 #else
5444     exit(1);
5445 #endif
5446 }
5447 EOM
5448 set try
5449 if eval $compile_ok && $run ./try; then
5450         val="$define"
5451         echo "You are using the GNU C Library"
5452 else
5453         val="$undef"
5454         echo "You are not using the GNU C Library"
5455 fi
5456 $rm -f try try.*
5457 set d_gnulibc
5458 eval $setvar
5459
5460 : see if nm is to be used to determine whether a symbol is defined or not
5461 case "$usenm" in
5462 '')
5463         dflt=''
5464         case "$d_gnulibc" in
5465         "$define")
5466                 echo " "
5467                 echo "nm probably won't work on the GNU C Library." >&4
5468                 dflt=n
5469                 ;;
5470         esac
5471         case "$dflt" in
5472         '') 
5473                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5474                         echo " "
5475                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5476                         echo "'nm' won't be sufficient on this sytem." >&4
5477                         dflt=n
5478                 fi
5479                 ;;
5480         esac
5481         case "$dflt" in
5482         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5483                 if $test $dflt -gt 20; then
5484                         dflt=y
5485                 else
5486                         dflt=n
5487                 fi
5488                 ;;
5489         esac
5490         ;;
5491 *)
5492         case "$usenm" in
5493         true|$define) dflt=y;;
5494         *) dflt=n;;
5495         esac
5496         ;;
5497 esac
5498 $cat <<EOM
5499
5500 I can use $nm to extract the symbols from your C libraries. This
5501 is a time consuming task which may generate huge output on the disk (up
5502 to 3 megabytes) but that should make the symbols extraction faster. The
5503 alternative is to skip the 'nm' extraction part and to compile a small
5504 test program instead to determine whether each symbol is present. If
5505 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5506 this may be the best solution.
5507
5508 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5509
5510 EOM
5511 rp="Shall I use $nm to extract C symbols from the libraries?"
5512 . ./myread
5513 case "$ans" in
5514 [Nn]*) usenm=false;;
5515 *) usenm=true;;
5516 esac
5517
5518 runnm=$usenm
5519 case "$reuseval" in
5520 true) runnm=false;;
5521 esac
5522
5523 : nm options which may be necessary
5524 case "$nm_opt" in
5525 '') if $test -f /mach_boot; then
5526                 nm_opt=''       # Mach
5527         elif $test -d /usr/ccs/lib; then
5528                 nm_opt='-p'     # Solaris (and SunOS?)
5529         elif $test -f /dgux; then
5530                 nm_opt='-p'     # DG-UX
5531         elif $test -f /lib64/rld; then
5532                 nm_opt='-p'     # 64-bit Irix
5533         else
5534                 nm_opt=''
5535         fi;;
5536 esac
5537
5538 : nm options which may be necessary for shared libraries but illegal
5539 : for archive libraries.  Thank you, Linux.
5540 case "$nm_so_opt" in
5541 '')     case "$myuname" in
5542         *linux*)
5543                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5544                         nm_so_opt='--dynamic'
5545                 fi
5546                 ;;
5547         esac
5548         ;;
5549 esac
5550
5551 case "$runnm" in
5552 true)
5553 : get list of predefined functions in a handy place
5554 echo " "
5555 case "$libc" in
5556 '') libc=unknown
5557         case "$libs" in
5558         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5559         esac
5560         ;;
5561 esac
5562 case "$libs" in
5563 '') ;;
5564 *)  for thislib in $libs; do
5565         case "$thislib" in
5566         -lc|-lc_s)
5567                 : Handle C library specially below.
5568                 ;;
5569         -l*)
5570                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5571                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5572                         :
5573                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5574                         :
5575                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5576                         :
5577                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5578                         :
5579                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5580                         :
5581                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5582                         :
5583                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5584                         :
5585                 else
5586                         try=''
5587                 fi
5588                 libnames="$libnames $try"
5589                 ;;
5590         *) libnames="$libnames $thislib" ;;
5591         esac
5592         done
5593         ;;
5594 esac
5595 xxx=normal
5596 case "$libc" in
5597 unknown)
5598         set /lib/libc.$so
5599         for xxx in $libpth; do
5600                 $test -r $1 || set $xxx/libc.$so
5601                 : The messy sed command sorts on library version numbers.
5602                 $test -r $1 || \
5603                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5604                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5605                                 h
5606                                 s/[0-9][0-9]*/0000&/g
5607                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5608                                 G
5609                                 s/\n/ /' | \
5610                          $sort | $sed -e 's/^.* //'`
5611                 eval set \$$#
5612         done
5613         $test -r $1 || set /usr/ccs/lib/libc.$so
5614         $test -r $1 || set /lib/libsys_s$_a
5615         ;;
5616 *)
5617         set blurfl
5618         ;;
5619 esac
5620 if $test -r "$1"; then
5621         echo "Your (shared) C library seems to be in $1."
5622         libc="$1"
5623 elif $test -r /lib/libc && $test -r /lib/clib; then
5624         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5625         xxx=apollo
5626         libc='/lib/clib /lib/libc'
5627         if $test -r /lib/syslib; then
5628                 echo "(Your math library is in /lib/syslib.)"
5629                 libc="$libc /lib/syslib"
5630         fi
5631 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5632         echo "Your C library seems to be in $libc, as you said before."
5633 elif $test -r $incpath/usr/lib/libc$_a; then
5634         libc=$incpath/usr/lib/libc$_a;
5635         echo "Your C library seems to be in $libc.  That's fine."
5636 elif $test -r /lib/libc$_a; then
5637         libc=/lib/libc$_a;
5638         echo "Your C library seems to be in $libc.  You're normal."
5639 else
5640         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5641                 :
5642         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5643                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5644         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5645                 :
5646         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5647                 :
5648         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5649                 :
5650         else
5651                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5652         fi
5653         if $test -r "$tans"; then
5654                 echo "Your C library seems to be in $tans, of all places."
5655                 libc=$tans
5656         else
5657                 libc='blurfl'
5658         fi
5659 fi
5660 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5661         dflt="$libc"
5662         cat <<EOM
5663
5664 If the guess above is wrong (which it might be if you're using a strange
5665 compiler, or your machine supports multiple models), you can override it here.
5666
5667 EOM
5668 else
5669         dflt=''
5670         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5671         cat >&4 <<EOM
5672 I can't seem to find your C library.  I've looked in the following places:
5673
5674 EOM
5675         $sed 's/^/      /' libpath
5676         cat <<EOM
5677
5678 None of these seems to contain your C library. I need to get its name...
5679
5680 EOM
5681 fi
5682 fn=f
5683 rp='Where is your C library?'
5684 . ./getfile
5685 libc="$ans"
5686
5687 echo " "
5688 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5689 set X `cat libnames`
5690 shift
5691 xxx=files
5692 case $# in 1) xxx=file; esac
5693 echo "Extracting names from the following $xxx for later perusal:" >&4
5694 echo " "
5695 $sed 's/^/      /' libnames >&4
5696 echo " "
5697 $echo $n "This may take a while...$c" >&4
5698
5699 for file in $*; do
5700         case $file in
5701         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5702         *) $nm $nm_opt $file 2>/dev/null;;
5703         esac
5704 done >libc.tmp
5705
5706 $echo $n ".$c"
5707 $grep fprintf libc.tmp > libc.ptf
5708 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5709 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
5710 xxx='[ADTSIW]'
5711 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5712         eval $xscan;\
5713         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5714                 eval $xrun
5715 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5716         eval $xscan;\
5717         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5718                 eval $xrun
5719 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5720         eval $xscan;\
5721         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5722                 eval $xrun
5723 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5724         eval $xscan;\
5725         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5726                 eval $xrun
5727 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5728         eval $xscan;\
5729         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5730                 eval $xrun
5731 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5732         eval $xscan;\
5733         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5734                 eval $xrun
5735 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5736                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5737         eval $xscan;\
5738         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5739                 eval $xrun
5740 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5741         eval $xscan;\
5742         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5743                 eval $xrun
5744 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5745         eval $xscan;\
5746         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5747                 eval $xrun
5748 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5749         eval $xscan;\
5750         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5751                 eval $xrun
5752 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5753         eval $xscan;\
5754         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5755                 eval $xrun
5756 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5757         eval $xscan;\
5758         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5759                 eval $xrun
5760 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5761         eval $xscan;\
5762         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5763                 eval $xrun
5764 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5765         eval $xscan;\
5766         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5767                 eval $xrun
5768 else
5769         $nm -p $* 2>/dev/null >libc.tmp
5770         $grep fprintf libc.tmp > libc.ptf
5771         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5772                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5773         then
5774                 nm_opt='-p'
5775                 eval $xrun
5776         else
5777                 echo " "
5778                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5779                 com=''
5780                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5781                         for thisname in $libnames $libc; do
5782                                 $ar t $thisname >>libc.tmp
5783                         done
5784                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5785                         echo "Ok." >&4
5786                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5787                         # Repeat libc to extract forwarders to DLL entries too
5788                         for thisname in $libnames $libc; do
5789                                 $ar tv $thisname >>libc.tmp
5790                                 # Revision 50 of EMX has bug in $ar.
5791                                 # it will not extract forwarders to DLL entries
5792                                 # Use emximp which will extract exactly them.
5793                                 emximp -o tmp.imp $thisname \
5794                                     2>/dev/null && \
5795                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5796                                     < tmp.imp >>libc.tmp
5797                                 $rm tmp.imp
5798                         done
5799                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5800                         echo "Ok." >&4
5801                 else
5802                         echo "$ar didn't seem to work right." >&4
5803                         echo "Maybe this is a Cray...trying bld instead..." >&4
5804                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5805                         then
5806                                 for thisname in $libnames; do
5807                                         bld t $libnames | \
5808                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5809                                         $ar t $thisname >>libc.tmp
5810                                 done
5811                                 echo "Ok." >&4
5812                         else
5813                                 echo "That didn't work either.  Giving up." >&4
5814                                 exit 1
5815                         fi
5816                 fi
5817         fi
5818 fi
5819 nm_extract="$com"
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 $rm -f libnames libpath
5828
5829 : is a C symbol defined?
5830 csym='tlook=$1;
5831 case "$3" in
5832 -v) tf=libc.tmp; tc=""; tdc="";;
5833 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5834 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5835 esac;
5836 tx=yes;
5837 case "$reuseval-$4" in
5838 true-) ;;
5839 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5840 esac;
5841 case "$tx" in
5842 yes)
5843         case "$runnm" in
5844         true)
5845                 if $contains $tlook $tf >/dev/null 2>&1;
5846                 then tval=true;
5847                 else tval=false;
5848                 fi;;
5849         *)
5850                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5851                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5852                 then tval=true;
5853                 else tval=false;
5854                 fi;
5855                 $rm -f t t.c;;
5856         esac;;
5857 *)
5858         case "$tval" in
5859         $define) tval=true;;
5860         *) tval=false;;
5861         esac;;
5862 esac;
5863 eval "$2=$tval"'
5864
5865 : define an is-in-libc? function
5866 inlibc='echo " "; td=$define; tu=$undef;
5867 sym=$1; var=$2; eval "was=\$$2";
5868 tx=yes;
5869 case "$reuseval$was" in
5870 true) ;;
5871 true*) tx=no;;
5872 esac;
5873 case "$tx" in
5874 yes)
5875         set $sym tres -f;
5876         eval $csym;
5877         case "$tres" in
5878         true)
5879                 echo "$sym() found." >&4;
5880                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5881         *)
5882                 echo "$sym() NOT found." >&4;
5883                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5884         esac;;
5885 *)
5886         case "$was" in
5887         $define) echo "$sym() found." >&4;;
5888         *) echo "$sym() NOT found." >&4;;
5889         esac;;
5890 esac'
5891
5892 : see if sqrtl exists
5893 set sqrtl d_sqrtl
5894 eval $inlibc
5895
5896 : check for length of double
5897 echo " "
5898 case "$doublesize" in
5899 '')
5900         echo "Checking to see how big your double precision numbers are..." >&4
5901         $cat >try.c <<'EOCP'
5902 #include <stdio.h>
5903 int main()
5904 {
5905     printf("%d\n", (int)sizeof(double));
5906     exit(0);
5907 }
5908 EOCP
5909         set try
5910         if eval $compile_ok; then
5911                 doublesize=`$run ./try`
5912                 echo "Your double is $doublesize bytes long."
5913         else
5914                 dflt='8'
5915                 echo "(I can't seem to compile the test program.  Guessing...)"
5916                 rp="What is the size of a double precision number (in bytes)?"
5917                 . ./myread
5918                 doublesize="$ans"
5919         fi
5920         ;;
5921 esac
5922 $rm -f try.c try
5923
5924 : check for long doubles
5925 echo " "
5926 echo "Checking to see if you have long double..." >&4
5927 echo 'int main() { long double x = 7.0; }' > try.c
5928 set try
5929 if eval $compile; then
5930         val="$define"
5931         echo "You have long double."
5932 else
5933         val="$undef"
5934         echo "You do not have long double."
5935 fi
5936 $rm try.*
5937 set d_longdbl
5938 eval $setvar
5939
5940 : check for length of long double
5941 case "${d_longdbl}${longdblsize}" in
5942 $define)
5943         echo " "
5944         echo "Checking to see how big your long doubles are..." >&4
5945         $cat >try.c <<'EOCP'
5946 #include <stdio.h>
5947 int main()
5948 {
5949         printf("%d\n", sizeof(long double));
5950 }
5951 EOCP
5952         set try
5953         set try
5954         if eval $compile; then
5955                 longdblsize=`$run ./try`
5956                 echo "Your long doubles are $longdblsize bytes long."
5957         else
5958                 dflt='8'
5959                 echo " "
5960                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5961                 rp="What is the size of a long double (in bytes)?"
5962                 . ./myread
5963                 longdblsize="$ans"
5964         fi
5965         if $test "X$doublesize" = "X$longdblsize"; then
5966                 echo "(That isn't any different from an ordinary double.)"
5967         fi      
5968         ;;
5969 esac
5970 $rm -f try.* try
5971
5972 echo " "
5973
5974 if $test X"$d_longdbl" = X"$define"; then
5975
5976 echo "Checking how to print long doubles..." >&4
5977
5978 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
5979         $cat >try.c <<'EOCP'
5980 #include <sys/types.h>
5981 #include <stdio.h>
5982 int main() {
5983   double d = 123.456;
5984   printf("%.3f\n", d);
5985 }
5986 EOCP
5987         set try
5988         if eval $compile; then
5989                 yyy=`$run ./try`
5990                 case "$yyy" in
5991                 123.456)
5992                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
5993                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
5994                         echo "We will use %f."
5995                         ;;
5996                 esac
5997         fi
5998 fi
5999
6000 if $test X"$sPRIfldbl" = X; then
6001         $cat >try.c <<'EOCP'
6002 #include <sys/types.h>
6003 #include <stdio.h>
6004 int main() {
6005   long double d = 123.456;
6006   printf("%.3Lf\n", d);
6007 }
6008 EOCP
6009         set try
6010         if eval $compile; then
6011                 yyy=`$run ./try`
6012                 case "$yyy" in
6013                 123.456)
6014                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
6015                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
6016                         echo "We will use %Lf."
6017                         ;;
6018                 esac
6019         fi
6020 fi
6021
6022 if $test X"$sPRIfldbl" = X; then
6023         $cat >try.c <<'EOCP'
6024 #include <sys/types.h>
6025 #include <stdio.h>
6026 int main() {
6027   long double d = 123.456;
6028   printf("%.3llf\n", d);
6029 }
6030 EOCP
6031         set try
6032         if eval $compile; then
6033                 yyy=`$run ./try`
6034                 case "$yyy" in
6035                 123.456)
6036                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
6037                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
6038                         echo "We will use %llf."
6039                         ;;
6040                 esac
6041         fi
6042 fi
6043
6044 if $test X"$sPRIfldbl" = X; then
6045         $cat >try.c <<'EOCP'
6046 #include <sys/types.h>
6047 #include <stdio.h>
6048 int main() {
6049   long double d = 123.456;
6050   printf("%.3lf\n", d);
6051 }
6052 EOCP
6053         set try
6054         if eval $compile; then
6055                 yyy=`$run ./try`
6056                 case "$yyy" in
6057                 123.456)
6058                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
6059                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
6060                         echo "We will use %lf."
6061                         ;;
6062                 esac
6063         fi
6064 fi
6065
6066 if $test X"$sPRIfldbl" = X; then
6067         echo "Cannot figure out how to print long doubles." >&4
6068 else
6069         sSCNfldbl=$sPRIfldbl    # expect consistency
6070 fi
6071
6072 $rm -f try try.*
6073
6074 fi # d_longdbl
6075
6076 case "$sPRIfldbl" in
6077 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
6078         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
6079         d_SCNfldbl="$undef";
6080         ;;
6081 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
6082         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
6083         d_SCNfldbl="$define";
6084         ;;
6085 esac
6086
6087 : see if modfl exists
6088 set modfl d_modfl
6089 eval $inlibc
6090
6091 d_modfl_pow32_bug="$undef"
6092
6093 case "$d_longdbl$d_modfl" in
6094 $define$define)
6095         $cat <<EOM
6096 Checking to see whether your modfl() is okay for large values...
6097 EOM
6098 $cat >try.c <<EOCP
6099 #include <math.h> 
6100 #include <stdio.h>
6101 int main() {
6102     long double nv = 4294967303.15;
6103     long double v, w;
6104     v = modfl(nv, &w);         
6105 #ifdef __GLIBC__
6106     printf("glibc");
6107 #endif
6108     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
6109     return 0;
6110 }
6111 EOCP
6112         case "$osname:$gccversion" in
6113         aix:)   saveccflags="$ccflags"
6114                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
6115         esac
6116         set try
6117         if eval $compile; then
6118                 foo=`$run ./try`
6119                 case "$foo" in
6120                 *" 4294967303.150000 1.150000 4294967302.000000")
6121                         echo >&4 "Your modfl() is broken for large values."
6122                         d_modfl_pow32_bug="$define"
6123                         case "$foo" in
6124                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
6125                         ;;
6126                         esac
6127                         ;;
6128                 *" 4294967303.150000 0.150000 4294967303.000000")
6129                         echo >&4 "Your modfl() seems okay for large values."
6130                         ;;
6131                 *)      echo >&4 "I don't understand your modfl() at all."
6132                         d_modfl="$undef"
6133                         ;;
6134                 esac
6135                 $rm -f try.* try core core.try.*
6136         else
6137                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
6138                 d_modfl="$undef"
6139         fi
6140         case "$osname:$gccversion" in
6141         aix:)   ccflags="$saveccflags" ;; # restore
6142         esac
6143         ;;
6144 esac
6145
6146 case "$ccflags" in
6147 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6148 esac
6149
6150 case "$uselongdouble" in
6151 $define|true|[yY]*)     dflt='y';;
6152 *) dflt='n';;
6153 esac
6154 cat <<EOM
6155
6156 Perl can be built to take advantage of long doubles which
6157 (if available) may give more accuracy and range for floating point numbers.
6158
6159 If this doesn't make any sense to you, just accept the default '$dflt'.
6160 EOM
6161 rp='Try to use long doubles if available?'
6162 . ./myread
6163 case "$ans" in
6164 y|Y)    val="$define"   ;;
6165 *)      val="$undef"    ;;
6166 esac
6167 set uselongdouble
6168 eval $setvar
6169
6170 case "$uselongdouble" in
6171 true|[yY]*) uselongdouble="$define" ;;
6172 esac
6173
6174 case "$uselongdouble" in
6175 $define)
6176 : Look for a hint-file generated 'call-back-unit'.  If the
6177 : user has specified that long doubles should be used,
6178 : we may need to set or change some other defaults.
6179         if $test -f uselongdouble.cbu; then
6180                 echo "Your platform has some specific hints for long doubles, using them..."
6181                 . ./uselongdouble.cbu
6182         else
6183                 $cat <<EOM
6184 (Your platform doesn't have any specific hints for long doubles.)
6185 EOM
6186         fi
6187         ;;
6188 esac
6189
6190 message=X
6191 case "$uselongdouble:$d_sqrtl:$d_modfl" in
6192 $define:$define:$define)
6193         : You have both
6194         ;;
6195 $define:$define:$undef)
6196         message="I could not find modfl"
6197         ;;
6198 $define:$undef:$define)
6199         message="I could not find sqrtl"
6200         ;;
6201 $define:$undef:$undef)
6202         message="I found neither sqrtl nor modfl"
6203         ;;
6204 esac
6205
6206 if $test "$message" != X; then
6207         $cat <<EOM >&4
6208
6209 *** You requested the use of long doubles but you do not seem to have
6210 *** the mathematic functions for long doubles.
6211 *** ($message)
6212 *** I'm disabling the use of long doubles.
6213
6214 EOM
6215
6216         uselongdouble=$undef
6217 fi
6218
6219 case "$useperlio" in
6220 $define|true|[yY]*|'')  dflt='y';;
6221 *) dflt='n';;
6222 esac
6223 cat <<EOM
6224
6225 Previous version of $package used the standard IO mechanisms as
6226 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
6227 alternate IO mechanisms via the PerlIO abstraction layer, but the
6228 stdio mechanism is still available if needed.  The abstraction layer
6229 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
6230 Using PerlIO with sfio may cause problems with some extension modules.
6231
6232 If this doesn't make any sense to you, just accept the default '$dflt'.
6233 EOM
6234 rp='Use the PerlIO abstraction layer?'
6235 . ./myread
6236 case "$ans" in
6237 y|Y) 
6238         val="$define"
6239         ;;
6240 *)      
6241         echo "Ok, doing things the stdio way."
6242         val="$undef"
6243         ;;
6244 esac
6245 set useperlio
6246 eval $setvar 
6247
6248 case "$usesocks" in
6249 $define|true|[yY]*)
6250         case "$useperlio" in
6251         $define|true|[yY]*) ;;
6252         *)      cat >&4 <<EOM
6253
6254 You are using the SOCKS proxy protocol library which means that you
6255 should also use the PerlIO layer.  You may be headed for trouble.
6256
6257 EOM
6258                 ;;
6259         esac
6260         ;;
6261 esac
6262
6263         
6264 : determine the architecture name
6265 echo " "
6266 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6267         tarch=`arch`"-$osname"
6268 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6269         if uname -m > tmparch 2>&1 ; then
6270                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6271                         -e 's/$/'"-$osname/" tmparch`
6272         else
6273                 tarch="$osname"
6274         fi
6275         $rm -f tmparch
6276 else
6277         tarch="$osname"
6278 fi
6279 case "$myarchname" in
6280 ''|"$tarch") ;;
6281 *)
6282         echo "(Your architecture name used to be $myarchname.)"
6283         archname=''
6284         ;;
6285 esac
6286 case "$targetarch" in
6287 '') ;;
6288 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6289 esac
6290 myarchname="$tarch"
6291 case "$archname" in
6292 '') dflt="$tarch";;
6293 *) dflt="$archname";;
6294 esac
6295 rp='What is your architecture name'
6296 . ./myread
6297 archname="$ans"
6298 case "$usethreads" in
6299 $define)
6300         echo "Threads selected." >&4
6301         case "$archname" in
6302         *-thread*) echo "...and architecture name already has -thread." >&4
6303                 ;;
6304         *)      archname="$archname-thread"
6305                 echo "...setting architecture name to $archname." >&4
6306                 ;;
6307         esac
6308         ;;
6309 esac
6310 case "$usemultiplicity" in
6311 $define)
6312         echo "Multiplicity selected." >&4
6313         case "$archname" in
6314         *-multi*) echo "...and architecture name already has -multi." >&4
6315                 ;;
6316         *)      archname="$archname-multi"
6317                 echo "...setting architecture name to $archname." >&4
6318                 ;;
6319         esac
6320         ;;
6321 esac
6322 case "$use64bitint$use64bitall" in
6323 *"$define"*)
6324         case "$archname64" in
6325         '')
6326                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6327                 ;;
6328         *)
6329                 case "$use64bitint" in
6330                 "$define") echo "64 bit integers selected." >&4 ;;
6331                 esac
6332                 case "$use64bitall" in
6333                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6334                 esac
6335                 case "$archname" in
6336                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6337                         ;;
6338                 *)      archname="$archname-$archname64"
6339                         echo "...setting architecture name to $archname." >&4
6340                         ;;
6341                 esac
6342                 ;;
6343         esac
6344 esac
6345 case "$uselongdouble" in
6346 $define)
6347         echo "Long doubles selected." >&4
6348         case "$longdblsize" in
6349         $doublesize)
6350                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6351                 ;;
6352         *)
6353                 case "$archname" in
6354                 *-ld*) echo "...and architecture name already has -ld." >&4
6355                         ;;
6356                 *)      archname="$archname-ld"
6357                         echo "...setting architecture name to $archname." >&4
6358                         ;;
6359                 esac
6360                 ;;
6361         esac
6362         ;;
6363 esac
6364 case "$useperlio" in
6365 $define)
6366         echo "Perlio selected." >&4
6367         ;;
6368 *)
6369         echo "Perlio not selected, using stdio." >&4
6370         case "$archname" in
6371         *-stdio*) echo "...and architecture name already has -stdio." >&4
6372                 ;;
6373         *)      archname="$archname-stdio"
6374                 echo "...setting architecture name to $archname." >&4
6375                 ;;
6376         esac
6377         ;;
6378 esac
6379
6380 : determine root of directory hierarchy where package will be installed.
6381 case "$prefix" in
6382 '')
6383         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
6384         ;;
6385 *)
6386         dflt="$prefix"
6387         ;;
6388 esac
6389 $cat <<EOM
6390
6391 By default, $package will be installed in $dflt/bin, manual pages
6392 under $dflt/man, etc..., i.e. with $dflt as prefix for all
6393 installation directories. Typically this is something like /usr/local.
6394 If you wish to have binaries under /usr/bin but other parts of the
6395 installation under /usr/local, that's ok: you will be prompted
6396 separately for each of the installation directories, the prefix being
6397 only used to set the defaults.
6398
6399 EOM
6400 fn=d~
6401 rp='Installation prefix to use?'
6402 . ./getfile
6403 oldprefix=''
6404 case "$prefix" in
6405 '') ;;
6406 *)
6407         case "$ans" in
6408         "$prefix") ;;
6409         *) oldprefix="$prefix";;
6410         esac
6411         ;;
6412 esac
6413 prefix="$ans"
6414 prefixexp="$ansexp"
6415
6416 case "$afsroot" in
6417 '')     afsroot=/afs ;;
6418 *)      afsroot=$afsroot ;;
6419 esac
6420
6421 : is AFS running?
6422 echo " "
6423 case "$afs" in
6424 $define|true)   afs=true ;;
6425 $undef|false)   afs=false ;;
6426 *)      if test -d $afsroot; then
6427                 afs=true
6428         else
6429                 afs=false
6430         fi
6431         ;;
6432 esac
6433 if $afs; then
6434         echo "AFS may be running... I'll be extra cautious then..." >&4
6435 else
6436         echo "AFS does not seem to be running..." >&4
6437 fi
6438
6439 : determine installation prefix for where package is to be installed.
6440 if $afs; then 
6441 $cat <<EOM
6442
6443 Since you are running AFS, I need to distinguish the directory in which
6444 files will reside from the directory in which they are installed (and from
6445 which they are presumably copied to the former directory by occult means).
6446
6447 EOM
6448         case "$installprefix" in
6449         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6450         *) dflt="$installprefix";;
6451         esac
6452 else
6453 $cat <<EOM
6454
6455 In some special cases, particularly when building $package for distribution,
6456 it is convenient to distinguish between the directory in which files should 
6457 be installed from the directory ($prefix) in which they 
6458 will eventually reside.  For most users, these two directories are the same.
6459
6460 EOM
6461         case "$installprefix" in
6462         '') dflt=$prefix ;;
6463         *) dflt=$installprefix;;
6464         esac
6465 fi
6466 fn=d~
6467 rp='What installation prefix should I use for installing files?'
6468 . ./getfile
6469 installprefix="$ans"
6470 installprefixexp="$ansexp"
6471
6472 : set the prefixit variable, to compute a suitable default value
6473 prefixit='case "$3" in
6474 ""|none)
6475         case "$oldprefix" in
6476         "") eval "$1=\"\$$2\"";;
6477         *)
6478                 case "$3" in
6479                 "") eval "$1=";;
6480                 none)
6481                         eval "tp=\"\$$2\"";
6482                         case "$tp" in
6483                         ""|" ") eval "$1=\"\$$2\"";;
6484                         *) eval "$1=";;
6485                         esac;;
6486                 esac;;
6487         esac;;
6488 *)
6489         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6490         case "$tp" in
6491         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6492         /*-$oldprefix/*|\~*-$oldprefix/*)
6493                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6494         *) eval "$1=\"\$$2\"";;
6495         esac;;
6496 esac'
6497
6498 : get the patchlevel
6499 echo " "
6500 echo "Getting the current patchlevel..." >&4
6501 if $test -r $rsrc/patchlevel.h;then
6502         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6503         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6504         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6505         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6506         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6507         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6508        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6509 else
6510         revision=0
6511         patchlevel=0
6512         subversion=0
6513         api_revision=0
6514         api_version=0
6515         api_subversion=0
6516         perl_patchlevel=0
6517         $echo "(You do not have patchlevel.h.  Eek.)"
6518 fi
6519 if $test -r $rsrc/.patch ; then  
6520         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6521                 perl_patchlevel=`cat $rsrc/.patch`
6522         fi
6523 fi
6524 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
6525 version_patchlevel_string="version $patchlevel subversion $subversion"
6526 case "$perl_patchlevel" in
6527 0|'') ;;
6528 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
6529 esac
6530
6531 $echo "(You have $package $version_patchlevel_string.)"
6532
6533 case "$osname" in
6534 dos|vms)
6535         : XXX Should be a Configure test for double-dots in filenames.
6536         version=`echo $revision $patchlevel $subversion | \
6537                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6538         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6539                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6540         ;;
6541 *)
6542         version=`echo $revision $patchlevel $subversion | \
6543                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6544         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6545                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6546         ;;
6547 esac
6548 : Special case the 5.005_xx maintenance series, which used 5.005
6549 : without any subversion label as a subdirectory in $sitelib
6550 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6551         api_versionstring='5.005'
6552 fi
6553
6554 : determine installation style
6555 : For now, try to deduce it from prefix unless it is already set.
6556 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6557 case "$installstyle" in
6558 '')     case "$prefix" in
6559                 *perl*) dflt='lib';;
6560                 *) dflt='lib/perl5' ;;
6561         esac
6562         ;;
6563 *)      dflt="$installstyle" ;;
6564 esac
6565 : Probably not worth prompting for this since we prompt for all
6566 : the directories individually, and the prompt would be too long and
6567 : confusing anyway.
6568 installstyle=$dflt
6569
6570 : determine where private library files go
6571 : Usual default is /usr/local/lib/perl5/$version.
6572 : Also allow things like /opt/perl/lib/$version, since 
6573 : /opt/perl/lib/perl5... would be redundant.
6574 : The default "style" setting is made in installstyle.U
6575 case "$installstyle" in
6576 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6577 *)       set dflt privlib lib/$version ;;
6578 esac
6579 eval $prefixit
6580 $cat <<EOM
6581
6582 There are some auxiliary files for $package that need to be put into a
6583 private library directory that is accessible by everyone.
6584
6585 EOM
6586 fn=d~+
6587 rp='Pathname where the private library files will reside?'
6588 . ./getfile
6589 privlib="$ans"
6590 privlibexp="$ansexp"
6591 : Change installation prefix, if necessary.
6592 if $test X"$prefix" != X"$installprefix"; then
6593         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6594 else
6595         installprivlib="$privlibexp"
6596 fi
6597
6598 : set the prefixup variable, to restore leading tilda escape
6599 prefixup='case "$prefixexp" in
6600 "$prefix") ;;
6601 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6602 esac'
6603
6604 : determine where public architecture dependent libraries go
6605 set archlib archlib
6606 eval $prefixit
6607 : privlib default is /usr/local/lib/$package/$version
6608 : archlib default is /usr/local/lib/$package/$version/$archname
6609 : privlib may have an optional trailing /share.
6610 tdflt=`echo $privlib | $sed 's,/share$,,'`
6611 tdflt=$tdflt/$archname
6612 case "$archlib" in
6613 '')     dflt=$tdflt
6614         ;;
6615 *)      dflt="$archlib"
6616     ;;
6617 esac
6618 $cat <<EOM
6619
6620 $spackage contains architecture-dependent library files.  If you are
6621 sharing libraries in a heterogeneous environment, you might store
6622 these files in a separate location.  Otherwise, you can just include
6623 them with the rest of the public library files.
6624
6625 EOM
6626 fn=d+~
6627 rp='Where do you want to put the public architecture-dependent libraries?'
6628 . ./getfile
6629 archlib="$ans"
6630 archlibexp="$ansexp"
6631 if $test X"$archlib" = X"$privlib"; then
6632         d_archlib="$undef"
6633 else
6634         d_archlib="$define"
6635 fi
6636 : Change installation prefix, if necessary.
6637 if $test X"$prefix" != X"$installprefix"; then
6638         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6639 else
6640         installarchlib="$archlibexp"
6641 fi
6642
6643 : see if setuid scripts can be secure
6644 $cat <<EOM
6645
6646 Some kernels have a bug that prevents setuid #! scripts from being
6647 secure.  Some sites have disabled setuid #! scripts because of this.
6648
6649 First let's decide if your kernel supports secure setuid #! scripts.
6650 (If setuid #! scripts would be secure but have been disabled anyway,
6651 don't say that they are secure if asked.)
6652
6653 EOM
6654
6655 val="$undef"
6656 if $test -d /dev/fd; then
6657         echo "#!$ls" >reflect
6658         chmod +x,u+s reflect
6659         ./reflect >flect 2>&1
6660         if $contains "/dev/fd" flect >/dev/null; then
6661                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6662                 val="$define"
6663         else
6664                 $cat <<EOM
6665 If you are not sure if they are secure, I can check but I'll need a
6666 username and password different from the one you are using right now.
6667 If you don't have such a username or don't want me to test, simply
6668 enter 'none'.
6669
6670 EOM
6671                 rp='Other username to test security of setuid scripts with?'
6672                 dflt='none'
6673                 . ./myread
6674                 case "$ans" in
6675                 n|none)
6676                         case "$d_suidsafe" in
6677                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6678                                 dflt=n;;
6679                         "$undef")
6680                                 echo "Well, the $hint value is *not* secure." >&4
6681                                 dflt=n;;
6682                         *)      echo "Well, the $hint value *is* secure." >&4
6683                                 dflt=y;;
6684                         esac
6685                         ;;
6686                 *)
6687                         $rm -f reflect flect
6688                         echo "#!$ls" >reflect
6689                         chmod +x,u+s reflect
6690                         echo >flect
6691                         chmod a+w flect
6692                         echo '"su" will (probably) prompt you for '"$ans's password."
6693                         su $ans -c './reflect >flect'
6694                         if $contains "/dev/fd" flect >/dev/null; then
6695                                 echo "Okay, it looks like setuid scripts are secure." >&4
6696                                 dflt=y
6697                         else
6698                                 echo "I don't think setuid scripts are secure." >&4
6699                                 dflt=n
6700                         fi
6701                         ;;
6702                 esac
6703                 rp='Does your kernel have *secure* setuid scripts?'
6704                 . ./myread
6705                 case "$ans" in
6706                 [yY]*)  val="$define";;
6707                 *)      val="$undef";;
6708                 esac
6709         fi
6710 else
6711         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6712         echo "(That's for file descriptors, not floppy disks.)"
6713         val="$undef"
6714 fi
6715 set d_suidsafe
6716 eval $setvar
6717
6718 $rm -f reflect flect
6719
6720 : now see if they want to do setuid emulation
6721 echo " "
6722 val="$undef"
6723 case "$d_suidsafe" in
6724 "$define")
6725         val="$undef"
6726         echo "No need to emulate SUID scripts since they are secure here." >&4
6727         ;;
6728 *)
6729         $cat <<EOM
6730 Some systems have disabled setuid scripts, especially systems where
6731 setuid scripts cannot be secure.  On systems where setuid scripts have
6732 been disabled, the setuid/setgid bits on scripts are currently
6733 useless.  It is possible for $package to detect those bits and emulate
6734 setuid/setgid in a secure fashion.  This emulation will only work if
6735 setuid scripts have been disabled in your kernel.
6736
6737 EOM
6738         case "$d_dosuid" in
6739         "$define") dflt=y ;;
6740         *) dflt=n ;;
6741         esac
6742         rp="Do you want to do setuid/setgid emulation?"
6743         . ./myread
6744         case "$ans" in
6745         [yY]*)  val="$define";;
6746         *)      val="$undef";;
6747         esac
6748         ;;
6749 esac
6750 set d_dosuid
6751 eval $setvar
6752
6753 : see if this is a malloc.h system
6754 set malloc.h i_malloc
6755 eval $inhdr
6756
6757 : see if stdlib is available
6758 set stdlib.h i_stdlib
6759 eval $inhdr
6760
6761 : determine which malloc to compile in
6762 echo " "
6763 case "$usemymalloc" in
6764 [yY]*|true|$define)     dflt='y' ;;
6765 [nN]*|false|$undef)     dflt='n' ;;
6766 *)      case "$ptrsize" in
6767         4) dflt='y' ;;
6768         *) dflt='n' ;;
6769         esac
6770         ;;
6771 esac
6772 rp="Do you wish to attempt to use the malloc that comes with $package?"
6773 . ./myread
6774 usemymalloc="$ans"
6775 case "$ans" in
6776 y*|true)
6777         usemymalloc='y'
6778         mallocsrc='malloc.c'
6779         mallocobj="malloc$_o"
6780         d_mymalloc="$define"
6781         case "$libs" in
6782         *-lmalloc*)
6783                 : Remove malloc from list of libraries to use
6784                 echo "Removing unneeded -lmalloc from library list" >&4
6785                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6786                 shift
6787                 libs="$*"
6788                 echo "libs = $libs" >&4
6789                 ;;
6790         esac
6791         ;;
6792 *)
6793         usemymalloc='n'
6794         mallocsrc=''
6795         mallocobj=''
6796         d_mymalloc="$undef"
6797         ;;
6798 esac
6799
6800 : compute the return types of malloc and free
6801 echo " "
6802 $cat >malloc.c <<END
6803 #$i_malloc I_MALLOC
6804 #$i_stdlib I_STDLIB
6805 #include <stdio.h>
6806 #include <sys/types.h>
6807 #ifdef I_MALLOC
6808 #include <malloc.h>
6809 #endif
6810 #ifdef I_STDLIB
6811 #include <stdlib.h>
6812 #endif
6813 #ifdef TRY_MALLOC
6814 void *malloc();
6815 #endif
6816 #ifdef TRY_FREE
6817 void free();
6818 #endif
6819 END
6820 case "$malloctype" in
6821 '')
6822         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6823                 malloctype='void *'
6824         else
6825                 malloctype='char *'
6826         fi
6827         ;;
6828 esac
6829 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6830
6831 case "$freetype" in
6832 '')
6833         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6834                 freetype='void'
6835         else
6836                 freetype='int'
6837         fi
6838         ;;
6839 esac
6840 echo "Your system uses $freetype free(), it would seem." >&4
6841 $rm -f malloc.[co]
6842 $cat <<EOM
6843
6844 After $package is installed, you may wish to install various
6845 add-on modules and utilities.  Typically, these add-ons will
6846 be installed under $prefix with the rest
6847 of this package.  However, you may wish to install such add-ons
6848 elsewhere under a different prefix.
6849
6850 If you do not wish to put everything under a single prefix, that's
6851 ok.  You will be prompted for the individual locations; this siteprefix
6852 is only used to suggest the defaults.
6853
6854 The default should be fine for most people.
6855
6856 EOM
6857 fn=d~+
6858 rp='Installation prefix to use for add-on modules and utilities?'
6859 : XXX Here might be another good place for an installstyle setting.
6860 case "$siteprefix" in
6861 '') dflt=$prefix ;;
6862 *)  dflt=$siteprefix ;;
6863 esac
6864 . ./getfile
6865 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6866 oldsiteprefix=''
6867 case "$siteprefix" in
6868 '') ;;
6869 *)      case "$ans" in
6870         "$prefix") ;;
6871         *) oldsiteprefix="$prefix";;
6872         esac
6873         ;;
6874 esac
6875 siteprefix="$ans"
6876 siteprefixexp="$ansexp"
6877
6878 : determine where site specific libraries go.
6879 : Usual default is /usr/local/lib/perl5/site_perl/$version
6880 : The default "style" setting is made in installstyle.U
6881 : XXX No longer works with Prefixit stuff.
6882 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6883 case "$sitelib" in
6884 '') case "$installstyle" in
6885         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6886         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6887         esac
6888         ;;
6889 *)      dflt="$sitelib"
6890         ;;
6891 esac
6892 $cat <<EOM
6893
6894 The installation process will create a directory for
6895 site-specific extensions and modules.  Most users find it convenient
6896 to place all site-specific files in this directory rather than in the
6897 main distribution directory.
6898
6899 EOM
6900 fn=d~+
6901 rp='Pathname for the site-specific library files?'
6902 . ./getfile
6903 sitelib="$ans"
6904 sitelibexp="$ansexp"
6905 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6906 : Change installation prefix, if necessary.
6907 if $test X"$prefix" != X"$installprefix"; then
6908         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6909 else
6910         installsitelib="$sitelibexp"
6911 fi
6912
6913 : determine where site specific architecture-dependent libraries go.
6914 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6915 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6916 : sitelib may have an optional trailing /share.
6917 case "$sitearch" in
6918 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6919         dflt="$dflt/$archname"
6920         ;;
6921 *)      dflt="$sitearch"
6922         ;;
6923 esac
6924 set sitearch sitearch none
6925 eval $prefixit
6926 $cat <<EOM
6927
6928 The installation process will also create a directory for
6929 architecture-dependent site-specific extensions and modules.
6930
6931 EOM
6932 fn=d~+
6933 rp='Pathname for the site-specific architecture-dependent library files?'
6934 . ./getfile
6935 sitearch="$ans"
6936 sitearchexp="$ansexp"
6937 : Change installation prefix, if necessary.
6938 if $test X"$prefix" != X"$installprefix"; then
6939         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6940 else
6941         installsitearch="$sitearchexp"
6942 fi
6943
6944 $cat <<EOM
6945
6946 The installation process will also create a directory for
6947 vendor-supplied add-ons.  Vendors who supply perl with their system
6948 may find it convenient to place all vendor-supplied files in this
6949 directory rather than in the main distribution directory.  This will
6950 ease upgrades between binary-compatible maintenance versions of perl.
6951
6952 Of course you may also use these directories in whatever way you see
6953 fit.  For example, you might use them to access modules shared over a
6954 company-wide network.
6955
6956 The default answer should be fine for most people.
6957 This causes further questions about vendor add-ons to be skipped
6958 and no vendor-specific directories will be configured for perl.
6959
6960 EOM
6961 rp='Do you want to configure vendor-specific add-on directories?'
6962 case "$usevendorprefix" in
6963 define|true|[yY]*) dflt=y ;;
6964 *)      : User may have set vendorprefix directly on Configure command line.
6965         case "$vendorprefix" in
6966         ''|' ') dflt=n ;;
6967         *)      dflt=y ;;
6968         esac
6969         ;;
6970 esac
6971 . ./myread
6972 case "$ans" in
6973 [yY]*)  fn=d~+
6974         rp='Installation prefix to use for vendor-supplied add-ons?'
6975         case "$vendorprefix" in
6976         '') dflt='' ;;
6977         *)  dflt=$vendorprefix ;;
6978         esac
6979         . ./getfile
6980         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6981         oldvendorprefix=''
6982         case "$vendorprefix" in
6983         '') ;;
6984         *)      case "$ans" in
6985                 "$prefix") ;;
6986                 *) oldvendorprefix="$prefix";;
6987                 esac
6988                 ;;
6989         esac
6990         usevendorprefix="$define"
6991         vendorprefix="$ans"
6992         vendorprefixexp="$ansexp"
6993         ;;
6994 *)      usevendorprefix="$undef"
6995         vendorprefix=''
6996         vendorprefixexp=''
6997         ;;
6998 esac
6999
7000 case "$vendorprefix" in
7001 '')     d_vendorlib="$undef"
7002         vendorlib=''
7003         vendorlibexp=''
7004         ;;
7005 *)      d_vendorlib="$define"
7006         : determine where vendor-supplied modules go.
7007         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7008         case "$vendorlib" in
7009         '')
7010                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7011                 case "$installstyle" in
7012                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7013                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7014                 esac
7015                 ;;
7016         *)      dflt="$vendorlib"
7017                 ;;
7018         esac
7019         fn=d~+
7020         rp='Pathname for the vendor-supplied library files?'
7021         . ./getfile
7022         vendorlib="$ans"
7023         vendorlibexp="$ansexp"
7024         ;;
7025 esac
7026 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7027 : Change installation prefix, if necessary.
7028 if $test X"$prefix" != X"$installprefix"; then
7029         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
7030 else
7031         installvendorlib="$vendorlibexp"
7032 fi
7033
7034 case "$vendorprefix" in
7035 '')     d_vendorarch="$undef"
7036         vendorarch=''
7037         vendorarchexp=''
7038         ;;
7039 *)      d_vendorarch="$define"
7040         : determine where vendor-supplied architecture-dependent libraries go.
7041         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7042         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7043         : vendorlib may have an optional trailing /share.
7044         case "$vendorarch" in
7045         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7046                 dflt="$dflt/$archname"
7047                 ;;
7048         *)      dflt="$vendorarch" ;;
7049         esac
7050         fn=d~+
7051         rp='Pathname for vendor-supplied architecture-dependent files?'
7052         . ./getfile
7053         vendorarch="$ans"
7054         vendorarchexp="$ansexp"
7055         ;;
7056 esac
7057 : Change installation prefix, if necessary.
7058 if $test X"$prefix" != X"$installprefix"; then
7059         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
7060 else
7061         installvendorarch="$vendorarchexp"
7062 fi
7063
7064 : Final catch-all directories to search
7065 $cat <<EOM
7066
7067 Lastly, you can have perl look in other directories for extensions and
7068 modules in addition to those already specified.
7069 These directories will be searched after 
7070         $sitearch 
7071         $sitelib 
7072 EOM
7073 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7074 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7075 echo ' '
7076 case "$otherlibdirs" in
7077 ''|' ') dflt='none' ;;
7078 *)      dflt="$otherlibdirs" ;;
7079 esac
7080 $cat <<EOM
7081 Enter a colon-separated set of extra paths to include in perl's @INC
7082 search path, or enter 'none' for no extra paths.
7083
7084 EOM
7085
7086 rp='Colon-separated list of additional directories for perl to search?'
7087 . ./myread
7088 case "$ans" in
7089 ' '|''|none)    otherlibdirs=' ' ;;     
7090 *)      otherlibdirs="$ans" ;;
7091 esac
7092 case "$otherlibdirs" in
7093 ' ') val=$undef ;;
7094 *)      val=$define ;;
7095 esac
7096 set d_perl_otherlibdirs
7097 eval $setvar
7098
7099 : Cruising for prototypes
7100 echo " "
7101 echo "Checking out function prototypes..." >&4
7102 $cat >prototype.c <<'EOCP'
7103 int main(int argc, char *argv[]) {
7104         exit(0);}
7105 EOCP
7106 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7107         echo "Your C compiler appears to support function prototypes."
7108         val="$define"
7109 else
7110         echo "Your C compiler doesn't seem to understand function prototypes."
7111         val="$undef"
7112 fi
7113 set prototype
7114 eval $setvar
7115 $rm -f prototype*
7116
7117 case "$prototype" in
7118 "$define") ;;
7119 *)      ansi2knr='ansi2knr'
7120         echo " "
7121         cat <<EOM >&4
7122
7123 $me:  FATAL ERROR:
7124 This version of $package can only be compiled by a compiler that 
7125 understands function prototypes.  Unfortunately, your C compiler 
7126         $cc $ccflags
7127 doesn't seem to understand them.  Sorry about that.
7128
7129 If GNU cc is available for your system, perhaps you could try that instead.  
7130
7131 Eventually, we hope to support building Perl with pre-ANSI compilers.
7132 If you would like to help in that effort, please contact <perlbug@perl.org>.
7133
7134 Aborting Configure now.
7135 EOM
7136         exit 2
7137         ;;
7138 esac
7139
7140 : determine where public executables go
7141 echo " "
7142 set dflt bin bin
7143 eval $prefixit
7144 fn=d~
7145 rp='Pathname where the public executables will reside?'
7146 . ./getfile
7147 if $test "X$ansexp" != "X$binexp"; then
7148         installbin=''
7149 fi
7150 bin="$ans"
7151 binexp="$ansexp"
7152 : Change installation prefix, if necessary.
7153 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7154 if $test X"$prefix" != X"$installprefix"; then
7155         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
7156 else
7157         installbin="$binexp"
7158 fi
7159
7160 echo " "
7161 case "$extras" in
7162 '') dflt='n';;
7163 *) dflt='y';;
7164 esac
7165 cat <<EOM
7166 Perl can be built with extra modules or bundles of modules which
7167 will be fetched from the CPAN and installed alongside Perl.
7168
7169 Notice that you will need access to the CPAN; either via the Internet,
7170 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7171 be asked later to configure the CPAN.pm module which will in turn do
7172 the installation of the rest of the extra modules or bundles.)
7173
7174 Notice also that if the modules require any external software such as
7175 libraries and headers (the libz library and the zlib.h header for the
7176 Compress::Zlib module, for example) you MUST have any such software
7177 already installed, this configuration process will NOT install such
7178 things for you.
7179
7180 If this doesn't make any sense to you, just accept the default '$dflt'.
7181 EOM
7182 rp='Install any extra modules (y or n)?'
7183 . ./myread
7184 case "$ans" in
7185 y|Y)
7186         cat <<EOM
7187
7188 Please list any extra modules or bundles to be installed from CPAN,
7189 with spaces between the names.  The names can be in any format the
7190 'install' command of CPAN.pm will understand.  (Answer 'none',
7191 without the quotes, to install no extra modules or bundles.)
7192 EOM
7193         rp='Extras?'
7194         dflt="$extras"
7195         . ./myread
7196         extras="$ans"
7197 esac
7198 case "$extras" in
7199 ''|'none')
7200         val=''
7201         $rm -f ../extras.lst
7202         ;;
7203 *)      echo "(Saving the list of extras for later...)"
7204         echo "$extras" > ../extras.lst
7205         val="'$extras'"
7206         ;;
7207 esac
7208 set extras
7209 eval $setvar
7210 echo " "
7211
7212 : Find perl5.005 or later.
7213 echo "Looking for a previously installed perl5.005 or later... "
7214 case "$perl5" in
7215 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7216                 : Check if this perl is recent and can load a simple module
7217                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7218                         perl5=$tdir/perl
7219                         break;
7220                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7221                         perl5=$tdir/perl5
7222                         break;
7223                 fi
7224         done
7225         ;;
7226 *)      perl5="$perl5"
7227         ;;
7228 esac
7229 case "$perl5" in
7230 '')     echo "None found.  That's ok.";;
7231 *)      echo "Using $perl5." ;;
7232 esac
7233
7234 : Determine list of previous versions to include in @INC
7235 $cat > getverlist <<EOPL
7236 #!$perl5 -w
7237 use File::Basename;
7238 \$api_versionstring = "$api_versionstring";
7239 \$version = "$version";
7240 \$stem = "$sitelib_stem";
7241 \$archname = "$archname";
7242 EOPL
7243         $cat >> getverlist <<'EOPL'
7244 # Can't have leading @ because metaconfig interprets it as a command!
7245 ;@inc_version_list=();
7246 # XXX Redo to do opendir/readdir? 
7247 if (-d $stem) {
7248     chdir($stem);
7249     ;@candidates = glob("5.*");
7250 }
7251 else {
7252     ;@candidates = ();
7253 }
7254
7255 # XXX ToDo:  These comparisons must be reworked when two-digit
7256 # subversions come along, so that 5.7.10 compares as greater than
7257 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
7258 # widespread that we can use the built-in version vectors rather
7259 # than reinventing them here.  For 5.6.0, however, we must
7260 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
7261 foreach $d (@candidates) {
7262     if ($d lt $version) {
7263         if ($d ge $api_versionstring) {
7264             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
7265         }
7266         elsif ($d ge "5.005") {
7267             unshift(@inc_version_list, grep { -d } $d);
7268         }
7269     }
7270     else {
7271         # Skip newer version.  I.e. don't look in
7272         # 5.7.0 if we're installing 5.6.1.
7273     }
7274 }
7275
7276 if (@inc_version_list) {
7277     print join(' ', @inc_version_list);
7278 }
7279 else {
7280     # Blank space to preserve value for next Configure run.
7281     print " ";
7282 }
7283 EOPL
7284 chmod +x getverlist
7285 case "$inc_version_list" in
7286 '')     if test -x "$perl5$exe_ext"; then
7287                 dflt=`$perl5 getverlist`
7288         else
7289                 dflt='none'
7290         fi
7291         ;;
7292 $undef) dflt='none' ;;
7293 *)  eval dflt=\"$inc_version_list\" ;;
7294 esac
7295 case "$dflt" in
7296 ''|' ') dflt=none ;;
7297 esac
7298 case "$dflt" in
7299 5.005) dflt=none ;;
7300 esac
7301 $cat <<'EOM'
7302
7303 In order to ease the process of upgrading, this version of perl 
7304 can be configured to use modules built and installed with earlier 
7305 versions of perl that were installed under $prefix.  Specify here
7306 the list of earlier versions that this version of perl should check.
7307 If Configure detected no earlier versions of perl installed under
7308 $prefix, then the list will be empty.  Answer 'none' to tell perl
7309 to not search earlier versions.
7310
7311 The default should almost always be sensible, so if you're not sure,
7312 just accept the default.
7313 EOM
7314
7315 rp='List of earlier versions to include in @INC?'
7316 . ./myread
7317 case "$ans" in
7318 [Nn]one|''|' ') inc_version_list=' ' ;;
7319 *) inc_version_list="$ans" ;;
7320 esac
7321 case "$inc_version_list" in
7322 ''|' ') 
7323         inc_version_list_init='0';;
7324 *)      inc_version_list_init=`echo $inc_version_list |
7325                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7326         ;;
7327 esac
7328 $rm -f getverlist
7329
7330 : determine whether to install perl also as /usr/bin/perl
7331
7332 echo " "
7333 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7334         $cat <<EOM
7335 Many scripts expect perl to be installed as /usr/bin/perl.
7336 I can install the perl you are about to compile also as /usr/bin/perl
7337 (in addition to $installbin/perl).
7338 EOM
7339         case "$installusrbinperl" in
7340         "$undef"|[nN]*) dflt='n';;
7341         *)              dflt='y';;
7342         esac
7343         rp="Do you want to install perl as /usr/bin/perl?"
7344         . ./myread
7345         case "$ans" in
7346         [yY]*)  val="$define";;
7347         *)      val="$undef" ;;
7348         esac
7349 else
7350         val="$undef"
7351 fi
7352 set installusrbinperl
7353 eval $setvar
7354
7355 : see if dld is available
7356 set dld.h i_dld
7357 eval $inhdr
7358
7359 : see if dlopen exists
7360 xxx_runnm="$runnm"
7361 runnm=false
7362 set dlopen d_dlopen
7363 eval $inlibc
7364 runnm="$xxx_runnm"
7365
7366 : determine which dynamic loading, if any, to compile in
7367 echo " "
7368 dldir="ext/DynaLoader"
7369 case "$usedl" in
7370 $define|y|true)
7371         dflt='y'
7372         usedl="$define"
7373         ;;
7374 $undef|n|false)
7375         dflt='n'
7376         usedl="$undef"
7377         ;;
7378 *) 
7379         dflt='n'
7380         case "$d_dlopen" in
7381             $define) dflt='y' ;;
7382         esac
7383         case "$i_dld" in
7384             $define) dflt='y' ;;
7385         esac
7386         : Does a dl_xxx.xs file exist for this operating system
7387         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7388         ;;
7389 esac
7390 rp="Do you wish to use dynamic loading?"
7391 . ./myread
7392 usedl="$ans"
7393 case "$ans" in
7394 y*) usedl="$define"
7395         case "$dlsrc" in
7396         '')
7397                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7398                         dflt="$dldir/dl_${osname}.xs"
7399                 elif $test "$d_dlopen" = "$define" ; then
7400                         dflt="$dldir/dl_dlopen.xs"
7401                 elif $test "$i_dld" = "$define" ; then
7402                         dflt="$dldir/dl_dld.xs"
7403                 else
7404                         dflt=''
7405                 fi
7406                 ;;
7407         *)      dflt="$dldir/$dlsrc"
7408                 ;;
7409         esac
7410     echo "The following dynamic loading files are available:"
7411         : Can not go over to $dldir because getfile has path hard-coded in.
7412         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7413         rp="Source file to use for dynamic loading"
7414         fn="fne"
7415         gfpth="$src"
7416         . ./getfile
7417         usedl="$define"
7418         : emulate basename
7419         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7420
7421         $cat << EOM
7422
7423 Some systems may require passing special flags to $cc -c to
7424 compile modules that will be used to create a shared library.
7425 To use no flags, say "none".
7426
7427 EOM
7428     case "$cccdlflags" in
7429     '') case "$gccversion" in
7430                 '') case "$osname" in
7431                         hpux)   dflt='+z' ;;
7432                         next)   dflt='none' ;;
7433                         irix*)  dflt='-KPIC' ;;
7434                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7435                         sunos)  dflt='-pic' ;;
7436                         *)      dflt='none' ;;
7437                     esac
7438                         ;;
7439                 *)  case "$osname" in
7440                         darwin) dflt='none' ;;
7441                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7442                         *)      dflt='-fpic' ;;
7443                     esac ;;
7444             esac ;;
7445         ' ') dflt='none' ;;
7446     *)  dflt="$cccdlflags" ;;
7447     esac
7448     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7449     . ./myread
7450     case "$ans" in
7451     none) cccdlflags=' ' ;;
7452     *) cccdlflags="$ans" ;;
7453     esac
7454
7455     cat << EOM
7456
7457 Some systems use ld to create libraries that can be dynamically loaded,
7458 while other systems (such as those using ELF) use $cc.
7459
7460 EOM
7461         case "$ld" in
7462         '')     $cat >try.c <<'EOM'
7463 /* Test for whether ELF binaries are produced */
7464 #include <fcntl.h>
7465 #include <stdlib.h>
7466 int main() {
7467         char b[4];
7468         int i = open("a.out",O_RDONLY);
7469         if(i == -1) 
7470                 exit(1); /* fail */
7471         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7472                 exit(0); /* succeed (yes, it's ELF) */
7473         else
7474                 exit(1); /* fail */
7475 }
7476 EOM
7477                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7478                         cat <<EOM
7479 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7480 EOM
7481                         dflt="$cc"
7482                 else
7483                         echo "I'll use ld to build dynamic libraries."
7484                         dflt='ld'
7485                 fi
7486                 rm -f try.c a.out
7487                 ;;
7488         *)      dflt="$ld"
7489                 ;;
7490         esac
7491
7492     rp="What command should be used to create dynamic libraries?"
7493     . ./myread
7494         ld="$ans"
7495
7496     cat << EOM
7497
7498 Some systems may require passing special flags to $ld to create a
7499 library that can be dynamically loaded.  If your ld flags include
7500 -L/other/path options to locate libraries outside your loader's normal
7501 search path, you may need to specify those -L options here as well.  To
7502 use no flags, say "none".
7503
7504 EOM
7505     case "$lddlflags" in
7506     '') case "$osname" in
7507                         beos) dflt='-nostart' ;;
7508                         hpux) dflt='-b';
7509                               case "$gccversion" in
7510                               '') dflt="$dflt +vnocompatwarnings" ;;
7511                               esac
7512                               ;;        
7513                         linux|irix*)    dflt='-shared' ;;
7514                         next)  dflt='none' ;;
7515                         solaris) dflt='-G' ;;
7516                         sunos) dflt='-assert nodefinitions' ;;
7517                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7518                 *)     dflt='none' ;;
7519                         esac
7520                         ;;
7521     *) dflt="$lddlflags" ;;
7522     esac
7523
7524         : Try to guess additional flags to pick up local libraries.
7525         : Be careful not to append to a plain 'none'
7526         case "$dflt" in
7527         none) dflt='' ;;
7528         esac
7529         for thisflag in $ldflags; do
7530                 case "$thisflag" in
7531                 -L*|-R*|-Wl,-R*)
7532                         case " $dflt " in
7533                         *" $thisflag "*) ;;
7534                         *) dflt="$dflt $thisflag" ;;
7535                         esac
7536                         ;;
7537                 esac
7538         done
7539
7540         case "$dflt" in
7541         ''|' ') dflt='none' ;;
7542         esac
7543
7544     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7545     . ./myread
7546     case "$ans" in
7547     none) lddlflags=' ' ;;
7548     *) lddlflags="$ans" ;;
7549     esac
7550
7551         cat <<EOM
7552
7553 Some systems may require passing special flags to $cc to indicate that
7554 the resulting executable will use dynamic linking.  To use no flags,
7555 say "none".
7556
7557 EOM
7558     case "$ccdlflags" in
7559     '') case "$osname" in
7560                 hpux)   dflt='-Wl,-E' ;;
7561                 linux)  dflt='-rdynamic' ;;
7562                 next)   dflt='none' ;;
7563                 sunos)  dflt='none' ;;
7564                 *)      dflt='none' ;;
7565             esac ;;
7566     ' ')  dflt='none' ;;
7567     *)  dflt="$ccdlflags" ;;
7568     esac
7569     rp="Any special flags to pass to $cc to use dynamic linking?"
7570     . ./myread
7571     case "$ans" in
7572     none) ccdlflags=' ' ;;
7573     *) ccdlflags="$ans" ;;
7574     esac
7575     ;;
7576 *)  usedl="$undef"
7577         ld='ld'
7578     dlsrc='dl_none.xs'
7579     lddlflags=''
7580     ccdlflags=''
7581     ;;
7582 esac
7583
7584 also=''
7585 case "$usedl" in
7586 $undef)
7587         # No dynamic loading being used, so don't bother even to prompt.
7588         useshrplib='false'
7589         ;;
7590 *)      case "$useshrplib" in
7591         '')     case "$osname" in
7592                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7593                         dflt=y
7594                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7595                         ;;
7596                 next*)
7597                         case "$osvers" in
7598                         4*)     dflt=y
7599                                 also='Building a shared libperl is needed for MAB support.'
7600                                 ;;
7601                         *)      dflt=n
7602                                 ;;
7603                         esac
7604                         ;;
7605                 *)      dflt=n
7606                         ;;
7607                 esac
7608                 ;;
7609         $define|true|[Yy]*)
7610                 dflt=y
7611                 ;;
7612         *)      dflt=n
7613                 ;;
7614         esac
7615         $cat << EOM
7616
7617 The perl executable is normally obtained by linking perlmain.c with
7618 libperl${_a}, any static extensions (usually just DynaLoader), and
7619 any other libraries needed on this system (such as -lm, etc.).  Since
7620 your system supports dynamic loading, it is probably possible to build
7621 a shared libperl.$so.  If you will have more than one executable linked
7622 to libperl.$so, this will significantly reduce the size of each
7623 executable, but it may have a noticeable affect on performance.  The
7624 default is probably sensible for your system.
7625 $also
7626
7627 EOM
7628         rp="Build a shared libperl.$so (y/n)"
7629         . ./myread
7630         case "$ans" in
7631         true|$define|[Yy]*)
7632                 useshrplib='true'  ;;
7633         *)      useshrplib='false' ;;
7634         esac
7635         ;;
7636 esac
7637
7638 case "$useshrplib" in
7639 true)
7640         case "$libperl" in
7641         '')
7642                 # Figure out a good name for libperl.so.  Since it gets stored in
7643                 # a version-specific architecture-dependent library, the version
7644                 # number isn't really that important, except for making cc/ld happy.
7645                 #
7646                 # A name such as libperl.so.3.1
7647                 majmin="libperl.$so.$patchlevel.$subversion"
7648                 # A name such as libperl.so.301
7649                 majonly=`echo $patchlevel $subversion |
7650                         $awk '{printf "%d%02d", $1, $2}'`
7651                 majonly=libperl.$so.$majonly
7652                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7653                 # rely on figuring it out from the naming of libc.
7654                 case "${osname}${osvers}" in
7655                 next4*)
7656                         dflt=libperl.5.$so
7657                         # XXX How handle the --version stuff for MAB?
7658                         ;;
7659                 linux*)  # ld won't link with a bare -lperl otherwise.
7660                         dflt=libperl.$so
7661                         ;;
7662                 cygwin*) # ld links against an importlib
7663                         dflt=libperl$lib_ext
7664                         ;;
7665                 *)      # Try to guess based on whether libc has major.minor.
7666                         case "$libc" in
7667                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7668                         *libc.$so.[0-9]*) dflt=$majonly ;;
7669                         *)      dflt=libperl.$so ;;
7670                         esac
7671                         ;;
7672                 esac
7673                 ;;
7674         *)      dflt=$libperl
7675                 ;;
7676         esac
7677         cat << EOM
7678
7679 I need to select a good name for the shared libperl.  If your system uses
7680 library names with major and minor numbers, then you might want something
7681 like $majmin.  Alternatively, if your system uses a single version
7682 number for shared libraries, then you might want to use $majonly.
7683 Or, your system might be quite happy with a simple libperl.$so.
7684
7685 Since the shared libperl will get installed into a version-specific
7686 architecture-dependent directory, the version number of the shared perl
7687 library probably isn't important, so the default should be o.k.
7688
7689 EOM
7690         rp='What name do you want to give to the shared libperl?'
7691         . ./myread
7692         libperl=$ans
7693         echo "Ok, I'll use $libperl"
7694         ;;
7695 *)
7696         libperl="libperl${_a}"
7697         ;;
7698 esac
7699
7700 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7701 case "$shrpdir" in
7702 '') ;;
7703 *)      $cat >&4 <<EOM
7704 WARNING:  Use of the shrpdir variable for the installation location of
7705 the shared $libperl is not supported.  It was never documented and
7706 will not work in this version.  Let me (perlbug@perl.org)
7707 know of any problems this may cause.
7708
7709 EOM
7710         case "$shrpdir" in
7711         "$archlibexp/CORE")
7712                 $cat >&4 <<EOM
7713 But your current setting of $shrpdir is
7714 the default anyway, so it's harmless.
7715 EOM
7716                 ;;
7717         *)
7718                 $cat >&4 <<EOM
7719 Further, your current attempted setting of $shrpdir
7720 conflicts with the value of $archlibexp/CORE
7721 that installperl will use.
7722 EOM
7723                 ;;
7724         esac
7725         ;;
7726 esac
7727
7728 # How will the perl executable find the installed shared $libperl?
7729 # Add $xxx to ccdlflags.
7730 # If we can't figure out a command-line option, use $shrpenv to
7731 # set env LD_RUN_PATH.  The main perl makefile uses this.
7732 shrpdir=$archlibexp/CORE
7733 xxx=''
7734 tmp_shrpenv=''
7735 if "$useshrplib"; then
7736     case "$osname" in 
7737         aix)
7738                 # We'll set it in Makefile.SH...
7739                 ;;
7740         solaris)
7741                 xxx="-R $shrpdir"
7742                 ;;
7743         freebsd|netbsd)
7744                 xxx="-Wl,-R$shrpdir"
7745                 ;;
7746         bsdos|linux|irix*|dec_osf)
7747                 xxx="-Wl,-rpath,$shrpdir"
7748                 ;;
7749         next)
7750                 # next doesn't like the default...
7751                 ;;
7752         beos)
7753                 # beos doesn't like the default, either.
7754                 ;;
7755         hpux*)
7756                 # hpux doesn't like the default, either.
7757                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7758                 ;;
7759         *)
7760                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7761                 ;;
7762         esac
7763         case "$xxx" in
7764         '') ;;
7765         *)      
7766                 # Only add $xxx if it isn't already in ccdlflags.
7767                 case " $ccdlflags " in
7768                 *" $xxx "*)     ;;
7769                 *)      ccdlflags="$ccdlflags $xxx"
7770                         cat <<EOM >&4
7771
7772 Adding $xxx to the flags
7773 passed to $ld so that the perl executable will find the 
7774 installed shared $libperl.
7775
7776 EOM
7777                         ;;
7778                 esac
7779                 ;;
7780         esac
7781 fi
7782 # Fix ccdlflags in AIX for building external extensions.
7783 # (For building Perl itself bare -bE:perl.exp is needed,
7784 #  Makefile.SH takes care of this.)
7785 case "$osname" in
7786 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7787 esac
7788 # Respect a hint or command-line value.
7789 case "$shrpenv" in
7790 '') shrpenv="$tmp_shrpenv" ;;
7791 esac
7792 case "$ldlibpthname" in
7793 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7794 none)   ldlibpthname='' ;;
7795 esac
7796
7797 : determine where manual pages are on this system
7798 echo " "
7799 case "$sysman" in
7800 '') 
7801         syspath='/usr/share/man/man1 /usr/man/man1'
7802         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7803         syspath="$syspath /usr/man/u_man/man1"
7804         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7805         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7806         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7807         sysman=`./loc . /usr/man/man1 $syspath`
7808         ;;
7809 esac
7810 if $test -d "$sysman"; then
7811         echo "System manual is in $sysman." >&4
7812 else
7813         echo "Could not find manual pages in source form." >&4
7814 fi
7815
7816 : determine where manual pages go
7817 set man1dir man1dir none
7818 eval $prefixit
7819 $cat <<EOM
7820
7821 $spackage has manual pages available in source form.
7822 EOM
7823 case "$nroff" in
7824 nroff)
7825         echo "However, you don't have nroff, so they're probably useless to you."
7826         case "$man1dir" in
7827         '') man1dir="none";;
7828         esac;;
7829 esac
7830 echo "If you don't want the manual sources installed, answer 'none'."
7831 case "$man1dir" in
7832 ' ') dflt=none
7833         ;;
7834 '')
7835         lookpath="$prefixexp/share/man/man1"
7836         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7837         lookpath="$lookpath $prefixexp/man/p_man/man1"
7838         lookpath="$lookpath $prefixexp/man/u_man/man1"
7839         lookpath="$lookpath $prefixexp/man/man.1"
7840         case "$sysman" in
7841         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7842         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7843         esac
7844         set dflt
7845         eval $prefixup
7846         ;;
7847 *)  dflt="$man1dir"
7848         ;;
7849 esac
7850 echo " "
7851 fn=dn+~
7852 rp="Where do the main $spackage manual pages (source) go?"
7853 . ./getfile
7854 if $test "X$man1direxp" != "X$ansexp"; then
7855         installman1dir=''
7856 fi
7857 man1dir="$ans"
7858 man1direxp="$ansexp"
7859 case "$man1dir" in
7860 '')     man1dir=' '
7861         installman1dir='';;
7862 esac
7863
7864 : Change installation prefix, if necessary.
7865 if $test X"$prefix" != X"$installprefix"; then
7866         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7867 else
7868         installman1dir="$man1direxp"
7869 fi
7870
7871 : What suffix to use on installed man pages
7872
7873 case "$man1dir" in
7874 ' ')
7875         man1ext='0'
7876         ;;
7877 *)
7878         rp="What suffix should be used for the main $spackage man pages?"
7879         case "$man1ext" in
7880         '')     case "$man1dir" in
7881                 *1)  dflt=1 ;;
7882                 *1p) dflt=1p ;;
7883                 *1pm) dflt=1pm ;;
7884                 *l) dflt=l;;
7885                 *n) dflt=n;;
7886                 *o) dflt=o;;
7887                 *p) dflt=p;;
7888                 *C) dflt=C;;
7889                 *L) dflt=L;;
7890                 *L1) dflt=L1;;
7891                 *) dflt=1;;
7892                 esac
7893                 ;;
7894         *)      dflt="$man1ext";;
7895         esac
7896         . ./myread
7897         man1ext="$ans"
7898         ;;
7899 esac
7900
7901 : see if we can have long filenames
7902 echo " "
7903 first=123456789abcdef
7904 $rm -f $first
7905 if (echo hi >$first) 2>/dev/null; then
7906         if $test -f 123456789abcde; then
7907                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
7908                 val="$undef"
7909         else
7910                 echo 'You can have filenames longer than 14 characters.'>&4
7911                 val="$define"
7912         fi
7913 else
7914         $cat <<'EOM'
7915 You can't have filenames longer than 14 chars.
7916 You can't even think about them!
7917 EOM
7918         val="$undef"
7919 fi 
7920 set d_flexfnam
7921 eval $setvar
7922 $rm -rf 123456789abcde*
7923
7924 : determine where library module manual pages go
7925 set man3dir man3dir none
7926 eval $prefixit
7927 $cat <<EOM
7928
7929 $spackage has manual pages for many of the library modules.
7930 EOM
7931
7932 case "$nroff" in
7933 nroff)
7934         $cat <<'EOM'
7935 However, you don't have nroff, so they're probably useless to you.
7936 EOM
7937         case "$man3dir" in
7938         '') man3dir="none";;
7939         esac;;
7940 esac
7941
7942 case "$d_flexfnam" in
7943 undef)
7944         $cat <<'EOM'
7945 However, your system can't handle the long file names like File::Basename.3. 
7946 EOM
7947         case "$man3dir" in
7948         '') man3dir="none";;
7949         esac;;
7950 esac
7951
7952 echo "If you don't want the manual sources installed, answer 'none'."
7953 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7954 case "$man3dir" in
7955 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7956         if $test -d "$privlib/man/man3"; then
7957                 cat <<EOM >&4
7958
7959 WARNING:  Previous versions of perl installed man3 pages into
7960 $privlib/man/man3.  This version will suggest a 
7961 new default of $dflt.  
7962 EOM
7963                 tdflt=$dflt
7964                 dflt='n'
7965                 rp='Do you wish to preserve the old behavior?(y/n)'
7966                 . ./myread
7967                 case "$ans" in
7968                 y*) dflt="$privlib/man/man3" ;;
7969                 *)  dflt=$tdflt ;;
7970                 esac
7971     fi
7972         ;;
7973 *)      dflt="$man3dir" ;;
7974 esac
7975 case "$dflt" in
7976 ' ') dflt=none ;;
7977 esac
7978 echo " "
7979 fn=dn+~
7980 rp="Where do the $package library man pages (source) go?"
7981 . ./getfile
7982 man3dir="$ans"
7983 man3direxp="$ansexp"
7984 case "$man3dir" in
7985 '')     man3dir=' '
7986         installman3dir='';;
7987 esac
7988
7989 : Change installation prefix, if necessary.
7990 if $test X"$prefix" != X"$installprefix"; then
7991         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7992 else
7993         installman3dir="$man3direxp"
7994 fi
7995
7996 : What suffix to use on installed man pages
7997 case "$man3dir" in
7998 ' ')
7999         man3ext='0'
8000         ;;
8001 *)
8002         rp="What suffix should be used for the $package library man pages?"
8003         case "$man3ext" in
8004         '')     case "$man3dir" in
8005                 *3)  dflt=3 ;;
8006                 *3p) dflt=3p ;;
8007                 *3pm) dflt=3pm ;;
8008                 *l) dflt=l;;
8009                 *n) dflt=n;;
8010                 *o) dflt=o;;
8011                 *p) dflt=p;;
8012                 *C) dflt=C;;
8013                 *L) dflt=L;;
8014                 *L3) dflt=L3;;
8015                 *) dflt=3;;
8016                 esac
8017                 ;;
8018         *)      dflt="$man3ext";;
8019         esac
8020         . ./myread
8021         man3ext="$ans"
8022         ;;
8023 esac
8024
8025 : see if we have to deal with yellow pages, now NIS.
8026 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8027         if $test -f /usr/etc/nibindd; then
8028                 echo " "
8029                 echo "I'm fairly confident you're on a NeXT."
8030                 echo " "
8031                 rp='Do you get the hosts file via NetInfo?'
8032                 dflt=y
8033                 case "$hostcat" in
8034                 nidump*) ;;
8035                 '') ;;
8036                 *) dflt=n;;
8037                 esac
8038                 . ./myread
8039                 case "$ans" in
8040                 y*) hostcat='nidump hosts .';;
8041                 *)      case "$hostcat" in
8042                         nidump*) hostcat='';;
8043                         esac
8044                         ;;
8045                 esac
8046         fi
8047         case "$hostcat" in
8048         nidump*) ;;
8049         *)
8050                 case "$hostcat" in
8051                 *ypcat*) dflt=y;;
8052                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8053                                 dflt=y
8054                         else
8055                                 dflt=n
8056                         fi;;
8057                 *) dflt=n;;
8058                 esac
8059                 echo " "
8060                 rp='Are you getting the hosts file via yellow pages?'
8061                 . ./myread
8062                 case "$ans" in
8063                 y*) hostcat='ypcat hosts';;
8064                 *) hostcat='cat /etc/hosts';;
8065                 esac
8066                 ;;
8067         esac
8068 fi
8069 case "$hostcat" in
8070 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8071 esac
8072 case "$groupcat" in
8073 '') test -f /etc/group && groupcat='cat /etc/group';;
8074 esac
8075 case "$passcat" in
8076 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8077 esac
8078
8079 : now get the host name
8080 echo " "
8081 echo "Figuring out host name..." >&4
8082 case "$myhostname" in
8083 '') cont=true
8084         echo 'Maybe "hostname" will work...'
8085         if tans=`sh -c hostname 2>&1` ; then
8086                 myhostname=$tans
8087                 phostname=hostname
8088                 cont=''
8089         fi
8090         ;;
8091 *) cont='';;
8092 esac
8093 if $test "$cont"; then
8094         if ./xenix; then
8095                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8096                 if tans=`cat /etc/systemid 2>&1` ; then
8097                         myhostname=$tans
8098                         phostname='cat /etc/systemid'
8099                         echo "Whadyaknow.  Xenix always was a bit strange..."
8100                         cont=''
8101                 fi
8102         elif $test -r /etc/systemid; then
8103                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8104         fi
8105 fi
8106 if $test "$cont"; then
8107         echo 'No, maybe "uuname -l" will work...'
8108         if tans=`sh -c 'uuname -l' 2>&1` ; then
8109                 myhostname=$tans
8110                 phostname='uuname -l'
8111         else
8112                 echo 'Strange.  Maybe "uname -n" will work...'
8113                 if tans=`sh -c 'uname -n' 2>&1` ; then
8114                         myhostname=$tans
8115                         phostname='uname -n'
8116                 else
8117                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8118                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8119                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8120                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8121                         else
8122                                 case "$myhostname" in
8123                                 '') echo "Does this machine have an identity crisis or something?"
8124                                         phostname='';;
8125                                 *)
8126                                         echo "Well, you said $myhostname before..."
8127                                         phostname='echo $myhostname';;
8128                                 esac
8129                         fi
8130                 fi
8131         fi
8132 fi
8133 case "$myhostname" in
8134 '') myhostname=noname ;;
8135 esac
8136 : you do not want to know about this
8137 set $myhostname
8138 myhostname=$1
8139
8140 : verify guess
8141 if $test "$myhostname" ; then
8142         dflt=y
8143         rp='Your host name appears to be "'$myhostname'".'" Right?"
8144         . ./myread
8145         case "$ans" in
8146         y*) ;;
8147         *) myhostname='';;
8148         esac
8149 fi
8150
8151 : bad guess or no guess
8152 while $test "X$myhostname" = X ; do
8153         dflt=''
8154         rp="Please type the (one word) name of your host:"
8155         . ./myread
8156         myhostname="$ans"
8157 done
8158
8159 : translate upper to lower if necessary
8160 case "$myhostname" in
8161 *[A-Z]*)
8162         echo "(Normalizing case in your host name)"
8163         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8164         ;;
8165 esac
8166
8167 case "$myhostname" in
8168 *.*)
8169         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8170         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8171         echo "(Trimming domain name from host name--host name is now $myhostname)"
8172         ;;
8173 *) case "$mydomain" in
8174         '')
8175                 {
8176                         test "X$hostcat" = "Xypcat hosts" &&
8177                         ypmatch "$myhostname" hosts 2>/dev/null |\
8178                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8179                         $test -s hosts
8180                 } || {
8181                         test "X$hostcat" != "X" &&
8182                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8183                                         /[       ]$myhostname[  . ]/p" > hosts
8184                 }
8185                 tmp_re="[       . ]"
8186                 if $test -f hosts; then
8187                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8188                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8189                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8190                                 hosts | $sort | $uniq | \
8191                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8192                         case `$echo X$dflt` in
8193                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8194                                 dflt=.
8195                                 ;;
8196                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8197                                 ;;
8198                         esac
8199                 else
8200                         echo "(I cannot locate a hosts database anywhere)"
8201                         dflt=.
8202                 fi
8203                 case "$dflt" in
8204                 .)
8205                         tans=`./loc resolv.conf X /etc /usr/etc`
8206                         if $test -f "$tans"; then
8207                                 echo "(Attempting domain name extraction from $tans)"
8208                                 dflt=.`$sed -n -e 's/   / /g' \
8209                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8210                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8211                                 case "$dflt" in
8212                                 .) dflt=.`$sed -n -e 's/        / /g' \
8213                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8214                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8215                                         ;;
8216                                 esac
8217                         fi
8218                         ;;
8219                 esac
8220                 case "$dflt" in
8221                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8222                         dflt=.`sh -c domainname 2>/dev/null`
8223                         case "$dflt" in
8224                         '') dflt='.';;
8225                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8226                         esac
8227                         ;;
8228                 esac
8229                 case "$dflt$osname" in
8230                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8231                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8232                         ;;
8233                 esac
8234                 case "$dflt" in
8235                 .) echo "(Lost all hope -- silly guess then)"
8236                         dflt='.nonet'
8237                         ;;
8238                 esac
8239                 $rm -f hosts
8240                 ;;
8241         *) dflt="$mydomain";;
8242         esac;;
8243 esac
8244 echo " "
8245 rp="What is your domain name?"
8246 . ./myread
8247 tans="$ans"
8248 case "$ans" in
8249 '') ;;
8250 .*) ;;
8251 *) tans=".$tans";;
8252 esac
8253 mydomain="$tans"
8254
8255 : translate upper to lower if necessary
8256 case "$mydomain" in
8257 *[A-Z]*)
8258         echo "(Normalizing case in your domain name)"
8259         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8260         ;;
8261 esac
8262
8263 : a little sanity check here
8264 case "$phostname" in
8265 '') ;;
8266 *)
8267         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8268         $myhostname$mydomain|$myhostname) ;;
8269         *)
8270                 case "$phostname" in
8271                 sed*)
8272                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8273                         ;;
8274                 *)
8275                         echo "(That doesn't agree with your $phostname command, by the way.)"
8276                         ;;
8277                 esac
8278         ;;
8279         esac
8280         ;;
8281 esac
8282
8283 $cat <<EOM
8284
8285 I need to get your e-mail address in Internet format if possible, i.e.
8286 something like user@host.domain. Please answer accurately since I have
8287 no easy means to double check it. The default value provided below
8288 is most probably close to reality but may not be valid from outside
8289 your organization...
8290
8291 EOM
8292 cont=x
8293 while test "$cont"; do
8294         case "$cf_email" in
8295         '') dflt="$cf_by@$myhostname$mydomain";;
8296         *) dflt="$cf_email";;
8297         esac
8298         rp='What is your e-mail address?'
8299         . ./myread
8300         cf_email="$ans"
8301         case "$cf_email" in
8302         *@*.*) cont='' ;;
8303         *)
8304                 rp='Address does not look like an Internet one.  Use it anyway?'
8305                 case "$fastread" in
8306                 yes) dflt=y ;;
8307                 *) dflt=n ;;
8308                 esac
8309                 . ./myread
8310                 case "$ans" in
8311                 y*) cont='' ;;
8312                 *) echo " " ;;
8313                 esac
8314                 ;;
8315         esac
8316 done
8317
8318 $cat <<EOM
8319
8320 If you or somebody else will be maintaining perl at your site, please
8321 fill in the correct e-mail address here so that they may be contacted
8322 if necessary. Currently, the "perlbug" program included with perl
8323 will send mail to this address in addition to perlbug@perl.org. You may
8324 enter "none" for no administrator.
8325
8326 EOM
8327 case "$perladmin" in
8328 '') dflt="$cf_email";;
8329 *) dflt="$perladmin";;
8330 esac
8331 rp='Perl administrator e-mail address'
8332 . ./myread
8333 perladmin="$ans"
8334
8335 : determine whether to only install version-specific parts.
8336 echo " "
8337 $cat <<EOM
8338 Do you want to install only the version-specific parts of the perl
8339 distribution?  Usually you do *not* want to do this.
8340 EOM
8341 case "$versiononly" in
8342 "$define"|[Yy]*|true) dflt='y' ;;
8343 *) dflt='n';
8344 esac
8345 rp="Do you want to install only the version-specific parts of perl?"
8346 . ./myread
8347 case "$ans" in
8348 [yY]*)  val="$define";;
8349 *)      val="$undef" ;;
8350 esac
8351 set versiononly
8352 eval $setvar
8353
8354 case "$versiononly" in
8355 "$define") inc_version_list=''
8356            inc_version_list_init=0
8357            ;;
8358 esac
8359
8360 : figure out how to guarantee perl startup
8361 case "$startperl" in
8362 '')
8363         case "$sharpbang" in
8364         *!)
8365                 $cat <<EOH
8366
8367 I can use the #! construct to start perl on your system. This will
8368 make startup of perl scripts faster, but may cause problems if you
8369 want to share those scripts and perl is not in a standard place
8370 ($binexp/perl) on all your platforms. The alternative is to force
8371 a shell by starting the script with a single ':' character.
8372
8373 EOH
8374                 case "$versiononly" in
8375                 "$define")      dflt="$binexp/perl$version";;  
8376                 *)              dflt="$binexp/perl";;
8377                 esac
8378                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8379                 . ./myread
8380                 case "$ans" in
8381                 none)   startperl=": # use perl";;
8382                 *)      startperl="#!$ans"
8383                         if $test 30 -lt `echo "$ans" | wc -c`; then
8384                                 $cat >&4 <<EOM
8385
8386 WARNING:  Some systems limit the #! command to 32 characters.
8387 If you experience difficulty running Perl scripts with #!, try
8388 installing Perl in a directory with a shorter pathname.
8389
8390 EOM
8391                         fi ;;
8392                 esac
8393                 ;;
8394         *) startperl=": # use perl"
8395                 ;;
8396         esac
8397         ;;
8398 esac
8399 echo "I'll use $startperl to start perl scripts."
8400
8401 : figure best path for perl in scripts
8402 case "$perlpath" in
8403 '')
8404         case "$versiononly" in
8405         "$define")      perlpath="$binexp/perl$version";;
8406         *)              perlpath="$binexp/perl";;
8407         esac
8408         case "$startperl" in
8409         *!*) ;;
8410         *)
8411                 $cat <<EOH
8412
8413 I will use the "eval 'exec'" idiom to start Perl on your system.
8414 I can use the full path of your Perl binary for this purpose, but
8415 doing so may cause problems if you want to share those scripts and
8416 Perl is not always in a standard place ($binexp/perl).
8417
8418 EOH
8419                 dflt="$binexp/perl"
8420                 rp="What path shall I use in \"eval 'exec'\"?"
8421                 . ./myread
8422                 perlpath="$ans"
8423                 ;;
8424         esac
8425         ;;
8426 esac
8427 case "$startperl" in
8428 *!*)    ;;
8429 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8430 esac
8431
8432 : determine where public executable scripts go
8433 set scriptdir scriptdir
8434 eval $prefixit
8435 case "$scriptdir" in
8436 '')
8437         dflt="$bin"
8438         : guess some guesses
8439         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8440         $test -d /usr/share/bin     && dflt=/usr/share/bin
8441         $test -d /usr/local/script  && dflt=/usr/local/script
8442         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8443         $test -d $prefixexp/script  && dflt=$prefixexp/script
8444         set dflt
8445         eval $prefixup
8446         ;;
8447 *)  dflt="$scriptdir"
8448         ;;
8449 esac
8450 $cat <<EOM
8451  
8452 Some installations have a separate directory just for executable scripts so
8453 that they can mount it across multiple architectures but keep the scripts in
8454 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8455 Or you might just lump your scripts in with all your other executables.
8456  
8457 EOM
8458 fn=d~
8459 rp='Where do you keep publicly executable scripts?'
8460 . ./getfile
8461 if $test "X$ansexp" != "X$scriptdirexp"; then
8462         installscript=''
8463 fi
8464 scriptdir="$ans"
8465 scriptdirexp="$ansexp"
8466 : Change installation prefix, if necessary.
8467 if $test X"$prefix" != X"$installprefix"; then
8468         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8469 else
8470         installscript="$scriptdirexp"
8471 fi
8472
8473 : determine where add-on public executables go
8474 case "$sitebin" in
8475 '')     dflt=$siteprefix/bin ;;
8476 *)      dflt=$sitebin ;;
8477 esac
8478 fn=d~
8479 rp='Pathname where the add-on public executables should be installed?'
8480 . ./getfile
8481 sitebin="$ans"
8482 sitebinexp="$ansexp"
8483 : Change installation prefix, if necessary.
8484 if $test X"$prefix" != X"$installprefix"; then
8485         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8486 else
8487         installsitebin="$sitebinexp"
8488 fi
8489
8490 : define an is-a-typedef? function
8491 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8492 case "$inclist" in
8493 "") inclist="sys/types.h";;
8494 esac;
8495 eval "varval=\$$var";
8496 case "$varval" in
8497 "")
8498         $rm -f temp.c;
8499         for inc in $inclist; do
8500                 echo "#include <$inc>" >>temp.c;
8501         done;
8502         echo "#ifdef $type" >> temp.c;
8503         echo "printf(\"We have $type\");" >> temp.c;
8504         echo "#endif" >> temp.c;
8505         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8506         if $contains $type temp.E >/dev/null 2>&1; then
8507                 eval "$var=\$type";
8508         else
8509                 eval "$var=\$def";
8510         fi;
8511         $rm -f temp.?;;
8512 *) eval "$var=\$varval";;
8513 esac'
8514
8515 : define an is-a-typedef? function that prompts if the type is not available.
8516 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8517 case "$inclist" in
8518 "") inclist="sys/types.h";;
8519 esac;
8520 eval "varval=\$$var";
8521 case "$varval" in
8522 "")
8523         $rm -f temp.c;
8524         for inc in $inclist; do
8525                 echo "#include <$inc>" >>temp.c;
8526         done;
8527         echo "#ifdef $type" >> temp.c;
8528         echo "printf(\"We have $type\");" >> temp.c;
8529         echo "#endif" >> temp.c;
8530         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8531         echo " " ;
8532         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8533         if $contains $type temp.E >/dev/null 2>&1; then
8534                 echo "$type found." >&4;
8535                 eval "$var=\$type";
8536         else
8537                 echo "$type NOT found." >&4;
8538                 dflt="$def";
8539                 . ./myread ;
8540                 eval "$var=\$ans";
8541         fi;
8542         $rm -f temp.?;;
8543 *) eval "$var=\$varval";;
8544 esac'
8545
8546 : see what type lseek is declared as in the kernel
8547 rp="What is the type used for lseek's offset on this system?"
8548 set off_t lseektype long stdio.h sys/types.h
8549 eval $typedef_ask
8550
8551 echo " "
8552 echo "Checking to see how big your file offsets are..." >&4
8553 $cat >try.c <<EOCP
8554 #include <sys/types.h>
8555 #include <stdio.h>
8556 int main()
8557 {
8558     printf("%d\n", (int)sizeof($lseektype));
8559     return(0); 
8560 }
8561 EOCP
8562 set try
8563 if eval $compile_ok; then
8564         lseeksize=`$run ./try`
8565         echo "Your file offsets are $lseeksize bytes long."
8566 else
8567         dflt=$longsize
8568         echo " "
8569         echo "(I can't seem to compile the test program.  Guessing...)"
8570         rp="What is the size of your file offsets (in bytes)?"
8571         . ./myread
8572         lseeksize="$ans"
8573 fi
8574 $rm -f try.c try
8575
8576 : see what type file positions are declared as in the library
8577 rp="What is the type for file position used by fsetpos()?"
8578 set fpos_t fpostype long stdio.h sys/types.h
8579 eval $typedef_ask
8580
8581 echo " "
8582 case "$fpostype" in
8583 *_t) zzz="$fpostype"    ;;
8584 *)   zzz="fpos_t"       ;;
8585 esac
8586 echo "Checking the size of $zzz..." >&4 
8587 cat > try.c <<EOCP
8588 #include <sys/types.h>
8589 #include <stdio.h>
8590 int main() {
8591     printf("%d\n", (int)sizeof($fpostype));
8592     exit(0);
8593 }
8594 EOCP
8595 set try
8596 if eval $compile_ok; then
8597         yyy=`$run ./try`
8598         case "$yyy" in
8599         '')     fpossize=4
8600                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8601                 ;;
8602         *)      fpossize=$yyy
8603                 echo "Your $zzz is $fpossize bytes long."
8604                 ;;
8605         esac
8606 else
8607         dflt="$longsize"
8608         echo " " >&4
8609         echo "(I can't compile the test program.  Guessing...)" >&4
8610         rp="What is the size of your file positions (in bytes)?"
8611         . ./myread
8612         fpossize="$ans"
8613 fi
8614
8615
8616
8617 # Backward compatibility (uselfs is deprecated).
8618 case "$uselfs" in
8619 "$define"|true|[yY]*)
8620         cat <<EOM >&4
8621
8622 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8623 EOM
8624         uselargefiles="$define"
8625         ;;
8626 esac                          
8627
8628 case "$lseeksize:$fpossize" in
8629 8:8) cat <<EOM
8630
8631 You can have files larger than 2 gigabytes.
8632 EOM
8633    val="$define" ;;
8634 *)    case "$uselargefiles" in
8635    "$undef"|false|[nN]*) dflt='n' ;;
8636    *)   dflt='y' ;;
8637    esac
8638    cat <<EOM
8639
8640 Perl can be built to understand large files (files larger than 2 gigabytes)
8641 on some systems.  To do so, Configure can be run with -Duselargefiles.
8642
8643 If this doesn't make any sense to you, just accept the default '$dflt'.
8644 EOM
8645    rp='Try to understand large files, if available?'
8646    . ./myread
8647    case "$ans" in
8648    y|Y)         val="$define" ;;
8649    *)           val="$undef"  ;;
8650    esac
8651    ;;
8652 esac
8653 set uselargefiles
8654 eval $setvar
8655 case "$uselargefiles" in
8656 "$define")
8657 : Look for a hint-file generated 'call-back-unit'.  If the
8658 : user has specified that a large files perl is to be built,
8659 : we may need to set or change some other defaults.
8660         if $test -f uselargefiles.cbu; then
8661                 echo "Your platform has some specific hints for large file builds, using them..."
8662                 . ./uselargefiles.cbu
8663                 echo " "
8664                 echo "Rechecking to see how big your file offsets are..." >&4
8665                 $cat >try.c <<EOCP
8666 #include <sys/types.h>
8667 #include <stdio.h>
8668 int main()
8669 {
8670     printf("%d\n", (int)sizeof($lseektype));
8671     return(0); 
8672 }
8673 EOCP
8674                 set try
8675                 if eval $compile_ok; then
8676                         lseeksize=`$run ./try`
8677                         $echo "Your file offsets are now $lseeksize bytes long."
8678                 else
8679                         dflt="$lseeksize"
8680                         echo " "
8681                         echo "(I can't seem to compile the test program.  Guessing...)"
8682                         rp="What is the size of your file offsets (in bytes)?"
8683                         . ./myread
8684                         lseeksize="$ans"
8685                 fi
8686                 case "$fpostype" in
8687                 *_t) zzz="$fpostype"    ;;
8688                 *)   zzz="fpos_t"       ;;
8689                 esac
8690                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8691                 $cat > try.c <<EOCP
8692 #include <sys/types.h>
8693 #include <stdio.h>
8694 int main() {
8695     printf("%d\n", (int)sizeof($fpostype));
8696     exit(0);
8697 }
8698 EOCP
8699                 set try
8700                 if eval $compile_ok; then
8701                         yyy=`$run ./try`
8702                         dflt="$lseeksize"
8703                         case "$yyy" in
8704                         '')     echo " "
8705                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8706                                 ;;
8707                         *)      fpossize=$yyy
8708                                 echo " $fpossize bytes." >&4
8709                                 ;;
8710                         esac
8711                 else
8712                         dflt="$fpossize"
8713                         echo " "
8714                         echo "(I can't compile the test program.  Guessing...)" >&4
8715                         rp="What is the size of your file positions (in bytes)?"
8716                         . ./myread
8717                         fpossize="$ans"
8718                 fi
8719                 $rm -f try.c try
8720         fi
8721         ;;
8722 esac
8723
8724 case "$vendorprefix" in
8725 '')     d_vendorbin="$undef"
8726         vendorbin=''
8727         vendorbinexp=''
8728         ;;
8729 *)      d_vendorbin="$define"
8730         : determine where vendor-supplied executables go.
8731         case "$vendorbin" in
8732         '') dflt=$vendorprefix/bin ;;
8733         *)      dflt="$vendorbin" ;;
8734         esac
8735         fn=d~+
8736         rp='Pathname for the vendor-supplied executables directory?'
8737         . ./getfile
8738         vendorbin="$ans"
8739         vendorbinexp="$ansexp"
8740         ;;
8741 esac
8742 : Change installation prefix, if necessary.
8743 if $test X"$prefix" != X"$installprefix"; then
8744         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8745 else
8746         installvendorbin="$vendorbinexp"
8747 fi
8748
8749 : see if qgcvt exists
8750 set qgcvt d_qgcvt
8751 eval $inlibc
8752
8753 : Check how to convert floats to strings.
8754
8755 if test "X$d_Gconvert" = X; then
8756
8757 echo " "
8758 echo "Checking for an efficient way to convert floats to strings."
8759 echo " " > try.c
8760 case "$uselongdouble" in
8761 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8762 esac
8763 case "$d_longdbl" in
8764 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8765 esac
8766 case "$d_PRIgldbl" in
8767 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
8768 esac
8769 $cat >>try.c <<EOP
8770 #ifdef TRY_gconvert
8771 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8772 char *myname = "gconvert";
8773 #endif
8774 #ifdef TRY_gcvt
8775 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8776 char *myname = "gcvt";
8777 #endif
8778 #ifdef TRY_qgcvt
8779 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8780 char *myname = "qgcvt";
8781 #define DOUBLETYPE long double
8782 #endif
8783 #ifdef TRY_sprintf
8784 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8785 #ifdef HAS_PRIgldbl
8786 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8787 #else
8788 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
8789 #endif
8790 #else
8791 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8792 #endif
8793 char *myname = "sprintf";
8794 #endif
8795
8796 #ifndef DOUBLETYPE
8797 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8798 #define DOUBLETYPE long double
8799 #else
8800 #define DOUBLETYPE double
8801 #endif
8802 #endif
8803
8804 #include <stdio.h>
8805
8806 #define I_STDLIB $i_stdlib
8807 #ifdef I_STDLIB
8808 #include <stdlib.h>
8809 #endif
8810
8811 int
8812 checkit(expect, got)
8813 char *expect;
8814 char *got;
8815 {
8816     if (strcmp(expect, got)) {
8817                 printf("%s oddity:  Expected %s, got %s\n",
8818                         myname, expect, got);
8819                 exit(1);
8820         }
8821 }
8822
8823 int main()
8824
8825         char buf[64]; 
8826         buf[63] = '\0';
8827
8828         /* This must be 1st test on (which?) platform */
8829         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8830         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8831         checkit("0.1", buf);
8832
8833         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
8834         checkit("0.01", buf);
8835
8836         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
8837         checkit("0.001", buf);
8838
8839         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
8840         checkit("0.0001", buf);
8841
8842         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
8843         if (strlen(buf) > 5)
8844             checkit("9e-005", buf); /* for Microsoft ?? */
8845         else
8846             checkit("9e-05", buf);
8847
8848         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
8849         checkit("1", buf);
8850
8851         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
8852         checkit("1.1", buf);
8853
8854         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
8855         checkit("1.01", buf);
8856
8857         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
8858         checkit("1.001", buf);
8859
8860         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
8861         checkit("1.0001", buf);
8862
8863         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
8864         checkit("1.00001", buf);
8865
8866         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
8867         checkit("1.000001", buf);
8868
8869         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
8870         checkit("0", buf);
8871
8872         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
8873         checkit("-1", buf);
8874
8875         /* Some Linux gcvt's give 1.e+5 here. */
8876         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
8877         checkit("100000", buf);
8878         
8879         /* Some Linux gcvt's give -1.e+5 here. */
8880         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
8881         checkit("-100000", buf);
8882
8883         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
8884         checkit("123.456", buf);
8885
8886         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
8887         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
8888         /* 34 should be enough to scare even long double
8889          * places into using the e notation. */
8890         if (strlen(buf) > 5)
8891             checkit("1e+034", buf); /* for Microsoft */
8892         else
8893             checkit("1e+34", buf);
8894
8895         /* For Perl, if you add additional tests here, also add them to
8896          * t/base/num.t for benefit of platforms not using Configure or
8897          * overriding d_Gconvert */
8898
8899         exit(0);
8900 }
8901 EOP
8902 : first add preferred functions to our list
8903 xxx_list=""
8904 for xxx_convert in $gconvert_preference; do
8905     case $xxx_convert in
8906     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
8907     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
8908     esac 
8909 done
8910 : then add any others
8911 for xxx_convert in gconvert gcvt sprintf; do
8912     case "$xxx_list" in
8913     *$xxx_convert*) ;;
8914     *) xxx_list="$xxx_list $xxx_convert" ;;
8915     esac 
8916 done
8917
8918 case "$d_longdbl$uselongdouble" in
8919 "$define$define")
8920     : again, add prefered functions to our list first
8921     xxx_ld_list=""
8922     for xxx_convert in $gconvert_ld_preference; do
8923         case $xxx_convert in
8924         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
8925         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
8926         esac
8927     done
8928     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
8929     for xxx_convert in qgcvt sprintf $xxx_list; do
8930         case "$xxx_ld_list" in
8931         $xxx_convert*|*" $xxx_convert"*) ;;
8932         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
8933         esac
8934     done
8935     : if sprintf cannot do long doubles, move it to the end
8936     if test "$d_PRIgldbl" != "$define"; then
8937         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
8938     fi
8939     : if no qgcvt, remove it
8940     if test "$d_qgcvt" != "$define"; then
8941         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
8942     fi
8943     : use the ld_list
8944     xxx_list="$xxx_ld_list"
8945     ;;
8946 esac
8947
8948 for xxx_convert in $xxx_list; do
8949         echo "Trying $xxx_convert..."
8950         $rm -f try try$_o
8951         set try -DTRY_$xxx_convert
8952         if eval $compile; then
8953                 echo "$xxx_convert() found." >&4
8954                 if $run ./try; then
8955                         echo "I'll use $xxx_convert to convert floats into a string." >&4
8956                         break;
8957                 else
8958                         echo "...But $xxx_convert didn't work as I expected."
8959                         xxx_convert=''
8960                 fi
8961         else
8962                 echo "$xxx_convert NOT found." >&4
8963         fi
8964 done
8965
8966 if test X$xxx_convert = X; then
8967     echo "*** WHOA THERE!!! ***" >&4
8968     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
8969     xxx_convert=sprintf
8970 fi
8971
8972 case "$xxx_convert" in
8973 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
8974 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
8975 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
8976 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
8977    "$define$define$define")
8978       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
8979    "$define$define$undef")
8980       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
8981    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
8982    esac
8983    ;;  
8984 esac
8985
8986 fi
8987
8988 : see if _fwalk exists
8989 set fwalk d__fwalk
8990 eval $inlibc
8991
8992 : Initialize h_fcntl
8993 h_fcntl=false
8994
8995 : Initialize h_sysfile
8996 h_sysfile=false
8997
8998 : access call always available on UNIX
8999 set access d_access
9000 eval $inlibc
9001
9002 : locate the flags for 'access()'
9003 case "$d_access" in
9004 "$define")
9005         echo " "
9006         $cat >access.c <<'EOCP'
9007 #include <sys/types.h>
9008 #ifdef I_FCNTL
9009 #include <fcntl.h>
9010 #endif
9011 #ifdef I_SYS_FILE
9012 #include <sys/file.h>
9013 #endif
9014 #ifdef I_UNISTD
9015 #include <unistd.h>
9016 #endif
9017 int main() {
9018         exit(R_OK);
9019 }
9020 EOCP
9021         : check sys/file.h first, no particular reason here
9022         if $test `./findhdr sys/file.h` && \
9023                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9024                 h_sysfile=true;
9025                 echo "<sys/file.h> defines the *_OK access constants." >&4
9026         elif $test `./findhdr fcntl.h` && \
9027                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9028                 h_fcntl=true;
9029                 echo "<fcntl.h> defines the *_OK access constants." >&4
9030         elif $test `./findhdr unistd.h` && \
9031                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9032                 echo "<unistd.h> defines the *_OK access constants." >&4
9033         else
9034                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9035         fi
9036         ;;
9037 esac
9038 $rm -f access*
9039
9040 : see if accessx exists
9041 set accessx d_accessx
9042 eval $inlibc
9043
9044 : see if alarm exists
9045 set alarm d_alarm
9046 eval $inlibc
9047
9048 : see if POSIX threads are available
9049 set pthread.h i_pthread
9050 eval $inhdr
9051
9052 : define a fucntion to check prototypes
9053 $cat > protochk <<EOSH
9054 $startsh
9055 cc="$cc"
9056 optimize="$optimize"
9057 ccflags="$ccflags"
9058 prototype="$prototype"
9059 define="$define"
9060 rm=$rm
9061 usethreads=$usethreads
9062 i_pthread=$i_pthread
9063 pthread_h_first=$pthread_h_first
9064 EOSH
9065
9066 $cat >> protochk <<'EOSH'
9067
9068 $rm -f try.c
9069 foo="$1"
9070 shift
9071 while test $# -ge 2; do
9072         case "$1" in
9073                 $define) echo "#include <$2>" >> try.c ;;
9074                 literal) echo "$2" >> try.c ;;
9075         esac
9076     # Extra magic for the benefit of systems that need pthread.h
9077     # to be included early to correctly detect threadsafe functions.
9078     # Such functions must guarantee themselves, though, that the usethreads
9079     # and i_pthread have been defined, before calling protochk.
9080     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9081         echo "#include <pthread.h>" >> try.c
9082         pthread_h_done=yes
9083     fi
9084     shift 2
9085 done
9086 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9087 cat >> try.c <<'EOCP'
9088 #ifdef CAN_PROTOTYPE
9089 #define _(args) args
9090 #else
9091 #define _(args) ()
9092 #endif
9093 EOCP
9094 echo "$foo" >> try.c
9095 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9096 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9097 status=$?
9098 $rm -f try.[co]
9099 exit $status
9100 EOSH
9101 chmod +x protochk
9102 $eunicefix protochk
9103
9104 hasproto='varname=$1; func=$2; shift; shift;
9105 while $test $# -ge 2; do
9106         case "$1" in
9107         $define) echo "#include <$2>";;
9108         esac ;
9109     shift 2;
9110 done > try.c;
9111 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9112 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9113         echo "$func() prototype found.";
9114         val="$define";
9115 else
9116         echo "$func() prototype NOT found.";
9117         val="$undef";
9118 fi;
9119 set $varname;
9120 eval $setvar;
9121 $rm -f try.c tryout.c'
9122
9123 : see if sys/types.h has to be included
9124 set sys/types.h i_systypes
9125 eval $inhdr
9126
9127 : see if sys/select.h has to be included
9128 set sys/select.h i_sysselct
9129 eval $inhdr
9130
9131 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9132 while $test $# -ge 2; do
9133         case "$1" in
9134         $define) echo "#include <$2>";;
9135         esac ;
9136     shift 2;
9137 done > try.c;
9138 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9139 set try;
9140 if eval $compile; then
9141         val="$define";
9142 else
9143         val="$undef";
9144 fi;
9145 set $varname;
9146 eval $setvar;
9147 $rm -f try.c try.o'
9148
9149 : see if we should include time.h, sys/time.h, or both
9150 echo " "
9151 if test "X$timeincl" = X; then
9152         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9153         $echo $n "I'm now running the test program...$c"
9154         $cat >try.c <<'EOCP'
9155 #include <sys/types.h>
9156 #ifdef I_TIME
9157 #include <time.h>
9158 #endif
9159 #ifdef I_SYSTIME
9160 #ifdef SYSTIMEKERNEL
9161 #define KERNEL
9162 #endif
9163 #include <sys/time.h>
9164 #endif
9165 #ifdef I_SYSSELECT
9166 #include <sys/select.h>
9167 #endif
9168 int main()
9169 {
9170         struct tm foo;
9171 #ifdef S_TIMEVAL
9172         struct timeval bar;
9173 #endif
9174 #ifdef S_TIMEZONE
9175         struct timezone tzp;
9176 #endif
9177         if (foo.tm_sec == foo.tm_sec)
9178                 exit(0);
9179 #ifdef S_TIMEVAL
9180         if (bar.tv_sec == bar.tv_sec)
9181                 exit(0);
9182 #endif
9183         exit(1);
9184 }
9185 EOCP
9186         flags=''
9187         for s_timezone in '-DS_TIMEZONE' ''; do
9188         sysselect=''
9189         for s_timeval in '-DS_TIMEVAL' ''; do
9190         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9191         for i_time in '' '-DI_TIME'; do
9192         for i_systime in '-DI_SYSTIME' ''; do
9193                 case "$flags" in
9194                 '') $echo $n ".$c"
9195                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9196                         if eval $compile; then
9197                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9198                                 shift
9199                                 flags="$*"
9200                                 echo " "
9201                                 $echo $n "Succeeded with $flags$c"
9202                         fi
9203                         ;;
9204                 esac
9205         done
9206         done
9207         done
9208         done
9209         done
9210         timeincl=''
9211         echo " "
9212         case "$flags" in
9213         *SYSTIMEKERNEL*) i_systimek="$define"
9214                 timeincl=`./findhdr sys/time.h`
9215                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9216         *) i_systimek="$undef";;
9217         esac
9218         case "$flags" in
9219         *I_TIME*) i_time="$define"
9220                 timeincl=`./findhdr time.h`" $timeincl"
9221                 echo "We'll include <time.h>." >&4;;
9222         *) i_time="$undef";;
9223         esac
9224         case "$flags" in
9225         *I_SYSTIME*) i_systime="$define"
9226                 timeincl=`./findhdr sys/time.h`" $timeincl"
9227                 echo "We'll include <sys/time.h>." >&4;;
9228         *) i_systime="$undef";;
9229         esac
9230         $rm -f try.c try
9231 fi
9232 : see if struct tm knows about tm_zone
9233 case "$i_systime$i_time" in
9234 *$define*) 
9235         echo " "
9236         echo "Checking to see if your struct tm has tm_zone field..." >&4
9237         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9238         eval $hasfield
9239         ;;
9240 *)      val="$undef"
9241         set d_tm_tm_zone
9242         eval $setvar
9243         ;;
9244 esac
9245 case "$d_tm_tm_zone" in
9246 "$define")      echo "Yes, it does."   ;;
9247 *)              echo "No, it doesn't." ;;
9248 esac
9249 : see if struct tm knows about tm_gmtoff
9250 case "$i_systime$i_time" in
9251 *$define*) 
9252         echo " "
9253         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9254         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9255         eval $hasfield
9256         ;;
9257 *)      val="$undef"
9258         set d_tm_tm_gmtoff
9259         eval $setvar
9260         ;;
9261 esac
9262 case "$d_tm_tm_gmtoff" in
9263 "$define")      echo "Yes, it does."   ;;
9264 *)              echo "No, it doesn't." ;;
9265 esac
9266
9267 : see if asctime_r exists
9268 set asctime_r d_asctime_r
9269 eval $inlibc
9270 case "$d_asctime_r" in
9271 "$define")
9272         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9273         case "$d_asctime_r_proto:$usethreads" in
9274         ":define")      d_asctime_r_proto=define
9275                 set d_asctime_r_proto asctime_r $hdrs
9276                 eval $hasproto ;;
9277         *)      ;;
9278         esac
9279         case "$d_asctime_r_proto" in
9280         define)
9281         case "$asctime_r_proto" in
9282         ''|0) try='char* asctime_r(const struct tm*, char*);'
9283         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9284         esac
9285         case "$asctime_r_proto" in
9286         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9287         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9288         esac
9289         case "$asctime_r_proto" in
9290         ''|0) try='int asctime_r(const struct tm*, char*);'
9291         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9292         esac
9293         case "$asctime_r_proto" in
9294         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9295         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9296         esac
9297         case "$asctime_r_proto" in
9298         ''|0)   d_asctime_r=undef
9299                 asctime_r_proto=0
9300                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9301         * )     case "$asctime_r_proto" in
9302                 REENTRANT_PROTO*) ;;
9303                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9304                 esac
9305                 echo "Prototype: $try" ;;
9306         esac
9307         ;;
9308         *)      case "$usethreads" in
9309                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9310                 esac
9311                 d_asctime_r=undef
9312                 asctime_r_proto=0
9313                 ;;
9314         esac
9315         ;;
9316 *)      asctime_r_proto=0
9317         ;;
9318 esac
9319
9320 : see if atolf exists
9321 set atolf d_atolf
9322 eval $inlibc
9323
9324 : see if atoll exists
9325 set atoll d_atoll
9326 eval $inlibc
9327
9328 : Look for GNU-cc style attribute checking
9329 echo " "
9330 echo "Checking whether your compiler can handle __attribute__ ..." >&4
9331 $cat >attrib.c <<'EOCP'
9332 #include <stdio.h>
9333 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
9334 EOCP
9335 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9336         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9337                 echo "Your C compiler doesn't fully support __attribute__."
9338                 val="$undef"
9339         else
9340                 echo "Your C compiler supports __attribute__."
9341                 val="$define"
9342         fi
9343 else
9344         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9345         val="$undef"
9346 fi
9347 set d_attribut
9348 eval $setvar
9349 $rm -f attrib*
9350
9351 : see if bcmp exists
9352 set bcmp d_bcmp
9353 eval $inlibc
9354
9355 : see if bcopy exists
9356 set bcopy d_bcopy
9357 eval $inlibc
9358
9359 : see if this is a unistd.h system
9360 set unistd.h i_unistd
9361 eval $inhdr
9362
9363 : see if getpgrp exists
9364 set getpgrp d_getpgrp
9365 eval $inlibc
9366
9367 case "$d_getpgrp" in
9368 "$define")
9369         echo " "
9370         echo "Checking to see which flavor of getpgrp is in use..."
9371         $cat >try.c <<EOP
9372 #$i_unistd I_UNISTD
9373 #include <sys/types.h>
9374 #ifdef I_UNISTD
9375 #  include <unistd.h>
9376 #endif
9377 int main()
9378 {
9379         if (getuid() == 0) {
9380                 printf("(I see you are running Configure as super-user...)\n");
9381                 setuid(1);
9382         }
9383 #ifdef TRY_BSD_PGRP
9384         if (getpgrp(1) == 0)
9385                 exit(0);
9386 #else
9387         if (getpgrp() > 0)
9388                 exit(0);
9389 #endif
9390         exit(1);
9391 }
9392 EOP
9393         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9394                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
9395                 val="$define"
9396         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9397                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
9398                 val="$undef"
9399         else
9400                 echo "I can't seem to compile and run the test program."
9401                 if ./usg; then
9402                         xxx="a USG one, i.e. you use getpgrp()."
9403                 else
9404                         # SVR4 systems can appear rather BSD-ish.
9405                         case "$i_unistd" in
9406                         $undef)
9407                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
9408                                 val="$define"
9409                                 ;;
9410                         $define)
9411                                 xxx="probably a USG one, i.e. you use getpgrp()."
9412                                 val="$undef"
9413                                 ;;
9414                         esac
9415                 fi
9416                 echo "Assuming your getpgrp is $xxx" >&4
9417         fi
9418         ;;
9419 *) val="$undef";;
9420 esac
9421 set d_bsdgetpgrp
9422 eval $setvar
9423 $rm -f try try.*
9424
9425 : see if setpgrp exists
9426 set setpgrp d_setpgrp
9427 eval $inlibc
9428
9429 case "$d_setpgrp" in
9430 "$define")
9431         echo " "
9432         echo "Checking to see which flavor of setpgrp is in use..."
9433         $cat >try.c <<EOP
9434 #$i_unistd I_UNISTD
9435 #include <sys/types.h>
9436 #ifdef I_UNISTD
9437 #  include <unistd.h>
9438 #endif
9439 int main()
9440 {
9441         if (getuid() == 0) {
9442                 printf("(I see you are running Configure as super-user...)\n");
9443                 setuid(1);
9444         }
9445 #ifdef TRY_BSD_PGRP
9446         if (-1 == setpgrp(1, 1))
9447                 exit(0);
9448 #else
9449         if (setpgrp() != -1)
9450                 exit(0);
9451 #endif
9452         exit(1);
9453 }
9454 EOP
9455         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9456                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
9457                 val="$define"
9458         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9459                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
9460                 val="$undef"
9461         else
9462                 echo "(I can't seem to compile and run the test program.)"
9463                 if ./usg; then
9464                         xxx="a USG one, i.e. you use setpgrp()."
9465                 else
9466                         # SVR4 systems can appear rather BSD-ish.
9467                         case "$i_unistd" in
9468                         $undef)
9469                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
9470                                 val="$define"
9471                                 ;;
9472                         $define)
9473                                 xxx="probably a USG one, i.e. you use setpgrp()."
9474                                 val="$undef"
9475                                 ;;
9476                         esac
9477                 fi
9478                 echo "Assuming your setpgrp is $xxx" >&4
9479         fi
9480         ;;
9481 *) val="$undef";;
9482 esac
9483 set d_bsdsetpgrp
9484 eval $setvar
9485 $rm -f try try.*
9486 : see if bzero exists
9487 set bzero d_bzero
9488 eval $inlibc
9489
9490 : see if signal is declared as pointer to function returning int or void
9491 echo " "
9492 xxx=`./findhdr signal.h`
9493 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
9494 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
9495         echo "You have int (*signal())() instead of void." >&4
9496         val="$undef"
9497 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
9498         echo "You have void (*signal())()." >&4
9499         val="$define"
9500 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
9501         echo "You have int (*signal())() instead of void." >&4
9502         val="$undef"
9503 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
9504         echo "You have void (*signal())()." >&4
9505         val="$define"
9506 else
9507         case "$d_voidsig" in
9508         '')
9509         echo "I can't determine whether signal handler returns void or int..." >&4
9510                 dflt=void
9511                 rp="What type does your signal handler return?"
9512                 . ./myread
9513                 case "$ans" in
9514                 v*) val="$define";;
9515                 *) val="$undef";;
9516                 esac;;
9517         "$define")
9518                 echo "As you already told me, signal handler returns void." >&4
9519                 val="$define"
9520                 ;;
9521         *)      echo "As you already told me, signal handler returns int." >&4
9522                 val="$undef"
9523                 ;;
9524         esac
9525 fi
9526 set d_voidsig
9527 eval $setvar
9528 case "$d_voidsig" in
9529 "$define") signal_t="void";;
9530 *) signal_t="int";;
9531 esac
9532 $rm -f $$.tmp
9533
9534 : check for ability to cast large floats to 32-bit ints.
9535 echo " "
9536 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
9537 if $test "$intsize" -ge 4; then
9538         xxx=int
9539 else
9540         xxx=long
9541 fi
9542 $cat >try.c <<EOCP
9543 #include <stdio.h>
9544 #include <sys/types.h>
9545 #include <signal.h>
9546 $signal_t blech(s) int s; { exit(3); }
9547 int main()
9548 {
9549         $xxx i32;
9550         double f, g;
9551         int result = 0;
9552         char str[16];
9553         signal(SIGFPE, blech);
9554
9555         /* Don't let compiler optimize the test away.  Store the number 
9556            in a writable string for gcc to pass to sscanf under HP/UX.
9557         */
9558         sprintf(str, "2147483647");
9559         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
9560         g = 10 * f;
9561         i32  = ($xxx) g;
9562
9563         /* x86 processors will probably give 0x8000 0000, which is a
9564        sign change.  We don't want that.  We want to mimic SPARC
9565            behavior here, which is to preserve the sign and give
9566            back 0x7fff ffff.
9567         */
9568         if (i32 != ($xxx) f)
9569                 result |= 1;
9570         exit(result);
9571 }
9572 EOCP
9573 set try
9574 if eval $compile_ok; then
9575         $run ./try
9576         yyy=$?
9577 else
9578         echo "(I can't seem to compile the test program--assuming it can't)"
9579         yyy=1
9580 fi
9581 case "$yyy" in
9582 0)      val="$define"
9583         echo "Yup, it can."
9584         ;;
9585 *)      val="$undef"
9586         echo "Nope, it can't."
9587         ;;
9588 esac
9589 set d_casti32
9590 eval $setvar
9591 $rm -f try try.*
9592
9593 : check for ability to cast negative floats to unsigned
9594 echo " "
9595 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
9596 $cat >try.c <<EOCP
9597 #include <stdio.h>
9598 #include <sys/types.h>
9599 #include <signal.h>
9600 $signal_t blech(s) int s; { exit(7); }
9601 $signal_t blech_in_list(s) int s; { exit(4); }
9602 unsigned long dummy_long(p) unsigned long p; { return p; }
9603 unsigned int dummy_int(p) unsigned int p; { return p; }
9604 unsigned short dummy_short(p) unsigned short p; { return p; }
9605 int main()
9606 {
9607         double f;
9608         unsigned long along;
9609         unsigned int aint;
9610         unsigned short ashort;
9611         int result = 0;
9612         char str[16];
9613         
9614         /* Frustrate gcc-2.7.2's optimizer which failed this test with
9615            a direct f = -123. assignment.  gcc-2.8.0 reportedly
9616            optimized the whole file away
9617         */
9618         /* Store the number in a writable string for gcc to pass to 
9619            sscanf under HP/UX.
9620         */
9621         sprintf(str, "-123");
9622         sscanf(str, "%lf", &f);  /* f = -123.; */
9623
9624         signal(SIGFPE, blech);
9625         along = (unsigned long)f;
9626         aint = (unsigned int)f;
9627         ashort = (unsigned short)f;
9628         if (along != (unsigned long)-123)
9629                 result |= 1;
9630         if (aint != (unsigned int)-123)
9631                 result |= 1;
9632         if (ashort != (unsigned short)-123)
9633                 result |= 1;
9634         sprintf(str, "1073741824.");
9635         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
9636         f = f + f;
9637         along = 0;
9638         along = (unsigned long)f;
9639         if (along != 0x80000000)
9640                 result |= 2;
9641         f -= 1.;
9642         along = 0;
9643         along = (unsigned long)f;
9644         if (along != 0x7fffffff)
9645                 result |= 1;
9646         f += 2.;
9647         along = 0;
9648         along = (unsigned long)f;
9649         if (along != 0x80000001)
9650                 result |= 2;
9651         if (result)
9652                 exit(result);
9653         signal(SIGFPE, blech_in_list);
9654         sprintf(str, "123.");
9655         sscanf(str, "%lf", &f);  /* f = 123.; */
9656         along = dummy_long((unsigned long)f);
9657         aint = dummy_int((unsigned int)f);
9658         ashort = dummy_short((unsigned short)f);
9659         if (along != (unsigned long)123)
9660                 result |= 4;
9661         if (aint != (unsigned int)123)
9662                 result |= 4;
9663         if (ashort != (unsigned short)123)
9664                 result |= 4;
9665         exit(result);
9666
9667 }
9668 EOCP
9669 set try
9670 if eval $compile_ok; then
9671         $run ./try
9672         castflags=$?
9673 else
9674         echo "(I can't seem to compile the test program--assuming it can't)"
9675         castflags=7
9676 fi
9677 case "$castflags" in
9678 0)      val="$define"
9679         echo "Yup, it can."
9680         ;;
9681 *)      val="$undef"
9682         echo "Nope, it can't."
9683         ;;
9684 esac
9685 set d_castneg
9686 eval $setvar
9687 $rm -f try.*
9688
9689 : see if vprintf exists
9690 echo " "
9691 if set vprintf val -f d_vprintf; eval $csym; $val; then
9692         echo 'vprintf() found.' >&4
9693         val="$define"
9694         $cat >try.c <<'EOF'
9695 #include <varargs.h>
9696
9697 int main() { xxx("foo"); }
9698
9699 xxx(va_alist)
9700 va_dcl
9701 {
9702         va_list args;
9703         char buf[10];
9704
9705         va_start(args);
9706         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
9707 }
9708 EOF
9709         set try
9710         if eval $compile && $run ./try; then
9711                 echo "Your vsprintf() returns (int)." >&4
9712                 val2="$undef"
9713         else
9714                 echo "Your vsprintf() returns (char*)." >&4
9715                 val2="$define"
9716         fi
9717 else
9718         echo 'vprintf() NOT found.' >&4
9719                 val="$undef"
9720                 val2="$undef"
9721 fi
9722 $rm -f try try.*
9723 set d_vprintf
9724 eval $setvar
9725 val=$val2
9726 set d_charvspr
9727 eval $setvar
9728
9729 : see if chown exists
9730 set chown d_chown
9731 eval $inlibc
9732
9733 : see if chroot exists
9734 set chroot d_chroot
9735 eval $inlibc
9736
9737 : see if chsize exists
9738 set chsize d_chsize
9739 eval $inlibc
9740
9741 : see if class exists
9742 set class d_class
9743 eval $inlibc
9744
9745 hasstruct='varname=$1; struct=$2; shift; shift;
9746 while $test $# -ge 2; do
9747         case "$1" in
9748         $define) echo "#include <$2>";;
9749         esac ;
9750     shift 2;
9751 done > try.c;
9752 echo "int main () { struct $struct foo; }" >> try.c;
9753 set try;
9754 if eval $compile; then
9755         val="$define";
9756 else
9757         val="$undef";
9758 fi;
9759 set $varname;
9760 eval $setvar;
9761 $rm -f try.c try.o'
9762
9763 socketlib=''
9764 sockethdr=''
9765 : see whether socket exists
9766 echo " "
9767 $echo $n "Hmm... $c" >&4
9768 if set socket val -f d_socket; eval $csym; $val; then
9769         echo "Looks like you have Berkeley networking support." >&4
9770         d_socket="$define"
9771         if set setsockopt val -f; eval $csym; $val; then
9772                 d_oldsock="$undef"
9773         else
9774                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9775                 d_oldsock="$define"
9776         fi
9777 else
9778         if $contains socklib libc.list >/dev/null 2>&1; then
9779                 echo "Looks like you have Berkeley networking support." >&4
9780                 d_socket="$define"
9781                 : we will have to assume that it supports the 4.2 BSD interface
9782                 d_oldsock="$undef"
9783         else
9784                 echo "You don't have Berkeley networking in libc$_a..." >&4
9785                 if test "X$d_socket" = "X$define"; then
9786                    echo "...but you seem to believe that you have sockets." >&4
9787                 else
9788                         for net in net socket
9789                         do
9790                                 if test -f /usr/lib/lib$net$_a; then
9791                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9792                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9793                                         if $contains socket libc.list >/dev/null 2>&1; then
9794                                                 d_socket="$define"
9795                                                 socketlib="-l$net"
9796                                                 case "$net" in
9797                                                 net)
9798                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9799                                                         sockethdr="-I/usr/netinclude"
9800                                                         ;;
9801                                                 esac
9802                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
9803                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9804                                                         d_oldsock="$undef"
9805                                                 else
9806                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9807                                                         d_oldsock="$define"
9808                                                 fi
9809                                                 break
9810                                         fi
9811                                 fi
9812                         done
9813                         if test "X$d_socket" != "X$define"; then
9814                            echo "or anywhere else I see." >&4
9815                            d_socket="$undef"
9816                            d_oldsock="$undef"
9817                         fi
9818                 fi
9819         fi
9820 fi
9821
9822 : see if socketpair exists
9823 set socketpair d_sockpair
9824 eval $inlibc
9825
9826
9827 echo " "
9828 echo "Checking the availability of certain socket constants..." >&4
9829 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9830         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9831         $cat >try.c <<EOF
9832 #include <sys/types.h>
9833 #include <sys/socket.h>
9834 int main() {
9835     int i = $ENUM;
9836 }
9837 EOF
9838         val="$undef"
9839         set try; if eval $compile; then
9840                 val="$define"
9841         fi
9842         set d_${enum}; eval $setvar
9843         $rm -f try.c try
9844 done
9845
9846 : see if this is a sys/uio.h system
9847 set sys/uio.h i_sysuio
9848 eval $inhdr
9849
9850
9851 echo " "
9852 echo "Checking to see if your system supports struct cmsghdr..." >&4
9853 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
9854 eval $hasstruct
9855 case "$d_cmsghdr_s" in
9856 "$define")      echo "Yes, it does."   ;;
9857 *)              echo "No, it doesn't." ;;
9858 esac
9859
9860
9861 : check for const keyword
9862 echo " "
9863 echo 'Checking to see if your C compiler knows about "const"...' >&4
9864 $cat >const.c <<'EOCP'
9865 typedef struct spug { int drokk; } spug;
9866 int main()
9867 {
9868         const char *foo;
9869         const spug y;
9870 }
9871 EOCP
9872 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
9873         val="$define"
9874         echo "Yup, it does."
9875 else
9876         val="$undef"
9877         echo "Nope, it doesn't."
9878 fi
9879 set d_const
9880 eval $setvar
9881
9882 : see if crypt exists
9883 echo " "
9884 set crypt d_crypt
9885 eval $inlibc
9886 case "$d_crypt" in
9887 $define) cryptlib='' ;;
9888 *)      if set crypt val -f d_crypt; eval $csym; $val; then
9889                 echo 'crypt() found.' >&4
9890                 val="$define"
9891                 cryptlib=''
9892         else
9893                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
9894                 if $test -z "$cryptlib"; then
9895                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
9896                 else
9897                         cryptlib=-lcrypt
9898                 fi
9899                 if $test -z "$cryptlib"; then
9900                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
9901                 else
9902                         cryptlib=-lcrypt
9903                 fi
9904                 if $test -z "$cryptlib"; then
9905                         cryptlib=`./loc libcrypt$_a "" $libpth`
9906                 else
9907                         cryptlib=-lcrypt
9908                 fi
9909                 if $test -z "$cryptlib"; then
9910                         echo 'crypt() NOT found.' >&4
9911                         val="$undef"
9912                 else
9913                         val="$define"
9914                 fi
9915         fi
9916         set d_crypt
9917         eval $setvar
9918         ;;
9919 esac
9920
9921 : see if this is a crypt.h system
9922 set crypt.h i_crypt
9923 eval $inhdr
9924
9925 : see if crypt_r exists
9926 set crypt_r d_crypt_r
9927 eval $inlibc
9928 case "$d_crypt_r" in
9929 "$define")
9930         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
9931         case "$d_crypt_r_proto:$usethreads" in
9932         ":define")      d_crypt_r_proto=define
9933                 set d_crypt_r_proto crypt_r $hdrs
9934                 eval $hasproto ;;
9935         *)      ;;
9936         esac
9937         case "$d_crypt_r_proto" in
9938         define)
9939         case "$crypt_r_proto" in
9940         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
9941         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
9942         esac
9943         case "$crypt_r_proto" in
9944         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
9945         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
9946         esac
9947         case "$crypt_r_proto" in
9948         ''|0)   d_crypt_r=undef
9949                 crypt_r_proto=0
9950                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
9951         * )     case "$crypt_r_proto" in
9952                 REENTRANT_PROTO*) ;;
9953                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
9954                 esac
9955                 echo "Prototype: $try" ;;
9956         esac
9957         ;;
9958         *)      case "$usethreads" in
9959                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
9960                 esac
9961                 d_crypt_r=undef
9962                 crypt_r_proto=0
9963                 ;;
9964         esac
9965         ;;
9966 *)      crypt_r_proto=0
9967         ;;
9968 esac
9969
9970 : get csh whereabouts
9971 case "$csh" in
9972 'csh') val="$undef" ;;
9973 *) val="$define" ;;
9974 esac
9975 set d_csh
9976 eval $setvar
9977 : Respect a hint or command line value for full_csh.
9978 case "$full_csh" in
9979 '') full_csh=$csh ;;
9980 esac
9981
9982 : see if ctermid_r exists
9983 set ctermid_r d_ctermid_r
9984 eval $inlibc
9985 case "$d_ctermid_r" in
9986 "$define")
9987         hdrs="$i_systypes sys/types.h define stdio.h "
9988         case "$d_ctermid_r_proto:$usethreads" in
9989         ":define")      d_ctermid_r_proto=define
9990                 set d_ctermid_r_proto ctermid_r $hdrs
9991                 eval $hasproto ;;
9992         *)      ;;
9993         esac
9994         case "$d_ctermid_r_proto" in
9995         define)
9996         case "$ctermid_r_proto" in
9997         ''|0) try='char* ctermid_r(char*);'
9998         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
9999         esac
10000         case "$ctermid_r_proto" in
10001         ''|0)   d_ctermid_r=undef
10002                 ctermid_r_proto=0
10003                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10004         * )     case "$ctermid_r_proto" in
10005                 REENTRANT_PROTO*) ;;
10006                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10007                 esac
10008                 echo "Prototype: $try" ;;
10009         esac
10010         ;;
10011         *)      case "$usethreads" in
10012                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10013                 esac
10014                 d_ctermid_r=undef
10015                 ctermid_r_proto=0
10016                 ;;
10017         esac
10018         ;;
10019 *)      ctermid_r_proto=0
10020         ;;
10021 esac
10022
10023 : see if ctime_r exists
10024 set ctime_r d_ctime_r
10025 eval $inlibc
10026 case "$d_ctime_r" in
10027 "$define")
10028         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10029         case "$d_ctime_r_proto:$usethreads" in
10030         ":define")      d_ctime_r_proto=define
10031                 set d_ctime_r_proto ctime_r $hdrs
10032                 eval $hasproto ;;
10033         *)      ;;
10034         esac
10035         case "$d_ctime_r_proto" in
10036         define)
10037         case "$ctime_r_proto" in
10038         ''|0) try='char* ctime_r(const time_t*, char*);'
10039         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10040         esac
10041         case "$ctime_r_proto" in
10042         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10043         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10044         esac
10045         case "$ctime_r_proto" in
10046         ''|0) try='int ctime_r(const time_t*, char*);'
10047         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10048         esac
10049         case "$ctime_r_proto" in
10050         ''|0) try='int ctime_r(const time_t*, char*, int);'
10051         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10052         esac
10053         case "$ctime_r_proto" in
10054         ''|0)   d_ctime_r=undef
10055                 ctime_r_proto=0
10056                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10057         * )     case "$ctime_r_proto" in
10058                 REENTRANT_PROTO*) ;;
10059                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10060                 esac
10061                 echo "Prototype: $try" ;;
10062         esac
10063         ;;
10064         *)      case "$usethreads" in
10065                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10066                 esac
10067                 d_ctime_r=undef
10068                 ctime_r_proto=0
10069                 ;;
10070         esac
10071         ;;
10072 *)      ctime_r_proto=0
10073         ;;
10074 esac
10075
10076 : see if cuserid exists
10077 set cuserid d_cuserid
10078 eval $inlibc
10079
10080 : see if this is a limits.h system
10081 set limits.h i_limits
10082 eval $inhdr
10083
10084 : see if this is a float.h system
10085 set float.h i_float
10086 eval $inhdr
10087
10088 : See if number of significant digits in a double precision number is known
10089 echo " "
10090 $cat >dbl_dig.c <<EOM
10091 #$i_limits I_LIMITS
10092 #$i_float I_FLOAT
10093 #ifdef I_LIMITS
10094 #include <limits.h>
10095 #endif
10096 #ifdef I_FLOAT
10097 #include <float.h>
10098 #endif
10099 #ifdef DBL_DIG
10100 printf("Contains DBL_DIG");
10101 #endif
10102 EOM
10103 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10104 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10105         echo "DBL_DIG found." >&4
10106         val="$define"
10107 else
10108         echo "DBL_DIG NOT found." >&4
10109         val="$undef"
10110 fi
10111 $rm -f dbl_dig.?
10112 set d_dbl_dig
10113 eval $setvar
10114
10115 : see if dbm.h is available
10116 : see if dbmclose exists
10117 set dbmclose d_dbmclose
10118 eval $inlibc
10119
10120 case "$d_dbmclose" in
10121 $define)
10122         set dbm.h i_dbm
10123         eval $inhdr
10124         case "$i_dbm" in
10125         $define)
10126                 val="$undef"
10127                 set i_rpcsvcdbm
10128                 eval $setvar
10129                 ;;
10130         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10131                 eval $inhdr
10132                 ;;
10133         esac
10134         ;;
10135 *)      echo "We won't be including <dbm.h>"
10136         val="$undef"
10137         set i_dbm
10138         eval $setvar
10139         val="$undef"
10140         set i_rpcsvcdbm
10141         eval $setvar
10142         ;;
10143 esac
10144
10145 : see if prototype for dbminit is available
10146 echo " "
10147 set d_dbminitproto dbminit $i_dbm dbm.h
10148 eval $hasproto
10149
10150 : see if difftime exists
10151 set difftime d_difftime
10152 eval $inlibc
10153
10154 : see if this is a dirent system
10155 echo " "
10156 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10157         val="$define"
10158         echo "<dirent.h> found." >&4
10159 else
10160         val="$undef"
10161         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10162                 echo "<sys/dir.h> found." >&4
10163                 echo " "
10164         else
10165                 xinc=`./findhdr sys/ndir.h`
10166         fi
10167         echo "<dirent.h> NOT found." >&4
10168 fi
10169 set i_dirent
10170 eval $setvar
10171
10172 : Look for type of directory structure.
10173 echo " "
10174 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10175
10176 case "$direntrytype" in
10177 ''|' ')
10178         case "$i_dirent" in
10179         $define) guess1='struct dirent' ;;
10180         *) guess1='struct direct'  ;;
10181         esac
10182         ;;
10183 *)      guess1="$direntrytype"
10184         ;;
10185 esac
10186
10187 case "$guess1" in
10188 'struct dirent') guess2='struct direct' ;;
10189 *) guess2='struct dirent' ;;
10190 esac
10191                 
10192 if $contains "$guess1" try.c >/dev/null 2>&1; then
10193         direntrytype="$guess1"
10194         echo "Your directory entries are $direntrytype." >&4
10195 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10196         direntrytype="$guess2"
10197         echo "Your directory entries seem to be $direntrytype." >&4
10198 else
10199         echo "I don't recognize your system's directory entries." >&4
10200         rp="What type is used for directory entries on this system?"
10201         dflt="$guess1"
10202         . ./myread
10203         direntrytype="$ans"
10204 fi
10205 $rm -f try.c
10206
10207
10208 : see if the directory entry stores field length
10209 echo " "
10210 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10211 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10212         echo "Good, your directory entry keeps length information in d_namlen." >&4
10213         val="$define"
10214 else
10215         echo "Your directory entry does not know about the d_namlen field." >&4
10216         val="$undef"
10217 fi
10218 set d_dirnamlen
10219 eval $setvar
10220 $rm -f try.c
10221
10222 : see if this is an sysdir system
10223 set sys/dir.h i_sysdir
10224 eval $inhdr
10225
10226 : see if this is an sysndir system
10227 set sys/ndir.h i_sysndir
10228 eval $inhdr
10229
10230 : Look for dirfd
10231 echo " "
10232 $cat >dirfd.c <<EOM
10233 #include <stdio.h>
10234 #$i_dirent I_DIRENT             /**/
10235 #$i_sysdir I_SYS_DIR            /**/
10236 #$i_sysndir I_SYS_NDIR          /**/
10237 #$i_systypes I_SYS_TYPES        /**/
10238 #if defined(I_SYS_TYPES)
10239 #include <sys/types.h>
10240 #endif
10241 #if defined(I_DIRENT)
10242 #include <dirent.h>
10243 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10244 #include <sys/dir.h>
10245 #endif
10246 #else
10247 #ifdef I_SYS_NDIR
10248 #include <sys/ndir.h>
10249 #else
10250 #ifdef I_SYS_DIR
10251 #ifdef hp9000s500
10252 #include <ndir.h>       /* may be wrong in the future */
10253 #else
10254 #include <sys/dir.h>
10255 #endif
10256 #endif
10257 #endif
10258 #endif 
10259 int main() {
10260         DIR *dirp = opendir(".");
10261         if (dirfd(dirp) >= 0)
10262                 exit(0);
10263         else
10264                 exit(1);
10265 }
10266 EOM
10267 set dirfd
10268 if eval $compile; then
10269         val="$define"
10270 fi
10271 case "$val" in
10272 $define)        echo "dirfd() found." >&4       ;;
10273 *)              echo "dirfd() NOT found." >&4   ;;
10274 esac
10275 set d_dirfd
10276 eval $setvar
10277 $rm -f dirfd*
10278
10279 : see if dlerror exists
10280 xxx_runnm="$runnm"
10281 runnm=false
10282 set dlerror d_dlerror
10283 eval $inlibc
10284 runnm="$xxx_runnm"
10285
10286 : see if dlfcn is available
10287 set dlfcn.h i_dlfcn
10288 eval $inhdr
10289
10290 case "$usedl" in
10291 $define|y|true)
10292         $cat << EOM
10293
10294 On a few systems, the dynamically loaded modules that perl generates and uses
10295 will need a different extension than shared libs. The default will probably
10296 be appropriate.
10297
10298 EOM
10299         case "$dlext" in
10300         '')     dflt="$so" ;;
10301         *)      dflt="$dlext" ;;
10302         esac
10303         rp='What is the extension of dynamically loaded modules'
10304         . ./myread
10305         dlext="$ans"
10306         ;;
10307 *)
10308         dlext="none"
10309         ;;
10310 esac
10311
10312 : Check if dlsym need a leading underscore
10313 echo " "
10314 val="$undef"
10315
10316 case "$dlsrc" in
10317 dl_dlopen.xs)
10318         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
10319         $cat >dyna.c <<'EOM'
10320 fred () { }
10321 EOM
10322
10323 $cat >fred.c<<EOM
10324
10325 #include <stdio.h>
10326 #$i_dlfcn I_DLFCN
10327 #ifdef I_DLFCN
10328 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
10329 #else
10330 #include <sys/types.h>
10331 #include <nlist.h>
10332 #include <link.h>
10333 #endif
10334
10335 extern int fred() ;
10336
10337 int main()
10338 {
10339     void * handle ;
10340     void * symbol ;
10341 #ifndef RTLD_LAZY
10342     int mode = 1 ;
10343 #else
10344     int mode = RTLD_LAZY ;
10345 #endif
10346     handle = dlopen("./dyna.$dlext", mode) ;
10347     if (handle == NULL) {
10348         printf ("1\n") ;
10349         fflush (stdout) ;
10350         exit(0);
10351     }
10352     symbol = dlsym(handle, "fred") ;
10353     if (symbol == NULL) {
10354         /* try putting a leading underscore */
10355         symbol = dlsym(handle, "_fred") ;
10356         if (symbol == NULL) {
10357             printf ("2\n") ;
10358             fflush (stdout) ;
10359             exit(0);
10360         }
10361         printf ("3\n") ;
10362     }
10363     else
10364         printf ("4\n") ;
10365     fflush (stdout) ;
10366     exit(0);
10367 }
10368 EOM
10369         : Call the object file tmp-dyna.o in case dlext=o.
10370         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
10371                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
10372                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
10373                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
10374                 xxx=`$run ./fred`
10375                 case $xxx in
10376                 1)      echo "Test program failed using dlopen." >&4
10377                         echo "Perhaps you should not use dynamic loading." >&4;;
10378                 2)      echo "Test program failed using dlsym." >&4
10379                         echo "Perhaps you should not use dynamic loading." >&4;;
10380                 3)      echo "dlsym needs a leading underscore" >&4
10381                         val="$define" ;;
10382                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
10383                 esac
10384         else
10385                 echo "I can't compile and run the test program." >&4
10386                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
10387         fi
10388         ;;
10389 esac
10390                 
10391 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
10392
10393 set d_dlsymun
10394 eval $setvar
10395
10396 : see if drand48_r exists
10397 set drand48_r d_drand48_r
10398 eval $inlibc
10399 case "$d_drand48_r" in
10400 "$define")
10401         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
10402         case "$d_drand48_r_proto:$usethreads" in
10403         ":define")      d_drand48_r_proto=define
10404                 set d_drand48_r_proto drand48_r $hdrs
10405                 eval $hasproto ;;
10406         *)      ;;
10407         esac
10408         case "$d_drand48_r_proto" in
10409         define)
10410         case "$drand48_r_proto" in
10411         ''|0) try='int drand48_r(struct drand48_data*, double*);'
10412         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
10413         esac
10414         case "$drand48_r_proto" in
10415         ''|0)   d_drand48_r=undef
10416                 drand48_r_proto=0
10417                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10418         * )     case "$drand48_r_proto" in
10419                 REENTRANT_PROTO*) ;;
10420                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
10421                 esac
10422                 echo "Prototype: $try" ;;
10423         esac
10424         ;;
10425         *)      case "$usethreads" in
10426                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
10427                 esac
10428                 d_drand48_r=undef
10429                 drand48_r_proto=0
10430                 ;;
10431         esac
10432         ;;
10433 *)      drand48_r_proto=0
10434         ;;
10435 esac
10436
10437 : see if prototype for drand48 is available
10438 echo " "
10439 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
10440 eval $hasproto
10441
10442 : see if dup2 exists
10443 set dup2 d_dup2
10444 eval $inlibc
10445
10446 : see if eaccess exists
10447 set eaccess d_eaccess
10448 eval $inlibc
10449
10450 : see if endgrent exists
10451 set endgrent d_endgrent
10452 eval $inlibc
10453
10454 : see if this is an grp system
10455 set grp.h i_grp
10456 eval $inhdr
10457
10458 case "$i_grp" in
10459 $define)
10460         xxx=`./findhdr grp.h`
10461         $cppstdin $cppflags $cppminus < $xxx >$$.h
10462
10463         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10464                 val="$define"
10465         else
10466                 val="$undef"
10467         fi
10468         set d_grpasswd
10469         eval $setvar
10470
10471         $rm -f $$.h
10472         ;;
10473 *)
10474         val="$undef";
10475         set d_grpasswd; eval $setvar
10476         ;;
10477 esac
10478
10479 : see if endgrent_r exists
10480 set endgrent_r d_endgrent_r
10481 eval $inlibc
10482 case "$d_endgrent_r" in
10483 "$define")
10484         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
10485         case "$d_endgrent_r_proto:$usethreads" in
10486         ":define")      d_endgrent_r_proto=define
10487                 set d_endgrent_r_proto endgrent_r $hdrs
10488                 eval $hasproto ;;
10489         *)      ;;
10490         esac
10491         case "$d_endgrent_r_proto" in
10492         define)
10493         case "$endgrent_r_proto" in
10494         ''|0) try='int endgrent_r(FILE**);'
10495         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
10496         esac
10497         case "$endgrent_r_proto" in
10498         ''|0) try='void endgrent_r(FILE**);'
10499         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
10500         esac
10501         case "$endgrent_r_proto" in
10502         ''|0)   d_endgrent_r=undef
10503                 endgrent_r_proto=0
10504                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10505         * )     case "$endgrent_r_proto" in
10506                 REENTRANT_PROTO*) ;;
10507                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
10508                 esac
10509                 echo "Prototype: $try" ;;
10510         esac
10511         ;;
10512         *)      case "$usethreads" in
10513                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
10514                 esac
10515                 d_endgrent_r=undef
10516                 endgrent_r_proto=0
10517                 ;;
10518         esac
10519         ;;
10520 *)      endgrent_r_proto=0
10521         ;;
10522 esac
10523
10524 : see if endhostent exists
10525 set endhostent d_endhent
10526 eval $inlibc
10527
10528 : see if this is a netdb.h system
10529 set netdb.h i_netdb
10530 eval $inhdr
10531
10532 : see if endhostent_r exists
10533 set endhostent_r d_endhostent_r
10534 eval $inlibc
10535 case "$d_endhostent_r" in
10536 "$define")
10537         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10538         case "$d_endhostent_r_proto:$usethreads" in
10539         ":define")      d_endhostent_r_proto=define
10540                 set d_endhostent_r_proto endhostent_r $hdrs
10541                 eval $hasproto ;;
10542         *)      ;;
10543         esac
10544         case "$d_endhostent_r_proto" in
10545         define)
10546         case "$endhostent_r_proto" in
10547         ''|0) try='int endhostent_r(struct hostent_data*);'
10548         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
10549         esac
10550         case "$endhostent_r_proto" in
10551         ''|0) try='void endhostent_r(struct hostent_data*);'
10552         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
10553         esac
10554         case "$endhostent_r_proto" in
10555         ''|0)   d_endhostent_r=undef
10556                 endhostent_r_proto=0
10557                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
10558         * )     case "$endhostent_r_proto" in
10559                 REENTRANT_PROTO*) ;;
10560                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
10561                 esac
10562                 echo "Prototype: $try" ;;
10563         esac
10564         ;;
10565         *)      case "$usethreads" in
10566                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
10567                 esac
10568                 d_endhostent_r=undef
10569                 endhostent_r_proto=0
10570                 ;;
10571         esac
10572         ;;
10573 *)      endhostent_r_proto=0
10574         ;;
10575 esac
10576
10577 : see if endnetent exists
10578 set endnetent d_endnent
10579 eval $inlibc
10580
10581 : see if endnetent_r exists
10582 set endnetent_r d_endnetent_r
10583 eval $inlibc
10584 case "$d_endnetent_r" in
10585 "$define")
10586         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10587         case "$d_endnetent_r_proto:$usethreads" in
10588         ":define")      d_endnetent_r_proto=define
10589                 set d_endnetent_r_proto endnetent_r $hdrs
10590                 eval $hasproto ;;
10591         *)      ;;
10592         esac
10593         case "$d_endnetent_r_proto" in
10594         define)
10595         case "$endnetent_r_proto" in
10596         ''|0) try='int endnetent_r(struct netent_data*);'
10597         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
10598         esac
10599         case "$endnetent_r_proto" in
10600         ''|0) try='void endnetent_r(struct netent_data*);'
10601         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
10602         esac
10603         case "$endnetent_r_proto" in
10604         ''|0)   d_endnetent_r=undef
10605                 endnetent_r_proto=0
10606                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
10607         * )     case "$endnetent_r_proto" in
10608                 REENTRANT_PROTO*) ;;
10609                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
10610                 esac
10611                 echo "Prototype: $try" ;;
10612         esac
10613         ;;
10614         *)      case "$usethreads" in
10615                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
10616                 esac
10617                 d_endnetent_r=undef
10618                 endnetent_r_proto=0
10619                 ;;
10620         esac
10621         ;;
10622 *)      endnetent_r_proto=0
10623         ;;
10624 esac
10625
10626 : see if endprotoent exists
10627 set endprotoent d_endpent
10628 eval $inlibc
10629
10630 : see if endprotoent_r exists
10631 set endprotoent_r d_endprotoent_r
10632 eval $inlibc
10633 case "$d_endprotoent_r" in
10634 "$define")
10635         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10636         case "$d_endprotoent_r_proto:$usethreads" in
10637         ":define")      d_endprotoent_r_proto=define
10638                 set d_endprotoent_r_proto endprotoent_r $hdrs
10639                 eval $hasproto ;;
10640         *)      ;;
10641         esac
10642         case "$d_endprotoent_r_proto" in
10643         define)
10644         case "$endprotoent_r_proto" in
10645         ''|0) try='int endprotoent_r(struct protoent_data*);'
10646         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
10647         esac
10648         case "$endprotoent_r_proto" in
10649         ''|0) try='void endprotoent_r(struct protoent_data*);'
10650         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
10651         esac
10652         case "$endprotoent_r_proto" in
10653         ''|0)   d_endprotoent_r=undef
10654                 endprotoent_r_proto=0
10655                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
10656         * )     case "$endprotoent_r_proto" in
10657                 REENTRANT_PROTO*) ;;
10658                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
10659                 esac
10660                 echo "Prototype: $try" ;;
10661         esac
10662         ;;
10663         *)      case "$usethreads" in
10664                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
10665                 esac
10666                 d_endprotoent_r=undef
10667                 endprotoent_r_proto=0
10668                 ;;
10669         esac
10670         ;;
10671 *)      endprotoent_r_proto=0
10672         ;;
10673 esac
10674
10675 : see if endpwent exists
10676 set endpwent d_endpwent
10677 eval $inlibc
10678
10679 : see if this is a pwd.h system
10680 set pwd.h i_pwd
10681 eval $inhdr
10682
10683 case "$i_pwd" in
10684 $define)
10685         xxx=`./findhdr pwd.h`
10686         $cppstdin $cppflags $cppminus < $xxx >$$.h
10687
10688         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10689                 val="$define"
10690         else
10691                 val="$undef"
10692         fi
10693         set d_pwquota
10694         eval $setvar
10695
10696         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10697                 val="$define"
10698         else
10699                 val="$undef"
10700         fi
10701         set d_pwage
10702         eval $setvar
10703
10704         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10705                 val="$define"
10706         else
10707                 val="$undef"
10708         fi
10709         set d_pwchange
10710         eval $setvar
10711
10712         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10713                 val="$define"
10714         else
10715                 val="$undef"
10716         fi
10717         set d_pwclass
10718         eval $setvar
10719
10720         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10721                 val="$define"
10722         else
10723                 val="$undef"
10724         fi
10725         set d_pwexpire
10726         eval $setvar
10727
10728         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10729                 val="$define"
10730         else
10731                 val="$undef"
10732         fi
10733         set d_pwcomment
10734         eval $setvar
10735
10736         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10737                 val="$define"
10738         else
10739                 val="$undef"
10740         fi
10741         set d_pwgecos
10742         eval $setvar
10743
10744         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10745                 val="$define"
10746         else
10747                 val="$undef"
10748         fi
10749         set d_pwpasswd
10750         eval $setvar
10751
10752         $rm -f $$.h
10753         ;;
10754 *)
10755         val="$undef"; 
10756         set d_pwquota; eval $setvar
10757         set d_pwage; eval $setvar
10758         set d_pwchange; eval $setvar
10759         set d_pwclass; eval $setvar
10760         set d_pwexpire; eval $setvar
10761         set d_pwcomment; eval $setvar
10762         set d_pwgecos; eval $setvar
10763         set d_pwpasswd; eval $setvar
10764         ;;
10765 esac
10766
10767 : see if endpwent_r exists
10768 set endpwent_r d_endpwent_r
10769 eval $inlibc
10770 case "$d_endpwent_r" in
10771 "$define")
10772         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
10773         case "$d_endpwent_r_proto:$usethreads" in
10774         ":define")      d_endpwent_r_proto=define
10775                 set d_endpwent_r_proto endpwent_r $hdrs
10776                 eval $hasproto ;;
10777         *)      ;;
10778         esac
10779         case "$d_endpwent_r_proto" in
10780         define)
10781         case "$endpwent_r_proto" in
10782         ''|0) try='int endpwent_r(FILE**);'
10783         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
10784         esac
10785         case "$endpwent_r_proto" in
10786         ''|0) try='void endpwent_r(FILE**);'
10787         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
10788         esac
10789         case "$endpwent_r_proto" in
10790         ''|0)   d_endpwent_r=undef
10791                 endpwent_r_proto=0
10792                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
10793         * )     case "$endpwent_r_proto" in
10794                 REENTRANT_PROTO*) ;;
10795                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
10796                 esac
10797                 echo "Prototype: $try" ;;
10798         esac
10799         ;;
10800         *)      case "$usethreads" in
10801                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
10802                 esac
10803                 d_endpwent_r=undef
10804                 endpwent_r_proto=0
10805                 ;;
10806         esac
10807         ;;
10808 *)      endpwent_r_proto=0
10809         ;;
10810 esac
10811
10812 : see if endservent exists
10813 set endservent d_endsent
10814 eval $inlibc
10815
10816 : see if endservent_r exists
10817 set endservent_r d_endservent_r
10818 eval $inlibc
10819 case "$d_endservent_r" in
10820 "$define")
10821         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10822         case "$d_endservent_r_proto:$usethreads" in
10823         ":define")      d_endservent_r_proto=define
10824                 set d_endservent_r_proto endservent_r $hdrs
10825                 eval $hasproto ;;
10826         *)      ;;
10827         esac
10828         case "$d_endservent_r_proto" in
10829         define)
10830         case "$endservent_r_proto" in
10831         ''|0) try='int endservent_r(struct servent_data*);'
10832         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
10833         esac
10834         case "$endservent_r_proto" in
10835         ''|0) try='void endservent_r(struct servent_data*);'
10836         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
10837         esac
10838         case "$endservent_r_proto" in
10839         ''|0)   d_endservent_r=undef
10840                 endservent_r_proto=0
10841                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
10842         * )     case "$endservent_r_proto" in
10843                 REENTRANT_PROTO*) ;;
10844                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
10845                 esac
10846                 echo "Prototype: $try" ;;
10847         esac
10848         ;;
10849         *)      case "$usethreads" in
10850                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
10851                 esac
10852                 d_endservent_r=undef
10853                 endservent_r_proto=0
10854                 ;;
10855         esac
10856         ;;
10857 *)      endservent_r_proto=0
10858         ;;
10859 esac
10860
10861 : Locate the flags for 'open()'
10862 echo " "
10863 $cat >try.c <<'EOCP'
10864 #include <sys/types.h>
10865 #ifdef I_FCNTL
10866 #include <fcntl.h>
10867 #endif
10868 #ifdef I_SYS_FILE
10869 #include <sys/file.h>
10870 #endif
10871 int main() {
10872         if(O_RDONLY);
10873 #ifdef O_TRUNC
10874         exit(0);
10875 #else
10876         exit(1);
10877 #endif
10878 }
10879 EOCP
10880 : check sys/file.h first to get FREAD on Sun
10881 if $test `./findhdr sys/file.h` && \
10882                 set try -DI_SYS_FILE && eval $compile; then
10883         h_sysfile=true;
10884         echo "<sys/file.h> defines the O_* constants..." >&4
10885         if $run ./try; then
10886                 echo "and you have the 3 argument form of open()." >&4
10887                 val="$define"
10888         else
10889                 echo "but not the 3 argument form of open().  Oh, well." >&4
10890                 val="$undef"
10891         fi
10892 elif $test `./findhdr fcntl.h` && \
10893                 set try -DI_FCNTL && eval $compile; then
10894         h_fcntl=true;
10895         echo "<fcntl.h> defines the O_* constants..." >&4
10896         if $run ./try; then
10897                 echo "and you have the 3 argument form of open()." >&4
10898                 val="$define"
10899         else
10900                 echo "but not the 3 argument form of open().  Oh, well." >&4
10901                 val="$undef"
10902         fi
10903 else
10904         val="$undef"
10905         echo "I can't find the O_* constant definitions!  You got problems." >&4
10906 fi
10907 set d_open3
10908 eval $setvar
10909 $rm -f try try.*
10910
10911 : see which of string.h or strings.h is needed
10912 echo " "
10913 strings=`./findhdr string.h`
10914 if $test "$strings" && $test -r "$strings"; then
10915         echo "Using <string.h> instead of <strings.h>." >&4
10916         val="$define"
10917 else
10918         val="$undef"
10919         strings=`./findhdr strings.h`
10920         if $test "$strings" && $test -r "$strings"; then
10921                 echo "Using <strings.h> instead of <string.h>." >&4
10922         else
10923                 echo "No string header found -- You'll surely have problems." >&4
10924         fi
10925 fi
10926 set i_string
10927 eval $setvar
10928 case "$i_string" in
10929 "$undef") strings=`./findhdr strings.h`;;
10930 *)        strings=`./findhdr string.h`;;
10931 esac
10932
10933 : see if this is a sys/file.h system
10934 val=''
10935 set sys/file.h val
10936 eval $inhdr
10937
10938 : do we need to include sys/file.h ?
10939 case "$val" in
10940 "$define")
10941         echo " "
10942         if $h_sysfile; then
10943                 val="$define"
10944                 echo "We'll be including <sys/file.h>." >&4
10945         else
10946                 val="$undef"
10947                 echo "We won't be including <sys/file.h>." >&4
10948         fi
10949         ;;
10950 *)
10951         h_sysfile=false
10952         ;;
10953 esac
10954 set i_sysfile
10955 eval $setvar
10956
10957 : see if fcntl.h is there
10958 val=''
10959 set fcntl.h val
10960 eval $inhdr
10961
10962 : see if we can include fcntl.h
10963 case "$val" in
10964 "$define")
10965         echo " "
10966         if $h_fcntl; then
10967                 val="$define"
10968                 echo "We'll be including <fcntl.h>." >&4
10969         else
10970                 val="$undef"
10971                 if $h_sysfile; then
10972         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
10973                 else
10974                         echo "We won't be including <fcntl.h>." >&4
10975                 fi
10976         fi
10977         ;;
10978 *)
10979         h_fcntl=false
10980         val="$undef"
10981         ;;
10982 esac
10983 set i_fcntl
10984 eval $setvar
10985
10986 : check for non-blocking I/O stuff
10987 case "$h_sysfile" in
10988 true) echo "#include <sys/file.h>" > head.c;;
10989 *)
10990        case "$h_fcntl" in
10991        true) echo "#include <fcntl.h>" > head.c;;
10992        *) echo "#include <sys/fcntl.h>" > head.c;;
10993        esac
10994        ;;
10995 esac
10996 echo " "
10997 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
10998 case "$o_nonblock" in
10999 '')
11000         $cat head.c > try.c
11001         $cat >>try.c <<EOCP
11002 #include <stdio.h>
11003 #include <stdlib.h>
11004 #$i_fcntl I_FCNTL
11005 #ifdef I_FCNTL
11006 #include <fcntl.h>
11007 #endif
11008 int main() {
11009 #ifdef O_NONBLOCK
11010         printf("O_NONBLOCK\n");
11011         exit(0);
11012 #endif
11013 #ifdef O_NDELAY
11014         printf("O_NDELAY\n");
11015         exit(0);
11016 #endif
11017 #ifdef FNDELAY
11018         printf("FNDELAY\n");
11019         exit(0);
11020 #endif
11021         exit(0);
11022 }
11023 EOCP
11024         set try
11025         if eval $compile_ok; then
11026                 o_nonblock=`$run ./try`
11027                 case "$o_nonblock" in
11028                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11029                 *) echo "Seems like we can use $o_nonblock.";;
11030                 esac
11031         else
11032                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11033         fi
11034         ;;
11035 *) echo "Using $hint value $o_nonblock.";;
11036 esac
11037 $rm -f try try.* .out core
11038
11039 echo " "
11040 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11041 case "$eagain" in
11042 '')
11043         $cat head.c > try.c
11044         $cat >>try.c <<EOCP
11045 #include <errno.h>
11046 #include <sys/types.h>
11047 #include <signal.h>
11048 #include <stdio.h> 
11049 #include <stdlib.h> 
11050 #$i_fcntl I_FCNTL
11051 #ifdef I_FCNTL
11052 #include <fcntl.h>
11053 #endif
11054 #define MY_O_NONBLOCK $o_nonblock
11055 #ifndef errno  /* XXX need better Configure test */
11056 extern int errno;
11057 #endif
11058 #$i_unistd I_UNISTD
11059 #ifdef I_UNISTD
11060 #include <unistd.h>
11061 #endif
11062 #$i_string I_STRING
11063 #ifdef I_STRING
11064 #include <string.h>
11065 #else
11066 #include <strings.h>
11067 #endif
11068 $signal_t blech(x) int x; { exit(3); }
11069 EOCP
11070         $cat >> try.c <<'EOCP'
11071 int main()
11072 {
11073         int pd[2];
11074         int pu[2];
11075         char buf[1];
11076         char string[100];
11077
11078         pipe(pd);       /* Down: child -> parent */
11079         pipe(pu);       /* Up: parent -> child */
11080         if (0 != fork()) {
11081                 int ret;
11082                 close(pd[1]);   /* Parent reads from pd[0] */
11083                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11084 #ifdef F_SETFL
11085                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11086                         exit(1);
11087 #else
11088                 exit(4);
11089 #endif
11090                 signal(SIGALRM, blech);
11091                 alarm(5);
11092                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11093                         exit(2);
11094                 sprintf(string, "%d\n", ret);
11095                 write(2, string, strlen(string));
11096                 alarm(0);
11097 #ifdef EAGAIN
11098                 if (errno == EAGAIN) {
11099                         printf("EAGAIN\n");
11100                         goto ok;
11101                 }
11102 #endif
11103 #ifdef EWOULDBLOCK
11104                 if (errno == EWOULDBLOCK)
11105                         printf("EWOULDBLOCK\n");
11106 #endif
11107         ok:
11108                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11109                 sleep(2);                               /* Give it time to close our pipe */
11110                 alarm(5);
11111                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11112                 alarm(0);
11113                 sprintf(string, "%d\n", ret);
11114                 write(4, string, strlen(string));
11115                 exit(0);
11116         }
11117
11118         close(pd[0]);                   /* We write to pd[1] */
11119         close(pu[1]);                   /* We read from pu[0] */
11120         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11121         close(pd[1]);                   /* Pipe pd is now fully closed! */
11122         exit(0);                                /* Bye bye, thank you for playing! */
11123 }
11124 EOCP
11125         set try
11126         if eval $compile_ok; then
11127                 echo "$startsh" >mtry
11128                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11129                 chmod +x mtry
11130                 ./mtry >/dev/null 2>&1
11131                 case $? in
11132                 0) eagain=`$cat try.out`;;
11133                 1) echo "Could not perform non-blocking setting!";;
11134                 2) echo "I did a successful read() for something that was not there!";;
11135                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11136                 4) echo "Could not find F_SETFL!";;
11137                 *) echo "Something terribly wrong happened during testing.";;
11138                 esac
11139                 rd_nodata=`$cat try.ret`
11140                 echo "A read() system call with no data present returns $rd_nodata."
11141                 case "$rd_nodata" in
11142                 0|-1) ;;
11143                 *)
11144                         echo "(That's peculiar, fixing that to be -1.)"
11145                         rd_nodata=-1
11146                         ;;
11147                 esac
11148                 case "$eagain" in
11149                 '')
11150                         echo "Forcing errno EAGAIN on read() with no data available."
11151                         eagain=EAGAIN
11152                         ;;
11153                 *)
11154                         echo "Your read() sets errno to $eagain when no data is available."
11155                         ;;
11156                 esac
11157                 status=`$cat try.err`
11158                 case "$status" in
11159                 0) echo "And it correctly returns 0 to signal EOF.";;
11160                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11161                 *) echo "However, your read() returns '$status' on EOF??";;
11162                 esac
11163                 val="$define"
11164                 if test "$status" = "$rd_nodata"; then
11165                         echo "WARNING: you can't distinguish between EOF and no data!"
11166                         val="$undef"
11167                 fi
11168         else
11169                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11170                 eagain=EAGAIN
11171         fi
11172         set d_eofnblk
11173         eval $setvar
11174         ;;
11175 *)
11176         echo "Using $hint value $eagain."
11177         echo "Your read() returns $rd_nodata when no data is present."
11178         case "$d_eofnblk" in
11179         "$define") echo "And you can see EOF because read() returns 0.";;
11180         "$undef") echo "But you can't see EOF status from read() returned value.";;
11181         *)
11182                 echo "(Assuming you can't see EOF status from read anyway.)"
11183                 d_eofnblk=$undef
11184                 ;;
11185         esac
11186         ;;
11187 esac
11188 $rm -f try try.* .out core head.c mtry
11189
11190 : see if fchdir exists
11191 set fchdir d_fchdir
11192 eval $inlibc
11193
11194 : see if fchmod exists
11195 set fchmod d_fchmod
11196 eval $inlibc
11197
11198 : see if fchown exists
11199 set fchown d_fchown
11200 eval $inlibc
11201
11202 : see if this is an fcntl system
11203 set fcntl d_fcntl
11204 eval $inlibc
11205
11206 echo " "
11207 : See if fcntl-based locking works.
11208 $cat >try.c <<EOCP
11209 #include <stdlib.h>
11210 #include <unistd.h>
11211 #include <fcntl.h>
11212 #include <signal.h>
11213 $signal_t blech(x) int x; { exit(3); }
11214 int main() {
11215 #if defined(F_SETLK) && defined(F_SETLKW)
11216      struct flock flock;
11217      int retval, fd;
11218      fd = open("try.c", O_RDONLY);
11219      flock.l_type = F_RDLCK;
11220      flock.l_whence = SEEK_SET;
11221      flock.l_start = flock.l_len = 0;
11222      signal(SIGALRM, blech);
11223      alarm(10);
11224      retval = fcntl(fd, F_SETLK, &flock);
11225      close(fd);
11226      (retval < 0 ? exit(2) : exit(0));
11227 #else
11228      exit(2);
11229 #endif
11230 }
11231 EOCP
11232 echo "Checking if fcntl-based file locking works... "
11233 case "$d_fcntl" in
11234 "$define")
11235         set try
11236         if eval $compile_ok; then
11237                 if $run ./try; then
11238                         echo "Yes, it seems to work."
11239                         val="$define"
11240                 else
11241                         echo "Nope, it didn't work."
11242                         val="$undef"
11243                         case "$?" in
11244                         3) $cat >&4 <<EOM
11245 ***
11246 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
11247 *** This is (almost) impossible.
11248 *** If your NFS lock daemons are not feeling well, something like
11249 *** this may happen, please investigate.  Cannot continue, aborting.
11250 ***
11251 EOM
11252                                 exit 1
11253                                 ;;
11254                         esac
11255                 fi
11256         else
11257                 echo "I'm unable to compile the test program, so I'll assume not."
11258                 val="$undef"
11259         fi
11260         ;;
11261 *) val="$undef";
11262         echo "Nope, since you don't even have fcntl()."
11263         ;;
11264 esac
11265 set d_fcntl_can_lock
11266 eval $setvar
11267 $rm -f try*
11268
11269
11270 : check for fd_set items
11271 $cat <<EOM
11272
11273 Checking to see how well your C compiler handles fd_set and friends ...
11274 EOM
11275 $cat >try.c <<EOCP
11276 #$i_systime I_SYS_TIME
11277 #$i_sysselct I_SYS_SELECT
11278 #$d_socket HAS_SOCKET
11279 #include <sys/types.h>
11280 #ifdef HAS_SOCKET
11281 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
11282 #endif
11283 #ifdef I_SYS_TIME
11284 #include <sys/time.h>
11285 #endif
11286 #ifdef I_SYS_SELECT
11287 #include <sys/select.h>
11288 #endif
11289 int main() {
11290         fd_set fds;
11291
11292 #ifdef TRYBITS
11293         if(fds.fds_bits);
11294 #endif
11295
11296 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
11297         exit(0);
11298 #else
11299         exit(1);
11300 #endif
11301 }
11302 EOCP
11303 set try -DTRYBITS
11304 if eval $compile; then
11305         d_fds_bits="$define"
11306         d_fd_set="$define"
11307         echo "Well, your system knows about the normal fd_set typedef..." >&4
11308         if $run ./try; then
11309                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
11310                 d_fd_macros="$define"
11311         else
11312                 $cat >&4 <<'EOM'
11313 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
11314 EOM
11315                 d_fd_macros="$undef"
11316         fi
11317 else
11318         $cat <<'EOM'
11319 Hmm, your compiler has some difficulty with fd_set.  Checking further...
11320 EOM
11321         set try
11322         if eval $compile; then
11323                 d_fds_bits="$undef"
11324                 d_fd_set="$define"
11325                 echo "Well, your system has some sort of fd_set available..." >&4
11326                 if $run ./try; then
11327                         echo "and you have the normal fd_set macros." >&4
11328                         d_fd_macros="$define"
11329                 else
11330                         $cat <<'EOM'
11331 but not the normal fd_set macros!  Gross!  More work for me...
11332 EOM
11333                         d_fd_macros="$undef"
11334                 fi
11335         else
11336         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
11337                 d_fd_set="$undef"
11338                 d_fds_bits="$undef"
11339                 d_fd_macros="$undef"
11340         fi
11341 fi
11342 $rm -f try try.*
11343
11344 : see if fgetpos exists
11345 set fgetpos d_fgetpos
11346 eval $inlibc
11347
11348 : see if finite exists
11349 set finite d_finite
11350 eval $inlibc
11351
11352 : see if finitel exists
11353 set finitel d_finitel
11354 eval $inlibc
11355
11356 : see if flock exists
11357 set flock d_flock
11358 eval $inlibc
11359
11360 : see if prototype for flock is available
11361 echo " "
11362 set d_flockproto flock $i_sysfile sys/file.h
11363 eval $hasproto
11364
11365 : see if fork exists
11366 set fork d_fork
11367 eval $inlibc
11368
11369 : see if fp_class exists
11370 set fp_class d_fp_class
11371 eval $inlibc
11372
11373 : see if pathconf exists
11374 set pathconf d_pathconf
11375 eval $inlibc
11376
11377 : see if fpathconf exists
11378 set fpathconf d_fpathconf
11379 eval $inlibc
11380
11381 : see if fpclass exists
11382 set fpclass d_fpclass
11383 eval $inlibc
11384
11385 : see if fpclassify exists
11386 set fpclassify d_fpclassify
11387 eval $inlibc
11388
11389 : see if fpclassl exists
11390 set fpclassl d_fpclassl
11391 eval $inlibc
11392
11393
11394 : check for fpos64_t
11395 echo " "
11396 echo "Checking to see if you have fpos64_t..." >&4
11397 $cat >try.c <<EOCP
11398 #include <stdio.h>
11399 int main() { fpos64_t x = 7; }
11400 EOCP
11401 set try
11402 if eval $compile; then
11403         val="$define"
11404         echo "You have fpos64_t."
11405 else
11406         val="$undef"
11407         echo "You do not have fpos64_t."
11408         case "$fpossize" in
11409         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
11410         esac
11411 fi
11412 $rm -f try.* try
11413 set d_fpos64_t
11414 eval $setvar
11415
11416 : see if frexpl exists
11417 set frexpl d_frexpl
11418 eval $inlibc
11419
11420 : see if this is a sys/param system
11421 set sys/param.h i_sysparam
11422 eval $inhdr
11423
11424 : see if this is a sys/mount.h system
11425 set sys/mount.h i_sysmount
11426 eval $inhdr
11427
11428
11429 echo " "
11430 echo "Checking to see if your system supports struct fs_data..." >&4
11431 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
11432 eval $hasstruct
11433 case "$d_fs_data_s" in
11434 "$define")      echo "Yes, it does."   ;;
11435 *)              echo "No, it doesn't." ;;
11436 esac
11437
11438 : see if fseeko exists
11439 set fseeko d_fseeko
11440 eval $inlibc
11441 case "$longsize" in
11442 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
11443 esac
11444
11445 : see if fsetpos exists
11446 set fsetpos d_fsetpos
11447 eval $inlibc
11448
11449
11450 : see if fstatfs exists
11451 set fstatfs d_fstatfs
11452 eval $inlibc
11453
11454
11455 : see if statvfs exists
11456 set statvfs d_statvfs
11457 eval $inlibc
11458
11459 : see if fstatvfs exists
11460 set fstatvfs d_fstatvfs
11461 eval $inlibc
11462
11463
11464 : see if fsync exists
11465 set fsync d_fsync
11466 eval $inlibc
11467
11468 : see if ftello exists
11469 set ftello d_ftello
11470 eval $inlibc
11471 case "$longsize" in
11472 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
11473 esac
11474
11475 : see if getcwd exists
11476 set getcwd d_getcwd
11477 eval $inlibc
11478
11479 : see if getespwnam exists
11480 set getespwnam d_getespwnam
11481 eval $inlibc
11482
11483
11484 : see if getfsstat exists
11485 set getfsstat d_getfsstat
11486 eval $inlibc
11487
11488 : see if getgrent exists
11489 set getgrent d_getgrent
11490 eval $inlibc
11491
11492 : see if getgrent_r exists
11493 set getgrent_r d_getgrent_r
11494 eval $inlibc
11495 case "$d_getgrent_r" in
11496 "$define")
11497         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11498         case "$d_getgrent_r_proto:$usethreads" in
11499         ":define")      d_getgrent_r_proto=define
11500                 set d_getgrent_r_proto getgrent_r $hdrs
11501                 eval $hasproto ;;
11502         *)      ;;
11503         esac
11504         case "$d_getgrent_r_proto" in
11505         define)
11506         case "$getgrent_r_proto" in
11507         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
11508         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
11509         esac
11510         case "$getgrent_r_proto" in
11511         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
11512         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
11513         esac
11514         case "$getgrent_r_proto" in
11515         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
11516         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
11517         esac
11518         case "$getgrent_r_proto" in
11519         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
11520         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
11521         esac
11522         case "$getgrent_r_proto" in
11523         ''|0) try='int getgrent_r(struct group*, char*, int);'
11524         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
11525         esac
11526         case "$getgrent_r_proto" in
11527         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
11528         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
11529         esac
11530         case "$getgrent_r_proto" in
11531         ''|0)   d_getgrent_r=undef
11532                 getgrent_r_proto=0
11533                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
11534         * )     case "$getgrent_r_proto" in
11535                 REENTRANT_PROTO*) ;;
11536                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
11537                 esac
11538                 echo "Prototype: $try" ;;
11539         esac
11540         ;;
11541         *)      case "$usethreads" in
11542                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
11543                 esac
11544                 d_getgrent_r=undef
11545                 getgrent_r_proto=0
11546                 ;;
11547         esac
11548         ;;
11549 *)      getgrent_r_proto=0
11550         ;;
11551 esac
11552
11553 : see if getgrgid_r exists
11554 set getgrgid_r d_getgrgid_r
11555 eval $inlibc
11556 case "$d_getgrgid_r" in
11557 "$define")
11558         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11559         case "$d_getgrgid_r_proto:$usethreads" in
11560         ":define")      d_getgrgid_r_proto=define
11561                 set d_getgrgid_r_proto getgrgid_r $hdrs
11562                 eval $hasproto ;;
11563         *)      ;;
11564         esac
11565         case "$d_getgrgid_r_proto" in
11566         define)
11567         case "$getgrgid_r_proto" in
11568         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
11569         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
11570         esac
11571         case "$getgrgid_r_proto" in
11572         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
11573         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
11574         esac
11575         case "$getgrgid_r_proto" in
11576         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
11577         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
11578         esac
11579         case "$getgrgid_r_proto" in
11580         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
11581         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
11582         esac
11583         case "$getgrgid_r_proto" in
11584         ''|0)   d_getgrgid_r=undef
11585                 getgrgid_r_proto=0
11586                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
11587         * )     case "$getgrgid_r_proto" in
11588                 REENTRANT_PROTO*) ;;
11589                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
11590                 esac
11591                 echo "Prototype: $try" ;;
11592         esac
11593         ;;
11594         *)      case "$usethreads" in
11595                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
11596                 esac
11597                 d_getgrgid_r=undef
11598                 getgrgid_r_proto=0
11599                 ;;
11600         esac
11601         ;;
11602 *)      getgrgid_r_proto=0
11603         ;;
11604 esac
11605
11606 : see if getgrnam_r exists
11607 set getgrnam_r d_getgrnam_r
11608 eval $inlibc
11609 case "$d_getgrnam_r" in
11610 "$define")
11611         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11612         case "$d_getgrnam_r_proto:$usethreads" in
11613         ":define")      d_getgrnam_r_proto=define
11614                 set d_getgrnam_r_proto getgrnam_r $hdrs
11615                 eval $hasproto ;;
11616         *)      ;;
11617         esac
11618         case "$d_getgrnam_r_proto" in
11619         define)
11620         case "$getgrnam_r_proto" in
11621         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
11622         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
11623         esac
11624         case "$getgrnam_r_proto" in
11625         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
11626         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
11627         esac
11628         case "$getgrnam_r_proto" in
11629         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
11630         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
11631         esac
11632         case "$getgrnam_r_proto" in
11633         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
11634         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
11635         esac
11636         case "$getgrnam_r_proto" in
11637         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
11638         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
11639         esac
11640         case "$getgrnam_r_proto" in
11641         ''|0)   d_getgrnam_r=undef
11642                 getgrnam_r_proto=0
11643                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
11644         * )     case "$getgrnam_r_proto" in
11645                 REENTRANT_PROTO*) ;;
11646                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
11647                 esac
11648                 echo "Prototype: $try" ;;
11649         esac
11650         ;;
11651         *)      case "$usethreads" in
11652                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
11653                 esac
11654                 d_getgrnam_r=undef
11655                 getgrnam_r_proto=0
11656                 ;;
11657         esac
11658         ;;
11659 *)      getgrnam_r_proto=0
11660         ;;
11661 esac
11662
11663 : see if gethostbyaddr exists
11664 set gethostbyaddr d_gethbyaddr
11665 eval $inlibc
11666
11667 : see if gethostbyname exists
11668 set gethostbyname d_gethbyname
11669 eval $inlibc
11670
11671 : see if gethostent exists
11672 set gethostent d_gethent
11673 eval $inlibc
11674
11675 : see how we will look up host name
11676 echo " "
11677 call=''
11678 if set gethostname val -f d_gethname; eval $csym; $val; then
11679         echo 'gethostname() found.' >&4
11680         d_gethname="$define"
11681         call=gethostname
11682 fi
11683 if set uname val -f d_uname; eval $csym; $val; then
11684         if ./xenix; then
11685                 $cat <<'EOM'
11686 uname() was found, but you're running xenix, and older versions of xenix
11687 have a broken uname(). If you don't really know whether your xenix is old
11688 enough to have a broken system call, use the default answer.
11689
11690 EOM
11691                 dflt=y
11692                 case "$d_uname" in
11693                 "$define") dflt=n;;
11694                 esac
11695                 rp='Is your uname() broken?'
11696                 . ./myread
11697                 case "$ans" in
11698                 n*) d_uname="$define"; call=uname;;
11699                 esac
11700         else
11701                 echo 'uname() found.' >&4
11702                 d_uname="$define"
11703                 case "$call" in
11704                 '') call=uname ;;
11705                 esac
11706         fi
11707 fi
11708 case "$d_gethname" in
11709 '') d_gethname="$undef";;
11710 esac
11711 case "$d_uname" in
11712 '') d_uname="$undef";;
11713 esac
11714 case "$d_uname$d_gethname" in
11715 *define*)
11716         dflt=n
11717         cat <<EOM
11718  
11719 Every now and then someone has a $call() that lies about the hostname
11720 but can't be fixed for political or economic reasons.  If you wish, I can
11721 pretend $call() isn't there and maybe compute hostname at run-time
11722 thanks to the '$phostname' command.
11723
11724 EOM
11725         rp="Shall I ignore $call() from now on?"
11726         . ./myread
11727         case "$ans" in
11728         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
11729         esac;;
11730 esac
11731 case "$phostname" in
11732 '') aphostname='';;
11733 *) case "$aphostname" in
11734         /*) ;;
11735         *) set X $phostname
11736                 shift
11737                 file=$1
11738                 shift
11739                 file=`./loc $file $file $pth`
11740                 aphostname=`echo $file $*`
11741                 ;;
11742         esac
11743         ;;
11744 esac
11745 case "$d_uname$d_gethname" in
11746 *define*) ;;
11747 *)
11748         case "$phostname" in
11749         '')
11750                 echo "There will be no way for $package to get your hostname." >&4;;
11751         *)
11752         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
11753                 ;;
11754         esac;;
11755 esac
11756 case "$d_phostname" in
11757 '') d_phostname="$undef";;
11758 esac
11759
11760 : see if gethostbyaddr_r exists
11761 set gethostbyaddr_r d_gethostbyaddr_r
11762 eval $inlibc
11763 case "$d_gethostbyaddr_r" in
11764 "$define")
11765         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11766         case "$d_gethostbyaddr_r_proto:$usethreads" in
11767         ":define")      d_gethostbyaddr_r_proto=define
11768                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
11769                 eval $hasproto ;;
11770         *)      ;;
11771         esac
11772         case "$d_gethostbyaddr_r_proto" in
11773         define)
11774         case "$gethostbyaddr_r_proto" in
11775         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
11776         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
11777         esac
11778         case "$gethostbyaddr_r_proto" in
11779         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
11780         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
11781         esac
11782         case "$gethostbyaddr_r_proto" in
11783         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
11784         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
11785         esac
11786         case "$gethostbyaddr_r_proto" in
11787         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
11788         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
11789         esac
11790         case "$gethostbyaddr_r_proto" in
11791         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
11792         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
11793         esac
11794         case "$gethostbyaddr_r_proto" in
11795         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
11796         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
11797         esac
11798         case "$gethostbyaddr_r_proto" in
11799         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
11800         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
11801         esac
11802         case "$gethostbyaddr_r_proto" in
11803         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
11804         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
11805         esac
11806         case "$gethostbyaddr_r_proto" in
11807         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
11808         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
11809         esac
11810         case "$gethostbyaddr_r_proto" in
11811         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
11812         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
11813         esac
11814         case "$gethostbyaddr_r_proto" in
11815         ''|0)   d_gethostbyaddr_r=undef
11816                 gethostbyaddr_r_proto=0
11817                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
11818         * )     case "$gethostbyaddr_r_proto" in
11819                 REENTRANT_PROTO*) ;;
11820                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
11821                 esac
11822                 echo "Prototype: $try" ;;
11823         esac
11824         ;;
11825         *)      case "$usethreads" in
11826                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
11827                 esac
11828                 d_gethostbyaddr_r=undef
11829                 gethostbyaddr_r_proto=0
11830                 ;;
11831         esac
11832         ;;
11833 *)      gethostbyaddr_r_proto=0
11834         ;;
11835 esac
11836
11837 : see if gethostbyname_r exists
11838 set gethostbyname_r d_gethostbyname_r
11839 eval $inlibc
11840 case "$d_gethostbyname_r" in
11841 "$define")
11842         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11843         case "$d_gethostbyname_r_proto:$usethreads" in
11844         ":define")      d_gethostbyname_r_proto=define
11845                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
11846                 eval $hasproto ;;
11847         *)      ;;
11848         esac
11849         case "$d_gethostbyname_r_proto" in
11850         define)
11851         case "$gethostbyname_r_proto" in
11852         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
11853         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
11854         esac
11855         case "$gethostbyname_r_proto" in
11856         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
11857         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
11858         esac
11859         case "$gethostbyname_r_proto" in
11860         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
11861         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
11862         esac
11863         case "$gethostbyname_r_proto" in
11864         ''|0)   d_gethostbyname_r=undef
11865                 gethostbyname_r_proto=0
11866                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
11867         * )     case "$gethostbyname_r_proto" in
11868                 REENTRANT_PROTO*) ;;
11869                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
11870                 esac
11871                 echo "Prototype: $try" ;;
11872         esac
11873         ;;
11874         *)      case "$usethreads" in
11875                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
11876                 esac
11877                 d_gethostbyname_r=undef
11878                 gethostbyname_r_proto=0
11879                 ;;
11880         esac
11881         ;;
11882 *)      gethostbyname_r_proto=0
11883         ;;
11884 esac
11885
11886 : see if gethostent_r exists
11887 set gethostent_r d_gethostent_r
11888 eval $inlibc
11889 case "$d_gethostent_r" in
11890 "$define")
11891         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11892         case "$d_gethostent_r_proto:$usethreads" in
11893         ":define")      d_gethostent_r_proto=define
11894                 set d_gethostent_r_proto gethostent_r $hdrs
11895                 eval $hasproto ;;
11896         *)      ;;
11897         esac
11898         case "$d_gethostent_r_proto" in
11899         define)
11900         case "$gethostent_r_proto" in
11901         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
11902         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
11903         esac
11904         case "$gethostent_r_proto" in
11905         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
11906         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
11907         esac
11908         case "$gethostent_r_proto" in
11909         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
11910         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
11911         esac
11912         case "$gethostent_r_proto" in
11913         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
11914         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
11915         esac
11916         case "$gethostent_r_proto" in
11917         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
11918         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
11919         esac
11920         case "$gethostent_r_proto" in
11921         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
11922         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
11923         esac
11924         case "$gethostent_r_proto" in
11925         ''|0)   d_gethostent_r=undef
11926                 gethostent_r_proto=0
11927                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
11928         * )     case "$gethostent_r_proto" in
11929                 REENTRANT_PROTO*) ;;
11930                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
11931                 esac
11932                 echo "Prototype: $try" ;;
11933         esac
11934         ;;
11935         *)      case "$usethreads" in
11936                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
11937                 esac
11938                 d_gethostent_r=undef
11939                 gethostent_r_proto=0
11940                 ;;
11941         esac
11942         ;;
11943 *)      gethostent_r_proto=0
11944         ;;
11945 esac
11946
11947 : see if prototypes for various gethostxxx netdb.h functions are available
11948 echo " "
11949 set d_gethostprotos gethostent $i_netdb netdb.h
11950 eval $hasproto
11951
11952 : see if getitimer exists
11953 set getitimer d_getitimer
11954 eval $inlibc
11955
11956 : see if getlogin exists
11957 set getlogin d_getlogin
11958 eval $inlibc
11959
11960 : see if getlogin_r exists
11961 set getlogin_r d_getlogin_r
11962 eval $inlibc
11963 case "$d_getlogin_r" in
11964 "$define")
11965         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
11966         case "$d_getlogin_r_proto:$usethreads" in
11967         ":define")      d_getlogin_r_proto=define
11968                 set d_getlogin_r_proto getlogin_r $hdrs
11969                 eval $hasproto ;;
11970         *)      ;;
11971         esac
11972         case "$d_getlogin_r_proto" in
11973         define)
11974         case "$getlogin_r_proto" in
11975         ''|0) try='int getlogin_r(char*, size_t);'
11976         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
11977         esac
11978         case "$getlogin_r_proto" in
11979         ''|0) try='int getlogin_r(char*, int);'
11980         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
11981         esac
11982         case "$getlogin_r_proto" in
11983         ''|0) try='char* getlogin_r(char*, size_t);'
11984         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
11985         esac
11986         case "$getlogin_r_proto" in
11987         ''|0) try='char* getlogin_r(char*, int);'
11988         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
11989         esac
11990         case "$getlogin_r_proto" in
11991         ''|0)   d_getlogin_r=undef
11992                 getlogin_r_proto=0
11993                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
11994         * )     case "$getlogin_r_proto" in
11995                 REENTRANT_PROTO*) ;;
11996                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
11997                 esac
11998                 echo "Prototype: $try" ;;
11999         esac
12000         ;;
12001         *)      case "$usethreads" in
12002                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
12003                 esac
12004                 d_getlogin_r=undef
12005                 getlogin_r_proto=0
12006                 ;;
12007         esac
12008         ;;
12009 *)      getlogin_r_proto=0
12010         ;;
12011 esac
12012
12013 : see if getmnt exists
12014 set getmnt d_getmnt
12015 eval $inlibc
12016
12017 : see if getmntent exists
12018 set getmntent d_getmntent
12019 eval $inlibc
12020
12021 : see if getnetbyaddr exists
12022 set getnetbyaddr d_getnbyaddr
12023 eval $inlibc
12024
12025 : see if getnetbyname exists
12026 set getnetbyname d_getnbyname
12027 eval $inlibc
12028
12029 : see if getnetent exists
12030 set getnetent d_getnent
12031 eval $inlibc
12032
12033 : see if getnetbyaddr_r exists
12034 set getnetbyaddr_r d_getnetbyaddr_r
12035 eval $inlibc
12036 case "$d_getnetbyaddr_r" in
12037 "$define")
12038         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12039         case "$d_getnetbyaddr_r_proto:$usethreads" in
12040         ":define")      d_getnetbyaddr_r_proto=define
12041                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
12042                 eval $hasproto ;;
12043         *)      ;;
12044         esac
12045         case "$d_getnetbyaddr_r_proto" in
12046         define)
12047         case "$getnetbyaddr_r_proto" in
12048         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
12049         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
12050         esac
12051         case "$getnetbyaddr_r_proto" in
12052         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
12053         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
12054         esac
12055         case "$getnetbyaddr_r_proto" in
12056         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
12057         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
12058         esac
12059         case "$getnetbyaddr_r_proto" in
12060         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
12061         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
12062         esac
12063         case "$getnetbyaddr_r_proto" in
12064         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
12065         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
12066         esac
12067         case "$getnetbyaddr_r_proto" in
12068         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
12069         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
12070         esac
12071         case "$getnetbyaddr_r_proto" in
12072         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
12073         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
12074         esac
12075         case "$getnetbyaddr_r_proto" in
12076         ''|0)   d_getnetbyaddr_r=undef
12077                 getnetbyaddr_r_proto=0
12078                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
12079         * )     case "$getnetbyaddr_r_proto" in
12080                 REENTRANT_PROTO*) ;;
12081                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
12082                 esac
12083                 echo "Prototype: $try" ;;
12084         esac
12085         ;;
12086         *)      case "$usethreads" in
12087                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
12088                 esac
12089                 d_getnetbyaddr_r=undef
12090                 getnetbyaddr_r_proto=0
12091                 ;;
12092         esac
12093         ;;
12094 *)      getnetbyaddr_r_proto=0
12095         ;;
12096 esac
12097
12098 : see if getnetbyname_r exists
12099 set getnetbyname_r d_getnetbyname_r
12100 eval $inlibc
12101 case "$d_getnetbyname_r" in
12102 "$define")
12103         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12104         case "$d_getnetbyname_r_proto:$usethreads" in
12105         ":define")      d_getnetbyname_r_proto=define
12106                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
12107                 eval $hasproto ;;
12108         *)      ;;
12109         esac
12110         case "$d_getnetbyname_r_proto" in
12111         define)
12112         case "$getnetbyname_r_proto" in
12113         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
12114         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
12115         esac
12116         case "$getnetbyname_r_proto" in
12117         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
12118         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
12119         esac
12120         case "$getnetbyname_r_proto" in
12121         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
12122         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
12123         esac
12124         case "$getnetbyname_r_proto" in
12125         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
12126         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
12127         esac
12128         case "$getnetbyname_r_proto" in
12129         ''|0)   d_getnetbyname_r=undef
12130                 getnetbyname_r_proto=0
12131                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
12132         * )     case "$getnetbyname_r_proto" in
12133                 REENTRANT_PROTO*) ;;
12134                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
12135                 esac
12136                 echo "Prototype: $try" ;;
12137         esac
12138         ;;
12139         *)      case "$usethreads" in
12140                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
12141                 esac
12142                 d_getnetbyname_r=undef
12143                 getnetbyname_r_proto=0
12144                 ;;
12145         esac
12146         ;;
12147 *)      getnetbyname_r_proto=0
12148         ;;
12149 esac
12150
12151 : see if getnetent_r exists
12152 set getnetent_r d_getnetent_r
12153 eval $inlibc
12154 case "$d_getnetent_r" in
12155 "$define")
12156         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12157         case "$d_getnetent_r_proto:$usethreads" in
12158         ":define")      d_getnetent_r_proto=define
12159                 set d_getnetent_r_proto getnetent_r $hdrs
12160                 eval $hasproto ;;
12161         *)      ;;
12162         esac
12163         case "$d_getnetent_r_proto" in
12164         define)
12165         case "$getnetent_r_proto" in
12166         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
12167         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
12168         esac
12169         case "$getnetent_r_proto" in
12170         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
12171         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
12172         esac
12173         case "$getnetent_r_proto" in
12174         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
12175         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
12176         esac
12177         case "$getnetent_r_proto" in
12178         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
12179         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
12180         esac
12181         case "$getnetent_r_proto" in
12182         ''|0) try='int getnetent_r(struct netent*, char*, int);'
12183         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
12184         esac
12185         case "$getnetent_r_proto" in
12186         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
12187         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
12188         esac
12189         case "$getnetent_r_proto" in
12190         ''|0)   d_getnetent_r=undef
12191                 getnetent_r_proto=0
12192                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
12193         * )     case "$getnetent_r_proto" in
12194                 REENTRANT_PROTO*) ;;
12195                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
12196                 esac
12197                 echo "Prototype: $try" ;;
12198         esac
12199         ;;
12200         *)      case "$usethreads" in
12201                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
12202                 esac
12203                 d_getnetent_r=undef
12204                 getnetent_r_proto=0
12205                 ;;
12206         esac
12207         ;;
12208 *)      getnetent_r_proto=0
12209         ;;
12210 esac
12211
12212 : see if prototypes for various getnetxxx netdb.h functions are available
12213 echo " "
12214 set d_getnetprotos getnetent $i_netdb netdb.h
12215 eval $hasproto
12216
12217 : see if getpagesize exists
12218 set getpagesize d_getpagsz
12219 eval $inlibc
12220
12221
12222 : see if getprotobyname exists
12223 set getprotobyname d_getpbyname
12224 eval $inlibc
12225
12226 : see if getprotobynumber exists
12227 set getprotobynumber d_getpbynumber
12228 eval $inlibc
12229
12230 : see if getprotoent exists
12231 set getprotoent d_getpent
12232 eval $inlibc
12233
12234 : see if getpgid exists
12235 set getpgid d_getpgid
12236 eval $inlibc
12237
12238 : see if getpgrp2 exists
12239 set getpgrp2 d_getpgrp2
12240 eval $inlibc
12241
12242 : see if getppid exists
12243 set getppid d_getppid
12244 eval $inlibc
12245
12246 : see if getpriority exists
12247 set getpriority d_getprior
12248 eval $inlibc
12249
12250 : see if getprotobyname_r exists
12251 set getprotobyname_r d_getprotobyname_r
12252 eval $inlibc
12253 case "$d_getprotobyname_r" in
12254 "$define")
12255         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12256         case "$d_getprotobyname_r_proto:$usethreads" in
12257         ":define")      d_getprotobyname_r_proto=define
12258                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
12259                 eval $hasproto ;;
12260         *)      ;;
12261         esac
12262         case "$d_getprotobyname_r_proto" in
12263         define)
12264         case "$getprotobyname_r_proto" in
12265         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
12266         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
12267         esac
12268         case "$getprotobyname_r_proto" in
12269         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
12270         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
12271         esac
12272         case "$getprotobyname_r_proto" in
12273         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
12274         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
12275         esac
12276         case "$getprotobyname_r_proto" in
12277         ''|0)   d_getprotobyname_r=undef
12278                 getprotobyname_r_proto=0
12279                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
12280         * )     case "$getprotobyname_r_proto" in
12281                 REENTRANT_PROTO*) ;;
12282                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
12283                 esac
12284                 echo "Prototype: $try" ;;
12285         esac
12286         ;;
12287         *)      case "$usethreads" in
12288                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
12289                 esac
12290                 d_getprotobyname_r=undef
12291                 getprotobyname_r_proto=0
12292                 ;;
12293         esac
12294         ;;
12295 *)      getprotobyname_r_proto=0
12296         ;;
12297 esac
12298
12299 : see if getprotobynumber_r exists
12300 set getprotobynumber_r d_getprotobynumber_r
12301 eval $inlibc
12302 case "$d_getprotobynumber_r" in
12303 "$define")
12304         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12305         case "$d_getprotobynumber_r_proto:$usethreads" in
12306         ":define")      d_getprotobynumber_r_proto=define
12307                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
12308                 eval $hasproto ;;
12309         *)      ;;
12310         esac
12311         case "$d_getprotobynumber_r_proto" in
12312         define)
12313         case "$getprotobynumber_r_proto" in
12314         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
12315         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
12316         esac
12317         case "$getprotobynumber_r_proto" in
12318         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
12319         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
12320         esac
12321         case "$getprotobynumber_r_proto" in
12322         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
12323         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
12324         esac
12325         case "$getprotobynumber_r_proto" in
12326         ''|0)   d_getprotobynumber_r=undef
12327                 getprotobynumber_r_proto=0
12328                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
12329         * )     case "$getprotobynumber_r_proto" in
12330                 REENTRANT_PROTO*) ;;
12331                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
12332                 esac
12333                 echo "Prototype: $try" ;;
12334         esac
12335         ;;
12336         *)      case "$usethreads" in
12337                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
12338                 esac
12339                 d_getprotobynumber_r=undef
12340                 getprotobynumber_r_proto=0
12341                 ;;
12342         esac
12343         ;;
12344 *)      getprotobynumber_r_proto=0
12345         ;;
12346 esac
12347
12348 : see if getprotoent_r exists
12349 set getprotoent_r d_getprotoent_r
12350 eval $inlibc
12351 case "$d_getprotoent_r" in
12352 "$define")
12353         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12354         case "$d_getprotoent_r_proto:$usethreads" in
12355         ":define")      d_getprotoent_r_proto=define
12356                 set d_getprotoent_r_proto getprotoent_r $hdrs
12357                 eval $hasproto ;;
12358         *)      ;;
12359         esac
12360         case "$d_getprotoent_r_proto" in
12361         define)
12362         case "$getprotoent_r_proto" in
12363         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
12364         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
12365         esac
12366         case "$getprotoent_r_proto" in
12367         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
12368         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
12369         esac
12370         case "$getprotoent_r_proto" in
12371         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
12372         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
12373         esac
12374         case "$getprotoent_r_proto" in
12375         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
12376         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
12377         esac
12378         case "$getprotoent_r_proto" in
12379         ''|0)   d_getprotoent_r=undef
12380                 getprotoent_r_proto=0
12381                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
12382         * )     case "$getprotoent_r_proto" in
12383                 REENTRANT_PROTO*) ;;
12384                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
12385                 esac
12386                 echo "Prototype: $try" ;;
12387         esac
12388         ;;
12389         *)      case "$usethreads" in
12390                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
12391                 esac
12392                 d_getprotoent_r=undef
12393                 getprotoent_r_proto=0
12394                 ;;
12395         esac
12396         ;;
12397 *)      getprotoent_r_proto=0
12398         ;;
12399 esac
12400
12401 : see if prototypes for various getprotoxxx netdb.h functions are available
12402 echo " "
12403 set d_getprotoprotos getprotoent $i_netdb netdb.h
12404 eval $hasproto
12405
12406 : see if getprpwnam exists
12407 set getprpwnam d_getprpwnam
12408 eval $inlibc
12409
12410 : see if getpwent exists
12411 set getpwent d_getpwent
12412 eval $inlibc
12413
12414 : see if getpwent_r exists
12415 set getpwent_r d_getpwent_r
12416 eval $inlibc
12417 case "$d_getpwent_r" in
12418 "$define")
12419         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12420         case "$d_getpwent_r_proto:$usethreads" in
12421         ":define")      d_getpwent_r_proto=define
12422                 set d_getpwent_r_proto getpwent_r $hdrs
12423                 eval $hasproto ;;
12424         *)      ;;
12425         esac
12426         case "$d_getpwent_r_proto" in
12427         define)
12428         case "$getpwent_r_proto" in
12429         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
12430         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
12431         esac
12432         case "$getpwent_r_proto" in
12433         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
12434         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
12435         esac
12436         case "$getpwent_r_proto" in
12437         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
12438         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
12439         esac
12440         case "$getpwent_r_proto" in
12441         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
12442         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
12443         esac
12444         case "$getpwent_r_proto" in
12445         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
12446         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
12447         esac
12448         case "$getpwent_r_proto" in
12449         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
12450         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
12451         esac
12452         case "$getpwent_r_proto" in
12453         ''|0)   d_getpwent_r=undef
12454                 getpwent_r_proto=0
12455                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
12456         * )     case "$getpwent_r_proto" in
12457                 REENTRANT_PROTO*) ;;
12458                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
12459                 esac
12460                 echo "Prototype: $try" ;;
12461         esac
12462         ;;
12463         *)      case "$usethreads" in
12464                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
12465                 esac
12466                 d_getpwent_r=undef
12467                 getpwent_r_proto=0
12468                 ;;
12469         esac
12470         ;;
12471 *)      getpwent_r_proto=0
12472         ;;
12473 esac
12474
12475 : see if getpwnam_r exists
12476 set getpwnam_r d_getpwnam_r
12477 eval $inlibc
12478 case "$d_getpwnam_r" in
12479 "$define")
12480         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12481         case "$d_getpwnam_r_proto:$usethreads" in
12482         ":define")      d_getpwnam_r_proto=define
12483                 set d_getpwnam_r_proto getpwnam_r $hdrs
12484                 eval $hasproto ;;
12485         *)      ;;
12486         esac
12487         case "$d_getpwnam_r_proto" in
12488         define)
12489         case "$getpwnam_r_proto" in
12490         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
12491         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
12492         esac
12493         case "$getpwnam_r_proto" in
12494         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
12495         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
12496         esac
12497         case "$getpwnam_r_proto" in
12498         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
12499         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
12500         esac
12501         case "$getpwnam_r_proto" in
12502         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
12503         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
12504         esac
12505         case "$getpwnam_r_proto" in
12506         ''|0)   d_getpwnam_r=undef
12507                 getpwnam_r_proto=0
12508                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
12509         * )     case "$getpwnam_r_proto" in
12510                 REENTRANT_PROTO*) ;;
12511                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
12512                 esac
12513                 echo "Prototype: $try" ;;
12514         esac
12515         ;;
12516         *)      case "$usethreads" in
12517                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
12518                 esac
12519                 d_getpwnam_r=undef
12520                 getpwnam_r_proto=0
12521                 ;;
12522         esac
12523         ;;
12524 *)      getpwnam_r_proto=0
12525         ;;
12526 esac
12527
12528 : see if getpwuid_r exists
12529 set getpwuid_r d_getpwuid_r
12530 eval $inlibc
12531 case "$d_getpwuid_r" in
12532 "$define")
12533         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12534         case "$d_getpwuid_r_proto:$usethreads" in
12535         ":define")      d_getpwuid_r_proto=define
12536                 set d_getpwuid_r_proto getpwuid_r $hdrs
12537                 eval $hasproto ;;
12538         *)      ;;
12539         esac
12540         case "$d_getpwuid_r_proto" in
12541         define)
12542         case "$getpwuid_r_proto" in
12543         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
12544         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
12545         esac
12546         case "$getpwuid_r_proto" in
12547         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
12548         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
12549         esac
12550         case "$getpwuid_r_proto" in
12551         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
12552         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
12553         esac
12554         case "$getpwuid_r_proto" in
12555         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
12556         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
12557         esac
12558         case "$getpwuid_r_proto" in
12559         ''|0)   d_getpwuid_r=undef
12560                 getpwuid_r_proto=0
12561                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
12562         * )     case "$getpwuid_r_proto" in
12563                 REENTRANT_PROTO*) ;;
12564                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
12565                 esac
12566                 echo "Prototype: $try" ;;
12567         esac
12568         ;;
12569         *)      case "$usethreads" in
12570                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
12571                 esac
12572                 d_getpwuid_r=undef
12573                 getpwuid_r_proto=0
12574                 ;;
12575         esac
12576         ;;
12577 *)      getpwuid_r_proto=0
12578         ;;
12579 esac
12580
12581
12582 : see if getservbyname exists
12583 set getservbyname d_getsbyname
12584 eval $inlibc
12585
12586 : see if getservbyport exists
12587 set getservbyport d_getsbyport
12588 eval $inlibc
12589
12590 : see if getservent exists
12591 set getservent d_getsent
12592 eval $inlibc
12593
12594 : see if getservbyname_r exists
12595 set getservbyname_r d_getservbyname_r
12596 eval $inlibc
12597 case "$d_getservbyname_r" in
12598 "$define")
12599         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12600         case "$d_getservbyname_r_proto:$usethreads" in
12601         ":define")      d_getservbyname_r_proto=define
12602                 set d_getservbyname_r_proto getservbyname_r $hdrs
12603                 eval $hasproto ;;
12604         *)      ;;
12605         esac
12606         case "$d_getservbyname_r_proto" in
12607         define)
12608         case "$getservbyname_r_proto" in
12609         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
12610         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
12611         esac
12612         case "$getservbyname_r_proto" in
12613         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
12614         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
12615         esac
12616         case "$getservbyname_r_proto" in
12617         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
12618         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
12619         esac
12620         case "$getservbyname_r_proto" in
12621         ''|0)   d_getservbyname_r=undef
12622                 getservbyname_r_proto=0
12623                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
12624         * )     case "$getservbyname_r_proto" in
12625                 REENTRANT_PROTO*) ;;
12626                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
12627                 esac
12628                 echo "Prototype: $try" ;;
12629         esac
12630         ;;
12631         *)      case "$usethreads" in
12632                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
12633                 esac
12634                 d_getservbyname_r=undef
12635                 getservbyname_r_proto=0
12636                 ;;
12637         esac
12638         ;;
12639 *)      getservbyname_r_proto=0
12640         ;;
12641 esac
12642
12643 : see if getservbyport_r exists
12644 set getservbyport_r d_getservbyport_r
12645 eval $inlibc
12646 case "$d_getservbyport_r" in
12647 "$define")
12648         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12649         case "$d_getservbyport_r_proto:$usethreads" in
12650         ":define")      d_getservbyport_r_proto=define
12651                 set d_getservbyport_r_proto getservbyport_r $hdrs
12652                 eval $hasproto ;;
12653         *)      ;;
12654         esac
12655         case "$d_getservbyport_r_proto" in
12656         define)
12657         case "$getservbyport_r_proto" in
12658         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
12659         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
12660         esac
12661         case "$getservbyport_r_proto" in
12662         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
12663         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
12664         esac
12665         case "$getservbyport_r_proto" in
12666         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
12667         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
12668         esac
12669         case "$getservbyport_r_proto" in
12670         ''|0)   d_getservbyport_r=undef
12671                 getservbyport_r_proto=0
12672                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
12673         * )     case "$getservbyport_r_proto" in
12674                 REENTRANT_PROTO*) ;;
12675                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
12676                 esac
12677                 echo "Prototype: $try" ;;
12678         esac
12679         ;;
12680         *)      case "$usethreads" in
12681                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
12682                 esac
12683                 d_getservbyport_r=undef
12684                 getservbyport_r_proto=0
12685                 ;;
12686         esac
12687         ;;
12688 *)      getservbyport_r_proto=0
12689         ;;
12690 esac
12691
12692 : see if getservent_r exists
12693 set getservent_r d_getservent_r
12694 eval $inlibc
12695 case "$d_getservent_r" in
12696 "$define")
12697         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12698         case "$d_getservent_r_proto:$usethreads" in
12699         ":define")      d_getservent_r_proto=define
12700                 set d_getservent_r_proto getservent_r $hdrs
12701                 eval $hasproto ;;
12702         *)      ;;
12703         esac
12704         case "$d_getservent_r_proto" in
12705         define)
12706         case "$getservent_r_proto" in
12707         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
12708         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
12709         esac
12710         case "$getservent_r_proto" in
12711         ''|0) try='int getservent_r(struct servent*, char*, int);'
12712         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
12713         esac
12714         case "$getservent_r_proto" in
12715         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
12716         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
12717         esac
12718         case "$getservent_r_proto" in
12719         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
12720         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
12721         esac
12722         case "$getservent_r_proto" in
12723         ''|0)   d_getservent_r=undef
12724                 getservent_r_proto=0
12725                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
12726         * )     case "$getservent_r_proto" in
12727                 REENTRANT_PROTO*) ;;
12728                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
12729                 esac
12730                 echo "Prototype: $try" ;;
12731         esac
12732         ;;
12733         *)      case "$usethreads" in
12734                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
12735                 esac
12736                 d_getservent_r=undef
12737                 getservent_r_proto=0
12738                 ;;
12739         esac
12740         ;;
12741 *)      getservent_r_proto=0
12742         ;;
12743 esac
12744
12745 : see if prototypes for various getservxxx netdb.h functions are available
12746 echo " "
12747 set d_getservprotos getservent $i_netdb netdb.h
12748 eval $hasproto
12749
12750 : see if getspnam exists
12751 set getspnam d_getspnam
12752 eval $inlibc
12753
12754 : see if this is a shadow.h system
12755 set shadow.h i_shadow
12756 eval $inhdr
12757
12758 : see if getspnam_r exists
12759 set getspnam_r d_getspnam_r
12760 eval $inlibc
12761 case "$d_getspnam_r" in
12762 "$define")
12763         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
12764         case "$d_getspnam_r_proto:$usethreads" in
12765         ":define")      d_getspnam_r_proto=define
12766                 set d_getspnam_r_proto getspnam_r $hdrs
12767                 eval $hasproto ;;
12768         *)      ;;
12769         esac
12770         case "$d_getspnam_r_proto" in
12771         define)
12772         case "$getspnam_r_proto" in
12773         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
12774         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
12775         esac
12776         case "$getspnam_r_proto" in
12777         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
12778         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
12779         esac
12780         case "$getspnam_r_proto" in
12781         ''|0)   d_getspnam_r=undef
12782                 getspnam_r_proto=0
12783                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
12784         * )     case "$getspnam_r_proto" in
12785                 REENTRANT_PROTO*) ;;
12786                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
12787                 esac
12788                 echo "Prototype: $try" ;;
12789         esac
12790         ;;
12791         *)      case "$usethreads" in
12792                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
12793                 esac
12794                 d_getspnam_r=undef
12795                 getspnam_r_proto=0
12796                 ;;
12797         esac
12798         ;;
12799 *)      getspnam_r_proto=0
12800         ;;
12801 esac
12802
12803 : see if gettimeofday or ftime exists
12804 set gettimeofday d_gettimeod
12805 eval $inlibc
12806 case "$d_gettimeod" in
12807 "$undef")
12808         set ftime d_ftime 
12809         eval $inlibc
12810         ;;
12811 *)
12812         val="$undef"; set d_ftime; eval $setvar
12813         ;;
12814 esac
12815 case "$d_gettimeod$d_ftime" in
12816 "$undef$undef")
12817         echo " "
12818         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
12819         ;;
12820 esac
12821
12822 : see if gmtime_r exists
12823 set gmtime_r d_gmtime_r
12824 eval $inlibc
12825 case "$d_gmtime_r" in
12826 "$define")
12827         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12828         case "$d_gmtime_r_proto:$usethreads" in
12829         ":define")      d_gmtime_r_proto=define
12830                 set d_gmtime_r_proto gmtime_r $hdrs
12831                 eval $hasproto ;;
12832         *)      ;;
12833         esac
12834         case "$d_gmtime_r_proto" in
12835         define)
12836         case "$gmtime_r_proto" in
12837         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
12838         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
12839         esac
12840         case "$gmtime_r_proto" in
12841         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
12842         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
12843         esac
12844         case "$gmtime_r_proto" in
12845         ''|0)   d_gmtime_r=undef
12846                 gmtime_r_proto=0
12847                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
12848         * )     case "$gmtime_r_proto" in
12849                 REENTRANT_PROTO*) ;;
12850                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
12851                 esac
12852                 echo "Prototype: $try" ;;
12853         esac
12854         ;;
12855         *)      case "$usethreads" in
12856                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
12857                 esac
12858                 d_gmtime_r=undef
12859                 gmtime_r_proto=0
12860                 ;;
12861         esac
12862         ;;
12863 *)      gmtime_r_proto=0
12864         ;;
12865 esac
12866
12867 : see if hasmntopt exists
12868 set hasmntopt d_hasmntopt
12869 eval $inlibc
12870
12871 : see if this is a netinet/in.h or sys/in.h system
12872 set netinet/in.h i_niin sys/in.h i_sysin
12873 eval $inhdr
12874
12875 : see if arpa/inet.h has to be included
12876 set arpa/inet.h i_arpainet
12877 eval $inhdr
12878
12879 : see if htonl --and friends-- exists
12880 val=''
12881 set htonl val
12882 eval $inlibc
12883
12884 : Maybe they are macros.
12885 case "$val" in
12886 $undef)
12887         $cat >htonl.c <<EOM
12888 #include <stdio.h>
12889 #include <sys/types.h>
12890 #$i_niin I_NETINET_IN
12891 #$i_sysin I_SYS_IN
12892 #$i_arpainet I_ARPA_INET
12893 #ifdef I_NETINET_IN
12894 #include <netinet/in.h>
12895 #endif
12896 #ifdef I_SYS_IN
12897 #include <sys/in.h>
12898 #endif
12899 #ifdef I_ARPA_INET
12900 #include <arpa/inet.h>
12901 #endif
12902 #ifdef htonl
12903 printf("Defined as a macro.");
12904 #endif
12905 EOM
12906         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
12907         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
12908                 val="$define"
12909                 echo "But it seems to be defined as a macro." >&4
12910         fi
12911         $rm -f htonl.?
12912         ;;
12913 esac
12914 set d_htonl
12915 eval $setvar
12916
12917 : index or strchr
12918 echo " "
12919 if set index val -f; eval $csym; $val; then
12920         if set strchr val -f d_strchr; eval $csym; $val; then
12921                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
12922                         val="$define"
12923                         vali="$undef"
12924                         echo "strchr() found." >&4
12925                 else
12926                         val="$undef"
12927                         vali="$define"
12928                         echo "index() found." >&4
12929                 fi
12930         else
12931                 val="$undef"
12932                 vali="$define"
12933                 echo "index() found." >&4
12934         fi
12935 else
12936         if set strchr val -f d_strchr; eval $csym; $val; then
12937                 val="$define"
12938                 vali="$undef"
12939                 echo "strchr() found." >&4
12940         else
12941                 echo "No index() or strchr() found!" >&4
12942                 val="$undef"
12943                 vali="$undef"
12944         fi
12945 fi
12946 set d_strchr; eval $setvar
12947 val="$vali"
12948 set d_index; eval $setvar
12949
12950 : check whether inet_aton exists
12951 set inet_aton d_inetaton
12952 eval $inlibc
12953
12954 : Look for isascii
12955 echo " "
12956 $cat >isascii.c <<'EOCP'
12957 #include <stdio.h>
12958 #include <ctype.h>
12959 int main() {
12960         int c = 'A';
12961         if (isascii(c))
12962                 exit(0);
12963         else
12964                 exit(1);
12965 }
12966 EOCP
12967 set isascii
12968 if eval $compile; then
12969         echo "isascii() found." >&4
12970         val="$define"
12971 else
12972         echo "isascii() NOT found." >&4
12973         val="$undef"
12974 fi
12975 set d_isascii
12976 eval $setvar
12977 $rm -f isascii*
12978
12979 : see if isfinite exists
12980 set isfinite d_isfinite
12981 eval $inlibc
12982
12983 : see if isinf exists
12984 set isinf d_isinf
12985 eval $inlibc
12986
12987 : see if isnan exists
12988 set isnan d_isnan
12989 eval $inlibc
12990
12991 : see if isnanl exists
12992 set isnanl d_isnanl
12993 eval $inlibc
12994
12995 : see if killpg exists
12996 set killpg d_killpg
12997 eval $inlibc
12998
12999 : see if lchown exists
13000 echo " "
13001 $cat > try.c <<'EOCP'
13002 /* System header to define __stub macros and hopefully few prototypes,
13003     which can conflict with char lchown(); below.  */
13004 #include <assert.h>
13005 /* Override any gcc2 internal prototype to avoid an error.  */
13006 /* We use char because int might match the return type of a gcc2
13007    builtin and then its argument prototype would still apply.  */
13008 char lchown();
13009 int main() {
13010     /*  The GNU C library defines this for functions which it implements
13011         to always fail with ENOSYS.  Some functions are actually named
13012         something starting with __ and the normal name is an alias.  */
13013 #if defined (__stub_lchown) || defined (__stub___lchown)
13014 choke me
13015 #else
13016 lchown();
13017 #endif
13018 ; return 0; }
13019 EOCP
13020 set try
13021 if eval $compile; then
13022     $echo "lchown() found." >&4
13023     val="$define"
13024 else
13025     $echo "lchown() NOT found." >&4
13026     val="$undef"
13027 fi
13028 set d_lchown
13029 eval $setvar
13030
13031 : See if number of significant digits in a double precision number is known
13032 echo " "
13033 $cat >ldbl_dig.c <<EOM
13034 #$i_limits I_LIMITS
13035 #$i_float I_FLOAT
13036 #ifdef I_LIMITS
13037 #include <limits.h>
13038 #endif
13039 #ifdef I_FLOAT
13040 #include <float.h>
13041 #endif
13042 #ifdef LDBL_DIG
13043 printf("Contains LDBL_DIG");
13044 #endif
13045 EOM
13046 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
13047 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
13048         echo "LDBL_DIG found." >&4
13049         val="$define"
13050 else
13051         echo "LDBL_DIG NOT found." >&4
13052         val="$undef"
13053 fi
13054 $rm -f ldbl_dig.?
13055 set d_ldbl_dig
13056 eval $setvar
13057
13058 : see if link exists
13059 set link d_link
13060 eval $inlibc
13061
13062 : see if localtime_r exists
13063 set localtime_r d_localtime_r
13064 eval $inlibc
13065 case "$d_localtime_r" in
13066 "$define")
13067         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13068         case "$d_localtime_r_proto:$usethreads" in
13069         ":define")      d_localtime_r_proto=define
13070                 set d_localtime_r_proto localtime_r $hdrs
13071                 eval $hasproto ;;
13072         *)      ;;
13073         esac
13074         case "$d_localtime_r_proto" in
13075         define)
13076         case "$localtime_r_proto" in
13077         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
13078         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
13079         esac
13080         case "$localtime_r_proto" in
13081         ''|0) try='int localtime_r(const time_t*, struct tm*);'
13082         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
13083         esac
13084         case "$localtime_r_proto" in
13085         ''|0)   d_localtime_r=undef
13086                 localtime_r_proto=0
13087                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
13088         * )     case "$localtime_r_proto" in
13089                 REENTRANT_PROTO*) ;;
13090                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
13091                 esac
13092                 echo "Prototype: $try" ;;
13093         esac
13094         ;;
13095         *)      case "$usethreads" in
13096                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
13097                 esac
13098                 d_localtime_r=undef
13099                 localtime_r_proto=0
13100                 ;;
13101         esac
13102         ;;
13103 *)      localtime_r_proto=0
13104         ;;
13105 esac
13106
13107 : see if localeconv exists
13108 set localeconv d_locconv
13109 eval $inlibc
13110
13111 : see if lockf exists
13112 set lockf d_lockf
13113 eval $inlibc
13114
13115 : see if prototype for lseek is available
13116 echo " "
13117 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
13118 eval $hasproto
13119
13120 : see if lstat exists
13121 set lstat d_lstat
13122 eval $inlibc
13123
13124 : see if madvise exists
13125 set madvise d_madvise
13126 eval $inlibc
13127
13128 : see if mblen exists
13129 set mblen d_mblen
13130 eval $inlibc
13131
13132 : see if mbstowcs exists
13133 set mbstowcs d_mbstowcs
13134 eval $inlibc
13135
13136 : see if mbtowc exists
13137 set mbtowc d_mbtowc
13138 eval $inlibc
13139
13140 : see if memchr exists
13141 set memchr d_memchr
13142 eval $inlibc
13143
13144 : see if memcmp exists
13145 set memcmp d_memcmp
13146 eval $inlibc
13147
13148 : see if memcpy exists
13149 set memcpy d_memcpy
13150 eval $inlibc
13151
13152 : see if memmove exists
13153 set memmove d_memmove
13154 eval $inlibc
13155
13156 : see if memset exists
13157 set memset d_memset
13158 eval $inlibc
13159
13160 : see if mkdir exists
13161 set mkdir d_mkdir
13162 eval $inlibc
13163
13164 : see if mkdtemp exists
13165 set mkdtemp d_mkdtemp
13166 eval $inlibc
13167
13168 : see if mkfifo exists
13169 set mkfifo d_mkfifo
13170 eval $inlibc
13171
13172 : see if mkstemp exists
13173 set mkstemp d_mkstemp
13174 eval $inlibc
13175
13176 : see if mkstemps exists
13177 set mkstemps d_mkstemps
13178 eval $inlibc
13179
13180 : see if mktime exists
13181 set mktime d_mktime
13182 eval $inlibc
13183
13184 : see if this is a sys/mman.h system
13185 set sys/mman.h i_sysmman
13186 eval $inhdr
13187
13188 : see if mmap exists
13189 set mmap d_mmap
13190 eval $inlibc
13191 : see what shmat returns
13192 : default to something harmless
13193 mmaptype='void *'
13194 case "$i_sysmman$d_mmap" in
13195 "$define$define")
13196         $cat >mmap.c <<'END'
13197 #include <sys/mman.h>
13198 void *mmap();
13199 END
13200         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
13201                 mmaptype='void *'
13202         else
13203                 mmaptype='caddr_t'
13204         fi
13205         echo "and it returns ($mmaptype)." >&4
13206         ;;
13207 esac
13208
13209
13210
13211 : see if mprotect exists
13212 set mprotect d_mprotect
13213 eval $inlibc
13214
13215 : see if msgctl exists
13216 set msgctl d_msgctl
13217 eval $inlibc
13218
13219 : see if msgget exists
13220 set msgget d_msgget
13221 eval $inlibc
13222
13223 : see if msgsnd exists
13224 set msgsnd d_msgsnd
13225 eval $inlibc
13226
13227 : see if msgrcv exists
13228 set msgrcv d_msgrcv
13229 eval $inlibc
13230
13231 : see how much of the 'msg*(2)' library is present.
13232 h_msg=true
13233 echo " "
13234 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
13235 *"$undef"*) h_msg=false;;
13236 esac
13237 case "$osname" in
13238 freebsd)
13239     case "`ipcs 2>&1`" in
13240     "SVID messages"*"not configured"*)
13241         echo "Your $osname does not have the msg*(2) configured." >&4
13242         h_msg=false
13243         val="$undef"
13244         set msgctl d_msgctl
13245         eval $setvar
13246         set msgget d_msgget
13247         eval $setvar
13248         set msgsnd d_msgsnd
13249         eval $setvar
13250         set msgrcv d_msgrcv
13251         eval $setvar
13252         ;;
13253     esac
13254     ;;
13255 esac
13256 : we could also check for sys/ipc.h ...
13257 if $h_msg && $test `./findhdr sys/msg.h`; then
13258         echo "You have the full msg*(2) library." >&4
13259         val="$define"
13260 else
13261         echo "You don't have the full msg*(2) library." >&4
13262         val="$undef"
13263 fi
13264 set d_msg
13265 eval $setvar
13266
13267
13268 echo " "
13269 echo "Checking to see if your system supports struct msghdr..." >&4
13270 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
13271 eval $hasstruct
13272 case "$d_msghdr_s" in
13273 "$define")      echo "Yes, it does."   ;;
13274 *)              echo "No, it doesn't." ;;
13275 esac
13276
13277
13278 : see if msync exists
13279 set msync d_msync
13280 eval $inlibc
13281
13282 : see if munmap exists
13283 set munmap d_munmap
13284 eval $inlibc
13285
13286 : see if nice exists
13287 set nice d_nice
13288 eval $inlibc
13289
13290 : see if this is a langinfo.h system
13291 set langinfo.h i_langinfo
13292 eval $inhdr
13293
13294 : see if nl_langinfo exists
13295 set nl_langinfo d_nl_langinfo
13296 eval $inlibc
13297
13298 : check for length of character
13299 echo " "
13300 case "$charsize" in
13301 '')
13302         echo "Checking to see how big your characters are (hey, you never know)..." >&4
13303         $cat >try.c <<'EOCP'
13304 #include <stdio.h>
13305 int main()
13306 {
13307     printf("%d\n", (int)sizeof(char));
13308     exit(0);
13309 }
13310 EOCP
13311         set try
13312         if eval $compile_ok; then
13313                 dflt=`$run ./try`
13314         else
13315                 dflt='1'
13316                 echo "(I can't seem to compile the test program.  Guessing...)"
13317         fi
13318         ;;
13319 *)
13320         dflt="$charsize"
13321         ;;
13322 esac
13323 rp="What is the size of a character (in bytes)?"
13324 . ./myread
13325 charsize="$ans"
13326 $rm -f try.c try
13327
13328 : check for volatile keyword
13329 echo " "
13330 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
13331 $cat >try.c <<'EOCP'
13332 int main()
13333 {
13334         typedef struct _goo_struct goo_struct;
13335         goo_struct * volatile goo = ((goo_struct *)0);
13336         struct _goo_struct {
13337                 long long_int;
13338                 int reg_int;
13339                 char char_var;
13340         };
13341         typedef unsigned short foo_t;
13342         char *volatile foo;
13343         volatile int bar;
13344         volatile foo_t blech;
13345         foo = foo;
13346 }
13347 EOCP
13348 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
13349         val="$define"
13350         echo "Yup, it does."
13351 else
13352         val="$undef"
13353         echo "Nope, it doesn't."
13354 fi
13355 set d_volatile
13356 eval $setvar
13357 $rm -f try.*
13358
13359
13360 echo " "
13361 $echo "Choosing the C types to be used for Perl's internal types..." >&4
13362
13363 case "$use64bitint:$d_quad:$quadtype" in
13364 define:define:?*)
13365         ivtype="$quadtype"
13366         uvtype="$uquadtype"
13367         ivsize=8
13368         uvsize=8
13369         ;;
13370 *)      ivtype="long"
13371         uvtype="unsigned long"
13372         ivsize=$longsize
13373         uvsize=$longsize
13374         ;;
13375 esac
13376
13377 case "$uselongdouble:$d_longdbl" in
13378 define:define)
13379         nvtype="long double"
13380         nvsize=$longdblsize
13381         ;;
13382 *)      nvtype=double
13383         nvsize=$doublesize
13384         ;;
13385 esac
13386
13387 $echo "(IV will be "$ivtype", $ivsize bytes)"
13388 $echo "(UV will be "$uvtype", $uvsize bytes)"
13389 $echo "(NV will be "$nvtype", $nvsize bytes)"
13390
13391 $cat >try.c <<EOCP
13392 #$i_inttypes I_INTTYPES
13393 #ifdef I_INTTYPES
13394 #include <inttypes.h>
13395 #endif
13396 #include <stdio.h>
13397 int main() {
13398 #ifdef INT8
13399    int8_t i =  INT8_MAX;
13400   uint8_t u = UINT8_MAX;
13401   printf("int8_t\n");
13402 #endif
13403 #ifdef INT16
13404    int16_t i =  INT16_MAX;
13405   uint16_t i = UINT16_MAX;
13406   printf("int16_t\n");
13407 #endif
13408 #ifdef INT32
13409    int32_t i =  INT32_MAX;
13410   uint32_t u = UINT32_MAX;
13411   printf("int32_t\n");
13412 #endif
13413 }
13414 EOCP
13415
13416 case "$i8type" in
13417 '')     case "$charsize" in
13418         1)      i8type=char
13419                 u8type="unsigned char"
13420                 i8size=$charsize
13421                 u8size=$charsize
13422                 ;;
13423         esac
13424         ;;
13425 esac
13426 case "$i8type" in
13427 '')     set try -DINT8
13428         if eval $compile; then
13429                 case "`$run ./try`" in
13430                 int8_t) i8type=int8_t
13431                         u8type=uint8_t
13432                         i8size=1
13433                         u8size=1
13434                         ;;
13435                 esac
13436         fi
13437         ;;
13438 esac
13439 case "$i8type" in
13440 '')     if $test $charsize -ge 1; then
13441                 i8type=char
13442                 u8type="unsigned char"
13443                 i8size=$charsize
13444                 u8size=$charsize
13445         fi
13446         ;;
13447 esac
13448
13449 case "$i16type" in
13450 '')     case "$shortsize" in
13451         2)      i16type=short
13452                 u16type="unsigned short"
13453                 i16size=$shortsize
13454                 u16size=$shortsize
13455                 ;;
13456         esac
13457         ;;
13458 esac
13459 case "$i16type" in
13460 '')     set try -DINT16
13461         if eval $compile; then
13462                 case "`$run ./try`" in
13463                 int16_t)
13464                         i16type=int16_t
13465                         u16type=uint16_t
13466                         i16size=2
13467                         u16size=2
13468                         ;;
13469                 esac
13470         fi
13471         ;;
13472 esac
13473 case "$i16type" in
13474 '')     if $test $shortsize -ge 2; then
13475                 i16type=short
13476                 u16type="unsigned short"
13477                 i16size=$shortsize
13478                 u16size=$shortsize
13479         fi
13480         ;;
13481 esac
13482
13483 case "$i32type" in
13484 '')     case "$longsize" in
13485         4)      i32type=long
13486                 u32type="unsigned long"
13487                 i32size=$longsize
13488                 u32size=$longsize
13489                 ;;
13490         *)      case "$intsize" in
13491                 4)      i32type=int
13492                         u32type="unsigned int"
13493                         i32size=$intsize
13494                         u32size=$intsize
13495                         ;;
13496                 esac
13497                 ;;
13498         esac
13499         ;;
13500 esac
13501 case "$i32type" in
13502 '')     set try -DINT32
13503         if eval $compile; then
13504                 case "`$run ./try`" in
13505                 int32_t)
13506                         i32type=int32_t
13507                         u32type=uint32_t
13508                         i32size=4
13509                         u32size=4
13510                         ;;
13511                 esac
13512         fi
13513         ;;
13514 esac
13515 case "$i32type" in
13516 '')     if $test $intsize -ge 4; then
13517                 i32type=int
13518                 u32type="unsigned int"
13519                 i32size=$intsize
13520                 u32size=$intsize
13521         fi
13522         ;;
13523 esac
13524
13525 case "$i64type" in
13526 '')     case "$d_quad:$quadtype" in
13527         define:?*)
13528                 i64type="$quadtype"
13529                 u64type="$uquadtype"
13530                 i64size=8
13531                 u64size=8
13532                 ;;
13533         esac
13534         ;;
13535 esac
13536
13537 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
13538 : volatile so that the compiler has to store it out to memory.
13539 if test X"$d_volatile" = X"$define"; then
13540         volatile=volatile
13541 fi
13542 $cat <<EOP >try.c
13543 #include <stdio.h>
13544 #include <sys/types.h>
13545 #include <signal.h>
13546 #ifdef SIGFPE
13547 $volatile int bletched = 0;
13548 $signal_t blech(s) int s; { bletched = 1; }
13549 #endif
13550 int main() {
13551     $uvtype u = 0;
13552     $nvtype d;
13553     int     n = 8 * $uvsize;
13554     int     i;
13555 #ifdef SIGFPE
13556     signal(SIGFPE, blech);
13557 #endif
13558
13559     for (i = 0; i < n; i++) {
13560       u = u << 1 | ($uvtype)1;
13561       d = ($nvtype)u;
13562       if (($uvtype)d != u)
13563         break;
13564       if (d <= 0)
13565         break;
13566       d = ($nvtype)(u - 1);
13567       if (($uvtype)d != (u - 1))
13568         break;
13569 #ifdef SIGFPE
13570       if (bletched) {
13571         break;
13572 #endif
13573       } 
13574     }
13575     printf("%d\n", ((i == n) ? -n : i));
13576     exit(0);
13577 }
13578 EOP
13579 set try
13580
13581 d_nv_preserves_uv="$undef"
13582 if eval $compile; then
13583         nv_preserves_uv_bits="`$run ./try`"
13584 fi
13585 case "$nv_preserves_uv_bits" in
13586 \-[1-9]*)       
13587         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
13588         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
13589         d_nv_preserves_uv="$define"
13590         ;;
13591 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
13592         d_nv_preserves_uv="$undef" ;;
13593 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
13594         nv_preserves_uv_bits="$undef" ;;
13595 esac
13596
13597 $rm -f try.* try
13598
13599
13600 : check for off64_t
13601 echo " "
13602 echo "Checking to see if you have off64_t..." >&4
13603 $cat >try.c <<EOCP
13604 #include <sys/types.h>
13605 #include <unistd.h>
13606 int main() { off64_t x = 7; }
13607 EOCP
13608 set try
13609 if eval $compile; then
13610         val="$define"
13611         echo "You have off64_t."
13612 else
13613         val="$undef"
13614         echo "You do not have off64_t."
13615         case "$lseeksize" in
13616         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
13617         esac
13618 fi
13619 $rm -f try.* try
13620 set d_off64_t
13621 eval $setvar
13622
13623 : how to create joinable pthreads
13624 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
13625         echo " "
13626         echo "Checking what constant to use for creating joinable pthreads..." >&4 
13627         $cat >try.c <<'EOCP'
13628 #include <pthread.h>
13629 int main() {
13630     int detachstate = JOINABLE;
13631 }
13632 EOCP
13633         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
13634         if eval $compile; then
13635                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
13636                 val="$undef" # Yes, undef.
13637                 set d_old_pthread_create_joinable
13638                 eval $setvar
13639                 val=""
13640                 set old_pthread_create_joinable
13641                 eval $setvar
13642         else
13643                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
13644                 if eval $compile; then
13645                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
13646                         val="$define"
13647                         set d_old_pthread_create_joinable
13648                         eval $setvar
13649                         val=PTHREAD_CREATE_UNDETACHED
13650                         set old_pthread_create_joinable
13651                         eval $setvar
13652                 else            
13653                         set try -DJOINABLE=__UNDETACHED
13654                         if eval $compile; then
13655                                 echo "You seem to use __UNDETACHED." >&4
13656                                 val="$define"
13657                                 set d_old_pthread_create_joinable
13658                                 eval $setvar
13659                                 val=__UNDETACHED
13660                                 set old_pthread_create_joinable
13661                                 eval $setvar
13662                         else
13663                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
13664                                 val="$define"
13665                                 set d_old_pthread_create_joinable
13666                                 eval $setvar
13667                                 val=0
13668                                 set old_pthread_create_joinable
13669                                 eval $setvar
13670                         fi
13671                 fi
13672         fi
13673         $rm -f try try.*
13674 else
13675     d_old_pthread_create_joinable="$undef"
13676     old_pthread_create_joinable=""
13677 fi
13678
13679 : see if pause exists
13680 set pause d_pause
13681 eval $inlibc
13682
13683 : see if pipe exists
13684 set pipe d_pipe
13685 eval $inlibc
13686
13687 : see if poll exists
13688 set poll d_poll
13689 eval $inlibc
13690
13691 : see if readlink exists
13692 set readlink d_readlink
13693 eval $inlibc
13694
13695 echo " "
13696 procselfexe=''
13697 val="$undef"
13698 case "$d_readlink" in
13699 "$define")
13700         if $issymlink /proc/self/exe ; then
13701                 $ls -l /proc/self/exe > reflect
13702                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13703                         echo "You have Linux-like /proc/self/exe."
13704                         procselfexe='"/proc/self/exe"'
13705                         val="$define"
13706                 fi
13707         fi
13708         if $issymlink /proc/curproc/file ; then
13709                 $ls -l /proc/curproc/file > reflect
13710                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
13711                         echo "You have BSD-like /proc/curproc/file."
13712                         procselfexe='"/proc/curproc/file"'
13713                         val="$define"
13714                 fi
13715         fi
13716         ;;
13717 esac
13718 $rm -f reflect
13719 set d_procselfexe
13720 eval $setvar
13721
13722 : see whether the pthread_atfork exists
13723 $cat >try.c <<EOP
13724 #include <pthread.h>
13725 #include <stdio.h>
13726 int main() {
13727 #ifdef  PTHREAD_ATFORK
13728         pthread_atfork(NULL,NULL,NULL);
13729 #endif
13730 }
13731 EOP
13732
13733 : see if pthread_atfork exists
13734 set try -DPTHREAD_ATFORK
13735 if eval $compile; then
13736     val="$define"
13737 else
13738     val="$undef"
13739 fi
13740 case "$usethreads" in
13741 $define)
13742         case "$val" in
13743         $define) echo 'pthread_atfork found.' >&4        ;;
13744         *)       echo 'pthread_atfork NOT found.' >&4    ;;
13745         esac
13746 esac
13747 set d_pthread_atfork
13748 eval $setvar
13749
13750
13751 : see whether the various POSIXish _yields exist
13752 $cat >try.c <<EOP
13753 #include <pthread.h>
13754 #include <stdio.h>
13755 int main() {
13756 #ifdef SCHED_YIELD
13757         sched_yield();
13758 #else
13759 #ifdef PTHREAD_YIELD
13760         pthread_yield();
13761 #else
13762 #ifdef PTHREAD_YIELD_NULL
13763         pthread_yield(NULL);
13764 #endif
13765 #endif
13766 #endif
13767 }
13768 EOP
13769 : see if sched_yield exists
13770 set try -DSCHED_YIELD
13771 if eval $compile; then
13772     val="$define"
13773     sched_yield='sched_yield()'
13774 else
13775     val="$undef"
13776 fi
13777 case "$usethreads" in
13778 $define)
13779         case "$val" in
13780         $define) echo 'sched_yield() found.' >&4        ;;
13781         *)       echo 'sched_yield() NOT found.' >&4    ;;
13782         esac
13783 esac
13784 set d_sched_yield
13785 eval $setvar
13786
13787 : see if pthread_yield exists
13788 set try -DPTHREAD_YIELD
13789 if eval $compile; then
13790     val="$define"
13791     case "$sched_yield" in
13792     '') sched_yield='pthread_yield()' ;;
13793     esac
13794 else
13795     set try -DPTHREAD_YIELD_NULL
13796     if eval $compile; then
13797         val="$define"
13798         case "$sched_yield" in
13799         '') sched_yield='pthread_yield(NULL)' ;;
13800         esac
13801     else
13802         val="$undef"
13803     fi
13804 fi
13805 case "$usethreads" in
13806 $define)
13807         case "$val" in
13808         $define) echo 'pthread_yield() found.' >&4      ;;
13809         *)       echo 'pthread_yield() NOT found.' >&4  ;;
13810         esac
13811         ;;
13812 esac
13813 set d_pthread_yield
13814 eval $setvar
13815
13816 case "$sched_yield" in
13817 '') sched_yield=undef ;;
13818 esac
13819
13820 $rm -f try try.*
13821
13822 : see if random_r exists
13823 set random_r d_random_r
13824 eval $inlibc
13825 case "$d_random_r" in
13826 "$define")
13827         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
13828         case "$d_random_r_proto:$usethreads" in
13829         ":define")      d_random_r_proto=define
13830                 set d_random_r_proto random_r $hdrs
13831                 eval $hasproto ;;
13832         *)      ;;
13833         esac
13834         case "$d_random_r_proto" in
13835         define)
13836         case "$random_r_proto" in
13837         ''|0) try='int random_r(int*, struct random_data*);'
13838         ./protochk "extern $try" $hdrs && random_r_proto=I_TS ;;
13839         esac
13840         case "$random_r_proto" in
13841         ''|0)   d_random_r=undef
13842                 random_r_proto=0
13843                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
13844         * )     case "$random_r_proto" in
13845                 REENTRANT_PROTO*) ;;
13846                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
13847                 esac
13848                 echo "Prototype: $try" ;;
13849         esac
13850         ;;
13851         *)      case "$usethreads" in
13852                 define) echo "random_r has no prototype, not using it." >&4 ;;
13853                 esac
13854                 d_random_r=undef
13855                 random_r_proto=0
13856                 ;;
13857         esac
13858         ;;
13859 *)      random_r_proto=0
13860         ;;
13861 esac
13862
13863 : see if readdir and friends exist
13864 set readdir d_readdir
13865 eval $inlibc
13866 set seekdir d_seekdir
13867 eval $inlibc
13868 set telldir d_telldir
13869 eval $inlibc
13870 set rewinddir d_rewinddir
13871 eval $inlibc
13872
13873 : see if readdir64_r exists
13874 set readdir64_r d_readdir64_r
13875 eval $inlibc
13876 case "$d_readdir64_r" in
13877 "$define")
13878         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
13879         case "$d_readdir64_r_proto:$usethreads" in
13880         ":define")      d_readdir64_r_proto=define
13881                 set d_readdir64_r_proto readdir64_r $hdrs
13882                 eval $hasproto ;;
13883         *)      ;;
13884         esac
13885         case "$d_readdir64_r_proto" in
13886         define)
13887         case "$readdir64_r_proto" in
13888         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
13889         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
13890         esac
13891         case "$readdir64_r_proto" in
13892         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
13893         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
13894         esac
13895         case "$readdir64_r_proto" in
13896         ''|0)   d_readdir64_r=undef
13897                 readdir64_r_proto=0
13898                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
13899         * )     case "$readdir64_r_proto" in
13900                 REENTRANT_PROTO*) ;;
13901                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
13902                 esac
13903                 echo "Prototype: $try" ;;
13904         esac
13905         ;;
13906         *)      case "$usethreads" in
13907                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
13908                 esac
13909                 d_readdir64_r=undef
13910                 readdir64_r_proto=0
13911                 ;;
13912         esac
13913         ;;
13914 *)      readdir64_r_proto=0
13915         ;;
13916 esac
13917
13918 : see if readdir_r exists
13919 set readdir_r d_readdir_r
13920 eval $inlibc
13921 case "$d_readdir_r" in
13922 "$define")
13923         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
13924         case "$d_readdir_r_proto:$usethreads" in
13925         ":define")      d_readdir_r_proto=define
13926                 set d_readdir_r_proto readdir_r $hdrs
13927                 eval $hasproto ;;
13928         *)      ;;
13929         esac
13930         case "$d_readdir_r_proto" in
13931         define)
13932         case "$readdir_r_proto" in
13933         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
13934         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
13935         esac
13936         case "$readdir_r_proto" in
13937         ''|0) try='int readdir_r(DIR*, struct dirent*);'
13938         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
13939         esac
13940         case "$readdir_r_proto" in
13941         ''|0)   d_readdir_r=undef
13942                 readdir_r_proto=0
13943                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
13944         * )     case "$readdir_r_proto" in
13945                 REENTRANT_PROTO*) ;;
13946                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
13947                 esac
13948                 echo "Prototype: $try" ;;
13949         esac
13950         ;;
13951         *)      case "$usethreads" in
13952                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
13953                 esac
13954                 d_readdir_r=undef
13955                 readdir_r_proto=0
13956                 ;;
13957         esac
13958         ;;
13959 *)      readdir_r_proto=0
13960         ;;
13961 esac
13962
13963 : see if readv exists
13964 set readv d_readv
13965 eval $inlibc
13966
13967 : see if recvmsg exists
13968 set recvmsg d_recvmsg
13969 eval $inlibc
13970
13971 : see if rename exists
13972 set rename d_rename
13973 eval $inlibc
13974
13975 : see if rmdir exists
13976 set rmdir d_rmdir
13977 eval $inlibc
13978
13979 : see if memory.h is available.
13980 val=''
13981 set memory.h val
13982 eval $inhdr
13983
13984 : See if it conflicts with string.h
13985 case "$val" in
13986 $define)
13987         case "$strings" in
13988         '') ;;
13989         *)
13990                 $cppstdin $cppflags $cppminus < $strings > mem.h
13991                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
13992                         echo " "
13993                         echo "We won't be including <memory.h>."
13994                         val="$undef"
13995                 fi
13996                 $rm -f mem.h
13997                 ;;
13998         esac
13999 esac
14000 set i_memory
14001 eval $setvar
14002
14003 : can bcopy handle overlapping blocks?
14004 echo " "
14005 val="$undef"
14006 case "$d_memmove" in
14007 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
14008 *)      case "$d_bcopy" in
14009         "$define")
14010                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
14011                 $cat >try.c <<EOCP
14012 #$i_memory I_MEMORY
14013 #$i_stdlib I_STDLIB
14014 #$i_string I_STRING
14015 #$i_unistd I_UNISTD
14016 EOCP
14017         $cat >>try.c <<'EOCP'
14018 #include <stdio.h>
14019 #ifdef I_MEMORY
14020 #  include <memory.h>
14021 #endif
14022 #ifdef I_STDLIB
14023 #  include <stdlib.h>
14024 #endif
14025 #ifdef I_STRING
14026 #  include <string.h>
14027 #else
14028 #  include <strings.h>
14029 #endif
14030 #ifdef I_UNISTD
14031 #  include <unistd.h>  /* Needed for NetBSD */
14032 #endif
14033 int main()
14034 {
14035 char buf[128], abc[128];
14036 char *b;
14037 int len;
14038 int off;
14039 int align;
14040
14041 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14042    try to store the string in read-only memory. */
14043 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
14044
14045 for (align = 7; align >= 0; align--) {
14046         for (len = 36; len; len--) {
14047                 b = buf+align;
14048                 bcopy(abc, b, len);
14049                 for (off = 1; off <= len; off++) {
14050                         bcopy(b, b+off, len);
14051                         bcopy(b+off, b, len);
14052                         if (bcmp(b, abc, len))
14053                                 exit(1);
14054                 }
14055         }
14056 }
14057 exit(0);
14058 }
14059 EOCP
14060                 set try
14061                 if eval $compile_ok; then
14062                         if ./try 2>/dev/null; then
14063                                 echo "Yes, it can."
14064                                 val="$define"
14065                         else
14066                                 echo "It can't, sorry."
14067                         fi
14068                 else
14069                         echo "(I can't compile the test program, so we'll assume not...)"
14070                 fi
14071                 ;;
14072         esac
14073         $rm -f try.* try core
14074         ;;
14075 esac
14076 set d_safebcpy
14077 eval $setvar
14078
14079 : can memcpy handle overlapping blocks?
14080 echo " "
14081 val="$undef"
14082 case "$d_memmove" in
14083 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
14084 *)      case "$d_memcpy" in
14085         "$define")
14086                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
14087                 $cat >try.c <<EOCP
14088 #$i_memory I_MEMORY
14089 #$i_stdlib I_STDLIB
14090 #$i_string I_STRING
14091 #$i_unistd I_UNISTD
14092 EOCP
14093         $cat >>try.c <<'EOCP'
14094 #include <stdio.h>
14095 #ifdef I_MEMORY
14096 #  include <memory.h>
14097 #endif
14098 #ifdef I_STDLIB
14099 #  include <stdlib.h>
14100 #endif
14101 #ifdef I_STRING
14102 #  include <string.h>
14103 #else
14104 #  include <strings.h>
14105 #endif
14106 #ifdef I_UNISTD
14107 #  include <unistd.h>  /* Needed for NetBSD */
14108 #endif
14109 int main()
14110 {
14111 char buf[128], abc[128];
14112 char *b;
14113 int len;
14114 int off;
14115 int align;
14116
14117 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14118    try to store the string in read-only memory. */
14119 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
14120
14121 for (align = 7; align >= 0; align--) {
14122         for (len = 36; len; len--) {
14123                 b = buf+align;
14124                 memcpy(b, abc, len);
14125                 for (off = 1; off <= len; off++) {
14126                         memcpy(b+off, b, len);
14127                         memcpy(b, b+off, len);
14128                         if (memcmp(b, abc, len))
14129                                 exit(1);
14130                 }
14131         }
14132 }
14133 exit(0);
14134 }
14135 EOCP
14136                 set try
14137                 if eval $compile_ok; then
14138                         if ./try 2>/dev/null; then
14139                                 echo "Yes, it can."
14140                                 val="$define"
14141                         else
14142                                 echo "It can't, sorry."
14143                         fi
14144                 else
14145                         echo "(I can't compile the test program, so we'll assume not...)"
14146                 fi
14147                 ;;
14148         esac
14149         $rm -f try.* try core
14150         ;;
14151 esac
14152 set d_safemcpy
14153 eval $setvar
14154
14155 : can memcmp be trusted to compare relative magnitude?
14156 val="$undef"
14157 case "$d_memcmp" in
14158 "$define")
14159         echo " "
14160         echo "Checking if your memcmp() can compare relative magnitude..." >&4
14161         $cat >try.c <<EOCP
14162 #$i_memory I_MEMORY
14163 #$i_stdlib I_STDLIB
14164 #$i_string I_STRING
14165 #$i_unistd I_UNISTD
14166 EOCP
14167         $cat >>try.c <<'EOCP'
14168 #include <stdio.h>
14169 #ifdef I_MEMORY
14170 #  include <memory.h>
14171 #endif
14172 #ifdef I_STDLIB
14173 #  include <stdlib.h>
14174 #endif
14175 #ifdef I_STRING
14176 #  include <string.h>
14177 #else
14178 #  include <strings.h>
14179 #endif
14180 #ifdef I_UNISTD
14181 #  include <unistd.h>  /* Needed for NetBSD */
14182 #endif
14183 int main()
14184 {
14185 char a = -1;
14186 char b = 0;
14187 if ((a < b) && memcmp(&a, &b, 1) < 0)
14188         exit(1);
14189 exit(0);
14190 }
14191 EOCP
14192         set try
14193         if eval $compile_ok; then
14194                 if $run ./try 2>/dev/null; then
14195                         echo "Yes, it can."
14196                         val="$define"
14197                 else
14198                         echo "No, it can't (it uses signed chars)."
14199                 fi
14200         else
14201                 echo "(I can't compile the test program, so we'll assume not...)"
14202         fi
14203         ;;
14204 esac
14205 $rm -f try.* try core
14206 set d_sanemcmp
14207 eval $setvar
14208
14209 : see if prototype for sbrk is available
14210 echo " "
14211 set d_sbrkproto sbrk $i_unistd unistd.h
14212 eval $hasproto
14213
14214 : see if select exists
14215 set select d_select
14216 eval $inlibc
14217
14218 : see if semctl exists
14219 set semctl d_semctl
14220 eval $inlibc
14221
14222 : see if semget exists
14223 set semget d_semget
14224 eval $inlibc
14225
14226 : see if semop exists
14227 set semop d_semop
14228 eval $inlibc
14229
14230 : see how much of the 'sem*(2)' library is present.
14231 h_sem=true
14232 echo " "
14233 case "$d_semctl$d_semget$d_semop" in
14234 *"$undef"*) h_sem=false;;
14235 esac
14236 case "$osname" in
14237 freebsd)
14238     case "`ipcs 2>&1`" in
14239     "SVID messages"*"not configured"*)
14240         echo "Your $osname does not have the sem*(2) configured." >&4
14241         h_sem=false
14242         val="$undef"
14243         set semctl d_semctl
14244         eval $setvar
14245         set semget d_semget
14246         eval $setvar
14247         set semop d_semop
14248         eval $setvar
14249         ;;
14250     esac
14251     ;;
14252 esac
14253 : we could also check for sys/ipc.h ...
14254 if $h_sem && $test `./findhdr sys/sem.h`; then
14255         echo "You have the full sem*(2) library." >&4
14256         val="$define"
14257 else
14258         echo "You don't have the full sem*(2) library." >&4
14259         val="$undef"
14260 fi
14261 set d_sem
14262 eval $setvar
14263
14264 : see whether sys/sem.h defines union semun
14265 echo " "
14266 $cat > try.c <<'END'
14267 #include <sys/types.h>
14268 #include <sys/ipc.h>
14269 #include <sys/sem.h>
14270 int main () { union semun semun; semun.buf = 0; }
14271 END
14272 set try
14273 if eval $compile; then
14274     echo "You have union semun in <sys/sem.h>." >&4
14275     val="$define"
14276 else
14277     echo "You do not have union semun in <sys/sem.h>." >&4
14278     val="$undef"
14279 fi
14280 $rm -f try try.c try.h
14281 set d_union_semun
14282 eval $setvar
14283
14284 : see how to do semctl IPC_STAT
14285 case "$d_sem" in
14286 $define)
14287     : see whether semctl IPC_STAT can use union semun
14288     echo " "
14289     $cat > try.h <<END
14290 #ifndef S_IRUSR
14291 #   ifdef S_IREAD
14292 #       define S_IRUSR S_IREAD
14293 #       define S_IWUSR S_IWRITE
14294 #       define S_IXUSR S_IEXEC
14295 #   else
14296 #       define S_IRUSR 0400
14297 #       define S_IWUSR 0200
14298 #       define S_IXUSR 0100
14299 #   endif
14300 #   define S_IRGRP (S_IRUSR>>3)
14301 #   define S_IWGRP (S_IWUSR>>3)
14302 #   define S_IXGRP (S_IXUSR>>3)
14303 #   define S_IROTH (S_IRUSR>>6)
14304 #   define S_IWOTH (S_IWUSR>>6)
14305 #   define S_IXOTH (S_IXUSR>>6)
14306 #endif
14307 #ifndef S_IRWXU
14308 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
14309 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
14310 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
14311 #endif
14312 END
14313
14314     $cat > try.c <<END
14315 #include <sys/types.h>
14316 #include <sys/ipc.h>
14317 #include <sys/sem.h>
14318 #include <sys/stat.h>
14319 #include <stdio.h>
14320 #include <errno.h>
14321 #include "try.h"
14322 #ifndef errno
14323 extern int errno;
14324 #endif
14325 #$d_union_semun HAS_UNION_SEMUN
14326 int main() {
14327     union semun
14328 #ifndef HAS_UNION_SEMUN
14329     {
14330         int val;
14331         struct semid_ds *buf;
14332         unsigned short *array;
14333     }
14334 #endif
14335     arg;
14336     int sem, st;
14337
14338 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
14339     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14340     if (sem > -1) {
14341         struct semid_ds argbuf;
14342         arg.buf = &argbuf;
14343 #       ifdef IPC_STAT
14344         st = semctl(sem, 0, IPC_STAT, arg);
14345         if (st == 0)
14346             printf("semun\n");
14347         else
14348 #       endif /* IPC_STAT */
14349             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14350 #       ifdef IPC_RMID
14351         if (semctl(sem, 0, IPC_RMID, arg) != 0)
14352 #       endif /* IPC_RMID */
14353             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14354     } else
14355 #endif /* IPC_PRIVATE && ... */
14356         printf("semget failed: errno = %d\n", errno);
14357   return 0;
14358 }
14359 END
14360     val="$undef"
14361     set try
14362     if eval $compile; then
14363         xxx=`$run ./try`
14364         case "$xxx" in
14365         semun) val="$define" ;;
14366         esac
14367     fi
14368     $rm -f try try.c
14369     set d_semctl_semun
14370     eval $setvar
14371     case "$d_semctl_semun" in
14372     $define)
14373         echo "You can use union semun for semctl IPC_STAT." >&4
14374         also='also'
14375         ;;
14376     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
14377         also=''
14378         ;;
14379     esac
14380
14381     : see whether semctl IPC_STAT can use struct semid_ds pointer
14382     $cat > try.c <<'END'
14383 #include <sys/types.h>
14384 #include <sys/ipc.h>
14385 #include <sys/sem.h>
14386 #include <sys/stat.h>
14387 #include "try.h"
14388 #include <stdio.h>
14389 #include <errno.h>
14390 #ifndef errno
14391 extern int errno;
14392 #endif
14393 int main() {
14394     struct semid_ds arg;
14395     int sem, st;
14396
14397 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
14398     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14399     if (sem > -1) {
14400 #       ifdef IPC_STAT
14401         st = semctl(sem, 0, IPC_STAT, &arg);
14402         if (st == 0)
14403             printf("semid_ds\n");
14404         else
14405 #       endif /* IPC_STAT */
14406             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14407 #       ifdef IPC_RMID
14408         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
14409 #       endif /* IPC_RMID */
14410             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14411     } else
14412 #endif /* IPC_PRIVATE && ... */
14413         printf("semget failed: errno = %d\n", errno);
14414
14415     return 0;
14416 }
14417 END
14418     val="$undef"
14419     set try
14420     if eval $compile; then
14421         xxx=`$run ./try`
14422         case "$xxx" in
14423         semid_ds) val="$define" ;;
14424         esac
14425     fi
14426     $rm -f try try.c
14427     set d_semctl_semid_ds
14428     eval $setvar
14429     case "$d_semctl_semid_ds" in
14430     $define)
14431         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
14432         ;;
14433     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
14434         ;;
14435     esac
14436     $rm -f try.h
14437     ;;
14438 *)  val="$undef"
14439
14440     # We do not have the full sem*(2) library, so assume we can not
14441     # use either.
14442
14443     set d_semctl_semun
14444     eval $setvar
14445
14446     set d_semctl_semid_ds
14447     eval $setvar
14448     ;;
14449 esac
14450
14451 : see if sendmsg exists
14452 set sendmsg d_sendmsg
14453 eval $inlibc
14454
14455 : see if setegid exists
14456 set setegid d_setegid
14457 eval $inlibc
14458
14459 : see if seteuid exists
14460 set seteuid d_seteuid
14461 eval $inlibc
14462
14463 : see if setgrent exists
14464 set setgrent d_setgrent
14465 eval $inlibc
14466
14467 : see if setgrent_r exists
14468 set setgrent_r d_setgrent_r
14469 eval $inlibc
14470 case "$d_setgrent_r" in
14471 "$define")
14472         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14473         case "$d_setgrent_r_proto:$usethreads" in
14474         ":define")      d_setgrent_r_proto=define
14475                 set d_setgrent_r_proto setgrent_r $hdrs
14476                 eval $hasproto ;;
14477         *)      ;;
14478         esac
14479         case "$d_setgrent_r_proto" in
14480         define)
14481         case "$setgrent_r_proto" in
14482         ''|0) try='int setgrent_r(FILE**);'
14483         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
14484         esac
14485         case "$setgrent_r_proto" in
14486         ''|0) try='void setgrent_r(FILE**);'
14487         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
14488         esac
14489         case "$setgrent_r_proto" in
14490         ''|0)   d_setgrent_r=undef
14491                 setgrent_r_proto=0
14492                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
14493         * )     case "$setgrent_r_proto" in
14494                 REENTRANT_PROTO*) ;;
14495                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
14496                 esac
14497                 echo "Prototype: $try" ;;
14498         esac
14499         ;;
14500         *)      case "$usethreads" in
14501                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
14502                 esac
14503                 d_setgrent_r=undef
14504                 setgrent_r_proto=0
14505                 ;;
14506         esac
14507         ;;
14508 *)      setgrent_r_proto=0
14509         ;;
14510 esac
14511
14512 : see if sethostent exists
14513 set sethostent d_sethent
14514 eval $inlibc
14515
14516 : see if sethostent_r exists
14517 set sethostent_r d_sethostent_r
14518 eval $inlibc
14519 case "$d_sethostent_r" in
14520 "$define")
14521         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14522         case "$d_sethostent_r_proto:$usethreads" in
14523         ":define")      d_sethostent_r_proto=define
14524                 set d_sethostent_r_proto sethostent_r $hdrs
14525                 eval $hasproto ;;
14526         *)      ;;
14527         esac
14528         case "$d_sethostent_r_proto" in
14529         define)
14530         case "$sethostent_r_proto" in
14531         ''|0) try='int sethostent_r(int, struct hostent_data*);'
14532         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
14533         esac
14534         case "$sethostent_r_proto" in
14535         ''|0) try='void sethostent_r(int, struct hostent_data*);'
14536         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
14537         esac
14538         case "$sethostent_r_proto" in
14539         ''|0)   d_sethostent_r=undef
14540                 sethostent_r_proto=0
14541                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
14542         * )     case "$sethostent_r_proto" in
14543                 REENTRANT_PROTO*) ;;
14544                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
14545                 esac
14546                 echo "Prototype: $try" ;;
14547         esac
14548         ;;
14549         *)      case "$usethreads" in
14550                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
14551                 esac
14552                 d_sethostent_r=undef
14553                 sethostent_r_proto=0
14554                 ;;
14555         esac
14556         ;;
14557 *)      sethostent_r_proto=0
14558         ;;
14559 esac
14560
14561 : see if setitimer exists
14562 set setitimer d_setitimer
14563 eval $inlibc
14564
14565 : see if setlinebuf exists
14566 set setlinebuf d_setlinebuf
14567 eval $inlibc
14568
14569 : see if setlocale exists
14570 set setlocale d_setlocale
14571 eval $inlibc
14572
14573 : see if locale.h is available
14574 set locale.h i_locale
14575 eval $inhdr
14576
14577 : see if setlocale_r exists
14578 set setlocale_r d_setlocale_r
14579 eval $inlibc
14580 case "$d_setlocale_r" in
14581 "$define")
14582         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
14583         case "$d_setlocale_r_proto:$usethreads" in
14584         ":define")      d_setlocale_r_proto=define
14585                 set d_setlocale_r_proto setlocale_r $hdrs
14586                 eval $hasproto ;;
14587         *)      ;;
14588         esac
14589         case "$d_setlocale_r_proto" in
14590         define)
14591         case "$setlocale_r_proto" in
14592         ''|0) try='int setlocale_r(int, const char*, char*, int);'
14593         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
14594         esac
14595         case "$setlocale_r_proto" in
14596         ''|0)   d_setlocale_r=undef
14597                 setlocale_r_proto=0
14598                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
14599         * )     case "$setlocale_r_proto" in
14600                 REENTRANT_PROTO*) ;;
14601                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
14602                 esac
14603                 echo "Prototype: $try" ;;
14604         esac
14605         ;;
14606         *)      case "$usethreads" in
14607                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
14608                 esac
14609                 d_setlocale_r=undef
14610                 setlocale_r_proto=0
14611                 ;;
14612         esac
14613         ;;
14614 *)      setlocale_r_proto=0
14615         ;;
14616 esac
14617
14618 : see if setnetent exists
14619 set setnetent d_setnent
14620 eval $inlibc
14621
14622 : see if setnetent_r exists
14623 set setnetent_r d_setnetent_r
14624 eval $inlibc
14625 case "$d_setnetent_r" in
14626 "$define")
14627         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14628         case "$d_setnetent_r_proto:$usethreads" in
14629         ":define")      d_setnetent_r_proto=define
14630                 set d_setnetent_r_proto setnetent_r $hdrs
14631                 eval $hasproto ;;
14632         *)      ;;
14633         esac
14634         case "$d_setnetent_r_proto" in
14635         define)
14636         case "$setnetent_r_proto" in
14637         ''|0) try='int setnetent_r(int, struct netent_data*);'
14638         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
14639         esac
14640         case "$setnetent_r_proto" in
14641         ''|0) try='void setnetent_r(int, struct netent_data*);'
14642         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
14643         esac
14644         case "$setnetent_r_proto" in
14645         ''|0)   d_setnetent_r=undef
14646                 setnetent_r_proto=0
14647                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
14648         * )     case "$setnetent_r_proto" in
14649                 REENTRANT_PROTO*) ;;
14650                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
14651                 esac
14652                 echo "Prototype: $try" ;;
14653         esac
14654         ;;
14655         *)      case "$usethreads" in
14656                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
14657                 esac
14658                 d_setnetent_r=undef
14659                 setnetent_r_proto=0
14660                 ;;
14661         esac
14662         ;;
14663 *)      setnetent_r_proto=0
14664         ;;
14665 esac
14666
14667 : see if setprotoent exists
14668 set setprotoent d_setpent
14669 eval $inlibc
14670
14671 : see if setpgid exists
14672 set setpgid d_setpgid
14673 eval $inlibc
14674
14675 : see if setpgrp2 exists
14676 set setpgrp2 d_setpgrp2
14677 eval $inlibc
14678
14679 : see if setpriority exists
14680 set setpriority d_setprior
14681 eval $inlibc
14682
14683 : see if setproctitle exists
14684 set setproctitle d_setproctitle
14685 eval $inlibc
14686
14687 : see if setprotoent_r exists
14688 set setprotoent_r d_setprotoent_r
14689 eval $inlibc
14690 case "$d_setprotoent_r" in
14691 "$define")
14692         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14693         case "$d_setprotoent_r_proto:$usethreads" in
14694         ":define")      d_setprotoent_r_proto=define
14695                 set d_setprotoent_r_proto setprotoent_r $hdrs
14696                 eval $hasproto ;;
14697         *)      ;;
14698         esac
14699         case "$d_setprotoent_r_proto" in
14700         define)
14701         case "$setprotoent_r_proto" in
14702         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
14703         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
14704         esac
14705         case "$setprotoent_r_proto" in
14706         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
14707         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
14708         esac
14709         case "$setprotoent_r_proto" in
14710         ''|0)   d_setprotoent_r=undef
14711                 setprotoent_r_proto=0
14712                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
14713         * )     case "$setprotoent_r_proto" in
14714                 REENTRANT_PROTO*) ;;
14715                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
14716                 esac
14717                 echo "Prototype: $try" ;;
14718         esac
14719         ;;
14720         *)      case "$usethreads" in
14721                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
14722                 esac
14723                 d_setprotoent_r=undef
14724                 setprotoent_r_proto=0
14725                 ;;
14726         esac
14727         ;;
14728 *)      setprotoent_r_proto=0
14729         ;;
14730 esac
14731
14732 : see if setpwent exists
14733 set setpwent d_setpwent
14734 eval $inlibc
14735
14736 : see if setpwent_r exists
14737 set setpwent_r d_setpwent_r
14738 eval $inlibc
14739 case "$d_setpwent_r" in
14740 "$define")
14741         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14742         case "$d_setpwent_r_proto:$usethreads" in
14743         ":define")      d_setpwent_r_proto=define
14744                 set d_setpwent_r_proto setpwent_r $hdrs
14745                 eval $hasproto ;;
14746         *)      ;;
14747         esac
14748         case "$d_setpwent_r_proto" in
14749         define)
14750         case "$setpwent_r_proto" in
14751         ''|0) try='int setpwent_r(FILE**);'
14752         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
14753         esac
14754         case "$setpwent_r_proto" in
14755         ''|0) try='void setpwent_r(FILE**);'
14756         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
14757         esac
14758         case "$setpwent_r_proto" in
14759         ''|0)   d_setpwent_r=undef
14760                 setpwent_r_proto=0
14761                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
14762         * )     case "$setpwent_r_proto" in
14763                 REENTRANT_PROTO*) ;;
14764                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
14765                 esac
14766                 echo "Prototype: $try" ;;
14767         esac
14768         ;;
14769         *)      case "$usethreads" in
14770                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
14771                 esac
14772                 d_setpwent_r=undef
14773                 setpwent_r_proto=0
14774                 ;;
14775         esac
14776         ;;
14777 *)      setpwent_r_proto=0
14778         ;;
14779 esac
14780
14781 : see if setregid exists
14782 set setregid d_setregid
14783 eval $inlibc
14784 set setresgid d_setresgid
14785 eval $inlibc
14786
14787 : see if setreuid exists
14788 set setreuid d_setreuid
14789 eval $inlibc
14790 set setresuid d_setresuid
14791 eval $inlibc
14792
14793 : see if setrgid exists
14794 set setrgid d_setrgid
14795 eval $inlibc
14796
14797 : see if setruid exists
14798 set setruid d_setruid
14799 eval $inlibc
14800
14801 : see if setservent exists
14802 set setservent d_setsent
14803 eval $inlibc
14804
14805 : see if setservent_r exists
14806 set setservent_r d_setservent_r
14807 eval $inlibc
14808 case "$d_setservent_r" in
14809 "$define")
14810         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14811         case "$d_setservent_r_proto:$usethreads" in
14812         ":define")      d_setservent_r_proto=define
14813                 set d_setservent_r_proto setservent_r $hdrs
14814                 eval $hasproto ;;
14815         *)      ;;
14816         esac
14817         case "$d_setservent_r_proto" in
14818         define)
14819         case "$setservent_r_proto" in
14820         ''|0) try='int setservent_r(int, struct servent_data*);'
14821         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
14822         esac
14823         case "$setservent_r_proto" in
14824         ''|0) try='void setservent_r(int, struct servent_data*);'
14825         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
14826         esac
14827         case "$setservent_r_proto" in
14828         ''|0)   d_setservent_r=undef
14829                 setservent_r_proto=0
14830                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
14831         * )     case "$setservent_r_proto" in
14832                 REENTRANT_PROTO*) ;;
14833                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
14834                 esac
14835                 echo "Prototype: $try" ;;
14836         esac
14837         ;;
14838         *)      case "$usethreads" in
14839                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
14840                 esac
14841                 d_setservent_r=undef
14842                 setservent_r_proto=0
14843                 ;;
14844         esac
14845         ;;
14846 *)      setservent_r_proto=0
14847         ;;
14848 esac
14849
14850 : see if setsid exists
14851 set setsid d_setsid
14852 eval $inlibc
14853
14854 : see if setvbuf exists
14855 set setvbuf d_setvbuf
14856 eval $inlibc
14857
14858 : see if sfio.h is available
14859 set sfio.h i_sfio
14860 eval $inhdr
14861
14862
14863 : see if sfio library is available
14864 case "$i_sfio" in
14865 $define)
14866         val=''
14867         set sfreserve val
14868         eval $inlibc
14869         ;;
14870 *)
14871         val="$undef"
14872         ;;
14873 esac
14874 : Ok, but do we want to use it.
14875 case "$val" in
14876 $define)
14877         case "$usesfio" in
14878         true|$define|[yY]*) dflt='y';;
14879         *) dflt='n';;
14880         esac
14881         echo "$package can use the sfio library, but it is experimental."
14882         case "$useperlio" in
14883         "$undef")
14884             echo "For sfio also the PerlIO abstraction layer is needed."
14885             echo "Earlier you said you wouldn't want that."
14886             ;;
14887         esac
14888         rp="You seem to have sfio available, do you want to try using it?"
14889         . ./myread
14890         case "$ans" in
14891         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
14892                 useperlio="$define"
14893                 val="$define"
14894                 ;;
14895         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
14896                 val="$undef"
14897                 ;;
14898         esac
14899         ;;
14900 *)      case "$usesfio" in
14901         true|$define|[yY]*)
14902                 echo "Sorry, cannot find sfio on this machine." >&4
14903                 echo "Ignoring your setting of usesfio=$usesfio." >&4
14904                 val="$undef"
14905                 ;;
14906         esac
14907         ;;
14908 esac
14909 set d_sfio
14910 eval $setvar
14911 case "$d_sfio" in
14912 $define) usesfio='true';;
14913 *) usesfio='false';;
14914 esac
14915 case "$d_sfio" in
14916 $define) ;;
14917 *)      : Remove sfio from list of libraries to use
14918         case "$libs" in
14919         *-lsfio*)
14920                 echo "Removing unneeded -lsfio from library list" >&4
14921                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
14922                 shift
14923                 libs="$*"
14924                 echo "libs = $libs" >&4
14925                 ;;
14926         esac
14927 ;;
14928 esac
14929
14930
14931 : see if shmctl exists
14932 set shmctl d_shmctl
14933 eval $inlibc
14934
14935 : see if shmget exists
14936 set shmget d_shmget
14937 eval $inlibc
14938
14939 : see if shmat exists
14940 set shmat d_shmat
14941 eval $inlibc
14942 : see what shmat returns
14943 case "$d_shmat" in
14944 "$define")
14945         $cat >shmat.c <<'END'
14946 #include <sys/shm.h>
14947 void *shmat();
14948 END
14949         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
14950                 shmattype='void *'
14951         else
14952                 shmattype='char *'
14953         fi
14954         echo "and it returns ($shmattype)." >&4
14955         : see if a prototype for shmat is available
14956         xxx=`./findhdr sys/shm.h`
14957         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
14958         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
14959                 val="$define"
14960         else
14961                 val="$undef"
14962         fi
14963         $rm -f shmat.[co]
14964         ;;
14965 *)
14966         val="$undef"
14967         ;;
14968 esac
14969 set d_shmatprototype
14970 eval $setvar
14971
14972 : see if shmdt exists
14973 set shmdt d_shmdt
14974 eval $inlibc
14975
14976 : see how much of the 'shm*(2)' library is present.
14977 h_shm=true
14978 echo " "
14979 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
14980 *"$undef"*) h_shm=false;;
14981 esac
14982 case "$osname" in
14983 freebsd)
14984     case "`ipcs 2>&1`" in
14985     "SVID shared memory"*"not configured"*)
14986         echo "Your $osname does not have the shm*(2) configured." >&4
14987         h_shm=false
14988         val="$undef"
14989         set shmctl d_shmctl
14990         evat $setvar
14991         set shmget d_shmget
14992         evat $setvar
14993         set shmat d_shmat
14994         evat $setvar
14995         set shmdt d_shmdt
14996         evat $setvar
14997         ;;
14998     esac
14999     ;;
15000 esac
15001 : we could also check for sys/ipc.h ...
15002 if $h_shm && $test `./findhdr sys/shm.h`; then
15003         echo "You have the full shm*(2) library." >&4
15004         val="$define"
15005 else
15006         echo "You don't have the full shm*(2) library." >&4
15007         val="$undef"
15008 fi
15009 set d_shm
15010 eval $setvar
15011
15012 echo " "
15013 : see if we have sigaction
15014 if set sigaction val -f d_sigaction; eval $csym; $val; then
15015         echo 'sigaction() found.' >&4
15016         $cat > try.c <<'EOP'
15017 #include <stdio.h>
15018 #include <sys/types.h>
15019 #include <signal.h>
15020 int main()
15021 {
15022     struct sigaction act, oact;
15023     act.sa_flags = 0;
15024     oact.sa_handler = 0;
15025     /* so that act and oact are used */
15026     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
15027 }
15028 EOP
15029         set try
15030         if eval $compile_ok; then
15031                 val="$define"
15032         else
15033                 echo "But you don't seem to have a useable struct sigaction." >&4
15034                 val="$undef"
15035         fi
15036 else
15037         echo 'sigaction NOT found.' >&4
15038         val="$undef"
15039 fi
15040 set d_sigaction; eval $setvar
15041 $rm -f try try$_o try.c
15042
15043 : see if sigprocmask exists
15044 set sigprocmask d_sigprocmask
15045 eval $inlibc
15046
15047 : see if sigsetjmp exists
15048 echo " "
15049 case "$d_sigsetjmp" in
15050 '')
15051         $cat >try.c <<'EOP'
15052 #include <setjmp.h>
15053 sigjmp_buf env;
15054 int set = 1;
15055 int main()
15056 {
15057         if (sigsetjmp(env,1))
15058                 exit(set);
15059         set = 0;
15060         siglongjmp(env, 1);
15061         exit(1);
15062 }
15063 EOP
15064         set try
15065         if eval $compile; then
15066                 if $run ./try >/dev/null 2>&1; then
15067                         echo "POSIX sigsetjmp found." >&4
15068                         val="$define"
15069                 else
15070                         $cat >&4 <<EOM
15071 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
15072 I'll ignore them.
15073 EOM
15074                         val="$undef"
15075                 fi
15076         else
15077                 echo "sigsetjmp not found." >&4
15078                 val="$undef"
15079         fi
15080         ;;
15081 *) val="$d_sigsetjmp"
15082         case "$d_sigsetjmp" in
15083         $define) echo "POSIX sigsetjmp found." >&4;;
15084         $undef) echo "sigsetjmp not found." >&4;;
15085         esac
15086         ;;
15087 esac
15088 set d_sigsetjmp
15089 eval $setvar
15090 $rm -f try.c try
15091
15092 : see if sockatmark exists
15093 set sockatmark d_sockatmark
15094 eval $inlibc
15095
15096 : see if prototype for sockatmark is available
15097 echo " "
15098 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
15099 eval $hasproto
15100
15101 : see if socks5_init exists
15102 set socks5_init d_socks5_init
15103 eval $inlibc
15104
15105 : see if srand48_r exists
15106 set srand48_r d_srand48_r
15107 eval $inlibc
15108 case "$d_srand48_r" in
15109 "$define")
15110         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15111         case "$d_srand48_r_proto:$usethreads" in
15112         ":define")      d_srand48_r_proto=define
15113                 set d_srand48_r_proto srand48_r $hdrs
15114                 eval $hasproto ;;
15115         *)      ;;
15116         esac
15117         case "$d_srand48_r_proto" in
15118         define)
15119         case "$srand48_r_proto" in
15120         ''|0) try='int srand48_r(long, struct drand48_data*);'
15121         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
15122         esac
15123         case "$srand48_r_proto" in
15124         ''|0)   d_srand48_r=undef
15125                 srand48_r_proto=0
15126                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
15127         * )     case "$srand48_r_proto" in
15128                 REENTRANT_PROTO*) ;;
15129                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
15130                 esac
15131                 echo "Prototype: $try" ;;
15132         esac
15133         ;;
15134         *)      case "$usethreads" in
15135                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
15136                 esac
15137                 d_srand48_r=undef
15138                 srand48_r_proto=0
15139                 ;;
15140         esac
15141         ;;
15142 *)      srand48_r_proto=0
15143         ;;
15144 esac
15145
15146 : see if srandom_r exists
15147 set srandom_r d_srandom_r
15148 eval $inlibc
15149 case "$d_srandom_r" in
15150 "$define")
15151         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15152         case "$d_srandom_r_proto:$usethreads" in
15153         ":define")      d_srandom_r_proto=define
15154                 set d_srandom_r_proto srandom_r $hdrs
15155                 eval $hasproto ;;
15156         *)      ;;
15157         esac
15158         case "$d_srandom_r_proto" in
15159         define)
15160         case "$srandom_r_proto" in
15161         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
15162         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
15163         esac
15164         case "$srandom_r_proto" in
15165         ''|0)   d_srandom_r=undef
15166                 srandom_r_proto=0
15167                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
15168         * )     case "$srandom_r_proto" in
15169                 REENTRANT_PROTO*) ;;
15170                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
15171                 esac
15172                 echo "Prototype: $try" ;;
15173         esac
15174         ;;
15175         *)      case "$usethreads" in
15176                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
15177                 esac
15178                 d_srandom_r=undef
15179                 srandom_r_proto=0
15180                 ;;
15181         esac
15182         ;;
15183 *)      srandom_r_proto=0
15184         ;;
15185 esac
15186
15187 : see if prototype for setresgid is available
15188 echo " "
15189 set d_sresgproto setresgid $i_unistd unistd.h
15190 eval $hasproto
15191
15192 : see if prototype for setresuid is available
15193 echo " "
15194 set d_sresuproto setresuid $i_unistd unistd.h
15195 eval $hasproto
15196
15197 : see if sys/stat.h is available
15198 set sys/stat.h i_sysstat
15199 eval $inhdr
15200
15201
15202 : see if stat knows about block sizes
15203 echo " "
15204 echo "Checking to see if your struct stat has st_blocks field..." >&4
15205 set d_statblks stat st_blocks $i_sysstat sys/stat.h
15206 eval $hasfield
15207
15208
15209 : see if this is a sys/vfs.h system
15210 set sys/vfs.h i_sysvfs
15211 eval $inhdr
15212
15213
15214 : see if this is a sys/statfs.h system
15215 set sys/statfs.h i_sysstatfs
15216 eval $inhdr
15217
15218
15219 echo " "
15220 echo "Checking to see if your system supports struct statfs..." >&4
15221 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
15222 eval $hasstruct
15223 case "$d_statfs_s" in
15224 "$define")      echo "Yes, it does."   ;;
15225 *)              echo "No, it doesn't." ;;
15226 esac
15227
15228
15229
15230 : see if struct statfs knows about f_flags
15231 case "$d_statfs_s" in
15232 define) 
15233         echo " "
15234         echo "Checking to see if your struct statfs has f_flags field..." >&4
15235         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
15236         eval $hasfield
15237         ;;
15238 *)      val="$undef"
15239         set d_statfs_f_flags
15240         eval $setvar
15241         ;;
15242 esac
15243 case "$d_statfs_f_flags" in
15244 "$define")      echo "Yes, it does."   ;;
15245 *)              echo "No, it doesn't." ;;
15246 esac
15247
15248 : see if _ptr and _cnt from stdio act std
15249 echo " "
15250
15251 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
15252         echo "(Looks like you have stdio.h from BSD.)"
15253         case "$stdio_ptr" in
15254         '') stdio_ptr='((fp)->_p)'
15255                 ptr_lval=$define
15256                 ;;
15257         *)      ptr_lval=$d_stdio_ptr_lval;;
15258         esac
15259         case "$stdio_cnt" in
15260         '') stdio_cnt='((fp)->_r)'
15261                 cnt_lval=$define
15262                 ;;
15263         *)      cnt_lval=$d_stdio_cnt_lval;;
15264         esac
15265         case "$stdio_base" in
15266         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
15267         esac
15268         case "$stdio_bufsiz" in
15269         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
15270         esac
15271 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
15272         echo "(Looks like you have stdio.h from Linux.)"
15273         case "$stdio_ptr" in
15274         '') stdio_ptr='((fp)->_IO_read_ptr)'
15275                 ptr_lval=$define
15276                 ;;
15277         *)      ptr_lval=$d_stdio_ptr_lval;;
15278         esac
15279         case "$stdio_cnt" in
15280         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
15281                 cnt_lval=$undef
15282                 ;;
15283         *)      cnt_lval=$d_stdio_cnt_lval;;
15284         esac
15285         case "$stdio_base" in
15286         '') stdio_base='((fp)->_IO_read_base)';;
15287         esac
15288         case "$stdio_bufsiz" in
15289         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
15290         esac
15291 else
15292         case "$stdio_ptr" in
15293         '') stdio_ptr='((fp)->_ptr)'
15294                 ptr_lval=$define
15295                 ;;
15296         *)      ptr_lval=$d_stdio_ptr_lval;;
15297         esac
15298         case "$stdio_cnt" in
15299         '') stdio_cnt='((fp)->_cnt)'
15300                 cnt_lval=$define
15301                 ;;
15302         *)      cnt_lval=$d_stdio_cnt_lval;;
15303         esac
15304         case "$stdio_base" in
15305         '') stdio_base='((fp)->_base)';;
15306         esac
15307         case "$stdio_bufsiz" in
15308         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
15309         esac
15310 fi
15311
15312 : test whether _ptr and _cnt really work
15313 echo "Checking how std your stdio is..." >&4
15314 $cat >try.c <<EOP
15315 #include <stdio.h>
15316 #define FILE_ptr(fp)    $stdio_ptr
15317 #define FILE_cnt(fp)    $stdio_cnt
15318 int main() {
15319         FILE *fp = fopen("try.c", "r");
15320         char c = getc(fp);
15321         if (
15322                 18 <= FILE_cnt(fp) &&
15323                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15324         )
15325                 exit(0);
15326         exit(1);
15327 }
15328 EOP
15329 val="$undef"
15330 set try
15331 if eval $compile && $to try.c; then
15332         if $run ./try; then
15333                 echo "Your stdio acts pretty std."
15334                 val="$define"
15335         else
15336                 echo "Your stdio isn't very std."
15337         fi
15338 else
15339         echo "Your stdio doesn't appear very std."
15340 fi
15341 $rm -f try.c try
15342 set d_stdstdio
15343 eval $setvar
15344
15345 : Can _ptr be used as an lvalue?
15346 case "$d_stdstdio$ptr_lval" in
15347 $define$define) val=$define ;;
15348 *) val=$undef ;;
15349 esac
15350 set d_stdio_ptr_lval
15351 eval $setvar
15352
15353 : Can _cnt be used as an lvalue?
15354 case "$d_stdstdio$cnt_lval" in
15355 $define$define) val=$define ;;
15356 *) val=$undef ;;
15357 esac
15358 set d_stdio_cnt_lval
15359 eval $setvar
15360
15361
15362 : test whether setting _ptr sets _cnt as a side effect
15363 d_stdio_ptr_lval_sets_cnt="$undef"
15364 d_stdio_ptr_lval_nochange_cnt="$undef"
15365 case "$d_stdio_ptr_lval$d_stdstdio" in
15366 $define$define)
15367         echo "Checking to see what happens if we set the stdio ptr..." >&4
15368 $cat >try.c <<EOP
15369 #include <stdio.h>
15370 /* Can we scream? */
15371 /* Eat dust sed :-) */
15372 /* In the buffer space, no one can hear you scream. */
15373 #define FILE_ptr(fp)    $stdio_ptr
15374 #define FILE_cnt(fp)    $stdio_cnt
15375 #include <sys/types.h>
15376 int main() {
15377         FILE *fp = fopen("try.c", "r");
15378         int c;
15379         char *ptr;
15380         size_t cnt;
15381         if (!fp) {
15382             puts("Fail even to read");
15383             exit(1);
15384         }
15385         c = getc(fp); /* Read away the first # */
15386         if (c == EOF) {
15387             puts("Fail even to read");
15388             exit(1);
15389         }
15390         if (!(
15391                 18 <= FILE_cnt(fp) &&
15392                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15393         )) {
15394                 puts("Fail even to read");
15395                 exit (1);
15396         }
15397         ptr = (char*) FILE_ptr(fp);
15398         cnt = (size_t)FILE_cnt(fp);
15399
15400         FILE_ptr(fp) += 42;
15401
15402         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
15403                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
15404                 exit (1);
15405         }
15406         if (FILE_cnt(fp) <= 20) {
15407                 printf ("Fail (<20 chars to test)");
15408                 exit (1);
15409         }
15410         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
15411                 puts("Fail compare");
15412                 exit (1);
15413         }
15414         if (cnt == FILE_cnt(fp)) {
15415                 puts("Pass_unchanged");
15416                 exit (0);
15417         }       
15418         if (FILE_cnt(fp) == (cnt - 42)) {
15419                 puts("Pass_changed");
15420                 exit (0);
15421         }
15422         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
15423         return 1;
15424
15425 }
15426 EOP
15427         set try
15428         if eval $compile && $to try.c; then
15429                 case `$run ./try` in
15430                 Pass_changed)
15431                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
15432                         d_stdio_ptr_lval_sets_cnt="$define" ;;
15433                 Pass_unchanged)
15434                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
15435                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
15436                 Fail*)
15437                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
15438                 *)
15439                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
15440         esac
15441         else
15442                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
15443         fi
15444         $rm -f try.c try
15445         ;;
15446 esac
15447
15448 : see if _base is also standard
15449 val="$undef"
15450 case "$d_stdstdio" in
15451 $define)
15452         $cat >try.c <<EOP
15453 #include <stdio.h>
15454 #define FILE_base(fp)   $stdio_base
15455 #define FILE_bufsiz(fp) $stdio_bufsiz
15456 int main() {
15457         FILE *fp = fopen("try.c", "r");
15458         char c = getc(fp);
15459         if (
15460                 19 <= FILE_bufsiz(fp) &&
15461                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
15462         )
15463                 exit(0);
15464         exit(1);
15465 }
15466 EOP
15467         set try
15468         if eval $compile && $to try.c; then
15469                 if $run ./try; then
15470                         echo "And its _base field acts std."
15471                         val="$define"
15472                 else
15473                         echo "But its _base field isn't std."
15474                 fi
15475         else
15476                 echo "However, it seems to be lacking the _base field."
15477         fi
15478         $rm -f try.c try
15479         ;;
15480 esac
15481 set d_stdiobase
15482 eval $setvar
15483
15484 $cat >&4 <<EOM
15485 Checking how to access stdio streams by file descriptor number...
15486 EOM
15487 case "$stdio_stream_array" in
15488 '')     $cat >try.c <<EOCP
15489 #include <stdio.h>
15490 int main() {
15491   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
15492     printf("yes\n");
15493 }
15494 EOCP
15495         for s in _iob __iob __sF
15496         do
15497                 set try -DSTDIO_STREAM_ARRAY=$s
15498                 if eval $compile; then
15499                         case "`$run ./try`" in
15500                         yes)    stdio_stream_array=$s; break ;;
15501                         esac
15502                 fi
15503         done
15504         $rm -f try.* try$exe_ext
15505 esac
15506 case "$stdio_stream_array" in
15507 '')     $cat >&4 <<EOM
15508 I can't figure out how to access stdio streams by file descriptor number.
15509 EOM
15510         d_stdio_stream_array="$undef"
15511         ;;
15512 *)      $cat >&4 <<EOM
15513 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
15514 EOM
15515         d_stdio_stream_array="$define"
15516         ;;
15517 esac
15518
15519 : see if strcoll exists
15520 set strcoll d_strcoll
15521 eval $inlibc
15522
15523 : check for structure copying
15524 echo " "
15525 echo "Checking to see if your C compiler can copy structs..." >&4
15526 $cat >try.c <<'EOCP'
15527 int main()
15528 {
15529         struct blurfl {
15530                 int dyick;
15531         } foo, bar;
15532
15533         foo = bar;
15534 }
15535 EOCP
15536 if $cc -c try.c >/dev/null 2>&1 ; then
15537         val="$define"
15538         echo "Yup, it can."
15539 else
15540         val="$undef"
15541         echo "Nope, it can't."
15542 fi
15543 set d_strctcpy
15544 eval $setvar
15545 $rm -f try.*
15546
15547 : see if strerror and/or sys_errlist[] exist
15548 echo " "
15549 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
15550     if set strerror val -f d_strerror; eval $csym; $val; then
15551                 echo 'strerror() found.' >&4
15552                 d_strerror="$define"
15553                 d_strerrm='strerror(e)'
15554                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
15555                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
15556                         d_syserrlst="$define"
15557                 else
15558                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
15559                         d_syserrlst="$undef"
15560                 fi
15561     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
15562                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
15563                 echo 'strerror() found in string header.' >&4
15564                 d_strerror="$define"
15565                 d_strerrm='strerror(e)'
15566                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
15567                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
15568                                 d_syserrlst="$define"
15569                 else
15570                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
15571                         d_syserrlst="$undef"
15572                 fi
15573     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
15574                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
15575                 d_strerror="$undef"
15576                 d_syserrlst="$define"
15577                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
15578     else
15579                 echo 'strerror() and sys_errlist[] NOT found.' >&4
15580                 d_strerror="$undef"
15581                 d_syserrlst="$undef"
15582                 d_strerrm='"unknown"'
15583     fi
15584 fi
15585
15586 : see if strerror_r exists
15587 set strerror_r d_strerror_r
15588 eval $inlibc
15589 case "$d_strerror_r" in
15590 "$define")
15591         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
15592         case "$d_strerror_r_proto:$usethreads" in
15593         ":define")      d_strerror_r_proto=define
15594                 set d_strerror_r_proto strerror_r $hdrs
15595                 eval $hasproto ;;
15596         *)      ;;
15597         esac
15598         case "$d_strerror_r_proto" in
15599         define)
15600         case "$strerror_r_proto" in
15601         ''|0) try='int strerror_r(int, char*, size_t);'
15602         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
15603         esac
15604         case "$strerror_r_proto" in
15605         ''|0) try='int strerror_r(int, char*, int);'
15606         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
15607         esac
15608         case "$strerror_r_proto" in
15609         ''|0) try='char* strerror_r(int, char*, size_t);'
15610         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
15611         esac
15612         case "$strerror_r_proto" in
15613         ''|0)   d_strerror_r=undef
15614                 strerror_r_proto=0
15615                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
15616         * )     case "$strerror_r_proto" in
15617                 REENTRANT_PROTO*) ;;
15618                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
15619                 esac
15620                 echo "Prototype: $try" ;;
15621         esac
15622         ;;
15623         *)      case "$usethreads" in
15624                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
15625                 esac
15626                 d_strerror_r=undef
15627                 strerror_r_proto=0
15628                 ;;
15629         esac
15630         ;;
15631 *)      strerror_r_proto=0
15632         ;;
15633 esac
15634
15635 : see if strftime exists
15636 set strftime d_strftime
15637 eval $inlibc
15638
15639 : see if strtod exists
15640 set strtod d_strtod
15641 eval $inlibc
15642
15643 : see if strtol exists
15644 set strtol d_strtol
15645 eval $inlibc
15646
15647 : see if strtold exists
15648 set strtold d_strtold
15649 eval $inlibc
15650
15651 : see if strtoll exists
15652 set strtoll d_strtoll
15653 eval $inlibc
15654
15655 case "$d_longlong-$d_strtoll" in
15656 "$define-$define")
15657         $cat <<EOM
15658 Checking whether your strtoll() works okay...
15659 EOM
15660         $cat >try.c <<'EOCP'
15661 #include <errno.h>
15662 #ifdef __hpux
15663 #define strtoll __strtoll
15664 #endif
15665 #ifdef __EMX__
15666 #define strtoll _strtoll
15667 #endif
15668 #include <stdio.h>
15669 extern long long int strtoll(char *s, char **, int); 
15670 static int bad = 0;
15671 int check(char *s, long long ell, int een) {
15672         long long gll;
15673         errno = 0;
15674         gll = strtoll(s, 0, 10);
15675         if (!((gll == ell) && (errno == een)))
15676                 bad++;
15677 }
15678 int main() {
15679         check(" 1",                                      1LL, 0);
15680         check(" 0",                                      0LL, 0);
15681         check("-1",                                     -1LL, 0);
15682         check("-9223372036854775808", -9223372036854775808LL, 0);
15683         check("-9223372036854775808", -9223372036854775808LL, 0);
15684         check(" 9223372036854775807",  9223372036854775807LL, 0);
15685         check("-9223372036854775808", -9223372036854775808LL, 0);
15686         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
15687         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
15688         if (!bad)
15689                 printf("ok\n");
15690 }
15691 EOCP
15692         set try
15693         if eval $compile; then
15694                 yyy=`$run ./try`
15695                 case "$yyy" in
15696                 ok) echo "Your strtoll() seems to be working okay." ;;
15697                 *) cat <<EOM >&4
15698 Your strtoll() doesn't seem to be working okay.
15699 EOM
15700                    d_strtoll="$undef"
15701                    ;;
15702                 esac
15703         else
15704                 echo "(I can't seem to compile the test program--assuming it doesn't)"
15705                 d_strtoll="$undef"
15706         fi
15707         ;;
15708 esac
15709
15710 : see if strtoq exists
15711 set strtoq d_strtoq
15712 eval $inlibc
15713
15714 : see if strtoul exists
15715 set strtoul d_strtoul
15716 eval $inlibc
15717
15718 case "$d_strtoul" in
15719 "$define")
15720         $cat <<EOM
15721 Checking whether your strtoul() works okay...
15722 EOM
15723         $cat >try.c <<'EOCP'
15724 #include <errno.h>
15725 #include <stdio.h>
15726 extern unsigned long int strtoul(char *s, char **, int); 
15727 static int bad = 0;
15728 void check(char *s, unsigned long eul, int een) {
15729         unsigned long gul;
15730         errno = 0;
15731         gul = strtoul(s, 0, 10);
15732         if (!((gul == eul) && (errno == een)))
15733                 bad++;
15734 }
15735 int main() {
15736         check(" 1", 1L, 0);
15737         check(" 0", 0L, 0);
15738 EOCP
15739         case "$longsize" in
15740         8)
15741             $cat >>try.c <<'EOCP'
15742         check("18446744073709551615", 18446744073709551615UL, 0);
15743         check("18446744073709551616", 18446744073709551615UL, ERANGE);
15744 #if 0 /* strtoul() for /^-/ strings is undefined. */
15745         check("-1", 18446744073709551615UL, 0);
15746         check("-18446744073709551614", 2, 0);
15747         check("-18446744073709551615", 1, 0);
15748         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
15749         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
15750 #endif
15751 EOCP
15752                 ;;
15753         4)
15754                     $cat >>try.c <<'EOCP'
15755         check("4294967295", 4294967295UL, 0);
15756         check("4294967296", 4294967295UL, ERANGE);
15757 #if 0 /* strtoul() for /^-/ strings is undefined. */
15758         check("-1", 4294967295UL, 0);
15759         check("-4294967294", 2, 0);
15760         check("-4294967295", 1, 0);
15761         check("-4294967296", 4294967295UL, ERANGE);
15762         check("-4294967297", 4294967295UL, ERANGE);
15763 #endif
15764 EOCP
15765                 ;;
15766         *)
15767 : Should we write these tests to be more portable by sprintf-ing
15768 : ~0 and then manipulating that char string as input for strtol?
15769                 ;;
15770         esac
15771         $cat >>try.c <<'EOCP'
15772         if (!bad)
15773                 printf("ok\n");
15774         return 0;
15775 }
15776 EOCP
15777         set try
15778         if eval $compile; then
15779                 case "`$run ./try`" in
15780                 ok) echo "Your strtoul() seems to be working okay." ;;
15781                 *) cat <<EOM >&4
15782 Your strtoul() doesn't seem to be working okay.
15783 EOM
15784                    d_strtoul="$undef"
15785                    ;;
15786                 esac
15787         fi
15788         ;;
15789 esac
15790
15791 : see if strtoull exists
15792 set strtoull d_strtoull
15793 eval $inlibc
15794
15795 case "$d_longlong-$d_strtoull" in
15796 "$define-$define")
15797         $cat <<EOM
15798 Checking whether your strtoull() works okay...
15799 EOM
15800         $cat >try.c <<'EOCP'
15801 #include <errno.h>
15802 #ifdef __hpux
15803 #define strtoull __strtoull
15804 #endif
15805 #include <stdio.h>
15806 extern unsigned long long int strtoull(char *s, char **, int); 
15807 static int bad = 0;
15808 int check(char *s, long long eull, int een) {
15809         long long gull;
15810         errno = 0;
15811         gull = strtoull(s, 0, 10);
15812         if (!((gull == eull) && (errno == een)))
15813                 bad++;
15814 }
15815 int main() {
15816         check(" 1",                                        1LL, 0);
15817         check(" 0",                                        0LL, 0);
15818         check("18446744073709551615",  18446744073709551615ULL, 0);
15819         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
15820 #if 0 /* strtoull() for /^-/ strings is undefined. */
15821         check("-1",                    18446744073709551615ULL, 0);
15822         check("-18446744073709551614",                     2LL, 0);
15823         check("-18446744073709551615",                     1LL, 0);
15824         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
15825         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
15826 #endif
15827         if (!bad)
15828                 printf("ok\n");
15829 }
15830 EOCP
15831         set try
15832         if eval $compile; then
15833                 case "`$run ./try`" in
15834                 ok) echo "Your strtoull() seems to be working okay." ;;
15835                 *) cat <<EOM >&4
15836 Your strtoull() doesn't seem to be working okay.
15837 EOM
15838                    d_strtoull="$undef"
15839                    ;;
15840                 esac
15841         fi
15842         ;;
15843 esac
15844
15845 : see if strtouq exists
15846 set strtouq d_strtouq
15847 eval $inlibc
15848
15849 case "$d_strtouq" in
15850 "$define")
15851         $cat <<EOM
15852 Checking whether your strtouq() works okay...
15853 EOM
15854         $cat >try.c <<'EOCP'
15855 #include <errno.h>
15856 #include <stdio.h>
15857 extern unsigned long long int strtouq(char *s, char **, int); 
15858 static int bad = 0;
15859 void check(char *s, unsigned long long eull, int een) {
15860         unsigned long long gull;
15861         errno = 0;
15862         gull = strtouq(s, 0, 10);
15863         if (!((gull == eull) && (errno == een)))
15864                 bad++;
15865 }
15866 int main() {
15867         check(" 1",                                        1LL, 0);
15868         check(" 0",                                        0LL, 0);
15869         check("18446744073709551615",  18446744073709551615ULL, 0);
15870         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
15871 #if 0 /* strtouq() for /^-/ strings is undefined. */
15872         check("-1",                    18446744073709551615ULL, 0);
15873         check("-18446744073709551614",                     2LL, 0);
15874         check("-18446744073709551615",                     1LL, 0);
15875         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
15876         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
15877 #endif
15878         if (!bad)
15879                 printf("ok\n");
15880         return 0;
15881 }
15882 EOCP
15883         set try
15884         if eval $compile; then
15885                 case "`$run ./try`" in
15886                 ok) echo "Your strtouq() seems to be working okay." ;;
15887                 *) cat <<EOM >&4
15888 Your strtouq() doesn't seem to be working okay.
15889 EOM
15890                    d_strtouq="$undef"
15891                    ;;
15892                 esac
15893         fi
15894         ;;
15895 esac
15896
15897 : see if strxfrm exists
15898 set strxfrm d_strxfrm
15899 eval $inlibc
15900
15901 : see if symlink exists
15902 set symlink d_symlink
15903 eval $inlibc
15904
15905 : see if syscall exists
15906 set syscall d_syscall
15907 eval $inlibc
15908
15909 : see if prototype for syscall is available
15910 echo " "
15911 set d_syscallproto syscall $i_unistd unistd.h
15912 eval $hasproto
15913
15914 : see if sysconf exists
15915 set sysconf d_sysconf
15916 eval $inlibc
15917
15918 : see if system exists
15919 set system d_system
15920 eval $inlibc
15921
15922 : see if tcgetpgrp exists
15923 set tcgetpgrp d_tcgetpgrp
15924 eval $inlibc
15925
15926 : see if tcsetpgrp exists
15927 set tcsetpgrp d_tcsetpgrp
15928 eval $inlibc
15929
15930 : see if prototype for telldir is available
15931 echo " "
15932 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
15933 eval $hasproto
15934
15935 : see if time exists
15936 echo " "
15937 if test "X$d_time" = X -o X"$timetype" = X; then
15938     if set time val -f d_time; eval $csym; $val; then
15939                 echo 'time() found.' >&4
15940                 val="$define"
15941                 rp="What is the type returned by time() on this system?"
15942                 set time_t timetype long stdio.h sys/types.h
15943                 eval $typedef_ask
15944     else
15945                 echo 'time() not found, hope that will do.' >&4
15946                 val="$undef"
15947                 timetype='int';
15948     fi
15949     set d_time
15950     eval $setvar
15951 fi
15952
15953 : see if this is a sys/times.h system
15954 set sys/times.h i_systimes
15955 eval $inhdr
15956
15957 : see if times exists
15958 echo " "
15959 if set times val -f d_times; eval $csym; $val; then
15960         echo 'times() found.' >&4
15961         d_times="$define"
15962         inc=''
15963         case "$i_systimes" in
15964         "$define") inc='sys/times.h';;
15965         esac
15966         rp="What is the type returned by times() on this system?"
15967         set clock_t clocktype long stdio.h sys/types.h $inc
15968         eval $typedef_ask
15969 else
15970         echo 'times() NOT found, hope that will do.' >&4
15971         d_times="$undef"
15972         clocktype='int'
15973 fi
15974
15975 : see if tmpnam_r exists
15976 set tmpnam_r d_tmpnam_r
15977 eval $inlibc
15978 case "$d_tmpnam_r" in
15979 "$define")
15980         hdrs="$i_systypes sys/types.h define stdio.h "
15981         case "$d_tmpnam_r_proto:$usethreads" in
15982         ":define")      d_tmpnam_r_proto=define
15983                 set d_tmpnam_r_proto tmpnam_r $hdrs
15984                 eval $hasproto ;;
15985         *)      ;;
15986         esac
15987         case "$d_tmpnam_r_proto" in
15988         define)
15989         case "$tmpnam_r_proto" in
15990         ''|0) try='char* tmpnam_r(char*);'
15991         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
15992         esac
15993         case "$tmpnam_r_proto" in
15994         ''|0)   d_tmpnam_r=undef
15995                 tmpnam_r_proto=0
15996                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
15997         * )     case "$tmpnam_r_proto" in
15998                 REENTRANT_PROTO*) ;;
15999                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
16000                 esac
16001                 echo "Prototype: $try" ;;
16002         esac
16003         ;;
16004         *)      case "$usethreads" in
16005                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
16006                 esac
16007                 d_tmpnam_r=undef
16008                 tmpnam_r_proto=0
16009                 ;;
16010         esac
16011         ;;
16012 *)      tmpnam_r_proto=0
16013         ;;
16014 esac
16015
16016 : see if truncate exists
16017 set truncate d_truncate
16018 eval $inlibc
16019
16020 : see if ttyname_r exists
16021 set ttyname_r d_ttyname_r
16022 eval $inlibc
16023 case "$d_ttyname_r" in
16024 "$define")
16025         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
16026         case "$d_ttyname_r_proto:$usethreads" in
16027         ":define")      d_ttyname_r_proto=define
16028                 set d_ttyname_r_proto ttyname_r $hdrs
16029                 eval $hasproto ;;
16030         *)      ;;
16031         esac
16032         case "$d_ttyname_r_proto" in
16033         define)
16034         case "$ttyname_r_proto" in
16035         ''|0) try='int ttyname_r(int, char*, size_t);'
16036         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
16037         esac
16038         case "$ttyname_r_proto" in
16039         ''|0) try='int ttyname_r(int, char*, int);'
16040         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
16041         esac
16042         case "$ttyname_r_proto" in
16043         ''|0) try='char* ttyname_r(int, char*, int);'
16044         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
16045         esac
16046         case "$ttyname_r_proto" in
16047         ''|0)   d_ttyname_r=undef
16048                 ttyname_r_proto=0
16049                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
16050         * )     case "$ttyname_r_proto" in
16051                 REENTRANT_PROTO*) ;;
16052                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
16053                 esac
16054                 echo "Prototype: $try" ;;
16055         esac
16056         ;;
16057         *)      case "$usethreads" in
16058                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
16059                 esac
16060                 d_ttyname_r=undef
16061                 ttyname_r_proto=0
16062                 ;;
16063         esac
16064         ;;
16065 *)      ttyname_r_proto=0
16066         ;;
16067 esac
16068
16069 : see if tzname[] exists
16070 echo " "
16071 if set tzname val -a d_tzname; eval $csym; $val; then
16072         val="$define"
16073         echo 'tzname[] found.' >&4
16074 else
16075         val="$undef"
16076         echo 'tzname[] NOT found.' >&4
16077 fi
16078 set d_tzname
16079 eval $setvar
16080
16081 case "$osname" in
16082 next|rhapsody|darwin) multiarch="$define" ;;
16083 esac
16084 case "$multiarch" in
16085 ''|[nN]*) multiarch="$undef" ;;
16086 esac
16087
16088 : check for ordering of bytes in a UV
16089 echo " "
16090 case "$usecrosscompile$multiarch" in
16091 *$define*)
16092         $cat <<EOM
16093 You seem to be either cross-compiling or doing a multiarchitecture build,
16094 skipping the byteorder check.
16095
16096 EOM
16097         byteorder='ffff'
16098         ;;
16099 *)
16100         case "$byteorder" in
16101         '')
16102                 $cat <<'EOM'
16103 In the following, larger digits indicate more significance.  A big-endian
16104 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
16105 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
16106 machines may have weird orders like 3412.  A Cray will report 87654321,
16107 an Alpha will report 12345678. If the test program works the default is
16108 probably right.
16109 I'm now running the test program...
16110 EOM
16111                 $cat >try.c <<EOCP
16112 #include <stdio.h>
16113 #include <sys/types.h>
16114 typedef $uvtype UV;
16115 int main()
16116 {
16117         int i;
16118         union {
16119                 UV l;
16120                 char c[$uvsize];
16121         } u;
16122
16123         if ($uvsize > 4)
16124                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
16125         else
16126                 u.l = (UV)0x04030201;
16127         for (i = 0; i < $uvsize; i++)
16128                 printf("%c", u.c[i]+'0');
16129         printf("\n");
16130         exit(0);
16131 }
16132 EOCP
16133                 xxx_prompt=y
16134                 set try
16135                 if eval $compile && ./try > /dev/null; then
16136                         dflt=`$run ./try`
16137                         case "$dflt" in
16138                         [1-4][1-4][1-4][1-4]|12345678|87654321)
16139                                 echo "(The test program ran ok.)"
16140                                 echo "byteorder=$dflt"
16141                                 xxx_prompt=n
16142                         ;;
16143                         ????|????????) echo "(The test program ran ok.)" ;;
16144                         *) echo "(The test program didn't run right for some reason.)" ;;
16145                         esac
16146                 else
16147                         dflt='4321'
16148                         cat <<'EOM'
16149 (I can't seem to compile the test program.  Guessing big-endian...)
16150 EOM
16151                 fi
16152                 case "$xxx_prompt" in
16153                 y)
16154                         rp="What is the order of bytes in $uvtype?"
16155                         . ./myread
16156                         byteorder="$ans"
16157                         ;;
16158                 *)      byteorder=$dflt
16159                         ;;
16160                 esac
16161                 ;;
16162         esac
16163         $rm -f try.c try
16164         ;;
16165 esac
16166
16167
16168 $cat <<EOM
16169
16170 Checking to see whether you can access character data unalignedly...
16171 EOM
16172 case "$d_u32align" in
16173 '')   $cat >try.c <<EOCP
16174 #include <stdio.h>
16175 #define U32 $u32type
16176 #define BYTEORDER 0x$byteorder
16177 #define U8 $u8type
16178 #include <signal.h>
16179 #ifdef SIGBUS
16180 $signal_t bletch(s) int s; { exit(4); }
16181 #endif
16182 int main() {
16183 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
16184     U8 buf[8];
16185     U32 *up;
16186     int i;
16187
16188     if (sizeof(U32) != 4) {
16189         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
16190         exit(1);
16191     }
16192
16193     fflush(stdout);
16194
16195 #ifdef SIGBUS
16196     signal(SIGBUS, bletch);
16197 #endif
16198
16199     buf[0] = 0;
16200     buf[1] = 0;
16201     buf[2] = 0;
16202     buf[3] = 1;
16203     buf[5] = 0;
16204     buf[6] = 0;
16205     buf[7] = 0;
16206     buf[8] = 1;
16207
16208     for (i = 0; i < 4; i++) {
16209         up = (U32*)(buf + i);
16210         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
16211                (*up == 1 << (8*(3-i)))  /* little-endian */
16212               )
16213            )
16214         {
16215             printf("read failed (%x)\n", *up);
16216             exit(2);
16217         }
16218     }
16219
16220     /* write test */
16221     for (i = 0; i < 4; i++) {
16222         up = (U32*)(buf + i);
16223         *up = 0xBeef;
16224         if (*up != 0xBeef) {
16225             printf("write failed (%x)\n", *up);
16226             exit(3);
16227         }
16228     }
16229
16230     exit(0);
16231 #else
16232     printf("1\n");
16233     exit(1);
16234 #endif
16235     return 0;
16236 }
16237 EOCP
16238 set try
16239 if eval $compile_ok; then
16240         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
16241         $run ./try 2>&1 >/dev/null
16242         case "$?" in
16243         0)      cat >&4 <<EOM
16244 You can access character data pretty unalignedly.
16245 EOM
16246                 d_u32align="$undef"
16247                 ;;
16248         *)      cat >&4 <<EOM
16249 It seems that you must access character data in an aligned manner.
16250 EOM
16251                 d_u32align="$define"
16252                 ;;
16253         esac
16254 else
16255         rp='Can you access character data at unaligned addresses?'
16256         dflt='n'
16257         . ./myread
16258         case "$ans" in
16259         [yY]*)  d_u32align="$undef"  ;;
16260         *)      d_u32align="$define" ;;
16261         esac
16262 fi
16263 $rm -f core core.try.* try.core
16264 ;;
16265 esac
16266
16267 : see if ualarm exists
16268 set ualarm d_ualarm
16269 eval $inlibc
16270
16271 : see if umask exists
16272 set umask d_umask
16273 eval $inlibc
16274
16275 : see if unordered exists
16276 set unordered d_unordered
16277 eval $inlibc
16278
16279 : see if usleep exists
16280 set usleep d_usleep
16281 eval $inlibc
16282
16283 : see if prototype for usleep is available
16284 echo " "
16285 set d_usleepproto usleep $i_unistd unistd.h
16286 eval $hasproto
16287
16288 : see if ustat exists
16289 set ustat d_ustat
16290 eval $inlibc
16291
16292 : backward compatibility for d_hvfork
16293 if test X$d_hvfork != X; then
16294         d_vfork="$d_hvfork"
16295         d_hvfork=''
16296 fi
16297 : see if there is a vfork
16298 val=''
16299 set vfork val
16300 eval $inlibc
16301
16302 : Ok, but do we want to use it. vfork is reportedly unreliable in 
16303 : perl on Solaris 2.x, and probably elsewhere.
16304 case "$val" in
16305 $define)
16306         echo " "
16307         case "$usevfork" in
16308         false) dflt='n';;
16309         *) dflt='y';;
16310         esac
16311         cat <<'EOM'
16312  
16313 Perl can only use a vfork() that doesn't suffer from strict
16314 restrictions on calling functions or modifying global data in
16315 the child.  For example, glibc-2.1 contains such a vfork()
16316 that is unsuitable.  If your system provides a proper fork()
16317 call, chances are that you do NOT want perl to use vfork().
16318
16319 EOM
16320         rp="Do you still want to use vfork()?"
16321         . ./myread
16322         case "$ans" in
16323         y|Y) ;;
16324         *)
16325                 echo "Ok, we won't use vfork()."
16326                 val="$undef"
16327                 ;;
16328         esac
16329         ;;
16330 esac
16331 set d_vfork
16332 eval $setvar
16333 case "$d_vfork" in
16334 $define) usevfork='true';;
16335 *) usevfork='false';;
16336 esac
16337
16338 : see if closedir exists
16339 set closedir d_closedir
16340 eval $inlibc
16341
16342 case "$d_closedir" in
16343 "$define")
16344         echo " "
16345         echo "Checking whether closedir() returns a status..." >&4
16346         cat > try.c <<EOM
16347 #$i_dirent I_DIRENT             /**/
16348 #$i_sysdir I_SYS_DIR            /**/
16349 #$i_sysndir I_SYS_NDIR          /**/
16350 #$i_systypes I_SYS_TYPES        /**/
16351
16352 #if defined(I_SYS_TYPES)
16353 #include <sys/types.h>
16354 #endif
16355 #if defined(I_DIRENT)
16356 #include <dirent.h>
16357 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
16358 #include <sys/dir.h>
16359 #endif
16360 #else
16361 #ifdef I_SYS_NDIR
16362 #include <sys/ndir.h>
16363 #else
16364 #ifdef I_SYS_DIR
16365 #ifdef hp9000s500
16366 #include <ndir.h>       /* may be wrong in the future */
16367 #else
16368 #include <sys/dir.h>
16369 #endif
16370 #endif
16371 #endif
16372 #endif 
16373 int main() { return closedir(opendir(".")); }
16374 EOM
16375         set try
16376         if eval $compile_ok; then
16377                 if $run ./try > /dev/null 2>&1 ; then
16378                         echo "Yes, it does."
16379                         val="$undef"
16380                 else
16381                         echo "No, it doesn't."
16382                         val="$define"
16383                 fi
16384         else
16385                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16386                 val="$define"
16387         fi
16388         ;;
16389 *)
16390         val="$undef";
16391         ;;
16392 esac
16393 set d_void_closedir
16394 eval $setvar
16395 $rm -f try try.*
16396 : see if there is a wait4
16397 set wait4 d_wait4
16398 eval $inlibc
16399
16400 : see if waitpid exists
16401 set waitpid d_waitpid
16402 eval $inlibc
16403
16404 : see if wcstombs exists
16405 set wcstombs d_wcstombs
16406 eval $inlibc
16407
16408 : see if wctomb exists
16409 set wctomb d_wctomb
16410 eval $inlibc
16411
16412 : see if writev exists
16413 set writev d_writev
16414 eval $inlibc
16415
16416 : preserve RCS keywords in files with variable substitution, grrr
16417 Date='$Date'
16418 Id='$Id'
16419 Log='$Log'
16420 RCSfile='$RCSfile'
16421 Revision='$Revision'
16422
16423 : check for alignment requirements
16424 echo " "
16425 case "$usecrosscompile$multiarch" in
16426 *$define*)
16427         $cat <<EOM
16428 You seem to be either cross-compiling or doing a multiarchitecture build,
16429 skipping the memory alignment check.
16430
16431 EOM
16432         case "$alignbytes" in
16433         '') alignbytes=8 ;;
16434         esac
16435         ;;
16436 *)
16437         case "$alignbytes" in
16438         '') echo "Checking alignment constraints..." >&4
16439                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
16440                         $cat >try.c <<'EOCP'
16441 typedef long double NV;
16442 EOCP
16443                 else
16444                         $cat >try.c <<'EOCP'
16445 typedef double NV;
16446 EOCP
16447                 fi
16448                 $cat >>try.c <<'EOCP'
16449 #include <stdio.h>
16450 struct foobar {
16451         char foo;
16452         NV bar;
16453 } try_algn;
16454 int main()
16455 {
16456     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
16457     return(0);
16458 }
16459 EOCP
16460                 set try
16461                 if eval $compile_ok; then
16462                         dflt=`$run ./try`
16463                 else
16464                         dflt='8'
16465                         echo "(I can't seem to compile the test program...)"
16466                 fi
16467                 ;;
16468         *) dflt="$alignbytes"
16469                 ;;
16470         esac
16471         rp="Doubles must be aligned on a how-many-byte boundary?"
16472         . ./myread
16473         alignbytes="$ans"
16474         $rm -f try.c try
16475         ;;
16476 esac
16477
16478
16479 : set the base revision
16480 baserev=5.0
16481
16482 : how do we catenate cpp tokens here?
16483 echo " "
16484 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
16485 $cat >cpp_stuff.c <<'EOCP'
16486 #define RCAT(a,b)a/**/b
16487 #define ACAT(a,b)a ## b
16488 RCAT(Rei,ser)
16489 ACAT(Cir,cus)
16490 EOCP
16491 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
16492 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
16493         echo "Oh!  Smells like ANSI's been here." >&4
16494         echo "We can catify or stringify, separately or together!"
16495         cpp_stuff=42
16496 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
16497         echo "Ah, yes!  The good old days!" >&4
16498         echo "However, in the good old days we don't know how to stringify and"
16499         echo "catify at the same time."
16500         cpp_stuff=1
16501 else
16502         $cat >&4 <<EOM
16503 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
16504 to have to edit the values of CAT[2-5] in config.h...
16505 EOM
16506         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
16507 fi
16508 $rm -f cpp_stuff.*
16509
16510 : see if this is a db.h system
16511 set db.h i_db
16512 eval $inhdr
16513
16514 case "$i_db" in
16515 $define)
16516         : Check db version.
16517         echo " "
16518         echo "Checking Berkeley DB version ..." >&4
16519         $cat >try.c <<EOCP
16520 #$d_const HASCONST
16521 #ifndef HASCONST
16522 #define const
16523 #endif
16524 #include <sys/types.h>
16525 #include <stdio.h>
16526 #include <db.h>
16527 int main(int argc, char *argv[])
16528 {
16529 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
16530     int Major, Minor, Patch ;
16531     unsigned long Version ;
16532     (void)db_version(&Major, &Minor, &Patch) ;
16533     if (argc == 2) {
16534         printf("%d %d %d %d %d %d\n",
16535                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
16536                Major, Minor, Patch);
16537         exit(0);
16538     }
16539     printf("You have Berkeley DB Version 2 or greater.\n");
16540
16541     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
16542                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
16543     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
16544                 Major, Minor, Patch) ;
16545
16546     /* check that db.h & libdb are compatible */
16547     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
16548         printf("db.h and libdb are incompatible.\n") ;
16549         exit(3);        
16550     }
16551
16552     printf("db.h and libdb are compatible.\n") ;
16553
16554     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
16555                 + DB_VERSION_PATCH ;
16556
16557     /* needs to be >= 2.3.4 */
16558     if (Version < 2003004) {
16559     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
16560         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
16561         exit(2);        
16562     }
16563
16564     exit(0);
16565 #else
16566 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
16567     if (argc == 2) {
16568         printf("1 0 0\n");
16569         exit(0);
16570     }
16571     printf("You have Berkeley DB Version 1.\n");
16572     exit(0);    /* DB version < 2: the coast is clear. */
16573 #else
16574     exit(1);    /* <db.h> not Berkeley DB? */
16575 #endif
16576 #endif
16577 }
16578 EOCP
16579         set try
16580         if eval $compile_ok && $run ./try; then
16581                 echo 'Looks OK.' >&4
16582                 set `$run ./try 1`
16583                 db_version_major=$1
16584                 db_version_minor=$2
16585                 db_version_patch=$3
16586         else
16587                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
16588                 i_db=$undef
16589                 case " $libs " in
16590                 *"-ldb "*)
16591                         : Remove db from list of libraries to use
16592                         echo "Removing unusable -ldb from library list" >&4
16593                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
16594                         shift
16595                         libs="$*"
16596                         echo "libs = $libs" >&4
16597                         ;;
16598                 esac
16599         fi
16600         $rm -f try.*
16601         ;;
16602 esac
16603
16604 case "$i_db" in
16605 define)
16606         : Check the return type needed for hash 
16607         echo " "
16608         echo "Checking return type needed for hash for Berkeley DB ..." >&4
16609         $cat >try.c <<EOCP
16610 #$d_const HASCONST
16611 #ifndef HASCONST
16612 #define const
16613 #endif
16614 #include <sys/types.h>
16615 #include <db.h>
16616
16617 #ifndef DB_VERSION_MAJOR
16618 u_int32_t hash_cb (ptr, size)
16619 const void *ptr;
16620 size_t size;
16621 {
16622 }
16623 HASHINFO info;
16624 int main()
16625 {
16626         info.hash = hash_cb;
16627 }
16628 #endif
16629 EOCP
16630         if $cc $ccflags -c try.c >try.out 2>&1 ; then
16631                 if $contains warning try.out >>/dev/null 2>&1 ; then
16632                         db_hashtype='int'
16633                 else
16634                         db_hashtype='u_int32_t'
16635                 fi
16636         else
16637                 : XXX Maybe we should just give up here.
16638                 db_hashtype=u_int32_t
16639                 $cat try.out >&4
16640                 echo "Help:  I can't seem to compile the db test program." >&4
16641                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
16642         fi
16643         $rm -f try.*
16644         echo "Your version of Berkeley DB uses $db_hashtype for hash."
16645         ;;
16646 *)      db_hashtype=u_int32_t
16647         ;;
16648 esac
16649 case "$i_db" in
16650 define)
16651         : Check the return type needed for prefix 
16652         echo " "
16653         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
16654         cat >try.c <<EOCP
16655 #$d_const HASCONST
16656 #ifndef HASCONST
16657 #define const
16658 #endif
16659 #include <sys/types.h>
16660 #include <db.h>
16661
16662 #ifndef DB_VERSION_MAJOR
16663 size_t prefix_cb (key1, key2)
16664 const DBT *key1;
16665 const DBT *key2;
16666 {
16667 }
16668 BTREEINFO info;
16669 int main()
16670 {
16671         info.prefix = prefix_cb;
16672 }
16673 #endif
16674 EOCP
16675         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
16676                 if $contains warning try.out >>/dev/null 2>&1 ; then
16677                         db_prefixtype='int'
16678                 else
16679                         db_prefixtype='size_t'
16680                 fi
16681         else
16682                 db_prefixtype='size_t'
16683                 : XXX Maybe we should just give up here.
16684                 $cat try.out >&4
16685                 echo "Help:  I can't seem to compile the db test program." >&4
16686                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
16687         fi
16688         $rm -f try.*
16689         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
16690         ;;
16691 *)      db_prefixtype='size_t'
16692         ;;
16693 esac
16694
16695
16696 : How can we generate normalized random numbers ?
16697 echo " "
16698 echo "Looking for a random number function..." >&4
16699 case "$randfunc" in
16700 '')
16701         if set drand48 val -f; eval $csym; $val; then
16702                 dflt="drand48"
16703                 echo "Good, found drand48()." >&4
16704         elif set random val -f; eval $csym; $val; then
16705                 dflt="random"
16706                 echo "OK, found random()." >&4
16707         else
16708                 dflt="rand"
16709                 echo "Yick, looks like I have to use rand()." >&4
16710         fi
16711         echo " "
16712         ;;
16713 *)
16714         dflt="$randfunc"
16715         ;;
16716 esac
16717 cont=true
16718
16719 case "$ccflags" in
16720 *-Dmy_rand=*|*-Dmy_srand=*)
16721         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
16722         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
16723         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
16724         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
16725         ;;
16726 esac
16727
16728 while $test "$cont"; do
16729         rp="Use which function to generate random numbers?"
16730         . ./myread
16731         if $test "$ans" = "$dflt"; then
16732                 : null
16733         else
16734                 randbits=''
16735         fi
16736         randfunc="$ans"
16737         if set $ans val -f; eval $csym; $val; then
16738                 cont=''
16739         else
16740                 dflt=y
16741                 rp="I cannot find function $ans. Use that name anyway?"
16742                 . ./myread
16743                 dflt=rand
16744                 case "$ans" in
16745                         [yY]*) cont='';;
16746                 esac
16747         fi
16748         case "$cont" in
16749         '')
16750                 case "$randfunc" in
16751                 drand48)
16752                         drand01="drand48()"
16753                         seedfunc="srand48"
16754                         randbits=48
16755                         randseedtype=long
16756                         ;;
16757                 rand|random)
16758                         case "$randbits" in
16759                         '')
16760 echo "Checking to see how many bits your $randfunc() function produces..." >&4
16761                                 $cat >try.c <<EOCP
16762 #$i_unistd I_UNISTD
16763 #$i_stdlib I_STDLIB
16764 #include <stdio.h>
16765 #ifdef I_UNISTD
16766 #  include <unistd.h>
16767 #endif
16768 #ifdef I_STDLIB
16769 #  include <stdlib.h>
16770 #endif
16771 int main()
16772 {
16773         register int i;
16774         register unsigned long tmp;
16775         register unsigned long max = 0L;
16776
16777         for (i = 1000; i; i--) {
16778                 tmp = (unsigned long) $randfunc();
16779                 if (tmp > max) max = tmp;
16780         }
16781         for (i = 0; max; i++)
16782                 max /= 2;
16783         printf("%d\n",i);
16784 }
16785 EOCP
16786                                 set try
16787                                 if eval $compile_ok; then
16788                                         dflt=`try`
16789                                 else
16790                                         dflt='?'
16791                                         echo "(I can't seem to compile the test program...)"
16792                                 fi
16793                                 ;;
16794                         *)
16795                                 dflt="$randbits"
16796                                 ;;
16797                         esac
16798                         rp="How many bits does your $randfunc() function produce?"
16799                         . ./myread
16800                         randbits="$ans"
16801                         $rm -f try.c try
16802                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
16803                         seedfunc="s$randfunc"
16804                         randseedtype=unsigned
16805                         ;;
16806                 *)
16807                         dflt="31"
16808                         rp="How many bits does your $randfunc() function produce?"
16809                         . ./myread
16810                         randbits="$ans"
16811                         seedfunc="s$randfunc"
16812                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
16813                         if set $seedfunc val -f; eval $csym; $val; then
16814                                 echo "(Using $seedfunc() to seed random generator)"
16815                         else
16816                                 echo "(Warning: no $seedfunc() to seed random generator)"
16817                                 seedfunc=rand
16818                         fi
16819                         randseedtype=unsigned
16820                         ;;
16821                 esac
16822                 ;;
16823         esac
16824 done
16825
16826 echo " "
16827 echo "Determining whether or not we are on an EBCDIC system..." >&4
16828 $cat >try.c <<'EOM'
16829 int main()
16830 {
16831   if ('M'==0xd4) return 0;
16832   return 1;
16833 }
16834 EOM
16835
16836 val=$undef
16837 set try
16838 if eval $compile_ok; then
16839         if $run ./try; then
16840                 echo "You seem to speak EBCDIC." >&4
16841                 val="$define"
16842         else
16843                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
16844         fi
16845 else
16846         echo "I'm unable to compile the test program." >&4
16847         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
16848 fi
16849 $rm -f try try.*
16850 set ebcdic
16851 eval $setvar
16852
16853 echo " "
16854 $cat >&4 <<EOM
16855 Checking how to flush all pending stdio output...
16856 EOM
16857 # I only know how to find the first 32 possibly open files on SunOS.
16858 # See also hints/sunos_4_1.sh and util.c  --AD
16859 case "$osname" in
16860 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
16861 esac
16862 $cat >>try.c <<EOCP
16863 #include <stdio.h>
16864 #$i_unistd I_UNISTD
16865 #ifdef I_UNISTD
16866 # include <unistd.h>
16867 #endif
16868 #$d_sysconf HAS_SYSCONF
16869 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
16870 #ifdef HAS_STDIO_STREAM_ARRAY
16871 # define STDIO_STREAM_ARRAY $stdio_stream_array
16872 #endif
16873 int main() {
16874   FILE* p;
16875   unlink("try.out");
16876   p = fopen("try.out", "w");
16877 #ifdef TRY_FPUTC
16878   fputc('x', p);
16879 #else
16880 # ifdef TRY_FPRINTF
16881   fprintf(p, "x");
16882 # endif
16883 #endif
16884 #ifdef TRY_FFLUSH_NULL
16885   fflush(NULL);
16886 #endif
16887 #ifdef TRY_FFLUSH_ALL
16888   {
16889     long open_max = -1;
16890 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
16891     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
16892 # else
16893 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
16894     open_max = sysconf(_SC_OPEN_MAX);
16895 #  else
16896 #   ifdef FOPEN_MAX
16897     open_max = FOPEN_MAX;
16898 #   else
16899 #    ifdef OPEN_MAX
16900     open_max = OPEN_MAX;
16901 #    else
16902 #     ifdef _NFILE
16903     open_max = _NFILE;
16904 #     endif
16905 #    endif
16906 #   endif
16907 #  endif
16908 # endif 
16909 # ifdef HAS_STDIO_STREAM_ARRAY
16910     if (open_max > 0) {
16911       long i;
16912       for (i = 0; i < open_max; i++)
16913             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
16914                 STDIO_STREAM_ARRAY[i]._file < open_max &&
16915                 STDIO_STREAM_ARRAY[i]._flag)
16916                 fflush(&STDIO_STREAM_ARRAY[i]);
16917     }   
16918   }
16919 # endif
16920 #endif
16921   _exit(42);
16922 }
16923 EOCP
16924 : first we have to find out how _not_ to flush
16925 $to try.c
16926 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
16927     output=''
16928     set try -DTRY_FPUTC
16929     if eval $compile; then
16930             $run ./try 2>/dev/null
16931             code="$?"
16932             $from try.out
16933             if $test ! -s try.out -a "X$code" = X42; then
16934                 output=-DTRY_FPUTC
16935             fi
16936     fi
16937     case "$output" in
16938     '')
16939             set try -DTRY_FPRINTF
16940             if eval $compile; then
16941                     $run ./try 2>/dev/null
16942                     code="$?"
16943                     $from try.out
16944                     if $test ! -s try.out -a "X$code" = X42; then
16945                         output=-DTRY_FPRINTF
16946                     fi
16947             fi
16948         ;;
16949     esac
16950 fi
16951 : check for fflush NULL behaviour
16952 case "$fflushNULL" in
16953 '')     set try -DTRY_FFLUSH_NULL $output
16954         if eval $compile; then
16955                 $run ./try 2>/dev/null
16956                 code="$?"
16957                 $from try.out
16958                 if $test -s try.out -a "X$code" = X42; then
16959                         fflushNULL="`$cat try.out`"
16960                 else
16961                         if $test "X$code" != X42; then
16962                                 $cat >&4 <<EOM
16963 (If this test failed, don't worry, we'll try another method shortly.)
16964 EOM
16965                         fi
16966                 fi
16967         fi
16968         $rm -f core try.core core.try.*
16969         case "$fflushNULL" in
16970         x)      $cat >&4 <<EOM
16971 Your fflush(NULL) works okay for output streams.
16972 Let's see if it clobbers input pipes...
16973 EOM
16974 # As of mid-March 2000 all versions of Solaris appear to have a stdio
16975 # bug that improperly flushes the input end of pipes.  So we avoid the
16976 # autoflush on fork/system/exec support for now. :-(
16977 $cat >tryp.c <<EOCP
16978 #include <stdio.h>
16979 int
16980 main(int argc, char **argv)
16981 {
16982     char buf[1024];
16983     int i;
16984     char *bp = buf;
16985     while (1) {
16986         while ((i = getc(stdin)) != -1
16987                && (*bp++ = i) != '\n'
16988                && bp < &buf[1024])
16989         /* DO NOTHING */ ;
16990         *bp = '\0';
16991         fprintf(stdout, "%s", buf);
16992         fflush(NULL);
16993         if (i == -1)
16994             return 0;
16995         bp = buf;
16996     }
16997 }
16998 EOCP
16999                 fflushNULL="$define"
17000                 set tryp
17001                 if eval $compile; then
17002                     $rm -f tryp.out
17003                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17004                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
17005                        $cat >&4 <<EOM
17006 fflush(NULL) seems to behave okay with input streams.
17007 EOM
17008                         fflushNULL="$define"
17009                     else
17010                         $cat >&4 <<EOM
17011 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
17012 EOM
17013                         fflushNULL="$undef"
17014                     fi
17015                 fi
17016                 $rm -f core tryp.c tryp.core core.tryp.*
17017                 ;;
17018         '')     $cat >&4 <<EOM
17019 Your fflush(NULL) isn't working (contrary to ANSI C).
17020 EOM
17021                 fflushNULL="$undef"
17022                 ;;
17023         *)      $cat >&4 <<EOM
17024 Cannot figure out whether your fflush(NULL) works or not.
17025 I'm assuming it doesn't (contrary to ANSI C).
17026 EOM
17027                 fflushNULL="$undef"
17028                 ;;
17029         esac
17030         ;;
17031 $define|true|[yY]*)
17032         fflushNULL="$define"
17033         ;;
17034 *)
17035         fflushNULL="$undef"
17036         ;;
17037 esac
17038 : check explicit looping only if NULL did not work, and if the pipe
17039 : bug does not show up on an explicit flush too
17040 case "$fflushNULL" in
17041 "$undef")
17042         $cat >tryp.c <<EOCP
17043 #include <stdio.h>
17044 int
17045 main(int argc, char **argv)
17046 {
17047     char buf[1024];
17048     int i;
17049     char *bp = buf;
17050     while (1) {
17051         while ((i = getc(stdin)) != -1
17052                && (*bp++ = i) != '\n'
17053                && bp < &buf[1024])
17054         /* DO NOTHING */ ;
17055         *bp = '\0';
17056         fprintf(stdout, "%s", buf);
17057         fflush(stdin);
17058         if (i == -1)
17059             return 0;
17060         bp = buf;
17061     }
17062 }
17063 EOCP
17064         set tryp
17065         if eval $compile; then
17066             $rm -f tryp.out
17067             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17068             if cmp tryp.c tryp.out >/dev/null 2>&1; then
17069                $cat >&4 <<EOM
17070 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
17071 EOM
17072                 : now check for fflushall behaviour
17073                 case "$fflushall" in
17074                 '')     set try -DTRY_FFLUSH_ALL $output
17075                         if eval $compile; then
17076                                 $cat >&4 <<EOM
17077 (Now testing the other method--but note that this also may fail.)
17078 EOM
17079                                 $run ./try 2>/dev/null
17080                                 code=$?
17081                                 $from try.out
17082                                 if $test -s try.out -a "X$code" = X42; then
17083                                         fflushall="`$cat try.out`"
17084                                 fi
17085                         fi
17086                         $rm -f core try.core core.try.*
17087                         case "$fflushall" in
17088                         x)      $cat >&4 <<EOM
17089 Whew. Flushing explicitly all the stdio streams works.
17090 EOM
17091                                 fflushall="$define"
17092                                 ;;
17093                         '')     $cat >&4 <<EOM
17094 Sigh. Flushing explicitly all the stdio streams doesn't work.
17095 EOM
17096                                 fflushall="$undef"
17097                                 ;;
17098                         *)      $cat >&4 <<EOM
17099 Cannot figure out whether flushing stdio streams explicitly works or not.
17100 I'm assuming it doesn't.
17101 EOM
17102                                 fflushall="$undef"
17103                                 ;;
17104                         esac
17105                         ;;
17106                 "$define"|true|[yY]*)
17107                         fflushall="$define"
17108                         ;;
17109                 *)
17110                         fflushall="$undef"
17111                         ;;
17112                 esac
17113             else
17114                 $cat >&4 <<EOM
17115 All is futile.  Even fflush(stdin) clobbers input pipes!
17116 EOM
17117                 fflushall="$undef"
17118             fi
17119         else
17120             fflushall="$undef"
17121         fi
17122         $rm -f core tryp.c tryp.core core.tryp.*
17123         ;;
17124 *)      fflushall="$undef"
17125         ;;
17126 esac
17127
17128 case "$fflushNULL$fflushall" in
17129 undefundef)
17130         $cat <<EOM
17131 OK, I give up.  I cannot figure out how to flush pending stdio output.
17132 We won't be flushing handles at all before fork/exec/popen.
17133 EOM
17134         ;;
17135 esac
17136 $rm -f try.* try$exe_ext
17137
17138 : Store the full pathname to the ar program for use in the C program
17139 : Respect a hint or command line value for full_ar.
17140 case "$full_ar" in
17141 '') full_ar=$ar ;;
17142 esac
17143
17144 : Store the full pathname to the sed program for use in the C program
17145 full_sed=$sed
17146
17147 : see what type gids are declared as in the kernel
17148 echo " "
17149 echo "Looking for the type for group ids returned by getgid()."
17150 set gid_t gidtype xxx stdio.h sys/types.h
17151 eval $typedef
17152 case "$gidtype" in
17153 xxx)
17154         xxx=`./findhdr sys/user.h`
17155         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
17156         case $1 in
17157         unsigned) dflt="$1 $2" ;;
17158         *) dflt="$1" ;;
17159         esac
17160         ;;
17161 *) dflt="$gidtype";;
17162 esac
17163 case "$gidtype" in
17164 gid_t) echo "gid_t found." ;;
17165 *)      rp="What is the type for group ids returned by getgid()?"
17166         . ./myread
17167         gidtype="$ans"
17168         ;;
17169 esac
17170
17171 echo " "
17172 case "$gidtype" in
17173 *_t) zzz="$gidtype"     ;;
17174 *)   zzz="gid"          ;;
17175 esac
17176 echo "Checking the size of $zzz..." >&4 
17177 cat > try.c <<EOCP
17178 #include <sys/types.h>
17179 #include <stdio.h>
17180 int main() {
17181     printf("%d\n", (int)sizeof($gidtype));
17182     exit(0);
17183 }
17184 EOCP
17185 set try
17186 if eval $compile_ok; then
17187         yyy=`$run ./try`
17188         case "$yyy" in
17189         '')     gidsize=4
17190                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
17191                 ;;
17192         *)      gidsize=$yyy
17193                 echo "Your $zzz is $gidsize bytes long."
17194                 ;;
17195         esac
17196 else
17197         gidsize=4
17198         echo "(I can't compile the test program--guessing $gidsize.)" >&4
17199 fi
17200
17201
17202 echo " "
17203 case "$gidtype" in
17204 *_t) zzz="$gidtype"     ;;
17205 *)   zzz="gid"          ;;
17206 esac
17207 echo "Checking the sign of $zzz..." >&4 
17208 cat > try.c <<EOCP
17209 #include <sys/types.h>
17210 #include <stdio.h>
17211 int main() {
17212         $gidtype foo = -1;
17213         if (foo < 0)
17214                 printf("-1\n");
17215         else
17216                 printf("1\n");
17217 }
17218 EOCP
17219 set try
17220 if eval $compile; then
17221         yyy=`$run ./try`
17222         case "$yyy" in
17223         '')     gidsign=1
17224                 echo "(I can't execute the test program--guessing unsigned.)" >&4
17225                 ;;
17226         *)      gidsign=$yyy
17227                 case "$gidsign" in
17228                  1) echo "Your $zzz is unsigned." ;;
17229                 -1) echo "Your $zzz is signed."   ;;
17230                 esac
17231                 ;;
17232         esac
17233 else
17234         gidsign=1
17235         echo "(I can't compile the test program--guessing unsigned.)" >&4
17236 fi
17237
17238
17239 echo " "
17240
17241 if $test X"$quadtype" != X; then
17242
17243 echo "Checking how to print 64-bit integers..." >&4
17244
17245 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
17246         $cat >try.c <<'EOCP'
17247 #include <sys/types.h>
17248 #include <stdio.h>
17249 int main() {
17250   int q = 12345678901;
17251   printf("%ld\n", q);
17252 }
17253 EOCP
17254         set try
17255         if eval $compile; then
17256                 yyy=`$run ./try`
17257                 case "$yyy" in
17258                 12345678901)
17259                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
17260                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
17261                         echo "We will use %d."
17262                         ;;
17263                 esac
17264         fi
17265 fi
17266
17267 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
17268         $cat >try.c <<'EOCP'
17269 #include <sys/types.h>
17270 #include <stdio.h>
17271 int main() {
17272   long q = 12345678901;
17273   printf("%ld\n", q);
17274 }
17275 EOCP
17276         set try
17277         if eval $compile; then
17278                 yyy=`$run ./try`
17279                 case "$yyy" in
17280                 12345678901)
17281                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
17282                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
17283                         echo "We will use %ld."
17284                         ;;
17285                 esac
17286         fi
17287 fi
17288
17289 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
17290         $cat >try.c <<'EOCP'
17291 #include <sys/types.h>
17292 #include <inttypes.h>
17293 #include <stdio.h>
17294 int main() {
17295   int64_t q = 12345678901;
17296   printf("%" PRId64 "\n", q);
17297 }
17298 EOCP
17299         set try
17300         if eval $compile; then
17301                 yyy=`$run ./try`
17302                 case "$yyy" in
17303                 12345678901)
17304                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
17305                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
17306                         echo "We will use the C9X style."
17307                         ;;
17308                 esac
17309         fi
17310 fi
17311
17312 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17313         $cat >try.c <<EOCP
17314 #include <sys/types.h>
17315 #include <stdio.h>
17316 int main() {
17317   $quadtype q = 12345678901;
17318   printf("%Ld\n", q);
17319 }
17320 EOCP
17321         set try
17322         if eval $compile; then
17323                 yyy=`$run ./try`
17324                 case "$yyy" in
17325                 12345678901)
17326                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
17327                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
17328                         echo "We will use %Ld."
17329                         ;;
17330                 esac
17331         fi
17332 fi
17333
17334 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
17335         $cat >try.c <<'EOCP'
17336 #include <sys/types.h>
17337 #include <stdio.h>
17338 int main() {
17339   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
17340   printf("%lld\n", q);
17341 }
17342 EOCP
17343         set try
17344         if eval $compile; then
17345                 yyy=`$run ./try`
17346                 case "$yyy" in
17347                 12345678901)
17348                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
17349                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
17350                         echo "We will use the %lld style."
17351                         ;;
17352                 esac
17353         fi
17354 fi
17355
17356 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17357         $cat >try.c <<EOCP
17358 #include <sys/types.h>
17359 #include <stdio.h>
17360 int main() {
17361   $quadtype q = 12345678901;
17362   printf("%qd\n", q);
17363 }
17364 EOCP
17365         set try
17366         if eval $compile; then
17367                 yyy=`$run ./try`
17368                 case "$yyy" in
17369                 12345678901)
17370                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
17371                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
17372                         echo "We will use %qd."
17373                         ;;
17374                 esac
17375         fi
17376 fi
17377
17378 if $test X"$sPRId64" = X; then
17379         echo "Cannot figure out how to print 64-bit integers." >&4
17380 fi
17381
17382 $rm -f try try.*
17383
17384 fi
17385
17386 case "$sPRId64" in
17387 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
17388         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
17389         ;;
17390 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
17391         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
17392         ;;
17393 esac
17394
17395
17396 echo " "
17397 $echo "Checking the format strings to be used for Perl's internal types..." >&4
17398
17399 if $test X"$ivsize" = X8; then
17400         ivdformat="$sPRId64"
17401         uvuformat="$sPRIu64"
17402         uvoformat="$sPRIo64"
17403         uvxformat="$sPRIx64"
17404         uvXUformat="$sPRIXU64"
17405 else
17406         if $test X"$ivsize" = X"$longsize"; then
17407                 ivdformat='"ld"'
17408                 uvuformat='"lu"'
17409                 uvoformat='"lo"'
17410                 uvxformat='"lx"'
17411                 uvXUformat='"lX"'
17412         else
17413                 if $test X"$ivsize" = X"$intsize"; then
17414                         ivdformat='"d"'
17415                         uvuformat='"u"'
17416                         uvoformat='"o"'
17417                         uvxformat='"x"'
17418                         uvXUformat='"X"'
17419                 else
17420                         : far out
17421                         if $test X"$ivsize" = X"$shortsize"; then
17422                                 ivdformat='"hd"'
17423                                 uvuformat='"hu"'
17424                                 uvoformat='"ho"'
17425                                 uvxformat='"hx"'
17426                                 uvXUformat='"hX"'
17427                         fi
17428                 fi
17429         fi
17430 fi
17431
17432 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
17433         nveformat="$sPRIeldbl"
17434         nvfformat="$sPRIfldbl"
17435         nvgformat="$sPRIgldbl"
17436         nvEUformat="$sPRIEUldbl"
17437         nvFUformat="$sPRIFUldbl"
17438         nvGUformat="$sPRIGUldbl"
17439 else
17440         nveformat='"e"'
17441         nvfformat='"f"'
17442         nvgformat='"g"'
17443         nvEUformat='"E"'
17444         nvFUformat='"F"'
17445         nvGUformat='"G"'
17446 fi
17447
17448 case "$ivdformat" in
17449 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
17450     exit 1
17451     ;;
17452 esac
17453
17454
17455 echo " "
17456 $echo "Checking the format string to be used for gids..." >&4
17457
17458 case "$gidsign" in
17459 -1)     if $test X"$gidsize" = X"$ivsize"; then
17460                 gidformat="$ivdformat"
17461         else
17462                 if $test X"$gidsize" = X"$longsize"; then
17463                         gidformat='"ld"'
17464                 else
17465                         if $test X"$gidsize" = X"$intsize"; then
17466                                 gidformat='"d"'
17467                         else
17468                                 if $test X"$gidsize" = X"$shortsize"; then
17469                                         gidformat='"hd"'
17470                                 fi
17471                         fi
17472                 fi
17473         fi
17474         ;;
17475 *)      if $test X"$gidsize" = X"$uvsize"; then
17476                 gidformat="$uvuformat"
17477         else
17478                 if $test X"$gidsize" = X"$longsize"; then
17479                         gidformat='"lu"'
17480                 else
17481                         if $test X"$gidsize" = X"$intsize"; then
17482                                 gidformat='"u"'
17483                         else
17484                                 if $test X"$gidsize" = X"$shortsize"; then
17485                                         gidformat='"hu"'
17486                                 fi
17487                         fi
17488                 fi
17489         fi
17490         ;;
17491 esac
17492
17493 : see if getgroups exists
17494 set getgroups d_getgrps
17495 eval $inlibc
17496
17497 : see if setgroups exists
17498 set setgroups d_setgrps
17499 eval $inlibc
17500
17501
17502 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
17503 echo " "
17504 case "$d_getgrps$d_setgrps" in
17505 *define*)
17506         case "$groupstype" in
17507         '') dflt="$gidtype" ;;
17508         *)  dflt="$groupstype" ;;
17509         esac
17510         $cat <<EOM
17511 What type of pointer is the second argument to getgroups() and setgroups()?
17512 Usually this is the same as group ids, $gidtype, but not always.
17513
17514 EOM
17515         rp='What type pointer is the second argument to getgroups() and setgroups()?'
17516         . ./myread
17517         groupstype="$ans"
17518         ;;
17519 *)  groupstype="$gidtype";;
17520 esac
17521
17522 echo " "
17523 echo "Checking if your $make program sets \$(MAKE)..." >&4
17524 case "$make_set_make" in
17525 '')
17526         $sed 's/^X //' > testmake.mak << 'EOF'
17527 Xall:
17528 X       @echo 'maketemp="$(MAKE)"'
17529 EOF
17530         case "`$make -f testmake.mak 2>/dev/null`" in
17531         *maketemp=*) make_set_make='#' ;;
17532         *)      make_set_make="MAKE=$make" ;;
17533         esac
17534         $rm -f testmake.mak
17535         ;;
17536 esac
17537 case "$make_set_make" in
17538 '#') echo "Yup, it does.";;
17539 *) echo "Nope, it doesn't.";;
17540 esac
17541
17542 : see what type is used for mode_t
17543 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
17544 set mode_t modetype int stdio.h sys/types.h
17545 eval $typedef_ask
17546
17547 : see if stdarg is available
17548 echo " "
17549 if $test `./findhdr stdarg.h`; then
17550         echo "<stdarg.h> found." >&4
17551         valstd="$define"
17552 else
17553         echo "<stdarg.h> NOT found." >&4
17554         valstd="$undef"
17555 fi
17556
17557 : see if varags is available
17558 echo " "
17559 if $test `./findhdr varargs.h`; then
17560         echo "<varargs.h> found." >&4
17561 else
17562         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
17563 fi
17564
17565 : set up the varargs testing programs
17566 $cat > varargs.c <<EOP
17567 #ifdef I_STDARG
17568 #include <stdarg.h>
17569 #endif
17570 #ifdef I_VARARGS
17571 #include <varargs.h>
17572 #endif
17573
17574 #ifdef I_STDARG
17575 int f(char *p, ...)
17576 #else
17577 int f(va_alist)
17578 va_dcl
17579 #endif
17580 {
17581         va_list ap;
17582 #ifndef I_STDARG
17583         char *p;
17584 #endif
17585 #ifdef I_STDARG
17586         va_start(ap,p);
17587 #else
17588         va_start(ap);
17589         p = va_arg(ap, char *);
17590 #endif
17591         va_end(ap);
17592 }
17593 EOP
17594 $cat > varargs <<EOP
17595 $startsh
17596 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
17597         echo "true"
17598 else
17599         echo "false"
17600 fi
17601 $rm -f varargs$_o
17602 EOP
17603 chmod +x varargs
17604
17605 : now check which varargs header should be included
17606 echo " "
17607 i_varhdr=''
17608 case "$valstd" in
17609 "$define")
17610         if `./varargs I_STDARG`; then
17611                 val='stdarg.h'
17612         elif `./varargs I_VARARGS`; then
17613                 val='varargs.h'
17614         fi
17615         ;;
17616 *)
17617         if `./varargs I_VARARGS`; then
17618                 val='varargs.h'
17619         fi
17620         ;;
17621 esac
17622 case "$val" in
17623 '')
17624 echo "I could not find the definition for va_dcl... You have problems..." >&4
17625         val="$undef"; set i_stdarg; eval $setvar
17626         val="$undef"; set i_varargs; eval $setvar
17627         ;;
17628 *) 
17629         set i_varhdr
17630         eval $setvar
17631         case "$i_varhdr" in
17632         stdarg.h)
17633                 val="$define"; set i_stdarg; eval $setvar
17634                 val="$undef"; set i_varargs; eval $setvar
17635                 ;;
17636         varargs.h)
17637                 val="$undef"; set i_stdarg; eval $setvar
17638                 val="$define"; set i_varargs; eval $setvar
17639                 ;;
17640         esac
17641         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
17642 esac
17643 $rm -f varargs*
17644
17645 : see if we need va_copy
17646 echo " "
17647 case "$i_stdarg" in
17648 "$define")
17649         $cat >try.c <<EOCP
17650 #include <stdarg.h>
17651 #include <stdio.h>
17652 #$i_stdlib I_STDLIB
17653 #ifdef I_STDLIB
17654 #include <stdlib.h>
17655 #endif
17656 #include <signal.h>
17657
17658 int
17659 ivfprintf(FILE *f, const char *fmt, va_list *valp)
17660 {
17661   return vfprintf(f, fmt, *valp);
17662 }
17663  
17664 int    
17665 myvfprintf(FILE *f, const  char *fmt, va_list val)
17666 {
17667   return ivfprintf(f, fmt, &val);
17668 }
17669       
17670 int
17671 myprintf(char *fmt, ...) 
17672 {
17673   va_list val;
17674   va_start(val, fmt);
17675   return myvfprintf(stdout, fmt, val); 
17676 }         
17677
17678 int
17679 main(int ac, char **av)
17680 {
17681   signal(SIGSEGV, exit);
17682
17683   myprintf("%s%cs all right, then\n", "that", '\'');                            
17684   exit(0);      
17685 }
17686 EOCP
17687         set try
17688         if eval $compile && $run ./try 2>&1 >/dev/null; then
17689                 case "`$run ./try`" in
17690                 "that's all right, then")
17691                         okay=yes
17692                         ;;
17693                 esac
17694         fi
17695         case "$okay" in
17696         yes)    echo "It seems that you don't need va_copy()." >&4
17697                 need_va_copy="$undef"
17698                 ;;
17699         *)      echo "It seems that va_copy() or similar will be needed." >&4
17700                 need_va_copy="$define"
17701                 ;;
17702         esac
17703         $rm -f try.* core core.* *.core *.core.*
17704         ;;
17705 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
17706         ;;
17707 esac
17708
17709 : see what type is used for size_t
17710 rp="What is the type used for the length parameter for string functions?"
17711 set size_t sizetype 'unsigned int' stdio.h sys/types.h
17712 eval $typedef_ask
17713
17714 : check for type of arguments to gethostbyaddr. 
17715 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
17716         case "$d_gethbyaddr" in
17717         $define)
17718                 $cat <<EOM
17719
17720 Checking to see what type of arguments are accepted by gethostbyaddr().
17721 EOM
17722                 hdrs="$define sys/types.h
17723                         $d_socket sys/socket.h 
17724                         $i_niin netinet/in.h 
17725                         $i_netdb netdb.h
17726                         $i_unistd unistd.h"
17727                 : The first arg can 'char *' or 'void *'
17728                 : The second arg is some of integral type
17729                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
17730                         for yyy in size_t long int; do
17731                                 case "$netdb_host_type" in
17732                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
17733                                         if ./protochk "$try" $hdrs; then
17734                                                 echo "Your system accepts $xxx for the first arg."
17735                                                 echo "...and $yyy for the second arg."
17736                                                 netdb_host_type="$xxx"
17737                                                 netdb_hlen_type="$yyy"
17738                                         fi
17739                                         ;;
17740                                 esac
17741                         done
17742                 done
17743                 : In case none of those worked, prompt the user.
17744                 case "$netdb_host_type" in
17745                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
17746                         dflt='char *'
17747                         . ./myread
17748                         netdb_host_type=$ans
17749                         rp='What is the type for the 2nd argument to gethostbyaddr?'
17750                         dflt="$sizetype"
17751                         . ./myread
17752                         netdb_hlen_type=$ans
17753                         ;;
17754                 esac
17755                 ;;
17756         *)      : no gethostbyaddr, so pick harmless defaults
17757                 netdb_host_type='char *'
17758                 netdb_hlen_type="$sizetype"
17759                 ;;
17760         esac
17761         # Remove the "const" if needed. -- but then we'll have a 
17762         # prototype clash!
17763         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
17764 fi
17765
17766 : check for type of argument to gethostbyname. 
17767 if test "X$netdb_name_type" = X ; then
17768         case "$d_gethbyname" in
17769         $define)
17770                 $cat <<EOM
17771
17772 Checking to see what type of argument is accepted by gethostbyname().
17773 EOM
17774                 hdrs="$define sys/types.h
17775                         $d_socket sys/socket.h 
17776                         $i_niin netinet/in.h 
17777                         $i_netdb netdb.h
17778                         $i_unistd unistd.h"
17779                 for xxx in "const char *" "char *"; do
17780                         case "$netdb_name_type" in
17781                         '')     try="extern struct hostent *gethostbyname($xxx);"
17782                                 if ./protochk "$try" $hdrs; then
17783                                         echo "Your system accepts $xxx."
17784                                         netdb_name_type="$xxx"
17785                                 fi
17786                                 ;;
17787                         esac
17788                 done
17789                 : In case none of those worked, prompt the user.
17790                 case "$netdb_name_type" in
17791                 '')     rp='What is the type for the 1st argument to gethostbyname?'
17792                         dflt='char *'
17793                         . ./myread
17794                         netdb_name_type=$ans
17795                         ;;
17796                 esac
17797                 ;;
17798         *)      : no gethostbyname, so pick harmless default
17799                 netdb_name_type='char *'
17800                 ;;
17801         esac
17802 fi
17803
17804 : check for type of 1st argument to getnetbyaddr. 
17805 if test "X$netdb_net_type" = X ; then
17806         case "$d_getnbyaddr" in
17807         $define)
17808                 $cat <<EOM
17809
17810 Checking to see what type of 1st argument is accepted by getnetbyaddr().
17811 EOM
17812                 hdrs="$define sys/types.h
17813                         $d_socket sys/socket.h 
17814                         $i_niin netinet/in.h 
17815                         $i_netdb netdb.h
17816                         $i_unistd unistd.h"
17817                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
17818                         case "$netdb_net_type" in
17819                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
17820                                 if ./protochk "$try" $hdrs; then
17821                                         echo "Your system accepts $xxx."
17822                                         netdb_net_type="$xxx"
17823                                 fi
17824                                 ;;
17825                         esac
17826                 done
17827                 : In case none of those worked, prompt the user.
17828                 case "$netdb_net_type" in
17829                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
17830                         dflt='long'
17831                         . ./myread
17832                         netdb_net_type=$ans
17833                         ;;
17834                 esac
17835                 ;;
17836         *)      : no getnetbyaddr, so pick harmless default
17837                 netdb_net_type='long'
17838                 ;;
17839         esac
17840 fi
17841 : locate the preferred pager for this system
17842 case "$pager" in
17843 '')
17844         dflt=''
17845         case "$pg" in
17846         /*) dflt=$pg;;
17847         [a-zA-Z]:/*) dflt=$pg;;
17848         esac
17849         case "$more" in
17850         /*) dflt=$more;;
17851         [a-zA-Z]:/*) dflt=$more;;
17852         esac
17853         case "$less" in
17854         /*) dflt=$less;;
17855         [a-zA-Z]:/*) dflt=$less;;
17856         esac
17857         case "$dflt" in
17858         '') dflt=/usr/ucb/more;;
17859         esac
17860         ;;
17861 *) dflt="$pager";;
17862 esac
17863 echo " "
17864 fn=f/
17865 rp='What pager is used on your system?'
17866 . ./getfile
17867 pager="$ans"
17868
17869 : see what type pids are declared as in the kernel
17870 rp="What is the type of process ids on this system?"
17871 set pid_t pidtype int stdio.h sys/types.h
17872 eval $typedef_ask
17873
17874 : Find earliest binary compatible site_perl subdirectory perl can use.
17875 xs_apiversion=$version # The current site_perl version.
17876 : Find earliest pure perl site_perl subdirectory perl can use.
17877 : The versioned directories started at 5.005.
17878 pm_apiversion='5.005'
17879
17880 : see if ar generates random libraries by itself
17881 echo " "
17882 echo "Checking how to generate random libraries on your machine..." >&4
17883 echo 'int bar1() { return bar2(); }' > bar1.c
17884 echo 'int bar2() { return 2; }' > bar2.c
17885 $cat > foo.c <<'EOP'
17886 int main() { printf("%d\n", bar1()); exit(0); }
17887 EOP
17888 $cc $ccflags -c bar1.c >/dev/null 2>&1
17889 $cc $ccflags -c bar2.c >/dev/null 2>&1
17890 $cc $ccflags -c foo.c >/dev/null 2>&1
17891 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
17892 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
17893         $run ./foobar >/dev/null 2>&1; then
17894         echo "$ar appears to generate random libraries itself."
17895         orderlib=false
17896         ranlib=":"
17897 elif $ar ts bar$_a >/dev/null 2>&1 &&
17898         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
17899         $run ./foobar >/dev/null 2>&1; then
17900                 echo "a table of contents needs to be added with '$ar ts'."
17901                 orderlib=false
17902                 ranlib="$ar ts"
17903 else
17904         case "$ranlib" in
17905         :) ranlib='';;
17906         '')
17907                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
17908                 $test -f $ranlib || ranlib=''
17909                 ;;
17910         esac
17911         if $test -n "$ranlib"; then
17912                 echo "your system has '$ranlib'; we'll use that."
17913                 orderlib=false
17914         else
17915                 echo "your system doesn't seem to support random libraries"
17916                 echo "so we'll use lorder and tsort to order the libraries."
17917                 orderlib=true
17918                 ranlib=":"
17919         fi
17920 fi
17921 $rm -f foo* bar* 
17922
17923 : check for type of arguments to select. 
17924 case "$selecttype" in
17925 '') case "$d_select" in
17926         $define)
17927                 echo " "
17928                 $cat <<EOM
17929 Checking to see what type of arguments are accepted by select().
17930 EOM
17931                 hdrs="$define sys/types.h
17932                         $i_systime sys/time.h 
17933                         $i_sysselct sys/select.h
17934                         $d_socket sys/socket.h"
17935                 : The first arg can be int, unsigned, or size_t
17936                 : The last arg may or may not be 'const'
17937                 val=''
17938                 : void pointer has been seen but using that
17939                 : breaks the selectminbits test
17940                 for xxx in 'fd_set *' 'int *'; do
17941                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
17942                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
17943                                         case "$val" in
17944                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
17945                                                 if ./protochk "$try" $hdrs; then
17946                                                         echo "Your system accepts $xxx."
17947                                                         val="$xxx"
17948                                                 fi
17949                                                 ;;
17950                                         esac
17951                                 done
17952                         done
17953                 done
17954                 case "$val" in
17955                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
17956                         case "$d_fd_set" in
17957                                 $define) dflt="fd_set *" ;;
17958                                 *)              dflt="int *" ;;
17959                         esac
17960                         . ./myread
17961                         val=$ans
17962                         ;;
17963                 esac
17964                 selecttype="$val"
17965                 ;;
17966         *)      : no select, so pick a harmless default
17967                 selecttype='int *'
17968                 ;;
17969         esac
17970         ;;
17971 esac
17972
17973 : check for the select 'width'
17974 case "$selectminbits" in
17975 '') case "$d_select" in
17976         $define)
17977                 $cat <<EOM
17978
17979 Checking to see on how many bits at a time your select() operates...
17980 EOM
17981                 $cat >try.c <<EOCP
17982 #include <sys/types.h>
17983 #$i_time I_TIME
17984 #$i_systime I_SYS_TIME
17985 #$i_systimek I_SYS_TIME_KERNEL
17986 #ifdef I_TIME
17987 #   include <time.h>
17988 #endif
17989 #ifdef I_SYS_TIME
17990 #   ifdef I_SYS_TIME_KERNEL
17991 #       define KERNEL
17992 #   endif
17993 #   include <sys/time.h>
17994 #   ifdef I_SYS_TIME_KERNEL
17995 #       undef KERNEL
17996 #   endif
17997 #endif
17998 #$i_sysselct I_SYS_SELECT
17999 #ifdef I_SYS_SELECT
18000 #include <sys/select.h>
18001 #endif
18002 #$d_socket HAS_SOCKET
18003 #ifdef HAS_SOCKET
18004 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
18005 #endif
18006 #include <stdio.h>
18007 $selecttype b;
18008 #define S sizeof(*(b))
18009 #define MINBITS 64
18010 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
18011 #define NBITS  (NBYTES * 8)
18012 int main() {
18013     char s[NBYTES];
18014     struct timeval t;
18015     int i;
18016     FILE* fp;
18017     int fd;
18018
18019     fclose(stdin);
18020     fp = fopen("try.c", "r");
18021     if (fp == 0)
18022       exit(1);
18023     fd = fileno(fp);
18024     if (fd < 0)
18025       exit(2);
18026     b = ($selecttype)s;
18027     for (i = 0; i < NBITS; i++)
18028         FD_SET(i, b);
18029     t.tv_sec  = 0;
18030     t.tv_usec = 0;
18031     select(fd + 1, b, 0, 0, &t);
18032     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
18033     printf("%d\n", i + 1);
18034     return 0;
18035 }
18036 EOCP
18037                 set try
18038                 if eval $compile_ok; then
18039                         selectminbits=`$run ./try`
18040                         case "$selectminbits" in
18041                         '')     cat >&4 <<EOM
18042 Cannot figure out on how many bits at a time your select() operates.
18043 I'll play safe and guess it is 32 bits.
18044 EOM
18045                                 selectminbits=32
18046                                 bits="32 bits"
18047                                 ;;
18048                         1)      bits="1 bit" ;;
18049                         *)      bits="$selectminbits bits" ;;
18050                         esac
18051                         echo "Your select() operates on $bits at a time." >&4
18052                 else
18053                         rp='What is the minimum number of bits your select() operates on?'
18054                         case "$byteorder" in
18055                         1234|12345678)  dflt=32 ;;
18056                         *)              dflt=1  ;;
18057                         esac
18058                         . ./myread
18059                         val=$ans
18060                         selectminbits="$val"
18061                 fi
18062                 $rm -f try.* try
18063                 ;;
18064         *)      : no select, so pick a harmless default
18065                 selectminbits='32'
18066                 ;;
18067         esac
18068         ;;
18069 esac
18070
18071 : Trace out the files included by signal.h, then look for SIGxxx names.
18072 : Remove SIGARRAYSIZE used by HPUX.
18073 : Remove SIGSTKSIZE used by Linux.
18074 : Remove SIGSTKSZ used by Posix.
18075 : Remove SIGTYP void lines used by OS2.
18076 : Some cpps, like os390, dont give the file name anywhere
18077 if [ "X$fieldn" = X ]; then
18078         : Just make some guesses.  We check them later.
18079         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
18080 else
18081         xxx=`echo '#include <signal.h>' |
18082         $cppstdin $cppminus $cppflags 2>/dev/null |
18083         $grep '^[       ]*#.*include' | 
18084         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
18085 fi
18086 : Check this list of files to be sure we have parsed the cpp output ok.
18087 : This will also avoid potentially non-existent files, such 
18088 : as ../foo/bar.h
18089 xxxfiles=''
18090 for xx in $xxx /dev/null ; do
18091         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
18092 done
18093 : If we have found no files, at least try signal.h
18094 case "$xxxfiles" in
18095 '')     xxxfiles=`./findhdr signal.h` ;;
18096 esac
18097 xxx=`awk '
18098 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
18099         print substr($2, 4, 20)
18100 }
18101 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
18102         print substr($3, 4, 20)
18103 }' $xxxfiles`
18104 : Append some common names just in case the awk scan failed.
18105 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
18106 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
18107 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
18108 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
18109 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
18110
18111 : generate a few handy files for later
18112 $cat > signal.c <<'EOCP'
18113 #include <sys/types.h>
18114 #include <signal.h>
18115 #include <stdio.h>
18116 int main() {
18117
18118 /* Strange style to avoid deeply-nested #if/#else/#endif */
18119 #ifndef NSIG
18120 #  ifdef _NSIG
18121 #    define NSIG (_NSIG)
18122 #  endif
18123 #endif
18124
18125 #ifndef NSIG
18126 #  ifdef SIGMAX
18127 #    define NSIG (SIGMAX+1)
18128 #  endif
18129 #endif
18130
18131 #ifndef NSIG
18132 #  ifdef SIG_MAX
18133 #    define NSIG (SIG_MAX+1)
18134 #  endif
18135 #endif
18136
18137 #ifndef NSIG
18138 #  ifdef MAXSIG
18139 #    define NSIG (MAXSIG+1)
18140 #  endif
18141 #endif
18142
18143 #ifndef NSIG
18144 #  ifdef MAX_SIG
18145 #    define NSIG (MAX_SIG+1)
18146 #  endif
18147 #endif
18148
18149 #ifndef NSIG
18150 #  ifdef SIGARRAYSIZE
18151 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
18152 #  endif
18153 #endif
18154
18155 #ifndef NSIG
18156 #  ifdef _sys_nsig
18157 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
18158 #  endif
18159 #endif
18160
18161 /* Default to some arbitrary number that's big enough to get most
18162    of the common signals.
18163 */
18164 #ifndef NSIG
18165 #    define NSIG 50
18166 #endif
18167
18168 printf("NSIG %d\n", NSIG);
18169
18170 #ifndef JUST_NSIG
18171
18172 EOCP
18173
18174 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
18175 {
18176         printf "#ifdef SIG"; printf $1; printf "\n"
18177         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
18178         printf $1; printf ");\n"
18179         printf "#endif\n"
18180 }
18181 END {
18182         printf "#endif /* JUST_NSIG */\n";
18183         printf "exit(0);\n}\n";
18184 }
18185 ' >>signal.c
18186 $cat >signal.awk <<'EOP'
18187 BEGIN { ndups = 0 }
18188 $1 ~ /^NSIG$/ { nsig = $2 }
18189 ($1 !~ /^NSIG$/) && (NF == 2) {
18190     if ($2 > maxsig) { maxsig = $2 }
18191     if (sig_name[$2]) {
18192         dup_name[ndups] = $1
18193         dup_num[ndups] = $2
18194         ndups++ 
18195     }
18196     else {
18197         sig_name[$2] = $1
18198         sig_num[$2] = $2
18199     }
18200 }
18201 END { 
18202     if (nsig == 0) {
18203         nsig = maxsig + 1
18204     }
18205     printf("NSIG %d\n", nsig);
18206     for (n = 1; n < nsig; n++) {
18207         if (sig_name[n]) {
18208             printf("%s %d\n", sig_name[n], sig_num[n])
18209         }
18210         else {
18211             printf("NUM%d %d\n", n, n) 
18212         }
18213     }
18214     for (n = 0; n < ndups; n++) {
18215         printf("%s %d\n", dup_name[n], dup_num[n])
18216     }
18217 }
18218 EOP
18219 $cat >signal_cmd <<EOS
18220 $startsh
18221 if $test -s signal.lst; then
18222     echo "Using your existing signal.lst file"
18223         exit 0
18224 fi
18225 xxx="$xxx"
18226 EOS
18227 $cat >>signal_cmd <<'EOS'
18228
18229 set signal
18230 if eval $compile_ok; then
18231         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
18232 else
18233         echo "(I can't seem be able to compile the whole test program)" >&4
18234         echo "(I'll try it in little pieces.)" >&4
18235         set signal -DJUST_NSIG
18236         if eval $compile_ok; then
18237                 $run ./signal$_exe > signal.nsg
18238                 $cat signal.nsg
18239         else
18240                 echo "I can't seem to figure out how many signals you have." >&4
18241                 echo "Guessing 50." >&4
18242                 echo 'NSIG 50' > signal.nsg
18243         fi
18244         : Now look at all the signal names, one at a time.
18245         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
18246                 $cat > signal.c <<EOCP
18247 #include <sys/types.h>
18248 #include <signal.h>
18249 #include <stdio.h>
18250 int main() {
18251 printf("$xx %d\n", SIG${xx});
18252 return 0;
18253 }
18254 EOCP
18255                 set signal
18256                 if eval $compile; then
18257                         echo "SIG${xx} found."
18258                         $run ./signal$_exe  >> signal.ls1
18259                 else
18260                         echo "SIG${xx} NOT found."
18261                 fi
18262         done
18263         if $test -s signal.ls1; then
18264                 $cat signal.nsg signal.ls1 |
18265                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
18266         fi
18267
18268 fi
18269 if $test -s signal.lst; then
18270         :
18271 else
18272         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
18273         echo 'kill -l' >signal
18274         set X `csh -f <signal`
18275         $rm -f signal
18276         shift
18277         case $# in
18278         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
18279         esac
18280         echo $@ | $tr ' ' $trnl | \
18281             $awk '{ printf "%s %d\n", $1, ++s; }
18282                   END { printf "NSIG %d\n", ++s }' >signal.lst
18283 fi
18284 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
18285 EOS
18286 chmod a+x signal_cmd
18287 $eunicefix signal_cmd
18288
18289 : generate list of signal names
18290 echo " "
18291 case "$sig_name_init" in
18292 '') doinit=yes ;;
18293 *)  case "$sig_num_init" in
18294     ''|*,*) doinit=yes ;;
18295     esac ;;
18296 esac
18297 case "$doinit" in
18298 yes)
18299         echo "Generating a list of signal names and numbers..." >&4
18300         . ./signal_cmd
18301         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
18302         sig_name=`$awk 'BEGIN { printf "ZERO " }
18303                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
18304         sig_num=`$awk  'BEGIN { printf "0 " }
18305                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
18306         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
18307                              !/^NSIG/   { printf "\"%s\", ", $1 }
18308                              END        { printf "0\n" }' signal.lst`
18309         sig_num_init=`$awk  'BEGIN      { printf "0, " }
18310                              !/^NSIG/   { printf "%d, ", $2}
18311                              END        { printf "0\n"}' signal.lst`
18312         ;;
18313 esac
18314 echo "The following $sig_count signals are available:"
18315 echo " "
18316 echo $sig_name | $awk \
18317 'BEGIN { linelen = 0 }
18318 {
18319         for (i = 1; i <= NF; i++) {
18320                 name = "SIG" $i " "
18321                 linelen = linelen + length(name)
18322                 if (linelen > 70) {
18323                         printf "\n"
18324                         linelen = length(name)
18325                 }
18326                 printf "%s", name
18327         }
18328         printf "\n"
18329 }'
18330 sig_size=`echo $sig_name | awk '{print NF}'`
18331 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
18332
18333 echo " "
18334 case "$sizetype" in
18335 *_t) zzz="$sizetype"    ;;
18336 *)   zzz="filesize"     ;;
18337 esac
18338 echo "Checking the size of $zzz..." >&4 
18339 cat > try.c <<EOCP
18340 #include <sys/types.h>
18341 #include <stdio.h>
18342 int main() {
18343     printf("%d\n", (int)sizeof($sizetype));
18344     exit(0);
18345 }
18346 EOCP
18347 set try
18348 if eval $compile_ok; then
18349         yyy=`$run ./try`
18350         case "$yyy" in
18351         '')     sizesize=4
18352                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
18353                 ;;
18354         *)      sizesize=$yyy
18355                 echo "Your $zzz size is $sizesize bytes."
18356                 ;;
18357         esac
18358 else
18359         sizesize=4
18360         echo "(I can't compile the test program--guessing $sizesize.)" >&4
18361 fi
18362
18363
18364 : check for socklen_t
18365 echo " "
18366 echo "Checking to see if you have socklen_t..." >&4
18367 $cat >try.c <<EOCP
18368 #include <sys/types.h>
18369 #$d_socket HAS_SOCKET
18370 #ifdef HAS_SOCKET
18371 #include <sys/socket.h>
18372 #endif
18373 int main() { socklen_t x = 16; }
18374 EOCP
18375 set try
18376 if eval $compile; then
18377         val="$define"
18378         echo "You have socklen_t."
18379 else
18380         val="$undef"
18381         echo "You do not have socklen_t."
18382         case "$sizetype" in
18383         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
18384         esac
18385 fi
18386 $rm -f try try.*
18387 set d_socklen_t
18388 eval $setvar
18389
18390 : see if this is a socks.h system
18391 set socks.h i_socks
18392 eval $inhdr
18393
18394 : check for type of the size argument to socket calls
18395 case "$d_socket" in
18396 "$define")
18397         $cat <<EOM
18398
18399 Checking to see what type is the last argument of accept().
18400 EOM
18401         yyy=''
18402         case "$d_socklen_t" in
18403         "$define") yyy="$yyy socklen_t"
18404         esac
18405         yyy="$yyy $sizetype int long unsigned"
18406         for xxx in $yyy; do
18407                 case "$socksizetype" in
18408                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
18409                         case "$usesocks" in
18410                         "$define")
18411                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
18412                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18413                                         socksizetype="$xxx"
18414                                 fi
18415                                 ;;
18416                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
18417                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18418                                         socksizetype="$xxx"
18419                                 fi
18420                                 ;;
18421                         esac
18422                         ;;
18423                 esac
18424         done
18425 : In case none of those worked, prompt the user.
18426         case "$socksizetype" in
18427         '')     rp='What is the type for socket address structure sizes?'
18428                 dflt='int'
18429                 . ./myread
18430                 socksizetype=$ans
18431                 ;;
18432         esac
18433         ;;
18434 *)      : no sockets, so pick relatively harmless default
18435         socksizetype='int'
18436         ;;
18437 esac
18438
18439 : see what type is used for signed size_t
18440 set ssize_t ssizetype int stdio.h sys/types.h
18441 eval $typedef
18442 dflt="$ssizetype"
18443 $cat > try.c <<EOM
18444 #include <stdio.h>
18445 #include <sys/types.h>
18446 #define Size_t $sizetype
18447 #define SSize_t $dflt
18448 int main()
18449 {
18450         if (sizeof(Size_t) == sizeof(SSize_t))
18451                 printf("$dflt\n");
18452         else if (sizeof(Size_t) == sizeof(int))
18453                 printf("int\n");
18454         else 
18455                 printf("long\n");
18456         exit(0);
18457 }
18458 EOM
18459 echo " "
18460 set try
18461 if eval $compile_ok && $run ./try > /dev/null; then
18462         ssizetype=`$run ./try`
18463         echo "I'll be using $ssizetype for functions returning a byte count." >&4
18464 else
18465         $cat >&4 <<EOM
18466 Help! I can't compile and run the ssize_t test program: please enlighten me!
18467 (This is probably a misconfiguration in your system or libraries, and
18468 you really ought to fix it.  Still, I'll try anyway.)
18469
18470 I need a type that is the same size as $sizetype, but is guaranteed to
18471 be signed.  Common values are ssize_t, int and long.
18472
18473 EOM
18474         rp="What signed type is the same size as $sizetype?"
18475         . ./myread
18476         ssizetype="$ans"
18477 fi
18478 $rm -f try try.*
18479
18480 : see what type of char stdio uses.
18481 echo " "
18482 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
18483 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
18484         echo "Your stdio uses unsigned chars." >&4
18485         stdchar="unsigned char"
18486 else
18487         echo "Your stdio uses signed chars." >&4
18488         stdchar="char"
18489 fi
18490 $rm -f stdioh
18491
18492
18493
18494 : see what type uids are declared as in the kernel
18495 echo " "
18496 echo "Looking for the type for user ids returned by getuid()."
18497 set uid_t uidtype xxx stdio.h sys/types.h
18498 eval $typedef
18499 case "$uidtype" in
18500 xxx)
18501         xxx=`./findhdr sys/user.h`
18502         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18503         case $1 in
18504         unsigned) dflt="$1 $2" ;;
18505         *) dflt="$1" ;;
18506         esac
18507         ;;
18508 *) dflt="$uidtype";;
18509 esac
18510 case "$uidtype" in
18511 uid_t)  echo "uid_t found." ;;
18512 *)      rp="What is the type for user ids returned by getuid()?"
18513         . ./myread
18514         uidtype="$ans"
18515         ;;
18516 esac
18517
18518 echo " "
18519 case "$uidtype" in
18520 *_t) zzz="$uidtype"     ;;
18521 *)   zzz="uid"          ;;
18522 esac
18523 echo "Checking the size of $zzz..." >&4 
18524 cat > try.c <<EOCP
18525 #include <sys/types.h>
18526 #include <stdio.h>
18527 int main() {
18528     printf("%d\n", (int)sizeof($uidtype));
18529     exit(0);
18530 }
18531 EOCP
18532 set try
18533 if eval $compile_ok; then
18534         yyy=`$run ./try`
18535         case "$yyy" in
18536         '')     uidsize=4
18537                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
18538                 ;;
18539         *)      uidsize=$yyy
18540                 echo "Your $zzz is $uidsize bytes long."
18541                 ;;
18542         esac
18543 else
18544         uidsize=4
18545         echo "(I can't compile the test program--guessing $uidsize.)" >&4
18546 fi
18547
18548 echo " "
18549 case "$uidtype" in
18550 *_t) zzz="$uidtype"     ;;
18551 *)   zzz="uid"          ;;
18552 esac
18553 echo "Checking the sign of $zzz..." >&4
18554 cat > try.c <<EOCP
18555 #include <sys/types.h>
18556 #include <stdio.h>
18557 int main() {
18558         $uidtype foo = -1;
18559         if (foo < 0)
18560                 printf("-1\n");
18561         else
18562                 printf("1\n");
18563 }
18564 EOCP
18565 set try
18566 if eval $compile; then
18567         yyy=`$run ./try`
18568         case "$yyy" in
18569         '')     uidsign=1
18570                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18571                 ;;
18572         *)      uidsign=$yyy
18573                 case "$uidsign" in
18574                  1) echo "Your $zzz is unsigned." ;;
18575                 -1) echo "Your $zzz is signed."   ;;
18576                 esac
18577                 ;;
18578         esac
18579 else
18580         uidsign=1
18581         echo "(I can't compile the test program--guessing unsigned.)" >&4
18582 fi
18583
18584
18585
18586 echo " "
18587 $echo "Checking the format string to be used for uids..." >&4
18588
18589 case "$uidsign" in
18590 -1)     if $test X"$uidsize" = X"$ivsize"; then
18591                 uidformat="$ivdformat"
18592         else
18593                 if $test X"$uidsize" = X"$longsize"; then
18594                         uidformat='"ld"'
18595                 else
18596                         if $test X"$uidsize" = X"$intsize"; then
18597                                 uidformat='"d"'
18598                         else
18599                                 if $test X"$uidsize" = X"$shortsize"; then
18600                                         uidformat='"hd"'
18601                                 fi
18602                         fi
18603                 fi
18604         fi
18605         ;;
18606 *)      if $test X"$uidsize" = X"$uvsize"; then
18607                 uidformat="$uvuformat"
18608         else
18609                 if $test X"$uidsize" = X"$longsize"; then
18610                         uidformat='"lu"'
18611                 else
18612                         if $test X"$uidsize" = X"$intsize"; then
18613                                 uidformat='"u"'
18614                         else
18615                                 if $test X"$uidsize" = X"$shortsize"; then
18616                                         uidformat='"hu"'
18617                                 fi
18618                         fi
18619                 fi
18620         fi
18621         ;;
18622 esac
18623
18624 : determine compiler compiler
18625 case "$yacc" in
18626 '')
18627         dflt=yacc;;
18628 *)
18629         dflt="$yacc";;
18630 esac
18631 echo " "
18632 comp='yacc'
18633 if $test -f "$byacc$_exe"; then
18634         dflt="$byacc"
18635         comp="byacc or $comp"
18636 fi
18637 if $test -f "$bison$_exe"; then
18638         comp="$comp or bison -y"
18639 fi
18640 rp="Which compiler compiler ($comp) shall I use?"
18641 . ./myread
18642 yacc="$ans"
18643 case "$yacc" in
18644 *bis*)
18645         case "$yacc" in
18646         *-y*) ;;
18647         *)
18648                 yacc="$yacc -y"
18649                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
18650                 ;;
18651         esac
18652         ;;
18653 esac
18654
18655 : see if this is a fp.h system
18656 set fp.h i_fp
18657 eval $inhdr
18658
18659 : see if this is a fp_class.h system
18660 set fp_class.h i_fp_class
18661 eval $inhdr
18662
18663 : see if this is a ieeefp.h system
18664 case "$i_ieeefp" in
18665 '' ) set ieeefp.h i_ieeefp
18666      eval $inhdr
18667      ;;
18668 esac
18669
18670 : see if this is a libutil.h system
18671 set libutil.h i_libutil
18672 eval $inhdr
18673
18674 : see if mach cthreads are available
18675 if test "X$usethreads" = "X$define"; then
18676         set mach/cthreads.h i_machcthr
18677         eval $inhdr
18678 else
18679         i_machcthr="$undef"
18680 fi
18681
18682
18683
18684 : see if this is a math.h system
18685 set math.h i_math
18686 eval $inhdr
18687
18688 : see if this is a mntent.h system
18689 set mntent.h i_mntent
18690 eval $inhdr
18691
18692 : see if ndbm.h is available
18693 set ndbm.h t_ndbm
18694 eval $inhdr
18695
18696 case "$t_ndbm" in
18697 $undef)
18698     # Some Linux distributions such as RedHat 7.1 put the
18699     # ndbm.h header in /usr/include/gdbm/ndbm.h.
18700     if $test -f /usr/include/gdbm/ndbm.h; then
18701         echo '<gdbm/ndbm.h> found.'
18702         ccflags="$ccflags -I/usr/include/gdbm"
18703         cppflags="$cppflags -I/usr/include/gdbm"
18704         t_ndbm=$define
18705     fi
18706     ;;
18707 esac
18708
18709 case "$t_ndbm" in
18710 $define)
18711         : see if dbm_open exists
18712         set dbm_open d_dbm_open
18713         eval $inlibc
18714         case "$d_dbm_open" in
18715         $undef)
18716                 t_ndbm="$undef"
18717                 echo "We won't be including <ndbm.h>"
18718                 ;;
18719         esac
18720         ;;
18721 esac
18722 val="$t_ndbm"
18723 set i_ndbm
18724 eval $setvar
18725
18726 : see if net/errno.h is available
18727 val=''
18728 set net/errno.h val
18729 eval $inhdr
18730
18731 : Unfortunately, it causes problems on some systems.  Arrgh.
18732 case "$val" in
18733 $define)
18734         cat > try.c <<'EOM'
18735 #include <stdio.h>
18736 #include <errno.h>
18737 #include <net/errno.h>
18738 int func()
18739 {
18740         return ENOTSOCK;
18741 }
18742 EOM
18743         if $cc $ccflags -c try.c >/dev/null 2>&1; then
18744                 echo "We'll be including <net/errno.h>." >&4
18745         else
18746                 echo "We won't be including <net/errno.h>." >&4
18747                 val="$undef"
18748         fi
18749         $rm -f try.* try
18750         ;;
18751 esac
18752 set i_neterrno
18753 eval $setvar
18754
18755 : see if netinet/tcp.h is available
18756 set netinet/tcp.h i_netinettcp
18757 eval $inhdr
18758
18759 : see if this is a poll.h system
18760 set poll.h i_poll
18761 eval $inhdr
18762
18763 : see if this is a prot.h system
18764 set prot.h i_prot
18765 eval $inhdr
18766
18767 echo " "
18768 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
18769 $cat <<'EOSH' > Cppsym.know
18770 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
18771 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
18772 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
18773 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
18774 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
18775 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
18776 bull c cadmus clipper CMU COFF COMPILER_VERSION
18777 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
18778 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
18779 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
18780 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
18781 GLIBC GLIBC_MINOR
18782 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
18783 H3050R H3050RX hbullx20 hcx host_mips
18784 hp200 hp300 hp700 HP700 hp800 hp9000
18785 hp9000s200 hp9000s300 hp9000s400 hp9000s500
18786 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
18787 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
18788 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
18789 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
18790 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
18791 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
18792 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
18793 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
18794 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
18795 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
18796 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
18797 MATH_HAS_NO_SIDE_EFFECTS
18798 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
18799 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
18800 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
18801 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
18802 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
18803 NetBSD news1500 news1700 news1800 news1900 news3700
18804 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
18805 ns32016 ns32332 ns32k nsc32000
18806 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
18807 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
18808 pc532 pdp11 PGC PIC plexus PORTAR posix
18809 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
18810 POSIX_C_SOURCE POSIX_SOURCE POWER
18811 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
18812 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
18813 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
18814 sony sony_news sonyrisc sparc sparclite spectrum
18815 stardent stdc STDC_EXT stratos sun sun3 sun386
18816 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
18817 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
18818 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
18819 sysV68 sysV88 Tek4132 Tek4300 titan
18820 TM3200 TM5400 TM5600
18821 tower tower32 tower32_200 tower32_600 tower32_700
18822 tower32_800 tower32_850 tss
18823 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
18824 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
18825 unix UNIX95 UNIX99 unixpc unos
18826 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
18827 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
18828 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
18829 USGr4 USGr4_2
18830 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
18831 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
18832 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
18833 z8000
18834 EOSH
18835 # Maybe put other stuff here too.
18836 cat <<EOSH >>Cppsym.know
18837 $osname
18838 EOSH
18839 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
18840 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
18841 $cat Cppsym.know > Cppsym.c
18842 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
18843 $rm -f Cppsym.a Cppsym.b Cppsym.c
18844 cat <<EOSH > Cppsym
18845 $startsh
18846 if $test \$# -gt 0; then
18847     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
18848     if $test -s Cppsym.got; then
18849         $rm -f Cppsym.got
18850         exit 0
18851     fi
18852     $rm -f Cppsym.got
18853     exit 1
18854 else
18855     $tr " " "$trnl" | ./Cppsym.try
18856     exit 0
18857 fi
18858 EOSH
18859 chmod +x Cppsym
18860 $eunicefix Cppsym
18861 cat <<EOSH > Cppsym.try
18862 $startsh
18863 cat <<'EOCP' > try.c
18864 #include <stdio.h>
18865 int main() {
18866 EOCP
18867 $awk \\
18868 EOSH
18869 cat <<'EOSH' >> Cppsym.try
18870 'length($1) > 0 {
18871     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
18872     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
18873     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
18874     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
18875 }'       >> try.c
18876 echo 'return 0;}' >> try.c
18877 EOSH
18878 cat <<EOSH >> Cppsym.try
18879 ccflags="$ccflags"
18880 case "$osname-$gccversion" in
18881 irix-) ccflags="\$ccflags -woff 1178" ;;
18882 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
18883 esac
18884 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
18885 EOSH
18886 chmod +x Cppsym.try
18887 $eunicefix Cppsym.try
18888 ./Cppsym < Cppsym.know > Cppsym.true
18889 : now check the C compiler for additional symbols
18890 postprocess_cc_v=''
18891 case "$osname" in
18892 aix) postprocess_cc_v="|$tr , ' '" ;;
18893 esac
18894 $cat >ccsym <<EOS
18895 $startsh
18896 $cat >tmp.c <<EOF
18897 extern int foo;
18898 EOF
18899 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
18900 do
18901         case "\$i" in
18902         -D*) echo "\$i" | $sed 's/^-D//';;
18903         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
18904         esac
18905 done
18906 $rm -f try.c
18907 EOS
18908 postprocess_cc_v=''
18909 chmod +x ccsym
18910 $eunicefix ccsym
18911 ./ccsym > ccsym1.raw
18912 if $test -s ccsym1.raw; then
18913        $sort ccsym1.raw | $uniq >ccsym.raw
18914 else
18915        mv ccsym1.raw ccsym.raw
18916 fi
18917
18918 $awk '/\=/ { print $0; next }
18919         { print $0"=1" }' ccsym.raw >ccsym.list
18920 $awk '/\=/ { print $0; next }
18921         { print $0"=1" }' Cppsym.true >ccsym.true
18922 $comm -13 ccsym.true ccsym.list >ccsym.own
18923 $comm -12 ccsym.true ccsym.list >ccsym.com
18924 $comm -23 ccsym.true ccsym.list >ccsym.cpp
18925 also=''
18926 if $test -z ccsym.raw; then
18927         echo "Your C compiler doesn't seem to define any symbols!" >&4
18928         echo " "
18929         echo "However, your C preprocessor defines the following symbols:"
18930         $cat Cppsym.true
18931         ccsymbols=''
18932         cppsymbols=`$cat Cppsym.true`
18933         cppsymbols=`echo $cppsymbols`
18934         cppccsymbols="$cppsymbols"
18935 else
18936         if $test -s ccsym.com; then
18937                 echo "Your C compiler and pre-processor define these symbols:"
18938                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
18939                 also='also '
18940                 symbols='ones'
18941                 cppccsymbols=`$cat ccsym.com`
18942                 cppccsymbols=`echo $cppccsymbols`
18943                 $test "$silent" || sleep 1
18944         fi
18945         if $test -s ccsym.cpp; then
18946                 $test "$also" && echo " "
18947                 echo "Your C pre-processor ${also}defines the following symbols:"
18948                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
18949                 also='further '
18950                 cppsymbols=`$cat ccsym.cpp`
18951                 cppsymbols=`echo $cppsymbols`
18952                 $test "$silent" || sleep 1
18953         fi
18954         if $test -s ccsym.own; then
18955                 $test "$also" && echo " "
18956                 echo "Your C compiler ${also}defines the following cpp symbols:"
18957                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
18958                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
18959                 ccsymbols=`$cat ccsym.own`
18960                 ccsymbols=`echo $ccsymbols`
18961                 $test "$silent" || sleep 1
18962         fi
18963 fi
18964
18965 : see if this is a termio system
18966 val="$undef"
18967 val2="$undef"
18968 val3="$undef"
18969 if $test `./findhdr termios.h`; then
18970         set tcsetattr i_termios
18971         eval $inlibc
18972         val3="$i_termios"
18973 fi
18974 echo " "
18975 case "$val3" in
18976 "$define") echo "You have POSIX termios.h... good!" >&4;;
18977 *) if ./Cppsym pyr; then
18978                 case "`/bin/universe`" in
18979                 ucb) if $test `./findhdr sgtty.h`; then
18980                                 val2="$define"
18981                                 echo "<sgtty.h> found." >&4
18982                         else
18983                                 echo "System is pyramid with BSD universe."
18984                                 echo "<sgtty.h> not found--you could have problems." >&4
18985                         fi;;
18986                 *) if $test `./findhdr termio.h`; then
18987                                 val="$define"
18988                                 echo "<termio.h> found." >&4
18989                         else
18990                                 echo "System is pyramid with USG universe."
18991                                 echo "<termio.h> not found--you could have problems." >&4
18992                         fi;;
18993                 esac
18994         elif ./usg; then
18995                 if $test `./findhdr termio.h`; then
18996                         echo "<termio.h> found." >&4
18997                         val="$define"
18998                 elif $test `./findhdr sgtty.h`; then
18999                         echo "<sgtty.h> found." >&4
19000                         val2="$define"
19001                 else
19002 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
19003                 fi
19004         else
19005                 if $test `./findhdr sgtty.h`; then
19006                         echo "<sgtty.h> found." >&4
19007                         val2="$define"
19008                 elif $test `./findhdr termio.h`; then
19009                         echo "<termio.h> found." >&4
19010                         val="$define"
19011                 else
19012 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
19013                 fi
19014         fi;;
19015 esac
19016 set i_termio; eval $setvar
19017 val=$val2; set i_sgtty; eval $setvar
19018 val=$val3; set i_termios; eval $setvar
19019
19020 : see if stddef is available
19021 set stddef.h i_stddef
19022 eval $inhdr
19023
19024 : see if this is a sunmath.h system
19025 set sunmath.h i_sunmath
19026 eval $inhdr
19027
19028 : see if sys/access.h is available
19029 set sys/access.h i_sysaccess
19030 eval $inhdr
19031
19032 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
19033 set sys/filio.h i_sysfilio
19034 eval $inhdr
19035 echo " "
19036 if $test `./findhdr sys/ioctl.h`; then
19037         val="$define"
19038         echo '<sys/ioctl.h> found.' >&4
19039 else
19040         val="$undef"
19041         if $test $i_sysfilio = "$define"; then
19042             echo '<sys/ioctl.h> NOT found.' >&4
19043         else
19044                 $test $i_sgtty = "$define" && xxx="sgtty.h"
19045                 $test $i_termio = "$define" && xxx="termio.h"
19046                 $test $i_termios = "$define" && xxx="termios.h"
19047 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
19048         fi
19049 fi
19050 set i_sysioctl
19051 eval $setvar
19052
19053 : see if socket ioctl defs are in sys/sockio.h
19054 echo " "
19055 xxx=`./findhdr sys/sockio.h`
19056 if $test "$xxx"; then
19057         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
19058                 val="$define"
19059                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
19060         else
19061                 val="$undef"
19062                 echo "No socket ioctls found in <sys/sockio.h>." >&4
19063         fi
19064 else
19065         val="$undef"
19066         $cat <<EOM
19067 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
19068 EOM
19069 fi
19070 set i_syssockio
19071 eval $setvar
19072
19073
19074 : see if this is a syslog.h system
19075 set syslog.h i_syslog
19076 eval $inhdr
19077
19078
19079 : see if this is a sys/mode.h system
19080 set sys/mode.h i_sysmode
19081 eval $inhdr
19082
19083 : see if sys/resource.h has to be included
19084 set sys/resource.h i_sysresrc
19085 eval $inhdr
19086
19087 : see if sys/security.h is available
19088 set sys/security.h i_syssecrt
19089 eval $inhdr
19090
19091 : see if this is a sys/statvfs.h system
19092 set sys/statvfs.h i_sysstatvfs
19093 eval $inhdr
19094
19095 : see if this is a sys/un.h system
19096 set sys/un.h i_sysun
19097 eval $inhdr
19098
19099
19100 : see if this is a sys/utsname.h system
19101 set sys/utsname.h i_sysutsname
19102 eval $inhdr
19103
19104 : see if this is a syswait system
19105 set sys/wait.h i_syswait
19106 eval $inhdr
19107
19108 : see if this is a ustat.h system
19109 set ustat.h i_ustat
19110 eval $inhdr
19111
19112 : see if this is an utime system
19113 set utime.h i_utime
19114 eval $inhdr
19115
19116 : see if this is a values.h system
19117 set values.h i_values
19118 eval $inhdr
19119
19120 : see if this is a vfork system
19121 case "$d_vfork" in
19122 "$define")
19123         set vfork.h i_vfork
19124         eval $inhdr
19125         ;;
19126 *)
19127         i_vfork="$undef"
19128         ;;
19129 esac
19130
19131 : see if gdbm.h is available
19132 set gdbm.h t_gdbm
19133 eval $inhdr
19134 case "$t_gdbm" in
19135 $define)
19136         : see if gdbm_open exists
19137         set gdbm_open d_gdbm_open
19138         eval $inlibc
19139         case "$d_gdbm_open" in
19140         $undef)
19141                 t_gdbm="$undef"
19142                 echo "We won't be including <gdbm.h>"
19143                 ;;
19144         esac
19145         ;;
19146 esac
19147 val="$t_gdbm"
19148 set i_gdbm
19149 eval $setvar
19150
19151 echo " "
19152 echo "Looking for extensions..." >&4
19153 : If we are using the old config.sh, known_extensions may contain
19154 : old or inaccurate or duplicate values.
19155 known_extensions=''
19156 nonxs_extensions=''
19157 : We do not use find because it might not be available.
19158 : We do not just use MANIFEST because the user may have dropped
19159 : some additional extensions into the source tree and expect them
19160 : to be built.
19161
19162 : Function to recursively find available extensions, ignoring DynaLoader
19163 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
19164 find_extensions='
19165     for xxx in *; do
19166        case "$xxx" in
19167            DynaLoader|dynaload) ;;
19168            *)
19169            if $test -f $xxx/$xxx.xs; then
19170                known_extensions="$known_extensions $1$xxx";
19171            elif $test -f $xxx/Makefile.PL; then
19172                nonxs_extensions="$nonxs_extensions $1$xxx";
19173            else
19174                if $test -d $xxx -a $# -lt 10; then
19175                    set $1$xxx/ $*;
19176                    cd "$xxx";
19177                    eval $find_extensions;
19178                    cd ..;
19179                    shift;
19180                fi;
19181            fi
19182            ;;
19183        esac;
19184     done'
19185 tdir=`pwd`
19186 cd "$rsrc/ext"
19187 set X
19188 shift
19189 eval $find_extensions
19190 # Special case:  Add in threads/shared since it is not picked up by the
19191 # recursive find above (and adding in general recursive finding breaks
19192 # SDBM_File/sdbm).  A.D.  10/25/2001.
19193 known_extensions="$known_extensions threads/shared"
19194 set X $nonxs_extensions
19195 shift
19196 nonxs_extensions="$*"
19197 set X $known_extensions
19198 shift
19199 known_extensions="$*"
19200 cd "$tdir"
19201
19202 : Now see which are supported on this system.
19203 avail_ext=''
19204 for xxx in $known_extensions ; do
19205         case "$xxx" in
19206         DB_File|db_file)
19207                 case "$i_db" in
19208                 $define) avail_ext="$avail_ext $xxx" ;;
19209                 esac
19210                 ;;
19211         GDBM_File|gdbm_fil)
19212                 case "$i_gdbm" in 
19213                 $define) avail_ext="$avail_ext $xxx" ;;
19214                 esac
19215                 ;;
19216         I18N/Langinfo|i18n_lan)
19217                 case "$i_langinfo$d_nl_langinfo" in 
19218                 $define$define) avail_ext="$avail_ext $xxx" ;;
19219                 esac
19220                 ;;
19221         NDBM_File|ndbm_fil)
19222                 case "$i_ndbm" in
19223                 $define)
19224                     case "$osname-$use64bitint" in
19225                     cygwin-*|hpux-define)
19226                         case "$libs" in
19227                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
19228                         esac
19229                         ;;
19230                     *) avail_ext="$avail_ext $xxx" ;;
19231                     esac
19232                     ;;
19233                 esac
19234                 ;;
19235         ODBM_File|odbm_fil) 
19236                 case "${i_dbm}${i_rpcsvcdbm}" in
19237                 *"${define}"*)
19238                     case "$osname-$use64bitint" in
19239                     cygwin-*|hpux-define)
19240                         case "$libs" in
19241                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
19242                         esac
19243                         ;;
19244                     *) avail_ext="$avail_ext $xxx" ;;
19245                     esac
19246                     ;;
19247                 esac
19248                 ;;
19249         POSIX|posix)
19250                 case "$useposix" in
19251                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19252                 esac
19253                 ;;
19254         Opcode|opcode)
19255                 case "$useopcode" in
19256                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19257                 esac
19258                 ;;
19259         Socket|socket)
19260                 case "$d_socket" in 
19261                 true|$define|y)
19262                     case "$osname" in
19263                     beos) ;; # not unless BONE
19264                     *) avail_ext="$avail_ext $xxx" ;;
19265                     esac
19266                     ;;
19267                 esac
19268                 ;;
19269         Sys/Syslog|sys/syslog)
19270                 : XXX syslog requires socket
19271                 case "$d_socket" in 
19272                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
19273                 esac
19274                 ;;
19275         Thread|thread)
19276                 case "$usethreads" in
19277                 true|$define|y)
19278                         case "$useithreads" in
19279                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
19280                         esac
19281                 esac
19282                 ;;
19283         threads|threads/shared)
19284                 # threads and threads::shared are special cases.
19285                 # To stop people from asking "Perl 5.8.0 was supposed
19286                 # to have this new fancy threads implementation but my
19287                 # perl doesn't have it" and from people trying to
19288                 # (re)install the threads module using CPAN.pm and
19289                 # CPAN.pm then offering to reinstall Perl 5.8.0,
19290                 # the threads.pm and threads/shared.pm will always be
19291                 # there, croaking informatively ("you need to rebuild
19292                 # all of Perl with threads, sorry") when threads haven't
19293                 # been compiled in.
19294                 # --jhi
19295                 avail_ext="$avail_ext $xxx"
19296                 ;;
19297         IPC/SysV|ipc/sysv)
19298                 : XXX Do we need a useipcsysv variable here
19299                 case "${d_msg}${d_sem}${d_shm}" in 
19300                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
19301                 esac
19302                 ;;
19303         *)      avail_ext="$avail_ext $xxx"
19304                 ;;
19305         esac
19306 done
19307
19308 set X $avail_ext
19309 shift
19310 avail_ext="$*"
19311
19312 : Now see which nonxs extensions are supported on this system.
19313 : For now assume all are.
19314 nonxs_ext=''
19315 for xxx in $nonxs_extensions ; do
19316         case "$xxx" in
19317         *)      nonxs_ext="$nonxs_ext $xxx"
19318                 ;;
19319         esac
19320 done
19321
19322 set X $nonxs_ext
19323 shift
19324 nonxs_ext="$*"
19325
19326 case $usedl in
19327 $define)
19328         $cat <<EOM
19329 A number of extensions are supplied with $package.  You may choose to
19330 compile these extensions for dynamic loading (the default), compile
19331 them into the $package executable (static loading), or not include
19332 them at all.  Answer "none" to include no extensions.
19333 Note that DynaLoader is always built and need not be mentioned here.
19334
19335 EOM
19336         case "$dynamic_ext" in
19337         '') dflt="$avail_ext" ;;
19338         *)      dflt="$dynamic_ext"
19339                 # Perhaps we are reusing an old out-of-date config.sh.
19340                 case "$hint" in
19341                 previous)
19342                         if test X"$dynamic_ext" != X"$avail_ext"; then
19343                                 $cat <<EOM
19344 NOTICE:  Your previous config.sh list may be incorrect. 
19345 The extensions now available to you are 
19346         ${avail_ext}
19347 but the default list from your previous config.sh is
19348         ${dynamic_ext} 
19349
19350 EOM
19351                         fi
19352                         ;;
19353                 esac
19354                 ;;
19355         esac
19356         case "$dflt" in
19357         '')     dflt=none;;
19358         esac
19359         rp="What extensions do you wish to load dynamically?"
19360         . ./myread
19361         case "$ans" in
19362         none) dynamic_ext=' ' ;;
19363         *) dynamic_ext="$ans" ;;
19364         esac
19365
19366         case "$static_ext" in
19367         '')
19368                 : Exclude those already listed in dynamic linking
19369                 dflt=''
19370                 for xxx in $avail_ext; do
19371                         case " $dynamic_ext " in
19372                         *" $xxx "*) ;;
19373                         *) dflt="$dflt $xxx" ;;
19374                         esac
19375                 done
19376                 set X $dflt
19377                 shift
19378                 dflt="$*"
19379                 ;;
19380         *)  dflt="$static_ext" 
19381                 ;;
19382         esac
19383
19384         case "$dflt" in
19385         '')     dflt=none;;
19386         esac
19387         rp="What extensions do you wish to load statically?"
19388         . ./myread
19389         case "$ans" in
19390         none) static_ext=' ' ;;
19391         *) static_ext="$ans" ;;
19392         esac
19393         ;;
19394 *)
19395         $cat <<EOM
19396 A number of extensions are supplied with $package.  Answer "none" 
19397 to include no extensions. 
19398 Note that DynaLoader is always built and need not be mentioned here.
19399
19400 EOM
19401         case "$static_ext" in
19402         '') dflt="$avail_ext" ;;
19403         *)      dflt="$static_ext"
19404                 # Perhaps we are reusing an old out-of-date config.sh.
19405                 case "$hint" in
19406                 previous)
19407                         if test X"$static_ext" != X"$avail_ext"; then
19408                                 $cat <<EOM
19409 NOTICE:  Your previous config.sh list may be incorrect. 
19410 The extensions now available to you are 
19411         ${avail_ext}
19412 but the default list from your previous config.sh is
19413         ${static_ext} 
19414
19415 EOM
19416                         fi
19417                         ;;
19418                 esac
19419                 ;;
19420         esac
19421         : Exclude those that are not xs extensions
19422         case "$dflt" in
19423         '')     dflt=none;;
19424         esac
19425         rp="What extensions do you wish to include?"
19426         . ./myread
19427         case "$ans" in
19428         none) static_ext=' ' ;;
19429         *) static_ext="$ans" ;;
19430         esac
19431         ;;
19432 esac
19433 #        
19434 # Encode is a special case.  If we are building Encode as a static
19435 # extension, we need to explicitly list its subextensions as well.
19436 # For other nested extensions, this is handled automatically by
19437 # the appropriate Makefile.PL.
19438 case " $static_ext " in
19439         *" Encode "*) # Add the subextensions of Encode
19440         cd "$rsrc/ext"
19441         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
19442                 static_ext="$static_ext Encode/$xxx"
19443         done
19444         cd "$tdir"
19445         ;;
19446 esac
19447
19448 set X $dynamic_ext $static_ext $nonxs_ext
19449 shift
19450 extensions="$*"
19451
19452 : Remove libraries needed only for extensions
19453 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
19454 : The exception is SunOS 4.x, which needs them.
19455 case "${osname}X${osvers}" in
19456 sunos*X4*)
19457     perllibs="$libs"
19458     ;;
19459 *) case "$usedl" in
19460     $define|true|[yY]*)
19461             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
19462             shift
19463             perllibs="$*"
19464             ;;
19465     *)  perllibs="$libs"
19466             ;;
19467     esac
19468     ;;
19469 esac
19470
19471 : Remove build directory name from cppstdin so it can be used from
19472 : either the present location or the final installed location.
19473 echo " "
19474 : Get out of the UU directory to get correct path name.
19475 cd ..
19476 case "$cppstdin" in
19477 `pwd`/cppstdin)
19478         echo "Stripping down cppstdin path name"
19479         cppstdin=cppstdin
19480         ;;
19481 esac
19482 cd UU
19483
19484 : end of configuration questions
19485 echo " "
19486 echo "End of configuration questions."
19487 echo " "
19488
19489 : back to where it started
19490 if test -d ../UU; then
19491         cd ..
19492 fi
19493
19494 : configuration may be patched via a 'config.arch' file
19495 if $test -f config.arch; then
19496         echo "I see a config.arch file, loading it."
19497         . ./config.arch
19498 fi
19499
19500 : configuration may be patched via a 'config.over' file
19501 if $test -f config.over; then
19502         echo " "
19503         dflt=y
19504         rp='I see a config.over file.  Do you wish to load it?'
19505         . UU/myread
19506         case "$ans" in
19507         n*) echo "OK, I'll ignore it.";;
19508         *)      . ./config.over
19509                 echo "Configuration override changes have been loaded."
19510                 ;;
19511         esac
19512 fi
19513
19514 : in case they want portability, strip down executable paths
19515 case "$d_portable" in
19516 "$define")
19517         echo " "
19518         echo "Stripping down executable paths..." >&4
19519         for file in $loclist $trylist; do
19520                 eval temp=\$$file
19521                 eval $file=`basename $temp`
19522         done
19523         ;;
19524 esac
19525
19526 : create config.sh file
19527 echo " "
19528 echo "Creating config.sh..." >&4
19529 $spitshell <<EOT >config.sh
19530 $startsh
19531 #
19532 # This file was produced by running the Configure script. It holds all the
19533 # definitions figured out by Configure. Should you modify one of these values,
19534 # do not forget to propagate your changes by running "Configure -der". You may
19535 # instead choose to run each of the .SH files by yourself, or "Configure -S".
19536 #
19537
19538 # Package name      : $package
19539 # Source directory  : $src
19540 # Configuration time: $cf_time
19541 # Configured by     : $cf_by
19542 # Target system     : $myuname
19543
19544 Author='$Author'
19545 Date='$Date'
19546 Header='$Header'
19547 Id='$Id'
19548 Locker='$Locker'
19549 Log='$Log'
19550 Mcc='$Mcc'
19551 RCSfile='$RCSfile'
19552 Revision='$Revision'
19553 Source='$Source'
19554 State='$State'
19555 _a='$_a'
19556 _exe='$_exe'
19557 _o='$_o'
19558 afs='$afs'
19559 afsroot='$afsroot'
19560 alignbytes='$alignbytes'
19561 ansi2knr='$ansi2knr'
19562 aphostname='$aphostname'
19563 api_revision='$api_revision'
19564 api_subversion='$api_subversion'
19565 api_version='$api_version'
19566 api_versionstring='$api_versionstring'
19567 ar='$ar'
19568 archlib='$archlib'
19569 archlibexp='$archlibexp'
19570 archname64='$archname64'
19571 archname='$archname'
19572 archobjs='$archobjs'
19573 asctime_r_proto='$asctime_r_proto'
19574 awk='$awk'
19575 baserev='$baserev'
19576 bash='$bash'
19577 bin='$bin'
19578 binexp='$binexp'
19579 bison='$bison'
19580 byacc='$byacc'
19581 byteorder='$byteorder'
19582 c='$c'
19583 castflags='$castflags'
19584 cat='$cat'
19585 cc='$cc'
19586 cccdlflags='$cccdlflags'
19587 ccdlflags='$ccdlflags'
19588 ccflags='$ccflags'
19589 ccflags_uselargefiles='$ccflags_uselargefiles'
19590 ccname='$ccname'
19591 ccsymbols='$ccsymbols'
19592 ccversion='$ccversion'
19593 cf_by='$cf_by'
19594 cf_email='$cf_email'
19595 cf_time='$cf_time'
19596 charsize='$charsize'
19597 chgrp='$chgrp'
19598 chmod='$chmod'
19599 chown='$chown'
19600 clocktype='$clocktype'
19601 comm='$comm'
19602 compress='$compress'
19603 contains='$contains'
19604 cp='$cp'
19605 cpio='$cpio'
19606 cpp='$cpp'
19607 cpp_stuff='$cpp_stuff'
19608 cppccsymbols='$cppccsymbols'
19609 cppflags='$cppflags'
19610 cpplast='$cpplast'
19611 cppminus='$cppminus'
19612 cpprun='$cpprun'
19613 cppstdin='$cppstdin'
19614 cppsymbols='$cppsymbols'
19615 crypt_r_proto='$crypt_r_proto'
19616 cryptlib='$cryptlib'
19617 csh='$csh'
19618 ctermid_r_proto='$ctermid_r_proto'
19619 ctime_r_proto='$ctime_r_proto'
19620 d_Gconvert='$d_Gconvert'
19621 d_PRIEUldbl='$d_PRIEUldbl'
19622 d_PRIFUldbl='$d_PRIFUldbl'
19623 d_PRIGUldbl='$d_PRIGUldbl'
19624 d_PRIXU64='$d_PRIXU64'
19625 d_PRId64='$d_PRId64'
19626 d_PRIeldbl='$d_PRIeldbl'
19627 d_PRIfldbl='$d_PRIfldbl'
19628 d_PRIgldbl='$d_PRIgldbl'
19629 d_PRIi64='$d_PRIi64'
19630 d_PRIo64='$d_PRIo64'
19631 d_PRIu64='$d_PRIu64'
19632 d_PRIx64='$d_PRIx64'
19633 d_SCNfldbl='$d_SCNfldbl'
19634 d__fwalk='$d__fwalk'
19635 d_access='$d_access'
19636 d_accessx='$d_accessx'
19637 d_alarm='$d_alarm'
19638 d_archlib='$d_archlib'
19639 d_asctime_r='$d_asctime_r'
19640 d_atolf='$d_atolf'
19641 d_atoll='$d_atoll'
19642 d_attribut='$d_attribut'
19643 d_bcmp='$d_bcmp'
19644 d_bcopy='$d_bcopy'
19645 d_bsd='$d_bsd'
19646 d_bsdgetpgrp='$d_bsdgetpgrp'
19647 d_bsdsetpgrp='$d_bsdsetpgrp'
19648 d_bzero='$d_bzero'
19649 d_casti32='$d_casti32'
19650 d_castneg='$d_castneg'
19651 d_charvspr='$d_charvspr'
19652 d_chown='$d_chown'
19653 d_chroot='$d_chroot'
19654 d_chsize='$d_chsize'
19655 d_class='$d_class'
19656 d_closedir='$d_closedir'
19657 d_cmsghdr_s='$d_cmsghdr_s'
19658 d_const='$d_const'
19659 d_crypt='$d_crypt'
19660 d_crypt_r='$d_crypt_r'
19661 d_csh='$d_csh'
19662 d_ctermid_r='$d_ctermid_r'
19663 d_ctime_r='$d_ctime_r'
19664 d_cuserid='$d_cuserid'
19665 d_dbl_dig='$d_dbl_dig'
19666 d_dbminitproto='$d_dbminitproto'
19667 d_difftime='$d_difftime'
19668 d_dirfd='$d_dirfd'
19669 d_dirnamlen='$d_dirnamlen'
19670 d_dlerror='$d_dlerror'
19671 d_dlopen='$d_dlopen'
19672 d_dlsymun='$d_dlsymun'
19673 d_dosuid='$d_dosuid'
19674 d_drand48_r='$d_drand48_r'
19675 d_drand48proto='$d_drand48proto'
19676 d_dup2='$d_dup2'
19677 d_eaccess='$d_eaccess'
19678 d_endgrent='$d_endgrent'
19679 d_endgrent_r='$d_endgrent_r'
19680 d_endhent='$d_endhent'
19681 d_endhostent_r='$d_endhostent_r'
19682 d_endnent='$d_endnent'
19683 d_endnetent_r='$d_endnetent_r'
19684 d_endpent='$d_endpent'
19685 d_endprotoent_r='$d_endprotoent_r'
19686 d_endpwent='$d_endpwent'
19687 d_endpwent_r='$d_endpwent_r'
19688 d_endsent='$d_endsent'
19689 d_endservent_r='$d_endservent_r'
19690 d_eofnblk='$d_eofnblk'
19691 d_eunice='$d_eunice'
19692 d_fchdir='$d_fchdir'
19693 d_fchmod='$d_fchmod'
19694 d_fchown='$d_fchown'
19695 d_fcntl='$d_fcntl'
19696 d_fcntl_can_lock='$d_fcntl_can_lock'
19697 d_fd_macros='$d_fd_macros'
19698 d_fd_set='$d_fd_set'
19699 d_fds_bits='$d_fds_bits'
19700 d_fgetpos='$d_fgetpos'
19701 d_finite='$d_finite'
19702 d_finitel='$d_finitel'
19703 d_flexfnam='$d_flexfnam'
19704 d_flock='$d_flock'
19705 d_flockproto='$d_flockproto'
19706 d_fork='$d_fork'
19707 d_fp_class='$d_fp_class'
19708 d_fpathconf='$d_fpathconf'
19709 d_fpclass='$d_fpclass'
19710 d_fpclassify='$d_fpclassify'
19711 d_fpclassl='$d_fpclassl'
19712 d_fpos64_t='$d_fpos64_t'
19713 d_frexpl='$d_frexpl'
19714 d_fs_data_s='$d_fs_data_s'
19715 d_fseeko='$d_fseeko'
19716 d_fsetpos='$d_fsetpos'
19717 d_fstatfs='$d_fstatfs'
19718 d_fstatvfs='$d_fstatvfs'
19719 d_fsync='$d_fsync'
19720 d_ftello='$d_ftello'
19721 d_ftime='$d_ftime'
19722 d_getcwd='$d_getcwd'
19723 d_getespwnam='$d_getespwnam'
19724 d_getfsstat='$d_getfsstat'
19725 d_getgrent='$d_getgrent'
19726 d_getgrent_r='$d_getgrent_r'
19727 d_getgrgid_r='$d_getgrgid_r'
19728 d_getgrnam_r='$d_getgrnam_r'
19729 d_getgrps='$d_getgrps'
19730 d_gethbyaddr='$d_gethbyaddr'
19731 d_gethbyname='$d_gethbyname'
19732 d_gethent='$d_gethent'
19733 d_gethname='$d_gethname'
19734 d_gethostbyaddr_r='$d_gethostbyaddr_r'
19735 d_gethostbyname_r='$d_gethostbyname_r'
19736 d_gethostent_r='$d_gethostent_r'
19737 d_gethostprotos='$d_gethostprotos'
19738 d_getitimer='$d_getitimer'
19739 d_getlogin='$d_getlogin'
19740 d_getlogin_r='$d_getlogin_r'
19741 d_getmnt='$d_getmnt'
19742 d_getmntent='$d_getmntent'
19743 d_getnbyaddr='$d_getnbyaddr'
19744 d_getnbyname='$d_getnbyname'
19745 d_getnent='$d_getnent'
19746 d_getnetbyaddr_r='$d_getnetbyaddr_r'
19747 d_getnetbyname_r='$d_getnetbyname_r'
19748 d_getnetent_r='$d_getnetent_r'
19749 d_getnetprotos='$d_getnetprotos'
19750 d_getpagsz='$d_getpagsz'
19751 d_getpbyname='$d_getpbyname'
19752 d_getpbynumber='$d_getpbynumber'
19753 d_getpent='$d_getpent'
19754 d_getpgid='$d_getpgid'
19755 d_getpgrp2='$d_getpgrp2'
19756 d_getpgrp='$d_getpgrp'
19757 d_getppid='$d_getppid'
19758 d_getprior='$d_getprior'
19759 d_getprotobyname_r='$d_getprotobyname_r'
19760 d_getprotobynumber_r='$d_getprotobynumber_r'
19761 d_getprotoent_r='$d_getprotoent_r'
19762 d_getprotoprotos='$d_getprotoprotos'
19763 d_getprpwnam='$d_getprpwnam'
19764 d_getpwent='$d_getpwent'
19765 d_getpwent_r='$d_getpwent_r'
19766 d_getpwnam_r='$d_getpwnam_r'
19767 d_getpwuid_r='$d_getpwuid_r'
19768 d_getsbyname='$d_getsbyname'
19769 d_getsbyport='$d_getsbyport'
19770 d_getsent='$d_getsent'
19771 d_getservbyname_r='$d_getservbyname_r'
19772 d_getservbyport_r='$d_getservbyport_r'
19773 d_getservent_r='$d_getservent_r'
19774 d_getservprotos='$d_getservprotos'
19775 d_getspnam='$d_getspnam'
19776 d_getspnam_r='$d_getspnam_r'
19777 d_gettimeod='$d_gettimeod'
19778 d_gmtime_r='$d_gmtime_r'
19779 d_gnulibc='$d_gnulibc'
19780 d_grpasswd='$d_grpasswd'
19781 d_hasmntopt='$d_hasmntopt'
19782 d_htonl='$d_htonl'
19783 d_index='$d_index'
19784 d_inetaton='$d_inetaton'
19785 d_int64_t='$d_int64_t'
19786 d_isascii='$d_isascii'
19787 d_isfinite='$d_isfinite'
19788 d_isinf='$d_isinf'
19789 d_isnan='$d_isnan'
19790 d_isnanl='$d_isnanl'
19791 d_killpg='$d_killpg'
19792 d_lchown='$d_lchown'
19793 d_ldbl_dig='$d_ldbl_dig'
19794 d_link='$d_link'
19795 d_localtime_r='$d_localtime_r'
19796 d_locconv='$d_locconv'
19797 d_lockf='$d_lockf'
19798 d_longdbl='$d_longdbl'
19799 d_longlong='$d_longlong'
19800 d_lseekproto='$d_lseekproto'
19801 d_lstat='$d_lstat'
19802 d_madvise='$d_madvise'
19803 d_mblen='$d_mblen'
19804 d_mbstowcs='$d_mbstowcs'
19805 d_mbtowc='$d_mbtowc'
19806 d_memchr='$d_memchr'
19807 d_memcmp='$d_memcmp'
19808 d_memcpy='$d_memcpy'
19809 d_memmove='$d_memmove'
19810 d_memset='$d_memset'
19811 d_mkdir='$d_mkdir'
19812 d_mkdtemp='$d_mkdtemp'
19813 d_mkfifo='$d_mkfifo'
19814 d_mkstemp='$d_mkstemp'
19815 d_mkstemps='$d_mkstemps'
19816 d_mktime='$d_mktime'
19817 d_mmap='$d_mmap'
19818 d_modfl='$d_modfl'
19819 d_modfl_pow32_bug='$d_modfl_pow32_bug'
19820 d_mprotect='$d_mprotect'
19821 d_msg='$d_msg'
19822 d_msg_ctrunc='$d_msg_ctrunc'
19823 d_msg_dontroute='$d_msg_dontroute'
19824 d_msg_oob='$d_msg_oob'
19825 d_msg_peek='$d_msg_peek'
19826 d_msg_proxy='$d_msg_proxy'
19827 d_msgctl='$d_msgctl'
19828 d_msgget='$d_msgget'
19829 d_msghdr_s='$d_msghdr_s'
19830 d_msgrcv='$d_msgrcv'
19831 d_msgsnd='$d_msgsnd'
19832 d_msync='$d_msync'
19833 d_munmap='$d_munmap'
19834 d_mymalloc='$d_mymalloc'
19835 d_nice='$d_nice'
19836 d_nl_langinfo='$d_nl_langinfo'
19837 d_nv_preserves_uv='$d_nv_preserves_uv'
19838 d_off64_t='$d_off64_t'
19839 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
19840 d_oldpthreads='$d_oldpthreads'
19841 d_oldsock='$d_oldsock'
19842 d_open3='$d_open3'
19843 d_pathconf='$d_pathconf'
19844 d_pause='$d_pause'
19845 d_perl_otherlibdirs='$d_perl_otherlibdirs'
19846 d_phostname='$d_phostname'
19847 d_pipe='$d_pipe'
19848 d_poll='$d_poll'
19849 d_portable='$d_portable'
19850 d_procselfexe='$d_procselfexe'
19851 d_pthread_atfork='$d_pthread_atfork'
19852 d_pthread_yield='$d_pthread_yield'
19853 d_pwage='$d_pwage'
19854 d_pwchange='$d_pwchange'
19855 d_pwclass='$d_pwclass'
19856 d_pwcomment='$d_pwcomment'
19857 d_pwexpire='$d_pwexpire'
19858 d_pwgecos='$d_pwgecos'
19859 d_pwpasswd='$d_pwpasswd'
19860 d_pwquota='$d_pwquota'
19861 d_qgcvt='$d_qgcvt'
19862 d_quad='$d_quad'
19863 d_random_r='$d_random_r'
19864 d_readdir64_r='$d_readdir64_r'
19865 d_readdir='$d_readdir'
19866 d_readdir_r='$d_readdir_r'
19867 d_readlink='$d_readlink'
19868 d_readv='$d_readv'
19869 d_recvmsg='$d_recvmsg'
19870 d_rename='$d_rename'
19871 d_rewinddir='$d_rewinddir'
19872 d_rmdir='$d_rmdir'
19873 d_safebcpy='$d_safebcpy'
19874 d_safemcpy='$d_safemcpy'
19875 d_sanemcmp='$d_sanemcmp'
19876 d_sbrkproto='$d_sbrkproto'
19877 d_sched_yield='$d_sched_yield'
19878 d_scm_rights='$d_scm_rights'
19879 d_seekdir='$d_seekdir'
19880 d_select='$d_select'
19881 d_sem='$d_sem'
19882 d_semctl='$d_semctl'
19883 d_semctl_semid_ds='$d_semctl_semid_ds'
19884 d_semctl_semun='$d_semctl_semun'
19885 d_semget='$d_semget'
19886 d_semop='$d_semop'
19887 d_sendmsg='$d_sendmsg'
19888 d_setegid='$d_setegid'
19889 d_seteuid='$d_seteuid'
19890 d_setgrent='$d_setgrent'
19891 d_setgrent_r='$d_setgrent_r'
19892 d_setgrps='$d_setgrps'
19893 d_sethent='$d_sethent'
19894 d_sethostent_r='$d_sethostent_r'
19895 d_setitimer='$d_setitimer'
19896 d_setlinebuf='$d_setlinebuf'
19897 d_setlocale='$d_setlocale'
19898 d_setlocale_r='$d_setlocale_r'
19899 d_setnent='$d_setnent'
19900 d_setnetent_r='$d_setnetent_r'
19901 d_setpent='$d_setpent'
19902 d_setpgid='$d_setpgid'
19903 d_setpgrp2='$d_setpgrp2'
19904 d_setpgrp='$d_setpgrp'
19905 d_setprior='$d_setprior'
19906 d_setproctitle='$d_setproctitle'
19907 d_setprotoent_r='$d_setprotoent_r'
19908 d_setpwent='$d_setpwent'
19909 d_setpwent_r='$d_setpwent_r'
19910 d_setregid='$d_setregid'
19911 d_setresgid='$d_setresgid'
19912 d_setresuid='$d_setresuid'
19913 d_setreuid='$d_setreuid'
19914 d_setrgid='$d_setrgid'
19915 d_setruid='$d_setruid'
19916 d_setsent='$d_setsent'
19917 d_setservent_r='$d_setservent_r'
19918 d_setsid='$d_setsid'
19919 d_setvbuf='$d_setvbuf'
19920 d_sfio='$d_sfio'
19921 d_shm='$d_shm'
19922 d_shmat='$d_shmat'
19923 d_shmatprototype='$d_shmatprototype'
19924 d_shmctl='$d_shmctl'
19925 d_shmdt='$d_shmdt'
19926 d_shmget='$d_shmget'
19927 d_sigaction='$d_sigaction'
19928 d_sigprocmask='$d_sigprocmask'
19929 d_sigsetjmp='$d_sigsetjmp'
19930 d_sockatmark='$d_sockatmark'
19931 d_sockatmarkproto='$d_sockatmarkproto'
19932 d_socket='$d_socket'
19933 d_socklen_t='$d_socklen_t'
19934 d_sockpair='$d_sockpair'
19935 d_socks5_init='$d_socks5_init'
19936 d_sqrtl='$d_sqrtl'
19937 d_srand48_r='$d_srand48_r'
19938 d_srandom_r='$d_srandom_r'
19939 d_sresgproto='$d_sresgproto'
19940 d_sresuproto='$d_sresuproto'
19941 d_statblks='$d_statblks'
19942 d_statfs_f_flags='$d_statfs_f_flags'
19943 d_statfs_s='$d_statfs_s'
19944 d_statvfs='$d_statvfs'
19945 d_stdio_cnt_lval='$d_stdio_cnt_lval'
19946 d_stdio_ptr_lval='$d_stdio_ptr_lval'
19947 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
19948 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
19949 d_stdio_stream_array='$d_stdio_stream_array'
19950 d_stdiobase='$d_stdiobase'
19951 d_stdstdio='$d_stdstdio'
19952 d_strchr='$d_strchr'
19953 d_strcoll='$d_strcoll'
19954 d_strctcpy='$d_strctcpy'
19955 d_strerrm='$d_strerrm'
19956 d_strerror='$d_strerror'
19957 d_strerror_r='$d_strerror_r'
19958 d_strftime='$d_strftime'
19959 d_strtod='$d_strtod'
19960 d_strtol='$d_strtol'
19961 d_strtold='$d_strtold'
19962 d_strtoll='$d_strtoll'
19963 d_strtoq='$d_strtoq'
19964 d_strtoul='$d_strtoul'
19965 d_strtoull='$d_strtoull'
19966 d_strtouq='$d_strtouq'
19967 d_strxfrm='$d_strxfrm'
19968 d_suidsafe='$d_suidsafe'
19969 d_symlink='$d_symlink'
19970 d_syscall='$d_syscall'
19971 d_syscallproto='$d_syscallproto'
19972 d_sysconf='$d_sysconf'
19973 d_sysernlst='$d_sysernlst'
19974 d_syserrlst='$d_syserrlst'
19975 d_system='$d_system'
19976 d_tcgetpgrp='$d_tcgetpgrp'
19977 d_tcsetpgrp='$d_tcsetpgrp'
19978 d_telldir='$d_telldir'
19979 d_telldirproto='$d_telldirproto'
19980 d_time='$d_time'
19981 d_times='$d_times'
19982 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
19983 d_tm_tm_zone='$d_tm_tm_zone'
19984 d_tmpnam_r='$d_tmpnam_r'
19985 d_truncate='$d_truncate'
19986 d_ttyname_r='$d_ttyname_r'
19987 d_tzname='$d_tzname'
19988 d_u32align='$d_u32align'
19989 d_ualarm='$d_ualarm'
19990 d_umask='$d_umask'
19991 d_uname='$d_uname'
19992 d_union_semun='$d_union_semun'
19993 d_unordered='$d_unordered'
19994 d_usleep='$d_usleep'
19995 d_usleepproto='$d_usleepproto'
19996 d_ustat='$d_ustat'
19997 d_vendorarch='$d_vendorarch'
19998 d_vendorbin='$d_vendorbin'
19999 d_vendorlib='$d_vendorlib'
20000 d_vfork='$d_vfork'
20001 d_void_closedir='$d_void_closedir'
20002 d_voidsig='$d_voidsig'
20003 d_voidtty='$d_voidtty'
20004 d_volatile='$d_volatile'
20005 d_vprintf='$d_vprintf'
20006 d_wait4='$d_wait4'
20007 d_waitpid='$d_waitpid'
20008 d_wcstombs='$d_wcstombs'
20009 d_wctomb='$d_wctomb'
20010 d_writev='$d_writev'
20011 d_xenix='$d_xenix'
20012 date='$date'
20013 db_hashtype='$db_hashtype'
20014 db_prefixtype='$db_prefixtype'
20015 db_version_major='$db_version_major'
20016 db_version_minor='$db_version_minor'
20017 db_version_patch='$db_version_patch'
20018 defvoidused='$defvoidused'
20019 direntrytype='$direntrytype'
20020 dlext='$dlext'
20021 dlsrc='$dlsrc'
20022 doublesize='$doublesize'
20023 drand01='$drand01'
20024 drand48_r_proto='$drand48_r_proto'
20025 dynamic_ext='$dynamic_ext'
20026 eagain='$eagain'
20027 ebcdic='$ebcdic'
20028 echo='$echo'
20029 egrep='$egrep'
20030 emacs='$emacs'
20031 endgrent_r_proto='$endgrent_r_proto'
20032 endhostent_r_proto='$endhostent_r_proto'
20033 endnetent_r_proto='$endnetent_r_proto'
20034 endprotoent_r_proto='$endprotoent_r_proto'
20035 endpwent_r_proto='$endpwent_r_proto'
20036 endservent_r_proto='$endservent_r_proto'
20037 eunicefix='$eunicefix'
20038 exe_ext='$exe_ext'
20039 expr='$expr'
20040 extensions='$extensions'
20041 extras='$extras'
20042 fflushNULL='$fflushNULL'
20043 fflushall='$fflushall'
20044 find='$find'
20045 firstmakefile='$firstmakefile'
20046 flex='$flex'
20047 fpossize='$fpossize'
20048 fpostype='$fpostype'
20049 freetype='$freetype'
20050 from='$from'
20051 full_ar='$full_ar'
20052 full_csh='$full_csh'
20053 full_sed='$full_sed'
20054 gccosandvers='$gccosandvers'
20055 gccversion='$gccversion'
20056 getgrent_r_proto='$getgrent_r_proto'
20057 getgrgid_r_proto='$getgrgid_r_proto'
20058 getgrnam_r_proto='$getgrnam_r_proto'
20059 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
20060 gethostbyname_r_proto='$gethostbyname_r_proto'
20061 gethostent_r_proto='$gethostent_r_proto'
20062 getlogin_r_proto='$getlogin_r_proto'
20063 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
20064 getnetbyname_r_proto='$getnetbyname_r_proto'
20065 getnetent_r_proto='$getnetent_r_proto'
20066 getprotobyname_r_proto='$getprotobyname_r_proto'
20067 getprotobynumber_r_proto='$getprotobynumber_r_proto'
20068 getprotoent_r_proto='$getprotoent_r_proto'
20069 getpwent_r_proto='$getpwent_r_proto'
20070 getpwnam_r_proto='$getpwnam_r_proto'
20071 getpwuid_r_proto='$getpwuid_r_proto'
20072 getservbyname_r_proto='$getservbyname_r_proto'
20073 getservbyport_r_proto='$getservbyport_r_proto'
20074 getservent_r_proto='$getservent_r_proto'
20075 getspnam_r_proto='$getspnam_r_proto'
20076 gidformat='$gidformat'
20077 gidsign='$gidsign'
20078 gidsize='$gidsize'
20079 gidtype='$gidtype'
20080 glibpth='$glibpth'
20081 gmake='$gmake'
20082 gmtime_r_proto='$gmtime_r_proto'
20083 grep='$grep'
20084 groupcat='$groupcat'
20085 groupstype='$groupstype'
20086 gzip='$gzip'
20087 h_fcntl='$h_fcntl'
20088 h_sysfile='$h_sysfile'
20089 hint='$hint'
20090 hostcat='$hostcat'
20091 i16size='$i16size'
20092 i16type='$i16type'
20093 i32size='$i32size'
20094 i32type='$i32type'
20095 i64size='$i64size'
20096 i64type='$i64type'
20097 i8size='$i8size'
20098 i8type='$i8type'
20099 i_arpainet='$i_arpainet'
20100 i_bsdioctl='$i_bsdioctl'
20101 i_crypt='$i_crypt'
20102 i_db='$i_db'
20103 i_dbm='$i_dbm'
20104 i_dirent='$i_dirent'
20105 i_dld='$i_dld'
20106 i_dlfcn='$i_dlfcn'
20107 i_fcntl='$i_fcntl'
20108 i_float='$i_float'
20109 i_fp='$i_fp'
20110 i_fp_class='$i_fp_class'
20111 i_gdbm='$i_gdbm'
20112 i_grp='$i_grp'
20113 i_ieeefp='$i_ieeefp'
20114 i_inttypes='$i_inttypes'
20115 i_langinfo='$i_langinfo'
20116 i_libutil='$i_libutil'
20117 i_limits='$i_limits'
20118 i_locale='$i_locale'
20119 i_machcthr='$i_machcthr'
20120 i_malloc='$i_malloc'
20121 i_math='$i_math'
20122 i_memory='$i_memory'
20123 i_mntent='$i_mntent'
20124 i_ndbm='$i_ndbm'
20125 i_netdb='$i_netdb'
20126 i_neterrno='$i_neterrno'
20127 i_netinettcp='$i_netinettcp'
20128 i_niin='$i_niin'
20129 i_poll='$i_poll'
20130 i_prot='$i_prot'
20131 i_pthread='$i_pthread'
20132 i_pwd='$i_pwd'
20133 i_rpcsvcdbm='$i_rpcsvcdbm'
20134 i_sfio='$i_sfio'
20135 i_sgtty='$i_sgtty'
20136 i_shadow='$i_shadow'
20137 i_socks='$i_socks'
20138 i_stdarg='$i_stdarg'
20139 i_stddef='$i_stddef'
20140 i_stdlib='$i_stdlib'
20141 i_string='$i_string'
20142 i_sunmath='$i_sunmath'
20143 i_sysaccess='$i_sysaccess'
20144 i_sysdir='$i_sysdir'
20145 i_sysfile='$i_sysfile'
20146 i_sysfilio='$i_sysfilio'
20147 i_sysin='$i_sysin'
20148 i_sysioctl='$i_sysioctl'
20149 i_syslog='$i_syslog'
20150 i_sysmman='$i_sysmman'
20151 i_sysmode='$i_sysmode'
20152 i_sysmount='$i_sysmount'
20153 i_sysndir='$i_sysndir'
20154 i_sysparam='$i_sysparam'
20155 i_sysresrc='$i_sysresrc'
20156 i_syssecrt='$i_syssecrt'
20157 i_sysselct='$i_sysselct'
20158 i_syssockio='$i_syssockio'
20159 i_sysstat='$i_sysstat'
20160 i_sysstatfs='$i_sysstatfs'
20161 i_sysstatvfs='$i_sysstatvfs'
20162 i_systime='$i_systime'
20163 i_systimek='$i_systimek'
20164 i_systimes='$i_systimes'
20165 i_systypes='$i_systypes'
20166 i_sysuio='$i_sysuio'
20167 i_sysun='$i_sysun'
20168 i_sysutsname='$i_sysutsname'
20169 i_sysvfs='$i_sysvfs'
20170 i_syswait='$i_syswait'
20171 i_termio='$i_termio'
20172 i_termios='$i_termios'
20173 i_time='$i_time'
20174 i_unistd='$i_unistd'
20175 i_ustat='$i_ustat'
20176 i_utime='$i_utime'
20177 i_values='$i_values'
20178 i_varargs='$i_varargs'
20179 i_varhdr='$i_varhdr'
20180 i_vfork='$i_vfork'
20181 ignore_versioned_solibs='$ignore_versioned_solibs'
20182 inc_version_list='$inc_version_list'
20183 inc_version_list_init='$inc_version_list_init'
20184 incpath='$incpath'
20185 inews='$inews'
20186 installarchlib='$installarchlib'
20187 installbin='$installbin'
20188 installman1dir='$installman1dir'
20189 installman3dir='$installman3dir'
20190 installprefix='$installprefix'
20191 installprefixexp='$installprefixexp'
20192 installprivlib='$installprivlib'
20193 installscript='$installscript'
20194 installsitearch='$installsitearch'
20195 installsitebin='$installsitebin'
20196 installsitelib='$installsitelib'
20197 installstyle='$installstyle'
20198 installusrbinperl='$installusrbinperl'
20199 installvendorarch='$installvendorarch'
20200 installvendorbin='$installvendorbin'
20201 installvendorlib='$installvendorlib'
20202 intsize='$intsize'
20203 issymlink='$issymlink'
20204 ivdformat='$ivdformat'
20205 ivsize='$ivsize'
20206 ivtype='$ivtype'
20207 known_extensions='$known_extensions'
20208 ksh='$ksh'
20209 ld='$ld'
20210 lddlflags='$lddlflags'
20211 ldflags='$ldflags'
20212 ldflags_uselargefiles='$ldflags_uselargefiles'
20213 ldlibpthname='$ldlibpthname'
20214 less='$less'
20215 lib_ext='$lib_ext'
20216 libc='$libc'
20217 libperl='$libperl'
20218 libpth='$libpth'
20219 libs='$libs'
20220 libsdirs='$libsdirs'
20221 libsfiles='$libsfiles'
20222 libsfound='$libsfound'
20223 libspath='$libspath'
20224 libswanted='$libswanted'
20225 libswanted_uselargefiles='$libswanted_uselargefiles'
20226 line='$line'
20227 lint='$lint'
20228 lkflags='$lkflags'
20229 ln='$ln'
20230 lns='$lns'
20231 localtime_r_proto='$localtime_r_proto'
20232 locincpth='$locincpth'
20233 loclibpth='$loclibpth'
20234 longdblsize='$longdblsize'
20235 longlongsize='$longlongsize'
20236 longsize='$longsize'
20237 lp='$lp'
20238 lpr='$lpr'
20239 ls='$ls'
20240 lseeksize='$lseeksize'
20241 lseektype='$lseektype'
20242 mail='$mail'
20243 mailx='$mailx'
20244 make='$make'
20245 make_set_make='$make_set_make'
20246 mallocobj='$mallocobj'
20247 mallocsrc='$mallocsrc'
20248 malloctype='$malloctype'
20249 man1dir='$man1dir'
20250 man1direxp='$man1direxp'
20251 man1ext='$man1ext'
20252 man3dir='$man3dir'
20253 man3direxp='$man3direxp'
20254 man3ext='$man3ext'
20255 mips_type='$mips_type'
20256 mkdir='$mkdir'
20257 mmaptype='$mmaptype'
20258 modetype='$modetype'
20259 more='$more'
20260 multiarch='$multiarch'
20261 mv='$mv'
20262 myarchname='$myarchname'
20263 mydomain='$mydomain'
20264 myhostname='$myhostname'
20265 myuname='$myuname'
20266 n='$n'
20267 need_va_copy='$need_va_copy'
20268 netdb_hlen_type='$netdb_hlen_type'
20269 netdb_host_type='$netdb_host_type'
20270 netdb_name_type='$netdb_name_type'
20271 netdb_net_type='$netdb_net_type'
20272 nm='$nm'
20273 nm_opt='$nm_opt'
20274 nm_so_opt='$nm_so_opt'
20275 nonxs_ext='$nonxs_ext'
20276 nroff='$nroff'
20277 nvEUformat='$nvEUformat'
20278 nvFUformat='$nvFUformat'
20279 nvGUformat='$nvGUformat'
20280 nv_preserves_uv_bits='$nv_preserves_uv_bits'
20281 nveformat='$nveformat'
20282 nvfformat='$nvfformat'
20283 nvgformat='$nvgformat'
20284 nvsize='$nvsize'
20285 nvtype='$nvtype'
20286 o_nonblock='$o_nonblock'
20287 obj_ext='$obj_ext'
20288 old_pthread_create_joinable='$old_pthread_create_joinable'
20289 optimize='$optimize'
20290 orderlib='$orderlib'
20291 osname='$osname'
20292 osvers='$osvers'
20293 otherlibdirs='$otherlibdirs'
20294 package='$package'
20295 pager='$pager'
20296 passcat='$passcat'
20297 patchlevel='$patchlevel'
20298 path_sep='$path_sep'
20299 perl5='$perl5'
20300 perl='$perl'
20301 perl_patchlevel='$perl_patchlevel'
20302 perladmin='$perladmin'
20303 perllibs='$perllibs'
20304 perlpath='$perlpath'
20305 pg='$pg'
20306 phostname='$phostname'
20307 pidtype='$pidtype'
20308 plibpth='$plibpth'
20309 pm_apiversion='$pm_apiversion'
20310 pmake='$pmake'
20311 pr='$pr'
20312 prefix='$prefix'
20313 prefixexp='$prefixexp'
20314 privlib='$privlib'
20315 privlibexp='$privlibexp'
20316 procselfexe='$procselfexe'
20317 prototype='$prototype'
20318 ptrsize='$ptrsize'
20319 quadkind='$quadkind'
20320 quadtype='$quadtype'
20321 randbits='$randbits'
20322 randfunc='$randfunc'
20323 random_r_proto='$random_r_proto'
20324 randseedtype='$randseedtype'
20325 ranlib='$ranlib'
20326 rd_nodata='$rd_nodata'
20327 readdir64_r_proto='$readdir64_r_proto'
20328 readdir_r_proto='$readdir_r_proto'
20329 revision='$revision'
20330 rm='$rm'
20331 rmail='$rmail'
20332 run='$run'
20333 runnm='$runnm'
20334 sPRIEUldbl='$sPRIEUldbl'
20335 sPRIFUldbl='$sPRIFUldbl'
20336 sPRIGUldbl='$sPRIGUldbl'
20337 sPRIXU64='$sPRIXU64'
20338 sPRId64='$sPRId64'
20339 sPRIeldbl='$sPRIeldbl'
20340 sPRIfldbl='$sPRIfldbl'
20341 sPRIgldbl='$sPRIgldbl'
20342 sPRIi64='$sPRIi64'
20343 sPRIo64='$sPRIo64'
20344 sPRIu64='$sPRIu64'
20345 sPRIx64='$sPRIx64'
20346 sSCNfldbl='$sSCNfldbl'
20347 sched_yield='$sched_yield'
20348 scriptdir='$scriptdir'
20349 scriptdirexp='$scriptdirexp'
20350 sed='$sed'
20351 seedfunc='$seedfunc'
20352 selectminbits='$selectminbits'
20353 selecttype='$selecttype'
20354 sendmail='$sendmail'
20355 setgrent_r_proto='$setgrent_r_proto'
20356 sethostent_r_proto='$sethostent_r_proto'
20357 setlocale_r_proto='$setlocale_r_proto'
20358 setnetent_r_proto='$setnetent_r_proto'
20359 setprotoent_r_proto='$setprotoent_r_proto'
20360 setpwent_r_proto='$setpwent_r_proto'
20361 setservent_r_proto='$setservent_r_proto'
20362 sh='$sh'
20363 shar='$shar'
20364 sharpbang='$sharpbang'
20365 shmattype='$shmattype'
20366 shortsize='$shortsize'
20367 shrpenv='$shrpenv'
20368 shsharp='$shsharp'
20369 sig_count='$sig_count'
20370 sig_name='$sig_name'
20371 sig_name_init='$sig_name_init'
20372 sig_num='$sig_num'
20373 sig_num_init='$sig_num_init'
20374 sig_size='$sig_size'
20375 signal_t='$signal_t'
20376 sitearch='$sitearch'
20377 sitearchexp='$sitearchexp'
20378 sitebin='$sitebin'
20379 sitebinexp='$sitebinexp'
20380 sitelib='$sitelib'
20381 sitelib_stem='$sitelib_stem'
20382 sitelibexp='$sitelibexp'
20383 siteprefix='$siteprefix'
20384 siteprefixexp='$siteprefixexp'
20385 sizesize='$sizesize'
20386 sizetype='$sizetype'
20387 sleep='$sleep'
20388 smail='$smail'
20389 so='$so'
20390 sockethdr='$sockethdr'
20391 socketlib='$socketlib'
20392 socksizetype='$socksizetype'
20393 sort='$sort'
20394 spackage='$spackage'
20395 spitshell='$spitshell'
20396 srand48_r_proto='$srand48_r_proto'
20397 srandom_r_proto='$srandom_r_proto'
20398 src='$src'
20399 ssizetype='$ssizetype'
20400 startperl='$startperl'
20401 startsh='$startsh'
20402 static_ext='$static_ext'
20403 stdchar='$stdchar'
20404 stdio_base='$stdio_base'
20405 stdio_bufsiz='$stdio_bufsiz'
20406 stdio_cnt='$stdio_cnt'
20407 stdio_filbuf='$stdio_filbuf'
20408 stdio_ptr='$stdio_ptr'
20409 stdio_stream_array='$stdio_stream_array'
20410 strerror_r_proto='$strerror_r_proto'
20411 strings='$strings'
20412 submit='$submit'
20413 subversion='$subversion'
20414 sysman='$sysman'
20415 tail='$tail'
20416 tar='$tar'
20417 targetarch='$targetarch'
20418 tbl='$tbl'
20419 tee='$tee'
20420 test='$test'
20421 timeincl='$timeincl'
20422 timetype='$timetype'
20423 tmpnam_r_proto='$tmpnam_r_proto'
20424 to='$to'
20425 touch='$touch'
20426 tr='$tr'
20427 trnl='$trnl'
20428 troff='$troff'
20429 ttyname_r_proto='$ttyname_r_proto'
20430 u16size='$u16size'
20431 u16type='$u16type'
20432 u32size='$u32size'
20433 u32type='$u32type'
20434 u64size='$u64size'
20435 u64type='$u64type'
20436 u8size='$u8size'
20437 u8type='$u8type'
20438 uidformat='$uidformat'
20439 uidsign='$uidsign'
20440 uidsize='$uidsize'
20441 uidtype='$uidtype'
20442 uname='$uname'
20443 uniq='$uniq'
20444 uquadtype='$uquadtype'
20445 use5005threads='$use5005threads'
20446 use64bitall='$use64bitall'
20447 use64bitint='$use64bitint'
20448 usecrosscompile='$usecrosscompile'
20449 usedl='$usedl'
20450 useithreads='$useithreads'
20451 uselargefiles='$uselargefiles'
20452 uselongdouble='$uselongdouble'
20453 usemorebits='$usemorebits'
20454 usemultiplicity='$usemultiplicity'
20455 usemymalloc='$usemymalloc'
20456 usenm='$usenm'
20457 useopcode='$useopcode'
20458 useperlio='$useperlio'
20459 useposix='$useposix'
20460 usereentrant='$usereentrant'
20461 usesfio='$usesfio'
20462 useshrplib='$useshrplib'
20463 usesocks='$usesocks'
20464 usethreads='$usethreads'
20465 usevendorprefix='$usevendorprefix'
20466 usevfork='$usevfork'
20467 usrinc='$usrinc'
20468 uuname='$uuname'
20469 uvXUformat='$uvXUformat'
20470 uvoformat='$uvoformat'
20471 uvsize='$uvsize'
20472 uvtype='$uvtype'
20473 uvuformat='$uvuformat'
20474 uvxformat='$uvxformat'
20475 vendorarch='$vendorarch'
20476 vendorarchexp='$vendorarchexp'
20477 vendorbin='$vendorbin'
20478 vendorbinexp='$vendorbinexp'
20479 vendorlib='$vendorlib'
20480 vendorlib_stem='$vendorlib_stem'
20481 vendorlibexp='$vendorlibexp'
20482 vendorprefix='$vendorprefix'
20483 vendorprefixexp='$vendorprefixexp'
20484 version='$version'
20485 version_patchlevel_string='$version_patchlevel_string'
20486 versiononly='$versiononly'
20487 vi='$vi'
20488 voidflags='$voidflags'
20489 xlibpth='$xlibpth'
20490 xs_apiversion='$xs_apiversion'
20491 yacc='$yacc'
20492 yaccflags='$yaccflags'
20493 zcat='$zcat'
20494 zip='$zip'
20495 EOT
20496
20497 : Add in command line options if available
20498 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
20499
20500 : add special variables
20501 $test -f $src/patchlevel.h && \
20502 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
20503 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
20504 echo "PERL_CONFIG_SH=true" >>config.sh
20505
20506 : propagate old symbols
20507 if $test -f UU/config.sh; then
20508         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
20509         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
20510         $sort | $uniq -u >UU/oldsyms
20511         set X `cat UU/oldsyms`
20512         shift
20513         case $# in
20514         0) ;;
20515         *)
20516                 cat <<EOM
20517 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
20518 EOM
20519                 echo "# Variables propagated from previous config.sh file." >>config.sh
20520                 for sym in `cat UU/oldsyms`; do
20521                         echo "    Propagating $hint variable "'$'"$sym..."
20522                         eval 'tmp="$'"${sym}"'"'
20523                         echo "$tmp" | \
20524                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
20525                 done
20526                 ;;
20527         esac
20528 fi
20529
20530 : Finish up by extracting the .SH files
20531 case "$alldone" in
20532 exit)
20533         $rm -rf UU
20534         echo "Extraction done."
20535         exit 0
20536         ;;
20537 cont)
20538         ;;
20539 '')
20540         dflt=''
20541         nostick=true
20542         $cat <<EOM
20543
20544 If you'd like to make any changes to the config.sh file before I begin
20545 to configure things, do it as a shell escape now (e.g. !vi config.sh).
20546
20547 EOM
20548         rp="Press return or use a shell escape to edit config.sh:"
20549         . UU/myread
20550         nostick=''
20551         case "$ans" in
20552         '') ;;
20553         *) : in case they cannot read
20554                 sh 1>&4 -c "$ans";;
20555         esac
20556         ;;
20557 esac
20558
20559 : if this fails, just run all the .SH files by hand
20560 . ./config.sh
20561
20562 echo " "
20563 exec 1>&4
20564 pwd=`pwd`
20565 . ./UU/extract
20566 cd "$pwd"
20567
20568 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
20569         dflt=y
20570         case "$silent" in
20571         true) ;;
20572         *)
20573                 $cat <<EOM
20574
20575 Now you need to generate make dependencies by running "$make depend".
20576 You might prefer to run it in background: "$make depend > makedepend.out &"
20577 It can take a while, so you might not want to run it right now.
20578
20579 EOM
20580                 ;;
20581         esac
20582         rp="Run $make depend now?"
20583         . UU/myread
20584         case "$ans" in
20585         y*)
20586                 $make depend && echo "Now you must run '$make'."
20587                 ;;
20588         *)
20589                 echo "You must run '$make depend' then '$make'."
20590                 ;;
20591         esac
20592 elif test -f [Mm]akefile; then
20593         echo " "
20594         echo "Now you must run a $make."
20595 else
20596         echo "Configure done."
20597 fi
20598
20599 if $test -f Policy.sh; then
20600     $cat <<EOM
20601
20602 If you compile $package on a different machine or from a different object
20603 directory, copy the Policy.sh file from this object directory to the
20604 new one before you run Configure -- this will help you with most of
20605 the policy defaults.
20606
20607 EOM
20608 fi
20609 if $test -f config.msg; then
20610     echo "Hmm.  I also noted the following information while running:"
20611     echo " "
20612     $cat config.msg >&4
20613     $rm -f config.msg
20614 fi
20615 $rm -f kit*isdone ark*isdone
20616 $rm -rf UU
20617
20618 : End of Configure
20619