This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate change #18420 from maint-5.8:
[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 Mon Dec 16 12:51:57 MET 2002 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.org)
25
26 cat >c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat c1$$ c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f c1$$ c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 case "X${MACHTYPE:-nonesuchmach}" in
69                 *cygwin) ;;
70                 *) p_=\; ;;
71                 esac
72         fi
73 fi
74
75 : Proper PATH setting
76 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
77 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
78 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
79 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
80 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
81 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
82 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
83 paths="$paths /sbin /usr/sbin /usr/libexec"
84 paths="$paths /system/gnu_library/bin"
85
86 for p in $paths
87 do
88         case "$p_$PATH$p_" in
89         *$p_$p$p_*) ;;
90         *) test -d $p && PATH=$PATH$p_$p ;;
91         esac
92 done
93
94 PATH=.$p_$PATH
95 export PATH
96
97 : shall we be using ksh?
98 inksh=''
99 needksh=''
100 avoidksh=''
101 newsh=/bin/ksh
102 changesh=''
103 if (PATH=.; alias -x) >/dev/null 2>&1; then
104                 inksh=true
105 fi
106 if test -f /hp-ux -a -f /bin/ksh; then
107         needksh='to avoid sh bug in "here document" expansion'
108 fi
109 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
110         if test X`/usr/bin/uname -v` = X4; then
111                 avoidksh="to avoid AIX 4's /bin/sh"
112                 newsh=/usr/bin/bsh
113         fi
114 fi
115 if test -f /osf_boot -a -f /usr/sbin/setld; then
116         if test X`/usr/bin/uname -s` = XOSF1; then
117                 avoidksh="to avoid Digital UNIX' ksh"
118                 newsh=/bin/sh
119                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
120         fi
121 fi
122 case "$inksh/$needksh" in
123 /[a-z]*)
124                 ENV=''
125                 changesh=true
126                 reason="$needksh"
127         ;;
128 esac
129 case "$inksh/$avoidksh" in
130 true/[a-z]*)
131         changesh=true
132         reason="$avoidksh"
133         ;;
134 esac
135 case "$inksh/$needksh-$avoidksh-" in
136 true/--)
137                 cat <<EOM
138 (I see you are using the Korn shell.  Some ksh's blow up on $me,
139 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
140 EOM
141         ;;
142 esac
143 case "$changesh" in
144 true)
145         export newsh
146         echo "(Feeding myself to $newsh $reason.)"
147         case "$0" in
148         Configure|*/Configure) exec $newsh $0 "$@";;
149         *) exec $newsh Configure "$@";;
150         esac
151         ;;
152 esac
153
154 : if needed set CDPATH to a harmless value that is not chatty
155 : avoid bash 2.02 problems with empty CDPATH.
156 case "$CDPATH" in
157 '')     ;;
158 *)      case "$SHELL" in
159         *bash*) CDPATH='.' ;;
160         *)              CDPATH='' ;;
161         esac
162         ;;
163 esac
164 : Configure runs within the UU subdirectory
165 test -d UU || mkdir UU
166 cd UU && rm -f ./*
167
168
169 ccname=''
170 ccversion=''
171 ccsymbols=''
172 cppccsymbols=''
173 cppsymbols=''
174 from=''
175 run=''
176 targetarch=''
177 to=''
178 usecrosscompile=''
179 perllibs=''
180 dynamic_ext=''
181 extensions=''
182 known_extensions=''
183 nonxs_ext=''
184 static_ext=''
185 useopcode=''
186 useposix=''
187 extras=''
188 d_bsd=''
189 d_eunice=''
190 d_xenix=''
191 eunicefix=''
192 Mcc=''
193 ar=''
194 awk=''
195 bash=''
196 bison=''
197 byacc=''
198 cat=''
199 chgrp=''
200 chmod=''
201 chown=''
202 comm=''
203 compress=''
204 cp=''
205 cpio=''
206 cpp=''
207 csh=''
208 date=''
209 echo=''
210 egrep=''
211 emacs=''
212 expr=''
213 find=''
214 flex=''
215 gmake=''
216 grep=''
217 gzip=''
218 inews=''
219 ksh=''
220 less=''
221 line=''
222 lint=''
223 ln=''
224 lp=''
225 lpr=''
226 ls=''
227 mail=''
228 mailx=''
229 make=''
230 mkdir=''
231 more=''
232 mv=''
233 nm=''
234 nroff=''
235 perl=''
236 pg=''
237 pmake=''
238 pr=''
239 rm=''
240 rmail=''
241 sed=''
242 sendmail=''
243 shar=''
244 sleep=''
245 smail=''
246 sort=''
247 submit=''
248 tail=''
249 tar=''
250 tbl=''
251 tee=''
252 test=''
253 touch=''
254 tr=''
255 troff=''
256 uname=''
257 uniq=''
258 uuname=''
259 vi=''
260 zcat=''
261 zip=''
262 full_ar=''
263 full_sed=''
264 libswanted=''
265 hint=''
266 myuname=''
267 osname=''
268 osvers=''
269 Author=''
270 Date=''
271 Header=''
272 Id=''
273 Locker=''
274 Log=''
275 RCSfile=''
276 Revision=''
277 Source=''
278 State=''
279 _a=''
280 _exe=''
281 _o=''
282 archobjs=''
283 exe_ext=''
284 firstmakefile=''
285 lib_ext=''
286 obj_ext=''
287 path_sep=''
288 afs=''
289 afsroot=''
290 alignbytes=''
291 ansi2knr=''
292 archlib=''
293 archlibexp=''
294 d_archlib=''
295 installarchlib=''
296 archname=''
297 myarchname=''
298 d_atolf=''
299 d_atoll=''
300 baserev=''
301 bin=''
302 binexp=''
303 installbin=''
304 byteorder=''
305 cc=''
306 ccflags=''
307 cppflags=''
308 ldflags=''
309 lkflags=''
310 locincpth=''
311 optimize=''
312 cf_email=''
313 cf_by=''
314 cf_time=''
315 charsize=''
316 contains=''
317 cpp_stuff=''
318 cpplast=''
319 cppminus=''
320 cpprun=''
321 cppstdin=''
322 d__fwalk=''
323 d_access=''
324 d_accessx=''
325 d_alarm=''
326 asctime_r_proto=''
327 d_asctime_r=''
328 d_attribut=''
329 d_bcmp=''
330 d_bcopy=''
331 d_bzero=''
332 d_casti32=''
333 castflags=''
334 d_castneg=''
335 d_chown=''
336 d_chroot=''
337 d_chsize=''
338 d_class=''
339 d_closedir=''
340 d_void_closedir=''
341 d_cmsghdr_s=''
342 d_const=''
343 cryptlib=''
344 d_crypt=''
345 crypt_r_proto=''
346 d_crypt_r=''
347 d_csh=''
348 full_csh=''
349 ctermid_r_proto=''
350 d_ctermid_r=''
351 ctime_r_proto=''
352 d_ctime_r=''
353 d_cuserid=''
354 d_dbl_dig=''
355 d_dbminitproto=''
356 d_difftime=''
357 d_dirfd=''
358 d_dlerror=''
359 d_dlopen=''
360 d_dlsymun=''
361 d_dosuid=''
362 d_suidsafe=''
363 d_drand48_r=''
364 drand48_r_proto=''
365 d_drand48proto=''
366 d_dup2=''
367 d_eaccess=''
368 d_endgrent=''
369 d_endgrent_r=''
370 endgrent_r_proto=''
371 d_endhent=''
372 d_endhostent_r=''
373 endhostent_r_proto=''
374 d_endnent=''
375 d_endnetent_r=''
376 endnetent_r_proto=''
377 d_endpent=''
378 d_endprotoent_r=''
379 endprotoent_r_proto=''
380 d_endpwent=''
381 d_endpwent_r=''
382 endpwent_r_proto=''
383 d_endsent=''
384 d_endservent_r=''
385 endservent_r_proto=''
386 d_fchdir=''
387 d_fchmod=''
388 d_fchown=''
389 d_fcntl=''
390 d_fcntl_can_lock=''
391 d_fd_macros=''
392 d_fd_set=''
393 d_fds_bits=''
394 d_fgetpos=''
395 d_finite=''
396 d_finitel=''
397 d_flexfnam=''
398 d_flock=''
399 d_flockproto=''
400 d_fork=''
401 d_fp_class=''
402 d_fpclass=''
403 d_fpclassify=''
404 d_fpclassl=''
405 d_fpos64_t=''
406 d_frexpl=''
407 d_fs_data_s=''
408 d_fseeko=''
409 d_fsetpos=''
410 d_fstatfs=''
411 d_fsync=''
412 d_ftello=''
413 d_ftime=''
414 d_gettimeod=''
415 d_Gconvert=''
416 d_getcwd=''
417 d_getespwnam=''
418 d_getfsstat=''
419 d_getgrent=''
420 d_getgrent_r=''
421 getgrent_r_proto=''
422 d_getgrgid_r=''
423 getgrgid_r_proto=''
424 d_getgrnam_r=''
425 getgrnam_r_proto=''
426 d_getgrps=''
427 d_gethbyaddr=''
428 d_gethbyname=''
429 d_gethent=''
430 aphostname=''
431 d_gethname=''
432 d_phostname=''
433 d_uname=''
434 d_gethostbyaddr_r=''
435 gethostbyaddr_r_proto=''
436 d_gethostbyname_r=''
437 gethostbyname_r_proto=''
438 d_gethostent_r=''
439 gethostent_r_proto=''
440 d_gethostprotos=''
441 d_getitimer=''
442 d_getlogin=''
443 d_getlogin_r=''
444 getlogin_r_proto=''
445 d_getmnt=''
446 d_getmntent=''
447 d_getnbyaddr=''
448 d_getnbyname=''
449 d_getnent=''
450 d_getnetbyaddr_r=''
451 getnetbyaddr_r_proto=''
452 d_getnetbyname_r=''
453 getnetbyname_r_proto=''
454 d_getnetent_r=''
455 getnetent_r_proto=''
456 d_getnetprotos=''
457 d_getpagsz=''
458 d_getpent=''
459 d_getpgid=''
460 d_getpgrp2=''
461 d_bsdgetpgrp=''
462 d_getpgrp=''
463 d_getppid=''
464 d_getprior=''
465 d_getpbyname=''
466 d_getpbynumber=''
467 d_getprotobyname_r=''
468 getprotobyname_r_proto=''
469 d_getprotobynumber_r=''
470 getprotobynumber_r_proto=''
471 d_getprotoent_r=''
472 getprotoent_r_proto=''
473 d_getprotoprotos=''
474 d_getprpwnam=''
475 d_getpwent=''
476 d_getpwent_r=''
477 getpwent_r_proto=''
478 d_getpwnam_r=''
479 getpwnam_r_proto=''
480 d_getpwuid_r=''
481 getpwuid_r_proto=''
482 d_getsent=''
483 d_getservbyname_r=''
484 getservbyname_r_proto=''
485 d_getservbyport_r=''
486 getservbyport_r_proto=''
487 d_getservent_r=''
488 getservent_r_proto=''
489 d_getservprotos=''
490 d_getspnam=''
491 d_getspnam_r=''
492 getspnam_r_proto=''
493 d_getsbyname=''
494 d_getsbyport=''
495 d_gmtime_r=''
496 gmtime_r_proto=''
497 d_gnulibc=''
498 gnulibc_version=''
499 d_hasmntopt=''
500 d_htonl=''
501 d_inetaton=''
502 d_int64_t=''
503 d_isascii=''
504 d_isfinite=''
505 d_isinf=''
506 d_isnan=''
507 d_isnanl=''
508 d_killpg=''
509 d_lchown=''
510 d_ldbl_dig=''
511 d_link=''
512 d_localtime_r=''
513 localtime_r_proto=''
514 d_locconv=''
515 d_lockf=''
516 d_longdbl=''
517 longdblsize=''
518 d_longlong=''
519 longlongsize=''
520 d_lseekproto=''
521 d_lstat=''
522 d_madvise=''
523 d_mblen=''
524 d_mbstowcs=''
525 d_mbtowc=''
526 d_memchr=''
527 d_memcmp=''
528 d_memcpy=''
529 d_memmove=''
530 d_memset=''
531 d_mkdir=''
532 d_mkdtemp=''
533 d_mkfifo=''
534 d_mkstemp=''
535 d_mkstemps=''
536 d_mktime=''
537 d_mmap=''
538 mmaptype=''
539 d_modfl=''
540 d_modfl_pow32_bug=''
541 d_modflproto=''
542 d_mprotect=''
543 d_msg=''
544 d_msgctl=''
545 d_msgget=''
546 d_msghdr_s=''
547 d_msgrcv=''
548 d_msgsnd=''
549 d_msync=''
550 d_munmap=''
551 d_nanosleep=''
552 d_nice=''
553 d_nl_langinfo=''
554 d_off64_t=''
555 d_open3=''
556 d_fpathconf=''
557 d_pathconf=''
558 d_pause=''
559 d_pipe=''
560 d_poll=''
561 d_portable=''
562 d_procselfexe=''
563 procselfexe=''
564 d_old_pthread_create_joinable=''
565 old_pthread_create_joinable=''
566 d_pthread_atfork=''
567 d_pthread_yield=''
568 d_sched_yield=''
569 sched_yield=''
570 d_qgcvt=''
571 d_random_r=''
572 random_r_proto=''
573 d_readdir64_r=''
574 readdir64_r_proto=''
575 d_readdir=''
576 d_rewinddir=''
577 d_seekdir=''
578 d_telldir=''
579 d_readdir_r=''
580 readdir_r_proto=''
581 d_readlink=''
582 d_readv=''
583 d_recvmsg=''
584 d_rename=''
585 d_rmdir=''
586 d_safebcpy=''
587 d_safemcpy=''
588 d_sanemcmp=''
589 d_sbrkproto=''
590 d_select=''
591 d_sem=''
592 d_semctl=''
593 d_semget=''
594 d_semop=''
595 d_sendmsg=''
596 d_setegid=''
597 d_seteuid=''
598 d_setgrent=''
599 d_setgrent_r=''
600 setgrent_r_proto=''
601 d_setgrps=''
602 d_sethent=''
603 d_sethostent_r=''
604 sethostent_r_proto=''
605 d_setitimer=''
606 d_setlinebuf=''
607 d_setlocale=''
608 d_setlocale_r=''
609 setlocale_r_proto=''
610 d_setnent=''
611 d_setnetent_r=''
612 setnetent_r_proto=''
613 d_setpent=''
614 d_setpgid=''
615 d_setpgrp2=''
616 d_bsdsetpgrp=''
617 d_setpgrp=''
618 d_setprior=''
619 d_setproctitle=''
620 d_setprotoent_r=''
621 setprotoent_r_proto=''
622 d_setpwent=''
623 d_setpwent_r=''
624 setpwent_r_proto=''
625 d_setregid=''
626 d_setresgid=''
627 d_setresuid=''
628 d_setreuid=''
629 d_setrgid=''
630 d_setruid=''
631 d_setsent=''
632 d_setservent_r=''
633 setservent_r_proto=''
634 d_setsid=''
635 d_setvbuf=''
636 d_sfio=''
637 usesfio=''
638 d_shm=''
639 d_shmat=''
640 d_shmatprototype=''
641 shmattype=''
642 d_shmctl=''
643 d_shmdt=''
644 d_shmget=''
645 d_sigaction=''
646 d_sigprocmask=''
647 d_sigsetjmp=''
648 d_sockatmark=''
649 d_sockatmarkproto=''
650 d_msg_ctrunc=''
651 d_msg_dontroute=''
652 d_msg_oob=''
653 d_msg_peek=''
654 d_msg_proxy=''
655 d_oldsock=''
656 d_scm_rights=''
657 d_socket=''
658 d_sockpair=''
659 sockethdr=''
660 socketlib=''
661 d_socklen_t=''
662 d_socks5_init=''
663 d_sqrtl=''
664 d_srand48_r=''
665 srand48_r_proto=''
666 d_srandom_r=''
667 srandom_r_proto=''
668 d_sresgproto=''
669 d_sresuproto=''
670 d_statblks=''
671 d_statfs_f_flags=''
672 d_statfs_s=''
673 d_fstatvfs=''
674 d_statvfs=''
675 d_stdio_cnt_lval=''
676 d_stdio_ptr_lval=''
677 d_stdio_ptr_lval_nochange_cnt=''
678 d_stdio_ptr_lval_sets_cnt=''
679 d_stdiobase=''
680 d_stdstdio=''
681 stdio_base=''
682 stdio_bufsiz=''
683 stdio_cnt=''
684 stdio_filbuf=''
685 stdio_ptr=''
686 d_index=''
687 d_strchr=''
688 d_strcoll=''
689 d_strctcpy=''
690 d_strerrm=''
691 d_strerror=''
692 d_sysernlst=''
693 d_syserrlst=''
694 d_strerror_r=''
695 strerror_r_proto=''
696 d_strftime=''
697 d_strtod=''
698 d_strtol=''
699 d_strtold=''
700 d_strtoll=''
701 d_strtoq=''
702 d_strtoul=''
703 d_strtoull=''
704 d_strtouq=''
705 d_strxfrm=''
706 d_symlink=''
707 d_syscall=''
708 d_syscallproto=''
709 d_sysconf=''
710 d_system=''
711 d_tcgetpgrp=''
712 d_tcsetpgrp=''
713 d_telldirproto=''
714 d_time=''
715 timetype=''
716 clocktype=''
717 d_times=''
718 d_tmpnam_r=''
719 tmpnam_r_proto=''
720 d_truncate=''
721 d_ttyname_r=''
722 ttyname_r_proto=''
723 d_tzname=''
724 d_u32align=''
725 d_ualarm=''
726 d_umask=''
727 d_semctl_semid_ds=''
728 d_semctl_semun=''
729 d_union_semun=''
730 d_unordered=''
731 d_usleep=''
732 d_usleepproto=''
733 d_ustat=''
734 d_vfork=''
735 usevfork=''
736 d_voidsig=''
737 signal_t=''
738 d_volatile=''
739 d_charvspr=''
740 d_vprintf=''
741 d_wait4=''
742 d_waitpid=''
743 d_wcstombs=''
744 d_wctomb=''
745 d_writev=''
746 dlext=''
747 cccdlflags=''
748 ccdlflags=''
749 dlsrc=''
750 ld=''
751 lddlflags=''
752 usedl=''
753 doublesize=''
754 ebcdic=''
755 fflushNULL=''
756 fflushall=''
757 fpossize=''
758 fpostype=''
759 gccansipedantic=''
760 gccosandvers=''
761 gccversion=''
762 gidformat=''
763 gidsign=''
764 gidsize=''
765 gidtype=''
766 groupstype=''
767 h_fcntl=''
768 h_sysfile=''
769 html1dir=''
770 html1direxp=''
771 installhtml1dir=''
772 html3dir=''
773 html3direxp=''
774 installhtml3dir=''
775 i_arpainet=''
776 i_crypt=''
777 db_hashtype=''
778 db_prefixtype=''
779 db_version_major=''
780 db_version_minor=''
781 db_version_patch=''
782 i_db=''
783 i_dbm=''
784 i_rpcsvcdbm=''
785 d_dirnamlen=''
786 direntrytype=''
787 i_dirent=''
788 i_dld=''
789 i_dlfcn=''
790 i_fcntl=''
791 i_float=''
792 i_fp=''
793 i_fp_class=''
794 i_gdbm=''
795 d_grpasswd=''
796 i_grp=''
797 i_ieeefp=''
798 i_inttypes=''
799 i_langinfo=''
800 i_libutil=''
801 i_limits=''
802 i_locale=''
803 i_machcthr=''
804 i_malloc=''
805 i_math=''
806 i_memory=''
807 i_mntent=''
808 i_ndbm=''
809 i_netdb=''
810 i_neterrno=''
811 i_netinettcp=''
812 i_niin=''
813 i_sysin=''
814 i_poll=''
815 i_prot=''
816 i_pthread=''
817 d_pwage=''
818 d_pwchange=''
819 d_pwclass=''
820 d_pwcomment=''
821 d_pwexpire=''
822 d_pwgecos=''
823 d_pwpasswd=''
824 d_pwquota=''
825 i_pwd=''
826 i_sfio=''
827 i_shadow=''
828 i_socks=''
829 i_stddef=''
830 i_stdlib=''
831 i_string=''
832 strings=''
833 i_sunmath=''
834 i_sysaccess=''
835 i_sysdir=''
836 i_sysfile=''
837 d_voidtty=''
838 i_bsdioctl=''
839 i_sysfilio=''
840 i_sysioctl=''
841 i_syssockio=''
842 i_syslog=''
843 i_sysmman=''
844 i_sysmode=''
845 i_sysmount=''
846 i_sysndir=''
847 i_sysparam=''
848 i_sysresrc=''
849 i_syssecrt=''
850 i_sysselct=''
851 i_sysstat=''
852 i_sysstatfs=''
853 i_sysstatvfs=''
854 i_systimes=''
855 i_systypes=''
856 i_sysuio=''
857 i_sysun=''
858 i_sysutsname=''
859 i_sysvfs=''
860 i_syswait=''
861 i_sgtty=''
862 i_termio=''
863 i_termios=''
864 d_tm_tm_gmtoff=''
865 d_tm_tm_zone=''
866 i_systime=''
867 i_systimek=''
868 i_time=''
869 timeincl=''
870 i_unistd=''
871 i_ustat=''
872 i_utime=''
873 i_values=''
874 i_stdarg=''
875 i_varargs=''
876 i_varhdr=''
877 i_vfork=''
878 inc_version_list=''
879 inc_version_list_init=''
880 installprefix=''
881 installprefixexp=''
882 installstyle=''
883 installusrbinperl=''
884 intsize=''
885 longsize=''
886 shortsize=''
887 issymlink=''
888 libc=''
889 ldlibpthname=''
890 libperl=''
891 shrpenv=''
892 useshrplib=''
893 glibpth=''
894 libpth=''
895 loclibpth=''
896 plibpth=''
897 xlibpth=''
898 ignore_versioned_solibs=''
899 libs=''
900 libsdirs=''
901 libsfiles=''
902 libsfound=''
903 libspath=''
904 lns=''
905 d_PRIEUldbl=''
906 d_PRIFUldbl=''
907 d_PRIGUldbl=''
908 d_PRIeldbl=''
909 d_PRIfldbl=''
910 d_PRIgldbl=''
911 d_SCNfldbl=''
912 sPRIEUldbl=''
913 sPRIFUldbl=''
914 sPRIGUldbl=''
915 sPRIeldbl=''
916 sPRIfldbl=''
917 sPRIgldbl=''
918 sSCNfldbl=''
919 lseeksize=''
920 lseektype=''
921 make_set_make=''
922 d_mymalloc=''
923 freetype=''
924 mallocobj=''
925 mallocsrc=''
926 malloctype=''
927 usemymalloc=''
928 installman1dir=''
929 man1dir=''
930 man1direxp=''
931 man1ext=''
932 installman3dir=''
933 man3dir=''
934 man3direxp=''
935 man3ext=''
936 modetype=''
937 multiarch=''
938 mydomain=''
939 myhostname=''
940 phostname=''
941 c=''
942 n=''
943 d_eofnblk=''
944 eagain=''
945 o_nonblock=''
946 rd_nodata=''
947 need_va_copy=''
948 netdb_hlen_type=''
949 netdb_host_type=''
950 netdb_name_type=''
951 netdb_net_type=''
952 groupcat=''
953 hostcat=''
954 passcat=''
955 orderlib=''
956 ranlib=''
957 d_perl_otherlibdirs=''
958 otherlibdirs=''
959 package=''
960 spackage=''
961 pager=''
962 api_revision=''
963 api_subversion=''
964 api_version=''
965 api_versionstring=''
966 patchlevel=''
967 perl_patchlevel=''
968 revision=''
969 subversion=''
970 version=''
971 version_patchlevel_string=''
972 perl5=''
973 perladmin=''
974 perlpath=''
975 d_nv_preserves_uv=''
976 i16size=''
977 i16type=''
978 i32size=''
979 i32type=''
980 i64size=''
981 i64type=''
982 i8size=''
983 i8type=''
984 ivsize=''
985 ivtype=''
986 nv_preserves_uv_bits=''
987 nvsize=''
988 nvtype=''
989 u16size=''
990 u16type=''
991 u32size=''
992 u32type=''
993 u64size=''
994 u64type=''
995 u8size=''
996 u8type=''
997 uvsize=''
998 uvtype=''
999 ivdformat=''
1000 nvEUformat=''
1001 nvFUformat=''
1002 nvGUformat=''
1003 nveformat=''
1004 nvfformat=''
1005 nvgformat=''
1006 uvXUformat=''
1007 uvoformat=''
1008 uvuformat=''
1009 uvxformat=''
1010 pidtype=''
1011 prefix=''
1012 prefixexp=''
1013 installprivlib=''
1014 privlib=''
1015 privlibexp=''
1016 prototype=''
1017 ptrsize=''
1018 d_PRIXU64=''
1019 d_PRId64=''
1020 d_PRIi64=''
1021 d_PRIo64=''
1022 d_PRIu64=''
1023 d_PRIx64=''
1024 sPRIXU64=''
1025 sPRId64=''
1026 sPRIi64=''
1027 sPRIo64=''
1028 sPRIu64=''
1029 sPRIx64=''
1030 d_quad=''
1031 quadkind=''
1032 quadtype=''
1033 uquadtype=''
1034 drand01=''
1035 randbits=''
1036 randfunc=''
1037 randseedtype=''
1038 seedfunc=''
1039 installscript=''
1040 scriptdir=''
1041 scriptdirexp=''
1042 selectminbits=''
1043 selecttype=''
1044 sh=''
1045 sig_count=''
1046 sig_name=''
1047 sig_name_init=''
1048 sig_num=''
1049 sig_num_init=''
1050 sig_size=''
1051 installsitearch=''
1052 sitearch=''
1053 sitearchexp=''
1054 installsitebin=''
1055 sitebin=''
1056 sitebinexp=''
1057 installsitehtml1=''
1058 sitehtml1=''
1059 sitehtml1exp=''
1060 installsitehtml3=''
1061 sitehtml3=''
1062 sitehtml3exp=''
1063 installsitelib=''
1064 sitelib=''
1065 sitelib_stem=''
1066 sitelibexp=''
1067 installsiteman1=''
1068 siteman1=''
1069 siteman1exp=''
1070 installsiteman3=''
1071 siteman3=''
1072 siteman3exp=''
1073 siteprefix=''
1074 siteprefixexp=''
1075 installsitescript=''
1076 sitescript=''
1077 sitescriptexp=''
1078 sizesize=''
1079 sizetype=''
1080 so=''
1081 socksizetype=''
1082 sharpbang=''
1083 shsharp=''
1084 spitshell=''
1085 src=''
1086 ssizetype=''
1087 startperl=''
1088 startsh=''
1089 stdchar=''
1090 d_stdio_stream_array=''
1091 stdio_stream_array=''
1092 sysman=''
1093 trnl=''
1094 uidformat=''
1095 uidsign=''
1096 uidsize=''
1097 uidtype=''
1098 archname64=''
1099 use64bitall=''
1100 use64bitint=''
1101 ccflags_uselargefiles=''
1102 ldflags_uselargefiles=''
1103 libswanted_uselargefiles=''
1104 uselargefiles=''
1105 uselongdouble=''
1106 usemorebits=''
1107 usemultiplicity=''
1108 nm_opt=''
1109 nm_so_opt=''
1110 runnm=''
1111 usenm=''
1112 useperlio=''
1113 usesocks=''
1114 d_oldpthreads=''
1115 use5005threads=''
1116 useithreads=''
1117 usereentrant=''
1118 usethreads=''
1119 incpath=''
1120 mips_type=''
1121 usrinc=''
1122 d_vendorarch=''
1123 installvendorarch=''
1124 vendorarch=''
1125 vendorarchexp=''
1126 d_vendorbin=''
1127 installvendorbin=''
1128 vendorbin=''
1129 vendorbinexp=''
1130 installvendorhtml1=''
1131 vendorhtml1=''
1132 vendorhtml1exp=''
1133 installvendorhtml3=''
1134 vendorhtml3=''
1135 vendorhtml3exp=''
1136 d_vendorlib=''
1137 installvendorlib=''
1138 vendorlib=''
1139 vendorlib_stem=''
1140 vendorlibexp=''
1141 installvendorman1=''
1142 vendorman1=''
1143 vendorman1exp=''
1144 installvendorman3=''
1145 vendorman3=''
1146 vendorman3exp=''
1147 usevendorprefix=''
1148 vendorprefix=''
1149 vendorprefixexp=''
1150 d_vendorscript=''
1151 installvendorscript=''
1152 vendorscript=''
1153 vendorscriptexp=''
1154 versiononly=''
1155 defvoidused=''
1156 voidflags=''
1157 pm_apiversion=''
1158 xs_apiversion=''
1159 yacc=''
1160 yaccflags=''
1161 CONFIG=''
1162
1163 define='define'
1164 undef='undef'
1165 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1166 rmlist=''
1167
1168 : We must find out about Eunice early
1169 eunicefix=':'
1170 if test -f /etc/unixtovms; then
1171         eunicefix=/etc/unixtovms
1172 fi
1173 if test -f /etc/unixtovms.exe; then
1174         eunicefix=/etc/unixtovms.exe
1175 fi
1176
1177 : Set executable suffix now -- needed before hints available
1178 if test -f "/libs/version.library"; then
1179 : Amiga OS
1180     _exe=""
1181 elif test -f "/system/gnu_library/bin/ar.pm"; then
1182 : Stratus VOS
1183     _exe=".pm"
1184 elif test -n "$DJGPP"; then
1185 : DOS DJGPP
1186     _exe=".exe"
1187 elif test -d c:/. ; then
1188 : OS/2 or cygwin
1189     _exe=".exe"
1190 fi
1191
1192 i_whoami=''
1193 ccname=''
1194 ccversion=''
1195 perllibs=''
1196 : set useposix=false in your hint file to disable the POSIX extension.
1197 useposix=true
1198 : set useopcode=false in your hint file to disable the Opcode extension.
1199 useopcode=true
1200 : Trailing extension.  Override this in a hint file, if needed.
1201 : Extra object files, if any, needed on this platform.
1202 archobjs=''
1203 archname=''
1204 : Possible local include directories to search.
1205 : Set locincpth to "" in a hint file to defeat local include searches.
1206 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1207 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1208 :
1209 : no include file wanted by default
1210 inclwanted=''
1211
1212 groupstype=''
1213 libnames=''
1214 : change the next line if compiling for Xenix/286 on Xenix/386
1215 xlibpth='/usr/lib/386 /lib/386'
1216 : Possible local library directories to search.
1217 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1218 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1219
1220 : general looking path for locating libraries
1221 glibpth="/lib /usr/lib $xlibpth"
1222 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1223 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1224 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1225
1226 : Private path used by Configure to find libraries.  Its value
1227 : is prepended to libpth. This variable takes care of special
1228 : machines, like the mips.  Usually, it should be empty.
1229 plibpth=''
1230
1231 : default library list
1232 libswanted=''
1233 : some systems want to use only the non-versioned libso:s
1234 ignore_versioned_solibs=''
1235 siteman1=''
1236 siteman3=''
1237 sitescript=''
1238 archname64=''
1239 ccflags_uselargefiles=''
1240 ldflags_uselargefiles=''
1241 libswanted_uselargefiles=''
1242 : set usemultiplicity on the Configure command line to enable multiplicity.
1243 : set usesocks on the Configure command line to enable socks.
1244 : set usethreads on the Configure command line to enable threads.
1245 usereentrant='undef'
1246 : full support for void wanted by default
1247 defvoidused=15
1248
1249 : List of libraries we want.
1250 : If anyone needs -lnet, put it in a hint file.
1251 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1252 libswanted="$libswanted dld ld sun m c cposix posix"
1253 libswanted="$libswanted ndir dir crypt sec"
1254 libswanted="$libswanted ucb bsd BSD PW x util rt posix4"
1255 : We probably want to search /usr/shlib before most other libraries.
1256 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1257 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1258 glibpth="/usr/shlib $glibpth"
1259 : Do not use vfork unless overridden by a hint file.
1260 usevfork=false
1261
1262 : Find the basic shell for Bourne shell scripts
1263 case "$sh" in
1264 '')
1265         case "$SYSTYPE" in
1266         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1267         *) xxx='/bin/sh';;
1268         esac
1269         if test -f "$xxx"; then
1270                 sh="$xxx"
1271         else
1272                 : Build up a list and do a single loop so we can 'break' out.
1273                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1274                 for xxx in sh bash ksh pdksh ash; do
1275                         for p in $pth; do
1276                                 try="$try ${p}/${xxx}"
1277                         done
1278                 done
1279                 for xxx in $try; do
1280                         if test -f "$xxx"; then
1281                                 sh="$xxx";
1282                                 break
1283                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1284                                 sh="$xxx";
1285                                 break
1286                         elif test -f "$xxx.exe"; then
1287                                 sh="$xxx";
1288                                 break
1289                         fi
1290                 done
1291         fi
1292         ;;
1293 esac
1294
1295 case "$sh" in
1296 '')     cat >&2 <<EOM
1297 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1298
1299 Usually it's in /bin/sh.  How did you even get this far?
1300 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1301 we'll try to straighten this all out.
1302 EOM
1303         exit 1
1304         ;;
1305 esac
1306
1307 : see if sh knows # comments
1308 if `$sh -c '#' >/dev/null 2>&1`; then
1309         shsharp=true
1310         spitshell=cat
1311         xcat=/bin/cat
1312         test -f $xcat$_exe || xcat=/usr/bin/cat
1313         if test ! -f $xcat$_exe; then
1314                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1315                         if test -f $p/cat$_exe; then
1316                                 xcat=$p/cat
1317                                 break
1318                         fi
1319                 done
1320                 if test ! -f $xcat$_exe; then
1321                         echo "Can't find cat anywhere!"
1322                         exit 1
1323                 fi
1324         fi
1325         echo "#!$xcat" >sharp
1326         $eunicefix sharp
1327         chmod +x sharp
1328         ./sharp > today
1329         if test -s today; then
1330                 sharpbang='#!'
1331         else
1332                 echo "#! $xcat" > sharp
1333                 $eunicefix sharp
1334                 chmod +x sharp
1335                 ./sharp > today
1336                 if test -s today; then
1337                         sharpbang='#! '
1338                 else
1339                         sharpbang=': use '
1340                 fi
1341         fi
1342 else
1343         echo " "
1344         echo "Your $sh doesn't grok # comments--I will strip them later on."
1345         shsharp=false
1346         cd ..
1347         echo "exec grep -v '^[  ]*#'" >spitshell
1348         chmod +x spitshell
1349         $eunicefix spitshell
1350         spitshell=`pwd`/spitshell
1351         cd UU
1352         echo "I presume that if # doesn't work, #! won't work either!"
1353         sharpbang=': use '
1354 fi
1355 rm -f sharp today
1356
1357 : figure out how to guarantee sh startup
1358 case "$startsh" in
1359 '') startsh=${sharpbang}${sh} ;;
1360 *)
1361 esac
1362 cat >sharp <<EOSS
1363 $startsh
1364 set abc
1365 test "$?abc" != 1
1366 EOSS
1367
1368 chmod +x sharp
1369 $eunicefix sharp
1370 if ./sharp; then
1371         : echo "Yup, it does."
1372 else
1373         echo "Hmm... '$startsh' does not guarantee sh startup..."
1374         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1375 fi
1376 rm -f sharp
1377
1378
1379 : Save command line options in file UU/cmdline.opt for later use in
1380 : generating config.sh.
1381 cat > cmdline.opt <<EOSH
1382 # Configure command line arguments.
1383 config_arg0='$0'
1384 config_args='$*'
1385 config_argc=$#
1386 EOSH
1387 argn=1
1388 args_exp=''
1389 args_sep=''
1390 for arg in "$@"; do
1391         cat >>cmdline.opt <<EOSH
1392 config_arg$argn='$arg'
1393 EOSH
1394         # Extreme backslashitis: replace each ' by '"'"'
1395         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1396 $arg
1397 EOC
1398         arg_exp=`cat cmdl.opt`
1399         args_exp="$args_exp$args_sep'$arg_exp'"
1400         argn=`expr $argn + 1`
1401         args_sep=' '
1402 done
1403 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1404 # used by ./hints/os2.sh
1405 rm -f cmdl.opt
1406
1407 : produce awk script to parse command line options
1408 cat >options.awk <<'EOF'
1409 BEGIN {
1410         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1411
1412         len = length(optstr);
1413         for (i = 1; i <= len; i++) {
1414                 c = substr(optstr, i, 1);
1415                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1416                 if (a == ":") {
1417                         arg[c] = 1;
1418                         i++;
1419                 }
1420                 opt[c] = 1;
1421         }
1422 }
1423 {
1424         expect = 0;
1425         str = $0;
1426         if (substr(str, 1, 1) != "-") {
1427                 printf("'%s'\n", str);
1428                 next;
1429         }
1430         len = length($0);
1431         for (i = 2; i <= len; i++) {
1432                 c = substr(str, i, 1);
1433                 if (!opt[c]) {
1434                         printf("-%s\n", substr(str, i));
1435                         next;
1436                 }
1437                 printf("-%s\n", c);
1438                 if (arg[c]) {
1439                         if (i < len)
1440                                 printf("'%s'\n", substr(str, i + 1));
1441                         else
1442                                 expect = 1;
1443                         next;
1444                 }
1445         }
1446 }
1447 END {
1448         if (expect)
1449                 print "?";
1450 }
1451 EOF
1452
1453 : process the command line options
1454 set X `for arg in "$@"; do echo "X$arg"; done |
1455         sed -e s/X// | awk -f options.awk`
1456 eval "set $*"
1457 shift
1458 rm -f options.awk
1459
1460 : set up default values
1461 fastread=''
1462 reuseval=false
1463 config_sh=''
1464 alldone=''
1465 error=''
1466 silent=''
1467 extractsh=''
1468 override=''
1469 knowitall=''
1470 rm -f optdef.sh posthint.sh
1471 cat >optdef.sh <<EOS
1472 $startsh
1473 EOS
1474
1475
1476 : option parsing
1477 while test $# -gt 0; do
1478         case "$1" in
1479         -d) shift; fastread=yes;;
1480         -e) shift; alldone=cont;;
1481         -f)
1482                 shift
1483                 cd ..
1484                 if test -r "$1"; then
1485                         config_sh="$1"
1486                 else
1487                         echo "$me: cannot read config file $1." >&2
1488                         error=true
1489                 fi
1490                 cd UU
1491                 shift;;
1492         -h) shift; error=true;;
1493         -r) shift; reuseval=true;;
1494         -s) shift; silent=true; realsilent=true;;
1495         -E) shift; alldone=exit;;
1496         -K) shift; knowitall=true;;
1497         -O) shift; override=true;;
1498         -S) shift; silent=true; extractsh=true;;
1499         -D)
1500                 shift
1501                 case "$1" in
1502                 *=)
1503                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1504                         echo "$me: ignoring -D $1" >&2
1505                         ;;
1506                 *=*) echo "$1" | \
1507                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1508                 *) echo "$1='define'" >> optdef.sh;;
1509                 esac
1510                 shift
1511                 ;;
1512         -U)
1513                 shift
1514                 case "$1" in
1515                 *=) echo "$1" >> optdef.sh;;
1516                 *=*)
1517                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1518                         echo "$me: ignoring -U $1" >&2
1519                         ;;
1520                 *) echo "$1='undef'" >> optdef.sh;;
1521                 esac
1522                 shift
1523                 ;;
1524         -A)
1525             shift
1526             xxx=''
1527             yyy="$1"
1528             zzz=''
1529             uuu=undef
1530             case "$yyy" in
1531             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1532                  case "$zzz" in
1533                  *:*) zzz='' ;;
1534                  *)   xxx=append
1535                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1536                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1537                  esac
1538                  ;;
1539             esac
1540             case "$xxx" in
1541             '')  case "$yyy" in
1542                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1543                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1544                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1545                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1546                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1547                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1548                  esac
1549                  ;;       
1550             esac
1551             case "$xxx" in
1552             append)
1553                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1554             clear)
1555                 echo "$yyy=''"                  >> posthint.sh ;;
1556             define)
1557                 case "$zzz" in
1558                 '') zzz=define ;;
1559                 esac
1560                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1561             eval)
1562                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1563             prepend)
1564                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1565             undef)
1566                 case "$zzz" in
1567                 '') zzz="$uuu" ;;
1568                 esac
1569                 echo "$yyy=$zzz"                >> posthint.sh ;;
1570             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1571             esac
1572             shift
1573             ;;
1574         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1575             exit 0;;
1576         --) break;;
1577         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1578         *) break;;
1579         esac
1580 done
1581
1582 case "$error" in
1583 true)
1584         cat >&2 <<EOM
1585 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1586                  [-U symbol] [-U symbol=] [-A command:symbol...]
1587   -d : use defaults for all answers.
1588   -e : go on without questioning past the production of config.sh.
1589   -f : specify an alternate default configuration file.
1590   -h : print this help message and exit (with an error status).
1591   -r : reuse C symbols value if possible (skips costly nm extraction).
1592   -s : silent mode, only echoes questions and essential information.
1593   -D : define symbol to have some value:
1594          -D symbol         symbol gets the value 'define'
1595          -D symbol=value   symbol gets the value 'value'
1596   -E : stop at the end of questions, after having produced config.sh.
1597   -K : do not use unless you know what you are doing.
1598   -O : let -D and -U override definitions from loaded configuration file.
1599   -S : perform variable substitutions on all .SH files (can mix with -f)
1600   -U : undefine symbol:
1601          -U symbol    symbol gets the value 'undef'
1602          -U symbol=   symbol gets completely empty
1603   -A : manipulate symbol after the platform specific hints have been applied:
1604          -A symbol=value                append " "value to symbol
1605          -A append:symbol=value         append value to symbol
1606          -A define:symbol=value         define symbol to have value
1607          -A clear:symbol                define symbol to be ''
1608          -A define:symbol               define symbol to be 'define'
1609          -A eval:symbol=value           define symbol to be eval of value
1610          -A prepend:symbol=value        prepend value to symbol
1611          -A undef:symbol                define symbol to be 'undef'
1612          -A undef:symbol=               define symbol to be ''
1613   -V : print version number and exit (with a zero status).
1614 EOM
1615         exit 1
1616         ;;
1617 esac
1618
1619 : Sanity checks
1620 case "$fastread$alldone" in
1621 yescont|yesexit) ;;
1622 *)
1623         case "$extractsh" in
1624         true) ;;
1625         *)
1626                 if test ! -t 0; then
1627                         echo "Say 'sh Configure', not 'sh <Configure'"
1628                         exit 1
1629                 fi
1630                 ;;
1631         esac
1632         ;;
1633 esac
1634
1635 exec 4>&1
1636 case "$silent" in
1637 true) exec 1>/dev/null;;
1638 esac
1639
1640 : run the defines and the undefines, if any, but leave the file out there...
1641 touch optdef.sh
1642 . ./optdef.sh
1643 : create the posthint manipulation script and leave the file out there...
1644 touch posthint.sh
1645
1646 : set package name
1647 package=perl5
1648 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1649 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1650 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1651 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1652 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1653 esac
1654
1655 : Some greps do not return status, grrr.
1656 echo "grimblepritz" >grimble
1657 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1658         contains=contains
1659 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1660         contains=grep
1661 else
1662         contains=contains
1663 fi
1664 rm -f grimble
1665 : the following should work in any shell
1666 case "$contains" in
1667 contains*)
1668         echo " "
1669         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1670         cat >contains <<'EOSS'
1671 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1672 EOSS
1673 chmod +x contains
1674 esac
1675
1676 : Find the path to the source tree
1677 case "$src" in
1678 '') case "$0" in
1679     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1680          case "$src" in
1681          /*)    ;;
1682          .)     ;;
1683          *)     src=`cd ../$src && pwd` ;;
1684          esac
1685          ;;
1686     *)   src='.';;
1687     esac;;
1688 esac
1689 case "$src" in
1690 '')     src=/
1691         rsrc=/
1692         ;;
1693 /*) rsrc="$src";;
1694 *) rsrc="../$src";;
1695 esac
1696 if test -f $rsrc/Configure && \
1697         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1698 then
1699    : found it, so we are ok.
1700 else
1701         rsrc=''
1702         for src in . .. ../.. ../../.. ../../../..; do
1703                 if test -f ../$src/Configure && \
1704                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1705                 then
1706                         rsrc=../$src
1707                         break
1708                 fi
1709         done
1710 fi
1711 case "$rsrc" in
1712 '')
1713         cat <<EOM >&4
1714
1715 Sorry, I can't seem to locate the source dir for $package.  Please start
1716 Configure with an explicit path -- i.e. /some/path/Configure.
1717
1718 EOM
1719         exit 1
1720         ;;
1721 ../.)   rsrc='..';;
1722 *)
1723         echo " "
1724         echo "Sources for $package found in \"$src\"." >&4
1725         ;;
1726 esac
1727
1728 : script used to extract .SH files with variable substitutions
1729 cat >extract <<'EOS'
1730 PERL_CONFIG_SH=true
1731 echo "Doing variable substitutions on .SH files..."
1732 if test -f MANIFEST; then
1733         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1734 else
1735         echo "(Looking for .SH files under the source directory.)"
1736         set x `(cd "$src"; find . -name "*.SH" -print)`
1737 fi
1738 shift
1739 case $# in
1740 0) set x `(cd "$src"; echo *.SH)`; shift;;
1741 esac
1742 if test ! -f "$src/$1"; then
1743         shift
1744 fi
1745 mkdir_p='
1746 name=$1;
1747 create="";
1748 while test $name; do
1749         if test ! -d "$name"; then
1750                 create="$name $create";
1751                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1752                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1753         else
1754                 name="";
1755         fi;
1756 done;
1757 for file in $create; do
1758         mkdir $file;
1759 done
1760 '
1761 for file in $*; do
1762         case "$src" in
1763         ".")
1764                 case "$file" in
1765                 */*)
1766                         dir=`expr X$file : 'X\(.*\)/'`
1767                         file=`expr X$file : 'X.*/\(.*\)'`
1768                         (cd "$dir" && . ./$file)
1769                         ;;
1770                 *)
1771                         . ./$file
1772                         ;;
1773                 esac
1774                 ;;
1775         *)
1776                 case "$file" in
1777                 */*)
1778                         dir=`expr X$file : 'X\(.*\)/'`
1779                         file=`expr X$file : 'X.*/\(.*\)'`
1780                         (set x $dir; shift; eval $mkdir_p)
1781                         sh <"$src/$dir/$file"
1782                         ;;
1783                 *)
1784                         sh <"$src/$file"
1785                         ;;
1786                 esac
1787                 ;;
1788         esac
1789 done
1790 if test -f "$src/config_h.SH"; then
1791         if test ! -f config.h; then
1792         : oops, they left it out of MANIFEST, probably, so do it anyway.
1793         . "$src/config_h.SH"
1794         fi
1795 fi
1796 EOS
1797
1798 : extract files and exit if asked to do so
1799 case "$extractsh" in
1800 true)
1801         case "$realsilent" in
1802         true) ;;
1803         *) exec 1>&4;;
1804         esac
1805         case "$config_sh" in
1806         '') config_sh='config.sh';;
1807         esac
1808         echo " "
1809         echo "Fetching answers from $config_sh..."
1810         cd ..
1811         . $config_sh
1812         test "$override" && . ./optdef.sh
1813         echo " "
1814         . UU/extract
1815         rm -rf UU
1816         echo "Extraction done."
1817         exit 0
1818         ;;
1819 esac
1820
1821 : Eunice requires " " instead of "", can you believe it
1822 echo " "
1823 : Here we go...
1824 echo "Beginning of configuration questions for $package."
1825
1826 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1827
1828 : first determine how to suppress newline on echo command
1829 echo " "
1830 echo "Checking echo to see how to suppress newlines..."
1831 (echo "hi there\c" ; echo " ") >.echotmp
1832 if $contains c .echotmp >/dev/null 2>&1 ; then
1833         echo "...using -n."
1834         n='-n'
1835         c=''
1836 else
1837         cat <<'EOM'
1838 ...using \c
1839 EOM
1840         n=''
1841         c='\c'
1842 fi
1843 echo $n "The star should be here-->$c"
1844 echo '*'
1845 rm -f .echotmp
1846
1847 : Now test for existence of everything in MANIFEST
1848 echo " "
1849 if test -f "$rsrc/MANIFEST"; then
1850         echo "First let's make sure your kit is complete.  Checking..." >&4
1851         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1852         rm -f missing
1853         tmppwd=`pwd`
1854         for filelist in x??; do
1855                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1856         done
1857         if test -s missing; then
1858                 cat missing >&4
1859                 cat >&4 <<'EOM'
1860
1861 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1862
1863 You have the option of continuing the configuration process, despite the
1864 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1865 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1866 and contact the author (perlbug@perl.org).
1867
1868 EOM
1869                 echo $n "Continue? [n] $c" >&4
1870                 read ans
1871                 case "$ans" in
1872                 y*)
1873                         echo "Continuing..." >&4
1874                         rm -f missing
1875                         ;;
1876                 *)
1877                         echo "ABORTING..." >&4
1878                         kill $$
1879                         ;;
1880                 esac
1881         else
1882                 echo "Looks good..."
1883         fi
1884 else
1885         echo "There is no MANIFEST file.  I hope your kit is complete !"
1886 fi
1887 rm -f missing x??
1888
1889 echo " "
1890 : Find the appropriate value for a newline for tr
1891 if test -n "$DJGPP"; then
1892        trnl='\012'
1893 fi
1894 if test X"$trnl" = X; then
1895         case "`echo foo|tr '\n' x 2>/dev/null`" in
1896         foox) trnl='\n' ;;
1897         esac
1898 fi
1899 if test X"$trnl" = X; then
1900         case "`echo foo|tr '\012' x 2>/dev/null`" in
1901         foox) trnl='\012' ;;
1902         esac
1903 fi
1904 if test X"$trnl" = X; then
1905        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1906        fooxy) trnl='\n\r' ;;
1907        esac
1908 fi
1909 if test X"$trnl" = X; then
1910         cat <<EOM >&2
1911
1912 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1913
1914 EOM
1915         exit 1
1916 fi
1917
1918 : compute the number of columns on the terminal for proper question formatting
1919 case "$COLUMNS" in
1920 '') COLUMNS='80';;
1921 esac
1922
1923 : set up the echo used in my read
1924 myecho="case \"\$xxxm\" in
1925 '') echo $n \"\$rp $c\" >&4;;
1926 *) case \"\$rp\" in
1927         '') echo $n \"[\$xxxm] $c\";;
1928         *)
1929                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1930                         echo \"\$rp\" >&4
1931                         echo $n \"[\$xxxm] $c\" >&4
1932                 else
1933                         echo $n \"\$rp [\$xxxm] $c\" >&4
1934                 fi
1935                 ;;
1936         esac;;
1937 esac"
1938
1939 : now set up to do reads with possible shell escape and default assignment
1940 cat <<EOSC >myread
1941 $startsh
1942 xxxm=\$dflt
1943 $myecho
1944 ans='!'
1945 case "\$fastread" in
1946 yes) case "\$dflt" in
1947         '') ;;
1948         *) ans='';
1949                 case "\$silent-\$rp" in
1950                 true-) ;;
1951                 *) echo " " >&4;;
1952                 esac;;
1953         esac;;
1954 *) case "\$silent" in
1955         true) case "\$rp" in
1956                 '') ans='';;
1957                 esac;;
1958         esac;;
1959 esac
1960 while expr "X\$ans" : "X!" >/dev/null; do
1961         read answ
1962         set x \$xxxm
1963         shift
1964         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1965         case  "\$answ" in
1966         "!")
1967                 sh 1>&4
1968                 echo " "
1969                 $myecho
1970                 ;;
1971         !*)
1972                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1973                 shift
1974                 sh 1>&4 -c "\$*"
1975                 echo " "
1976                 $myecho
1977                 ;;
1978         "\$ans")
1979                 case "\$ans" in
1980                 \\&*)
1981                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1982                         shift
1983                         case "\$1" in
1984                         -d)
1985                                 fastread=yes
1986                                 echo "(OK, I'll run with -d after this question.)" >&4
1987                                 ;;
1988                         -*)
1989                                 echo "*** Sorry, \$1 not supported yet." >&4
1990                                 ;;
1991                         esac
1992                         $myecho
1993                         ans=!
1994                         ;;
1995                 esac;;
1996         *)
1997                 case "\$aok" in
1998                 y)
1999                         echo "*** Substitution done -- please confirm."
2000                         xxxm="\$ans"
2001                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2002                         xxxm="\$ans"
2003                         ans=!
2004                         ;;
2005                 *)
2006                         echo "*** Error -- try again."
2007                         ans=!
2008                         ;;
2009                 esac
2010                 $myecho
2011                 ;;
2012         esac
2013         case "\$ans\$xxxm\$nostick" in
2014         '')
2015                 ans=!
2016                 $myecho
2017                 ;;
2018         esac
2019 done
2020 case "\$ans" in
2021 '') ans="\$xxxm";;
2022 esac
2023 EOSC
2024
2025 : create .config dir to save info across Configure sessions
2026 test -d ../.config || mkdir ../.config
2027 cat >../.config/README <<EOF
2028 This directory created by Configure to save information that should
2029 persist across sessions for $package.
2030
2031 You may safely delete it if you wish.
2032 EOF
2033
2034 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2035 case "$usedevel" in
2036 $define|true|[yY]*) ;;
2037 *) case "$xversion" in
2038    *[13579])
2039         cat >&4 <<EOH
2040 *** WHOA THERE!!! ***
2041
2042     This is an UNSTABLE DEVELOPMENT release.
2043     The version of this $package distribution is $xversion, that is, odd,
2044     (as opposed to even) and that signifies a development release.
2045     If you want a maintenance release, you want an even-numbered version.
2046
2047     Do ***NOT*** install this into production use.
2048     Data corruption and crashes are possible.
2049
2050     It is most seriously suggested that you do not continue any further
2051     unless you want to help in developing and debugging Perl.
2052
2053     If you *still* want to build perl, you can answer 'y' now,
2054     or pass -Dusedevel to Configure.
2055
2056 EOH
2057         rp='Do you really want to continue?'
2058         dflt='n'
2059         . ./myread
2060         case "$ans" in
2061         [yY]) echo >&4 "Okay, continuing."
2062               usedevel="$define" ;;
2063         *) echo >&4 "Okay, bye."
2064            exit 1
2065            ;;
2066         esac
2067         ;;
2068     esac
2069     ;;
2070 esac
2071 case "$usedevel" in
2072 $define|true|[yY]*)
2073         case "$versiononly" in
2074         '') versiononly="$define" ;;
2075         esac
2076         case "$installusrbinperl" in
2077         '') installusrbinperl="$undef" ;;
2078         esac
2079         ;;
2080 esac
2081
2082 : general instructions
2083 needman=true
2084 firsttime=true
2085 user=`(logname) 2>/dev/null`
2086 case "$user" in
2087 '') user=`whoami 2>&1`;;
2088 esac
2089 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2090         firsttime=false
2091         echo " "
2092         rp='Would you like to see the instructions?'
2093         dflt=n
2094         . ./myread
2095         case "$ans" in
2096         [yY]*) ;;
2097         *) needman=false;;
2098         esac
2099 fi
2100 if $needman; then
2101         cat <<EOH
2102
2103 This installation shell script will examine your system and ask you questions
2104 to determine how the perl5 package should be installed. If you get
2105 stuck on a question, you may use a ! shell escape to start a subshell or
2106 execute a command.  Many of the questions will have default answers in square
2107 brackets; typing carriage return will give you the default.
2108
2109 On some of the questions which ask for file or directory names you are allowed
2110 to use the ~name construct to specify the login directory belonging to "name",
2111 even if you don't have a shell which knows about that.  Questions where this is
2112 allowed will be marked "(~name ok)".
2113
2114 EOH
2115         rp=''
2116         dflt='Type carriage return to continue'
2117         . ./myread
2118         cat <<'EOH'
2119
2120 The prompter used in this script allows you to use shell variables and
2121 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2122 in the default answer, as if the default line was a set of arguments given to a
2123 script shell.  This means you may also use $* to repeat the whole default line,
2124 so you do not have to re-type everything to add something to the default.
2125
2126 Everytime there is a substitution, you will have to confirm.  If there is an
2127 error (e.g. an unmatched backtick), the default answer will remain unchanged
2128 and you will be prompted again.
2129
2130 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2131 the questions and use the computed defaults (or the previous answers if there
2132 was already a config.sh file). Type 'Configure -h' for a list of options.
2133 You may also start interactively and then answer '& -d' at any prompt to turn
2134 on the non-interactive behaviour for the remainder of the execution.
2135
2136 EOH
2137         . ./myread
2138         cat <<EOH
2139
2140 Much effort has been expended to ensure that this shell script will run on any
2141 Unix system.  If despite that it blows up on yours, your best bet is to edit
2142 Configure and run it again.  If you can't run Configure for some reason,
2143 you'll have to generate a config.sh file by hand.  Whatever problems you
2144 have, let me (perlbug@perl.org) know how I blew it.
2145
2146 This installation script affects things in two ways:
2147
2148 1) it may do direct variable substitutions on some of the files included
2149    in this kit.
2150 2) it builds a config.h file for inclusion in C programs.  You may edit
2151    any of these files as the need arises after running this script.
2152
2153 If you make a mistake on a question, there is no easy way to back up to it
2154 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2155 files.  Configure will offer to let you do this before it runs the SH files.
2156
2157 EOH
2158         dflt='Type carriage return to continue'
2159         . ./myread
2160         case "$firsttime" in
2161         true) echo $user >>../.config/instruct;;
2162         esac
2163 fi
2164
2165 : find out where common programs are
2166 echo " "
2167 echo "Locating common programs..." >&4
2168 cat <<EOSC >loc
2169 $startsh
2170 case \$# in
2171 0) exit 1;;
2172 esac
2173 thing=\$1
2174 shift
2175 dflt=\$1
2176 shift
2177 for dir in \$*; do
2178         case "\$thing" in
2179         .)
2180         if test -d \$dir/\$thing; then
2181                 echo \$dir
2182                 exit 0
2183         fi
2184         ;;
2185         *)
2186         for thisthing in \$dir/\$thing; do
2187                 : just loop through to pick last item
2188         done
2189         if test -f \$thisthing; then
2190                 echo \$thisthing
2191                 exit 0
2192         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2193                 echo \$thisthing
2194                 exit 0
2195         elif test -f \$dir/\$thing.exe; then
2196                 if test -n "$DJGPP"; then
2197                         echo \$dir/\$thing.exe
2198                 elif test "$eunicefix" != ":"; then
2199                         : on Eunice apparently
2200                         echo \$dir/\$thing
2201                         exit 0
2202                 fi
2203                 exit 0
2204         fi
2205         ;;
2206         esac
2207 done
2208 echo \$dflt
2209 exit 1
2210 EOSC
2211 chmod +x loc
2212 $eunicefix loc
2213 loclist="
2214 awk
2215 cat
2216 chmod
2217 comm
2218 cp
2219 echo
2220 expr
2221 grep
2222 ls
2223 mkdir
2224 rm
2225 sed
2226 sort
2227 touch
2228 tr
2229 uniq
2230 "
2231 trylist="
2232 Mcc
2233 ar
2234 bison
2235 byacc
2236 cpp
2237 csh
2238 date
2239 egrep
2240 gmake
2241 gzip
2242 less
2243 ln
2244 make
2245 more
2246 nm
2247 nroff
2248 pg
2249 test
2250 uname
2251 zip
2252 "
2253 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2254 pth="$pth /lib /usr/lib"
2255 for file in $loclist; do
2256         eval xxx=\$$file
2257         case "$xxx" in
2258         /*|?:[\\/]*)
2259                 if test -f "$xxx"; then
2260                         : ok
2261                 else
2262                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2263                         xxx=`./loc $file $file $pth`
2264                 fi
2265                 ;;
2266         '') xxx=`./loc $file $file $pth`;;
2267         *) xxx=`./loc $xxx $xxx $pth`;;
2268         esac
2269         eval $file=$xxx$_exe
2270         eval _$file=$xxx
2271         case "$xxx" in
2272         /*)
2273                 echo $file is in $xxx.
2274                 ;;
2275         ?:[\\/]*)
2276                 echo $file is in $xxx.
2277                 ;;
2278         *)
2279                 echo "I don't know where '$file' is, and my life depends on it." >&4
2280                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2281                 exit 1
2282                 ;;
2283         esac
2284 done
2285 echo " "
2286 echo "Don't worry if any of the following aren't found..."
2287 say=offhand
2288 for file in $trylist; do
2289         eval xxx=\$$file
2290         case "$xxx" in
2291         /*|?:[\\/]*)
2292                 if test -f "$xxx"; then
2293                         : ok
2294                 else
2295                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2296                         xxx=`./loc $file $file $pth`
2297                 fi
2298                 ;;
2299         '') xxx=`./loc $file $file $pth`;;
2300         *) xxx=`./loc $xxx $xxx $pth`;;
2301         esac
2302         eval $file=$xxx$_exe
2303         eval _$file=$xxx
2304         case "$xxx" in
2305         /*)
2306                 echo $file is in $xxx.
2307                 ;;
2308         ?:[\\/]*)
2309                 echo $file is in $xxx.
2310                 ;;
2311         *)
2312                 echo "I don't see $file out there, $say."
2313                 say=either
2314                 ;;
2315         esac
2316 done
2317 case "$egrep" in
2318 egrep)
2319         echo "Substituting grep for egrep."
2320         egrep=$grep
2321         _egrep=$grep
2322         ;;
2323 esac
2324 case "$ln" in
2325 ln)
2326         echo "Substituting cp for ln."
2327         ln=$cp
2328         _ln=$cp
2329         ;;
2330 esac
2331 case "$make" in
2332 make)   
2333         case "$gmake" in
2334         gmake)
2335         echo "I can't find make or gmake, and my life depends on it." >&4
2336         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2337         exit 1
2338         ;;
2339         esac
2340         ;;
2341 esac    
2342 case "$gmake" in
2343 gmake)  ;;
2344 *)      # We can't have osname yet.
2345         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2346                 # Assume that gmake, if found, is definitely GNU make
2347                 # and prefer it over the system make.
2348                 echo "Substituting gmake for make."
2349                 make=$gmake
2350                 _make=$gmake
2351         fi
2352         ;;
2353 esac
2354 case "$test" in
2355 test)
2356         echo "Hopefully test is built into your sh."
2357         ;;
2358 *)
2359         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2360                 echo "Using the test built into your sh."
2361                 test=test
2362                 _test=test
2363         fi
2364         ;;
2365 esac
2366 case "$echo" in
2367 echo)
2368         echo "Hopefully echo is built into your sh."
2369         ;;
2370 '') ;;
2371 *)
2372         echo " "
2373 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2374         $echo $n "hi there$c" >foo1
2375         echo $n "hi there$c" >foo2
2376         if cmp foo1 foo2 >/dev/null 2>&1; then
2377                 echo "They are compatible.  In fact, they may be identical."
2378         else
2379                 case "$n" in
2380                 '-n') n='' c='\c';;
2381                 *) n='-n' c='';;
2382                 esac
2383                 cat <<FOO
2384 They are not compatible!  You are probably running ksh on a non-USG system.
2385 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2386 have echo built in and we may have to run some Bourne shell scripts.  That
2387 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2388
2389 FOO
2390                 $echo $n "The star should be here-->$c"
2391                 $echo "*"
2392         fi
2393         $rm -f foo1 foo2
2394         ;;
2395 esac
2396
2397 cat <<EOS >trygcc
2398 $startsh
2399 EOS
2400 cat <<'EOSC' >>trygcc
2401 case "$cc" in
2402 '') ;;
2403 *)  $rm -f try try.*
2404     $cat >try.c <<EOM
2405 int main(int argc, char *argv[]) {
2406   return 0;
2407 }
2408 EOM
2409     if $cc -o try $ccflags $ldflags try.c; then
2410        :
2411     else
2412         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2413         despair=yes
2414         trygcc=yes
2415         case "$cc" in
2416         *gcc*) trygcc=no ;;
2417         esac
2418         case "`$cc -v -c try.c 2>&1`" in
2419         *gcc*) trygcc=no ;;
2420         esac
2421         if $test X"$trygcc" = Xyes; then
2422             if gcc -o try -c try.c; then
2423                 echo " "
2424                 echo "You seem to have a working gcc, though." >&4
2425                 rp="Would you like to use it?"
2426                 dflt=y
2427                 if $test -f myread; then
2428                     . ./myread
2429                 else
2430                     if $test -f UU/myread; then
2431                         . ./UU/myread
2432                     else
2433                         echo "Cannot find myread, sorry.  Aborting." >&2
2434                         exit 1
2435                     fi
2436                 fi  
2437                 case "$ans" in
2438                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2439                        if $test -f usethreads.cbu; then
2440                            $cat >&4 <<EOM 
2441
2442 *** However, any setting of the C compiler flags (e.g. for thread support)
2443 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2444 *** (together with e.g. -Dusethreads).
2445
2446 EOM
2447                        fi;;
2448                 esac
2449             fi
2450         fi
2451     fi
2452     $rm -f try try.*
2453     ;;
2454 esac
2455 EOSC
2456
2457 cat <<EOS >checkcc
2458 $startsh
2459 EOS
2460 cat <<'EOSC' >>checkcc
2461 case "$cc" in        
2462 '') ;;
2463 *)  $rm -f try try.*              
2464     $cat >try.c <<EOM
2465 int main(int argc, char *argv[]) {
2466   return 0;
2467 }
2468 EOM
2469     if $cc -o try $ccflags $ldflags try.c; then
2470        :
2471     else
2472         if $test X"$despair" = Xyes; then
2473            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2474         fi
2475         $cat >&4 <<EOM         
2476 You need to find a working C compiler.
2477 Either (purchase and) install the C compiler supplied by your OS vendor,
2478 or for a free C compiler try http://gcc.gnu.org/
2479 I cannot continue any further, aborting.
2480 EOM
2481         exit 1
2482     fi
2483     $rm -f try try.*
2484     ;;
2485 esac
2486 EOSC
2487
2488 : determine whether symbolic links are supported
2489 echo " "
2490 $touch blurfl
2491 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2492         echo "Symbolic links are supported." >&4
2493         lns="$ln -s"
2494 else
2495         echo "Symbolic links are NOT supported." >&4
2496         lns="$ln"
2497 fi
2498 $rm -f blurfl sym
2499
2500 : determine whether symbolic links are supported
2501 echo " "
2502 case "$lns" in
2503 *"ln"*" -s")
2504         echo "Checking how to test for symbolic links..." >&4
2505         $lns blurfl sym
2506         if $test "X$issymlink" = X; then
2507                 case "$newsh" in
2508                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2509                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2510                 esac
2511                 if test $? = 0; then
2512                         issymlink="test -h"
2513                 else
2514                         echo "Your builtin 'test -h' may be broken." >&4
2515                         case "$test" in
2516                         /*)     ;;
2517                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2518                                 for p in $pth
2519                                 do
2520                                         if test -f "$p/$test"; then
2521                                                 test="$p/$test"
2522                                                 break
2523                                         fi
2524                                 done
2525                                 ;;
2526                         esac
2527                         case "$test" in
2528                         /*)
2529                                 echo "Trying external '$test -h'." >&4
2530                                 issymlink="$test -h"
2531                                 if $test ! -h sym >/dev/null 2>&1; then
2532                                         echo "External '$test -h' is broken, too." >&4
2533                                         issymlink=''
2534                                 fi
2535                                 ;;
2536                         *)      issymlink='' ;;
2537                         esac
2538                 fi              
2539         fi
2540         if $test "X$issymlink" = X; then
2541                 if $test -L sym 2>/dev/null; then
2542                         issymlink="$test -L"
2543                         echo "The builtin '$test -L' worked." >&4
2544                 fi
2545         fi
2546         if $test "X$issymlink" != X; then
2547                 echo "You can test for symbolic links with '$issymlink'." >&4
2548         else
2549                 echo "I do not know how you can test for symbolic links." >&4
2550         fi
2551         $rm -f blurfl sym
2552         ;;
2553 *)      echo "No symbolic links, so not testing for their testing..." >&4
2554         ;;
2555 esac
2556 echo " "
2557
2558
2559 case "$mksymlinks" in
2560 $define|true|[yY]*)
2561         case "$src" in
2562         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2563                 exit 1
2564                 ;;
2565         *)      case "$lns:$issymlink" in
2566                 *"ln"*" -s:"*"test -"?)
2567                         echo "Creating the symbolic links..." >&4
2568                         echo "(First creating the subdirectories...)" >&4
2569                         cd ..
2570                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2571                                 read directory
2572                                 test -z "$directory" && break
2573                                 mkdir -p $directory
2574                         done
2575                         # Sanity check 1.
2576                         if test ! -d t/base; then
2577                                 echo "Failed to create the subdirectories.  Aborting." >&4
2578                                 exit 1
2579                         fi
2580                         echo "(Then creating the symlinks...)" >&4
2581                         awk '{print $1}' $src/MANIFEST | while true; do
2582                                 read filename
2583                                 test -z "$filename" && break
2584                                 if test -f $filename; then
2585                                         if $issymlink $filename; then
2586                                                 rm -f $filename
2587                                         fi
2588                                 fi
2589                                 if test -f $filename; then
2590                                         echo "$filename already exists, not symlinking."
2591                                 else
2592                                         ln -s $src/$filename $filename
2593                                 fi
2594                         done
2595                         # Sanity check 2.
2596                         if test ! -f t/base/lex.t; then
2597                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2598                                 exit 1
2599                         fi
2600                         cd UU
2601                         ;;
2602                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2603                         ;;
2604                 esac
2605                 ;;
2606         esac
2607         ;;
2608 esac
2609
2610
2611 case "$usecrosscompile" in
2612 $define|true|[yY]*)
2613         $echo "Cross-compiling..."
2614         croak=''
2615         case "$cc" in
2616         *-*-gcc) # A cross-compiling gcc, probably.
2617             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2618             ar=$targetarch-ar
2619             # leave out ld, choosing it is more complex
2620             nm=$targetarch-nm
2621             ranlib=$targetarch-ranlib
2622             $echo 'extern int foo;' > try.c
2623             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2624             shift
2625             if $test $# -gt 0; then
2626                 incpth="$incpth $*"
2627                 incpth="`$echo $incpth|$sed 's/^ //'`"
2628                 echo "Guessing incpth '$incpth'." >&4
2629                 for i in $*; do
2630                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2631                     if $test -d $j; then
2632                         libpth="$libpth $j"
2633                     fi
2634                 done   
2635                 libpth="`$echo $libpth|$sed 's/^ //'`"
2636                 echo "Guessing libpth '$libpth'." >&4
2637             fi
2638             $rm -f try.c
2639             ;;
2640         esac
2641         case "$targetarch" in
2642         '') echo "Targetarch not defined." >&4; croak=y ;;
2643         *)  echo "Using targetarch $targetarch." >&4 ;;
2644         esac
2645         case "$incpth" in
2646         '') echo "Incpth not defined." >&4; croak=y ;;
2647         *)  echo "Using incpth '$incpth'." >&4 ;;
2648         esac
2649         case "$libpth" in
2650         '') echo "Libpth not defined." >&4; croak=y ;;
2651         *)  echo "Using libpth '$libpth'." >&4 ;;
2652         esac
2653         case "$usrinc" in
2654         '') for i in $incpth; do
2655                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2656                     usrinc=$i
2657                     echo "Guessing usrinc $usrinc." >&4
2658                     break
2659                 fi
2660             done
2661             case "$usrinc" in
2662             '') echo "Usrinc not defined." >&4; croak=y ;;
2663             esac
2664             ;;
2665         *)  echo "Using usrinc $usrinc." >&4 ;;
2666         esac
2667         case "$targethost" in
2668         '') echo "Targethost not defined." >&4; croak=y ;;
2669         *)  echo "Using targethost $targethost." >&4
2670         esac
2671         locincpth=' '
2672         loclibpth=' '
2673         case "$croak" in
2674         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2675         esac
2676         case "$src" in
2677         /*) run=$src/Cross/run
2678             targetmkdir=$src/Cross/mkdir
2679             to=$src/Cross/to
2680             from=$src/Cross/from
2681             ;;
2682         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2683             run=$pwd/Cross/run
2684             targetmkdir=$pwd/Cross/mkdir
2685             to=$pwd/Cross/to
2686             from=$pwd/Cross/from
2687             ;;
2688         esac
2689         case "$targetrun" in
2690         '') targetrun=ssh ;;
2691         esac
2692         case "$targetto" in
2693         '') targetto=scp ;;
2694         esac
2695         case "$targetfrom" in
2696         '') targetfrom=scp ;;
2697         esac
2698         run=$run-$targetrun
2699         to=$to-$targetto
2700         from=$from-$targetfrom
2701         case "$targetdir" in
2702         '')  targetdir=/tmp
2703              echo "Guessing targetdir $targetdir." >&4
2704              ;;
2705         esac
2706         case "$targetuser" in
2707         '')  targetuser=root
2708              echo "Guessing targetuser $targetuser." >&4
2709              ;;
2710         esac
2711         case "$targetfrom" in
2712         scp)    q=-q ;;
2713         *)      q='' ;;
2714         esac
2715         case "$targetrun" in
2716         ssh|rsh)
2717             cat >$run <<EOF
2718 #!/bin/sh
2719 case "\$1" in
2720 -cwd)
2721   shift
2722   cwd=\$1
2723   shift
2724   ;;
2725 esac
2726 case "\$cwd" in
2727 '') cwd=$targetdir ;;
2728 esac
2729 exe=\$1
2730 shift
2731 if $test ! -f \$exe.xok; then
2732   $to \$exe
2733   $touch \$exe.xok
2734 fi
2735 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2736 EOF
2737             ;;
2738         *)  echo "Unknown targetrun '$targetrun'" >&4
2739             exit 1
2740             ;;
2741         esac
2742         case "$targetmkdir" in
2743         */Cross/mkdir)
2744             cat >$targetmkdir <<EOF
2745 #!/bin/sh
2746 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2747 EOF
2748             $chmod a+rx $targetmkdir
2749             ;;
2750         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2751             exit 1
2752             ;;
2753         esac
2754         case "$targetto" in
2755         scp|rcp)
2756             cat >$to <<EOF
2757 #!/bin/sh
2758 for f in \$@
2759 do
2760   case "\$f" in
2761   /*)
2762     $targetmkdir \`dirname \$f\`
2763     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2764     ;;
2765   *)
2766     $targetmkdir $targetdir/\`dirname \$f\`
2767     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2768     ;;
2769   esac
2770 done
2771 exit 0
2772 EOF
2773             ;;
2774         cp) cat >$to <<EOF
2775 #!/bin/sh
2776 for f in \$@
2777 do
2778   case "\$f" in
2779   /*)
2780     $mkdir -p $targetdir/\`dirname \$f\`
2781     $cp \$f $targetdir/\$f || exit 1
2782     ;;
2783   *)
2784     $targetmkdir $targetdir/\`dirname \$f\`
2785     $cp \$f $targetdir/\$f || exit 1
2786     ;;
2787   esac
2788 done
2789 exit 0
2790 EOF
2791             ;;
2792         *)  echo "Unknown targetto '$targetto'" >&4
2793             exit 1
2794             ;;
2795         esac
2796         case "$targetfrom" in
2797         scp|rcp)
2798           cat >$from <<EOF
2799 #!/bin/sh
2800 for f in \$@
2801 do
2802   $rm -f \$f
2803   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2804 done
2805 exit 0
2806 EOF
2807             ;;
2808         cp) cat >$from <<EOF
2809 #!/bin/sh
2810 for f in \$@
2811 do
2812   $rm -f \$f
2813   cp $targetdir/\$f . || exit 1
2814 done
2815 exit 0
2816 EOF
2817             ;;
2818         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2819             exit 1
2820             ;;
2821         esac
2822         if $test ! -f $run; then
2823             echo "Target 'run' script '$run' not found." >&4
2824         else
2825             $chmod a+rx $run
2826         fi
2827         if $test ! -f $to; then
2828             echo "Target 'to' script '$to' not found." >&4
2829         else
2830             $chmod a+rx $to
2831         fi
2832         if $test ! -f $from; then
2833             echo "Target 'from' script '$from' not found." >&4
2834         else
2835             $chmod a+rx $from
2836         fi
2837         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2838             exit 1
2839         fi
2840         cat >&4 <<EOF
2841 Using '$run' for remote execution,
2842 and '$from' and '$to'
2843 for remote file transfer.
2844 EOF
2845         ;;
2846 *)      run=''
2847         to=:
2848         from=:
2849         usecrosscompile='undef'
2850         targetarch=''
2851         ;;
2852 esac
2853
2854 : see whether [:lower:] and [:upper:] are supported character classes
2855 echo " "
2856 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2857 ABYZ)
2858         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2859         up='[:upper:]'
2860         low='[:lower:]'
2861         ;;
2862 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2863         # (0xc9 and 0xd1), therefore that is a nice testing point.
2864         if test "X$up" = X -o "X$low" = X; then
2865             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2866             ij) up='[A-Z]'
2867                 low='[a-z]'
2868                 ;;
2869             esac
2870         fi
2871         if test "X$up" = X -o "X$low" = X; then
2872             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2873             ij) up='A-Z'
2874                 low='a-z'
2875                 ;;
2876             esac
2877         fi
2878         if test "X$up" = X -o "X$low" = X; then
2879             case "`echo IJ | od -x 2>/dev/null`" in
2880             *C9D1*|*c9d1*)
2881                 echo "Hey, this might be EBCDIC." >&4
2882                 if test "X$up" = X -o "X$low" = X; then
2883                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2884                     ij) up='[A-IJ-RS-Z]'
2885                         low='[a-ij-rs-z]'
2886                         ;;
2887                     esac
2888                 fi
2889                 if test "X$up" = X -o "X$low" = X; then
2890                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2891                     ij) up='A-IJ-RS-Z'
2892                         low='a-ij-rs-z'
2893                         ;;
2894                     esac
2895                 fi
2896                 ;;
2897             esac
2898         fi
2899 esac
2900 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2901 ij)
2902     echo "Using $up and $low to convert case." >&4
2903     ;;
2904 *)
2905     echo "I don't know how to translate letters from upper to lower case." >&4
2906     echo "Your tr is not acting any way I know of." >&4
2907     exit 1
2908     ;;
2909 esac
2910 : set up the translation script tr, must be called with ./tr of course
2911 cat >tr <<EOSC
2912 $startsh
2913 case "\$1\$2" in
2914 '[A-Z][a-z]') exec $tr '$up' '$low';;
2915 '[a-z][A-Z]') exec $tr '$low' '$up';;
2916 esac
2917 exec $tr "\$@"
2918 EOSC
2919 chmod +x tr
2920 $eunicefix tr
2921
2922 : Try to determine whether config.sh was made on this system
2923 case "$config_sh" in
2924 '')
2925 myuname=`$uname -a 2>/dev/null`
2926 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2927 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2928 # because the A-Z/a-z are not consecutive.
2929 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2930         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2931 newmyuname="$myuname"
2932 dflt=n
2933 case "$knowitall" in
2934 '')
2935         if test -f ../config.sh; then
2936                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2937                         eval "`grep myuname= ../config.sh`"
2938                 fi
2939                 if test "X$myuname" = "X$newmyuname"; then
2940                         dflt=y
2941                 fi
2942         fi
2943         ;;
2944 *) dflt=y;;
2945 esac
2946
2947 : Get old answers from old config file if Configure was run on the
2948 : same system, otherwise use the hints.
2949 hint=default
2950 cd ..
2951 if test -f config.sh; then
2952         echo " "
2953         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2954         . UU/myread
2955         case "$ans" in
2956         n*|N*) echo "OK, I'll ignore it."
2957                 mv config.sh config.sh.old
2958                 myuname="$newmyuname"
2959                 ;;
2960         *)  echo "Fetching default answers from your old config.sh file..." >&4
2961                 tmp_n="$n"
2962                 tmp_c="$c"
2963                 tmp_sh="$sh"
2964                 . ./config.sh
2965                 cp config.sh UU
2966                 n="$tmp_n"
2967                 c="$tmp_c"
2968                 : Older versions did not always set $sh.  Catch re-use of such
2969                 : an old config.sh.
2970                 case "$sh" in
2971                 '') sh="$tmp_sh" ;;
2972                 esac
2973                 hint=previous
2974                 ;;
2975         esac
2976 fi
2977 . ./UU/checkcc
2978 if test ! -f config.sh; then
2979         $cat <<EOM
2980
2981 First time through, eh?  I have some defaults handy for some systems
2982 that need some extra help getting the Configure answers right:
2983
2984 EOM
2985         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2986         dflt=''
2987         : Half the following guesses are probably wrong... If you have better
2988         : tests or hints, please send them to perlbug@perl.org
2989         : The metaconfig authors would also appreciate a copy...
2990         $test -f /irix && osname=irix
2991         $test -f /xenix && osname=sco_xenix
2992         $test -f /dynix && osname=dynix
2993         $test -f /dnix && osname=dnix
2994         $test -f /lynx.os && osname=lynxos
2995         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2996         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2997         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2998         $test -f /bin/mips && /bin/mips && osname=mips
2999         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3000                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3001         $test -d /usr/apollo/bin && osname=apollo
3002         $test -f /etc/saf/_sactab && osname=svr4
3003         $test -d /usr/include/minix && osname=minix
3004         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3005         if $test -d /MachTen -o -d /MachTen_Folder; then
3006                 osname=machten
3007                 if $test -x /sbin/version; then
3008                         osvers=`/sbin/version | $awk '{print $2}' |
3009                         $sed -e 's/[A-Za-z]$//'`
3010                 elif $test -x /usr/etc/version; then
3011                         osvers=`/usr/etc/version | $awk '{print $2}' |
3012                         $sed -e 's/[A-Za-z]$//'`
3013                 else
3014                         osvers="$2.$3"
3015                 fi
3016         fi
3017
3018         $test -f /sys/posix.dll &&
3019                 $test -f /usr/bin/what &&
3020                 set X `/usr/bin/what /sys/posix.dll` &&
3021                 $test "$3" = UWIN &&
3022                 osname=uwin &&
3023                 osvers="$5"
3024
3025         if $test -f $uname; then
3026                 set X $myuname
3027                 shift
3028
3029                 case "$5" in
3030                 fps*) osname=fps ;;
3031                 mips*)
3032                         case "$4" in
3033                         umips) osname=umips ;;
3034                         *) osname=mips ;;
3035                         esac;;
3036                 [23]100) osname=mips ;;
3037                 next*) osname=next ;;
3038                 i386*)
3039                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3040                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3041                                 osname='sco'
3042                                 osvers=$tmp
3043                         elif $test -f /etc/kconfig; then
3044                                 osname=isc
3045                                 if test "$lns" = "$ln -s"; then
3046                                         osvers=4
3047                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3048                                         osvers=3
3049                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3050                                         osvers=2
3051                                 fi
3052                         fi
3053                         tmp=''
3054                         ;;
3055                 pc*)
3056                         if test -n "$DJGPP"; then
3057                                 osname=dos
3058                                 osvers=djgpp
3059                         fi
3060                         ;;
3061                 esac
3062
3063                 case "$1" in
3064                 aix) osname=aix
3065                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3066                         case "$tmp" in
3067                         'not found') osvers="$4"."$3" ;;
3068                         '<3240'|'<>3240') osvers=3.2.0 ;;
3069                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3070                         '=3250'|'>3250') osvers=3.2.5 ;;
3071                         *) osvers=$tmp;;
3072                         esac
3073                         ;;
3074                 bsd386) osname=bsd386
3075                         osvers=`$uname -r`
3076                         ;;
3077                 cygwin*) osname=cygwin
3078                         osvers="$3"
3079                         ;;
3080                 *dc.osx) osname=dcosx
3081                         osvers="$3"
3082                         ;;
3083                 dnix) osname=dnix
3084                         osvers="$3"
3085                         ;;
3086                 domainos) osname=apollo
3087                         osvers="$3"
3088                         ;;
3089                 dgux) osname=dgux 
3090                         osvers="$3"
3091                         ;;
3092                 dynixptx*) osname=dynixptx
3093                         osvers=`echo "$4"|sed 's/^v//'`
3094                         ;;
3095                 freebsd) osname=freebsd 
3096                         osvers="$3" ;;
3097                 genix) osname=genix ;;
3098                 hp*) osname=hpux 
3099                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3100                         ;;
3101                 irix*) osname=irix
3102                         case "$3" in
3103                         4*) osvers=4 ;;
3104                         5*) osvers=5 ;;
3105                         *)      osvers="$3" ;;
3106                         esac
3107                         ;;
3108                 linux) osname=linux
3109                         case "$3" in
3110                         *)      osvers="$3" ;;
3111                         esac
3112                         ;;
3113                 MiNT) osname=mint
3114                         ;;
3115                 netbsd*) osname=netbsd
3116                         osvers="$3"
3117                         ;;
3118                 news-os) osvers="$3"
3119                         case "$3" in
3120                         4*) osname=newsos4 ;;
3121                         *) osname=newsos ;;
3122                         esac
3123                         ;;
3124                 next*) osname=next ;;
3125                 nonstop-ux) osname=nonstopux ;;
3126                 openbsd) osname=openbsd
3127                         osvers="$3"
3128                         ;;
3129                 POSIX-BC | posix-bc ) osname=posix-bc
3130                         osvers="$3"
3131                         ;;
3132                 powerux | power_ux | powermax_os | powermaxos | \
3133                 powerunix | power_unix) osname=powerux
3134                         osvers="$3"
3135                         ;;
3136                 qnx) osname=qnx
3137                         osvers="$4"
3138                         ;;
3139                 solaris) osname=solaris
3140                         case "$3" in
3141                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3142                         *)      osvers="$3" ;;
3143                         esac
3144                         ;;
3145                 sunos) osname=sunos
3146                         case "$3" in
3147                         5*) osname=solaris
3148                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3149                         *)      osvers="$3" ;;
3150                         esac
3151                         ;;
3152                 titanos) osname=titanos
3153                         case "$3" in
3154                         1*) osvers=1 ;;
3155                         2*) osvers=2 ;;
3156                         3*) osvers=3 ;;
3157                         4*) osvers=4 ;;
3158                         *)      osvers="$3" ;;
3159                         esac
3160                         ;;
3161                 ultrix) osname=ultrix
3162                         osvers="$3"
3163                         ;;
3164                 osf1|mls+)      case "$5" in
3165                                 alpha)
3166                                         osname=dec_osf
3167                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3168                                         case "$osvers" in
3169                                         [1-9].[0-9]*) ;;
3170                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3171                                         esac
3172                                         ;;
3173                         hp*)    osname=hp_osf1  ;;
3174                         mips)   osname=mips_osf1 ;;
3175                         esac
3176                         ;;
3177                 unixware) osname=svr5
3178                         osvers="$4"
3179                         ;;
3180                 uts)    osname=uts
3181                         osvers="$3"
3182                         ;;
3183                 vos) osvers="$3"
3184                         ;;
3185                 $2) case "$osname" in
3186                         *isc*) ;;
3187                         *freebsd*) ;;
3188                         svr*)
3189                                 : svr4.x or possibly later
3190                                 case "svr$3" in 
3191                                 ${osname}*)
3192                                         osname=svr$3
3193                                         osvers=$4
3194                                         ;;
3195                                 esac
3196                                 case "$osname" in
3197                                 svr4.0)
3198                                         : Check for ESIX
3199                                         if test -f /stand/boot ; then
3200                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3201                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3202                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3203                                                         if test -n "$isesix"; then
3204                                                                 osname=esix4
3205                                                         fi
3206                                                 fi
3207                                         fi
3208                                         ;;
3209                                 esac
3210                                 ;;
3211                         *)      if test -f /etc/systemid; then
3212                                         osname=sco
3213                                         set `echo $3 | $sed 's/\./ /g'` $4
3214                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3215                                                 osvers=$1.$2.$3
3216                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3217                                                 osvers=$1.$2
3218                                         elif $test -f $src/hints/sco_$1.sh; then
3219                                                 osvers=$1
3220                                         fi
3221                                 else
3222                                         case "$osname" in
3223                                         '') : Still unknown.  Probably a generic Sys V.
3224                                                 osname="sysv"
3225                                                 osvers="$3"
3226                                                 ;;
3227                                         esac
3228                                 fi
3229                                 ;;
3230                         esac
3231                         ;;
3232                 *)      case "$osname" in
3233                         '') : Still unknown.  Probably a generic BSD.
3234                                 osname="$1"
3235                                 osvers="$3"
3236                                 ;;
3237                         esac
3238                         ;;
3239                 esac
3240         else
3241                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3242                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3243                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3244                                 osname=news_os
3245                         fi
3246                         $rm -f UU/kernel.what
3247                 elif test -d c:/.; then
3248                         set X $myuname
3249                         osname=os2
3250                         osvers="$5"
3251                 fi
3252         fi
3253         
3254         case "$targetarch" in
3255         '') ;;
3256         *)  hostarch=$osname
3257             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3258             osvers=''
3259             ;;
3260         esac
3261
3262         : Now look for a hint file osname_osvers, unless one has been
3263         : specified already.
3264         case "$hintfile" in
3265         ''|' ')
3266                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3267                 : Also try without trailing minor version numbers.
3268                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3269                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3270                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3271                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3272                 case "$file" in
3273                 '') dflt=none ;;
3274                 *)  case "$osvers" in
3275                         '') dflt=$file
3276                                 ;;
3277                         *)  if $test -f $src/hints/$file.sh ; then
3278                                         dflt=$file
3279                                 elif $test -f $src/hints/$xfile.sh ; then
3280                                         dflt=$xfile
3281                                 elif $test -f $src/hints/$xxfile.sh ; then
3282                                         dflt=$xxfile
3283                                 elif $test -f $src/hints/$xxxfile.sh ; then
3284                                         dflt=$xxxfile
3285                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3286                                         dflt=$xxxxfile
3287                                 elif $test -f "$src/hints/${osname}.sh" ; then
3288                                         dflt="${osname}"
3289                                 else
3290                                         dflt=none
3291                                 fi
3292                                 ;;
3293                         esac
3294                         ;;
3295                 esac
3296                 if $test -f Policy.sh ; then
3297                         case "$dflt" in
3298                         *Policy*) ;;
3299                         none) dflt="Policy" ;;
3300                         *) dflt="Policy $dflt" ;;
3301                         esac
3302                 fi
3303                 ;;
3304         *)
3305                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3306                 ;;
3307         esac
3308
3309         if $test -f Policy.sh ; then
3310                 $cat <<EOM
3311
3312 There's also a Policy hint file available, which should make the
3313 site-specific (policy) questions easier to answer.
3314 EOM
3315
3316         fi
3317
3318         $cat <<EOM
3319
3320 You may give one or more space-separated answers, or "none" if appropriate.
3321 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3322 is a good thing.  DO NOT give a wrong version or a wrong OS.
3323
3324 EOM
3325
3326         rp="Which of these apply, if any?"
3327         . UU/myread
3328         tans=$ans
3329         for file in $tans; do
3330                 if $test X$file = XPolicy -a -f Policy.sh; then
3331                         . Policy.sh
3332                         $cat Policy.sh >> UU/config.sh
3333                 elif $test -f $src/hints/$file.sh; then
3334                         . $src/hints/$file.sh
3335                         $cat $src/hints/$file.sh >> UU/config.sh
3336                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3337                         : nothing
3338                 else
3339                         : Give one chance to correct a possible typo.
3340                         echo "$file.sh does not exist"
3341                         dflt=$file
3342                         rp="hint to use instead?"
3343                         . UU/myread
3344                         for file in $ans; do
3345                                 if $test -f "$src/hints/$file.sh"; then
3346                                         . $src/hints/$file.sh
3347                                         $cat $src/hints/$file.sh >> UU/config.sh
3348                                 elif $test X$ans = X -o X$ans = Xnone ; then
3349                                         : nothing
3350                                 else
3351                                         echo "$file.sh does not exist -- ignored."
3352                                 fi
3353                         done
3354                 fi
3355         done
3356
3357         hint=recommended
3358         : Remember our hint file for later.
3359         if $test -f "$src/hints/$file.sh" ; then
3360                 hintfile="$file"
3361         else
3362                 hintfile=''
3363         fi
3364 fi
3365 cd UU
3366 ;;
3367 *)
3368         echo " "
3369         echo "Fetching default answers from $config_sh..." >&4
3370         tmp_n="$n"
3371         tmp_c="$c"
3372         cd ..
3373         cp $config_sh config.sh 2>/dev/null
3374         chmod +w config.sh
3375         . ./config.sh
3376         cd UU
3377         cp ../config.sh .
3378         n="$tmp_n"
3379         c="$tmp_c"
3380         hint=previous
3381         ;;
3382 esac
3383 test "$override" && . ./optdef.sh
3384
3385 : Restore computed paths
3386 for file in $loclist $trylist; do
3387         eval $file="\$_$file"
3388 done
3389
3390 cat << EOM
3391
3392 Configure uses the operating system name and version to set some defaults.
3393 The default value is probably right if the name rings a bell. Otherwise,
3394 since spelling matters for me, either accept the default or answer "none"
3395 to leave it blank.
3396
3397 EOM
3398 case "$osname" in
3399         ''|' ')
3400                 case "$hintfile" in
3401                 ''|' '|none) dflt=none ;;
3402                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3403                 esac
3404                 ;;
3405         *) dflt="$osname" ;;
3406 esac
3407 rp="Operating system name?"
3408 . ./myread
3409 case "$ans" in
3410 none)  osname='' ;;
3411 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3412 esac
3413 echo " "
3414 case "$osvers" in
3415         ''|' ')
3416                 case "$hintfile" in
3417                 ''|' '|none) dflt=none ;;
3418                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3419                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3420                         case "$dflt" in
3421                         ''|' ') dflt=none ;;
3422                         esac
3423                         ;;
3424                 esac
3425                 ;;
3426         *) dflt="$osvers" ;;
3427 esac
3428 rp="Operating system version?"
3429 . ./myread
3430 case "$ans" in
3431 none)  osvers='' ;;
3432 *) osvers="$ans" ;;
3433 esac
3434
3435
3436 . ./posthint.sh
3437
3438 : who configured the system
3439 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3440 cf_by=`(logname) 2>/dev/null`
3441 case "$cf_by" in
3442 "")
3443         cf_by=`(whoami) 2>/dev/null`
3444         case "$cf_by" in
3445         "") cf_by=unknown ;;
3446         esac ;;
3447 esac
3448
3449 : set up the script used to warn in case of inconsistency
3450 cat <<EOS >whoa
3451 $startsh
3452 EOS
3453 cat <<'EOSC' >>whoa
3454 dflt=y
3455 echo " "
3456 echo "*** WHOA THERE!!! ***" >&4
3457 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3458 rp="    Keep the $hint value?"
3459 . ./myread
3460 case "$ans" in
3461 y) td=$was; tu=$was;;
3462 esac
3463 EOSC
3464
3465 : function used to set $1 to $val
3466 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3467 case "$val$was" in
3468 $define$undef) . ./whoa; eval "$var=\$td";;
3469 $undef$define) . ./whoa; eval "$var=\$tu";;
3470 *) eval "$var=$val";;
3471 esac'
3472
3473 case "$usesocks" in
3474 $define|true|[yY]*)     dflt='y';;
3475 *) dflt='n';;
3476 esac
3477 cat <<EOM
3478
3479 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3480 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3481 to use the PerlIO abstraction layer, this will be implicitly selected.
3482
3483 If this doesn't make any sense to you, just accept the default '$dflt'.
3484 EOM
3485 rp='Build Perl for SOCKS?'
3486 . ./myread
3487 case "$ans" in
3488 y|Y)    val="$define" ;;     
3489 *)      val="$undef" ;;
3490 esac
3491 set usesocks
3492 eval $setvar
3493
3494 case "$usesocks" in
3495 $define|true|[yY]*) useperlio="$define";;
3496 esac
3497
3498 case "$useperlio" in
3499 $define|true|[yY]*|'')  dflt='y';;
3500 *) dflt='n';;
3501 esac
3502 cat <<EOM
3503
3504 Previous version of $package used the standard IO mechanisms as
3505 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3506 alternate IO mechanisms via the PerlIO abstraction layer, but the
3507 stdio mechanism is still available if needed.  The abstraction layer
3508 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3509 Using PerlIO with sfio may cause problems with some extension modules.
3510
3511 If this doesn't make any sense to you, just accept the default '$dflt'.
3512 EOM
3513 rp='Use the PerlIO abstraction layer?'
3514 . ./myread
3515 case "$ans" in
3516 y|Y) 
3517         val="$define"
3518         ;;
3519 *)      
3520         echo "Ok, doing things the stdio way."
3521         val="$undef"
3522         ;;
3523 esac
3524 set useperlio
3525 eval $setvar 
3526
3527 case "$usesocks" in
3528 $define|true|[yY]*)
3529         case "$useperlio" in
3530         $define|true|[yY]*) ;;
3531         *)      cat >&4 <<EOM
3532
3533 You are using the SOCKS proxy protocol library which means that you
3534 should also use the PerlIO layer.  You may be headed for trouble.
3535
3536 EOM
3537                 ;;
3538         esac
3539         ;;
3540 esac
3541
3542         
3543 case "$usethreads" in
3544 $define|true|[yY]*)     dflt='y';;
3545 *)     # Catch case where user specified ithreads or 5005threads but
3546        # forgot -Dusethreads (A.D. 4/2002)
3547        case "$useithreads$use5005threads" in
3548        *$define*)      
3549                 case "$useperlio" in
3550                 "$define")      dflt='y' ;;
3551                 *)              dflt='n' ;;
3552                 esac
3553                 ;;
3554        *)       dflt='n';;
3555        esac
3556        ;;
3557 esac
3558 cat <<EOM
3559
3560 Perl can be built to take advantage of threads on some systems.
3561 To do so, Configure can be run with -Dusethreads.
3562
3563 Note that Perl built with threading support runs slightly slower
3564 and uses more memory than plain Perl. The current implementation
3565 is believed to be stable, but it is fairly new, and so should be
3566 treated with caution.
3567
3568 If this doesn't make any sense to you, just accept the default '$dflt'.
3569 EOM
3570 rp='Build a threading Perl?'
3571 . ./myread
3572 case "$ans" in
3573 y|Y)    val="$define" ;;
3574 *)      val="$undef" ;;
3575 esac
3576 set usethreads
3577 eval $setvar
3578
3579 case "$usethreads" in
3580 $define)
3581         $cat <<EOM
3582
3583 Since release 5.6, Perl has had two different threading implementations,
3584 the newer interpreter-based version (ithreads) with one interpreter per
3585 thread, and the older 5.005 version (5005threads).
3586 The 5005threads version is effectively unmaintained and will probably be
3587 removed in Perl 5.10, so there should be no need to build a Perl using it
3588 unless needed for backwards compatibility with some existing 5.005threads
3589 code.
3590
3591 EOM
3592         : Default to ithreads unless overridden on command line or with
3593         : old config.sh
3594         dflt='y'
3595         case "$use5005threads" in
3596                 $define|true|[yY]*) dflt='n';;
3597         esac
3598         case "$useithreads" in
3599                 $undef|false|[nN]*) dflt='n';;
3600         esac
3601         rp='Use the newer interpreter-based ithreads?'
3602         . ./myread
3603         case "$ans" in
3604         y|Y)    val="$define" ;;
3605         *)      val="$undef" ;;
3606         esac
3607         set useithreads
3608         eval $setvar
3609         : Now set use5005threads to the opposite value.
3610         case "$useithreads" in
3611         $define) val="$undef" ;;
3612         *) val="$define" ;;
3613         esac
3614         set use5005threads
3615         eval $setvar
3616         ;;
3617 *)
3618         useithreads="$undef"
3619         use5005threads="$undef"
3620         ;;
3621 esac
3622
3623 case "$useithreads$use5005threads" in
3624 "$define$define")
3625         $cat >&4 <<EOM
3626
3627 You cannot have both the ithreads and the 5.005 threads enabled
3628 at the same time.  Disabling the 5.005 threads since they are
3629 much less stable than the ithreads.
3630
3631 EOM
3632         use5005threads="$undef"
3633         ;;
3634 esac
3635
3636 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3637         cat >&4 <<EOF
3638 ***
3639 *** To build with ithreads you must also use the PerlIO layer.
3640 *** Cannot continue, aborting.
3641 ***
3642 EOF
3643         exit 1
3644 fi
3645
3646 case "$d_oldpthreads" in
3647 '')     : Configure tests would be welcome here.  For now, assume undef.
3648         val="$undef" ;;
3649 *)      val="$d_oldpthreads" ;;
3650 esac
3651 set d_oldpthreads
3652 eval $setvar
3653
3654
3655 case "$usethreads" in
3656 "$define"|true|[yY]*)
3657 : Look for a hint-file generated 'call-back-unit'.  If the
3658 : user has specified that a threading perl is to be built,
3659 : we may need to set or change some other defaults.
3660         if $test -f usethreads.cbu; then
3661                 echo "Your platform has some specific hints for threaded builds, using them..."
3662                 . ./usethreads.cbu
3663         else
3664                 $cat <<EOM
3665 (Your platform doesn't have any specific hints for threaded builds.
3666  Assuming POSIX threads, then.)
3667 EOM
3668         fi
3669         ;;
3670 esac
3671
3672 cat <<EOM
3673
3674 Perl can be built so that multiple Perl interpreters can coexist
3675 within the same Perl executable.
3676 EOM
3677
3678 case "$useithreads" in
3679 $define)
3680         cat <<EOM
3681 This multiple interpreter support is required for interpreter-based threads.
3682 EOM
3683         val="$define"
3684         ;;
3685 *)      case "$usemultiplicity" in
3686         $define|true|[yY]*)     dflt='y';;
3687         *) dflt='n';;
3688         esac
3689         echo " "
3690         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3691         rp='Build Perl for multiplicity?'
3692         . ./myread
3693         case "$ans" in
3694         y|Y)    val="$define" ;;
3695         *)      val="$undef" ;;
3696         esac
3697         ;;
3698 esac
3699 set usemultiplicity
3700 eval $setvar
3701
3702
3703 case "$usemorebits" in
3704 "$define"|true|[yY]*)
3705         use64bitint="$define"
3706         uselongdouble="$define"
3707         usemorebits="$define"
3708         ;;
3709 *)      usemorebits="$undef"
3710         ;;
3711 esac
3712
3713 : make some quick guesses about what we are up against
3714 echo " "
3715 $echo $n "Hmm...  $c"
3716 echo exit 1 >bsd
3717 echo exit 1 >usg
3718 echo exit 1 >v7
3719 echo exit 1 >osf1
3720 echo exit 1 >eunice
3721 echo exit 1 >xenix
3722 echo exit 1 >venix
3723 echo exit 1 >os2
3724 d_bsd="$undef"
3725 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3726 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3727 then
3728         echo "Looks kind of like an OSF/1 system, but we'll see..."
3729         echo exit 0 >osf1
3730 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3731         xxx=`./loc addbib blurfl $pth`
3732         if $test -f $xxx; then
3733         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3734                 echo exit 0 >bsd
3735                 echo exit 0 >usg
3736         else
3737                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3738                         echo "Looks kind of like an extended USG system, but we'll see..."
3739                 else
3740                         echo "Looks kind of like a USG system, but we'll see..."
3741                 fi
3742                 echo exit 0 >usg
3743         fi
3744 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3745         echo "Looks kind of like a BSD system, but we'll see..."
3746         d_bsd="$define"
3747         echo exit 0 >bsd
3748 else
3749         echo "Looks kind of like a Version 7 system, but we'll see..."
3750         echo exit 0 >v7
3751 fi
3752 case "$eunicefix" in
3753 *unixtovms*)
3754         $cat <<'EOI'
3755 There is, however, a strange, musty smell in the air that reminds me of
3756 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3757 EOI
3758         echo exit 0 >eunice
3759         d_eunice="$define"
3760 : it so happens the Eunice I know will not run shell scripts in Unix format
3761         ;;
3762 *)
3763         echo " "
3764         echo "Congratulations.  You aren't running Eunice."
3765         d_eunice="$undef"
3766         ;;
3767 esac
3768 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3769 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3770 : semicolon as a patch separator
3771 case "$p_" in
3772 :) ;;
3773 *)
3774         $cat <<'EOI'
3775 I have the feeling something is not exactly right, however...don't tell me...
3776 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3777 (Or you may be running DOS with DJGPP.)
3778 EOI
3779         echo exit 0 >os2
3780         ;;
3781 esac
3782 if test -f /xenix; then
3783         echo "Actually, this looks more like a XENIX system..."
3784         echo exit 0 >xenix
3785         d_xenix="$define"
3786 else
3787         echo " "
3788         echo "It's not Xenix..."
3789         d_xenix="$undef"
3790 fi
3791 chmod +x xenix
3792 $eunicefix xenix
3793 if test -f /venix; then
3794         echo "Actually, this looks more like a VENIX system..."
3795         echo exit 0 >venix
3796 else
3797         echo " "
3798         if ./xenix; then
3799                 : null
3800         else
3801                 echo "Nor is it Venix..."
3802         fi
3803 fi
3804 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3805 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3806 $rm -f foo
3807
3808 case "$cc" in
3809 '') dflt=cc;;
3810 *) dflt="$cc";;
3811 esac
3812 rp="Use which C compiler?"
3813 . ./myread
3814 cc="$ans"
3815
3816 : See if they have not cc but they do have gcc
3817 . ./trygcc
3818 : Look for a hint-file generated 'call-back-unit'.  Now that the
3819 : user has specified the compiler, we may need to set or change some
3820 : other defaults.
3821 if $test -f cc.cbu; then
3822     . ./cc.cbu
3823 fi
3824 . ./checkcc
3825
3826 echo " "
3827 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3828 $cat >try.c <<EOM
3829 #include <stdio.h>
3830 int main() {
3831 #ifdef __GNUC__
3832 #ifdef __VERSION__
3833         printf("%s\n", __VERSION__);
3834 #else
3835         printf("%s\n", "1");
3836 #endif
3837 #endif
3838         exit(0);
3839 }
3840 EOM
3841 if $cc -o try $ccflags $ldflags try.c; then
3842         gccversion=`$run ./try`
3843         case "$gccversion" in
3844         '') echo "You are not using GNU cc." ;;
3845         *)  echo "You are using GNU cc $gccversion."
3846             ccname=gcc
3847             ;;
3848         esac
3849 else
3850         echo " "
3851         echo "*** WHOA THERE!!! ***" >&4
3852         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3853         case "$knowitall" in
3854         '')
3855         echo "    You'd better start hunting for one and let me know about it." >&4
3856                 exit 1
3857                 ;;
3858         esac
3859 fi
3860 $rm -f try try.*
3861 case "$gccversion" in
3862 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3863 esac
3864 case "$gccversion" in
3865 '') gccosandvers='' ;;
3866 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3867    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3868    gccshortvers=''
3869    case "$gccosandvers" in
3870    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3871    $osname$osvers) ;; # looking good
3872    $osname*) cat <<EOM >&4
3873
3874 *** WHOA THERE!!! ***
3875
3876     Your gcc has not been compiled for the exact release of
3877     your operating system ($gccosandvers versus $osname$osvers).
3878
3879     In general it is a good idea to keep gcc synchronized with
3880     the operating system because otherwise serious problems
3881     may ensue when trying to compile software, like Perl.
3882
3883     I'm trying to be optimistic here, though, and will continue.
3884     If later during the configuration and build icky compilation
3885     problems appear (headerfile conflicts being the most common
3886     manifestation), I suggest reinstalling the gcc to match
3887     your operating system release.
3888
3889 EOM
3890       ;;
3891    *) gccosandvers='' ;; # failed to parse, better be silent
3892    esac
3893    ;;
3894 esac
3895 case "$ccname" in
3896 '') ccname="$cc" ;;
3897 esac
3898
3899 # gcc 3.* complain about adding -Idirectories that they already know about,
3900 # so we will take those off from locincpth.
3901 case "$gccversion" in
3902 3*)
3903     echo "main(){}">try.c
3904     for incdir in $locincpth; do
3905        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
3906              grep '^c[cp]p*[01]: warning: changing search order '`
3907        if test "X$warn" != X; then
3908            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
3909        fi
3910     done
3911     $rm -f try try.*
3912 esac
3913
3914 : decide how portable to be.  Allow command line overrides.
3915 case "$d_portable" in
3916 "$undef") ;;
3917 *)      d_portable="$define" ;;
3918 esac
3919
3920 : set up shell script to do ~ expansion
3921 cat >filexp <<EOSS
3922 $startsh
3923 : expand filename
3924 case "\$1" in
3925  ~/*|~)
3926         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3927         ;;
3928  ~*)
3929         if $test -f /bin/csh; then
3930                 /bin/csh -f -c "glob \$1"
3931                 failed=\$?
3932                 echo ""
3933                 exit \$failed
3934         else
3935                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3936                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3937                 if $test ! -d "\$dir"; then
3938                         me=\`basename \$0\`
3939                         echo "\$me: can't locate home directory for: \$name" >&2
3940                         exit 1
3941                 fi
3942                 case "\$1" in
3943                 */*)
3944                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3945                         ;;
3946                 *)
3947                         echo \$dir
3948                         ;;
3949                 esac
3950         fi
3951         ;;
3952 *)
3953         echo \$1
3954         ;;
3955 esac
3956 EOSS
3957 chmod +x filexp
3958 $eunicefix filexp
3959
3960 : now set up to get a file name
3961 cat <<EOS >getfile
3962 $startsh
3963 EOS
3964 cat <<'EOSC' >>getfile
3965 tilde=''
3966 fullpath=''
3967 already=''
3968 skip=''
3969 none_ok=''
3970 exp_file=''
3971 nopath_ok=''
3972 orig_rp="$rp"
3973 orig_dflt="$dflt"
3974 case "$gfpth" in
3975 '') gfpth='.' ;;
3976 esac
3977
3978 case "$fn" in
3979 *\(*)
3980         : getfile will accept an answer from the comma-separated list
3981         : enclosed in parentheses even if it does not meet other criteria.
3982         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3983         fn=`echo $fn | sed 's/(.*)//'`
3984         ;;
3985 esac
3986
3987 case "$fn" in
3988 *:*)
3989         loc_file=`expr $fn : '.*:\(.*\)'`
3990         fn=`expr $fn : '\(.*\):.*'`
3991         ;;
3992 esac
3993
3994 case "$fn" in
3995 *~*) tilde=true;;
3996 esac
3997 case "$fn" in
3998 */*) fullpath=true;;
3999 esac
4000 case "$fn" in
4001 *+*) skip=true;;
4002 esac
4003 case "$fn" in
4004 *n*) none_ok=true;;
4005 esac
4006 case "$fn" in
4007 *e*) exp_file=true;;
4008 esac
4009 case "$fn" in
4010 *p*) nopath_ok=true;;
4011 esac
4012
4013 case "$fn" in
4014 *f*) type='File';;
4015 *d*) type='Directory';;
4016 *l*) type='Locate';;
4017 esac
4018
4019 what="$type"
4020 case "$what" in
4021 Locate) what='File';;
4022 esac
4023
4024 case "$exp_file" in
4025 '')
4026         case "$d_portable" in
4027         "$define") ;;
4028         *) exp_file=true;;
4029         esac
4030         ;;
4031 esac
4032
4033 cd ..
4034 while test "$type"; do
4035         redo=''
4036         rp="$orig_rp"
4037         dflt="$orig_dflt"
4038         case "$tilde" in
4039         true) rp="$rp (~name ok)";;
4040         esac
4041         . UU/myread
4042         if test -f UU/getfile.ok && \
4043                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4044         then
4045                 value="$ans"
4046                 ansexp="$ans"
4047                 break
4048         fi
4049         case "$ans" in
4050         none)
4051                 value=''
4052                 ansexp=''
4053                 case "$none_ok" in
4054                 true) type='';;
4055                 esac
4056                 ;;
4057         *)
4058                 case "$tilde" in
4059                 '') value="$ans"
4060                         ansexp="$ans";;
4061                 *)
4062                         value=`UU/filexp $ans`
4063                         case $? in
4064                         0)
4065                                 if test "$ans" != "$value"; then
4066                                         echo "(That expands to $value on this system.)"
4067                                 fi
4068                                 ;;
4069                         *) value="$ans";;
4070                         esac
4071                         ansexp="$value"
4072                         case "$exp_file" in
4073                         '') value="$ans";;
4074                         esac
4075                         ;;
4076                 esac
4077                 case "$fullpath" in
4078                 true)
4079                         case "$ansexp" in
4080                         /*) value="$ansexp" ;;
4081                         [a-zA-Z]:/*) value="$ansexp" ;;
4082                         *)
4083                                 redo=true
4084                                 case "$already" in
4085                                 true)
4086                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4087                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4088                                         ;;
4089                                 *)
4090                                 echo "Please give a full path name, starting with slash." >&4
4091                                         case "$tilde" in
4092                                         true)
4093                                 echo "Note that using ~name is ok provided it expands well." >&4
4094                                                 already=true
4095                                                 ;;
4096                                         esac
4097                                 esac
4098                                 ;;
4099                         esac
4100                         ;;
4101                 esac
4102                 case "$redo" in
4103                 '')
4104                         case "$type" in
4105                         File)
4106                                 for fp in $gfpth; do
4107                                         if test "X$fp" = X.; then
4108                                             pf="$ansexp"
4109                                         else    
4110                                             pf="$fp/$ansexp"
4111                                         fi
4112                                         if test -f "$pf"; then
4113                                                 type=''
4114                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4115                                         then
4116                                                 echo "($value is not a plain file, but that's ok.)"
4117                                                 type=''
4118                                         fi
4119                                         if test X"$type" = X; then
4120                                             value="$pf"
4121                                             break
4122                                         fi
4123                                 done
4124                                 ;;
4125                         Directory)
4126                                 for fp in $gfpth; do
4127                                         if test "X$fp" = X.; then
4128                                             dir="$ans"
4129                                             direxp="$ansexp"
4130                                         else    
4131                                             dir="$fp/$ansexp"
4132                                             direxp="$fp/$ansexp"
4133                                         fi
4134                                         if test -d "$direxp"; then
4135                                                 type=''
4136                                                 value="$dir"
4137                                                 break
4138                                         fi
4139                                 done
4140                                 ;;
4141                         Locate)
4142                                 if test -d "$ansexp"; then
4143                                         echo "(Looking for $loc_file in directory $value.)"
4144                                         value="$value/$loc_file"
4145                                         ansexp="$ansexp/$loc_file"
4146                                 fi
4147                                 if test -f "$ansexp"; then
4148                                         type=''
4149                                 fi
4150                                 case "$nopath_ok" in
4151                                 true)   case "$value" in
4152                                         */*) ;;
4153                                         *)      echo "Assuming $value will be in people's path."
4154                                                 type=''
4155                                                 ;;
4156                                         esac
4157                                         ;;
4158                                 esac
4159                                 ;;
4160                         esac
4161
4162                         case "$skip" in
4163                         true) type='';
4164                         esac
4165
4166                         case "$type" in
4167                         '') ;;
4168                         *)
4169                                 if test "$fastread" = yes; then
4170                                         dflt=y
4171                                 else
4172                                         dflt=n
4173                                 fi
4174                                 rp="$what $value doesn't exist.  Use that name anyway?"
4175                                 . UU/myread
4176                                 dflt=''
4177                                 case "$ans" in
4178                                 y*) type='';;
4179                                 *) echo " ";;
4180                                 esac
4181                                 ;;
4182                         esac
4183                         ;;
4184                 esac
4185                 ;;
4186         esac
4187 done
4188 cd UU
4189 ans="$value"
4190 rp="$orig_rp"
4191 dflt="$orig_dflt"
4192 rm -f getfile.ok
4193 test "X$gfpthkeep" != Xy && gfpth=""
4194 EOSC
4195
4196 : What should the include directory be ?
4197 echo " "
4198 $echo $n "Hmm...  $c"
4199 dflt='/usr/include'
4200 incpath=''
4201 mips_type=''
4202 if $test -f /bin/mips && /bin/mips; then
4203         echo "Looks like a MIPS system..."
4204         $cat >usr.c <<'EOCP'
4205 #ifdef SYSTYPE_BSD43
4206 /bsd43
4207 #endif
4208 EOCP
4209         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4210                 dflt='/bsd43/usr/include'
4211                 incpath='/bsd43'
4212                 mips_type='BSD 4.3'
4213         else
4214                 mips_type='System V'
4215         fi
4216         $rm -f usr.c usr.out
4217         echo "and you're compiling with the $mips_type compiler and libraries."
4218         xxx_prompt=y
4219         echo "exit 0" >mips
4220 else
4221         echo "Doesn't look like a MIPS system."
4222         xxx_prompt=n
4223         echo "exit 1" >mips
4224 fi
4225 chmod +x mips
4226 $eunicefix mips
4227 case "$usrinc" in
4228 '') ;;
4229 *) dflt="$usrinc";;
4230 esac
4231 case "$xxx_prompt" in
4232 y)      fn=d/
4233         echo " "
4234         rp='Where are the include files you want to use?'
4235         . ./getfile
4236         usrinc="$ans"
4237         ;;
4238 *)      usrinc="$dflt"
4239         ;;
4240 esac
4241
4242 : see how we invoke the C preprocessor
4243 echo " "
4244 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4245 cat <<'EOT' >testcpp.c
4246 #define ABC abc
4247 #define XYZ xyz
4248 ABC.XYZ
4249 EOT
4250 cd ..
4251 if test ! -f cppstdin; then
4252         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4253                 # AIX cc -E doesn't show the absolute headerfile
4254                 # locations but we'll cheat by using the -M flag.
4255                 echo 'cat >.$$.c; rm -f .$$.u; '"$cc"' ${1+"$@"} -M -c .$$.c 2>/dev/null; test -s .$$.u && awk '"'"'$2 ~ /\.h$/ { print "# 0 \""$2"\"" }'"'"' .$$.u; rm -f .$$.o .$$.u; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' > cppstdin
4256         else
4257                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4258         fi
4259 else
4260         echo "Keeping your $hint cppstdin wrapper."
4261 fi
4262 chmod 755 cppstdin
4263 wrapper=`pwd`/cppstdin
4264 ok='false'
4265 cd UU
4266
4267 if $test "X$cppstdin" != "X" && \
4268         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4269         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4270 then
4271         echo "You used to use $cppstdin $cppminus so we'll use that again."
4272         case "$cpprun" in
4273         '') echo "But let's see if we can live without a wrapper..." ;;
4274         *)
4275                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4276                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4277                 then
4278                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4279                         ok='true'
4280                 else
4281                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4282                 fi
4283                 ;;
4284         esac
4285 else
4286         case "$cppstdin" in
4287         '') ;;
4288         *)
4289                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4290                 ;;
4291         esac
4292 fi
4293
4294 if $ok; then
4295         : nothing
4296 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4297         $cc -E <testcpp.c >testcpp.out 2>&1; \
4298         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4299         echo "Yup, it does."
4300         x_cpp="$cc -E"
4301         x_minus='';
4302 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4303         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4304         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4305         echo "Yup, it does."
4306         x_cpp="$cc -E"
4307         x_minus='-';
4308 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4309         $cc -P <testcpp.c >testcpp.out 2>&1; \
4310         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4311         echo "Yipee, that works!"
4312         x_cpp="$cc -P"
4313         x_minus='';
4314 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4315         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4316         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4317         echo "At long last!"
4318         x_cpp="$cc -P"
4319         x_minus='-';
4320 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4321         $cpp <testcpp.c >testcpp.out 2>&1; \
4322         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4323         echo "It works!"
4324         x_cpp="$cpp"
4325         x_minus='';
4326 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4327         $cpp - <testcpp.c >testcpp.out 2>&1; \
4328         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4329         echo "Hooray, it works!  I was beginning to wonder."
4330         x_cpp="$cpp"
4331         x_minus='-';
4332 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4333         $wrapper <testcpp.c >testcpp.out 2>&1; \
4334         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4335         x_cpp="$wrapper"
4336         x_minus=''
4337         echo "Eureka!"
4338 else
4339         dflt=''
4340         rp="No dice.  I can't find a C preprocessor.  Name one:"
4341         . ./myread
4342         x_cpp="$ans"
4343         x_minus=''
4344         $x_cpp <testcpp.c >testcpp.out 2>&1
4345         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4346                 echo "OK, that will do." >&4
4347         else
4348 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4349                 exit 1
4350         fi
4351 fi
4352
4353 case "$ok" in
4354 false)
4355         cppstdin="$x_cpp"
4356         cppminus="$x_minus"
4357         cpprun="$x_cpp"
4358         cpplast="$x_minus"
4359         set X $x_cpp
4360         shift
4361         case "$1" in
4362         "$cpp")
4363                 echo "Perhaps can we force $cc -E using a wrapper..."
4364                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4365                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4366                 then
4367                         echo "Yup, we can."
4368                         cppstdin="$wrapper"
4369                         cppminus='';
4370                 else
4371                         echo "Nope, we'll have to live without it..."
4372                 fi
4373                 ;;
4374         esac
4375         case "$cpprun" in
4376         "$wrapper")
4377                 cpprun=''
4378                 cpplast=''
4379                 ;;
4380         esac
4381         ;;
4382 esac
4383
4384 case "$cppstdin" in
4385 "$wrapper"|'cppstdin') ;;
4386 *) $rm -f $wrapper;;
4387 esac
4388 $rm -f testcpp.c testcpp.out
4389
4390 : Set private lib path
4391 case "$plibpth" in
4392 '') if ./mips; then
4393                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4394         fi;;
4395 esac
4396 case "$libpth" in
4397 ' ') dlist='';;
4398 '') dlist="$loclibpth $plibpth $glibpth";;
4399 *) dlist="$libpth";;
4400 esac
4401
4402 : Now check and see which directories actually exist, avoiding duplicates
4403 libpth=''
4404 for xxx in $dlist
4405 do
4406     if $test -d $xxx; then
4407                 case " $libpth " in
4408                 *" $xxx "*) ;;
4409                 *) libpth="$libpth $xxx";;
4410                 esac
4411     fi
4412 done
4413 $cat <<'EOM'
4414
4415 Some systems have incompatible or broken versions of libraries.  Among
4416 the directories listed in the question below, please remove any you
4417 know not to be holding relevant libraries, and add any that are needed.
4418 Say "none" for none.
4419
4420 EOM
4421 case "$libpth" in
4422 '') dflt='none';;
4423 *)
4424         set X $libpth
4425         shift
4426         dflt=${1+"$@"}
4427         ;;
4428 esac
4429 rp="Directories to use for library searches?"
4430 . ./myread
4431 case "$ans" in
4432 none) libpth=' ';;
4433 *) libpth="$ans";;
4434 esac
4435
4436 : compute shared library extension
4437 case "$so" in
4438 '')
4439         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4440                 dflt='sl'
4441         else
4442                 dflt='so'
4443         fi
4444         ;;
4445 *) dflt="$so";;
4446 esac
4447 $cat <<EOM
4448
4449 On some systems, shared libraries may be available.  Answer 'none' if
4450 you want to suppress searching of shared libraries for the remainder
4451 of this configuration.
4452
4453 EOM
4454 rp='What is the file extension used for shared libraries?'
4455 . ./myread
4456 so="$ans"
4457
4458 : Define several unixisms.
4459 : Hints files or command line option can be used to override them.
4460 : The convoluted testing is in case hints files set either the old
4461 : or the new name.
4462 case "$_exe" in
4463 '')     case "$exe_ext" in
4464         '')     ;;
4465         *)      _exe="$exe_ext" ;;
4466         esac
4467         ;;
4468 esac
4469 case "$_a" in
4470 '')     case "$lib_ext" in
4471     '') _a='.a';;
4472         *)      _a="$lib_ext" ;;
4473         esac
4474         ;;
4475 esac
4476 case "$_o" in
4477 '') case "$obj_ext" in
4478         '')     _o='.o';;
4479         *)      _o="$obj_ext";;
4480         esac
4481         ;;
4482 esac
4483 case "$p_" in
4484 '') case "$path_sep" in
4485         '')     p_=':';;
4486         *)      p_="$path_sep";;
4487         esac
4488         ;;
4489 esac
4490 exe_ext=$_exe
4491 lib_ext=$_a
4492 obj_ext=$_o
4493 path_sep=$p_
4494
4495 : Which makefile gets called first.  This is used by make depend.
4496 case "$firstmakefile" in
4497 '') firstmakefile='makefile';;
4498 esac
4499
4500 : Looking for optional libraries
4501 echo " "
4502 echo "Checking for optional libraries..." >&4
4503 case "$libs" in
4504 ' '|'') dflt='';;
4505 *) dflt="$libs";;
4506 esac
4507 case "$libswanted" in
4508 '') libswanted='c_s';;
4509 esac
4510 case "$usesocks" in
4511 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4512 esac
4513 libsfound=''
4514 libsfiles=''
4515 libsdirs=''
4516 libspath=''
4517 for thisdir in $libpth $xlibpth; do
4518   test -d $thisdir && libspath="$libspath $thisdir"
4519 done
4520 for thislib in $libswanted; do
4521         for thisdir in $libspath; do
4522             xxx=''
4523             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4524                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4525                 $test -f "$xxx" && eval $libscheck
4526                 $test -f "$xxx" && libstyle=shared
4527             fi
4528             if test ! -f "$xxx"; then
4529                 xxx=$thisdir/lib$thislib.$so
4530                 $test -f "$xxx" && eval $libscheck
4531                 $test -f "$xxx" && libstyle=shared
4532             fi  
4533             if test ! -f "$xxx"; then
4534                 xxx=$thisdir/lib$thislib$_a
4535                 $test -f "$xxx" && eval $libscheck
4536                 $test -f "$xxx" && libstyle=static
4537             fi
4538             if test ! -f "$xxx"; then
4539                 xxx=$thisdir/$thislib$_a
4540                 $test -f "$xxx" && eval $libscheck
4541                 $test -f "$xxx" && libstyle=static
4542             fi
4543             if test ! -f "$xxx"; then
4544                 xxx=$thisdir/lib${thislib}_s$_a
4545                 $test -f "$xxx" && eval $libscheck
4546                 $test -f "$xxx" && libstyle=static
4547                 $test -f "$xxx" && thislib=${thislib}_s
4548             fi
4549             if test ! -f "$xxx"; then
4550                 xxx=$thisdir/Slib$thislib$_a
4551                 $test -f "$xxx" && eval $libscheck
4552                 $test -f "$xxx" && libstyle=static
4553             fi
4554             if $test -f "$xxx"; then
4555                 case "$libstyle" in
4556                 shared) echo "Found -l$thislib (shared)." ;;
4557                 static) echo "Found -l$thislib." ;;
4558                 *)      echo "Found -l$thislib ($libstyle)." ;;
4559                 esac
4560                 case " $dflt " in
4561                 *"-l$thislib "*);;
4562                 *) dflt="$dflt -l$thislib"
4563                    libsfound="$libsfound $xxx"
4564                    yyy=`basename $xxx`
4565                    libsfiles="$libsfiles $yyy"
4566                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4567                    case " $libsdirs " in
4568                    *" $yyy "*) ;;
4569                    *) libsdirs="$libsdirs $yyy" ;;
4570                    esac
4571                    ;;
4572                 esac
4573                 break
4574             fi  
4575         done
4576         if $test ! -f "$xxx"; then
4577             echo "No -l$thislib."
4578         fi
4579 done
4580 set X $dflt
4581 shift
4582 dflt="$*"
4583 case "$libs" in
4584 '') dflt="$dflt";;
4585 *) dflt="$libs";;
4586 esac
4587 case "$dflt" in
4588 ' '|'') dflt='none';;
4589 esac
4590
4591 $cat <<EOM
4592
4593 In order to compile $package on your machine, a number of libraries
4594 are usually needed.  Include any other special libraries here as well.
4595 Say "none" for none.  The default list is almost always right.
4596 EOM
4597
4598 echo " "
4599 rp="What libraries to use?"
4600 . ./myread
4601 case "$ans" in
4602 none) libs=' ';;
4603 *) libs="$ans";;
4604 esac
4605
4606 : determine optimization, if desired, or use for debug flag also
4607 case "$optimize" in
4608 ' '|$undef) dflt='none';;
4609 '') dflt='-O';;
4610 *) dflt="$optimize";;
4611 esac
4612 $cat <<EOH
4613
4614 By default, $package compiles with the -O flag to use the optimizer.
4615 Alternately, you might want to use the symbolic debugger, which uses
4616 the -g flag (on traditional Unix systems).  Either flag can be
4617 specified here.  To use neither flag, specify the word "none".
4618
4619 EOH
4620 rp="What optimizer/debugger flag should be used?"
4621 . ./myread
4622 optimize="$ans"
4623 case "$optimize" in
4624 'none') optimize=" ";;
4625 esac
4626
4627 dflt=''
4628 : We will not override a previous value, but we might want to
4629 : augment a hint file
4630 case "$hint" in
4631 default|recommended)
4632         case "$gccversion" in
4633         1*) dflt='-fpcc-struct-return' ;;
4634         esac
4635         case "$optimize" in
4636         *-g*) dflt="$dflt -DDEBUGGING";;
4637         esac
4638         case "$gccversion" in
4639         2*) if test -d /etc/conf/kconfig.d &&
4640                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4641                 then
4642                         dflt="$dflt -posix"
4643                 fi
4644                 ;;
4645         esac
4646         case "$gccversion" in
4647         1*) ;;
4648         2.[0-8]*) ;;
4649         ?*)     echo " "
4650                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4651                 echo 'int main(void) { return 0; }' > gcctest.c
4652                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4653                         echo "Yes, it does." 2>&1
4654                         case "$ccflags" in
4655                         *strict-aliasing*) 
4656                                 echo "Leaving current flags $ccflags alone." 2>&1
4657                                 ;;
4658                         *) dflt="$dflt -fno-strict-aliasing" ;;
4659                         esac
4660                 else
4661                         echo "Nope, it doesn't, but that's ok." 2>&1
4662                 fi
4663                 ;;
4664         esac
4665         ;;
4666 esac
4667
4668 case "$mips_type" in
4669 *BSD*|'') inclwanted="$locincpth $usrinc";;
4670 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4671 esac
4672 for thisincl in $inclwanted; do
4673         if $test -d $thisincl; then
4674                 if $test x$thisincl != x$usrinc; then
4675                         case "$dflt" in
4676                         *" -I$thisincl "*);;
4677                         *) dflt="$dflt -I$thisincl ";;
4678                         esac
4679                 fi
4680         fi
4681 done
4682
4683 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4684         xxx=true;
4685 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4686         xxx=true;
4687 else
4688         xxx=false;
4689 fi;
4690 if $xxx; then
4691         case "$dflt" in
4692         *$2*);;
4693         *) dflt="$dflt -D$2";;
4694         esac;
4695 fi'
4696
4697 set signal.h LANGUAGE_C; eval $inctest
4698
4699 case "$usesocks" in
4700 $define)
4701         ccflags="$ccflags -DSOCKS"
4702         ;;
4703 esac
4704
4705 case "$hint" in
4706 default|recommended) dflt="$ccflags $dflt" ;;
4707 *) dflt="$ccflags";;
4708 esac
4709
4710 case "$dflt" in
4711 ''|' ') dflt=none;;
4712 esac
4713
4714 $cat <<EOH
4715
4716 Your C compiler may want other flags.  For this question you should include
4717 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4718 but you should NOT include libraries or ld flags like -lwhatever.  If you
4719 want $package to honor its debug switch, you should include -DDEBUGGING here.
4720 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4721
4722 To use no flags, specify the word "none".
4723
4724 EOH
4725 set X $dflt
4726 shift
4727 dflt=${1+"$@"}
4728 rp="Any additional cc flags?"
4729 . ./myread
4730 case "$ans" in
4731 none) ccflags='';;
4732 *) ccflags="$ans";;
4733 esac
4734
4735 : the following weeds options from ccflags that are of no interest to cpp
4736 case "$cppflags" in
4737 '') cppflags="$ccflags" ;;
4738 *)  cppflags="$cppflags $ccflags" ;;
4739 esac
4740 case "$gccversion" in
4741 1*) cppflags="$cppflags -D__GNUC__"
4742 esac
4743 case "$mips_type" in
4744 '');;
4745 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4746 esac
4747 case "$cppflags" in
4748 '');;
4749 *)
4750         echo " "
4751         echo "Let me guess what the preprocessor flags are..." >&4
4752         set X $cppflags
4753         shift
4754         cppflags=''
4755         $cat >cpp.c <<'EOM'
4756 #define BLURFL foo
4757
4758 BLURFL xx LFRULB
4759 EOM
4760         previous=''
4761         for flag in $*
4762         do
4763                 case "$flag" in
4764                 -*) ftry="$flag";;
4765                 *) ftry="$previous $flag";;
4766                 esac
4767                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4768                         >cpp1.out 2>/dev/null && \
4769                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4770                         >cpp2.out 2>/dev/null && \
4771                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4772                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4773                 then
4774                         cppflags="$cppflags $ftry"
4775                         previous=''
4776                 else
4777                         previous="$flag"
4778                 fi
4779         done
4780         set X $cppflags
4781         shift
4782         cppflags=${1+"$@"}
4783         case "$cppflags" in
4784         *-*)  echo "They appear to be: $cppflags";;
4785         esac
4786         $rm -f cpp.c cpp?.out
4787         ;;
4788 esac
4789
4790 : flags used in final linking phase
4791 case "$ldflags" in
4792 '') if ./venix; then
4793                 dflt='-i -z'
4794         else
4795                 dflt=''
4796         fi
4797         case "$ccflags" in
4798         *-posix*) dflt="$dflt -posix" ;;
4799         esac
4800         ;;
4801 *) dflt="$ldflags";;
4802 esac
4803
4804 : Try to guess additional flags to pick up local libraries.
4805 for thislibdir in $libpth; do
4806         case " $loclibpth " in
4807         *" $thislibdir "*)
4808                 case "$dflt " in 
4809                 *"-L$thislibdir "*) ;;
4810                 *)  dflt="$dflt -L$thislibdir" ;;
4811                 esac
4812                 ;;
4813         esac
4814 done
4815
4816 case "$dflt" in
4817 '') dflt='none' ;;
4818 esac
4819
4820 $cat <<EOH
4821
4822 Your C linker may need flags.  For this question you should
4823 include -L/whatever and any other flags used by the C linker, but you
4824 should NOT include libraries like -lwhatever.
4825
4826 Make sure you include the appropriate -L/path flags if your C linker
4827 does not normally search all of the directories you specified above,
4828 namely
4829         $libpth
4830 To use no flags, specify the word "none".
4831
4832 EOH
4833
4834 rp="Any additional ld flags (NOT including libraries)?"
4835 . ./myread
4836 case "$ans" in
4837 none) ldflags='';;
4838 *) ldflags="$ans";;
4839 esac
4840 rmlist="$rmlist pdp11"
4841
4842 : coherency check
4843 echo " "
4844 echo "Checking your choice of C compiler and flags for coherency..." >&4
4845 $cat > try.c <<'EOF'
4846 #include <stdio.h>
4847 int main() { printf("Ok\n"); exit(0); }
4848 EOF
4849 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4850 shift
4851 $cat >try.msg <<'EOM'
4852 I've tried to compile and run the following simple program:
4853
4854 EOM
4855 $cat try.c >> try.msg
4856
4857 $cat >> try.msg <<EOM
4858
4859 I used the command:
4860
4861         $*
4862         $run ./try
4863
4864 and I got the following output:
4865
4866 EOM
4867 dflt=y
4868 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4869         if $sh -c "$run ./try" >>try.msg 2>&1; then
4870                 xxx=`$run ./try`
4871                 case "$xxx" in
4872                 "Ok") dflt=n ;;
4873                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4874                         case " $libs " in
4875                         *" -lsfio "*)
4876                                 cat >> try.msg <<'EOQS'
4877 If $libs contains -lsfio, and sfio is mis-configured, then it
4878 sometimes (apparently) runs and exits with a 0 status, but with no
4879 output!  It may have to do with sfio's use of _exit vs. exit.
4880
4881 EOQS
4882                                 rp="You have a big problem.  Shall I abort Configure"
4883                                 dflt=y
4884                                 ;;
4885                         esac
4886                         ;;
4887                 esac
4888         else
4889                 echo "The program compiled OK, but exited with status $?." >>try.msg
4890                 rp="You have a problem.  Shall I abort Configure"
4891                 dflt=y
4892         fi
4893 else
4894         echo "I can't compile the test program." >>try.msg
4895         rp="You have a BIG problem.  Shall I abort Configure"
4896         dflt=y
4897 fi
4898 case "$dflt" in
4899 y)
4900         $cat try.msg >&4
4901         case "$knowitall" in
4902         '')
4903                 echo "(The supplied flags or libraries might be incorrect.)"
4904                 ;;
4905         *) dflt=n;;
4906         esac
4907         echo " "
4908         . ./myread
4909         case "$ans" in
4910         n*|N*) ;;
4911         *)      echo "Ok.  Stopping Configure." >&4
4912                 exit 1
4913                 ;;
4914         esac
4915         ;;
4916 n) echo "OK, that should do.";;
4917 esac
4918 $rm -f try try.* core
4919
4920 : define a shorthand compile call
4921 compile='
4922 mc_file=$1;
4923 shift;
4924 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4925 : define a shorthand compile call for compilations that should be ok.
4926 compile_ok='
4927 mc_file=$1;
4928 shift;
4929 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4930
4931 : check for lengths of integral types
4932 echo " "
4933 case "$intsize" in
4934 '')
4935         echo "Checking to see how big your integers are..." >&4
4936         $cat >try.c <<'EOCP'
4937 #include <stdio.h>
4938 int main()
4939 {
4940         printf("intsize=%d;\n", (int)sizeof(int));
4941         printf("longsize=%d;\n", (int)sizeof(long));
4942         printf("shortsize=%d;\n", (int)sizeof(short));
4943         exit(0);
4944 }
4945 EOCP
4946         set try
4947         if eval $compile_ok && $run ./try > /dev/null; then
4948                 eval `$run ./try`
4949                 echo "Your integers are $intsize bytes long."
4950                 echo "Your long integers are $longsize bytes long."
4951                 echo "Your short integers are $shortsize bytes long."
4952         else
4953                 $cat >&4 <<EOM
4954 !
4955 Help! I can't compile and run the intsize test program: please enlighten me!
4956 (This is probably a misconfiguration in your system or libraries, and
4957 you really ought to fix it.  Still, I'll try anyway.)
4958 !
4959 EOM
4960                 dflt=4
4961                 rp="What is the size of an integer (in bytes)?"
4962                 . ./myread
4963                 intsize="$ans"
4964                 dflt=$intsize
4965                 rp="What is the size of a long integer (in bytes)?"
4966                 . ./myread
4967                 longsize="$ans"
4968                 dflt=2
4969                 rp="What is the size of a short integer (in bytes)?"
4970                 . ./myread
4971                 shortsize="$ans"
4972         fi
4973         ;;
4974 esac
4975 $rm -f try try.*
4976
4977 : check for long long
4978 echo " "
4979 echo "Checking to see if you have long long..." >&4
4980 echo 'int main() { long long x = 7; return 0; }' > try.c
4981 set try
4982 if eval $compile; then
4983         val="$define"
4984         echo "You have long long."
4985 else
4986         val="$undef"
4987         echo "You do not have long long."
4988 fi
4989 $rm try.*
4990 set d_longlong
4991 eval $setvar
4992
4993 : check for length of long long
4994 case "${d_longlong}${longlongsize}" in
4995 $define)
4996         echo " "
4997         echo "Checking to see how big your long longs are..." >&4
4998         $cat >try.c <<'EOCP'
4999 #include <stdio.h>
5000 int main()
5001 {
5002     printf("%d\n", (int)sizeof(long long));
5003     return(0);
5004 }
5005 EOCP
5006         set try
5007         if eval $compile_ok; then
5008                 longlongsize=`$run ./try`
5009                 echo "Your long longs are $longlongsize bytes long."
5010         else
5011                 dflt='8'
5012                 echo " "
5013                 echo "(I can't seem to compile the test program.  Guessing...)"
5014                 rp="What is the size of a long long (in bytes)?"
5015                 . ./myread
5016                 longlongsize="$ans"
5017         fi
5018         if $test "X$longsize" = "X$longlongsize"; then
5019                 echo "(That isn't any different from an ordinary long.)"
5020         fi      
5021         ;;
5022 esac
5023 $rm -f try.* try
5024
5025 : determine filename position in cpp output
5026 echo " "
5027 echo "Computing filename position in cpp output for #include directives..." >&4
5028 case "$osname" in
5029 vos) testaccess=-e ;;
5030 *)   testaccess=-r ;;
5031 esac
5032 echo '#include <stdio.h>' > foo.c
5033 $cat >fieldn <<EOF
5034 $startsh
5035 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5036 $grep '^[       ]*#.*stdio\.h' | \
5037 while read cline; do
5038         pos=1
5039         set \$cline
5040         while $test \$# -gt 0; do
5041                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5042                         echo "\$pos"
5043                         exit 0
5044                 fi
5045                 shift
5046                 pos=\`expr \$pos + 1\`
5047         done
5048 done
5049 EOF
5050 chmod +x fieldn
5051 fieldn=`./fieldn`
5052 $rm -f foo.c fieldn
5053 case $fieldn in
5054 '') pos='???';;
5055 1) pos=first;;
5056 2) pos=second;;
5057 3) pos=third;;
5058 *) pos="${fieldn}th";;
5059 esac
5060 echo "Your cpp writes the filename in the $pos field of the line."
5061
5062 case "$osname" in
5063 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5064 *)   cppfilter='' ;;
5065 esac
5066 : locate header file
5067 $cat >findhdr <<EOF
5068 $startsh
5069 wanted=\$1
5070 name=''
5071 for usrincdir in $usrinc
5072 do
5073         if test -f \$usrincdir/\$wanted; then
5074                 echo "\$usrincdir/\$wanted"
5075                 exit 0
5076         fi
5077 done
5078 awkprg='{ print \$$fieldn }'
5079 echo "#include <\$wanted>" > foo\$\$.c
5080 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5081 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5082 while read cline; do
5083         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5084         case "\$name" in
5085         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5086         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5087         *) exit 2;;
5088         esac;
5089 done;
5090 #
5091 # status = 0: grep returned 0 lines, case statement not executed
5092 # status = 1: headerfile found
5093 # status = 2: while loop executed, no headerfile found
5094 #
5095 status=\$?
5096 $rm -f foo\$\$.c;
5097 if test \$status -eq 1; then
5098         exit 0;
5099 fi
5100 exit 1
5101 EOF
5102 chmod +x findhdr
5103
5104 : define an alternate in-header-list? function
5105 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5106 cont=true; xxf="echo \"<\$1> found.\" >&4";
5107 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5108 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5109 esac;
5110 case $# in 4) instead=instead;; *) instead="at last";; esac;
5111 while $test "$cont"; do
5112         xxx=`./findhdr $1`
5113         var=$2; eval "was=\$$2";
5114         if $test "$xxx" && $test -r "$xxx";
5115         then eval $xxf;
5116         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5117                 cont="";
5118         else eval $xxnf;
5119         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5120         set $yyy; shift; shift; yyy=$@;
5121         case $# in 0) cont="";;
5122         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5123                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5124         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5125                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5126         esac;
5127 done;
5128 while $test "$yyy";
5129 do set $yyy; var=$2; eval "was=\$$2";
5130         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5131         set $yyy; shift; shift; yyy=$@;
5132 done'
5133
5134 : see if inttypes.h is available
5135 : we want a real compile instead of Inhdr because some systems
5136 : have an inttypes.h which includes non-existent headers
5137 echo " "
5138 $cat >try.c <<EOCP
5139 #include <inttypes.h>
5140 int main() {
5141         static int32_t foo32 = 0x12345678;
5142 }
5143 EOCP
5144 set try
5145 if eval $compile; then
5146         echo "<inttypes.h> found." >&4
5147         val="$define"
5148 else
5149         echo "<inttypes.h> NOT found." >&4
5150         val="$undef"
5151 fi
5152 $rm -f try.c try
5153 set i_inttypes
5154 eval $setvar
5155
5156 : check for int64_t
5157 echo " "
5158 echo "Checking to see if you have int64_t..." >&4
5159 $cat >try.c <<EOCP
5160 #include <sys/types.h>
5161 #$i_inttypes I_INTTYPES
5162 #ifdef I_INTTYPES
5163 #include <inttypes.h>
5164 #endif
5165 int main() { int64_t x = 7; }
5166 EOCP
5167 set try
5168 if eval $compile; then
5169         val="$define"
5170         echo "You have int64_t."
5171 else
5172         val="$undef"
5173         echo "You do not have int64_t."
5174 fi
5175 $rm -f try try.*
5176 set d_int64_t
5177 eval $setvar
5178
5179
5180 echo " "
5181 echo "Checking which 64-bit integer type we could use..." >&4
5182
5183 case "$intsize" in
5184 8) val=int
5185    set quadtype
5186    eval $setvar
5187    val='"unsigned int"'
5188    set uquadtype
5189    eval $setvar
5190    quadkind=1
5191    ;;
5192 *) case "$longsize" in
5193    8) val=long
5194       set quadtype
5195       eval $setvar
5196       val='"unsigned long"'
5197       set uquadtype
5198       eval $setvar
5199       quadkind=2
5200       ;;
5201    *) case "$d_longlong:$longlongsize" in
5202       define:8)
5203         val='"long long"'
5204         set quadtype
5205         eval $setvar
5206         val='"unsigned long long"'
5207         set uquadtype
5208         eval $setvar
5209         quadkind=3
5210         ;;
5211       *) case "$d_int64_t" in
5212          define)
5213            val=int64_t
5214            set quadtype
5215            eval $setvar
5216            val=uint64_t
5217            set uquadtype
5218            eval $setvar
5219            quadkind=4
5220            ;;
5221          esac
5222          ;;
5223       esac
5224       ;;
5225    esac
5226    ;;
5227 esac
5228
5229 case "$quadtype" in
5230 '')     echo "Alas, no 64-bit integer types in sight." >&4
5231         d_quad="$undef"
5232         ;;
5233 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5234         d_quad="$define"
5235         ;;
5236 esac
5237
5238
5239 case "$uselonglong" in
5240 "$define"|true|[yY]*)
5241         cat <<EOM >&4
5242
5243 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5244 EOM
5245         use64bitint="$define"
5246         ;;
5247 esac                          
5248 case "$use64bits" in
5249 "$define"|true|[yY]*)
5250         cat <<EOM >&4
5251
5252 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5253 EOM
5254         use64bitint="$define"
5255         ;;
5256 esac                          
5257 case "$use64bitints" in
5258 "$define"|true|[yY]*)
5259         cat <<EOM >&4
5260
5261 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5262 EOM
5263         use64bitint="$define"
5264         ;;
5265 esac                          
5266 case "$use64bitsint" in
5267 "$define"|true|[yY]*)
5268         cat <<EOM >&4
5269
5270 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5271 EOM
5272         use64bitint="$define"
5273         ;;
5274 esac                          
5275 case "$uselonglongs" in
5276 "$define"|true|[yY]*)
5277         cat <<EOM >&4
5278
5279 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5280 EOM
5281         use64bitint="$define"
5282         ;;
5283 esac                          
5284 case "$use64bitsall" in
5285 "$define"|true|[yY]*)
5286         cat <<EOM >&4
5287
5288 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5289 EOM
5290         use64bitall="$define"
5291         ;;
5292 esac                          
5293
5294 case "$ccflags" in
5295 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5296 esac
5297 case "$use64bitall" in
5298 "$define"|true|[yY]*) use64bitint="$define" ;;
5299 esac
5300
5301 case "$longsize" in
5302 8) cat <<EOM
5303
5304 You have natively 64-bit long integers.
5305 EOM
5306    val="$define"
5307    ;;
5308 *) case "$use64bitint" in
5309    "$define"|true|[yY]*) dflt='y';;
5310    *) dflt='n';;
5311    esac
5312    case "$d_quad" in
5313    "$define") ;;
5314    *) dflt='n' ;;
5315    esac
5316    cat <<EOM
5317
5318 Perl can be built to take advantage of 64-bit integer types
5319 on some systems.  To do so, Configure can be run with -Duse64bitint.
5320 Choosing this option will most probably introduce binary incompatibilities.
5321
5322 If this doesn't make any sense to you, just accept the default '$dflt'.
5323 (The default has been chosen based on your configuration.)
5324 EOM
5325    rp='Try to use 64-bit integers, if available?'
5326    . ./myread
5327    case "$ans" in
5328    [yY]*) val="$define" ;;
5329    *)     val="$undef"  ;;
5330    esac
5331    ;;
5332 esac
5333 set use64bitint
5334 eval $setvar
5335
5336 case "$use64bitall" in
5337 "$define"|true|[yY]*) dflt='y' ;;
5338 *) case "$longsize" in
5339    8) dflt='y' ;;
5340    *) dflt='n' ;;
5341    esac
5342    ;;
5343 esac    
5344 cat <<EOM
5345
5346 You may also choose to try maximal 64-bitness.  It means using as much
5347 64-bitness as possible on the platform.  This in turn means even more
5348 binary incompatibilities.  On the other hand, your platform may not
5349 have any more 64-bitness available than what you already have chosen.
5350
5351 If this doesn't make any sense to you, just accept the default '$dflt'.
5352 (The default has been chosen based on your configuration.)
5353 EOM
5354 rp='Try to use maximal 64-bit support, if available?'
5355 . ./myread
5356 case "$ans" in
5357 [yY]*) val="$define" ;;
5358 *)     val="$undef"  ;;
5359 esac
5360 set use64bitall
5361 eval $setvar
5362 case "$use64bitall" in
5363 "$define")
5364         case "$use64bitint" in
5365         "$undef")
5366                 cat <<EOM
5367
5368 Since you have chosen a maximally 64-bit build, I'm also turning on
5369 the use of 64-bit integers.
5370 EOM
5371                 use64bitint="$define" ;;
5372         esac
5373         ;;
5374 esac
5375
5376 case "$use64bitint" in
5377 "$define"|true|[yY]*)
5378 : Look for a hint-file generated 'call-back-unit'.  If the
5379 : user has specified that a 64-bit perl is to be built,
5380 : we may need to set or change some other defaults.
5381         if $test -f use64bitint.cbu; then
5382                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5383                 . ./use64bitint.cbu
5384         fi
5385         case "$longsize" in
5386         4) case "$archname64" in
5387            '') archname64=64int ;;
5388            esac
5389            ;;
5390         esac
5391         ;;
5392 esac
5393
5394 case "$use64bitall" in
5395 "$define"|true|[yY]*)
5396 : Look for a hint-file generated 'call-back-unit'.  If the
5397 : user has specified that a maximally 64-bit perl is to be built,
5398 : we may need to set or change some other defaults.
5399         if $test -f use64bitall.cbu; then
5400                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5401                 . ./use64bitall.cbu
5402         fi
5403         case "$longsize" in
5404         4) case "$archname64" in
5405            ''|64int) archname64=64all ;;
5406            esac
5407            ;;
5408         esac
5409         ;;
5410 esac
5411
5412 echo " "
5413 echo "Checking for GNU C Library..." >&4
5414 cat >try.c <<'EOCP'
5415 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
5416    alone are insufficient to distinguish different versions, such as
5417    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
5418    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
5419 */
5420 #include <stdio.h>
5421 int main(void)
5422 {
5423 #ifdef __GLIBC__
5424 #   ifdef __GLIBC_MINOR__
5425 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
5426 #           include <gnu/libc-version.h>
5427             printf("%s\n",  gnu_get_libc_version());
5428 #       else
5429             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
5430 #       endif
5431 #   else
5432         printf("%d\n",  __GLIBC__);
5433 #   endif
5434     return 0;
5435 #else
5436     return 1;
5437 #endif
5438 }
5439 EOCP
5440 set try
5441 if eval $compile_ok && $run ./try > glibc.ver; then
5442         val="$define"
5443         gnulibc_version=`$cat glibc.ver`
5444         echo "You are using the GNU C Library version $gnulibc_version"
5445 else
5446         val="$undef"
5447         gnulibc_version=''
5448         echo "You are not using the GNU C Library"
5449 fi
5450 $rm -f try try.* glibc.ver
5451 set d_gnulibc
5452 eval $setvar
5453
5454 : see if nm is to be used to determine whether a symbol is defined or not
5455 case "$usenm" in
5456 '')
5457         dflt=''
5458         case "$d_gnulibc" in
5459         "$define")
5460                 echo " "
5461                 echo "nm probably won't work on the GNU C Library." >&4
5462                 dflt=n
5463                 ;;
5464         esac
5465         case "$dflt" in
5466         '') 
5467                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
5468                         echo " "
5469                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5470                         echo "'nm' won't be sufficient on this sytem." >&4
5471                         dflt=n
5472                 fi
5473                 ;;
5474         esac
5475         case "$dflt" in
5476         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5477                 if $test $dflt -gt 20; then
5478                         dflt=y
5479                 else
5480                         dflt=n
5481                 fi
5482                 ;;
5483         esac
5484         ;;
5485 *)
5486         case "$usenm" in
5487         true|$define) dflt=y;;
5488         *) dflt=n;;
5489         esac
5490         ;;
5491 esac
5492 $cat <<EOM
5493
5494 I can use $nm to extract the symbols from your C libraries. This
5495 is a time consuming task which may generate huge output on the disk (up
5496 to 3 megabytes) but that should make the symbols extraction faster. The
5497 alternative is to skip the 'nm' extraction part and to compile a small
5498 test program instead to determine whether each symbol is present. If
5499 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5500 this may be the best solution.
5501
5502 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5503
5504 EOM
5505 rp="Shall I use $nm to extract C symbols from the libraries?"
5506 . ./myread
5507 case "$ans" in
5508 [Nn]*) usenm=false;;
5509 *) usenm=true;;
5510 esac
5511
5512 runnm=$usenm
5513 case "$reuseval" in
5514 true) runnm=false;;
5515 esac
5516
5517 : nm options which may be necessary
5518 case "$nm_opt" in
5519 '') if $test -f /mach_boot; then
5520                 nm_opt=''       # Mach
5521         elif $test -d /usr/ccs/lib; then
5522                 nm_opt='-p'     # Solaris (and SunOS?)
5523         elif $test -f /dgux; then
5524                 nm_opt='-p'     # DG-UX
5525         elif $test -f /lib64/rld; then
5526                 nm_opt='-p'     # 64-bit Irix
5527         else
5528                 nm_opt=''
5529         fi;;
5530 esac
5531
5532 : nm options which may be necessary for shared libraries but illegal
5533 : for archive libraries.  Thank you, Linux.
5534 case "$nm_so_opt" in
5535 '')     case "$myuname" in
5536         *linux*)
5537                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5538                         nm_so_opt='--dynamic'
5539                 fi
5540                 ;;
5541         esac
5542         ;;
5543 esac
5544
5545 case "$runnm" in
5546 true)
5547 : get list of predefined functions in a handy place
5548 echo " "
5549 case "$libc" in
5550 '') libc=unknown
5551         case "$libs" in
5552         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5553         esac
5554         ;;
5555 esac
5556 case "$libs" in
5557 '') ;;
5558 *)  for thislib in $libs; do
5559         case "$thislib" in
5560         -lc|-lc_s)
5561                 : Handle C library specially below.
5562                 ;;
5563         -l*)
5564                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5565                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5566                         :
5567                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5568                         :
5569                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5570                         :
5571                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5572                         :
5573                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5574                         :
5575                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5576                         :
5577                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5578                         :
5579                 else
5580                         try=''
5581                 fi
5582                 libnames="$libnames $try"
5583                 ;;
5584         *) libnames="$libnames $thislib" ;;
5585         esac
5586         done
5587         ;;
5588 esac
5589 xxx=normal
5590 case "$libc" in
5591 unknown)
5592         set /lib/libc.$so
5593         for xxx in $libpth; do
5594                 $test -r $1 || set $xxx/libc.$so
5595                 : The messy sed command sorts on library version numbers.
5596                 $test -r $1 || \
5597                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5598                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5599                                 h
5600                                 s/[0-9][0-9]*/0000&/g
5601                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5602                                 G
5603                                 s/\n/ /' | \
5604                          $sort | $sed -e 's/^.* //'`
5605                 eval set \$$#
5606         done
5607         $test -r $1 || set /usr/ccs/lib/libc.$so
5608         $test -r $1 || set /lib/libsys_s$_a
5609         ;;
5610 *)
5611         set blurfl
5612         ;;
5613 esac
5614 if $test -r "$1"; then
5615         echo "Your (shared) C library seems to be in $1."
5616         libc="$1"
5617 elif $test -r /lib/libc && $test -r /lib/clib; then
5618         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5619         xxx=apollo
5620         libc='/lib/clib /lib/libc'
5621         if $test -r /lib/syslib; then
5622                 echo "(Your math library is in /lib/syslib.)"
5623                 libc="$libc /lib/syslib"
5624         fi
5625 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5626         echo "Your C library seems to be in $libc, as you said before."
5627 elif $test -r $incpath/usr/lib/libc$_a; then
5628         libc=$incpath/usr/lib/libc$_a;
5629         echo "Your C library seems to be in $libc.  That's fine."
5630 elif $test -r /lib/libc$_a; then
5631         libc=/lib/libc$_a;
5632         echo "Your C library seems to be in $libc.  You're normal."
5633 else
5634         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5635                 :
5636         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5637                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5638         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5639                 :
5640         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5641                 :
5642         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5643                 :
5644         else
5645                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5646         fi
5647         if $test -r "$tans"; then
5648                 echo "Your C library seems to be in $tans, of all places."
5649                 libc=$tans
5650         else
5651                 libc='blurfl'
5652         fi
5653 fi
5654 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5655         dflt="$libc"
5656         cat <<EOM
5657
5658 If the guess above is wrong (which it might be if you're using a strange
5659 compiler, or your machine supports multiple models), you can override it here.
5660
5661 EOM
5662 else
5663         dflt=''
5664         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5665         cat >&4 <<EOM
5666 I can't seem to find your C library.  I've looked in the following places:
5667
5668 EOM
5669         $sed 's/^/      /' libpath
5670         cat <<EOM
5671
5672 None of these seems to contain your C library. I need to get its name...
5673
5674 EOM
5675 fi
5676 fn=f
5677 rp='Where is your C library?'
5678 . ./getfile
5679 libc="$ans"
5680
5681 echo " "
5682 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5683 set X `cat libnames`
5684 shift
5685 xxx=files
5686 case $# in 1) xxx=file; esac
5687 echo "Extracting names from the following $xxx for later perusal:" >&4
5688 echo " "
5689 $sed 's/^/      /' libnames >&4
5690 echo " "
5691 $echo $n "This may take a while...$c" >&4
5692
5693 for file in $*; do
5694         case $file in
5695         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5696         *) $nm $nm_opt $file 2>/dev/null;;
5697         esac
5698 done >libc.tmp
5699
5700 $echo $n ".$c"
5701 $grep fprintf libc.tmp > libc.ptf
5702 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5703 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
5704 xxx='[ADTSIW]'
5705 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5706         eval $xscan;\
5707         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5708                 eval $xrun
5709 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5710         eval $xscan;\
5711         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5712                 eval $xrun
5713 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5714         eval $xscan;\
5715         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5716                 eval $xrun
5717 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5718         eval $xscan;\
5719         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5720                 eval $xrun
5721 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5722         eval $xscan;\
5723         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5724                 eval $xrun
5725 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5726         eval $xscan;\
5727         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5728                 eval $xrun
5729 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5730                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5731         eval $xscan;\
5732         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5733                 eval $xrun
5734 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5735         eval $xscan;\
5736         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5737                 eval $xrun
5738 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5739         eval $xscan;\
5740         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5741                 eval $xrun
5742 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5743         eval $xscan;\
5744         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5745                 eval $xrun
5746 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5747         eval $xscan;\
5748         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5749                 eval $xrun
5750 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5751         eval $xscan;\
5752         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5753                 eval $xrun
5754 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5755         eval $xscan;\
5756         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5757                 eval $xrun
5758 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5759         eval $xscan;\
5760         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5761                 eval $xrun
5762 else
5763         $nm -p $* 2>/dev/null >libc.tmp
5764         $grep fprintf libc.tmp > libc.ptf
5765         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5766                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5767         then
5768                 nm_opt='-p'
5769                 eval $xrun
5770         else
5771                 echo " "
5772                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5773                 com=''
5774                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5775                         for thisname in $libnames $libc; do
5776                                 $ar t $thisname >>libc.tmp
5777                         done
5778                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5779                         echo "Ok." >&4
5780                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5781                         # Repeat libc to extract forwarders to DLL entries too
5782                         for thisname in $libnames $libc; do
5783                                 $ar tv $thisname >>libc.tmp
5784                                 # Revision 50 of EMX has bug in $ar.
5785                                 # it will not extract forwarders to DLL entries
5786                                 # Use emximp which will extract exactly them.
5787                                 emximp -o tmp.imp $thisname \
5788                                     2>/dev/null && \
5789                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5790                                     < tmp.imp >>libc.tmp
5791                                 $rm tmp.imp
5792                         done
5793                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5794                         echo "Ok." >&4
5795                 else
5796                         echo "$ar didn't seem to work right." >&4
5797                         echo "Maybe this is a Cray...trying bld instead..." >&4
5798                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5799                         then
5800                                 for thisname in $libnames; do
5801                                         bld t $libnames | \
5802                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5803                                         $ar t $thisname >>libc.tmp
5804                                 done
5805                                 echo "Ok." >&4
5806                         else
5807                                 echo "That didn't work either.  Giving up." >&4
5808                                 exit 1
5809                         fi
5810                 fi
5811         fi
5812 fi
5813 nm_extract="$com"
5814 case "$PASE" in
5815 define)
5816     echo " "
5817     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
5818     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
5819     ;;
5820 *)  if $test -f /lib/syscalls.exp; then
5821         echo " "
5822         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5823         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
5824     fi
5825     ;;
5826 esac
5827 ;;
5828 esac
5829 $rm -f libnames libpath
5830
5831 : is a C symbol defined?
5832 csym='tlook=$1;
5833 case "$3" in
5834 -v) tf=libc.tmp; tc=""; tdc="";;
5835 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5836 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5837 esac;
5838 tx=yes;
5839 case "$reuseval-$4" in
5840 true-) ;;
5841 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5842 esac;
5843 case "$tx" in
5844 yes)
5845         case "$runnm" in
5846         true)
5847                 if $contains $tlook $tf >/dev/null 2>&1;
5848                 then tval=true;
5849                 else tval=false;
5850                 fi;;
5851         *)
5852                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5853                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5854                 then tval=true;
5855                 else tval=false;
5856                 fi;
5857                 $rm -f t t.c;;
5858         esac;;
5859 *)
5860         case "$tval" in
5861         $define) tval=true;;
5862         *) tval=false;;
5863         esac;;
5864 esac;
5865 eval "$2=$tval"'
5866
5867 : define an is-in-libc? function
5868 inlibc='echo " "; td=$define; tu=$undef;
5869 sym=$1; var=$2; eval "was=\$$2";
5870 tx=yes;
5871 case "$reuseval$was" in
5872 true) ;;
5873 true*) tx=no;;
5874 esac;
5875 case "$tx" in
5876 yes)
5877         set $sym tres -f;
5878         eval $csym;
5879         case "$tres" in
5880         true)
5881                 echo "$sym() found." >&4;
5882                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5883         *)
5884                 echo "$sym() NOT found." >&4;
5885                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5886         esac;;
5887 *)
5888         case "$was" in
5889         $define) echo "$sym() found." >&4;;
5890         *) echo "$sym() NOT found." >&4;;
5891         esac;;
5892 esac'
5893
5894 : see if sqrtl exists
5895 set sqrtl d_sqrtl
5896 eval $inlibc
5897
5898 hasproto='varname=$1; func=$2; shift; shift;
5899 while $test $# -ge 2; do
5900         case "$1" in
5901         $define) echo "#include <$2>";;
5902         esac ;
5903     shift 2;
5904 done > try.c;
5905 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
5906 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
5907         echo "$func() prototype found.";
5908         val="$define";
5909 else
5910         echo "$func() prototype NOT found.";
5911         val="$undef";
5912 fi;
5913 set $varname;
5914 eval $setvar;
5915 $rm -f try.c tryout.c'
5916
5917 : check for length of double
5918 echo " "
5919 case "$doublesize" in
5920 '')
5921         echo "Checking to see how big your double precision numbers are..." >&4
5922         $cat >try.c <<'EOCP'
5923 #include <stdio.h>
5924 int main()
5925 {
5926     printf("%d\n", (int)sizeof(double));
5927     exit(0);
5928 }
5929 EOCP
5930         set try
5931         if eval $compile_ok; then
5932                 doublesize=`$run ./try`
5933                 echo "Your double is $doublesize bytes long."
5934         else
5935                 dflt='8'
5936                 echo "(I can't seem to compile the test program.  Guessing...)"
5937                 rp="What is the size of a double precision number (in bytes)?"
5938                 . ./myread
5939                 doublesize="$ans"
5940         fi
5941         ;;
5942 esac
5943 $rm -f try.c try
5944
5945 : check for long doubles
5946 echo " "
5947 echo "Checking to see if you have long double..." >&4
5948 echo 'int main() { long double x = 7.0; }' > try.c
5949 set try
5950 if eval $compile; then
5951         val="$define"
5952         echo "You have long double."
5953 else
5954         val="$undef"
5955         echo "You do not have long double."
5956 fi
5957 $rm try.*
5958 set d_longdbl
5959 eval $setvar
5960
5961 : check for length of long double
5962 case "${d_longdbl}${longdblsize}" in
5963 $define)
5964         echo " "
5965         echo "Checking to see how big your long doubles are..." >&4
5966         $cat >try.c <<'EOCP'
5967 #include <stdio.h>
5968 int main()
5969 {
5970         printf("%d\n", sizeof(long double));
5971 }
5972 EOCP
5973         set try
5974         set try
5975         if eval $compile; then
5976                 longdblsize=`$run ./try`
5977                 echo "Your long doubles are $longdblsize bytes long."
5978         else
5979                 dflt='8'
5980                 echo " "
5981                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5982                 rp="What is the size of a long double (in bytes)?"
5983                 . ./myread
5984                 longdblsize="$ans"
5985         fi
5986         if $test "X$doublesize" = "X$longdblsize"; then
5987                 echo "(That isn't any different from an ordinary double.)"
5988         fi      
5989         ;;
5990 esac
5991 $rm -f try.* try
5992
5993 echo " "
5994
5995 if $test X"$d_longdbl" = X"$define"; then
5996
5997 echo "Checking how to print long doubles..." >&4
5998
5999 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
6000         $cat >try.c <<'EOCP'
6001 #include <sys/types.h>
6002 #include <stdio.h>
6003 int main() {
6004   double d = 123.456;
6005   printf("%.3f\n", d);
6006 }
6007 EOCP
6008         set try
6009         if eval $compile; then
6010                 yyy=`$run ./try`
6011                 case "$yyy" in
6012                 123.456)
6013                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
6014                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
6015                         echo "We will use %f."
6016                         ;;
6017                 esac
6018         fi
6019 fi
6020
6021 if $test X"$sPRIfldbl" = X; then
6022         $cat >try.c <<'EOCP'
6023 #include <sys/types.h>
6024 #include <stdio.h>
6025 int main() {
6026   long double d = 123.456;
6027   printf("%.3Lf\n", d);
6028 }
6029 EOCP
6030         set try
6031         if eval $compile; then
6032                 yyy=`$run ./try`
6033                 case "$yyy" in
6034                 123.456)
6035                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
6036                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
6037                         echo "We will use %Lf."
6038                         ;;
6039                 esac
6040         fi
6041 fi
6042
6043 if $test X"$sPRIfldbl" = X; then
6044         $cat >try.c <<'EOCP'
6045 #include <sys/types.h>
6046 #include <stdio.h>
6047 int main() {
6048   long double d = 123.456;
6049   printf("%.3llf\n", d);
6050 }
6051 EOCP
6052         set try
6053         if eval $compile; then
6054                 yyy=`$run ./try`
6055                 case "$yyy" in
6056                 123.456)
6057                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
6058                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
6059                         echo "We will use %llf."
6060                         ;;
6061                 esac
6062         fi
6063 fi
6064
6065 if $test X"$sPRIfldbl" = X; then
6066         $cat >try.c <<'EOCP'
6067 #include <sys/types.h>
6068 #include <stdio.h>
6069 int main() {
6070   long double d = 123.456;
6071   printf("%.3lf\n", d);
6072 }
6073 EOCP
6074         set try
6075         if eval $compile; then
6076                 yyy=`$run ./try`
6077                 case "$yyy" in
6078                 123.456)
6079                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
6080                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
6081                         echo "We will use %lf."
6082                         ;;
6083                 esac
6084         fi
6085 fi
6086
6087 if $test X"$sPRIfldbl" = X; then
6088         echo "Cannot figure out how to print long doubles." >&4
6089 else
6090         sSCNfldbl=$sPRIfldbl    # expect consistency
6091 fi
6092
6093 $rm -f try try.*
6094
6095 fi # d_longdbl
6096
6097 case "$sPRIfldbl" in
6098 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
6099         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
6100         d_SCNfldbl="$undef";
6101         ;;
6102 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
6103         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
6104         d_SCNfldbl="$define";
6105         ;;
6106 esac
6107
6108 : see if modfl exists
6109 set modfl d_modfl
6110 eval $inlibc
6111
6112 : see if prototype for modfl is available
6113 echo " "
6114 set d_modflproto modfl math.h
6115 eval $hasproto
6116
6117 d_modfl_pow32_bug="$undef"
6118
6119 case "$d_longdbl$d_modfl" in
6120 $define$define)
6121         $cat <<EOM
6122 Checking to see whether your modfl() is okay for large values...
6123 EOM
6124 $cat >try.c <<EOCP
6125 #include <math.h> 
6126 #include <stdio.h>
6127 EOCP
6128 if $test "X$d_modflproto" != "X$define"; then
6129         $cat >>try.c <<EOCP
6130 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
6131 long double modfl (long double, long double *);
6132 EOCP
6133 fi
6134 $cat >>try.c <<EOCP
6135 int main() {
6136     long double nv = 4294967303.15;
6137     long double v, w;
6138     v = modfl(nv, &w);         
6139 #ifdef __GLIBC__
6140     printf("glibc");
6141 #endif
6142     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
6143     return 0;
6144 }
6145 EOCP
6146         case "$osname:$gccversion" in
6147         aix:)   saveccflags="$ccflags"
6148                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
6149         esac
6150         set try
6151         if eval $compile; then
6152                 foo=`$run ./try`
6153                 case "$foo" in
6154                 *" 4294967303.150000 1.150000 4294967302.000000")
6155                         echo >&4 "Your modfl() is broken for large values."
6156                         d_modfl_pow32_bug="$define"
6157                         case "$foo" in
6158                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
6159                         ;;
6160                         esac
6161                         ;;
6162                 *" 4294967303.150000 0.150000 4294967303.000000")
6163                         echo >&4 "Your modfl() seems okay for large values."
6164                         ;;
6165                 *)      echo >&4 "I don't understand your modfl() at all."
6166                         d_modfl="$undef"
6167                         ;;
6168                 esac
6169                 $rm -f try.* try core core.try.*
6170         else
6171                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
6172                 d_modfl="$undef"
6173         fi
6174         case "$osname:$gccversion" in
6175         aix:)   ccflags="$saveccflags" ;; # restore
6176         esac
6177         ;;
6178 esac
6179
6180 case "$ccflags" in
6181 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6182 esac
6183
6184 case "$uselongdouble" in
6185 $define|true|[yY]*)     dflt='y';;
6186 *) dflt='n';;
6187 esac
6188 cat <<EOM
6189
6190 Perl can be built to take advantage of long doubles which
6191 (if available) may give more accuracy and range for floating point numbers.
6192
6193 If this doesn't make any sense to you, just accept the default '$dflt'.
6194 EOM
6195 rp='Try to use long doubles if available?'
6196 . ./myread
6197 case "$ans" in
6198 y|Y)    val="$define"   ;;
6199 *)      val="$undef"    ;;
6200 esac
6201 set uselongdouble
6202 eval $setvar
6203
6204 case "$uselongdouble" in
6205 true|[yY]*) uselongdouble="$define" ;;
6206 esac
6207
6208 case "$uselongdouble" in
6209 $define)
6210 : Look for a hint-file generated 'call-back-unit'.  If the
6211 : user has specified that long doubles should be used,
6212 : we may need to set or change some other defaults.
6213         if $test -f uselongdouble.cbu; then
6214                 echo "Your platform has some specific hints for long doubles, using them..."
6215                 . ./uselongdouble.cbu
6216         else
6217                 $cat <<EOM
6218 (Your platform doesn't have any specific hints for long doubles.)
6219 EOM
6220         fi
6221         ;;
6222 esac
6223
6224 message=X
6225 case "$uselongdouble:$d_sqrtl:$d_modfl" in
6226 $define:$define:$define)
6227         : You have both
6228         ;;
6229 $define:$define:$undef)
6230         message="I could not find modfl"
6231         ;;
6232 $define:$undef:$define)
6233         message="I could not find sqrtl"
6234         ;;
6235 $define:$undef:$undef)
6236         message="I found neither sqrtl nor modfl"
6237         ;;
6238 esac
6239
6240 if $test "$message" != X; then
6241         $cat <<EOM >&4
6242
6243 *** You requested the use of long doubles but you do not seem to have
6244 *** the mathematic functions for long doubles.
6245 *** ($message)
6246 *** I'm disabling the use of long doubles.
6247
6248 EOM
6249
6250         uselongdouble=$undef
6251 fi
6252
6253 : determine the architecture name
6254 echo " "
6255 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6256         tarch=`arch`"-$osname"
6257 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6258         if uname -m > tmparch 2>&1 ; then
6259                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6260                         -e 's/$/'"-$osname/" tmparch`
6261         else
6262                 tarch="$osname"
6263         fi
6264         $rm -f tmparch
6265 else
6266         tarch="$osname"
6267 fi
6268 case "$myarchname" in
6269 ''|"$tarch") ;;
6270 *)
6271         echo "(Your architecture name used to be $myarchname.)"
6272         archname=''
6273         ;;
6274 esac
6275 case "$targetarch" in
6276 '') ;;
6277 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6278 esac
6279 myarchname="$tarch"
6280 case "$archname" in
6281 '') dflt="$tarch";;
6282 *) dflt="$archname";;
6283 esac
6284 rp='What is your architecture name'
6285 . ./myread
6286 archname="$ans"
6287 case "$usethreads" in
6288 $define)
6289         echo "Threads selected." >&4
6290         case "$archname" in
6291         *-thread*) echo "...and architecture name already has -thread." >&4
6292                 ;;
6293         *)      archname="$archname-thread"
6294                 echo "...setting architecture name to $archname." >&4
6295                 ;;
6296         esac
6297         ;;
6298 esac
6299 case "$usemultiplicity" in
6300 $define)
6301         echo "Multiplicity selected." >&4
6302         case "$archname" in
6303         *-multi*) echo "...and architecture name already has -multi." >&4
6304                 ;;
6305         *)      archname="$archname-multi"
6306                 echo "...setting architecture name to $archname." >&4
6307                 ;;
6308         esac
6309         ;;
6310 esac
6311 case "$use64bitint$use64bitall" in
6312 *"$define"*)
6313         case "$archname64" in
6314         '')
6315                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6316                 ;;
6317         *)
6318                 case "$use64bitint" in
6319                 "$define") echo "64 bit integers selected." >&4 ;;
6320                 esac
6321                 case "$use64bitall" in
6322                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6323                 esac
6324                 case "$archname" in
6325                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6326                         ;;
6327                 *)      archname="$archname-$archname64"
6328                         echo "...setting architecture name to $archname." >&4
6329                         ;;
6330                 esac
6331                 ;;
6332         esac
6333 esac
6334 case "$uselongdouble" in
6335 $define)
6336         echo "Long doubles selected." >&4
6337         case "$longdblsize" in
6338         $doublesize)
6339                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6340                 ;;
6341         *)
6342                 case "$archname" in
6343                 *-ld*) echo "...and architecture name already has -ld." >&4
6344                         ;;
6345                 *)      archname="$archname-ld"
6346                         echo "...setting architecture name to $archname." >&4
6347                         ;;
6348                 esac
6349                 ;;
6350         esac
6351         ;;
6352 esac
6353 case "$useperlio" in
6354 $define)
6355         echo "Perlio selected." >&4
6356         ;;
6357 *)
6358         echo "Perlio not selected, using stdio." >&4
6359         case "$archname" in
6360         *-stdio*) echo "...and architecture name already has -stdio." >&4
6361                 ;;
6362         *)      archname="$archname-stdio"
6363                 echo "...setting architecture name to $archname." >&4
6364                 ;;
6365         esac
6366         ;;
6367 esac
6368
6369 : determine root of directory hierarchy where package will be installed.
6370 case "$prefix" in
6371 '')
6372         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
6373         ;;
6374 *?/)
6375         dflt=`echo "$prefix" | sed 's/.$//'`
6376         ;;
6377 *)
6378         dflt="$prefix"
6379         ;;
6380 esac
6381 $cat <<EOM
6382
6383 By default, $package will be installed in $dflt/bin, manual pages
6384 under $dflt/man, etc..., i.e. with $dflt as prefix for all
6385 installation directories. Typically this is something like /usr/local.
6386 If you wish to have binaries under /usr/bin but other parts of the
6387 installation under /usr/local, that's ok: you will be prompted
6388 separately for each of the installation directories, the prefix being
6389 only used to set the defaults.
6390
6391 EOM
6392 fn=d~
6393 rp='Installation prefix to use?'
6394 . ./getfile
6395 oldprefix=''
6396 case "$prefix" in
6397 '') ;;
6398 *)
6399         case "$ans" in
6400         "$prefix") ;;
6401         *) oldprefix="$prefix";;
6402         esac
6403         ;;
6404 esac
6405 prefix="$ans"
6406 prefixexp="$ansexp"
6407
6408 case "$afsroot" in
6409 '')     afsroot=/afs ;;
6410 *)      afsroot=$afsroot ;;
6411 esac
6412
6413 : is AFS running?
6414 echo " "
6415 case "$afs" in
6416 $define|true)   afs=true ;;
6417 $undef|false)   afs=false ;;
6418 *)      if test -d $afsroot; then
6419                 afs=true
6420         else
6421                 afs=false
6422         fi
6423         ;;
6424 esac
6425 if $afs; then
6426         echo "AFS may be running... I'll be extra cautious then..." >&4
6427 else
6428         echo "AFS does not seem to be running..." >&4
6429 fi
6430
6431 : determine installation prefix for where package is to be installed.
6432 if $afs; then 
6433 $cat <<EOM
6434
6435 Since you are running AFS, I need to distinguish the directory in which
6436 files will reside from the directory in which they are installed (and from
6437 which they are presumably copied to the former directory by occult means).
6438
6439 EOM
6440         case "$installprefix" in
6441         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6442         *) dflt="$installprefix";;
6443         esac
6444 else
6445 $cat <<EOM
6446
6447 In some special cases, particularly when building $package for distribution,
6448 it is convenient to distinguish the directory in which files should be
6449 installed from the directory ($prefix) in which they will
6450 eventually reside.  For most users, these two directories are the same.
6451
6452 EOM
6453         case "$installprefix" in
6454         '') dflt=$prefix ;;
6455         *) dflt=$installprefix;;
6456         esac
6457 fi
6458 fn=d~
6459 rp='What installation prefix should I use for installing files?'
6460 . ./getfile
6461 installprefix="$ans"
6462 installprefixexp="$ansexp"
6463
6464 : set the prefixit variable, to compute a suitable default value
6465 prefixit='case "$3" in
6466 ""|none)
6467         case "$oldprefix" in
6468         "") eval "$1=\"\$$2\"";;
6469         *)
6470                 case "$3" in
6471                 "") eval "$1=";;
6472                 none)
6473                         eval "tp=\"\$$2\"";
6474                         case "$tp" in
6475                         ""|" ") eval "$1=\"\$$2\"";;
6476                         *) eval "$1=";;
6477                         esac;;
6478                 esac;;
6479         esac;;
6480 *)
6481         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6482         case "$tp" in
6483         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6484         /*-$oldprefix/*|\~*-$oldprefix/*)
6485                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6486         *) eval "$1=\"\$$2\"";;
6487         esac;;
6488 esac'
6489
6490 : get the patchlevel
6491 echo " "
6492 echo "Getting the current patchlevel..." >&4
6493 if $test -r $rsrc/patchlevel.h;then
6494         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6495         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6496         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6497         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6498         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6499         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6500        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6501 else
6502         revision=0
6503         patchlevel=0
6504         subversion=0
6505         api_revision=0
6506         api_version=0
6507         api_subversion=0
6508         perl_patchlevel=0
6509         $echo "(You do not have patchlevel.h.  Eek.)"
6510 fi
6511 if $test -r $rsrc/.patch ; then  
6512         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6513                 perl_patchlevel=`cat $rsrc/.patch`
6514         fi
6515 fi
6516 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
6517 version_patchlevel_string="version $patchlevel subversion $subversion"
6518 case "$perl_patchlevel" in
6519 0|'') ;;
6520 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
6521 esac
6522
6523 $echo "(You have $package $version_patchlevel_string.)"
6524
6525 case "$osname" in
6526 dos|vms)
6527         : XXX Should be a Configure test for double-dots in filenames.
6528         version=`echo $revision $patchlevel $subversion | \
6529                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6530         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6531                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6532         ;;
6533 *)
6534         version=`echo $revision $patchlevel $subversion | \
6535                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6536         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6537                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6538         ;;
6539 esac
6540 : Special case the 5.005_xx maintenance series, which used 5.005
6541 : without any subversion label as a subdirectory in $sitelib
6542 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6543         api_versionstring='5.005'
6544 fi
6545
6546 : determine installation style
6547 : For now, try to deduce it from prefix unless it is already set.
6548 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6549 case "$installstyle" in
6550 '')     case "$prefix" in
6551                 *perl*) dflt='lib';;
6552                 *) dflt='lib/perl5' ;;
6553         esac
6554         ;;
6555 *)      dflt="$installstyle" ;;
6556 esac
6557 : Probably not worth prompting for this since we prompt for all
6558 : the directories individually, and the prompt would be too long and
6559 : confusing anyway.
6560 installstyle=$dflt
6561
6562 : determine where private library files go
6563 : Usual default is /usr/local/lib/perl5/$version.
6564 : Also allow things like /opt/perl/lib/$version, since 
6565 : /opt/perl/lib/perl5... would be redundant.
6566 : The default "style" setting is made in installstyle.U
6567 case "$installstyle" in
6568 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6569 *)       set dflt privlib lib/$version ;;
6570 esac
6571 eval $prefixit
6572 $cat <<EOM
6573
6574 There are some auxiliary files for $package that need to be put into a
6575 private library directory that is accessible by everyone.
6576
6577 EOM
6578 fn=d~+
6579 rp='Pathname where the private library files will reside?'
6580 . ./getfile
6581 privlib="$ans"
6582 privlibexp="$ansexp"
6583 : Change installation prefix, if necessary.
6584 if $test X"$prefix" != X"$installprefix"; then
6585         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6586 else
6587         installprivlib="$privlibexp"
6588 fi
6589
6590 : set the prefixup variable, to restore leading tilda escape
6591 prefixup='case "$prefixexp" in
6592 "$prefix") ;;
6593 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6594 esac'
6595
6596 : determine where public architecture dependent libraries go
6597 set archlib archlib
6598 eval $prefixit
6599 : privlib default is /usr/local/lib/$package/$version
6600 : archlib default is /usr/local/lib/$package/$version/$archname
6601 : privlib may have an optional trailing /share.
6602 tdflt=`echo $privlib | $sed 's,/share$,,'`
6603 tdflt=$tdflt/$archname
6604 case "$archlib" in
6605 '')     dflt=$tdflt
6606         ;;
6607 *)      dflt="$archlib"
6608     ;;
6609 esac
6610 $cat <<EOM
6611
6612 $spackage contains architecture-dependent library files.  If you are
6613 sharing libraries in a heterogeneous environment, you might store
6614 these files in a separate location.  Otherwise, you can just include
6615 them with the rest of the public library files.
6616
6617 EOM
6618 fn=d+~
6619 rp='Where do you want to put the public architecture-dependent libraries?'
6620 . ./getfile
6621 archlib="$ans"
6622 archlibexp="$ansexp"
6623 if $test X"$archlib" = X"$privlib"; then
6624         d_archlib="$undef"
6625 else
6626         d_archlib="$define"
6627 fi
6628 : Change installation prefix, if necessary.
6629 if $test X"$prefix" != X"$installprefix"; then
6630         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6631 else
6632         installarchlib="$archlibexp"
6633 fi
6634
6635 : see if setuid scripts can be secure
6636 $cat <<EOM
6637
6638 Some kernels have a bug that prevents setuid #! scripts from being
6639 secure.  Some sites have disabled setuid #! scripts because of this.
6640
6641 First let's decide if your kernel supports secure setuid #! scripts.
6642 (If setuid #! scripts would be secure but have been disabled anyway,
6643 don't say that they are secure if asked.)
6644
6645 EOM
6646
6647 val="$undef"
6648 if $test -d /dev/fd; then
6649         echo "#!$ls" >reflect
6650         chmod +x,u+s reflect
6651         ./reflect >flect 2>&1
6652         if $contains "/dev/fd" flect >/dev/null; then
6653                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6654                 val="$define"
6655         else
6656                 $cat <<EOM
6657 If you are not sure if they are secure, I can check but I'll need a
6658 username and password different from the one you are using right now.
6659 If you don't have such a username or don't want me to test, simply
6660 enter 'none'.
6661
6662 EOM
6663                 rp='Other username to test security of setuid scripts with?'
6664                 dflt='none'
6665                 . ./myread
6666                 case "$ans" in
6667                 n|none)
6668                         case "$d_suidsafe" in
6669                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6670                                 dflt=n;;
6671                         "$undef")
6672                                 echo "Well, the $hint value is *not* secure." >&4
6673                                 dflt=n;;
6674                         *)      echo "Well, the $hint value *is* secure." >&4
6675                                 dflt=y;;
6676                         esac
6677                         ;;
6678                 *)
6679                         $rm -f reflect flect
6680                         echo "#!$ls" >reflect
6681                         chmod +x,u+s reflect
6682                         echo >flect
6683                         chmod a+w flect
6684                         echo '"su" will (probably) prompt you for '"$ans's password."
6685                         su $ans -c './reflect >flect'
6686                         if $contains "/dev/fd" flect >/dev/null; then
6687                                 echo "Okay, it looks like setuid scripts are secure." >&4
6688                                 dflt=y
6689                         else
6690                                 echo "I don't think setuid scripts are secure." >&4
6691                                 dflt=n
6692                         fi
6693                         ;;
6694                 esac
6695                 rp='Does your kernel have *secure* setuid scripts?'
6696                 . ./myread
6697                 case "$ans" in
6698                 [yY]*)  val="$define";;
6699                 *)      val="$undef";;
6700                 esac
6701         fi
6702 else
6703         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6704         echo "(That's for file descriptors, not floppy disks.)"
6705         val="$undef"
6706 fi
6707 set d_suidsafe
6708 eval $setvar
6709
6710 $rm -f reflect flect
6711
6712 : now see if they want to do setuid emulation
6713 echo " "
6714 val="$undef"
6715 case "$d_suidsafe" in
6716 "$define")
6717         val="$undef"
6718         echo "No need to emulate SUID scripts since they are secure here." >&4
6719         ;;
6720 *)
6721         $cat <<EOM
6722 Some systems have disabled setuid scripts, especially systems where
6723 setuid scripts cannot be secure.  On systems where setuid scripts have
6724 been disabled, the setuid/setgid bits on scripts are currently
6725 useless.  It is possible for $package to detect those bits and emulate
6726 setuid/setgid in a secure fashion.  This emulation will only work if
6727 setuid scripts have been disabled in your kernel.
6728
6729 EOM
6730         case "$d_dosuid" in
6731         "$define") dflt=y ;;
6732         *) dflt=n ;;
6733         esac
6734         rp="Do you want to do setuid/setgid emulation?"
6735         . ./myread
6736         case "$ans" in
6737         [yY]*)  val="$define";;
6738         *)      val="$undef";;
6739         esac
6740         ;;
6741 esac
6742 set d_dosuid
6743 eval $setvar
6744
6745 : see if this is a malloc.h system
6746 set malloc.h i_malloc
6747 eval $inhdr
6748
6749 : see if stdlib is available
6750 set stdlib.h i_stdlib
6751 eval $inhdr
6752
6753 : check for void type
6754 echo " "
6755 echo "Checking to see how well your C compiler groks the void type..." >&4
6756 case "$voidflags" in
6757 '')
6758         $cat >try.c <<'EOCP'
6759 #if TRY & 1
6760 void sub() {
6761 #else
6762 sub() {
6763 #endif
6764         extern void moo();      /* function returning void */
6765         void (*goo)();          /* ptr to func returning void */
6766 #if TRY & 8
6767         void *hue;              /* generic ptr */
6768 #endif
6769 #if TRY & 2
6770         void (*foo[10])();
6771 #endif
6772
6773 #if TRY & 4
6774         if(goo == moo) {
6775                 exit(0);
6776         }
6777 #endif
6778         exit(0);
6779 }
6780 int main() { sub(); }
6781 EOCP
6782         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6783                 voidflags=$defvoidused
6784         echo "Good.  It appears to support void to the level $package wants.">&4
6785                 if $contains warning .out >/dev/null 2>&1; then
6786                         echo "However, you might get some warnings that look like this:"
6787                         $cat .out
6788                 fi
6789         else
6790 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6791                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6792                         echo "It supports 1..."
6793                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6794                                 echo "It also supports 2..."
6795                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6796                                         voidflags=7
6797                                         echo "And it supports 4 but not 8 definitely."
6798                                 else
6799                                         echo "It doesn't support 4..."
6800                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6801                                                 voidflags=11
6802                                                 echo "But it supports 8."
6803                                         else
6804                                                 voidflags=3
6805                                                 echo "Neither does it support 8."
6806                                         fi
6807                                 fi
6808                         else
6809                                 echo "It does not support 2..."
6810                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6811                                         voidflags=13
6812                                         echo "But it supports 4 and 8."
6813                                 else
6814                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6815                                                 voidflags=5
6816                                                 echo "And it supports 4 but has not heard about 8."
6817                                         else
6818                                                 echo "However it supports 8 but not 4."
6819                                         fi
6820                                 fi
6821                         fi
6822                 else
6823                         echo "There is no support at all for void."
6824                         voidflags=0
6825                 fi
6826         fi
6827 esac
6828 case "$voidflags" in
6829 "$defvoidused") ;;
6830 *)      $cat >&4 <<'EOM'
6831   Support flag bits are:
6832     1: basic void declarations.
6833     2: arrays of pointers to functions returning void.
6834     4: operations between pointers to and addresses of void functions.
6835     8: generic void pointers.
6836 EOM
6837         dflt="$voidflags";
6838         rp="Your void support flags add up to what?"
6839         . ./myread
6840         voidflags="$ans"
6841         ;;
6842 esac
6843 $rm -f try.* .out
6844
6845 : check for length of pointer
6846 echo " "
6847 case "$ptrsize" in
6848 '')
6849         echo "Checking to see how big your pointers are..." >&4
6850         if test "$voidflags" -gt 7; then
6851                 echo '#define VOID_PTR char *' > try.c
6852         else
6853                 echo '#define VOID_PTR void *' > try.c
6854         fi
6855         $cat >>try.c <<'EOCP'
6856 #include <stdio.h>
6857 int main()
6858 {
6859     printf("%d\n", (int)sizeof(VOID_PTR));
6860     exit(0);
6861 }
6862 EOCP
6863         set try
6864         if eval $compile_ok; then
6865                 ptrsize=`$run ./try`
6866                 echo "Your pointers are $ptrsize bytes long."
6867         else
6868                 dflt='4'
6869                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6870                 rp="What is the size of a pointer (in bytes)?"
6871                 . ./myread
6872                 ptrsize="$ans"
6873         fi
6874         ;;
6875 esac
6876 $rm -f try.c try
6877 case "$use64bitall" in
6878 "$define"|true|[yY]*)
6879         case "$ptrsize" in
6880         4)      cat <<EOM >&4
6881
6882 *** You have chosen a maximally 64-bit build, but your pointers
6883 *** are only 4 bytes wide, disabling maximal 64-bitness.
6884
6885 EOM
6886                 use64bitall="$undef"
6887                 case "$use64bitint" in
6888                 "$define"|true|[yY]*) ;;
6889                 *)      cat <<EOM >&4
6890
6891 *** Downgrading from maximal 64-bitness to using 64-bit integers.
6892
6893 EOM
6894                         use64bitint="$define"
6895                         ;;
6896                 esac
6897                 ;;
6898         esac
6899         ;;
6900 esac
6901
6902
6903 : determine which malloc to compile in
6904 echo " "
6905 case "$usemymalloc" in
6906 [yY]*|true|$define)     dflt='y' ;;
6907 [nN]*|false|$undef)     dflt='n' ;;
6908 *)      case "$ptrsize" in
6909         4) dflt='y' ;;
6910         *) dflt='n' ;;
6911         esac
6912         ;;
6913 esac
6914 rp="Do you wish to attempt to use the malloc that comes with $package?"
6915 . ./myread
6916 usemymalloc="$ans"
6917 case "$ans" in
6918 y*|true)
6919         usemymalloc='y'
6920         mallocsrc='malloc.c'
6921         mallocobj="malloc$_o"
6922         d_mymalloc="$define"
6923         case "$libs" in
6924         *-lmalloc*)
6925                 : Remove malloc from list of libraries to use
6926                 echo "Removing unneeded -lmalloc from library list" >&4
6927                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6928                 shift
6929                 libs="$*"
6930                 echo "libs = $libs" >&4
6931                 ;;
6932         esac
6933         ;;
6934 *)
6935         usemymalloc='n'
6936         mallocsrc=''
6937         mallocobj=''
6938         d_mymalloc="$undef"
6939         ;;
6940 esac
6941
6942 : compute the return types of malloc and free
6943 echo " "
6944 $cat >malloc.c <<END
6945 #$i_malloc I_MALLOC
6946 #$i_stdlib I_STDLIB
6947 #include <stdio.h>
6948 #include <sys/types.h>
6949 #ifdef I_MALLOC
6950 #include <malloc.h>
6951 #endif
6952 #ifdef I_STDLIB
6953 #include <stdlib.h>
6954 #endif
6955 #ifdef TRY_MALLOC
6956 void *malloc();
6957 #endif
6958 #ifdef TRY_FREE
6959 void free();
6960 #endif
6961 END
6962 case "$malloctype" in
6963 '')
6964         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6965                 malloctype='void *'
6966         else
6967                 malloctype='char *'
6968         fi
6969         ;;
6970 esac
6971 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6972
6973 case "$freetype" in
6974 '')
6975         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6976                 freetype='void'
6977         else
6978                 freetype='int'
6979         fi
6980         ;;
6981 esac
6982 echo "Your system uses $freetype free(), it would seem." >&4
6983 $rm -f malloc.[co]
6984 $cat <<EOM
6985
6986 After $package is installed, you may wish to install various
6987 add-on modules and utilities.  Typically, these add-ons will
6988 be installed under $prefix with the rest
6989 of this package.  However, you may wish to install such add-ons
6990 elsewhere under a different prefix.
6991
6992 If you do not wish to put everything under a single prefix, that's
6993 ok.  You will be prompted for the individual locations; this siteprefix
6994 is only used to suggest the defaults.
6995
6996 The default should be fine for most people.
6997
6998 EOM
6999 fn=d~+
7000 rp='Installation prefix to use for add-on modules and utilities?'
7001 : XXX Here might be another good place for an installstyle setting.
7002 case "$siteprefix" in
7003 '') dflt=$prefix ;;
7004 *)  dflt=$siteprefix ;;
7005 esac
7006 . ./getfile
7007 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7008 oldsiteprefix=''
7009 case "$siteprefix" in
7010 '') ;;
7011 *)      case "$ans" in
7012         "$prefix") ;;
7013         *) oldsiteprefix="$prefix";;
7014         esac
7015         ;;
7016 esac
7017 siteprefix="$ans"
7018 siteprefixexp="$ansexp"
7019
7020 : determine where site specific libraries go.
7021 : Usual default is /usr/local/lib/perl5/site_perl/$version
7022 : The default "style" setting is made in installstyle.U
7023 : XXX No longer works with Prefixit stuff.
7024 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7025 case "$sitelib" in
7026 '') case "$installstyle" in
7027         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7028         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7029         esac
7030         ;;
7031 *)      dflt="$sitelib"
7032         ;;
7033 esac
7034 $cat <<EOM
7035
7036 The installation process will create a directory for
7037 site-specific extensions and modules.  Most users find it convenient
7038 to place all site-specific files in this directory rather than in the
7039 main distribution directory.
7040
7041 EOM
7042 fn=d~+
7043 rp='Pathname for the site-specific library files?'
7044 . ./getfile
7045 sitelib="$ans"
7046 sitelibexp="$ansexp"
7047 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7048 : Change installation prefix, if necessary.
7049 if $test X"$prefix" != X"$installprefix"; then
7050         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
7051 else
7052         installsitelib="$sitelibexp"
7053 fi
7054
7055 : determine where site specific architecture-dependent libraries go.
7056 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7057 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7058 : sitelib may have an optional trailing /share.
7059 case "$sitearch" in
7060 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7061         dflt="$dflt/$archname"
7062         ;;
7063 *)      dflt="$sitearch"
7064         ;;
7065 esac
7066 set sitearch sitearch none
7067 eval $prefixit
7068 $cat <<EOM
7069
7070 The installation process will also create a directory for
7071 architecture-dependent site-specific extensions and modules.
7072
7073 EOM
7074 fn=d~+
7075 rp='Pathname for the site-specific architecture-dependent library files?'
7076 . ./getfile
7077 sitearch="$ans"
7078 sitearchexp="$ansexp"
7079 : Change installation prefix, if necessary.
7080 if $test X"$prefix" != X"$installprefix"; then
7081         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
7082 else
7083         installsitearch="$sitearchexp"
7084 fi
7085
7086 $cat <<EOM
7087
7088 The installation process will also create a directory for
7089 vendor-supplied add-ons.  Vendors who supply perl with their system
7090 may find it convenient to place all vendor-supplied files in this
7091 directory rather than in the main distribution directory.  This will
7092 ease upgrades between binary-compatible maintenance versions of perl.
7093
7094 Of course you may also use these directories in whatever way you see
7095 fit.  For example, you might use them to access modules shared over a
7096 company-wide network.
7097
7098 The default answer should be fine for most people.
7099 This causes further questions about vendor add-ons to be skipped
7100 and no vendor-specific directories will be configured for perl.
7101
7102 EOM
7103 rp='Do you want to configure vendor-specific add-on directories?'
7104 case "$usevendorprefix" in
7105 define|true|[yY]*) dflt=y ;;
7106 *)      : User may have set vendorprefix directly on Configure command line.
7107         case "$vendorprefix" in
7108         ''|' ') dflt=n ;;
7109         *)      dflt=y ;;
7110         esac
7111         ;;
7112 esac
7113 . ./myread
7114 case "$ans" in
7115 [yY]*)  fn=d~+
7116         rp='Installation prefix to use for vendor-supplied add-ons?'
7117         case "$vendorprefix" in
7118         '') dflt='' ;;
7119         *)  dflt=$vendorprefix ;;
7120         esac
7121         . ./getfile
7122         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7123         oldvendorprefix=''
7124         case "$vendorprefix" in
7125         '') ;;
7126         *)      case "$ans" in
7127                 "$prefix") ;;
7128                 *) oldvendorprefix="$prefix";;
7129                 esac
7130                 ;;
7131         esac
7132         usevendorprefix="$define"
7133         vendorprefix="$ans"
7134         vendorprefixexp="$ansexp"
7135         ;;
7136 *)      usevendorprefix="$undef"
7137         vendorprefix=''
7138         vendorprefixexp=''
7139         ;;
7140 esac
7141
7142 case "$vendorprefix" in
7143 '')     d_vendorlib="$undef"
7144         vendorlib=''
7145         vendorlibexp=''
7146         ;;
7147 *)      d_vendorlib="$define"
7148         : determine where vendor-supplied modules go.
7149         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7150         case "$vendorlib" in
7151         '')
7152                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7153                 case "$installstyle" in
7154                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7155                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7156                 esac
7157                 ;;
7158         *)      dflt="$vendorlib"
7159                 ;;
7160         esac
7161         fn=d~+
7162         rp='Pathname for the vendor-supplied library files?'
7163         . ./getfile
7164         vendorlib="$ans"
7165         vendorlibexp="$ansexp"
7166         ;;
7167 esac
7168 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7169 : Change installation prefix, if necessary.
7170 if $test X"$prefix" != X"$installprefix"; then
7171         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
7172 else
7173         installvendorlib="$vendorlibexp"
7174 fi
7175
7176 case "$vendorprefix" in
7177 '')     d_vendorarch="$undef"
7178         vendorarch=''
7179         vendorarchexp=''
7180         ;;
7181 *)      d_vendorarch="$define"
7182         : determine where vendor-supplied architecture-dependent libraries go.
7183         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7184         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7185         : vendorlib may have an optional trailing /share.
7186         case "$vendorarch" in
7187         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7188                 dflt="$dflt/$archname"
7189                 ;;
7190         *)      dflt="$vendorarch" ;;
7191         esac
7192         fn=d~+
7193         rp='Pathname for vendor-supplied architecture-dependent files?'
7194         . ./getfile
7195         vendorarch="$ans"
7196         vendorarchexp="$ansexp"
7197         ;;
7198 esac
7199 : Change installation prefix, if necessary.
7200 if $test X"$prefix" != X"$installprefix"; then
7201         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
7202 else
7203         installvendorarch="$vendorarchexp"
7204 fi
7205
7206 : Final catch-all directories to search
7207 $cat <<EOM
7208
7209 Lastly, you can have perl look in other directories for extensions and
7210 modules in addition to those already specified.
7211 These directories will be searched after 
7212         $sitearch 
7213         $sitelib 
7214 EOM
7215 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7216 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7217 echo ' '
7218 case "$otherlibdirs" in
7219 ''|' ') dflt='none' ;;
7220 *)      dflt="$otherlibdirs" ;;
7221 esac
7222 $cat <<EOM
7223 Enter a colon-separated set of extra paths to include in perl's @INC
7224 search path, or enter 'none' for no extra paths.
7225
7226 EOM
7227
7228 rp='Colon-separated list of additional directories for perl to search?'
7229 . ./myread
7230 case "$ans" in
7231 ' '|''|none)    otherlibdirs=' ' ;;     
7232 *)      otherlibdirs="$ans" ;;
7233 esac
7234 case "$otherlibdirs" in
7235 ' ') val=$undef ;;
7236 *)      val=$define ;;
7237 esac
7238 set d_perl_otherlibdirs
7239 eval $setvar
7240
7241 : Cruising for prototypes
7242 echo " "
7243 echo "Checking out function prototypes..." >&4
7244 $cat >prototype.c <<'EOCP'
7245 int main(int argc, char *argv[]) {
7246         exit(0);}
7247 EOCP
7248 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7249         echo "Your C compiler appears to support function prototypes."
7250         val="$define"
7251 else
7252         echo "Your C compiler doesn't seem to understand function prototypes."
7253         val="$undef"
7254 fi
7255 set prototype
7256 eval $setvar
7257 $rm -f prototype*
7258
7259 case "$prototype" in
7260 "$define") ;;
7261 *)      ansi2knr='ansi2knr'
7262         echo " "
7263         cat <<EOM >&4
7264
7265 $me:  FATAL ERROR:
7266 This version of $package can only be compiled by a compiler that 
7267 understands function prototypes.  Unfortunately, your C compiler 
7268         $cc $ccflags
7269 doesn't seem to understand them.  Sorry about that.
7270
7271 If GNU cc is available for your system, perhaps you could try that instead.  
7272
7273 Eventually, we hope to support building Perl with pre-ANSI compilers.
7274 If you would like to help in that effort, please contact <perlbug@perl.org>.
7275
7276 Aborting Configure now.
7277 EOM
7278         exit 2
7279         ;;
7280 esac
7281
7282 : determine where public executables go
7283 echo " "
7284 set dflt bin bin
7285 eval $prefixit
7286 fn=d~
7287 rp='Pathname where the public executables will reside?'
7288 . ./getfile
7289 if $test "X$ansexp" != "X$binexp"; then
7290         installbin=''
7291 fi
7292 bin="$ans"
7293 binexp="$ansexp"
7294 : Change installation prefix, if necessary.
7295 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7296 if $test X"$prefix" != X"$installprefix"; then
7297         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
7298 else
7299         installbin="$binexp"
7300 fi
7301
7302 echo " "
7303 case "$extras" in
7304 '') dflt='n';;
7305 *) dflt='y';;
7306 esac
7307 cat <<EOM
7308 Perl can be built with extra modules or bundles of modules which
7309 will be fetched from the CPAN and installed alongside Perl.
7310
7311 Notice that you will need access to the CPAN; either via the Internet,
7312 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7313 be asked later to configure the CPAN.pm module which will in turn do
7314 the installation of the rest of the extra modules or bundles.)
7315
7316 Notice also that if the modules require any external software such as
7317 libraries and headers (the libz library and the zlib.h header for the
7318 Compress::Zlib module, for example) you MUST have any such software
7319 already installed, this configuration process will NOT install such
7320 things for you.
7321
7322 If this doesn't make any sense to you, just accept the default '$dflt'.
7323 EOM
7324 rp='Install any extra modules (y or n)?'
7325 . ./myread
7326 case "$ans" in
7327 y|Y)
7328         cat <<EOM
7329
7330 Please list any extra modules or bundles to be installed from CPAN,
7331 with spaces between the names.  The names can be in any format the
7332 'install' command of CPAN.pm will understand.  (Answer 'none',
7333 without the quotes, to install no extra modules or bundles.)
7334 EOM
7335         rp='Extras?'
7336         dflt="$extras"
7337         . ./myread
7338         extras="$ans"
7339 esac
7340 case "$extras" in
7341 ''|'none')
7342         val=''
7343         $rm -f ../extras.lst
7344         ;;
7345 *)      echo "(Saving the list of extras for later...)"
7346         echo "$extras" > ../extras.lst
7347         val="'$extras'"
7348         ;;
7349 esac
7350 set extras
7351 eval $setvar
7352 echo " "
7353
7354 : determine where html pages for programs go
7355 set html1dir html1dir none
7356 eval $prefixit
7357 $cat <<EOM
7358
7359 If you wish to install html files for programs in $spackage, indicate 
7360 the appropriate directory here.  To skip installing html files,
7361 answer "none".
7362 EOM
7363 case "$html1dir" in
7364 ''|none|$undef|' ') dflt=none ;;
7365 *) dflt=$html1dir ;;
7366 esac
7367 fn=dn+~
7368 rp="Directory for the main $spackage html pages?"
7369 . ./getfile
7370 html1dir="$ans"
7371 html1direxp="$ansexp"
7372 : Use ' ' for none so value is preserved next time through Configure
7373 $test X"$html1dir" = "X" && html1dir=' '
7374 : Change installation prefix, if necessary.
7375 if $test X"$prefix" != X"$installprefix"; then
7376         installhtml1dir=`echo $html1direxp | sed "s#^$prefix#$installprefix#"`
7377 else
7378         installhtml1dir="$html1direxp"
7379 fi
7380
7381 : determine where html pages for libraries and modules go
7382 set html3dir html3dir none
7383 eval $prefixit
7384 $cat <<EOM
7385
7386 If you wish to install html files for modules associated with $spackage,
7387 indicate the appropriate directory here.  To skip installing html files,
7388 answer "none".
7389 EOM
7390 : There is no obvious default.  If they have specified html1dir, then
7391 : try to key off that, possibly changing .../html1 into .../html3.
7392 case "$html3dir" in
7393 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7394 *) dflt=$html3dir ;;
7395 esac
7396 fn=dn+~
7397 rp="Directory for the $spackage module html pages?"
7398 . ./getfile
7399 html3dir="$ans"
7400 html3direxp="$ansexp"
7401 : Use ' ' for none so value is preserved next time through Configure
7402 $test X"$html3dir" = "X" && html3dir=' '
7403 : Change installation prefix, if necessary.
7404 if $test X"$prefix" != X"$installprefix"; then
7405         installhtml3dir=`echo $html3direxp | sed "s#^$prefix#$installprefix#"`
7406 else
7407         installhtml3dir="$html3direxp"
7408 fi
7409
7410 : Find perl5.005 or later.
7411 echo "Looking for a previously installed perl5.005 or later... "
7412 case "$perl5" in
7413 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7414                 : Check if this perl is recent and can load a simple module
7415                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7416                         perl5=$tdir/perl
7417                         break;
7418                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7419                         perl5=$tdir/perl5
7420                         break;
7421                 fi
7422         done
7423         ;;
7424 *)      perl5="$perl5"
7425         ;;
7426 esac
7427 case "$perl5" in
7428 '')     echo "None found.  That's ok.";;
7429 *)      echo "Using $perl5." ;;
7430 esac
7431
7432 : Determine list of previous versions to include in @INC
7433 $cat > getverlist <<EOPL
7434 #!$perl5 -w
7435 use File::Basename;
7436 \$api_versionstring = "$api_versionstring";
7437 \$version = "$version";
7438 \$stem = "$sitelib_stem";
7439 \$archname = "$archname";
7440 EOPL
7441         $cat >> getverlist <<'EOPL'
7442 # Can't have leading @ because metaconfig interprets it as a command!
7443 ;@inc_version_list=();
7444 # XXX Redo to do opendir/readdir? 
7445 if (-d $stem) {
7446     chdir($stem);
7447     ;@candidates = glob("5.*");
7448 }
7449 else {
7450     ;@candidates = ();
7451 }
7452
7453 # XXX ToDo:  These comparisons must be reworked when two-digit
7454 # subversions come along, so that 5.7.10 compares as greater than
7455 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
7456 # widespread that we can use the built-in version vectors rather
7457 # than reinventing them here.  For 5.6.0, however, we must
7458 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
7459 foreach $d (@candidates) {
7460     if ($d lt $version) {
7461         if ($d ge $api_versionstring) {
7462             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
7463         }
7464         elsif ($d ge "5.005") {
7465             unshift(@inc_version_list, grep { -d } $d);
7466         }
7467     }
7468     else {
7469         # Skip newer version.  I.e. don't look in
7470         # 5.7.0 if we're installing 5.6.1.
7471     }
7472 }
7473
7474 if (@inc_version_list) {
7475     print join(' ', @inc_version_list);
7476 }
7477 else {
7478     # Blank space to preserve value for next Configure run.
7479     print " ";
7480 }
7481 EOPL
7482 chmod +x getverlist
7483 case "$inc_version_list" in
7484 '')     if test -x "$perl5$exe_ext"; then
7485                 dflt=`$perl5 getverlist`
7486         else
7487                 dflt='none'
7488         fi
7489         ;;
7490 $undef) dflt='none' ;;
7491 *)  eval dflt=\"$inc_version_list\" ;;
7492 esac
7493 case "$dflt" in
7494 ''|' ') dflt=none ;;
7495 esac
7496 case "$dflt" in
7497 5.005) dflt=none ;;
7498 esac
7499 $cat <<EOM
7500
7501 In order to ease the process of upgrading, this version of perl 
7502 can be configured to use modules built and installed with earlier 
7503 versions of perl that were installed under $prefix.  Specify here
7504 the list of earlier versions that this version of perl should check.
7505 If Configure detected no earlier versions of perl installed under
7506 $prefix, then the list will be empty.  Answer 'none' to tell perl
7507 to not search earlier versions.
7508
7509 The default should almost always be sensible, so if you're not sure,
7510 just accept the default.
7511 EOM
7512
7513 rp='List of earlier versions to include in @INC?'
7514 . ./myread
7515 case "$ans" in
7516 [Nn]one|''|' ') inc_version_list=' ' ;;
7517 *) inc_version_list="$ans" ;;
7518 esac
7519 case "$inc_version_list" in
7520 ''|' ') 
7521         inc_version_list_init='0';;
7522 *)      inc_version_list_init=`echo $inc_version_list |
7523                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7524         ;;
7525 esac
7526 $rm -f getverlist
7527
7528 : determine whether to install perl also as /usr/bin/perl
7529
7530 echo " "
7531 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7532         $cat <<EOM
7533 Many scripts expect perl to be installed as /usr/bin/perl.
7534
7535 If you want to, I can install the perl you are about to compile
7536 as /usr/bin/perl (in addition to $bin/perl).
7537 EOM
7538         if test -f /usr/bin/perl; then
7539             $cat <<EOM
7540
7541 However, please note that because you already have a /usr/bin/perl,
7542 overwriting that with a new Perl would very probably cause problems.
7543 Therefore I'm assuming you don't want to do that (unless you insist).
7544
7545 EOM
7546             case "$installusrbinperl" in
7547             "$define"|[yY]*)    dflt='y';;
7548             *)                  dflt='n';;
7549             esac
7550         else
7551             $cat <<EOM
7552
7553 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7554
7555 EOM
7556             case "$installusrbinperl" in
7557             "$undef"|[nN]*)     dflt='n';;
7558             *)                  dflt='y';;
7559             esac
7560         fi
7561         rp="Do you want to install perl as /usr/bin/perl?"
7562         . ./myread
7563         case "$ans" in
7564         [yY]*)  val="$define";;
7565         *)      val="$undef" ;;
7566         esac
7567 else
7568         val="$undef"
7569 fi
7570 set installusrbinperl
7571 eval $setvar
7572
7573 : see if dld is available
7574 set dld.h i_dld
7575 eval $inhdr
7576
7577 : see if dlopen exists
7578 xxx_runnm="$runnm"
7579 runnm=false
7580 set dlopen d_dlopen
7581 eval $inlibc
7582 runnm="$xxx_runnm"
7583
7584 : determine which dynamic loading, if any, to compile in
7585 echo " "
7586 dldir="ext/DynaLoader"
7587 case "$usedl" in
7588 $define|y|true)
7589         dflt='y'
7590         usedl="$define"
7591         ;;
7592 $undef|n|false)
7593         dflt='n'
7594         usedl="$undef"
7595         ;;
7596 *) 
7597         dflt='n'
7598         case "$d_dlopen" in
7599             $define) dflt='y' ;;
7600         esac
7601         case "$i_dld" in
7602             $define) dflt='y' ;;
7603         esac
7604         : Does a dl_xxx.xs file exist for this operating system
7605         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7606         ;;
7607 esac
7608 rp="Do you wish to use dynamic loading?"
7609 . ./myread
7610 usedl="$ans"
7611 case "$ans" in
7612 y*) usedl="$define"
7613         case "$dlsrc" in
7614         '')
7615                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7616                         dflt="$dldir/dl_${osname}.xs"
7617                 elif $test "$d_dlopen" = "$define" ; then
7618                         dflt="$dldir/dl_dlopen.xs"
7619                 elif $test "$i_dld" = "$define" ; then
7620                         dflt="$dldir/dl_dld.xs"
7621                 else
7622                         dflt=''
7623                 fi
7624                 ;;
7625         *)      dflt="$dldir/$dlsrc"
7626                 ;;
7627         esac
7628     echo "The following dynamic loading files are available:"
7629         : Can not go over to $dldir because getfile has path hard-coded in.
7630         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7631         rp="Source file to use for dynamic loading"
7632         fn="fne"
7633         gfpth="$src"
7634         . ./getfile
7635         usedl="$define"
7636         : emulate basename
7637         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7638
7639         $cat << EOM
7640
7641 Some systems may require passing special flags to $cc -c to
7642 compile modules that will be used to create a shared library.
7643 To use no flags, say "none".
7644
7645 EOM
7646     case "$cccdlflags" in
7647     '') case "$gccversion" in
7648                 '') case "$osname" in
7649                         hpux)   dflt='+z' ;;
7650                         next)   dflt='none' ;;
7651                         irix*)  dflt='-KPIC' ;;
7652                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7653                         sunos)  dflt='-pic' ;;
7654                         *)      dflt='none' ;;
7655                     esac
7656                         ;;
7657                 *)  case "$osname" in
7658                         darwin) dflt='none' ;;
7659                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7660                         *)      dflt='-fpic' ;;
7661                     esac ;;
7662             esac ;;
7663         ' ') dflt='none' ;;
7664     *)  dflt="$cccdlflags" ;;
7665     esac
7666     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7667     . ./myread
7668     case "$ans" in
7669     none) cccdlflags=' ' ;;
7670     *) cccdlflags="$ans" ;;
7671     esac
7672
7673     cat << EOM
7674
7675 Some systems use ld to create libraries that can be dynamically loaded,
7676 while other systems (such as those using ELF) use $cc.
7677
7678 EOM
7679         case "$ld" in
7680         '')     $cat >try.c <<'EOM'
7681 /* Test for whether ELF binaries are produced */
7682 #include <fcntl.h>
7683 #include <stdlib.h>
7684 int main() {
7685         char b[4];
7686         int i = open("a.out",O_RDONLY);
7687         if(i == -1) 
7688                 exit(1); /* fail */
7689         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7690                 exit(0); /* succeed (yes, it's ELF) */
7691         else
7692                 exit(1); /* fail */
7693 }
7694 EOM
7695                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7696                         cat <<EOM
7697 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7698 EOM
7699                         dflt="$cc"
7700                 else
7701                         echo "I'll use ld to build dynamic libraries."
7702                         dflt='ld'
7703                 fi
7704                 rm -f try.c a.out
7705                 ;;
7706         *)      dflt="$ld"
7707                 ;;
7708         esac
7709
7710     rp="What command should be used to create dynamic libraries?"
7711     . ./myread
7712         ld="$ans"
7713
7714     cat << EOM
7715
7716 Some systems may require passing special flags to $ld to create a
7717 library that can be dynamically loaded.  If your ld flags include
7718 -L/other/path options to locate libraries outside your loader's normal
7719 search path, you may need to specify those -L options here as well.  To
7720 use no flags, say "none".
7721
7722 EOM
7723     case "$lddlflags" in
7724     '') case "$osname" in
7725                         beos) dflt='-nostart' ;;
7726                         hpux) dflt='-b';
7727                               case "$gccversion" in
7728                               '') dflt="$dflt +vnocompatwarnings" ;;
7729                               esac
7730                               ;;        
7731                         linux|irix*)    dflt='-shared' ;;
7732                         next)  dflt='none' ;;
7733                         solaris) dflt='-G' ;;
7734                         sunos) dflt='-assert nodefinitions' ;;
7735                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7736                 *)     dflt='none' ;;
7737                         esac
7738                         ;;
7739     *) dflt="$lddlflags" ;;
7740     esac
7741
7742         : Try to guess additional flags to pick up local libraries.
7743         : Be careful not to append to a plain 'none'
7744         case "$dflt" in
7745         none) dflt='' ;;
7746         esac
7747         for thisflag in $ldflags; do
7748                 case "$thisflag" in
7749                 -L*|-R*|-Wl,-R*)
7750                         case " $dflt " in
7751                         *" $thisflag "*) ;;
7752                         *) dflt="$dflt $thisflag" ;;
7753                         esac
7754                         ;;
7755                 esac
7756         done
7757
7758         case "$dflt" in
7759         ''|' ') dflt='none' ;;
7760         esac
7761
7762     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7763     . ./myread
7764     case "$ans" in
7765     none) lddlflags=' ' ;;
7766     *) lddlflags="$ans" ;;
7767     esac
7768
7769         cat <<EOM
7770
7771 Some systems may require passing special flags to $cc to indicate that
7772 the resulting executable will use dynamic linking.  To use no flags,
7773 say "none".
7774
7775 EOM
7776     case "$ccdlflags" in
7777     '') case "$osname" in
7778                 hpux)   dflt='-Wl,-E' ;;
7779                 linux)  dflt='-rdynamic' ;;
7780                 next)   dflt='none' ;;
7781                 sunos)  dflt='none' ;;
7782                 *)      dflt='none' ;;
7783             esac ;;
7784     ' ')  dflt='none' ;;
7785     *)  dflt="$ccdlflags" ;;
7786     esac
7787     rp="Any special flags to pass to $cc to use dynamic linking?"
7788     . ./myread
7789     case "$ans" in
7790     none) ccdlflags=' ' ;;
7791     *) ccdlflags="$ans" ;;
7792     esac
7793     ;;
7794 *)  usedl="$undef"
7795         ld='ld'
7796     dlsrc='dl_none.xs'
7797     lddlflags=''
7798     ccdlflags=''
7799     ;;
7800 esac
7801
7802 also=''
7803 case "$usedl" in
7804 $undef)
7805         # No dynamic loading being used, so don't bother even to prompt.
7806         useshrplib='false'
7807         ;;
7808 *)      case "$useshrplib" in
7809         '')     case "$osname" in
7810                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7811                         dflt=y
7812                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7813                         ;;
7814                 next*)
7815                         case "$osvers" in
7816                         4*)     dflt=y
7817                                 also='Building a shared libperl is needed for MAB support.'
7818                                 ;;
7819                         *)      dflt=n
7820                                 ;;
7821                         esac
7822                         ;;
7823                 *)      dflt=n
7824                         ;;
7825                 esac
7826                 ;;
7827         $define|true|[Yy]*)
7828                 dflt=y
7829                 ;;
7830         *)      dflt=n
7831                 ;;
7832         esac
7833         $cat << EOM
7834
7835 The perl executable is normally obtained by linking perlmain.c with
7836 libperl${_a}, any static extensions (usually just DynaLoader), and
7837 any other libraries needed on this system (such as -lm, etc.).  Since
7838 your system supports dynamic loading, it is probably possible to build
7839 a shared libperl.$so.  If you will have more than one executable linked
7840 to libperl.$so, this will significantly reduce the size of each
7841 executable, but it may have a noticeable affect on performance.  The
7842 default is probably sensible for your system.
7843 $also
7844
7845 EOM
7846         rp="Build a shared libperl.$so (y/n)"
7847         . ./myread
7848         case "$ans" in
7849         true|$define|[Yy]*)
7850                 useshrplib='true'  ;;
7851         *)      useshrplib='false' ;;
7852         esac
7853         ;;
7854 esac
7855
7856 case "$useshrplib" in
7857 true)
7858         case "$libperl" in
7859         '')
7860                 # Figure out a good name for libperl.so.  Since it gets stored in
7861                 # a version-specific architecture-dependent library, the version
7862                 # number isn't really that important, except for making cc/ld happy.
7863                 #
7864                 # A name such as libperl.so.3.1
7865                 majmin="libperl.$so.$patchlevel.$subversion"
7866                 # A name such as libperl.so.301
7867                 majonly=`echo $patchlevel $subversion |
7868                         $awk '{printf "%d%02d", $1, $2}'`
7869                 majonly=libperl.$so.$majonly
7870                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7871                 # rely on figuring it out from the naming of libc.
7872                 case "${osname}${osvers}" in
7873                 next4*)
7874                         dflt=libperl.5.$so
7875                         # XXX How handle the --version stuff for MAB?
7876                         ;;
7877                 linux*)  # ld won't link with a bare -lperl otherwise.
7878                         dflt=libperl.$so
7879                         ;;
7880                 cygwin*) # ld links against an importlib
7881                         dflt=libperl$lib_ext
7882                         ;;
7883                 *)      # Try to guess based on whether libc has major.minor.
7884                         case "$libc" in
7885                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7886                         *libc.$so.[0-9]*) dflt=$majonly ;;
7887                         *)      dflt=libperl.$so ;;
7888                         esac
7889                         ;;
7890                 esac
7891                 ;;
7892         *)      dflt=$libperl
7893                 ;;
7894         esac
7895         cat << EOM
7896
7897 I need to select a good name for the shared libperl.  If your system uses
7898 library names with major and minor numbers, then you might want something
7899 like $majmin.  Alternatively, if your system uses a single version
7900 number for shared libraries, then you might want to use $majonly.
7901 Or, your system might be quite happy with a simple libperl.$so.
7902
7903 Since the shared libperl will get installed into a version-specific
7904 architecture-dependent directory, the version number of the shared perl
7905 library probably isn't important, so the default should be o.k.
7906
7907 EOM
7908         rp='What name do you want to give to the shared libperl?'
7909         . ./myread
7910         libperl=$ans
7911         echo "Ok, I'll use $libperl"
7912         ;;
7913 *)
7914         libperl="libperl${_a}"
7915         ;;
7916 esac
7917
7918 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7919 case "$shrpdir" in
7920 '') ;;
7921 *)      $cat >&4 <<EOM
7922 WARNING:  Use of the shrpdir variable for the installation location of
7923 the shared $libperl is not supported.  It was never documented and
7924 will not work in this version.  Let me (perlbug@perl.org)
7925 know of any problems this may cause.
7926
7927 EOM
7928         case "$shrpdir" in
7929         "$archlibexp/CORE")
7930                 $cat >&4 <<EOM
7931 But your current setting of $shrpdir is
7932 the default anyway, so it's harmless.
7933 EOM
7934                 ;;
7935         *)
7936                 $cat >&4 <<EOM
7937 Further, your current attempted setting of $shrpdir
7938 conflicts with the value of $archlibexp/CORE
7939 that installperl will use.
7940 EOM
7941                 ;;
7942         esac
7943         ;;
7944 esac
7945
7946 # How will the perl executable find the installed shared $libperl?
7947 # Add $xxx to ccdlflags.
7948 # If we can't figure out a command-line option, use $shrpenv to
7949 # set env LD_RUN_PATH.  The main perl makefile uses this.
7950 shrpdir=$archlibexp/CORE
7951 xxx=''
7952 tmp_shrpenv=''
7953 if "$useshrplib"; then
7954     case "$osname" in 
7955         aix)
7956                 # We'll set it in Makefile.SH...
7957                 ;;
7958         solaris)
7959                 xxx="-R $shrpdir"
7960                 ;;
7961         freebsd|netbsd|openbsd)
7962                 xxx="-Wl,-R$shrpdir"
7963                 ;;
7964         bsdos|linux|irix*|dec_osf)
7965                 xxx="-Wl,-rpath,$shrpdir"
7966                 ;;
7967         next)
7968                 # next doesn't like the default...
7969                 ;;
7970         beos)
7971                 # beos doesn't like the default, either.
7972                 ;;
7973         hpux*)
7974                 # hpux doesn't like the default, either.
7975                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7976                 ;;
7977         *)
7978                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7979                 ;;
7980         esac
7981         case "$xxx" in
7982         '') ;;
7983         *)      
7984                 # Only add $xxx if it isn't already in ccdlflags.
7985                 case " $ccdlflags " in
7986                 *" $xxx "*)     ;;
7987                 *)      ccdlflags="$ccdlflags $xxx"
7988                         cat <<EOM >&4
7989
7990 Adding $xxx to the flags
7991 passed to $ld so that the perl executable will find the 
7992 installed shared $libperl.
7993
7994 EOM
7995                         ;;
7996                 esac
7997                 ;;
7998         esac
7999 fi
8000 # Fix ccdlflags in AIX for building external extensions.
8001 # (For building Perl itself bare -bE:perl.exp is needed,
8002 #  Makefile.SH takes care of this.)
8003 case "$osname" in
8004 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8005 esac
8006 # Respect a hint or command-line value.
8007 case "$shrpenv" in
8008 '') shrpenv="$tmp_shrpenv" ;;
8009 esac
8010 case "$ldlibpthname" in
8011 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8012 none)   ldlibpthname='' ;;
8013 esac
8014
8015 : determine where manual pages are on this system
8016 echo " "
8017 case "$sysman" in
8018 '') 
8019         syspath='/usr/share/man/man1 /usr/man/man1'
8020         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8021         syspath="$syspath /usr/man/u_man/man1"
8022         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8023         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8024         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8025         sysman=`./loc . /usr/man/man1 $syspath`
8026         ;;
8027 esac
8028 if $test -d "$sysman"; then
8029         echo "System manual is in $sysman." >&4
8030 else
8031         echo "Could not find manual pages in source form." >&4
8032 fi
8033
8034 : determine where manual pages go
8035 set man1dir man1dir none
8036 eval $prefixit
8037 $cat <<EOM
8038
8039 $spackage has manual pages available in source form.
8040 EOM
8041 case "$nroff" in
8042 nroff)
8043         echo "However, you don't have nroff, so they're probably useless to you."
8044         case "$man1dir" in
8045         '') man1dir="none";;
8046         esac;;
8047 esac
8048 echo "If you don't want the manual sources installed, answer 'none'."
8049 case "$man1dir" in
8050 ' ') dflt=none
8051         ;;
8052 '')
8053         lookpath="$prefixexp/share/man/man1"
8054         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8055         lookpath="$lookpath $prefixexp/man/p_man/man1"
8056         lookpath="$lookpath $prefixexp/man/u_man/man1"
8057         lookpath="$lookpath $prefixexp/man/man.1"
8058         case "$sysman" in
8059         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8060         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8061         esac
8062         set dflt
8063         eval $prefixup
8064         ;;
8065 *)  dflt="$man1dir"
8066         ;;
8067 esac
8068 echo " "
8069 fn=dn+~
8070 rp="Where do the main $spackage manual pages (source) go?"
8071 . ./getfile
8072 if $test "X$man1direxp" != "X$ansexp"; then
8073         installman1dir=''
8074 fi
8075 man1dir="$ans"
8076 man1direxp="$ansexp"
8077 case "$man1dir" in
8078 '')     man1dir=' '
8079         installman1dir='';;
8080 esac
8081
8082 : Change installation prefix, if necessary.
8083 if $test X"$prefix" != X"$installprefix"; then
8084         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
8085 else
8086         installman1dir="$man1direxp"
8087 fi
8088
8089 : What suffix to use on installed man pages
8090
8091 case "$man1dir" in
8092 ' ')
8093         man1ext='0'
8094         ;;
8095 *)
8096         rp="What suffix should be used for the main $spackage man pages?"
8097         case "$man1ext" in
8098         '')     case "$man1dir" in
8099                 *1)  dflt=1 ;;
8100                 *1p) dflt=1p ;;
8101                 *1pm) dflt=1pm ;;
8102                 *l) dflt=l;;
8103                 *n) dflt=n;;
8104                 *o) dflt=o;;
8105                 *p) dflt=p;;
8106                 *C) dflt=C;;
8107                 *L) dflt=L;;
8108                 *L1) dflt=L1;;
8109                 *) dflt=1;;
8110                 esac
8111                 ;;
8112         *)      dflt="$man1ext";;
8113         esac
8114         . ./myread
8115         man1ext="$ans"
8116         ;;
8117 esac
8118
8119 : see if we can have long filenames
8120 echo " "
8121 first=123456789abcdef
8122 $rm -f $first
8123 if (echo hi >$first) 2>/dev/null; then
8124         if $test -f 123456789abcde; then
8125                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8126                 val="$undef"
8127         else
8128                 echo 'You can have filenames longer than 14 characters.'>&4
8129                 val="$define"
8130         fi
8131 else
8132         $cat <<'EOM'
8133 You can't have filenames longer than 14 chars.
8134 You can't even think about them!
8135 EOM
8136         val="$undef"
8137 fi 
8138 set d_flexfnam
8139 eval $setvar
8140 $rm -rf 123456789abcde*
8141
8142 : determine where library module manual pages go
8143 set man3dir man3dir none
8144 eval $prefixit
8145 $cat <<EOM
8146
8147 $spackage has manual pages for many of the library modules.
8148 EOM
8149
8150 case "$nroff" in
8151 nroff)
8152         $cat <<'EOM'
8153 However, you don't have nroff, so they're probably useless to you.
8154 EOM
8155         case "$man3dir" in
8156         '') man3dir="none";;
8157         esac;;
8158 esac
8159
8160 case "$d_flexfnam" in
8161 undef)
8162         $cat <<'EOM'
8163 However, your system can't handle the long file names like File::Basename.3. 
8164 EOM
8165         case "$man3dir" in
8166         '') man3dir="none";;
8167         esac;;
8168 esac
8169
8170 echo "If you don't want the manual sources installed, answer 'none'."
8171 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8172 case "$man3dir" in
8173 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8174         if $test -d "$privlib/man/man3"; then
8175                 cat <<EOM >&4
8176
8177 WARNING:  Previous versions of perl installed man3 pages into
8178 $privlib/man/man3.  This version will suggest a 
8179 new default of $dflt.  
8180 EOM
8181                 tdflt=$dflt
8182                 dflt='n'
8183                 rp='Do you wish to preserve the old behavior?(y/n)'
8184                 . ./myread
8185                 case "$ans" in
8186                 y*) dflt="$privlib/man/man3" ;;
8187                 *)  dflt=$tdflt ;;
8188                 esac
8189     fi
8190         ;;
8191 *)      dflt="$man3dir" ;;
8192 esac
8193 case "$dflt" in
8194 ' ') dflt=none ;;
8195 esac
8196 echo " "
8197 fn=dn+~
8198 rp="Where do the $package library man pages (source) go?"
8199 . ./getfile
8200 man3dir="$ans"
8201 man3direxp="$ansexp"
8202 case "$man3dir" in
8203 '')     man3dir=' '
8204         installman3dir='';;
8205 esac
8206
8207 : Change installation prefix, if necessary.
8208 if $test X"$prefix" != X"$installprefix"; then
8209         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8210 else
8211         installman3dir="$man3direxp"
8212 fi
8213
8214 : What suffix to use on installed man pages
8215 case "$man3dir" in
8216 ' ')
8217         man3ext='0'
8218         ;;
8219 *)
8220         rp="What suffix should be used for the $package library man pages?"
8221         case "$man3ext" in
8222         '')     case "$man3dir" in
8223                 *3)  dflt=3 ;;
8224                 *3p) dflt=3p ;;
8225                 *3pm) dflt=3pm ;;
8226                 *l) dflt=l;;
8227                 *n) dflt=n;;
8228                 *o) dflt=o;;
8229                 *p) dflt=p;;
8230                 *C) dflt=C;;
8231                 *L) dflt=L;;
8232                 *L3) dflt=L3;;
8233                 *) dflt=3;;
8234                 esac
8235                 ;;
8236         *)      dflt="$man3ext";;
8237         esac
8238         . ./myread
8239         man3ext="$ans"
8240         ;;
8241 esac
8242
8243 : see if we have to deal with yellow pages, now NIS.
8244 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8245         if $test -f /usr/etc/nibindd; then
8246                 echo " "
8247                 echo "I'm fairly confident you're on a NeXT."
8248                 echo " "
8249                 rp='Do you get the hosts file via NetInfo?'
8250                 dflt=y
8251                 case "$hostcat" in
8252                 nidump*) ;;
8253                 '') ;;
8254                 *) dflt=n;;
8255                 esac
8256                 . ./myread
8257                 case "$ans" in
8258                 y*) hostcat='nidump hosts .';;
8259                 *)      case "$hostcat" in
8260                         nidump*) hostcat='';;
8261                         esac
8262                         ;;
8263                 esac
8264         fi
8265         case "$hostcat" in
8266         nidump*) ;;
8267         *)
8268                 case "$hostcat" in
8269                 *ypcat*) dflt=y;;
8270                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8271                                 dflt=y
8272                         else
8273                                 dflt=n
8274                         fi;;
8275                 *) dflt=n;;
8276                 esac
8277                 echo " "
8278                 rp='Are you getting the hosts file via yellow pages?'
8279                 . ./myread
8280                 case "$ans" in
8281                 y*) hostcat='ypcat hosts';;
8282                 *) hostcat='cat /etc/hosts';;
8283                 esac
8284                 ;;
8285         esac
8286 fi
8287 case "$hostcat" in
8288 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8289 esac
8290 case "$groupcat" in
8291 '') test -f /etc/group && groupcat='cat /etc/group';;
8292 esac
8293 case "$passcat" in
8294 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8295 esac
8296
8297 : now get the host name
8298 echo " "
8299 echo "Figuring out host name..." >&4
8300 case "$myhostname" in
8301 '') cont=true
8302         echo 'Maybe "hostname" will work...'
8303         if tans=`sh -c hostname 2>&1` ; then
8304                 myhostname=$tans
8305                 phostname=hostname
8306                 cont=''
8307         fi
8308         ;;
8309 *) cont='';;
8310 esac
8311 if $test "$cont"; then
8312         if ./xenix; then
8313                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8314                 if tans=`cat /etc/systemid 2>&1` ; then
8315                         myhostname=$tans
8316                         phostname='cat /etc/systemid'
8317                         echo "Whadyaknow.  Xenix always was a bit strange..."
8318                         cont=''
8319                 fi
8320         elif $test -r /etc/systemid; then
8321                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8322         fi
8323 fi
8324 if $test "$cont"; then
8325         echo 'No, maybe "uuname -l" will work...'
8326         if tans=`sh -c 'uuname -l' 2>&1` ; then
8327                 myhostname=$tans
8328                 phostname='uuname -l'
8329         else
8330                 echo 'Strange.  Maybe "uname -n" will work...'
8331                 if tans=`sh -c 'uname -n' 2>&1` ; then
8332                         myhostname=$tans
8333                         phostname='uname -n'
8334                 else
8335                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8336                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8337                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8338                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8339                         else
8340                                 case "$myhostname" in
8341                                 '') echo "Does this machine have an identity crisis or something?"
8342                                         phostname='';;
8343                                 *)
8344                                         echo "Well, you said $myhostname before..."
8345                                         phostname='echo $myhostname';;
8346                                 esac
8347                         fi
8348                 fi
8349         fi
8350 fi
8351 case "$myhostname" in
8352 '') myhostname=noname ;;
8353 esac
8354 : you do not want to know about this
8355 set $myhostname
8356 myhostname=$1
8357
8358 : verify guess
8359 if $test "$myhostname" ; then
8360         dflt=y
8361         rp='Your host name appears to be "'$myhostname'".'" Right?"
8362         . ./myread
8363         case "$ans" in
8364         y*) ;;
8365         *) myhostname='';;
8366         esac
8367 fi
8368
8369 : bad guess or no guess
8370 while $test "X$myhostname" = X ; do
8371         dflt=''
8372         rp="Please type the (one word) name of your host:"
8373         . ./myread
8374         myhostname="$ans"
8375 done
8376
8377 : translate upper to lower if necessary
8378 case "$myhostname" in
8379 *[A-Z]*)
8380         echo "(Normalizing case in your host name)"
8381         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8382         ;;
8383 esac
8384
8385 case "$myhostname" in
8386 *.*)
8387         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8388         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8389         echo "(Trimming domain name from host name--host name is now $myhostname)"
8390         ;;
8391 *) case "$mydomain" in
8392         '')
8393                 {
8394                         test "X$hostcat" = "Xypcat hosts" &&
8395                         ypmatch "$myhostname" hosts 2>/dev/null |\
8396                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8397                         $test -s hosts
8398                 } || {
8399                         test "X$hostcat" != "X" &&
8400                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8401                                         /[       ]$myhostname[  . ]/p" > hosts
8402                 }
8403                 tmp_re="[       . ]"
8404                 if $test -f hosts; then
8405                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8406                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8407                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8408                                 hosts | $sort | $uniq | \
8409                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8410                         case `$echo X$dflt` in
8411                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8412                                 dflt=.
8413                                 ;;
8414                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8415                                 ;;
8416                         esac
8417                 else
8418                         echo "(I cannot locate a hosts database anywhere)"
8419                         dflt=.
8420                 fi
8421                 case "$dflt" in
8422                 .)
8423                         tans=`./loc resolv.conf X /etc /usr/etc`
8424                         if $test -f "$tans"; then
8425                                 echo "(Attempting domain name extraction from $tans)"
8426                                 dflt=.`$sed -n -e 's/   / /g' \
8427                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8428                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8429                                 case "$dflt" in
8430                                 .) dflt=.`$sed -n -e 's/        / /g' \
8431                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8432                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8433                                         ;;
8434                                 esac
8435                         fi
8436                         ;;
8437                 esac
8438                 case "$dflt" in
8439                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8440                         dflt=.`sh -c domainname 2>/dev/null`
8441                         case "$dflt" in
8442                         '') dflt='.';;
8443                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8444                         esac
8445                         ;;
8446                 esac
8447                 case "$dflt$osname" in
8448                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8449                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8450                         ;;
8451                 esac
8452                 case "$dflt" in
8453                 .) echo "(Lost all hope -- silly guess then)"
8454                         dflt='.nonet'
8455                         ;;
8456                 esac
8457                 $rm -f hosts
8458                 ;;
8459         *) dflt="$mydomain";;
8460         esac;;
8461 esac
8462 echo " "
8463 rp="What is your domain name?"
8464 . ./myread
8465 tans="$ans"
8466 case "$ans" in
8467 '') ;;
8468 .*) ;;
8469 *) tans=".$tans";;
8470 esac
8471 mydomain="$tans"
8472
8473 : translate upper to lower if necessary
8474 case "$mydomain" in
8475 *[A-Z]*)
8476         echo "(Normalizing case in your domain name)"
8477         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8478         ;;
8479 esac
8480
8481 : a little sanity check here
8482 case "$phostname" in
8483 '') ;;
8484 *)
8485         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8486         $myhostname$mydomain|$myhostname) ;;
8487         *)
8488                 case "$phostname" in
8489                 sed*)
8490                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8491                         ;;
8492                 *)
8493                         echo "(That doesn't agree with your $phostname command, by the way.)"
8494                         ;;
8495                 esac
8496         ;;
8497         esac
8498         ;;
8499 esac
8500
8501 $cat <<EOM
8502
8503 I need to get your e-mail address in Internet format if possible, i.e.
8504 something like user@host.domain. Please answer accurately since I have
8505 no easy means to double check it. The default value provided below
8506 is most probably close to reality but may not be valid from outside
8507 your organization...
8508
8509 EOM
8510 cont=x
8511 while test "$cont"; do
8512         case "$cf_email" in
8513         '') dflt="$cf_by@$myhostname$mydomain";;
8514         *) dflt="$cf_email";;
8515         esac
8516         rp='What is your e-mail address?'
8517         . ./myread
8518         cf_email="$ans"
8519         case "$cf_email" in
8520         *@*.*) cont='' ;;
8521         *)
8522                 rp='Address does not look like an Internet one.  Use it anyway?'
8523                 case "$fastread" in
8524                 yes) dflt=y ;;
8525                 *) dflt=n ;;
8526                 esac
8527                 . ./myread
8528                 case "$ans" in
8529                 y*) cont='' ;;
8530                 *) echo " " ;;
8531                 esac
8532                 ;;
8533         esac
8534 done
8535
8536 $cat <<EOM
8537
8538 If you or somebody else will be maintaining perl at your site, please
8539 fill in the correct e-mail address here so that they may be contacted
8540 if necessary. Currently, the "perlbug" program included with perl
8541 will send mail to this address in addition to perlbug@perl.org. You may
8542 enter "none" for no administrator.
8543
8544 EOM
8545 case "$perladmin" in
8546 '') dflt="$cf_email";;
8547 *) dflt="$perladmin";;
8548 esac
8549 rp='Perl administrator e-mail address'
8550 . ./myread
8551 perladmin="$ans"
8552
8553 : determine whether to only install version-specific parts.
8554 echo " "
8555 $cat <<EOM
8556 Do you want to install only the version-specific parts of the perl
8557 distribution?  Usually you do *not* want to do this.
8558 EOM
8559 case "$versiononly" in
8560 "$define"|[Yy]*|true) dflt='y' ;;
8561 *) dflt='n';
8562 esac
8563 rp="Do you want to install only the version-specific parts of perl?"
8564 . ./myread
8565 case "$ans" in
8566 [yY]*)  val="$define";;
8567 *)      val="$undef" ;;
8568 esac
8569 set versiononly
8570 eval $setvar
8571
8572 case "$versiononly" in
8573 "$define") inc_version_list=''
8574            inc_version_list_init=0
8575            ;;
8576 esac
8577
8578 : figure out how to guarantee perl startup
8579 case "$startperl" in
8580 '')
8581         case "$sharpbang" in
8582         *!)
8583                 $cat <<EOH
8584
8585 I can use the #! construct to start perl on your system. This will
8586 make startup of perl scripts faster, but may cause problems if you
8587 want to share those scripts and perl is not in a standard place
8588 ($binexp/perl) on all your platforms. The alternative is to force
8589 a shell by starting the script with a single ':' character.
8590
8591 EOH
8592                 case "$versiononly" in
8593                 "$define")      dflt="$binexp/perl$version";;  
8594                 *)              dflt="$binexp/perl";;
8595                 esac
8596                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8597                 . ./myread
8598                 case "$ans" in
8599                 none)   startperl=": # use perl";;
8600                 *)      startperl="#!$ans"
8601                         if $test 30 -lt `echo "$ans" | wc -c`; then
8602                                 $cat >&4 <<EOM
8603
8604 WARNING:  Some systems limit the #! command to 32 characters.
8605 If you experience difficulty running Perl scripts with #!, try
8606 installing Perl in a directory with a shorter pathname.
8607
8608 EOM
8609                         fi ;;
8610                 esac
8611                 ;;
8612         *) startperl=": # use perl"
8613                 ;;
8614         esac
8615         ;;
8616 esac
8617 echo "I'll use $startperl to start perl scripts."
8618
8619 : figure best path for perl in scripts
8620 case "$perlpath" in
8621 '')
8622         case "$versiononly" in
8623         "$define")      perlpath="$binexp/perl$version";;
8624         *)              perlpath="$binexp/perl";;
8625         esac
8626         case "$startperl" in
8627         *!*) ;;
8628         *)
8629                 $cat <<EOH
8630
8631 I will use the "eval 'exec'" idiom to start Perl on your system.
8632 I can use the full path of your Perl binary for this purpose, but
8633 doing so may cause problems if you want to share those scripts and
8634 Perl is not always in a standard place ($binexp/perl).
8635
8636 EOH
8637                 dflt="$binexp/perl"
8638                 rp="What path shall I use in \"eval 'exec'\"?"
8639                 . ./myread
8640                 perlpath="$ans"
8641                 ;;
8642         esac
8643         ;;
8644 esac
8645 case "$startperl" in
8646 *!*)    ;;
8647 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8648 esac
8649
8650 : determine where public executable scripts go
8651 set scriptdir scriptdir
8652 eval $prefixit
8653 case "$scriptdir" in
8654 '')
8655         dflt="$bin"
8656         : guess some guesses
8657         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8658         $test -d /usr/share/bin     && dflt=/usr/share/bin
8659         $test -d /usr/local/script  && dflt=/usr/local/script
8660         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8661         $test -d $prefixexp/script  && dflt=$prefixexp/script
8662         set dflt
8663         eval $prefixup
8664         ;;
8665 *)  dflt="$scriptdir"
8666         ;;
8667 esac
8668 $cat <<EOM
8669  
8670 Some installations have a separate directory just for executable scripts so
8671 that they can mount it across multiple architectures but keep the scripts in
8672 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8673 Or you might just lump your scripts in with all your other executables.
8674  
8675 EOM
8676 fn=d~
8677 rp='Where do you keep publicly executable scripts?'
8678 . ./getfile
8679 if $test "X$ansexp" != "X$scriptdirexp"; then
8680         installscript=''
8681 fi
8682 scriptdir="$ans"
8683 scriptdirexp="$ansexp"
8684 : Change installation prefix, if necessary.
8685 if $test X"$prefix" != X"$installprefix"; then
8686         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8687 else
8688         installscript="$scriptdirexp"
8689 fi
8690
8691 : determine where add-on public executables go
8692 case "$sitebin" in
8693 '')     dflt=$siteprefix/bin ;;
8694 *)      dflt=$sitebin ;;
8695 esac
8696 fn=d~
8697 rp='Pathname where the add-on public executables should be installed?'
8698 . ./getfile
8699 sitebin="$ans"
8700 sitebinexp="$ansexp"
8701 : Change installation prefix, if necessary.
8702 if $test X"$prefix" != X"$installprefix"; then
8703         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8704 else
8705         installsitebin="$sitebinexp"
8706 fi
8707
8708 : determine where add-on html pages go
8709 : There is no standard location, so try to copy the previously-selected 
8710 : directory structure for the core html pages.
8711 case "$sitehtml1" in
8712 '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8713 *)      dflt=$sitehtml1 ;;
8714 esac
8715 case "$dflt" in
8716 ''|' ') dflt=none ;;
8717 esac
8718 fn=dn+~
8719 rp='Pathname where the site-specific html pages should be installed?'
8720 . ./getfile
8721 sitehtml1="$ans"
8722 sitehtml1exp="$ansexp"
8723 : Use ' ' for none so value is preserved next time through Configure
8724 $test X"$sitehtml1" = "X" && sitehtml1=' '
8725 : Change installation prefix, if necessary.
8726 if $test X"$prefix" != X"$installprefix"; then
8727         installsitehtml1=`echo "$sitehtml1exp" | $sed "s#^$prefix#$installprefix#"`
8728 else
8729         installsitehtml1="$sitehtml1exp"
8730 fi
8731
8732 : determine where add-on library html pages go
8733 : There is no standard location, so try to copy the previously-selected
8734 : directory structure for the core html pages.
8735 case "$sitehtml3" in
8736 '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8737 *)      dflt=$sitehtml3 ;;
8738 esac
8739 case "$dflt" in
8740 ''|' ') dflt=none ;;
8741 esac
8742 fn=dn+~
8743 rp='Pathname where the site-specific library html pages should be installed?'
8744 . ./getfile
8745 sitehtml3="$ans"
8746 sitehtml3exp="$ansexp"
8747 : Use ' ' for none so value is preserved next time through Configure
8748 $test X"$sitehtml3" = "X" && sitehtml3=' '
8749 : Change installation prefix, if necessary.
8750 if $test X"$prefix" != X"$installprefix"; then
8751         installsitehtml3=`echo "$sitehtml3exp" | $sed "s#^$prefix#$installprefix#"`
8752 else
8753         installsitehtml3="$sitehtml3exp"
8754 fi
8755
8756 : determine where add-on manual pages go
8757 case "$siteman1" in
8758 '')     dflt=`echo "$man1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8759 *)      dflt=$siteman1 ;;
8760 esac
8761 case "$dflt" in
8762 ''|' ') dflt=none ;;
8763 esac
8764 fn=dn+~
8765 rp='Pathname where the site-specific manual pages should be installed?'
8766 . ./getfile
8767 siteman1="$ans"
8768 siteman1exp="$ansexp"
8769 : Use ' ' for none so value is preserved next time through Configure
8770 $test X"$siteman1" = "X" && siteman1=' '
8771 : Change installation prefix, if necessary.
8772 if $test X"$prefix" != X"$installprefix"; then
8773         installsiteman1=`echo "$siteman1exp" | $sed "s#^$prefix#$installprefix#"`
8774 else
8775         installsiteman1="$siteman1exp"
8776 fi
8777
8778 : determine where add-on library man pages go
8779 case "$siteman3" in
8780 '')     dflt=`echo "$man3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8781 *)      dflt=$siteman3 ;;
8782 esac
8783 case "$dflt" in
8784 ''|' ') dflt=none ;;
8785 esac
8786 fn=dn+~
8787 rp='Pathname where the site-specific library manual pages should be installed?'
8788 . ./getfile
8789 siteman3="$ans"
8790 siteman3exp="$ansexp"
8791 : Use ' ' for none so value is preserved next time through Configure
8792 $test X"$siteman3" = "X" && siteman3=' '
8793 : Change installation prefix, if necessary.
8794 if $test X"$prefix" != X"$installprefix"; then
8795         installsiteman3=`echo "$siteman3exp" | $sed "s#^$prefix#$installprefix#"`
8796 else
8797         installsiteman3="$siteman3exp"
8798 fi
8799
8800 : determine where add-on public executable scripts go
8801 case "$sitescript" in
8802 '')     dflt=$siteprefix/script
8803         $test -d $dflt || dflt=$sitebin ;;
8804 *)  dflt="$sitescript" ;;
8805 esac
8806 fn=d~+
8807 rp='Pathname where add-on public executable scripts should be installed?'
8808 . ./getfile
8809 sitescript="$ans"
8810 sitescriptexp="$ansexp"
8811 : Change installation prefix, if necessary.
8812 if $test X"$prefix" != X"$installprefix"; then
8813         installsitescript=`echo $sitescriptexp | sed "s#^$prefix#$installprefix#"`
8814 else
8815         installsitescript="$sitescriptexp"
8816 fi
8817
8818 : define an is-a-typedef? function
8819 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8820 case "$inclist" in
8821 "") inclist="sys/types.h";;
8822 esac;
8823 eval "varval=\$$var";
8824 case "$varval" in
8825 "")
8826         $rm -f temp.c;
8827         for inc in $inclist; do
8828                 echo "#include <$inc>" >>temp.c;
8829         done;
8830         echo "#ifdef $type" >> temp.c;
8831         echo "printf(\"We have $type\");" >> temp.c;
8832         echo "#endif" >> temp.c;
8833         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8834         if $contains $type temp.E >/dev/null 2>&1; then
8835                 eval "$var=\$type";
8836         else
8837                 eval "$var=\$def";
8838         fi;
8839         $rm -f temp.?;;
8840 *) eval "$var=\$varval";;
8841 esac'
8842
8843 : define an is-a-typedef? function that prompts if the type is not available.
8844 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8845 case "$inclist" in
8846 "") inclist="sys/types.h";;
8847 esac;
8848 eval "varval=\$$var";
8849 case "$varval" in
8850 "")
8851         $rm -f temp.c;
8852         for inc in $inclist; do
8853                 echo "#include <$inc>" >>temp.c;
8854         done;
8855         echo "#ifdef $type" >> temp.c;
8856         echo "printf(\"We have $type\");" >> temp.c;
8857         echo "#endif" >> temp.c;
8858         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8859         echo " " ;
8860         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8861         if $contains $type temp.E >/dev/null 2>&1; then
8862                 echo "$type found." >&4;
8863                 eval "$var=\$type";
8864         else
8865                 echo "$type NOT found." >&4;
8866                 dflt="$def";
8867                 . ./myread ;
8868                 eval "$var=\$ans";
8869         fi;
8870         $rm -f temp.?;;
8871 *) eval "$var=\$varval";;
8872 esac'
8873
8874 : see what type lseek is declared as in the kernel
8875 rp="What is the type used for lseek's offset on this system?"
8876 set off_t lseektype long stdio.h sys/types.h
8877 eval $typedef_ask
8878
8879 echo " "
8880 echo "Checking to see how big your file offsets are..." >&4
8881 $cat >try.c <<EOCP
8882 #include <sys/types.h>
8883 #include <stdio.h>
8884 int main()
8885 {
8886     printf("%d\n", (int)sizeof($lseektype));
8887     return(0); 
8888 }
8889 EOCP
8890 set try
8891 if eval $compile_ok; then
8892         lseeksize=`$run ./try`
8893         echo "Your file offsets are $lseeksize bytes long."
8894 else
8895         dflt=$longsize
8896         echo " "
8897         echo "(I can't seem to compile the test program.  Guessing...)"
8898         rp="What is the size of your file offsets (in bytes)?"
8899         . ./myread
8900         lseeksize="$ans"
8901 fi
8902 $rm -f try.c try
8903
8904 : see what type file positions are declared as in the library
8905 rp="What is the type for file position used by fsetpos()?"
8906 set fpos_t fpostype long stdio.h sys/types.h
8907 eval $typedef_ask
8908
8909 echo " "
8910 case "$fpostype" in
8911 *_t) zzz="$fpostype"    ;;
8912 *)   zzz="fpos_t"       ;;
8913 esac
8914 echo "Checking the size of $zzz..." >&4 
8915 cat > try.c <<EOCP
8916 #include <sys/types.h>
8917 #include <stdio.h>
8918 int main() {
8919     printf("%d\n", (int)sizeof($fpostype));
8920     exit(0);
8921 }
8922 EOCP
8923 set try
8924 if eval $compile_ok; then
8925         yyy=`$run ./try`
8926         case "$yyy" in
8927         '')     fpossize=4
8928                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8929                 ;;
8930         *)      fpossize=$yyy
8931                 echo "Your $zzz is $fpossize bytes long."
8932                 ;;
8933         esac
8934 else
8935         dflt="$longsize"
8936         echo " " >&4
8937         echo "(I can't compile the test program.  Guessing...)" >&4
8938         rp="What is the size of your file positions (in bytes)?"
8939         . ./myread
8940         fpossize="$ans"
8941 fi
8942
8943
8944
8945 # Backward compatibility (uselfs is deprecated).
8946 case "$uselfs" in
8947 "$define"|true|[yY]*)
8948         cat <<EOM >&4
8949
8950 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8951 EOM
8952         uselargefiles="$define"
8953         ;;
8954 esac                          
8955
8956 case "$lseeksize:$fpossize" in
8957 8:8) cat <<EOM
8958
8959 You can have files larger than 2 gigabytes.
8960 EOM
8961    val="$define" ;;
8962 *)    case "$uselargefiles" in
8963    "$undef"|false|[nN]*) dflt='n' ;;
8964    *)   dflt='y' ;;
8965    esac
8966    cat <<EOM
8967
8968 Perl can be built to understand large files (files larger than 2 gigabytes)
8969 on some systems.  To do so, Configure can be run with -Duselargefiles.
8970
8971 If this doesn't make any sense to you, just accept the default '$dflt'.
8972 EOM
8973    rp='Try to understand large files, if available?'
8974    . ./myread
8975    case "$ans" in
8976    y|Y)         val="$define" ;;
8977    *)           val="$undef"  ;;
8978    esac
8979    ;;
8980 esac
8981 set uselargefiles
8982 eval $setvar
8983 case "$uselargefiles" in
8984 "$define")
8985 : Look for a hint-file generated 'call-back-unit'.  If the
8986 : user has specified that a large files perl is to be built,
8987 : we may need to set or change some other defaults.
8988         if $test -f uselargefiles.cbu; then
8989                 echo "Your platform has some specific hints for large file builds, using them..."
8990                 . ./uselargefiles.cbu
8991                 echo " "
8992                 echo "Rechecking to see how big your file offsets are..." >&4
8993                 $cat >try.c <<EOCP
8994 #include <sys/types.h>
8995 #include <stdio.h>
8996 int main()
8997 {
8998     printf("%d\n", (int)sizeof($lseektype));
8999     return(0); 
9000 }
9001 EOCP
9002                 set try
9003                 if eval $compile_ok; then
9004                         lseeksize=`$run ./try`
9005                         $echo "Your file offsets are now $lseeksize bytes long."
9006                 else
9007                         dflt="$lseeksize"
9008                         echo " "
9009                         echo "(I can't seem to compile the test program.  Guessing...)"
9010                         rp="What is the size of your file offsets (in bytes)?"
9011                         . ./myread
9012                         lseeksize="$ans"
9013                 fi
9014                 case "$fpostype" in
9015                 *_t) zzz="$fpostype"    ;;
9016                 *)   zzz="fpos_t"       ;;
9017                 esac
9018                 $echo $n "Rechecking the size of $zzz...$c" >&4 
9019                 $cat > try.c <<EOCP
9020 #include <sys/types.h>
9021 #include <stdio.h>
9022 int main() {
9023     printf("%d\n", (int)sizeof($fpostype));
9024     exit(0);
9025 }
9026 EOCP
9027                 set try
9028                 if eval $compile_ok; then
9029                         yyy=`$run ./try`
9030                         dflt="$lseeksize"
9031                         case "$yyy" in
9032                         '')     echo " "
9033                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9034                                 ;;
9035                         *)      fpossize=$yyy
9036                                 echo " $fpossize bytes." >&4
9037                                 ;;
9038                         esac
9039                 else
9040                         dflt="$fpossize"
9041                         echo " "
9042                         echo "(I can't compile the test program.  Guessing...)" >&4
9043                         rp="What is the size of your file positions (in bytes)?"
9044                         . ./myread
9045                         fpossize="$ans"
9046                 fi
9047                 $rm -f try.c try
9048         fi
9049         ;;
9050 esac
9051
9052 case "$vendorprefix" in
9053 '')     d_vendorbin="$undef"
9054         vendorbin=''
9055         vendorbinexp=''
9056         ;;
9057 *)      d_vendorbin="$define"
9058         : determine where vendor-supplied executables go.
9059         case "$vendorbin" in
9060         '') dflt=$vendorprefix/bin ;;
9061         *)      dflt="$vendorbin" ;;
9062         esac
9063         fn=d~+
9064         rp='Pathname for the vendor-supplied executables directory?'
9065         . ./getfile
9066         vendorbin="$ans"
9067         vendorbinexp="$ansexp"
9068         ;;
9069 esac
9070 : Change installation prefix, if necessary.
9071 if $test X"$prefix" != X"$installprefix"; then
9072         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
9073 else
9074         installvendorbin="$vendorbinexp"
9075 fi
9076
9077 case "$vendorprefix" in
9078 '')     vendorhtml1=''
9079         vendorhtml1exp=''
9080         ;;
9081 *)      : determine where vendor-supplied html pages go.
9082         : There is no standard location, so try to copy the previously-selected
9083         : directory structure for the core html pages.
9084         : XXX Better default suggestions would be welcome.
9085         case "$vendorhtml1" in
9086         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9087         *)      dflt=$vendorhtml1 ;;
9088         esac
9089         case "$dflt" in
9090         ''|' ') dflt=none ;;
9091         esac
9092         fn=dn+~
9093         rp='Pathname for the vendor-supplied html pages?'
9094         . ./getfile
9095         vendorhtml1="$ans"
9096         vendorhtml1exp="$ansexp"
9097         ;;
9098 esac
9099 : Use ' ' for none so value is preserved next time through Configure
9100 $test X"$vendorhtml1" = "X" && vendorhtml1=' '
9101 : Change installation prefix, if necessary.
9102 if $test X"$prefix" != X"$installprefix"; then
9103         installvendorhtml1=`echo $vendorhtml1exp | $sed "s#^$prefix#$installprefix#"`
9104 else
9105         installvendorhtml1="$vendorhtml1exp"
9106 fi
9107
9108 case "$vendorprefix" in
9109 '')     vendorhtml3=''
9110         vendorhtml3exp=''
9111         ;;
9112 *)      : determine where vendor-supplied module html pages go.
9113         : There is no standard location, so try to copy the previously-selected
9114         : directory structure for the core html pages.
9115         : XXX Better default suggestions would be welcome.
9116         case "$vendorhtml3" in
9117         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9118         *)      dflt=$vendorhtml3 ;;
9119         esac
9120         case "$dflt" in
9121         ''|' ') dflt=none ;;
9122         esac
9123         fn=dn+~
9124         rp='Pathname for the vendor-supplied html pages?'
9125         . ./getfile
9126         vendorhtml3="$ans"
9127         vendorhtml3exp="$ansexp"
9128         ;;
9129 esac
9130 : Use ' ' for none so value is preserved next time through Configure
9131 $test X"$vendorhtml3" = "X" && vendorhtml3=' '
9132 : Change installation prefix, if necessary.
9133 if $test X"$prefix" != X"$installprefix"; then
9134         installvendorhtml3=`echo $vendorhtml3exp | $sed "s#^$prefix#$installprefix#"`
9135 else
9136         installvendorhtml3="$vendorhtml3exp"
9137 fi
9138
9139 case "$vendorprefix" in
9140 '')     vendorman1=''
9141         vendorman1exp=''
9142         ;;
9143 *)      : determine where vendor-supplied manual pages go.
9144         case "$vendorman1" in
9145         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9146         *)      dflt=$vendorman1 ;;
9147         esac
9148         case "$dflt" in
9149         ''|' ') dflt=none ;;
9150         esac
9151         fn=nd~+
9152         rp='Pathname for the vendor-supplied manual section 1 pages?'
9153         . ./getfile
9154         vendorman1="$ans"
9155         vendorman1exp="$ansexp"
9156         ;;
9157 esac
9158 : Use ' ' for none so value is preserved next time through Configure
9159 $test X"$vendorman1" = "X" && vendorman1=' '
9160 : Change installation prefix, if necessary.
9161 if $test X"$prefix" != X"$installprefix"; then
9162         installvendorman1=`echo "$vendorman1exp" | $sed "s#^$prefix#$installprefix#"`
9163 else
9164         installvendorman1="$vendorman1exp"
9165 fi
9166
9167 case "$vendorprefix" in
9168 '')     vendorman3=''
9169         vendorman3exp=''
9170         ;;
9171 *)      : determine where vendor-supplied module manual pages go.
9172         case "$vendorman3" in
9173         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9174         *)      dflt=$vendorman3 ;;
9175         esac
9176         case "$dflt" in
9177         ''|' ') dflt=none ;;
9178         esac
9179         fn=nd~+
9180         rp='Pathname for the vendor-supplied manual section 3 pages?'
9181         . ./getfile
9182         vendorman3="$ans"
9183         vendorman3exp="$ansexp"
9184         ;;
9185 esac
9186 : Use ' ' for none so value is preserved next time through Configure
9187 $test X"$vendorman3" = "X" && vendorman3=' '
9188 : Change installation prefix, if necessary.
9189 if $test X"$prefix" != X"$installprefix"; then
9190         installvendorman3=`echo "$vendorman3exp" | $sed "s#^$prefix#$installprefix#"`
9191 else
9192         installvendorman3="$vendorman3exp"
9193 fi
9194
9195 case "$vendorprefix" in
9196 '')     d_vendorscript="$undef"
9197         vendorscript=''
9198         vendorscriptexp=''
9199         ;;
9200 *)      d_vendorscript="$define"
9201         : determine where vendor-supplied scripts go.
9202         case "$vendorscript" in
9203         '')     dflt=$vendorprefix/script
9204                 $test -d $dflt || dflt=$vendorbin ;;
9205         *)  dflt="$vendorscript" ;;
9206         esac
9207         $cat <<EOM
9208
9209 The installation process will create a directory for 
9210 vendor-supplied scripts.
9211
9212 EOM
9213         fn=d~+
9214         rp='Pathname for the vendor-supplied scripts directory?'
9215         . ./getfile
9216         vendorscript="$ans"
9217         vendorscriptexp="$ansexp"
9218         ;;
9219 esac
9220 : Change installation prefix, if necessary.
9221 if $test X"$prefix" != X"$installprefix"; then
9222         installvendorscript=`echo $vendorscriptexp | $sed "s#^$prefix#$installprefix#"`
9223 else
9224         installvendorscript="$vendorscriptexp"
9225 fi
9226
9227 : see if qgcvt exists
9228 set qgcvt d_qgcvt
9229 eval $inlibc
9230
9231 : Check how to convert floats to strings.
9232
9233 if test "X$d_Gconvert" = X; then
9234
9235 echo " "
9236 echo "Checking for an efficient way to convert floats to strings."
9237 echo " " > try.c
9238 case "$uselongdouble" in
9239 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9240 esac
9241 case "$d_longdbl" in
9242 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9243 esac
9244 case "$d_PRIgldbl" in
9245 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9246 esac
9247 $cat >>try.c <<EOP
9248 #ifdef TRY_gconvert
9249 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9250 char *myname = "gconvert";
9251 #endif
9252 #ifdef TRY_gcvt
9253 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9254 char *myname = "gcvt";
9255 #endif
9256 #ifdef TRY_qgcvt
9257 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9258 char *myname = "qgcvt";
9259 #define DOUBLETYPE long double
9260 #endif
9261 #ifdef TRY_sprintf
9262 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9263 #ifdef HAS_PRIgldbl
9264 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9265 #else
9266 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9267 #endif
9268 #else
9269 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9270 #endif
9271 char *myname = "sprintf";
9272 #endif
9273
9274 #ifndef DOUBLETYPE
9275 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9276 #define DOUBLETYPE long double
9277 #else
9278 #define DOUBLETYPE double
9279 #endif
9280 #endif
9281
9282 #include <stdio.h>
9283
9284 #define I_STDLIB $i_stdlib
9285 #ifdef I_STDLIB
9286 #include <stdlib.h>
9287 #endif
9288
9289 int
9290 checkit(expect, got)
9291 char *expect;
9292 char *got;
9293 {
9294     if (strcmp(expect, got)) {
9295                 printf("%s oddity:  Expected %s, got %s\n",
9296                         myname, expect, got);
9297                 exit(1);
9298         }
9299 }
9300
9301 int main()
9302
9303         char buf[64]; 
9304         buf[63] = '\0';
9305
9306         /* This must be 1st test on (which?) platform */
9307         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9308         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9309         checkit("0.1", buf);
9310
9311         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9312         checkit("0.01", buf);
9313
9314         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9315         checkit("0.001", buf);
9316
9317         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9318         checkit("0.0001", buf);
9319
9320         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9321         if (strlen(buf) > 5)
9322             checkit("9e-005", buf); /* for Microsoft ?? */
9323         else
9324             checkit("9e-05", buf);
9325
9326         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9327         checkit("1", buf);
9328
9329         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9330         checkit("1.1", buf);
9331
9332         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9333         checkit("1.01", buf);
9334
9335         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9336         checkit("1.001", buf);
9337
9338         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9339         checkit("1.0001", buf);
9340
9341         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9342         checkit("1.00001", buf);
9343
9344         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9345         checkit("1.000001", buf);
9346
9347         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9348         checkit("0", buf);
9349
9350         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9351         checkit("-1", buf);
9352
9353         /* Some Linux gcvt's give 1.e+5 here. */
9354         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9355         checkit("100000", buf);
9356         
9357         /* Some Linux gcvt's give -1.e+5 here. */
9358         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9359         checkit("-100000", buf);
9360
9361         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9362         checkit("123.456", buf);
9363
9364         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9365         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9366         /* 34 should be enough to scare even long double
9367          * places into using the e notation. */
9368         if (strlen(buf) > 5)
9369             checkit("1e+034", buf); /* for Microsoft */
9370         else
9371             checkit("1e+34", buf);
9372
9373         /* For Perl, if you add additional tests here, also add them to
9374          * t/base/num.t for benefit of platforms not using Configure or
9375          * overriding d_Gconvert */
9376
9377         exit(0);
9378 }
9379 EOP
9380 : first add preferred functions to our list
9381 xxx_list=""
9382 for xxx_convert in $gconvert_preference; do
9383     case $xxx_convert in
9384     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9385     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9386     esac 
9387 done
9388 : then add any others
9389 for xxx_convert in gconvert gcvt sprintf; do
9390     case "$xxx_list" in
9391     *$xxx_convert*) ;;
9392     *) xxx_list="$xxx_list $xxx_convert" ;;
9393     esac 
9394 done
9395
9396 case "$d_longdbl$uselongdouble" in
9397 "$define$define")
9398     : again, add prefered functions to our list first
9399     xxx_ld_list=""
9400     for xxx_convert in $gconvert_ld_preference; do
9401         case $xxx_convert in
9402         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9403         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9404         esac
9405     done
9406     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9407     for xxx_convert in qgcvt sprintf $xxx_list; do
9408         case "$xxx_ld_list" in
9409         $xxx_convert*|*" $xxx_convert"*) ;;
9410         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9411         esac
9412     done
9413     : if sprintf cannot do long doubles, move it to the end
9414     if test "$d_PRIgldbl" != "$define"; then
9415         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9416     fi
9417     : if no qgcvt, remove it
9418     if test "$d_qgcvt" != "$define"; then
9419         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9420     fi
9421     : use the ld_list
9422     xxx_list="$xxx_ld_list"
9423     ;;
9424 esac
9425
9426 for xxx_convert in $xxx_list; do
9427         echo "Trying $xxx_convert..."
9428         $rm -f try try$_o
9429         set try -DTRY_$xxx_convert
9430         if eval $compile; then
9431                 echo "$xxx_convert() found." >&4
9432                 if $run ./try; then
9433                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9434                         break;
9435                 else
9436                         echo "...But $xxx_convert didn't work as I expected."
9437                         xxx_convert=''
9438                 fi
9439         else
9440                 echo "$xxx_convert NOT found." >&4
9441         fi
9442 done
9443
9444 if test X$xxx_convert = X; then
9445     echo "*** WHOA THERE!!! ***" >&4
9446     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9447     xxx_convert=sprintf
9448 fi
9449
9450 case "$xxx_convert" in
9451 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9452 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9453 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9454 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9455    "$define$define$define")
9456       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9457    "$define$define$undef")
9458       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9459    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9460    esac
9461    ;;  
9462 esac
9463
9464 fi
9465
9466 : see if _fwalk exists
9467 set fwalk d__fwalk
9468 eval $inlibc
9469
9470 : Initialize h_fcntl
9471 h_fcntl=false
9472
9473 : Initialize h_sysfile
9474 h_sysfile=false
9475
9476 : access call always available on UNIX
9477 set access d_access
9478 eval $inlibc
9479
9480 : locate the flags for 'access()'
9481 case "$d_access" in
9482 "$define")
9483         echo " "
9484         $cat >access.c <<'EOCP'
9485 #include <sys/types.h>
9486 #ifdef I_FCNTL
9487 #include <fcntl.h>
9488 #endif
9489 #ifdef I_SYS_FILE
9490 #include <sys/file.h>
9491 #endif
9492 #ifdef I_UNISTD
9493 #include <unistd.h>
9494 #endif
9495 int main() {
9496         exit(R_OK);
9497 }
9498 EOCP
9499         : check sys/file.h first, no particular reason here
9500         if $test `./findhdr sys/file.h` && \
9501                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9502                 h_sysfile=true;
9503                 echo "<sys/file.h> defines the *_OK access constants." >&4
9504         elif $test `./findhdr fcntl.h` && \
9505                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9506                 h_fcntl=true;
9507                 echo "<fcntl.h> defines the *_OK access constants." >&4
9508         elif $test `./findhdr unistd.h` && \
9509                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9510                 echo "<unistd.h> defines the *_OK access constants." >&4
9511         else
9512                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9513         fi
9514         ;;
9515 esac
9516 $rm -f access*
9517
9518 : see if accessx exists
9519 set accessx d_accessx
9520 eval $inlibc
9521
9522 : see if alarm exists
9523 set alarm d_alarm
9524 eval $inlibc
9525
9526 : see if POSIX threads are available
9527 set pthread.h i_pthread
9528 eval $inhdr
9529
9530 : define a fucntion to check prototypes
9531 $cat > protochk <<EOSH
9532 $startsh
9533 cc="$cc"
9534 optimize="$optimize"
9535 ccflags="$ccflags"
9536 prototype="$prototype"
9537 define="$define"
9538 rm=$rm
9539 usethreads=$usethreads
9540 i_pthread=$i_pthread
9541 pthread_h_first=$pthread_h_first
9542 EOSH
9543
9544 $cat >> protochk <<'EOSH'
9545
9546 $rm -f try.c
9547 foo="$1"
9548 shift
9549 while test $# -ge 2; do
9550         case "$1" in
9551                 $define) echo "#include <$2>" >> try.c ;;
9552                 literal) echo "$2" >> try.c ;;
9553         esac
9554     # Extra magic for the benefit of systems that need pthread.h
9555     # to be included early to correctly detect threadsafe functions.
9556     # Such functions must guarantee themselves, though, that the usethreads
9557     # and i_pthread have been defined, before calling protochk.
9558     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9559         echo "#include <pthread.h>" >> try.c
9560         pthread_h_done=yes
9561     fi
9562     shift 2
9563 done
9564 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9565 cat >> try.c <<'EOCP'
9566 #ifdef CAN_PROTOTYPE
9567 #define _(args) args
9568 #else
9569 #define _(args) ()
9570 #endif
9571 EOCP
9572 echo "$foo" >> try.c
9573 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9574 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9575 status=$?
9576 $rm -f try.[co]
9577 exit $status
9578 EOSH
9579 chmod +x protochk
9580 $eunicefix protochk
9581
9582 : see if sys/types.h has to be included
9583 set sys/types.h i_systypes
9584 eval $inhdr
9585
9586 : see if sys/select.h has to be included
9587 set sys/select.h i_sysselct
9588 eval $inhdr
9589
9590 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9591 while $test $# -ge 2; do
9592         case "$1" in
9593         $define) echo "#include <$2>";;
9594         esac ;
9595     shift 2;
9596 done > try.c;
9597 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9598 set try;
9599 if eval $compile; then
9600         val="$define";
9601 else
9602         val="$undef";
9603 fi;
9604 set $varname;
9605 eval $setvar;
9606 $rm -f try.c try.o'
9607
9608 : see if we should include time.h, sys/time.h, or both
9609 echo " "
9610 if test "X$timeincl" = X; then
9611         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9612         $echo $n "I'm now running the test program...$c"
9613         $cat >try.c <<'EOCP'
9614 #include <sys/types.h>
9615 #ifdef I_TIME
9616 #include <time.h>
9617 #endif
9618 #ifdef I_SYSTIME
9619 #ifdef SYSTIMEKERNEL
9620 #define KERNEL
9621 #endif
9622 #include <sys/time.h>
9623 #endif
9624 #ifdef I_SYSSELECT
9625 #include <sys/select.h>
9626 #endif
9627 int main()
9628 {
9629         struct tm foo;
9630 #ifdef S_TIMEVAL
9631         struct timeval bar;
9632 #endif
9633 #ifdef S_TIMEZONE
9634         struct timezone tzp;
9635 #endif
9636         if (foo.tm_sec == foo.tm_sec)
9637                 exit(0);
9638 #ifdef S_TIMEVAL
9639         if (bar.tv_sec == bar.tv_sec)
9640                 exit(0);
9641 #endif
9642         exit(1);
9643 }
9644 EOCP
9645         flags=''
9646         for s_timezone in '-DS_TIMEZONE' ''; do
9647         sysselect=''
9648         for s_timeval in '-DS_TIMEVAL' ''; do
9649         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9650         for i_time in '' '-DI_TIME'; do
9651         for i_systime in '-DI_SYSTIME' ''; do
9652                 case "$flags" in
9653                 '') $echo $n ".$c"
9654                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9655                         if eval $compile; then
9656                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9657                                 shift
9658                                 flags="$*"
9659                                 echo " "
9660                                 $echo $n "Succeeded with $flags$c"
9661                         fi
9662                         ;;
9663                 esac
9664         done
9665         done
9666         done
9667         done
9668         done
9669         timeincl=''
9670         echo " "
9671         case "$flags" in
9672         *SYSTIMEKERNEL*) i_systimek="$define"
9673                 timeincl=`./findhdr sys/time.h`
9674                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9675         *) i_systimek="$undef";;
9676         esac
9677         case "$flags" in
9678         *I_TIME*) i_time="$define"
9679                 timeincl=`./findhdr time.h`" $timeincl"
9680                 echo "We'll include <time.h>." >&4;;
9681         *) i_time="$undef";;
9682         esac
9683         case "$flags" in
9684         *I_SYSTIME*) i_systime="$define"
9685                 timeincl=`./findhdr sys/time.h`" $timeincl"
9686                 echo "We'll include <sys/time.h>." >&4;;
9687         *) i_systime="$undef";;
9688         esac
9689         $rm -f try.c try
9690 fi
9691 : see if struct tm knows about tm_zone
9692 case "$i_systime$i_time" in
9693 *$define*) 
9694         echo " "
9695         echo "Checking to see if your struct tm has tm_zone field..." >&4
9696         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9697         eval $hasfield
9698         ;;
9699 *)      val="$undef"
9700         set d_tm_tm_zone
9701         eval $setvar
9702         ;;
9703 esac
9704 case "$d_tm_tm_zone" in
9705 "$define")      echo "Yes, it does."   ;;
9706 *)              echo "No, it doesn't." ;;
9707 esac
9708 : see if struct tm knows about tm_gmtoff
9709 case "$i_systime$i_time" in
9710 *$define*) 
9711         echo " "
9712         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9713         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9714         eval $hasfield
9715         ;;
9716 *)      val="$undef"
9717         set d_tm_tm_gmtoff
9718         eval $setvar
9719         ;;
9720 esac
9721 case "$d_tm_tm_gmtoff" in
9722 "$define")      echo "Yes, it does."   ;;
9723 *)              echo "No, it doesn't." ;;
9724 esac
9725
9726 : see if asctime_r exists
9727 set asctime_r d_asctime_r
9728 eval $inlibc
9729 case "$d_asctime_r" in
9730 "$define")
9731         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9732         case "$d_asctime_r_proto:$usethreads" in
9733         ":define")      d_asctime_r_proto=define
9734                 set d_asctime_r_proto asctime_r $hdrs
9735                 eval $hasproto ;;
9736         *)      ;;
9737         esac
9738         case "$d_asctime_r_proto" in
9739         define)
9740         case "$asctime_r_proto" in
9741         ''|0) try='char* asctime_r(const struct tm*, char*);'
9742         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9743         esac
9744         case "$asctime_r_proto" in
9745         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9746         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9747         esac
9748         case "$asctime_r_proto" in
9749         ''|0) try='int asctime_r(const struct tm*, char*);'
9750         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9751         esac
9752         case "$asctime_r_proto" in
9753         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9754         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9755         esac
9756         case "$asctime_r_proto" in
9757         ''|0)   d_asctime_r=undef
9758                 asctime_r_proto=0
9759                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9760         * )     case "$asctime_r_proto" in
9761                 REENTRANT_PROTO*) ;;
9762                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9763                 esac
9764                 echo "Prototype: $try" ;;
9765         esac
9766         ;;
9767         *)      case "$usethreads" in
9768                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9769                 esac
9770                 d_asctime_r=undef
9771                 asctime_r_proto=0
9772                 ;;
9773         esac
9774         ;;
9775 *)      asctime_r_proto=0
9776         ;;
9777 esac
9778
9779 : see if atolf exists
9780 set atolf d_atolf
9781 eval $inlibc
9782
9783 : see if atoll exists
9784 set atoll d_atoll
9785 eval $inlibc
9786
9787 : Look for GNU-cc style attribute checking
9788 echo " "
9789 echo "Checking whether your compiler can handle __attribute__ ..." >&4
9790 $cat >attrib.c <<'EOCP'
9791 #include <stdio.h>
9792 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
9793 EOCP
9794 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9795         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9796                 echo "Your C compiler doesn't fully support __attribute__."
9797                 val="$undef"
9798         else
9799                 echo "Your C compiler supports __attribute__."
9800                 val="$define"
9801         fi
9802 else
9803         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9804         val="$undef"
9805 fi
9806 set d_attribut
9807 eval $setvar
9808 $rm -f attrib*
9809
9810 : see if bcmp exists
9811 set bcmp d_bcmp
9812 eval $inlibc
9813
9814 : see if bcopy exists
9815 set bcopy d_bcopy
9816 eval $inlibc
9817
9818 : see if this is a unistd.h system
9819 set unistd.h i_unistd
9820 eval $inhdr
9821
9822 : see if getpgrp exists
9823 set getpgrp d_getpgrp
9824 eval $inlibc
9825
9826 case "$d_getpgrp" in
9827 "$define")
9828         echo " "
9829         echo "Checking to see which flavor of getpgrp is in use..."
9830         $cat >try.c <<EOP
9831 #$i_unistd I_UNISTD
9832 #include <sys/types.h>
9833 #ifdef I_UNISTD
9834 #  include <unistd.h>
9835 #endif
9836 int main()
9837 {
9838         if (getuid() == 0) {
9839                 printf("(I see you are running Configure as super-user...)\n");
9840                 setuid(1);
9841         }
9842 #ifdef TRY_BSD_PGRP
9843         if (getpgrp(1) == 0)
9844                 exit(0);
9845 #else
9846         if (getpgrp() > 0)
9847                 exit(0);
9848 #endif
9849         exit(1);
9850 }
9851 EOP
9852         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9853                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
9854                 val="$define"
9855         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9856                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
9857                 val="$undef"
9858         else
9859                 echo "I can't seem to compile and run the test program."
9860                 if ./usg; then
9861                         xxx="a USG one, i.e. you use getpgrp()."
9862                 else
9863                         # SVR4 systems can appear rather BSD-ish.
9864                         case "$i_unistd" in
9865                         $undef)
9866                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
9867                                 val="$define"
9868                                 ;;
9869                         $define)
9870                                 xxx="probably a USG one, i.e. you use getpgrp()."
9871                                 val="$undef"
9872                                 ;;
9873                         esac
9874                 fi
9875                 echo "Assuming your getpgrp is $xxx" >&4
9876         fi
9877         ;;
9878 *) val="$undef";;
9879 esac
9880 set d_bsdgetpgrp
9881 eval $setvar
9882 $rm -f try try.*
9883
9884 : see if setpgrp exists
9885 set setpgrp d_setpgrp
9886 eval $inlibc
9887
9888 case "$d_setpgrp" in
9889 "$define")
9890         echo " "
9891         echo "Checking to see which flavor of setpgrp is in use..."
9892         $cat >try.c <<EOP
9893 #$i_unistd I_UNISTD
9894 #include <sys/types.h>
9895 #ifdef I_UNISTD
9896 #  include <unistd.h>
9897 #endif
9898 int main()
9899 {
9900         if (getuid() == 0) {
9901                 printf("(I see you are running Configure as super-user...)\n");
9902                 setuid(1);
9903         }
9904 #ifdef TRY_BSD_PGRP
9905         if (-1 == setpgrp(1, 1))
9906                 exit(0);
9907 #else
9908         if (setpgrp() != -1)
9909                 exit(0);
9910 #endif
9911         exit(1);
9912 }
9913 EOP
9914         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9915                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
9916                 val="$define"
9917         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9918                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
9919                 val="$undef"
9920         else
9921                 echo "(I can't seem to compile and run the test program.)"
9922                 if ./usg; then
9923                         xxx="a USG one, i.e. you use setpgrp()."
9924                 else
9925                         # SVR4 systems can appear rather BSD-ish.
9926                         case "$i_unistd" in
9927                         $undef)
9928                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
9929                                 val="$define"
9930                                 ;;
9931                         $define)
9932                                 xxx="probably a USG one, i.e. you use setpgrp()."
9933                                 val="$undef"
9934                                 ;;
9935                         esac
9936                 fi
9937                 echo "Assuming your setpgrp is $xxx" >&4
9938         fi
9939         ;;
9940 *) val="$undef";;
9941 esac
9942 set d_bsdsetpgrp
9943 eval $setvar
9944 $rm -f try try.*
9945 : see if bzero exists
9946 set bzero d_bzero
9947 eval $inlibc
9948
9949 : see if signal is declared as pointer to function returning int or void
9950 echo " "
9951 xxx=`./findhdr signal.h`
9952 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
9953 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
9954         echo "You have int (*signal())() instead of void." >&4
9955         val="$undef"
9956 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
9957         echo "You have void (*signal())()." >&4
9958         val="$define"
9959 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
9960         echo "You have int (*signal())() instead of void." >&4
9961         val="$undef"
9962 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
9963         echo "You have void (*signal())()." >&4
9964         val="$define"
9965 else
9966         case "$d_voidsig" in
9967         '')
9968         echo "I can't determine whether signal handler returns void or int..." >&4
9969                 dflt=void
9970                 rp="What type does your signal handler return?"
9971                 . ./myread
9972                 case "$ans" in
9973                 v*) val="$define";;
9974                 *) val="$undef";;
9975                 esac;;
9976         "$define")
9977                 echo "As you already told me, signal handler returns void." >&4
9978                 val="$define"
9979                 ;;
9980         *)      echo "As you already told me, signal handler returns int." >&4
9981                 val="$undef"
9982                 ;;
9983         esac
9984 fi
9985 set d_voidsig
9986 eval $setvar
9987 case "$d_voidsig" in
9988 "$define") signal_t="void";;
9989 *) signal_t="int";;
9990 esac
9991 $rm -f $$.tmp
9992
9993 : check for ability to cast large floats to 32-bit ints.
9994 echo " "
9995 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
9996 if $test "$intsize" -ge 4; then
9997         xxx=int
9998 else
9999         xxx=long
10000 fi
10001 $cat >try.c <<EOCP
10002 #include <stdio.h>
10003 #include <sys/types.h>
10004 #include <signal.h>
10005 $signal_t blech(s) int s; { exit(3); }
10006 int main()
10007 {
10008         $xxx i32;
10009         double f, g;
10010         int result = 0;
10011         char str[16];
10012         signal(SIGFPE, blech);
10013
10014         /* Don't let compiler optimize the test away.  Store the number 
10015            in a writable string for gcc to pass to sscanf under HP/UX.
10016         */
10017         sprintf(str, "2147483647");
10018         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10019         g = 10 * f;
10020         i32  = ($xxx) g;
10021
10022         /* x86 processors will probably give 0x8000 0000, which is a
10023        sign change.  We don't want that.  We want to mimic SPARC
10024            behavior here, which is to preserve the sign and give
10025            back 0x7fff ffff.
10026         */
10027         if (i32 != ($xxx) f)
10028                 result |= 1;
10029         exit(result);
10030 }
10031 EOCP
10032 set try
10033 if eval $compile_ok; then
10034         $run ./try
10035         yyy=$?
10036 else
10037         echo "(I can't seem to compile the test program--assuming it can't)"
10038         yyy=1
10039 fi
10040 case "$yyy" in
10041 0)      val="$define"
10042         echo "Yup, it can."
10043         ;;
10044 *)      val="$undef"
10045         echo "Nope, it can't."
10046         ;;
10047 esac
10048 set d_casti32
10049 eval $setvar
10050 $rm -f try try.*
10051
10052 : check for ability to cast negative floats to unsigned
10053 echo " "
10054 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10055 $cat >try.c <<EOCP
10056 #include <stdio.h>
10057 #include <sys/types.h>
10058 #include <signal.h>
10059 $signal_t blech(s) int s; { exit(7); }
10060 $signal_t blech_in_list(s) int s; { exit(4); }
10061 unsigned long dummy_long(p) unsigned long p; { return p; }
10062 unsigned int dummy_int(p) unsigned int p; { return p; }
10063 unsigned short dummy_short(p) unsigned short p; { return p; }
10064 int main()
10065 {
10066         double f;
10067         unsigned long along;
10068         unsigned int aint;
10069         unsigned short ashort;
10070         int result = 0;
10071         char str[16];
10072         
10073         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10074            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10075            optimized the whole file away
10076         */
10077         /* Store the number in a writable string for gcc to pass to 
10078            sscanf under HP/UX.
10079         */
10080         sprintf(str, "-123");
10081         sscanf(str, "%lf", &f);  /* f = -123.; */
10082
10083         signal(SIGFPE, blech);
10084         along = (unsigned long)f;
10085         aint = (unsigned int)f;
10086         ashort = (unsigned short)f;
10087         if (along != (unsigned long)-123)
10088                 result |= 1;
10089         if (aint != (unsigned int)-123)
10090                 result |= 1;
10091         if (ashort != (unsigned short)-123)
10092                 result |= 1;
10093         sprintf(str, "1073741824.");
10094         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10095         f = f + f;
10096         along = 0;
10097         along = (unsigned long)f;
10098         if (along != 0x80000000)
10099                 result |= 2;
10100         f -= 1.;
10101         along = 0;
10102         along = (unsigned long)f;
10103         if (along != 0x7fffffff)
10104                 result |= 1;
10105         f += 2.;
10106         along = 0;
10107         along = (unsigned long)f;
10108         if (along != 0x80000001)
10109                 result |= 2;
10110         if (result)
10111                 exit(result);
10112         signal(SIGFPE, blech_in_list);
10113         sprintf(str, "123.");
10114         sscanf(str, "%lf", &f);  /* f = 123.; */
10115         along = dummy_long((unsigned long)f);
10116         aint = dummy_int((unsigned int)f);
10117         ashort = dummy_short((unsigned short)f);
10118         if (along != (unsigned long)123)
10119                 result |= 4;
10120         if (aint != (unsigned int)123)
10121                 result |= 4;
10122         if (ashort != (unsigned short)123)
10123                 result |= 4;
10124         exit(result);
10125
10126 }
10127 EOCP
10128 set try
10129 if eval $compile_ok; then
10130         $run ./try
10131         castflags=$?
10132 else
10133         echo "(I can't seem to compile the test program--assuming it can't)"
10134         castflags=7
10135 fi
10136 case "$castflags" in
10137 0)      val="$define"
10138         echo "Yup, it can."
10139         ;;
10140 *)      val="$undef"
10141         echo "Nope, it can't."
10142         ;;
10143 esac
10144 set d_castneg
10145 eval $setvar
10146 $rm -f try.*
10147
10148 : see if vprintf exists
10149 echo " "
10150 if set vprintf val -f d_vprintf; eval $csym; $val; then
10151         echo 'vprintf() found.' >&4
10152         val="$define"
10153         $cat >try.c <<'EOF'
10154 #include <varargs.h>
10155
10156 int main() { xxx("foo"); }
10157
10158 xxx(va_alist)
10159 va_dcl
10160 {
10161         va_list args;
10162         char buf[10];
10163
10164         va_start(args);
10165         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10166 }
10167 EOF
10168         set try
10169         if eval $compile && $run ./try; then
10170                 echo "Your vsprintf() returns (int)." >&4
10171                 val2="$undef"
10172         else
10173                 echo "Your vsprintf() returns (char*)." >&4
10174                 val2="$define"
10175         fi
10176 else
10177         echo 'vprintf() NOT found.' >&4
10178                 val="$undef"
10179                 val2="$undef"
10180 fi
10181 $rm -f try try.*
10182 set d_vprintf
10183 eval $setvar
10184 val=$val2
10185 set d_charvspr
10186 eval $setvar
10187
10188 : see if chown exists
10189 set chown d_chown
10190 eval $inlibc
10191
10192 : see if chroot exists
10193 set chroot d_chroot
10194 eval $inlibc
10195
10196 : see if chsize exists
10197 set chsize d_chsize
10198 eval $inlibc
10199
10200 : see if class exists
10201 set class d_class
10202 eval $inlibc
10203
10204 hasstruct='varname=$1; struct=$2; shift; shift;
10205 while $test $# -ge 2; do
10206         case "$1" in
10207         $define) echo "#include <$2>";;
10208         esac ;
10209     shift 2;
10210 done > try.c;
10211 echo "int main () { struct $struct foo; }" >> try.c;
10212 set try;
10213 if eval $compile; then
10214         val="$define";
10215 else
10216         val="$undef";
10217 fi;
10218 set $varname;
10219 eval $setvar;
10220 $rm -f try.c try.o'
10221
10222 socketlib=''
10223 sockethdr=''
10224 : see whether socket exists
10225 echo " "
10226 $echo $n "Hmm... $c" >&4
10227 if set socket val -f d_socket; eval $csym; $val; then
10228         echo "Looks like you have Berkeley networking support." >&4
10229         d_socket="$define"
10230         if set setsockopt val -f; eval $csym; $val; then
10231                 d_oldsock="$undef"
10232         else
10233                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10234                 d_oldsock="$define"
10235         fi
10236 else
10237         if $contains socklib libc.list >/dev/null 2>&1; then
10238                 echo "Looks like you have Berkeley networking support." >&4
10239                 d_socket="$define"
10240                 : we will have to assume that it supports the 4.2 BSD interface
10241                 d_oldsock="$undef"
10242         else
10243                 echo "You don't have Berkeley networking in libc$_a..." >&4
10244                 if test "X$d_socket" = "X$define"; then
10245                    echo "...but you seem to believe that you have sockets." >&4
10246                 else
10247                         for net in net socket
10248                         do
10249                                 if test -f /usr/lib/lib$net$_a; then
10250                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10251                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10252                                         if $contains socket libc.list >/dev/null 2>&1; then
10253                                                 d_socket="$define"
10254                                                 socketlib="-l$net"
10255                                                 case "$net" in
10256                                                 net)
10257                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10258                                                         sockethdr="-I/usr/netinclude"
10259                                                         ;;
10260                                                 esac
10261                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10262                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10263                                                         d_oldsock="$undef"
10264                                                 else
10265                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10266                                                         d_oldsock="$define"
10267                                                 fi
10268                                                 break
10269                                         fi
10270                                 fi
10271                         done
10272                         if test "X$d_socket" != "X$define"; then
10273                            echo "or anywhere else I see." >&4
10274                            d_socket="$undef"
10275                            d_oldsock="$undef"
10276                         fi
10277                 fi
10278         fi
10279 fi
10280
10281 : see if socketpair exists
10282 set socketpair d_sockpair
10283 eval $inlibc
10284
10285
10286 echo " "
10287 echo "Checking the availability of certain socket constants..." >&4
10288 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10289         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10290         $cat >try.c <<EOF
10291 #include <sys/types.h>
10292 #include <sys/socket.h>
10293 int main() {
10294     int i = $ENUM;
10295 }
10296 EOF
10297         val="$undef"
10298         set try; if eval $compile; then
10299                 val="$define"
10300         fi
10301         set d_${enum}; eval $setvar
10302         $rm -f try.c try
10303 done
10304
10305 : see if this is a sys/uio.h system
10306 set sys/uio.h i_sysuio
10307 eval $inhdr
10308
10309
10310 echo " "
10311 echo "Checking to see if your system supports struct cmsghdr..." >&4
10312 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10313 eval $hasstruct
10314 case "$d_cmsghdr_s" in
10315 "$define")      echo "Yes, it does."   ;;
10316 *)              echo "No, it doesn't." ;;
10317 esac
10318
10319
10320 : check for const keyword
10321 echo " "
10322 echo 'Checking to see if your C compiler knows about "const"...' >&4
10323 $cat >const.c <<'EOCP'
10324 typedef struct spug { int drokk; } spug;
10325 main()
10326 {
10327         const char *foo;
10328         const spug y;
10329 }
10330 EOCP
10331 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10332         val="$define"
10333         echo "Yup, it does."
10334 else
10335         val="$undef"
10336         echo "Nope, it doesn't."
10337 fi
10338 set d_const
10339 eval $setvar
10340
10341 : see if crypt exists
10342 echo " "
10343 set crypt d_crypt
10344 eval $inlibc
10345 case "$d_crypt" in
10346 $define) cryptlib='' ;;
10347 *)      if set crypt val -f d_crypt; eval $csym; $val; then
10348                 echo 'crypt() found.' >&4
10349                 val="$define"
10350                 cryptlib=''
10351         else
10352                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10353                 if $test -z "$cryptlib"; then
10354                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10355                 else
10356                         cryptlib=-lcrypt
10357                 fi
10358                 if $test -z "$cryptlib"; then
10359                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10360                 else
10361                         cryptlib=-lcrypt
10362                 fi
10363                 if $test -z "$cryptlib"; then
10364                         cryptlib=`./loc libcrypt$_a "" $libpth`
10365                 else
10366                         cryptlib=-lcrypt
10367                 fi
10368                 if $test -z "$cryptlib"; then
10369                         echo 'crypt() NOT found.' >&4
10370                         val="$undef"
10371                 else
10372                         val="$define"
10373                 fi
10374         fi
10375         set d_crypt
10376         eval $setvar
10377         ;;
10378 esac
10379
10380 : see if this is a crypt.h system
10381 set crypt.h i_crypt
10382 eval $inhdr
10383
10384 : see if crypt_r exists
10385 set crypt_r d_crypt_r
10386 eval $inlibc
10387 case "$d_crypt_r" in
10388 "$define")
10389         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10390         case "$d_crypt_r_proto:$usethreads" in
10391         ":define")      d_crypt_r_proto=define
10392                 set d_crypt_r_proto crypt_r $hdrs
10393                 eval $hasproto ;;
10394         *)      ;;
10395         esac
10396         case "$d_crypt_r_proto" in
10397         define)
10398         case "$crypt_r_proto" in
10399         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10400         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10401         esac
10402         case "$crypt_r_proto" in
10403         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10404         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10405         esac
10406         case "$crypt_r_proto" in
10407         ''|0)   d_crypt_r=undef
10408                 crypt_r_proto=0
10409                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10410         * )     case "$crypt_r_proto" in
10411                 REENTRANT_PROTO*) ;;
10412                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10413                 esac
10414                 echo "Prototype: $try" ;;
10415         esac
10416         ;;
10417         *)      case "$usethreads" in
10418                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10419                 esac
10420                 d_crypt_r=undef
10421                 crypt_r_proto=0
10422                 ;;
10423         esac
10424         ;;
10425 *)      crypt_r_proto=0
10426         ;;
10427 esac
10428
10429 : get csh whereabouts
10430 case "$csh" in
10431 'csh') val="$undef" ;;
10432 *) val="$define" ;;
10433 esac
10434 set d_csh
10435 eval $setvar
10436 : Respect a hint or command line value for full_csh.
10437 case "$full_csh" in
10438 '') full_csh=$csh ;;
10439 esac
10440
10441 : see if ctermid_r exists
10442 set ctermid_r d_ctermid_r
10443 eval $inlibc
10444 case "$d_ctermid_r" in
10445 "$define")
10446         hdrs="$i_systypes sys/types.h define stdio.h "
10447         case "$d_ctermid_r_proto:$usethreads" in
10448         ":define")      d_ctermid_r_proto=define
10449                 set d_ctermid_r_proto ctermid_r $hdrs
10450                 eval $hasproto ;;
10451         *)      ;;
10452         esac
10453         case "$d_ctermid_r_proto" in
10454         define)
10455         case "$ctermid_r_proto" in
10456         ''|0) try='char* ctermid_r(char*);'
10457         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10458         esac
10459         case "$ctermid_r_proto" in
10460         ''|0)   d_ctermid_r=undef
10461                 ctermid_r_proto=0
10462                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10463         * )     case "$ctermid_r_proto" in
10464                 REENTRANT_PROTO*) ;;
10465                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10466                 esac
10467                 echo "Prototype: $try" ;;
10468         esac
10469         ;;
10470         *)      case "$usethreads" in
10471                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10472                 esac
10473                 d_ctermid_r=undef
10474                 ctermid_r_proto=0
10475                 ;;
10476         esac
10477         ;;
10478 *)      ctermid_r_proto=0
10479         ;;
10480 esac
10481
10482 : see if ctime_r exists
10483 set ctime_r d_ctime_r
10484 eval $inlibc
10485 case "$d_ctime_r" in
10486 "$define")
10487         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10488         case "$d_ctime_r_proto:$usethreads" in
10489         ":define")      d_ctime_r_proto=define
10490                 set d_ctime_r_proto ctime_r $hdrs
10491                 eval $hasproto ;;
10492         *)      ;;
10493         esac
10494         case "$d_ctime_r_proto" in
10495         define)
10496         case "$ctime_r_proto" in
10497         ''|0) try='char* ctime_r(const time_t*, char*);'
10498         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10499         esac
10500         case "$ctime_r_proto" in
10501         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10502         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10503         esac
10504         case "$ctime_r_proto" in
10505         ''|0) try='int ctime_r(const time_t*, char*);'
10506         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10507         esac
10508         case "$ctime_r_proto" in
10509         ''|0) try='int ctime_r(const time_t*, char*, int);'
10510         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10511         esac
10512         case "$ctime_r_proto" in
10513         ''|0)   d_ctime_r=undef
10514                 ctime_r_proto=0
10515                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10516         * )     case "$ctime_r_proto" in
10517                 REENTRANT_PROTO*) ;;
10518                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10519                 esac
10520                 echo "Prototype: $try" ;;
10521         esac
10522         ;;
10523         *)      case "$usethreads" in
10524                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10525                 esac
10526                 d_ctime_r=undef
10527                 ctime_r_proto=0
10528                 ;;
10529         esac
10530         ;;
10531 *)      ctime_r_proto=0
10532         ;;
10533 esac
10534
10535 : see if cuserid exists
10536 set cuserid d_cuserid
10537 eval $inlibc
10538
10539 : see if this is a limits.h system
10540 set limits.h i_limits
10541 eval $inhdr
10542
10543 : see if this is a float.h system
10544 set float.h i_float
10545 eval $inhdr
10546
10547 : See if number of significant digits in a double precision number is known
10548 echo " "
10549 $cat >dbl_dig.c <<EOM
10550 #$i_limits I_LIMITS
10551 #$i_float I_FLOAT
10552 #ifdef I_LIMITS
10553 #include <limits.h>
10554 #endif
10555 #ifdef I_FLOAT
10556 #include <float.h>
10557 #endif
10558 #ifdef DBL_DIG
10559 printf("Contains DBL_DIG");
10560 #endif
10561 EOM
10562 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10563 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10564         echo "DBL_DIG found." >&4
10565         val="$define"
10566 else
10567         echo "DBL_DIG NOT found." >&4
10568         val="$undef"
10569 fi
10570 $rm -f dbl_dig.?
10571 set d_dbl_dig
10572 eval $setvar
10573
10574 : see if dbm.h is available
10575 : see if dbmclose exists
10576 set dbmclose d_dbmclose
10577 eval $inlibc
10578
10579 case "$d_dbmclose" in
10580 $define)
10581         set dbm.h i_dbm
10582         eval $inhdr
10583         case "$i_dbm" in
10584         $define)
10585                 val="$undef"
10586                 set i_rpcsvcdbm
10587                 eval $setvar
10588                 ;;
10589         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10590                 eval $inhdr
10591                 ;;
10592         esac
10593         ;;
10594 *)      echo "We won't be including <dbm.h>"
10595         val="$undef"
10596         set i_dbm
10597         eval $setvar
10598         val="$undef"
10599         set i_rpcsvcdbm
10600         eval $setvar
10601         ;;
10602 esac
10603
10604 : see if prototype for dbminit is available
10605 echo " "
10606 set d_dbminitproto dbminit $i_dbm dbm.h
10607 eval $hasproto
10608
10609 : see if difftime exists
10610 set difftime d_difftime
10611 eval $inlibc
10612
10613 : see if this is a dirent system
10614 echo " "
10615 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10616         val="$define"
10617         echo "<dirent.h> found." >&4
10618 else
10619         val="$undef"
10620         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10621                 echo "<sys/dir.h> found." >&4
10622                 echo " "
10623         else
10624                 xinc=`./findhdr sys/ndir.h`
10625         fi
10626         echo "<dirent.h> NOT found." >&4
10627 fi
10628 set i_dirent
10629 eval $setvar
10630
10631 : Look for type of directory structure.
10632 echo " "
10633 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10634
10635 case "$direntrytype" in
10636 ''|' ')
10637         case "$i_dirent" in
10638         $define) guess1='struct dirent' ;;
10639         *) guess1='struct direct'  ;;
10640         esac
10641         ;;
10642 *)      guess1="$direntrytype"
10643         ;;
10644 esac
10645
10646 case "$guess1" in
10647 'struct dirent') guess2='struct direct' ;;
10648 *) guess2='struct dirent' ;;
10649 esac
10650                 
10651 if $contains "$guess1" try.c >/dev/null 2>&1; then
10652         direntrytype="$guess1"
10653         echo "Your directory entries are $direntrytype." >&4
10654 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10655         direntrytype="$guess2"
10656         echo "Your directory entries seem to be $direntrytype." >&4
10657 else
10658         echo "I don't recognize your system's directory entries." >&4
10659         rp="What type is used for directory entries on this system?"
10660         dflt="$guess1"
10661         . ./myread
10662         direntrytype="$ans"
10663 fi
10664 $rm -f try.c
10665
10666
10667 : see if the directory entry stores field length
10668 echo " "
10669 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10670 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10671         echo "Good, your directory entry keeps length information in d_namlen." >&4
10672         val="$define"
10673 else
10674         echo "Your directory entry does not know about the d_namlen field." >&4
10675         val="$undef"
10676 fi
10677 set d_dirnamlen
10678 eval $setvar
10679 $rm -f try.c
10680
10681 : see if this is an sysdir system
10682 set sys/dir.h i_sysdir
10683 eval $inhdr
10684
10685 : see if this is an sysndir system
10686 set sys/ndir.h i_sysndir
10687 eval $inhdr
10688
10689 : Look for dirfd
10690 echo " "
10691 $cat >dirfd.c <<EOM
10692 #include <stdio.h>
10693 #$i_dirent I_DIRENT             /**/
10694 #$i_sysdir I_SYS_DIR            /**/
10695 #$i_sysndir I_SYS_NDIR          /**/
10696 #$i_systypes I_SYS_TYPES        /**/
10697 #if defined(I_SYS_TYPES)
10698 #include <sys/types.h>
10699 #endif
10700 #if defined(I_DIRENT)
10701 #include <dirent.h>
10702 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10703 #include <sys/dir.h>
10704 #endif
10705 #else
10706 #ifdef I_SYS_NDIR
10707 #include <sys/ndir.h>
10708 #else
10709 #ifdef I_SYS_DIR
10710 #ifdef hp9000s500
10711 #include <ndir.h>       /* may be wrong in the future */
10712 #else
10713 #include <sys/dir.h>
10714 #endif
10715 #endif
10716 #endif
10717 #endif 
10718 int main() {
10719         DIR *dirp = opendir(".");
10720         if (dirfd(dirp) >= 0)
10721                 exit(0);
10722         else
10723                 exit(1);
10724 }
10725 EOM
10726 set dirfd
10727 if eval $compile; then
10728         val="$define"
10729 fi
10730 case "$val" in
10731 $define)        echo "dirfd() found." >&4       ;;
10732 *)              echo "dirfd() NOT found." >&4   ;;
10733 esac
10734 set d_dirfd
10735 eval $setvar
10736 $rm -f dirfd*
10737
10738 : see if dlerror exists
10739 xxx_runnm="$runnm"
10740 runnm=false
10741 set dlerror d_dlerror
10742 eval $inlibc
10743 runnm="$xxx_runnm"
10744
10745 : see if dlfcn is available
10746 set dlfcn.h i_dlfcn
10747 eval $inhdr
10748
10749 case "$usedl" in
10750 $define|y|true)
10751         $cat << EOM
10752
10753 On a few systems, the dynamically loaded modules that perl generates and uses
10754 will need a different extension than shared libs. The default will probably
10755 be appropriate.
10756
10757 EOM
10758         case "$dlext" in
10759         '')     dflt="$so" ;;
10760         *)      dflt="$dlext" ;;
10761         esac
10762         rp='What is the extension of dynamically loaded modules'
10763         . ./myread
10764         dlext="$ans"
10765         ;;
10766 *)
10767         dlext="none"
10768         ;;
10769 esac
10770
10771 : Check if dlsym need a leading underscore
10772 echo " "
10773 val="$undef"
10774
10775 case "$dlsrc" in
10776 dl_dlopen.xs)
10777         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
10778         $cat >dyna.c <<'EOM'
10779 fred () { }
10780 EOM
10781
10782 $cat >fred.c<<EOM
10783
10784 #include <stdio.h>
10785 #$i_dlfcn I_DLFCN
10786 #ifdef I_DLFCN
10787 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
10788 #else
10789 #include <sys/types.h>
10790 #include <nlist.h>
10791 #include <link.h>
10792 #endif
10793
10794 extern int fred() ;
10795
10796 int main()
10797 {
10798     void * handle ;
10799     void * symbol ;
10800 #ifndef RTLD_LAZY
10801     int mode = 1 ;
10802 #else
10803     int mode = RTLD_LAZY ;
10804 #endif
10805     handle = dlopen("./dyna.$dlext", mode) ;
10806     if (handle == NULL) {
10807         printf ("1\n") ;
10808         fflush (stdout) ;
10809         exit(0);
10810     }
10811     symbol = dlsym(handle, "fred") ;
10812     if (symbol == NULL) {
10813         /* try putting a leading underscore */
10814         symbol = dlsym(handle, "_fred") ;
10815         if (symbol == NULL) {
10816             printf ("2\n") ;
10817             fflush (stdout) ;
10818             exit(0);
10819         }
10820         printf ("3\n") ;
10821     }
10822     else
10823         printf ("4\n") ;
10824     fflush (stdout) ;
10825     exit(0);
10826 }
10827 EOM
10828         : Call the object file tmp-dyna.o in case dlext=o.
10829         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
10830                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
10831                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
10832                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
10833                 xxx=`$run ./fred`
10834                 case $xxx in
10835                 1)      echo "Test program failed using dlopen." >&4
10836                         echo "Perhaps you should not use dynamic loading." >&4;;
10837                 2)      echo "Test program failed using dlsym." >&4
10838                         echo "Perhaps you should not use dynamic loading." >&4;;
10839                 3)      echo "dlsym needs a leading underscore" >&4
10840                         val="$define" ;;
10841                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
10842                 esac
10843         else
10844                 echo "I can't compile and run the test program." >&4
10845                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
10846         fi
10847         ;;
10848 esac
10849                 
10850 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
10851
10852 set d_dlsymun
10853 eval $setvar
10854
10855 : see if drand48_r exists
10856 set drand48_r d_drand48_r
10857 eval $inlibc
10858 case "$d_drand48_r" in
10859 "$define")
10860         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
10861         case "$d_drand48_r_proto:$usethreads" in
10862         ":define")      d_drand48_r_proto=define
10863                 set d_drand48_r_proto drand48_r $hdrs
10864                 eval $hasproto ;;
10865         *)      ;;
10866         esac
10867         case "$d_drand48_r_proto" in
10868         define)
10869         case "$drand48_r_proto" in
10870         ''|0) try='int drand48_r(struct drand48_data*, double*);'
10871         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
10872         esac
10873         case "$drand48_r_proto" in
10874         ''|0)   d_drand48_r=undef
10875                 drand48_r_proto=0
10876                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10877         * )     case "$drand48_r_proto" in
10878                 REENTRANT_PROTO*) ;;
10879                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
10880                 esac
10881                 echo "Prototype: $try" ;;
10882         esac
10883         ;;
10884         *)      case "$usethreads" in
10885                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
10886                 esac
10887                 d_drand48_r=undef
10888                 drand48_r_proto=0
10889                 ;;
10890         esac
10891         ;;
10892 *)      drand48_r_proto=0
10893         ;;
10894 esac
10895
10896 : see if prototype for drand48 is available
10897 echo " "
10898 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
10899 eval $hasproto
10900
10901 : see if dup2 exists
10902 set dup2 d_dup2
10903 eval $inlibc
10904
10905 : see if eaccess exists
10906 set eaccess d_eaccess
10907 eval $inlibc
10908
10909 : see if endgrent exists
10910 set endgrent d_endgrent
10911 eval $inlibc
10912
10913 : see if this is an grp system
10914 set grp.h i_grp
10915 eval $inhdr
10916
10917 case "$i_grp" in
10918 $define)
10919         xxx=`./findhdr grp.h`
10920         $cppstdin $cppflags $cppminus < $xxx >$$.h
10921
10922         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10923                 val="$define"
10924         else
10925                 val="$undef"
10926         fi
10927         set d_grpasswd
10928         eval $setvar
10929
10930         $rm -f $$.h
10931         ;;
10932 *)
10933         val="$undef";
10934         set d_grpasswd; eval $setvar
10935         ;;
10936 esac
10937
10938 : see if endgrent_r exists
10939 set endgrent_r d_endgrent_r
10940 eval $inlibc
10941 case "$d_endgrent_r" in
10942 "$define")
10943         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
10944         case "$d_endgrent_r_proto:$usethreads" in
10945         ":define")      d_endgrent_r_proto=define
10946                 set d_endgrent_r_proto endgrent_r $hdrs
10947                 eval $hasproto ;;
10948         *)      ;;
10949         esac
10950         case "$d_endgrent_r_proto" in
10951         define)
10952         case "$endgrent_r_proto" in
10953         ''|0) try='int endgrent_r(FILE**);'
10954         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
10955         esac
10956         case "$endgrent_r_proto" in
10957         ''|0) try='void endgrent_r(FILE**);'
10958         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
10959         esac
10960         case "$endgrent_r_proto" in
10961         ''|0)   d_endgrent_r=undef
10962                 endgrent_r_proto=0
10963                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10964         * )     case "$endgrent_r_proto" in
10965                 REENTRANT_PROTO*) ;;
10966                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
10967                 esac
10968                 echo "Prototype: $try" ;;
10969         esac
10970         ;;
10971         *)      case "$usethreads" in
10972                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
10973                 esac
10974                 d_endgrent_r=undef
10975                 endgrent_r_proto=0
10976                 ;;
10977         esac
10978         ;;
10979 *)      endgrent_r_proto=0
10980         ;;
10981 esac
10982
10983 : see if endhostent exists
10984 set endhostent d_endhent
10985 eval $inlibc
10986
10987 : see if this is a netdb.h system
10988 set netdb.h i_netdb
10989 eval $inhdr
10990
10991 : see if endhostent_r exists
10992 set endhostent_r d_endhostent_r
10993 eval $inlibc
10994 case "$d_endhostent_r" in
10995 "$define")
10996         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
10997         case "$d_endhostent_r_proto:$usethreads" in
10998         ":define")      d_endhostent_r_proto=define
10999                 set d_endhostent_r_proto endhostent_r $hdrs
11000                 eval $hasproto ;;
11001         *)      ;;
11002         esac
11003         case "$d_endhostent_r_proto" in
11004         define)
11005         case "$endhostent_r_proto" in
11006         ''|0) try='int endhostent_r(struct hostent_data*);'
11007         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11008         esac
11009         case "$endhostent_r_proto" in
11010         ''|0) try='void endhostent_r(struct hostent_data*);'
11011         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11012         esac
11013         case "$endhostent_r_proto" in
11014         ''|0)   d_endhostent_r=undef
11015                 endhostent_r_proto=0
11016                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11017         * )     case "$endhostent_r_proto" in
11018                 REENTRANT_PROTO*) ;;
11019                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11020                 esac
11021                 echo "Prototype: $try" ;;
11022         esac
11023         ;;
11024         *)      case "$usethreads" in
11025                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11026                 esac
11027                 d_endhostent_r=undef
11028                 endhostent_r_proto=0
11029                 ;;
11030         esac
11031         ;;
11032 *)      endhostent_r_proto=0
11033         ;;
11034 esac
11035
11036 : see if endnetent exists
11037 set endnetent d_endnent
11038 eval $inlibc
11039
11040 : see if endnetent_r exists
11041 set endnetent_r d_endnetent_r
11042 eval $inlibc
11043 case "$d_endnetent_r" in
11044 "$define")
11045         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11046         case "$d_endnetent_r_proto:$usethreads" in
11047         ":define")      d_endnetent_r_proto=define
11048                 set d_endnetent_r_proto endnetent_r $hdrs
11049                 eval $hasproto ;;
11050         *)      ;;
11051         esac
11052         case "$d_endnetent_r_proto" in
11053         define)
11054         case "$endnetent_r_proto" in
11055         ''|0) try='int endnetent_r(struct netent_data*);'
11056         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11057         esac
11058         case "$endnetent_r_proto" in
11059         ''|0) try='void endnetent_r(struct netent_data*);'
11060         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11061         esac
11062         case "$endnetent_r_proto" in
11063         ''|0)   d_endnetent_r=undef
11064                 endnetent_r_proto=0
11065                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11066         * )     case "$endnetent_r_proto" in
11067                 REENTRANT_PROTO*) ;;
11068                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11069                 esac
11070                 echo "Prototype: $try" ;;
11071         esac
11072         ;;
11073         *)      case "$usethreads" in
11074                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11075                 esac
11076                 d_endnetent_r=undef
11077                 endnetent_r_proto=0
11078                 ;;
11079         esac
11080         ;;
11081 *)      endnetent_r_proto=0
11082         ;;
11083 esac
11084
11085 : see if endprotoent exists
11086 set endprotoent d_endpent
11087 eval $inlibc
11088
11089 : see if endprotoent_r exists
11090 set endprotoent_r d_endprotoent_r
11091 eval $inlibc
11092 case "$d_endprotoent_r" in
11093 "$define")
11094         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11095         case "$d_endprotoent_r_proto:$usethreads" in
11096         ":define")      d_endprotoent_r_proto=define
11097                 set d_endprotoent_r_proto endprotoent_r $hdrs
11098                 eval $hasproto ;;
11099         *)      ;;
11100         esac
11101         case "$d_endprotoent_r_proto" in
11102         define)
11103         case "$endprotoent_r_proto" in
11104         ''|0) try='int endprotoent_r(struct protoent_data*);'
11105         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11106         esac
11107         case "$endprotoent_r_proto" in
11108         ''|0) try='void endprotoent_r(struct protoent_data*);'
11109         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11110         esac
11111         case "$endprotoent_r_proto" in
11112         ''|0)   d_endprotoent_r=undef
11113                 endprotoent_r_proto=0
11114                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11115         * )     case "$endprotoent_r_proto" in
11116                 REENTRANT_PROTO*) ;;
11117                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11118                 esac
11119                 echo "Prototype: $try" ;;
11120         esac
11121         ;;
11122         *)      case "$usethreads" in
11123                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11124                 esac
11125                 d_endprotoent_r=undef
11126                 endprotoent_r_proto=0
11127                 ;;
11128         esac
11129         ;;
11130 *)      endprotoent_r_proto=0
11131         ;;
11132 esac
11133
11134 : see if endpwent exists
11135 set endpwent d_endpwent
11136 eval $inlibc
11137
11138 : see if this is a pwd.h system
11139 set pwd.h i_pwd
11140 eval $inhdr
11141
11142 case "$i_pwd" in
11143 $define)
11144         xxx=`./findhdr pwd.h`
11145         $cppstdin $cppflags $cppminus < $xxx >$$.h
11146
11147         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11148                 val="$define"
11149         else
11150                 val="$undef"
11151         fi
11152         set d_pwquota
11153         eval $setvar
11154
11155         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11156                 val="$define"
11157         else
11158                 val="$undef"
11159         fi
11160         set d_pwage
11161         eval $setvar
11162
11163         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11164                 val="$define"
11165         else
11166                 val="$undef"
11167         fi
11168         set d_pwchange
11169         eval $setvar
11170
11171         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11172                 val="$define"
11173         else
11174                 val="$undef"
11175         fi
11176         set d_pwclass
11177         eval $setvar
11178
11179         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11180                 val="$define"
11181         else
11182                 val="$undef"
11183         fi
11184         set d_pwexpire
11185         eval $setvar
11186
11187         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11188                 val="$define"
11189         else
11190                 val="$undef"
11191         fi
11192         set d_pwcomment
11193         eval $setvar
11194
11195         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11196                 val="$define"
11197         else
11198                 val="$undef"
11199         fi
11200         set d_pwgecos
11201         eval $setvar
11202
11203         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11204                 val="$define"
11205         else
11206                 val="$undef"
11207         fi
11208         set d_pwpasswd
11209         eval $setvar
11210
11211         $rm -f $$.h
11212         ;;
11213 *)
11214         val="$undef"; 
11215         set d_pwquota; eval $setvar
11216         set d_pwage; eval $setvar
11217         set d_pwchange; eval $setvar
11218         set d_pwclass; eval $setvar
11219         set d_pwexpire; eval $setvar
11220         set d_pwcomment; eval $setvar
11221         set d_pwgecos; eval $setvar
11222         set d_pwpasswd; eval $setvar
11223         ;;
11224 esac
11225
11226 : see if endpwent_r exists
11227 set endpwent_r d_endpwent_r
11228 eval $inlibc
11229 case "$d_endpwent_r" in
11230 "$define")
11231         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11232         case "$d_endpwent_r_proto:$usethreads" in
11233         ":define")      d_endpwent_r_proto=define
11234                 set d_endpwent_r_proto endpwent_r $hdrs
11235                 eval $hasproto ;;
11236         *)      ;;
11237         esac
11238         case "$d_endpwent_r_proto" in
11239         define)
11240         case "$endpwent_r_proto" in
11241         ''|0) try='int endpwent_r(FILE**);'
11242         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11243         esac
11244         case "$endpwent_r_proto" in
11245         ''|0) try='void endpwent_r(FILE**);'
11246         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11247         esac
11248         case "$endpwent_r_proto" in
11249         ''|0)   d_endpwent_r=undef
11250                 endpwent_r_proto=0
11251                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11252         * )     case "$endpwent_r_proto" in
11253                 REENTRANT_PROTO*) ;;
11254                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11255                 esac
11256                 echo "Prototype: $try" ;;
11257         esac
11258         ;;
11259         *)      case "$usethreads" in
11260                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11261                 esac
11262                 d_endpwent_r=undef
11263                 endpwent_r_proto=0
11264                 ;;
11265         esac
11266         ;;
11267 *)      endpwent_r_proto=0
11268         ;;
11269 esac
11270
11271 : see if endservent exists
11272 set endservent d_endsent
11273 eval $inlibc
11274
11275 : see if endservent_r exists
11276 set endservent_r d_endservent_r
11277 eval $inlibc
11278 case "$d_endservent_r" in
11279 "$define")
11280         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11281         case "$d_endservent_r_proto:$usethreads" in
11282         ":define")      d_endservent_r_proto=define
11283                 set d_endservent_r_proto endservent_r $hdrs
11284                 eval $hasproto ;;
11285         *)      ;;
11286         esac
11287         case "$d_endservent_r_proto" in
11288         define)
11289         case "$endservent_r_proto" in
11290         ''|0) try='int endservent_r(struct servent_data*);'
11291         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11292         esac
11293         case "$endservent_r_proto" in
11294         ''|0) try='void endservent_r(struct servent_data*);'
11295         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11296         esac
11297         case "$endservent_r_proto" in
11298         ''|0)   d_endservent_r=undef
11299                 endservent_r_proto=0
11300                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11301         * )     case "$endservent_r_proto" in
11302                 REENTRANT_PROTO*) ;;
11303                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11304                 esac
11305                 echo "Prototype: $try" ;;
11306         esac
11307         ;;
11308         *)      case "$usethreads" in
11309                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11310                 esac
11311                 d_endservent_r=undef
11312                 endservent_r_proto=0
11313                 ;;
11314         esac
11315         ;;
11316 *)      endservent_r_proto=0
11317         ;;
11318 esac
11319
11320 : Locate the flags for 'open()'
11321 echo " "
11322 $cat >try.c <<'EOCP'
11323 #include <sys/types.h>
11324 #ifdef I_FCNTL
11325 #include <fcntl.h>
11326 #endif
11327 #ifdef I_SYS_FILE
11328 #include <sys/file.h>
11329 #endif
11330 int main() {
11331         if(O_RDONLY);
11332 #ifdef O_TRUNC
11333         exit(0);
11334 #else
11335         exit(1);
11336 #endif
11337 }
11338 EOCP
11339 : check sys/file.h first to get FREAD on Sun
11340 if $test `./findhdr sys/file.h` && \
11341                 set try -DI_SYS_FILE && eval $compile; then
11342         h_sysfile=true;
11343         echo "<sys/file.h> defines the O_* constants..." >&4
11344         if $run ./try; then
11345                 echo "and you have the 3 argument form of open()." >&4
11346                 val="$define"
11347         else
11348                 echo "but not the 3 argument form of open().  Oh, well." >&4
11349                 val="$undef"
11350         fi
11351 elif $test `./findhdr fcntl.h` && \
11352                 set try -DI_FCNTL && eval $compile; then
11353         h_fcntl=true;
11354         echo "<fcntl.h> defines the O_* constants..." >&4
11355         if $run ./try; then
11356                 echo "and you have the 3 argument form of open()." >&4
11357                 val="$define"
11358         else
11359                 echo "but not the 3 argument form of open().  Oh, well." >&4
11360                 val="$undef"
11361         fi
11362 else
11363         val="$undef"
11364         echo "I can't find the O_* constant definitions!  You got problems." >&4
11365 fi
11366 set d_open3
11367 eval $setvar
11368 $rm -f try try.*
11369
11370 : see which of string.h or strings.h is needed
11371 echo " "
11372 strings=`./findhdr string.h`
11373 if $test "$strings" && $test -r "$strings"; then
11374         echo "Using <string.h> instead of <strings.h>." >&4
11375         val="$define"
11376 else
11377         val="$undef"
11378         strings=`./findhdr strings.h`
11379         if $test "$strings" && $test -r "$strings"; then
11380                 echo "Using <strings.h> instead of <string.h>." >&4
11381         else
11382                 echo "No string header found -- You'll surely have problems." >&4
11383         fi
11384 fi
11385 set i_string
11386 eval $setvar
11387 case "$i_string" in
11388 "$undef") strings=`./findhdr strings.h`;;
11389 *)        strings=`./findhdr string.h`;;
11390 esac
11391
11392 : see if this is a sys/file.h system
11393 val=''
11394 set sys/file.h val
11395 eval $inhdr
11396
11397 : do we need to include sys/file.h ?
11398 case "$val" in
11399 "$define")
11400         echo " "
11401         if $h_sysfile; then
11402                 val="$define"
11403                 echo "We'll be including <sys/file.h>." >&4
11404         else
11405                 val="$undef"
11406                 echo "We won't be including <sys/file.h>." >&4
11407         fi
11408         ;;
11409 *)
11410         h_sysfile=false
11411         ;;
11412 esac
11413 set i_sysfile
11414 eval $setvar
11415
11416 : see if fcntl.h is there
11417 val=''
11418 set fcntl.h val
11419 eval $inhdr
11420
11421 : see if we can include fcntl.h
11422 case "$val" in
11423 "$define")
11424         echo " "
11425         if $h_fcntl; then
11426                 val="$define"
11427                 echo "We'll be including <fcntl.h>." >&4
11428         else
11429                 val="$undef"
11430                 if $h_sysfile; then
11431         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11432                 else
11433                         echo "We won't be including <fcntl.h>." >&4
11434                 fi
11435         fi
11436         ;;
11437 *)
11438         h_fcntl=false
11439         val="$undef"
11440         ;;
11441 esac
11442 set i_fcntl
11443 eval $setvar
11444
11445 : check for non-blocking I/O stuff
11446 case "$h_sysfile" in
11447 true) echo "#include <sys/file.h>" > head.c;;
11448 *)
11449        case "$h_fcntl" in
11450        true) echo "#include <fcntl.h>" > head.c;;
11451        *) echo "#include <sys/fcntl.h>" > head.c;;
11452        esac
11453        ;;
11454 esac
11455 echo " "
11456 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11457 case "$o_nonblock" in
11458 '')
11459         $cat head.c > try.c
11460         $cat >>try.c <<EOCP
11461 #include <stdio.h>
11462 #include <stdlib.h>
11463 #$i_fcntl I_FCNTL
11464 #ifdef I_FCNTL
11465 #include <fcntl.h>
11466 #endif
11467 int main() {
11468 #ifdef O_NONBLOCK
11469         printf("O_NONBLOCK\n");
11470         exit(0);
11471 #endif
11472 #ifdef O_NDELAY
11473         printf("O_NDELAY\n");
11474         exit(0);
11475 #endif
11476 #ifdef FNDELAY
11477         printf("FNDELAY\n");
11478         exit(0);
11479 #endif
11480         exit(0);
11481 }
11482 EOCP
11483         set try
11484         if eval $compile_ok; then
11485                 o_nonblock=`$run ./try`
11486                 case "$o_nonblock" in
11487                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11488                 *) echo "Seems like we can use $o_nonblock.";;
11489                 esac
11490         else
11491                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11492         fi
11493         ;;
11494 *) echo "Using $hint value $o_nonblock.";;
11495 esac
11496 $rm -f try try.* .out core
11497
11498 echo " "
11499 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11500 case "$eagain" in
11501 '')
11502         $cat head.c > try.c
11503         $cat >>try.c <<EOCP
11504 #include <errno.h>
11505 #include <sys/types.h>
11506 #include <signal.h>
11507 #include <stdio.h> 
11508 #include <stdlib.h> 
11509 #$i_fcntl I_FCNTL
11510 #ifdef I_FCNTL
11511 #include <fcntl.h>
11512 #endif
11513 #define MY_O_NONBLOCK $o_nonblock
11514 #ifndef errno  /* XXX need better Configure test */
11515 extern int errno;
11516 #endif
11517 #$i_unistd I_UNISTD
11518 #ifdef I_UNISTD
11519 #include <unistd.h>
11520 #endif
11521 #$i_string I_STRING
11522 #ifdef I_STRING
11523 #include <string.h>
11524 #else
11525 #include <strings.h>
11526 #endif
11527 $signal_t blech(x) int x; { exit(3); }
11528 EOCP
11529         $cat >> try.c <<'EOCP'
11530 int main()
11531 {
11532         int pd[2];
11533         int pu[2];
11534         char buf[1];
11535         char string[100];
11536
11537         pipe(pd);       /* Down: child -> parent */
11538         pipe(pu);       /* Up: parent -> child */
11539         if (0 != fork()) {
11540                 int ret;
11541                 close(pd[1]);   /* Parent reads from pd[0] */
11542                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11543 #ifdef F_SETFL
11544                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11545                         exit(1);
11546 #else
11547                 exit(4);
11548 #endif
11549                 signal(SIGALRM, blech);
11550                 alarm(5);
11551                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11552                         exit(2);
11553                 sprintf(string, "%d\n", ret);
11554                 write(2, string, strlen(string));
11555                 alarm(0);
11556 #ifdef EAGAIN
11557                 if (errno == EAGAIN) {
11558                         printf("EAGAIN\n");
11559                         goto ok;
11560                 }
11561 #endif
11562 #ifdef EWOULDBLOCK
11563                 if (errno == EWOULDBLOCK)
11564                         printf("EWOULDBLOCK\n");
11565 #endif
11566         ok:
11567                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11568                 sleep(2);                               /* Give it time to close our pipe */
11569                 alarm(5);
11570                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11571                 alarm(0);
11572                 sprintf(string, "%d\n", ret);
11573                 write(4, string, strlen(string));
11574                 exit(0);
11575         }
11576
11577         close(pd[0]);                   /* We write to pd[1] */
11578         close(pu[1]);                   /* We read from pu[0] */
11579         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11580         close(pd[1]);                   /* Pipe pd is now fully closed! */
11581         exit(0);                                /* Bye bye, thank you for playing! */
11582 }
11583 EOCP
11584         set try
11585         if eval $compile_ok; then
11586                 echo "$startsh" >mtry
11587                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11588                 chmod +x mtry
11589                 ./mtry >/dev/null 2>&1
11590                 case $? in
11591                 0) eagain=`$cat try.out`;;
11592                 1) echo "Could not perform non-blocking setting!";;
11593                 2) echo "I did a successful read() for something that was not there!";;
11594                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11595                 4) echo "Could not find F_SETFL!";;
11596                 *) echo "Something terribly wrong happened during testing.";;
11597                 esac
11598                 rd_nodata=`$cat try.ret`
11599                 echo "A read() system call with no data present returns $rd_nodata."
11600                 case "$rd_nodata" in
11601                 0|-1) ;;
11602                 *)
11603                         echo "(That's peculiar, fixing that to be -1.)"
11604                         rd_nodata=-1
11605                         ;;
11606                 esac
11607                 case "$eagain" in
11608                 '')
11609                         echo "Forcing errno EAGAIN on read() with no data available."
11610                         eagain=EAGAIN
11611                         ;;
11612                 *)
11613                         echo "Your read() sets errno to $eagain when no data is available."
11614                         ;;
11615                 esac
11616                 status=`$cat try.err`
11617                 case "$status" in
11618                 0) echo "And it correctly returns 0 to signal EOF.";;
11619                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11620                 *) echo "However, your read() returns '$status' on EOF??";;
11621                 esac
11622                 val="$define"
11623                 if test "$status" = "$rd_nodata"; then
11624                         echo "WARNING: you can't distinguish between EOF and no data!"
11625                         val="$undef"
11626                 fi
11627         else
11628                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11629                 eagain=EAGAIN
11630         fi
11631         set d_eofnblk
11632         eval $setvar
11633         ;;
11634 *)
11635         echo "Using $hint value $eagain."
11636         echo "Your read() returns $rd_nodata when no data is present."
11637         case "$d_eofnblk" in
11638         "$define") echo "And you can see EOF because read() returns 0.";;
11639         "$undef") echo "But you can't see EOF status from read() returned value.";;
11640         *)
11641                 echo "(Assuming you can't see EOF status from read anyway.)"
11642                 d_eofnblk=$undef
11643                 ;;
11644         esac
11645         ;;
11646 esac
11647 $rm -f try try.* .out core head.c mtry
11648
11649 : see if fchdir exists
11650 set fchdir d_fchdir
11651 eval $inlibc
11652
11653 : see if fchmod exists
11654 set fchmod d_fchmod
11655 eval $inlibc
11656
11657 : see if fchown exists
11658 set fchown d_fchown
11659 eval $inlibc
11660
11661 : see if this is an fcntl system
11662 set fcntl d_fcntl
11663 eval $inlibc
11664
11665 echo " "
11666 : See if fcntl-based locking works.
11667 $cat >try.c <<EOCP
11668 #include <stdlib.h>
11669 #include <unistd.h>
11670 #include <fcntl.h>
11671 #include <signal.h>
11672 $signal_t blech(x) int x; { exit(3); }
11673 int main() {
11674 #if defined(F_SETLK) && defined(F_SETLKW)
11675      struct flock flock;
11676      int retval, fd;
11677      fd = open("try.c", O_RDONLY);
11678      flock.l_type = F_RDLCK;
11679      flock.l_whence = SEEK_SET;
11680      flock.l_start = flock.l_len = 0;
11681      signal(SIGALRM, blech);
11682      alarm(10);
11683      retval = fcntl(fd, F_SETLK, &flock);
11684      close(fd);
11685      (retval < 0 ? exit(2) : exit(0));
11686 #else
11687      exit(2);
11688 #endif
11689 }
11690 EOCP
11691 echo "Checking if fcntl-based file locking works... "
11692 case "$d_fcntl" in
11693 "$define")
11694         set try
11695         if eval $compile_ok; then
11696                 if $run ./try; then
11697                         echo "Yes, it seems to work."
11698                         val="$define"
11699                 else
11700                         echo "Nope, it didn't work."
11701                         val="$undef"
11702                         case "$?" in
11703                         3) $cat >&4 <<EOM
11704 ***
11705 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
11706 *** This is (almost) impossible.
11707 *** If your NFS lock daemons are not feeling well, something like
11708 *** this may happen, please investigate.  Cannot continue, aborting.
11709 ***
11710 EOM
11711                                 exit 1
11712                                 ;;
11713                         esac
11714                 fi
11715         else
11716                 echo "I'm unable to compile the test program, so I'll assume not."
11717                 val="$undef"
11718         fi
11719         ;;
11720 *) val="$undef";
11721         echo "Nope, since you don't even have fcntl()."
11722         ;;
11723 esac
11724 set d_fcntl_can_lock
11725 eval $setvar
11726 $rm -f try*
11727
11728
11729 : check for fd_set items
11730 $cat <<EOM
11731
11732 Checking to see how well your C compiler handles fd_set and friends ...
11733 EOM
11734 $cat >try.c <<EOCP
11735 #$i_systime I_SYS_TIME
11736 #$i_sysselct I_SYS_SELECT
11737 #$d_socket HAS_SOCKET
11738 #include <sys/types.h>
11739 #ifdef HAS_SOCKET
11740 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
11741 #endif
11742 #ifdef I_SYS_TIME
11743 #include <sys/time.h>
11744 #endif
11745 #ifdef I_SYS_SELECT
11746 #include <sys/select.h>
11747 #endif
11748 int main() {
11749         fd_set fds;
11750
11751 #ifdef TRYBITS
11752         if(fds.fds_bits);
11753 #endif
11754
11755 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
11756         exit(0);
11757 #else
11758         exit(1);
11759 #endif
11760 }
11761 EOCP
11762 set try -DTRYBITS
11763 if eval $compile; then
11764         d_fds_bits="$define"
11765         d_fd_set="$define"
11766         echo "Well, your system knows about the normal fd_set typedef..." >&4
11767         if $run ./try; then
11768                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
11769                 d_fd_macros="$define"
11770         else
11771                 $cat >&4 <<'EOM'
11772 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
11773 EOM
11774                 d_fd_macros="$undef"
11775         fi
11776 else
11777         $cat <<'EOM'
11778 Hmm, your compiler has some difficulty with fd_set.  Checking further...
11779 EOM
11780         set try
11781         if eval $compile; then
11782                 d_fds_bits="$undef"
11783                 d_fd_set="$define"
11784                 echo "Well, your system has some sort of fd_set available..." >&4
11785                 if $run ./try; then
11786                         echo "and you have the normal fd_set macros." >&4
11787                         d_fd_macros="$define"
11788                 else
11789                         $cat <<'EOM'
11790 but not the normal fd_set macros!  Gross!  More work for me...
11791 EOM
11792                         d_fd_macros="$undef"
11793                 fi
11794         else
11795         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
11796                 d_fd_set="$undef"
11797                 d_fds_bits="$undef"
11798                 d_fd_macros="$undef"
11799         fi
11800 fi
11801 $rm -f try try.*
11802
11803 : see if fgetpos exists
11804 set fgetpos d_fgetpos
11805 eval $inlibc
11806
11807 : see if finite exists
11808 set finite d_finite
11809 eval $inlibc
11810
11811 : see if finitel exists
11812 set finitel d_finitel
11813 eval $inlibc
11814
11815 : see if flock exists
11816 set flock d_flock
11817 eval $inlibc
11818
11819 : see if prototype for flock is available
11820 echo " "
11821 set d_flockproto flock $i_sysfile sys/file.h
11822 eval $hasproto
11823
11824 : see if fork exists
11825 set fork d_fork
11826 eval $inlibc
11827
11828 : see if fp_class exists
11829 set fp_class d_fp_class
11830 eval $inlibc
11831
11832 : see if pathconf exists
11833 set pathconf d_pathconf
11834 eval $inlibc
11835
11836 : see if fpathconf exists
11837 set fpathconf d_fpathconf
11838 eval $inlibc
11839
11840 : see if fpclass exists
11841 set fpclass d_fpclass
11842 eval $inlibc
11843
11844 : see if fpclassify exists
11845 set fpclassify d_fpclassify
11846 eval $inlibc
11847
11848 : see if fpclassl exists
11849 set fpclassl d_fpclassl
11850 eval $inlibc
11851
11852
11853 : check for fpos64_t
11854 echo " "
11855 echo "Checking to see if you have fpos64_t..." >&4
11856 $cat >try.c <<EOCP
11857 #include <stdio.h>
11858 int main() { fpos64_t x = 7; }
11859 EOCP
11860 set try
11861 if eval $compile; then
11862         val="$define"
11863         echo "You have fpos64_t."
11864 else
11865         val="$undef"
11866         echo "You do not have fpos64_t."
11867         case "$fpossize" in
11868         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
11869         esac
11870 fi
11871 $rm -f try.* try
11872 set d_fpos64_t
11873 eval $setvar
11874
11875 : see if frexpl exists
11876 set frexpl d_frexpl
11877 eval $inlibc
11878
11879 : see if this is a sys/param system
11880 set sys/param.h i_sysparam
11881 eval $inhdr
11882
11883 : see if this is a sys/mount.h system
11884 set sys/mount.h i_sysmount
11885 eval $inhdr
11886
11887
11888 echo " "
11889 echo "Checking to see if your system supports struct fs_data..." >&4
11890 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
11891 eval $hasstruct
11892 case "$d_fs_data_s" in
11893 "$define")      echo "Yes, it does."   ;;
11894 *)              echo "No, it doesn't." ;;
11895 esac
11896
11897 : see if fseeko exists
11898 set fseeko d_fseeko
11899 eval $inlibc
11900 case "$longsize" in
11901 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
11902 esac
11903
11904 : see if fsetpos exists
11905 set fsetpos d_fsetpos
11906 eval $inlibc
11907
11908
11909 : see if fstatfs exists
11910 set fstatfs d_fstatfs
11911 eval $inlibc
11912
11913
11914 : see if statvfs exists
11915 set statvfs d_statvfs
11916 eval $inlibc
11917
11918 : see if fstatvfs exists
11919 set fstatvfs d_fstatvfs
11920 eval $inlibc
11921
11922
11923 : see if fsync exists
11924 set fsync d_fsync
11925 eval $inlibc
11926
11927 : see if ftello exists
11928 set ftello d_ftello
11929 eval $inlibc
11930 case "$longsize" in
11931 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
11932 esac
11933
11934 : see if getcwd exists
11935 set getcwd d_getcwd
11936 eval $inlibc
11937
11938 : see if getespwnam exists
11939 set getespwnam d_getespwnam
11940 eval $inlibc
11941
11942
11943 : see if getfsstat exists
11944 set getfsstat d_getfsstat
11945 eval $inlibc
11946
11947 : see if getgrent exists
11948 set getgrent d_getgrent
11949 eval $inlibc
11950
11951 : see if getgrent_r exists
11952 set getgrent_r d_getgrent_r
11953 eval $inlibc
11954 case "$d_getgrent_r" in
11955 "$define")
11956         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11957         case "$d_getgrent_r_proto:$usethreads" in
11958         ":define")      d_getgrent_r_proto=define
11959                 set d_getgrent_r_proto getgrent_r $hdrs
11960                 eval $hasproto ;;
11961         *)      ;;
11962         esac
11963         case "$d_getgrent_r_proto" in
11964         define)
11965         case "$getgrent_r_proto" in
11966         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
11967         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
11968         esac
11969         case "$getgrent_r_proto" in
11970         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
11971         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
11972         esac
11973         case "$getgrent_r_proto" in
11974         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
11975         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
11976         esac
11977         case "$getgrent_r_proto" in
11978         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
11979         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
11980         esac
11981         case "$getgrent_r_proto" in
11982         ''|0) try='int getgrent_r(struct group*, char*, int);'
11983         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
11984         esac
11985         case "$getgrent_r_proto" in
11986         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
11987         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
11988         esac
11989         case "$getgrent_r_proto" in
11990         ''|0)   d_getgrent_r=undef
11991                 getgrent_r_proto=0
11992                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
11993         * )     case "$getgrent_r_proto" in
11994                 REENTRANT_PROTO*) ;;
11995                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
11996                 esac
11997                 echo "Prototype: $try" ;;
11998         esac
11999         ;;
12000         *)      case "$usethreads" in
12001                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12002                 esac
12003                 d_getgrent_r=undef
12004                 getgrent_r_proto=0
12005                 ;;
12006         esac
12007         ;;
12008 *)      getgrent_r_proto=0
12009         ;;
12010 esac
12011
12012 : see if getgrgid_r exists
12013 set getgrgid_r d_getgrgid_r
12014 eval $inlibc
12015 case "$d_getgrgid_r" in
12016 "$define")
12017         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12018         case "$d_getgrgid_r_proto:$usethreads" in
12019         ":define")      d_getgrgid_r_proto=define
12020                 set d_getgrgid_r_proto getgrgid_r $hdrs
12021                 eval $hasproto ;;
12022         *)      ;;
12023         esac
12024         case "$d_getgrgid_r_proto" in
12025         define)
12026         case "$getgrgid_r_proto" in
12027         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12028         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12029         esac
12030         case "$getgrgid_r_proto" in
12031         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12032         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12033         esac
12034         case "$getgrgid_r_proto" in
12035         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12036         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12037         esac
12038         case "$getgrgid_r_proto" in
12039         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12040         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12041         esac
12042         case "$getgrgid_r_proto" in
12043         ''|0)   d_getgrgid_r=undef
12044                 getgrgid_r_proto=0
12045                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
12046         * )     case "$getgrgid_r_proto" in
12047                 REENTRANT_PROTO*) ;;
12048                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12049                 esac
12050                 echo "Prototype: $try" ;;
12051         esac
12052         ;;
12053         *)      case "$usethreads" in
12054                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12055                 esac
12056                 d_getgrgid_r=undef
12057                 getgrgid_r_proto=0
12058                 ;;
12059         esac
12060         ;;
12061 *)      getgrgid_r_proto=0
12062         ;;
12063 esac
12064
12065 : see if getgrnam_r exists
12066 set getgrnam_r d_getgrnam_r
12067 eval $inlibc
12068 case "$d_getgrnam_r" in
12069 "$define")
12070         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12071         case "$d_getgrnam_r_proto:$usethreads" in
12072         ":define")      d_getgrnam_r_proto=define
12073                 set d_getgrnam_r_proto getgrnam_r $hdrs
12074                 eval $hasproto ;;
12075         *)      ;;
12076         esac
12077         case "$d_getgrnam_r_proto" in
12078         define)
12079         case "$getgrnam_r_proto" in
12080         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12081         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12082         esac
12083         case "$getgrnam_r_proto" in
12084         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12085         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12086         esac
12087         case "$getgrnam_r_proto" in
12088         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12089         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12090         esac
12091         case "$getgrnam_r_proto" in
12092         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12093         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12094         esac
12095         case "$getgrnam_r_proto" in
12096         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12097         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12098         esac
12099         case "$getgrnam_r_proto" in
12100         ''|0)   d_getgrnam_r=undef
12101                 getgrnam_r_proto=0
12102                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
12103         * )     case "$getgrnam_r_proto" in
12104                 REENTRANT_PROTO*) ;;
12105                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12106                 esac
12107                 echo "Prototype: $try" ;;
12108         esac
12109         ;;
12110         *)      case "$usethreads" in
12111                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12112                 esac
12113                 d_getgrnam_r=undef
12114                 getgrnam_r_proto=0
12115                 ;;
12116         esac
12117         ;;
12118 *)      getgrnam_r_proto=0
12119         ;;
12120 esac
12121
12122 : see if gethostbyaddr exists
12123 set gethostbyaddr d_gethbyaddr
12124 eval $inlibc
12125
12126 : see if gethostbyname exists
12127 set gethostbyname d_gethbyname
12128 eval $inlibc
12129
12130 : see if gethostent exists
12131 set gethostent d_gethent
12132 eval $inlibc
12133
12134 : see how we will look up host name
12135 echo " "
12136 call=''
12137 if set gethostname val -f d_gethname; eval $csym; $val; then
12138         echo 'gethostname() found.' >&4
12139         d_gethname="$define"
12140         call=gethostname
12141 fi
12142 if set uname val -f d_uname; eval $csym; $val; then
12143         if ./xenix; then
12144                 $cat <<'EOM'
12145 uname() was found, but you're running xenix, and older versions of xenix
12146 have a broken uname(). If you don't really know whether your xenix is old
12147 enough to have a broken system call, use the default answer.
12148
12149 EOM
12150                 dflt=y
12151                 case "$d_uname" in
12152                 "$define") dflt=n;;
12153                 esac
12154                 rp='Is your uname() broken?'
12155                 . ./myread
12156                 case "$ans" in
12157                 n*) d_uname="$define"; call=uname;;
12158                 esac
12159         else
12160                 echo 'uname() found.' >&4
12161                 d_uname="$define"
12162                 case "$call" in
12163                 '') call=uname ;;
12164                 esac
12165         fi
12166 fi
12167 case "$d_gethname" in
12168 '') d_gethname="$undef";;
12169 esac
12170 case "$d_uname" in
12171 '') d_uname="$undef";;
12172 esac
12173 case "$d_uname$d_gethname" in
12174 *define*)
12175         dflt=n
12176         cat <<EOM
12177  
12178 Every now and then someone has a $call() that lies about the hostname
12179 but can't be fixed for political or economic reasons.  If you wish, I can
12180 pretend $call() isn't there and maybe compute hostname at run-time
12181 thanks to the '$phostname' command.
12182
12183 EOM
12184         rp="Shall I ignore $call() from now on?"
12185         . ./myread
12186         case "$ans" in
12187         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12188         esac;;
12189 esac
12190 case "$phostname" in
12191 '') aphostname='';;
12192 *) case "$aphostname" in
12193         /*) ;;
12194         *) set X $phostname
12195                 shift
12196                 file=$1
12197                 shift
12198                 file=`./loc $file $file $pth`
12199                 aphostname=`echo $file $*`
12200                 ;;
12201         esac
12202         ;;
12203 esac
12204 case "$d_uname$d_gethname" in
12205 *define*) ;;
12206 *)
12207         case "$phostname" in
12208         '')
12209                 echo "There will be no way for $package to get your hostname." >&4;;
12210         *)
12211         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12212                 ;;
12213         esac;;
12214 esac
12215 case "$d_phostname" in
12216 '') d_phostname="$undef";;
12217 esac
12218
12219 : see if gethostbyaddr_r exists
12220 set gethostbyaddr_r d_gethostbyaddr_r
12221 eval $inlibc
12222 case "$d_gethostbyaddr_r" in
12223 "$define")
12224         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12225         case "$d_gethostbyaddr_r_proto:$usethreads" in
12226         ":define")      d_gethostbyaddr_r_proto=define
12227                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12228                 eval $hasproto ;;
12229         *)      ;;
12230         esac
12231         case "$d_gethostbyaddr_r_proto" in
12232         define)
12233         case "$gethostbyaddr_r_proto" in
12234         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12235         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12236         esac
12237         case "$gethostbyaddr_r_proto" in
12238         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12239         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12240         esac
12241         case "$gethostbyaddr_r_proto" in
12242         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12243         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12244         esac
12245         case "$gethostbyaddr_r_proto" in
12246         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12247         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12248         esac
12249         case "$gethostbyaddr_r_proto" in
12250         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12251         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12252         esac
12253         case "$gethostbyaddr_r_proto" in
12254         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12255         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12256         esac
12257         case "$gethostbyaddr_r_proto" in
12258         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12259         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12260         esac
12261         case "$gethostbyaddr_r_proto" in
12262         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12263         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12264         esac
12265         case "$gethostbyaddr_r_proto" in
12266         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
12267         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
12268         esac
12269         case "$gethostbyaddr_r_proto" in
12270         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
12271         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
12272         esac
12273         case "$gethostbyaddr_r_proto" in
12274         ''|0)   d_gethostbyaddr_r=undef
12275                 gethostbyaddr_r_proto=0
12276                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
12277         * )     case "$gethostbyaddr_r_proto" in
12278                 REENTRANT_PROTO*) ;;
12279                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
12280                 esac
12281                 echo "Prototype: $try" ;;
12282         esac
12283         ;;
12284         *)      case "$usethreads" in
12285                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
12286                 esac
12287                 d_gethostbyaddr_r=undef
12288                 gethostbyaddr_r_proto=0
12289                 ;;
12290         esac
12291         ;;
12292 *)      gethostbyaddr_r_proto=0
12293         ;;
12294 esac
12295
12296 : see if gethostbyname_r exists
12297 set gethostbyname_r d_gethostbyname_r
12298 eval $inlibc
12299 case "$d_gethostbyname_r" in
12300 "$define")
12301         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12302         case "$d_gethostbyname_r_proto:$usethreads" in
12303         ":define")      d_gethostbyname_r_proto=define
12304                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
12305                 eval $hasproto ;;
12306         *)      ;;
12307         esac
12308         case "$d_gethostbyname_r_proto" in
12309         define)
12310         case "$gethostbyname_r_proto" in
12311         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
12312         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
12313         esac
12314         case "$gethostbyname_r_proto" in
12315         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
12316         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
12317         esac
12318         case "$gethostbyname_r_proto" in
12319         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
12320         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
12321         esac
12322         case "$gethostbyname_r_proto" in
12323         ''|0)   d_gethostbyname_r=undef
12324                 gethostbyname_r_proto=0
12325                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
12326         * )     case "$gethostbyname_r_proto" in
12327                 REENTRANT_PROTO*) ;;
12328                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
12329                 esac
12330                 echo "Prototype: $try" ;;
12331         esac
12332         ;;
12333         *)      case "$usethreads" in
12334                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
12335                 esac
12336                 d_gethostbyname_r=undef
12337                 gethostbyname_r_proto=0
12338                 ;;
12339         esac
12340         ;;
12341 *)      gethostbyname_r_proto=0
12342         ;;
12343 esac
12344
12345 : see if gethostent_r exists
12346 set gethostent_r d_gethostent_r
12347 eval $inlibc
12348 case "$d_gethostent_r" in
12349 "$define")
12350         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12351         case "$d_gethostent_r_proto:$usethreads" in
12352         ":define")      d_gethostent_r_proto=define
12353                 set d_gethostent_r_proto gethostent_r $hdrs
12354                 eval $hasproto ;;
12355         *)      ;;
12356         esac
12357         case "$d_gethostent_r_proto" in
12358         define)
12359         case "$gethostent_r_proto" in
12360         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
12361         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
12362         esac
12363         case "$gethostent_r_proto" in
12364         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
12365         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
12366         esac
12367         case "$gethostent_r_proto" in
12368         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
12369         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
12370         esac
12371         case "$gethostent_r_proto" in
12372         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
12373         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
12374         esac
12375         case "$gethostent_r_proto" in
12376         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
12377         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
12378         esac
12379         case "$gethostent_r_proto" in
12380         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
12381         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
12382         esac
12383         case "$gethostent_r_proto" in
12384         ''|0)   d_gethostent_r=undef
12385                 gethostent_r_proto=0
12386                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
12387         * )     case "$gethostent_r_proto" in
12388                 REENTRANT_PROTO*) ;;
12389                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
12390                 esac
12391                 echo "Prototype: $try" ;;
12392         esac
12393         ;;
12394         *)      case "$usethreads" in
12395                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
12396                 esac
12397                 d_gethostent_r=undef
12398                 gethostent_r_proto=0
12399                 ;;
12400         esac
12401         ;;
12402 *)      gethostent_r_proto=0
12403         ;;
12404 esac
12405
12406 : see if prototypes for various gethostxxx netdb.h functions are available
12407 echo " "
12408 set d_gethostprotos gethostent $i_netdb netdb.h
12409 eval $hasproto
12410
12411 : see if getitimer exists
12412 set getitimer d_getitimer
12413 eval $inlibc
12414
12415 : see if getlogin exists
12416 set getlogin d_getlogin
12417 eval $inlibc
12418
12419 : see if getlogin_r exists
12420 set getlogin_r d_getlogin_r
12421 eval $inlibc
12422 case "$d_getlogin_r" in
12423 "$define")
12424         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
12425         case "$d_getlogin_r_proto:$usethreads" in
12426         ":define")      d_getlogin_r_proto=define
12427                 set d_getlogin_r_proto getlogin_r $hdrs
12428                 eval $hasproto ;;
12429         *)      ;;
12430         esac
12431         case "$d_getlogin_r_proto" in
12432         define)
12433         case "$getlogin_r_proto" in
12434         ''|0) try='int getlogin_r(char*, size_t);'
12435         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
12436         esac
12437         case "$getlogin_r_proto" in
12438         ''|0) try='int getlogin_r(char*, int);'
12439         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
12440         esac
12441         case "$getlogin_r_proto" in
12442         ''|0) try='char* getlogin_r(char*, size_t);'
12443         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
12444         esac
12445         case "$getlogin_r_proto" in
12446         ''|0) try='char* getlogin_r(char*, int);'
12447         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
12448         esac
12449         case "$getlogin_r_proto" in
12450         ''|0)   d_getlogin_r=undef
12451                 getlogin_r_proto=0
12452                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
12453         * )     case "$getlogin_r_proto" in
12454                 REENTRANT_PROTO*) ;;
12455                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
12456                 esac
12457                 echo "Prototype: $try" ;;
12458         esac
12459         ;;
12460         *)      case "$usethreads" in
12461                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
12462                 esac
12463                 d_getlogin_r=undef
12464                 getlogin_r_proto=0
12465                 ;;
12466         esac
12467         ;;
12468 *)      getlogin_r_proto=0
12469         ;;
12470 esac
12471
12472 : see if getmnt exists
12473 set getmnt d_getmnt
12474 eval $inlibc
12475
12476 : see if getmntent exists
12477 set getmntent d_getmntent
12478 eval $inlibc
12479
12480 : see if getnetbyaddr exists
12481 set getnetbyaddr d_getnbyaddr
12482 eval $inlibc
12483
12484 : see if getnetbyname exists
12485 set getnetbyname d_getnbyname
12486 eval $inlibc
12487
12488 : see if getnetent exists
12489 set getnetent d_getnent
12490 eval $inlibc
12491
12492 : see if getnetbyaddr_r exists
12493 set getnetbyaddr_r d_getnetbyaddr_r
12494 eval $inlibc
12495 case "$d_getnetbyaddr_r" in
12496 "$define")
12497         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12498         case "$d_getnetbyaddr_r_proto:$usethreads" in
12499         ":define")      d_getnetbyaddr_r_proto=define
12500                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
12501                 eval $hasproto ;;
12502         *)      ;;
12503         esac
12504         case "$d_getnetbyaddr_r_proto" in
12505         define)
12506         case "$getnetbyaddr_r_proto" in
12507         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
12508         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
12509         esac
12510         case "$getnetbyaddr_r_proto" in
12511         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
12512         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
12513         esac
12514         case "$getnetbyaddr_r_proto" in
12515         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
12516         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
12517         esac
12518         case "$getnetbyaddr_r_proto" in
12519         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
12520         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
12521         esac
12522         case "$getnetbyaddr_r_proto" in
12523         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
12524         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
12525         esac
12526         case "$getnetbyaddr_r_proto" in
12527         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
12528         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
12529         esac
12530         case "$getnetbyaddr_r_proto" in
12531         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
12532         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
12533         esac
12534         case "$getnetbyaddr_r_proto" in
12535         ''|0)   d_getnetbyaddr_r=undef
12536                 getnetbyaddr_r_proto=0
12537                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
12538         * )     case "$getnetbyaddr_r_proto" in
12539                 REENTRANT_PROTO*) ;;
12540                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
12541                 esac
12542                 echo "Prototype: $try" ;;
12543         esac
12544         ;;
12545         *)      case "$usethreads" in
12546                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
12547                 esac
12548                 d_getnetbyaddr_r=undef
12549                 getnetbyaddr_r_proto=0
12550                 ;;
12551         esac
12552         ;;
12553 *)      getnetbyaddr_r_proto=0
12554         ;;
12555 esac
12556
12557 : see if getnetbyname_r exists
12558 set getnetbyname_r d_getnetbyname_r
12559 eval $inlibc
12560 case "$d_getnetbyname_r" in
12561 "$define")
12562         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12563         case "$d_getnetbyname_r_proto:$usethreads" in
12564         ":define")      d_getnetbyname_r_proto=define
12565                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
12566                 eval $hasproto ;;
12567         *)      ;;
12568         esac
12569         case "$d_getnetbyname_r_proto" in
12570         define)
12571         case "$getnetbyname_r_proto" in
12572         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
12573         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
12574         esac
12575         case "$getnetbyname_r_proto" in
12576         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
12577         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
12578         esac
12579         case "$getnetbyname_r_proto" in
12580         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
12581         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
12582         esac
12583         case "$getnetbyname_r_proto" in
12584         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
12585         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
12586         esac
12587         case "$getnetbyname_r_proto" in
12588         ''|0)   d_getnetbyname_r=undef
12589                 getnetbyname_r_proto=0
12590                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
12591         * )     case "$getnetbyname_r_proto" in
12592                 REENTRANT_PROTO*) ;;
12593                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
12594                 esac
12595                 echo "Prototype: $try" ;;
12596         esac
12597         ;;
12598         *)      case "$usethreads" in
12599                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
12600                 esac
12601                 d_getnetbyname_r=undef
12602                 getnetbyname_r_proto=0
12603                 ;;
12604         esac
12605         ;;
12606 *)      getnetbyname_r_proto=0
12607         ;;
12608 esac
12609
12610 : see if getnetent_r exists
12611 set getnetent_r d_getnetent_r
12612 eval $inlibc
12613 case "$d_getnetent_r" in
12614 "$define")
12615         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12616         case "$d_getnetent_r_proto:$usethreads" in
12617         ":define")      d_getnetent_r_proto=define
12618                 set d_getnetent_r_proto getnetent_r $hdrs
12619                 eval $hasproto ;;
12620         *)      ;;
12621         esac
12622         case "$d_getnetent_r_proto" in
12623         define)
12624         case "$getnetent_r_proto" in
12625         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
12626         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
12627         esac
12628         case "$getnetent_r_proto" in
12629         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
12630         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
12631         esac
12632         case "$getnetent_r_proto" in
12633         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
12634         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
12635         esac
12636         case "$getnetent_r_proto" in
12637         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
12638         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
12639         esac
12640         case "$getnetent_r_proto" in
12641         ''|0) try='int getnetent_r(struct netent*, char*, int);'
12642         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
12643         esac
12644         case "$getnetent_r_proto" in
12645         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
12646         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
12647         esac
12648         case "$getnetent_r_proto" in
12649         ''|0)   d_getnetent_r=undef
12650                 getnetent_r_proto=0
12651                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
12652         * )     case "$getnetent_r_proto" in
12653                 REENTRANT_PROTO*) ;;
12654                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
12655                 esac
12656                 echo "Prototype: $try" ;;
12657         esac
12658         ;;
12659         *)      case "$usethreads" in
12660                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
12661                 esac
12662                 d_getnetent_r=undef
12663                 getnetent_r_proto=0
12664                 ;;
12665         esac
12666         ;;
12667 *)      getnetent_r_proto=0
12668         ;;
12669 esac
12670
12671 : see if prototypes for various getnetxxx netdb.h functions are available
12672 echo " "
12673 set d_getnetprotos getnetent $i_netdb netdb.h
12674 eval $hasproto
12675
12676 : see if getpagesize exists
12677 set getpagesize d_getpagsz
12678 eval $inlibc
12679
12680
12681 : see if getprotobyname exists
12682 set getprotobyname d_getpbyname
12683 eval $inlibc
12684
12685 : see if getprotobynumber exists
12686 set getprotobynumber d_getpbynumber
12687 eval $inlibc
12688
12689 : see if getprotoent exists
12690 set getprotoent d_getpent
12691 eval $inlibc
12692
12693 : see if getpgid exists
12694 set getpgid d_getpgid
12695 eval $inlibc
12696
12697 : see if getpgrp2 exists
12698 set getpgrp2 d_getpgrp2
12699 eval $inlibc
12700
12701 : see if getppid exists
12702 set getppid d_getppid
12703 eval $inlibc
12704
12705 : see if getpriority exists
12706 set getpriority d_getprior
12707 eval $inlibc
12708
12709 : see if getprotobyname_r exists
12710 set getprotobyname_r d_getprotobyname_r
12711 eval $inlibc
12712 case "$d_getprotobyname_r" in
12713 "$define")
12714         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12715         case "$d_getprotobyname_r_proto:$usethreads" in
12716         ":define")      d_getprotobyname_r_proto=define
12717                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
12718                 eval $hasproto ;;
12719         *)      ;;
12720         esac
12721         case "$d_getprotobyname_r_proto" in
12722         define)
12723         case "$getprotobyname_r_proto" in
12724         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
12725         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
12726         esac
12727         case "$getprotobyname_r_proto" in
12728         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
12729         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
12730         esac
12731         case "$getprotobyname_r_proto" in
12732         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
12733         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
12734         esac
12735         case "$getprotobyname_r_proto" in
12736         ''|0)   d_getprotobyname_r=undef
12737                 getprotobyname_r_proto=0
12738                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
12739         * )     case "$getprotobyname_r_proto" in
12740                 REENTRANT_PROTO*) ;;
12741                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
12742                 esac
12743                 echo "Prototype: $try" ;;
12744         esac
12745         ;;
12746         *)      case "$usethreads" in
12747                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
12748                 esac
12749                 d_getprotobyname_r=undef
12750                 getprotobyname_r_proto=0
12751                 ;;
12752         esac
12753         ;;
12754 *)      getprotobyname_r_proto=0
12755         ;;
12756 esac
12757
12758 : see if getprotobynumber_r exists
12759 set getprotobynumber_r d_getprotobynumber_r
12760 eval $inlibc
12761 case "$d_getprotobynumber_r" in
12762 "$define")
12763         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12764         case "$d_getprotobynumber_r_proto:$usethreads" in
12765         ":define")      d_getprotobynumber_r_proto=define
12766                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
12767                 eval $hasproto ;;
12768         *)      ;;
12769         esac
12770         case "$d_getprotobynumber_r_proto" in
12771         define)
12772         case "$getprotobynumber_r_proto" in
12773         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
12774         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
12775         esac
12776         case "$getprotobynumber_r_proto" in
12777         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
12778         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
12779         esac
12780         case "$getprotobynumber_r_proto" in
12781         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
12782         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
12783         esac
12784         case "$getprotobynumber_r_proto" in
12785         ''|0)   d_getprotobynumber_r=undef
12786                 getprotobynumber_r_proto=0
12787                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
12788         * )     case "$getprotobynumber_r_proto" in
12789                 REENTRANT_PROTO*) ;;
12790                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
12791                 esac
12792                 echo "Prototype: $try" ;;
12793         esac
12794         ;;
12795         *)      case "$usethreads" in
12796                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
12797                 esac
12798                 d_getprotobynumber_r=undef
12799                 getprotobynumber_r_proto=0
12800                 ;;
12801         esac
12802         ;;
12803 *)      getprotobynumber_r_proto=0
12804         ;;
12805 esac
12806
12807 : see if getprotoent_r exists
12808 set getprotoent_r d_getprotoent_r
12809 eval $inlibc
12810 case "$d_getprotoent_r" in
12811 "$define")
12812         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12813         case "$d_getprotoent_r_proto:$usethreads" in
12814         ":define")      d_getprotoent_r_proto=define
12815                 set d_getprotoent_r_proto getprotoent_r $hdrs
12816                 eval $hasproto ;;
12817         *)      ;;
12818         esac
12819         case "$d_getprotoent_r_proto" in
12820         define)
12821         case "$getprotoent_r_proto" in
12822         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
12823         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
12824         esac
12825         case "$getprotoent_r_proto" in
12826         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
12827         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
12828         esac
12829         case "$getprotoent_r_proto" in
12830         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
12831         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
12832         esac
12833         case "$getprotoent_r_proto" in
12834         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
12835         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
12836         esac
12837         case "$getprotoent_r_proto" in
12838         ''|0)   d_getprotoent_r=undef
12839                 getprotoent_r_proto=0
12840                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
12841         * )     case "$getprotoent_r_proto" in
12842                 REENTRANT_PROTO*) ;;
12843                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
12844                 esac
12845                 echo "Prototype: $try" ;;
12846         esac
12847         ;;
12848         *)      case "$usethreads" in
12849                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
12850                 esac
12851                 d_getprotoent_r=undef
12852                 getprotoent_r_proto=0
12853                 ;;
12854         esac
12855         ;;
12856 *)      getprotoent_r_proto=0
12857         ;;
12858 esac
12859
12860 : see if prototypes for various getprotoxxx netdb.h functions are available
12861 echo " "
12862 set d_getprotoprotos getprotoent $i_netdb netdb.h
12863 eval $hasproto
12864
12865 : see if getprpwnam exists
12866 set getprpwnam d_getprpwnam
12867 eval $inlibc
12868
12869 : see if getpwent exists
12870 set getpwent d_getpwent
12871 eval $inlibc
12872
12873 : see if getpwent_r exists
12874 set getpwent_r d_getpwent_r
12875 eval $inlibc
12876 case "$d_getpwent_r" in
12877 "$define")
12878         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12879         case "$d_getpwent_r_proto:$usethreads" in
12880         ":define")      d_getpwent_r_proto=define
12881                 set d_getpwent_r_proto getpwent_r $hdrs
12882                 eval $hasproto ;;
12883         *)      ;;
12884         esac
12885         case "$d_getpwent_r_proto" in
12886         define)
12887         case "$getpwent_r_proto" in
12888         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
12889         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
12890         esac
12891         case "$getpwent_r_proto" in
12892         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
12893         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
12894         esac
12895         case "$getpwent_r_proto" in
12896         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
12897         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
12898         esac
12899         case "$getpwent_r_proto" in
12900         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
12901         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
12902         esac
12903         case "$getpwent_r_proto" in
12904         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
12905         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
12906         esac
12907         case "$getpwent_r_proto" in
12908         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
12909         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
12910         esac
12911         case "$getpwent_r_proto" in
12912         ''|0)   d_getpwent_r=undef
12913                 getpwent_r_proto=0
12914                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
12915         * )     case "$getpwent_r_proto" in
12916                 REENTRANT_PROTO*) ;;
12917                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
12918                 esac
12919                 echo "Prototype: $try" ;;
12920         esac
12921         ;;
12922         *)      case "$usethreads" in
12923                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
12924                 esac
12925                 d_getpwent_r=undef
12926                 getpwent_r_proto=0
12927                 ;;
12928         esac
12929         ;;
12930 *)      getpwent_r_proto=0
12931         ;;
12932 esac
12933
12934 : see if getpwnam_r exists
12935 set getpwnam_r d_getpwnam_r
12936 eval $inlibc
12937 case "$d_getpwnam_r" in
12938 "$define")
12939         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12940         case "$d_getpwnam_r_proto:$usethreads" in
12941         ":define")      d_getpwnam_r_proto=define
12942                 set d_getpwnam_r_proto getpwnam_r $hdrs
12943                 eval $hasproto ;;
12944         *)      ;;
12945         esac
12946         case "$d_getpwnam_r_proto" in
12947         define)
12948         case "$getpwnam_r_proto" in
12949         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
12950         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
12951         esac
12952         case "$getpwnam_r_proto" in
12953         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
12954         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
12955         esac
12956         case "$getpwnam_r_proto" in
12957         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
12958         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
12959         esac
12960         case "$getpwnam_r_proto" in
12961         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
12962         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
12963         esac
12964         case "$getpwnam_r_proto" in
12965         ''|0)   d_getpwnam_r=undef
12966                 getpwnam_r_proto=0
12967                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
12968         * )     case "$getpwnam_r_proto" in
12969                 REENTRANT_PROTO*) ;;
12970                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
12971                 esac
12972                 echo "Prototype: $try" ;;
12973         esac
12974         ;;
12975         *)      case "$usethreads" in
12976                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
12977                 esac
12978                 d_getpwnam_r=undef
12979                 getpwnam_r_proto=0
12980                 ;;
12981         esac
12982         ;;
12983 *)      getpwnam_r_proto=0
12984         ;;
12985 esac
12986
12987 : see if getpwuid_r exists
12988 set getpwuid_r d_getpwuid_r
12989 eval $inlibc
12990 case "$d_getpwuid_r" in
12991 "$define")
12992         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12993         case "$d_getpwuid_r_proto:$usethreads" in
12994         ":define")      d_getpwuid_r_proto=define
12995                 set d_getpwuid_r_proto getpwuid_r $hdrs
12996                 eval $hasproto ;;
12997         *)      ;;
12998         esac
12999         case "$d_getpwuid_r_proto" in
13000         define)
13001         case "$getpwuid_r_proto" in
13002         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13003         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13004         esac
13005         case "$getpwuid_r_proto" in
13006         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13007         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13008         esac
13009         case "$getpwuid_r_proto" in
13010         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13011         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13012         esac
13013         case "$getpwuid_r_proto" in
13014         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13015         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13016         esac
13017         case "$getpwuid_r_proto" in
13018         ''|0)   d_getpwuid_r=undef
13019                 getpwuid_r_proto=0
13020                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
13021         * )     case "$getpwuid_r_proto" in
13022                 REENTRANT_PROTO*) ;;
13023                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13024                 esac
13025                 echo "Prototype: $try" ;;
13026         esac
13027         ;;
13028         *)      case "$usethreads" in
13029                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13030                 esac
13031                 d_getpwuid_r=undef
13032                 getpwuid_r_proto=0
13033                 ;;
13034         esac
13035         ;;
13036 *)      getpwuid_r_proto=0
13037         ;;
13038 esac
13039
13040
13041 : see if getservbyname exists
13042 set getservbyname d_getsbyname
13043 eval $inlibc
13044
13045 : see if getservbyport exists
13046 set getservbyport d_getsbyport
13047 eval $inlibc
13048
13049 : see if getservent exists
13050 set getservent d_getsent
13051 eval $inlibc
13052
13053 : see if getservbyname_r exists
13054 set getservbyname_r d_getservbyname_r
13055 eval $inlibc
13056 case "$d_getservbyname_r" in
13057 "$define")
13058         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13059         case "$d_getservbyname_r_proto:$usethreads" in
13060         ":define")      d_getservbyname_r_proto=define
13061                 set d_getservbyname_r_proto getservbyname_r $hdrs
13062                 eval $hasproto ;;
13063         *)      ;;
13064         esac
13065         case "$d_getservbyname_r_proto" in
13066         define)
13067         case "$getservbyname_r_proto" in
13068         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13069         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13070         esac
13071         case "$getservbyname_r_proto" in
13072         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13073         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13074         esac
13075         case "$getservbyname_r_proto" in
13076         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13077         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13078         esac
13079         case "$getservbyname_r_proto" in
13080         ''|0)   d_getservbyname_r=undef
13081                 getservbyname_r_proto=0
13082                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
13083         * )     case "$getservbyname_r_proto" in
13084                 REENTRANT_PROTO*) ;;
13085                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13086                 esac
13087                 echo "Prototype: $try" ;;
13088         esac
13089         ;;
13090         *)      case "$usethreads" in
13091                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13092                 esac
13093                 d_getservbyname_r=undef
13094                 getservbyname_r_proto=0
13095                 ;;
13096         esac
13097         ;;
13098 *)      getservbyname_r_proto=0
13099         ;;
13100 esac
13101
13102 : see if getservbyport_r exists
13103 set getservbyport_r d_getservbyport_r
13104 eval $inlibc
13105 case "$d_getservbyport_r" in
13106 "$define")
13107         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13108         case "$d_getservbyport_r_proto:$usethreads" in
13109         ":define")      d_getservbyport_r_proto=define
13110                 set d_getservbyport_r_proto getservbyport_r $hdrs
13111                 eval $hasproto ;;
13112         *)      ;;
13113         esac
13114         case "$d_getservbyport_r_proto" in
13115         define)
13116         case "$getservbyport_r_proto" in
13117         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13118         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13119         esac
13120         case "$getservbyport_r_proto" in
13121         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13122         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13123         esac
13124         case "$getservbyport_r_proto" in
13125         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13126         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13127         esac
13128         case "$getservbyport_r_proto" in
13129         ''|0)   d_getservbyport_r=undef
13130                 getservbyport_r_proto=0
13131                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
13132         * )     case "$getservbyport_r_proto" in
13133                 REENTRANT_PROTO*) ;;
13134                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13135                 esac
13136                 echo "Prototype: $try" ;;
13137         esac
13138         ;;
13139         *)      case "$usethreads" in
13140                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13141                 esac
13142                 d_getservbyport_r=undef
13143                 getservbyport_r_proto=0
13144                 ;;
13145         esac
13146         ;;
13147 *)      getservbyport_r_proto=0
13148         ;;
13149 esac
13150
13151 : see if getservent_r exists
13152 set getservent_r d_getservent_r
13153 eval $inlibc
13154 case "$d_getservent_r" in
13155 "$define")
13156         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13157         case "$d_getservent_r_proto:$usethreads" in
13158         ":define")      d_getservent_r_proto=define
13159                 set d_getservent_r_proto getservent_r $hdrs
13160                 eval $hasproto ;;
13161         *)      ;;
13162         esac
13163         case "$d_getservent_r_proto" in
13164         define)
13165         case "$getservent_r_proto" in
13166         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13167         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13168         esac
13169         case "$getservent_r_proto" in
13170         ''|0) try='int getservent_r(struct servent*, char*, int);'
13171         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13172         esac
13173         case "$getservent_r_proto" in
13174         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13175         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13176         esac
13177         case "$getservent_r_proto" in
13178         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13179         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13180         esac
13181         case "$getservent_r_proto" in
13182         ''|0)   d_getservent_r=undef
13183                 getservent_r_proto=0
13184                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
13185         * )     case "$getservent_r_proto" in
13186                 REENTRANT_PROTO*) ;;
13187                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13188                 esac
13189                 echo "Prototype: $try" ;;
13190         esac
13191         ;;
13192         *)      case "$usethreads" in
13193                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13194                 esac
13195                 d_getservent_r=undef
13196                 getservent_r_proto=0
13197                 ;;
13198         esac
13199         ;;
13200 *)      getservent_r_proto=0
13201         ;;
13202 esac
13203
13204 : see if prototypes for various getservxxx netdb.h functions are available
13205 echo " "
13206 set d_getservprotos getservent $i_netdb netdb.h
13207 eval $hasproto
13208
13209 : see if getspnam exists
13210 set getspnam d_getspnam
13211 eval $inlibc
13212
13213 : see if this is a shadow.h system
13214 set shadow.h i_shadow
13215 eval $inhdr
13216
13217 : see if getspnam_r exists
13218 set getspnam_r d_getspnam_r
13219 eval $inlibc
13220 case "$d_getspnam_r" in
13221 "$define")
13222         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
13223         case "$d_getspnam_r_proto:$usethreads" in
13224         ":define")      d_getspnam_r_proto=define
13225                 set d_getspnam_r_proto getspnam_r $hdrs
13226                 eval $hasproto ;;
13227         *)      ;;
13228         esac
13229         case "$d_getspnam_r_proto" in
13230         define)
13231         case "$getspnam_r_proto" in
13232         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13233         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13234         esac
13235         case "$getspnam_r_proto" in
13236         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13237         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13238         esac
13239         case "$getspnam_r_proto" in
13240         ''|0)   d_getspnam_r=undef
13241                 getspnam_r_proto=0
13242                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
13243         * )     case "$getspnam_r_proto" in
13244                 REENTRANT_PROTO*) ;;
13245                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13246                 esac
13247                 echo "Prototype: $try" ;;
13248         esac
13249         ;;
13250         *)      case "$usethreads" in
13251                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13252                 esac
13253                 d_getspnam_r=undef
13254                 getspnam_r_proto=0
13255                 ;;
13256         esac
13257         ;;
13258 *)      getspnam_r_proto=0
13259         ;;
13260 esac
13261
13262 : see if gettimeofday or ftime exists
13263 set gettimeofday d_gettimeod
13264 eval $inlibc
13265 case "$d_gettimeod" in
13266 "$undef")
13267         set ftime d_ftime 
13268         eval $inlibc
13269         ;;
13270 *)
13271         val="$undef"; set d_ftime; eval $setvar
13272         ;;
13273 esac
13274 case "$d_gettimeod$d_ftime" in
13275 "$undef$undef")
13276         echo " "
13277         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
13278         ;;
13279 esac
13280
13281 : see if gmtime_r exists
13282 set gmtime_r d_gmtime_r
13283 eval $inlibc
13284 case "$d_gmtime_r" in
13285 "$define")
13286         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13287         case "$d_gmtime_r_proto:$usethreads" in
13288         ":define")      d_gmtime_r_proto=define
13289                 set d_gmtime_r_proto gmtime_r $hdrs
13290                 eval $hasproto ;;
13291         *)      ;;
13292         esac
13293         case "$d_gmtime_r_proto" in
13294         define)
13295         case "$gmtime_r_proto" in
13296         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
13297         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
13298         esac
13299         case "$gmtime_r_proto" in
13300         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
13301         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
13302         esac
13303         case "$gmtime_r_proto" in
13304         ''|0)   d_gmtime_r=undef
13305                 gmtime_r_proto=0
13306                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
13307         * )     case "$gmtime_r_proto" in
13308                 REENTRANT_PROTO*) ;;
13309                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
13310                 esac
13311                 echo "Prototype: $try" ;;
13312         esac
13313         ;;
13314         *)      case "$usethreads" in
13315                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
13316                 esac
13317                 d_gmtime_r=undef
13318                 gmtime_r_proto=0
13319                 ;;
13320         esac
13321         ;;
13322 *)      gmtime_r_proto=0
13323         ;;
13324 esac
13325
13326 : see if hasmntopt exists
13327 set hasmntopt d_hasmntopt
13328 eval $inlibc
13329
13330 : see if this is a netinet/in.h or sys/in.h system
13331 set netinet/in.h i_niin sys/in.h i_sysin
13332 eval $inhdr
13333
13334 : see if arpa/inet.h has to be included
13335 set arpa/inet.h i_arpainet
13336 eval $inhdr
13337
13338 : see if htonl --and friends-- exists
13339 val=''
13340 set htonl val
13341 eval $inlibc
13342
13343 : Maybe they are macros.
13344 case "$val" in
13345 $undef)
13346         $cat >htonl.c <<EOM
13347 #include <stdio.h>
13348 #include <sys/types.h>
13349 #$i_niin I_NETINET_IN
13350 #$i_sysin I_SYS_IN
13351 #$i_arpainet I_ARPA_INET
13352 #ifdef I_NETINET_IN
13353 #include <netinet/in.h>
13354 #endif
13355 #ifdef I_SYS_IN
13356 #include <sys/in.h>
13357 #endif
13358 #ifdef I_ARPA_INET
13359 #include <arpa/inet.h>
13360 #endif
13361 #ifdef htonl
13362 printf("Defined as a macro.");
13363 #endif
13364 EOM
13365         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
13366         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
13367                 val="$define"
13368                 echo "But it seems to be defined as a macro." >&4
13369         fi
13370         $rm -f htonl.?
13371         ;;
13372 esac
13373 set d_htonl
13374 eval $setvar
13375
13376 : index or strchr
13377 echo " "
13378 if set index val -f; eval $csym; $val; then
13379         if set strchr val -f d_strchr; eval $csym; $val; then
13380                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
13381                         val="$define"
13382                         vali="$undef"
13383                         echo "strchr() found." >&4
13384                 else
13385                         val="$undef"
13386                         vali="$define"
13387                         echo "index() found." >&4
13388                 fi
13389         else
13390                 val="$undef"
13391                 vali="$define"
13392                 echo "index() found." >&4
13393         fi
13394 else
13395         if set strchr val -f d_strchr; eval $csym; $val; then
13396                 val="$define"
13397                 vali="$undef"
13398                 echo "strchr() found." >&4
13399         else
13400                 echo "No index() or strchr() found!" >&4
13401                 val="$undef"
13402                 vali="$undef"
13403         fi
13404 fi
13405 set d_strchr; eval $setvar
13406 val="$vali"
13407 set d_index; eval $setvar
13408
13409 : check whether inet_aton exists
13410 set inet_aton d_inetaton
13411 eval $inlibc
13412
13413 : Look for isascii
13414 echo " "
13415 $cat >isascii.c <<'EOCP'
13416 #include <stdio.h>
13417 #include <ctype.h>
13418 int main() {
13419         int c = 'A';
13420         if (isascii(c))
13421                 exit(0);
13422         else
13423                 exit(1);
13424 }
13425 EOCP
13426 set isascii
13427 if eval $compile; then
13428         echo "isascii() found." >&4
13429         val="$define"
13430 else
13431         echo "isascii() NOT found." >&4
13432         val="$undef"
13433 fi
13434 set d_isascii
13435 eval $setvar
13436 $rm -f isascii*
13437
13438 : see if isfinite exists
13439 set isfinite d_isfinite
13440 eval $inlibc
13441
13442 : see if isinf exists
13443 set isinf d_isinf
13444 eval $inlibc
13445
13446 : see if isnan exists
13447 set isnan d_isnan
13448 eval $inlibc
13449
13450 : see if isnanl exists
13451 set isnanl d_isnanl
13452 eval $inlibc
13453
13454 : see if killpg exists
13455 set killpg d_killpg
13456 eval $inlibc
13457
13458 : see if lchown exists
13459 echo " "
13460 $cat > try.c <<'EOCP'
13461 /* System header to define __stub macros and hopefully few prototypes,
13462     which can conflict with char lchown(); below.  */
13463 #include <assert.h>
13464 /* Override any gcc2 internal prototype to avoid an error.  */
13465 /* We use char because int might match the return type of a gcc2
13466    builtin and then its argument prototype would still apply.  */
13467 char lchown();
13468 int main() {
13469     /*  The GNU C library defines this for functions which it implements
13470         to always fail with ENOSYS.  Some functions are actually named
13471         something starting with __ and the normal name is an alias.  */
13472 #if defined (__stub_lchown) || defined (__stub___lchown)
13473 choke me
13474 #else
13475 lchown();
13476 #endif
13477 ; return 0; }
13478 EOCP
13479 set try
13480 if eval $compile; then
13481     $echo "lchown() found." >&4
13482     val="$define"
13483 else
13484     $echo "lchown() NOT found." >&4
13485     val="$undef"
13486 fi
13487 set d_lchown
13488 eval $setvar
13489
13490 : See if number of significant digits in a double precision number is known
13491 echo " "
13492 $cat >ldbl_dig.c <<EOM
13493 #$i_limits I_LIMITS
13494 #$i_float I_FLOAT
13495 #ifdef I_LIMITS
13496 #include <limits.h>
13497 #endif
13498 #ifdef I_FLOAT
13499 #include <float.h>
13500 #endif
13501 #ifdef LDBL_DIG
13502 printf("Contains LDBL_DIG");
13503 #endif
13504 EOM
13505 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
13506 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
13507         echo "LDBL_DIG found." >&4
13508         val="$define"
13509 else
13510         echo "LDBL_DIG NOT found." >&4
13511         val="$undef"
13512 fi
13513 $rm -f ldbl_dig.?
13514 set d_ldbl_dig
13515 eval $setvar
13516
13517 : see if link exists
13518 set link d_link
13519 eval $inlibc
13520
13521 : see if localtime_r exists
13522 set localtime_r d_localtime_r
13523 eval $inlibc
13524 case "$d_localtime_r" in
13525 "$define")
13526         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13527         case "$d_localtime_r_proto:$usethreads" in
13528         ":define")      d_localtime_r_proto=define
13529                 set d_localtime_r_proto localtime_r $hdrs
13530                 eval $hasproto ;;
13531         *)      ;;
13532         esac
13533         case "$d_localtime_r_proto" in
13534         define)
13535         case "$localtime_r_proto" in
13536         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
13537         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
13538         esac
13539         case "$localtime_r_proto" in
13540         ''|0) try='int localtime_r(const time_t*, struct tm*);'
13541         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
13542         esac
13543         case "$localtime_r_proto" in
13544         ''|0)   d_localtime_r=undef
13545                 localtime_r_proto=0
13546                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
13547         * )     case "$localtime_r_proto" in
13548                 REENTRANT_PROTO*) ;;
13549                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
13550                 esac
13551                 echo "Prototype: $try" ;;
13552         esac
13553         ;;
13554         *)      case "$usethreads" in
13555                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
13556                 esac
13557                 d_localtime_r=undef
13558                 localtime_r_proto=0
13559                 ;;
13560         esac
13561         ;;
13562 *)      localtime_r_proto=0
13563         ;;
13564 esac
13565
13566 : see if localeconv exists
13567 set localeconv d_locconv
13568 eval $inlibc
13569
13570 : see if lockf exists
13571 set lockf d_lockf
13572 eval $inlibc
13573
13574 : see if prototype for lseek is available
13575 echo " "
13576 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
13577 eval $hasproto
13578
13579 : see if lstat exists
13580 set lstat d_lstat
13581 eval $inlibc
13582
13583 : see if madvise exists
13584 set madvise d_madvise
13585 eval $inlibc
13586
13587 : see if mblen exists
13588 set mblen d_mblen
13589 eval $inlibc
13590
13591 : see if mbstowcs exists
13592 set mbstowcs d_mbstowcs
13593 eval $inlibc
13594
13595 : see if mbtowc exists
13596 set mbtowc d_mbtowc
13597 eval $inlibc
13598
13599 : see if memchr exists
13600 set memchr d_memchr
13601 eval $inlibc
13602
13603 : see if memcmp exists
13604 set memcmp d_memcmp
13605 eval $inlibc
13606
13607 : see if memcpy exists
13608 set memcpy d_memcpy
13609 eval $inlibc
13610
13611 : see if memmove exists
13612 set memmove d_memmove
13613 eval $inlibc
13614
13615 : see if memset exists
13616 set memset d_memset
13617 eval $inlibc
13618
13619 : see if mkdir exists
13620 set mkdir d_mkdir
13621 eval $inlibc
13622
13623 : see if mkdtemp exists
13624 set mkdtemp d_mkdtemp
13625 eval $inlibc
13626
13627 : see if mkfifo exists
13628 set mkfifo d_mkfifo
13629 eval $inlibc
13630
13631 : see if mkstemp exists
13632 set mkstemp d_mkstemp
13633 eval $inlibc
13634
13635 : see if mkstemps exists
13636 set mkstemps d_mkstemps
13637 eval $inlibc
13638
13639 : see if mktime exists
13640 set mktime d_mktime
13641 eval $inlibc
13642
13643 : see if this is a sys/mman.h system
13644 set sys/mman.h i_sysmman
13645 eval $inhdr
13646
13647 : see if mmap exists
13648 set mmap d_mmap
13649 eval $inlibc
13650 : see what shmat returns
13651 : default to something harmless
13652 mmaptype='void *'
13653 case "$i_sysmman$d_mmap" in
13654 "$define$define")
13655         $cat >mmap.c <<'END'
13656 #include <sys/mman.h>
13657 void *mmap();
13658 END
13659         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
13660                 mmaptype='void *'
13661         else
13662                 mmaptype='caddr_t'
13663         fi
13664         echo "and it returns ($mmaptype)." >&4
13665         ;;
13666 esac
13667
13668
13669
13670 : see if mprotect exists
13671 set mprotect d_mprotect
13672 eval $inlibc
13673
13674 : see if msgctl exists
13675 set msgctl d_msgctl
13676 eval $inlibc
13677
13678 : see if msgget exists
13679 set msgget d_msgget
13680 eval $inlibc
13681
13682 : see if msgsnd exists
13683 set msgsnd d_msgsnd
13684 eval $inlibc
13685
13686 : see if msgrcv exists
13687 set msgrcv d_msgrcv
13688 eval $inlibc
13689
13690 : see how much of the 'msg*(2)' library is present.
13691 h_msg=true
13692 echo " "
13693 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
13694 *"$undef"*) h_msg=false;;
13695 esac
13696 case "$osname" in
13697 freebsd)
13698     case "`ipcs 2>&1`" in
13699     "SVID messages"*"not configured"*)
13700         echo "Your $osname does not have the msg*(2) configured." >&4
13701         h_msg=false
13702         val="$undef"
13703         set msgctl d_msgctl
13704         eval $setvar
13705         set msgget d_msgget
13706         eval $setvar
13707         set msgsnd d_msgsnd
13708         eval $setvar
13709         set msgrcv d_msgrcv
13710         eval $setvar
13711         ;;
13712     esac
13713     ;;
13714 esac
13715 : we could also check for sys/ipc.h ...
13716 if $h_msg && $test `./findhdr sys/msg.h`; then
13717         echo "You have the full msg*(2) library." >&4
13718         val="$define"
13719 else
13720         echo "You don't have the full msg*(2) library." >&4
13721         val="$undef"
13722 fi
13723 set d_msg
13724 eval $setvar
13725
13726
13727 echo " "
13728 echo "Checking to see if your system supports struct msghdr..." >&4
13729 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
13730 eval $hasstruct
13731 case "$d_msghdr_s" in
13732 "$define")      echo "Yes, it does."   ;;
13733 *)              echo "No, it doesn't." ;;
13734 esac
13735
13736
13737 : see if msync exists
13738 set msync d_msync
13739 eval $inlibc
13740
13741 : see if munmap exists
13742 set munmap d_munmap
13743 eval $inlibc
13744
13745 : see if nanosleep exists
13746 set nanosleep d_nanosleep
13747 eval $inlibc
13748
13749 : see if nice exists
13750 set nice d_nice
13751 eval $inlibc
13752
13753 : see if this is a langinfo.h system
13754 set langinfo.h i_langinfo
13755 eval $inhdr
13756
13757 : see if nl_langinfo exists
13758 set nl_langinfo d_nl_langinfo
13759 eval $inlibc
13760
13761 : check for length of character
13762 echo " "
13763 case "$charsize" in
13764 '')
13765         echo "Checking to see how big your characters are (hey, you never know)..." >&4
13766         $cat >try.c <<'EOCP'
13767 #include <stdio.h>
13768 int main()
13769 {
13770     printf("%d\n", (int)sizeof(char));
13771     exit(0);
13772 }
13773 EOCP
13774         set try
13775         if eval $compile_ok; then
13776                 dflt=`$run ./try`
13777         else
13778                 dflt='1'
13779                 echo "(I can't seem to compile the test program.  Guessing...)"
13780         fi
13781         ;;
13782 *)
13783         dflt="$charsize"
13784         ;;
13785 esac
13786 rp="What is the size of a character (in bytes)?"
13787 . ./myread
13788 charsize="$ans"
13789 $rm -f try.c try
13790
13791 : check for volatile keyword
13792 echo " "
13793 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
13794 $cat >try.c <<'EOCP'
13795 main()
13796 {
13797         typedef struct _goo_struct goo_struct;
13798         goo_struct * volatile goo = ((goo_struct *)0);
13799         struct _goo_struct {
13800                 long long_int;
13801                 int reg_int;
13802                 char char_var;
13803         };
13804         typedef unsigned short foo_t;
13805         char *volatile foo;
13806         volatile int bar;
13807         volatile foo_t blech;
13808         foo = foo;
13809 }
13810 EOCP
13811 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
13812         val="$define"
13813         echo "Yup, it does."
13814 else
13815         val="$undef"
13816         echo "Nope, it doesn't."
13817 fi
13818 set d_volatile
13819 eval $setvar
13820 $rm -f try.*
13821
13822
13823 echo " "
13824 $echo "Choosing the C types to be used for Perl's internal types..." >&4
13825
13826 case "$use64bitint:$d_quad:$quadtype" in
13827 define:define:?*)
13828         ivtype="$quadtype"
13829         uvtype="$uquadtype"
13830         ivsize=8
13831         uvsize=8
13832         ;;
13833 *)      ivtype="long"
13834         uvtype="unsigned long"
13835         ivsize=$longsize
13836         uvsize=$longsize
13837         ;;
13838 esac
13839
13840 case "$uselongdouble:$d_longdbl" in
13841 define:define)
13842         nvtype="long double"
13843         nvsize=$longdblsize
13844         ;;
13845 *)      nvtype=double
13846         nvsize=$doublesize
13847         ;;
13848 esac
13849
13850 $echo "(IV will be "$ivtype", $ivsize bytes)"
13851 $echo "(UV will be "$uvtype", $uvsize bytes)"
13852 $echo "(NV will be "$nvtype", $nvsize bytes)"
13853
13854 $cat >try.c <<EOCP
13855 #$i_inttypes I_INTTYPES
13856 #ifdef I_INTTYPES
13857 #include <inttypes.h>
13858 #endif
13859 #include <stdio.h>
13860 int main() {
13861 #ifdef INT8
13862    int8_t i =  INT8_MAX;
13863   uint8_t u = UINT8_MAX;
13864   printf("int8_t\n");
13865 #endif
13866 #ifdef INT16
13867    int16_t i =  INT16_MAX;
13868   uint16_t i = UINT16_MAX;
13869   printf("int16_t\n");
13870 #endif
13871 #ifdef INT32
13872    int32_t i =  INT32_MAX;
13873   uint32_t u = UINT32_MAX;
13874   printf("int32_t\n");
13875 #endif
13876 }
13877 EOCP
13878
13879 case "$i8type" in
13880 '')     case "$charsize" in
13881         1)      i8type=char
13882                 u8type="unsigned char"
13883                 i8size=$charsize
13884                 u8size=$charsize
13885                 ;;
13886         esac
13887         ;;
13888 esac
13889 case "$i8type" in
13890 '')     set try -DINT8
13891         if eval $compile; then
13892                 case "`$run ./try`" in
13893                 int8_t) i8type=int8_t
13894                         u8type=uint8_t
13895                         i8size=1
13896                         u8size=1
13897                         ;;
13898                 esac
13899         fi
13900         ;;
13901 esac
13902 case "$i8type" in
13903 '')     if $test $charsize -ge 1; then
13904                 i8type=char
13905                 u8type="unsigned char"
13906                 i8size=$charsize
13907                 u8size=$charsize
13908         fi
13909         ;;
13910 esac
13911
13912 case "$i16type" in
13913 '')     case "$shortsize" in
13914         2)      i16type=short
13915                 u16type="unsigned short"
13916                 i16size=$shortsize
13917                 u16size=$shortsize
13918                 ;;
13919         esac
13920         ;;
13921 esac
13922 case "$i16type" in
13923 '')     set try -DINT16
13924         if eval $compile; then
13925                 case "`$run ./try`" in
13926                 int16_t)
13927                         i16type=int16_t
13928                         u16type=uint16_t
13929                         i16size=2
13930                         u16size=2
13931                         ;;
13932                 esac
13933         fi
13934         ;;
13935 esac
13936 case "$i16type" in
13937 '')     if $test $shortsize -ge 2; then
13938                 i16type=short
13939                 u16type="unsigned short"
13940                 i16size=$shortsize
13941                 u16size=$shortsize
13942         fi
13943         ;;
13944 esac
13945
13946 case "$i32type" in
13947 '')     case "$longsize" in
13948         4)      i32type=long
13949                 u32type="unsigned long"
13950                 i32size=$longsize
13951                 u32size=$longsize
13952                 ;;
13953         *)      case "$intsize" in
13954                 4)      i32type=int
13955                         u32type="unsigned int"
13956                         i32size=$intsize
13957                         u32size=$intsize
13958                         ;;
13959                 esac
13960                 ;;
13961         esac
13962         ;;
13963 esac
13964 case "$i32type" in
13965 '')     set try -DINT32
13966         if eval $compile; then
13967                 case "`$run ./try`" in
13968                 int32_t)
13969                         i32type=int32_t
13970                         u32type=uint32_t
13971                         i32size=4
13972                         u32size=4
13973                         ;;
13974                 esac
13975         fi
13976         ;;
13977 esac
13978 case "$i32type" in
13979 '')     if $test $intsize -ge 4; then
13980                 i32type=int
13981                 u32type="unsigned int"
13982                 i32size=$intsize
13983                 u32size=$intsize
13984         fi
13985         ;;
13986 esac
13987
13988 case "$i64type" in
13989 '')     case "$d_quad:$quadtype" in
13990         define:?*)
13991                 i64type="$quadtype"
13992                 u64type="$uquadtype"
13993                 i64size=8
13994                 u64size=8
13995                 ;;
13996         esac
13997         ;;
13998 esac
13999
14000 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14001 : volatile so that the compiler has to store it out to memory.
14002 if test X"$d_volatile" = X"$define"; then
14003         volatile=volatile
14004 fi
14005 $cat <<EOP >try.c
14006 #include <stdio.h>
14007 #include <sys/types.h>
14008 #include <signal.h>
14009 #ifdef SIGFPE
14010 $volatile int bletched = 0;
14011 $signal_t blech(s) int s; { bletched = 1; }
14012 #endif
14013 int main() {
14014     $uvtype u = 0;
14015     $nvtype d;
14016     int     n = 8 * $uvsize;
14017     int     i;
14018 #ifdef SIGFPE
14019     signal(SIGFPE, blech);
14020 #endif
14021
14022     for (i = 0; i < n; i++) {
14023       u = u << 1 | ($uvtype)1;
14024       d = ($nvtype)u;
14025       if (($uvtype)d != u)
14026         break;
14027       if (d <= 0)
14028         break;
14029       d = ($nvtype)(u - 1);
14030       if (($uvtype)d != (u - 1))
14031         break;
14032 #ifdef SIGFPE
14033       if (bletched) {
14034         break;
14035 #endif
14036       } 
14037     }
14038     printf("%d\n", ((i == n) ? -n : i));
14039     exit(0);
14040 }
14041 EOP
14042 set try
14043
14044 d_nv_preserves_uv="$undef"
14045 if eval $compile; then
14046         nv_preserves_uv_bits="`$run ./try`"
14047 fi
14048 case "$nv_preserves_uv_bits" in
14049 \-[1-9]*)       
14050         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14051         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
14052         d_nv_preserves_uv="$define"
14053         ;;
14054 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
14055         d_nv_preserves_uv="$undef" ;;
14056 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
14057         nv_preserves_uv_bits="$undef" ;;
14058 esac
14059
14060 $rm -f try.* try
14061
14062
14063 : check for off64_t
14064 echo " "
14065 echo "Checking to see if you have off64_t..." >&4
14066 $cat >try.c <<EOCP
14067 #include <sys/types.h>
14068 #include <unistd.h>
14069 int main() { off64_t x = 7; }
14070 EOCP
14071 set try
14072 if eval $compile; then
14073         val="$define"
14074         echo "You have off64_t."
14075 else
14076         val="$undef"
14077         echo "You do not have off64_t."
14078         case "$lseeksize" in
14079         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
14080         esac
14081 fi
14082 $rm -f try.* try
14083 set d_off64_t
14084 eval $setvar
14085
14086 : how to create joinable pthreads
14087 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
14088         echo " "
14089         echo "Checking what constant to use for creating joinable pthreads..." >&4 
14090         $cat >try.c <<'EOCP'
14091 #include <pthread.h>
14092 int main() {
14093     int detachstate = JOINABLE;
14094 }
14095 EOCP
14096         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
14097         if eval $compile; then
14098                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
14099                 val="$undef" # Yes, undef.
14100                 set d_old_pthread_create_joinable
14101                 eval $setvar
14102                 val=""
14103                 set old_pthread_create_joinable
14104                 eval $setvar
14105         else
14106                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
14107                 if eval $compile; then
14108                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
14109                         val="$define"
14110                         set d_old_pthread_create_joinable
14111                         eval $setvar
14112                         val=PTHREAD_CREATE_UNDETACHED
14113                         set old_pthread_create_joinable
14114                         eval $setvar
14115                 else            
14116                         set try -DJOINABLE=__UNDETACHED
14117                         if eval $compile; then
14118                                 echo "You seem to use __UNDETACHED." >&4
14119                                 val="$define"
14120                                 set d_old_pthread_create_joinable
14121                                 eval $setvar
14122                                 val=__UNDETACHED
14123                                 set old_pthread_create_joinable
14124                                 eval $setvar
14125                         else
14126                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
14127                                 val="$define"
14128                                 set d_old_pthread_create_joinable
14129                                 eval $setvar
14130                                 val=0
14131                                 set old_pthread_create_joinable
14132                                 eval $setvar
14133                         fi
14134                 fi
14135         fi
14136         $rm -f try try.*
14137 else
14138     d_old_pthread_create_joinable="$undef"
14139     old_pthread_create_joinable=""
14140 fi
14141
14142 : see if pause exists
14143 set pause d_pause
14144 eval $inlibc
14145
14146 : see if pipe exists
14147 set pipe d_pipe
14148 eval $inlibc
14149
14150 : see if poll exists
14151 set poll d_poll
14152 eval $inlibc
14153
14154 : see if readlink exists
14155 set readlink d_readlink
14156 eval $inlibc
14157
14158 echo " "
14159 procselfexe=''
14160 val="$undef"
14161 case "$d_readlink" in
14162 "$define")
14163         if $issymlink /proc/self/exe ; then
14164                 $ls -l /proc/self/exe > reflect
14165                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
14166                         echo "You have Linux-like /proc/self/exe."
14167                         procselfexe='"/proc/self/exe"'
14168                         val="$define"
14169                 fi
14170         fi
14171         if $issymlink /proc/curproc/file ; then
14172                 $ls -l /proc/curproc/file > reflect
14173                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
14174                         echo "You have BSD-like /proc/curproc/file."
14175                         procselfexe='"/proc/curproc/file"'
14176                         val="$define"
14177                 fi
14178         fi
14179         ;;
14180 esac
14181 $rm -f reflect
14182 set d_procselfexe
14183 eval $setvar
14184
14185 : see whether the pthread_atfork exists
14186 $cat >try.c <<EOP
14187 #include <pthread.h>
14188 #include <stdio.h>
14189 int main() {
14190 #ifdef  PTHREAD_ATFORK
14191         pthread_atfork(NULL,NULL,NULL);
14192 #endif
14193 }
14194 EOP
14195
14196 : see if pthread_atfork exists
14197 set try -DPTHREAD_ATFORK
14198 if eval $compile; then
14199     val="$define"
14200 else
14201     val="$undef"
14202 fi
14203 case "$usethreads" in
14204 $define)
14205         case "$val" in
14206         $define) echo 'pthread_atfork found.' >&4        ;;
14207         *)       echo 'pthread_atfork NOT found.' >&4    ;;
14208         esac
14209 esac
14210 set d_pthread_atfork
14211 eval $setvar
14212
14213
14214 : see whether the various POSIXish _yields exist
14215 $cat >try.c <<EOP
14216 #include <pthread.h>
14217 #include <stdio.h>
14218 int main() {
14219 #ifdef SCHED_YIELD
14220         sched_yield();
14221 #else
14222 #ifdef PTHREAD_YIELD
14223         pthread_yield();
14224 #else
14225 #ifdef PTHREAD_YIELD_NULL
14226         pthread_yield(NULL);
14227 #endif
14228 #endif
14229 #endif
14230 }
14231 EOP
14232 : see if sched_yield exists
14233 set try -DSCHED_YIELD
14234 if eval $compile; then
14235     val="$define"
14236     sched_yield='sched_yield()'
14237 else
14238     val="$undef"
14239 fi
14240 case "$usethreads" in
14241 $define)
14242         case "$val" in
14243         $define) echo 'sched_yield() found.' >&4        ;;
14244         *)       echo 'sched_yield() NOT found.' >&4    ;;
14245         esac
14246 esac
14247 set d_sched_yield
14248 eval $setvar
14249
14250 : see if pthread_yield exists
14251 set try -DPTHREAD_YIELD
14252 if eval $compile; then
14253     val="$define"
14254     case "$sched_yield" in
14255     '') sched_yield='pthread_yield()' ;;
14256     esac
14257 else
14258     set try -DPTHREAD_YIELD_NULL
14259     if eval $compile; then
14260         val="$define"
14261         case "$sched_yield" in
14262         '') sched_yield='pthread_yield(NULL)' ;;
14263         esac
14264     else
14265         val="$undef"
14266     fi
14267 fi
14268 case "$usethreads" in
14269 $define)
14270         case "$val" in
14271         $define) echo 'pthread_yield() found.' >&4      ;;
14272         *)       echo 'pthread_yield() NOT found.' >&4  ;;
14273         esac
14274         ;;
14275 esac
14276 set d_pthread_yield
14277 eval $setvar
14278
14279 case "$sched_yield" in
14280 '') sched_yield=undef ;;
14281 esac
14282
14283 $rm -f try try.*
14284
14285 : see if random_r exists
14286 set random_r d_random_r
14287 eval $inlibc
14288 case "$d_random_r" in
14289 "$define")
14290         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
14291         case "$d_random_r_proto:$usethreads" in
14292         ":define")      d_random_r_proto=define
14293                 set d_random_r_proto random_r $hdrs
14294                 eval $hasproto ;;
14295         *)      ;;
14296         esac
14297         case "$d_random_r_proto" in
14298         define)
14299         case "$random_r_proto" in
14300         ''|0) try='int random_r(int*, struct random_data*);'
14301         ./protochk "extern $try" $hdrs && random_r_proto=I_TS ;;
14302         esac
14303         case "$random_r_proto" in
14304         ''|0)   d_random_r=undef
14305                 random_r_proto=0
14306                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
14307         * )     case "$random_r_proto" in
14308                 REENTRANT_PROTO*) ;;
14309                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
14310                 esac
14311                 echo "Prototype: $try" ;;
14312         esac
14313         ;;
14314         *)      case "$usethreads" in
14315                 define) echo "random_r has no prototype, not using it." >&4 ;;
14316                 esac
14317                 d_random_r=undef
14318                 random_r_proto=0
14319                 ;;
14320         esac
14321         ;;
14322 *)      random_r_proto=0
14323         ;;
14324 esac
14325
14326 : see if readdir and friends exist
14327 set readdir d_readdir
14328 eval $inlibc
14329 set seekdir d_seekdir
14330 eval $inlibc
14331 set telldir d_telldir
14332 eval $inlibc
14333 set rewinddir d_rewinddir
14334 eval $inlibc
14335
14336 : see if readdir64_r exists
14337 set readdir64_r d_readdir64_r
14338 eval $inlibc
14339 case "$d_readdir64_r" in
14340 "$define")
14341         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
14342         case "$d_readdir64_r_proto:$usethreads" in
14343         ":define")      d_readdir64_r_proto=define
14344                 set d_readdir64_r_proto readdir64_r $hdrs
14345                 eval $hasproto ;;
14346         *)      ;;
14347         esac
14348         case "$d_readdir64_r_proto" in
14349         define)
14350         case "$readdir64_r_proto" in
14351         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
14352         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
14353         esac
14354         case "$readdir64_r_proto" in
14355         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
14356         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
14357         esac
14358         case "$readdir64_r_proto" in
14359         ''|0)   d_readdir64_r=undef
14360                 readdir64_r_proto=0
14361                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
14362         * )     case "$readdir64_r_proto" in
14363                 REENTRANT_PROTO*) ;;
14364                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
14365                 esac
14366                 echo "Prototype: $try" ;;
14367         esac
14368         ;;
14369         *)      case "$usethreads" in
14370                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
14371                 esac
14372                 d_readdir64_r=undef
14373                 readdir64_r_proto=0
14374                 ;;
14375         esac
14376         ;;
14377 *)      readdir64_r_proto=0
14378         ;;
14379 esac
14380
14381 : see if readdir_r exists
14382 set readdir_r d_readdir_r
14383 eval $inlibc
14384 case "$d_readdir_r" in
14385 "$define")
14386         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
14387         case "$d_readdir_r_proto:$usethreads" in
14388         ":define")      d_readdir_r_proto=define
14389                 set d_readdir_r_proto readdir_r $hdrs
14390                 eval $hasproto ;;
14391         *)      ;;
14392         esac
14393         case "$d_readdir_r_proto" in
14394         define)
14395         case "$readdir_r_proto" in
14396         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
14397         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
14398         esac
14399         case "$readdir_r_proto" in
14400         ''|0) try='int readdir_r(DIR*, struct dirent*);'
14401         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
14402         esac
14403         case "$readdir_r_proto" in
14404         ''|0)   d_readdir_r=undef
14405                 readdir_r_proto=0
14406                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
14407         * )     case "$readdir_r_proto" in
14408                 REENTRANT_PROTO*) ;;
14409                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
14410                 esac
14411                 echo "Prototype: $try" ;;
14412         esac
14413         ;;
14414         *)      case "$usethreads" in
14415                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
14416                 esac
14417                 d_readdir_r=undef
14418                 readdir_r_proto=0
14419                 ;;
14420         esac
14421         ;;
14422 *)      readdir_r_proto=0
14423         ;;
14424 esac
14425
14426 : see if readv exists
14427 set readv d_readv
14428 eval $inlibc
14429
14430 : see if recvmsg exists
14431 set recvmsg d_recvmsg
14432 eval $inlibc
14433
14434 : see if rename exists
14435 set rename d_rename
14436 eval $inlibc
14437
14438 : see if rmdir exists
14439 set rmdir d_rmdir
14440 eval $inlibc
14441
14442 : see if memory.h is available.
14443 val=''
14444 set memory.h val
14445 eval $inhdr
14446
14447 : See if it conflicts with string.h
14448 case "$val" in
14449 $define)
14450         case "$strings" in
14451         '') ;;
14452         *)
14453                 $cppstdin $cppflags $cppminus < $strings > mem.h
14454                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
14455                         echo " "
14456                         echo "We won't be including <memory.h>."
14457                         val="$undef"
14458                 fi
14459                 $rm -f mem.h
14460                 ;;
14461         esac
14462 esac
14463 set i_memory
14464 eval $setvar
14465
14466 : can bcopy handle overlapping blocks?
14467 echo " "
14468 val="$undef"
14469 case "$d_memmove" in
14470 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
14471 *)      case "$d_bcopy" in
14472         "$define")
14473                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
14474                 $cat >try.c <<EOCP
14475 #$i_memory I_MEMORY
14476 #$i_stdlib I_STDLIB
14477 #$i_string I_STRING
14478 #$i_unistd I_UNISTD
14479 EOCP
14480         $cat >>try.c <<'EOCP'
14481 #include <stdio.h>
14482 #ifdef I_MEMORY
14483 #  include <memory.h>
14484 #endif
14485 #ifdef I_STDLIB
14486 #  include <stdlib.h>
14487 #endif
14488 #ifdef I_STRING
14489 #  include <string.h>
14490 #else
14491 #  include <strings.h>
14492 #endif
14493 #ifdef I_UNISTD
14494 #  include <unistd.h>  /* Needed for NetBSD */
14495 #endif
14496 int main()
14497 {
14498 char buf[128], abc[128];
14499 char *b;
14500 int len;
14501 int off;
14502 int align;
14503
14504 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14505    try to store the string in read-only memory. */
14506 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
14507
14508 for (align = 7; align >= 0; align--) {
14509         for (len = 36; len; len--) {
14510                 b = buf+align;
14511                 bcopy(abc, b, len);
14512                 for (off = 1; off <= len; off++) {
14513                         bcopy(b, b+off, len);
14514                         bcopy(b+off, b, len);
14515                         if (bcmp(b, abc, len))
14516                                 exit(1);
14517                 }
14518         }
14519 }
14520 exit(0);
14521 }
14522 EOCP
14523                 set try
14524                 if eval $compile_ok; then
14525                         if ./try 2>/dev/null; then
14526                                 echo "Yes, it can."
14527                                 val="$define"
14528                         else
14529                                 echo "It can't, sorry."
14530                         fi
14531                 else
14532                         echo "(I can't compile the test program, so we'll assume not...)"
14533                 fi
14534                 ;;
14535         esac
14536         $rm -f try.* try core
14537         ;;
14538 esac
14539 set d_safebcpy
14540 eval $setvar
14541
14542 : can memcpy handle overlapping blocks?
14543 echo " "
14544 val="$undef"
14545 case "$d_memmove" in
14546 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
14547 *)      case "$d_memcpy" in
14548         "$define")
14549                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
14550                 $cat >try.c <<EOCP
14551 #$i_memory I_MEMORY
14552 #$i_stdlib I_STDLIB
14553 #$i_string I_STRING
14554 #$i_unistd I_UNISTD
14555 EOCP
14556         $cat >>try.c <<'EOCP'
14557 #include <stdio.h>
14558 #ifdef I_MEMORY
14559 #  include <memory.h>
14560 #endif
14561 #ifdef I_STDLIB
14562 #  include <stdlib.h>
14563 #endif
14564 #ifdef I_STRING
14565 #  include <string.h>
14566 #else
14567 #  include <strings.h>
14568 #endif
14569 #ifdef I_UNISTD
14570 #  include <unistd.h>  /* Needed for NetBSD */
14571 #endif
14572 int main()
14573 {
14574 char buf[128], abc[128];
14575 char *b;
14576 int len;
14577 int off;
14578 int align;
14579
14580 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14581    try to store the string in read-only memory. */
14582 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
14583
14584 for (align = 7; align >= 0; align--) {
14585         for (len = 36; len; len--) {
14586                 b = buf+align;
14587                 memcpy(b, abc, len);
14588                 for (off = 1; off <= len; off++) {
14589                         memcpy(b+off, b, len);
14590                         memcpy(b, b+off, len);
14591                         if (memcmp(b, abc, len))
14592                                 exit(1);
14593                 }
14594         }
14595 }
14596 exit(0);
14597 }
14598 EOCP
14599                 set try
14600                 if eval $compile_ok; then
14601                         if ./try 2>/dev/null; then
14602                                 echo "Yes, it can."
14603                                 val="$define"
14604                         else
14605                                 echo "It can't, sorry."
14606                         fi
14607                 else
14608                         echo "(I can't compile the test program, so we'll assume not...)"
14609                 fi
14610                 ;;
14611         esac
14612         $rm -f try.* try core
14613         ;;
14614 esac
14615 set d_safemcpy
14616 eval $setvar
14617
14618 : can memcmp be trusted to compare relative magnitude?
14619 val="$undef"
14620 case "$d_memcmp" in
14621 "$define")
14622         echo " "
14623         echo "Checking if your memcmp() can compare relative magnitude..." >&4
14624         $cat >try.c <<EOCP
14625 #$i_memory I_MEMORY
14626 #$i_stdlib I_STDLIB
14627 #$i_string I_STRING
14628 #$i_unistd I_UNISTD
14629 EOCP
14630         $cat >>try.c <<'EOCP'
14631 #include <stdio.h>
14632 #ifdef I_MEMORY
14633 #  include <memory.h>
14634 #endif
14635 #ifdef I_STDLIB
14636 #  include <stdlib.h>
14637 #endif
14638 #ifdef I_STRING
14639 #  include <string.h>
14640 #else
14641 #  include <strings.h>
14642 #endif
14643 #ifdef I_UNISTD
14644 #  include <unistd.h>  /* Needed for NetBSD */
14645 #endif
14646 int main()
14647 {
14648 char a = -1;
14649 char b = 0;
14650 if ((a < b) && memcmp(&a, &b, 1) < 0)
14651         exit(1);
14652 exit(0);
14653 }
14654 EOCP
14655         set try
14656         if eval $compile_ok; then
14657                 if $run ./try 2>/dev/null; then
14658                         echo "Yes, it can."
14659                         val="$define"
14660                 else
14661                         echo "No, it can't (it uses signed chars)."
14662                 fi
14663         else
14664                 echo "(I can't compile the test program, so we'll assume not...)"
14665         fi
14666         ;;
14667 esac
14668 $rm -f try.* try core
14669 set d_sanemcmp
14670 eval $setvar
14671
14672 : see if prototype for sbrk is available
14673 echo " "
14674 set d_sbrkproto sbrk $i_unistd unistd.h
14675 eval $hasproto
14676
14677 : see if select exists
14678 set select d_select
14679 eval $inlibc
14680
14681 : see if semctl exists
14682 set semctl d_semctl
14683 eval $inlibc
14684
14685 : see if semget exists
14686 set semget d_semget
14687 eval $inlibc
14688
14689 : see if semop exists
14690 set semop d_semop
14691 eval $inlibc
14692
14693 : see how much of the 'sem*(2)' library is present.
14694 h_sem=true
14695 echo " "
14696 case "$d_semctl$d_semget$d_semop" in
14697 *"$undef"*) h_sem=false;;
14698 esac
14699 case "$osname" in
14700 freebsd)
14701     case "`ipcs 2>&1`" in
14702     "SVID messages"*"not configured"*)
14703         echo "Your $osname does not have the sem*(2) configured." >&4
14704         h_sem=false
14705         val="$undef"
14706         set semctl d_semctl
14707         eval $setvar
14708         set semget d_semget
14709         eval $setvar
14710         set semop d_semop
14711         eval $setvar
14712         ;;
14713     esac
14714     ;;
14715 esac
14716 : we could also check for sys/ipc.h ...
14717 if $h_sem && $test `./findhdr sys/sem.h`; then
14718         echo "You have the full sem*(2) library." >&4
14719         val="$define"
14720 else
14721         echo "You don't have the full sem*(2) library." >&4
14722         val="$undef"
14723 fi
14724 set d_sem
14725 eval $setvar
14726
14727 : see whether sys/sem.h defines union semun
14728 echo " "
14729 $cat > try.c <<'END'
14730 #include <sys/types.h>
14731 #include <sys/ipc.h>
14732 #include <sys/sem.h>
14733 int main () { union semun semun; semun.buf = 0; }
14734 END
14735 set try
14736 if eval $compile; then
14737     echo "You have union semun in <sys/sem.h>." >&4
14738     val="$define"
14739 else
14740     echo "You do not have union semun in <sys/sem.h>." >&4
14741     val="$undef"
14742 fi
14743 $rm -f try try.c try.h
14744 set d_union_semun
14745 eval $setvar
14746
14747 : see how to do semctl IPC_STAT
14748 case "$d_sem" in
14749 $define)
14750     : see whether semctl IPC_STAT can use union semun
14751     echo " "
14752     $cat > try.h <<END
14753 #ifndef S_IRUSR
14754 #   ifdef S_IREAD
14755 #       define S_IRUSR S_IREAD
14756 #       define S_IWUSR S_IWRITE
14757 #       define S_IXUSR S_IEXEC
14758 #   else
14759 #       define S_IRUSR 0400
14760 #       define S_IWUSR 0200
14761 #       define S_IXUSR 0100
14762 #   endif
14763 #   define S_IRGRP (S_IRUSR>>3)
14764 #   define S_IWGRP (S_IWUSR>>3)
14765 #   define S_IXGRP (S_IXUSR>>3)
14766 #   define S_IROTH (S_IRUSR>>6)
14767 #   define S_IWOTH (S_IWUSR>>6)
14768 #   define S_IXOTH (S_IXUSR>>6)
14769 #endif
14770 #ifndef S_IRWXU
14771 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
14772 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
14773 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
14774 #endif
14775 END
14776
14777     $cat > try.c <<END
14778 #include <sys/types.h>
14779 #include <sys/ipc.h>
14780 #include <sys/sem.h>
14781 #include <sys/stat.h>
14782 #include <stdio.h>
14783 #include <errno.h>
14784 #include "try.h"
14785 #ifndef errno
14786 extern int errno;
14787 #endif
14788 #$d_union_semun HAS_UNION_SEMUN
14789 int main() {
14790     union semun
14791 #ifndef HAS_UNION_SEMUN
14792     {
14793         int val;
14794         struct semid_ds *buf;
14795         unsigned short *array;
14796     }
14797 #endif
14798     arg;
14799     int sem, st;
14800
14801 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
14802     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14803     if (sem > -1) {
14804         struct semid_ds argbuf;
14805         arg.buf = &argbuf;
14806 #       ifdef IPC_STAT
14807         st = semctl(sem, 0, IPC_STAT, arg);
14808         if (st == 0)
14809             printf("semun\n");
14810         else
14811 #       endif /* IPC_STAT */
14812             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14813 #       ifdef IPC_RMID
14814         if (semctl(sem, 0, IPC_RMID, arg) != 0)
14815 #       endif /* IPC_RMID */
14816             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14817     } else
14818 #endif /* IPC_PRIVATE && ... */
14819         printf("semget failed: errno = %d\n", errno);
14820   return 0;
14821 }
14822 END
14823     val="$undef"
14824     set try
14825     if eval $compile; then
14826         xxx=`$run ./try`
14827         case "$xxx" in
14828         semun) val="$define" ;;
14829         esac
14830     fi
14831     $rm -f try try.c
14832     set d_semctl_semun
14833     eval $setvar
14834     case "$d_semctl_semun" in
14835     $define)
14836         echo "You can use union semun for semctl IPC_STAT." >&4
14837         also='also'
14838         ;;
14839     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
14840         also=''
14841         ;;
14842     esac
14843
14844     : see whether semctl IPC_STAT can use struct semid_ds pointer
14845     $cat > try.c <<'END'
14846 #include <sys/types.h>
14847 #include <sys/ipc.h>
14848 #include <sys/sem.h>
14849 #include <sys/stat.h>
14850 #include "try.h"
14851 #include <stdio.h>
14852 #include <errno.h>
14853 #ifndef errno
14854 extern int errno;
14855 #endif
14856 int main() {
14857     struct semid_ds arg;
14858     int sem, st;
14859
14860 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
14861     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14862     if (sem > -1) {
14863 #       ifdef IPC_STAT
14864         st = semctl(sem, 0, IPC_STAT, &arg);
14865         if (st == 0)
14866             printf("semid_ds\n");
14867         else
14868 #       endif /* IPC_STAT */
14869             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14870 #       ifdef IPC_RMID
14871         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
14872 #       endif /* IPC_RMID */
14873             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14874     } else
14875 #endif /* IPC_PRIVATE && ... */
14876         printf("semget failed: errno = %d\n", errno);
14877
14878     return 0;
14879 }
14880 END
14881     val="$undef"
14882     set try
14883     if eval $compile; then
14884         xxx=`$run ./try`
14885         case "$xxx" in
14886         semid_ds) val="$define" ;;
14887         esac
14888     fi
14889     $rm -f try try.c
14890     set d_semctl_semid_ds
14891     eval $setvar
14892     case "$d_semctl_semid_ds" in
14893     $define)
14894         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
14895         ;;
14896     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
14897         ;;
14898     esac
14899     $rm -f try.h
14900     ;;
14901 *)  val="$undef"
14902
14903     # We do not have the full sem*(2) library, so assume we can not
14904     # use either.
14905
14906     set d_semctl_semun
14907     eval $setvar
14908
14909     set d_semctl_semid_ds
14910     eval $setvar
14911     ;;
14912 esac
14913
14914 : see if sendmsg exists
14915 set sendmsg d_sendmsg
14916 eval $inlibc
14917
14918 : see if setegid exists
14919 set setegid d_setegid
14920 eval $inlibc
14921
14922 : see if seteuid exists
14923 set seteuid d_seteuid
14924 eval $inlibc
14925
14926 : see if setgrent exists
14927 set setgrent d_setgrent
14928 eval $inlibc
14929
14930 : see if setgrent_r exists
14931 set setgrent_r d_setgrent_r
14932 eval $inlibc
14933 case "$d_setgrent_r" in
14934 "$define")
14935         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14936         case "$d_setgrent_r_proto:$usethreads" in
14937         ":define")      d_setgrent_r_proto=define
14938                 set d_setgrent_r_proto setgrent_r $hdrs
14939                 eval $hasproto ;;
14940         *)      ;;
14941         esac
14942         case "$d_setgrent_r_proto" in
14943         define)
14944         case "$setgrent_r_proto" in
14945         ''|0) try='int setgrent_r(FILE**);'
14946         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
14947         esac
14948         case "$setgrent_r_proto" in
14949         ''|0) try='void setgrent_r(FILE**);'
14950         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
14951         esac
14952         case "$setgrent_r_proto" in
14953         ''|0)   d_setgrent_r=undef
14954                 setgrent_r_proto=0
14955                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
14956         * )     case "$setgrent_r_proto" in
14957                 REENTRANT_PROTO*) ;;
14958                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
14959                 esac
14960                 echo "Prototype: $try" ;;
14961         esac
14962         ;;
14963         *)      case "$usethreads" in
14964                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
14965                 esac
14966                 d_setgrent_r=undef
14967                 setgrent_r_proto=0
14968                 ;;
14969         esac
14970         ;;
14971 *)      setgrent_r_proto=0
14972         ;;
14973 esac
14974
14975 : see if sethostent exists
14976 set sethostent d_sethent
14977 eval $inlibc
14978
14979 : see if sethostent_r exists
14980 set sethostent_r d_sethostent_r
14981 eval $inlibc
14982 case "$d_sethostent_r" in
14983 "$define")
14984         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14985         case "$d_sethostent_r_proto:$usethreads" in
14986         ":define")      d_sethostent_r_proto=define
14987                 set d_sethostent_r_proto sethostent_r $hdrs
14988                 eval $hasproto ;;
14989         *)      ;;
14990         esac
14991         case "$d_sethostent_r_proto" in
14992         define)
14993         case "$sethostent_r_proto" in
14994         ''|0) try='int sethostent_r(int, struct hostent_data*);'
14995         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
14996         esac
14997         case "$sethostent_r_proto" in
14998         ''|0) try='void sethostent_r(int, struct hostent_data*);'
14999         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
15000         esac
15001         case "$sethostent_r_proto" in
15002         ''|0)   d_sethostent_r=undef
15003                 sethostent_r_proto=0
15004                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
15005         * )     case "$sethostent_r_proto" in
15006                 REENTRANT_PROTO*) ;;
15007                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
15008                 esac
15009                 echo "Prototype: $try" ;;
15010         esac
15011         ;;
15012         *)      case "$usethreads" in
15013                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
15014                 esac
15015                 d_sethostent_r=undef
15016                 sethostent_r_proto=0
15017                 ;;
15018         esac
15019         ;;
15020 *)      sethostent_r_proto=0
15021         ;;
15022 esac
15023
15024 : see if setitimer exists
15025 set setitimer d_setitimer
15026 eval $inlibc
15027
15028 : see if setlinebuf exists
15029 set setlinebuf d_setlinebuf
15030 eval $inlibc
15031
15032 : see if setlocale exists
15033 set setlocale d_setlocale
15034 eval $inlibc
15035
15036 : see if locale.h is available
15037 set locale.h i_locale
15038 eval $inhdr
15039
15040 : see if setlocale_r exists
15041 set setlocale_r d_setlocale_r
15042 eval $inlibc
15043 case "$d_setlocale_r" in
15044 "$define")
15045         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
15046         case "$d_setlocale_r_proto:$usethreads" in
15047         ":define")      d_setlocale_r_proto=define
15048                 set d_setlocale_r_proto setlocale_r $hdrs
15049                 eval $hasproto ;;
15050         *)      ;;
15051         esac
15052         case "$d_setlocale_r_proto" in
15053         define)
15054         case "$setlocale_r_proto" in
15055         ''|0) try='int setlocale_r(int, const char*, char*, int);'
15056         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
15057         esac
15058         case "$setlocale_r_proto" in
15059         ''|0)   d_setlocale_r=undef
15060                 setlocale_r_proto=0
15061                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
15062         * )     case "$setlocale_r_proto" in
15063                 REENTRANT_PROTO*) ;;
15064                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
15065                 esac
15066                 echo "Prototype: $try" ;;
15067         esac
15068         ;;
15069         *)      case "$usethreads" in
15070                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
15071                 esac
15072                 d_setlocale_r=undef
15073                 setlocale_r_proto=0
15074                 ;;
15075         esac
15076         ;;
15077 *)      setlocale_r_proto=0
15078         ;;
15079 esac
15080
15081 : see if setnetent exists
15082 set setnetent d_setnent
15083 eval $inlibc
15084
15085 : see if setnetent_r exists
15086 set setnetent_r d_setnetent_r
15087 eval $inlibc
15088 case "$d_setnetent_r" in
15089 "$define")
15090         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15091         case "$d_setnetent_r_proto:$usethreads" in
15092         ":define")      d_setnetent_r_proto=define
15093                 set d_setnetent_r_proto setnetent_r $hdrs
15094                 eval $hasproto ;;
15095         *)      ;;
15096         esac
15097         case "$d_setnetent_r_proto" in
15098         define)
15099         case "$setnetent_r_proto" in
15100         ''|0) try='int setnetent_r(int, struct netent_data*);'
15101         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
15102         esac
15103         case "$setnetent_r_proto" in
15104         ''|0) try='void setnetent_r(int, struct netent_data*);'
15105         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
15106         esac
15107         case "$setnetent_r_proto" in
15108         ''|0)   d_setnetent_r=undef
15109                 setnetent_r_proto=0
15110                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
15111         * )     case "$setnetent_r_proto" in
15112                 REENTRANT_PROTO*) ;;
15113                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
15114                 esac
15115                 echo "Prototype: $try" ;;
15116         esac
15117         ;;
15118         *)      case "$usethreads" in
15119                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
15120                 esac
15121                 d_setnetent_r=undef
15122                 setnetent_r_proto=0
15123                 ;;
15124         esac
15125         ;;
15126 *)      setnetent_r_proto=0
15127         ;;
15128 esac
15129
15130 : see if setprotoent exists
15131 set setprotoent d_setpent
15132 eval $inlibc
15133
15134 : see if setpgid exists
15135 set setpgid d_setpgid
15136 eval $inlibc
15137
15138 : see if setpgrp2 exists
15139 set setpgrp2 d_setpgrp2
15140 eval $inlibc
15141
15142 : see if setpriority exists
15143 set setpriority d_setprior
15144 eval $inlibc
15145
15146 : see if setproctitle exists
15147 set setproctitle d_setproctitle
15148 eval $inlibc
15149
15150 : see if setprotoent_r exists
15151 set setprotoent_r d_setprotoent_r
15152 eval $inlibc
15153 case "$d_setprotoent_r" in
15154 "$define")
15155         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15156         case "$d_setprotoent_r_proto:$usethreads" in
15157         ":define")      d_setprotoent_r_proto=define
15158                 set d_setprotoent_r_proto setprotoent_r $hdrs
15159                 eval $hasproto ;;
15160         *)      ;;
15161         esac
15162         case "$d_setprotoent_r_proto" in
15163         define)
15164         case "$setprotoent_r_proto" in
15165         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
15166         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
15167         esac
15168         case "$setprotoent_r_proto" in
15169         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
15170         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
15171         esac
15172         case "$setprotoent_r_proto" in
15173         ''|0)   d_setprotoent_r=undef
15174                 setprotoent_r_proto=0
15175                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
15176         * )     case "$setprotoent_r_proto" in
15177                 REENTRANT_PROTO*) ;;
15178                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
15179                 esac
15180                 echo "Prototype: $try" ;;
15181         esac
15182         ;;
15183         *)      case "$usethreads" in
15184                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
15185                 esac
15186                 d_setprotoent_r=undef
15187                 setprotoent_r_proto=0
15188                 ;;
15189         esac
15190         ;;
15191 *)      setprotoent_r_proto=0
15192         ;;
15193 esac
15194
15195 : see if setpwent exists
15196 set setpwent d_setpwent
15197 eval $inlibc
15198
15199 : see if setpwent_r exists
15200 set setpwent_r d_setpwent_r
15201 eval $inlibc
15202 case "$d_setpwent_r" in
15203 "$define")
15204         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15205         case "$d_setpwent_r_proto:$usethreads" in
15206         ":define")      d_setpwent_r_proto=define
15207                 set d_setpwent_r_proto setpwent_r $hdrs
15208                 eval $hasproto ;;
15209         *)      ;;
15210         esac
15211         case "$d_setpwent_r_proto" in
15212         define)
15213         case "$setpwent_r_proto" in
15214         ''|0) try='int setpwent_r(FILE**);'
15215         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
15216         esac
15217         case "$setpwent_r_proto" in
15218         ''|0) try='void setpwent_r(FILE**);'
15219         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
15220         esac
15221         case "$setpwent_r_proto" in
15222         ''|0)   d_setpwent_r=undef
15223                 setpwent_r_proto=0
15224                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
15225         * )     case "$setpwent_r_proto" in
15226                 REENTRANT_PROTO*) ;;
15227                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
15228                 esac
15229                 echo "Prototype: $try" ;;
15230         esac
15231         ;;
15232         *)      case "$usethreads" in
15233                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
15234                 esac
15235                 d_setpwent_r=undef
15236                 setpwent_r_proto=0
15237                 ;;
15238         esac
15239         ;;
15240 *)      setpwent_r_proto=0
15241         ;;
15242 esac
15243
15244 : see if setregid exists
15245 set setregid d_setregid
15246 eval $inlibc
15247 set setresgid d_setresgid
15248 eval $inlibc
15249
15250 : see if setreuid exists
15251 set setreuid d_setreuid
15252 eval $inlibc
15253 set setresuid d_setresuid
15254 eval $inlibc
15255
15256 : see if setrgid exists
15257 set setrgid d_setrgid
15258 eval $inlibc
15259
15260 : see if setruid exists
15261 set setruid d_setruid
15262 eval $inlibc
15263
15264 : see if setservent exists
15265 set setservent d_setsent
15266 eval $inlibc
15267
15268 : see if setservent_r exists
15269 set setservent_r d_setservent_r
15270 eval $inlibc
15271 case "$d_setservent_r" in
15272 "$define")
15273         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15274         case "$d_setservent_r_proto:$usethreads" in
15275         ":define")      d_setservent_r_proto=define
15276                 set d_setservent_r_proto setservent_r $hdrs
15277                 eval $hasproto ;;
15278         *)      ;;
15279         esac
15280         case "$d_setservent_r_proto" in
15281         define)
15282         case "$setservent_r_proto" in
15283         ''|0) try='int setservent_r(int, struct servent_data*);'
15284         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
15285         esac
15286         case "$setservent_r_proto" in
15287         ''|0) try='void setservent_r(int, struct servent_data*);'
15288         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
15289         esac
15290         case "$setservent_r_proto" in
15291         ''|0)   d_setservent_r=undef
15292                 setservent_r_proto=0
15293                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
15294         * )     case "$setservent_r_proto" in
15295                 REENTRANT_PROTO*) ;;
15296                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
15297                 esac
15298                 echo "Prototype: $try" ;;
15299         esac
15300         ;;
15301         *)      case "$usethreads" in
15302                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
15303                 esac
15304                 d_setservent_r=undef
15305                 setservent_r_proto=0
15306                 ;;
15307         esac
15308         ;;
15309 *)      setservent_r_proto=0
15310         ;;
15311 esac
15312
15313 : see if setsid exists
15314 set setsid d_setsid
15315 eval $inlibc
15316
15317 : see if setvbuf exists
15318 set setvbuf d_setvbuf
15319 eval $inlibc
15320
15321 : see if sfio.h is available
15322 set sfio.h i_sfio
15323 eval $inhdr
15324
15325
15326 : see if sfio library is available
15327 case "$i_sfio" in
15328 $define)
15329         val=''
15330         set sfreserve val
15331         eval $inlibc
15332         ;;
15333 *)
15334         val="$undef"
15335         ;;
15336 esac
15337 : Ok, but do we want to use it.
15338 case "$val" in
15339 $define)
15340         case "$usesfio" in
15341         true|$define|[yY]*) dflt='y';;
15342         *) dflt='n';;
15343         esac
15344         echo "$package can use the sfio library, but it is experimental."
15345         case "$useperlio" in
15346         "$undef")
15347             echo "For sfio also the PerlIO abstraction layer is needed."
15348             echo "Earlier you said you wouldn't want that."
15349             ;;
15350         esac
15351         rp="You seem to have sfio available, do you want to try using it?"
15352         . ./myread
15353         case "$ans" in
15354         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
15355                 useperlio="$define"
15356                 val="$define"
15357                 ;;
15358         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
15359                 val="$undef"
15360                 ;;
15361         esac
15362         ;;
15363 *)      case "$usesfio" in
15364         true|$define|[yY]*)
15365                 echo "Sorry, cannot find sfio on this machine." >&4
15366                 echo "Ignoring your setting of usesfio=$usesfio." >&4
15367                 val="$undef"
15368                 ;;
15369         esac
15370         ;;
15371 esac
15372 set d_sfio
15373 eval $setvar
15374 case "$d_sfio" in
15375 $define) usesfio='true';;
15376 *) usesfio='false';;
15377 esac
15378 case "$d_sfio" in
15379 $define) ;;
15380 *)      : Remove sfio from list of libraries to use
15381         case "$libs" in
15382         *-lsfio*)
15383                 echo "Removing unneeded -lsfio from library list" >&4
15384                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
15385                 shift
15386                 libs="$*"
15387                 echo "libs = $libs" >&4
15388                 ;;
15389         esac
15390 ;;
15391 esac
15392
15393
15394 : see if shmctl exists
15395 set shmctl d_shmctl
15396 eval $inlibc
15397
15398 : see if shmget exists
15399 set shmget d_shmget
15400 eval $inlibc
15401
15402 : see if shmat exists
15403 set shmat d_shmat
15404 eval $inlibc
15405 : see what shmat returns
15406 case "$d_shmat" in
15407 "$define")
15408         $cat >shmat.c <<'END'
15409 #include <sys/shm.h>
15410 void *shmat();
15411 END
15412         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
15413                 shmattype='void *'
15414         else
15415                 shmattype='char *'
15416         fi
15417         echo "and it returns ($shmattype)." >&4
15418         : see if a prototype for shmat is available
15419         xxx=`./findhdr sys/shm.h`
15420         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
15421         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
15422                 val="$define"
15423         else
15424                 val="$undef"
15425         fi
15426         $rm -f shmat.[co]
15427         ;;
15428 *)
15429         val="$undef"
15430         ;;
15431 esac
15432 set d_shmatprototype
15433 eval $setvar
15434
15435 : see if shmdt exists
15436 set shmdt d_shmdt
15437 eval $inlibc
15438
15439 : see how much of the 'shm*(2)' library is present.
15440 h_shm=true
15441 echo " "
15442 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
15443 *"$undef"*) h_shm=false;;
15444 esac
15445 case "$osname" in
15446 freebsd)
15447     case "`ipcs 2>&1`" in
15448     "SVID shared memory"*"not configured"*)
15449         echo "Your $osname does not have the shm*(2) configured." >&4
15450         h_shm=false
15451         val="$undef"
15452         set shmctl d_shmctl
15453         evat $setvar
15454         set shmget d_shmget
15455         evat $setvar
15456         set shmat d_shmat
15457         evat $setvar
15458         set shmdt d_shmdt
15459         evat $setvar
15460         ;;
15461     esac
15462     ;;
15463 esac
15464 : we could also check for sys/ipc.h ...
15465 if $h_shm && $test `./findhdr sys/shm.h`; then
15466         echo "You have the full shm*(2) library." >&4
15467         val="$define"
15468 else
15469         echo "You don't have the full shm*(2) library." >&4
15470         val="$undef"
15471 fi
15472 set d_shm
15473 eval $setvar
15474
15475 echo " "
15476 : see if we have sigaction
15477 if set sigaction val -f d_sigaction; eval $csym; $val; then
15478         echo 'sigaction() found.' >&4
15479         $cat > try.c <<'EOP'
15480 #include <stdio.h>
15481 #include <sys/types.h>
15482 #include <signal.h>
15483 int main()
15484 {
15485     struct sigaction act, oact;
15486     act.sa_flags = 0;
15487     oact.sa_handler = 0;
15488     /* so that act and oact are used */
15489     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
15490 }
15491 EOP
15492         set try
15493         if eval $compile_ok; then
15494                 val="$define"
15495         else
15496                 echo "But you don't seem to have a useable struct sigaction." >&4
15497                 val="$undef"
15498         fi
15499 else
15500         echo 'sigaction NOT found.' >&4
15501         val="$undef"
15502 fi
15503 set d_sigaction; eval $setvar
15504 $rm -f try try$_o try.c
15505
15506 : see if sigprocmask exists
15507 set sigprocmask d_sigprocmask
15508 eval $inlibc
15509
15510 : see if sigsetjmp exists
15511 echo " "
15512 case "$d_sigsetjmp" in
15513 '')
15514         $cat >try.c <<'EOP'
15515 #include <setjmp.h>
15516 sigjmp_buf env;
15517 int set = 1;
15518 int main()
15519 {
15520         if (sigsetjmp(env,1))
15521                 exit(set);
15522         set = 0;
15523         siglongjmp(env, 1);
15524         exit(1);
15525 }
15526 EOP
15527         set try
15528         if eval $compile; then
15529                 if $run ./try >/dev/null 2>&1; then
15530                         echo "POSIX sigsetjmp found." >&4
15531                         val="$define"
15532                 else
15533                         $cat >&4 <<EOM
15534 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
15535 I'll ignore them.
15536 EOM
15537                         val="$undef"
15538                 fi
15539         else
15540                 echo "sigsetjmp not found." >&4
15541                 val="$undef"
15542         fi
15543         ;;
15544 *) val="$d_sigsetjmp"
15545         case "$d_sigsetjmp" in
15546         $define) echo "POSIX sigsetjmp found." >&4;;
15547         $undef) echo "sigsetjmp not found." >&4;;
15548         esac
15549         ;;
15550 esac
15551 set d_sigsetjmp
15552 eval $setvar
15553 $rm -f try.c try
15554
15555 : see if sockatmark exists
15556 set sockatmark d_sockatmark
15557 eval $inlibc
15558
15559 : see if prototype for sockatmark is available
15560 echo " "
15561 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
15562 eval $hasproto
15563
15564 : see if socks5_init exists
15565 set socks5_init d_socks5_init
15566 eval $inlibc
15567
15568 : see if srand48_r exists
15569 set srand48_r d_srand48_r
15570 eval $inlibc
15571 case "$d_srand48_r" in
15572 "$define")
15573         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15574         case "$d_srand48_r_proto:$usethreads" in
15575         ":define")      d_srand48_r_proto=define
15576                 set d_srand48_r_proto srand48_r $hdrs
15577                 eval $hasproto ;;
15578         *)      ;;
15579         esac
15580         case "$d_srand48_r_proto" in
15581         define)
15582         case "$srand48_r_proto" in
15583         ''|0) try='int srand48_r(long, struct drand48_data*);'
15584         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
15585         esac
15586         case "$srand48_r_proto" in
15587         ''|0)   d_srand48_r=undef
15588                 srand48_r_proto=0
15589                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
15590         * )     case "$srand48_r_proto" in
15591                 REENTRANT_PROTO*) ;;
15592                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
15593                 esac
15594                 echo "Prototype: $try" ;;
15595         esac
15596         ;;
15597         *)      case "$usethreads" in
15598                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
15599                 esac
15600                 d_srand48_r=undef
15601                 srand48_r_proto=0
15602                 ;;
15603         esac
15604         ;;
15605 *)      srand48_r_proto=0
15606         ;;
15607 esac
15608
15609 : see if srandom_r exists
15610 set srandom_r d_srandom_r
15611 eval $inlibc
15612 case "$d_srandom_r" in
15613 "$define")
15614         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15615         case "$d_srandom_r_proto:$usethreads" in
15616         ":define")      d_srandom_r_proto=define
15617                 set d_srandom_r_proto srandom_r $hdrs
15618                 eval $hasproto ;;
15619         *)      ;;
15620         esac
15621         case "$d_srandom_r_proto" in
15622         define)
15623         case "$srandom_r_proto" in
15624         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
15625         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
15626         esac
15627         case "$srandom_r_proto" in
15628         ''|0)   d_srandom_r=undef
15629                 srandom_r_proto=0
15630                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
15631         * )     case "$srandom_r_proto" in
15632                 REENTRANT_PROTO*) ;;
15633                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
15634                 esac
15635                 echo "Prototype: $try" ;;
15636         esac
15637         ;;
15638         *)      case "$usethreads" in
15639                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
15640                 esac
15641                 d_srandom_r=undef
15642                 srandom_r_proto=0
15643                 ;;
15644         esac
15645         ;;
15646 *)      srandom_r_proto=0
15647         ;;
15648 esac
15649
15650 : see if prototype for setresgid is available
15651 echo " "
15652 set d_sresgproto setresgid $i_unistd unistd.h
15653 eval $hasproto
15654
15655 : see if prototype for setresuid is available
15656 echo " "
15657 set d_sresuproto setresuid $i_unistd unistd.h
15658 eval $hasproto
15659
15660 : see if sys/stat.h is available
15661 set sys/stat.h i_sysstat
15662 eval $inhdr
15663
15664
15665 : see if stat knows about block sizes
15666 echo " "
15667 echo "Checking to see if your struct stat has st_blocks field..." >&4
15668 set d_statblks stat st_blocks $i_sysstat sys/stat.h
15669 eval $hasfield
15670
15671
15672 : see if this is a sys/vfs.h system
15673 set sys/vfs.h i_sysvfs
15674 eval $inhdr
15675
15676
15677 : see if this is a sys/statfs.h system
15678 set sys/statfs.h i_sysstatfs
15679 eval $inhdr
15680
15681
15682 echo " "
15683 echo "Checking to see if your system supports struct statfs..." >&4
15684 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
15685 eval $hasstruct
15686 case "$d_statfs_s" in
15687 "$define")      echo "Yes, it does."   ;;
15688 *)              echo "No, it doesn't." ;;
15689 esac
15690
15691
15692
15693 : see if struct statfs knows about f_flags
15694 case "$d_statfs_s" in
15695 define) 
15696         echo " "
15697         echo "Checking to see if your struct statfs has f_flags field..." >&4
15698         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
15699         eval $hasfield
15700         ;;
15701 *)      val="$undef"
15702         set d_statfs_f_flags
15703         eval $setvar
15704         ;;
15705 esac
15706 case "$d_statfs_f_flags" in
15707 "$define")      echo "Yes, it does."   ;;
15708 *)              echo "No, it doesn't." ;;
15709 esac
15710
15711 : see if _ptr and _cnt from stdio act std
15712 echo " "
15713
15714 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
15715         echo "(Looks like you have stdio.h from BSD.)"
15716         case "$stdio_ptr" in
15717         '') stdio_ptr='((fp)->_p)'
15718                 ptr_lval=$define
15719                 ;;
15720         *)      ptr_lval=$d_stdio_ptr_lval;;
15721         esac
15722         case "$stdio_cnt" in
15723         '') stdio_cnt='((fp)->_r)'
15724                 cnt_lval=$define
15725                 ;;
15726         *)      cnt_lval=$d_stdio_cnt_lval;;
15727         esac
15728         case "$stdio_base" in
15729         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
15730         esac
15731         case "$stdio_bufsiz" in
15732         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
15733         esac
15734 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
15735         echo "(Looks like you have stdio.h from Linux.)"
15736         case "$stdio_ptr" in
15737         '') stdio_ptr='((fp)->_IO_read_ptr)'
15738                 ptr_lval=$define
15739                 ;;
15740         *)      ptr_lval=$d_stdio_ptr_lval;;
15741         esac
15742         case "$stdio_cnt" in
15743         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
15744                 cnt_lval=$undef
15745                 ;;
15746         *)      cnt_lval=$d_stdio_cnt_lval;;
15747         esac
15748         case "$stdio_base" in
15749         '') stdio_base='((fp)->_IO_read_base)';;
15750         esac
15751         case "$stdio_bufsiz" in
15752         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
15753         esac
15754 else
15755         case "$stdio_ptr" in
15756         '') stdio_ptr='((fp)->_ptr)'
15757                 ptr_lval=$define
15758                 ;;
15759         *)      ptr_lval=$d_stdio_ptr_lval;;
15760         esac
15761         case "$stdio_cnt" in
15762         '') stdio_cnt='((fp)->_cnt)'
15763                 cnt_lval=$define
15764                 ;;
15765         *)      cnt_lval=$d_stdio_cnt_lval;;
15766         esac
15767         case "$stdio_base" in
15768         '') stdio_base='((fp)->_base)';;
15769         esac
15770         case "$stdio_bufsiz" in
15771         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
15772         esac
15773 fi
15774
15775 : test whether _ptr and _cnt really work
15776 echo "Checking how std your stdio is..." >&4
15777 $cat >try.c <<EOP
15778 #include <stdio.h>
15779 #define FILE_ptr(fp)    $stdio_ptr
15780 #define FILE_cnt(fp)    $stdio_cnt
15781 int main() {
15782         FILE *fp = fopen("try.c", "r");
15783         char c = getc(fp);
15784         if (
15785                 18 <= FILE_cnt(fp) &&
15786                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15787         )
15788                 exit(0);
15789         exit(1);
15790 }
15791 EOP
15792 val="$undef"
15793 set try
15794 if eval $compile && $to try.c; then
15795         if $run ./try; then
15796                 echo "Your stdio acts pretty std."
15797                 val="$define"
15798         else
15799                 echo "Your stdio isn't very std."
15800         fi
15801 else
15802         echo "Your stdio doesn't appear very std."
15803 fi
15804 $rm -f try.c try
15805
15806 # glibc 2.2.90 and above apparently change stdio streams so Perl's
15807 # direct buffer manipulation no longer works.  The Configure tests
15808 # should be changed to correctly detect this, but until then,
15809 # the following check should at least let perl compile and run.
15810 # (This quick fix should be updated before 5.8.1.)
15811 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
15812 # A. Dougherty, June 3, 2002.
15813 case "$d_gnulibc" in
15814 $define)
15815         case "$gnulibc_version" in
15816         2.[01]*)  ;;
15817         2.2) ;;
15818         2.2.[0-9]) ;;
15819         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
15820                 val="$undef"
15821                 ;;
15822         esac
15823         ;;
15824 esac
15825 set d_stdstdio
15826 eval $setvar
15827
15828 : Can _ptr be used as an lvalue?
15829 case "$d_stdstdio$ptr_lval" in
15830 $define$define) val=$define ;;
15831 *) val=$undef ;;
15832 esac
15833 set d_stdio_ptr_lval
15834 eval $setvar
15835
15836 : Can _cnt be used as an lvalue?
15837 case "$d_stdstdio$cnt_lval" in
15838 $define$define) val=$define ;;
15839 *) val=$undef ;;
15840 esac
15841 set d_stdio_cnt_lval
15842 eval $setvar
15843
15844
15845 : test whether setting _ptr sets _cnt as a side effect
15846 d_stdio_ptr_lval_sets_cnt="$undef"
15847 d_stdio_ptr_lval_nochange_cnt="$undef"
15848 case "$d_stdio_ptr_lval$d_stdstdio" in
15849 $define$define)
15850         echo "Checking to see what happens if we set the stdio ptr..." >&4
15851 $cat >try.c <<EOP
15852 #include <stdio.h>
15853 /* Can we scream? */
15854 /* Eat dust sed :-) */
15855 /* In the buffer space, no one can hear you scream. */
15856 #define FILE_ptr(fp)    $stdio_ptr
15857 #define FILE_cnt(fp)    $stdio_cnt
15858 #include <sys/types.h>
15859 int main() {
15860         FILE *fp = fopen("try.c", "r");
15861         int c;
15862         char *ptr;
15863         size_t cnt;
15864         if (!fp) {
15865             puts("Fail even to read");
15866             exit(1);
15867         }
15868         c = getc(fp); /* Read away the first # */
15869         if (c == EOF) {
15870             puts("Fail even to read");
15871             exit(1);
15872         }
15873         if (!(
15874                 18 <= FILE_cnt(fp) &&
15875                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15876         )) {
15877                 puts("Fail even to read");
15878                 exit (1);
15879         }
15880         ptr = (char*) FILE_ptr(fp);
15881         cnt = (size_t)FILE_cnt(fp);
15882
15883         FILE_ptr(fp) += 42;
15884
15885         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
15886                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
15887                 exit (1);
15888         }
15889         if (FILE_cnt(fp) <= 20) {
15890                 printf ("Fail (<20 chars to test)");
15891                 exit (1);
15892         }
15893         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
15894                 puts("Fail compare");
15895                 exit (1);
15896         }
15897         if (cnt == FILE_cnt(fp)) {
15898                 puts("Pass_unchanged");
15899                 exit (0);
15900         }       
15901         if (FILE_cnt(fp) == (cnt - 42)) {
15902                 puts("Pass_changed");
15903                 exit (0);
15904         }
15905         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
15906         return 1;
15907
15908 }
15909 EOP
15910         set try
15911         if eval $compile && $to try.c; then
15912                 case `$run ./try` in
15913                 Pass_changed)
15914                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
15915                         d_stdio_ptr_lval_sets_cnt="$define" ;;
15916                 Pass_unchanged)
15917                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
15918                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
15919                 Fail*)
15920                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
15921                 *)
15922                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
15923         esac
15924         else
15925                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
15926         fi
15927         $rm -f try.c try
15928         ;;
15929 esac
15930
15931 : see if _base is also standard
15932 val="$undef"
15933 case "$d_stdstdio" in
15934 $define)
15935         $cat >try.c <<EOP
15936 #include <stdio.h>
15937 #define FILE_base(fp)   $stdio_base
15938 #define FILE_bufsiz(fp) $stdio_bufsiz
15939 int main() {
15940         FILE *fp = fopen("try.c", "r");
15941         char c = getc(fp);
15942         if (
15943                 19 <= FILE_bufsiz(fp) &&
15944                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
15945         )
15946                 exit(0);
15947         exit(1);
15948 }
15949 EOP
15950         set try
15951         if eval $compile && $to try.c; then
15952                 if $run ./try; then
15953                         echo "And its _base field acts std."
15954                         val="$define"
15955                 else
15956                         echo "But its _base field isn't std."
15957                 fi
15958         else
15959                 echo "However, it seems to be lacking the _base field."
15960         fi
15961         $rm -f try.c try
15962         ;;
15963 esac
15964 set d_stdiobase
15965 eval $setvar
15966
15967 $cat >&4 <<EOM
15968 Checking how to access stdio streams by file descriptor number...
15969 EOM
15970 case "$stdio_stream_array" in
15971 '')     $cat >try.c <<EOCP
15972 #include <stdio.h>
15973 int main() {
15974   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
15975     printf("yes\n");
15976 }
15977 EOCP
15978         for s in _iob __iob __sF
15979         do
15980                 set try -DSTDIO_STREAM_ARRAY=$s
15981                 if eval $compile; then
15982                         case "`$run ./try`" in
15983                         yes)    stdio_stream_array=$s; break ;;
15984                         esac
15985                 fi
15986         done
15987         $rm -f try.* try$exe_ext
15988 esac
15989 case "$stdio_stream_array" in
15990 '')     $cat >&4 <<EOM
15991 I can't figure out how to access stdio streams by file descriptor number.
15992 EOM
15993         d_stdio_stream_array="$undef"
15994         ;;
15995 *)      $cat >&4 <<EOM
15996 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
15997 EOM
15998         d_stdio_stream_array="$define"
15999         ;;
16000 esac
16001
16002 : see if strcoll exists
16003 set strcoll d_strcoll
16004 eval $inlibc
16005
16006 : check for structure copying
16007 echo " "
16008 echo "Checking to see if your C compiler can copy structs..." >&4
16009 $cat >try.c <<'EOCP'
16010 main()
16011 {
16012         struct blurfl {
16013                 int dyick;
16014         } foo, bar;
16015
16016         foo = bar;
16017 }
16018 EOCP
16019 if $cc -c try.c >/dev/null 2>&1 ; then
16020         val="$define"
16021         echo "Yup, it can."
16022 else
16023         val="$undef"
16024         echo "Nope, it can't."
16025 fi
16026 set d_strctcpy
16027 eval $setvar
16028 $rm -f try.*
16029
16030 : see if strerror and/or sys_errlist[] exist
16031 echo " "
16032 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16033     if set strerror val -f d_strerror; eval $csym; $val; then
16034                 echo 'strerror() found.' >&4
16035                 d_strerror="$define"
16036                 d_strerrm='strerror(e)'
16037                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16038                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
16039                         d_syserrlst="$define"
16040                 else
16041                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16042                         d_syserrlst="$undef"
16043                 fi
16044     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16045                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16046                 echo 'strerror() found in string header.' >&4
16047                 d_strerror="$define"
16048                 d_strerrm='strerror(e)'
16049                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16050                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16051                                 d_syserrlst="$define"
16052                 else
16053                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
16054                         d_syserrlst="$undef"
16055                 fi
16056     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16057                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16058                 d_strerror="$undef"
16059                 d_syserrlst="$define"
16060                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16061     else
16062                 echo 'strerror() and sys_errlist[] NOT found.' >&4
16063                 d_strerror="$undef"
16064                 d_syserrlst="$undef"
16065                 d_strerrm='"unknown"'
16066     fi
16067 fi
16068
16069 : see if strerror_r exists
16070 set strerror_r d_strerror_r
16071 eval $inlibc
16072 case "$d_strerror_r" in
16073 "$define")
16074         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
16075         case "$d_strerror_r_proto:$usethreads" in
16076         ":define")      d_strerror_r_proto=define
16077                 set d_strerror_r_proto strerror_r $hdrs
16078                 eval $hasproto ;;
16079         *)      ;;
16080         esac
16081         case "$d_strerror_r_proto" in
16082         define)
16083         case "$strerror_r_proto" in
16084         ''|0) try='int strerror_r(int, char*, size_t);'
16085         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
16086         esac
16087         case "$strerror_r_proto" in
16088         ''|0) try='int strerror_r(int, char*, int);'
16089         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
16090         esac
16091         case "$strerror_r_proto" in
16092         ''|0) try='char* strerror_r(int, char*, size_t);'
16093         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
16094         esac
16095         case "$strerror_r_proto" in
16096         ''|0)   d_strerror_r=undef
16097                 strerror_r_proto=0
16098                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
16099         * )     case "$strerror_r_proto" in
16100                 REENTRANT_PROTO*) ;;
16101                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
16102                 esac
16103                 echo "Prototype: $try" ;;
16104         esac
16105         ;;
16106         *)      case "$usethreads" in
16107                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
16108                 esac
16109                 d_strerror_r=undef
16110                 strerror_r_proto=0
16111                 ;;
16112         esac
16113         ;;
16114 *)      strerror_r_proto=0
16115         ;;
16116 esac
16117
16118 : see if strftime exists
16119 set strftime d_strftime
16120 eval $inlibc
16121
16122 : see if strtod exists
16123 set strtod d_strtod
16124 eval $inlibc
16125
16126 : see if strtol exists
16127 set strtol d_strtol
16128 eval $inlibc
16129
16130 : see if strtold exists
16131 set strtold d_strtold
16132 eval $inlibc
16133
16134 : see if strtoll exists
16135 set strtoll d_strtoll
16136 eval $inlibc
16137
16138 case "$d_longlong-$d_strtoll" in
16139 "$define-$define")
16140         $cat <<EOM
16141 Checking whether your strtoll() works okay...
16142 EOM
16143         $cat >try.c <<'EOCP'
16144 #include <errno.h>
16145 #ifdef __hpux
16146 #define strtoll __strtoll
16147 #endif
16148 #ifdef __EMX__
16149 #define strtoll _strtoll
16150 #endif
16151 #include <stdio.h>
16152 extern long long int strtoll(char *s, char **, int); 
16153 static int bad = 0;
16154 int check(char *s, long long ell, int een) {
16155         long long gll;
16156         errno = 0;
16157         gll = strtoll(s, 0, 10);
16158         if (!((gll == ell) && (errno == een)))
16159                 bad++;
16160 }
16161 int main() {
16162         check(" 1",                                      1LL, 0);
16163         check(" 0",                                      0LL, 0);
16164         check("-1",                                     -1LL, 0);
16165         check("-9223372036854775808", -9223372036854775808LL, 0);
16166         check("-9223372036854775808", -9223372036854775808LL, 0);
16167         check(" 9223372036854775807",  9223372036854775807LL, 0);
16168         check("-9223372036854775808", -9223372036854775808LL, 0);
16169         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
16170         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
16171         if (!bad)
16172                 printf("ok\n");
16173 }
16174 EOCP
16175         set try
16176         if eval $compile; then
16177                 yyy=`$run ./try`
16178                 case "$yyy" in
16179                 ok) echo "Your strtoll() seems to be working okay." ;;
16180                 *) cat <<EOM >&4
16181 Your strtoll() doesn't seem to be working okay.
16182 EOM
16183                    d_strtoll="$undef"
16184                    ;;
16185                 esac
16186         else
16187                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16188                 d_strtoll="$undef"
16189         fi
16190         ;;
16191 esac
16192
16193 : see if strtoq exists
16194 set strtoq d_strtoq
16195 eval $inlibc
16196
16197 : see if strtoul exists
16198 set strtoul d_strtoul
16199 eval $inlibc
16200
16201 case "$d_strtoul" in
16202 "$define")
16203         $cat <<EOM
16204 Checking whether your strtoul() works okay...
16205 EOM
16206         $cat >try.c <<'EOCP'
16207 #include <errno.h>
16208 #include <stdio.h>
16209 extern unsigned long int strtoul(char *s, char **, int); 
16210 static int bad = 0;
16211 void check(char *s, unsigned long eul, int een) {
16212         unsigned long gul;
16213         errno = 0;
16214         gul = strtoul(s, 0, 10);
16215         if (!((gul == eul) && (errno == een)))
16216                 bad++;
16217 }
16218 int main() {
16219         check(" 1", 1L, 0);
16220         check(" 0", 0L, 0);
16221 EOCP
16222         case "$longsize" in
16223         8)
16224             $cat >>try.c <<'EOCP'
16225         check("18446744073709551615", 18446744073709551615UL, 0);
16226         check("18446744073709551616", 18446744073709551615UL, ERANGE);
16227 #if 0 /* strtoul() for /^-/ strings is undefined. */
16228         check("-1", 18446744073709551615UL, 0);
16229         check("-18446744073709551614", 2, 0);
16230         check("-18446744073709551615", 1, 0);
16231         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
16232         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
16233 #endif
16234 EOCP
16235                 ;;
16236         4)
16237                     $cat >>try.c <<'EOCP'
16238         check("4294967295", 4294967295UL, 0);
16239         check("4294967296", 4294967295UL, ERANGE);
16240 #if 0 /* strtoul() for /^-/ strings is undefined. */
16241         check("-1", 4294967295UL, 0);
16242         check("-4294967294", 2, 0);
16243         check("-4294967295", 1, 0);
16244         check("-4294967296", 4294967295UL, ERANGE);
16245         check("-4294967297", 4294967295UL, ERANGE);
16246 #endif
16247 EOCP
16248                 ;;
16249         *)
16250 : Should we write these tests to be more portable by sprintf-ing
16251 : ~0 and then manipulating that char string as input for strtol?
16252                 ;;
16253         esac
16254         $cat >>try.c <<'EOCP'
16255         if (!bad)
16256                 printf("ok\n");
16257         return 0;
16258 }
16259 EOCP
16260         set try
16261         if eval $compile; then
16262                 case "`$run ./try`" in
16263                 ok) echo "Your strtoul() seems to be working okay." ;;
16264                 *) cat <<EOM >&4
16265 Your strtoul() doesn't seem to be working okay.
16266 EOM
16267                    d_strtoul="$undef"
16268                    ;;
16269                 esac
16270         fi
16271         ;;
16272 esac
16273
16274 : see if strtoull exists
16275 set strtoull d_strtoull
16276 eval $inlibc
16277
16278 case "$d_longlong-$d_strtoull" in
16279 "$define-$define")
16280         $cat <<EOM
16281 Checking whether your strtoull() works okay...
16282 EOM
16283         $cat >try.c <<'EOCP'
16284 #include <errno.h>
16285 #ifdef __hpux
16286 #define strtoull __strtoull
16287 #endif
16288 #include <stdio.h>
16289 extern unsigned long long int strtoull(char *s, char **, int); 
16290 static int bad = 0;
16291 int check(char *s, long long eull, int een) {
16292         long long gull;
16293         errno = 0;
16294         gull = strtoull(s, 0, 10);
16295         if (!((gull == eull) && (errno == een)))
16296                 bad++;
16297 }
16298 int main() {
16299         check(" 1",                                        1LL, 0);
16300         check(" 0",                                        0LL, 0);
16301         check("18446744073709551615",  18446744073709551615ULL, 0);
16302         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
16303 #if 0 /* strtoull() for /^-/ strings is undefined. */
16304         check("-1",                    18446744073709551615ULL, 0);
16305         check("-18446744073709551614",                     2LL, 0);
16306         check("-18446744073709551615",                     1LL, 0);
16307         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16308         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
16309 #endif
16310         if (!bad)
16311                 printf("ok\n");
16312 }
16313 EOCP
16314         set try
16315         if eval $compile; then
16316                 case "`$run ./try`" in
16317                 ok) echo "Your strtoull() seems to be working okay." ;;
16318                 *) cat <<EOM >&4
16319 Your strtoull() doesn't seem to be working okay.
16320 EOM
16321                    d_strtoull="$undef"
16322                    ;;
16323                 esac
16324         fi
16325         ;;
16326 esac
16327
16328 : see if strtouq exists
16329 set strtouq d_strtouq
16330 eval $inlibc
16331
16332 case "$d_strtouq" in
16333 "$define")
16334         $cat <<EOM
16335 Checking whether your strtouq() works okay...
16336 EOM
16337         $cat >try.c <<'EOCP'
16338 #include <errno.h>
16339 #include <stdio.h>
16340 extern unsigned long long int strtouq(char *s, char **, int); 
16341 static int bad = 0;
16342 void check(char *s, unsigned long long eull, int een) {
16343         unsigned long long gull;
16344         errno = 0;
16345         gull = strtouq(s, 0, 10);
16346         if (!((gull == eull) && (errno == een)))
16347                 bad++;
16348 }
16349 int main() {
16350         check(" 1",                                        1LL, 0);
16351         check(" 0",                                        0LL, 0);
16352         check("18446744073709551615",  18446744073709551615ULL, 0);
16353         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
16354 #if 0 /* strtouq() for /^-/ strings is undefined. */
16355         check("-1",                    18446744073709551615ULL, 0);
16356         check("-18446744073709551614",                     2LL, 0);
16357         check("-18446744073709551615",                     1LL, 0);
16358         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16359         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
16360 #endif
16361         if (!bad)
16362                 printf("ok\n");
16363         return 0;
16364 }
16365 EOCP
16366         set try
16367         if eval $compile; then
16368                 case "`$run ./try`" in
16369                 ok) echo "Your strtouq() seems to be working okay." ;;
16370                 *) cat <<EOM >&4
16371 Your strtouq() doesn't seem to be working okay.
16372 EOM
16373                    d_strtouq="$undef"
16374                    ;;
16375                 esac
16376         fi
16377         ;;
16378 esac
16379
16380 : see if strxfrm exists
16381 set strxfrm d_strxfrm
16382 eval $inlibc
16383
16384 : see if symlink exists
16385 set symlink d_symlink
16386 eval $inlibc
16387
16388 : see if syscall exists
16389 set syscall d_syscall
16390 eval $inlibc
16391
16392 : see if prototype for syscall is available
16393 echo " "
16394 set d_syscallproto syscall $i_unistd unistd.h
16395 eval $hasproto
16396
16397 : see if sysconf exists
16398 set sysconf d_sysconf
16399 eval $inlibc
16400
16401 : see if system exists
16402 set system d_system
16403 eval $inlibc
16404
16405 : see if tcgetpgrp exists
16406 set tcgetpgrp d_tcgetpgrp
16407 eval $inlibc
16408
16409 : see if tcsetpgrp exists
16410 set tcsetpgrp d_tcsetpgrp
16411 eval $inlibc
16412
16413 : see if prototype for telldir is available
16414 echo " "
16415 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
16416 eval $hasproto
16417
16418 : see if time exists
16419 echo " "
16420 if test "X$d_time" = X -o X"$timetype" = X; then
16421     if set time val -f d_time; eval $csym; $val; then
16422                 echo 'time() found.' >&4
16423                 val="$define"
16424                 rp="What is the type returned by time() on this system?"
16425                 set time_t timetype long stdio.h sys/types.h
16426                 eval $typedef_ask
16427     else
16428                 echo 'time() not found, hope that will do.' >&4
16429                 val="$undef"
16430                 timetype='int';
16431     fi
16432     set d_time
16433     eval $setvar
16434 fi
16435
16436 : see if this is a sys/times.h system
16437 set sys/times.h i_systimes
16438 eval $inhdr
16439
16440 : see if times exists
16441 echo " "
16442 if set times val -f d_times; eval $csym; $val; then
16443         echo 'times() found.' >&4
16444         d_times="$define"
16445         inc=''
16446         case "$i_systimes" in
16447         "$define") inc='sys/times.h';;
16448         esac
16449         rp="What is the type returned by times() on this system?"
16450         set clock_t clocktype long stdio.h sys/types.h $inc
16451         eval $typedef_ask
16452 else
16453         echo 'times() NOT found, hope that will do.' >&4
16454         d_times="$undef"
16455         clocktype='int'
16456 fi
16457
16458 : see if tmpnam_r exists
16459 set tmpnam_r d_tmpnam_r
16460 eval $inlibc
16461 case "$d_tmpnam_r" in
16462 "$define")
16463         hdrs="$i_systypes sys/types.h define stdio.h "
16464         case "$d_tmpnam_r_proto:$usethreads" in
16465         ":define")      d_tmpnam_r_proto=define
16466                 set d_tmpnam_r_proto tmpnam_r $hdrs
16467                 eval $hasproto ;;
16468         *)      ;;
16469         esac
16470         case "$d_tmpnam_r_proto" in
16471         define)
16472         case "$tmpnam_r_proto" in
16473         ''|0) try='char* tmpnam_r(char*);'
16474         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
16475         esac
16476         case "$tmpnam_r_proto" in
16477         ''|0)   d_tmpnam_r=undef
16478                 tmpnam_r_proto=0
16479                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
16480         * )     case "$tmpnam_r_proto" in
16481                 REENTRANT_PROTO*) ;;
16482                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
16483                 esac
16484                 echo "Prototype: $try" ;;
16485         esac
16486         ;;
16487         *)      case "$usethreads" in
16488                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
16489                 esac
16490                 d_tmpnam_r=undef
16491                 tmpnam_r_proto=0
16492                 ;;
16493         esac
16494         ;;
16495 *)      tmpnam_r_proto=0
16496         ;;
16497 esac
16498
16499 : see if truncate exists
16500 set truncate d_truncate
16501 eval $inlibc
16502
16503 : see if ttyname_r exists
16504 set ttyname_r d_ttyname_r
16505 eval $inlibc
16506 case "$d_ttyname_r" in
16507 "$define")
16508         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
16509         case "$d_ttyname_r_proto:$usethreads" in
16510         ":define")      d_ttyname_r_proto=define
16511                 set d_ttyname_r_proto ttyname_r $hdrs
16512                 eval $hasproto ;;
16513         *)      ;;
16514         esac
16515         case "$d_ttyname_r_proto" in
16516         define)
16517         case "$ttyname_r_proto" in
16518         ''|0) try='int ttyname_r(int, char*, size_t);'
16519         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
16520         esac
16521         case "$ttyname_r_proto" in
16522         ''|0) try='int ttyname_r(int, char*, int);'
16523         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
16524         esac
16525         case "$ttyname_r_proto" in
16526         ''|0) try='char* ttyname_r(int, char*, int);'
16527         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
16528         esac
16529         case "$ttyname_r_proto" in
16530         ''|0)   d_ttyname_r=undef
16531                 ttyname_r_proto=0
16532                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
16533         * )     case "$ttyname_r_proto" in
16534                 REENTRANT_PROTO*) ;;
16535                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
16536                 esac
16537                 echo "Prototype: $try" ;;
16538         esac
16539         ;;
16540         *)      case "$usethreads" in
16541                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
16542                 esac
16543                 d_ttyname_r=undef
16544                 ttyname_r_proto=0
16545                 ;;
16546         esac
16547         ;;
16548 *)      ttyname_r_proto=0
16549         ;;
16550 esac
16551
16552 : see if tzname[] exists
16553 echo " "
16554 if set tzname val -a d_tzname; eval $csym; $val; then
16555         val="$define"
16556         echo 'tzname[] found.' >&4
16557 else
16558         val="$undef"
16559         echo 'tzname[] NOT found.' >&4
16560 fi
16561 set d_tzname
16562 eval $setvar
16563
16564 case "$osname" in
16565 next|rhapsody|darwin) multiarch="$define" ;;
16566 esac
16567 case "$multiarch" in
16568 ''|[nN]*) multiarch="$undef" ;;
16569 esac
16570
16571 : check for ordering of bytes in a UV
16572 echo " "
16573 case "$usecrosscompile$multiarch" in
16574 *$define*)
16575         $cat <<EOM
16576 You seem to be either cross-compiling or doing a multiarchitecture build,
16577 skipping the byteorder check.
16578
16579 EOM
16580         byteorder='ffff'
16581         ;;
16582 *)
16583         case "$byteorder" in
16584         '')
16585                 $cat <<'EOM'
16586 In the following, larger digits indicate more significance.  A big-endian
16587 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
16588 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
16589 machines may have weird orders like 3412.  A Cray will report 87654321,
16590 an Alpha will report 12345678. If the test program works the default is
16591 probably right.
16592 I'm now running the test program...
16593 EOM
16594                 $cat >try.c <<EOCP
16595 #include <stdio.h>
16596 #include <sys/types.h>
16597 typedef $uvtype UV;
16598 int main()
16599 {
16600         int i;
16601         union {
16602                 UV l;
16603                 char c[$uvsize];
16604         } u;
16605
16606         if ($uvsize > 4)
16607                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
16608         else
16609                 u.l = (UV)0x04030201;
16610         for (i = 0; i < $uvsize; i++)
16611                 printf("%c", u.c[i]+'0');
16612         printf("\n");
16613         exit(0);
16614 }
16615 EOCP
16616                 xxx_prompt=y
16617                 set try
16618                 if eval $compile && ./try > /dev/null; then
16619                         dflt=`$run ./try`
16620                         case "$dflt" in
16621                         [1-4][1-4][1-4][1-4]|12345678|87654321)
16622                                 echo "(The test program ran ok.)"
16623                                 echo "byteorder=$dflt"
16624                                 xxx_prompt=n
16625                         ;;
16626                         ????|????????) echo "(The test program ran ok.)" ;;
16627                         *) echo "(The test program didn't run right for some reason.)" ;;
16628                         esac
16629                 else
16630                         dflt='4321'
16631                         cat <<'EOM'
16632 (I can't seem to compile the test program.  Guessing big-endian...)
16633 EOM
16634                 fi
16635                 case "$xxx_prompt" in
16636                 y)
16637                         rp="What is the order of bytes in $uvtype?"
16638                         . ./myread
16639                         byteorder="$ans"
16640                         ;;
16641                 *)      byteorder=$dflt
16642                         ;;
16643                 esac
16644                 ;;
16645         esac
16646         $rm -f try.c try
16647         ;;
16648 esac
16649
16650
16651 $cat <<EOM
16652
16653 Checking to see whether you can access character data unalignedly...
16654 EOM
16655 case "$d_u32align" in
16656 '')   $cat >try.c <<EOCP
16657 #include <stdio.h>
16658 #define U32 $u32type
16659 #define BYTEORDER 0x$byteorder
16660 #define U8 $u8type
16661 #include <signal.h>
16662 #ifdef SIGBUS
16663 $signal_t bletch(s) int s; { exit(4); }
16664 #endif
16665 int main() {
16666 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
16667     U8 buf[8];
16668     U32 *up;
16669     int i;
16670
16671     if (sizeof(U32) != 4) {
16672         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
16673         exit(1);
16674     }
16675
16676     fflush(stdout);
16677
16678 #ifdef SIGBUS
16679     signal(SIGBUS, bletch);
16680 #endif
16681
16682     buf[0] = 0;
16683     buf[1] = 0;
16684     buf[2] = 0;
16685     buf[3] = 1;
16686     buf[5] = 0;
16687     buf[6] = 0;
16688     buf[7] = 0;
16689     buf[8] = 1;
16690
16691     for (i = 0; i < 4; i++) {
16692         up = (U32*)(buf + i);
16693         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
16694                (*up == 1 << (8*(3-i)))  /* little-endian */
16695               )
16696            )
16697         {
16698             printf("read failed (%x)\n", *up);
16699             exit(2);
16700         }
16701     }
16702
16703     /* write test */
16704     for (i = 0; i < 4; i++) {
16705         up = (U32*)(buf + i);
16706         *up = 0xBeef;
16707         if (*up != 0xBeef) {
16708             printf("write failed (%x)\n", *up);
16709             exit(3);
16710         }
16711     }
16712
16713     exit(0);
16714 #else
16715     printf("1\n");
16716     exit(1);
16717 #endif
16718     return 0;
16719 }
16720 EOCP
16721 set try
16722 if eval $compile_ok; then
16723         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
16724         $run ./try 2>&1 >/dev/null
16725         case "$?" in
16726         0)      cat >&4 <<EOM
16727 You can access character data pretty unalignedly.
16728 EOM
16729                 d_u32align="$undef"
16730                 ;;
16731         *)      cat >&4 <<EOM
16732 It seems that you must access character data in an aligned manner.
16733 EOM
16734                 d_u32align="$define"
16735                 ;;
16736         esac
16737 else
16738         rp='Can you access character data at unaligned addresses?'
16739         dflt='n'
16740         . ./myread
16741         case "$ans" in
16742         [yY]*)  d_u32align="$undef"  ;;
16743         *)      d_u32align="$define" ;;
16744         esac
16745 fi
16746 $rm -f core core.try.* try.core
16747 ;;
16748 esac
16749
16750 : see if ualarm exists
16751 set ualarm d_ualarm
16752 eval $inlibc
16753
16754 : see if umask exists
16755 set umask d_umask
16756 eval $inlibc
16757
16758 : see if unordered exists
16759 set unordered d_unordered
16760 eval $inlibc
16761
16762 : see if usleep exists
16763 set usleep d_usleep
16764 eval $inlibc
16765
16766 : see if prototype for usleep is available
16767 echo " "
16768 set d_usleepproto usleep $i_unistd unistd.h
16769 eval $hasproto
16770
16771 : see if ustat exists
16772 set ustat d_ustat
16773 eval $inlibc
16774
16775 : backward compatibility for d_hvfork
16776 if test X$d_hvfork != X; then
16777         d_vfork="$d_hvfork"
16778         d_hvfork=''
16779 fi
16780 : see if there is a vfork
16781 val=''
16782 set vfork val
16783 eval $inlibc
16784
16785 : Ok, but do we want to use it. vfork is reportedly unreliable in 
16786 : perl on Solaris 2.x, and probably elsewhere.
16787 case "$val" in
16788 $define)
16789         echo " "
16790         case "$usevfork" in
16791         false) dflt='n';;
16792         *) dflt='y';;
16793         esac
16794         cat <<'EOM'
16795  
16796 Perl can only use a vfork() that doesn't suffer from strict
16797 restrictions on calling functions or modifying global data in
16798 the child.  For example, glibc-2.1 contains such a vfork()
16799 that is unsuitable.  If your system provides a proper fork()
16800 call, chances are that you do NOT want perl to use vfork().
16801
16802 EOM
16803         rp="Do you still want to use vfork()?"
16804         . ./myread
16805         case "$ans" in
16806         y|Y) ;;
16807         *)
16808                 echo "Ok, we won't use vfork()."
16809                 val="$undef"
16810                 ;;
16811         esac
16812         ;;
16813 esac
16814 set d_vfork
16815 eval $setvar
16816 case "$d_vfork" in
16817 $define) usevfork='true';;
16818 *) usevfork='false';;
16819 esac
16820
16821 : see if closedir exists
16822 set closedir d_closedir
16823 eval $inlibc
16824
16825 case "$d_closedir" in
16826 "$define")
16827         echo " "
16828         echo "Checking whether closedir() returns a status..." >&4
16829         cat > try.c <<EOM
16830 #$i_dirent I_DIRENT             /**/
16831 #$i_sysdir I_SYS_DIR            /**/
16832 #$i_sysndir I_SYS_NDIR          /**/
16833 #$i_systypes I_SYS_TYPES        /**/
16834
16835 #if defined(I_SYS_TYPES)
16836 #include <sys/types.h>
16837 #endif
16838 #if defined(I_DIRENT)
16839 #include <dirent.h>
16840 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
16841 #include <sys/dir.h>
16842 #endif
16843 #else
16844 #ifdef I_SYS_NDIR
16845 #include <sys/ndir.h>
16846 #else
16847 #ifdef I_SYS_DIR
16848 #ifdef hp9000s500
16849 #include <ndir.h>       /* may be wrong in the future */
16850 #else
16851 #include <sys/dir.h>
16852 #endif
16853 #endif
16854 #endif
16855 #endif 
16856 int main() { return closedir(opendir(".")); }
16857 EOM
16858         set try
16859         if eval $compile_ok; then
16860                 if $run ./try > /dev/null 2>&1 ; then
16861                         echo "Yes, it does."
16862                         val="$undef"
16863                 else
16864                         echo "No, it doesn't."
16865                         val="$define"
16866                 fi
16867         else
16868                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16869                 val="$define"
16870         fi
16871         ;;
16872 *)
16873         val="$undef";
16874         ;;
16875 esac
16876 set d_void_closedir
16877 eval $setvar
16878 $rm -f try try.*
16879 : see if there is a wait4
16880 set wait4 d_wait4
16881 eval $inlibc
16882
16883 : see if waitpid exists
16884 set waitpid d_waitpid
16885 eval $inlibc
16886
16887 : see if wcstombs exists
16888 set wcstombs d_wcstombs
16889 eval $inlibc
16890
16891 : see if wctomb exists
16892 set wctomb d_wctomb
16893 eval $inlibc
16894
16895 : see if writev exists
16896 set writev d_writev
16897 eval $inlibc
16898
16899 : preserve RCS keywords in files with variable substitution, grrr
16900 Date='$Date'
16901 Id='$Id'
16902 Log='$Log'
16903 RCSfile='$RCSfile'
16904 Revision='$Revision'
16905
16906 : check for alignment requirements
16907 echo " "
16908 case "$usecrosscompile$multiarch" in
16909 *$define*)
16910         $cat <<EOM
16911 You seem to be either cross-compiling or doing a multiarchitecture build,
16912 skipping the memory alignment check.
16913
16914 EOM
16915         case "$alignbytes" in
16916         '') alignbytes=8 ;;
16917         esac
16918         ;;
16919 *)
16920         case "$alignbytes" in
16921         '') echo "Checking alignment constraints..." >&4
16922                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
16923                         $cat >try.c <<'EOCP'
16924 typedef long double NV;
16925 EOCP
16926                 else
16927                         $cat >try.c <<'EOCP'
16928 typedef double NV;
16929 EOCP
16930                 fi
16931                 $cat >>try.c <<'EOCP'
16932 #include <stdio.h>
16933 struct foobar {
16934         char foo;
16935         NV bar;
16936 } try_algn;
16937 int main()
16938 {
16939     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
16940     return(0);
16941 }
16942 EOCP
16943                 set try
16944                 if eval $compile_ok; then
16945                         dflt=`$run ./try`
16946                 else
16947                         dflt='8'
16948                         echo "(I can't seem to compile the test program...)"
16949                 fi
16950                 ;;
16951         *) dflt="$alignbytes"
16952                 ;;
16953         esac
16954         rp="Doubles must be aligned on a how-many-byte boundary?"
16955         . ./myread
16956         alignbytes="$ans"
16957         $rm -f try.c try
16958         ;;
16959 esac
16960
16961
16962 : set the base revision
16963 baserev=5.0
16964
16965 : how do we catenate cpp tokens here?
16966 echo " "
16967 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
16968 $cat >cpp_stuff.c <<'EOCP'
16969 #define RCAT(a,b)a/**/b
16970 #define ACAT(a,b)a ## b
16971 RCAT(Rei,ser)
16972 ACAT(Cir,cus)
16973 EOCP
16974 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
16975 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
16976         echo "Oh!  Smells like ANSI's been here." >&4
16977         echo "We can catify or stringify, separately or together!"
16978         cpp_stuff=42
16979 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
16980         echo "Ah, yes!  The good old days!" >&4
16981         echo "However, in the good old days we don't know how to stringify and"
16982         echo "catify at the same time."
16983         cpp_stuff=1
16984 else
16985         $cat >&4 <<EOM
16986 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
16987 to have to edit the values of CAT[2-5] in config.h...
16988 EOM
16989         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
16990 fi
16991 $rm -f cpp_stuff.*
16992
16993 : see if this is a db.h system
16994 set db.h i_db
16995 eval $inhdr
16996
16997 case "$i_db" in
16998 $define)
16999         : Check db version.
17000         echo " "
17001         echo "Checking Berkeley DB version ..." >&4
17002         $cat >try.c <<EOCP
17003 #$d_const HASCONST
17004 #ifndef HASCONST
17005 #define const
17006 #endif
17007 #include <sys/types.h>
17008 #include <stdio.h>
17009 #include <db.h>
17010 int main(int argc, char *argv[])
17011 {
17012 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17013     int Major, Minor, Patch ;
17014     unsigned long Version ;
17015     (void)db_version(&Major, &Minor, &Patch) ;
17016     if (argc == 2) {
17017         printf("%d %d %d %d %d %d\n",
17018                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17019                Major, Minor, Patch);
17020         exit(0);
17021     }
17022     printf("You have Berkeley DB Version 2 or greater.\n");
17023
17024     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17025                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17026     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17027                 Major, Minor, Patch) ;
17028
17029     /* check that db.h & libdb are compatible */
17030     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
17031         printf("db.h and libdb are incompatible.\n") ;
17032         exit(3);        
17033     }
17034
17035     printf("db.h and libdb are compatible.\n") ;
17036
17037     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17038                 + DB_VERSION_PATCH ;
17039
17040     /* needs to be >= 2.3.4 */
17041     if (Version < 2003004) {
17042     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
17043         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
17044         exit(2);        
17045     }
17046
17047     exit(0);
17048 #else
17049 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
17050     if (argc == 2) {
17051         printf("1 0 0\n");
17052         exit(0);
17053     }
17054     printf("You have Berkeley DB Version 1.\n");
17055     exit(0);    /* DB version < 2: the coast is clear. */
17056 #else
17057     exit(1);    /* <db.h> not Berkeley DB? */
17058 #endif
17059 #endif
17060 }
17061 EOCP
17062         set try
17063         if eval $compile_ok && $run ./try; then
17064                 echo 'Looks OK.' >&4
17065                 set `$run ./try 1`
17066                 db_version_major=$1
17067                 db_version_minor=$2
17068                 db_version_patch=$3
17069         else
17070                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
17071                 i_db=$undef
17072                 case " $libs " in
17073                 *"-ldb "*)
17074                         : Remove db from list of libraries to use
17075                         echo "Removing unusable -ldb from library list" >&4
17076                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
17077                         shift
17078                         libs="$*"
17079                         echo "libs = $libs" >&4
17080                         ;;
17081                 esac
17082         fi
17083         $rm -f try.*
17084         ;;
17085 esac
17086
17087 case "$i_db" in
17088 define)
17089         : Check the return type needed for hash 
17090         echo " "
17091         echo "Checking return type needed for hash for Berkeley DB ..." >&4
17092         $cat >try.c <<EOCP
17093 #$d_const HASCONST
17094 #ifndef HASCONST
17095 #define const
17096 #endif
17097 #include <sys/types.h>
17098 #include <db.h>
17099
17100 #ifndef DB_VERSION_MAJOR
17101 u_int32_t hash_cb (ptr, size)
17102 const void *ptr;
17103 size_t size;
17104 {
17105 }
17106 HASHINFO info;
17107 int main()
17108 {
17109         info.hash = hash_cb;
17110 }
17111 #endif
17112 EOCP
17113         if $cc $ccflags -c try.c >try.out 2>&1 ; then
17114                 if $contains warning try.out >>/dev/null 2>&1 ; then
17115                         db_hashtype='int'
17116                 else
17117                         db_hashtype='u_int32_t'
17118                 fi
17119         else
17120                 : XXX Maybe we should just give up here.
17121                 db_hashtype=u_int32_t
17122                 $cat try.out >&4
17123                 echo "Help:  I can't seem to compile the db test program." >&4
17124                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
17125         fi
17126         $rm -f try.*
17127         echo "Your version of Berkeley DB uses $db_hashtype for hash."
17128         ;;
17129 *)      db_hashtype=u_int32_t
17130         ;;
17131 esac
17132 case "$i_db" in
17133 define)
17134         : Check the return type needed for prefix 
17135         echo " "
17136         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
17137         cat >try.c <<EOCP
17138 #$d_const HASCONST
17139 #ifndef HASCONST
17140 #define const
17141 #endif
17142 #include <sys/types.h>
17143 #include <db.h>
17144
17145 #ifndef DB_VERSION_MAJOR
17146 size_t prefix_cb (key1, key2)
17147 const DBT *key1;
17148 const DBT *key2;
17149 {
17150 }
17151 BTREEINFO info;
17152 int main()
17153 {
17154         info.prefix = prefix_cb;
17155 }
17156 #endif
17157 EOCP
17158         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
17159                 if $contains warning try.out >>/dev/null 2>&1 ; then
17160                         db_prefixtype='int'
17161                 else
17162                         db_prefixtype='size_t'
17163                 fi
17164         else
17165                 db_prefixtype='size_t'
17166                 : XXX Maybe we should just give up here.
17167                 $cat try.out >&4
17168                 echo "Help:  I can't seem to compile the db test program." >&4
17169                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
17170         fi
17171         $rm -f try.*
17172         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
17173         ;;
17174 *)      db_prefixtype='size_t'
17175         ;;
17176 esac
17177
17178
17179 : How can we generate normalized random numbers ?
17180 echo " "
17181 echo "Looking for a random number function..." >&4
17182 case "$randfunc" in
17183 '')
17184         if set drand48 val -f; eval $csym; $val; then
17185                 dflt="drand48"
17186                 echo "Good, found drand48()." >&4
17187         elif set random val -f; eval $csym; $val; then
17188                 dflt="random"
17189                 echo "OK, found random()." >&4
17190         else
17191                 dflt="rand"
17192                 echo "Yick, looks like I have to use rand()." >&4
17193         fi
17194         echo " "
17195         ;;
17196 *)
17197         dflt="$randfunc"
17198         ;;
17199 esac
17200 cont=true
17201
17202 case "$ccflags" in
17203 *-Dmy_rand=*|*-Dmy_srand=*)
17204         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
17205         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
17206         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
17207         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
17208         ;;
17209 esac
17210
17211 while $test "$cont"; do
17212         rp="Use which function to generate random numbers?"
17213         . ./myread
17214         if $test "$ans" = "$dflt"; then
17215                 : null
17216         else
17217                 randbits=''
17218         fi
17219         randfunc="$ans"
17220         if set $ans val -f; eval $csym; $val; then
17221                 cont=''
17222         else
17223                 dflt=y
17224                 rp="I cannot find function $ans. Use that name anyway?"
17225                 . ./myread
17226                 dflt=rand
17227                 case "$ans" in
17228                         [yY]*) cont='';;
17229                 esac
17230         fi
17231         case "$cont" in
17232         '')
17233                 case "$randfunc" in
17234                 drand48)
17235                         drand01="drand48()"
17236                         seedfunc="srand48"
17237                         randbits=48
17238                         randseedtype=long
17239                         ;;
17240                 rand|random)
17241                         case "$randbits" in
17242                         '')
17243 echo "Checking to see how many bits your $randfunc() function produces..." >&4
17244                                 $cat >try.c <<EOCP
17245 #$i_unistd I_UNISTD
17246 #$i_stdlib I_STDLIB
17247 #include <stdio.h>
17248 #ifdef I_UNISTD
17249 #  include <unistd.h>
17250 #endif
17251 #ifdef I_STDLIB
17252 #  include <stdlib.h>
17253 #endif
17254 int main()
17255 {
17256         register int i;
17257         register unsigned long tmp;
17258         register unsigned long max = 0L;
17259
17260         for (i = 1000; i; i--) {
17261                 tmp = (unsigned long) $randfunc();
17262                 if (tmp > max) max = tmp;
17263         }
17264         for (i = 0; max; i++)
17265                 max /= 2;
17266         printf("%d\n",i);
17267 }
17268 EOCP
17269                                 set try
17270                                 if eval $compile_ok; then
17271                                         dflt=`try`
17272                                 else
17273                                         dflt='?'
17274                                         echo "(I can't seem to compile the test program...)"
17275                                 fi
17276                                 ;;
17277                         *)
17278                                 dflt="$randbits"
17279                                 ;;
17280                         esac
17281                         rp="How many bits does your $randfunc() function produce?"
17282                         . ./myread
17283                         randbits="$ans"
17284                         $rm -f try.c try
17285                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17286                         seedfunc="s$randfunc"
17287                         randseedtype=unsigned
17288                         ;;
17289                 *)
17290                         dflt="31"
17291                         rp="How many bits does your $randfunc() function produce?"
17292                         . ./myread
17293                         randbits="$ans"
17294                         seedfunc="s$randfunc"
17295                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17296                         if set $seedfunc val -f; eval $csym; $val; then
17297                                 echo "(Using $seedfunc() to seed random generator)"
17298                         else
17299                                 echo "(Warning: no $seedfunc() to seed random generator)"
17300                                 seedfunc=rand
17301                         fi
17302                         randseedtype=unsigned
17303                         ;;
17304                 esac
17305                 ;;
17306         esac
17307 done
17308
17309 echo " "
17310 echo "Determining whether or not we are on an EBCDIC system..." >&4
17311 $cat >try.c <<'EOM'
17312 int main()
17313 {
17314   if ('M'==0xd4) return 0;
17315   return 1;
17316 }
17317 EOM
17318
17319 val=$undef
17320 set try
17321 if eval $compile_ok; then
17322         if $run ./try; then
17323                 echo "You seem to speak EBCDIC." >&4
17324                 val="$define"
17325         else
17326                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
17327         fi
17328 else
17329         echo "I'm unable to compile the test program." >&4
17330         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
17331 fi
17332 $rm -f try try.*
17333 set ebcdic
17334 eval $setvar
17335
17336 echo " "
17337 $cat >&4 <<EOM
17338 Checking how to flush all pending stdio output...
17339 EOM
17340 # I only know how to find the first 32 possibly open files on SunOS.
17341 # See also hints/sunos_4_1.sh and util.c  --AD
17342 case "$osname" in
17343 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
17344 esac
17345 $cat >>try.c <<EOCP
17346 #include <stdio.h>
17347 #$i_unistd I_UNISTD
17348 #ifdef I_UNISTD
17349 # include <unistd.h>
17350 #endif
17351 #$d_sysconf HAS_SYSCONF
17352 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
17353 #ifdef HAS_STDIO_STREAM_ARRAY
17354 # define STDIO_STREAM_ARRAY $stdio_stream_array
17355 #endif
17356 int main() {
17357   FILE* p;
17358   unlink("try.out");
17359   p = fopen("try.out", "w");
17360 #ifdef TRY_FPUTC
17361   fputc('x', p);
17362 #else
17363 # ifdef TRY_FPRINTF
17364   fprintf(p, "x");
17365 # endif
17366 #endif
17367 #ifdef TRY_FFLUSH_NULL
17368   fflush(NULL);
17369 #endif
17370 #ifdef TRY_FFLUSH_ALL
17371   {
17372     long open_max = -1;
17373 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
17374     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
17375 # else
17376 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
17377     open_max = sysconf(_SC_OPEN_MAX);
17378 #  else
17379 #   ifdef FOPEN_MAX
17380     open_max = FOPEN_MAX;
17381 #   else
17382 #    ifdef OPEN_MAX
17383     open_max = OPEN_MAX;
17384 #    else
17385 #     ifdef _NFILE
17386     open_max = _NFILE;
17387 #     endif
17388 #    endif
17389 #   endif
17390 #  endif
17391 # endif 
17392 # ifdef HAS_STDIO_STREAM_ARRAY
17393     if (open_max > 0) {
17394       long i;
17395       for (i = 0; i < open_max; i++)
17396             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
17397                 STDIO_STREAM_ARRAY[i]._file < open_max &&
17398                 STDIO_STREAM_ARRAY[i]._flag)
17399                 fflush(&STDIO_STREAM_ARRAY[i]);
17400     }   
17401   }
17402 # endif
17403 #endif
17404   _exit(42);
17405 }
17406 EOCP
17407 : first we have to find out how _not_ to flush
17408 $to try.c
17409 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
17410     output=''
17411     set try -DTRY_FPUTC
17412     if eval $compile; then
17413             $run ./try 2>/dev/null
17414             code="$?"
17415             $from try.out
17416             if $test ! -s try.out -a "X$code" = X42; then
17417                 output=-DTRY_FPUTC
17418             fi
17419     fi
17420     case "$output" in
17421     '')
17422             set try -DTRY_FPRINTF
17423             if eval $compile; then
17424                     $run ./try 2>/dev/null
17425                     code="$?"
17426                     $from try.out
17427                     if $test ! -s try.out -a "X$code" = X42; then
17428                         output=-DTRY_FPRINTF
17429                     fi
17430             fi
17431         ;;
17432     esac
17433 fi
17434 : check for fflush NULL behaviour
17435 case "$fflushNULL" in
17436 '')     set try -DTRY_FFLUSH_NULL $output
17437         if eval $compile; then
17438                 $run ./try 2>/dev/null
17439                 code="$?"
17440                 $from try.out
17441                 if $test -s try.out -a "X$code" = X42; then
17442                         fflushNULL="`$cat try.out`"
17443                 else
17444                         if $test "X$code" != X42; then
17445                                 $cat >&4 <<EOM
17446 (If this test failed, don't worry, we'll try another method shortly.)
17447 EOM
17448                         fi
17449                 fi
17450         fi
17451         $rm -f core try.core core.try.*
17452         case "$fflushNULL" in
17453         x)      $cat >&4 <<EOM
17454 Your fflush(NULL) works okay for output streams.
17455 Let's see if it clobbers input pipes...
17456 EOM
17457 # As of mid-March 2000 all versions of Solaris appear to have a stdio
17458 # bug that improperly flushes the input end of pipes.  So we avoid the
17459 # autoflush on fork/system/exec support for now. :-(
17460 $cat >tryp.c <<EOCP
17461 #include <stdio.h>
17462 int
17463 main(int argc, char **argv)
17464 {
17465     char buf[1024];
17466     int i;
17467     char *bp = buf;
17468     while (1) {
17469         while ((i = getc(stdin)) != -1
17470                && (*bp++ = i) != '\n'
17471                && bp < &buf[1024])
17472         /* DO NOTHING */ ;
17473         *bp = '\0';
17474         fprintf(stdout, "%s", buf);
17475         fflush(NULL);
17476         if (i == -1)
17477             return 0;
17478         bp = buf;
17479     }
17480 }
17481 EOCP
17482                 fflushNULL="$define"
17483                 set tryp
17484                 if eval $compile; then
17485                     $rm -f tryp.out
17486                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17487                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
17488                        $cat >&4 <<EOM
17489 fflush(NULL) seems to behave okay with input streams.
17490 EOM
17491                         fflushNULL="$define"
17492                     else
17493                         $cat >&4 <<EOM
17494 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
17495 EOM
17496                         fflushNULL="$undef"
17497                     fi
17498                 fi
17499                 $rm -f core tryp.c tryp.core core.tryp.*
17500                 ;;
17501         '')     $cat >&4 <<EOM
17502 Your fflush(NULL) isn't working (contrary to ANSI C).
17503 EOM
17504                 fflushNULL="$undef"
17505                 ;;
17506         *)      $cat >&4 <<EOM
17507 Cannot figure out whether your fflush(NULL) works or not.
17508 I'm assuming it doesn't (contrary to ANSI C).
17509 EOM
17510                 fflushNULL="$undef"
17511                 ;;
17512         esac
17513         ;;
17514 $define|true|[yY]*)
17515         fflushNULL="$define"
17516         ;;
17517 *)
17518         fflushNULL="$undef"
17519         ;;
17520 esac
17521 : check explicit looping only if NULL did not work, and if the pipe
17522 : bug does not show up on an explicit flush too
17523 case "$fflushNULL" in
17524 "$undef")
17525         $cat >tryp.c <<EOCP
17526 #include <stdio.h>
17527 int
17528 main(int argc, char **argv)
17529 {
17530     char buf[1024];
17531     int i;
17532     char *bp = buf;
17533     while (1) {
17534         while ((i = getc(stdin)) != -1
17535                && (*bp++ = i) != '\n'
17536                && bp < &buf[1024])
17537         /* DO NOTHING */ ;
17538         *bp = '\0';
17539         fprintf(stdout, "%s", buf);
17540         fflush(stdin);
17541         if (i == -1)
17542             return 0;
17543         bp = buf;
17544     }
17545 }
17546 EOCP
17547         set tryp
17548         if eval $compile; then
17549             $rm -f tryp.out
17550             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17551             if cmp tryp.c tryp.out >/dev/null 2>&1; then
17552                $cat >&4 <<EOM
17553 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
17554 EOM
17555                 : now check for fflushall behaviour
17556                 case "$fflushall" in
17557                 '')     set try -DTRY_FFLUSH_ALL $output
17558                         if eval $compile; then
17559                                 $cat >&4 <<EOM
17560 (Now testing the other method--but note that this also may fail.)
17561 EOM
17562                                 $run ./try 2>/dev/null
17563                                 code=$?
17564                                 $from try.out
17565                                 if $test -s try.out -a "X$code" = X42; then
17566                                         fflushall="`$cat try.out`"
17567                                 fi
17568                         fi
17569                         $rm -f core try.core core.try.*
17570                         case "$fflushall" in
17571                         x)      $cat >&4 <<EOM
17572 Whew. Flushing explicitly all the stdio streams works.
17573 EOM
17574                                 fflushall="$define"
17575                                 ;;
17576                         '')     $cat >&4 <<EOM
17577 Sigh. Flushing explicitly all the stdio streams doesn't work.
17578 EOM
17579                                 fflushall="$undef"
17580                                 ;;
17581                         *)      $cat >&4 <<EOM
17582 Cannot figure out whether flushing stdio streams explicitly works or not.
17583 I'm assuming it doesn't.
17584 EOM
17585                                 fflushall="$undef"
17586                                 ;;
17587                         esac
17588                         ;;
17589                 "$define"|true|[yY]*)
17590                         fflushall="$define"
17591                         ;;
17592                 *)
17593                         fflushall="$undef"
17594                         ;;
17595                 esac
17596             else
17597                 $cat >&4 <<EOM
17598 All is futile.  Even fflush(stdin) clobbers input pipes!
17599 EOM
17600                 fflushall="$undef"
17601             fi
17602         else
17603             fflushall="$undef"
17604         fi
17605         $rm -f core tryp.c tryp.core core.tryp.*
17606         ;;
17607 *)      fflushall="$undef"
17608         ;;
17609 esac
17610
17611 case "$fflushNULL$fflushall" in
17612 undefundef)
17613         $cat <<EOM
17614 OK, I give up.  I cannot figure out how to flush pending stdio output.
17615 We won't be flushing handles at all before fork/exec/popen.
17616 EOM
17617         ;;
17618 esac
17619 $rm -f try.* try$exe_ext
17620
17621 : Store the full pathname to the ar program for use in the C program
17622 : Respect a hint or command line value for full_ar.
17623 case "$full_ar" in
17624 '') full_ar=$ar ;;
17625 esac
17626
17627 : Store the full pathname to the sed program for use in the C program
17628 full_sed=$sed
17629
17630 : see what type gids are declared as in the kernel
17631 echo " "
17632 echo "Looking for the type for group ids returned by getgid()."
17633 set gid_t gidtype xxx stdio.h sys/types.h
17634 eval $typedef
17635 case "$gidtype" in
17636 xxx)
17637         xxx=`./findhdr sys/user.h`
17638         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
17639         case $1 in
17640         unsigned) dflt="$1 $2" ;;
17641         *) dflt="$1" ;;
17642         esac
17643         ;;
17644 *) dflt="$gidtype";;
17645 esac
17646 case "$gidtype" in
17647 gid_t) echo "gid_t found." ;;
17648 *)      rp="What is the type for group ids returned by getgid()?"
17649         . ./myread
17650         gidtype="$ans"
17651         ;;
17652 esac
17653
17654 echo " "
17655 case "$gidtype" in
17656 *_t) zzz="$gidtype"     ;;
17657 *)   zzz="gid"          ;;
17658 esac
17659 echo "Checking the size of $zzz..." >&4 
17660 cat > try.c <<EOCP
17661 #include <sys/types.h>
17662 #include <stdio.h>
17663 int main() {
17664     printf("%d\n", (int)sizeof($gidtype));
17665     exit(0);
17666 }
17667 EOCP
17668 set try
17669 if eval $compile_ok; then
17670         yyy=`$run ./try`
17671         case "$yyy" in
17672         '')     gidsize=4
17673                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
17674                 ;;
17675         *)      gidsize=$yyy
17676                 echo "Your $zzz is $gidsize bytes long."
17677                 ;;
17678         esac
17679 else
17680         gidsize=4
17681         echo "(I can't compile the test program--guessing $gidsize.)" >&4
17682 fi
17683
17684
17685 echo " "
17686 case "$gidtype" in
17687 *_t) zzz="$gidtype"     ;;
17688 *)   zzz="gid"          ;;
17689 esac
17690 echo "Checking the sign of $zzz..." >&4 
17691 cat > try.c <<EOCP
17692 #include <sys/types.h>
17693 #include <stdio.h>
17694 int main() {
17695         $gidtype foo = -1;
17696         if (foo < 0)
17697                 printf("-1\n");
17698         else
17699                 printf("1\n");
17700 }
17701 EOCP
17702 set try
17703 if eval $compile; then
17704         yyy=`$run ./try`
17705         case "$yyy" in
17706         '')     gidsign=1
17707                 echo "(I can't execute the test program--guessing unsigned.)" >&4
17708                 ;;
17709         *)      gidsign=$yyy
17710                 case "$gidsign" in
17711                  1) echo "Your $zzz is unsigned." ;;
17712                 -1) echo "Your $zzz is signed."   ;;
17713                 esac
17714                 ;;
17715         esac
17716 else
17717         gidsign=1
17718         echo "(I can't compile the test program--guessing unsigned.)" >&4
17719 fi
17720
17721
17722 echo " "
17723
17724 if $test X"$quadtype" != X; then
17725
17726 echo "Checking how to print 64-bit integers..." >&4
17727
17728 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
17729         $cat >try.c <<'EOCP'
17730 #include <sys/types.h>
17731 #include <stdio.h>
17732 int main() {
17733   int q = 12345678901;
17734   printf("%ld\n", q);
17735 }
17736 EOCP
17737         set try
17738         if eval $compile; then
17739                 yyy=`$run ./try`
17740                 case "$yyy" in
17741                 12345678901)
17742                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
17743                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
17744                         echo "We will use %d."
17745                         ;;
17746                 esac
17747         fi
17748 fi
17749
17750 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
17751         $cat >try.c <<'EOCP'
17752 #include <sys/types.h>
17753 #include <stdio.h>
17754 int main() {
17755   long q = 12345678901;
17756   printf("%ld\n", q);
17757 }
17758 EOCP
17759         set try
17760         if eval $compile; then
17761                 yyy=`$run ./try`
17762                 case "$yyy" in
17763                 12345678901)
17764                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
17765                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
17766                         echo "We will use %ld."
17767                         ;;
17768                 esac
17769         fi
17770 fi
17771
17772 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
17773         $cat >try.c <<'EOCP'
17774 #include <sys/types.h>
17775 #include <inttypes.h>
17776 #include <stdio.h>
17777 int main() {
17778   int64_t q = 12345678901;
17779   printf("%" PRId64 "\n", q);
17780 }
17781 EOCP
17782         set try
17783         if eval $compile; then
17784                 yyy=`$run ./try`
17785                 case "$yyy" in
17786                 12345678901)
17787                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
17788                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
17789                         echo "We will use the C9X style."
17790                         ;;
17791                 esac
17792         fi
17793 fi
17794
17795 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17796         $cat >try.c <<EOCP
17797 #include <sys/types.h>
17798 #include <stdio.h>
17799 int main() {
17800   $quadtype q = 12345678901;
17801   printf("%Ld\n", q);
17802 }
17803 EOCP
17804         set try
17805         if eval $compile; then
17806                 yyy=`$run ./try`
17807                 case "$yyy" in
17808                 12345678901)
17809                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
17810                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
17811                         echo "We will use %Ld."
17812                         ;;
17813                 esac
17814         fi
17815 fi
17816
17817 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
17818         $cat >try.c <<'EOCP'
17819 #include <sys/types.h>
17820 #include <stdio.h>
17821 int main() {
17822   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
17823   printf("%lld\n", q);
17824 }
17825 EOCP
17826         set try
17827         if eval $compile; then
17828                 yyy=`$run ./try`
17829                 case "$yyy" in
17830                 12345678901)
17831                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
17832                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
17833                         echo "We will use the %lld style."
17834                         ;;
17835                 esac
17836         fi
17837 fi
17838
17839 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17840         $cat >try.c <<EOCP
17841 #include <sys/types.h>
17842 #include <stdio.h>
17843 int main() {
17844   $quadtype q = 12345678901;
17845   printf("%qd\n", q);
17846 }
17847 EOCP
17848         set try
17849         if eval $compile; then
17850                 yyy=`$run ./try`
17851                 case "$yyy" in
17852                 12345678901)
17853                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
17854                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
17855                         echo "We will use %qd."
17856                         ;;
17857                 esac
17858         fi
17859 fi
17860
17861 if $test X"$sPRId64" = X; then
17862         echo "Cannot figure out how to print 64-bit integers." >&4
17863 fi
17864
17865 $rm -f try try.*
17866
17867 fi
17868
17869 case "$sPRId64" in
17870 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
17871         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
17872         ;;
17873 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
17874         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
17875         ;;
17876 esac
17877
17878
17879 echo " "
17880 $echo "Checking the format strings to be used for Perl's internal types..." >&4
17881
17882 if $test X"$ivsize" = X8; then
17883         ivdformat="$sPRId64"
17884         uvuformat="$sPRIu64"
17885         uvoformat="$sPRIo64"
17886         uvxformat="$sPRIx64"
17887         uvXUformat="$sPRIXU64"
17888 else
17889         if $test X"$ivsize" = X"$longsize"; then
17890                 ivdformat='"ld"'
17891                 uvuformat='"lu"'
17892                 uvoformat='"lo"'
17893                 uvxformat='"lx"'
17894                 uvXUformat='"lX"'
17895         else
17896                 if $test X"$ivsize" = X"$intsize"; then
17897                         ivdformat='"d"'
17898                         uvuformat='"u"'
17899                         uvoformat='"o"'
17900                         uvxformat='"x"'
17901                         uvXUformat='"X"'
17902                 else
17903                         : far out
17904                         if $test X"$ivsize" = X"$shortsize"; then
17905                                 ivdformat='"hd"'
17906                                 uvuformat='"hu"'
17907                                 uvoformat='"ho"'
17908                                 uvxformat='"hx"'
17909                                 uvXUformat='"hX"'
17910                         fi
17911                 fi
17912         fi
17913 fi
17914
17915 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
17916         nveformat="$sPRIeldbl"
17917         nvfformat="$sPRIfldbl"
17918         nvgformat="$sPRIgldbl"
17919         nvEUformat="$sPRIEUldbl"
17920         nvFUformat="$sPRIFUldbl"
17921         nvGUformat="$sPRIGUldbl"
17922 else
17923         nveformat='"e"'
17924         nvfformat='"f"'
17925         nvgformat='"g"'
17926         nvEUformat='"E"'
17927         nvFUformat='"F"'
17928         nvGUformat='"G"'
17929 fi
17930
17931 case "$ivdformat" in
17932 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
17933     exit 1
17934     ;;
17935 esac
17936
17937
17938 echo " "
17939 $echo "Checking the format string to be used for gids..." >&4
17940
17941 case "$gidsign" in
17942 -1)     if $test X"$gidsize" = X"$ivsize"; then
17943                 gidformat="$ivdformat"
17944         else
17945                 if $test X"$gidsize" = X"$longsize"; then
17946                         gidformat='"ld"'
17947                 else
17948                         if $test X"$gidsize" = X"$intsize"; then
17949                                 gidformat='"d"'
17950                         else
17951                                 if $test X"$gidsize" = X"$shortsize"; then
17952                                         gidformat='"hd"'
17953                                 fi
17954                         fi
17955                 fi
17956         fi
17957         ;;
17958 *)      if $test X"$gidsize" = X"$uvsize"; then
17959                 gidformat="$uvuformat"
17960         else
17961                 if $test X"$gidsize" = X"$longsize"; then
17962                         gidformat='"lu"'
17963                 else
17964                         if $test X"$gidsize" = X"$intsize"; then
17965                                 gidformat='"u"'
17966                         else
17967                                 if $test X"$gidsize" = X"$shortsize"; then
17968                                         gidformat='"hu"'
17969                                 fi
17970                         fi
17971                 fi
17972         fi
17973         ;;
17974 esac
17975
17976 : see if getgroups exists
17977 set getgroups d_getgrps
17978 eval $inlibc
17979
17980 : see if setgroups exists
17981 set setgroups d_setgrps
17982 eval $inlibc
17983
17984
17985 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
17986 echo " "
17987 case "$d_getgrps$d_setgrps" in
17988 *define*)
17989         case "$groupstype" in
17990         '') dflt="$gidtype" ;;
17991         *)  dflt="$groupstype" ;;
17992         esac
17993         $cat <<EOM
17994 What type of pointer is the second argument to getgroups() and setgroups()?
17995 Usually this is the same as group ids, $gidtype, but not always.
17996
17997 EOM
17998         rp='What type pointer is the second argument to getgroups() and setgroups()?'
17999         . ./myread
18000         groupstype="$ans"
18001         ;;
18002 *)  groupstype="$gidtype";;
18003 esac
18004
18005 echo " "
18006 echo "Checking if your $make program sets \$(MAKE)..." >&4
18007 case "$make_set_make" in
18008 '')
18009         $sed 's/^X //' > testmake.mak << 'EOF'
18010 Xall:
18011 X       @echo 'maketemp="$(MAKE)"'
18012 EOF
18013         case "`$make -f testmake.mak 2>/dev/null`" in
18014         *maketemp=*) make_set_make='#' ;;
18015         *)      make_set_make="MAKE=$make" ;;
18016         esac
18017         $rm -f testmake.mak
18018         ;;
18019 esac
18020 case "$make_set_make" in
18021 '#') echo "Yup, it does.";;
18022 *) echo "Nope, it doesn't.";;
18023 esac
18024
18025 : see what type is used for mode_t
18026 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
18027 set mode_t modetype int stdio.h sys/types.h
18028 eval $typedef_ask
18029
18030 : see if stdarg is available
18031 echo " "
18032 if $test `./findhdr stdarg.h`; then
18033         echo "<stdarg.h> found." >&4
18034         valstd="$define"
18035 else
18036         echo "<stdarg.h> NOT found." >&4
18037         valstd="$undef"
18038 fi
18039
18040 : see if varags is available
18041 echo " "
18042 if $test `./findhdr varargs.h`; then
18043         echo "<varargs.h> found." >&4
18044 else
18045         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
18046 fi
18047
18048 : set up the varargs testing programs
18049 $cat > varargs.c <<EOP
18050 #ifdef I_STDARG
18051 #include <stdarg.h>
18052 #endif
18053 #ifdef I_VARARGS
18054 #include <varargs.h>
18055 #endif
18056
18057 #ifdef I_STDARG
18058 int f(char *p, ...)
18059 #else
18060 int f(va_alist)
18061 va_dcl
18062 #endif
18063 {
18064         va_list ap;
18065 #ifndef I_STDARG
18066         char *p;
18067 #endif
18068 #ifdef I_STDARG
18069         va_start(ap,p);
18070 #else
18071         va_start(ap);
18072         p = va_arg(ap, char *);
18073 #endif
18074         va_end(ap);
18075 }
18076 EOP
18077 $cat > varargs <<EOP
18078 $startsh
18079 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
18080         echo "true"
18081 else
18082         echo "false"
18083 fi
18084 $rm -f varargs$_o
18085 EOP
18086 chmod +x varargs
18087
18088 : now check which varargs header should be included
18089 echo " "
18090 i_varhdr=''
18091 case "$valstd" in
18092 "$define")
18093         if `./varargs I_STDARG`; then
18094                 val='stdarg.h'
18095         elif `./varargs I_VARARGS`; then
18096                 val='varargs.h'
18097         fi
18098         ;;
18099 *)
18100         if `./varargs I_VARARGS`; then
18101                 val='varargs.h'
18102         fi
18103         ;;
18104 esac
18105 case "$val" in
18106 '')
18107 echo "I could not find the definition for va_dcl... You have problems..." >&4
18108         val="$undef"; set i_stdarg; eval $setvar
18109         val="$undef"; set i_varargs; eval $setvar
18110         ;;
18111 *) 
18112         set i_varhdr
18113         eval $setvar
18114         case "$i_varhdr" in
18115         stdarg.h)
18116                 val="$define"; set i_stdarg; eval $setvar
18117                 val="$undef"; set i_varargs; eval $setvar
18118                 ;;
18119         varargs.h)
18120                 val="$undef"; set i_stdarg; eval $setvar
18121                 val="$define"; set i_varargs; eval $setvar
18122                 ;;
18123         esac
18124         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
18125 esac
18126 $rm -f varargs*
18127
18128 : see if we need va_copy
18129 echo " "
18130 case "$i_stdarg" in
18131 "$define")
18132         $cat >try.c <<EOCP
18133 #include <stdarg.h>
18134 #include <stdio.h>
18135 #$i_stdlib I_STDLIB
18136 #ifdef I_STDLIB
18137 #include <stdlib.h>
18138 #endif
18139 #include <signal.h>
18140
18141 int
18142 ivfprintf(FILE *f, const char *fmt, va_list *valp)
18143 {
18144   return vfprintf(f, fmt, *valp);
18145 }
18146  
18147 int    
18148 myvfprintf(FILE *f, const  char *fmt, va_list val)
18149 {
18150   return ivfprintf(f, fmt, &val);
18151 }
18152       
18153 int
18154 myprintf(char *fmt, ...) 
18155 {
18156   va_list val;
18157   va_start(val, fmt);
18158   return myvfprintf(stdout, fmt, val); 
18159 }         
18160
18161 int
18162 main(int ac, char **av)
18163 {
18164   signal(SIGSEGV, exit);
18165
18166   myprintf("%s%cs all right, then\n", "that", '\'');                            
18167   exit(0);      
18168 }
18169 EOCP
18170         set try
18171         if eval $compile && $run ./try 2>&1 >/dev/null; then
18172                 case "`$run ./try`" in
18173                 "that's all right, then")
18174                         okay=yes
18175                         ;;
18176                 esac
18177         fi
18178         case "$okay" in
18179         yes)    echo "It seems that you don't need va_copy()." >&4
18180                 need_va_copy="$undef"
18181                 ;;
18182         *)      echo "It seems that va_copy() or similar will be needed." >&4
18183                 need_va_copy="$define"
18184                 ;;
18185         esac
18186         $rm -f try.* core core.* *.core *.core.*
18187         ;;
18188 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
18189         ;;
18190 esac
18191
18192 : see what type is used for size_t
18193 rp="What is the type used for the length parameter for string functions?"
18194 set size_t sizetype 'unsigned int' stdio.h sys/types.h
18195 eval $typedef_ask
18196
18197 : check for type of arguments to gethostbyaddr. 
18198 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
18199         case "$d_gethbyaddr" in
18200         $define)
18201                 $cat <<EOM
18202
18203 Checking to see what type of arguments are accepted by gethostbyaddr().
18204 EOM
18205                 hdrs="$define sys/types.h
18206                         $d_socket sys/socket.h 
18207                         $i_niin netinet/in.h 
18208                         $i_netdb netdb.h
18209                         $i_unistd unistd.h"
18210                 : The first arg can 'char *' or 'void *'
18211                 : The second arg is some of integral type
18212                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
18213                         for yyy in size_t long int; do
18214                                 case "$netdb_host_type" in
18215                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
18216                                         if ./protochk "$try" $hdrs; then
18217                                                 echo "Your system accepts $xxx for the first arg."
18218                                                 echo "...and $yyy for the second arg."
18219                                                 netdb_host_type="$xxx"
18220                                                 netdb_hlen_type="$yyy"
18221                                         fi
18222                                         ;;
18223                                 esac
18224                         done
18225                 done
18226                 : In case none of those worked, prompt the user.
18227                 case "$netdb_host_type" in
18228                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
18229                         dflt='char *'
18230                         . ./myread
18231                         netdb_host_type=$ans
18232                         rp='What is the type for the 2nd argument to gethostbyaddr?'
18233                         dflt="$sizetype"
18234                         . ./myread
18235                         netdb_hlen_type=$ans
18236                         ;;
18237                 esac
18238                 ;;
18239         *)      : no gethostbyaddr, so pick harmless defaults
18240                 netdb_host_type='char *'
18241                 netdb_hlen_type="$sizetype"
18242                 ;;
18243         esac
18244         # Remove the "const" if needed. -- but then we'll have a 
18245         # prototype clash!
18246         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
18247 fi
18248
18249 : check for type of argument to gethostbyname. 
18250 if test "X$netdb_name_type" = X ; then
18251         case "$d_gethbyname" in
18252         $define)
18253                 $cat <<EOM
18254
18255 Checking to see what type of argument is accepted by gethostbyname().
18256 EOM
18257                 hdrs="$define sys/types.h
18258                         $d_socket sys/socket.h 
18259                         $i_niin netinet/in.h 
18260                         $i_netdb netdb.h
18261                         $i_unistd unistd.h"
18262                 for xxx in "const char *" "char *"; do
18263                         case "$netdb_name_type" in
18264                         '')     try="extern struct hostent *gethostbyname($xxx);"
18265                                 if ./protochk "$try" $hdrs; then
18266                                         echo "Your system accepts $xxx."
18267                                         netdb_name_type="$xxx"
18268                                 fi
18269                                 ;;
18270                         esac
18271                 done
18272                 : In case none of those worked, prompt the user.
18273                 case "$netdb_name_type" in
18274                 '')     rp='What is the type for the 1st argument to gethostbyname?'
18275                         dflt='char *'
18276                         . ./myread
18277                         netdb_name_type=$ans
18278                         ;;
18279                 esac
18280                 ;;
18281         *)      : no gethostbyname, so pick harmless default
18282                 netdb_name_type='char *'
18283                 ;;
18284         esac
18285 fi
18286
18287 : check for type of 1st argument to getnetbyaddr. 
18288 if test "X$netdb_net_type" = X ; then
18289         case "$d_getnbyaddr" in
18290         $define)
18291                 $cat <<EOM
18292
18293 Checking to see what type of 1st argument is accepted by getnetbyaddr().
18294 EOM
18295                 hdrs="$define sys/types.h
18296                         $d_socket sys/socket.h 
18297                         $i_niin netinet/in.h 
18298                         $i_netdb netdb.h
18299                         $i_unistd unistd.h"
18300                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
18301                         case "$netdb_net_type" in
18302                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
18303                                 if ./protochk "$try" $hdrs; then
18304                                         echo "Your system accepts $xxx."
18305                                         netdb_net_type="$xxx"
18306                                 fi
18307                                 ;;
18308                         esac
18309                 done
18310                 : In case none of those worked, prompt the user.
18311                 case "$netdb_net_type" in
18312                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
18313                         dflt='long'
18314                         . ./myread
18315                         netdb_net_type=$ans
18316                         ;;
18317                 esac
18318                 ;;
18319         *)      : no getnetbyaddr, so pick harmless default
18320                 netdb_net_type='long'
18321                 ;;
18322         esac
18323 fi
18324 : locate the preferred pager for this system
18325 fn=f/
18326 case "$pager" in
18327 '')
18328         dflt=''
18329         case "$pg" in
18330         /*) dflt=$pg;;
18331         [a-zA-Z]:/*) dflt=$pg;;
18332         esac
18333         case "$more" in
18334         /*) dflt=$more;;
18335         [a-zA-Z]:/*) dflt=$more;;
18336         esac
18337         case "$less" in
18338         /*) dflt=$less;;
18339         [a-zA-Z]:/*) dflt=$less;;
18340         esac
18341         case "$dflt" in
18342         '') dflt=/usr/ucb/more;;
18343         esac
18344         ;;
18345 *)      dflt="$pager"
18346         : Instruct ./getfile to trust the hinted or previous pager value,
18347         : even if it does not begin with a slash.  For example, on os2,
18348         : pager might be cmd /c more.  See comments in UU/getfile.
18349         fn="f/($pager)"
18350         ;;
18351 esac
18352 echo " "
18353 rp='What pager is used on your system?'
18354 . ./getfile
18355 pager="$ans"
18356
18357 : see what type pids are declared as in the kernel
18358 rp="What is the type of process ids on this system?"
18359 set pid_t pidtype int stdio.h sys/types.h
18360 eval $typedef_ask
18361
18362 : Find earliest binary compatible site_perl subdirectory perl can use.
18363 xs_apiversion=$version # The current site_perl version.
18364 : Find earliest pure perl site_perl subdirectory perl can use.
18365 : The versioned directories started at 5.005.
18366 pm_apiversion='5.005'
18367
18368 : see if ar generates random libraries by itself
18369 echo " "
18370 echo "Checking how to generate random libraries on your machine..." >&4
18371 echo 'int bar1() { return bar2(); }' > bar1.c
18372 echo 'int bar2() { return 2; }' > bar2.c
18373 $cat > foo.c <<'EOP'
18374 int main() { printf("%d\n", bar1()); exit(0); }
18375 EOP
18376 $cc $ccflags -c bar1.c >/dev/null 2>&1
18377 $cc $ccflags -c bar2.c >/dev/null 2>&1
18378 $cc $ccflags -c foo.c >/dev/null 2>&1
18379 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
18380 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
18381         $run ./foobar >/dev/null 2>&1; then
18382         echo "$ar appears to generate random libraries itself."
18383         orderlib=false
18384         ranlib=":"
18385 elif $ar ts bar$_a >/dev/null 2>&1 &&
18386         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
18387         $run ./foobar >/dev/null 2>&1; then
18388                 echo "a table of contents needs to be added with '$ar ts'."
18389                 orderlib=false
18390                 ranlib="$ar ts"
18391 else
18392         case "$ranlib" in
18393         :) ranlib='';;
18394         '')
18395                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
18396                 $test -f $ranlib || ranlib=''
18397                 ;;
18398         esac
18399         if $test -n "$ranlib"; then
18400                 echo "your system has '$ranlib'; we'll use that."
18401                 orderlib=false
18402         else
18403                 echo "your system doesn't seem to support random libraries"
18404                 echo "so we'll use lorder and tsort to order the libraries."
18405                 orderlib=true
18406                 ranlib=":"
18407         fi
18408 fi
18409 $rm -f foo* bar* 
18410
18411 : check for type of arguments to select. 
18412 case "$selecttype" in
18413 '') case "$d_select" in
18414         $define)
18415                 echo " "
18416                 $cat <<EOM
18417 Checking to see what type of arguments are accepted by select().
18418 EOM
18419                 hdrs="$define sys/types.h
18420                         $i_systime sys/time.h 
18421                         $i_sysselct sys/select.h
18422                         $d_socket sys/socket.h"
18423                 : The first arg can be int, unsigned, or size_t
18424                 : The last arg may or may not be 'const'
18425                 val=''
18426                 : void pointer has been seen but using that
18427                 : breaks the selectminbits test
18428                 for xxx in 'fd_set *' 'int *'; do
18429                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
18430                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
18431                                         case "$val" in
18432                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
18433                                                 if ./protochk "$try" $hdrs; then
18434                                                         echo "Your system accepts $xxx."
18435                                                         val="$xxx"
18436                                                 fi
18437                                                 ;;
18438                                         esac
18439                                 done
18440                         done
18441                 done
18442                 case "$val" in
18443                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
18444                         case "$d_fd_set" in
18445                                 $define) dflt="fd_set *" ;;
18446                                 *)              dflt="int *" ;;
18447                         esac
18448                         . ./myread
18449                         val=$ans
18450                         ;;
18451                 esac
18452                 selecttype="$val"
18453                 ;;
18454         *)      : no select, so pick a harmless default
18455                 selecttype='int *'
18456                 ;;
18457         esac
18458         ;;
18459 esac
18460
18461 : check for the select 'width'
18462 case "$selectminbits" in
18463 '') case "$d_select" in
18464         $define)
18465                 $cat <<EOM
18466
18467 Checking to see on how many bits at a time your select() operates...
18468 EOM
18469                 $cat >try.c <<EOCP
18470 #include <sys/types.h>
18471 #$i_time I_TIME
18472 #$i_systime I_SYS_TIME
18473 #$i_systimek I_SYS_TIME_KERNEL
18474 #ifdef I_TIME
18475 #   include <time.h>
18476 #endif
18477 #ifdef I_SYS_TIME
18478 #   ifdef I_SYS_TIME_KERNEL
18479 #       define KERNEL
18480 #   endif
18481 #   include <sys/time.h>
18482 #   ifdef I_SYS_TIME_KERNEL
18483 #       undef KERNEL
18484 #   endif
18485 #endif
18486 #$i_sysselct I_SYS_SELECT
18487 #ifdef I_SYS_SELECT
18488 #include <sys/select.h>
18489 #endif
18490 #$d_socket HAS_SOCKET
18491 #ifdef HAS_SOCKET
18492 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
18493 #endif
18494 #include <stdio.h>
18495 $selecttype b;
18496 #define S sizeof(*(b))
18497 #define MINBITS 64
18498 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
18499 #define NBITS  (NBYTES * 8)
18500 int main() {
18501     char s[NBYTES];
18502     struct timeval t;
18503     int i;
18504     FILE* fp;
18505     int fd;
18506
18507     fclose(stdin);
18508     fp = fopen("try.c", "r");
18509     if (fp == 0)
18510       exit(1);
18511     fd = fileno(fp);
18512     if (fd < 0)
18513       exit(2);
18514     b = ($selecttype)s;
18515     for (i = 0; i < NBITS; i++)
18516         FD_SET(i, b);
18517     t.tv_sec  = 0;
18518     t.tv_usec = 0;
18519     select(fd + 1, b, 0, 0, &t);
18520     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
18521     printf("%d\n", i + 1);
18522     return 0;
18523 }
18524 EOCP
18525                 set try
18526                 if eval $compile_ok; then
18527                         selectminbits=`$run ./try`
18528                         case "$selectminbits" in
18529                         '')     cat >&4 <<EOM
18530 Cannot figure out on how many bits at a time your select() operates.
18531 I'll play safe and guess it is 32 bits.
18532 EOM
18533                                 selectminbits=32
18534                                 bits="32 bits"
18535                                 ;;
18536                         1)      bits="1 bit" ;;
18537                         *)      bits="$selectminbits bits" ;;
18538                         esac
18539                         echo "Your select() operates on $bits at a time." >&4
18540                 else
18541                         rp='What is the minimum number of bits your select() operates on?'
18542                         case "$byteorder" in
18543                         1234|12345678)  dflt=32 ;;
18544                         *)              dflt=1  ;;
18545                         esac
18546                         . ./myread
18547                         val=$ans
18548                         selectminbits="$val"
18549                 fi
18550                 $rm -f try.* try
18551                 ;;
18552         *)      : no select, so pick a harmless default
18553                 selectminbits='32'
18554                 ;;
18555         esac
18556         ;;
18557 esac
18558
18559 : Trace out the files included by signal.h, then look for SIGxxx names.
18560 : Remove SIGARRAYSIZE used by HPUX.
18561 : Remove SIGSTKSIZE used by Linux.
18562 : Remove SIGSTKSZ used by Posix.
18563 : Remove SIGTYP void lines used by OS2.
18564 : Some cpps, like os390, dont give the file name anywhere
18565 if [ "X$fieldn" = X ]; then
18566         : Just make some guesses.  We check them later.
18567         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
18568 else
18569         xxx=`echo '#include <signal.h>' |
18570         $cppstdin $cppminus $cppflags 2>/dev/null |
18571         $grep '^[       ]*#.*include' | 
18572         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
18573 fi
18574 : Check this list of files to be sure we have parsed the cpp output ok.
18575 : This will also avoid potentially non-existent files, such 
18576 : as ../foo/bar.h
18577 xxxfiles=''
18578 for xx in $xxx /dev/null ; do
18579         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
18580 done
18581 : If we have found no files, at least try signal.h
18582 case "$xxxfiles" in
18583 '')     xxxfiles=`./findhdr signal.h` ;;
18584 esac
18585 xxx=`awk '
18586 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
18587         print substr($2, 4, 20)
18588 }
18589 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
18590         print substr($3, 4, 20)
18591 }' $xxxfiles`
18592 : Append some common names just in case the awk scan failed.
18593 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
18594 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
18595 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
18596 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
18597 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
18598
18599 : generate a few handy files for later
18600 $cat > signal.c <<'EOCP'
18601 #include <sys/types.h>
18602 #include <signal.h>
18603 #include <stdio.h>
18604 int main() {
18605
18606 /* Strange style to avoid deeply-nested #if/#else/#endif */
18607 #ifndef NSIG
18608 #  ifdef _NSIG
18609 #    define NSIG (_NSIG)
18610 #  endif
18611 #endif
18612
18613 #ifndef NSIG
18614 #  ifdef SIGMAX
18615 #    define NSIG (SIGMAX+1)
18616 #  endif
18617 #endif
18618
18619 #ifndef NSIG
18620 #  ifdef SIG_MAX
18621 #    define NSIG (SIG_MAX+1)
18622 #  endif
18623 #endif
18624
18625 #ifndef NSIG
18626 #  ifdef MAXSIG
18627 #    define NSIG (MAXSIG+1)
18628 #  endif
18629 #endif
18630
18631 #ifndef NSIG
18632 #  ifdef MAX_SIG
18633 #    define NSIG (MAX_SIG+1)
18634 #  endif
18635 #endif
18636
18637 #ifndef NSIG
18638 #  ifdef SIGARRAYSIZE
18639 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
18640 #  endif
18641 #endif
18642
18643 #ifndef NSIG
18644 #  ifdef _sys_nsig
18645 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
18646 #  endif
18647 #endif
18648
18649 /* Default to some arbitrary number that's big enough to get most
18650    of the common signals.
18651 */
18652 #ifndef NSIG
18653 #    define NSIG 50
18654 #endif
18655
18656 printf("NSIG %d\n", NSIG);
18657
18658 #ifndef JUST_NSIG
18659
18660 EOCP
18661
18662 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
18663 {
18664         printf "#ifdef SIG"; printf $1; printf "\n"
18665         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
18666         printf $1; printf ");\n"
18667         printf "#endif\n"
18668 }
18669 END {
18670         printf "#endif /* JUST_NSIG */\n";
18671         printf "exit(0);\n}\n";
18672 }
18673 ' >>signal.c
18674 $cat >signal.awk <<'EOP'
18675 BEGIN { ndups = 0 }
18676 $1 ~ /^NSIG$/ { nsig = $2 }
18677 ($1 !~ /^NSIG$/) && (NF == 2) {
18678     if ($2 > maxsig) { maxsig = $2 }
18679     if (sig_name[$2]) {
18680         dup_name[ndups] = $1
18681         dup_num[ndups] = $2
18682         ndups++ 
18683     }
18684     else {
18685         sig_name[$2] = $1
18686         sig_num[$2] = $2
18687     }
18688 }
18689 END { 
18690     if (nsig == 0) {
18691         nsig = maxsig + 1
18692     }
18693     printf("NSIG %d\n", nsig);
18694     for (n = 1; n < nsig; n++) {
18695         if (sig_name[n]) {
18696             printf("%s %d\n", sig_name[n], sig_num[n])
18697         }
18698         else {
18699             printf("NUM%d %d\n", n, n) 
18700         }
18701     }
18702     for (n = 0; n < ndups; n++) {
18703         printf("%s %d\n", dup_name[n], dup_num[n])
18704     }
18705 }
18706 EOP
18707 $cat >signal_cmd <<EOS
18708 $startsh
18709 if $test -s signal.lst; then
18710     echo "Using your existing signal.lst file"
18711         exit 0
18712 fi
18713 xxx="$xxx"
18714 EOS
18715 $cat >>signal_cmd <<'EOS'
18716
18717 set signal
18718 if eval $compile_ok; then
18719         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
18720 else
18721         echo "(I can't seem be able to compile the whole test program)" >&4
18722         echo "(I'll try it in little pieces.)" >&4
18723         set signal -DJUST_NSIG
18724         if eval $compile_ok; then
18725                 $run ./signal$_exe > signal.nsg
18726                 $cat signal.nsg
18727         else
18728                 echo "I can't seem to figure out how many signals you have." >&4
18729                 echo "Guessing 50." >&4
18730                 echo 'NSIG 50' > signal.nsg
18731         fi
18732         : Now look at all the signal names, one at a time.
18733         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
18734                 $cat > signal.c <<EOCP
18735 #include <sys/types.h>
18736 #include <signal.h>
18737 #include <stdio.h>
18738 int main() {
18739 printf("$xx %d\n", SIG${xx});
18740 return 0;
18741 }
18742 EOCP
18743                 set signal
18744                 if eval $compile; then
18745                         echo "SIG${xx} found."
18746                         $run ./signal$_exe  >> signal.ls1
18747                 else
18748                         echo "SIG${xx} NOT found."
18749                 fi
18750         done
18751         if $test -s signal.ls1; then
18752                 $cat signal.nsg signal.ls1 |
18753                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
18754         fi
18755
18756 fi
18757 if $test -s signal.lst; then
18758         :
18759 else
18760         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
18761         echo 'kill -l' >signal
18762         set X `csh -f <signal`
18763         $rm -f signal
18764         shift
18765         case $# in
18766         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
18767         esac
18768         echo $@ | $tr ' ' $trnl | \
18769             $awk '{ printf "%s %d\n", $1, ++s; }
18770                   END { printf "NSIG %d\n", ++s }' >signal.lst
18771 fi
18772 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
18773 EOS
18774 chmod a+x signal_cmd
18775 $eunicefix signal_cmd
18776
18777 : generate list of signal names
18778 echo " "
18779 case "$sig_name_init" in
18780 '') doinit=yes ;;
18781 *)  case "$sig_num_init" in
18782     ''|*,*) doinit=yes ;;
18783     esac ;;
18784 esac
18785 case "$doinit" in
18786 yes)
18787         echo "Generating a list of signal names and numbers..." >&4
18788         . ./signal_cmd
18789         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
18790         sig_name=`$awk 'BEGIN { printf "ZERO " }
18791                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
18792         sig_num=`$awk  'BEGIN { printf "0 " }
18793                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
18794         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
18795                              !/^NSIG/   { printf "\"%s\", ", $1 }
18796                              END        { printf "0\n" }' signal.lst`
18797         sig_num_init=`$awk  'BEGIN      { printf "0, " }
18798                              !/^NSIG/   { printf "%d, ", $2}
18799                              END        { printf "0\n"}' signal.lst`
18800         ;;
18801 esac
18802 echo "The following $sig_count signals are available:"
18803 echo " "
18804 echo $sig_name | $awk \
18805 'BEGIN { linelen = 0 }
18806 {
18807         for (i = 1; i <= NF; i++) {
18808                 name = "SIG" $i " "
18809                 linelen = linelen + length(name)
18810                 if (linelen > 70) {
18811                         printf "\n"
18812                         linelen = length(name)
18813                 }
18814                 printf "%s", name
18815         }
18816         printf "\n"
18817 }'
18818 sig_size=`echo $sig_name | awk '{print NF}'`
18819 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
18820
18821 echo " "
18822 case "$sizetype" in
18823 *_t) zzz="$sizetype"    ;;
18824 *)   zzz="filesize"     ;;
18825 esac
18826 echo "Checking the size of $zzz..." >&4 
18827 cat > try.c <<EOCP
18828 #include <sys/types.h>
18829 #include <stdio.h>
18830 int main() {
18831     printf("%d\n", (int)sizeof($sizetype));
18832     exit(0);
18833 }
18834 EOCP
18835 set try
18836 if eval $compile_ok; then
18837         yyy=`$run ./try`
18838         case "$yyy" in
18839         '')     sizesize=4
18840                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
18841                 ;;
18842         *)      sizesize=$yyy
18843                 echo "Your $zzz size is $sizesize bytes."
18844                 ;;
18845         esac
18846 else
18847         sizesize=4
18848         echo "(I can't compile the test program--guessing $sizesize.)" >&4
18849 fi
18850
18851
18852 : check for socklen_t
18853 echo " "
18854 echo "Checking to see if you have socklen_t..." >&4
18855 $cat >try.c <<EOCP
18856 #include <sys/types.h>
18857 #$d_socket HAS_SOCKET
18858 #ifdef HAS_SOCKET
18859 #include <sys/socket.h>
18860 #endif
18861 int main() { socklen_t x = 16; }
18862 EOCP
18863 set try
18864 if eval $compile; then
18865         val="$define"
18866         echo "You have socklen_t."
18867 else
18868         val="$undef"
18869         echo "You do not have socklen_t."
18870         case "$sizetype" in
18871         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
18872         esac
18873 fi
18874 $rm -f try try.*
18875 set d_socklen_t
18876 eval $setvar
18877
18878 : see if this is a socks.h system
18879 set socks.h i_socks
18880 eval $inhdr
18881
18882 : check for type of the size argument to socket calls
18883 case "$d_socket" in
18884 "$define")
18885         $cat <<EOM
18886
18887 Checking to see what type is the last argument of accept().
18888 EOM
18889         yyy=''
18890         case "$d_socklen_t" in
18891         "$define") yyy="$yyy socklen_t"
18892         esac
18893         yyy="$yyy $sizetype int long unsigned"
18894         for xxx in $yyy; do
18895                 case "$socksizetype" in
18896                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
18897                         case "$usesocks" in
18898                         "$define")
18899                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
18900                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18901                                         socksizetype="$xxx"
18902                                 fi
18903                                 ;;
18904                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
18905                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18906                                         socksizetype="$xxx"
18907                                 fi
18908                                 ;;
18909                         esac
18910                         ;;
18911                 esac
18912         done
18913 : In case none of those worked, prompt the user.
18914         case "$socksizetype" in
18915         '')     rp='What is the type for socket address structure sizes?'
18916                 dflt='int'
18917                 . ./myread
18918                 socksizetype=$ans
18919                 ;;
18920         esac
18921         ;;
18922 *)      : no sockets, so pick relatively harmless default
18923         socksizetype='int'
18924         ;;
18925 esac
18926
18927 : see what type is used for signed size_t
18928 set ssize_t ssizetype int stdio.h sys/types.h
18929 eval $typedef
18930 dflt="$ssizetype"
18931 $cat > try.c <<EOM
18932 #include <stdio.h>
18933 #include <sys/types.h>
18934 #define Size_t $sizetype
18935 #define SSize_t $dflt
18936 int main()
18937 {
18938         if (sizeof(Size_t) == sizeof(SSize_t))
18939                 printf("$dflt\n");
18940         else if (sizeof(Size_t) == sizeof(int))
18941                 printf("int\n");
18942         else 
18943                 printf("long\n");
18944         exit(0);
18945 }
18946 EOM
18947 echo " "
18948 set try
18949 if eval $compile_ok && $run ./try > /dev/null; then
18950         ssizetype=`$run ./try`
18951         echo "I'll be using $ssizetype for functions returning a byte count." >&4
18952 else
18953         $cat >&4 <<EOM
18954 Help! I can't compile and run the ssize_t test program: please enlighten me!
18955 (This is probably a misconfiguration in your system or libraries, and
18956 you really ought to fix it.  Still, I'll try anyway.)
18957
18958 I need a type that is the same size as $sizetype, but is guaranteed to
18959 be signed.  Common values are ssize_t, int and long.
18960
18961 EOM
18962         rp="What signed type is the same size as $sizetype?"
18963         . ./myread
18964         ssizetype="$ans"
18965 fi
18966 $rm -f try try.*
18967
18968 : see what type of char stdio uses.
18969 echo " "
18970 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
18971 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
18972         echo "Your stdio uses unsigned chars." >&4
18973         stdchar="unsigned char"
18974 else
18975         echo "Your stdio uses signed chars." >&4
18976         stdchar="char"
18977 fi
18978 $rm -f stdioh
18979
18980
18981
18982 : see what type uids are declared as in the kernel
18983 echo " "
18984 echo "Looking for the type for user ids returned by getuid()."
18985 set uid_t uidtype xxx stdio.h sys/types.h
18986 eval $typedef
18987 case "$uidtype" in
18988 xxx)
18989         xxx=`./findhdr sys/user.h`
18990         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
18991         case $1 in
18992         unsigned) dflt="$1 $2" ;;
18993         *) dflt="$1" ;;
18994         esac
18995         ;;
18996 *) dflt="$uidtype";;
18997 esac
18998 case "$uidtype" in
18999 uid_t)  echo "uid_t found." ;;
19000 *)      rp="What is the type for user ids returned by getuid()?"
19001         . ./myread
19002         uidtype="$ans"
19003         ;;
19004 esac
19005
19006 echo " "
19007 case "$uidtype" in
19008 *_t) zzz="$uidtype"     ;;
19009 *)   zzz="uid"          ;;
19010 esac
19011 echo "Checking the size of $zzz..." >&4 
19012 cat > try.c <<EOCP
19013 #include <sys/types.h>
19014 #include <stdio.h>
19015 int main() {
19016     printf("%d\n", (int)sizeof($uidtype));
19017     exit(0);
19018 }
19019 EOCP
19020 set try
19021 if eval $compile_ok; then
19022         yyy=`$run ./try`
19023         case "$yyy" in
19024         '')     uidsize=4
19025                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
19026                 ;;
19027         *)      uidsize=$yyy
19028                 echo "Your $zzz is $uidsize bytes long."
19029                 ;;
19030         esac
19031 else
19032         uidsize=4
19033         echo "(I can't compile the test program--guessing $uidsize.)" >&4
19034 fi
19035
19036 echo " "
19037 case "$uidtype" in
19038 *_t) zzz="$uidtype"     ;;
19039 *)   zzz="uid"          ;;
19040 esac
19041 echo "Checking the sign of $zzz..." >&4
19042 cat > try.c <<EOCP
19043 #include <sys/types.h>
19044 #include <stdio.h>
19045 int main() {
19046         $uidtype foo = -1;
19047         if (foo < 0)
19048                 printf("-1\n");
19049         else
19050                 printf("1\n");
19051 }
19052 EOCP
19053 set try
19054 if eval $compile; then
19055         yyy=`$run ./try`
19056         case "$yyy" in
19057         '')     uidsign=1
19058                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19059                 ;;
19060         *)      uidsign=$yyy
19061                 case "$uidsign" in
19062                  1) echo "Your $zzz is unsigned." ;;
19063                 -1) echo "Your $zzz is signed."   ;;
19064                 esac
19065                 ;;
19066         esac
19067 else
19068         uidsign=1
19069         echo "(I can't compile the test program--guessing unsigned.)" >&4
19070 fi
19071
19072
19073
19074 echo " "
19075 $echo "Checking the format string to be used for uids..." >&4
19076
19077 case "$uidsign" in
19078 -1)     if $test X"$uidsize" = X"$ivsize"; then
19079                 uidformat="$ivdformat"
19080         else
19081                 if $test X"$uidsize" = X"$longsize"; then
19082                         uidformat='"ld"'
19083                 else
19084                         if $test X"$uidsize" = X"$intsize"; then
19085                                 uidformat='"d"'
19086                         else
19087                                 if $test X"$uidsize" = X"$shortsize"; then
19088                                         uidformat='"hd"'
19089                                 fi
19090                         fi
19091                 fi
19092         fi
19093         ;;
19094 *)      if $test X"$uidsize" = X"$uvsize"; then
19095                 uidformat="$uvuformat"
19096         else
19097                 if $test X"$uidsize" = X"$longsize"; then
19098                         uidformat='"lu"'
19099                 else
19100                         if $test X"$uidsize" = X"$intsize"; then
19101                                 uidformat='"u"'
19102                         else
19103                                 if $test X"$uidsize" = X"$shortsize"; then
19104                                         uidformat='"hu"'
19105                                 fi
19106                         fi
19107                 fi
19108         fi
19109         ;;
19110 esac
19111
19112 : determine compiler compiler
19113 case "$yacc" in
19114 '')
19115         dflt=yacc;;
19116 *)
19117         dflt="$yacc";;
19118 esac
19119 echo " "
19120 comp='yacc'
19121 if $test -f "$byacc$_exe"; then
19122         dflt="$byacc"
19123         comp="byacc or $comp"
19124 fi
19125 if $test -f "$bison$_exe"; then
19126         comp="$comp or bison -y"
19127 fi
19128 rp="Which compiler compiler ($comp) shall I use?"
19129 . ./myread
19130 yacc="$ans"
19131 case "$yacc" in
19132 *bis*)
19133         case "$yacc" in
19134         *-y*) ;;
19135         *)
19136                 yacc="$yacc -y"
19137                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
19138                 ;;
19139         esac
19140         ;;
19141 esac
19142
19143 : see if this is a fp.h system
19144 set fp.h i_fp
19145 eval $inhdr
19146
19147 : see if this is a fp_class.h system
19148 set fp_class.h i_fp_class
19149 eval $inhdr
19150
19151 : see if this is a ieeefp.h system
19152 case "$i_ieeefp" in
19153 '' ) set ieeefp.h i_ieeefp
19154      eval $inhdr
19155      ;;
19156 esac
19157
19158 : see if this is a libutil.h system
19159 set libutil.h i_libutil
19160 eval $inhdr
19161
19162 : see if mach cthreads are available
19163 if test "X$usethreads" = "X$define"; then
19164         set mach/cthreads.h i_machcthr
19165         eval $inhdr
19166 else
19167         i_machcthr="$undef"
19168 fi
19169
19170
19171
19172 : see if this is a math.h system
19173 set math.h i_math
19174 eval $inhdr
19175
19176 : see if this is a mntent.h system
19177 set mntent.h i_mntent
19178 eval $inhdr
19179
19180 : see if ndbm.h is available
19181 set ndbm.h t_ndbm
19182 eval $inhdr
19183
19184 case "$t_ndbm" in
19185 $undef)
19186     # Some Linux distributions such as RedHat 7.1 put the
19187     # ndbm.h header in /usr/include/gdbm/ndbm.h.
19188     if $test -f /usr/include/gdbm/ndbm.h; then
19189         echo '<gdbm/ndbm.h> found.'
19190         ccflags="$ccflags -I/usr/include/gdbm"
19191         cppflags="$cppflags -I/usr/include/gdbm"
19192         t_ndbm=$define
19193     fi
19194     ;;
19195 esac
19196
19197 case "$t_ndbm" in
19198 $define)
19199         : see if dbm_open exists
19200         set dbm_open d_dbm_open
19201         eval $inlibc
19202         case "$d_dbm_open" in
19203         $undef)
19204                 t_ndbm="$undef"
19205                 echo "We won't be including <ndbm.h>"
19206                 ;;
19207         esac
19208         ;;
19209 esac
19210 val="$t_ndbm"
19211 set i_ndbm
19212 eval $setvar
19213
19214 : see if net/errno.h is available
19215 val=''
19216 set net/errno.h val
19217 eval $inhdr
19218
19219 : Unfortunately, it causes problems on some systems.  Arrgh.
19220 case "$val" in
19221 $define)
19222         cat > try.c <<'EOM'
19223 #include <stdio.h>
19224 #include <errno.h>
19225 #include <net/errno.h>
19226 int func()
19227 {
19228         return ENOTSOCK;
19229 }
19230 EOM
19231         if $cc $ccflags -c try.c >/dev/null 2>&1; then
19232                 echo "We'll be including <net/errno.h>." >&4
19233         else
19234                 echo "We won't be including <net/errno.h>." >&4
19235                 val="$undef"
19236         fi
19237         $rm -f try.* try
19238         ;;
19239 esac
19240 set i_neterrno
19241 eval $setvar
19242
19243 : see if netinet/tcp.h is available
19244 set netinet/tcp.h i_netinettcp
19245 eval $inhdr
19246
19247 : see if this is a poll.h system
19248 set poll.h i_poll
19249 eval $inhdr
19250
19251 : see if this is a prot.h system
19252 set prot.h i_prot
19253 eval $inhdr
19254
19255 echo " "
19256 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
19257 $cat <<'EOSH' > Cppsym.know
19258 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
19259 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
19260 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
19261 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
19262 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
19263 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
19264 bull c cadmus clipper CMU COFF COMPILER_VERSION
19265 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
19266 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
19267 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
19268 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
19269 GLIBC GLIBC_MINOR
19270 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
19271 H3050R H3050RX hbullx20 hcx host_mips
19272 hp200 hp300 hp700 HP700 hp800 hp9000
19273 hp9000s200 hp9000s300 hp9000s400 hp9000s500
19274 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
19275 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
19276 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
19277 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
19278 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
19279 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
19280 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
19281 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
19282 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
19283 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
19284 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
19285 MATH_HAS_NO_SIDE_EFFECTS
19286 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
19287 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
19288 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
19289 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
19290 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
19291 NetBSD news1500 news1700 news1800 news1900 news3700
19292 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
19293 ns32016 ns32332 ns32k nsc32000
19294 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
19295 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
19296 pc532 pdp11 PGC PIC plexus PORTAR posix
19297 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
19298 POSIX_C_SOURCE POSIX_SOURCE POWER
19299 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
19300 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
19301 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
19302 sony sony_news sonyrisc sparc sparclite spectrum
19303 stardent stdc STDC_EXT stratos sun sun3 sun386
19304 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
19305 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
19306 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
19307 sysV68 sysV88 Tek4132 Tek4300 titan
19308 TM3200 TM5400 TM5600
19309 tower tower32 tower32_200 tower32_600 tower32_700
19310 tower32_800 tower32_850 tss
19311 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
19312 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
19313 unix UNIX95 UNIX99 unixpc unos
19314 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
19315 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
19316 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
19317 USGr4 USGr4_2
19318 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
19319 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
19320 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
19321 z8000
19322 EOSH
19323 # Maybe put other stuff here too.
19324 cat <<EOSH >>Cppsym.know
19325 $osname
19326 EOSH
19327 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
19328 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
19329 $cat Cppsym.know > Cppsym.c
19330 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
19331 $rm -f Cppsym.a Cppsym.b Cppsym.c
19332 cat <<EOSH > Cppsym
19333 $startsh
19334 if $test \$# -gt 0; then
19335     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
19336     if $test -s Cppsym.got; then
19337         $rm -f Cppsym.got
19338         exit 0
19339     fi
19340     $rm -f Cppsym.got
19341     exit 1
19342 else
19343     $tr " " "$trnl" | ./Cppsym.try
19344     exit 0
19345 fi
19346 EOSH
19347 chmod +x Cppsym
19348 $eunicefix Cppsym
19349 cat <<EOSH > Cppsym.try
19350 $startsh
19351 cat <<'EOCP' > try.c
19352 #include <stdio.h>
19353 int main() {
19354 EOCP
19355 $awk \\
19356 EOSH
19357 cat <<'EOSH' >> Cppsym.try
19358 'length($1) > 0 {
19359     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
19360     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
19361     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
19362     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
19363 }'       >> try.c
19364 echo 'return 0;}' >> try.c
19365 EOSH
19366 cat <<EOSH >> Cppsym.try
19367 ccflags="$ccflags"
19368 case "$osname-$gccversion" in
19369 irix-) ccflags="\$ccflags -woff 1178" ;;
19370 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
19371 esac
19372 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
19373 EOSH
19374 chmod +x Cppsym.try
19375 $eunicefix Cppsym.try
19376 ./Cppsym < Cppsym.know > Cppsym.true
19377 : now check the C compiler for additional symbols
19378 postprocess_cc_v=''
19379 case "$osname" in
19380 aix) postprocess_cc_v="|$tr , ' '" ;;
19381 esac
19382 $cat >ccsym <<EOS
19383 $startsh
19384 $cat >tmp.c <<EOF
19385 extern int foo;
19386 EOF
19387 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
19388 do
19389         case "\$i" in
19390         -D*) echo "\$i" | $sed 's/^-D//';;
19391         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
19392         esac
19393 done
19394 $rm -f try.c
19395 EOS
19396 postprocess_cc_v=''
19397 chmod +x ccsym
19398 $eunicefix ccsym
19399 ./ccsym > ccsym1.raw
19400 if $test -s ccsym1.raw; then
19401        $sort ccsym1.raw | $uniq >ccsym.raw
19402 else
19403        mv ccsym1.raw ccsym.raw
19404 fi
19405
19406 $awk '/\=/ { print $0; next }
19407         { print $0"=1" }' ccsym.raw >ccsym.list
19408 $awk '/\=/ { print $0; next }
19409         { print $0"=1" }' Cppsym.true >ccsym.true
19410 $comm -13 ccsym.true ccsym.list >ccsym.own
19411 $comm -12 ccsym.true ccsym.list >ccsym.com
19412 $comm -23 ccsym.true ccsym.list >ccsym.cpp
19413 also=''
19414 if $test -z ccsym.raw; then
19415         echo "Your C compiler doesn't seem to define any symbols!" >&4
19416         echo " "
19417         echo "However, your C preprocessor defines the following symbols:"
19418         $cat Cppsym.true
19419         ccsymbols=''
19420         cppsymbols=`$cat Cppsym.true`
19421         cppsymbols=`echo $cppsymbols`
19422         cppccsymbols="$cppsymbols"
19423 else
19424         if $test -s ccsym.com; then
19425                 echo "Your C compiler and pre-processor define these symbols:"
19426                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
19427                 also='also '
19428                 symbols='ones'
19429                 cppccsymbols=`$cat ccsym.com`
19430                 cppccsymbols=`echo $cppccsymbols`
19431                 $test "$silent" || sleep 1
19432         fi
19433         if $test -s ccsym.cpp; then
19434                 $test "$also" && echo " "
19435                 echo "Your C pre-processor ${also}defines the following symbols:"
19436                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
19437                 also='further '
19438                 cppsymbols=`$cat ccsym.cpp`
19439                 cppsymbols=`echo $cppsymbols`
19440                 $test "$silent" || sleep 1
19441         fi
19442         if $test -s ccsym.own; then
19443                 $test "$also" && echo " "
19444                 echo "Your C compiler ${also}defines the following cpp symbols:"
19445                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
19446                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
19447                 ccsymbols=`$cat ccsym.own`
19448                 ccsymbols=`echo $ccsymbols`
19449                 $test "$silent" || sleep 1
19450         fi
19451 fi
19452
19453 : see if this is a termio system
19454 val="$undef"
19455 val2="$undef"
19456 val3="$undef"
19457 if $test `./findhdr termios.h`; then
19458         set tcsetattr i_termios
19459         eval $inlibc
19460         val3="$i_termios"
19461 fi
19462 echo " "
19463 case "$val3" in
19464 "$define") echo "You have POSIX termios.h... good!" >&4;;
19465 *) if ./Cppsym pyr; then
19466                 case "`/bin/universe`" in
19467                 ucb) if $test `./findhdr sgtty.h`; then
19468                                 val2="$define"
19469                                 echo "<sgtty.h> found." >&4
19470                         else
19471                                 echo "System is pyramid with BSD universe."
19472                                 echo "<sgtty.h> not found--you could have problems." >&4
19473                         fi;;
19474                 *) if $test `./findhdr termio.h`; then
19475                                 val="$define"
19476                                 echo "<termio.h> found." >&4
19477                         else
19478                                 echo "System is pyramid with USG universe."
19479                                 echo "<termio.h> not found--you could have problems." >&4
19480                         fi;;
19481                 esac
19482         elif ./usg; then
19483                 if $test `./findhdr termio.h`; then
19484                         echo "<termio.h> found." >&4
19485                         val="$define"
19486                 elif $test `./findhdr sgtty.h`; then
19487                         echo "<sgtty.h> found." >&4
19488                         val2="$define"
19489                 else
19490 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
19491                 fi
19492         else
19493                 if $test `./findhdr sgtty.h`; then
19494                         echo "<sgtty.h> found." >&4
19495                         val2="$define"
19496                 elif $test `./findhdr termio.h`; then
19497                         echo "<termio.h> found." >&4
19498                         val="$define"
19499                 else
19500 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
19501                 fi
19502         fi;;
19503 esac
19504 set i_termio; eval $setvar
19505 val=$val2; set i_sgtty; eval $setvar
19506 val=$val3; set i_termios; eval $setvar
19507
19508 : see if stddef is available
19509 set stddef.h i_stddef
19510 eval $inhdr
19511
19512 : see if this is a sunmath.h system
19513 set sunmath.h i_sunmath
19514 eval $inhdr
19515
19516 : see if sys/access.h is available
19517 set sys/access.h i_sysaccess
19518 eval $inhdr
19519
19520 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
19521 set sys/filio.h i_sysfilio
19522 eval $inhdr
19523 echo " "
19524 if $test `./findhdr sys/ioctl.h`; then
19525         val="$define"
19526         echo '<sys/ioctl.h> found.' >&4
19527 else
19528         val="$undef"
19529         if $test $i_sysfilio = "$define"; then
19530             echo '<sys/ioctl.h> NOT found.' >&4
19531         else
19532                 $test $i_sgtty = "$define" && xxx="sgtty.h"
19533                 $test $i_termio = "$define" && xxx="termio.h"
19534                 $test $i_termios = "$define" && xxx="termios.h"
19535 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
19536         fi
19537 fi
19538 set i_sysioctl
19539 eval $setvar
19540
19541 : see if socket ioctl defs are in sys/sockio.h
19542 echo " "
19543 xxx=`./findhdr sys/sockio.h`
19544 if $test "$xxx"; then
19545         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
19546                 val="$define"
19547                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
19548         else
19549                 val="$undef"
19550                 echo "No socket ioctls found in <sys/sockio.h>." >&4
19551         fi
19552 else
19553         val="$undef"
19554         $cat <<EOM
19555 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
19556 EOM
19557 fi
19558 set i_syssockio
19559 eval $setvar
19560
19561
19562 : see if this is a syslog.h system
19563 set syslog.h i_syslog
19564 eval $inhdr
19565
19566
19567 : see if this is a sys/mode.h system
19568 set sys/mode.h i_sysmode
19569 eval $inhdr
19570
19571 : see if sys/resource.h has to be included
19572 set sys/resource.h i_sysresrc
19573 eval $inhdr
19574
19575 : see if sys/security.h is available
19576 set sys/security.h i_syssecrt
19577 eval $inhdr
19578
19579 : see if this is a sys/statvfs.h system
19580 set sys/statvfs.h i_sysstatvfs
19581 eval $inhdr
19582
19583 : see if this is a sys/un.h system
19584 set sys/un.h i_sysun
19585 eval $inhdr
19586
19587
19588 : see if this is a sys/utsname.h system
19589 set sys/utsname.h i_sysutsname
19590 eval $inhdr
19591
19592 : see if this is a syswait system
19593 set sys/wait.h i_syswait
19594 eval $inhdr
19595
19596 : see if this is a ustat.h system
19597 set ustat.h i_ustat
19598 eval $inhdr
19599
19600 : see if this is an utime system
19601 set utime.h i_utime
19602 eval $inhdr
19603
19604 : see if this is a values.h system
19605 set values.h i_values
19606 eval $inhdr
19607
19608 : see if this is a vfork system
19609 case "$d_vfork" in
19610 "$define")
19611         set vfork.h i_vfork
19612         eval $inhdr
19613         ;;
19614 *)
19615         i_vfork="$undef"
19616         ;;
19617 esac
19618
19619 : see if gdbm.h is available
19620 set gdbm.h t_gdbm
19621 eval $inhdr
19622 case "$t_gdbm" in
19623 $define)
19624         : see if gdbm_open exists
19625         set gdbm_open d_gdbm_open
19626         eval $inlibc
19627         case "$d_gdbm_open" in
19628         $undef)
19629                 t_gdbm="$undef"
19630                 echo "We won't be including <gdbm.h>"
19631                 ;;
19632         esac
19633         ;;
19634 esac
19635 val="$t_gdbm"
19636 set i_gdbm
19637 eval $setvar
19638
19639 echo " "
19640 echo "Looking for extensions..." >&4
19641 : If we are using the old config.sh, known_extensions may contain
19642 : old or inaccurate or duplicate values.
19643 known_extensions=''
19644 nonxs_extensions=''
19645 : We do not use find because it might not be available.
19646 : We do not just use MANIFEST because the user may have dropped
19647 : some additional extensions into the source tree and expect them
19648 : to be built.
19649
19650 : Function to recursively find available extensions, ignoring DynaLoader
19651 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
19652 find_extensions='
19653     for xxx in *; do
19654        case "$xxx" in
19655            DynaLoader|dynaload) ;;
19656            *)
19657            if $test -f $xxx/$xxx.xs; then
19658                known_extensions="$known_extensions $1$xxx";
19659            elif $test -f $xxx/Makefile.PL; then
19660                nonxs_extensions="$nonxs_extensions $1$xxx";
19661            else
19662                if $test -d $xxx -a $# -lt 10; then
19663                    set $1$xxx/ $*;
19664                    cd "$xxx";
19665                    eval $find_extensions;
19666                    cd ..;
19667                    shift;
19668                fi;
19669            fi
19670            ;;
19671        esac;
19672     done'
19673 tdir=`pwd`
19674 cd "$rsrc/ext"
19675 set X
19676 shift
19677 eval $find_extensions
19678 # Special case:  Add in threads/shared since it is not picked up by the
19679 # recursive find above (and adding in general recursive finding breaks
19680 # SDBM_File/sdbm).  A.D.  10/25/2001.
19681 known_extensions="$known_extensions threads/shared"
19682 set X $nonxs_extensions
19683 shift
19684 nonxs_extensions="$*"
19685 set X $known_extensions
19686 shift
19687 known_extensions="$*"
19688 cd "$tdir"
19689
19690 : Now see which are supported on this system.
19691 avail_ext=''
19692 for xxx in $known_extensions ; do
19693         case "$xxx" in
19694         DB_File|db_file)
19695                 case "$i_db" in
19696                 $define) avail_ext="$avail_ext $xxx" ;;
19697                 esac
19698                 ;;
19699         GDBM_File|gdbm_fil)
19700                 case "$i_gdbm" in 
19701                 $define) avail_ext="$avail_ext $xxx" ;;
19702                 esac
19703                 ;;
19704         I18N/Langinfo|i18n_lan)
19705                 case "$i_langinfo$d_nl_langinfo" in 
19706                 $define$define) avail_ext="$avail_ext $xxx" ;;
19707                 esac
19708                 ;;
19709         NDBM_File|ndbm_fil)
19710                 case "$i_ndbm" in
19711                 $define)
19712                     case "$osname-$use64bitint" in
19713                     hpux-define)
19714                         case "$libs" in
19715                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
19716                         esac
19717                         ;;
19718                     *) avail_ext="$avail_ext $xxx" ;;
19719                     esac
19720                     ;;
19721                 esac
19722                 ;;
19723         ODBM_File|odbm_fil) 
19724                 case "${i_dbm}${i_rpcsvcdbm}" in
19725                 *"${define}"*)
19726                     case "$osname-$use64bitint" in
19727                     hpux-define)
19728                         case "$libs" in
19729                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
19730                         esac
19731                         ;;
19732                     *) avail_ext="$avail_ext $xxx" ;;
19733                     esac
19734                     ;;
19735                 esac
19736                 ;;
19737         POSIX|posix)
19738                 case "$useposix" in
19739                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19740                 esac
19741                 ;;
19742         Opcode|opcode)
19743                 case "$useopcode" in
19744                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19745                 esac
19746                 ;;
19747         Socket|socket)
19748                 case "$d_socket" in 
19749                 true|$define|y)
19750                     case "$osname" in
19751                     beos) ;; # not unless BONE
19752                     *) avail_ext="$avail_ext $xxx" ;;
19753                     esac
19754                     ;;
19755                 esac
19756                 ;;
19757         Sys/Syslog|sys/syslog)
19758                 : XXX syslog requires socket
19759                 case "$d_socket" in 
19760                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
19761                 esac
19762                 ;;
19763         Thread|thread)
19764                 case "$usethreads" in
19765                 true|$define|y)
19766                         case "$useithreads" in
19767                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
19768                         esac
19769                 esac
19770                 ;;
19771         XS/APItest|xs/apitest)
19772                 # This is just for testing.  Skip it unless we have dynamic loading.
19773
19774                 case "$usedl" in
19775                 $define) avail_ext="$avail_ext $xxx" ;;
19776                 esac
19777                 ;;
19778         XS/Typemap|xs/typemap)
19779                 # This is just for testing.  Skip it unless we have dynamic loading.
19780                 case "$usedl" in
19781                 $define) avail_ext="$avail_ext $xxx" ;;
19782                 esac
19783                 ;;
19784         threads|threads/shared)
19785                 # threads and threads::shared are special cases.
19786                 # To stop people from asking "Perl 5.8.0 was supposed
19787                 # to have this new fancy threads implementation but my
19788                 # perl doesn't have it" and from people trying to
19789                 # (re)install the threads module using CPAN.pm and
19790                 # CPAN.pm then offering to reinstall Perl 5.8.0,
19791                 # the threads.pm and threads/shared.pm will always be
19792                 # there, croaking informatively ("you need to rebuild
19793                 # all of Perl with threads, sorry") when threads haven't
19794                 # been compiled in.
19795                 # --jhi
19796                 avail_ext="$avail_ext $xxx"
19797                 ;;
19798         IPC/SysV|ipc/sysv)
19799                 : XXX Do we need a useipcsysv variable here
19800                 case "${d_msg}${d_sem}${d_shm}" in 
19801                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
19802                 esac
19803                 ;;
19804         *)      avail_ext="$avail_ext $xxx"
19805                 ;;
19806         esac
19807 done
19808
19809 set X $avail_ext
19810 shift
19811 avail_ext="$*"
19812
19813 : Now see which nonxs extensions are supported on this system.
19814 : For now assume all are.
19815 nonxs_ext=''
19816 for xxx in $nonxs_extensions ; do
19817         case "$xxx" in
19818         *)      nonxs_ext="$nonxs_ext $xxx"
19819                 ;;
19820         esac
19821 done
19822
19823 set X $nonxs_ext
19824 shift
19825 nonxs_ext="$*"
19826
19827 case $usedl in
19828 $define)
19829         $cat <<EOM
19830 A number of extensions are supplied with $package.  You may choose to
19831 compile these extensions for dynamic loading (the default), compile
19832 them into the $package executable (static loading), or not include
19833 them at all.  Answer "none" to include no extensions.
19834 Note that DynaLoader is always built and need not be mentioned here.
19835
19836 EOM
19837         case "$dynamic_ext" in
19838         '')
19839                 : Exclude those listed in static_ext
19840                 dflt=''
19841                 for xxx in $avail_ext; do
19842                         case " $static_ext " in
19843                         *" $xxx "*) ;;
19844                         *) dflt="$dflt $xxx" ;;
19845                         esac
19846                 done
19847                 set X $dflt
19848                 shift
19849                 dflt="$*"
19850                 ;;
19851         *)      dflt="$dynamic_ext"
19852                 # Perhaps we are reusing an old out-of-date config.sh.
19853                 case "$hint" in
19854                 previous)
19855                         if test X"$dynamic_ext" != X"$avail_ext"; then
19856                                 $cat <<EOM
19857 NOTICE:  Your previous config.sh list may be incorrect. 
19858 The extensions now available to you are 
19859         ${avail_ext}
19860 but the default list from your previous config.sh is
19861         ${dynamic_ext} 
19862
19863 EOM
19864                         fi
19865                         ;;
19866                 esac
19867                 ;;
19868         esac
19869         case "$dflt" in
19870         '')     dflt=none;;
19871         esac
19872         rp="What extensions do you wish to load dynamically?"
19873         . ./myread
19874         case "$ans" in
19875         none) dynamic_ext=' ' ;;
19876         *) dynamic_ext="$ans" ;;
19877         esac
19878
19879         case "$static_ext" in
19880         '')
19881                 : Exclude those already listed in dynamic linking
19882                 dflt=''
19883                 for xxx in $avail_ext; do
19884                         case " $dynamic_ext " in
19885                         *" $xxx "*) ;;
19886                         *) dflt="$dflt $xxx" ;;
19887                         esac
19888                 done
19889                 set X $dflt
19890                 shift
19891                 dflt="$*"
19892                 ;;
19893         *)  dflt="$static_ext" 
19894                 ;;
19895         esac
19896
19897         case "$dflt" in
19898         '')     dflt=none;;
19899         esac
19900         rp="What extensions do you wish to load statically?"
19901         . ./myread
19902         case "$ans" in
19903         none) static_ext=' ' ;;
19904         *) static_ext="$ans" ;;
19905         esac
19906         ;;
19907 *)
19908         $cat <<EOM
19909 A number of extensions are supplied with $package.  Answer "none" 
19910 to include no extensions. 
19911 Note that DynaLoader is always built and need not be mentioned here.
19912
19913 EOM
19914         case "$static_ext" in
19915         '') dflt="$avail_ext" ;;
19916         *)      dflt="$static_ext"
19917                 # Perhaps we are reusing an old out-of-date config.sh.
19918                 case "$hint" in
19919                 previous)
19920                         if test X"$static_ext" != X"$avail_ext"; then
19921                                 $cat <<EOM
19922 NOTICE:  Your previous config.sh list may be incorrect. 
19923 The extensions now available to you are 
19924         ${avail_ext}
19925 but the default list from your previous config.sh is
19926         ${static_ext} 
19927
19928 EOM
19929                         fi
19930                         ;;
19931                 esac
19932                 ;;
19933         esac
19934         : Exclude those that are not xs extensions
19935         case "$dflt" in
19936         '')     dflt=none;;
19937         esac
19938         rp="What extensions do you wish to include?"
19939         . ./myread
19940         case "$ans" in
19941         none) static_ext=' ' ;;
19942         *) static_ext="$ans" ;;
19943         esac
19944         ;;
19945 esac
19946 #        
19947 # Encode is a special case.  If we are building Encode as a static
19948 # extension, we need to explicitly list its subextensions as well.
19949 # For other nested extensions, this is handled automatically by
19950 # the appropriate Makefile.PL.
19951 case " $static_ext " in
19952         *" Encode "*) # Add the subextensions of Encode
19953         cd "$rsrc/ext"
19954         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
19955                 static_ext="$static_ext Encode/$xxx"
19956         done
19957         cd "$tdir"
19958         ;;
19959 esac
19960
19961 set X $dynamic_ext $static_ext $nonxs_ext
19962 shift
19963 extensions="$*"
19964
19965 : Remove libraries needed only for extensions
19966 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
19967 : The exception is SunOS 4.x, which needs them.
19968 case "${osname}X${osvers}" in
19969 sunos*X4*)
19970     perllibs="$libs"
19971     ;;
19972 *) case "$usedl" in
19973     $define|true|[yY]*)
19974             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
19975             shift
19976             perllibs="$*"
19977             ;;
19978     *)  perllibs="$libs"
19979             ;;
19980     esac
19981     ;;
19982 esac
19983
19984 : Remove build directory name from cppstdin so it can be used from
19985 : either the present location or the final installed location.
19986 echo " "
19987 : Get out of the UU directory to get correct path name.
19988 cd ..
19989 case "$cppstdin" in
19990 `pwd`/cppstdin)
19991         echo "Stripping down cppstdin path name"
19992         cppstdin=cppstdin
19993         ;;
19994 esac
19995 cd UU
19996
19997 : end of configuration questions
19998 echo " "
19999 echo "End of configuration questions."
20000 echo " "
20001
20002 : back to where it started
20003 if test -d ../UU; then
20004         cd ..
20005 fi
20006
20007 : configuration may be patched via a 'config.arch' file
20008 if $test -f config.arch; then
20009         echo "I see a config.arch file, loading it."
20010         . ./config.arch
20011 fi
20012
20013 : configuration may be patched via a 'config.over' file
20014 if $test -f config.over; then
20015         echo " "
20016         dflt=y
20017         rp='I see a config.over file.  Do you wish to load it?'
20018         . UU/myread
20019         case "$ans" in
20020         n*) echo "OK, I'll ignore it.";;
20021         *)      . ./config.over
20022                 echo "Configuration override changes have been loaded."
20023                 ;;
20024         esac
20025 fi
20026
20027 : in case they want portability, strip down executable paths
20028 case "$d_portable" in
20029 "$define")
20030         echo " "
20031         echo "Stripping down executable paths..." >&4
20032         for file in $loclist $trylist; do
20033                 eval temp=\$$file
20034                 eval $file=`basename $temp`
20035         done
20036         ;;
20037 esac
20038
20039 : create config.sh file
20040 echo " "
20041 echo "Creating config.sh..." >&4
20042 $spitshell <<EOT >config.sh
20043 $startsh
20044 #
20045 # This file was produced by running the Configure script. It holds all the
20046 # definitions figured out by Configure. Should you modify one of these values,
20047 # do not forget to propagate your changes by running "Configure -der". You may
20048 # instead choose to run each of the .SH files by yourself, or "Configure -S".
20049 #
20050
20051 # Package name      : $package
20052 # Source directory  : $src
20053 # Configuration time: $cf_time
20054 # Configured by     : $cf_by
20055 # Target system     : $myuname
20056
20057 Author='$Author'
20058 Date='$Date'
20059 Header='$Header'
20060 Id='$Id'
20061 Locker='$Locker'
20062 Log='$Log'
20063 Mcc='$Mcc'
20064 RCSfile='$RCSfile'
20065 Revision='$Revision'
20066 Source='$Source'
20067 State='$State'
20068 _a='$_a'
20069 _exe='$_exe'
20070 _o='$_o'
20071 afs='$afs'
20072 afsroot='$afsroot'
20073 alignbytes='$alignbytes'
20074 ansi2knr='$ansi2knr'
20075 aphostname='$aphostname'
20076 api_revision='$api_revision'
20077 api_subversion='$api_subversion'
20078 api_version='$api_version'
20079 api_versionstring='$api_versionstring'
20080 ar='$ar'
20081 archlib='$archlib'
20082 archlibexp='$archlibexp'
20083 archname64='$archname64'
20084 archname='$archname'
20085 archobjs='$archobjs'
20086 asctime_r_proto='$asctime_r_proto'
20087 awk='$awk'
20088 baserev='$baserev'
20089 bash='$bash'
20090 bin='$bin'
20091 binexp='$binexp'
20092 bison='$bison'
20093 byacc='$byacc'
20094 byteorder='$byteorder'
20095 c='$c'
20096 castflags='$castflags'
20097 cat='$cat'
20098 cc='$cc'
20099 cccdlflags='$cccdlflags'
20100 ccdlflags='$ccdlflags'
20101 ccflags='$ccflags'
20102 ccflags_uselargefiles='$ccflags_uselargefiles'
20103 ccname='$ccname'
20104 ccsymbols='$ccsymbols'
20105 ccversion='$ccversion'
20106 cf_by='$cf_by'
20107 cf_email='$cf_email'
20108 cf_time='$cf_time'
20109 charsize='$charsize'
20110 chgrp='$chgrp'
20111 chmod='$chmod'
20112 chown='$chown'
20113 clocktype='$clocktype'
20114 comm='$comm'
20115 compress='$compress'
20116 contains='$contains'
20117 cp='$cp'
20118 cpio='$cpio'
20119 cpp='$cpp'
20120 cpp_stuff='$cpp_stuff'
20121 cppccsymbols='$cppccsymbols'
20122 cppflags='$cppflags'
20123 cpplast='$cpplast'
20124 cppminus='$cppminus'
20125 cpprun='$cpprun'
20126 cppstdin='$cppstdin'
20127 cppsymbols='$cppsymbols'
20128 crypt_r_proto='$crypt_r_proto'
20129 cryptlib='$cryptlib'
20130 csh='$csh'
20131 ctermid_r_proto='$ctermid_r_proto'
20132 ctime_r_proto='$ctime_r_proto'
20133 d_Gconvert='$d_Gconvert'
20134 d_PRIEUldbl='$d_PRIEUldbl'
20135 d_PRIFUldbl='$d_PRIFUldbl'
20136 d_PRIGUldbl='$d_PRIGUldbl'
20137 d_PRIXU64='$d_PRIXU64'
20138 d_PRId64='$d_PRId64'
20139 d_PRIeldbl='$d_PRIeldbl'
20140 d_PRIfldbl='$d_PRIfldbl'
20141 d_PRIgldbl='$d_PRIgldbl'
20142 d_PRIi64='$d_PRIi64'
20143 d_PRIo64='$d_PRIo64'
20144 d_PRIu64='$d_PRIu64'
20145 d_PRIx64='$d_PRIx64'
20146 d_SCNfldbl='$d_SCNfldbl'
20147 d__fwalk='$d__fwalk'
20148 d_access='$d_access'
20149 d_accessx='$d_accessx'
20150 d_alarm='$d_alarm'
20151 d_archlib='$d_archlib'
20152 d_asctime_r='$d_asctime_r'
20153 d_atolf='$d_atolf'
20154 d_atoll='$d_atoll'
20155 d_attribut='$d_attribut'
20156 d_bcmp='$d_bcmp'
20157 d_bcopy='$d_bcopy'
20158 d_bsd='$d_bsd'
20159 d_bsdgetpgrp='$d_bsdgetpgrp'
20160 d_bsdsetpgrp='$d_bsdsetpgrp'
20161 d_bzero='$d_bzero'
20162 d_casti32='$d_casti32'
20163 d_castneg='$d_castneg'
20164 d_charvspr='$d_charvspr'
20165 d_chown='$d_chown'
20166 d_chroot='$d_chroot'
20167 d_chsize='$d_chsize'
20168 d_class='$d_class'
20169 d_closedir='$d_closedir'
20170 d_cmsghdr_s='$d_cmsghdr_s'
20171 d_const='$d_const'
20172 d_crypt='$d_crypt'
20173 d_crypt_r='$d_crypt_r'
20174 d_csh='$d_csh'
20175 d_ctermid_r='$d_ctermid_r'
20176 d_ctime_r='$d_ctime_r'
20177 d_cuserid='$d_cuserid'
20178 d_dbl_dig='$d_dbl_dig'
20179 d_dbminitproto='$d_dbminitproto'
20180 d_difftime='$d_difftime'
20181 d_dirfd='$d_dirfd'
20182 d_dirnamlen='$d_dirnamlen'
20183 d_dlerror='$d_dlerror'
20184 d_dlopen='$d_dlopen'
20185 d_dlsymun='$d_dlsymun'
20186 d_dosuid='$d_dosuid'
20187 d_drand48_r='$d_drand48_r'
20188 d_drand48proto='$d_drand48proto'
20189 d_dup2='$d_dup2'
20190 d_eaccess='$d_eaccess'
20191 d_endgrent='$d_endgrent'
20192 d_endgrent_r='$d_endgrent_r'
20193 d_endhent='$d_endhent'
20194 d_endhostent_r='$d_endhostent_r'
20195 d_endnent='$d_endnent'
20196 d_endnetent_r='$d_endnetent_r'
20197 d_endpent='$d_endpent'
20198 d_endprotoent_r='$d_endprotoent_r'
20199 d_endpwent='$d_endpwent'
20200 d_endpwent_r='$d_endpwent_r'
20201 d_endsent='$d_endsent'
20202 d_endservent_r='$d_endservent_r'
20203 d_eofnblk='$d_eofnblk'
20204 d_eunice='$d_eunice'
20205 d_fchdir='$d_fchdir'
20206 d_fchmod='$d_fchmod'
20207 d_fchown='$d_fchown'
20208 d_fcntl='$d_fcntl'
20209 d_fcntl_can_lock='$d_fcntl_can_lock'
20210 d_fd_macros='$d_fd_macros'
20211 d_fd_set='$d_fd_set'
20212 d_fds_bits='$d_fds_bits'
20213 d_fgetpos='$d_fgetpos'
20214 d_finite='$d_finite'
20215 d_finitel='$d_finitel'
20216 d_flexfnam='$d_flexfnam'
20217 d_flock='$d_flock'
20218 d_flockproto='$d_flockproto'
20219 d_fork='$d_fork'
20220 d_fp_class='$d_fp_class'
20221 d_fpathconf='$d_fpathconf'
20222 d_fpclass='$d_fpclass'
20223 d_fpclassify='$d_fpclassify'
20224 d_fpclassl='$d_fpclassl'
20225 d_fpos64_t='$d_fpos64_t'
20226 d_frexpl='$d_frexpl'
20227 d_fs_data_s='$d_fs_data_s'
20228 d_fseeko='$d_fseeko'
20229 d_fsetpos='$d_fsetpos'
20230 d_fstatfs='$d_fstatfs'
20231 d_fstatvfs='$d_fstatvfs'
20232 d_fsync='$d_fsync'
20233 d_ftello='$d_ftello'
20234 d_ftime='$d_ftime'
20235 d_getcwd='$d_getcwd'
20236 d_getespwnam='$d_getespwnam'
20237 d_getfsstat='$d_getfsstat'
20238 d_getgrent='$d_getgrent'
20239 d_getgrent_r='$d_getgrent_r'
20240 d_getgrgid_r='$d_getgrgid_r'
20241 d_getgrnam_r='$d_getgrnam_r'
20242 d_getgrps='$d_getgrps'
20243 d_gethbyaddr='$d_gethbyaddr'
20244 d_gethbyname='$d_gethbyname'
20245 d_gethent='$d_gethent'
20246 d_gethname='$d_gethname'
20247 d_gethostbyaddr_r='$d_gethostbyaddr_r'
20248 d_gethostbyname_r='$d_gethostbyname_r'
20249 d_gethostent_r='$d_gethostent_r'
20250 d_gethostprotos='$d_gethostprotos'
20251 d_getitimer='$d_getitimer'
20252 d_getlogin='$d_getlogin'
20253 d_getlogin_r='$d_getlogin_r'
20254 d_getmnt='$d_getmnt'
20255 d_getmntent='$d_getmntent'
20256 d_getnbyaddr='$d_getnbyaddr'
20257 d_getnbyname='$d_getnbyname'
20258 d_getnent='$d_getnent'
20259 d_getnetbyaddr_r='$d_getnetbyaddr_r'
20260 d_getnetbyname_r='$d_getnetbyname_r'
20261 d_getnetent_r='$d_getnetent_r'
20262 d_getnetprotos='$d_getnetprotos'
20263 d_getpagsz='$d_getpagsz'
20264 d_getpbyname='$d_getpbyname'
20265 d_getpbynumber='$d_getpbynumber'
20266 d_getpent='$d_getpent'
20267 d_getpgid='$d_getpgid'
20268 d_getpgrp2='$d_getpgrp2'
20269 d_getpgrp='$d_getpgrp'
20270 d_getppid='$d_getppid'
20271 d_getprior='$d_getprior'
20272 d_getprotobyname_r='$d_getprotobyname_r'
20273 d_getprotobynumber_r='$d_getprotobynumber_r'
20274 d_getprotoent_r='$d_getprotoent_r'
20275 d_getprotoprotos='$d_getprotoprotos'
20276 d_getprpwnam='$d_getprpwnam'
20277 d_getpwent='$d_getpwent'
20278 d_getpwent_r='$d_getpwent_r'
20279 d_getpwnam_r='$d_getpwnam_r'
20280 d_getpwuid_r='$d_getpwuid_r'
20281 d_getsbyname='$d_getsbyname'
20282 d_getsbyport='$d_getsbyport'
20283 d_getsent='$d_getsent'
20284 d_getservbyname_r='$d_getservbyname_r'
20285 d_getservbyport_r='$d_getservbyport_r'
20286 d_getservent_r='$d_getservent_r'
20287 d_getservprotos='$d_getservprotos'
20288 d_getspnam='$d_getspnam'
20289 d_getspnam_r='$d_getspnam_r'
20290 d_gettimeod='$d_gettimeod'
20291 d_gmtime_r='$d_gmtime_r'
20292 d_gnulibc='$d_gnulibc'
20293 d_grpasswd='$d_grpasswd'
20294 d_hasmntopt='$d_hasmntopt'
20295 d_htonl='$d_htonl'
20296 d_index='$d_index'
20297 d_inetaton='$d_inetaton'
20298 d_int64_t='$d_int64_t'
20299 d_isascii='$d_isascii'
20300 d_isfinite='$d_isfinite'
20301 d_isinf='$d_isinf'
20302 d_isnan='$d_isnan'
20303 d_isnanl='$d_isnanl'
20304 d_killpg='$d_killpg'
20305 d_lchown='$d_lchown'
20306 d_ldbl_dig='$d_ldbl_dig'
20307 d_link='$d_link'
20308 d_localtime_r='$d_localtime_r'
20309 d_locconv='$d_locconv'
20310 d_lockf='$d_lockf'
20311 d_longdbl='$d_longdbl'
20312 d_longlong='$d_longlong'
20313 d_lseekproto='$d_lseekproto'
20314 d_lstat='$d_lstat'
20315 d_madvise='$d_madvise'
20316 d_mblen='$d_mblen'
20317 d_mbstowcs='$d_mbstowcs'
20318 d_mbtowc='$d_mbtowc'
20319 d_memchr='$d_memchr'
20320 d_memcmp='$d_memcmp'
20321 d_memcpy='$d_memcpy'
20322 d_memmove='$d_memmove'
20323 d_memset='$d_memset'
20324 d_mkdir='$d_mkdir'
20325 d_mkdtemp='$d_mkdtemp'
20326 d_mkfifo='$d_mkfifo'
20327 d_mkstemp='$d_mkstemp'
20328 d_mkstemps='$d_mkstemps'
20329 d_mktime='$d_mktime'
20330 d_mmap='$d_mmap'
20331 d_modfl='$d_modfl'
20332 d_modfl_pow32_bug='$d_modfl_pow32_bug'
20333 d_modflproto='$d_modflproto'
20334 d_mprotect='$d_mprotect'
20335 d_msg='$d_msg'
20336 d_msg_ctrunc='$d_msg_ctrunc'
20337 d_msg_dontroute='$d_msg_dontroute'
20338 d_msg_oob='$d_msg_oob'
20339 d_msg_peek='$d_msg_peek'
20340 d_msg_proxy='$d_msg_proxy'
20341 d_msgctl='$d_msgctl'
20342 d_msgget='$d_msgget'
20343 d_msghdr_s='$d_msghdr_s'
20344 d_msgrcv='$d_msgrcv'
20345 d_msgsnd='$d_msgsnd'
20346 d_msync='$d_msync'
20347 d_munmap='$d_munmap'
20348 d_mymalloc='$d_mymalloc'
20349 d_nanosleep='$d_nanosleep'
20350 d_nice='$d_nice'
20351 d_nl_langinfo='$d_nl_langinfo'
20352 d_nv_preserves_uv='$d_nv_preserves_uv'
20353 d_off64_t='$d_off64_t'
20354 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
20355 d_oldpthreads='$d_oldpthreads'
20356 d_oldsock='$d_oldsock'
20357 d_open3='$d_open3'
20358 d_pathconf='$d_pathconf'
20359 d_pause='$d_pause'
20360 d_perl_otherlibdirs='$d_perl_otherlibdirs'
20361 d_phostname='$d_phostname'
20362 d_pipe='$d_pipe'
20363 d_poll='$d_poll'
20364 d_portable='$d_portable'
20365 d_procselfexe='$d_procselfexe'
20366 d_pthread_atfork='$d_pthread_atfork'
20367 d_pthread_yield='$d_pthread_yield'
20368 d_pwage='$d_pwage'
20369 d_pwchange='$d_pwchange'
20370 d_pwclass='$d_pwclass'
20371 d_pwcomment='$d_pwcomment'
20372 d_pwexpire='$d_pwexpire'
20373 d_pwgecos='$d_pwgecos'
20374 d_pwpasswd='$d_pwpasswd'
20375 d_pwquota='$d_pwquota'
20376 d_qgcvt='$d_qgcvt'
20377 d_quad='$d_quad'
20378 d_random_r='$d_random_r'
20379 d_readdir64_r='$d_readdir64_r'
20380 d_readdir='$d_readdir'
20381 d_readdir_r='$d_readdir_r'
20382 d_readlink='$d_readlink'
20383 d_readv='$d_readv'
20384 d_recvmsg='$d_recvmsg'
20385 d_rename='$d_rename'
20386 d_rewinddir='$d_rewinddir'
20387 d_rmdir='$d_rmdir'
20388 d_safebcpy='$d_safebcpy'
20389 d_safemcpy='$d_safemcpy'
20390 d_sanemcmp='$d_sanemcmp'
20391 d_sbrkproto='$d_sbrkproto'
20392 d_sched_yield='$d_sched_yield'
20393 d_scm_rights='$d_scm_rights'
20394 d_seekdir='$d_seekdir'
20395 d_select='$d_select'
20396 d_sem='$d_sem'
20397 d_semctl='$d_semctl'
20398 d_semctl_semid_ds='$d_semctl_semid_ds'
20399 d_semctl_semun='$d_semctl_semun'
20400 d_semget='$d_semget'
20401 d_semop='$d_semop'
20402 d_sendmsg='$d_sendmsg'
20403 d_setegid='$d_setegid'
20404 d_seteuid='$d_seteuid'
20405 d_setgrent='$d_setgrent'
20406 d_setgrent_r='$d_setgrent_r'
20407 d_setgrps='$d_setgrps'
20408 d_sethent='$d_sethent'
20409 d_sethostent_r='$d_sethostent_r'
20410 d_setitimer='$d_setitimer'
20411 d_setlinebuf='$d_setlinebuf'
20412 d_setlocale='$d_setlocale'
20413 d_setlocale_r='$d_setlocale_r'
20414 d_setnent='$d_setnent'
20415 d_setnetent_r='$d_setnetent_r'
20416 d_setpent='$d_setpent'
20417 d_setpgid='$d_setpgid'
20418 d_setpgrp2='$d_setpgrp2'
20419 d_setpgrp='$d_setpgrp'
20420 d_setprior='$d_setprior'
20421 d_setproctitle='$d_setproctitle'
20422 d_setprotoent_r='$d_setprotoent_r'
20423 d_setpwent='$d_setpwent'
20424 d_setpwent_r='$d_setpwent_r'
20425 d_setregid='$d_setregid'
20426 d_setresgid='$d_setresgid'
20427 d_setresuid='$d_setresuid'
20428 d_setreuid='$d_setreuid'
20429 d_setrgid='$d_setrgid'
20430 d_setruid='$d_setruid'
20431 d_setsent='$d_setsent'
20432 d_setservent_r='$d_setservent_r'
20433 d_setsid='$d_setsid'
20434 d_setvbuf='$d_setvbuf'
20435 d_sfio='$d_sfio'
20436 d_shm='$d_shm'
20437 d_shmat='$d_shmat'
20438 d_shmatprototype='$d_shmatprototype'
20439 d_shmctl='$d_shmctl'
20440 d_shmdt='$d_shmdt'
20441 d_shmget='$d_shmget'
20442 d_sigaction='$d_sigaction'
20443 d_sigprocmask='$d_sigprocmask'
20444 d_sigsetjmp='$d_sigsetjmp'
20445 d_sockatmark='$d_sockatmark'
20446 d_sockatmarkproto='$d_sockatmarkproto'
20447 d_socket='$d_socket'
20448 d_socklen_t='$d_socklen_t'
20449 d_sockpair='$d_sockpair'
20450 d_socks5_init='$d_socks5_init'
20451 d_sqrtl='$d_sqrtl'
20452 d_srand48_r='$d_srand48_r'
20453 d_srandom_r='$d_srandom_r'
20454 d_sresgproto='$d_sresgproto'
20455 d_sresuproto='$d_sresuproto'
20456 d_statblks='$d_statblks'
20457 d_statfs_f_flags='$d_statfs_f_flags'
20458 d_statfs_s='$d_statfs_s'
20459 d_statvfs='$d_statvfs'
20460 d_stdio_cnt_lval='$d_stdio_cnt_lval'
20461 d_stdio_ptr_lval='$d_stdio_ptr_lval'
20462 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
20463 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
20464 d_stdio_stream_array='$d_stdio_stream_array'
20465 d_stdiobase='$d_stdiobase'
20466 d_stdstdio='$d_stdstdio'
20467 d_strchr='$d_strchr'
20468 d_strcoll='$d_strcoll'
20469 d_strctcpy='$d_strctcpy'
20470 d_strerrm='$d_strerrm'
20471 d_strerror='$d_strerror'
20472 d_strerror_r='$d_strerror_r'
20473 d_strftime='$d_strftime'
20474 d_strtod='$d_strtod'
20475 d_strtol='$d_strtol'
20476 d_strtold='$d_strtold'
20477 d_strtoll='$d_strtoll'
20478 d_strtoq='$d_strtoq'
20479 d_strtoul='$d_strtoul'
20480 d_strtoull='$d_strtoull'
20481 d_strtouq='$d_strtouq'
20482 d_strxfrm='$d_strxfrm'
20483 d_suidsafe='$d_suidsafe'
20484 d_symlink='$d_symlink'
20485 d_syscall='$d_syscall'
20486 d_syscallproto='$d_syscallproto'
20487 d_sysconf='$d_sysconf'
20488 d_sysernlst='$d_sysernlst'
20489 d_syserrlst='$d_syserrlst'
20490 d_system='$d_system'
20491 d_tcgetpgrp='$d_tcgetpgrp'
20492 d_tcsetpgrp='$d_tcsetpgrp'
20493 d_telldir='$d_telldir'
20494 d_telldirproto='$d_telldirproto'
20495 d_time='$d_time'
20496 d_times='$d_times'
20497 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
20498 d_tm_tm_zone='$d_tm_tm_zone'
20499 d_tmpnam_r='$d_tmpnam_r'
20500 d_truncate='$d_truncate'
20501 d_ttyname_r='$d_ttyname_r'
20502 d_tzname='$d_tzname'
20503 d_u32align='$d_u32align'
20504 d_ualarm='$d_ualarm'
20505 d_umask='$d_umask'
20506 d_uname='$d_uname'
20507 d_union_semun='$d_union_semun'
20508 d_unordered='$d_unordered'
20509 d_usleep='$d_usleep'
20510 d_usleepproto='$d_usleepproto'
20511 d_ustat='$d_ustat'
20512 d_vendorarch='$d_vendorarch'
20513 d_vendorbin='$d_vendorbin'
20514 d_vendorlib='$d_vendorlib'
20515 d_vendorscript='$d_vendorscript'
20516 d_vfork='$d_vfork'
20517 d_void_closedir='$d_void_closedir'
20518 d_voidsig='$d_voidsig'
20519 d_voidtty='$d_voidtty'
20520 d_volatile='$d_volatile'
20521 d_vprintf='$d_vprintf'
20522 d_wait4='$d_wait4'
20523 d_waitpid='$d_waitpid'
20524 d_wcstombs='$d_wcstombs'
20525 d_wctomb='$d_wctomb'
20526 d_writev='$d_writev'
20527 d_xenix='$d_xenix'
20528 date='$date'
20529 db_hashtype='$db_hashtype'
20530 db_prefixtype='$db_prefixtype'
20531 db_version_major='$db_version_major'
20532 db_version_minor='$db_version_minor'
20533 db_version_patch='$db_version_patch'
20534 defvoidused='$defvoidused'
20535 direntrytype='$direntrytype'
20536 dlext='$dlext'
20537 dlsrc='$dlsrc'
20538 doublesize='$doublesize'
20539 drand01='$drand01'
20540 drand48_r_proto='$drand48_r_proto'
20541 dynamic_ext='$dynamic_ext'
20542 eagain='$eagain'
20543 ebcdic='$ebcdic'
20544 echo='$echo'
20545 egrep='$egrep'
20546 emacs='$emacs'
20547 endgrent_r_proto='$endgrent_r_proto'
20548 endhostent_r_proto='$endhostent_r_proto'
20549 endnetent_r_proto='$endnetent_r_proto'
20550 endprotoent_r_proto='$endprotoent_r_proto'
20551 endpwent_r_proto='$endpwent_r_proto'
20552 endservent_r_proto='$endservent_r_proto'
20553 eunicefix='$eunicefix'
20554 exe_ext='$exe_ext'
20555 expr='$expr'
20556 extensions='$extensions'
20557 extras='$extras'
20558 fflushNULL='$fflushNULL'
20559 fflushall='$fflushall'
20560 find='$find'
20561 firstmakefile='$firstmakefile'
20562 flex='$flex'
20563 fpossize='$fpossize'
20564 fpostype='$fpostype'
20565 freetype='$freetype'
20566 from='$from'
20567 full_ar='$full_ar'
20568 full_csh='$full_csh'
20569 full_sed='$full_sed'
20570 gccansipedantic='$gccansipedantic'
20571 gccosandvers='$gccosandvers'
20572 gccversion='$gccversion'
20573 getgrent_r_proto='$getgrent_r_proto'
20574 getgrgid_r_proto='$getgrgid_r_proto'
20575 getgrnam_r_proto='$getgrnam_r_proto'
20576 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
20577 gethostbyname_r_proto='$gethostbyname_r_proto'
20578 gethostent_r_proto='$gethostent_r_proto'
20579 getlogin_r_proto='$getlogin_r_proto'
20580 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
20581 getnetbyname_r_proto='$getnetbyname_r_proto'
20582 getnetent_r_proto='$getnetent_r_proto'
20583 getprotobyname_r_proto='$getprotobyname_r_proto'
20584 getprotobynumber_r_proto='$getprotobynumber_r_proto'
20585 getprotoent_r_proto='$getprotoent_r_proto'
20586 getpwent_r_proto='$getpwent_r_proto'
20587 getpwnam_r_proto='$getpwnam_r_proto'
20588 getpwuid_r_proto='$getpwuid_r_proto'
20589 getservbyname_r_proto='$getservbyname_r_proto'
20590 getservbyport_r_proto='$getservbyport_r_proto'
20591 getservent_r_proto='$getservent_r_proto'
20592 getspnam_r_proto='$getspnam_r_proto'
20593 gidformat='$gidformat'
20594 gidsign='$gidsign'
20595 gidsize='$gidsize'
20596 gidtype='$gidtype'
20597 glibpth='$glibpth'
20598 gmake='$gmake'
20599 gmtime_r_proto='$gmtime_r_proto'
20600 gnulibc_version='$gnulibc_version'
20601 grep='$grep'
20602 groupcat='$groupcat'
20603 groupstype='$groupstype'
20604 gzip='$gzip'
20605 h_fcntl='$h_fcntl'
20606 h_sysfile='$h_sysfile'
20607 hint='$hint'
20608 hostcat='$hostcat'
20609 html1dir='$html1dir'
20610 html1direxp='$html1direxp'
20611 html3dir='$html3dir'
20612 html3direxp='$html3direxp'
20613 i16size='$i16size'
20614 i16type='$i16type'
20615 i32size='$i32size'
20616 i32type='$i32type'
20617 i64size='$i64size'
20618 i64type='$i64type'
20619 i8size='$i8size'
20620 i8type='$i8type'
20621 i_arpainet='$i_arpainet'
20622 i_bsdioctl='$i_bsdioctl'
20623 i_crypt='$i_crypt'
20624 i_db='$i_db'
20625 i_dbm='$i_dbm'
20626 i_dirent='$i_dirent'
20627 i_dld='$i_dld'
20628 i_dlfcn='$i_dlfcn'
20629 i_fcntl='$i_fcntl'
20630 i_float='$i_float'
20631 i_fp='$i_fp'
20632 i_fp_class='$i_fp_class'
20633 i_gdbm='$i_gdbm'
20634 i_grp='$i_grp'
20635 i_ieeefp='$i_ieeefp'
20636 i_inttypes='$i_inttypes'
20637 i_langinfo='$i_langinfo'
20638 i_libutil='$i_libutil'
20639 i_limits='$i_limits'
20640 i_locale='$i_locale'
20641 i_machcthr='$i_machcthr'
20642 i_malloc='$i_malloc'
20643 i_math='$i_math'
20644 i_memory='$i_memory'
20645 i_mntent='$i_mntent'
20646 i_ndbm='$i_ndbm'
20647 i_netdb='$i_netdb'
20648 i_neterrno='$i_neterrno'
20649 i_netinettcp='$i_netinettcp'
20650 i_niin='$i_niin'
20651 i_poll='$i_poll'
20652 i_prot='$i_prot'
20653 i_pthread='$i_pthread'
20654 i_pwd='$i_pwd'
20655 i_rpcsvcdbm='$i_rpcsvcdbm'
20656 i_sfio='$i_sfio'
20657 i_sgtty='$i_sgtty'
20658 i_shadow='$i_shadow'
20659 i_socks='$i_socks'
20660 i_stdarg='$i_stdarg'
20661 i_stddef='$i_stddef'
20662 i_stdlib='$i_stdlib'
20663 i_string='$i_string'
20664 i_sunmath='$i_sunmath'
20665 i_sysaccess='$i_sysaccess'
20666 i_sysdir='$i_sysdir'
20667 i_sysfile='$i_sysfile'
20668 i_sysfilio='$i_sysfilio'
20669 i_sysin='$i_sysin'
20670 i_sysioctl='$i_sysioctl'
20671 i_syslog='$i_syslog'
20672 i_sysmman='$i_sysmman'
20673 i_sysmode='$i_sysmode'
20674 i_sysmount='$i_sysmount'
20675 i_sysndir='$i_sysndir'
20676 i_sysparam='$i_sysparam'
20677 i_sysresrc='$i_sysresrc'
20678 i_syssecrt='$i_syssecrt'
20679 i_sysselct='$i_sysselct'
20680 i_syssockio='$i_syssockio'
20681 i_sysstat='$i_sysstat'
20682 i_sysstatfs='$i_sysstatfs'
20683 i_sysstatvfs='$i_sysstatvfs'
20684 i_systime='$i_systime'
20685 i_systimek='$i_systimek'
20686 i_systimes='$i_systimes'
20687 i_systypes='$i_systypes'
20688 i_sysuio='$i_sysuio'
20689 i_sysun='$i_sysun'
20690 i_sysutsname='$i_sysutsname'
20691 i_sysvfs='$i_sysvfs'
20692 i_syswait='$i_syswait'
20693 i_termio='$i_termio'
20694 i_termios='$i_termios'
20695 i_time='$i_time'
20696 i_unistd='$i_unistd'
20697 i_ustat='$i_ustat'
20698 i_utime='$i_utime'
20699 i_values='$i_values'
20700 i_varargs='$i_varargs'
20701 i_varhdr='$i_varhdr'
20702 i_vfork='$i_vfork'
20703 ignore_versioned_solibs='$ignore_versioned_solibs'
20704 inc_version_list='$inc_version_list'
20705 inc_version_list_init='$inc_version_list_init'
20706 incpath='$incpath'
20707 inews='$inews'
20708 installarchlib='$installarchlib'
20709 installbin='$installbin'
20710 installhtml1dir='$installhtml1dir'
20711 installhtml3dir='$installhtml3dir'
20712 installman1dir='$installman1dir'
20713 installman3dir='$installman3dir'
20714 installprefix='$installprefix'
20715 installprefixexp='$installprefixexp'
20716 installprivlib='$installprivlib'
20717 installscript='$installscript'
20718 installsitearch='$installsitearch'
20719 installsitebin='$installsitebin'
20720 installsitehtml1='$installsitehtml1'
20721 installsitehtml3='$installsitehtml3'
20722 installsitelib='$installsitelib'
20723 installsiteman1='$installsiteman1'
20724 installsiteman3='$installsiteman3'
20725 installsitescript='$installsitescript'
20726 installstyle='$installstyle'
20727 installusrbinperl='$installusrbinperl'
20728 installvendorarch='$installvendorarch'
20729 installvendorbin='$installvendorbin'
20730 installvendorhtml1='$installvendorhtml1'
20731 installvendorhtml3='$installvendorhtml3'
20732 installvendorlib='$installvendorlib'
20733 installvendorman1='$installvendorman1'
20734 installvendorman3='$installvendorman3'
20735 installvendorscript='$installvendorscript'
20736 intsize='$intsize'
20737 issymlink='$issymlink'
20738 ivdformat='$ivdformat'
20739 ivsize='$ivsize'
20740 ivtype='$ivtype'
20741 known_extensions='$known_extensions'
20742 ksh='$ksh'
20743 ld='$ld'
20744 lddlflags='$lddlflags'
20745 ldflags='$ldflags'
20746 ldflags_uselargefiles='$ldflags_uselargefiles'
20747 ldlibpthname='$ldlibpthname'
20748 less='$less'
20749 lib_ext='$lib_ext'
20750 libc='$libc'
20751 libperl='$libperl'
20752 libpth='$libpth'
20753 libs='$libs'
20754 libsdirs='$libsdirs'
20755 libsfiles='$libsfiles'
20756 libsfound='$libsfound'
20757 libspath='$libspath'
20758 libswanted='$libswanted'
20759 libswanted_uselargefiles='$libswanted_uselargefiles'
20760 line='$line'
20761 lint='$lint'
20762 lkflags='$lkflags'
20763 ln='$ln'
20764 lns='$lns'
20765 localtime_r_proto='$localtime_r_proto'
20766 locincpth='$locincpth'
20767 loclibpth='$loclibpth'
20768 longdblsize='$longdblsize'
20769 longlongsize='$longlongsize'
20770 longsize='$longsize'
20771 lp='$lp'
20772 lpr='$lpr'
20773 ls='$ls'
20774 lseeksize='$lseeksize'
20775 lseektype='$lseektype'
20776 mail='$mail'
20777 mailx='$mailx'
20778 make='$make'
20779 make_set_make='$make_set_make'
20780 mallocobj='$mallocobj'
20781 mallocsrc='$mallocsrc'
20782 malloctype='$malloctype'
20783 man1dir='$man1dir'
20784 man1direxp='$man1direxp'
20785 man1ext='$man1ext'
20786 man3dir='$man3dir'
20787 man3direxp='$man3direxp'
20788 man3ext='$man3ext'
20789 mips_type='$mips_type'
20790 mkdir='$mkdir'
20791 mmaptype='$mmaptype'
20792 modetype='$modetype'
20793 more='$more'
20794 multiarch='$multiarch'
20795 mv='$mv'
20796 myarchname='$myarchname'
20797 mydomain='$mydomain'
20798 myhostname='$myhostname'
20799 myuname='$myuname'
20800 n='$n'
20801 need_va_copy='$need_va_copy'
20802 netdb_hlen_type='$netdb_hlen_type'
20803 netdb_host_type='$netdb_host_type'
20804 netdb_name_type='$netdb_name_type'
20805 netdb_net_type='$netdb_net_type'
20806 nm='$nm'
20807 nm_opt='$nm_opt'
20808 nm_so_opt='$nm_so_opt'
20809 nonxs_ext='$nonxs_ext'
20810 nroff='$nroff'
20811 nvEUformat='$nvEUformat'
20812 nvFUformat='$nvFUformat'
20813 nvGUformat='$nvGUformat'
20814 nv_preserves_uv_bits='$nv_preserves_uv_bits'
20815 nveformat='$nveformat'
20816 nvfformat='$nvfformat'
20817 nvgformat='$nvgformat'
20818 nvsize='$nvsize'
20819 nvtype='$nvtype'
20820 o_nonblock='$o_nonblock'
20821 obj_ext='$obj_ext'
20822 old_pthread_create_joinable='$old_pthread_create_joinable'
20823 optimize='$optimize'
20824 orderlib='$orderlib'
20825 osname='$osname'
20826 osvers='$osvers'
20827 otherlibdirs='$otherlibdirs'
20828 package='$package'
20829 pager='$pager'
20830 passcat='$passcat'
20831 patchlevel='$patchlevel'
20832 path_sep='$path_sep'
20833 perl5='$perl5'
20834 perl='$perl'
20835 perl_patchlevel='$perl_patchlevel'
20836 perladmin='$perladmin'
20837 perllibs='$perllibs'
20838 perlpath='$perlpath'
20839 pg='$pg'
20840 phostname='$phostname'
20841 pidtype='$pidtype'
20842 plibpth='$plibpth'
20843 pm_apiversion='$pm_apiversion'
20844 pmake='$pmake'
20845 pr='$pr'
20846 prefix='$prefix'
20847 prefixexp='$prefixexp'
20848 privlib='$privlib'
20849 privlibexp='$privlibexp'
20850 procselfexe='$procselfexe'
20851 prototype='$prototype'
20852 ptrsize='$ptrsize'
20853 quadkind='$quadkind'
20854 quadtype='$quadtype'
20855 randbits='$randbits'
20856 randfunc='$randfunc'
20857 random_r_proto='$random_r_proto'
20858 randseedtype='$randseedtype'
20859 ranlib='$ranlib'
20860 rd_nodata='$rd_nodata'
20861 readdir64_r_proto='$readdir64_r_proto'
20862 readdir_r_proto='$readdir_r_proto'
20863 revision='$revision'
20864 rm='$rm'
20865 rmail='$rmail'
20866 run='$run'
20867 runnm='$runnm'
20868 sPRIEUldbl='$sPRIEUldbl'
20869 sPRIFUldbl='$sPRIFUldbl'
20870 sPRIGUldbl='$sPRIGUldbl'
20871 sPRIXU64='$sPRIXU64'
20872 sPRId64='$sPRId64'
20873 sPRIeldbl='$sPRIeldbl'
20874 sPRIfldbl='$sPRIfldbl'
20875 sPRIgldbl='$sPRIgldbl'
20876 sPRIi64='$sPRIi64'
20877 sPRIo64='$sPRIo64'
20878 sPRIu64='$sPRIu64'
20879 sPRIx64='$sPRIx64'
20880 sSCNfldbl='$sSCNfldbl'
20881 sched_yield='$sched_yield'
20882 scriptdir='$scriptdir'
20883 scriptdirexp='$scriptdirexp'
20884 sed='$sed'
20885 seedfunc='$seedfunc'
20886 selectminbits='$selectminbits'
20887 selecttype='$selecttype'
20888 sendmail='$sendmail'
20889 setgrent_r_proto='$setgrent_r_proto'
20890 sethostent_r_proto='$sethostent_r_proto'
20891 setlocale_r_proto='$setlocale_r_proto'
20892 setnetent_r_proto='$setnetent_r_proto'
20893 setprotoent_r_proto='$setprotoent_r_proto'
20894 setpwent_r_proto='$setpwent_r_proto'
20895 setservent_r_proto='$setservent_r_proto'
20896 sh='$sh'
20897 shar='$shar'
20898 sharpbang='$sharpbang'
20899 shmattype='$shmattype'
20900 shortsize='$shortsize'
20901 shrpenv='$shrpenv'
20902 shsharp='$shsharp'
20903 sig_count='$sig_count'
20904 sig_name='$sig_name'
20905 sig_name_init='$sig_name_init'
20906 sig_num='$sig_num'
20907 sig_num_init='$sig_num_init'
20908 sig_size='$sig_size'
20909 signal_t='$signal_t'
20910 sitearch='$sitearch'
20911 sitearchexp='$sitearchexp'
20912 sitebin='$sitebin'
20913 sitebinexp='$sitebinexp'
20914 sitehtml1='$sitehtml1'
20915 sitehtml1exp='$sitehtml1exp'
20916 sitehtml3='$sitehtml3'
20917 sitehtml3exp='$sitehtml3exp'
20918 sitelib='$sitelib'
20919 sitelib_stem='$sitelib_stem'
20920 sitelibexp='$sitelibexp'
20921 siteman1='$siteman1'
20922 siteman1exp='$siteman1exp'
20923 siteman3='$siteman3'
20924 siteman3exp='$siteman3exp'
20925 siteprefix='$siteprefix'
20926 siteprefixexp='$siteprefixexp'
20927 sitescript='$sitescript'
20928 sitescriptexp='$sitescriptexp'
20929 sizesize='$sizesize'
20930 sizetype='$sizetype'
20931 sleep='$sleep'
20932 smail='$smail'
20933 so='$so'
20934 sockethdr='$sockethdr'
20935 socketlib='$socketlib'
20936 socksizetype='$socksizetype'
20937 sort='$sort'
20938 spackage='$spackage'
20939 spitshell='$spitshell'
20940 srand48_r_proto='$srand48_r_proto'
20941 srandom_r_proto='$srandom_r_proto'
20942 src='$src'
20943 ssizetype='$ssizetype'
20944 startperl='$startperl'
20945 startsh='$startsh'
20946 static_ext='$static_ext'
20947 stdchar='$stdchar'
20948 stdio_base='$stdio_base'
20949 stdio_bufsiz='$stdio_bufsiz'
20950 stdio_cnt='$stdio_cnt'
20951 stdio_filbuf='$stdio_filbuf'
20952 stdio_ptr='$stdio_ptr'
20953 stdio_stream_array='$stdio_stream_array'
20954 strerror_r_proto='$strerror_r_proto'
20955 strings='$strings'
20956 submit='$submit'
20957 subversion='$subversion'
20958 sysman='$sysman'
20959 tail='$tail'
20960 tar='$tar'
20961 targetarch='$targetarch'
20962 tbl='$tbl'
20963 tee='$tee'
20964 test='$test'
20965 timeincl='$timeincl'
20966 timetype='$timetype'
20967 tmpnam_r_proto='$tmpnam_r_proto'
20968 to='$to'
20969 touch='$touch'
20970 tr='$tr'
20971 trnl='$trnl'
20972 troff='$troff'
20973 ttyname_r_proto='$ttyname_r_proto'
20974 u16size='$u16size'
20975 u16type='$u16type'
20976 u32size='$u32size'
20977 u32type='$u32type'
20978 u64size='$u64size'
20979 u64type='$u64type'
20980 u8size='$u8size'
20981 u8type='$u8type'
20982 uidformat='$uidformat'
20983 uidsign='$uidsign'
20984 uidsize='$uidsize'
20985 uidtype='$uidtype'
20986 uname='$uname'
20987 uniq='$uniq'
20988 uquadtype='$uquadtype'
20989 use5005threads='$use5005threads'
20990 use64bitall='$use64bitall'
20991 use64bitint='$use64bitint'
20992 usecrosscompile='$usecrosscompile'
20993 usedl='$usedl'
20994 useithreads='$useithreads'
20995 uselargefiles='$uselargefiles'
20996 uselongdouble='$uselongdouble'
20997 usemorebits='$usemorebits'
20998 usemultiplicity='$usemultiplicity'
20999 usemymalloc='$usemymalloc'
21000 usenm='$usenm'
21001 useopcode='$useopcode'
21002 useperlio='$useperlio'
21003 useposix='$useposix'
21004 usereentrant='$usereentrant'
21005 usesfio='$usesfio'
21006 useshrplib='$useshrplib'
21007 usesocks='$usesocks'
21008 usethreads='$usethreads'
21009 usevendorprefix='$usevendorprefix'
21010 usevfork='$usevfork'
21011 usrinc='$usrinc'
21012 uuname='$uuname'
21013 uvXUformat='$uvXUformat'
21014 uvoformat='$uvoformat'
21015 uvsize='$uvsize'
21016 uvtype='$uvtype'
21017 uvuformat='$uvuformat'
21018 uvxformat='$uvxformat'
21019 vendorarch='$vendorarch'
21020 vendorarchexp='$vendorarchexp'
21021 vendorbin='$vendorbin'
21022 vendorbinexp='$vendorbinexp'
21023 vendorhtml1='$vendorhtml1'
21024 vendorhtml1exp='$vendorhtml1exp'
21025 vendorhtml3='$vendorhtml3'
21026 vendorhtml3exp='$vendorhtml3exp'
21027 vendorlib='$vendorlib'
21028 vendorlib_stem='$vendorlib_stem'
21029 vendorlibexp='$vendorlibexp'
21030 vendorman1='$vendorman1'
21031 vendorman1exp='$vendorman1exp'
21032 vendorman3='$vendorman3'
21033 vendorman3exp='$vendorman3exp'
21034 vendorprefix='$vendorprefix'
21035 vendorprefixexp='$vendorprefixexp'
21036 vendorscript='$vendorscript'
21037 vendorscriptexp='$vendorscriptexp'
21038 version='$version'
21039 version_patchlevel_string='$version_patchlevel_string'
21040 versiononly='$versiononly'
21041 vi='$vi'
21042 voidflags='$voidflags'
21043 xlibpth='$xlibpth'
21044 xs_apiversion='$xs_apiversion'
21045 yacc='$yacc'
21046 yaccflags='$yaccflags'
21047 zcat='$zcat'
21048 zip='$zip'
21049 EOT
21050
21051 : Add in command line options if available
21052 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21053
21054 : add special variables
21055 $test -f $src/patchlevel.h && \
21056 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
21057 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
21058 echo "PERL_CONFIG_SH=true" >>config.sh
21059
21060 : propagate old symbols
21061 if $test -f UU/config.sh; then
21062         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
21063         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
21064         $sort | $uniq -u >UU/oldsyms
21065         set X `cat UU/oldsyms`
21066         shift
21067         case $# in
21068         0) ;;
21069         *)
21070                 cat <<EOM
21071 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
21072 EOM
21073                 echo "# Variables propagated from previous config.sh file." >>config.sh
21074                 for sym in `cat UU/oldsyms`; do
21075                         echo "    Propagating $hint variable "'$'"$sym..."
21076                         eval 'tmp="$'"${sym}"'"'
21077                         echo "$tmp" | \
21078                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
21079                 done
21080                 ;;
21081         esac
21082 fi
21083
21084 : Finish up by extracting the .SH files
21085 case "$alldone" in
21086 exit)
21087         $rm -rf UU
21088         echo "Extraction done."
21089         exit 0
21090         ;;
21091 cont)
21092         ;;
21093 '')
21094         dflt=''
21095         nostick=true
21096         $cat <<EOM
21097
21098 If you'd like to make any changes to the config.sh file before I begin
21099 to configure things, do it as a shell escape now (e.g. !vi config.sh).
21100
21101 EOM
21102         rp="Press return or use a shell escape to edit config.sh:"
21103         . UU/myread
21104         nostick=''
21105         case "$ans" in
21106         '') ;;
21107         *) : in case they cannot read
21108                 sh 1>&4 -c "$ans";;
21109         esac
21110         ;;
21111 esac
21112
21113 : if this fails, just run all the .SH files by hand
21114 . ./config.sh
21115
21116 echo " "
21117 exec 1>&4
21118 pwd=`pwd`
21119 . ./UU/extract
21120 cd "$pwd"
21121
21122 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
21123         dflt=y
21124         case "$silent" in
21125         true) ;;
21126         *)
21127                 $cat <<EOM
21128
21129 Now you need to generate make dependencies by running "$make depend".
21130 You might prefer to run it in background: "$make depend > makedepend.out &"
21131 It can take a while, so you might not want to run it right now.
21132
21133 EOM
21134                 ;;
21135         esac
21136         rp="Run $make depend now?"
21137         . UU/myread
21138         case "$ans" in
21139         y*)
21140                 $make depend && echo "Now you must run '$make'."
21141                 ;;
21142         *)
21143                 echo "You must run '$make depend' then '$make'."
21144                 ;;
21145         esac
21146 elif test -f [Mm]akefile; then
21147         echo " "
21148         echo "Now you must run a $make."
21149 else
21150         echo "Configure done."
21151 fi
21152
21153 if $test -f Policy.sh; then
21154     $cat <<EOM
21155
21156 If you compile $package on a different machine or from a different object
21157 directory, copy the Policy.sh file from this object directory to the
21158 new one before you run Configure -- this will help you with most of
21159 the policy defaults.
21160
21161 EOM
21162 fi
21163 if $test -f config.msg; then
21164     echo "Hmm.  I also noted the following information while running:"
21165     echo " "
21166     $cat config.msg >&4
21167     $rm -f config.msg
21168 fi
21169 $rm -f kit*isdone ark*isdone
21170 $rm -rf UU
21171
21172 : End of Configure
21173