Regen Configure, modlib, toc.
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Thu Jul 12 07:32:38 EET DST 2001 [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                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccname=''
164 ccversion=''
165 ccsymbols=''
166 cppccsymbols=''
167 cppsymbols=''
168 from=''
169 run=''
170 targetarch=''
171 to=''
172 usecrosscompile=''
173 perllibs=''
174 dynamic_ext=''
175 extensions=''
176 known_extensions=''
177 nonxs_ext=''
178 static_ext=''
179 useopcode=''
180 useposix=''
181 d_bsd=''
182 d_eunice=''
183 d_xenix=''
184 eunicefix=''
185 Mcc=''
186 ar=''
187 awk=''
188 bash=''
189 bison=''
190 byacc=''
191 cat=''
192 chgrp=''
193 chmod=''
194 chown=''
195 comm=''
196 compress=''
197 cp=''
198 cpio=''
199 cpp=''
200 csh=''
201 date=''
202 echo=''
203 egrep=''
204 emacs=''
205 expr=''
206 find=''
207 flex=''
208 grep=''
209 gzip=''
210 inews=''
211 ksh=''
212 less=''
213 line=''
214 lint=''
215 ln=''
216 lp=''
217 lpr=''
218 ls=''
219 mail=''
220 mailx=''
221 make=''
222 mkdir=''
223 more=''
224 mv=''
225 nm=''
226 nroff=''
227 perl=''
228 pg=''
229 pmake=''
230 pr=''
231 rm=''
232 rmail=''
233 sed=''
234 sendmail=''
235 shar=''
236 sleep=''
237 smail=''
238 sort=''
239 submit=''
240 tail=''
241 tar=''
242 tbl=''
243 tee=''
244 test=''
245 touch=''
246 tr=''
247 troff=''
248 uname=''
249 uniq=''
250 uuname=''
251 vi=''
252 zcat=''
253 zip=''
254 full_ar=''
255 full_sed=''
256 libswanted=''
257 hint=''
258 myuname=''
259 osname=''
260 osvers=''
261 Author=''
262 Date=''
263 Header=''
264 Id=''
265 Locker=''
266 Log=''
267 RCSfile=''
268 Revision=''
269 Source=''
270 State=''
271 _a=''
272 _exe=''
273 _o=''
274 archobjs=''
275 exe_ext=''
276 firstmakefile=''
277 lib_ext=''
278 obj_ext=''
279 path_sep=''
280 afs=''
281 afsroot=''
282 alignbytes=''
283 ansi2knr=''
284 archlib=''
285 archlibexp=''
286 d_archlib=''
287 installarchlib=''
288 archname=''
289 myarchname=''
290 d_atolf=''
291 d_atoll=''
292 baserev=''
293 bin=''
294 binexp=''
295 installbin=''
296 bincompat5005=''
297 d_bincompat5005=''
298 byteorder=''
299 cc=''
300 ccflags=''
301 cppflags=''
302 ldflags=''
303 lkflags=''
304 locincpth=''
305 optimize=''
306 cf_email=''
307 cf_by=''
308 cf_time=''
309 charsize=''
310 contains=''
311 cpp_stuff=''
312 cpplast=''
313 cppminus=''
314 cpprun=''
315 cppstdin=''
316 d__fwalk=''
317 d_access=''
318 d_accessx=''
319 d_alarm=''
320 d_attribut=''
321 d_bcmp=''
322 d_bcopy=''
323 d_bzero=''
324 d_casti32=''
325 castflags=''
326 d_castneg=''
327 d_chown=''
328 d_chroot=''
329 d_chsize=''
330 d_closedir=''
331 d_void_closedir=''
332 d_cmsghdr_s=''
333 d_const=''
334 cryptlib=''
335 d_crypt=''
336 d_csh=''
337 full_csh=''
338 d_cuserid=''
339 d_dbl_dig=''
340 d_dbminitproto=''
341 d_difftime=''
342 d_dlerror=''
343 d_dlopen=''
344 d_dlsymun=''
345 d_dosuid=''
346 d_suidsafe=''
347 d_drand48proto=''
348 d_dup2=''
349 d_eaccess=''
350 d_endgrent=''
351 d_endhent=''
352 d_endnent=''
353 d_endpent=''
354 d_endpwent=''
355 d_endsent=''
356 d_fchdir=''
357 d_fchmod=''
358 d_fchown=''
359 d_fcntl=''
360 d_fcntl_can_lock=''
361 d_fd_macros=''
362 d_fd_set=''
363 d_fds_bits=''
364 d_fgetpos=''
365 d_flexfnam=''
366 d_flock=''
367 d_flockproto=''
368 d_fork=''
369 d_fpos64_t=''
370 d_frexpl=''
371 d_fs_data_s=''
372 d_fseeko=''
373 d_fsetpos=''
374 d_fstatfs=''
375 d_fsync=''
376 d_ftello=''
377 d_ftime=''
378 d_gettimeod=''
379 d_Gconvert=''
380 d_getcwd=''
381 d_getespwnam=''
382 d_getfsstat=''
383 d_getgrent=''
384 d_getgrps=''
385 d_gethbyaddr=''
386 d_gethbyname=''
387 d_gethent=''
388 aphostname=''
389 d_gethname=''
390 d_phostname=''
391 d_uname=''
392 d_gethostprotos=''
393 d_getitimer=''
394 d_getlogin=''
395 d_getmnt=''
396 d_getmntent=''
397 d_getnbyaddr=''
398 d_getnbyname=''
399 d_getnent=''
400 d_getnetprotos=''
401 d_getpagsz=''
402 d_getpent=''
403 d_getpgid=''
404 d_getpgrp2=''
405 d_bsdgetpgrp=''
406 d_getpgrp=''
407 d_getppid=''
408 d_getprior=''
409 d_getpbyname=''
410 d_getpbynumber=''
411 d_getprotoprotos=''
412 d_getprpwnam=''
413 d_getpwent=''
414 d_getsent=''
415 d_getservprotos=''
416 d_getspnam=''
417 d_getsbyname=''
418 d_getsbyport=''
419 d_gnulibc=''
420 d_hasmntopt=''
421 d_htonl=''
422 d_iconv=''
423 d_inetaton=''
424 d_int64_t=''
425 d_isascii=''
426 d_isnan=''
427 d_isnanl=''
428 d_killpg=''
429 d_lchown=''
430 d_ldbl_dig=''
431 d_link=''
432 d_locconv=''
433 d_lockf=''
434 d_longdbl=''
435 longdblsize=''
436 d_longlong=''
437 longlongsize=''
438 d_lseekproto=''
439 d_lstat=''
440 d_madvise=''
441 d_mblen=''
442 d_mbstowcs=''
443 d_mbtowc=''
444 d_memchr=''
445 d_memcmp=''
446 d_memcpy=''
447 d_memmove=''
448 d_memset=''
449 d_mkdir=''
450 d_mkdtemp=''
451 d_mkfifo=''
452 d_mkstemp=''
453 d_mkstemps=''
454 d_mktime=''
455 d_mmap=''
456 mmaptype=''
457 d_modfl=''
458 d_modfl_pow32_bug=''
459 d_mprotect=''
460 d_msg=''
461 d_msgctl=''
462 d_msgget=''
463 d_msghdr_s=''
464 d_msgrcv=''
465 d_msgsnd=''
466 d_msync=''
467 d_munmap=''
468 d_nice=''
469 d_nl_langinfo=''
470 d_off64_t=''
471 d_open3=''
472 d_fpathconf=''
473 d_pathconf=''
474 d_pause=''
475 d_pipe=''
476 d_poll=''
477 d_portable=''
478 d_old_pthread_create_joinable=''
479 old_pthread_create_joinable=''
480 d_pthread_yield=''
481 d_sched_yield=''
482 sched_yield=''
483 d_qgcvt=''
484 d_readdir=''
485 d_rewinddir=''
486 d_seekdir=''
487 d_telldir=''
488 d_readlink=''
489 d_readv=''
490 d_recvmsg=''
491 d_rename=''
492 d_rmdir=''
493 d_safebcpy=''
494 d_safemcpy=''
495 d_sanemcmp=''
496 d_sbrkproto=''
497 d_select=''
498 d_sem=''
499 d_semctl=''
500 d_semget=''
501 d_semop=''
502 d_sendmsg=''
503 d_setegid=''
504 d_seteuid=''
505 d_setgrent=''
506 d_setgrps=''
507 d_sethent=''
508 d_setitimer=''
509 d_setlinebuf=''
510 d_setlocale=''
511 d_setnent=''
512 d_setpent=''
513 d_setpgid=''
514 d_setpgrp2=''
515 d_bsdsetpgrp=''
516 d_setpgrp=''
517 d_setprior=''
518 d_setproctitle=''
519 d_setpwent=''
520 d_setregid=''
521 d_setresgid=''
522 d_setresuid=''
523 d_setreuid=''
524 d_setrgid=''
525 d_setruid=''
526 d_setsent=''
527 d_setsid=''
528 d_setvbuf=''
529 d_sfio=''
530 usesfio=''
531 d_shm=''
532 d_shmat=''
533 d_shmatprototype=''
534 shmattype=''
535 d_shmctl=''
536 d_shmdt=''
537 d_shmget=''
538 d_sigaction=''
539 d_sigprocmask=''
540 d_sigsetjmp=''
541 d_sockatmark=''
542 d_sockatmarkproto=''
543 d_msg_ctrunc=''
544 d_msg_dontroute=''
545 d_msg_oob=''
546 d_msg_peek=''
547 d_msg_proxy=''
548 d_oldsock=''
549 d_scm_rights=''
550 d_socket=''
551 d_sockpair=''
552 sockethdr=''
553 socketlib=''
554 d_socklen_t=''
555 d_socks5_init=''
556 d_sqrtl=''
557 d_sresgproto=''
558 d_sresuproto=''
559 d_statblks=''
560 d_statfs_f_flags=''
561 d_statfs_s=''
562 d_fstatvfs=''
563 d_statvfs=''
564 d_stdio_cnt_lval=''
565 d_stdio_ptr_lval=''
566 d_stdio_ptr_lval_nochange_cnt=''
567 d_stdio_ptr_lval_sets_cnt=''
568 d_stdiobase=''
569 d_stdstdio=''
570 stdio_base=''
571 stdio_bufsiz=''
572 stdio_cnt=''
573 stdio_filbuf=''
574 stdio_ptr=''
575 d_index=''
576 d_strchr=''
577 d_strcoll=''
578 d_strctcpy=''
579 d_strerrm=''
580 d_strerror=''
581 d_sysernlst=''
582 d_syserrlst=''
583 d_strftime=''
584 d_strtod=''
585 d_strtol=''
586 d_strtold=''
587 d_strtoll=''
588 d_strtoq=''
589 d_strtoul=''
590 d_strtoull=''
591 d_strtouq=''
592 d_strxfrm=''
593 d_symlink=''
594 d_syscall=''
595 d_syscallproto=''
596 d_sysconf=''
597 d_system=''
598 d_tcgetpgrp=''
599 d_tcsetpgrp=''
600 d_telldirproto=''
601 d_time=''
602 timetype=''
603 clocktype=''
604 d_times=''
605 d_truncate=''
606 d_tzname=''
607 d_u32align=''
608 d_ualarm=''
609 d_umask=''
610 d_semctl_semid_ds=''
611 d_semctl_semun=''
612 d_union_semun=''
613 d_usleep=''
614 d_usleepproto=''
615 d_ustat=''
616 d_vfork=''
617 usevfork=''
618 d_voidsig=''
619 signal_t=''
620 d_volatile=''
621 d_charvspr=''
622 d_vprintf=''
623 d_wait4=''
624 d_waitpid=''
625 d_wcstombs=''
626 d_wctomb=''
627 d_writev=''
628 dlext=''
629 cccdlflags=''
630 ccdlflags=''
631 dlsrc=''
632 ld=''
633 lddlflags=''
634 usedl=''
635 doublesize=''
636 ebcdic=''
637 fflushNULL=''
638 fflushall=''
639 fpossize=''
640 fpostype=''
641 gccosandvers=''
642 gccversion=''
643 gidformat=''
644 gidsign=''
645 gidsize=''
646 gidtype=''
647 groupstype=''
648 h_fcntl=''
649 h_sysfile=''
650 i_arpainet=''
651 db_hashtype=''
652 db_prefixtype=''
653 db_version_major=''
654 db_version_minor=''
655 db_version_patch=''
656 i_db=''
657 i_dbm=''
658 i_rpcsvcdbm=''
659 d_dirnamlen=''
660 direntrytype=''
661 i_dirent=''
662 i_dld=''
663 i_dlfcn=''
664 i_fcntl=''
665 i_float=''
666 i_gdbm=''
667 d_grpasswd=''
668 i_grp=''
669 i_iconv=''
670 i_ieeefp=''
671 i_inttypes=''
672 i_langinfo=''
673 i_libutil=''
674 i_limits=''
675 i_locale=''
676 i_machcthr=''
677 i_malloc=''
678 i_math=''
679 i_memory=''
680 i_mntent=''
681 i_ndbm=''
682 i_netdb=''
683 i_neterrno=''
684 i_netinettcp=''
685 i_niin=''
686 i_sysin=''
687 i_poll=''
688 i_prot=''
689 i_pthread=''
690 d_pwage=''
691 d_pwchange=''
692 d_pwclass=''
693 d_pwcomment=''
694 d_pwexpire=''
695 d_pwgecos=''
696 d_pwpasswd=''
697 d_pwquota=''
698 i_pwd=''
699 i_sfio=''
700 i_shadow=''
701 i_socks=''
702 i_stddef=''
703 i_stdlib=''
704 i_string=''
705 strings=''
706 i_sunmath=''
707 i_sysaccess=''
708 i_sysdir=''
709 i_sysfile=''
710 d_voidtty=''
711 i_bsdioctl=''
712 i_sysfilio=''
713 i_sysioctl=''
714 i_syssockio=''
715 i_syslog=''
716 i_sysmman=''
717 i_sysmode=''
718 i_sysmount=''
719 i_sysndir=''
720 i_sysparam=''
721 i_sysresrc=''
722 i_syssecrt=''
723 i_sysselct=''
724 i_sysstat=''
725 i_sysstatfs=''
726 i_sysstatvfs=''
727 i_systimes=''
728 i_systypes=''
729 i_sysuio=''
730 i_sysun=''
731 i_sysutsname=''
732 i_sysvfs=''
733 i_syswait=''
734 i_sgtty=''
735 i_termio=''
736 i_termios=''
737 i_systime=''
738 i_systimek=''
739 i_time=''
740 timeincl=''
741 i_unistd=''
742 i_ustat=''
743 i_utime=''
744 i_values=''
745 i_stdarg=''
746 i_varargs=''
747 i_varhdr=''
748 i_vfork=''
749 inc_version_list=''
750 inc_version_list_init=''
751 installprefix=''
752 installprefixexp=''
753 installstyle=''
754 installusrbinperl=''
755 intsize=''
756 longsize=''
757 shortsize=''
758 issymlink=''
759 libc=''
760 ldlibpthname=''
761 libperl=''
762 shrpenv=''
763 useshrplib=''
764 glibpth=''
765 libpth=''
766 loclibpth=''
767 plibpth=''
768 xlibpth=''
769 ignore_versioned_solibs=''
770 libs=''
771 libsdirs=''
772 libsfiles=''
773 libsfound=''
774 libspath=''
775 lns=''
776 d_PRIEUldbl=''
777 d_PRIFUldbl=''
778 d_PRIGUldbl=''
779 d_PRIeldbl=''
780 d_PRIfldbl=''
781 d_PRIgldbl=''
782 d_SCNfldbl=''
783 sPRIEUldbl=''
784 sPRIFUldbl=''
785 sPRIGUldbl=''
786 sPRIeldbl=''
787 sPRIfldbl=''
788 sPRIgldbl=''
789 sSCNfldbl=''
790 lseeksize=''
791 lseektype=''
792 make_set_make=''
793 d_mymalloc=''
794 freetype=''
795 mallocobj=''
796 mallocsrc=''
797 malloctype=''
798 usemymalloc=''
799 installman1dir=''
800 man1dir=''
801 man1direxp=''
802 man1ext=''
803 installman3dir=''
804 man3dir=''
805 man3direxp=''
806 man3ext=''
807 modetype=''
808 multiarch=''
809 mydomain=''
810 myhostname=''
811 phostname=''
812 c=''
813 n=''
814 d_eofnblk=''
815 eagain=''
816 o_nonblock=''
817 rd_nodata=''
818 need_va_copy=''
819 netdb_hlen_type=''
820 netdb_host_type=''
821 netdb_name_type=''
822 netdb_net_type=''
823 groupcat=''
824 hostcat=''
825 passcat=''
826 orderlib=''
827 ranlib=''
828 d_perl_otherlibdirs=''
829 otherlibdirs=''
830 package=''
831 spackage=''
832 pager=''
833 api_revision=''
834 api_subversion=''
835 api_version=''
836 api_versionstring=''
837 patchlevel=''
838 perl_patchlevel=''
839 revision=''
840 subversion=''
841 version=''
842 version_patchlevel_string=''
843 perl5=''
844 perladmin=''
845 perlpath=''
846 d_nv_preserves_uv=''
847 d_nv_preserves_uv_bits=''
848 i16size=''
849 i16type=''
850 i32size=''
851 i32type=''
852 i64size=''
853 i64type=''
854 i8size=''
855 i8type=''
856 ivsize=''
857 ivtype=''
858 nvsize=''
859 nvtype=''
860 u16size=''
861 u16type=''
862 u32size=''
863 u32type=''
864 u64size=''
865 u64type=''
866 u8size=''
867 u8type=''
868 uvsize=''
869 uvtype=''
870 ivdformat=''
871 nvEUformat=''
872 nvFUformat=''
873 nvGUformat=''
874 nveformat=''
875 nvfformat=''
876 nvgformat=''
877 uvXUformat=''
878 uvoformat=''
879 uvuformat=''
880 uvxformat=''
881 pidtype=''
882 prefix=''
883 prefixexp=''
884 installprivlib=''
885 privlib=''
886 privlibexp=''
887 prototype=''
888 ptrsize=''
889 d_PRIXU64=''
890 d_PRId64=''
891 d_PRIi64=''
892 d_PRIo64=''
893 d_PRIu64=''
894 d_PRIx64=''
895 sPRIXU64=''
896 sPRId64=''
897 sPRIi64=''
898 sPRIo64=''
899 sPRIu64=''
900 sPRIx64=''
901 d_quad=''
902 quadkind=''
903 quadtype=''
904 uquadtype=''
905 drand01=''
906 randbits=''
907 randfunc=''
908 randseedtype=''
909 seedfunc=''
910 installscript=''
911 scriptdir=''
912 scriptdirexp=''
913 selectminbits=''
914 selecttype=''
915 sh=''
916 sig_count=''
917 sig_name=''
918 sig_name_init=''
919 sig_num=''
920 sig_num_init=''
921 sig_size=''
922 installsitearch=''
923 sitearch=''
924 sitearchexp=''
925 installsitebin=''
926 sitebin=''
927 sitebinexp=''
928 installsitelib=''
929 sitelib=''
930 sitelib_stem=''
931 sitelibexp=''
932 siteprefix=''
933 siteprefixexp=''
934 sizesize=''
935 sizetype=''
936 so=''
937 socksizetype=''
938 sharpbang=''
939 shsharp=''
940 spitshell=''
941 src=''
942 ssizetype=''
943 startperl=''
944 startsh=''
945 stdchar=''
946 d_stdio_stream_array=''
947 stdio_stream_array=''
948 sysman=''
949 trnl=''
950 uidformat=''
951 uidsign=''
952 uidsize=''
953 uidtype=''
954 archname64=''
955 use64bitall=''
956 use64bitint=''
957 ccflags_uselargefiles=''
958 ldflags_uselargefiles=''
959 libswanted_uselargefiles=''
960 uselargefiles=''
961 uselongdouble=''
962 usemorebits=''
963 usemultiplicity=''
964 nm_opt=''
965 nm_so_opt=''
966 runnm=''
967 usenm=''
968 useperlio=''
969 usesocks=''
970 d_oldpthreads=''
971 use5005threads=''
972 useithreads=''
973 usereentrant=''
974 usethreads=''
975 incpath=''
976 mips_type=''
977 usrinc=''
978 d_vendorarch=''
979 installvendorarch=''
980 vendorarch=''
981 vendorarchexp=''
982 d_vendorbin=''
983 installvendorbin=''
984 vendorbin=''
985 vendorbinexp=''
986 d_vendorlib=''
987 installvendorlib=''
988 vendorlib=''
989 vendorlib_stem=''
990 vendorlibexp=''
991 usevendorprefix=''
992 vendorprefix=''
993 vendorprefixexp=''
994 versiononly=''
995 defvoidused=''
996 voidflags=''
997 pm_apiversion=''
998 xs_apiversion=''
999 yacc=''
1000 yaccflags=''
1001 CONFIG=''
1002
1003 define='define'
1004 undef='undef'
1005 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1006 rmlist=''
1007
1008 : We must find out about Eunice early
1009 eunicefix=':'
1010 if test -f /etc/unixtovms; then
1011         eunicefix=/etc/unixtovms
1012 fi
1013 if test -f /etc/unixtovms.exe; then
1014         eunicefix=/etc/unixtovms.exe
1015 fi
1016
1017 i_whoami=''
1018 ccname=''
1019 ccversion=''
1020 perllibs=''
1021 : set useposix=false in your hint file to disable the POSIX extension.
1022 useposix=true
1023 : set useopcode=false in your hint file to disable the Opcode extension.
1024 useopcode=true
1025 : Trailing extension.  Override this in a hint file, if needed.
1026 _exe=''
1027 : Extra object files, if any, needed on this platform.
1028 archobjs=''
1029 archname=''
1030 : Possible local include directories to search.
1031 : Set locincpth to "" in a hint file to defeat local include searches.
1032 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1033 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1034 :
1035 : no include file wanted by default
1036 inclwanted=''
1037
1038 groupstype=''
1039 libnames=''
1040 : change the next line if compiling for Xenix/286 on Xenix/386
1041 xlibpth='/usr/lib/386 /lib/386'
1042 : Possible local library directories to search.
1043 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1044 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1045
1046 : general looking path for locating libraries
1047 glibpth="/lib /usr/lib $xlibpth"
1048 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1049 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1050 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1051
1052 : Private path used by Configure to find libraries.  Its value
1053 : is prepended to libpth. This variable takes care of special
1054 : machines, like the mips.  Usually, it should be empty.
1055 plibpth=''
1056
1057 : default library list
1058 libswanted=''
1059 : some systems want to use only the non-versioned libso:s
1060 ignore_versioned_solibs=''
1061 archname64=''
1062 ccflags_uselargefiles=''
1063 ldflags_uselargefiles=''
1064 libswanted_uselargefiles=''
1065 : set usemultiplicity on the Configure command line to enable multiplicity.
1066 : set usesocks on the Configure command line to enable socks.
1067 : set usethreads on the Configure command line to enable threads.
1068 usereentrant='undef'
1069 : full support for void wanted by default
1070 defvoidused=15
1071
1072 : List of libraries we want.
1073 : If anyone needs -lnet, put it in a hint file.
1074 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1075 libswanted="$libswanted dld ld sun m c cposix posix"
1076 libswanted="$libswanted ndir dir crypt sec"
1077 libswanted="$libswanted ucb bsd BSD PW x iconv util"
1078 : We probably want to search /usr/shlib before most other libraries.
1079 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1080 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1081 glibpth="/usr/shlib $glibpth"
1082 : Do not use vfork unless overridden by a hint file.
1083 usevfork=false
1084
1085 : Find the basic shell for Bourne shell scripts
1086 case "$sh" in
1087 '')
1088         case "$SYSTYPE" in
1089         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1090         *) xxx='/bin/sh';;
1091         esac
1092         if test -f "$xxx"; then
1093                 sh="$xxx"
1094         else
1095                 : Build up a list and do a single loop so we can 'break' out.
1096                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1097                 for xxx in sh bash ksh pdksh ash; do
1098                         for p in $pth; do
1099                                 try="$try ${p}/${xxx}"
1100                         done
1101                 done
1102                 for xxx in $try; do
1103                         if test -f "$xxx"; then
1104                                 sh="$xxx";
1105                                 break
1106                         elif test -f "$xxx.exe"; then
1107                                 sh="$xxx";
1108                                 break
1109                         fi
1110                 done
1111         fi
1112         ;;
1113 esac
1114
1115 case "$sh" in
1116 '')     cat <<EOM >&2
1117 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1118
1119 Usually it's in /bin/sh.  How did you even get this far?
1120 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1121 we'll try to straighten this all out.
1122 EOM
1123         exit 1
1124         ;;
1125 esac
1126
1127 : see if sh knows # comments
1128 if `$sh -c '#' >/dev/null 2>&1`; then
1129         shsharp=true
1130         spitshell=cat
1131         xcat=/bin/cat
1132         test -f $xcat || xcat=/usr/bin/cat
1133         echo "#!$xcat" >sharp
1134         $eunicefix sharp
1135         chmod +x sharp
1136         ./sharp > today
1137         if test -s today; then
1138                 sharpbang='#!'
1139         else
1140                 echo "#! $xcat" > sharp
1141                 $eunicefix sharp
1142                 chmod +x sharp
1143                 ./sharp > today
1144                 if test -s today; then
1145                         sharpbang='#! '
1146                 else
1147                         sharpbang=': use '
1148                 fi
1149         fi
1150 else
1151         echo " "
1152         echo "Your $sh doesn't grok # comments--I will strip them later on."
1153         shsharp=false
1154         cd ..
1155         echo "exec grep -v '^[  ]*#'" >spitshell
1156         chmod +x spitshell
1157         $eunicefix spitshell
1158         spitshell=`pwd`/spitshell
1159         cd UU
1160         echo "I presume that if # doesn't work, #! won't work either!"
1161         sharpbang=': use '
1162 fi
1163 rm -f sharp today
1164
1165 : figure out how to guarantee sh startup
1166 case "$startsh" in
1167 '') startsh=${sharpbang}${sh} ;;
1168 *)
1169 esac
1170 cat >sharp <<EOSS
1171 $startsh
1172 set abc
1173 test "$?abc" != 1
1174 EOSS
1175
1176 chmod +x sharp
1177 $eunicefix sharp
1178 if ./sharp; then
1179         : echo "Yup, it does."
1180 else
1181         echo "Hmm... '$startsh' does not guarantee sh startup..."
1182         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1183 fi
1184 rm -f sharp
1185
1186
1187 : Save command line options in file UU/cmdline.opt for later use in
1188 : generating config.sh.
1189 cat > cmdline.opt <<EOSH
1190 # Configure command line arguments.
1191 config_arg0='$0'
1192 config_args='$*'
1193 config_argc=$#
1194 EOSH
1195 argn=1
1196 args_exp=''
1197 args_sep=''
1198 for arg in "$@"; do
1199         cat >>cmdline.opt <<EOSH
1200 config_arg$argn='$arg'
1201 EOSH
1202         # Extreme backslashitis: replace each ' by '"'"'
1203         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1204 $arg
1205 EOC
1206         arg_exp=`cat cmdl.opt`
1207         args_exp="$args_exp$args_sep'$arg_exp'"
1208         argn=`expr $argn + 1`
1209         args_sep=' '
1210 done
1211 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1212 # used by ./hints/os2.sh
1213 rm -f cmdl.opt
1214
1215 : produce awk script to parse command line options
1216 cat >options.awk <<'EOF'
1217 BEGIN {
1218         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1219
1220         len = length(optstr);
1221         for (i = 1; i <= len; i++) {
1222                 c = substr(optstr, i, 1);
1223                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1224                 if (a == ":") {
1225                         arg[c] = 1;
1226                         i++;
1227                 }
1228                 opt[c] = 1;
1229         }
1230 }
1231 {
1232         expect = 0;
1233         str = $0;
1234         if (substr(str, 1, 1) != "-") {
1235                 printf("'%s'\n", str);
1236                 next;
1237         }
1238         len = length($0);
1239         for (i = 2; i <= len; i++) {
1240                 c = substr(str, i, 1);
1241                 if (!opt[c]) {
1242                         printf("-%s\n", substr(str, i));
1243                         next;
1244                 }
1245                 printf("-%s\n", c);
1246                 if (arg[c]) {
1247                         if (i < len)
1248                                 printf("'%s'\n", substr(str, i + 1));
1249                         else
1250                                 expect = 1;
1251                         next;
1252                 }
1253         }
1254 }
1255 END {
1256         if (expect)
1257                 print "?";
1258 }
1259 EOF
1260
1261 : process the command line options
1262 set X `for arg in "$@"; do echo "X$arg"; done |
1263         sed -e s/X// | awk -f options.awk`
1264 eval "set $*"
1265 shift
1266 rm -f options.awk
1267
1268 : set up default values
1269 fastread=''
1270 reuseval=false
1271 config_sh=''
1272 alldone=''
1273 error=''
1274 silent=''
1275 extractsh=''
1276 override=''
1277 knowitall=''
1278 rm -f optdef.sh posthint.sh
1279 cat >optdef.sh <<EOS
1280 $startsh
1281 EOS
1282
1283
1284 : option parsing
1285 while test $# -gt 0; do
1286         case "$1" in
1287         -d) shift; fastread=yes;;
1288         -e) shift; alldone=cont;;
1289         -f)
1290                 shift
1291                 cd ..
1292                 if test -r "$1"; then
1293                         config_sh="$1"
1294                 else
1295                         echo "$me: cannot read config file $1." >&2
1296                         error=true
1297                 fi
1298                 cd UU
1299                 shift;;
1300         -h) shift; error=true;;
1301         -r) shift; reuseval=true;;
1302         -s) shift; silent=true; realsilent=true;;
1303         -E) shift; alldone=exit;;
1304         -K) shift; knowitall=true;;
1305         -O) shift; override=true;;
1306         -S) shift; silent=true; extractsh=true;;
1307         -D)
1308                 shift
1309                 case "$1" in
1310                 *=)
1311                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1312                         echo "$me: ignoring -D $1" >&2
1313                         ;;
1314                 *=*) echo "$1" | \
1315                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1316                 *) echo "$1='define'" >> optdef.sh;;
1317                 esac
1318                 shift
1319                 ;;
1320         -U)
1321                 shift
1322                 case "$1" in
1323                 *=) echo "$1" >> optdef.sh;;
1324                 *=*)
1325                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1326                         echo "$me: ignoring -U $1" >&2
1327                         ;;
1328                 *) echo "$1='undef'" >> optdef.sh;;
1329                 esac
1330                 shift
1331                 ;;
1332         -A)
1333             shift
1334             xxx=''
1335             yyy="$1"
1336             zzz=''
1337             uuu=undef
1338             case "$yyy" in
1339             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1340                  case "$zzz" in
1341                  *:*) zzz='' ;;
1342                  *)   xxx=append
1343                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1344                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1345                  esac
1346                  ;;
1347             esac
1348             case "$xxx" in
1349             '')  case "$yyy" in
1350                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1351                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1352                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1353                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1354                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1355                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1356                  esac
1357                  ;;       
1358             esac
1359             case "$xxx" in
1360             append)
1361                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1362             clear)
1363                 echo "$yyy=''"                  >> posthint.sh ;;
1364             define)
1365                 case "$zzz" in
1366                 '') zzz=define ;;
1367                 esac
1368                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1369             eval)
1370                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1371             prepend)
1372                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1373             undef)
1374                 case "$zzz" in
1375                 '') zzz="$uuu" ;;
1376                 esac
1377                 echo "$yyy=$zzz"                >> posthint.sh ;;
1378             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1379             esac
1380             shift
1381             ;;
1382         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1383             exit 0;;
1384         --) break;;
1385         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1386         *) break;;
1387         esac
1388 done
1389
1390 case "$error" in
1391 true)
1392         cat >&2 <<EOM
1393 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1394                  [-U symbol] [-U symbol=] [-A command:symbol...]
1395   -d : use defaults for all answers.
1396   -e : go on without questioning past the production of config.sh.
1397   -f : specify an alternate default configuration file.
1398   -h : print this help message and exit (with an error status).
1399   -r : reuse C symbols value if possible (skips costly nm extraction).
1400   -s : silent mode, only echoes questions and essential information.
1401   -D : define symbol to have some value:
1402          -D symbol         symbol gets the value 'define'
1403          -D symbol=value   symbol gets the value 'value'
1404   -E : stop at the end of questions, after having produced config.sh.
1405   -K : do not use unless you know what you are doing.
1406   -O : let -D and -U override definitions from loaded configuration file.
1407   -S : perform variable substitutions on all .SH files (can mix with -f)
1408   -U : undefine symbol:
1409          -U symbol    symbol gets the value 'undef'
1410          -U symbol=   symbol gets completely empty
1411   -A : manipulate symbol after the platform specific hints have been applied:
1412          -A symbol=value                append " "value to symbol
1413          -A append:symbol=value         append value to symbol
1414          -A define:symbol=value         define symbol to have value
1415          -A clear:symbol                define symbol to be ''
1416          -A define:symbol               define symbol to be 'define'
1417          -A eval:symbol=value           define symbol to be eval of value
1418          -A prepend:symbol=value        prepend value to symbol
1419          -A undef:symbol                define symbol to be 'undef'
1420          -A undef:symbol=               define symbol to be ''
1421   -V : print version number and exit (with a zero status).
1422 EOM
1423         exit 1
1424         ;;
1425 esac
1426
1427 : Sanity checks
1428 case "$fastread$alldone" in
1429 yescont|yesexit) ;;
1430 *)
1431         case "$extractsh" in
1432         true) ;;
1433         *)
1434                 if test ! -t 0; then
1435                         echo "Say 'sh Configure', not 'sh <Configure'"
1436                         exit 1
1437                 fi
1438                 ;;
1439         esac
1440         ;;
1441 esac
1442
1443 exec 4>&1
1444 case "$silent" in
1445 true) exec 1>/dev/null;;
1446 esac
1447
1448 : run the defines and the undefines, if any, but leave the file out there...
1449 touch optdef.sh
1450 . ./optdef.sh
1451 : create the posthint manipulation script and leave the file out there...
1452 touch posthint.sh
1453
1454 : set package name
1455 package=perl5
1456 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1457 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1458 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1459 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1460 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1461 esac
1462
1463 : Some greps do not return status, grrr.
1464 echo "grimblepritz" >grimble
1465 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1466         contains=contains
1467 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1468         contains=grep
1469 else
1470         contains=contains
1471 fi
1472 rm -f grimble
1473 : the following should work in any shell
1474 case "$contains" in
1475 contains*)
1476         echo " "
1477         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1478         cat >contains <<'EOSS'
1479 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1480 EOSS
1481 chmod +x contains
1482 esac
1483
1484 : Find the path to the source tree
1485 case "$src" in
1486 '') case "$0" in
1487     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1488          case "$src" in
1489          /*)    ;;
1490          .)     ;;
1491          *)     src=`cd ../$src && pwd` ;;
1492          esac
1493          ;;
1494     *)   src='.';;
1495     esac;;
1496 esac
1497 case "$src" in
1498 '')     src=/
1499         rsrc=/
1500         ;;
1501 /*) rsrc="$src";;
1502 *) rsrc="../$src";;
1503 esac
1504 if test -f $rsrc/Configure && \
1505         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1506 then
1507    : found it, so we are ok.
1508 else
1509         rsrc=''
1510         for src in . .. ../.. ../../.. ../../../..; do
1511                 if test -f ../$src/Configure && \
1512                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1513                 then
1514                         rsrc=../$src
1515                         break
1516                 fi
1517         done
1518 fi
1519 case "$rsrc" in
1520 '')
1521         cat <<EOM >&4
1522
1523 Sorry, I can't seem to locate the source dir for $package.  Please start
1524 Configure with an explicit path -- i.e. /some/path/Configure.
1525
1526 EOM
1527         exit 1
1528         ;;
1529 ../.)   rsrc='..';;
1530 *)
1531         echo " "
1532         echo "Sources for $package found in \"$src\"." >&4
1533         ;;
1534 esac
1535
1536 : script used to extract .SH files with variable substitutions
1537 cat >extract <<'EOS'
1538 PERL_CONFIG_SH=true
1539 echo "Doing variable substitutions on .SH files..."
1540 if test -f MANIFEST; then
1541         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1542 else
1543         echo "(Looking for .SH files under the source directory.)"
1544         set x `(cd $src; find . -name "*.SH" -print)`
1545 fi
1546 shift
1547 case $# in
1548 0) set x `(cd $src; echo *.SH)`; shift;;
1549 esac
1550 if test ! -f $src/$1; then
1551         shift
1552 fi
1553 mkdir_p='
1554 name=$1;
1555 create="";
1556 while test $name; do
1557         if test ! -d "$name"; then
1558                 create="$name $create";
1559                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1560                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1561         else
1562                 name="";
1563         fi;
1564 done;
1565 for file in $create; do
1566         mkdir $file;
1567 done
1568 '
1569 for file in $*; do
1570         case "$src" in
1571         ".")
1572                 case "$file" in
1573                 */*)
1574                         dir=`expr X$file : 'X\(.*\)/'`
1575                         file=`expr X$file : 'X.*/\(.*\)'`
1576                         (cd $dir && . ./$file)
1577                         ;;
1578                 *)
1579                         . ./$file
1580                         ;;
1581                 esac
1582                 ;;
1583         *)
1584                 case "$file" in
1585                 */*)
1586                         dir=`expr X$file : 'X\(.*\)/'`
1587                         file=`expr X$file : 'X.*/\(.*\)'`
1588                         (set x $dir; shift; eval $mkdir_p)
1589                         sh <$src/$dir/$file
1590                         ;;
1591                 *)
1592                         sh <$src/$file
1593                         ;;
1594                 esac
1595                 ;;
1596         esac
1597 done
1598 if test -f $src/config_h.SH; then
1599         if test ! -f config.h; then
1600         : oops, they left it out of MANIFEST, probably, so do it anyway.
1601         . $src/config_h.SH
1602         fi
1603 fi
1604 EOS
1605
1606 : extract files and exit if asked to do so
1607 case "$extractsh" in
1608 true)
1609         case "$realsilent" in
1610         true) ;;
1611         *) exec 1>&4;;
1612         esac
1613         case "$config_sh" in
1614         '') config_sh='config.sh';;
1615         esac
1616         echo " "
1617         echo "Fetching answers from $config_sh..."
1618         cd ..
1619         . $config_sh
1620         test "$override" && . ./optdef.sh
1621         echo " "
1622         . UU/extract
1623         rm -rf UU
1624         echo "Extraction done."
1625         exit 0
1626         ;;
1627 esac
1628
1629 : Eunice requires " " instead of "", can you believe it
1630 echo " "
1631 : Here we go...
1632 echo "Beginning of configuration questions for $package."
1633
1634 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1635
1636 : first determine how to suppress newline on echo command
1637 echo " "
1638 echo "Checking echo to see how to suppress newlines..."
1639 (echo "hi there\c" ; echo " ") >.echotmp
1640 if $contains c .echotmp >/dev/null 2>&1 ; then
1641         echo "...using -n."
1642         n='-n'
1643         c=''
1644 else
1645         cat <<'EOM'
1646 ...using \c
1647 EOM
1648         n=''
1649         c='\c'
1650 fi
1651 echo $n "The star should be here-->$c"
1652 echo '*'
1653 rm -f .echotmp
1654
1655 : Now test for existence of everything in MANIFEST
1656 echo " "
1657 if test -f $rsrc/MANIFEST; then
1658         echo "First let's make sure your kit is complete.  Checking..." >&4
1659         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1660         rm -f missing
1661         tmppwd=`pwd`
1662         for filelist in x??; do
1663                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1664         done
1665         if test -s missing; then
1666                 cat missing >&4
1667                 cat >&4 <<'EOM'
1668
1669 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1670
1671 You have the option of continuing the configuration process, despite the
1672 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1673 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1674 and contact the author (perlbug@perl.org).
1675
1676 EOM
1677                 echo $n "Continue? [n] $c" >&4
1678                 read ans
1679                 case "$ans" in
1680                 y*)
1681                         echo "Continuing..." >&4
1682                         rm -f missing
1683                         ;;
1684                 *)
1685                         echo "ABORTING..." >&4
1686                         kill $$
1687                         ;;
1688                 esac
1689         else
1690                 echo "Looks good..."
1691         fi
1692 else
1693         echo "There is no MANIFEST file.  I hope your kit is complete !"
1694 fi
1695 rm -f missing x??
1696
1697 echo " "
1698 : Find the appropriate value for a newline for tr
1699 if test -n "$DJGPP"; then
1700        trnl='\012'
1701 fi
1702 if test X"$trnl" = X; then
1703         case "`echo foo|tr '\n' x 2>/dev/null`" in
1704         foox) trnl='\n' ;;
1705         esac
1706 fi
1707 if test X"$trnl" = X; then
1708         case "`echo foo|tr '\012' x 2>/dev/null`" in
1709         foox) trnl='\012' ;;
1710         esac
1711 fi
1712 if test X"$trnl" = X; then
1713         cat <<EOM >&2
1714
1715 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1716
1717 EOM
1718         exit 1
1719 fi
1720
1721 : compute the number of columns on the terminal for proper question formatting
1722 case "$COLUMNS" in
1723 '') COLUMNS='80';;
1724 esac
1725
1726 : set up the echo used in my read
1727 myecho="case \"\$xxxm\" in
1728 '') echo $n \"\$rp $c\" >&4;;
1729 *) case \"\$rp\" in
1730         '') echo $n \"[\$xxxm] $c\";;
1731         *)
1732                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1733                         echo \"\$rp\" >&4
1734                         echo $n \"[\$xxxm] $c\" >&4
1735                 else
1736                         echo $n \"\$rp [\$xxxm] $c\" >&4
1737                 fi
1738                 ;;
1739         esac;;
1740 esac"
1741
1742 : now set up to do reads with possible shell escape and default assignment
1743 cat <<EOSC >myread
1744 $startsh
1745 xxxm=\$dflt
1746 $myecho
1747 ans='!'
1748 case "\$fastread" in
1749 yes) case "\$dflt" in
1750         '') ;;
1751         *) ans='';
1752                 case "\$silent-\$rp" in
1753                 true-) ;;
1754                 *) echo " " >&4;;
1755                 esac;;
1756         esac;;
1757 *) case "\$silent" in
1758         true) case "\$rp" in
1759                 '') ans='';;
1760                 esac;;
1761         esac;;
1762 esac
1763 while expr "X\$ans" : "X!" >/dev/null; do
1764         read answ
1765         set x \$xxxm
1766         shift
1767         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1768         case  "\$answ" in
1769         "!")
1770                 sh 1>&4
1771                 echo " "
1772                 $myecho
1773                 ;;
1774         !*)
1775                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1776                 shift
1777                 sh 1>&4 -c "\$*"
1778                 echo " "
1779                 $myecho
1780                 ;;
1781         "\$ans")
1782                 case "\$ans" in
1783                 \\&*)
1784                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1785                         shift
1786                         case "\$1" in
1787                         -d)
1788                                 fastread=yes
1789                                 echo "(OK, I'll run with -d after this question.)" >&4
1790                                 ;;
1791                         -*)
1792                                 echo "*** Sorry, \$1 not supported yet." >&4
1793                                 ;;
1794                         esac
1795                         $myecho
1796                         ans=!
1797                         ;;
1798                 esac;;
1799         *)
1800                 case "\$aok" in
1801                 y)
1802                         echo "*** Substitution done -- please confirm."
1803                         xxxm="\$ans"
1804                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1805                         xxxm="\$ans"
1806                         ans=!
1807                         ;;
1808                 *)
1809                         echo "*** Error -- try again."
1810                         ans=!
1811                         ;;
1812                 esac
1813                 $myecho
1814                 ;;
1815         esac
1816         case "\$ans\$xxxm\$nostick" in
1817         '')
1818                 ans=!
1819                 $myecho
1820                 ;;
1821         esac
1822 done
1823 case "\$ans" in
1824 '') ans="\$xxxm";;
1825 esac
1826 EOSC
1827
1828 : create .config dir to save info across Configure sessions
1829 test -d ../.config || mkdir ../.config
1830 cat >../.config/README <<EOF
1831 This directory created by Configure to save information that should
1832 persist across sessions for $package.
1833
1834 You may safely delete it if you wish.
1835 EOF
1836
1837 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1838 case "$usedevel" in
1839 $define|true|[yY]*) ;;
1840 *) case "$xversion" in
1841    *[13579])
1842         cat >&4 <<EOH
1843 *** WHOA THERE!!! ***
1844
1845     This is an UNSTABLE DEVELOPMENT release.
1846     The version of this $package distribution is $xversion, that is, odd,
1847     (as opposed to even) and that signifies a development release.
1848     If you want a maintenance release, you want an even-numbered version.
1849
1850     Do ***NOT*** install this into production use.
1851     Data corruption and crashes are possible.
1852
1853     It is most seriously suggested that you do not continue any further
1854     unless you want to help in developing and debugging Perl.
1855
1856     If you *still* want to build perl, you can answer 'y' now,
1857     or pass -Dusedevel to Configure.
1858
1859 EOH
1860         rp='Do you really want to continue?'
1861         dflt='n'
1862         . ./myread
1863         case "$ans" in
1864         [yY]) echo >&4 "Okay, continuing."
1865               usedevel="$define" ;;
1866         *) echo >&4 "Okay, bye."
1867            exit 1
1868            ;;
1869         esac
1870         ;;
1871     esac
1872     ;;
1873 esac
1874 case "$usedevel" in
1875 $define|true|[yY]*)
1876         case "$versiononly" in
1877         '') versiononly="$define" ;;
1878         esac
1879         case "$installusrbinperl" in
1880         '') installusrbinperl="$undef" ;;
1881         esac
1882         ;;
1883 esac
1884
1885 : general instructions
1886 needman=true
1887 firsttime=true
1888 user=`(logname) 2>/dev/null`
1889 case "$user" in
1890 '') user=`whoami 2>&1`;;
1891 esac
1892 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1893         firsttime=false
1894         echo " "
1895         rp='Would you like to see the instructions?'
1896         dflt=n
1897         . ./myread
1898         case "$ans" in
1899         [yY]*) ;;
1900         *) needman=false;;
1901         esac
1902 fi
1903 if $needman; then
1904         cat <<EOH
1905
1906 This installation shell script will examine your system and ask you questions
1907 to determine how the perl5 package should be installed. If you get
1908 stuck on a question, you may use a ! shell escape to start a subshell or
1909 execute a command.  Many of the questions will have default answers in square
1910 brackets; typing carriage return will give you the default.
1911
1912 On some of the questions which ask for file or directory names you are allowed
1913 to use the ~name construct to specify the login directory belonging to "name",
1914 even if you don't have a shell which knows about that.  Questions where this is
1915 allowed will be marked "(~name ok)".
1916
1917 EOH
1918         rp=''
1919         dflt='Type carriage return to continue'
1920         . ./myread
1921         cat <<'EOH'
1922
1923 The prompter used in this script allows you to use shell variables and
1924 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1925 in the default answer, as if the default line was a set of arguments given to a
1926 script shell.  This means you may also use $* to repeat the whole default line,
1927 so you do not have to re-type everything to add something to the default.
1928
1929 Everytime there is a substitution, you will have to confirm.  If there is an
1930 error (e.g. an unmatched backtick), the default answer will remain unchanged
1931 and you will be prompted again.
1932
1933 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1934 the questions and use the computed defaults (or the previous answers if there
1935 was already a config.sh file). Type 'Configure -h' for a list of options.
1936 You may also start interactively and then answer '& -d' at any prompt to turn
1937 on the non-interactive behaviour for the remainder of the execution.
1938
1939 EOH
1940         . ./myread
1941         cat <<EOH
1942
1943 Much effort has been expended to ensure that this shell script will run on any
1944 Unix system.  If despite that it blows up on yours, your best bet is to edit
1945 Configure and run it again.  If you can't run Configure for some reason,
1946 you'll have to generate a config.sh file by hand.  Whatever problems you
1947 have, let me (perlbug@perl.org) know how I blew it.
1948
1949 This installation script affects things in two ways:
1950
1951 1) it may do direct variable substitutions on some of the files included
1952    in this kit.
1953 2) it builds a config.h file for inclusion in C programs.  You may edit
1954    any of these files as the need arises after running this script.
1955
1956 If you make a mistake on a question, there is no easy way to back up to it
1957 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1958 files.  Configure will offer to let you do this before it runs the SH files.
1959
1960 EOH
1961         dflt='Type carriage return to continue'
1962         . ./myread
1963         case "$firsttime" in
1964         true) echo $user >>../.config/instruct;;
1965         esac
1966 fi
1967
1968 : find out where common programs are
1969 echo " "
1970 echo "Locating common programs..." >&4
1971 cat <<EOSC >loc
1972 $startsh
1973 case \$# in
1974 0) exit 1;;
1975 esac
1976 thing=\$1
1977 shift
1978 dflt=\$1
1979 shift
1980 for dir in \$*; do
1981         case "\$thing" in
1982         .)
1983         if test -d \$dir/\$thing; then
1984                 echo \$dir
1985                 exit 0
1986         fi
1987         ;;
1988         *)
1989         for thisthing in \$dir/\$thing; do
1990                 : just loop through to pick last item
1991         done
1992         if test -f \$thisthing; then
1993                 echo \$thisthing
1994                 exit 0
1995         elif test -f \$dir/\$thing.exe; then
1996                 if test -n "$DJGPP"; then
1997                         echo \$dir/\$thing.exe
1998                 else
1999                         : on Eunice apparently
2000                         echo \$dir/\$thing
2001                 fi
2002                 exit 0
2003         fi
2004         ;;
2005         esac
2006 done
2007 echo \$dflt
2008 exit 1
2009 EOSC
2010 chmod +x loc
2011 $eunicefix loc
2012 loclist="
2013 awk
2014 cat
2015 chmod
2016 comm
2017 cp
2018 echo
2019 expr
2020 grep
2021 ls
2022 make
2023 mkdir
2024 rm
2025 sed
2026 sort
2027 touch
2028 tr
2029 uniq
2030 "
2031 trylist="
2032 Mcc
2033 ar
2034 bison
2035 byacc
2036 cpp
2037 csh
2038 date
2039 egrep
2040 gzip
2041 less
2042 ln
2043 more
2044 nm
2045 nroff
2046 pg
2047 test
2048 uname
2049 zip
2050 "
2051 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2052 pth="$pth /lib /usr/lib"
2053 for file in $loclist; do
2054         eval xxx=\$$file
2055         case "$xxx" in
2056         /*|?:[\\/]*)
2057                 if test -f "$xxx"; then
2058                         : ok
2059                 else
2060                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2061                         xxx=`./loc $file $file $pth`
2062                 fi
2063                 ;;
2064         '') xxx=`./loc $file $file $pth`;;
2065         *) xxx=`./loc $xxx $xxx $pth`;;
2066         esac
2067         eval $file=$xxx
2068         eval _$file=$xxx
2069         case "$xxx" in
2070         /*)
2071                 echo $file is in $xxx.
2072                 ;;
2073         ?:[\\/]*)
2074                 echo $file is in $xxx.
2075                 ;;
2076         *)
2077                 echo "I don't know where '$file' is, and my life depends on it." >&4
2078                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2079                 exit 1
2080                 ;;
2081         esac
2082 done
2083 echo " "
2084 echo "Don't worry if any of the following aren't found..."
2085 say=offhand
2086 for file in $trylist; do
2087         eval xxx=\$$file
2088         case "$xxx" in
2089         /*|?:[\\/]*)
2090                 if test -f "$xxx"; then
2091                         : ok
2092                 else
2093                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2094                         xxx=`./loc $file $file $pth`
2095                 fi
2096                 ;;
2097         '') xxx=`./loc $file $file $pth`;;
2098         *) xxx=`./loc $xxx $xxx $pth`;;
2099         esac
2100         eval $file=$xxx
2101         eval _$file=$xxx
2102         case "$xxx" in
2103         /*)
2104                 echo $file is in $xxx.
2105                 ;;
2106         ?:[\\/]*)
2107                 echo $file is in $xxx.
2108                 ;;
2109         *)
2110                 echo "I don't see $file out there, $say."
2111                 say=either
2112                 ;;
2113         esac
2114 done
2115 case "$egrep" in
2116 egrep)
2117         echo "Substituting grep for egrep."
2118         egrep=$grep
2119         ;;
2120 esac
2121 case "$ln" in
2122 ln)
2123         echo "Substituting cp for ln."
2124         ln=$cp
2125         ;;
2126 esac
2127 case "$test" in
2128 test)
2129         echo "Hopefully test is built into your sh."
2130         ;;
2131 *)
2132         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2133                 echo "Using the test built into your sh."
2134                 test=test
2135                 _test=test
2136         fi
2137         ;;
2138 esac
2139 case "$echo" in
2140 echo)
2141         echo "Hopefully echo is built into your sh."
2142         ;;
2143 '') ;;
2144 *)
2145         echo " "
2146 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2147         $echo $n "hi there$c" >foo1
2148         echo $n "hi there$c" >foo2
2149         if cmp foo1 foo2 >/dev/null 2>&1; then
2150                 echo "They are compatible.  In fact, they may be identical."
2151         else
2152                 case "$n" in
2153                 '-n') n='' c='\c';;
2154                 *) n='-n' c='';;
2155                 esac
2156                 cat <<FOO
2157 They are not compatible!  You are probably running ksh on a non-USG system.
2158 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2159 have echo built in and we may have to run some Bourne shell scripts.  That
2160 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2161
2162 FOO
2163                 $echo $n "The star should be here-->$c"
2164                 $echo "*"
2165         fi
2166         $rm -f foo1 foo2
2167         ;;
2168 esac
2169
2170 cat <<EOS >checkcc
2171 $startsh
2172 EOS
2173 cat <<'EOSC' >>checkcc
2174 case "$cc" in
2175 '') ;;
2176 *)  $rm -f try try.*
2177     $cat >try.c <<EOM
2178 int main(int argc, char *argv[]) {
2179   return 0;
2180 }
2181 EOM
2182     if $cc -o try $ccflags $ldflags try.c; then
2183        :
2184     else
2185         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2186         despair=yes
2187         trygcc=yes
2188         case "$cc" in
2189         *gcc*) trygcc=no ;;
2190         esac
2191         case "`$cc -v -c try.c 2>&1`" in
2192         *gcc*) trygcc=no ;;
2193         esac
2194         if $test X"$trygcc" = Xyes; then
2195             if gcc -o try -c try.c; then
2196                 echo " "
2197                 echo "You seem to have a working gcc, though." >&4
2198                 rp="Would you like to use it?"
2199                 dflt=y
2200                 if $test -f myread; then
2201                     . ./myread
2202                 else
2203                     if $test -f UU/myread; then
2204                         . ./UU/myread
2205                     else
2206                         echo "Cannot find myread, sorry.  Aborting." >&2
2207                         exit 1
2208                     fi
2209                 fi  
2210                 case "$ans" in
2211                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2212                 esac
2213             fi
2214         fi
2215         if $test X"$despair" = Xyes; then
2216             $cat >&4 <<EOM
2217 You need to find a working C compiler.
2218 Either (purchase and) install the C compiler supplied by your OS vendor,
2219 or for a free C compiler try http://gcc.gnu.org/
2220 I cannot continue any further, aborting.
2221 EOM
2222             exit 1
2223         fi
2224     fi
2225     $rm -f try try.*
2226     ;;
2227 esac
2228 EOSC
2229
2230 : determine whether symbolic links are supported
2231 echo " "
2232 $touch blurfl
2233 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2234         echo "Symbolic links are supported." >&4
2235         lns="$ln -s"
2236 else
2237         echo "Symbolic links are NOT supported." >&4
2238         lns="$ln"
2239 fi
2240 $rm -f blurfl sym
2241
2242 : determine whether symbolic links are supported
2243 echo " "
2244 case "$lns" in
2245 *"ln -s")
2246         echo "Checking how to test for symbolic links..." >&4
2247         $lns blurfl sym
2248         if $test "X$issymlink" = X; then
2249                 sh -c "PATH= test -h sym" >/dev/null 2>&1
2250                 if test $? = 0; then
2251                         issymlink="test -h"
2252                 fi              
2253         fi
2254         if $test "X$issymlink" = X; then
2255                 if  $test -h >/dev/null 2>&1; then
2256                         issymlink="$test -h"
2257                         echo "Your builtin 'test -h' may be broken, I'm using external '$test -h'." >&4
2258                 fi              
2259         fi
2260         if $test "X$issymlink" = X; then
2261                 if $test -L sym 2>/dev/null; then
2262                         issymlink="$test -L"
2263                 fi
2264         fi
2265         if $test "X$issymlink" != X; then
2266                 echo "You can test for symbolic links with '$issymlink'." >&4
2267         else
2268                 echo "I do not know how you can test for symbolic links." >&4
2269         fi
2270         $rm -f blurfl sym
2271         ;;
2272 *)      echo "No symbolic links, so not testing for their testing..." >&4
2273         ;;
2274 esac
2275 echo " "
2276
2277
2278 case "$mksymlinks" in
2279 $define|true|[yY]*)
2280         case "$src" in
2281         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2282                 exit 1
2283                 ;;
2284         *)      case "$lns:$issymlink" in
2285                 *"ln -s:"*"test -"?)
2286                         echo "Creating the symbolic links..." >&4
2287                         echo "(First creating the subdirectories...)" >&4
2288                         cd ..
2289                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2290                                 read directory
2291                                 test -z "$directory" && break
2292                                 mkdir -p $directory
2293                         done
2294                         # Sanity check 1.
2295                         if test ! -d t/base; then
2296                                 echo "Failed to create the subdirectories.  Aborting." >&4
2297                                 exit 1
2298                         fi
2299                         echo "(Then creating the symlinks...)" >&4
2300                         awk '{print $1}' $src/MANIFEST | while true; do
2301                                 read filename
2302                                 test -z "$filename" && break
2303                                 if test -f $filename; then
2304                                         if $issymlink $filename; then
2305                                                 rm -f $filename
2306                                         fi
2307                                 fi
2308                                 if test -f $filename; then
2309                                         echo "$filename already exists, not symlinking."
2310                                 else
2311                                         ln -s $src/$filename $filename
2312                                 fi
2313                         done
2314                         # Sanity check 2.
2315                         if test ! -f t/base/commonsense.t; then
2316                                 echo "Failed to create the symlinks.  Aborting." >&4
2317                                 exit 1
2318                         fi
2319                         cd UU
2320                         ;;
2321                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2322                         ;;
2323                 esac
2324                 ;;
2325         esac
2326         ;;
2327 esac
2328
2329
2330 case "$usecrosscompile" in
2331 $define|true|[yY]*)
2332         $echo "Cross-compiling..."
2333         croak=''
2334         case "$cc" in
2335         *-*-gcc) # A cross-compiling gcc, probably.
2336             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2337             ar=$targetarch-ar
2338             # leave out ld, choosing it is more complex
2339             nm=$targetarch-nm
2340             ranlib=$targetarch-ranlib
2341             $echo 'extern int foo;' > try.c
2342             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2343             shift
2344             if $test $# -gt 0; then
2345                 incpth="$incpth $*"
2346                 incpth="`$echo $incpth|$sed 's/^ //'`"
2347                 echo "Guessing incpth '$incpth'." >&4
2348                 for i in $*; do
2349                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2350                     if $test -d $j; then
2351                         libpth="$libpth $j"
2352                     fi
2353                 done   
2354                 libpth="`$echo $libpth|$sed 's/^ //'`"
2355                 echo "Guessing libpth '$libpth'." >&4
2356             fi
2357             $rm -f try.c
2358             ;;
2359         esac
2360         case "$targetarch" in
2361         '') echo "Targetarch not defined." >&4; croak=y ;;
2362         *)  echo "Using targetarch $targetarch." >&4 ;;
2363         esac
2364         case "$incpth" in
2365         '') echo "Incpth not defined." >&4; croak=y ;;
2366         *)  echo "Using incpth '$incpth'." >&4 ;;
2367         esac
2368         case "$libpth" in
2369         '') echo "Libpth not defined." >&4; croak=y ;;
2370         *)  echo "Using libpth '$libpth'." >&4 ;;
2371         esac
2372         case "$usrinc" in
2373         '') for i in $incpth; do
2374                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2375                     usrinc=$i
2376                     echo "Guessing usrinc $usrinc." >&4
2377                     break
2378                 fi
2379             done
2380             case "$usrinc" in
2381             '') echo "Usrinc not defined." >&4; croak=y ;;
2382             esac
2383             ;;
2384         *)  echo "Using usrinc $usrinc." >&4 ;;
2385         esac
2386         case "$targethost" in
2387         '') echo "Targethost not defined." >&4; croak=y ;;
2388         *)  echo "Using targethost $targethost." >&4
2389         esac
2390         locincpth=' '
2391         loclibpth=' '
2392         case "$croak" in
2393         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2394         esac
2395         case "$src" in
2396         /*) run=$src/Cross/run
2397             targetmkdir=$src/Cross/mkdir
2398             to=$src/Cross/to
2399             from=$src/Cross/from
2400             ;;
2401         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2402             run=$pwd/Cross/run
2403             targetmkdir=$pwd/Cross/mkdir
2404             to=$pwd/Cross/to
2405             from=$pwd/Cross/from
2406             ;;
2407         esac
2408         case "$targetrun" in
2409         '') targetrun=ssh ;;
2410         esac
2411         case "$targetto" in
2412         '') targetto=scp ;;
2413         esac
2414         case "$targetfrom" in
2415         '') targetfrom=scp ;;
2416         esac
2417         run=$run-$targetrun
2418         to=$to-$targetto
2419         from=$from-$targetfrom
2420         case "$targetdir" in
2421         '')  targetdir=/tmp
2422              echo "Guessing targetdir $targetdir." >&4
2423              ;;
2424         esac
2425         case "$targetuser" in
2426         '')  targetuser=root
2427              echo "Guessing targetuser $targetuser." >&4
2428              ;;
2429         esac
2430         case "$targetfrom" in
2431         scp)    q=-q ;;
2432         *)      q='' ;;
2433         esac
2434         case "$targetrun" in
2435         ssh|rsh)
2436             cat >$run <<EOF
2437 #!/bin/sh
2438 case "\$1" in
2439 -cwd)
2440   shift
2441   cwd=\$1
2442   shift
2443   ;;
2444 esac
2445 case "\$cwd" in
2446 '') cwd=$targetdir ;;
2447 esac
2448 exe=\$1
2449 shift
2450 if $test ! -f \$exe.xok; then
2451   $to \$exe
2452   $touch \$exe.xok
2453 fi
2454 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2455 EOF
2456             ;;
2457         *)  echo "Unknown targetrun '$targetrun'" >&4
2458             exit 1
2459             ;;
2460         esac
2461         case "$targetmkdir" in
2462         */Cross/mkdir)
2463             cat >$targetmkdir <<EOF
2464 #!/bin/sh
2465 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2466 EOF
2467             $chmod a+rx $targetmkdir
2468             ;;
2469         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2470             exit 1
2471             ;;
2472         esac
2473         case "$targetto" in
2474         scp|rcp)
2475             cat >$to <<EOF
2476 #!/bin/sh
2477 for f in \$@
2478 do
2479   case "\$f" in
2480   /*)
2481     $targetmkdir \`dirname \$f\`
2482     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2483     ;;
2484   *)
2485     $targetmkdir $targetdir/\`dirname \$f\`
2486     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2487     ;;
2488   esac
2489 done
2490 exit 0
2491 EOF
2492             ;;
2493         cp) cat >$to <<EOF
2494 #!/bin/sh
2495 for f in \$@
2496 do
2497   case "\$f" in
2498   /*)
2499     $mkdir -p $targetdir/\`dirname \$f\`
2500     $cp \$f $targetdir/\$f || exit 1
2501     ;;
2502   *)
2503     $targetmkdir $targetdir/\`dirname \$f\`
2504     $cp \$f $targetdir/\$f || exit 1
2505     ;;
2506   esac
2507 done
2508 exit 0
2509 EOF
2510             ;;
2511         *)  echo "Unknown targetto '$targetto'" >&4
2512             exit 1
2513             ;;
2514         esac
2515         case "$targetfrom" in
2516         scp|rcp)
2517           cat >$from <<EOF
2518 #!/bin/sh
2519 for f in \$@
2520 do
2521   $rm -f \$f
2522   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2523 done
2524 exit 0
2525 EOF
2526             ;;
2527         cp) cat >$from <<EOF
2528 #!/bin/sh
2529 for f in \$@
2530 do
2531   $rm -f \$f
2532   cp $targetdir/\$f . || exit 1
2533 done
2534 exit 0
2535 EOF
2536             ;;
2537         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2538             exit 1
2539             ;;
2540         esac
2541         if $test ! -f $run; then
2542             echo "Target 'run' script '$run' not found." >&4
2543         else
2544             $chmod a+rx $run
2545         fi
2546         if $test ! -f $to; then
2547             echo "Target 'to' script '$to' not found." >&4
2548         else
2549             $chmod a+rx $to
2550         fi
2551         if $test ! -f $from; then
2552             echo "Target 'from' script '$from' not found." >&4
2553         else
2554             $chmod a+rx $from
2555         fi
2556         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2557             exit 1
2558         fi
2559         cat >&4 <<EOF
2560 Using '$run' for remote execution,
2561 and '$from' and '$to'
2562 for remote file transfer.
2563 EOF
2564         ;;
2565 *)      run=''
2566         to=:
2567         from=:
2568         usecrosscompile='undef'
2569         targetarch=''
2570         ;;
2571 esac
2572
2573 : see whether [:lower:] and [:upper:] are supported character classes
2574 echo " "
2575 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2576 ABYZ)
2577         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2578         up='[:upper:]'
2579         low='[:lower:]'
2580         ;;
2581 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2582         # (0xc9 and 0xd1), therefore that is a nice testing point.
2583         if test "X$up" = X -o "X$low" = X; then
2584             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2585             ij) up='[A-Z]'
2586                 low='[a-z]'
2587                 ;;
2588             esac
2589         fi
2590         if test "X$up" = X -o "X$low" = X; then
2591             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2592             ij) up='A-Z'
2593                 low='a-z'
2594                 ;;
2595             esac
2596         fi
2597         if test "X$up" = X -o "X$low" = X; then
2598             case "`echo IJ | od -x 2>/dev/null`" in
2599             *C9D1*|*c9d1*)
2600                 echo "Hey, this might be EBCDIC." >&4
2601                 if test "X$up" = X -o "X$low" = X; then
2602                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2603                     ij) up='[A-IJ-RS-Z]'
2604                         low='[a-ij-rs-z]'
2605                         ;;
2606                     esac
2607                 fi
2608                 if test "X$up" = X -o "X$low" = X; then
2609                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2610                     ij) up='A-IJ-RS-Z'
2611                         low='a-ij-rs-z'
2612                         ;;
2613                     esac
2614                 fi
2615                 ;;
2616             esac
2617         fi
2618 esac
2619 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2620 ij)
2621     echo "Using $up and $low to convert case." >&4
2622     ;;
2623 *)
2624     echo "I don't know how to translate letters from upper to lower case." >&4
2625     echo "Your tr is not acting any way I know of." >&4
2626     exit 1
2627     ;;
2628 esac
2629 : set up the translation script tr, must be called with ./tr of course
2630 cat >tr <<EOSC
2631 $startsh
2632 case "\$1\$2" in
2633 '[A-Z][a-z]') exec $tr '$up' '$low';;
2634 '[a-z][A-Z]') exec $tr '$low' '$up';;
2635 esac
2636 exec $tr "\$@"
2637 EOSC
2638 chmod +x tr
2639 $eunicefix tr
2640
2641 : Try to determine whether config.sh was made on this system
2642 case "$config_sh" in
2643 '')
2644 myuname=`$uname -a 2>/dev/null`
2645 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2646 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2647 # because the A-Z/a-z are not consecutive.
2648 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2649         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2650 newmyuname="$myuname"
2651 dflt=n
2652 case "$knowitall" in
2653 '')
2654         if test -f ../config.sh; then
2655                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2656                         eval "`grep myuname= ../config.sh`"
2657                 fi
2658                 if test "X$myuname" = "X$newmyuname"; then
2659                         dflt=y
2660                 fi
2661         fi
2662         ;;
2663 *) dflt=y;;
2664 esac
2665
2666 : Get old answers from old config file if Configure was run on the
2667 : same system, otherwise use the hints.
2668 hint=default
2669 cd ..
2670 if test -f config.sh; then
2671         echo " "
2672         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2673         . UU/myread
2674         case "$ans" in
2675         n*|N*) echo "OK, I'll ignore it."
2676                 mv config.sh config.sh.old
2677                 myuname="$newmyuname"
2678                 ;;
2679         *)  echo "Fetching default answers from your old config.sh file..." >&4
2680                 tmp_n="$n"
2681                 tmp_c="$c"
2682                 tmp_sh="$sh"
2683                 . ./config.sh
2684                 cp config.sh UU
2685                 n="$tmp_n"
2686                 c="$tmp_c"
2687                 : Older versions did not always set $sh.  Catch re-use of such
2688                 : an old config.sh.
2689                 case "$sh" in
2690                 '') sh="$tmp_sh" ;;
2691                 esac
2692                 hint=previous
2693                 ;;
2694         esac
2695 fi
2696 . ./UU/checkcc
2697 if test ! -f config.sh; then
2698         $cat <<EOM
2699
2700 First time through, eh?  I have some defaults handy for some systems
2701 that need some extra help getting the Configure answers right:
2702
2703 EOM
2704         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2705         dflt=''
2706         : Half the following guesses are probably wrong... If you have better
2707         : tests or hints, please send them to perlbug@perl.org
2708         : The metaconfig authors would also appreciate a copy...
2709         $test -f /irix && osname=irix
2710         $test -f /xenix && osname=sco_xenix
2711         $test -f /dynix && osname=dynix
2712         $test -f /dnix && osname=dnix
2713         $test -f /lynx.os && osname=lynxos
2714         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2715         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2716         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2717         $test -f /bin/mips && /bin/mips && osname=mips
2718         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2719                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2720         $test -d /usr/apollo/bin && osname=apollo
2721         $test -f /etc/saf/_sactab && osname=svr4
2722         $test -d /usr/include/minix && osname=minix
2723         if $test -d /MachTen -o -d /MachTen_Folder; then
2724                 osname=machten
2725                 if $test -x /sbin/version; then
2726                         osvers=`/sbin/version | $awk '{print $2}' |
2727                         $sed -e 's/[A-Za-z]$//'`
2728                 elif $test -x /usr/etc/version; then
2729                         osvers=`/usr/etc/version | $awk '{print $2}' |
2730                         $sed -e 's/[A-Za-z]$//'`
2731                 else
2732                         osvers="$2.$3"
2733                 fi
2734         fi
2735
2736         $test -f /sys/posix.dll &&
2737                 $test -f /usr/bin/what &&
2738                 set X `/usr/bin/what /sys/posix.dll` &&
2739                 $test "$3" = UWIN &&
2740                 osname=uwin &&
2741                 osvers="$5"
2742
2743         if $test -f $uname; then
2744                 set X $myuname
2745                 shift
2746
2747                 case "$5" in
2748                 fps*) osname=fps ;;
2749                 mips*)
2750                         case "$4" in
2751                         umips) osname=umips ;;
2752                         *) osname=mips ;;
2753                         esac;;
2754                 [23]100) osname=mips ;;
2755                 next*) osname=next ;;
2756                 i386*)
2757                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2758                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2759                                 osname='sco'
2760                                 osvers=$tmp
2761                         elif $test -f /etc/kconfig; then
2762                                 osname=isc
2763                                 if test "$lns" = "$ln -s"; then
2764                                         osvers=4
2765                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2766                                         osvers=3
2767                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2768                                         osvers=2
2769                                 fi
2770                         fi
2771                         tmp=''
2772                         ;;
2773                 pc*)
2774                         if test -n "$DJGPP"; then
2775                                 osname=dos
2776                                 osvers=djgpp
2777                         fi
2778                         ;;
2779                 esac
2780
2781                 case "$1" in
2782                 aix) osname=aix
2783                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2784                         case "$tmp" in
2785                         'not found') osvers="$4"."$3" ;;
2786                         '<3240'|'<>3240') osvers=3.2.0 ;;
2787                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2788                         '=3250'|'>3250') osvers=3.2.5 ;;
2789                         *) osvers=$tmp;;
2790                         esac
2791                         ;;
2792                 bsd386) osname=bsd386
2793                         osvers=`$uname -r`
2794                         ;;
2795                 cygwin*) osname=cygwin
2796                         osvers="$3"
2797                         ;;
2798                 *dc.osx) osname=dcosx
2799                         osvers="$3"
2800                         ;;
2801                 dnix) osname=dnix
2802                         osvers="$3"
2803                         ;;
2804                 domainos) osname=apollo
2805                         osvers="$3"
2806                         ;;
2807                 dgux) osname=dgux 
2808                         osvers="$3"
2809                         ;;
2810                 dynixptx*) osname=dynixptx
2811                         osvers=`echo "$4"|sed 's/^v//'`
2812                         ;;
2813                 freebsd) osname=freebsd 
2814                         osvers="$3" ;;
2815                 genix) osname=genix ;;
2816                 hp*) osname=hpux 
2817                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2818                         ;;
2819                 irix*) osname=irix
2820                         case "$3" in
2821                         4*) osvers=4 ;;
2822                         5*) osvers=5 ;;
2823                         *)      osvers="$3" ;;
2824                         esac
2825                         ;;
2826                 linux) osname=linux
2827                         case "$3" in
2828                         *)      osvers="$3" ;;
2829                         esac
2830                         ;;
2831                 MiNT) osname=mint
2832                         ;;
2833                 netbsd*) osname=netbsd
2834                         osvers="$3"
2835                         ;;
2836                 news-os) osvers="$3"
2837                         case "$3" in
2838                         4*) osname=newsos4 ;;
2839                         *) osname=newsos ;;
2840                         esac
2841                         ;;
2842                 next*) osname=next ;;
2843                 nonstop-ux) osname=nonstopux ;;
2844                 POSIX-BC | posix-bc ) osname=posix-bc
2845                         osvers="$3"
2846                         ;;
2847                 powerux | power_ux | powermax_os | powermaxos | \
2848                 powerunix | power_unix) osname=powerux
2849                         osvers="$3"
2850                         ;;
2851                 qnx) osname=qnx
2852                         osvers="$4"
2853                         ;;
2854                 solaris) osname=solaris
2855                         case "$3" in
2856                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2857                         *)      osvers="$3" ;;
2858                         esac
2859                         ;;
2860                 sunos) osname=sunos
2861                         case "$3" in
2862                         5*) osname=solaris
2863                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2864                         *)      osvers="$3" ;;
2865                         esac
2866                         ;;
2867                 titanos) osname=titanos
2868                         case "$3" in
2869                         1*) osvers=1 ;;
2870                         2*) osvers=2 ;;
2871                         3*) osvers=3 ;;
2872                         4*) osvers=4 ;;
2873                         *)      osvers="$3" ;;
2874                         esac
2875                         ;;
2876                 ultrix) osname=ultrix
2877                         osvers="$3"
2878                         ;;
2879                 osf1|mls+)      case "$5" in
2880                                 alpha)
2881                                         osname=dec_osf
2882                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2883                                         case "$osvers" in
2884                                         [1-9].[0-9]*) ;;
2885                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2886                                         esac
2887                                         ;;
2888                         hp*)    osname=hp_osf1  ;;
2889                         mips)   osname=mips_osf1 ;;
2890                         esac
2891                         ;;
2892                 unixware) osname=svr5
2893                         osvers="$4"
2894                         ;;
2895                 uts) osname=uts
2896                         osvers="$3"
2897                         ;;
2898                 $2) case "$osname" in
2899                         *isc*) ;;
2900                         *freebsd*) ;;
2901                         svr*)
2902                                 : svr4.x or possibly later
2903                                 case "svr$3" in 
2904                                 ${osname}*)
2905                                         osname=svr$3
2906                                         osvers=$4
2907                                         ;;
2908                                 esac
2909                                 case "$osname" in
2910                                 svr4.0)
2911                                         : Check for ESIX
2912                                         if test -f /stand/boot ; then
2913                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2914                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2915                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2916                                                         if test -n "$isesix"; then
2917                                                                 osname=esix4
2918                                                         fi
2919                                                 fi
2920                                         fi
2921                                         ;;
2922                                 esac
2923                                 ;;
2924                         *)      if test -f /etc/systemid; then
2925                                         osname=sco
2926                                         set `echo $3 | $sed 's/\./ /g'` $4
2927                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2928                                                 osvers=$1.$2.$3
2929                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2930                                                 osvers=$1.$2
2931                                         elif $test -f $src/hints/sco_$1.sh; then
2932                                                 osvers=$1
2933                                         fi
2934                                 else
2935                                         case "$osname" in
2936                                         '') : Still unknown.  Probably a generic Sys V.
2937                                                 osname="sysv"
2938                                                 osvers="$3"
2939                                                 ;;
2940                                         esac
2941                                 fi
2942                                 ;;
2943                         esac
2944                         ;;
2945                 *)      case "$osname" in
2946                         '') : Still unknown.  Probably a generic BSD.
2947                                 osname="$1"
2948                                 osvers="$3"
2949                                 ;;
2950                         esac
2951                         ;;
2952                 esac
2953         else
2954                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2955                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2956                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2957                                 osname=news_os
2958                         fi
2959                         $rm -f UU/kernel.what
2960                 elif test -d c:/.; then
2961                         set X $myuname
2962                         osname=os2
2963                         osvers="$5"
2964                 fi
2965         fi
2966         
2967         case "$targetarch" in
2968         '') ;;
2969         *)  hostarch=$osname
2970             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
2971             osvers=''
2972             ;;
2973         esac
2974
2975         : Now look for a hint file osname_osvers, unless one has been
2976         : specified already.
2977         case "$hintfile" in
2978         ''|' ')
2979                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2980                 : Also try without trailing minor version numbers.
2981                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2982                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2983                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2984                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2985                 case "$file" in
2986                 '') dflt=none ;;
2987                 *)  case "$osvers" in
2988                         '') dflt=$file
2989                                 ;;
2990                         *)  if $test -f $src/hints/$file.sh ; then
2991                                         dflt=$file
2992                                 elif $test -f $src/hints/$xfile.sh ; then
2993                                         dflt=$xfile
2994                                 elif $test -f $src/hints/$xxfile.sh ; then
2995                                         dflt=$xxfile
2996                                 elif $test -f $src/hints/$xxxfile.sh ; then
2997                                         dflt=$xxxfile
2998                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2999                                         dflt=$xxxxfile
3000                                 elif $test -f "$src/hints/${osname}.sh" ; then
3001                                         dflt="${osname}"
3002                                 else
3003                                         dflt=none
3004                                 fi
3005                                 ;;
3006                         esac
3007                         ;;
3008                 esac
3009                 if $test -f Policy.sh ; then
3010                         case "$dflt" in
3011                         *Policy*) ;;
3012                         none) dflt="Policy" ;;
3013                         *) dflt="Policy $dflt" ;;
3014                         esac
3015                 fi
3016                 ;;
3017         *)
3018                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3019                 ;;
3020         esac
3021
3022         if $test -f Policy.sh ; then
3023                 $cat <<EOM
3024
3025 There's also a Policy hint file available, which should make the
3026 site-specific (policy) questions easier to answer.
3027 EOM
3028
3029         fi
3030
3031         $cat <<EOM
3032
3033 You may give one or more space-separated answers, or "none" if appropriate.
3034 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3035 is a good thing.  DO NOT give a wrong version or a wrong OS.
3036
3037 EOM
3038
3039         rp="Which of these apply, if any?"
3040         . UU/myread
3041         tans=$ans
3042         for file in $tans; do
3043                 if $test X$file = XPolicy -a -f Policy.sh; then
3044                         . Policy.sh
3045                         $cat Policy.sh >> UU/config.sh
3046                 elif $test -f $src/hints/$file.sh; then
3047                         . $src/hints/$file.sh
3048                         $cat $src/hints/$file.sh >> UU/config.sh
3049                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3050                         : nothing
3051                 else
3052                         : Give one chance to correct a possible typo.
3053                         echo "$file.sh does not exist"
3054                         dflt=$file
3055                         rp="hint to use instead?"
3056                         . UU/myread
3057                         for file in $ans; do
3058                                 if $test -f "$src/hints/$file.sh"; then
3059                                         . $src/hints/$file.sh
3060                                         $cat $src/hints/$file.sh >> UU/config.sh
3061                                 elif $test X$ans = X -o X$ans = Xnone ; then
3062                                         : nothing
3063                                 else
3064                                         echo "$file.sh does not exist -- ignored."
3065                                 fi
3066                         done
3067                 fi
3068         done
3069
3070         hint=recommended
3071         : Remember our hint file for later.
3072         if $test -f "$src/hints/$file.sh" ; then
3073                 hintfile="$file"
3074         else
3075                 hintfile=''
3076         fi
3077 fi
3078 cd UU
3079 ;;
3080 *)
3081         echo " "
3082         echo "Fetching default answers from $config_sh..." >&4
3083         tmp_n="$n"
3084         tmp_c="$c"
3085         cd ..
3086         cp $config_sh config.sh 2>/dev/null
3087         chmod +w config.sh
3088         . ./config.sh
3089         cd UU
3090         cp ../config.sh .
3091         n="$tmp_n"
3092         c="$tmp_c"
3093         hint=previous
3094         ;;
3095 esac
3096 test "$override" && . ./optdef.sh
3097
3098 : Restore computed paths
3099 for file in $loclist $trylist; do
3100         eval $file="\$_$file"
3101 done
3102
3103 cat << EOM
3104
3105 Configure uses the operating system name and version to set some defaults.
3106 The default value is probably right if the name rings a bell. Otherwise,
3107 since spelling matters for me, either accept the default or answer "none"
3108 to leave it blank.
3109
3110 EOM
3111 case "$osname" in
3112         ''|' ')
3113                 case "$hintfile" in
3114                 ''|' '|none) dflt=none ;;
3115                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3116                 esac
3117                 ;;
3118         *) dflt="$osname" ;;
3119 esac
3120 rp="Operating system name?"
3121 . ./myread
3122 case "$ans" in
3123 none)  osname='' ;;
3124 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3125 esac
3126 echo " "
3127 case "$osvers" in
3128         ''|' ')
3129                 case "$hintfile" in
3130                 ''|' '|none) dflt=none ;;
3131                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3132                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3133                         case "$dflt" in
3134                         ''|' ') dflt=none ;;
3135                         esac
3136                         ;;
3137                 esac
3138                 ;;
3139         *) dflt="$osvers" ;;
3140 esac
3141 rp="Operating system version?"
3142 . ./myread
3143 case "$ans" in
3144 none)  osvers='' ;;
3145 *) osvers="$ans" ;;
3146 esac
3147
3148
3149 . ./posthint.sh
3150
3151 : who configured the system
3152 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3153 cf_by=`(logname) 2>/dev/null`
3154 case "$cf_by" in
3155 "")
3156         cf_by=`(whoami) 2>/dev/null`
3157         case "$cf_by" in
3158         "") cf_by=unknown ;;
3159         esac ;;
3160 esac
3161
3162 : set up the script used to warn in case of inconsistency
3163 cat <<EOS >whoa
3164 $startsh
3165 EOS
3166 cat <<'EOSC' >>whoa
3167 dflt=y
3168 echo " "
3169 echo "*** WHOA THERE!!! ***" >&4
3170 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3171 rp="    Keep the $hint value?"
3172 . ./myread
3173 case "$ans" in
3174 y) td=$was; tu=$was;;
3175 esac
3176 EOSC
3177
3178 : function used to set $1 to $val
3179 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3180 case "$val$was" in
3181 $define$undef) . ./whoa; eval "$var=\$td";;
3182 $undef$define) . ./whoa; eval "$var=\$tu";;
3183 *) eval "$var=$val";;
3184 esac'
3185
3186 case "$usethreads" in
3187 $define|true|[yY]*)     dflt='y';;
3188 *) dflt='n';;
3189 esac
3190 cat <<EOM
3191
3192 Perl can be built to take advantage of threads on some systems.
3193 To do so, Configure can be run with -Dusethreads.
3194
3195 Note that threading is a highly experimental feature, and
3196 some known race conditions still remain.  If you choose to try
3197 it, be very sure to not actually deploy it for production
3198 purposes.  README.threads has more details, and is required
3199 reading if you enable threads.
3200
3201 If this doesn't make any sense to you, just accept the default '$dflt'.
3202 EOM
3203 rp='Build a threading Perl?'
3204 . ./myread
3205 case "$ans" in
3206 y|Y)    val="$define" ;;
3207 *)      val="$undef" ;;
3208 esac
3209 set usethreads
3210 eval $setvar
3211
3212 case "$usethreads" in
3213 $define)
3214         $cat <<EOM
3215
3216 As of 5.5.640, Perl has two different internal threading implementations,
3217 the 5.005 version (5005threads) and an interpreter-based version
3218 (ithreads) that has one interpreter per thread.  Both are very 
3219 experimental.  This arrangement exists to help developers work out
3220 which one is better.
3221
3222 If you're a casual user, you probably don't want interpreter-threads
3223 at this time.  There doesn't yet exist a way to create threads from
3224 within Perl in this model, i.e., "use Thread;" will NOT work.
3225 EOM
3226         : Default to ithreads unless overridden on command line or with
3227         : old config.sh
3228         dflt='y'
3229         case "$use5005threads" in
3230                 $define|true|[yY]*) dflt='n';;
3231         esac
3232         case "$useithreads" in
3233                 $undef|false|[nN]*) dflt='n';;
3234         esac
3235         rp='Use interpreter-based ithreads?'
3236         . ./myread
3237         case "$ans" in
3238         y|Y)    val="$define" ;;
3239         *)      val="$undef" ;;
3240         esac
3241         set useithreads
3242         eval $setvar
3243         : Now set use5005threads to the opposite value.
3244         case "$useithreads" in
3245         $define) val="$undef" ;;
3246         *) val="$define" ;;
3247         esac
3248         set use5005threads
3249         eval $setvar
3250         ;;
3251 *)
3252         useithreads="$undef"
3253         use5005threads="$undef"
3254         ;;
3255 esac
3256
3257 case "$useithreads$use5005threads" in
3258 "$define$define")
3259         $cat >&4 <<EOM
3260
3261 You cannot have both the ithreads and the 5.005 threads enabled
3262 at the same time.  Disabling the 5.005 threads since they are
3263 much less stable than the ithreads.
3264
3265 EOM
3266         use5005threads="$undef"
3267         ;;
3268 esac
3269
3270 case "$d_oldpthreads" in
3271 '')     : Configure tests would be welcome here.  For now, assume undef.
3272         val="$undef" ;;
3273 *)      val="$d_oldpthreads" ;;
3274 esac
3275 set d_oldpthreads
3276 eval $setvar
3277
3278
3279 case "$usethreads" in
3280 "$define"|true|[yY]*)
3281 : Look for a hint-file generated 'call-back-unit'.  If the
3282 : user has specified that a threading perl is to be built,
3283 : we may need to set or change some other defaults.
3284         if $test -f usethreads.cbu; then
3285                 echo "Your platform has some specific hints for threaded builds, using them..."
3286                 . ./usethreads.cbu
3287         else
3288                 $cat <<EOM
3289 (Your platform doesn't have any specific hints for threaded builds.
3290  Assuming POSIX threads, then.)
3291 EOM
3292         fi
3293         ;;
3294 esac
3295
3296 cat <<EOM
3297
3298 Perl can be built so that multiple Perl interpreters can coexist
3299 within the same Perl executable.
3300 EOM
3301
3302 case "$useithreads" in
3303 $define)
3304         cat <<EOM
3305 This multiple interpreter support is required for interpreter-based threads.
3306 EOM
3307         val="$define"
3308         ;;
3309 *)      case "$usemultiplicity" in
3310         $define|true|[yY]*)     dflt='y';;
3311         *) dflt='n';;
3312         esac
3313         echo " "
3314         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3315         rp='Build Perl for multiplicity?'
3316         . ./myread
3317         case "$ans" in
3318         y|Y)    val="$define" ;;
3319         *)      val="$undef" ;;
3320         esac
3321         ;;
3322 esac
3323 set usemultiplicity
3324 eval $setvar
3325
3326
3327 case "$usemorebits" in
3328 "$define"|true|[yY]*)
3329         use64bitint="$define"
3330         uselongdouble="$define"
3331         usemorebits="$define"
3332         ;;
3333 *)      usemorebits="$undef"
3334         ;;
3335 esac
3336
3337 : make some quick guesses about what we are up against
3338 echo " "
3339 $echo $n "Hmm...  $c"
3340 echo exit 1 >bsd
3341 echo exit 1 >usg
3342 echo exit 1 >v7
3343 echo exit 1 >osf1
3344 echo exit 1 >eunice
3345 echo exit 1 >xenix
3346 echo exit 1 >venix
3347 echo exit 1 >os2
3348 d_bsd="$undef"
3349 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3350 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3351 then
3352         echo "Looks kind of like an OSF/1 system, but we'll see..."
3353         echo exit 0 >osf1
3354 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3355         xxx=`./loc addbib blurfl $pth`
3356         if $test -f $xxx; then
3357         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3358                 echo exit 0 >bsd
3359                 echo exit 0 >usg
3360         else
3361                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3362                         echo "Looks kind of like an extended USG system, but we'll see..."
3363                 else
3364                         echo "Looks kind of like a USG system, but we'll see..."
3365                 fi
3366                 echo exit 0 >usg
3367         fi
3368 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3369         echo "Looks kind of like a BSD system, but we'll see..."
3370         d_bsd="$define"
3371         echo exit 0 >bsd
3372 else
3373         echo "Looks kind of like a Version 7 system, but we'll see..."
3374         echo exit 0 >v7
3375 fi
3376 case "$eunicefix" in
3377 *unixtovms*)
3378         $cat <<'EOI'
3379 There is, however, a strange, musty smell in the air that reminds me of
3380 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3381 EOI
3382         echo exit 0 >eunice
3383         d_eunice="$define"
3384 : it so happens the Eunice I know will not run shell scripts in Unix format
3385         ;;
3386 *)
3387         echo " "
3388         echo "Congratulations.  You aren't running Eunice."
3389         d_eunice="$undef"
3390         ;;
3391 esac
3392 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3393 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3394 : semicolon as a patch separator
3395 case "$p_" in
3396 :) ;;
3397 *)
3398         $cat <<'EOI'
3399 I have the feeling something is not exactly right, however...don't tell me...
3400 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3401 (Or you may be running DOS with DJGPP.)
3402 EOI
3403         echo exit 0 >os2
3404         ;;
3405 esac
3406 if test -f /xenix; then
3407         echo "Actually, this looks more like a XENIX system..."
3408         echo exit 0 >xenix
3409         d_xenix="$define"
3410 else
3411         echo " "
3412         echo "It's not Xenix..."
3413         d_xenix="$undef"
3414 fi
3415 chmod +x xenix
3416 $eunicefix xenix
3417 if test -f /venix; then
3418         echo "Actually, this looks more like a VENIX system..."
3419         echo exit 0 >venix
3420 else
3421         echo " "
3422         if ./xenix; then
3423                 : null
3424         else
3425                 echo "Nor is it Venix..."
3426         fi
3427 fi
3428 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3429 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3430 $rm -f foo
3431
3432 case "$cc" in
3433 '') dflt=cc;;
3434 *) dflt="$cc";;
3435 esac
3436 rp="Use which C compiler?"
3437 . ./myread
3438 cc="$ans"
3439 : Look for a hint-file generated 'call-back-unit'.  Now that the
3440 : user has specified the compiler, we may need to set or change some
3441 : other defaults.
3442 if $test -f cc.cbu; then
3443     . ./cc.cbu
3444 fi
3445 . ./checkcc
3446
3447 echo " "
3448 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3449 $cat >try.c <<EOM
3450 #include <stdio.h>
3451 int main() {
3452 #ifdef __GNUC__
3453 #ifdef __VERSION__
3454         printf("%s\n", __VERSION__);
3455 #else
3456         printf("%s\n", "1");
3457 #endif
3458 #endif
3459         exit(0);
3460 }
3461 EOM
3462 if $cc -o try $ccflags $ldflags try.c; then
3463         gccversion=`$run ./try`
3464         case "$gccversion" in
3465         '') echo "You are not using GNU cc." ;;
3466         *)  echo "You are using GNU cc $gccversion."
3467             ccname=gcc  
3468             ;;
3469         esac
3470 else
3471         echo " "
3472         echo "*** WHOA THERE!!! ***" >&4
3473         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3474         case "$knowitall" in
3475         '')
3476         echo "    You'd better start hunting for one and let me know about it." >&4
3477                 exit 1
3478                 ;;
3479         esac
3480 fi
3481 $rm -f try try.*
3482 case "$gccversion" in
3483 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3484 esac
3485 case "$gccversion" in
3486 '') gccosandvers='' ;;
3487 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3488    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3489    gccshortvers=''
3490    case "$gccosandvers" in
3491    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3492    $osname$osvers) ;; # looking good
3493    $osname*) cat <<EOM >&4
3494
3495 *** WHOA THERE!!! ***
3496
3497     Your gcc has not been compiled for the exact release of
3498     your operating system ($gccosandvers versus $osname$osvers).
3499
3500     In general it is a good idea to keep gcc synchronized with
3501     the operating system because otherwise serious problems
3502     may ensue when trying to compile software, like Perl.
3503
3504     I'm trying to be optimistic here, though, and will continue.
3505     If later during the configuration and build icky compilation
3506     problems appear (headerfile conflicts being the most common
3507     manifestation), I suggest reinstalling the gcc to match
3508     your operating system release.
3509
3510 EOM
3511       ;;
3512    *) gccosandvers='' ;; # failed to parse, better be silent
3513    esac
3514    ;;
3515 esac
3516 case "$ccname" in
3517 '') ccname="$cc" ;;
3518 esac
3519
3520 case "$gccversion" in
3521 '') ;;
3522 *)  case "$ccflags" in
3523     *-Wall*) ;;
3524     *) ccflags="$ccflags -Wall" ;;
3525     esac
3526     ;;
3527 esac
3528
3529 : decide how portable to be.  Allow command line overrides.
3530 case "$d_portable" in
3531 "$undef") ;;
3532 *)      d_portable="$define" ;;
3533 esac
3534
3535 : set up shell script to do ~ expansion
3536 cat >filexp <<EOSS
3537 $startsh
3538 : expand filename
3539 case "\$1" in
3540  ~/*|~)
3541         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3542         ;;
3543  ~*)
3544         if $test -f /bin/csh; then
3545                 /bin/csh -f -c "glob \$1"
3546                 failed=\$?
3547                 echo ""
3548                 exit \$failed
3549         else
3550                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3551                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3552                 if $test ! -d "\$dir"; then
3553                         me=\`basename \$0\`
3554                         echo "\$me: can't locate home directory for: \$name" >&2
3555                         exit 1
3556                 fi
3557                 case "\$1" in
3558                 */*)
3559                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3560                         ;;
3561                 *)
3562                         echo \$dir
3563                         ;;
3564                 esac
3565         fi
3566         ;;
3567 *)
3568         echo \$1
3569         ;;
3570 esac
3571 EOSS
3572 chmod +x filexp
3573 $eunicefix filexp
3574
3575 : now set up to get a file name
3576 cat <<EOS >getfile
3577 $startsh
3578 EOS
3579 cat <<'EOSC' >>getfile
3580 tilde=''
3581 fullpath=''
3582 already=''
3583 skip=''
3584 none_ok=''
3585 exp_file=''
3586 nopath_ok=''
3587 orig_rp="$rp"
3588 orig_dflt="$dflt"
3589 case "$gfpth" in
3590 '') gfpth='.' ;;
3591 esac
3592
3593 case "$fn" in
3594 *\(*)
3595         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3596         fn=`echo $fn | sed 's/(.*)//'`
3597         ;;
3598 esac
3599
3600 case "$fn" in
3601 *:*)
3602         loc_file=`expr $fn : '.*:\(.*\)'`
3603         fn=`expr $fn : '\(.*\):.*'`
3604         ;;
3605 esac
3606
3607 case "$fn" in
3608 *~*) tilde=true;;
3609 esac
3610 case "$fn" in
3611 */*) fullpath=true;;
3612 esac
3613 case "$fn" in
3614 *+*) skip=true;;
3615 esac
3616 case "$fn" in
3617 *n*) none_ok=true;;
3618 esac
3619 case "$fn" in
3620 *e*) exp_file=true;;
3621 esac
3622 case "$fn" in
3623 *p*) nopath_ok=true;;
3624 esac
3625
3626 case "$fn" in
3627 *f*) type='File';;
3628 *d*) type='Directory';;
3629 *l*) type='Locate';;
3630 esac
3631
3632 what="$type"
3633 case "$what" in
3634 Locate) what='File';;
3635 esac
3636
3637 case "$exp_file" in
3638 '')
3639         case "$d_portable" in
3640         "$define") ;;
3641         *) exp_file=true;;
3642         esac
3643         ;;
3644 esac
3645
3646 cd ..
3647 while test "$type"; do
3648         redo=''
3649         rp="$orig_rp"
3650         dflt="$orig_dflt"
3651         case "$tilde" in
3652         true) rp="$rp (~name ok)";;
3653         esac
3654         . UU/myread
3655         if test -f UU/getfile.ok && \
3656                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3657         then
3658                 value="$ans"
3659                 ansexp="$ans"
3660                 break
3661         fi
3662         case "$ans" in
3663         none)
3664                 value=''
3665                 ansexp=''
3666                 case "$none_ok" in
3667                 true) type='';;
3668                 esac
3669                 ;;
3670         *)
3671                 case "$tilde" in
3672                 '') value="$ans"
3673                         ansexp="$ans";;
3674                 *)
3675                         value=`UU/filexp $ans`
3676                         case $? in
3677                         0)
3678                                 if test "$ans" != "$value"; then
3679                                         echo "(That expands to $value on this system.)"
3680                                 fi
3681                                 ;;
3682                         *) value="$ans";;
3683                         esac
3684                         ansexp="$value"
3685                         case "$exp_file" in
3686                         '') value="$ans";;
3687                         esac
3688                         ;;
3689                 esac
3690                 case "$fullpath" in
3691                 true)
3692                         case "$ansexp" in
3693                         /*) value="$ansexp" ;;
3694                         [a-zA-Z]:/*) value="$ansexp" ;;
3695                         *)
3696                                 redo=true
3697                                 case "$already" in
3698                                 true)
3699                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3700                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3701                                         ;;
3702                                 *)
3703                                 echo "Please give a full path name, starting with slash." >&4
3704                                         case "$tilde" in
3705                                         true)
3706                                 echo "Note that using ~name is ok provided it expands well." >&4
3707                                                 already=true
3708                                                 ;;
3709                                         esac
3710                                 esac
3711                                 ;;
3712                         esac
3713                         ;;
3714                 esac
3715                 case "$redo" in
3716                 '')
3717                         case "$type" in
3718                         File)
3719                                 for fp in $gfpth; do
3720                                         if test "X$fp" = X.; then
3721                                             pf="$ansexp"
3722                                         else    
3723                                             pf="$fp/$ansexp"
3724                                         fi
3725                                         if test -f "$pf"; then
3726                                                 type=''
3727                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3728                                         then
3729                                                 echo "($value is not a plain file, but that's ok.)"
3730                                                 type=''
3731                                         fi
3732                                         if test X"$type" = X; then
3733                                             value="$pf"
3734                                             break
3735                                         fi
3736                                 done
3737                                 ;;
3738                         Directory)
3739                                 for fp in $gfpth; do
3740                                         if test "X$fp" = X.; then
3741                                             dir="$ans"
3742                                             direxp="$ansexp"
3743                                         else    
3744                                             dir="$fp/$ansexp"
3745                                             direxp="$fp/$ansexp"
3746                                         fi
3747                                         if test -d "$direxp"; then
3748                                                 type=''
3749                                                 value="$dir"
3750                                                 break
3751                                         fi
3752                                 done
3753                                 ;;
3754                         Locate)
3755                                 if test -d "$ansexp"; then
3756                                         echo "(Looking for $loc_file in directory $value.)"
3757                                         value="$value/$loc_file"
3758                                         ansexp="$ansexp/$loc_file"
3759                                 fi
3760                                 if test -f "$ansexp"; then
3761                                         type=''
3762                                 fi
3763                                 case "$nopath_ok" in
3764                                 true)   case "$value" in
3765                                         */*) ;;
3766                                         *)      echo "Assuming $value will be in people's path."
3767                                                 type=''
3768                                                 ;;
3769                                         esac
3770                                         ;;
3771                                 esac
3772                                 ;;
3773                         esac
3774
3775                         case "$skip" in
3776                         true) type='';
3777                         esac
3778
3779                         case "$type" in
3780                         '') ;;
3781                         *)
3782                                 if test "$fastread" = yes; then
3783                                         dflt=y
3784                                 else
3785                                         dflt=n
3786                                 fi
3787                                 rp="$what $value doesn't exist.  Use that name anyway?"
3788                                 . UU/myread
3789                                 dflt=''
3790                                 case "$ans" in
3791                                 y*) type='';;
3792                                 *) echo " ";;
3793                                 esac
3794                                 ;;
3795                         esac
3796                         ;;
3797                 esac
3798                 ;;
3799         esac
3800 done
3801 cd UU
3802 ans="$value"
3803 rp="$orig_rp"
3804 dflt="$orig_dflt"
3805 rm -f getfile.ok
3806 test "X$gfpthkeep" != Xy && gfpth=""
3807 EOSC
3808
3809 : What should the include directory be ?
3810 echo " "
3811 $echo $n "Hmm...  $c"
3812 dflt='/usr/include'
3813 incpath=''
3814 mips_type=''
3815 if $test -f /bin/mips && /bin/mips; then
3816         echo "Looks like a MIPS system..."
3817         $cat >usr.c <<'EOCP'
3818 #ifdef SYSTYPE_BSD43
3819 /bsd43
3820 #endif
3821 EOCP
3822         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3823                 dflt='/bsd43/usr/include'
3824                 incpath='/bsd43'
3825                 mips_type='BSD 4.3'
3826         else
3827                 mips_type='System V'
3828         fi
3829         $rm -f usr.c usr.out
3830         echo "and you're compiling with the $mips_type compiler and libraries."
3831         xxx_prompt=y
3832         echo "exit 0" >mips
3833 else
3834         echo "Doesn't look like a MIPS system."
3835         xxx_prompt=n
3836         echo "exit 1" >mips
3837 fi
3838 chmod +x mips
3839 $eunicefix mips
3840 case "$usrinc" in
3841 '') ;;
3842 *) dflt="$usrinc";;
3843 esac
3844 case "$xxx_prompt" in
3845 y)      fn=d/
3846         echo " "
3847         rp='Where are the include files you want to use?'
3848         . ./getfile
3849         usrinc="$ans"
3850         ;;
3851 *)      usrinc="$dflt"
3852         ;;
3853 esac
3854
3855 : see how we invoke the C preprocessor
3856 echo " "
3857 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3858 cat <<'EOT' >testcpp.c
3859 #define ABC abc
3860 #define XYZ xyz
3861 ABC.XYZ
3862 EOT
3863 cd ..
3864 if test ! -f cppstdin; then
3865         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3866                 # AIX cc -E doesn't show the absolute headerfile
3867                 # locations but we'll cheat by using the -M flag.
3868                 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
3869         else
3870                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3871         fi
3872 else
3873         echo "Keeping your $hint cppstdin wrapper."
3874 fi
3875 chmod 755 cppstdin
3876 wrapper=`pwd`/cppstdin
3877 ok='false'
3878 cd UU
3879
3880 if $test "X$cppstdin" != "X" && \
3881         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3882         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3883 then
3884         echo "You used to use $cppstdin $cppminus so we'll use that again."
3885         case "$cpprun" in
3886         '') echo "But let's see if we can live without a wrapper..." ;;
3887         *)
3888                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3889                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3890                 then
3891                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3892                         ok='true'
3893                 else
3894                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3895                 fi
3896                 ;;
3897         esac
3898 else
3899         case "$cppstdin" in
3900         '') ;;
3901         *)
3902                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3903                 ;;
3904         esac
3905 fi
3906
3907 if $ok; then
3908         : nothing
3909 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3910         $cc -E <testcpp.c >testcpp.out 2>&1; \
3911         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3912         echo "Yup, it does."
3913         x_cpp="$cc -E"
3914         x_minus='';
3915 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3916         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3917         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3918         echo "Yup, it does."
3919         x_cpp="$cc -E"
3920         x_minus='-';
3921 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3922         $cc -P <testcpp.c >testcpp.out 2>&1; \
3923         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3924         echo "Yipee, that works!"
3925         x_cpp="$cc -P"
3926         x_minus='';
3927 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3928         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3929         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3930         echo "At long last!"
3931         x_cpp="$cc -P"
3932         x_minus='-';
3933 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3934         $cpp <testcpp.c >testcpp.out 2>&1; \
3935         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3936         echo "It works!"
3937         x_cpp="$cpp"
3938         x_minus='';
3939 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3940         $cpp - <testcpp.c >testcpp.out 2>&1; \
3941         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3942         echo "Hooray, it works!  I was beginning to wonder."
3943         x_cpp="$cpp"
3944         x_minus='-';
3945 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3946         $wrapper <testcpp.c >testcpp.out 2>&1; \
3947         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3948         x_cpp="$wrapper"
3949         x_minus=''
3950         echo "Eureka!"
3951 else
3952         dflt=''
3953         rp="No dice.  I can't find a C preprocessor.  Name one:"
3954         . ./myread
3955         x_cpp="$ans"
3956         x_minus=''
3957         $x_cpp <testcpp.c >testcpp.out 2>&1
3958         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3959                 echo "OK, that will do." >&4
3960         else
3961 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3962                 exit 1
3963         fi
3964 fi
3965
3966 case "$ok" in
3967 false)
3968         cppstdin="$x_cpp"
3969         cppminus="$x_minus"
3970         cpprun="$x_cpp"
3971         cpplast="$x_minus"
3972         set X $x_cpp
3973         shift
3974         case "$1" in
3975         "$cpp")
3976                 echo "Perhaps can we force $cc -E using a wrapper..."
3977                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3978                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3979                 then
3980                         echo "Yup, we can."
3981                         cppstdin="$wrapper"
3982                         cppminus='';
3983                 else
3984                         echo "Nope, we'll have to live without it..."
3985                 fi
3986                 ;;
3987         esac
3988         case "$cpprun" in
3989         "$wrapper")
3990                 cpprun=''
3991                 cpplast=''
3992                 ;;
3993         esac
3994         ;;
3995 esac
3996
3997 case "$cppstdin" in
3998 "$wrapper"|'cppstdin') ;;
3999 *) $rm -f $wrapper;;
4000 esac
4001 $rm -f testcpp.c testcpp.out
4002
4003 : Set private lib path
4004 case "$plibpth" in
4005 '') if ./mips; then
4006                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4007         fi;;
4008 esac
4009 case "$libpth" in
4010 ' ') dlist='';;
4011 '') dlist="$loclibpth $plibpth $glibpth";;
4012 *) dlist="$libpth";;
4013 esac
4014
4015 : Now check and see which directories actually exist, avoiding duplicates
4016 libpth=''
4017 for xxx in $dlist
4018 do
4019     if $test -d $xxx; then
4020                 case " $libpth " in
4021                 *" $xxx "*) ;;
4022                 *) libpth="$libpth $xxx";;
4023                 esac
4024     fi
4025 done
4026 $cat <<'EOM'
4027
4028 Some systems have incompatible or broken versions of libraries.  Among
4029 the directories listed in the question below, please remove any you
4030 know not to be holding relevant libraries, and add any that are needed.
4031 Say "none" for none.
4032
4033 EOM
4034 case "$libpth" in
4035 '') dflt='none';;
4036 *)
4037         set X $libpth
4038         shift
4039         dflt=${1+"$@"}
4040         ;;
4041 esac
4042 rp="Directories to use for library searches?"
4043 . ./myread
4044 case "$ans" in
4045 none) libpth=' ';;
4046 *) libpth="$ans";;
4047 esac
4048
4049 : compute shared library extension
4050 case "$so" in
4051 '')
4052         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4053                 dflt='sl'
4054         else
4055                 dflt='so'
4056         fi
4057         ;;
4058 *) dflt="$so";;
4059 esac
4060 $cat <<EOM
4061
4062 On some systems, shared libraries may be available.  Answer 'none' if
4063 you want to suppress searching of shared libraries for the remainder
4064 of this configuration.
4065
4066 EOM
4067 rp='What is the file extension used for shared libraries?'
4068 . ./myread
4069 so="$ans"
4070
4071 : Define several unixisms.
4072 : Hints files or command line option can be used to override them.
4073 : The convoluted testing is in case hints files set either the old
4074 : or the new name.
4075 case "$_exe" in
4076 '')     case "$exe_ext" in
4077     '') ;;
4078         *)      _exe="$exe_ext" ;;
4079         esac
4080         ;;
4081 esac
4082 case "$_a" in
4083 '')     case "$lib_ext" in
4084     '') _a='.a';;
4085         *)      _a="$lib_ext" ;;
4086         esac
4087         ;;
4088 esac
4089 case "$_o" in
4090 '') case "$obj_ext" in
4091         '')     _o='.o';;
4092         *)      _o="$obj_ext";;
4093         esac
4094         ;;
4095 esac
4096 case "$p_" in
4097 '') case "$path_sep" in
4098         '')     p_=':';;
4099         *)      p_="$path_sep";;
4100         esac
4101         ;;
4102 esac
4103 exe_ext=$_exe
4104 lib_ext=$_a
4105 obj_ext=$_o
4106 path_sep=$p_
4107
4108 : Which makefile gets called first.  This is used by make depend.
4109 case "$firstmakefile" in
4110 '') firstmakefile='makefile';;
4111 esac
4112
4113 case "$usesocks" in
4114 $define|true|[yY]*)     dflt='y';;
4115 *) dflt='n';;
4116 esac
4117 cat <<EOM
4118
4119 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4120 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4121 to use the PerlIO abstraction layer, this will be implicitly selected.
4122
4123 If this doesn't make any sense to you, just accept the default '$dflt'.
4124 EOM
4125 rp='Build Perl for SOCKS?'
4126 . ./myread
4127 case "$ans" in
4128 y|Y)    val="$define" ;;     
4129 *)      val="$undef" ;;
4130 esac
4131 set usesocks
4132 eval $setvar
4133
4134 case "$usesocks" in
4135 $define|true|[yY]*) useperlio="$define";;
4136 esac
4137
4138 : Looking for optional libraries
4139 echo " "
4140 echo "Checking for optional libraries..." >&4
4141 case "$libs" in
4142 ' '|'') dflt='';;
4143 *) dflt="$libs";;
4144 esac
4145 case "$libswanted" in
4146 '') libswanted='c_s';;
4147 esac
4148 case "$usesocks" in
4149 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4150 esac
4151 libsfound=''
4152 libsfiles=''
4153 libsdirs=''
4154 libspath=''
4155 for thisdir in $libpth $xlibpth; do
4156   test -d $thisdir && libspath="$libspath $thisdir"
4157 done
4158 for thislib in $libswanted; do
4159         for thisdir in $libspath; do
4160             xxx=''
4161             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4162                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
4163                 $test -f "$xxx" && eval $libscheck
4164                 $test -f "$xxx" && libstyle=shared
4165             fi
4166             if test ! -f "$xxx"; then
4167                 xxx=$thisdir/lib$thislib.$so
4168                 $test -f "$xxx" && eval $libscheck
4169                 $test -f "$xxx" && libstyle=shared
4170             fi  
4171             if test ! -f "$xxx"; then
4172                 xxx=$thisdir/lib$thislib$_a
4173                 $test -f "$xxx" && eval $libscheck
4174                 $test -f "$xxx" && libstyle=static
4175             fi
4176             if test ! -f "$xxx"; then
4177                 xxx=$thisdir/$thislib$_a
4178                 $test -f "$xxx" && eval $libscheck
4179                 $test -f "$xxx" && libstyle=static
4180             fi
4181             if test ! -f "$xxx"; then
4182                 xxx=$thisdir/lib${thislib}_s$_a
4183                 $test -f "$xxx" && eval $libscheck
4184                 $test -f "$xxx" && libstyle=static
4185                 $test -f "$xxx" && thislib=${thislib}_s
4186             fi
4187             if test ! -f "$xxx"; then
4188                 xxx=$thisdir/Slib$thislib$_a
4189                 $test -f "$xxx" && eval $libscheck
4190                 $test -f "$xxx" && libstyle=static
4191             fi
4192             if $test -f "$xxx"; then
4193                 case "$libstyle" in
4194                 shared) echo "Found -l$thislib (shared)." ;;
4195                 static) echo "Found -l$thislib." ;;
4196                 *)      echo "Found -l$thislib ($libstyle)." ;;
4197                 esac
4198                 case " $dflt " in
4199                 *"-l$thislib "*);;
4200                 *) dflt="$dflt -l$thislib"
4201                    libsfound="$libsfound $xxx"
4202                    yyy=`basename $xxx`
4203                    libsfiles="$libsfiles $yyy"
4204                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4205                    case " $libsdirs " in
4206                    *" $yyy "*) ;;
4207                    *) libsdirs="$libsdirs $yyy" ;;
4208                    esac
4209                    ;;
4210                 esac
4211                 break
4212             fi  
4213         done
4214         if $test ! -f "$xxx"; then
4215             echo "No -l$thislib."
4216         fi
4217 done
4218 set X $dflt
4219 shift
4220 dflt="$*"
4221 case "$libs" in
4222 '') dflt="$dflt";;
4223 *) dflt="$libs";;
4224 esac
4225 case "$dflt" in
4226 ' '|'') dflt='none';;
4227 esac
4228
4229 $cat <<EOM
4230
4231 In order to compile $package on your machine, a number of libraries
4232 are usually needed.  Include any other special libraries here as well.
4233 Say "none" for none.  The default list is almost always right.
4234 EOM
4235
4236 echo " "
4237 rp="What libraries to use?"
4238 . ./myread
4239 case "$ans" in
4240 none) libs=' ';;
4241 *) libs="$ans";;
4242 esac
4243
4244 : determine optimization, if desired, or use for debug flag also
4245 case "$optimize" in
4246 ' '|$undef) dflt='none';;
4247 '') dflt='-O';;
4248 *) dflt="$optimize";;
4249 esac
4250 $cat <<EOH
4251
4252 By default, $package compiles with the -O flag to use the optimizer.
4253 Alternately, you might want to use the symbolic debugger, which uses
4254 the -g flag (on traditional Unix systems).  Either flag can be
4255 specified here.  To use neither flag, specify the word "none".
4256
4257 EOH
4258 rp="What optimizer/debugger flag should be used?"
4259 . ./myread
4260 optimize="$ans"
4261 case "$optimize" in
4262 'none') optimize=" ";;
4263 esac
4264
4265 dflt=''
4266 : We will not override a previous value, but we might want to
4267 : augment a hint file
4268 case "$hint" in
4269 default|recommended)
4270         case "$gccversion" in
4271         1*) dflt='-fpcc-struct-return' ;;
4272         esac
4273         case "$optimize" in
4274         *-g*) dflt="$dflt -DDEBUGGING";;
4275         esac
4276         case "$gccversion" in
4277         2*) if test -d /etc/conf/kconfig.d &&
4278                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4279                 then
4280                         dflt="$dflt -posix"
4281                 fi
4282                 ;;
4283         esac
4284         case "$gccversion" in
4285         1*) ;;
4286         2.[0-8]*) ;;
4287         ?*)     echo " "
4288                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4289                 echo 'int main(void) { return 0; }' > gcctest.c
4290                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4291                         echo "Yes, it does." 2>&1
4292                         case "$ccflags" in
4293                         *strict-aliasing*) 
4294                                 echo "Leaving current flags $ccflags alone." 2>&1
4295                                 ;;
4296                         *) dflt="$dflt -fno-strict-aliasing" ;;
4297                         esac
4298                 else
4299                         echo "Nope, it doesn't, but that's ok." 2>&1
4300                 fi
4301                 ;;
4302         esac
4303         ;;
4304 esac
4305
4306 case "$mips_type" in
4307 *BSD*|'') inclwanted="$locincpth $usrinc";;
4308 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4309 esac
4310 for thisincl in $inclwanted; do
4311         if $test -d $thisincl; then
4312                 if $test x$thisincl != x$usrinc; then
4313                         case "$dflt" in
4314                         *" -I$thisincl "*);;
4315                         *) dflt="$dflt -I$thisincl ";;
4316                         esac
4317                 fi
4318         fi
4319 done
4320
4321 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4322         xxx=true;
4323 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4324         xxx=true;
4325 else
4326         xxx=false;
4327 fi;
4328 if $xxx; then
4329         case "$dflt" in
4330         *$2*);;
4331         *) dflt="$dflt -D$2";;
4332         esac;
4333 fi'
4334
4335 set signal.h LANGUAGE_C; eval $inctest
4336
4337 case "$usesocks" in
4338 $define)
4339         ccflags="$ccflags -DSOCKS"
4340         ;;
4341 esac
4342
4343 case "$hint" in
4344 default|recommended) dflt="$ccflags $dflt" ;;
4345 *) dflt="$ccflags";;
4346 esac
4347
4348 case "$dflt" in
4349 ''|' ') dflt=none;;
4350 esac
4351
4352 $cat <<EOH
4353
4354 Your C compiler may want other flags.  For this question you should include
4355 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4356 but you should NOT include libraries or ld flags like -lwhatever.  If you
4357 want $package to honor its debug switch, you should include -DDEBUGGING here.
4358 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4359
4360 To use no flags, specify the word "none".
4361
4362 EOH
4363 set X $dflt
4364 shift
4365 dflt=${1+"$@"}
4366 rp="Any additional cc flags?"
4367 . ./myread
4368 case "$ans" in
4369 none) ccflags='';;
4370 *) ccflags="$ans";;
4371 esac
4372
4373 : the following weeds options from ccflags that are of no interest to cpp
4374 case "$cppflags" in
4375 '') cppflags="$ccflags" ;;
4376 *)  cppflags="$cppflags $ccflags" ;;
4377 esac
4378 case "$gccversion" in
4379 1*) cppflags="$cppflags -D__GNUC__"
4380 esac
4381 case "$mips_type" in
4382 '');;
4383 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4384 esac
4385 case "$cppflags" in
4386 '');;
4387 *)
4388         echo " "
4389         echo "Let me guess what the preprocessor flags are..." >&4
4390         set X $cppflags
4391         shift
4392         cppflags=''
4393         $cat >cpp.c <<'EOM'
4394 #define BLURFL foo
4395
4396 BLURFL xx LFRULB
4397 EOM
4398         previous=''
4399         for flag in $*
4400         do
4401                 case "$flag" in
4402                 -*) ftry="$flag";;
4403                 *) ftry="$previous $flag";;
4404                 esac
4405                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4406                         >cpp1.out 2>/dev/null && \
4407                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4408                         >cpp2.out 2>/dev/null && \
4409                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4410                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4411                 then
4412                         cppflags="$cppflags $ftry"
4413                         previous=''
4414                 else
4415                         previous="$flag"
4416                 fi
4417         done
4418         set X $cppflags
4419         shift
4420         cppflags=${1+"$@"}
4421         case "$cppflags" in
4422         *-*)  echo "They appear to be: $cppflags";;
4423         esac
4424         $rm -f cpp.c cpp?.out
4425         ;;
4426 esac
4427
4428 : flags used in final linking phase
4429 case "$ldflags" in
4430 '') if ./venix; then
4431                 dflt='-i -z'
4432         else
4433                 dflt=''
4434         fi
4435         case "$ccflags" in
4436         *-posix*) dflt="$dflt -posix" ;;
4437         esac
4438         ;;
4439 *) dflt="$ldflags";;
4440 esac
4441
4442 : Try to guess additional flags to pick up local libraries.
4443 for thislibdir in $libpth; do
4444         case " $loclibpth " in
4445         *" $thislibdir "*)
4446                 case "$dflt " in 
4447                 *"-L$thislibdir "*) ;;
4448                 *)  dflt="$dflt -L$thislibdir" ;;
4449                 esac
4450                 ;;
4451         esac
4452 done
4453
4454 case "$dflt" in
4455 '') dflt='none' ;;
4456 esac
4457
4458 $cat <<EOH
4459
4460 Your C linker may need flags.  For this question you should
4461 include -L/whatever and any other flags used by the C linker, but you
4462 should NOT include libraries like -lwhatever.
4463
4464 Make sure you include the appropriate -L/path flags if your C linker
4465 does not normally search all of the directories you specified above,
4466 namely
4467         $libpth
4468 To use no flags, specify the word "none".
4469
4470 EOH
4471
4472 rp="Any additional ld flags (NOT including libraries)?"
4473 . ./myread
4474 case "$ans" in
4475 none) ldflags='';;
4476 *) ldflags="$ans";;
4477 esac
4478 rmlist="$rmlist pdp11"
4479
4480 : coherency check
4481 echo " "
4482 echo "Checking your choice of C compiler and flags for coherency..." >&4
4483 $cat > try.c <<'EOF'
4484 #include <stdio.h>
4485 int main() { printf("Ok\n"); exit(0); }
4486 EOF
4487 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4488 shift
4489 $cat >try.msg <<'EOM'
4490 I've tried to compile and run the following simple program:
4491
4492 EOM
4493 $cat try.c >> try.msg
4494
4495 $cat >> try.msg <<EOM
4496
4497 I used the command:
4498
4499         $*
4500         $run ./try
4501
4502 and I got the following output:
4503
4504 EOM
4505 dflt=y
4506 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4507         if $sh -c "$run ./try" >>try.msg 2>&1; then
4508                 xxx=`$run ./try`
4509                 case "$xxx" in
4510                 "Ok") dflt=n ;;
4511                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4512                         case " $libs " in
4513                         *" -lsfio "*)
4514                                 cat >> try.msg <<'EOQS'
4515 If $libs contains -lsfio, and sfio is mis-configured, then it
4516 sometimes (apparently) runs and exits with a 0 status, but with no
4517 output!  It may have to do with sfio's use of _exit vs. exit.
4518
4519 EOQS
4520                                 rp="You have a big problem.  Shall I abort Configure"
4521                                 dflt=y
4522                                 ;;
4523                         esac
4524                         ;;
4525                 esac
4526         else
4527                 echo "The program compiled OK, but exited with status $?." >>try.msg
4528                 rp="You have a problem.  Shall I abort Configure"
4529                 dflt=y
4530         fi
4531 else
4532         echo "I can't compile the test program." >>try.msg
4533         rp="You have a BIG problem.  Shall I abort Configure"
4534         dflt=y
4535 fi
4536 case "$dflt" in
4537 y)
4538         $cat try.msg >&4
4539         case "$knowitall" in
4540         '')
4541                 echo "(The supplied flags or libraries might be incorrect.)"
4542                 ;;
4543         *) dflt=n;;
4544         esac
4545         echo " "
4546         . ./myread
4547         case "$ans" in
4548         n*|N*) ;;
4549         *)      echo "Ok.  Stopping Configure." >&4
4550                 exit 1
4551                 ;;
4552         esac
4553         ;;
4554 n) echo "OK, that should do.";;
4555 esac
4556 $rm -f try try.* core
4557
4558 : define a shorthand compile call
4559 compile='
4560 mc_file=$1;
4561 shift;
4562 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4563 : define a shorthand compile call for compilations that should be ok.
4564 compile_ok='
4565 mc_file=$1;
4566 shift;
4567 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4568
4569 : check for lengths of integral types
4570 echo " "
4571 case "$intsize" in
4572 '')
4573         echo "Checking to see how big your integers are..." >&4
4574         $cat >try.c <<'EOCP'
4575 #include <stdio.h>
4576 int main()
4577 {
4578         printf("intsize=%d;\n", (int)sizeof(int));
4579         printf("longsize=%d;\n", (int)sizeof(long));
4580         printf("shortsize=%d;\n", (int)sizeof(short));
4581         exit(0);
4582 }
4583 EOCP
4584         set try
4585         if eval $compile_ok && $run ./try > /dev/null; then
4586                 eval `$run ./try`
4587                 echo "Your integers are $intsize bytes long."
4588                 echo "Your long integers are $longsize bytes long."
4589                 echo "Your short integers are $shortsize bytes long."
4590         else
4591                 $cat >&4 <<EOM
4592 !
4593 Help! I can't compile and run the intsize test program: please enlighten me!
4594 (This is probably a misconfiguration in your system or libraries, and
4595 you really ought to fix it.  Still, I'll try anyway.)
4596 !
4597 EOM
4598                 dflt=4
4599                 rp="What is the size of an integer (in bytes)?"
4600                 . ./myread
4601                 intsize="$ans"
4602                 dflt=$intsize
4603                 rp="What is the size of a long integer (in bytes)?"
4604                 . ./myread
4605                 longsize="$ans"
4606                 dflt=2
4607                 rp="What is the size of a short integer (in bytes)?"
4608                 . ./myread
4609                 shortsize="$ans"
4610         fi
4611         ;;
4612 esac
4613 $rm -f try try.*
4614
4615 : check for void type
4616 echo " "
4617 echo "Checking to see how well your C compiler groks the void type..." >&4
4618 case "$voidflags" in
4619 '')
4620         $cat >try.c <<'EOCP'
4621 #if TRY & 1
4622 void sub() {
4623 #else
4624 sub() {
4625 #endif
4626         extern void moo();      /* function returning void */
4627         void (*goo)();          /* ptr to func returning void */
4628 #if TRY & 8
4629         void *hue;              /* generic ptr */
4630 #endif
4631 #if TRY & 2
4632         void (*foo[10])();
4633 #endif
4634
4635 #if TRY & 4
4636         if(goo == moo) {
4637                 exit(0);
4638         }
4639 #endif
4640         exit(0);
4641 }
4642 int main() { sub(); }
4643 EOCP
4644         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4645                 voidflags=$defvoidused
4646         echo "Good.  It appears to support void to the level $package wants.">&4
4647                 if $contains warning .out >/dev/null 2>&1; then
4648                         echo "However, you might get some warnings that look like this:"
4649                         $cat .out
4650                 fi
4651         else
4652 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
4653                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4654                         echo "It supports 1..."
4655                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4656                                 echo "It also supports 2..."
4657                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4658                                         voidflags=7
4659                                         echo "And it supports 4 but not 8 definitely."
4660                                 else
4661                                         echo "It doesn't support 4..."
4662                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4663                                                 voidflags=11
4664                                                 echo "But it supports 8."
4665                                         else
4666                                                 voidflags=3
4667                                                 echo "Neither does it support 8."
4668                                         fi
4669                                 fi
4670                         else
4671                                 echo "It does not support 2..."
4672                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4673                                         voidflags=13
4674                                         echo "But it supports 4 and 8."
4675                                 else
4676                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4677                                                 voidflags=5
4678                                                 echo "And it supports 4 but has not heard about 8."
4679                                         else
4680                                                 echo "However it supports 8 but not 4."
4681                                         fi
4682                                 fi
4683                         fi
4684                 else
4685                         echo "There is no support at all for void."
4686                         voidflags=0
4687                 fi
4688         fi
4689 esac
4690 case "$voidflags" in
4691 "$defvoidused") ;;
4692 *)      $cat >&4 <<'EOM'
4693   Support flag bits are:
4694     1: basic void declarations.
4695     2: arrays of pointers to functions returning void.
4696     4: operations between pointers to and addresses of void functions.
4697     8: generic void pointers.
4698 EOM
4699         dflt="$voidflags";
4700         rp="Your void support flags add up to what?"
4701         . ./myread
4702         voidflags="$ans"
4703         ;;
4704 esac
4705 $rm -f try.* .out
4706
4707 : check for length of pointer
4708 echo " "
4709 case "$ptrsize" in
4710 '')
4711         echo "Checking to see how big your pointers are..." >&4
4712         if test "$voidflags" -gt 7; then
4713                 echo '#define VOID_PTR char *' > try.c
4714         else
4715                 echo '#define VOID_PTR void *' > try.c
4716         fi
4717         $cat >>try.c <<'EOCP'
4718 #include <stdio.h>
4719 int main()
4720 {
4721     printf("%d\n", (int)sizeof(VOID_PTR));
4722     exit(0);
4723 }
4724 EOCP
4725         set try
4726         if eval $compile_ok; then
4727                 ptrsize=`$run ./try`
4728                 echo "Your pointers are $ptrsize bytes long."
4729         else
4730                 dflt='4'
4731                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
4732                 rp="What is the size of a pointer (in bytes)?"
4733                 . ./myread
4734                 ptrsize="$ans"
4735         fi
4736         ;;
4737 esac
4738 $rm -f try.c try
4739
4740 : check for long long
4741 echo " "
4742 echo "Checking to see if you have long long..." >&4
4743 echo 'int main() { long long x = 7; return 0; }' > try.c
4744 set try
4745 if eval $compile; then
4746         val="$define"
4747         echo "You have long long."
4748 else
4749         val="$undef"
4750         echo "You do not have long long."
4751 fi
4752 $rm try.*
4753 set d_longlong
4754 eval $setvar
4755
4756 : check for length of long long
4757 case "${d_longlong}${longlongsize}" in
4758 $define)
4759         echo " "
4760         echo "Checking to see how big your long longs are..." >&4
4761         $cat >try.c <<'EOCP'
4762 #include <stdio.h>
4763 int main()
4764 {
4765     printf("%d\n", (int)sizeof(long long));
4766     return(0);
4767 }
4768 EOCP
4769         set try
4770         if eval $compile_ok; then
4771                 longlongsize=`$run ./try`
4772                 echo "Your long longs are $longlongsize bytes long."
4773         else
4774                 dflt='8'
4775                 echo " "
4776                 echo "(I can't seem to compile the test program.  Guessing...)"
4777                 rp="What is the size of a long long (in bytes)?"
4778                 . ./myread
4779                 longlongsize="$ans"
4780         fi
4781         if $test "X$longsize" = "X$longlongsize"; then
4782                 echo "(That isn't any different from an ordinary long.)"
4783         fi      
4784         ;;
4785 esac
4786 $rm -f try.* try
4787
4788 : determine filename position in cpp output
4789 echo " "
4790 echo "Computing filename position in cpp output for #include directives..." >&4
4791 echo '#include <stdio.h>' > foo.c
4792 $cat >fieldn <<EOF
4793 $startsh
4794 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4795 $grep '^[       ]*#.*stdio\.h' | \
4796 while read cline; do
4797         pos=1
4798         set \$cline
4799         while $test \$# -gt 0; do
4800                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4801                         echo "\$pos"
4802                         exit 0
4803                 fi
4804                 shift
4805                 pos=\`expr \$pos + 1\`
4806         done
4807 done
4808 EOF
4809 chmod +x fieldn
4810 fieldn=`./fieldn`
4811 $rm -f foo.c fieldn
4812 case $fieldn in
4813 '') pos='???';;
4814 1) pos=first;;
4815 2) pos=second;;
4816 3) pos=third;;
4817 *) pos="${fieldn}th";;
4818 esac
4819 echo "Your cpp writes the filename in the $pos field of the line."
4820
4821 : locate header file
4822 $cat >findhdr <<EOF
4823 $startsh
4824 wanted=\$1
4825 name=''
4826 for usrincdir in $usrinc
4827 do
4828         if test -f \$usrincdir/\$wanted; then
4829                 echo "\$usrincdir/\$wanted"
4830                 exit 0
4831         fi
4832 done
4833 awkprg='{ print \$$fieldn }'
4834 echo "#include <\$wanted>" > foo\$\$.c
4835 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4836 $grep "^[       ]*#.*\$wanted" | \
4837 while read cline; do
4838         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4839         case "\$name" in
4840         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4841         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4842         *) exit 2;;
4843         esac;
4844 done;
4845 #
4846 # status = 0: grep returned 0 lines, case statement not executed
4847 # status = 1: headerfile found
4848 # status = 2: while loop executed, no headerfile found
4849 #
4850 status=\$?
4851 $rm -f foo\$\$.c;
4852 if test \$status -eq 1; then
4853         exit 0;
4854 fi
4855 exit 1
4856 EOF
4857 chmod +x findhdr
4858
4859 : define an alternate in-header-list? function
4860 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4861 cont=true; xxf="echo \"<\$1> found.\" >&4";
4862 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4863 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4864 esac;
4865 case $# in 4) instead=instead;; *) instead="at last";; esac;
4866 while $test "$cont"; do
4867         xxx=`./findhdr $1`
4868         var=$2; eval "was=\$$2";
4869         if $test "$xxx" && $test -r "$xxx";
4870         then eval $xxf;
4871         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4872                 cont="";
4873         else eval $xxnf;
4874         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4875         set $yyy; shift; shift; yyy=$@;
4876         case $# in 0) cont="";;
4877         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4878                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4879         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4880                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4881         esac;
4882 done;
4883 while $test "$yyy";
4884 do set $yyy; var=$2; eval "was=\$$2";
4885         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4886         set $yyy; shift; shift; yyy=$@;
4887 done'
4888
4889 : see if inttypes.h is available
4890 : we want a real compile instead of Inhdr because some systems
4891 : have an inttypes.h which includes non-existent headers
4892 echo " "
4893 $cat >try.c <<EOCP
4894 #include <inttypes.h>
4895 int main() {
4896         static int32_t foo32 = 0x12345678;
4897 }
4898 EOCP
4899 set try
4900 if eval $compile; then
4901         echo "<inttypes.h> found." >&4
4902         val="$define"
4903 else
4904         echo "<inttypes.h> NOT found." >&4
4905         val="$undef"
4906 fi
4907 $rm -f try.c try
4908 set i_inttypes
4909 eval $setvar
4910
4911 : check for int64_t
4912 echo " "
4913 echo "Checking to see if you have int64_t..." >&4
4914 $cat >try.c <<EOCP
4915 #include <sys/types.h>
4916 #$i_inttypes I_INTTYPES
4917 #ifdef I_INTTYPES
4918 #include <inttypes.h>
4919 #endif
4920 int main() { int64_t x = 7; }
4921 EOCP
4922 set try
4923 if eval $compile; then
4924         val="$define"
4925         echo "You have int64_t."
4926 else
4927         val="$undef"
4928         echo "You do not have int64_t."
4929 fi
4930 $rm -f try try.*
4931 set d_int64_t
4932 eval $setvar
4933
4934
4935 echo " "
4936 echo "Checking which 64-bit integer type we could use..." >&4
4937
4938 case "$intsize" in
4939 8) val=int
4940    set quadtype
4941    eval $setvar
4942    val='"unsigned int"'
4943    set uquadtype
4944    eval $setvar
4945    quadkind=1
4946    ;;
4947 *) case "$longsize" in
4948    8) val=long
4949       set quadtype
4950       eval $setvar
4951       val='"unsigned long"'
4952       set uquadtype
4953       eval $setvar
4954       quadkind=2
4955       ;;
4956    *) case "$d_longlong:$longlongsize" in
4957       define:8)
4958         val='"long long"'
4959         set quadtype
4960         eval $setvar
4961         val='"unsigned long long"'
4962         set uquadtype
4963         eval $setvar
4964         quadkind=3
4965         ;;
4966       *) case "$d_int64_t" in
4967          define)
4968            val=int64_t
4969            set quadtype
4970            eval $setvar
4971            val=uint64_t
4972            set uquadtype
4973            eval $setvar
4974            quadkind=4
4975            ;;
4976          esac
4977          ;;
4978       esac
4979       ;;
4980    esac
4981    ;;
4982 esac
4983
4984 case "$quadtype" in
4985 '')     echo "Alas, no 64-bit integer types in sight." >&4
4986         d_quad="$undef"
4987         ;;
4988 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
4989         d_quad="$define"
4990         ;;
4991 esac
4992
4993
4994 case "$uselonglong" in
4995 "$define"|true|[yY]*)
4996         cat <<EOM >&4
4997
4998 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4999 EOM
5000         use64bitint="$define"
5001         ;;
5002 esac                          
5003 case "$use64bits" in
5004 "$define"|true|[yY]*)
5005         cat <<EOM >&4
5006
5007 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5008 EOM
5009         use64bitint="$define"
5010         ;;
5011 esac                          
5012 case "$use64bitints" in
5013 "$define"|true|[yY]*)
5014         cat <<EOM >&4
5015
5016 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5017 EOM
5018         use64bitint="$define"
5019         ;;
5020 esac                          
5021 case "$use64bitsint" in
5022 "$define"|true|[yY]*)
5023         cat <<EOM >&4
5024
5025 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5026 EOM
5027         use64bitint="$define"
5028         ;;
5029 esac                          
5030 case "$uselonglongs" in
5031 "$define"|true|[yY]*)
5032         cat <<EOM >&4
5033
5034 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5035 EOM
5036         use64bitint="$define"
5037         ;;
5038 esac                          
5039 case "$use64bitsall" in
5040 "$define"|true|[yY]*)
5041         cat <<EOM >&4
5042
5043 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5044 EOM
5045         use64bitall="$define"
5046         ;;
5047 esac                          
5048
5049 case "$ccflags" in
5050 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5051 esac
5052 case "$use64bitall" in
5053 "$define"|true|[yY]*) use64bitint="$define" ;;
5054 esac
5055
5056 case "$longsize" in
5057 8) cat <<EOM
5058
5059 You have natively 64-bit long integers.
5060 EOM
5061    val="$define"
5062    ;;
5063 *) case "$use64bitint" in
5064    "$define"|true|[yY]*) dflt='y';;
5065    *) dflt='n';;
5066    esac
5067    case "$d_quad" in
5068    "$define") ;;
5069    *) dflt='n' ;;
5070    esac
5071    cat <<EOM
5072
5073 Perl can be built to take advantage of 64-bit integer types
5074 on some systems.  To do so, Configure can be run with -Duse64bitint.
5075 Choosing this option will most probably introduce binary incompatibilities.
5076
5077 If this doesn't make any sense to you, just accept the default '$dflt'.
5078 (The default has been chosen based on your configuration.)
5079 EOM
5080    rp='Try to use 64-bit integers, if available?'
5081    . ./myread
5082    case "$ans" in
5083    [yY]*) val="$define" ;;
5084    *)     val="$undef"  ;;
5085    esac
5086    ;;
5087 esac
5088 set use64bitint
5089 eval $setvar
5090
5091 case "$use64bitall" in
5092 "$define"|true|[yY]*) dflt='y' ;;
5093 *) case "$longsize" in
5094    8) dflt='y' ;;
5095    *) dflt='n' ;;
5096    esac
5097    ;;
5098 esac    
5099 cat <<EOM
5100
5101 You may also choose to try maximal 64-bitness.  It means using as much
5102 64-bitness as possible on the platform.  This in turn means even more
5103 binary incompatibilities.  On the other hand, your platform may not
5104 have any more 64-bitness available than what you already have chosen.
5105
5106 If this doesn't make any sense to you, just accept the default '$dflt'.
5107 (The default has been chosen based on your configuration.)
5108 EOM
5109 rp='Try to use maximal 64-bit support, if available?'
5110 . ./myread
5111 case "$ans" in
5112 [yY]*) val="$define" ;;
5113 *)     val="$undef"  ;;
5114 esac
5115 set use64bitall
5116 eval $setvar
5117 case "$use64bitall" in
5118 "$define")
5119         case "$use64bitint" in
5120         "$undef")
5121                 cat <<EOM
5122
5123 Since you have chosen a maximally 64-bit build, I'm also turning on
5124 the use of 64-bit integers.
5125 EOM
5126                 use64bitint="$define" ;;
5127         esac
5128         ;;
5129 esac
5130
5131 case "$use64bitall" in
5132 "$define"|true|[yY]*)
5133         case "$ptrsize" in
5134         4)      cat <<EOM >&4
5135
5136 *** You have chosen a maximally 64-bit build, but your pointers
5137 *** are only 4 bytes wide, disabling maximal 64-bitness.
5138
5139 EOM
5140                 use64bitall="$undef"
5141                 case "$use64bitint" in
5142                 "$define"|true|[yY]*) ;;
5143                 *)      cat <<EOM >&4
5144
5145 *** Downgrading from maximal 64-bitness to using 64-bit integers.
5146
5147 EOM
5148                         use64bitint="$define"
5149                         ;;
5150                 esac
5151                 ;;
5152         esac
5153         ;;
5154 esac
5155
5156 case "$use64bitint" in
5157 "$define"|true|[yY]*)
5158 : Look for a hint-file generated 'call-back-unit'.  If the
5159 : user has specified that a 64-bit perl is to be built,
5160 : we may need to set or change some other defaults.
5161         if $test -f use64bitint.cbu; then
5162                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5163                 . ./use64bitint.cbu
5164         fi
5165         case "$longsize" in
5166         4) case "$archname64" in
5167            '') archname64=64int ;;
5168            esac
5169            ;;
5170         esac
5171         ;;
5172 esac
5173
5174 case "$use64bitall" in
5175 "$define"|true|[yY]*)
5176 : Look for a hint-file generated 'call-back-unit'.  If the
5177 : user has specified that a maximally 64-bit perl is to be built,
5178 : we may need to set or change some other defaults.
5179         if $test -f use64bitall.cbu; then
5180                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5181                 . ./use64bitall.cbu
5182         fi
5183         case "$longsize" in
5184         4) case "$archname64" in
5185            ''|64int) archname64=64all ;;
5186            esac
5187            ;;
5188         esac
5189         ;;
5190 esac
5191
5192 echo " "
5193 echo "Checking for GNU C Library..." >&4
5194 cat >try.c <<EOM
5195 #include <stdio.h>
5196 int main()
5197 {
5198 #ifdef __GLIBC__
5199     exit(0);
5200 #else
5201     exit(1);
5202 #endif
5203 }
5204 EOM
5205 set try
5206 if eval $compile_ok && $run ./try; then
5207         val="$define"
5208         echo "You are using the GNU C Library"
5209 else
5210         val="$undef"
5211         echo "You are not using the GNU C Library"
5212 fi
5213 $rm -f try try.*
5214 set d_gnulibc
5215 eval $setvar
5216
5217 : see if nm is to be used to determine whether a symbol is defined or not
5218 case "$usenm" in
5219 '')
5220         dflt=''
5221         case "$d_gnulibc" in
5222         "$define")
5223                 echo " "
5224                 echo "nm probably won't work on the GNU C Library." >&4
5225                 dflt=n
5226                 ;;
5227         esac
5228         case "$dflt" in
5229         '') 
5230                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5231                         echo " "
5232                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5233                         echo "'nm' won't be sufficient on this sytem." >&4
5234                         dflt=n
5235                 fi
5236                 ;;
5237         esac
5238         case "$dflt" in
5239         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5240                 if $test $dflt -gt 20; then
5241                         dflt=y
5242                 else
5243                         dflt=n
5244                 fi
5245                 ;;
5246         esac
5247         ;;
5248 *)
5249         case "$usenm" in
5250         true|$define) dflt=y;;
5251         *) dflt=n;;
5252         esac
5253         ;;
5254 esac
5255 $cat <<EOM
5256
5257 I can use $nm to extract the symbols from your C libraries. This
5258 is a time consuming task which may generate huge output on the disk (up
5259 to 3 megabytes) but that should make the symbols extraction faster. The
5260 alternative is to skip the 'nm' extraction part and to compile a small
5261 test program instead to determine whether each symbol is present. If
5262 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5263 this may be the best solution.
5264
5265 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5266
5267 EOM
5268 rp="Shall I use $nm to extract C symbols from the libraries?"
5269 . ./myread
5270 case "$ans" in
5271 [Nn]*) usenm=false;;
5272 *) usenm=true;;
5273 esac
5274
5275 runnm=$usenm
5276 case "$reuseval" in
5277 true) runnm=false;;
5278 esac
5279
5280 : nm options which may be necessary
5281 case "$nm_opt" in
5282 '') if $test -f /mach_boot; then
5283                 nm_opt=''       # Mach
5284         elif $test -d /usr/ccs/lib; then
5285                 nm_opt='-p'     # Solaris (and SunOS?)
5286         elif $test -f /dgux; then
5287                 nm_opt='-p'     # DG-UX
5288         elif $test -f /lib64/rld; then
5289                 nm_opt='-p'     # 64-bit Irix
5290         else
5291                 nm_opt=''
5292         fi;;
5293 esac
5294
5295 : nm options which may be necessary for shared libraries but illegal
5296 : for archive libraries.  Thank you, Linux.
5297 case "$nm_so_opt" in
5298 '')     case "$myuname" in
5299         *linux*)
5300                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5301                         nm_so_opt='--dynamic'
5302                 fi
5303                 ;;
5304         esac
5305         ;;
5306 esac
5307
5308 case "$runnm" in
5309 true)
5310 : get list of predefined functions in a handy place
5311 echo " "
5312 case "$libc" in
5313 '') libc=unknown
5314         case "$libs" in
5315         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5316         esac
5317         ;;
5318 esac
5319 case "$libs" in
5320 '') ;;
5321 *)  for thislib in $libs; do
5322         case "$thislib" in
5323         -lc|-lc_s)
5324                 : Handle C library specially below.
5325                 ;;
5326         -l*)
5327                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5328                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5329                         :
5330                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5331                         :
5332                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5333                         :
5334                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5335                         :
5336                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5337                         :
5338                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5339                         :
5340                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5341                         :
5342                 else
5343                         try=''
5344                 fi
5345                 libnames="$libnames $try"
5346                 ;;
5347         *) libnames="$libnames $thislib" ;;
5348         esac
5349         done
5350         ;;
5351 esac
5352 xxx=normal
5353 case "$libc" in
5354 unknown)
5355         set /lib/libc.$so
5356         for xxx in $libpth; do
5357                 $test -r $1 || set $xxx/libc.$so
5358                 : The messy sed command sorts on library version numbers.
5359                 $test -r $1 || \
5360                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5361                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5362                                 h
5363                                 s/[0-9][0-9]*/0000&/g
5364                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5365                                 G
5366                                 s/\n/ /' | \
5367                          $sort | $sed -e 's/^.* //'`
5368                 eval set \$$#
5369         done
5370         $test -r $1 || set /usr/ccs/lib/libc.$so
5371         $test -r $1 || set /lib/libsys_s$_a
5372         ;;
5373 *)
5374         set blurfl
5375         ;;
5376 esac
5377 if $test -r "$1"; then
5378         echo "Your (shared) C library seems to be in $1."
5379         libc="$1"
5380 elif $test -r /lib/libc && $test -r /lib/clib; then
5381         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5382         xxx=apollo
5383         libc='/lib/clib /lib/libc'
5384         if $test -r /lib/syslib; then
5385                 echo "(Your math library is in /lib/syslib.)"
5386                 libc="$libc /lib/syslib"
5387         fi
5388 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5389         echo "Your C library seems to be in $libc, as you said before."
5390 elif $test -r $incpath/usr/lib/libc$_a; then
5391         libc=$incpath/usr/lib/libc$_a;
5392         echo "Your C library seems to be in $libc.  That's fine."
5393 elif $test -r /lib/libc$_a; then
5394         libc=/lib/libc$_a;
5395         echo "Your C library seems to be in $libc.  You're normal."
5396 else
5397         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5398                 :
5399         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5400                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5401         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5402                 :
5403         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5404                 :
5405         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5406                 :
5407         else
5408                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5409         fi
5410         if $test -r "$tans"; then
5411                 echo "Your C library seems to be in $tans, of all places."
5412                 libc=$tans
5413         else
5414                 libc='blurfl'
5415         fi
5416 fi
5417 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5418         dflt="$libc"
5419         cat <<EOM
5420
5421 If the guess above is wrong (which it might be if you're using a strange
5422 compiler, or your machine supports multiple models), you can override it here.
5423
5424 EOM
5425 else
5426         dflt=''
5427         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5428         cat >&4 <<EOM
5429 I can't seem to find your C library.  I've looked in the following places:
5430
5431 EOM
5432         $sed 's/^/      /' libpath
5433         cat <<EOM
5434
5435 None of these seems to contain your C library. I need to get its name...
5436
5437 EOM
5438 fi
5439 fn=f
5440 rp='Where is your C library?'
5441 . ./getfile
5442 libc="$ans"
5443
5444 echo " "
5445 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5446 set X `cat libnames`
5447 shift
5448 xxx=files
5449 case $# in 1) xxx=file; esac
5450 echo "Extracting names from the following $xxx for later perusal:" >&4
5451 echo " "
5452 $sed 's/^/      /' libnames >&4
5453 echo " "
5454 $echo $n "This may take a while...$c" >&4
5455
5456 for file in $*; do
5457         case $file in
5458         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5459         *) $nm $nm_opt $file 2>/dev/null;;
5460         esac
5461 done >libc.tmp
5462
5463 $echo $n ".$c"
5464 $grep fprintf libc.tmp > libc.ptf
5465 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5466 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5467 xxx='[ADTSIW]'
5468 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5469         eval $xscan;\
5470         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5471                 eval $xrun
5472 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5473         eval $xscan;\
5474         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5475                 eval $xrun
5476 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5477         eval $xscan;\
5478         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5479                 eval $xrun
5480 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5481         eval $xscan;\
5482         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5483                 eval $xrun
5484 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5485         eval $xscan;\
5486         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5487                 eval $xrun
5488 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5489         eval $xscan;\
5490         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5491                 eval $xrun
5492 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5493                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5494         eval $xscan;\
5495         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5496                 eval $xrun
5497 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5498         eval $xscan;\
5499         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5500                 eval $xrun
5501 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5502         eval $xscan;\
5503         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5504                 eval $xrun
5505 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5506         eval $xscan;\
5507         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5508                 eval $xrun
5509 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5510         eval $xscan;\
5511         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5512                 eval $xrun
5513 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5514         eval $xscan;\
5515         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5516                 eval $xrun
5517 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5518         eval $xscan;\
5519         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5520                 eval $xrun
5521 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5522         eval $xscan;\
5523         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5524                 eval $xrun
5525 else
5526         $nm -p $* 2>/dev/null >libc.tmp
5527         $grep fprintf libc.tmp > libc.ptf
5528         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5529                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5530         then
5531                 nm_opt='-p'
5532                 eval $xrun
5533         else
5534                 echo " "
5535                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5536                 com=''
5537                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5538                         for thisname in $libnames $libc; do
5539                                 $ar t $thisname >>libc.tmp
5540                         done
5541                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5542                         echo "Ok." >&4
5543                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5544                         # Repeat libc to extract forwarders to DLL entries too
5545                         for thisname in $libnames $libc; do
5546                                 $ar tv $thisname >>libc.tmp
5547                                 # Revision 50 of EMX has bug in $ar.
5548                                 # it will not extract forwarders to DLL entries
5549                                 # Use emximp which will extract exactly them.
5550                                 emximp -o tmp.imp $thisname \
5551                                     2>/dev/null && \
5552                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5553                                     < tmp.imp >>libc.tmp
5554                                 $rm tmp.imp
5555                         done
5556                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5557                         echo "Ok." >&4
5558                 else
5559                         echo "$ar didn't seem to work right." >&4
5560                         echo "Maybe this is a Cray...trying bld instead..." >&4
5561                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5562                         then
5563                                 for thisname in $libnames; do
5564                                         bld t $libnames | \
5565                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5566                                         $ar t $thisname >>libc.tmp
5567                                 done
5568                                 echo "Ok." >&4
5569                         else
5570                                 echo "That didn't work either.  Giving up." >&4
5571                                 exit 1
5572                         fi
5573                 fi
5574         fi
5575 fi
5576 nm_extract="$com"
5577 if $test -f /lib/syscalls.exp; then
5578         echo " "
5579         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5580         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
5581 fi
5582 ;;
5583 esac
5584 $rm -f libnames libpath
5585
5586 : is a C symbol defined?
5587 csym='tlook=$1;
5588 case "$3" in
5589 -v) tf=libc.tmp; tc=""; tdc="";;
5590 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5591 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5592 esac;
5593 tx=yes;
5594 case "$reuseval-$4" in
5595 true-) ;;
5596 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5597 esac;
5598 case "$tx" in
5599 yes)
5600         case "$runnm" in
5601         true)
5602                 if $contains $tlook $tf >/dev/null 2>&1;
5603                 then tval=true;
5604                 else tval=false;
5605                 fi;;
5606         *)
5607                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5608                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5609                 then tval=true;
5610                 else tval=false;
5611                 fi;
5612                 $rm -f t t.c;;
5613         esac;;
5614 *)
5615         case "$tval" in
5616         $define) tval=true;;
5617         *) tval=false;;
5618         esac;;
5619 esac;
5620 eval "$2=$tval"'
5621
5622 : define an is-in-libc? function
5623 inlibc='echo " "; td=$define; tu=$undef;
5624 sym=$1; var=$2; eval "was=\$$2";
5625 tx=yes;
5626 case "$reuseval$was" in
5627 true) ;;
5628 true*) tx=no;;
5629 esac;
5630 case "$tx" in
5631 yes)
5632         set $sym tres -f;
5633         eval $csym;
5634         case "$tres" in
5635         true)
5636                 echo "$sym() found." >&4;
5637                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5638         *)
5639                 echo "$sym() NOT found." >&4;
5640                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5641         esac;;
5642 *)
5643         case "$was" in
5644         $define) echo "$sym() found." >&4;;
5645         *) echo "$sym() NOT found." >&4;;
5646         esac;;
5647 esac'
5648
5649 : see if sqrtl exists
5650 set sqrtl d_sqrtl
5651 eval $inlibc
5652
5653 case "$ccflags" in
5654 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5655 esac
5656
5657 case "$uselongdouble" in
5658 $define|true|[yY]*)     dflt='y';;
5659 *) dflt='n';;
5660 esac
5661 cat <<EOM
5662
5663 Perl can be built to take advantage of long doubles which
5664 (if available) may give more accuracy and range for floating point numbers.
5665
5666 If this doesn't make any sense to you, just accept the default '$dflt'.
5667 EOM
5668 rp='Try to use long doubles if available?'
5669 . ./myread
5670 case "$ans" in
5671 y|Y)    val="$define"   ;;
5672 *)      val="$undef"    ;;
5673 esac
5674 set uselongdouble
5675 eval $setvar
5676
5677 case "$uselongdouble" in
5678 true|[yY]*) uselongdouble="$define" ;;
5679 esac
5680
5681 case "$uselongdouble" in
5682 $define)
5683 : Look for a hint-file generated 'call-back-unit'.  If the
5684 : user has specified that long doubles should be used,
5685 : we may need to set or change some other defaults.
5686         if $test -f uselongdouble.cbu; then
5687                 echo "Your platform has some specific hints for long doubles, using them..."
5688                 . ./uselongdouble.cbu
5689         else
5690                 $cat <<EOM
5691 (Your platform doesn't have any specific hints for long doubles.)
5692 EOM
5693         fi
5694         ;;
5695 esac
5696
5697 case "$uselongdouble:$d_sqrtl" in
5698 $define:$undef)
5699                 $cat <<EOM >&4
5700
5701 *** You requested the use of long doubles but you do not seem to have
5702 *** the mathematic functions for long doubles.  I'm disabling the use
5703 *** of long doubles.
5704
5705 EOM
5706         uselongdouble=$undef
5707         ;;
5708 esac
5709
5710 : check for length of double
5711 echo " "
5712 case "$doublesize" in
5713 '')
5714         echo "Checking to see how big your double precision numbers are..." >&4
5715         $cat >try.c <<'EOCP'
5716 #include <stdio.h>
5717 int main()
5718 {
5719     printf("%d\n", (int)sizeof(double));
5720     exit(0);
5721 }
5722 EOCP
5723         set try
5724         if eval $compile_ok; then
5725                 doublesize=`$run ./try`
5726                 echo "Your double is $doublesize bytes long."
5727         else
5728                 dflt='8'
5729                 echo "(I can't seem to compile the test program.  Guessing...)"
5730                 rp="What is the size of a double precision number (in bytes)?"
5731                 . ./myread
5732                 doublesize="$ans"
5733         fi
5734         ;;
5735 esac
5736 $rm -f try.c try
5737
5738 : check for long doubles
5739 echo " "
5740 echo "Checking to see if you have long double..." >&4
5741 echo 'int main() { long double x = 7.0; }' > try.c
5742 set try
5743 if eval $compile; then
5744         val="$define"
5745         echo "You have long double."
5746 else
5747         val="$undef"
5748         echo "You do not have long double."
5749 fi
5750 $rm try.*
5751 set d_longdbl
5752 eval $setvar
5753
5754 : check for length of long double
5755 case "${d_longdbl}${longdblsize}" in
5756 $define)
5757         echo " "
5758         echo "Checking to see how big your long doubles are..." >&4
5759         $cat >try.c <<'EOCP'
5760 #include <stdio.h>
5761 int main()
5762 {
5763         printf("%d\n", sizeof(long double));
5764 }
5765 EOCP
5766         set try
5767         set try
5768         if eval $compile; then
5769                 longdblsize=`$run ./try`
5770                 echo "Your long doubles are $longdblsize bytes long."
5771         else
5772                 dflt='8'
5773                 echo " "
5774                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5775                 rp="What is the size of a long double (in bytes)?"
5776                 . ./myread
5777                 longdblsize="$ans"
5778         fi
5779         if $test "X$doublesize" = "X$longdblsize"; then
5780                 echo "(That isn't any different from an ordinary double.)"
5781         fi      
5782         ;;
5783 esac
5784 $rm -f try.* try
5785
5786 case "$useperlio" in
5787 $define|true|[yY]*|'')  dflt='y';;
5788 *) dflt='n';;
5789 esac
5790 cat <<EOM
5791
5792 Previous version of $package used the standard IO mechanisms as
5793 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
5794 alternate IO mechanisms via the PerlIO abstraction layer, but the
5795 stdio mechanism is still available if needed.  The abstraction layer
5796 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
5797 Using PerlIO with sfio may cause problems with some extension modules.
5798
5799 If this doesn't make any sense to you, just accept the default '$dflt'.
5800 EOM
5801 rp='Use the PerlIO abstraction layer?'
5802 . ./myread
5803 case "$ans" in
5804 y|Y) 
5805         val="$define"
5806         ;;
5807 *)      
5808         echo "Ok, doing things the stdio way."
5809         val="$undef"
5810         ;;
5811 esac
5812 set useperlio
5813 eval $setvar 
5814
5815 case "$usesocks" in
5816 $define|true|[yY]*)
5817         case "$useperlio" in
5818         $define|true|[yY]*) ;;
5819         *)      cat >&4 <<EOM
5820
5821 You are using the SOCKS proxy protocol library which means that you
5822 should also use the PerlIO layer.  You may be headed for trouble.
5823
5824 EOM
5825                 ;;
5826         esac
5827         ;;
5828 esac
5829
5830         
5831 : determine the architecture name
5832 echo " "
5833 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5834         tarch=`arch`"-$osname"
5835 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5836         if uname -m > tmparch 2>&1 ; then
5837                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5838                         -e 's/$/'"-$osname/" tmparch`
5839         else
5840                 tarch="$osname"
5841         fi
5842         $rm -f tmparch
5843 else
5844         tarch="$osname"
5845 fi
5846 case "$myarchname" in
5847 ''|"$tarch") ;;
5848 *)
5849         echo "(Your architecture name used to be $myarchname.)"
5850         archname=''
5851         ;;
5852 esac
5853 case "$targetarch" in
5854 '') ;;
5855 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5856 esac
5857 myarchname="$tarch"
5858 case "$archname" in
5859 '') dflt="$tarch";;
5860 *) dflt="$archname";;
5861 esac
5862 rp='What is your architecture name'
5863 . ./myread
5864 archname="$ans"
5865 case "$usethreads" in
5866 $define)
5867         echo "Threads selected." >&4
5868         case "$archname" in
5869         *-thread*) echo "...and architecture name already has -thread." >&4
5870                 ;;
5871         *)      archname="$archname-thread"
5872                 echo "...setting architecture name to $archname." >&4
5873                 ;;
5874         esac
5875         ;;
5876 esac
5877 case "$usemultiplicity" in
5878 $define)
5879         echo "Multiplicity selected." >&4
5880         case "$archname" in
5881         *-multi*) echo "...and architecture name already has -multi." >&4
5882                 ;;
5883         *)      archname="$archname-multi"
5884                 echo "...setting architecture name to $archname." >&4
5885                 ;;
5886         esac
5887         ;;
5888 esac
5889 case "$use64bitint$use64bitall" in
5890 *"$define"*)
5891         case "$archname64" in
5892         '')
5893                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5894                 ;;
5895         *)
5896                 case "$use64bitint" in
5897                 "$define") echo "64 bit integers selected." >&4 ;;
5898                 esac
5899                 case "$use64bitall" in
5900                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5901                 esac
5902                 case "$archname" in
5903                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5904                         ;;
5905                 *)      archname="$archname-$archname64"
5906                         echo "...setting architecture name to $archname." >&4
5907                         ;;
5908                 esac
5909                 ;;
5910         esac
5911 esac
5912 case "$uselongdouble" in
5913 $define)
5914         echo "Long doubles selected." >&4
5915         case "$longdblsize" in
5916         $doublesize)
5917                 "...but long doubles are equal to doubles, not changing architecture name." >&4
5918                 ;;
5919         *)
5920                 case "$archname" in
5921                 *-ld*) echo "...and architecture name already has -ld." >&4
5922                         ;;
5923                 *)      archname="$archname-ld"
5924                         echo "...setting architecture name to $archname." >&4
5925                         ;;
5926                 esac
5927                 ;;
5928         esac
5929         ;;
5930 esac
5931 case "$useperlio" in
5932 $define)
5933         echo "Perlio selected." >&4
5934         ;;
5935 *)
5936         echo "Perlio not selected, using stdio." >&4
5937         case "$archname" in
5938         *-stdio*) echo "...and architecture name already has -stdio." >&4
5939                 ;;
5940         *)      archname="$archname-stdio"
5941                 echo "...setting architecture name to $archname." >&4
5942                 ;;
5943         esac
5944         ;;
5945 esac
5946
5947 : determine root of directory hierarchy where package will be installed.
5948 case "$prefix" in
5949 '')
5950         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5951         ;;
5952 *)
5953         dflt="$prefix"
5954         ;;
5955 esac
5956 $cat <<EOM
5957
5958 By default, $package will be installed in $dflt/bin, manual pages
5959 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5960 installation directories. Typically this is something like /usr/local.
5961 If you wish to have binaries under /usr/bin but other parts of the
5962 installation under /usr/local, that's ok: you will be prompted
5963 separately for each of the installation directories, the prefix being
5964 only used to set the defaults.
5965
5966 EOM
5967 fn=d~
5968 rp='Installation prefix to use?'
5969 . ./getfile
5970 oldprefix=''
5971 case "$prefix" in
5972 '') ;;
5973 *)
5974         case "$ans" in
5975         "$prefix") ;;
5976         *) oldprefix="$prefix";;
5977         esac
5978         ;;
5979 esac
5980 prefix="$ans"
5981 prefixexp="$ansexp"
5982
5983 case "$afsroot" in
5984 '')     afsroot=/afs ;;
5985 *)      afsroot=$afsroot ;;
5986 esac
5987
5988 : is AFS running?
5989 echo " "
5990 case "$afs" in
5991 $define|true)   afs=true ;;
5992 $undef|false)   afs=false ;;
5993 *)      if test -d $afsroot; then
5994                 afs=true
5995         else
5996                 afs=false
5997         fi
5998         ;;
5999 esac
6000 if $afs; then
6001         echo "AFS may be running... I'll be extra cautious then..." >&4
6002 else
6003         echo "AFS does not seem to be running..." >&4
6004 fi
6005
6006 : determine installation prefix for where package is to be installed.
6007 if $afs; then 
6008 $cat <<EOM
6009
6010 Since you are running AFS, I need to distinguish the directory in which
6011 files will reside from the directory in which they are installed (and from
6012 which they are presumably copied to the former directory by occult means).
6013
6014 EOM
6015         case "$installprefix" in
6016         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6017         *) dflt="$installprefix";;
6018         esac
6019 else
6020 $cat <<EOM
6021
6022 In some special cases, particularly when building $package for distribution,
6023 it is convenient to distinguish between the directory in which files should 
6024 be installed from the directory ($prefix) in which they 
6025 will eventually reside.  For most users, these two directories are the same.
6026
6027 EOM
6028         case "$installprefix" in
6029         '') dflt=$prefix ;;
6030         *) dflt=$installprefix;;
6031         esac
6032 fi
6033 fn=d~
6034 rp='What installation prefix should I use for installing files?'
6035 . ./getfile
6036 installprefix="$ans"
6037 installprefixexp="$ansexp"
6038
6039 : set the prefixit variable, to compute a suitable default value
6040 prefixit='case "$3" in
6041 ""|none)
6042         case "$oldprefix" in
6043         "") eval "$1=\"\$$2\"";;
6044         *)
6045                 case "$3" in
6046                 "") eval "$1=";;
6047                 none)
6048                         eval "tp=\"\$$2\"";
6049                         case "$tp" in
6050                         ""|" ") eval "$1=\"\$$2\"";;
6051                         *) eval "$1=";;
6052                         esac;;
6053                 esac;;
6054         esac;;
6055 *)
6056         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6057         case "$tp" in
6058         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6059         /*-$oldprefix/*|\~*-$oldprefix/*)
6060                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6061         *) eval "$1=\"\$$2\"";;
6062         esac;;
6063 esac'
6064
6065 : get the patchlevel
6066 echo " "
6067 echo "Getting the current patchlevel..." >&4
6068 if $test -r $rsrc/patchlevel.h;then
6069         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6070         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6071         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6072         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6073         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6074         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6075        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6076 else
6077         revision=0
6078         patchlevel=0
6079         subversion=0
6080         api_revision=0
6081         api_version=0
6082         api_subversion=0
6083         perl_patchlevel=0
6084         $echo "(You do not have patchlevel.h.  Eek.)"
6085 fi
6086 if $test -r $rsrc/.patch ; then  
6087         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6088                 perl_patchlevel=`cat $rsrc/.patch`
6089         fi
6090 fi
6091 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
6092 version_patchlevel_string="version $patchlevel subversion $subversion"
6093 case "$perl_patchlevel" in
6094 0|'') ;;
6095 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
6096 esac
6097
6098 $echo "(You have $package $version_patchlevel_string.)"
6099
6100 case "$osname" in
6101 dos|vms)
6102         : XXX Should be a Configure test for double-dots in filenames.
6103         version=`echo $revision $patchlevel $subversion | \
6104                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6105         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6106                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6107         ;;
6108 *)
6109         version=`echo $revision $patchlevel $subversion | \
6110                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6111         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6112                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6113         ;;
6114 esac
6115 : Special case the 5.005_xx maintenance series, which used 5.005
6116 : without any subversion label as a subdirectory in $sitelib
6117 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6118         api_versionstring='5.005'
6119 fi
6120
6121 : determine installation style
6122 : For now, try to deduce it from prefix unless it is already set.
6123 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6124 case "$installstyle" in
6125 '')     case "$prefix" in
6126                 *perl*) dflt='lib';;
6127                 *) dflt='lib/perl5' ;;
6128         esac
6129         ;;
6130 *)      dflt="$installstyle" ;;
6131 esac
6132 : Probably not worth prompting for this since we prompt for all
6133 : the directories individually, and the prompt would be too long and
6134 : confusing anyway.
6135 installstyle=$dflt
6136
6137 : determine where private library files go
6138 : Usual default is /usr/local/lib/perl5/$version.
6139 : Also allow things like /opt/perl/lib/$version, since 
6140 : /opt/perl/lib/perl5... would be redundant.
6141 : The default "style" setting is made in installstyle.U
6142 case "$installstyle" in
6143 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6144 *)       set dflt privlib lib/$version ;;
6145 esac
6146 eval $prefixit
6147 $cat <<EOM
6148
6149 There are some auxiliary files for $package that need to be put into a
6150 private library directory that is accessible by everyone.
6151
6152 EOM
6153 fn=d~+
6154 rp='Pathname where the private library files will reside?'
6155 . ./getfile
6156 privlib="$ans"
6157 privlibexp="$ansexp"
6158 : Change installation prefix, if necessary.
6159 if $test X"$prefix" != X"$installprefix"; then
6160         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6161 else
6162         installprivlib="$privlibexp"
6163 fi
6164
6165 : set the prefixup variable, to restore leading tilda escape
6166 prefixup='case "$prefixexp" in
6167 "$prefix") ;;
6168 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6169 esac'
6170
6171 : determine where public architecture dependent libraries go
6172 set archlib archlib
6173 eval $prefixit
6174 : privlib default is /usr/local/lib/$package/$version
6175 : archlib default is /usr/local/lib/$package/$version/$archname
6176 : privlib may have an optional trailing /share.
6177 tdflt=`echo $privlib | $sed 's,/share$,,'`
6178 tdflt=$tdflt/$archname
6179 case "$archlib" in
6180 '')     dflt=$tdflt
6181         ;;
6182 *)      dflt="$archlib"
6183     ;;
6184 esac
6185 $cat <<EOM
6186
6187 $spackage contains architecture-dependent library files.  If you are
6188 sharing libraries in a heterogeneous environment, you might store
6189 these files in a separate location.  Otherwise, you can just include
6190 them with the rest of the public library files.
6191
6192 EOM
6193 fn=d+~
6194 rp='Where do you want to put the public architecture-dependent libraries?'
6195 . ./getfile
6196 archlib="$ans"
6197 archlibexp="$ansexp"
6198 if $test X"$archlib" = X"$privlib"; then
6199         d_archlib="$undef"
6200 else
6201         d_archlib="$define"
6202 fi
6203 : Change installation prefix, if necessary.
6204 if $test X"$prefix" != X"$installprefix"; then
6205         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6206 else
6207         installarchlib="$archlibexp"
6208 fi
6209
6210
6211 : Binary compatibility with 5.005 is not possible for builds
6212 : with advanced features
6213 case "$usethreads$usemultiplicity" in
6214 *define*)
6215         bincompat5005="$undef"
6216         d_bincompat5005="$undef"
6217         ;;
6218 *)      $cat <<EOM
6219
6220 This version of Perl can be compiled for binary compatibility with 5.005.
6221 If you decide to do so, you will be able to continue using most of the
6222 extensions that were compiled for Perl 5.005.
6223
6224 EOM
6225         case "$bincompat5005$d_bincompat5005" in
6226         *"$undef"*) dflt=n ;;
6227         *) dflt=y ;;
6228         esac
6229         rp='Binary compatibility with Perl 5.005?'
6230         . ./myread
6231         case "$ans" in
6232         y*) val="$define" ;;
6233         *)  val="$undef" ;;
6234         esac
6235         set d_bincompat5005
6236         eval $setvar
6237         case "$d_bincompat5005" in
6238         "$define")
6239                 bincompat5005="$define"
6240                 ;;
6241         *)      bincompat5005="$undef"
6242                 d_bincompat5005="$undef"
6243                 ;;
6244         esac
6245         ;;
6246 esac
6247
6248
6249 : see if setuid scripts can be secure
6250 $cat <<EOM
6251
6252 Some kernels have a bug that prevents setuid #! scripts from being
6253 secure.  Some sites have disabled setuid #! scripts because of this.
6254
6255 First let's decide if your kernel supports secure setuid #! scripts.
6256 (If setuid #! scripts would be secure but have been disabled anyway,
6257 don't say that they are secure if asked.)
6258
6259 EOM
6260
6261 val="$undef"
6262 if $test -d /dev/fd; then
6263         echo "#!$ls" >reflect
6264         chmod +x,u+s reflect
6265         ./reflect >flect 2>&1
6266         if $contains "/dev/fd" flect >/dev/null; then
6267                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6268                 val="$define"
6269         else
6270                 $cat <<EOM
6271 If you are not sure if they are secure, I can check but I'll need a
6272 username and password different from the one you are using right now.
6273 If you don't have such a username or don't want me to test, simply
6274 enter 'none'.
6275
6276 EOM
6277                 rp='Other username to test security of setuid scripts with?'
6278                 dflt='none'
6279                 . ./myread
6280                 case "$ans" in
6281                 n|none)
6282                         case "$d_suidsafe" in
6283                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6284                                 dflt=n;;
6285                         "$undef")
6286                                 echo "Well, the $hint value is *not* secure." >&4
6287                                 dflt=n;;
6288                         *)      echo "Well, the $hint value *is* secure." >&4
6289                                 dflt=y;;
6290                         esac
6291                         ;;
6292                 *)
6293                         $rm -f reflect flect
6294                         echo "#!$ls" >reflect
6295                         chmod +x,u+s reflect
6296                         echo >flect
6297                         chmod a+w flect
6298                         echo '"su" will (probably) prompt you for '"$ans's password."
6299                         su $ans -c './reflect >flect'
6300                         if $contains "/dev/fd" flect >/dev/null; then
6301                                 echo "Okay, it looks like setuid scripts are secure." >&4
6302                                 dflt=y
6303                         else
6304                                 echo "I don't think setuid scripts are secure." >&4
6305                                 dflt=n
6306                         fi
6307                         ;;
6308                 esac
6309                 rp='Does your kernel have *secure* setuid scripts?'
6310                 . ./myread
6311                 case "$ans" in
6312                 [yY]*)  val="$define";;
6313                 *)      val="$undef";;
6314                 esac
6315         fi
6316 else
6317         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6318         echo "(That's for file descriptors, not floppy disks.)"
6319         val="$undef"
6320 fi
6321 set d_suidsafe
6322 eval $setvar
6323
6324 $rm -f reflect flect
6325
6326 : now see if they want to do setuid emulation
6327 echo " "
6328 val="$undef"
6329 case "$d_suidsafe" in
6330 "$define")
6331         val="$undef"
6332         echo "No need to emulate SUID scripts since they are secure here." >& 4
6333         ;;
6334 *)
6335         $cat <<EOM
6336 Some systems have disabled setuid scripts, especially systems where
6337 setuid scripts cannot be secure.  On systems where setuid scripts have
6338 been disabled, the setuid/setgid bits on scripts are currently
6339 useless.  It is possible for $package to detect those bits and emulate
6340 setuid/setgid in a secure fashion.  This emulation will only work if
6341 setuid scripts have been disabled in your kernel.
6342
6343 EOM
6344         case "$d_dosuid" in
6345         "$define") dflt=y ;;
6346         *) dflt=n ;;
6347         esac
6348         rp="Do you want to do setuid/setgid emulation?"
6349         . ./myread
6350         case "$ans" in
6351         [yY]*)  val="$define";;
6352         *)      val="$undef";;
6353         esac
6354         ;;
6355 esac
6356 set d_dosuid
6357 eval $setvar
6358
6359 : see if this is a malloc.h system
6360 set malloc.h i_malloc
6361 eval $inhdr
6362
6363 : see if stdlib is available
6364 set stdlib.h i_stdlib
6365 eval $inhdr
6366
6367 : determine which malloc to compile in
6368 echo " "
6369 case "$usemymalloc" in
6370 [yY]*|true|$define)     dflt='y' ;;
6371 [nN]*|false|$undef)     dflt='n' ;;
6372 *)      case "$ptrsize" in
6373         4) dflt='y' ;;
6374         *) dflt='n' ;;
6375         esac
6376         ;;
6377 esac
6378 rp="Do you wish to attempt to use the malloc that comes with $package?"
6379 . ./myread
6380 usemymalloc="$ans"
6381 case "$ans" in
6382 y*|true)
6383         usemymalloc='y'
6384         mallocsrc='malloc.c'
6385         mallocobj="malloc$_o"
6386         d_mymalloc="$define"
6387         case "$libs" in
6388         *-lmalloc*)
6389                 : Remove malloc from list of libraries to use
6390                 echo "Removing unneeded -lmalloc from library list" >&4
6391                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6392                 shift
6393                 libs="$*"
6394                 echo "libs = $libs" >&4
6395                 ;;
6396         esac
6397         ;;
6398 *)
6399         usemymalloc='n'
6400         mallocsrc=''
6401         mallocobj=''
6402         d_mymalloc="$undef"
6403         ;;
6404 esac
6405
6406 : compute the return types of malloc and free
6407 echo " "
6408 $cat >malloc.c <<END
6409 #$i_malloc I_MALLOC
6410 #$i_stdlib I_STDLIB
6411 #include <stdio.h>
6412 #include <sys/types.h>
6413 #ifdef I_MALLOC
6414 #include <malloc.h>
6415 #endif
6416 #ifdef I_STDLIB
6417 #include <stdlib.h>
6418 #endif
6419 #ifdef TRY_MALLOC
6420 void *malloc();
6421 #endif
6422 #ifdef TRY_FREE
6423 void free();
6424 #endif
6425 END
6426 case "$malloctype" in
6427 '')
6428         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6429                 malloctype='void *'
6430         else
6431                 malloctype='char *'
6432         fi
6433         ;;
6434 esac
6435 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6436
6437 case "$freetype" in
6438 '')
6439         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6440                 freetype='void'
6441         else
6442                 freetype='int'
6443         fi
6444         ;;
6445 esac
6446 echo "Your system uses $freetype free(), it would seem." >&4
6447 $rm -f malloc.[co]
6448 $cat <<EOM
6449
6450 After $package is installed, you may wish to install various
6451 add-on modules and utilities.  Typically, these add-ons will
6452 be installed under $prefix with the rest
6453 of this package.  However, you may wish to install such add-ons
6454 elsewhere under a different prefix.
6455
6456 If you do not wish to put everything under a single prefix, that's
6457 ok.  You will be prompted for the individual locations; this siteprefix
6458 is only used to suggest the defaults.
6459
6460 The default should be fine for most people.
6461
6462 EOM
6463 fn=d~+
6464 rp='Installation prefix to use for add-on modules and utilities?'
6465 : XXX Here might be another good place for an installstyle setting.
6466 case "$siteprefix" in
6467 '') dflt=$prefix ;;
6468 *)  dflt=$siteprefix ;;
6469 esac
6470 . ./getfile
6471 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6472 oldsiteprefix=''
6473 case "$siteprefix" in
6474 '') ;;
6475 *)      case "$ans" in
6476         "$prefix") ;;
6477         *) oldsiteprefix="$prefix";;
6478         esac
6479         ;;
6480 esac
6481 siteprefix="$ans"
6482 siteprefixexp="$ansexp"
6483
6484 : determine where site specific libraries go.
6485 : Usual default is /usr/local/lib/perl5/site_perl/$version
6486 : The default "style" setting is made in installstyle.U
6487 : XXX No longer works with Prefixit stuff.
6488 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6489 case "$sitelib" in
6490 '') case "$installstyle" in
6491         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6492         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6493         esac
6494         ;;
6495 *)      dflt="$sitelib"
6496         ;;
6497 esac
6498 $cat <<EOM
6499
6500 The installation process will create a directory for
6501 site-specific extensions and modules.  Most users find it convenient
6502 to place all site-specific files in this directory rather than in the
6503 main distribution directory.
6504
6505 EOM
6506 fn=d~+
6507 rp='Pathname for the site-specific library files?'
6508 . ./getfile
6509 sitelib="$ans"
6510 sitelibexp="$ansexp"
6511 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6512 : Change installation prefix, if necessary.
6513 if $test X"$prefix" != X"$installprefix"; then
6514         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6515 else
6516         installsitelib="$sitelibexp"
6517 fi
6518
6519 : determine where site specific architecture-dependent libraries go.
6520 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6521 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6522 : sitelib may have an optional trailing /share.
6523 case "$sitearch" in
6524 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6525         dflt="$dflt/$archname"
6526         ;;
6527 *)      dflt="$sitearch"
6528         ;;
6529 esac
6530 set sitearch sitearch none
6531 eval $prefixit
6532 $cat <<EOM
6533
6534 The installation process will also create a directory for
6535 architecture-dependent site-specific extensions and modules.
6536
6537 EOM
6538 fn=d~+
6539 rp='Pathname for the site-specific architecture-dependent library files?'
6540 . ./getfile
6541 sitearch="$ans"
6542 sitearchexp="$ansexp"
6543 : Change installation prefix, if necessary.
6544 if $test X"$prefix" != X"$installprefix"; then
6545         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6546 else
6547         installsitearch="$sitearchexp"
6548 fi
6549
6550 $cat <<EOM
6551
6552 The installation process will also create a directory for
6553 vendor-supplied add-ons.  Vendors who supply perl with their system
6554 may find it convenient to place all vendor-supplied files in this
6555 directory rather than in the main distribution directory.  This will
6556 ease upgrades between binary-compatible maintenance versions of perl.
6557
6558 Of course you may also use these directories in whatever way you see
6559 fit.  For example, you might use them to access modules shared over a
6560 company-wide network.
6561
6562 The default answer should be fine for most people.
6563 This causes further questions about vendor add-ons to be skipped
6564 and no vendor-specific directories will be configured for perl.
6565
6566 EOM
6567 rp='Do you want to configure vendor-specific add-on directories?'
6568 case "$usevendorprefix" in
6569 define|true|[yY]*) dflt=y ;;
6570 *)      : User may have set vendorprefix directly on Configure command line.
6571         case "$vendorprefix" in
6572         ''|' ') dflt=n ;;
6573         *)      dflt=y ;;
6574         esac
6575         ;;
6576 esac
6577 . ./myread
6578 case "$ans" in
6579 [yY]*)  fn=d~+
6580         rp='Installation prefix to use for vendor-supplied add-ons?'
6581         case "$vendorprefix" in
6582         '') dflt='' ;;
6583         *)  dflt=$vendorprefix ;;
6584         esac
6585         . ./getfile
6586         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6587         oldvendorprefix=''
6588         case "$vendorprefix" in
6589         '') ;;
6590         *)      case "$ans" in
6591                 "$prefix") ;;
6592                 *) oldvendorprefix="$prefix";;
6593                 esac
6594                 ;;
6595         esac
6596         usevendorprefix="$define"
6597         vendorprefix="$ans"
6598         vendorprefixexp="$ansexp"
6599         ;;
6600 *)      usevendorprefix="$undef"
6601         vendorprefix=''
6602         vendorprefixexp=''
6603         ;;
6604 esac
6605
6606 case "$vendorprefix" in
6607 '')     d_vendorlib="$undef"
6608         vendorlib=''
6609         vendorlibexp=''
6610         ;;
6611 *)      d_vendorlib="$define"
6612         : determine where vendor-supplied modules go.
6613         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6614         case "$vendorlib" in
6615         '')
6616                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6617                 case "$installstyle" in
6618                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6619                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6620                 esac
6621                 ;;
6622         *)      dflt="$vendorlib"
6623                 ;;
6624         esac
6625         fn=d~+
6626         rp='Pathname for the vendor-supplied library files?'
6627         . ./getfile
6628         vendorlib="$ans"
6629         vendorlibexp="$ansexp"
6630         ;;
6631 esac
6632 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6633 : Change installation prefix, if necessary.
6634 if $test X"$prefix" != X"$installprefix"; then
6635         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6636 else
6637         installvendorlib="$vendorlibexp"
6638 fi
6639
6640 case "$vendorprefix" in
6641 '')     d_vendorarch="$undef"
6642         vendorarch=''
6643         vendorarchexp=''
6644         ;;
6645 *)      d_vendorarch="$define"
6646         : determine where vendor-supplied architecture-dependent libraries go.
6647         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6648         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6649         : vendorlib may have an optional trailing /share.
6650         case "$vendorarch" in
6651         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6652                 dflt="$dflt/$archname"
6653                 ;;
6654         *)      dflt="$vendorarch" ;;
6655         esac
6656         fn=d~+
6657         rp='Pathname for vendor-supplied architecture-dependent files?'
6658         . ./getfile
6659         vendorarch="$ans"
6660         vendorarchexp="$ansexp"
6661         ;;
6662 esac
6663 : Change installation prefix, if necessary.
6664 if $test X"$prefix" != X"$installprefix"; then
6665         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6666 else
6667         installvendorarch="$vendorarchexp"
6668 fi
6669
6670 : Final catch-all directories to search
6671 $cat <<EOM
6672
6673 Lastly, you can have perl look in other directories for extensions and
6674 modules in addition to those already specified.
6675 These directories will be searched after 
6676         $sitearch 
6677         $sitelib 
6678 EOM
6679 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6680 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6681 echo ' '
6682 case "$otherlibdirs" in
6683 ''|' ') dflt='none' ;;
6684 *)      dflt="$otherlibdirs" ;;
6685 esac
6686 $cat <<EOM
6687 Enter a colon-separated set of extra paths to include in perl's @INC
6688 search path, or enter 'none' for no extra paths.
6689
6690 EOM
6691
6692 rp='Colon-separated list of additional directories for perl to search?'
6693 . ./myread
6694 case "$ans" in
6695 ' '|''|none)    otherlibdirs=' ' ;;     
6696 *)      otherlibdirs="$ans" ;;
6697 esac
6698 case "$otherlibdirs" in
6699 ' ') val=$undef ;;
6700 *)      val=$define ;;
6701 esac
6702 set d_perl_otherlibdirs
6703 eval $setvar
6704
6705 : Cruising for prototypes
6706 echo " "
6707 echo "Checking out function prototypes..." >&4
6708 $cat >prototype.c <<'EOCP'
6709 int main(int argc, char *argv[]) {
6710         exit(0);}
6711 EOCP
6712 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6713         echo "Your C compiler appears to support function prototypes."
6714         val="$define"
6715 else
6716         echo "Your C compiler doesn't seem to understand function prototypes."
6717         val="$undef"
6718 fi
6719 set prototype
6720 eval $setvar
6721 $rm -f prototype*
6722
6723 case "$prototype" in
6724 "$define") ;;
6725 *)      ansi2knr='ansi2knr'
6726         echo " "
6727         cat <<EOM >&4
6728
6729 $me:  FATAL ERROR:
6730 This version of $package can only be compiled by a compiler that 
6731 understands function prototypes.  Unfortunately, your C compiler 
6732         $cc $ccflags
6733 doesn't seem to understand them.  Sorry about that.
6734
6735 If GNU cc is available for your system, perhaps you could try that instead.  
6736
6737 Eventually, we hope to support building Perl with pre-ANSI compilers.
6738 If you would like to help in that effort, please contact <perlbug@perl.org>.
6739
6740 Aborting Configure now.
6741 EOM
6742         exit 2
6743         ;;
6744 esac
6745
6746 : determine where public executables go
6747 echo " "
6748 set dflt bin bin
6749 eval $prefixit
6750 fn=d~
6751 rp='Pathname where the public executables will reside?'
6752 . ./getfile
6753 if $test "X$ansexp" != "X$binexp"; then
6754         installbin=''
6755 fi
6756 bin="$ans"
6757 binexp="$ansexp"
6758 : Change installation prefix, if necessary.
6759 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6760 if $test X"$prefix" != X"$installprefix"; then
6761         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6762 else
6763         installbin="$binexp"
6764 fi
6765
6766 : Find perl5.005 or later.
6767 echo "Looking for a previously installed perl5.005 or later... "
6768 case "$perl5" in
6769 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6770                 : Check if this perl is recent and can load a simple module
6771                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6772                         perl5=$tdir/perl
6773                         break;
6774                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6775                         perl5=$tdir/perl5
6776                         break;
6777                 fi
6778         done
6779         ;;
6780 *)      perl5="$perl5"
6781         ;;
6782 esac
6783 case "$perl5" in
6784 '')     echo "None found.  That's ok.";;
6785 *)      echo "Using $perl5." ;;
6786 esac
6787
6788 : Determine list of previous versions to include in @INC
6789 $cat > getverlist <<EOPL
6790 #!$perl5 -w
6791 use File::Basename;
6792 \$api_versionstring = "$api_versionstring";
6793 \$version = "$version";
6794 \$stem = "$sitelib_stem";
6795 \$archname = "$archname";
6796 EOPL
6797         $cat >> getverlist <<'EOPL'
6798 # Can't have leading @ because metaconfig interprets it as a command!
6799 ;@inc_version_list=();
6800 # XXX Redo to do opendir/readdir? 
6801 if (-d $stem) {
6802     chdir($stem);
6803     ;@candidates = glob("5.*");
6804 }
6805 else {
6806     ;@candidates = ();
6807 }
6808
6809 # XXX ToDo:  These comparisons must be reworked when two-digit
6810 # subversions come along, so that 5.7.10 compares as greater than
6811 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6812 # widespread that we can use the built-in version vectors rather
6813 # than reinventing them here.  For 5.6.0, however, we must
6814 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6815 foreach $d (@candidates) {
6816     if ($d lt $version) {
6817         if ($d ge $api_versionstring) {
6818             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6819         }
6820         elsif ($d ge "5.005") {
6821             unshift(@inc_version_list, grep { -d } $d);
6822         }
6823     }
6824     else {
6825         # Skip newer version.  I.e. don't look in
6826         # 5.7.0 if we're installing 5.6.1.
6827     }
6828 }
6829
6830 if (@inc_version_list) {
6831     print join(' ', @inc_version_list);
6832 }
6833 else {
6834     # Blank space to preserve value for next Configure run.
6835     print " ";
6836 }
6837 EOPL
6838 chmod +x getverlist
6839 case "$inc_version_list" in
6840 '')     if test -x "$perl5$exe_ext"; then
6841                 dflt=`$perl5 getverlist`
6842         else
6843                 dflt='none'
6844         fi
6845         ;;
6846 $undef) dflt='none' ;;
6847 *)  eval dflt=\"$inc_version_list\" ;;
6848 esac
6849 case "$dflt" in
6850 ''|' ') dflt=none ;;
6851 esac
6852 case "$dflt" in
6853 5.005) case "$bincompat5005" in
6854        $define|true|[yY]*) ;;
6855        *) dflt=none ;;
6856        esac
6857        ;;
6858 esac
6859 $cat <<'EOM'
6860
6861 In order to ease the process of upgrading, this version of perl 
6862 can be configured to use modules built and installed with earlier 
6863 versions of perl that were installed under $prefix.  Specify here
6864 the list of earlier versions that this version of perl should check.
6865 If Configure detected no earlier versions of perl installed under
6866 $prefix, then the list will be empty.  Answer 'none' to tell perl
6867 to not search earlier versions.
6868
6869 The default should almost always be sensible, so if you're not sure,
6870 just accept the default.
6871 EOM
6872
6873 rp='List of earlier versions to include in @INC?'
6874 . ./myread
6875 case "$ans" in
6876 [Nn]one|''|' ') inc_version_list=' ' ;;
6877 *) inc_version_list="$ans" ;;
6878 esac
6879 case "$inc_version_list" in
6880 ''|' ') 
6881         inc_version_list_init='0';;
6882 *)      inc_version_list_init=`echo $inc_version_list |
6883                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6884         ;;
6885 esac
6886 $rm -f getverlist
6887
6888 : determine whether to install perl also as /usr/bin/perl
6889
6890 echo " "
6891 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6892         $cat <<EOM
6893 Many scripts expect perl to be installed as /usr/bin/perl.
6894 I can install the perl you are about to compile also as /usr/bin/perl
6895 (in addition to $installbin/perl).
6896 EOM
6897         case "$installusrbinperl" in
6898         "$undef"|[nN]*) dflt='n';;
6899         *)              dflt='y';;
6900         esac
6901         rp="Do you want to install perl as /usr/bin/perl?"
6902         . ./myread
6903         case "$ans" in
6904         [yY]*)  val="$define";;
6905         *)      val="$undef" ;;
6906         esac
6907 else
6908         val="$undef"
6909 fi
6910 set installusrbinperl
6911 eval $setvar
6912
6913 : see if dld is available
6914 set dld.h i_dld
6915 eval $inhdr
6916
6917 : see if dlopen exists
6918 xxx_runnm="$runnm"
6919 runnm=false
6920 set dlopen d_dlopen
6921 eval $inlibc
6922 runnm="$xxx_runnm"
6923
6924 : determine which dynamic loading, if any, to compile in
6925 echo " "
6926 dldir="ext/DynaLoader"
6927 case "$usedl" in
6928 $define|y|true)
6929         dflt='y'
6930         usedl="$define"
6931         ;;
6932 $undef|n|false)
6933         dflt='n'
6934         usedl="$undef"
6935         ;;
6936 *) 
6937         dflt='n'
6938         case "$d_dlopen" in
6939             $define) dflt='y' ;;
6940         esac
6941         case "$i_dld" in
6942             $define) dflt='y' ;;
6943         esac
6944         : Does a dl_xxx.xs file exist for this operating system
6945         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6946         ;;
6947 esac
6948 rp="Do you wish to use dynamic loading?"
6949 . ./myread
6950 usedl="$ans"
6951 case "$ans" in
6952 y*) usedl="$define"
6953         case "$dlsrc" in
6954         '')
6955                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6956                         dflt="$dldir/dl_${osname}.xs"
6957                 elif $test "$d_dlopen" = "$define" ; then
6958                         dflt="$dldir/dl_dlopen.xs"
6959                 elif $test "$i_dld" = "$define" ; then
6960                         dflt="$dldir/dl_dld.xs"
6961                 else
6962                         dflt=''
6963                 fi
6964                 ;;
6965         *)      dflt="$dldir/$dlsrc"
6966                 ;;
6967         esac
6968     echo "The following dynamic loading files are available:"
6969         : Can not go over to $dldir because getfile has path hard-coded in.
6970         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6971         rp="Source file to use for dynamic loading"
6972         fn="fne"
6973         gfpth="$src"
6974         . ./getfile
6975         usedl="$define"
6976         : emulate basename
6977         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6978
6979         $cat << EOM
6980
6981 Some systems may require passing special flags to $cc -c to
6982 compile modules that will be used to create a shared library.
6983 To use no flags, say "none".
6984
6985 EOM
6986     case "$cccdlflags" in
6987     '') case "$gccversion" in
6988                 '') case "$osname" in
6989                         hpux)   dflt='+z' ;;
6990                         next)   dflt='none' ;;
6991                         irix*)  dflt='-KPIC' ;;
6992                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
6993                         sunos)  dflt='-pic' ;;
6994                         *)      dflt='none' ;;
6995                     esac
6996                         ;;
6997                 *)  case "$osname" in
6998                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
6999                         *)      dflt='-fpic' ;;
7000                     esac ;;
7001             esac ;;
7002         ' ') dflt='none' ;;
7003     *)  dflt="$cccdlflags" ;;
7004     esac
7005     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7006     . ./myread
7007     case "$ans" in
7008     none) cccdlflags=' ' ;;
7009     *) cccdlflags="$ans" ;;
7010     esac
7011
7012     cat << EOM
7013
7014 Some systems use ld to create libraries that can be dynamically loaded,
7015 while other systems (such as those using ELF) use $cc.
7016
7017 EOM
7018         case "$ld" in
7019         '')     $cat >try.c <<'EOM'
7020 /* Test for whether ELF binaries are produced */
7021 #include <fcntl.h>
7022 #include <stdlib.h>
7023 int main() {
7024         char b[4];
7025         int i = open("a.out",O_RDONLY);
7026         if(i == -1) 
7027                 exit(1); /* fail */
7028         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7029                 exit(0); /* succeed (yes, it's ELF) */
7030         else
7031                 exit(1); /* fail */
7032 }
7033 EOM
7034                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7035                         cat <<EOM
7036 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7037 EOM
7038                         dflt="$cc"
7039                 else
7040                         echo "I'll use ld to build dynamic libraries."
7041                         dflt='ld'
7042                 fi
7043                 rm -f try.c a.out
7044                 ;;
7045         *)      dflt="$ld"
7046                 ;;
7047         esac
7048
7049     rp="What command should be used to create dynamic libraries?"
7050     . ./myread
7051         ld="$ans"
7052
7053     cat << EOM
7054
7055 Some systems may require passing special flags to $ld to create a
7056 library that can be dynamically loaded.  If your ld flags include
7057 -L/other/path options to locate libraries outside your loader's normal
7058 search path, you may need to specify those -L options here as well.  To
7059 use no flags, say "none".
7060
7061 EOM
7062     case "$lddlflags" in
7063     '') case "$osname" in
7064                         beos) dflt='-nostart' ;;
7065                         hpux) dflt='-b';
7066                               case "$gccversion" in
7067                               '') dflt="$dflt +vnocompatwarnings" ;;
7068                               esac
7069                               ;;        
7070                         linux|irix*)    dflt='-shared' ;;
7071                         next)  dflt='none' ;;
7072                         solaris) dflt='-G' ;;
7073                         sunos) dflt='-assert nodefinitions' ;;
7074                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7075                 *)     dflt='none' ;;
7076                         esac
7077                         ;;
7078     *) dflt="$lddlflags" ;;
7079     esac
7080
7081         : Try to guess additional flags to pick up local libraries.
7082         : Be careful not to append to a plain 'none'
7083         case "$dflt" in
7084         none) dflt='' ;;
7085         esac
7086         for thisflag in $ldflags; do
7087                 case "$thisflag" in
7088                 -L*|-R*)
7089                         case " $dflt " in
7090                         *" $thisflag "*) ;;
7091                         *) dflt="$dflt $thisflag" ;;
7092                         esac
7093                         ;;
7094                 esac
7095         done
7096
7097         case "$dflt" in
7098         ''|' ') dflt='none' ;;
7099         esac
7100
7101     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7102     . ./myread
7103     case "$ans" in
7104     none) lddlflags=' ' ;;
7105     *) lddlflags="$ans" ;;
7106     esac
7107
7108         cat <<EOM
7109
7110 Some systems may require passing special flags to $cc to indicate that
7111 the resulting executable will use dynamic linking.  To use no flags,
7112 say "none".
7113
7114 EOM
7115     case "$ccdlflags" in
7116     '') case "$osname" in
7117                 hpux)   dflt='-Wl,-E' ;;
7118                 linux)  dflt='-rdynamic' ;;
7119                 next)   dflt='none' ;;
7120                 sunos)  dflt='none' ;;
7121                 *)      dflt='none' ;;
7122             esac ;;
7123     ' ')  dflt='none' ;;
7124     *)  dflt="$ccdlflags" ;;
7125     esac
7126     rp="Any special flags to pass to $cc to use dynamic linking?"
7127     . ./myread
7128     case "$ans" in
7129     none) ccdlflags=' ' ;;
7130     *) ccdlflags="$ans" ;;
7131     esac
7132     ;;
7133 *)  usedl="$undef"
7134         ld='ld'
7135     dlsrc='dl_none.xs'
7136     lddlflags=''
7137     ccdlflags=''
7138     ;;
7139 esac
7140
7141 also=''
7142 case "$usedl" in
7143 $undef)
7144         # No dynamic loading being used, so don't bother even to prompt.
7145         useshrplib='false'
7146         ;;
7147 *)      case "$useshrplib" in
7148         '')     case "$osname" in
7149                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7150                         dflt=y
7151                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7152                         ;;
7153                 next*)
7154                         case "$osvers" in
7155                         4*)     dflt=y
7156                                 also='Building a shared libperl is needed for MAB support.'
7157                                 ;;
7158                         *)      dflt=n
7159                                 ;;
7160                         esac
7161                         ;;
7162                 *)      dflt=n
7163                         ;;
7164                 esac
7165                 ;;
7166         $define|true|[Yy]*)
7167                 dflt=y
7168                 ;;
7169         *)      dflt=n
7170                 ;;
7171         esac
7172         $cat << EOM
7173
7174 The perl executable is normally obtained by linking perlmain.c with
7175 libperl${_a}, any static extensions (usually just DynaLoader), and
7176 any other libraries needed on this system (such as -lm, etc.).  Since
7177 your system supports dynamic loading, it is probably possible to build
7178 a shared libperl.$so.  If you will have more than one executable linked
7179 to libperl.$so, this will significantly reduce the size of each
7180 executable, but it may have a noticeable affect on performance.  The
7181 default is probably sensible for your system.
7182 $also
7183
7184 EOM
7185         rp="Build a shared libperl.$so (y/n)"
7186         . ./myread
7187         case "$ans" in
7188         true|$define|[Yy]*)
7189                 useshrplib='true'  ;;
7190         *)      useshrplib='false' ;;
7191         esac
7192         ;;
7193 esac
7194
7195 case "$useshrplib" in
7196 true)
7197         case "$libperl" in
7198         '')
7199                 # Figure out a good name for libperl.so.  Since it gets stored in
7200                 # a version-specific architecture-dependent library, the version
7201                 # number isn't really that important, except for making cc/ld happy.
7202                 #
7203                 # A name such as libperl.so.3.1
7204                 majmin="libperl.$so.$patchlevel.$subversion"
7205                 # A name such as libperl.so.301
7206                 majonly=`echo $patchlevel $subversion |
7207                         $awk '{printf "%d%02d", $1, $2}'`
7208                 majonly=libperl.$so.$majonly
7209                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7210                 # rely on figuring it out from the naming of libc.
7211                 case "${osname}${osvers}" in
7212                 next4*)
7213                         dflt=libperl.5.$so
7214                         # XXX How handle the --version stuff for MAB?
7215                         ;;
7216                 linux*)  # ld won't link with a bare -lperl otherwise.
7217                         dflt=libperl.$so
7218                         ;;
7219                 cygwin*) # include version
7220                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
7221                         ;;
7222                 *)      # Try to guess based on whether libc has major.minor.
7223                         case "$libc" in
7224                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7225                         *libc.$so.[0-9]*) dflt=$majonly ;;
7226                         *)      dflt=libperl.$so ;;
7227                         esac
7228                         ;;
7229                 esac
7230                 ;;
7231         *)      dflt=$libperl
7232                 ;;
7233         esac
7234         cat << EOM
7235
7236 I need to select a good name for the shared libperl.  If your system uses
7237 library names with major and minor numbers, then you might want something
7238 like $majmin.  Alternatively, if your system uses a single version
7239 number for shared libraries, then you might want to use $majonly.
7240 Or, your system might be quite happy with a simple libperl.$so.
7241
7242 Since the shared libperl will get installed into a version-specific
7243 architecture-dependent directory, the version number of the shared perl
7244 library probably isn't important, so the default should be o.k.
7245
7246 EOM
7247         rp='What name do you want to give to the shared libperl?'
7248         . ./myread
7249         libperl=$ans
7250         echo "Ok, I'll use $libperl"
7251         ;;
7252 *)
7253         libperl="libperl${_a}"
7254         ;;
7255 esac
7256
7257 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7258 case "$shrpdir" in
7259 '') ;;
7260 *)      $cat >&4 <<EOM
7261 WARNING:  Use of the shrpdir variable for the installation location of
7262 the shared $libperl is not supported.  It was never documented and
7263 will not work in this version.  Let me (perlbug@perl.org)
7264 know of any problems this may cause.
7265
7266 EOM
7267         case "$shrpdir" in
7268         "$archlibexp/CORE")
7269                 $cat >&4 <<EOM
7270 But your current setting of $shrpdir is
7271 the default anyway, so it's harmless.
7272 EOM
7273                 ;;
7274         *)
7275                 $cat >&4 <<EOM
7276 Further, your current attempted setting of $shrpdir
7277 conflicts with the value of $archlibexp/CORE
7278 that installperl will use.
7279 EOM
7280                 ;;
7281         esac
7282         ;;
7283 esac
7284
7285 # How will the perl executable find the installed shared $libperl?
7286 # Add $xxx to ccdlflags.
7287 # If we can't figure out a command-line option, use $shrpenv to
7288 # set env LD_RUN_PATH.  The main perl makefile uses this.
7289 shrpdir=$archlibexp/CORE
7290 xxx=''
7291 tmp_shrpenv=''
7292 if "$useshrplib"; then
7293     case "$osname" in 
7294         aix)
7295                 # We'll set it in Makefile.SH...
7296                 ;;
7297         solaris|netbsd)
7298                 xxx="-R $shrpdir"
7299                 ;;
7300         freebsd)
7301                 xxx="-Wl,-R$shrpdir"
7302                 ;;
7303         linux|irix*|dec_osf)
7304                 xxx="-Wl,-rpath,$shrpdir"
7305                 ;;
7306         next)
7307                 # next doesn't like the default...
7308                 ;;
7309         beos)
7310                 # beos doesn't like the default, either.
7311                 ;;
7312         hpux*)
7313                 # hpux doesn't like the default, either.
7314                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7315                 ;;
7316         *)
7317                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7318                 ;;
7319         esac
7320         case "$xxx" in
7321         '') ;;
7322         *)      
7323                 # Only add $xxx if it isn't already in ccdlflags.
7324                 case " $ccdlflags " in
7325                 *" $xxx "*)     ;;
7326                 *)      ccdlflags="$ccdlflags $xxx"
7327                         cat <<EOM >&4
7328
7329 Adding $xxx to the flags
7330 passed to $ld so that the perl executable will find the 
7331 installed shared $libperl.
7332
7333 EOM
7334                         ;;
7335                 esac
7336                 ;;
7337         esac
7338 fi
7339 # Fix ccdlflags in AIX for building external extensions.
7340 # (For building Perl itself bare -bE:perl.exp is needed,
7341 #  Makefile.SH takes care of this.)
7342 case "$osname" in
7343 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7344 esac
7345 # Respect a hint or command-line value.
7346 case "$shrpenv" in
7347 '') shrpenv="$tmp_shrpenv" ;;
7348 esac
7349 case "$ldlibpthname" in
7350 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7351 none)   ldlibpthname='' ;;
7352 esac
7353
7354 : determine where manual pages are on this system
7355 echo " "
7356 case "$sysman" in
7357 '') 
7358         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
7359         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
7360         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7361         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7362         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7363         sysman=`./loc . /usr/man/man1 $syspath`
7364         ;;
7365 esac
7366 if $test -d "$sysman"; then
7367         echo "System manual is in $sysman." >&4
7368 else
7369         echo "Could not find manual pages in source form." >&4
7370 fi
7371
7372 : determine where manual pages go
7373 set man1dir man1dir none
7374 eval $prefixit
7375 $cat <<EOM
7376
7377 $spackage has manual pages available in source form.
7378 EOM
7379 case "$nroff" in
7380 nroff)
7381         echo "However, you don't have nroff, so they're probably useless to you."
7382         case "$man1dir" in
7383         '') man1dir="none";;
7384         esac;;
7385 esac
7386 echo "If you don't want the manual sources installed, answer 'none'."
7387 case "$man1dir" in
7388 ' ') dflt=none
7389         ;;
7390 '')
7391         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
7392         lookpath="$lookpath $prefixexp/man/p_man/man1"
7393         lookpath="$lookpath $prefixexp/man/u_man/man1"
7394         lookpath="$lookpath $prefixexp/man/man.1"
7395         case "$sysman" in
7396         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7397         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7398         esac
7399         set dflt
7400         eval $prefixup
7401         ;;
7402 *)  dflt="$man1dir"
7403         ;;
7404 esac
7405 echo " "
7406 fn=dn+~
7407 rp="Where do the main $spackage manual pages (source) go?"
7408 . ./getfile
7409 if $test "X$man1direxp" != "X$ansexp"; then
7410         installman1dir=''
7411 fi
7412 man1dir="$ans"
7413 man1direxp="$ansexp"
7414 case "$man1dir" in
7415 '')     man1dir=' '
7416         installman1dir='';;
7417 esac
7418
7419 : Change installation prefix, if necessary.
7420 if $test X"$prefix" != X"$installprefix"; then
7421         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7422 else
7423         installman1dir="$man1direxp"
7424 fi
7425
7426 : What suffix to use on installed man pages
7427
7428 case "$man1dir" in
7429 ' ')
7430         man1ext='0'
7431         ;;
7432 *)
7433         rp="What suffix should be used for the main $spackage man pages?"
7434         case "$man1ext" in
7435         '')     case "$man1dir" in
7436                 *1)  dflt=1 ;;
7437                 *1p) dflt=1p ;;
7438                 *1pm) dflt=1pm ;;
7439                 *l) dflt=l;;
7440                 *n) dflt=n;;
7441                 *o) dflt=o;;
7442                 *p) dflt=p;;
7443                 *C) dflt=C;;
7444                 *L) dflt=L;;
7445                 *L1) dflt=L1;;
7446                 *) dflt=1;;
7447                 esac
7448                 ;;
7449         *)      dflt="$man1ext";;
7450         esac
7451         . ./myread
7452         man1ext="$ans"
7453         ;;
7454 esac
7455
7456 : see if we can have long filenames
7457 echo " "
7458 first=123456789abcdef
7459 $rm -f $first
7460 if (echo hi >$first) 2>/dev/null; then
7461         if $test -f 123456789abcde; then
7462                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
7463                 val="$undef"
7464         else
7465                 echo 'You can have filenames longer than 14 characters.'>&4
7466                 val="$define"
7467         fi
7468 else
7469         $cat <<'EOM'
7470 You can't have filenames longer than 14 chars.
7471 You can't even think about them!
7472 EOM
7473         val="$undef"
7474 fi 
7475 set d_flexfnam
7476 eval $setvar
7477 $rm -rf 123456789abcde*
7478
7479 : determine where library module manual pages go
7480 set man3dir man3dir none
7481 eval $prefixit
7482 $cat <<EOM
7483
7484 $spackage has manual pages for many of the library modules.
7485 EOM
7486
7487 case "$nroff" in
7488 nroff)
7489         $cat <<'EOM'
7490 However, you don't have nroff, so they're probably useless to you.
7491 EOM
7492         case "$man3dir" in
7493         '') man3dir="none";;
7494         esac;;
7495 esac
7496
7497 case "$d_flexfnam" in
7498 undef)
7499         $cat <<'EOM'
7500 However, your system can't handle the long file names like File::Basename.3. 
7501 EOM
7502         case "$man3dir" in
7503         '') man3dir="none";;
7504         esac;;
7505 esac
7506
7507 echo "If you don't want the manual sources installed, answer 'none'."
7508 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7509 case "$man3dir" in
7510 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7511         if $test -d "$privlib/man/man3"; then
7512                 cat <<EOM >&4
7513
7514 WARNING:  Previous versions of perl installed man3 pages into
7515 $privlib/man/man3.  This version will suggest a 
7516 new default of $dflt.  
7517 EOM
7518                 tdflt=$dflt
7519                 dflt='n'
7520                 rp='Do you wish to preserve the old behavior?(y/n)'
7521                 . ./myread
7522                 case "$ans" in
7523                 y*) dflt="$privlib/man/man3" ;;
7524                 *)  dflt=$tdflt ;;
7525                 esac
7526     fi
7527         ;;
7528 *)      dflt="$man3dir" ;;
7529 esac
7530 case "$dflt" in
7531 ' ') dflt=none ;;
7532 esac
7533 echo " "
7534 fn=dn+~
7535 rp="Where do the $package library man pages (source) go?"
7536 . ./getfile
7537 man3dir="$ans"
7538 man3direxp="$ansexp"
7539 case "$man3dir" in
7540 '')     man3dir=' '
7541         installman3dir='';;
7542 esac
7543
7544 : Change installation prefix, if necessary.
7545 if $test X"$prefix" != X"$installprefix"; then
7546         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7547 else
7548         installman3dir="$man3direxp"
7549 fi
7550
7551 : What suffix to use on installed man pages
7552 case "$man3dir" in
7553 ' ')
7554         man3ext='0'
7555         ;;
7556 *)
7557         rp="What suffix should be used for the $package library man pages?"
7558         case "$man3ext" in
7559         '')     case "$man3dir" in
7560                 *3)  dflt=3 ;;
7561                 *3p) dflt=3p ;;
7562                 *3pm) dflt=3pm ;;
7563                 *l) dflt=l;;
7564                 *n) dflt=n;;
7565                 *o) dflt=o;;
7566                 *p) dflt=p;;
7567                 *C) dflt=C;;
7568                 *L) dflt=L;;
7569                 *L3) dflt=L3;;
7570                 *) dflt=3;;
7571                 esac
7572                 ;;
7573         *)      dflt="$man3ext";;
7574         esac
7575         . ./myread
7576         man3ext="$ans"
7577         ;;
7578 esac
7579
7580 : see if we have to deal with yellow pages, now NIS.
7581 if $test -d /usr/etc/yp || $test -d /etc/yp; then
7582         if $test -f /usr/etc/nibindd; then
7583                 echo " "
7584                 echo "I'm fairly confident you're on a NeXT."
7585                 echo " "
7586                 rp='Do you get the hosts file via NetInfo?'
7587                 dflt=y
7588                 case "$hostcat" in
7589                 nidump*) ;;
7590                 '') ;;
7591                 *) dflt=n;;
7592                 esac
7593                 . ./myread
7594                 case "$ans" in
7595                 y*) hostcat='nidump hosts .';;
7596                 *)      case "$hostcat" in
7597                         nidump*) hostcat='';;
7598                         esac
7599                         ;;
7600                 esac
7601         fi
7602         case "$hostcat" in
7603         nidump*) ;;
7604         *)
7605                 case "$hostcat" in
7606                 *ypcat*) dflt=y;;
7607                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7608                                 dflt=y
7609                         else
7610                                 dflt=n
7611                         fi;;
7612                 *) dflt=n;;
7613                 esac
7614                 echo " "
7615                 rp='Are you getting the hosts file via yellow pages?'
7616                 . ./myread
7617                 case "$ans" in
7618                 y*) hostcat='ypcat hosts';;
7619                 *) hostcat='cat /etc/hosts';;
7620                 esac
7621                 ;;
7622         esac
7623 fi
7624 case "$hostcat" in
7625 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7626 esac
7627 case "$groupcat" in
7628 '') test -f /etc/group && groupcat='cat /etc/group';;
7629 esac
7630 case "$passcat" in
7631 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7632 esac
7633
7634 : now get the host name
7635 echo " "
7636 echo "Figuring out host name..." >&4
7637 case "$myhostname" in
7638 '') cont=true
7639         echo 'Maybe "hostname" will work...'
7640         if tans=`sh -c hostname 2>&1` ; then
7641                 myhostname=$tans
7642                 phostname=hostname
7643                 cont=''
7644         fi
7645         ;;
7646 *) cont='';;
7647 esac
7648 if $test "$cont"; then
7649         if ./xenix; then
7650                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7651                 if tans=`cat /etc/systemid 2>&1` ; then
7652                         myhostname=$tans
7653                         phostname='cat /etc/systemid'
7654                         echo "Whadyaknow.  Xenix always was a bit strange..."
7655                         cont=''
7656                 fi
7657         elif $test -r /etc/systemid; then
7658                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7659         fi
7660 fi
7661 if $test "$cont"; then
7662         echo 'No, maybe "uuname -l" will work...'
7663         if tans=`sh -c 'uuname -l' 2>&1` ; then
7664                 myhostname=$tans
7665                 phostname='uuname -l'
7666         else
7667                 echo 'Strange.  Maybe "uname -n" will work...'
7668                 if tans=`sh -c 'uname -n' 2>&1` ; then
7669                         myhostname=$tans
7670                         phostname='uname -n'
7671                 else
7672                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7673                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7674                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7675                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7676                         else
7677                                 case "$myhostname" in
7678                                 '') echo "Does this machine have an identity crisis or something?"
7679                                         phostname='';;
7680                                 *)
7681                                         echo "Well, you said $myhostname before..."
7682                                         phostname='echo $myhostname';;
7683                                 esac
7684                         fi
7685                 fi
7686         fi
7687 fi
7688 : you do not want to know about this
7689 set $myhostname
7690 myhostname=$1
7691
7692 : verify guess
7693 if $test "$myhostname" ; then
7694         dflt=y
7695         rp='Your host name appears to be "'$myhostname'".'" Right?"
7696         . ./myread
7697         case "$ans" in
7698         y*) ;;
7699         *) myhostname='';;
7700         esac
7701 fi
7702
7703 : bad guess or no guess
7704 while $test "X$myhostname" = X ; do
7705         dflt=''
7706         rp="Please type the (one word) name of your host:"
7707         . ./myread
7708         myhostname="$ans"
7709 done
7710
7711 : translate upper to lower if necessary
7712 case "$myhostname" in
7713 *[A-Z]*)
7714         echo "(Normalizing case in your host name)"
7715         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7716         ;;
7717 esac
7718
7719 case "$myhostname" in
7720 *.*)
7721         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7722         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7723         echo "(Trimming domain name from host name--host name is now $myhostname)"
7724         ;;
7725 *) case "$mydomain" in
7726         '')
7727                 {
7728                         test "X$hostcat" = "Xypcat hosts" &&
7729                         ypmatch "$myhostname" hosts 2>/dev/null |\
7730                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7731                         $test -s hosts
7732                 } || {
7733                         test "X$hostcat" != "X" &&
7734                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7735                                         /[       ]$myhostname[  . ]/p" > hosts
7736                 }
7737                 tmp_re="[       . ]"
7738                 if $test -f hosts; then
7739                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7740                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7741                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7742                                 hosts | $sort | $uniq | \
7743                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7744                         case `$echo X$dflt` in
7745                         X*\ *)  echo "(Several hosts in the database matched hostname)"
7746                                 dflt=.
7747                                 ;;
7748                         X.) echo "(You do not have fully-qualified names in the hosts database)"
7749                                 ;;
7750                         esac
7751                 else
7752                         echo "(I cannot locate a hosts database anywhere)"
7753                         dflt=.
7754                 fi
7755                 case "$dflt" in
7756                 .)
7757                         tans=`./loc resolv.conf X /etc /usr/etc`
7758                         if $test -f "$tans"; then
7759                                 echo "(Attempting domain name extraction from $tans)"
7760                                 dflt=.`$sed -n -e 's/   / /g' \
7761                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7762                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7763                                 case "$dflt" in
7764                                 .) dflt=.`$sed -n -e 's/        / /g' \
7765                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7766                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7767                                         ;;
7768                                 esac
7769                         fi
7770                         ;;
7771                 esac
7772                 case "$dflt" in
7773                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7774                         dflt=.`sh -c domainname 2>/dev/null`
7775                         case "$dflt" in
7776                         '') dflt='.';;
7777                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7778                         esac
7779                         ;;
7780                 esac
7781                 case "$dflt$osname" in
7782                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
7783                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
7784                         ;;
7785                 esac
7786                 case "$dflt" in
7787                 .) echo "(Lost all hope -- silly guess then)"
7788                         dflt='.uucp'
7789                         ;;
7790                 esac
7791                 $rm -f hosts
7792                 ;;
7793         *) dflt="$mydomain";;
7794         esac;;
7795 esac
7796 echo " "
7797 rp="What is your domain name?"
7798 . ./myread
7799 tans="$ans"
7800 case "$ans" in
7801 '') ;;
7802 .*) ;;
7803 *) tans=".$tans";;
7804 esac
7805 mydomain="$tans"
7806
7807 : translate upper to lower if necessary
7808 case "$mydomain" in
7809 *[A-Z]*)
7810         echo "(Normalizing case in your domain name)"
7811         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7812         ;;
7813 esac
7814
7815 : a little sanity check here
7816 case "$phostname" in
7817 '') ;;
7818 *)
7819         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7820         $myhostname$mydomain|$myhostname) ;;
7821         *)
7822                 case "$phostname" in
7823                 sed*)
7824                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7825                         ;;
7826                 *)
7827                         echo "(That doesn't agree with your $phostname command, by the way.)"
7828                         ;;
7829                 esac
7830         ;;
7831         esac
7832         ;;
7833 esac
7834
7835 $cat <<EOM
7836
7837 I need to get your e-mail address in Internet format if possible, i.e.
7838 something like user@host.domain. Please answer accurately since I have
7839 no easy means to double check it. The default value provided below
7840 is most probably close to reality but may not be valid from outside
7841 your organization...
7842
7843 EOM
7844 cont=x
7845 while test "$cont"; do
7846         case "$cf_email" in
7847         '') dflt="$cf_by@$myhostname$mydomain";;
7848         *) dflt="$cf_email";;
7849         esac
7850         rp='What is your e-mail address?'
7851         . ./myread
7852         cf_email="$ans"
7853         case "$cf_email" in
7854         *@*.*) cont='' ;;
7855         *)
7856                 rp='Address does not look like an Internet one.  Use it anyway?'
7857                 case "$fastread" in
7858                 yes) dflt=y ;;
7859                 *) dflt=n ;;
7860                 esac
7861                 . ./myread
7862                 case "$ans" in
7863                 y*) cont='' ;;
7864                 *) echo " " ;;
7865                 esac
7866                 ;;
7867         esac
7868 done
7869
7870 $cat <<EOM
7871
7872 If you or somebody else will be maintaining perl at your site, please
7873 fill in the correct e-mail address here so that they may be contacted
7874 if necessary. Currently, the "perlbug" program included with perl
7875 will send mail to this address in addition to perlbug@perl.org. You may
7876 enter "none" for no administrator.
7877
7878 EOM
7879 case "$perladmin" in
7880 '') dflt="$cf_email";;
7881 *) dflt="$perladmin";;
7882 esac
7883 rp='Perl administrator e-mail address'
7884 . ./myread
7885 perladmin="$ans"
7886
7887 : determine whether to only install version-specific parts.
7888 echo " "
7889 $cat <<EOM
7890 Do you want to install only the version-specific parts of the perl
7891 distribution?  Usually you do *not* want to do this.
7892 EOM
7893 case "$versiononly" in
7894 "$define"|[Yy]*|true) dflt='y' ;;
7895 *) dflt='n';
7896 esac
7897 rp="Do you want to install only the version-specific parts of perl?"
7898 . ./myread
7899 case "$ans" in
7900 [yY]*)  val="$define";;
7901 *)      val="$undef" ;;
7902 esac
7903 set versiononly
7904 eval $setvar
7905
7906 : figure out how to guarantee perl startup
7907 case "$startperl" in
7908 '')
7909         case "$sharpbang" in
7910         *!)
7911                 $cat <<EOH
7912
7913 I can use the #! construct to start perl on your system. This will
7914 make startup of perl scripts faster, but may cause problems if you
7915 want to share those scripts and perl is not in a standard place
7916 ($binexp/perl) on all your platforms. The alternative is to force
7917 a shell by starting the script with a single ':' character.
7918
7919 EOH
7920                 case "$versiononly" in
7921                 "$define")      dflt="$binexp/perl$version";;  
7922                 *)              dflt="$binexp/perl";;
7923                 esac
7924                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7925                 . ./myread
7926                 case "$ans" in
7927                 none)   startperl=": # use perl";;
7928                 *)      startperl="#!$ans"
7929                         if $test 30 -lt `echo "$ans" | wc -c`; then
7930                                 $cat >&4 <<EOM
7931
7932 WARNING:  Some systems limit the #! command to 32 characters.
7933 If you experience difficulty running Perl scripts with #!, try
7934 installing Perl in a directory with a shorter pathname.
7935
7936 EOM
7937                         fi ;;
7938                 esac
7939                 ;;
7940         *) startperl=": # use perl"
7941                 ;;
7942         esac
7943         ;;
7944 esac
7945 echo "I'll use $startperl to start perl scripts."
7946
7947 : figure best path for perl in scripts
7948 case "$perlpath" in
7949 '')
7950         perlpath="$binexp/perl"
7951         case "$startperl" in
7952         *!*) ;;
7953         *)
7954                 $cat <<EOH
7955
7956 I will use the "eval 'exec'" idiom to start Perl on your system.
7957 I can use the full path of your Perl binary for this purpose, but
7958 doing so may cause problems if you want to share those scripts and
7959 Perl is not always in a standard place ($binexp/perl).
7960
7961 EOH
7962                 dflt="$binexp/perl"
7963                 rp="What path shall I use in \"eval 'exec'\"?"
7964                 . ./myread
7965                 perlpath="$ans"
7966                 ;;
7967         esac
7968         ;;
7969 esac
7970 case "$startperl" in
7971 *!*)    ;;
7972 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7973 esac
7974
7975 : determine where public executable scripts go
7976 set scriptdir scriptdir
7977 eval $prefixit
7978 case "$scriptdir" in
7979 '')
7980         dflt="$bin"
7981         : guess some guesses
7982         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7983         $test -d /usr/share/bin     && dflt=/usr/share/bin
7984         $test -d /usr/local/script  && dflt=/usr/local/script
7985         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7986         $test -d $prefixexp/script  && dflt=$prefixexp/script
7987         set dflt
7988         eval $prefixup
7989         ;;
7990 *)  dflt="$scriptdir"
7991         ;;
7992 esac
7993 $cat <<EOM
7994  
7995 Some installations have a separate directory just for executable scripts so
7996 that they can mount it across multiple architectures but keep the scripts in
7997 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7998 Or you might just lump your scripts in with all your other executables.
7999  
8000 EOM
8001 fn=d~
8002 rp='Where do you keep publicly executable scripts?'
8003 . ./getfile
8004 if $test "X$ansexp" != "X$scriptdirexp"; then
8005         installscript=''
8006 fi
8007 scriptdir="$ans"
8008 scriptdirexp="$ansexp"
8009 : Change installation prefix, if necessary.
8010 if $test X"$prefix" != X"$installprefix"; then
8011         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8012 else
8013         installscript="$scriptdirexp"
8014 fi
8015
8016 : determine where add-on public executables go
8017 case "$sitebin" in
8018 '')     dflt=$siteprefix/bin ;;
8019 *)      dflt=$sitebin ;;
8020 esac
8021 fn=d~
8022 rp='Pathname where the add-on public executables should be installed?'
8023 . ./getfile
8024 sitebin="$ans"
8025 sitebinexp="$ansexp"
8026 : Change installation prefix, if necessary.
8027 if $test X"$prefix" != X"$installprefix"; then
8028         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8029 else
8030         installsitebin="$sitebinexp"
8031 fi
8032
8033 : define an is-a-typedef? function
8034 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8035 case "$inclist" in
8036 "") inclist="sys/types.h";;
8037 esac;
8038 eval "varval=\$$var";
8039 case "$varval" in
8040 "")
8041         $rm -f temp.c;
8042         for inc in $inclist; do
8043                 echo "#include <$inc>" >>temp.c;
8044         done;
8045         echo "#ifdef $type" >> temp.c;
8046         echo "printf(\"We have $type\");" >> temp.c;
8047         echo "#endif" >> temp.c;
8048         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8049         if $contains $type temp.E >/dev/null 2>&1; then
8050                 eval "$var=\$type";
8051         else
8052                 eval "$var=\$def";
8053         fi;
8054         $rm -f temp.?;;
8055 *) eval "$var=\$varval";;
8056 esac'
8057
8058 : define an is-a-typedef? function that prompts if the type is not available.
8059 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8060 case "$inclist" in
8061 "") inclist="sys/types.h";;
8062 esac;
8063 eval "varval=\$$var";
8064 case "$varval" in
8065 "")
8066         $rm -f temp.c;
8067         for inc in $inclist; do
8068                 echo "#include <$inc>" >>temp.c;
8069         done;
8070         echo "#ifdef $type" >> temp.c;
8071         echo "printf(\"We have $type\");" >> temp.c;
8072         echo "#endif" >> temp.c;
8073         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8074         echo " " ;
8075         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8076         if $contains $type temp.E >/dev/null 2>&1; then
8077                 echo "$type found." >&4;
8078                 eval "$var=\$type";
8079         else
8080                 echo "$type NOT found." >&4;
8081                 dflt="$def";
8082                 . ./myread ;
8083                 eval "$var=\$ans";
8084         fi;
8085         $rm -f temp.?;;
8086 *) eval "$var=\$varval";;
8087 esac'
8088
8089 : see what type lseek is declared as in the kernel
8090 rp="What is the type used for lseek's offset on this system?"
8091 set off_t lseektype long stdio.h sys/types.h
8092 eval $typedef_ask
8093
8094 echo " "
8095 echo "Checking to see how big your file offsets are..." >&4
8096 $cat >try.c <<EOCP
8097 #include <sys/types.h>
8098 #include <stdio.h>
8099 int main()
8100 {
8101     printf("%d\n", (int)sizeof($lseektype));
8102     return(0); 
8103 }
8104 EOCP
8105 set try
8106 if eval $compile_ok; then
8107         lseeksize=`$run ./try`
8108         echo "Your file offsets are $lseeksize bytes long."
8109 else
8110         dflt=$longsize
8111         echo " "
8112         echo "(I can't seem to compile the test program.  Guessing...)"
8113         rp="What is the size of your file offsets (in bytes)?"
8114         . ./myread
8115         lseeksize="$ans"
8116 fi
8117 $rm -f try.c try
8118
8119 : see what type file positions are declared as in the library
8120 rp="What is the type for file position used by fsetpos()?"
8121 set fpos_t fpostype long stdio.h sys/types.h
8122 eval $typedef_ask
8123
8124 echo " "
8125 case "$fpostype" in
8126 *_t) zzz="$fpostype"    ;;
8127 *)   zzz="fpos_t"       ;;
8128 esac
8129 echo "Checking the size of $zzz..." >&4 
8130 cat > try.c <<EOCP
8131 #include <sys/types.h>
8132 #include <stdio.h>
8133 int main() {
8134     printf("%d\n", (int)sizeof($fpostype));
8135     exit(0);
8136 }
8137 EOCP
8138 set try
8139 if eval $compile_ok; then
8140         yyy=`$run ./try`
8141         case "$yyy" in
8142         '')     fpossize=4
8143                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8144                 ;;
8145         *)      fpossize=$yyy
8146                 echo "Your $zzz is $fpossize bytes long."
8147                 ;;
8148         esac
8149 else
8150         dflt="$longsize"
8151         echo " " >&4
8152         echo "(I can't compile the test program.  Guessing...)" >&4
8153         rp="What is the size of your file positions (in bytes)?"
8154         . ./myread
8155         fpossize="$ans"
8156 fi
8157
8158
8159
8160 # Backward compatibility (uselfs is deprecated).
8161 case "$uselfs" in
8162 "$define"|true|[yY]*)
8163         cat <<EOM >&4
8164
8165 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8166 EOM
8167         uselargefiles="$define"
8168         ;;
8169 esac                          
8170
8171 case "$lseeksize:$fpossize" in
8172 8:8) cat <<EOM
8173
8174 You can have files larger than 2 gigabytes.
8175 EOM
8176    val="$define" ;;
8177 *)    case "$uselargefiles" in
8178    "$undef"|false|[nN]*) dflt='n' ;;
8179    *)   dflt='y' ;;
8180    esac
8181    cat <<EOM
8182
8183 Perl can be built to understand large files (files larger than 2 gigabytes)
8184 on some systems.  To do so, Configure can be run with -Duselargefiles.
8185
8186 If this doesn't make any sense to you, just accept the default '$dflt'.
8187 EOM
8188    rp='Try to understand large files, if available?'
8189    . ./myread
8190    case "$ans" in
8191    y|Y)         val="$define" ;;
8192    *)           val="$undef"  ;;
8193    esac
8194    ;;
8195 esac
8196 set uselargefiles
8197 eval $setvar
8198 case "$uselargefiles" in
8199 "$define")
8200 : Look for a hint-file generated 'call-back-unit'.  If the
8201 : user has specified that a large files perl is to be built,
8202 : we may need to set or change some other defaults.
8203         if $test -f uselargefiles.cbu; then
8204                 echo "Your platform has some specific hints for large file builds, using them..."
8205                 . ./uselargefiles.cbu
8206                 echo " "
8207                 echo "Rechecking to see how big your file offsets are..." >&4
8208                 $cat >try.c <<EOCP
8209 #include <sys/types.h>
8210 #include <stdio.h>
8211 int main()
8212 {
8213     printf("%d\n", (int)sizeof($lseektype));
8214     return(0); 
8215 }
8216 EOCP
8217                 set try
8218                 if eval $compile_ok; then
8219                         lseeksize=`$run ./try`
8220                         $echo "Your file offsets are now $lseeksize bytes long."
8221                 else
8222                         dflt="$lseeksize"
8223                         echo " "
8224                         echo "(I can't seem to compile the test program.  Guessing...)"
8225                         rp="What is the size of your file offsets (in bytes)?"
8226                         . ./myread
8227                         lseeksize="$ans"
8228                 fi
8229                 case "$fpostype" in
8230                 *_t) zzz="$fpostype"    ;;
8231                 *)   zzz="fpos_t"       ;;
8232                 esac
8233                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8234                 $cat > try.c <<EOCP
8235 #include <sys/types.h>
8236 #include <stdio.h>
8237 int main() {
8238     printf("%d\n", (int)sizeof($fpostype));
8239     exit(0);
8240 }
8241 EOCP
8242                 set try
8243                 if eval $compile_ok; then
8244                         yyy=`$run ./try`
8245                         dflt="$lseeksize"
8246                         case "$yyy" in
8247                         '')     echo " "
8248                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8249                                 ;;
8250                         *)      fpossize=$yyy
8251                                 echo " $fpossize bytes." >&4
8252                                 ;;
8253                         esac
8254                 else
8255                         dflt="$fpossize"
8256                         echo " "
8257                         echo "(I can't compile the test program.  Guessing...)" >&4
8258                         rp="What is the size of your file positions (in bytes)?"
8259                         . ./myread
8260                         fpossize="$ans"
8261                 fi
8262                 $rm -f try.c try
8263         fi
8264         ;;
8265 esac
8266
8267 case "$vendorprefix" in
8268 '')     d_vendorbin="$undef"
8269         vendorbin=''
8270         vendorbinexp=''
8271         ;;
8272 *)      d_vendorbin="$define"
8273         : determine where vendor-supplied executables go.
8274         case "$vendorbin" in
8275         '') dflt=$vendorprefix/bin ;;
8276         *)      dflt="$vendorbin" ;;
8277         esac
8278         fn=d~+
8279         rp='Pathname for the vendor-supplied executables directory?'
8280         . ./getfile
8281         vendorbin="$ans"
8282         vendorbinexp="$ansexp"
8283         ;;
8284 esac
8285 : Change installation prefix, if necessary.
8286 if $test X"$prefix" != X"$installprefix"; then
8287         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8288 else
8289         installvendorbin="$vendorbinexp"
8290 fi
8291
8292 : see if qgcvt exists
8293 set qgcvt d_qgcvt
8294 eval $inlibc
8295
8296 echo " "
8297
8298 if $test X"$d_longdbl" = X"$define"; then
8299
8300 echo "Checking how to print long doubles..." >&4
8301
8302 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
8303         $cat >try.c <<'EOCP'
8304 #include <sys/types.h>
8305 #include <stdio.h>
8306 int main() {
8307   double d = 123.456;
8308   printf("%.3f\n", d);
8309 }
8310 EOCP
8311         set try
8312         if eval $compile; then
8313                 yyy=`$run ./try`
8314                 case "$yyy" in
8315                 123.456)
8316                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
8317                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
8318                         echo "We will use %f."
8319                         ;;
8320                 esac
8321         fi
8322 fi
8323
8324 if $test X"$sPRIfldbl" = X; then
8325         $cat >try.c <<'EOCP'
8326 #include <sys/types.h>
8327 #include <stdio.h>
8328 int main() {
8329   long double d = 123.456;
8330   printf("%.3Lf\n", d);
8331 }
8332 EOCP
8333         set try
8334         if eval $compile; then
8335                 yyy=`$run ./try`
8336                 case "$yyy" in
8337                 123.456)
8338                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
8339                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
8340                         echo "We will use %Lf."
8341                         ;;
8342                 esac
8343         fi
8344 fi
8345
8346 if $test X"$sPRIfldbl" = X; then
8347         $cat >try.c <<'EOCP'
8348 #include <sys/types.h>
8349 #include <stdio.h>
8350 int main() {
8351   long double d = 123.456;
8352   printf("%.3llf\n", d);
8353 }
8354 EOCP
8355         set try
8356         if eval $compile; then
8357                 yyy=`$run ./try`
8358                 case "$yyy" in
8359                 123.456)
8360                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
8361                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
8362                         echo "We will use %llf."
8363                         ;;
8364                 esac
8365         fi
8366 fi
8367
8368 if $test X"$sPRIfldbl" = X; then
8369         $cat >try.c <<'EOCP'
8370 #include <sys/types.h>
8371 #include <stdio.h>
8372 int main() {
8373   long double d = 123.456;
8374   printf("%.3lf\n", d);
8375 }
8376 EOCP
8377         set try
8378         if eval $compile; then
8379                 yyy=`$run ./try`
8380                 case "$yyy" in
8381                 123.456)
8382                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
8383                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
8384                         echo "We will use %lf."
8385                         ;;
8386                 esac
8387         fi
8388 fi
8389
8390 if $test X"$sPRIfldbl" = X; then
8391         echo "Cannot figure out how to print long doubles." >&4
8392 else
8393         sSCNfldbl=$sPRIfldbl    # expect consistency
8394 fi
8395
8396 $rm -f try try.*
8397
8398 fi # d_longdbl
8399
8400 case "$sPRIfldbl" in
8401 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
8402         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
8403         d_SCNfldbl="$undef";
8404         ;;
8405 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
8406         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
8407         d_SCNfldbl="$define";
8408         ;;
8409 esac
8410
8411 : Check how to convert floats to strings.
8412 echo " "
8413 echo "Checking for an efficient way to convert floats to strings."
8414 echo " " > try.c
8415 case "$uselongdouble" in
8416 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8417 esac
8418 case "$d_longdbl" in
8419 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8420 esac
8421 case "$d_PRIgldbl" in
8422 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
8423 esac
8424 $cat >>try.c <<EOP
8425 #ifdef TRY_gconvert
8426 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8427 char *myname = "gconvert";
8428 #endif
8429 #ifdef TRY_gcvt
8430 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8431 char *myname = "gcvt";
8432 #endif
8433 #ifdef TRY_qgcvt
8434 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8435 char *myname = "qgcvt";
8436 #define DOUBLETYPE long double
8437 #endif
8438 #ifdef TRY_sprintf
8439 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
8440 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8441 #else
8442 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8443 #endif
8444 char *myname = "sprintf";
8445 #endif
8446
8447 #ifndef DOUBLETYPE
8448 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8449 #define DOUBLETYPE long double
8450 #else
8451 #define DOUBLETYPE double
8452 #endif
8453 #endif
8454
8455 #include <stdio.h>
8456
8457 #define I_STDLIB $i_stdlib
8458 #ifdef I_STDLIB
8459 #include <stdlib.h>
8460 #endif
8461
8462 int
8463 checkit(expect, got)
8464 char *expect;
8465 char *got;
8466 {
8467     if (strcmp(expect, got)) {
8468                 printf("%s oddity:  Expected %s, got %s\n",
8469                         myname, expect, got);
8470                 exit(1);
8471         }
8472 }
8473
8474 int main()
8475
8476         char buf[64]; 
8477         buf[63] = '\0';
8478
8479         /* This must be 1st test on (which?) platform */
8480         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8481         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8482         checkit("0.1", buf);
8483
8484         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
8485         checkit("1", buf);
8486
8487         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
8488         checkit("1.1", buf);
8489
8490         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
8491         checkit("1.01", buf);
8492
8493         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
8494         checkit("1.001", buf);
8495
8496         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
8497         checkit("1.0001", buf);
8498
8499         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
8500         checkit("1.00001", buf);
8501
8502         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
8503         checkit("1.000001", buf);
8504
8505         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
8506         checkit("0", buf);
8507
8508         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
8509         checkit("-1", buf);
8510
8511         /* Some Linux gcvt's give 1.e+5 here. */
8512         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
8513         checkit("100000", buf);
8514         
8515         /* Some Linux gcvt's give -1.e+5 here. */
8516         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
8517         checkit("-100000", buf);
8518
8519         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
8520         checkit("123.456", buf);
8521
8522         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
8523         Gconvert((DOUBLETYPE)1e30, 8, 0, buf);
8524         if (strlen(buf) > 5)
8525             checkit("1e+030", buf); /* for Microsoft */
8526         else
8527             checkit("1e+30", buf);
8528
8529         exit(0);
8530 }
8531 EOP
8532 case "$d_Gconvert" in
8533 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
8534 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
8535 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
8536 *) xxx_list='gconvert gcvt sprintf' ;;
8537 esac
8538
8539 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
8540 "$define$define$define")
8541     # for long doubles prefer first qgcvt, then sprintf
8542     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
8543     xxx_list="sprintf $xxx_list"
8544     case "$d_qgcvt" in
8545     "$define") xxx_list="qgcvt $xxx_list" ;;
8546     esac
8547     ;;
8548 esac
8549
8550 for xxx_convert in $xxx_list; do
8551         echo "Trying $xxx_convert..."
8552         $rm -f try try$_o
8553         set try -DTRY_$xxx_convert
8554         if eval $compile; then
8555                 echo "$xxx_convert() found." >&4
8556                 if $run ./try; then
8557                         echo "I'll use $xxx_convert to convert floats into a string." >&4
8558                         break;
8559                 else
8560                         echo "...But $xxx_convert didn't work as I expected."
8561                 fi
8562         else
8563                 echo "$xxx_convert NOT found." >&4
8564         fi
8565 done
8566         
8567 case "$xxx_convert" in
8568 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
8569 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
8570 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
8571 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
8572    "$define$define$define")
8573       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
8574    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
8575    esac
8576    ;;  
8577 esac
8578
8579 : see if _fwalk exists
8580 set fwalk d__fwalk
8581 eval $inlibc
8582
8583 : Initialize h_fcntl
8584 h_fcntl=false
8585
8586 : Initialize h_sysfile
8587 h_sysfile=false
8588
8589 : access call always available on UNIX
8590 set access d_access
8591 eval $inlibc
8592
8593 : locate the flags for 'access()'
8594 case "$d_access" in
8595 "$define")
8596         echo " "
8597         $cat >access.c <<'EOCP'
8598 #include <sys/types.h>
8599 #ifdef I_FCNTL
8600 #include <fcntl.h>
8601 #endif
8602 #ifdef I_SYS_FILE
8603 #include <sys/file.h>
8604 #endif
8605 #ifdef I_UNISTD
8606 #include <unistd.h>
8607 #endif
8608 int main() {
8609         exit(R_OK);
8610 }
8611 EOCP
8612         : check sys/file.h first, no particular reason here
8613         if $test `./findhdr sys/file.h` && \
8614                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
8615                 h_sysfile=true;
8616                 echo "<sys/file.h> defines the *_OK access constants." >&4
8617         elif $test `./findhdr fcntl.h` && \
8618                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
8619                 h_fcntl=true;
8620                 echo "<fcntl.h> defines the *_OK access constants." >&4
8621         elif $test `./findhdr unistd.h` && \
8622                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
8623                 echo "<unistd.h> defines the *_OK access constants." >&4
8624         else
8625                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
8626         fi
8627         ;;
8628 esac
8629 $rm -f access*
8630
8631 : see if accessx exists
8632 set accessx d_accessx
8633 eval $inlibc
8634
8635 : see if alarm exists
8636 set alarm d_alarm
8637 eval $inlibc
8638
8639 : see if atolf exists
8640 set atolf d_atolf
8641 eval $inlibc
8642
8643 : see if atoll exists
8644 set atoll d_atoll
8645 eval $inlibc
8646
8647 : Look for GNU-cc style attribute checking
8648 echo " "
8649 echo "Checking whether your compiler can handle __attribute__ ..." >&4
8650 $cat >attrib.c <<'EOCP'
8651 #include <stdio.h>
8652 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
8653 EOCP
8654 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
8655         if $contains 'warning' attrib.out >/dev/null 2>&1; then
8656                 echo "Your C compiler doesn't fully support __attribute__."
8657                 val="$undef"
8658         else
8659                 echo "Your C compiler supports __attribute__."
8660                 val="$define"
8661         fi
8662 else
8663         echo "Your C compiler doesn't seem to understand __attribute__ at all."
8664         val="$undef"
8665 fi
8666 set d_attribut
8667 eval $setvar
8668 $rm -f attrib*
8669
8670 : see if bcmp exists
8671 set bcmp d_bcmp
8672 eval $inlibc
8673
8674 : see if bcopy exists
8675 set bcopy d_bcopy
8676 eval $inlibc
8677
8678 : see if this is a unistd.h system
8679 set unistd.h i_unistd
8680 eval $inhdr
8681
8682 : see if getpgrp exists
8683 set getpgrp d_getpgrp
8684 eval $inlibc
8685
8686 case "$d_getpgrp" in
8687 "$define")
8688         echo " "
8689         echo "Checking to see which flavor of getpgrp is in use..."
8690         $cat >try.c <<EOP
8691 #$i_unistd I_UNISTD
8692 #include <sys/types.h>
8693 #ifdef I_UNISTD
8694 #  include <unistd.h>
8695 #endif
8696 int main()
8697 {
8698         if (getuid() == 0) {
8699                 printf("(I see you are running Configure as super-user...)\n");
8700                 setuid(1);
8701         }
8702 #ifdef TRY_BSD_PGRP
8703         if (getpgrp(1) == 0)
8704                 exit(0);
8705 #else
8706         if (getpgrp() > 0)
8707                 exit(0);
8708 #endif
8709         exit(1);
8710 }
8711 EOP
8712         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
8713                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
8714                 val="$define"
8715         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
8716                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
8717                 val="$undef"
8718         else
8719                 echo "I can't seem to compile and run the test program."
8720                 if ./usg; then
8721                         xxx="a USG one, i.e. you use getpgrp()."
8722                 else
8723                         # SVR4 systems can appear rather BSD-ish.
8724                         case "$i_unistd" in
8725                         $undef)
8726                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
8727                                 val="$define"
8728                                 ;;
8729                         $define)
8730                                 xxx="probably a USG one, i.e. you use getpgrp()."
8731                                 val="$undef"
8732                                 ;;
8733                         esac
8734                 fi
8735                 echo "Assuming your getpgrp is $xxx" >&4
8736         fi
8737         ;;
8738 *) val="$undef";;
8739 esac
8740 set d_bsdgetpgrp
8741 eval $setvar
8742 $rm -f try try.*
8743
8744 : see if setpgrp exists
8745 set setpgrp d_setpgrp
8746 eval $inlibc
8747
8748 case "$d_setpgrp" in
8749 "$define")
8750         echo " "
8751         echo "Checking to see which flavor of setpgrp is in use..."
8752         $cat >try.c <<EOP
8753 #$i_unistd I_UNISTD
8754 #include <sys/types.h>
8755 #ifdef I_UNISTD
8756 #  include <unistd.h>
8757 #endif
8758 int main()
8759 {
8760         if (getuid() == 0) {
8761                 printf("(I see you are running Configure as super-user...)\n");
8762                 setuid(1);
8763         }
8764 #ifdef TRY_BSD_PGRP
8765         if (-1 == setpgrp(1, 1))
8766                 exit(0);
8767 #else
8768         if (setpgrp() != -1)
8769                 exit(0);
8770 #endif
8771         exit(1);
8772 }
8773 EOP
8774         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
8775                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8776                 val="$define"
8777         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
8778                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8779                 val="$undef"
8780         else
8781                 echo "(I can't seem to compile and run the test program.)"
8782                 if ./usg; then
8783                         xxx="a USG one, i.e. you use setpgrp()."
8784                 else
8785                         # SVR4 systems can appear rather BSD-ish.
8786                         case "$i_unistd" in
8787                         $undef)
8788                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8789                                 val="$define"
8790                                 ;;
8791                         $define)
8792                                 xxx="probably a USG one, i.e. you use setpgrp()."
8793                                 val="$undef"
8794                                 ;;
8795                         esac
8796                 fi
8797                 echo "Assuming your setpgrp is $xxx" >&4
8798         fi
8799         ;;
8800 *) val="$undef";;
8801 esac
8802 set d_bsdsetpgrp
8803 eval $setvar
8804 $rm -f try try.*
8805 : see if bzero exists
8806 set bzero d_bzero
8807 eval $inlibc
8808
8809 : see if signal is declared as pointer to function returning int or void
8810 echo " "
8811 xxx=`./findhdr signal.h`
8812 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8813 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
8814         echo "You have int (*signal())() instead of void." >&4
8815         val="$undef"
8816 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
8817         echo "You have void (*signal())()." >&4
8818         val="$define"
8819 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8820         echo "You have int (*signal())() instead of void." >&4
8821         val="$undef"
8822 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8823         echo "You have void (*signal())()." >&4
8824         val="$define"
8825 else
8826         case "$d_voidsig" in
8827         '')
8828         echo "I can't determine whether signal handler returns void or int..." >&4
8829                 dflt=void
8830                 rp="What type does your signal handler return?"
8831                 . ./myread
8832                 case "$ans" in
8833                 v*) val="$define";;
8834                 *) val="$undef";;
8835                 esac;;
8836         "$define")
8837                 echo "As you already told me, signal handler returns void." >&4
8838                 val="$define"
8839                 ;;
8840         *)      echo "As you already told me, signal handler returns int." >&4
8841                 val="$undef"
8842                 ;;
8843         esac
8844 fi
8845 set d_voidsig
8846 eval $setvar
8847 case "$d_voidsig" in
8848 "$define") signal_t="void";;
8849 *) signal_t="int";;
8850 esac
8851 $rm -f $$.tmp
8852
8853 : check for ability to cast large floats to 32-bit ints.
8854 echo " "
8855 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8856 if $test "$intsize" -ge 4; then
8857         xxx=int
8858 else
8859         xxx=long
8860 fi
8861 $cat >try.c <<EOCP
8862 #include <stdio.h>
8863 #include <sys/types.h>
8864 #include <signal.h>
8865 $signal_t blech(s) int s; { exit(3); }
8866 int main()
8867 {
8868         $xxx i32;
8869         double f, g;
8870         int result = 0;
8871         char str[16];
8872         signal(SIGFPE, blech);
8873
8874         /* Don't let compiler optimize the test away.  Store the number 
8875            in a writable string for gcc to pass to sscanf under HP/UX.
8876         */
8877         sprintf(str, "2147483647");
8878         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8879         g = 10 * f;
8880         i32  = ($xxx) g;
8881
8882         /* x86 processors will probably give 0x8000 0000, which is a
8883        sign change.  We don't want that.  We want to mimic SPARC
8884            behavior here, which is to preserve the sign and give
8885            back 0x7fff ffff.
8886         */
8887         if (i32 != ($xxx) f)
8888                 result |= 1;
8889         exit(result);
8890 }
8891 EOCP
8892 set try
8893 if eval $compile_ok; then
8894         $run ./try
8895         yyy=$?
8896 else
8897         echo "(I can't seem to compile the test program--assuming it can't)"
8898         yyy=1
8899 fi
8900 case "$yyy" in
8901 0)      val="$define"
8902         echo "Yup, it can."
8903         ;;
8904 *)      val="$undef"
8905         echo "Nope, it can't."
8906         ;;
8907 esac
8908 set d_casti32
8909 eval $setvar
8910 $rm -f try try.*
8911
8912 : check for ability to cast negative floats to unsigned
8913 echo " "
8914 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8915 $cat >try.c <<EOCP
8916 #include <stdio.h>
8917 #include <sys/types.h>
8918 #include <signal.h>
8919 $signal_t blech(s) int s; { exit(7); }
8920 $signal_t blech_in_list(s) int s; { exit(4); }
8921 unsigned long dummy_long(p) unsigned long p; { return p; }
8922 unsigned int dummy_int(p) unsigned int p; { return p; }
8923 unsigned short dummy_short(p) unsigned short p; { return p; }
8924 int main()
8925 {
8926         double f;
8927         unsigned long along;
8928         unsigned int aint;
8929         unsigned short ashort;
8930         int result = 0;
8931         char str[16];
8932         
8933         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8934            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8935            optimized the whole file away
8936         */
8937         /* Store the number in a writable string for gcc to pass to 
8938            sscanf under HP/UX.
8939         */
8940         sprintf(str, "-123");
8941         sscanf(str, "%lf", &f);  /* f = -123.; */
8942
8943         signal(SIGFPE, blech);
8944         along = (unsigned long)f;
8945         aint = (unsigned int)f;
8946         ashort = (unsigned short)f;
8947         if (along != (unsigned long)-123)
8948                 result |= 1;
8949         if (aint != (unsigned int)-123)
8950                 result |= 1;
8951         if (ashort != (unsigned short)-123)
8952                 result |= 1;
8953         sprintf(str, "1073741824.");
8954         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8955         f = f + f;
8956         along = 0;
8957         along = (unsigned long)f;
8958         if (along != 0x80000000)
8959                 result |= 2;
8960         f -= 1.;
8961         along = 0;
8962         along = (unsigned long)f;
8963         if (along != 0x7fffffff)
8964                 result |= 1;
8965         f += 2.;
8966         along = 0;
8967         along = (unsigned long)f;
8968         if (along != 0x80000001)
8969                 result |= 2;
8970         if (result)
8971                 exit(result);
8972         signal(SIGFPE, blech_in_list);
8973         sprintf(str, "123.");
8974         sscanf(str, "%lf", &f);  /* f = 123.; */
8975         along = dummy_long((unsigned long)f);
8976         aint = dummy_int((unsigned int)f);
8977         ashort = dummy_short((unsigned short)f);
8978         if (along != (unsigned long)123)
8979                 result |= 4;
8980         if (aint != (unsigned int)123)
8981                 result |= 4;
8982         if (ashort != (unsigned short)123)
8983                 result |= 4;
8984         exit(result);
8985
8986 }
8987 EOCP
8988 set try
8989 if eval $compile_ok; then
8990         $run ./try
8991         castflags=$?
8992 else
8993         echo "(I can't seem to compile the test program--assuming it can't)"
8994         castflags=7
8995 fi
8996 case "$castflags" in
8997 0)      val="$define"
8998         echo "Yup, it can."
8999         ;;
9000 *)      val="$undef"
9001         echo "Nope, it can't."
9002         ;;
9003 esac
9004 set d_castneg
9005 eval $setvar
9006 $rm -f try.*
9007
9008 : see if vprintf exists
9009 echo " "
9010 if set vprintf val -f d_vprintf; eval $csym; $val; then
9011         echo 'vprintf() found.' >&4
9012         val="$define"
9013         $cat >try.c <<'EOF'
9014 #include <varargs.h>
9015
9016 int main() { xxx("foo"); }
9017
9018 xxx(va_alist)
9019 va_dcl
9020 {
9021         va_list args;
9022         char buf[10];
9023
9024         va_start(args);
9025         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
9026 }
9027 EOF
9028         set try
9029         if eval $compile && $run ./try; then
9030                 echo "Your vsprintf() returns (int)." >&4
9031                 val2="$undef"
9032         else
9033                 echo "Your vsprintf() returns (char*)." >&4
9034                 val2="$define"
9035         fi
9036 else
9037         echo 'vprintf() NOT found.' >&4
9038                 val="$undef"
9039                 val2="$undef"
9040 fi
9041 $rm -f try try.*
9042 set d_vprintf
9043 eval $setvar
9044 val=$val2
9045 set d_charvspr
9046 eval $setvar
9047
9048 : see if chown exists
9049 set chown d_chown
9050 eval $inlibc
9051
9052 : see if chroot exists
9053 set chroot d_chroot
9054 eval $inlibc
9055
9056 : see if chsize exists
9057 set chsize d_chsize
9058 eval $inlibc
9059
9060 hasstruct='varname=$1; struct=$2; shift; shift;
9061 while $test $# -ge 2; do
9062         case "$1" in
9063         $define) echo "#include <$2>";;
9064         esac ;
9065     shift 2;
9066 done > try.c;
9067 echo "int main () { struct $struct foo; }" >> try.c;
9068 set try;
9069 if eval $compile; then
9070         val="$define";
9071 else
9072         val="$undef";
9073 fi;
9074 set $varname;
9075 eval $setvar;
9076 $rm -f try.c try.o'
9077
9078 : see if sys/types.h has to be included
9079 set sys/types.h i_systypes
9080 eval $inhdr
9081
9082 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9083 while $test $# -ge 2; do
9084         case "$1" in
9085         $define) echo "#include <$2>";;
9086         esac ;
9087     shift 2;
9088 done > try.c;
9089 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9090 set try;
9091 if eval $compile; then
9092         val="$define";
9093 else
9094         val="$undef";
9095 fi;
9096 set $varname;
9097 eval $setvar;
9098 $rm -f try.c try.o'
9099
9100 socketlib=''
9101 sockethdr=''
9102 : see whether socket exists
9103 echo " "
9104 $echo $n "Hmm... $c" >&4
9105 if set socket val -f d_socket; eval $csym; $val; then
9106         echo "Looks like you have Berkeley networking support." >&4
9107         d_socket="$define"
9108         if set setsockopt val -f; eval $csym; $val; then
9109                 d_oldsock="$undef"
9110         else
9111                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9112                 d_oldsock="$define"
9113         fi
9114 else
9115         if $contains socklib libc.list >/dev/null 2>&1; then
9116                 echo "Looks like you have Berkeley networking support." >&4
9117                 d_socket="$define"
9118                 : we will have to assume that it supports the 4.2 BSD interface
9119                 d_oldsock="$undef"
9120         else
9121                 echo "You don't have Berkeley networking in libc$_a..." >&4
9122                 if test "X$d_socket" = "X$define"; then
9123                    echo "...but you seem to believe that you have sockets." >&4
9124                 else
9125                         for net in net socket
9126                         do
9127                                 if test -f /usr/lib/lib$net$_a; then
9128                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9129                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9130                                         if $contains socket libc.list >/dev/null 2>&1; then
9131                                                 d_socket="$define"
9132                                                 socketlib="-l$net"
9133                                                 case "$net" in
9134                                                 net)
9135                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9136                                                         sockethdr="-I/usr/netinclude"
9137                                                         ;;
9138                                                 esac
9139                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
9140                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9141                                                         d_oldsock="$undef"
9142                                                 else
9143                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9144                                                         d_oldsock="$define"
9145                                                 fi
9146                                                 break
9147                                         fi
9148                                 fi
9149                         done
9150                         if test "X$d_socket" != "X$define"; then
9151                            echo "or anywhere else I see." >&4
9152                            d_socket="$undef"
9153                            d_oldsock="$undef"
9154                         fi
9155                 fi
9156         fi
9157 fi
9158
9159 : see if socketpair exists
9160 set socketpair d_sockpair
9161 eval $inlibc
9162
9163
9164 echo " "
9165 echo "Checking the availability of certain socket constants..." >& 4
9166 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9167         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9168         $cat >try.c <<EOF
9169 #include <sys/types.h>
9170 #include <sys/socket.h>
9171 int main() {
9172     int i = $ENUM;
9173 }
9174 EOF
9175         val="$undef"
9176         set try; if eval $compile; then
9177                 val="$define"
9178         fi
9179         set d_${enum}; eval $setvar
9180         $rm -f try.c try
9181 done
9182
9183 : see if this is a sys/uio.h system
9184 set sys/uio.h i_sysuio
9185 eval $inhdr
9186
9187
9188 echo " "
9189 echo "Checking to see if your system supports struct cmsghdr..." >&4
9190 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
9191 eval $hasstruct
9192 case "$d_cmsghdr_s" in
9193 "$define")      echo "Yes, it does."   ;;
9194 *)              echo "No, it doesn't." ;;
9195 esac
9196
9197
9198 : check for const keyword
9199 echo " "
9200 echo 'Checking to see if your C compiler knows about "const"...' >&4
9201 $cat >const.c <<'EOCP'
9202 typedef struct spug { int drokk; } spug;
9203 int main()
9204 {
9205         const char *foo;
9206         const spug y;
9207 }
9208 EOCP
9209 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
9210         val="$define"
9211         echo "Yup, it does."
9212 else
9213         val="$undef"
9214         echo "Nope, it doesn't."
9215 fi
9216 set d_const
9217 eval $setvar
9218
9219 : see if crypt exists
9220 echo " "
9221 if set crypt val -f d_crypt; eval $csym; $val; then
9222         echo 'crypt() found.' >&4
9223         val="$define"
9224         cryptlib=''
9225 else
9226         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
9227         if $test -z "$cryptlib"; then
9228                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
9229         else
9230                 cryptlib=-lcrypt
9231         fi
9232         if $test -z "$cryptlib"; then
9233                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
9234         else
9235                 cryptlib=-lcrypt
9236         fi
9237         if $test -z "$cryptlib"; then
9238                 cryptlib=`./loc libcrypt$_a "" $libpth`
9239         else
9240                 cryptlib=-lcrypt
9241         fi
9242         if $test -z "$cryptlib"; then
9243                 echo 'crypt() NOT found.' >&4
9244                 val="$undef"
9245         else
9246                 val="$define"
9247         fi
9248 fi
9249 set d_crypt
9250 eval $setvar
9251
9252 : get csh whereabouts
9253 case "$csh" in
9254 'csh') val="$undef" ;;
9255 *) val="$define" ;;
9256 esac
9257 set d_csh
9258 eval $setvar
9259 : Respect a hint or command line value for full_csh.
9260 case "$full_csh" in
9261 '') full_csh=$csh ;;
9262 esac
9263
9264 : see if cuserid exists
9265 set cuserid d_cuserid
9266 eval $inlibc
9267
9268 : see if this is a limits.h system
9269 set limits.h i_limits
9270 eval $inhdr
9271
9272 : see if this is a float.h system
9273 set float.h i_float
9274 eval $inhdr
9275
9276 : See if number of significant digits in a double precision number is known
9277 echo " "
9278 $cat >dbl_dig.c <<EOM
9279 #$i_limits I_LIMITS
9280 #$i_float I_FLOAT
9281 #ifdef I_LIMITS
9282 #include <limits.h>
9283 #endif
9284 #ifdef I_FLOAT
9285 #include <float.h>
9286 #endif
9287 #ifdef DBL_DIG
9288 printf("Contains DBL_DIG");
9289 #endif
9290 EOM
9291 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
9292 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
9293         echo "DBL_DIG found." >&4
9294         val="$define"
9295 else
9296         echo "DBL_DIG NOT found." >&4
9297         val="$undef"
9298 fi
9299 $rm -f dbl_dig.?
9300 set d_dbl_dig
9301 eval $setvar
9302
9303 hasproto='varname=$1; func=$2; shift; shift;
9304 while $test $# -ge 2; do
9305         case "$1" in
9306         $define) echo "#include <$2>";;
9307         esac ;
9308     shift 2;
9309 done > try.c;
9310 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9311 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9312         echo "$func() prototype found.";
9313         val="$define";
9314 else
9315         echo "$func() prototype NOT found.";
9316         val="$undef";
9317 fi;
9318 set $varname;
9319 eval $setvar;
9320 $rm -f try.c tryout.c'
9321
9322 : see if dbm.h is available
9323 : see if dbmclose exists
9324 set dbmclose d_dbmclose
9325 eval $inlibc
9326
9327 case "$d_dbmclose" in
9328 $define)
9329         set dbm.h i_dbm
9330         eval $inhdr
9331         case "$i_dbm" in
9332         $define)
9333                 val="$undef"
9334                 set i_rpcsvcdbm
9335                 eval $setvar
9336                 ;;
9337         *)      set rpcsvc/dbm.h i_rpcsvcdbm
9338                 eval $inhdr
9339                 ;;
9340         esac
9341         ;;
9342 *)      echo "We won't be including <dbm.h>"
9343         val="$undef"
9344         set i_dbm
9345         eval $setvar
9346         val="$undef"
9347         set i_rpcsvcdbm
9348         eval $setvar
9349         ;;
9350 esac
9351
9352 : see if prototype for dbminit is available
9353 echo " "
9354 set d_dbminitproto dbminit $i_dbm dbm.h
9355 eval $hasproto
9356
9357 : see if difftime exists
9358 set difftime d_difftime
9359 eval $inlibc
9360
9361 : see if this is a dirent system
9362 echo " "
9363 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
9364         val="$define"
9365         echo "<dirent.h> found." >&4
9366 else
9367         val="$undef"
9368         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
9369                 echo "<sys/dir.h> found." >&4
9370                 echo " "
9371         else
9372                 xinc=`./findhdr sys/ndir.h`
9373         fi
9374         echo "<dirent.h> NOT found." >&4
9375 fi
9376 set i_dirent
9377 eval $setvar
9378
9379 : Look for type of directory structure.
9380 echo " "
9381 $cppstdin $cppflags $cppminus < "$xinc" > try.c
9382
9383 case "$direntrytype" in
9384 ''|' ')
9385         case "$i_dirent" in
9386         $define) guess1='struct dirent' ;;
9387         *) guess1='struct direct'  ;;
9388         esac
9389         ;;
9390 *)      guess1="$direntrytype"
9391         ;;
9392 esac
9393
9394 case "$guess1" in
9395 'struct dirent') guess2='struct direct' ;;
9396 *) guess2='struct dirent' ;;
9397 esac
9398                 
9399 if $contains "$guess1" try.c >/dev/null 2>&1; then
9400         direntrytype="$guess1"
9401         echo "Your directory entries are $direntrytype." >&4
9402 elif $contains "$guess2" try.c >/dev/null 2>&1; then
9403         direntrytype="$guess2"
9404         echo "Your directory entries seem to be $direntrytype." >&4
9405 else
9406         echo "I don't recognize your system's directory entries." >&4
9407         rp="What type is used for directory entries on this system?"
9408         dflt="$guess1"
9409         . ./myread
9410         direntrytype="$ans"
9411 fi
9412 $rm -f try.c
9413
9414
9415 : see if the directory entry stores field length
9416 echo " "
9417 $cppstdin $cppflags $cppminus < "$xinc" > try.c
9418 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
9419         echo "Good, your directory entry keeps length information in d_namlen." >&4
9420         val="$define"
9421 else
9422         echo "Your directory entry does not know about the d_namlen field." >&4
9423         val="$undef"
9424 fi
9425 set d_dirnamlen
9426 eval $setvar
9427 $rm -f try.c
9428
9429 : see if dlerror exists
9430 xxx_runnm="$runnm"
9431 runnm=false
9432 set dlerror d_dlerror
9433 eval $inlibc
9434 runnm="$xxx_runnm"
9435
9436 : see if dlfcn is available
9437 set dlfcn.h i_dlfcn
9438 eval $inhdr
9439
9440 case "$usedl" in
9441 $define|y|true)
9442         $cat << EOM
9443
9444 On a few systems, the dynamically loaded modules that perl generates and uses
9445 will need a different extension than shared libs. The default will probably
9446 be appropriate.
9447
9448 EOM
9449         case "$dlext" in
9450         '')     dflt="$so" ;;
9451         *)      dflt="$dlext" ;;
9452         esac
9453         rp='What is the extension of dynamically loaded modules'
9454         . ./myread
9455         dlext="$ans"
9456         ;;
9457 *)
9458         dlext="none"
9459         ;;
9460 esac
9461
9462 : Check if dlsym need a leading underscore
9463 echo " "
9464 val="$undef"
9465
9466 case "$dlsrc" in
9467 dl_dlopen.xs)
9468         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
9469         $cat >dyna.c <<'EOM'
9470 fred () { }
9471 EOM
9472
9473 $cat >fred.c<<EOM
9474
9475 #include <stdio.h>
9476 #$i_dlfcn I_DLFCN
9477 #ifdef I_DLFCN
9478 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
9479 #else
9480 #include <sys/types.h>
9481 #include <nlist.h>
9482 #include <link.h>
9483 #endif
9484
9485 extern int fred() ;
9486
9487 int main()
9488 {
9489     void * handle ;
9490     void * symbol ;
9491 #ifndef RTLD_LAZY
9492     int mode = 1 ;
9493 #else
9494     int mode = RTLD_LAZY ;
9495 #endif
9496     handle = dlopen("./dyna.$dlext", mode) ;
9497     if (handle == NULL) {
9498         printf ("1\n") ;
9499         fflush (stdout) ;
9500         exit(0);
9501     }
9502     symbol = dlsym(handle, "fred") ;
9503     if (symbol == NULL) {
9504         /* try putting a leading underscore */
9505         symbol = dlsym(handle, "_fred") ;
9506         if (symbol == NULL) {
9507             printf ("2\n") ;
9508             fflush (stdout) ;
9509             exit(0);
9510         }
9511         printf ("3\n") ;
9512     }
9513     else
9514         printf ("4\n") ;
9515     fflush (stdout) ;
9516     exit(0);
9517 }
9518 EOM
9519         : Call the object file tmp-dyna.o in case dlext=o.
9520         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
9521                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
9522                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
9523                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
9524                 xxx=`$run ./fred`
9525                 case $xxx in
9526                 1)      echo "Test program failed using dlopen." >&4
9527                         echo "Perhaps you should not use dynamic loading." >&4;;
9528                 2)      echo "Test program failed using dlsym." >&4
9529                         echo "Perhaps you should not use dynamic loading." >&4;;
9530                 3)      echo "dlsym needs a leading underscore" >&4
9531                         val="$define" ;;
9532                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
9533                 esac
9534         else
9535                 echo "I can't compile and run the test program." >&4
9536                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
9537         fi
9538         ;;
9539 esac
9540                 
9541 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
9542
9543 set d_dlsymun
9544 eval $setvar
9545
9546 : see if prototype for drand48 is available
9547 echo " "
9548 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
9549 eval $hasproto
9550
9551 : see if dup2 exists
9552 set dup2 d_dup2
9553 eval $inlibc
9554
9555 : see if eaccess exists
9556 set eaccess d_eaccess
9557 eval $inlibc
9558
9559 : see if endgrent exists
9560 set endgrent d_endgrent
9561 eval $inlibc
9562
9563 : see if endhostent exists
9564 set endhostent d_endhent
9565 eval $inlibc
9566
9567 : see if endnetent exists
9568 set endnetent d_endnent
9569 eval $inlibc
9570
9571 : see if endprotoent exists
9572 set endprotoent d_endpent
9573 eval $inlibc
9574
9575 : see if endpwent exists
9576 set endpwent d_endpwent
9577 eval $inlibc
9578
9579 : see if endservent exists
9580 set endservent d_endsent
9581 eval $inlibc
9582
9583 : Locate the flags for 'open()'
9584 echo " "
9585 $cat >try.c <<'EOCP'
9586 #include <sys/types.h>
9587 #ifdef I_FCNTL
9588 #include <fcntl.h>
9589 #endif
9590 #ifdef I_SYS_FILE
9591 #include <sys/file.h>
9592 #endif
9593 int main() {
9594         if(O_RDONLY);
9595 #ifdef O_TRUNC
9596         exit(0);
9597 #else
9598         exit(1);
9599 #endif
9600 }
9601 EOCP
9602 : check sys/file.h first to get FREAD on Sun
9603 if $test `./findhdr sys/file.h` && \
9604                 set try -DI_SYS_FILE && eval $compile; then
9605         h_sysfile=true;
9606         echo "<sys/file.h> defines the O_* constants..." >&4
9607         if $run ./try; then
9608                 echo "and you have the 3 argument form of open()." >&4
9609                 val="$define"
9610         else
9611                 echo "but not the 3 argument form of open().  Oh, well." >&4
9612                 val="$undef"
9613         fi
9614 elif $test `./findhdr fcntl.h` && \
9615                 set try -DI_FCNTL && eval $compile; then
9616         h_fcntl=true;
9617         echo "<fcntl.h> defines the O_* constants..." >&4
9618         if $run ./try; then
9619                 echo "and you have the 3 argument form of open()." >&4
9620                 val="$define"
9621         else
9622                 echo "but not the 3 argument form of open().  Oh, well." >&4
9623                 val="$undef"
9624         fi
9625 else
9626         val="$undef"
9627         echo "I can't find the O_* constant definitions!  You got problems." >&4
9628 fi
9629 set d_open3
9630 eval $setvar
9631 $rm -f try try.*
9632
9633 : see which of string.h or strings.h is needed
9634 echo " "
9635 strings=`./findhdr string.h`
9636 if $test "$strings" && $test -r "$strings"; then
9637         echo "Using <string.h> instead of <strings.h>." >&4
9638         val="$define"
9639 else
9640         val="$undef"
9641         strings=`./findhdr strings.h`
9642         if $test "$strings" && $test -r "$strings"; then
9643                 echo "Using <strings.h> instead of <string.h>." >&4
9644         else
9645                 echo "No string header found -- You'll surely have problems." >&4
9646         fi
9647 fi
9648 set i_string
9649 eval $setvar
9650 case "$i_string" in
9651 "$undef") strings=`./findhdr strings.h`;;
9652 *)        strings=`./findhdr string.h`;;
9653 esac
9654
9655 : check for non-blocking I/O stuff
9656 case "$h_sysfile" in
9657 true) echo "#include <sys/file.h>" > head.c;;
9658 *)
9659        case "$h_fcntl" in
9660        true) echo "#include <fcntl.h>" > head.c;;
9661        *) echo "#include <sys/fcntl.h>" > head.c;;
9662        esac
9663        ;;
9664 esac
9665 echo " "
9666 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
9667 case "$o_nonblock" in
9668 '')
9669         $cat head.c > try.c
9670         $cat >>try.c <<'EOCP'
9671 #include <stdio.h>
9672 int main() {
9673 #ifdef O_NONBLOCK
9674         printf("O_NONBLOCK\n");
9675         exit(0);
9676 #endif
9677 #ifdef O_NDELAY
9678         printf("O_NDELAY\n");
9679         exit(0);
9680 #endif
9681 #ifdef FNDELAY
9682         printf("FNDELAY\n");
9683         exit(0);
9684 #endif
9685         exit(0);
9686 }
9687 EOCP
9688         set try
9689         if eval $compile_ok; then
9690                 o_nonblock=`$run ./try`
9691                 case "$o_nonblock" in
9692                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
9693                 *) echo "Seems like we can use $o_nonblock.";;
9694                 esac
9695         else
9696                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
9697         fi
9698         ;;
9699 *) echo "Using $hint value $o_nonblock.";;
9700 esac
9701 $rm -f try try.* .out core
9702
9703 echo " "
9704 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
9705 case "$eagain" in
9706 '')
9707         $cat head.c > try.c
9708         $cat >>try.c <<EOCP
9709 #include <errno.h>
9710 #include <sys/types.h>
9711 #include <signal.h>
9712 #include <stdio.h> 
9713 #define MY_O_NONBLOCK $o_nonblock
9714 #ifndef errno  /* XXX need better Configure test */
9715 extern int errno;
9716 #endif
9717 #$i_unistd I_UNISTD
9718 #ifdef I_UNISTD
9719 #include <unistd.h>
9720 #endif
9721 #$i_string I_STRING
9722 #ifdef I_STRING
9723 #include <string.h>
9724 #else
9725 #include <strings.h>
9726 #endif
9727 $signal_t blech(x) int x; { exit(3); }
9728 EOCP
9729         $cat >> try.c <<'EOCP'
9730 int main()
9731 {
9732         int pd[2];
9733         int pu[2];
9734         char buf[1];
9735         char string[100];
9736
9737         pipe(pd);       /* Down: child -> parent */
9738         pipe(pu);       /* Up: parent -> child */
9739         if (0 != fork()) {
9740                 int ret;
9741                 close(pd[1]);   /* Parent reads from pd[0] */
9742                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
9743 #ifdef F_SETFL
9744                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
9745                         exit(1);
9746 #else
9747                 exit(4);
9748 #endif
9749                 signal(SIGALRM, blech);
9750                 alarm(5);
9751                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
9752                         exit(2);
9753                 sprintf(string, "%d\n", ret);
9754                 write(2, string, strlen(string));
9755                 alarm(0);
9756 #ifdef EAGAIN
9757                 if (errno == EAGAIN) {
9758                         printf("EAGAIN\n");
9759                         goto ok;
9760                 }
9761 #endif
9762 #ifdef EWOULDBLOCK
9763                 if (errno == EWOULDBLOCK)
9764                         printf("EWOULDBLOCK\n");
9765 #endif
9766         ok:
9767                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
9768                 sleep(2);                               /* Give it time to close our pipe */
9769                 alarm(5);
9770                 ret = read(pd[0], buf, 1);      /* Should read EOF */
9771                 alarm(0);
9772                 sprintf(string, "%d\n", ret);
9773                 write(3, string, strlen(string));
9774                 exit(0);
9775         }
9776
9777         close(pd[0]);                   /* We write to pd[1] */
9778         close(pu[1]);                   /* We read from pu[0] */
9779         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
9780         close(pd[1]);                   /* Pipe pd is now fully closed! */
9781         exit(0);                                /* Bye bye, thank you for playing! */
9782 }
9783 EOCP
9784         set try
9785         if eval $compile_ok; then
9786                 echo "$startsh" >mtry
9787                 echo "$run ./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
9788                 chmod +x mtry
9789                 ./mtry >/dev/null 2>&1
9790                 case $? in
9791                 0) eagain=`$cat try.out`;;
9792                 1) echo "Could not perform non-blocking setting!";;
9793                 2) echo "I did a successful read() for something that was not there!";;
9794                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
9795                 4) echo "Could not find F_SETFL!";;
9796                 *) echo "Something terribly wrong happened during testing.";;
9797                 esac
9798                 rd_nodata=`$cat try.ret`
9799                 echo "A read() system call with no data present returns $rd_nodata."
9800                 case "$rd_nodata" in
9801                 0|-1) ;;
9802                 *)
9803                         echo "(That's peculiar, fixing that to be -1.)"
9804                         rd_nodata=-1
9805                         ;;
9806                 esac
9807                 case "$eagain" in
9808                 '')
9809                         echo "Forcing errno EAGAIN on read() with no data available."
9810                         eagain=EAGAIN
9811                         ;;
9812                 *)
9813                         echo "Your read() sets errno to $eagain when no data is available."
9814                         ;;
9815                 esac
9816                 status=`$cat try.err`
9817                 case "$status" in
9818                 0) echo "And it correctly returns 0 to signal EOF.";;
9819                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
9820                 *) echo "However, your read() returns '$status' on EOF??";;
9821                 esac
9822                 val="$define"
9823                 if test "$status" = "$rd_nodata"; then
9824                         echo "WARNING: you can't distinguish between EOF and no data!"
9825                         val="$undef"
9826                 fi
9827         else
9828                 echo "I can't compile the test program--assuming errno EAGAIN will do."
9829                 eagain=EAGAIN
9830         fi
9831         set d_eofnblk
9832         eval $setvar
9833         ;;
9834 *)
9835         echo "Using $hint value $eagain."
9836         echo "Your read() returns $rd_nodata when no data is present."
9837         case "$d_eofnblk" in
9838         "$define") echo "And you can see EOF because read() returns 0.";;
9839         "$undef") echo "But you can't see EOF status from read() returned value.";;
9840         *)
9841                 echo "(Assuming you can't see EOF status from read anyway.)"
9842                 d_eofnblk=$undef
9843                 ;;
9844         esac
9845         ;;
9846 esac
9847 $rm -f try try.* .out core head.c mtry
9848
9849 : see if fchdir exists
9850 set fchdir d_fchdir
9851 eval $inlibc
9852
9853 : see if fchmod exists
9854 set fchmod d_fchmod
9855 eval $inlibc
9856
9857 : see if fchown exists
9858 set fchown d_fchown
9859 eval $inlibc
9860
9861 : see if this is an fcntl system
9862 set fcntl d_fcntl
9863 eval $inlibc
9864
9865 echo " "
9866 : See if fcntl-based locking works.
9867 $cat >try.c <<EOCP
9868 #include <stdlib.h>
9869 #include <unistd.h>
9870 #include <fcntl.h>
9871 #include <signal.h>
9872 $signal_t blech(x) int x; { exit(3); }
9873 int main() {
9874 #if defined(F_SETLK) && defined(F_SETLKW)
9875      struct flock flock;
9876      int retval, fd;
9877      fd = open("try.c", O_RDONLY);
9878      flock.l_type = F_RDLCK;
9879      flock.l_whence = SEEK_SET;
9880      flock.l_start = flock.l_len = 0;
9881      signal(SIGALRM, blech);
9882      alarm(10);
9883      retval = fcntl(fd, F_SETLK, &flock);
9884      close(fd);
9885      (retval < 0 ? exit(2) : exit(0));
9886 #else
9887      exit(2);
9888 #endif
9889 }
9890 EOCP
9891 echo "Checking if fcntl-based file locking works... "
9892 case "$d_fcntl" in
9893 "$define")
9894         set try
9895         if eval $compile_ok; then
9896                 if $run ./try; then
9897                         echo "Yes, it seems to work."
9898                         val="$define"
9899                 else
9900                         echo "Nope, it didn't work."
9901                         val="$undef"
9902                         case "$?" in
9903                         3) $cat >&4 <<EOM
9904 ***
9905 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
9906 *** This is (almost) impossible.
9907 *** If your NFS lock daemons are not feeling well, something like
9908 *** this may happen, please investigate.  Cannot continue, aborting.
9909 ***
9910 EOM
9911                                 exit 1
9912                                 ;;
9913                         esac
9914                 fi
9915         else
9916                 echo "I'm unable to compile the test program, so I'll assume not."
9917                 val="$undef"
9918         fi
9919         ;;
9920 *) val="$undef";
9921         echo "Nope, since you don't even have fcntl()."
9922         ;;
9923 esac
9924 set d_fcntl_can_lock
9925 eval $setvar
9926 $rm -f try*
9927
9928
9929 : see if sys/select.h has to be included
9930 set sys/select.h i_sysselct
9931 eval $inhdr
9932
9933 : see if we should include time.h, sys/time.h, or both
9934 echo " "
9935 if test "X$timeincl" = X; then
9936         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9937         $echo $n "I'm now running the test program...$c"
9938         $cat >try.c <<'EOCP'
9939 #include <sys/types.h>
9940 #ifdef I_TIME
9941 #include <time.h>
9942 #endif
9943 #ifdef I_SYSTIME
9944 #ifdef SYSTIMEKERNEL
9945 #define KERNEL
9946 #endif
9947 #include <sys/time.h>
9948 #endif
9949 #ifdef I_SYSSELECT
9950 #include <sys/select.h>
9951 #endif
9952 int main()
9953 {
9954         struct tm foo;
9955 #ifdef S_TIMEVAL
9956         struct timeval bar;
9957 #endif
9958 #ifdef S_TIMEZONE
9959         struct timezone tzp;
9960 #endif
9961         if (foo.tm_sec == foo.tm_sec)
9962                 exit(0);
9963 #ifdef S_TIMEVAL
9964         if (bar.tv_sec == bar.tv_sec)
9965                 exit(0);
9966 #endif
9967         exit(1);
9968 }
9969 EOCP
9970         flags=''
9971         for s_timezone in '-DS_TIMEZONE' ''; do
9972         sysselect=''
9973         for s_timeval in '-DS_TIMEVAL' ''; do
9974         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9975         for i_time in '' '-DI_TIME'; do
9976         for i_systime in '-DI_SYSTIME' ''; do
9977                 case "$flags" in
9978                 '') $echo $n ".$c"
9979                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9980                         if eval $compile; then
9981                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9982                                 shift
9983                                 flags="$*"
9984                                 echo " "
9985                                 $echo $n "Succeeded with $flags$c"
9986                         fi
9987                         ;;
9988                 esac
9989         done
9990         done
9991         done
9992         done
9993         done
9994         timeincl=''
9995         echo " "
9996         case "$flags" in
9997         *SYSTIMEKERNEL*) i_systimek="$define"
9998                 timeincl=`./findhdr sys/time.h`
9999                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10000         *) i_systimek="$undef";;
10001         esac
10002         case "$flags" in
10003         *I_TIME*) i_time="$define"
10004                 timeincl=`./findhdr time.h`" $timeincl"
10005                 echo "We'll include <time.h>." >&4;;
10006         *) i_time="$undef";;
10007         esac
10008         case "$flags" in
10009         *I_SYSTIME*) i_systime="$define"
10010                 timeincl=`./findhdr sys/time.h`" $timeincl"
10011                 echo "We'll include <sys/time.h>." >&4;;
10012         *) i_systime="$undef";;
10013         esac
10014         $rm -f try.c try
10015 fi
10016
10017 : check for fd_set items
10018 $cat <<EOM
10019
10020 Checking to see how well your C compiler handles fd_set and friends ...
10021 EOM
10022 $cat >try.c <<EOCP
10023 #$i_systime I_SYS_TIME
10024 #$i_sysselct I_SYS_SELECT
10025 #$d_socket HAS_SOCKET
10026 #include <sys/types.h>
10027 #ifdef HAS_SOCKET
10028 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
10029 #endif
10030 #ifdef I_SYS_TIME
10031 #include <sys/time.h>
10032 #endif
10033 #ifdef I_SYS_SELECT
10034 #include <sys/select.h>
10035 #endif
10036 int main() {
10037         fd_set fds;
10038
10039 #ifdef TRYBITS
10040         if(fds.fds_bits);
10041 #endif
10042
10043 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
10044         exit(0);
10045 #else
10046         exit(1);
10047 #endif
10048 }
10049 EOCP
10050 set try -DTRYBITS
10051 if eval $compile; then
10052         d_fds_bits="$define"
10053         d_fd_set="$define"
10054         echo "Well, your system knows about the normal fd_set typedef..." >&4
10055         if $run ./try; then
10056                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
10057                 d_fd_macros="$define"
10058         else
10059                 $cat >&4 <<'EOM'
10060 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
10061 EOM
10062                 d_fd_macros="$undef"
10063         fi
10064 else
10065         $cat <<'EOM'
10066 Hmm, your compiler has some difficulty with fd_set.  Checking further...
10067 EOM
10068         set try
10069         if eval $compile; then
10070                 d_fds_bits="$undef"
10071                 d_fd_set="$define"
10072                 echo "Well, your system has some sort of fd_set available..." >&4
10073                 if $run ./try; then
10074                         echo "and you have the normal fd_set macros." >&4
10075                         d_fd_macros="$define"
10076                 else
10077                         $cat <<'EOM'
10078 but not the normal fd_set macros!  Gross!  More work for me...
10079 EOM
10080                         d_fd_macros="$undef"
10081                 fi
10082         else
10083         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
10084                 d_fd_set="$undef"
10085                 d_fds_bits="$undef"
10086                 d_fd_macros="$undef"
10087         fi
10088 fi
10089 $rm -f try try.*
10090
10091 : see if fgetpos exists
10092 set fgetpos d_fgetpos
10093 eval $inlibc
10094
10095 : see if flock exists
10096 set flock d_flock
10097 eval $inlibc
10098
10099 : see if this is a sys/file.h system
10100 val=''
10101 set sys/file.h val
10102 eval $inhdr
10103
10104 : do we need to include sys/file.h ?
10105 case "$val" in
10106 "$define")
10107         echo " "
10108         if $h_sysfile; then
10109                 val="$define"
10110                 echo "We'll be including <sys/file.h>." >&4
10111         else
10112                 val="$undef"
10113                 echo "We won't be including <sys/file.h>." >&4
10114         fi
10115         ;;
10116 *)
10117         h_sysfile=false
10118         ;;
10119 esac
10120 set i_sysfile
10121 eval $setvar
10122
10123 : see if prototype for flock is available
10124 echo " "
10125 set d_flockproto flock $i_sysfile sys/file.h
10126 eval $hasproto
10127
10128 : see if fork exists
10129 set fork d_fork
10130 eval $inlibc
10131
10132 : see if pathconf exists
10133 set pathconf d_pathconf
10134 eval $inlibc
10135
10136 : see if fpathconf exists
10137 set fpathconf d_fpathconf
10138 eval $inlibc
10139
10140
10141 : check for fpos64_t
10142 echo " "
10143 echo "Checking to see if you have fpos64_t..." >&4
10144 $cat >try.c <<EOCP
10145 #include <stdio.h>
10146 int main() { fpos64_t x = 7; }
10147 EOCP
10148 set try
10149 if eval $compile; then
10150         val="$define"
10151         echo "You have fpos64_t."
10152 else
10153         val="$undef"
10154         echo "You do not have fpos64_t."
10155         case "$fpossize" in
10156         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
10157         esac
10158 fi
10159 $rm -f try.* try
10160 set d_fpos64_t
10161 eval $setvar
10162
10163 : see if frexpl exists
10164 set frexpl d_frexpl
10165 eval $inlibc
10166
10167 : see if this is a sys/param system
10168 set sys/param.h i_sysparam
10169 eval $inhdr
10170
10171 : see if this is a sys/mount.h system
10172 set sys/mount.h i_sysmount
10173 eval $inhdr
10174
10175
10176 echo " "
10177 echo "Checking to see if your system supports struct fs_data..." >&4
10178 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
10179 eval $hasstruct
10180 case "$d_fs_data_s" in
10181 "$define")      echo "Yes, it does."   ;;
10182 *)              echo "No, it doesn't." ;;
10183 esac
10184
10185 : see if fseeko exists
10186 set fseeko d_fseeko
10187 eval $inlibc
10188 case "$longsize" in
10189 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
10190 esac
10191
10192 : see if fsetpos exists
10193 set fsetpos d_fsetpos
10194 eval $inlibc
10195
10196
10197 : see if fstatfs exists
10198 set fstatfs d_fstatfs
10199 eval $inlibc
10200
10201
10202 : see if statvfs exists
10203 set statvfs d_statvfs
10204 eval $inlibc
10205
10206 : see if fstatvfs exists
10207 set fstatvfs d_fstatvfs
10208 eval $inlibc
10209
10210
10211 : see if fsync exists
10212 set fsync d_fsync
10213 eval $inlibc
10214
10215 : see if ftello exists
10216 set ftello d_ftello
10217 eval $inlibc
10218 case "$longsize" in
10219 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
10220 esac
10221
10222 : see if getcwd exists
10223 set getcwd d_getcwd
10224 eval $inlibc
10225
10226 : see if getespwnam exists
10227 set getespwnam d_getespwnam
10228 eval $inlibc
10229
10230
10231 : see if getfsstat exists
10232 set getfsstat d_getfsstat
10233 eval $inlibc
10234
10235 : see if getgrent exists
10236 set getgrent d_getgrent
10237 eval $inlibc
10238
10239 : see if gethostbyaddr exists
10240 set gethostbyaddr d_gethbyaddr
10241 eval $inlibc
10242
10243 : see if gethostbyname exists
10244 set gethostbyname d_gethbyname
10245 eval $inlibc
10246
10247 : see if gethostent exists
10248 set gethostent d_gethent
10249 eval $inlibc
10250
10251 : see how we will look up host name
10252 echo " "
10253 call=''
10254 if set gethostname val -f d_gethname; eval $csym; $val; then
10255         echo 'gethostname() found.' >&4
10256         d_gethname="$define"
10257         call=gethostname
10258 fi
10259 if set uname val -f d_uname; eval $csym; $val; then
10260         if ./xenix; then
10261                 $cat <<'EOM'
10262 uname() was found, but you're running xenix, and older versions of xenix
10263 have a broken uname(). If you don't really know whether your xenix is old
10264 enough to have a broken system call, use the default answer.
10265
10266 EOM
10267                 dflt=y
10268                 case "$d_uname" in
10269                 "$define") dflt=n;;
10270                 esac
10271                 rp='Is your uname() broken?'
10272                 . ./myread
10273                 case "$ans" in
10274                 n*) d_uname="$define"; call=uname;;
10275                 esac
10276         else
10277                 echo 'uname() found.' >&4
10278                 d_uname="$define"
10279                 case "$call" in
10280                 '') call=uname ;;
10281                 esac
10282         fi
10283 fi
10284 case "$d_gethname" in
10285 '') d_gethname="$undef";;
10286 esac
10287 case "$d_uname" in
10288 '') d_uname="$undef";;
10289 esac
10290 case "$d_uname$d_gethname" in
10291 *define*)
10292         dflt=n
10293         cat <<EOM
10294  
10295 Every now and then someone has a $call() that lies about the hostname
10296 but can't be fixed for political or economic reasons.  If you wish, I can
10297 pretend $call() isn't there and maybe compute hostname at run-time
10298 thanks to the '$phostname' command.
10299
10300 EOM
10301         rp="Shall I ignore $call() from now on?"
10302         . ./myread
10303         case "$ans" in
10304         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
10305         esac;;
10306 esac
10307 case "$phostname" in
10308 '') aphostname='';;
10309 *) case "$aphostname" in
10310         /*) ;;
10311         *) set X $phostname
10312                 shift
10313                 file=$1
10314                 shift
10315                 file=`./loc $file $file $pth`
10316                 aphostname=`echo $file $*`
10317                 ;;
10318         esac
10319         ;;
10320 esac
10321 case "$d_uname$d_gethname" in
10322 *define*) ;;
10323 *)
10324         case "$phostname" in
10325         '')
10326                 echo "There will be no way for $package to get your hostname." >&4;;
10327         *)
10328         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
10329                 ;;
10330         esac;;
10331 esac
10332 case "$d_phostname" in
10333 '') d_phostname="$undef";;
10334 esac
10335
10336 : see if this is a netdb.h system
10337 set netdb.h i_netdb
10338 eval $inhdr
10339
10340 : see if prototypes for various gethostxxx netdb.h functions are available
10341 echo " "
10342 set d_gethostprotos gethostent $i_netdb netdb.h
10343 eval $hasproto
10344
10345 : see if getitimer exists
10346 set getitimer d_getitimer
10347 eval $inlibc
10348
10349 : see if getlogin exists
10350 set getlogin d_getlogin
10351 eval $inlibc
10352
10353 : see if getmnt exists
10354 set getmnt d_getmnt
10355 eval $inlibc
10356
10357 : see if getmntent exists
10358 set getmntent d_getmntent
10359 eval $inlibc
10360
10361 : see if getnetbyaddr exists
10362 set getnetbyaddr d_getnbyaddr
10363 eval $inlibc
10364
10365 : see if getnetbyname exists
10366 set getnetbyname d_getnbyname
10367 eval $inlibc
10368
10369 : see if getnetent exists
10370 set getnetent d_getnent
10371 eval $inlibc
10372
10373 : see if prototypes for various getnetxxx netdb.h functions are available
10374 echo " "
10375 set d_getnetprotos getnetent $i_netdb netdb.h
10376 eval $hasproto
10377
10378 : see if getpagesize exists
10379 set getpagesize d_getpagsz
10380 eval $inlibc
10381
10382
10383 : see if getprotobyname exists
10384 set getprotobyname d_getpbyname
10385 eval $inlibc
10386
10387 : see if getprotobynumber exists
10388 set getprotobynumber d_getpbynumber
10389 eval $inlibc
10390
10391 : see if getprotoent exists
10392 set getprotoent d_getpent
10393 eval $inlibc
10394
10395 : see if getpgid exists
10396 set getpgid d_getpgid
10397 eval $inlibc
10398
10399 : see if getpgrp2 exists
10400 set getpgrp2 d_getpgrp2
10401 eval $inlibc
10402
10403 : see if getppid exists
10404 set getppid d_getppid
10405 eval $inlibc
10406
10407 : see if getpriority exists
10408 set getpriority d_getprior
10409 eval $inlibc
10410
10411 : see if prototypes for various getprotoxxx netdb.h functions are available
10412 echo " "
10413 set d_getprotoprotos getprotoent $i_netdb netdb.h
10414 eval $hasproto
10415
10416 : see if getprpwnam exists
10417 set getprpwnam d_getprpwnam
10418 eval $inlibc
10419
10420 : see if getpwent exists
10421 set getpwent d_getpwent
10422 eval $inlibc
10423
10424
10425 : see if getservbyname exists
10426 set getservbyname d_getsbyname
10427 eval $inlibc
10428
10429 : see if getservbyport exists
10430 set getservbyport d_getsbyport
10431 eval $inlibc
10432
10433 : see if getservent exists
10434 set getservent d_getsent
10435 eval $inlibc
10436
10437 : see if prototypes for various getservxxx netdb.h functions are available
10438 echo " "
10439 set d_getservprotos getservent $i_netdb netdb.h
10440 eval $hasproto
10441
10442 : see if getspnam exists
10443 set getspnam d_getspnam
10444 eval $inlibc
10445
10446 : see if gettimeofday or ftime exists
10447 set gettimeofday d_gettimeod
10448 eval $inlibc
10449 case "$d_gettimeod" in
10450 "$undef")
10451         set ftime d_ftime 
10452         eval $inlibc
10453         ;;
10454 *)
10455         val="$undef"; set d_ftime; eval $setvar
10456         ;;
10457 esac
10458 case "$d_gettimeod$d_ftime" in
10459 "$undef$undef")
10460         echo " "
10461         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
10462         ;;
10463 esac
10464
10465 : see if this is an grp system
10466 set grp.h i_grp
10467 eval $inhdr
10468
10469 case "$i_grp" in
10470 $define)
10471         xxx=`./findhdr grp.h`
10472         $cppstdin $cppflags $cppminus < $xxx >$$.h
10473
10474         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10475                 val="$define"
10476         else
10477                 val="$undef"
10478         fi
10479         set d_grpasswd
10480         eval $setvar
10481
10482         $rm -f $$.h
10483         ;;
10484 *)
10485         val="$undef";
10486         set d_grpasswd; eval $setvar
10487         ;;
10488 esac
10489
10490 : see if hasmntopt exists
10491 set hasmntopt d_hasmntopt
10492 eval $inlibc
10493
10494 : see if this is a netinet/in.h or sys/in.h system
10495 set netinet/in.h i_niin sys/in.h i_sysin
10496 eval $inhdr
10497
10498 : see if arpa/inet.h has to be included
10499 set arpa/inet.h i_arpainet
10500 eval $inhdr
10501
10502 : see if htonl --and friends-- exists
10503 val=''
10504 set htonl val
10505 eval $inlibc
10506
10507 : Maybe they are macros.
10508 case "$val" in
10509 $undef)
10510         $cat >htonl.c <<EOM
10511 #include <stdio.h>
10512 #include <sys/types.h>
10513 #$i_niin I_NETINET_IN
10514 #$i_sysin I_SYS_IN
10515 #$i_arpainet I_ARPA_INET
10516 #ifdef I_NETINET_IN
10517 #include <netinet/in.h>
10518 #endif
10519 #ifdef I_SYS_IN
10520 #include <sys/in.h>
10521 #endif
10522 #ifdef I_ARPA_INET
10523 #include <arpa/inet.h>
10524 #endif
10525 #ifdef htonl
10526 printf("Defined as a macro.");
10527 #endif
10528 EOM
10529         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
10530         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
10531                 val="$define"
10532                 echo "But it seems to be defined as a macro." >&4
10533         fi
10534         $rm -f htonl.?
10535         ;;
10536 esac
10537 set d_htonl
10538 eval $setvar
10539
10540 : see if iconv exists
10541 set iconv d_iconv
10542 eval $inlibc
10543
10544 : index or strchr
10545 echo " "
10546 if set index val -f; eval $csym; $val; then
10547         if set strchr val -f d_strchr; eval $csym; $val; then
10548                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
10549                         val="$define"
10550                         vali="$undef"
10551                         echo "strchr() found." >&4
10552                 else
10553                         val="$undef"
10554                         vali="$define"
10555                         echo "index() found." >&4
10556                 fi
10557         else
10558                 val="$undef"
10559                 vali="$define"
10560                 echo "index() found." >&4
10561         fi
10562 else
10563         if set strchr val -f d_strchr; eval $csym; $val; then
10564                 val="$define"
10565                 vali="$undef"
10566                 echo "strchr() found." >&4
10567         else
10568                 echo "No index() or strchr() found!" >&4
10569                 val="$undef"
10570                 vali="$undef"
10571         fi
10572 fi
10573 set d_strchr; eval $setvar
10574 val="$vali"
10575 set d_index; eval $setvar
10576
10577 : check whether inet_aton exists
10578 set inet_aton d_inetaton
10579 eval $inlibc
10580
10581 : Look for isascii
10582 echo " "
10583 $cat >isascii.c <<'EOCP'
10584 #include <stdio.h>
10585 #include <ctype.h>
10586 int main() {
10587         int c = 'A';
10588         if (isascii(c))
10589                 exit(0);
10590         else
10591                 exit(1);
10592 }
10593 EOCP
10594 set isascii
10595 if eval $compile; then
10596         echo "isascii() found." >&4
10597         val="$define"
10598 else
10599         echo "isascii() NOT found." >&4
10600         val="$undef"
10601 fi
10602 set d_isascii
10603 eval $setvar
10604 $rm -f isascii*
10605
10606 : see if isnan exists
10607 set isnan d_isnan
10608 eval $inlibc
10609
10610 : see if isnanl exists
10611 set isnanl d_isnanl
10612 eval $inlibc
10613
10614 : see if killpg exists
10615 set killpg d_killpg
10616 eval $inlibc
10617
10618 : see if lchown exists
10619 echo " "
10620 $cat > try.c <<'EOCP'
10621 /* System header to define __stub macros and hopefully few prototypes,
10622     which can conflict with char lchown(); below.  */
10623 #include <assert.h>
10624 /* Override any gcc2 internal prototype to avoid an error.  */
10625 /* We use char because int might match the return type of a gcc2
10626    builtin and then its argument prototype would still apply.  */
10627 char lchown();
10628 int main() {
10629     /*  The GNU C library defines this for functions which it implements
10630         to always fail with ENOSYS.  Some functions are actually named
10631         something starting with __ and the normal name is an alias.  */
10632 #if defined (__stub_lchown) || defined (__stub___lchown)
10633 choke me
10634 #else
10635 lchown();
10636 #endif
10637 ; return 0; }
10638 EOCP
10639 set try
10640 if eval $compile; then
10641     $echo "lchown() found." >&4
10642     val="$define"
10643 else
10644     $echo "lchown() NOT found." >&4
10645     val="$undef"
10646 fi
10647 set d_lchown
10648 eval $setvar
10649
10650 : See if number of significant digits in a double precision number is known
10651 echo " "
10652 $cat >ldbl_dig.c <<EOM
10653 #$i_limits I_LIMITS
10654 #$i_float I_FLOAT
10655 #ifdef I_LIMITS
10656 #include <limits.h>
10657 #endif
10658 #ifdef I_FLOAT
10659 #include <float.h>
10660 #endif
10661 #ifdef LDBL_DIG
10662 printf("Contains LDBL_DIG");
10663 #endif
10664 EOM
10665 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
10666 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
10667         echo "LDBL_DIG found." >&4
10668         val="$define"
10669 else
10670         echo "LDBL_DIG NOT found." >&4
10671         val="$undef"
10672 fi
10673 $rm -f ldbl_dig.?
10674 set d_ldbl_dig
10675 eval $setvar
10676
10677 : see if link exists
10678 set link d_link
10679 eval $inlibc
10680
10681 : see if localeconv exists
10682 set localeconv d_locconv
10683 eval $inlibc
10684
10685 : see if lockf exists
10686 set lockf d_lockf
10687 eval $inlibc
10688
10689 : see if prototype for lseek is available
10690 echo " "
10691 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
10692 eval $hasproto
10693
10694 : see if lstat exists
10695 set lstat d_lstat
10696 eval $inlibc
10697
10698 : see if madvise exists
10699 set madvise d_madvise
10700 eval $inlibc
10701
10702 : see if mblen exists
10703 set mblen d_mblen
10704 eval $inlibc
10705
10706 : see if mbstowcs exists
10707 set mbstowcs d_mbstowcs
10708 eval $inlibc
10709
10710 : see if mbtowc exists
10711 set mbtowc d_mbtowc
10712 eval $inlibc
10713
10714 : see if memchr exists
10715 set memchr d_memchr
10716 eval $inlibc
10717
10718 : see if memcmp exists
10719 set memcmp d_memcmp
10720 eval $inlibc
10721
10722 : see if memcpy exists
10723 set memcpy d_memcpy
10724 eval $inlibc
10725
10726 : see if memmove exists
10727 set memmove d_memmove
10728 eval $inlibc
10729
10730 : see if memset exists
10731 set memset d_memset
10732 eval $inlibc
10733
10734 : see if mkdir exists
10735 set mkdir d_mkdir
10736 eval $inlibc
10737
10738 : see if mkdtemp exists
10739 set mkdtemp d_mkdtemp
10740 eval $inlibc
10741
10742 : see if mkfifo exists
10743 set mkfifo d_mkfifo
10744 eval $inlibc
10745
10746 : see if mkstemp exists
10747 set mkstemp d_mkstemp
10748 eval $inlibc
10749
10750 : see if mkstemps exists
10751 set mkstemps d_mkstemps
10752 eval $inlibc
10753
10754 : see if mktime exists
10755 set mktime d_mktime
10756 eval $inlibc
10757
10758 : see if this is a sys/mman.h system
10759 set sys/mman.h i_sysmman
10760 eval $inhdr
10761
10762 : see if mmap exists
10763 set mmap d_mmap
10764 eval $inlibc
10765 : see what shmat returns
10766 : default to something harmless
10767 mmaptype='void *'
10768 case "$i_sysmman$d_mmap" in
10769 "$define$define")
10770         $cat >mmap.c <<'END'
10771 #include <sys/mman.h>
10772 void *mmap();
10773 END
10774         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
10775                 mmaptype='void *'
10776         else
10777                 mmaptype='caddr_t'
10778         fi
10779         echo "and it returns ($mmaptype)." >&4
10780         ;;
10781 esac
10782
10783
10784
10785 : see if modfl exists
10786 set modfl d_modfl
10787 eval $inlibc
10788
10789 d_modfl_pow32_bug="$undef"
10790
10791 case "$d_longdbl$d_modfl" in
10792 $define$define)
10793         $cat <<EOM
10794 Checking to see whether your modfl() is okay for large values...
10795 EOM
10796 $cat >try.c <<EOCP
10797 #include <math.h> 
10798 #include <stdio.h>
10799 int main() {
10800     long double nv = 4294967303.15;
10801     long double v, w;
10802     v = modfl(nv, &w);         
10803 #ifdef __GLIBC__
10804     printf("glibc");
10805 #endif
10806     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
10807     return 0;
10808 }
10809 EOCP
10810         case "$osname:$gccversion" in
10811         aix:)   saveccflags="$ccflags"
10812                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10813         esac
10814         set try
10815         if eval $compile; then
10816                 foo=`$run ./try`
10817                 case "$foo" in
10818                 *" 4294967303.150000 1.150000 4294967302.000000")
10819                         echo >&4 "Your modfl() is broken for large values."
10820                         d_modfl_pow32_bug="$define"
10821                         case "$foo" in
10822                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
10823                         ;;
10824                         esac
10825                         ;;
10826                 *" 4294967303.150000 0.150000 4294967303.000000")
10827                         echo >&4 "Your modfl() seems okay for large values."
10828                         ;;
10829                 *)      echo >&4 "I don't understand your modfl() at all."
10830                         d_modfl="$undef"
10831                         ;;
10832                 esac
10833                 $rm -f try.* try core core.try.*
10834         else
10835                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
10836                 d_modfl="$undef"
10837         fi
10838         case "$osname:$gccversion" in
10839         aix:)   ccflags="$saveccflags" ;; # restore
10840         esac
10841         ;;
10842 esac
10843
10844 : see if mprotect exists
10845 set mprotect d_mprotect
10846 eval $inlibc
10847
10848 : see if msgctl exists
10849 set msgctl d_msgctl
10850 eval $inlibc
10851
10852 : see if msgget exists
10853 set msgget d_msgget
10854 eval $inlibc
10855
10856 : see if msgsnd exists
10857 set msgsnd d_msgsnd
10858 eval $inlibc
10859
10860 : see if msgrcv exists
10861 set msgrcv d_msgrcv
10862 eval $inlibc
10863
10864 : see how much of the 'msg*(2)' library is present.
10865 h_msg=true
10866 echo " "
10867 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
10868 *"$undef"*) h_msg=false;;
10869 esac
10870 case "$osname" in
10871 freebsd)
10872     case "`ipcs 2>&1`" in
10873     "SVID messages"*"not configured"*)
10874         echo "Your $osname does not have the msg*(2) configured." >&4
10875         h_msg=false
10876         val="$undef"
10877         set msgctl d_msgctl
10878         eval $setvar
10879         set msgget d_msgget
10880         eval $setvar
10881         set msgsnd d_msgsnd
10882         eval $setvar
10883         set msgrcv d_msgrcv
10884         eval $setvar
10885         ;;
10886     esac
10887     ;;
10888 esac
10889 : we could also check for sys/ipc.h ...
10890 if $h_msg && $test `./findhdr sys/msg.h`; then
10891         echo "You have the full msg*(2) library." >&4
10892         val="$define"
10893 else
10894         echo "You don't have the full msg*(2) library." >&4
10895         val="$undef"
10896 fi
10897 set d_msg
10898 eval $setvar
10899
10900
10901 echo " "
10902 echo "Checking to see if your system supports struct msghdr..." >&4
10903 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10904 eval $hasstruct
10905 case "$d_msghdr_s" in
10906 "$define")      echo "Yes, it does."   ;;
10907 *)              echo "No, it doesn't." ;;
10908 esac
10909
10910
10911 : see if msync exists
10912 set msync d_msync
10913 eval $inlibc
10914
10915 : see if munmap exists
10916 set munmap d_munmap
10917 eval $inlibc
10918
10919 : see if nice exists
10920 set nice d_nice
10921 eval $inlibc
10922
10923 : see if this is a langinfo.h system
10924 set langinfo.h i_langinfo
10925 eval $inhdr
10926
10927 : see if nl_langinfo exists
10928 set nl_langinfo d_nl_langinfo
10929 eval $inlibc
10930
10931 : check for length of character
10932 echo " "
10933 case "$charsize" in
10934 '')
10935         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10936         $cat >try.c <<'EOCP'
10937 #include <stdio.h>
10938 int main()
10939 {
10940     printf("%d\n", (int)sizeof(char));
10941     exit(0);
10942 }
10943 EOCP
10944         set try
10945         if eval $compile_ok; then
10946                 dflt=`$run ./try`
10947         else
10948                 dflt='1'
10949                 echo "(I can't seem to compile the test program.  Guessing...)"
10950         fi
10951         ;;
10952 *)
10953         dflt="$charsize"
10954         ;;
10955 esac
10956 rp="What is the size of a character (in bytes)?"
10957 . ./myread
10958 charsize="$ans"
10959 $rm -f try.c try
10960
10961 : check for volatile keyword
10962 echo " "
10963 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10964 $cat >try.c <<'EOCP'
10965 int main()
10966 {
10967         typedef struct _goo_struct goo_struct;
10968         goo_struct * volatile goo = ((goo_struct *)0);
10969         struct _goo_struct {
10970                 long long_int;
10971                 int reg_int;
10972                 char char_var;
10973         };
10974         typedef unsigned short foo_t;
10975         char *volatile foo;
10976         volatile int bar;
10977         volatile foo_t blech;
10978         foo = foo;
10979 }
10980 EOCP
10981 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10982         val="$define"
10983         echo "Yup, it does."
10984 else
10985         val="$undef"
10986         echo "Nope, it doesn't."
10987 fi
10988 set d_volatile
10989 eval $setvar
10990 $rm -f try.*
10991
10992
10993 echo " "
10994 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10995
10996 case "$use64bitint:$d_quad:$quadtype" in
10997 define:define:?*)
10998         ivtype="$quadtype"
10999         uvtype="$uquadtype"
11000         ivsize=8
11001         uvsize=8
11002         ;;
11003 *)      ivtype="long"
11004         uvtype="unsigned long"
11005         ivsize=$longsize
11006         uvsize=$longsize
11007         ;;
11008 esac
11009
11010 case "$uselongdouble:$d_longdbl" in
11011 define:define)
11012         nvtype="long double"
11013         nvsize=$longdblsize
11014         ;;
11015 *)      nvtype=double
11016         nvsize=$doublesize
11017         ;;
11018 esac
11019
11020 $echo "(IV will be "$ivtype", $ivsize bytes)"
11021 $echo "(UV will be "$uvtype", $uvsize bytes)"
11022 $echo "(NV will be "$nvtype", $nvsize bytes)"
11023
11024 $cat >try.c <<EOCP
11025 #$i_inttypes I_INTTYPES
11026 #ifdef I_INTTYPES
11027 #include <inttypes.h>
11028 #endif
11029 #include <stdio.h>
11030 int main() {
11031 #ifdef INT8
11032    int8_t i =  INT8_MAX;
11033   uint8_t u = UINT8_MAX;
11034   printf("int8_t\n");
11035 #endif
11036 #ifdef INT16
11037    int16_t i =  INT16_MAX;
11038   uint16_t i = UINT16_MAX;
11039   printf("int16_t\n");
11040 #endif
11041 #ifdef INT32
11042    int32_t i =  INT32_MAX;
11043   uint32_t u = UINT32_MAX;
11044   printf("int32_t\n");
11045 #endif
11046 }
11047 EOCP
11048
11049 case "$i8type" in
11050 '')     case "$charsize" in
11051         1)      i8type=char
11052                 u8type="unsigned char"
11053                 i8size=$charsize
11054                 u8size=$charsize
11055                 ;;
11056         esac
11057         ;;
11058 esac
11059 case "$i8type" in
11060 '')     set try -DINT8
11061         if eval $compile; then
11062                 case "`$run ./try`" in
11063                 int8_t) i8type=int8_t
11064                         u8type=uint8_t
11065                         i8size=1
11066                         u8size=1
11067                         ;;
11068                 esac
11069         fi
11070         ;;
11071 esac
11072 case "$i8type" in
11073 '')     if $test $charsize -ge 1; then
11074                 i8type=char
11075                 u8type="unsigned char"
11076                 i8size=$charsize
11077                 u8size=$charsize
11078         fi
11079         ;;
11080 esac
11081
11082 case "$i16type" in
11083 '')     case "$shortsize" in
11084         2)      i16type=short
11085                 u16type="unsigned short"
11086                 i16size=$shortsize
11087                 u16size=$shortsize
11088                 ;;
11089         esac
11090         ;;
11091 esac
11092 case "$i16type" in
11093 '')     set try -DINT16
11094         if eval $compile; then
11095                 case "`$run ./try`" in
11096                 int16_t)
11097                         i16type=int16_t
11098                         u16type=uint16_t
11099                         i16size=2
11100                         u16size=2
11101                         ;;
11102                 esac
11103         fi
11104         ;;
11105 esac
11106 case "$i16type" in
11107 '')     if $test $shortsize -ge 2; then
11108                 i16type=short
11109                 u16type="unsigned short"
11110                 i16size=$shortsize
11111                 u16size=$shortsize
11112         fi
11113         ;;
11114 esac
11115
11116 case "$i32type" in
11117 '')     case "$longsize" in
11118         4)      i32type=long
11119                 u32type="unsigned long"
11120                 i32size=$longsize
11121                 u32size=$longsize
11122                 ;;
11123         *)      case "$intsize" in
11124                 4)      i32type=int
11125                         u32type="unsigned int"
11126                         i32size=$intsize
11127                         u32size=$intsize
11128                         ;;
11129                 esac
11130                 ;;
11131         esac
11132         ;;
11133 esac
11134 case "$i32type" in
11135 '')     set try -DINT32
11136         if eval $compile; then
11137                 case "`$run ./try`" in
11138                 int32_t)
11139                         i32type=int32_t
11140                         u32type=uint32_t
11141                         i32size=4
11142                         u32size=4
11143                         ;;
11144                 esac
11145         fi
11146         ;;
11147 esac
11148 case "$i32type" in
11149 '')     if $test $intsize -ge 4; then
11150                 i32type=int
11151                 u32type="unsigned int"
11152                 i32size=$intsize
11153                 u32size=$intsize
11154         fi
11155         ;;
11156 esac
11157
11158 case "$i64type" in
11159 '')     case "$d_quad:$quadtype" in
11160         define:?*)
11161                 i64type="$quadtype"
11162                 u64type="$uquadtype"
11163                 i64size=8
11164                 u64size=8
11165                 ;;
11166         esac
11167         ;;
11168 esac
11169
11170 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
11171 : volatile so that the compiler has to store it out to memory.
11172 if test X"$d_volatile" = X"$define"; then
11173         volatile=volatile
11174 fi
11175 $cat <<EOP >try.c
11176 #include <stdio.h>
11177 #include <sys/types.h>
11178 #include <signal.h>
11179 #ifdef SIGFPE
11180 $volatile int bletched = 0;
11181 $signal_t blech(s) int s; { bletched = 1; }
11182 #endif
11183 int main() {
11184     $uvtype u = 0;
11185     $nvtype d;
11186     int     n = 8 * $uvsize;
11187     int     i;
11188 #ifdef SIGFPE
11189     signal(SIGFPE, blech);
11190 #endif
11191
11192     for (i = 0; i < n; i++) {
11193       u = u << 1 | ($uvtype)1;
11194       d = ($nvtype)u;
11195       if (($uvtype)d != u)
11196         break;
11197       if (d <= 0)
11198         break;
11199       d = ($nvtype)(u - 1);
11200       if (($uvtype)d != (u - 1))
11201         break;
11202 #ifdef SIGFPE
11203       if (bletched) {
11204         break;
11205 #endif
11206       } 
11207     }
11208     printf("%d\n", ((i == n) ? -n : i));
11209     exit(0);
11210 }
11211 EOP
11212 set try
11213
11214 d_nv_preserves_uv="$undef"
11215 if eval $compile; then
11216         d_nv_preserves_uv_bits="`$run ./try`"
11217 fi
11218 case "$d_nv_preserves_uv_bits" in
11219 \-[1-9]*)       
11220         d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
11221         $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs."  2>&1
11222         d_nv_preserves_uv="$define"
11223         ;;
11224 [1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs."  2>&1
11225         d_nv_preserves_uv="$undef" ;;
11226 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
11227         d_nv_preserves_uv_bits="$undef" ;;
11228 esac
11229
11230 $rm -f try.* try
11231
11232
11233 : check for off64_t
11234 echo " "
11235 echo "Checking to see if you have off64_t..." >&4
11236 $cat >try.c <<EOCP
11237 #include <sys/types.h>
11238 #include <unistd.h>
11239 int main() { off64_t x = 7; }
11240 EOCP
11241 set try
11242 if eval $compile; then
11243         val="$define"
11244         echo "You have off64_t."
11245 else
11246         val="$undef"
11247         echo "You do not have off64_t."
11248         case "$lseeksize" in
11249         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
11250         esac
11251 fi
11252 $rm -f try.* try
11253 set d_off64_t
11254 eval $setvar
11255
11256 : see if POSIX threads are available
11257 set pthread.h i_pthread
11258 eval $inhdr
11259
11260
11261
11262
11263 : how to create joinable pthreads
11264 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
11265         echo " "
11266         echo "Checking what constant to use for creating joinable pthreads..." >&4 
11267         $cat >try.c <<'EOCP'
11268 #include <pthread.h>
11269 int main() {
11270     int detachstate = JOINABLE;
11271 }
11272 EOCP
11273         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
11274         if eval $compile; then
11275                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
11276                 val="$undef" # Yes, undef.
11277                 set d_old_pthread_create_joinable
11278                 eval $setvar
11279                 val=""
11280                 set old_pthread_create_joinable
11281                 eval $setvar
11282         else
11283                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
11284                 if eval $compile; then
11285                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
11286                         val="$define"
11287                         set d_old_pthread_create_joinable
11288                         eval $setvar
11289                         val=PTHREAD_CREATE_UNDETACHED
11290                         set old_pthread_create_joinable
11291                         eval $setvar
11292                 else            
11293                         set try -DJOINABLE=__UNDETACHED
11294                         if eval $compile; then
11295                                 echo "You seem to use __UNDETACHED." >&4
11296                                 val="$define"
11297                                 set d_old_pthread_create_joinable
11298                                 eval $setvar
11299                                 val=__UNDETACHED
11300                                 set old_pthread_create_joinable
11301                                 eval $setvar
11302                         else
11303                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
11304                                 val="$define"
11305                                 set d_old_pthread_create_joinable
11306                                 eval $setvar
11307                                 val=0
11308                                 set old_pthread_create_joinable
11309                                 eval $setvar
11310                         fi
11311                 fi
11312         fi
11313         $rm -f try try.*
11314 else
11315     d_old_pthread_create_joinable="$undef"
11316     old_pthread_create_joinable=""
11317 fi
11318
11319 : see if pause exists
11320 set pause d_pause
11321 eval $inlibc
11322
11323 : see if pipe exists
11324 set pipe d_pipe
11325 eval $inlibc
11326
11327 : see if poll exists
11328 set poll d_poll
11329 eval $inlibc
11330
11331
11332 : see whether the various POSIXish _yields exist
11333 $cat >try.c <<EOP
11334 #include <pthread.h>
11335 #include <stdio.h>
11336 int main() {
11337 #ifdef SCHED_YIELD
11338         sched_yield();
11339 #else
11340 #ifdef PTHREAD_YIELD
11341         pthread_yield();
11342 #else
11343 #ifdef PTHREAD_YIELD_NULL
11344         pthread_yield(NULL);
11345 #endif
11346 #endif
11347 #endif
11348 }
11349 EOP
11350 : see if sched_yield exists
11351 set try -DSCHED_YIELD
11352 if eval $compile; then
11353     val="$define"
11354     sched_yield='sched_yield()'
11355 else
11356     val="$undef"
11357 fi
11358 case "$usethreads" in
11359 $define)
11360         case "$val" in
11361         $define) echo 'sched_yield() found.' >&4        ;;
11362         *)       echo 'sched_yield() NOT found.' >&4    ;;
11363         esac
11364 esac
11365 set d_sched_yield
11366 eval $setvar
11367
11368 : see if pthread_yield exists
11369 set try -DPTHREAD_YIELD
11370 if eval $compile; then
11371     val="$define"
11372     case "$sched_yield" in
11373     '') sched_yield='pthread_yield()' ;;
11374     esac
11375 else
11376     set try -DPTHREAD_YIELD_NULL
11377     if eval $compile; then
11378         val="$define"
11379         case "$sched_yield" in
11380         '') sched_yield='pthread_yield(NULL)' ;;
11381         esac
11382     else
11383         val="$undef"
11384     fi
11385 fi
11386 case "$usethreads" in
11387 $define)
11388         case "$val" in
11389         $define) echo 'pthread_yield() found.' >&4      ;;
11390         *)       echo 'pthread_yield() NOT found.' >&4  ;;
11391         esac
11392         ;;
11393 esac
11394 set d_pthread_yield
11395 eval $setvar
11396
11397 case "$sched_yield" in
11398 '') sched_yield=undef ;;
11399 esac
11400
11401 $rm -f try try.*
11402
11403 : see if this is a pwd.h system
11404 set pwd.h i_pwd
11405 eval $inhdr
11406
11407 case "$i_pwd" in
11408 $define)
11409         xxx=`./findhdr pwd.h`
11410         $cppstdin $cppflags $cppminus < $xxx >$$.h
11411
11412         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11413                 val="$define"
11414         else
11415                 val="$undef"
11416         fi
11417         set d_pwquota
11418         eval $setvar
11419
11420         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11421                 val="$define"
11422         else
11423                 val="$undef"
11424         fi
11425         set d_pwage
11426         eval $setvar
11427
11428         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11429                 val="$define"
11430         else
11431                 val="$undef"
11432         fi
11433         set d_pwchange
11434         eval $setvar
11435
11436         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11437                 val="$define"
11438         else
11439                 val="$undef"
11440         fi
11441         set d_pwclass
11442         eval $setvar
11443
11444         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11445                 val="$define"
11446         else
11447                 val="$undef"
11448         fi
11449         set d_pwexpire
11450         eval $setvar
11451
11452         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11453                 val="$define"
11454         else
11455                 val="$undef"
11456         fi
11457         set d_pwcomment
11458         eval $setvar
11459
11460         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11461                 val="$define"
11462         else
11463                 val="$undef"
11464         fi
11465         set d_pwgecos
11466         eval $setvar
11467
11468         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11469                 val="$define"
11470         else
11471                 val="$undef"
11472         fi
11473         set d_pwpasswd
11474         eval $setvar
11475
11476         $rm -f $$.h
11477         ;;
11478 *)
11479         val="$undef"; 
11480         set d_pwquota; eval $setvar
11481         set d_pwage; eval $setvar
11482         set d_pwchange; eval $setvar
11483         set d_pwclass; eval $setvar
11484         set d_pwexpire; eval $setvar
11485         set d_pwcomment; eval $setvar
11486         set d_pwgecos; eval $setvar
11487         set d_pwpasswd; eval $setvar
11488         ;;
11489 esac
11490
11491 : see if readdir and friends exist
11492 set readdir d_readdir
11493 eval $inlibc
11494 set seekdir d_seekdir
11495 eval $inlibc
11496 set telldir d_telldir
11497 eval $inlibc
11498 set rewinddir d_rewinddir
11499 eval $inlibc
11500
11501 : see if readlink exists
11502 set readlink d_readlink
11503 eval $inlibc
11504
11505 : see if readv exists
11506 set readv d_readv
11507 eval $inlibc
11508
11509 : see if recvmsg exists
11510 set recvmsg d_recvmsg
11511 eval $inlibc
11512
11513 : see if rename exists
11514 set rename d_rename
11515 eval $inlibc
11516
11517 : see if rmdir exists
11518 set rmdir d_rmdir
11519 eval $inlibc
11520
11521 : see if memory.h is available.
11522 val=''
11523 set memory.h val
11524 eval $inhdr
11525
11526 : See if it conflicts with string.h
11527 case "$val" in
11528 $define)
11529         case "$strings" in
11530         '') ;;
11531         *)
11532                 $cppstdin $cppflags $cppminus < $strings > mem.h
11533                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
11534                         echo " "
11535                         echo "We won't be including <memory.h>."
11536                         val="$undef"
11537                 fi
11538                 $rm -f mem.h
11539                 ;;
11540         esac
11541 esac
11542 set i_memory
11543 eval $setvar
11544
11545 : can bcopy handle overlapping blocks?
11546 echo " "
11547 val="$undef"
11548 case "$d_memmove" in
11549 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
11550 *)      case "$d_bcopy" in
11551         "$define")
11552                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
11553                 $cat >try.c <<EOCP
11554 #$i_memory I_MEMORY
11555 #$i_stdlib I_STDLIB
11556 #$i_string I_STRING
11557 #$i_unistd I_UNISTD
11558 EOCP
11559         $cat >>try.c <<'EOCP'
11560 #include <stdio.h>
11561 #ifdef I_MEMORY
11562 #  include <memory.h>
11563 #endif
11564 #ifdef I_STDLIB
11565 #  include <stdlib.h>
11566 #endif
11567 #ifdef I_STRING
11568 #  include <string.h>
11569 #else
11570 #  include <strings.h>
11571 #endif
11572 #ifdef I_UNISTD
11573 #  include <unistd.h>  /* Needed for NetBSD */
11574 #endif
11575 int main()
11576 {
11577 char buf[128], abc[128];
11578 char *b;
11579 int len;
11580 int off;
11581 int align;
11582
11583 /* Copy "abcde..." string to char abc[] so that gcc doesn't
11584    try to store the string in read-only memory. */
11585 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
11586
11587 for (align = 7; align >= 0; align--) {
11588         for (len = 36; len; len--) {
11589                 b = buf+align;
11590                 bcopy(abc, b, len);
11591                 for (off = 1; off <= len; off++) {
11592                         bcopy(b, b+off, len);
11593                         bcopy(b+off, b, len);
11594                         if (bcmp(b, abc, len))
11595                                 exit(1);
11596                 }
11597         }
11598 }
11599 exit(0);
11600 }
11601 EOCP
11602                 set try
11603                 if eval $compile_ok; then
11604                         if ./try 2>/dev/null; then
11605                                 echo "Yes, it can."
11606                                 val="$define"
11607                         else
11608                                 echo "It can't, sorry."
11609                         fi
11610                 else
11611                         echo "(I can't compile the test program, so we'll assume not...)"
11612                 fi
11613                 ;;
11614         esac
11615         $rm -f try.* try core
11616         ;;
11617 esac
11618 set d_safebcpy
11619 eval $setvar
11620
11621 : can memcpy handle overlapping blocks?
11622 echo " "
11623 val="$undef"
11624 case "$d_memmove" in
11625 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
11626 *)      case "$d_memcpy" in
11627         "$define")
11628                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
11629                 $cat >try.c <<EOCP
11630 #$i_memory I_MEMORY
11631 #$i_stdlib I_STDLIB
11632 #$i_string I_STRING
11633 #$i_unistd I_UNISTD
11634 EOCP
11635         $cat >>try.c <<'EOCP'
11636 #include <stdio.h>
11637 #ifdef I_MEMORY
11638 #  include <memory.h>
11639 #endif
11640 #ifdef I_STDLIB
11641 #  include <stdlib.h>
11642 #endif
11643 #ifdef I_STRING
11644 #  include <string.h>
11645 #else
11646 #  include <strings.h>
11647 #endif
11648 #ifdef I_UNISTD
11649 #  include <unistd.h>  /* Needed for NetBSD */
11650 #endif
11651 int main()
11652 {
11653 char buf[128], abc[128];
11654 char *b;
11655 int len;
11656 int off;
11657 int align;
11658
11659 /* Copy "abcde..." string to char abc[] so that gcc doesn't
11660    try to store the string in read-only memory. */
11661 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
11662
11663 for (align = 7; align >= 0; align--) {
11664         for (len = 36; len; len--) {
11665                 b = buf+align;
11666                 memcpy(b, abc, len);
11667                 for (off = 1; off <= len; off++) {
11668                         memcpy(b+off, b, len);
11669                         memcpy(b, b+off, len);
11670                         if (memcmp(b, abc, len))
11671                                 exit(1);
11672                 }
11673         }
11674 }
11675 exit(0);
11676 }
11677 EOCP
11678                 set try
11679                 if eval $compile_ok; then
11680                         if ./try 2>/dev/null; then
11681                                 echo "Yes, it can."
11682                                 val="$define"
11683                         else
11684                                 echo "It can't, sorry."
11685                         fi
11686                 else
11687                         echo "(I can't compile the test program, so we'll assume not...)"
11688                 fi
11689                 ;;
11690         esac
11691         $rm -f try.* try core
11692         ;;
11693 esac
11694 set d_safemcpy
11695 eval $setvar
11696
11697 : can memcmp be trusted to compare relative magnitude?
11698 val="$undef"
11699 case "$d_memcmp" in
11700 "$define")
11701         echo " "
11702         echo "Checking if your memcmp() can compare relative magnitude..." >&4
11703         $cat >try.c <<EOCP
11704 #$i_memory I_MEMORY
11705 #$i_stdlib I_STDLIB
11706 #$i_string I_STRING
11707 #$i_unistd I_UNISTD
11708 EOCP
11709         $cat >>try.c <<'EOCP'
11710 #include <stdio.h>
11711 #ifdef I_MEMORY
11712 #  include <memory.h>
11713 #endif
11714 #ifdef I_STDLIB
11715 #  include <stdlib.h>
11716 #endif
11717 #ifdef I_STRING
11718 #  include <string.h>
11719 #else
11720 #  include <strings.h>
11721 #endif
11722 #ifdef I_UNISTD
11723 #  include <unistd.h>  /* Needed for NetBSD */
11724 #endif
11725 int main()
11726 {
11727 char a = -1;
11728 char b = 0;
11729 if ((a < b) && memcmp(&a, &b, 1) < 0)
11730         exit(1);
11731 exit(0);
11732 }
11733 EOCP
11734         set try
11735         if eval $compile_ok; then
11736                 if $run ./try 2>/dev/null; then
11737                         echo "Yes, it can."
11738                         val="$define"
11739                 else
11740                         echo "No, it can't (it uses signed chars)."
11741                 fi
11742         else
11743                 echo "(I can't compile the test program, so we'll assume not...)"
11744         fi
11745         ;;
11746 esac
11747 $rm -f try.* try core
11748 set d_sanemcmp
11749 eval $setvar
11750
11751 : see if prototype for sbrk is available
11752 echo " "
11753 set d_sbrkproto sbrk $i_unistd unistd.h
11754 eval $hasproto
11755
11756 : see if select exists
11757 set select d_select
11758 eval $inlibc
11759
11760 : see if semctl exists
11761 set semctl d_semctl
11762 eval $inlibc
11763
11764 : see if semget exists
11765 set semget d_semget
11766 eval $inlibc
11767
11768 : see if semop exists
11769 set semop d_semop
11770 eval $inlibc
11771
11772 : see how much of the 'sem*(2)' library is present.
11773 h_sem=true
11774 echo " "
11775 case "$d_semctl$d_semget$d_semop" in
11776 *"$undef"*) h_sem=false;;
11777 esac
11778 case "$osname" in
11779 freebsd)
11780     case "`ipcs 2>&1`" in
11781     "SVID messages"*"not configured"*)
11782         echo "Your $osname does not have the sem*(2) configured." >&4
11783         h_sem=false
11784         val="$undef"
11785         set semctl d_semctl
11786         eval $setvar
11787         set semget d_semget
11788         eval $setvar
11789         set semop d_semop
11790         eval $setvar
11791         ;;
11792     esac
11793     ;;
11794 esac
11795 : we could also check for sys/ipc.h ...
11796 if $h_sem && $test `./findhdr sys/sem.h`; then
11797         echo "You have the full sem*(2) library." >&4
11798         val="$define"
11799 else
11800         echo "You don't have the full sem*(2) library." >&4
11801         val="$undef"
11802 fi
11803 set d_sem
11804 eval $setvar
11805
11806 : see whether sys/sem.h defines union semun
11807 echo " "
11808 $cat > try.c <<'END'
11809 #include <sys/types.h>
11810 #include <sys/ipc.h>
11811 #include <sys/sem.h>
11812 int main () { union semun semun; semun.buf = 0; }
11813 END
11814 set try
11815 if eval $compile; then
11816     echo "You have union semun in <sys/sem.h>." >&4
11817     val="$define"
11818 else
11819     echo "You do not have union semun in <sys/sem.h>." >&4
11820     val="$undef"
11821 fi
11822 $rm -f try try.c try.h
11823 set d_union_semun
11824 eval $setvar
11825
11826 : see how to do semctl IPC_STAT
11827 case "$d_sem" in
11828 $define)
11829     : see whether semctl IPC_STAT can use union semun
11830     echo " "
11831     $cat > try.h <<END
11832 #ifndef S_IRUSR
11833 #   ifdef S_IREAD
11834 #       define S_IRUSR S_IREAD
11835 #       define S_IWUSR S_IWRITE
11836 #       define S_IXUSR S_IEXEC
11837 #   else
11838 #       define S_IRUSR 0400
11839 #       define S_IWUSR 0200
11840 #       define S_IXUSR 0100
11841 #   endif
11842 #   define S_IRGRP (S_IRUSR>>3)
11843 #   define S_IWGRP (S_IWUSR>>3)
11844 #   define S_IXGRP (S_IXUSR>>3)
11845 #   define S_IROTH (S_IRUSR>>6)
11846 #   define S_IWOTH (S_IWUSR>>6)
11847 #   define S_IXOTH (S_IXUSR>>6)
11848 #endif
11849 #ifndef S_IRWXU
11850 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11851 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11852 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11853 #endif
11854 END
11855
11856     $cat > try.c <<END
11857 #include <sys/types.h>
11858 #include <sys/ipc.h>
11859 #include <sys/sem.h>
11860 #include <sys/stat.h>
11861 #include <stdio.h>
11862 #include <errno.h>
11863 #include "try.h"
11864 #ifndef errno
11865 extern int errno;
11866 #endif
11867 #$d_union_semun HAS_UNION_SEMUN
11868 int main() {
11869     union semun
11870 #ifndef HAS_UNION_SEMUN
11871     {
11872         int val;
11873         struct semid_ds *buf;
11874         unsigned short *array;
11875     }
11876 #endif
11877     arg;
11878     int sem, st;
11879
11880 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11881     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11882     if (sem > -1) {
11883         struct semid_ds argbuf;
11884         arg.buf = &argbuf;
11885 #       ifdef IPC_STAT
11886         st = semctl(sem, 0, IPC_STAT, arg);
11887         if (st == 0)
11888             printf("semun\n");
11889         else
11890 #       endif /* IPC_STAT */
11891             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11892 #       ifdef IPC_RMID
11893         if (semctl(sem, 0, IPC_RMID, arg) != 0)
11894 #       endif /* IPC_RMID */
11895             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11896     } else
11897 #endif /* IPC_PRIVATE && ... */
11898         printf("semget failed: errno = %d\n", errno);
11899   return 0;
11900 }
11901 END
11902     val="$undef"
11903     set try
11904     if eval $compile; then
11905         xxx=`$run ./try`
11906         case "$xxx" in
11907         semun) val="$define" ;;
11908         esac
11909     fi
11910     $rm -f try try.c
11911     set d_semctl_semun
11912     eval $setvar
11913     case "$d_semctl_semun" in
11914     $define)
11915         echo "You can use union semun for semctl IPC_STAT." >&4
11916         also='also'
11917         ;;
11918     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11919         also=''
11920         ;;
11921     esac
11922
11923     : see whether semctl IPC_STAT can use struct semid_ds pointer
11924     $cat > try.c <<'END'
11925 #include <sys/types.h>
11926 #include <sys/ipc.h>
11927 #include <sys/sem.h>
11928 #include <sys/stat.h>
11929 #include "try.h"
11930 #include <stdio.h>
11931 #include <errno.h>
11932 #ifndef errno
11933 extern int errno;
11934 #endif
11935 int main() {
11936     struct semid_ds arg;
11937     int sem, st;
11938
11939 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11940     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11941     if (sem > -1) {
11942 #       ifdef IPC_STAT
11943         st = semctl(sem, 0, IPC_STAT, &arg);
11944         if (st == 0)
11945             printf("semid_ds\n");
11946         else
11947 #       endif /* IPC_STAT */
11948             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11949 #       ifdef IPC_RMID
11950         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11951 #       endif /* IPC_RMID */
11952             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11953     } else
11954 #endif /* IPC_PRIVATE && ... */
11955         printf("semget failed: errno = %d\n", errno);
11956
11957     return 0;
11958 }
11959 END
11960     val="$undef"
11961     set try
11962     if eval $compile; then
11963         xxx=`$run ./try`
11964         case "$xxx" in
11965         semid_ds) val="$define" ;;
11966         esac
11967     fi
11968     $rm -f try try.c
11969     set d_semctl_semid_ds
11970     eval $setvar
11971     case "$d_semctl_semid_ds" in
11972     $define)
11973         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11974         ;;
11975     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11976         ;;
11977     esac
11978     $rm -f try.h
11979     ;;
11980 *)  val="$undef"
11981
11982     # We do not have the full sem*(2) library, so assume we can not
11983     # use either.
11984
11985     set d_semctl_semun
11986     eval $setvar
11987
11988     set d_semctl_semid_ds
11989     eval $setvar
11990     ;;
11991 esac
11992
11993 : see if sendmsg exists
11994 set sendmsg d_sendmsg
11995 eval $inlibc
11996
11997 : see if setegid exists
11998 set setegid d_setegid
11999 eval $inlibc
12000
12001 : see if seteuid exists
12002 set seteuid d_seteuid
12003 eval $inlibc
12004
12005 : see if setgrent exists
12006 set setgrent d_setgrent
12007 eval $inlibc
12008
12009 : see if sethostent exists
12010 set sethostent d_sethent
12011 eval $inlibc
12012
12013 : see if setitimer exists
12014 set setitimer d_setitimer
12015 eval $inlibc
12016
12017 : see if setlinebuf exists
12018 set setlinebuf d_setlinebuf
12019 eval $inlibc
12020
12021 : see if setlocale exists
12022 set setlocale d_setlocale
12023 eval $inlibc
12024
12025 : see if setnetent exists
12026 set setnetent d_setnent
12027 eval $inlibc
12028
12029 : see if setprotoent exists
12030 set setprotoent d_setpent
12031 eval $inlibc
12032
12033 : see if setpgid exists
12034 set setpgid d_setpgid
12035 eval $inlibc
12036
12037 : see if setpgrp2 exists
12038 set setpgrp2 d_setpgrp2
12039 eval $inlibc
12040
12041 : see if setpriority exists
12042 set setpriority d_setprior
12043 eval $inlibc
12044
12045 : see if setproctitle exists
12046 set setproctitle d_setproctitle
12047 eval $inlibc
12048
12049 : see if setpwent exists
12050 set setpwent d_setpwent
12051 eval $inlibc
12052
12053 : see if setregid exists
12054 set setregid d_setregid
12055 eval $inlibc
12056 set setresgid d_setresgid
12057 eval $inlibc
12058
12059 : see if setreuid exists
12060 set setreuid d_setreuid
12061 eval $inlibc
12062 set setresuid d_setresuid
12063 eval $inlibc
12064
12065 : see if setrgid exists
12066 set setrgid d_setrgid
12067 eval $inlibc
12068
12069 : see if setruid exists
12070 set setruid d_setruid
12071 eval $inlibc
12072
12073 : see if setservent exists
12074 set setservent d_setsent
12075 eval $inlibc
12076
12077 : see if setsid exists
12078 set setsid d_setsid
12079 eval $inlibc
12080
12081 : see if setvbuf exists
12082 set setvbuf d_setvbuf
12083 eval $inlibc
12084
12085 : see if sfio.h is available
12086 set sfio.h i_sfio
12087 eval $inhdr
12088
12089
12090 : see if sfio library is available
12091 case "$i_sfio" in
12092 $define)
12093         val=''
12094         set sfreserve val
12095         eval $inlibc
12096         ;;
12097 *)
12098         val="$undef"
12099         ;;
12100 esac
12101 : Ok, but do we want to use it.
12102 case "$val" in
12103 $define)
12104         case "$usesfio" in
12105         true|$define|[yY]*) dflt='y';;
12106         *) dflt='n';;
12107         esac
12108         echo "$package can use the sfio library, but it is experimental."
12109         case "$useperlio" in
12110         "$undef")
12111             echo "For sfio also the PerlIO abstraction layer is needed."
12112             echo "Earlier you said you wouldn't want that."
12113             ;;
12114         esac
12115         rp="You seem to have sfio available, do you want to try using it?"
12116         . ./myread
12117         case "$ans" in
12118         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
12119                 useperlio="$define"
12120                 val="$define"
12121                 ;;
12122         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
12123                 val="$undef"
12124                 ;;
12125         esac
12126         ;;
12127 *)      case "$usesfio" in
12128         true|$define|[yY]*)
12129                 echo "Sorry, cannot find sfio on this machine." >&4
12130                 echo "Ignoring your setting of usesfio=$usesfio." >&4
12131                 val="$undef"
12132                 ;;
12133         esac
12134         ;;
12135 esac
12136 set d_sfio
12137 eval $setvar
12138 case "$d_sfio" in
12139 $define) usesfio='true';;
12140 *) usesfio='false';;
12141 esac
12142 case "$d_sfio" in
12143 $define) ;;
12144 *)      : Remove sfio from list of libraries to use
12145         case "$libs" in
12146         *-lsfio*)
12147                 echo "Removing unneeded -lsfio from library list" >&4
12148                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
12149                 shift
12150                 libs="$*"
12151                 echo "libs = $libs" >&4
12152                 ;;
12153         esac
12154 ;;
12155 esac
12156
12157
12158 : see if shmctl exists
12159 set shmctl d_shmctl
12160 eval $inlibc
12161
12162 : see if shmget exists
12163 set shmget d_shmget
12164 eval $inlibc
12165
12166 : see if shmat exists
12167 set shmat d_shmat
12168 eval $inlibc
12169 : see what shmat returns
12170 case "$d_shmat" in
12171 "$define")
12172         $cat >shmat.c <<'END'
12173 #include <sys/shm.h>
12174 void *shmat();
12175 END
12176         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
12177                 shmattype='void *'
12178         else
12179                 shmattype='char *'
12180         fi
12181         echo "and it returns ($shmattype)." >&4
12182         : see if a prototype for shmat is available
12183         xxx=`./findhdr sys/shm.h`
12184         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
12185         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
12186                 val="$define"
12187         else
12188                 val="$undef"
12189         fi
12190         $rm -f shmat.[co]
12191         ;;
12192 *)
12193         val="$undef"
12194         ;;
12195 esac
12196 set d_shmatprototype
12197 eval $setvar
12198
12199 : see if shmdt exists
12200 set shmdt d_shmdt
12201 eval $inlibc
12202
12203 : see how much of the 'shm*(2)' library is present.
12204 h_shm=true
12205 echo " "
12206 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
12207 *"$undef"*) h_shm=false;;
12208 esac
12209 case "$osname" in
12210 freebsd)
12211     case "`ipcs 2>&1`" in
12212     "SVID shared memory"*"not configured"*)
12213         echo "Your $osname does not have the shm*(2) configured." >&4
12214         h_shm=false
12215         val="$undef"
12216         set shmctl d_shmctl
12217         evat $setvar
12218         set shmget d_shmget
12219         evat $setvar
12220         set shmat d_shmat
12221         evat $setvar
12222         set shmdt d_shmdt
12223         evat $setvar
12224         ;;
12225     esac
12226     ;;
12227 esac
12228 : we could also check for sys/ipc.h ...
12229 if $h_shm && $test `./findhdr sys/shm.h`; then
12230         echo "You have the full shm*(2) library." >&4
12231         val="$define"
12232 else
12233         echo "You don't have the full shm*(2) library." >&4
12234         val="$undef"
12235 fi
12236 set d_shm
12237 eval $setvar
12238
12239 echo " "
12240 : see if we have sigaction
12241 if set sigaction val -f d_sigaction; eval $csym; $val; then
12242         echo 'sigaction() found.' >&4
12243         $cat > try.c <<'EOP'
12244 #include <stdio.h>
12245 #include <sys/types.h>
12246 #include <signal.h>
12247 int main()
12248 {
12249     struct sigaction act, oact;
12250     act.sa_flags = 0;
12251     oact.sa_handler = 0;
12252     /* so that act and oact are used */
12253     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
12254 }
12255 EOP
12256         set try
12257         if eval $compile_ok; then
12258                 val="$define"
12259         else
12260                 echo "But you don't seem to have a useable struct sigaction." >&4
12261                 val="$undef"
12262         fi
12263 else
12264         echo 'sigaction NOT found.' >&4
12265         val="$undef"
12266 fi
12267 set d_sigaction; eval $setvar
12268 $rm -f try try$_o try.c
12269
12270 : see if sigprocmask exists
12271 set sigprocmask d_sigprocmask
12272 eval $inlibc
12273
12274 : see if sigsetjmp exists
12275 echo " "
12276 case "$d_sigsetjmp" in
12277 '')
12278         $cat >try.c <<'EOP'
12279 #include <setjmp.h>
12280 sigjmp_buf env;
12281 int set = 1;
12282 int main()
12283 {
12284         if (sigsetjmp(env,1))
12285                 exit(set);
12286         set = 0;
12287         siglongjmp(env, 1);
12288         exit(1);
12289 }
12290 EOP
12291         set try
12292         if eval $compile; then
12293                 if $run ./try >/dev/null 2>&1; then
12294                         echo "POSIX sigsetjmp found." >&4
12295                         val="$define"
12296                 else
12297                         $cat >&4 <<EOM
12298 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
12299 I'll ignore them.
12300 EOM
12301                         val="$undef"
12302                 fi
12303         else
12304                 echo "sigsetjmp not found." >&4
12305                 val="$undef"
12306         fi
12307         ;;
12308 *) val="$d_sigsetjmp"
12309         case "$d_sigsetjmp" in
12310         $define) echo "POSIX sigsetjmp found." >&4;;
12311         $undef) echo "sigsetjmp not found." >&4;;
12312         esac
12313         ;;
12314 esac
12315 set d_sigsetjmp
12316 eval $setvar
12317 $rm -f try.c try
12318
12319 : see if sockatmark exists
12320 set sockatmark d_sockatmark
12321 eval $inlibc
12322
12323 : see if prototype for sockatmark is available
12324 echo " "
12325 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
12326 eval $hasproto
12327
12328 : see if socks5_init exists
12329 set socks5_init d_socks5_init
12330 eval $inlibc
12331
12332 : see if prototype for setresgid is available
12333 echo " "
12334 set d_sresgproto setresgid $i_unistd unistd.h
12335 eval $hasproto
12336
12337 : see if prototype for setresuid is available
12338 echo " "
12339 set d_sresuproto setresuid $i_unistd unistd.h
12340 eval $hasproto
12341
12342 : see if sys/stat.h is available
12343 set sys/stat.h i_sysstat
12344 eval $inhdr
12345
12346
12347 : see if stat knows about block sizes
12348 echo " "
12349 echo "Checking to see if your struct stat has st_blocks field..." >&4
12350 set d_statblks stat st_blocks $i_sysstat sys/stat.h
12351 eval $hasfield
12352
12353
12354 : see if this is a sys/vfs.h system
12355 set sys/vfs.h i_sysvfs
12356 eval $inhdr
12357
12358
12359 : see if this is a sys/statfs.h system
12360 set sys/statfs.h i_sysstatfs
12361 eval $inhdr
12362
12363
12364 echo " "
12365 echo "Checking to see if your system supports struct statfs..." >&4
12366 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
12367 eval $hasstruct
12368 case "$d_statfs_s" in
12369 "$define")      echo "Yes, it does."   ;;
12370 *)              echo "No, it doesn't." ;;
12371 esac
12372
12373
12374
12375 : see if struct statfs knows about f_flags
12376 case "$d_statfs_s" in
12377 define) 
12378         echo " "
12379         echo "Checking to see if your struct statfs has f_flags field..." >&4
12380         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
12381         eval $hasfield
12382         ;;
12383 *)      val="$undef"
12384         set d_statfs_f_flags
12385         eval $setvar
12386         ;;
12387 esac
12388 case "$d_statfs_f_flags" in
12389 "$define")      echo "Yes, it does."   ;;
12390 *)              echo "No, it doesn't." ;;
12391 esac
12392
12393 : see if _ptr and _cnt from stdio act std
12394 echo " "
12395
12396 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12397         echo "(Looks like you have stdio.h from BSD.)"
12398         case "$stdio_ptr" in
12399         '') stdio_ptr='((fp)->_p)'
12400                 ptr_lval=$define
12401                 ;;
12402         *)      ptr_lval=$d_stdio_ptr_lval;;
12403         esac
12404         case "$stdio_cnt" in
12405         '') stdio_cnt='((fp)->_r)'
12406                 cnt_lval=$define
12407                 ;;
12408         *)      cnt_lval=$d_stdio_cnt_lval;;
12409         esac
12410         case "$stdio_base" in
12411         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12412         esac
12413         case "$stdio_bufsiz" in
12414         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12415         esac
12416 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12417         echo "(Looks like you have stdio.h from Linux.)"
12418         case "$stdio_ptr" in
12419         '') stdio_ptr='((fp)->_IO_read_ptr)'
12420                 ptr_lval=$define
12421                 ;;
12422         *)      ptr_lval=$d_stdio_ptr_lval;;
12423         esac
12424         case "$stdio_cnt" in
12425         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12426                 cnt_lval=$undef
12427                 ;;
12428         *)      cnt_lval=$d_stdio_cnt_lval;;
12429         esac
12430         case "$stdio_base" in
12431         '') stdio_base='((fp)->_IO_read_base)';;
12432         esac
12433         case "$stdio_bufsiz" in
12434         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12435         esac
12436 else
12437         case "$stdio_ptr" in
12438         '') stdio_ptr='((fp)->_ptr)'
12439                 ptr_lval=$define
12440                 ;;
12441         *)      ptr_lval=$d_stdio_ptr_lval;;
12442         esac
12443         case "$stdio_cnt" in
12444         '') stdio_cnt='((fp)->_cnt)'
12445                 cnt_lval=$define
12446                 ;;
12447         *)      cnt_lval=$d_stdio_cnt_lval;;
12448         esac
12449         case "$stdio_base" in
12450         '') stdio_base='((fp)->_base)';;
12451         esac
12452         case "$stdio_bufsiz" in
12453         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12454         esac
12455 fi
12456
12457 : test whether _ptr and _cnt really work
12458 echo "Checking how std your stdio is..." >&4
12459 $cat >try.c <<EOP
12460 #include <stdio.h>
12461 #define FILE_ptr(fp)    $stdio_ptr
12462 #define FILE_cnt(fp)    $stdio_cnt
12463 int main() {
12464         FILE *fp = fopen("try.c", "r");
12465         char c = getc(fp);
12466         if (
12467                 18 <= FILE_cnt(fp) &&
12468                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12469         )
12470                 exit(0);
12471         exit(1);
12472 }
12473 EOP
12474 val="$undef"
12475 set try
12476 if eval $compile && $to try.c; then
12477         if $run ./try; then
12478                 echo "Your stdio acts pretty std."
12479                 val="$define"
12480         else
12481                 echo "Your stdio isn't very std."
12482         fi
12483 else
12484         echo "Your stdio doesn't appear very std."
12485 fi
12486 $rm -f try.c try
12487 set d_stdstdio
12488 eval $setvar
12489
12490 : Can _ptr be used as an lvalue?
12491 case "$d_stdstdio$ptr_lval" in
12492 $define$define) val=$define ;;
12493 *) val=$undef ;;
12494 esac
12495 set d_stdio_ptr_lval
12496 eval $setvar
12497
12498 : Can _cnt be used as an lvalue?
12499 case "$d_stdstdio$cnt_lval" in
12500 $define$define) val=$define ;;
12501 *) val=$undef ;;
12502 esac
12503 set d_stdio_cnt_lval
12504 eval $setvar
12505
12506
12507 : test whether setting _ptr sets _cnt as a side effect
12508 d_stdio_ptr_lval_sets_cnt="$undef"
12509 d_stdio_ptr_lval_nochange_cnt="$undef"
12510 case "$d_stdio_ptr_lval$d_stdstdio" in
12511 $define$define)
12512         echo "Checking to see what happens if we set the stdio ptr..." >&4
12513 $cat >try.c <<EOP
12514 #include <stdio.h>
12515 /* Can we scream? */
12516 /* Eat dust sed :-) */
12517 /* In the buffer space, no one can hear you scream. */
12518 #define FILE_ptr(fp)    $stdio_ptr
12519 #define FILE_cnt(fp)    $stdio_cnt
12520 #include <sys/types.h>
12521 int main() {
12522         FILE *fp = fopen("try.c", "r");
12523         int c;
12524         char *ptr;
12525         size_t cnt;
12526         if (!fp) {
12527             puts("Fail even to read");
12528             exit(1);
12529         }
12530         c = getc(fp); /* Read away the first # */
12531         if (c == EOF) {
12532             puts("Fail even to read");
12533             exit(1);
12534         }
12535         if (!(
12536                 18 <= FILE_cnt(fp) &&
12537                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12538         )) {
12539                 puts("Fail even to read");
12540                 exit (1);
12541         }
12542         ptr = (char*) FILE_ptr(fp);
12543         cnt = (size_t)FILE_cnt(fp);
12544
12545         FILE_ptr(fp) += 42;
12546
12547         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12548                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12549                 exit (1);
12550         }
12551         if (FILE_cnt(fp) <= 20) {
12552                 printf ("Fail (<20 chars to test)");
12553                 exit (1);
12554         }
12555         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12556                 puts("Fail compare");
12557                 exit (1);
12558         }
12559         if (cnt == FILE_cnt(fp)) {
12560                 puts("Pass_unchanged");
12561                 exit (0);
12562         }       
12563         if (FILE_cnt(fp) == (cnt - 42)) {
12564                 puts("Pass_changed");
12565                 exit (0);
12566         }
12567         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12568         return 1;
12569
12570 }
12571 EOP
12572         set try
12573         if eval $compile && $to try.c; then
12574                 case `$run ./try` in
12575                 Pass_changed)
12576                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12577                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12578                 Pass_unchanged)
12579                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12580                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12581                 Fail*)
12582                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12583                 *)
12584                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12585         esac
12586         else
12587                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12588         fi
12589         $rm -f try.c try
12590         ;;
12591 esac
12592
12593 : see if _base is also standard
12594 val="$undef"
12595 case "$d_stdstdio" in
12596 $define)
12597         $cat >try.c <<EOP
12598 #include <stdio.h>
12599 #define FILE_base(fp)   $stdio_base
12600 #define FILE_bufsiz(fp) $stdio_bufsiz
12601 int main() {
12602         FILE *fp = fopen("try.c", "r");
12603         char c = getc(fp);
12604         if (
12605                 19 <= FILE_bufsiz(fp) &&
12606                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12607         )
12608                 exit(0);
12609         exit(1);
12610 }
12611 EOP
12612         set try
12613         if eval $compile && $to try.c; then
12614                 if $run ./try; then
12615                         echo "And its _base field acts std."
12616                         val="$define"
12617                 else
12618                         echo "But its _base field isn't std."
12619                 fi
12620         else
12621                 echo "However, it seems to be lacking the _base field."
12622         fi
12623         $rm -f try.c try
12624         ;;
12625 esac
12626 set d_stdiobase
12627 eval $setvar
12628
12629 $cat >&4 <<EOM
12630 Checking how to access stdio streams by file descriptor number...
12631 EOM
12632 case "$stdio_stream_array" in
12633 '')     $cat >try.c <<EOCP
12634 #include <stdio.h>
12635 int main() {
12636   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
12637     printf("yes\n");
12638 }
12639 EOCP
12640         for s in _iob __iob __sF
12641         do
12642                 set try -DSTDIO_STREAM_ARRAY=$s
12643                 if eval $compile; then
12644                         case "`$run ./try`" in
12645                         yes)    stdio_stream_array=$s; break ;;
12646                         esac
12647                 fi
12648         done
12649         $rm -f try.* try$exe_ext
12650 esac
12651 case "$stdio_stream_array" in
12652 '')     $cat >&4 <<EOM
12653 I can't figure out how to access stdio streams by file descriptor number.
12654 EOM
12655         d_stdio_stream_array="$undef"
12656         ;;
12657 *)      $cat >&4 <<EOM
12658 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
12659 EOM
12660         d_stdio_stream_array="$define"
12661         ;;
12662 esac
12663
12664 : see if strcoll exists
12665 set strcoll d_strcoll
12666 eval $inlibc
12667
12668 : check for structure copying
12669 echo " "
12670 echo "Checking to see if your C compiler can copy structs..." >&4
12671 $cat >try.c <<'EOCP'
12672 int main()
12673 {
12674         struct blurfl {
12675                 int dyick;
12676         } foo, bar;
12677
12678         foo = bar;
12679 }
12680 EOCP
12681 if $cc -c try.c >/dev/null 2>&1 ; then
12682         val="$define"
12683         echo "Yup, it can."
12684 else
12685         val="$undef"
12686         echo "Nope, it can't."
12687 fi
12688 set d_strctcpy
12689 eval $setvar
12690 $rm -f try.*
12691
12692 : see if strerror and/or sys_errlist[] exist
12693 echo " "
12694 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
12695     if set strerror val -f d_strerror; eval $csym; $val; then
12696                 echo 'strerror() found.' >&4
12697                 d_strerror="$define"
12698                 d_strerrm='strerror(e)'
12699                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
12700                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
12701                         d_syserrlst="$define"
12702                 else
12703                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
12704                         d_syserrlst="$undef"
12705                 fi
12706     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
12707                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
12708                 echo 'strerror() found in string header.' >&4
12709                 d_strerror="$define"
12710                 d_strerrm='strerror(e)'
12711                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
12712                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
12713                                 d_syserrlst="$define"
12714                 else
12715                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
12716                         d_syserrlst="$undef"
12717                 fi
12718     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
12719                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
12720                 d_strerror="$undef"
12721                 d_syserrlst="$define"
12722                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
12723     else
12724                 echo 'strerror() and sys_errlist[] NOT found.' >&4
12725                 d_strerror="$undef"
12726                 d_syserrlst="$undef"
12727                 d_strerrm='"unknown"'
12728     fi
12729 fi
12730
12731 : see if strftime exists
12732 set strftime d_strftime
12733 eval $inlibc
12734
12735 : see if strtod exists
12736 set strtod d_strtod
12737 eval $inlibc
12738
12739 : see if strtol exists
12740 set strtol d_strtol
12741 eval $inlibc
12742
12743 : see if strtold exists
12744 set strtold d_strtold
12745 eval $inlibc
12746
12747 : see if strtoll exists
12748 set strtoll d_strtoll
12749 eval $inlibc
12750
12751 case "$d_longlong-$d_strtoll" in
12752 "$define-$define")
12753         $cat <<EOM
12754 Checking whether your strtoll() works okay...
12755 EOM
12756         $cat >try.c <<'EOCP'
12757 #include <errno.h>
12758 #ifdef __hpux
12759 #define strtoll __strtoll
12760 #endif
12761 #ifdef __EMX__
12762 #define strtoll _strtoll
12763 #endif
12764 #include <stdio.h>
12765 extern long long int strtoll(char *s, char **, int); 
12766 static int bad = 0;
12767 int check(char *s, long long ell, int een) {
12768         long long gll;
12769         errno = 0;
12770         gll = strtoll(s, 0, 10);
12771         if (!((gll == ell) && (errno == een)))
12772                 bad++;
12773 }
12774 int main() {
12775         check(" 1",                                      1LL, 0);
12776         check(" 0",                                      0LL, 0);
12777         check("-1",                                     -1LL, 0);
12778         check("-9223372036854775808", -9223372036854775808LL, 0);
12779         check("-9223372036854775808", -9223372036854775808LL, 0);
12780         check(" 9223372036854775807",  9223372036854775807LL, 0);
12781         check("-9223372036854775808", -9223372036854775808LL, 0);
12782         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
12783         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
12784         if (!bad)
12785                 printf("ok\n");
12786 }
12787 EOCP
12788         set try
12789         if eval $compile; then
12790                 yyy=`$run ./try`
12791                 case "$yyy" in
12792                 ok) echo "Your strtoll() seems to be working okay." ;;
12793                 *) cat <<EOM >&4
12794 Your strtoll() doesn't seem to be working okay.
12795 EOM
12796                    d_strtoll="$undef"
12797                    ;;
12798                 esac
12799         else
12800                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12801                 d_strtoll="$undef"
12802         fi
12803         ;;
12804 esac
12805
12806 : see if strtoq exists
12807 set strtoq d_strtoq
12808 eval $inlibc
12809
12810 : see if strtoul exists
12811 set strtoul d_strtoul
12812 eval $inlibc
12813
12814 case "$d_strtoul" in
12815 "$define")
12816         $cat <<EOM
12817 Checking whether your strtoul() works okay...
12818 EOM
12819         $cat >try.c <<'EOCP'
12820 #include <errno.h>
12821 #include <stdio.h>
12822 extern unsigned long int strtoul(char *s, char **, int); 
12823 static int bad = 0;
12824 void check(char *s, unsigned long eul, int een) {
12825         unsigned long gul;
12826         errno = 0;
12827         gul = strtoul(s, 0, 10);
12828         if (!((gul == eul) && (errno == een)))
12829                 bad++;
12830 }
12831 int main() {
12832         check(" 1", 1L, 0);
12833         check(" 0", 0L, 0);
12834 EOCP
12835         case "$longsize" in
12836         8)
12837             $cat >>try.c <<'EOCP'
12838         check("18446744073709551615", 18446744073709551615UL, 0);
12839         check("18446744073709551616", 18446744073709551615UL, ERANGE);
12840 #if 0 /* strtoul() for /^-/ strings is undefined. */
12841         check("-1", 18446744073709551615UL, 0);
12842         check("-18446744073709551614", 2, 0);
12843         check("-18446744073709551615", 1, 0);
12844         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
12845         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
12846 #endif
12847 EOCP
12848                 ;;
12849         4)
12850                     $cat >>try.c <<'EOCP'
12851         check("4294967295", 4294967295UL, 0);
12852         check("4294967296", 4294967295UL, ERANGE);
12853 #if 0 /* strtoul() for /^-/ strings is undefined. */
12854         check("-1", 4294967295UL, 0);
12855         check("-4294967294", 2, 0);
12856         check("-4294967295", 1, 0);
12857         check("-4294967296", 4294967295UL, ERANGE);
12858         check("-4294967297", 4294967295UL, ERANGE);
12859 #endif
12860 EOCP
12861                 ;;
12862         *)
12863 : Should we write these tests to be more portable by sprintf-ing
12864 : ~0 and then manipulating that char string as input for strtol?
12865                 ;;
12866         esac
12867         $cat >>try.c <<'EOCP'
12868         if (!bad)
12869                 printf("ok\n");
12870         return 0;
12871 }
12872 EOCP
12873         set try
12874         if eval $compile; then
12875                 case "`$run ./try`" in
12876                 ok) echo "Your strtoul() seems to be working okay." ;;
12877                 *) cat <<EOM >&4
12878 Your strtoul() doesn't seem to be working okay.
12879 EOM
12880                    d_strtoul="$undef"
12881                    ;;
12882                 esac
12883         fi
12884         ;;
12885 esac
12886
12887 : see if strtoull exists
12888 set strtoull d_strtoull
12889 eval $inlibc
12890
12891 case "$d_longlong-$d_strtoull" in
12892 "$define-$define")
12893         $cat <<EOM
12894 Checking whether your strtoull() works okay...
12895 EOM
12896         $cat >try.c <<'EOCP'
12897 #include <errno.h>
12898 #ifdef __hpux
12899 #define strtoull __strtoull
12900 #endif
12901 #include <stdio.h>
12902 extern unsigned long long int strtoull(char *s, char **, int); 
12903 static int bad = 0;
12904 int check(char *s, long long eull, int een) {
12905         long long gull;
12906         errno = 0;
12907         gull = strtoull(s, 0, 10);
12908         if (!((gull == eull) && (errno == een)))
12909                 bad++;
12910 }
12911 int main() {
12912         check(" 1",                                        1LL, 0);
12913         check(" 0",                                        0LL, 0);
12914         check("18446744073709551615",  18446744073709551615ULL, 0);
12915         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12916 #if 0 /* strtoull() for /^-/ strings is undefined. */
12917         check("-1",                    18446744073709551615ULL, 0);
12918         check("-18446744073709551614",                     2LL, 0);
12919         check("-18446744073709551615",                     1LL, 0);
12920         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12921         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12922 #endif
12923         if (!bad)
12924                 printf("ok\n");
12925 }
12926 EOCP
12927         set try
12928         if eval $compile; then
12929                 case "`$run ./try`" in
12930                 ok) echo "Your strtoull() seems to be working okay." ;;
12931                 *) cat <<EOM >&4
12932 Your strtoull() doesn't seem to be working okay.
12933 EOM
12934                    d_strtoull="$undef"
12935                    ;;
12936                 esac
12937         fi
12938         ;;
12939 esac
12940
12941 : see if strtouq exists
12942 set strtouq d_strtouq
12943 eval $inlibc
12944
12945 case "$d_strtouq" in
12946 "$define")
12947         $cat <<EOM
12948 Checking whether your strtouq() works okay...
12949 EOM
12950         $cat >try.c <<'EOCP'
12951 #include <errno.h>
12952 #include <stdio.h>
12953 extern unsigned long long int strtouq(char *s, char **, int); 
12954 static int bad = 0;
12955 void check(char *s, unsigned long long eull, int een) {
12956         unsigned long long gull;
12957         errno = 0;
12958         gull = strtouq(s, 0, 10);
12959         if (!((gull == eull) && (errno == een)))
12960                 bad++;
12961 }
12962 int main() {
12963         check(" 1",                                        1LL, 0);
12964         check(" 0",                                        0LL, 0);
12965         check("18446744073709551615",  18446744073709551615ULL, 0);
12966         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12967 #if 0 /* strtouq() for /^-/ strings is undefined. */
12968         check("-1",                    18446744073709551615ULL, 0);
12969         check("-18446744073709551614",                     2LL, 0);
12970         check("-18446744073709551615",                     1LL, 0);
12971         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12972         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12973 #endif
12974         if (!bad)
12975                 printf("ok\n");
12976         return 0;
12977 }
12978 EOCP
12979         set try
12980         if eval $compile; then
12981                 case "`$run ./try`" in
12982                 ok) echo "Your strtouq() seems to be working okay." ;;
12983                 *) cat <<EOM >&4
12984 Your strtouq() doesn't seem to be working okay.
12985 EOM
12986                    d_strtouq="$undef"
12987                    ;;
12988                 esac
12989         fi
12990         ;;
12991 esac
12992
12993 : see if strxfrm exists
12994 set strxfrm d_strxfrm
12995 eval $inlibc
12996
12997 : see if symlink exists
12998 set symlink d_symlink
12999 eval $inlibc
13000
13001 : see if syscall exists
13002 set syscall d_syscall
13003 eval $inlibc
13004
13005 : see if prototype for syscall is available
13006 echo " "
13007 set d_syscallproto syscall $i_unistd unistd.h
13008 eval $hasproto
13009
13010 : see if sysconf exists
13011 set sysconf d_sysconf
13012 eval $inlibc
13013
13014 : see if system exists
13015 set system d_system
13016 eval $inlibc
13017
13018 : see if tcgetpgrp exists
13019 set tcgetpgrp d_tcgetpgrp
13020 eval $inlibc
13021
13022 : see if tcsetpgrp exists
13023 set tcsetpgrp d_tcsetpgrp
13024 eval $inlibc
13025
13026 : see if prototype for telldir is available
13027 echo " "
13028 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
13029 eval $hasproto
13030
13031 : see if this is a sys/times.h system
13032 set sys/times.h i_systimes
13033 eval $inhdr
13034
13035 : see if times exists
13036 echo " "
13037 if set times val -f d_times; eval $csym; $val; then
13038         echo 'times() found.' >&4
13039         d_times="$define"
13040         inc=''
13041         case "$i_systimes" in
13042         "$define") inc='sys/times.h';;
13043         esac
13044         rp="What is the type returned by times() on this system?"
13045         set clock_t clocktype long stdio.h sys/types.h $inc
13046         eval $typedef_ask
13047 else
13048         echo 'times() NOT found, hope that will do.' >&4
13049         d_times="$undef"
13050         clocktype='int'
13051 fi
13052
13053 : see if truncate exists
13054 set truncate d_truncate
13055 eval $inlibc
13056
13057 : see if tzname[] exists
13058 echo " "
13059 if set tzname val -a d_tzname; eval $csym; $val; then
13060         val="$define"
13061         echo 'tzname[] found.' >&4
13062 else
13063         val="$undef"
13064         echo 'tzname[] NOT found.' >&4
13065 fi
13066 set d_tzname
13067 eval $setvar
13068
13069 case "$osname" in
13070 next|rhapsody|darwin) multiarch="$define" ;;
13071 esac
13072 case "$multiarch" in
13073 ''|[nN]*) multiarch="$undef" ;;
13074 esac
13075
13076 : check for ordering of bytes in a long
13077 echo " "
13078 case "$usecrosscompile$multiarch" in
13079 *$define*)
13080         $cat <<EOM
13081 You seem to be either cross-compiling or doing a multiarchitecture build,
13082 skipping the byteorder check.
13083
13084 EOM
13085         byteorder='ffff'
13086         ;;
13087 *)
13088         case "$byteorder" in
13089         '')
13090                 $cat <<'EOM'
13091 In the following, larger digits indicate more significance.  A big-endian
13092 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
13093 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
13094 machines may have weird orders like 3412.  A Cray will report 87654321,
13095 an Alpha will report 12345678. If the test program works the default is
13096 probably right.
13097 I'm now running the test program...
13098 EOM
13099                 $cat >try.c <<'EOCP'
13100 #include <stdio.h>
13101 int main()
13102 {
13103         int i;
13104         union {
13105                 unsigned long l;
13106                 char c[sizeof(long)];
13107         } u;
13108
13109         if (sizeof(long) > 4)
13110                 u.l = (0x08070605L << 32) | 0x04030201L;
13111         else
13112                 u.l = 0x04030201L;
13113         for (i = 0; i < sizeof(long); i++)
13114                 printf("%c", u.c[i]+'0');
13115         printf("\n");
13116         exit(0);
13117 }
13118 EOCP
13119                 xxx_prompt=y
13120                 set try
13121                 if eval $compile && ./try > /dev/null; then
13122                         dflt=`$run ./try`
13123                         case "$dflt" in
13124                         [1-4][1-4][1-4][1-4]|12345678|87654321)
13125                                 echo "(The test program ran ok.)"
13126                                 echo "byteorder=$dflt"
13127                                 xxx_prompt=n
13128                         ;;
13129                         ????|????????) echo "(The test program ran ok.)" ;;
13130                         *) echo "(The test program didn't run right for some reason.)" ;;
13131                         esac
13132                 else
13133                         dflt='4321'
13134                         cat <<'EOM'
13135 (I can't seem to compile the test program.  Guessing big-endian...)
13136 EOM
13137                 fi
13138                 case "$xxx_prompt" in
13139                 y)
13140                         rp="What is the order of bytes in a long?"
13141                         . ./myread
13142                         byteorder="$ans"
13143                         ;;
13144                 *)      byteorder=$dflt
13145                         ;;
13146                 esac
13147                 ;;
13148         esac
13149         $rm -f try.c try
13150         ;;
13151 esac
13152
13153
13154 $cat <<EOM
13155
13156 Checking to see whether you can access character data unalignedly...
13157 EOM
13158 $cat >try.c <<EOCP
13159 #include <stdio.h>
13160 #define U32 $u32type
13161 #define BYTEORDER $byteorder
13162 int main() {
13163 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
13164     U8 buf[] = "\0\0\0\1\0\0\0\0";
13165     U32 *up;
13166     int i;
13167
13168     if (sizeof(U32) != 4) {
13169         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
13170         exit(1);
13171     }
13172
13173     fflush(stdout);
13174
13175     for (i = 0; i < 4; i++) {
13176         up = (U32*)(buf + i);
13177         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
13178                (*up == 1 << (8*(3-i)))  /* little-endian */
13179               )
13180            )
13181         {
13182             printf("read failed (%x)\n", *up);
13183             exit(2);
13184         }
13185     }
13186
13187     /* write test */
13188     for (i = 0; i < 4; i++) {
13189         up = (U32*)(buf + i);
13190         *up = 0xBeef;
13191         if (*up != 0xBeef) {
13192             printf("write failed (%x)\n", *up);
13193             exit(3);
13194         }
13195     }
13196
13197     exit(0);
13198 #else
13199     printf("1\n");
13200     exit(1);
13201 #endif
13202     return 0;
13203 }
13204 EOCP
13205 set try
13206 if eval $compile_ok; then
13207         echo "(Testing for character data alignment may dump core.)" >&4
13208         $run ./try 2>&1 >/dev/null
13209         case "$?" in
13210         0)      cat >&4 <<EOM
13211 You can access character data pretty unalignedly.
13212 EOM
13213                 d_u32align="$undef"
13214                 ;;
13215         *)      cat >&4 <<EOM
13216 It seems that you must access character data in an aligned manner.
13217 EOM
13218                 d_u32align="$define"
13219                 ;;
13220         esac
13221         $rm -f core core.try.* try.core
13222 else
13223         rp='Can you access character data at unaligned addresses?'
13224         dflt='n'
13225         . ./myread
13226         case "$ans" in
13227         [yY]*)  d_u32align="$undef"  ;;
13228         *)      d_u32align="$define" ;;
13229         esac
13230 fi
13231
13232 : see if ualarm exists
13233 set ualarm d_ualarm
13234 eval $inlibc
13235
13236 : see if umask exists
13237 set umask d_umask
13238 eval $inlibc
13239
13240 : see if usleep exists
13241 set usleep d_usleep
13242 eval $inlibc
13243
13244 : see if prototype for usleep is available
13245 echo " "
13246 set d_usleepproto usleep $i_unistd unistd.h
13247 eval $hasproto
13248
13249 : see if ustat exists
13250 set ustat d_ustat
13251 eval $inlibc
13252
13253 : backward compatibility for d_hvfork
13254 if test X$d_hvfork != X; then
13255         d_vfork="$d_hvfork"
13256         d_hvfork=''
13257 fi
13258 : see if there is a vfork
13259 val=''
13260 set vfork val
13261 eval $inlibc
13262
13263 : Ok, but do we want to use it. vfork is reportedly unreliable in 
13264 : perl on Solaris 2.x, and probably elsewhere.
13265 case "$val" in
13266 $define)
13267         echo " "
13268         case "$usevfork" in
13269         false) dflt='n';;
13270         *) dflt='y';;
13271         esac
13272         cat <<'EOM'
13273  
13274 Perl can only use a vfork() that doesn't suffer from strict
13275 restrictions on calling functions or modifying global data in
13276 the child.  For example, glibc-2.1 contains such a vfork()
13277 that is unsuitable.  If your system provides a proper fork()
13278 call, chances are that you do NOT want perl to use vfork().
13279
13280 EOM
13281         rp="Do you still want to use vfork()?"
13282         . ./myread
13283         case "$ans" in
13284         y|Y) ;;
13285         *)
13286                 echo "Ok, we won't use vfork()."
13287                 val="$undef"
13288                 ;;
13289         esac
13290         ;;
13291 esac
13292 set d_vfork
13293 eval $setvar
13294 case "$d_vfork" in
13295 $define) usevfork='true';;
13296 *) usevfork='false';;
13297 esac
13298
13299 : see if this is an sysdir system
13300 set sys/dir.h i_sysdir
13301 eval $inhdr
13302
13303 : see if this is an sysndir system
13304 set sys/ndir.h i_sysndir
13305 eval $inhdr
13306
13307 : see if closedir exists
13308 set closedir d_closedir
13309 eval $inlibc
13310
13311 case "$d_closedir" in
13312 "$define")
13313         echo " "
13314         echo "Checking whether closedir() returns a status..." >&4
13315         cat > try.c <<EOM
13316 #$i_dirent I_DIRENT             /**/
13317 #$i_sysdir I_SYS_DIR            /**/
13318 #$i_sysndir I_SYS_NDIR          /**/
13319 #$i_systypes I_SYS_TYPES        /**/
13320
13321 #if defined(I_SYS_TYPES)
13322 #include <sys/types.h>
13323 #endif
13324 #if defined(I_DIRENT)
13325 #include <dirent.h>
13326 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
13327 #include <sys/dir.h>
13328 #endif
13329 #else
13330 #ifdef I_SYS_NDIR
13331 #include <sys/ndir.h>
13332 #else
13333 #ifdef I_SYS_DIR
13334 #ifdef hp9000s500
13335 #include <ndir.h>       /* may be wrong in the future */
13336 #else
13337 #include <sys/dir.h>
13338 #endif
13339 #endif
13340 #endif
13341 #endif 
13342 int main() { return closedir(opendir(".")); }
13343 EOM
13344         set try
13345         if eval $compile_ok; then
13346                 if $run ./try > /dev/null 2>&1 ; then
13347                         echo "Yes, it does."
13348                         val="$undef"
13349                 else
13350                         echo "No, it doesn't."
13351                         val="$define"
13352                 fi
13353         else
13354                 echo "(I can't seem to compile the test program--assuming it doesn't)"
13355                 val="$define"
13356         fi
13357         ;;
13358 *)
13359         val="$undef";
13360         ;;
13361 esac
13362 set d_void_closedir
13363 eval $setvar
13364 $rm -f try try.*
13365 : see if there is a wait4
13366 set wait4 d_wait4
13367 eval $inlibc
13368
13369 : see if waitpid exists
13370 set waitpid d_waitpid
13371 eval $inlibc
13372
13373 : see if wcstombs exists
13374 set wcstombs d_wcstombs
13375 eval $inlibc
13376
13377 : see if wctomb exists
13378 set wctomb d_wctomb
13379 eval $inlibc
13380
13381 : see if writev exists
13382 set writev d_writev
13383 eval $inlibc
13384
13385 : preserve RCS keywords in files with variable substitution, grrr
13386 Date='$Date'
13387 Id='$Id'
13388 Log='$Log'
13389 RCSfile='$RCSfile'
13390 Revision='$Revision'
13391
13392 : check for alignment requirements
13393 echo " "
13394 case "$usecrosscompile$multiarch" in
13395 *$define*)
13396         $cat <<EOM
13397 You seem to be either cross-compiling or doing a multiarchitecture build,
13398 skipping the memory alignment check.
13399
13400 EOM
13401         case "$alignbytes" in
13402         '') alignbytes=8 ;;
13403         esac
13404         ;;
13405 *)
13406         case "$alignbytes" in
13407         '') echo "Checking alignment constraints..." >&4
13408                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
13409                         $cat >try.c <<'EOCP'
13410 typedef long double NV;
13411 EOCP
13412                 else
13413                         $cat >try.c <<'EOCP'
13414 typedef double NV;
13415 EOCP
13416                 fi
13417                 $cat >>try.c <<'EOCP'
13418 #include <stdio.h>
13419 struct foobar {
13420         char foo;
13421         NV bar;
13422 } try_algn;
13423 int main()
13424 {
13425     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
13426     return(0);
13427 }
13428 EOCP
13429                 set try
13430                 if eval $compile_ok; then
13431                         dflt=`$run ./try`
13432                 else
13433                         dflt='8'
13434                         echo "(I can't seem to compile the test program...)"
13435                 fi
13436                 ;;
13437         *) dflt="$alignbytes"
13438                 ;;
13439         esac
13440         rp="Doubles must be aligned on a how-many-byte boundary?"
13441         . ./myread
13442         alignbytes="$ans"
13443         $rm -f try.c try
13444         ;;
13445 esac
13446
13447
13448 : set the base revision
13449 baserev=5.0
13450
13451 : how do we catenate cpp tokens here?
13452 echo " "
13453 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
13454 $cat >cpp_stuff.c <<'EOCP'
13455 #define RCAT(a,b)a/**/b
13456 #define ACAT(a,b)a ## b
13457 RCAT(Rei,ser)
13458 ACAT(Cir,cus)
13459 EOCP
13460 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
13461 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
13462         echo "Oh!  Smells like ANSI's been here." >&4
13463         echo "We can catify or stringify, separately or together!"
13464         cpp_stuff=42
13465 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
13466         echo "Ah, yes!  The good old days!" >&4
13467         echo "However, in the good old days we don't know how to stringify and"
13468         echo "catify at the same time."
13469         cpp_stuff=1
13470 else
13471         $cat >&4 <<EOM
13472 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
13473 to have to edit the values of CAT[2-5] in config.h...
13474 EOM
13475         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
13476 fi
13477 $rm -f cpp_stuff.*
13478
13479 : see if this is a db.h system
13480 set db.h i_db
13481 eval $inhdr
13482
13483 case "$i_db" in
13484 $define)
13485         : Check db version.
13486         echo " "
13487         echo "Checking Berkeley DB version ..." >&4
13488         $cat >try.c <<EOCP
13489 #$d_const HASCONST
13490 #ifndef HASCONST
13491 #define const
13492 #endif
13493 #include <sys/types.h>
13494 #include <stdio.h>
13495 #include <db.h>
13496 int main(int argc, char *argv[])
13497 {
13498 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
13499     int Major, Minor, Patch ;
13500     unsigned long Version ;
13501     (void)db_version(&Major, &Minor, &Patch) ;
13502     if (argc == 2) {
13503         printf("%d %d %d %d %d %d\n",
13504                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
13505                Major, Minor, Patch);
13506         exit(0);
13507     }
13508     printf("You have Berkeley DB Version 2 or greater.\n");
13509
13510     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
13511                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
13512     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
13513                 Major, Minor, Patch) ;
13514
13515     /* check that db.h & libdb are compatible */
13516     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
13517         printf("db.h and libdb are incompatible.\n") ;
13518         exit(3);        
13519     }
13520
13521     printf("db.h and libdb are compatible.\n") ;
13522
13523     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
13524                 + DB_VERSION_PATCH ;
13525
13526     /* needs to be >= 2.3.4 */
13527     if (Version < 2003004) {
13528     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
13529         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
13530         exit(2);        
13531     }
13532
13533     exit(0);
13534 #else
13535 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
13536     if (argc == 2) {
13537         printf("1 0 0\n");
13538         exit(0);
13539     }
13540     printf("You have Berkeley DB Version 1.\n");
13541     exit(0);    /* DB version < 2: the coast is clear. */
13542 #else
13543     exit(1);    /* <db.h> not Berkeley DB? */
13544 #endif
13545 #endif
13546 }
13547 EOCP
13548         set try
13549         if eval $compile_ok && $run ./try; then
13550                 echo 'Looks OK.' >&4
13551                 set `$run ./try 1`
13552                 db_version_major=$1
13553                 db_version_minor=$2
13554                 db_version_patch=$3
13555         else
13556                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
13557                 i_db=$undef
13558                 case " $libs " in
13559                 *"-ldb "*)
13560                         : Remove db from list of libraries to use
13561                         echo "Removing unusable -ldb from library list" >&4
13562                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
13563                         shift
13564                         libs="$*"
13565                         echo "libs = $libs" >&4
13566                         ;;
13567                 esac
13568         fi
13569         $rm -f try.*
13570         ;;
13571 esac
13572
13573 case "$i_db" in
13574 define)
13575         : Check the return type needed for hash 
13576         echo " "
13577         echo "Checking return type needed for hash for Berkeley DB ..." >&4
13578         $cat >try.c <<EOCP
13579 #$d_const HASCONST
13580 #ifndef HASCONST
13581 #define const
13582 #endif
13583 #include <sys/types.h>
13584 #include <db.h>
13585
13586 #ifndef DB_VERSION_MAJOR
13587 u_int32_t hash_cb (ptr, size)
13588 const void *ptr;
13589 size_t size;
13590 {
13591 }
13592 HASHINFO info;
13593 int main()
13594 {
13595         info.hash = hash_cb;
13596 }
13597 #endif
13598 EOCP
13599         if $cc $ccflags -c try.c >try.out 2>&1 ; then
13600                 if $contains warning try.out >>/dev/null 2>&1 ; then
13601                         db_hashtype='int'
13602                 else
13603                         db_hashtype='u_int32_t'
13604                 fi
13605         else
13606                 : XXX Maybe we should just give up here.
13607                 db_hashtype=u_int32_t
13608                 $cat try.out >&4
13609                 echo "Help:  I can't seem to compile the db test program." >&4
13610                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
13611         fi
13612         $rm -f try.*
13613         echo "Your version of Berkeley DB uses $db_hashtype for hash."
13614         ;;
13615 *)      db_hashtype=u_int32_t
13616         ;;
13617 esac
13618 case "$i_db" in
13619 define)
13620         : Check the return type needed for prefix 
13621         echo " "
13622         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
13623         cat >try.c <<EOCP
13624 #$d_const HASCONST
13625 #ifndef HASCONST
13626 #define const
13627 #endif
13628 #include <sys/types.h>
13629 #include <db.h>
13630
13631 #ifndef DB_VERSION_MAJOR
13632 size_t prefix_cb (key1, key2)
13633 const DBT *key1;
13634 const DBT *key2;
13635 {
13636 }
13637 BTREEINFO info;
13638 int main()
13639 {
13640         info.prefix = prefix_cb;
13641 }
13642 #endif
13643 EOCP
13644         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
13645                 if $contains warning try.out >>/dev/null 2>&1 ; then
13646                         db_prefixtype='int'
13647                 else
13648                         db_prefixtype='size_t'
13649                 fi
13650         else
13651                 db_prefixtype='size_t'
13652                 : XXX Maybe we should just give up here.
13653                 $cat try.out >&4
13654                 echo "Help:  I can't seem to compile the db test program." >&4
13655                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
13656         fi
13657         $rm -f try.*
13658         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
13659         ;;
13660 *)      db_prefixtype='size_t'
13661         ;;
13662 esac
13663
13664
13665 : How can we generate normalized random numbers ?
13666 echo " "
13667 echo "Looking for a random number function..." >&4
13668 case "$randfunc" in
13669 '')
13670         if set drand48 val -f; eval $csym; $val; then
13671                 dflt="drand48"
13672                 echo "Good, found drand48()." >&4
13673         elif set random val -f; eval $csym; $val; then
13674                 dflt="random"
13675                 echo "OK, found random()." >&4
13676         else
13677                 dflt="rand"
13678                 echo "Yick, looks like I have to use rand()." >&4
13679         fi
13680         echo " "
13681         ;;
13682 *)
13683         dflt="$randfunc"
13684         ;;
13685 esac
13686 cont=true
13687
13688 case "$ccflags" in
13689 *-Dmy_rand=*|*-Dmy_srand=*)
13690         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
13691         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
13692         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
13693         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
13694         ;;
13695 esac
13696
13697 while $test "$cont"; do
13698         rp="Use which function to generate random numbers?"
13699         . ./myread
13700         if $test "$ans" = "$dflt"; then
13701                 : null
13702         else
13703                 randbits=''
13704         fi
13705         randfunc="$ans"
13706         if set $ans val -f; eval $csym; $val; then
13707                 cont=''
13708         else
13709                 dflt=y
13710                 rp="I cannot find function $ans. Use that name anyway?"
13711                 . ./myread
13712                 dflt=rand
13713                 case "$ans" in
13714                         [yY]*) cont='';;
13715                 esac
13716         fi
13717         case "$cont" in
13718         '')
13719                 case "$randfunc" in
13720                 drand48)
13721                         drand01="drand48()"
13722                         seedfunc="srand48"
13723                         randbits=48
13724                         randseedtype=long
13725                         ;;
13726                 rand|random)
13727                         case "$randbits" in
13728                         '')
13729 echo "Checking to see how many bits your $randfunc() function produces..." >&4
13730                                 $cat >try.c <<EOCP
13731 #$i_unistd I_UNISTD
13732 #$i_stdlib I_STDLIB
13733 #include <stdio.h>
13734 #ifdef I_UNISTD
13735 #  include <unistd.h>
13736 #endif
13737 #ifdef I_STDLIB
13738 #  include <stdlib.h>
13739 #endif
13740 int main()
13741 {
13742         register int i;
13743         register unsigned long tmp;
13744         register unsigned long max = 0L;
13745
13746         for (i = 1000; i; i--) {
13747                 tmp = (unsigned long) $randfunc();
13748                 if (tmp > max) max = tmp;
13749         }
13750         for (i = 0; max; i++)
13751                 max /= 2;
13752         printf("%d\n",i);
13753 }
13754 EOCP
13755                                 set try
13756                                 if eval $compile_ok; then
13757                                         dflt=`try`
13758                                 else
13759                                         dflt='?'
13760                                         echo "(I can't seem to compile the test program...)"
13761                                 fi
13762                                 ;;
13763                         *)
13764                                 dflt="$randbits"
13765                                 ;;
13766                         esac
13767                         rp="How many bits does your $randfunc() function produce?"
13768                         . ./myread
13769                         randbits="$ans"
13770                         $rm -f try.c try
13771                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13772                         seedfunc="s$randfunc"
13773                         randseedtype=unsigned
13774                         ;;
13775                 *)
13776                         dflt="31"
13777                         rp="How many bits does your $randfunc() function produce?"
13778                         . ./myread
13779                         randbits="$ans"
13780                         seedfunc="s$randfunc"
13781                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13782                         if set $seedfunc val -f; eval $csym; $val; then
13783                                 echo "(Using $seedfunc() to seed random generator)"
13784                         else
13785                                 echo "(Warning: no $seedfunc() to seed random generator)"
13786                                 seedfunc=rand
13787                         fi
13788                         randseedtype=unsigned
13789                         ;;
13790                 esac
13791                 ;;
13792         esac
13793 done
13794
13795 echo " "
13796 echo "Determining whether or not we are on an EBCDIC system..." >&4
13797 $cat >try.c <<'EOM'
13798 int main()
13799 {
13800   if ('M'==0xd4) return 0;
13801   return 1;
13802 }
13803 EOM
13804
13805 val=$undef
13806 set try
13807 if eval $compile_ok; then
13808         if $run ./try; then
13809                 echo "You seem to speak EBCDIC." >&4
13810                 val="$define"
13811         else
13812                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
13813         fi
13814 else
13815         echo "I'm unable to compile the test program." >&4
13816         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
13817 fi
13818 $rm -f try try.*
13819 set ebcdic
13820 eval $setvar
13821
13822 echo " "
13823 $cat >&4 <<EOM
13824 Checking how to flush all pending stdio output...
13825 EOM
13826 # I only know how to find the first 32 possibly open files on SunOS.
13827 # See also hints/sunos_4_1.sh and util.c  --AD
13828 case "$osname" in
13829 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
13830 esac
13831 $cat >>try.c <<EOCP
13832 #include <stdio.h>
13833 #$i_unistd I_UNISTD
13834 #ifdef I_UNISTD
13835 # include <unistd.h>
13836 #endif
13837 #$d_sysconf HAS_SYSCONF
13838 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
13839 #ifdef HAS_STDIO_STREAM_ARRAY
13840 # define STDIO_STREAM_ARRAY $stdio_stream_array
13841 #endif
13842 int main() {
13843   FILE* p;
13844   unlink("try.out");
13845   p = fopen("try.out", "w");
13846 #ifdef TRY_FPUTC
13847   fputc('x', p);
13848 #else
13849 # ifdef TRY_FPRINTF
13850   fprintf(p, "x");
13851 # endif
13852 #endif
13853 #ifdef TRY_FFLUSH_NULL
13854   fflush(NULL);
13855 #endif
13856 #ifdef TRY_FFLUSH_ALL
13857   {
13858     long open_max = -1;
13859 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
13860     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
13861 # else
13862 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
13863     open_max = sysconf(_SC_OPEN_MAX);
13864 #  else
13865 #   ifdef FOPEN_MAX
13866     open_max = FOPEN_MAX;
13867 #   else
13868 #    ifdef OPEN_MAX
13869     open_max = OPEN_MAX;
13870 #    else
13871 #     ifdef _NFILE
13872     open_max = _NFILE;
13873 #     endif
13874 #    endif
13875 #   endif
13876 #  endif
13877 # endif 
13878 # ifdef HAS_STDIO_STREAM_ARRAY
13879     if (open_max > 0) {
13880       long i;
13881       for (i = 0; i < open_max; i++)
13882             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
13883                 STDIO_STREAM_ARRAY[i]._file < open_max &&
13884                 STDIO_STREAM_ARRAY[i]._flag)
13885                 fflush(&STDIO_STREAM_ARRAY[i]);
13886     }   
13887   }
13888 # endif
13889 #endif
13890   _exit(42);
13891 }
13892 EOCP
13893 : first we have to find out how _not_ to flush
13894 $to try.c
13895 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
13896     output=''
13897     set try -DTRY_FPUTC
13898     if eval $compile; then
13899             $run ./try 2>/dev/null
13900             code="$?"
13901             $from try.out
13902             if $test ! -s try.out -a "X$code" = X42; then
13903                 output=-DTRY_FPUTC
13904             fi
13905     fi
13906     case "$output" in
13907     '')
13908             set try -DTRY_FPRINTF
13909             if eval $compile; then
13910                     $run ./try 2>/dev/null
13911                     code="$?"
13912                     $from try.out
13913                     if $test ! -s try.out -a "X$code" = X42; then
13914                         output=-DTRY_FPRINTF
13915                     fi
13916             fi
13917         ;;
13918     esac
13919 fi
13920 : check for fflush NULL behaviour
13921 case "$fflushNULL" in
13922 '')     set try -DTRY_FFLUSH_NULL $output
13923         if eval $compile; then
13924                 $run ./try 2>/dev/null
13925                 code="$?"
13926                 $from try.out
13927                 if $test -s try.out -a "X$code" = X42; then
13928                         fflushNULL="`$cat try.out`"
13929                 else
13930                         if $test "X$code" != X42; then
13931                                 $cat >&4 <<EOM
13932 (If this test failed, don't worry, we'll try another method shortly.)
13933 EOM
13934                         fi
13935                 fi
13936         fi
13937         $rm -f core try.core core.try.*
13938         case "$fflushNULL" in
13939         x)      $cat >&4 <<EOM
13940 Your fflush(NULL) works okay for output streams.
13941 Let's see if it clobbers input pipes...
13942 EOM
13943 # As of mid-March 2000 all versions of Solaris appear to have a stdio
13944 # bug that improperly flushes the input end of pipes.  So we avoid the
13945 # autoflush on fork/system/exec support for now. :-(
13946 $cat >tryp.c <<EOCP
13947 #include <stdio.h>
13948 int
13949 main(int argc, char **argv)
13950 {
13951     char buf[1024];
13952     int i;
13953     char *bp = buf;
13954     while (1) {
13955         while ((i = getc(stdin)) != -1
13956                && (*bp++ = i) != '\n'
13957                && bp < &buf[1024])
13958         /* DO NOTHING */ ;
13959         *bp = '\0';
13960         fprintf(stdout, "%s", buf);
13961         fflush(NULL);
13962         if (i == -1)
13963             return 0;
13964         bp = buf;
13965     }
13966 }
13967 EOCP
13968                 fflushNULL="$define"
13969                 set tryp
13970                 if eval $compile; then
13971                     $rm -f tryp.out
13972                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
13973                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
13974                        $cat >&4 <<EOM
13975 fflush(NULL) seems to behave okay with input streams.
13976 EOM
13977                         fflushNULL="$define"
13978                     else
13979                         $cat >&4 <<EOM
13980 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
13981 EOM
13982                         fflushNULL="$undef"
13983                     fi
13984                 fi
13985                 $rm -f core tryp.c tryp.core core.tryp.*
13986                 ;;
13987         '')     $cat >&4 <<EOM
13988 Your fflush(NULL) isn't working (contrary to ANSI C).
13989 EOM
13990                 fflushNULL="$undef"
13991                 ;;
13992         *)      $cat >&4 <<EOM
13993 Cannot figure out whether your fflush(NULL) works or not.
13994 I'm assuming it doesn't (contrary to ANSI C).
13995 EOM
13996                 fflushNULL="$undef"
13997                 ;;
13998         esac
13999         ;;
14000 $define|true|[yY]*)
14001         fflushNULL="$define"
14002         ;;
14003 *)
14004         fflushNULL="$undef"
14005         ;;
14006 esac
14007 : check explicit looping only if NULL did not work, and if the pipe
14008 : bug does not show up on an explicit flush too
14009 case "$fflushNULL" in
14010 "$undef")
14011         $cat >tryp.c <<EOCP
14012 #include <stdio.h>
14013 int
14014 main(int argc, char **argv)
14015 {
14016     char buf[1024];
14017     int i;
14018     char *bp = buf;
14019     while (1) {
14020         while ((i = getc(stdin)) != -1
14021                && (*bp++ = i) != '\n'
14022                && bp < &buf[1024])
14023         /* DO NOTHING */ ;
14024         *bp = '\0';
14025         fprintf(stdout, "%s", buf);
14026         fflush(stdin);
14027         if (i == -1)
14028             return 0;
14029         bp = buf;
14030     }
14031 }
14032 EOCP
14033         set tryp
14034         if eval $compile; then
14035             $rm -f tryp.out
14036             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
14037             if cmp tryp.c tryp.out >/dev/null 2>&1; then
14038                $cat >&4 <<EOM
14039 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
14040 EOM
14041                 : now check for fflushall behaviour
14042                 case "$fflushall" in
14043                 '')     set try -DTRY_FFLUSH_ALL $output
14044                         if eval $compile; then
14045                                 $cat >&4 <<EOM
14046 (Now testing the other method--but note that this also may fail.)
14047 EOM
14048                                 $run ./try 2>/dev/null
14049                                 code=$?
14050                                 $from try.out
14051                                 if $test -s try.out -a "X$code" = X42; then
14052                                         fflushall="`$cat try.out`"
14053                                 fi
14054                         fi
14055                         $rm -f core try.core core.try.*
14056                         case "$fflushall" in
14057                         x)      $cat >&4 <<EOM
14058 Whew. Flushing explicitly all the stdio streams works.
14059 EOM
14060                                 fflushall="$define"
14061                                 ;;
14062                         '')     $cat >&4 <<EOM
14063 Sigh. Flushing explicitly all the stdio streams doesn't work.
14064 EOM
14065                                 fflushall="$undef"
14066                                 ;;
14067                         *)      $cat >&4 <<EOM
14068 Cannot figure out whether flushing stdio streams explicitly works or not.
14069 I'm assuming it doesn't.
14070 EOM
14071                                 fflushall="$undef"
14072                                 ;;
14073                         esac
14074                         ;;
14075                 "$define"|true|[yY]*)
14076                         fflushall="$define"
14077                         ;;
14078                 *)
14079                         fflushall="$undef"
14080                         ;;
14081                 esac
14082             else
14083                 $cat >&4 <<EOM
14084 All is futile.  Even fflush(stdin) clobbers input pipes!
14085 EOM
14086                 fflushall="$undef"
14087             fi
14088         else
14089             fflushall="$undef"
14090         fi
14091         $rm -f core tryp.c tryp.core core.tryp.*
14092         ;;
14093 *)      fflushall="$undef"
14094         ;;
14095 esac
14096
14097 case "$fflushNULL$fflushall" in
14098 undefundef)
14099         $cat <<EOM
14100 OK, I give up.  I cannot figure out how to flush pending stdio output.
14101 We won't be flushing handles at all before fork/exec/popen.
14102 EOM
14103         ;;
14104 esac
14105 $rm -f try.* try$exe_ext
14106
14107 : Store the full pathname to the ar program for use in the C program
14108 : Respect a hint or command line value for full_ar.
14109 case "$full_ar" in
14110 '') full_ar=$ar ;;
14111 esac
14112
14113 : Store the full pathname to the sed program for use in the C program
14114 full_sed=$sed
14115
14116 : see what type gids are declared as in the kernel
14117 echo " "
14118 echo "Looking for the type for group ids returned by getgid()."
14119 set gid_t gidtype xxx stdio.h sys/types.h
14120 eval $typedef
14121 case "$gidtype" in
14122 xxx)
14123         xxx=`./findhdr sys/user.h`
14124         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
14125         case $1 in
14126         unsigned) dflt="$1 $2" ;;
14127         *) dflt="$1" ;;
14128         esac
14129         ;;
14130 *) dflt="$gidtype";;
14131 esac
14132 case "$gidtype" in
14133 gid_t) echo "gid_t found." ;;
14134 *)      rp="What is the type for group ids returned by getgid()?"
14135         . ./myread
14136         gidtype="$ans"
14137         ;;
14138 esac
14139
14140 echo " "
14141 case "$gidtype" in
14142 *_t) zzz="$gidtype"     ;;
14143 *)   zzz="gid"          ;;
14144 esac
14145 echo "Checking the size of $zzz..." >&4 
14146 cat > try.c <<EOCP
14147 #include <sys/types.h>
14148 #include <stdio.h>
14149 int main() {
14150     printf("%d\n", (int)sizeof($gidtype));
14151     exit(0);
14152 }
14153 EOCP
14154 set try
14155 if eval $compile_ok; then
14156         yyy=`$run ./try`
14157         case "$yyy" in
14158         '')     gidsize=4
14159                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
14160                 ;;
14161         *)      gidsize=$yyy
14162                 echo "Your $zzz is $gidsize bytes long."
14163                 ;;
14164         esac
14165 else
14166         gidsize=4
14167         echo "(I can't compile the test program--guessing $gidsize.)" >&4
14168 fi
14169
14170
14171 echo " "
14172 case "$gidtype" in
14173 *_t) zzz="$gidtype"     ;;
14174 *)   zzz="gid"          ;;
14175 esac
14176 echo "Checking the sign of $zzz..." >&4 
14177 cat > try.c <<EOCP
14178 #include <sys/types.h>
14179 #include <stdio.h>
14180 int main() {
14181         $gidtype foo = -1;
14182         if (foo < 0)
14183                 printf("-1\n");
14184         else
14185                 printf("1\n");
14186 }
14187 EOCP
14188 set try
14189 if eval $compile; then
14190         yyy=`$run ./try`
14191         case "$yyy" in
14192         '')     gidsign=1
14193                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14194                 ;;
14195         *)      gidsign=$yyy
14196                 case "$gidsign" in
14197                  1) echo "Your $zzz is unsigned." ;;
14198                 -1) echo "Your $zzz is signed."   ;;
14199                 esac
14200                 ;;
14201         esac
14202 else
14203         gidsign=1
14204         echo "(I can't compile the test program--guessing unsigned.)" >&4
14205 fi
14206
14207
14208 echo " "
14209
14210 if $test X"$quadtype" != X; then
14211
14212 echo "Checking how to print 64-bit integers..." >&4
14213
14214 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
14215         $cat >try.c <<'EOCP'
14216 #include <sys/types.h>
14217 #include <stdio.h>
14218 int main() {
14219   int q = 12345678901;
14220   printf("%ld\n", q);
14221 }
14222 EOCP
14223         set try
14224         if eval $compile; then
14225                 yyy=`$run ./try`
14226                 case "$yyy" in
14227                 12345678901)
14228                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
14229                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
14230                         echo "We will use %d."
14231                         ;;
14232                 esac
14233         fi
14234 fi
14235
14236 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
14237         $cat >try.c <<'EOCP'
14238 #include <sys/types.h>
14239 #include <stdio.h>
14240 int main() {
14241   long q = 12345678901;
14242   printf("%ld\n", q);
14243 }
14244 EOCP
14245         set try
14246         if eval $compile; then
14247                 yyy=`$run ./try`
14248                 case "$yyy" in
14249                 12345678901)
14250                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
14251                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
14252                         echo "We will use %ld."
14253                         ;;
14254                 esac
14255         fi
14256 fi
14257
14258 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
14259         $cat >try.c <<'EOCP'
14260 #include <sys/types.h>
14261 #include <inttypes.h>
14262 #include <stdio.h>
14263 int main() {
14264   int64_t q = 12345678901;
14265   printf("%" PRId64 "\n", q);
14266 }
14267 EOCP
14268         set try
14269         if eval $compile; then
14270                 yyy=`$run ./try`
14271                 case "$yyy" in
14272                 12345678901)
14273                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
14274                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
14275                         echo "We will use the C9X style."
14276                         ;;
14277                 esac
14278         fi
14279 fi
14280
14281 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
14282         $cat >try.c <<EOCP
14283 #include <sys/types.h>
14284 #include <stdio.h>
14285 int main() {
14286   $quadtype q = 12345678901;
14287   printf("%Ld\n", q);
14288 }
14289 EOCP
14290         set try
14291         if eval $compile; then
14292                 yyy=`$run ./try`
14293                 case "$yyy" in
14294                 12345678901)
14295                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
14296                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
14297                         echo "We will use %Ld."
14298                         ;;
14299                 esac
14300         fi
14301 fi
14302
14303 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
14304         $cat >try.c <<'EOCP'
14305 #include <sys/types.h>
14306 #include <stdio.h>
14307 int main() {
14308   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
14309   printf("%lld\n", q);
14310 }
14311 EOCP
14312         set try
14313         if eval $compile; then
14314                 yyy=`$run ./try`
14315                 case "$yyy" in
14316                 12345678901)
14317                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
14318                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
14319                         echo "We will use the %lld style."
14320                         ;;
14321                 esac
14322         fi
14323 fi
14324
14325 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
14326         $cat >try.c <<EOCP
14327 #include <sys/types.h>
14328 #include <stdio.h>
14329 int main() {
14330   $quadtype q = 12345678901;
14331   printf("%qd\n", q);
14332 }
14333 EOCP
14334         set try
14335         if eval $compile; then
14336                 yyy=`$run ./try`
14337                 case "$yyy" in
14338                 12345678901)
14339                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
14340                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
14341                         echo "We will use %qd."
14342                         ;;
14343                 esac
14344         fi
14345 fi
14346
14347 if $test X"$sPRId64" = X; then
14348         echo "Cannot figure out how to print 64-bit integers." >&4
14349 fi
14350
14351 $rm -f try try.*
14352
14353 fi
14354
14355 case "$sPRId64" in
14356 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
14357         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
14358         ;;
14359 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
14360         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
14361         ;;
14362 esac
14363
14364
14365 echo " "
14366 $echo "Checking the format strings to be used for Perl's internal types..." >&4
14367
14368 if $test X"$ivsize" = X8; then
14369         ivdformat="$sPRId64"
14370         uvuformat="$sPRIu64"
14371         uvoformat="$sPRIo64"
14372         uvxformat="$sPRIx64"
14373         uvXUformat="$sPRIXU64"
14374 else
14375         if $test X"$ivsize" = X"$longsize"; then
14376                 ivdformat='"ld"'
14377                 uvuformat='"lu"'
14378                 uvoformat='"lo"'
14379                 uvxformat='"lx"'
14380                 uvXUformat='"lX"'
14381         else
14382                 if $test X"$ivsize" = X"$intsize"; then
14383                         ivdformat='"d"'
14384                         uvuformat='"u"'
14385                         uvoformat='"o"'
14386                         uvxformat='"x"'
14387                         uvXUformat='"X"'
14388                 else
14389                         : far out
14390                         if $test X"$ivsize" = X"$shortsize"; then
14391                                 ivdformat='"hd"'
14392                                 uvuformat='"hu"'
14393                                 uvoformat='"ho"'
14394                                 uvxformat='"hx"'
14395                                 uvXUformat='"hX"'
14396                         fi
14397                 fi
14398         fi
14399 fi
14400
14401 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
14402         nveformat="$sPRIeldbl"
14403         nvfformat="$sPRIfldbl"
14404         nvgformat="$sPRIgldbl"
14405         nvEUformat="$sPRIEUldbl"
14406         nvFUformat="$sPRIFUldbl"
14407         nvGUformat="$sPRIGUldbl"
14408 else
14409         nveformat='"e"'
14410         nvfformat='"f"'
14411         nvgformat='"g"'
14412         nvEUformat='"E"'
14413         nvFUformat='"F"'
14414         nvGUformat='"G"'
14415 fi
14416
14417 case "$ivdformat" in
14418 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
14419     exit 1
14420     ;;
14421 esac
14422
14423
14424 echo " "
14425 $echo "Checking the format string to be used for gids..." >&4
14426
14427 case "$gidsign" in
14428 -1)     if $test X"$gidsize" = X"$ivsize"; then
14429                 gidformat="$ivdformat"
14430         else
14431                 if $test X"$gidsize" = X"$longsize"; then
14432                         gidformat='"ld"'
14433                 else
14434                         if $test X"$gidsize" = X"$intsize"; then
14435                                 gidformat='"d"'
14436                         else
14437                                 if $test X"$gidsize" = X"$shortsize"; then
14438                                         gidformat='"hd"'
14439                                 fi
14440                         fi
14441                 fi
14442         fi
14443         ;;
14444 *)      if $test X"$gidsize" = X"$uvsize"; then
14445                 gidformat="$uvuformat"
14446         else
14447                 if $test X"$gidsize" = X"$longsize"; then
14448                         gidformat='"lu"'
14449                 else
14450                         if $test X"$gidsize" = X"$intsize"; then
14451                                 gidformat='"u"'
14452                         else
14453                                 if $test X"$gidsize" = X"$shortsize"; then
14454                                         gidformat='"hu"'
14455                                 fi
14456                         fi
14457                 fi
14458         fi
14459         ;;
14460 esac
14461
14462 : see if getgroups exists
14463 set getgroups d_getgrps
14464 eval $inlibc
14465
14466 : see if setgroups exists
14467 set setgroups d_setgrps
14468 eval $inlibc
14469
14470
14471 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
14472 echo " "
14473 case "$d_getgrps$d_setgrps" in
14474 *define*)
14475         case "$groupstype" in
14476         '') dflt="$gidtype" ;;
14477         *)  dflt="$groupstype" ;;
14478         esac
14479         $cat <<EOM
14480 What type of pointer is the second argument to getgroups() and setgroups()?
14481 Usually this is the same as group ids, $gidtype, but not always.
14482
14483 EOM
14484         rp='What type pointer is the second argument to getgroups() and setgroups()?'
14485         . ./myread
14486         groupstype="$ans"
14487         ;;
14488 *)  groupstype="$gidtype";;
14489 esac
14490
14491 echo " "
14492 echo "Checking if your $make program sets \$(MAKE)..." >&4
14493 case "$make_set_make" in
14494 '')
14495         $sed 's/^X //' > testmake.mak << 'EOF'
14496 Xall:
14497 X       @echo 'maketemp="$(MAKE)"'
14498 EOF
14499         case "`$make -f testmake.mak 2>/dev/null`" in
14500         *maketemp=*) make_set_make='#' ;;
14501         *)      make_set_make="MAKE=$make" ;;
14502         esac
14503         $rm -f testmake.mak
14504         ;;
14505 esac
14506 case "$make_set_make" in
14507 '#') echo "Yup, it does.";;
14508 *) echo "Nope, it doesn't.";;
14509 esac
14510
14511 : see what type is used for mode_t
14512 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
14513 set mode_t modetype int stdio.h sys/types.h
14514 eval $typedef_ask
14515
14516 : see if stdarg is available
14517 echo " "
14518 if $test `./findhdr stdarg.h`; then
14519         echo "<stdarg.h> found." >&4
14520         valstd="$define"
14521 else
14522         echo "<stdarg.h> NOT found." >&4
14523         valstd="$undef"
14524 fi
14525
14526 : see if varags is available
14527 echo " "
14528 if $test `./findhdr varargs.h`; then
14529         echo "<varargs.h> found." >&4
14530 else
14531         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14532 fi
14533
14534 : set up the varargs testing programs
14535 $cat > varargs.c <<EOP
14536 #ifdef I_STDARG
14537 #include <stdarg.h>
14538 #endif
14539 #ifdef I_VARARGS
14540 #include <varargs.h>
14541 #endif
14542
14543 #ifdef I_STDARG
14544 int f(char *p, ...)
14545 #else
14546 int f(va_alist)
14547 va_dcl
14548 #endif
14549 {
14550         va_list ap;
14551 #ifndef I_STDARG
14552         char *p;
14553 #endif
14554 #ifdef I_STDARG
14555         va_start(ap,p);
14556 #else
14557         va_start(ap);
14558         p = va_arg(ap, char *);
14559 #endif
14560         va_end(ap);
14561 }
14562 EOP
14563 $cat > varargs <<EOP
14564 $startsh
14565 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14566         echo "true"
14567 else
14568         echo "false"
14569 fi
14570 $rm -f varargs$_o
14571 EOP
14572 chmod +x varargs
14573
14574 : now check which varargs header should be included
14575 echo " "
14576 i_varhdr=''
14577 case "$valstd" in
14578 "$define")
14579         if `./varargs I_STDARG`; then
14580                 val='stdarg.h'
14581         elif `./varargs I_VARARGS`; then
14582                 val='varargs.h'
14583         fi
14584         ;;
14585 *)
14586         if `./varargs I_VARARGS`; then
14587                 val='varargs.h'
14588         fi
14589         ;;
14590 esac
14591 case "$val" in
14592 '')
14593 echo "I could not find the definition for va_dcl... You have problems..." >&4
14594         val="$undef"; set i_stdarg; eval $setvar
14595         val="$undef"; set i_varargs; eval $setvar
14596         ;;
14597 *) 
14598         set i_varhdr
14599         eval $setvar
14600         case "$i_varhdr" in
14601         stdarg.h)
14602                 val="$define"; set i_stdarg; eval $setvar
14603                 val="$undef"; set i_varargs; eval $setvar
14604                 ;;
14605         varargs.h)
14606                 val="$undef"; set i_stdarg; eval $setvar
14607                 val="$define"; set i_varargs; eval $setvar
14608                 ;;
14609         esac
14610         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14611 esac
14612 $rm -f varargs*
14613
14614 : see if we need va_copy
14615 echo " "
14616 case "$i_stdarg" in
14617 "$define")
14618         $cat >try.c <<EOCP
14619 #include <stdarg.h>
14620 #include <stdio.h>
14621 #$i_stdlib I_STDLIB
14622 #ifdef I_STDLIB
14623 #include <stdlib.h>
14624 #endif
14625 #include <signal.h>
14626
14627 int
14628 ivfprintf(FILE *f, const char *fmt, va_list *valp)
14629 {
14630   return vfprintf(f, fmt, *valp);
14631 }
14632  
14633 int    
14634 myvfprintf(FILE *f, const  char *fmt, va_list val)
14635 {
14636   return ivfprintf(f, fmt, &val);
14637 }
14638       
14639 int
14640 myprintf(char *fmt, ...) 
14641 {
14642   va_list val;
14643   va_start(val, fmt);
14644   return myvfprintf(stdout, fmt, val); 
14645 }         
14646
14647 int
14648 main(int ac, char **av)
14649 {
14650   signal(SIGSEGV, exit);
14651
14652   myprintf("%s%cs all right, then\n", "that", '\'');                            
14653   exit(0);      
14654 }
14655 EOCP
14656         set try
14657         if eval $compile && $run ./try 2>&1 >/dev/null; then
14658                 case "`$run ./try`" in
14659                 "that's all right, then")
14660                         okay=yes
14661                         ;;
14662                 esac
14663         fi
14664         case "$okay" in
14665         yes)    echo "It seems that you don't need va_copy()." >&4
14666                 need_va_copy="$undef"
14667                 ;;
14668         *)      echo "It seems that va_copy() or similar will be needed." >&4
14669                 need_va_copy="$define"
14670                 ;;
14671         esac
14672         $rm -f try.* core core.* *.core *.core.*
14673         ;;
14674 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
14675         ;;
14676 esac
14677
14678 : define a fucntion to check prototypes
14679 $cat > protochk <<EOSH
14680 $startsh
14681 cc="$cc"
14682 optimize="$optimize"
14683 ccflags="$ccflags"
14684 prototype="$prototype"
14685 define="$define"
14686 rm=$rm
14687 EOSH
14688
14689 $cat >> protochk <<'EOSH'
14690
14691 $rm -f try.c
14692 foo="$1"
14693 shift
14694 while test $# -ge 2; do
14695         case "$1" in
14696                 $define) echo "#include <$2>" >> try.c ;;
14697                 literal) echo "$2" >> try.c ;;
14698         esac
14699     shift 2
14700 done
14701 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
14702 cat >> try.c <<'EOCP'
14703 #ifdef CAN_PROTOTYPE
14704 #define _(args) args
14705 #else
14706 #define _(args) ()
14707 #endif
14708 EOCP
14709 echo "$foo" >> try.c
14710 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
14711 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
14712 status=$?
14713 $rm -f try.[co]
14714 exit $status
14715 EOSH
14716 chmod +x protochk
14717 $eunicefix protochk
14718
14719 : see what type is used for size_t
14720 rp="What is the type used for the length parameter for string functions?"
14721 set size_t sizetype 'unsigned int' stdio.h sys/types.h
14722 eval $typedef_ask
14723
14724 : check for type of arguments to gethostbyaddr. 
14725 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
14726         case "$d_gethbyaddr" in
14727         $define)
14728                 $cat <<EOM
14729
14730 Checking to see what type of arguments are accepted by gethostbyaddr().
14731 EOM
14732                 hdrs="$define sys/types.h
14733                         $d_socket sys/socket.h 
14734                         $i_niin netinet/in.h 
14735                         $i_netdb netdb.h
14736                         $i_unistd unistd.h"
14737                 : The first arg can 'char *' or 'void *'
14738                 : The second arg is some of integral type
14739                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
14740                         for yyy in size_t long int; do
14741                                 case "$netdb_host_type" in
14742                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
14743                                         if ./protochk "$try" $hdrs; then
14744                                                 echo "Your system accepts $xxx for the first arg."
14745                                                 echo "...and $yyy for the second arg."
14746                                                 netdb_host_type="$xxx"
14747                                                 netdb_hlen_type="$yyy"
14748                                         fi
14749                                         ;;
14750                                 esac
14751                         done
14752                 done
14753                 : In case none of those worked, prompt the user.
14754                 case "$netdb_host_type" in
14755                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
14756                         dflt='char *'
14757                         . ./myread
14758                         netdb_host_type=$ans
14759                         rp='What is the type for the 2nd argument to gethostbyaddr?'
14760                         dflt="$sizetype"
14761                         . ./myread
14762                         netdb_hlen_type=$ans
14763                         ;;
14764                 esac
14765                 ;;
14766         *)      : no gethostbyaddr, so pick harmless defaults
14767                 netdb_host_type='char *'
14768                 netdb_hlen_type="$sizetype"
14769                 ;;
14770         esac
14771         # Remove the "const" if needed. -- but then we'll have a 
14772         # prototype clash!
14773         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
14774 fi
14775
14776 : check for type of argument to gethostbyname. 
14777 if test "X$netdb_name_type" = X ; then
14778         case "$d_gethbyname" in
14779         $define)
14780                 $cat <<EOM
14781
14782 Checking to see what type of argument is accepted by gethostbyname().
14783 EOM
14784                 hdrs="$define sys/types.h
14785                         $d_socket sys/socket.h 
14786                         $i_niin netinet/in.h 
14787                         $i_netdb netdb.h
14788                         $i_unistd unistd.h"
14789                 for xxx in "const char *" "char *"; do
14790                         case "$netdb_name_type" in
14791                         '')     try="extern struct hostent *gethostbyname($xxx);"
14792                                 if ./protochk "$try" $hdrs; then
14793                                         echo "Your system accepts $xxx."
14794                                         netdb_name_type="$xxx"
14795                                 fi
14796                                 ;;
14797                         esac
14798                 done
14799                 : In case none of those worked, prompt the user.
14800                 case "$netdb_name_type" in
14801                 '')     rp='What is the type for the 1st argument to gethostbyname?'
14802                         dflt='char *'
14803                         . ./myread
14804                         netdb_name_type=$ans
14805                         ;;
14806                 esac
14807                 ;;
14808         *)      : no gethostbyname, so pick harmless default
14809                 netdb_name_type='char *'
14810                 ;;
14811         esac
14812 fi
14813
14814 : check for type of 1st argument to getnetbyaddr. 
14815 if test "X$netdb_net_type" = X ; then
14816         case "$d_getnbyaddr" in
14817         $define)
14818                 $cat <<EOM
14819
14820 Checking to see what type of 1st argument is accepted by getnetbyaddr().
14821 EOM
14822                 hdrs="$define sys/types.h
14823                         $d_socket sys/socket.h 
14824                         $i_niin netinet/in.h 
14825                         $i_netdb netdb.h
14826                         $i_unistd unistd.h"
14827                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
14828                         case "$netdb_net_type" in
14829                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
14830                                 if ./protochk "$try" $hdrs; then
14831                                         echo "Your system accepts $xxx."
14832                                         netdb_net_type="$xxx"
14833                                 fi
14834                                 ;;
14835                         esac
14836                 done
14837                 : In case none of those worked, prompt the user.
14838                 case "$netdb_net_type" in
14839                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
14840                         dflt='long'
14841                         . ./myread
14842                         netdb_net_type=$ans
14843                         ;;
14844                 esac
14845                 ;;
14846         *)      : no getnetbyaddr, so pick harmless default
14847                 netdb_net_type='long'
14848                 ;;
14849         esac
14850 fi
14851 : locate the preferred pager for this system
14852 case "$pager" in
14853 '')
14854         dflt=''
14855         case "$pg" in
14856         /*) dflt=$pg;;
14857         [a-zA-Z]:/*) dflt=$pg;;
14858         esac
14859         case "$more" in
14860         /*) dflt=$more;;
14861         [a-zA-Z]:/*) dflt=$more;;
14862         esac
14863         case "$less" in
14864         /*) dflt=$less;;
14865         [a-zA-Z]:/*) dflt=$less;;
14866         esac
14867         case "$dflt" in
14868         '') dflt=/usr/ucb/more;;
14869         esac
14870         ;;
14871 *) dflt="$pager";;
14872 esac
14873 echo " "
14874 fn=f/
14875 rp='What pager is used on your system?'
14876 . ./getfile
14877 pager="$ans"
14878
14879 : see what type pids are declared as in the kernel
14880 rp="What is the type of process ids on this system?"
14881 set pid_t pidtype int stdio.h sys/types.h
14882 eval $typedef_ask
14883
14884 : Find earliest binary compatible site_perl subdirectory perl can use.
14885 case "$bincompat5005" in
14886 "$define") xs_apiversion='5.005' ;;
14887 *) xs_apiversion=$version ;;   # The current site_perl version.
14888 esac
14889 : Find earliest pure perl site_perl subdirectory perl can use.
14890 : The versioned directories started at 5.005.
14891 pm_apiversion='5.005'
14892
14893 : see if ar generates random libraries by itself
14894 echo " "
14895 echo "Checking how to generate random libraries on your machine..." >&4
14896 echo 'int bar1() { return bar2(); }' > bar1.c
14897 echo 'int bar2() { return 2; }' > bar2.c
14898 $cat > foo.c <<'EOP'
14899 int main() { printf("%d\n", bar1()); exit(0); }
14900 EOP
14901 $cc $ccflags -c bar1.c >/dev/null 2>&1
14902 $cc $ccflags -c bar2.c >/dev/null 2>&1
14903 $cc $ccflags -c foo.c >/dev/null 2>&1
14904 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
14905 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14906         $run ./foobar >/dev/null 2>&1; then
14907         echo "$ar appears to generate random libraries itself."
14908         orderlib=false
14909         ranlib=":"
14910 elif $ar ts bar$_a >/dev/null 2>&1 &&
14911         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14912         $run ./foobar >/dev/null 2>&1; then
14913                 echo "a table of contents needs to be added with '$ar ts'."
14914                 orderlib=false
14915                 ranlib="$ar ts"
14916 else
14917         case "$ranlib" in
14918         :) ranlib='';;
14919         '')
14920                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
14921                 $test -f $ranlib || ranlib=''
14922                 ;;
14923         esac
14924         if $test -n "$ranlib"; then
14925                 echo "your system has '$ranlib'; we'll use that."
14926                 orderlib=false
14927         else
14928                 echo "your system doesn't seem to support random libraries"
14929                 echo "so we'll use lorder and tsort to order the libraries."
14930                 orderlib=true
14931                 ranlib=":"
14932         fi
14933 fi
14934 $rm -f foo* bar* 
14935
14936 : check for type of arguments to select. 
14937 case "$selecttype" in
14938 '') case "$d_select" in
14939         $define)
14940                 echo " "
14941                 $cat <<EOM
14942 Checking to see what type of arguments are accepted by select().
14943 EOM
14944                 hdrs="$define sys/types.h
14945                         $i_systime sys/time.h 
14946                         $i_sysselct sys/select.h
14947                         $d_socket sys/socket.h"
14948                 : The first arg can be int, unsigned, or size_t
14949                 : The last arg may or may not be 'const'
14950                 val=''
14951                 : void pointer has been seen but using that
14952                 : breaks the selectminbits test
14953                 for xxx in 'fd_set *' 'int *'; do
14954                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
14955                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
14956                                         case "$val" in
14957                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
14958                                                 if ./protochk "$try" $hdrs; then
14959                                                         echo "Your system accepts $xxx."
14960                                                         val="$xxx"
14961                                                 fi
14962                                                 ;;
14963                                         esac
14964                                 done
14965                         done
14966                 done
14967                 case "$val" in
14968                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
14969                         case "$d_fd_set" in
14970                                 $define) dflt="fd_set *" ;;
14971                                 *)              dflt="int *" ;;
14972                         esac
14973                         . ./myread
14974                         val=$ans
14975                         ;;
14976                 esac
14977                 selecttype="$val"
14978                 ;;
14979         *)      : no select, so pick a harmless default
14980                 selecttype='int *'
14981                 ;;
14982         esac
14983         ;;
14984 esac
14985
14986 : check for the select 'width'
14987 case "$selectminbits" in
14988 '') case "$d_select" in
14989         $define)
14990                 $cat <<EOM
14991
14992 Checking to see on how many bits at a time your select() operates...
14993 EOM
14994                 $cat >try.c <<EOCP
14995 #include <sys/types.h>
14996 #$i_time I_TIME
14997 #$i_systime I_SYS_TIME
14998 #$i_systimek I_SYS_TIME_KERNEL
14999 #ifdef I_TIME
15000 #   include <time.h>
15001 #endif
15002 #ifdef I_SYS_TIME
15003 #   ifdef I_SYS_TIME_KERNEL
15004 #       define KERNEL
15005 #   endif
15006 #   include <sys/time.h>
15007 #   ifdef I_SYS_TIME_KERNEL
15008 #       undef KERNEL
15009 #   endif
15010 #endif
15011 #$i_sysselct I_SYS_SELECT
15012 #ifdef I_SYS_SELECT
15013 #include <sys/select.h>
15014 #endif
15015 #$d_socket HAS_SOCKET
15016 #ifdef HAS_SOCKET
15017 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
15018 #endif
15019 #include <stdio.h>
15020 $selecttype b;
15021 #define S sizeof(*(b))
15022 #define MINBITS 64
15023 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
15024 #define NBITS  (NBYTES * 8)
15025 int main() {
15026     char s[NBYTES];
15027     struct timeval t;
15028     int i;
15029     FILE* fp;
15030     int fd;
15031
15032     fclose(stdin);
15033     fp = fopen("try.c", "r");
15034     if (fp == 0)
15035       exit(1);
15036     fd = fileno(fp);
15037     if (fd < 0)
15038       exit(2);
15039     b = ($selecttype)s;
15040     for (i = 0; i < NBITS; i++)
15041         FD_SET(i, b);
15042     t.tv_sec  = 0;
15043     t.tv_usec = 0;
15044     select(fd + 1, b, 0, 0, &t);
15045     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
15046     printf("%d\n", i + 1);
15047     return 0;
15048 }
15049 EOCP
15050                 set try
15051                 if eval $compile_ok; then
15052                         selectminbits=`$run ./try`
15053                         case "$selectminbits" in
15054                         '')     cat >&4 <<EOM
15055 Cannot figure out on how many bits at a time your select() operates.
15056 I'll play safe and guess it is 32 bits.
15057 EOM
15058                                 selectminbits=32
15059                                 bits="32 bits"
15060                                 ;;
15061                         1)      bits="1 bit" ;;
15062                         *)      bits="$selectminbits bits" ;;
15063                         esac
15064                         echo "Your select() operates on $bits at a time." >&4
15065                 else
15066                         rp='What is the minimum number of bits your select() operates on?'
15067                         case "$byteorder" in
15068                         1234|12345678)  dflt=32 ;;
15069                         *)              dflt=1  ;;
15070                         esac
15071                         . ./myread
15072                         val=$ans
15073                         selectminbits="$val"
15074                 fi
15075                 $rm -f try.* try
15076                 ;;
15077         *)      : no select, so pick a harmless default
15078                 selectminbits='32'
15079                 ;;
15080         esac
15081         ;;
15082 esac
15083
15084 : Trace out the files included by signal.h, then look for SIGxxx names.
15085 : Remove SIGARRAYSIZE used by HPUX.
15086 : Remove SIGSTKSIZE used by Linux.
15087 : Remove SIGSTKSZ used by Posix.
15088 : Remove SIGTYP void lines used by OS2.
15089 : Some cpps, like os390, dont give the file name anywhere
15090 if [ "X$fieldn" = X ]; then
15091         : Just make some guesses.  We check them later.
15092         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
15093 else
15094         xxx=`echo '#include <signal.h>' |
15095         $cppstdin $cppminus $cppflags 2>/dev/null |
15096         $grep '^[       ]*#.*include' | 
15097         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
15098 fi
15099 : Check this list of files to be sure we have parsed the cpp output ok.
15100 : This will also avoid potentially non-existent files, such 
15101 : as ../foo/bar.h
15102 xxxfiles=''
15103 for xx in $xxx /dev/null ; do
15104         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
15105 done
15106 : If we have found no files, at least try signal.h
15107 case "$xxxfiles" in
15108 '')     xxxfiles=`./findhdr signal.h` ;;
15109 esac
15110 xxx=`awk '
15111 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
15112         print substr($2, 4, 20)
15113 }
15114 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
15115         print substr($3, 4, 20)
15116 }' $xxxfiles`
15117 : Append some common names just in case the awk scan failed.
15118 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
15119 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
15120 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
15121 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
15122 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
15123
15124 : generate a few handy files for later
15125 $cat > signal.c <<'EOCP'
15126 #include <sys/types.h>
15127 #include <signal.h>
15128 #include <stdio.h>
15129 int main() {
15130
15131 /* Strange style to avoid deeply-nested #if/#else/#endif */
15132 #ifndef NSIG
15133 #  ifdef _NSIG
15134 #    define NSIG (_NSIG)
15135 #  endif
15136 #endif
15137
15138 #ifndef NSIG
15139 #  ifdef SIGMAX
15140 #    define NSIG (SIGMAX+1)
15141 #  endif
15142 #endif
15143
15144 #ifndef NSIG
15145 #  ifdef SIG_MAX
15146 #    define NSIG (SIG_MAX+1)
15147 #  endif
15148 #endif
15149
15150 #ifndef NSIG
15151 #  ifdef MAXSIG
15152 #    define NSIG (MAXSIG+1)
15153 #  endif
15154 #endif
15155
15156 #ifndef NSIG
15157 #  ifdef MAX_SIG
15158 #    define NSIG (MAX_SIG+1)
15159 #  endif
15160 #endif
15161
15162 #ifndef NSIG
15163 #  ifdef SIGARRAYSIZE
15164 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
15165 #  endif
15166 #endif
15167
15168 #ifndef NSIG
15169 #  ifdef _sys_nsig
15170 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
15171 #  endif
15172 #endif
15173
15174 /* Default to some arbitrary number that's big enough to get most
15175    of the common signals.
15176 */
15177 #ifndef NSIG
15178 #    define NSIG 50
15179 #endif
15180
15181 printf("NSIG %d\n", NSIG);
15182
15183 #ifndef JUST_NSIG
15184
15185 EOCP
15186
15187 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
15188 {
15189         printf "#ifdef SIG"; printf $1; printf "\n"
15190         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
15191         printf $1; printf ");\n"
15192         printf "#endif\n"
15193 }
15194 END {
15195         printf "#endif /* JUST_NSIG */\n";
15196         printf "exit(0);\n}\n";
15197 }
15198 ' >>signal.c
15199 $cat >signal.awk <<'EOP'
15200 BEGIN { ndups = 0 }
15201 $1 ~ /^NSIG$/ { nsig = $2 }
15202 ($1 !~ /^NSIG$/) && (NF == 2) {
15203     if ($2 > maxsig) { maxsig = $2 }
15204     if (sig_name[$2]) {
15205         dup_name[ndups] = $1
15206         dup_num[ndups] = $2
15207         ndups++ 
15208     }
15209     else {
15210         sig_name[$2] = $1
15211         sig_num[$2] = $2
15212     }
15213 }
15214 END { 
15215     if (nsig == 0) {
15216         nsig = maxsig + 1
15217     }
15218     printf("NSIG %d\n", nsig);
15219     for (n = 1; n < nsig; n++) {
15220         if (sig_name[n]) {
15221             printf("%s %d\n", sig_name[n], sig_num[n])
15222         }
15223         else {
15224             printf("NUM%d %d\n", n, n) 
15225         }
15226     }
15227     for (n = 0; n < ndups; n++) {
15228         printf("%s %d\n", dup_name[n], dup_num[n])
15229     }
15230 }
15231 EOP
15232 $cat >signal_cmd <<EOS
15233 $startsh
15234 if $test -s signal.lst; then
15235     echo "Using your existing signal.lst file"
15236         exit 0
15237 fi
15238 xxx="$xxx"
15239 EOS
15240 $cat >>signal_cmd <<'EOS'
15241
15242 set signal
15243 if eval $compile_ok; then
15244         $run ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
15245 else
15246         echo "(I can't seem be able to compile the whole test program)" >&4
15247         echo "(I'll try it in little pieces.)" >&4
15248         set signal -DJUST_NSIG
15249         if eval $compile_ok; then
15250                 $run ./signal$_exe > signal.nsg
15251                 $cat signal.nsg
15252         else
15253                 echo "I can't seem to figure out how many signals you have." >&4
15254                 echo "Guessing 50." >&4
15255                 echo 'NSIG 50' > signal.nsg
15256         fi
15257         : Now look at all the signal names, one at a time.
15258         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
15259                 $cat > signal.c <<EOCP
15260 #include <sys/types.h>
15261 #include <signal.h>
15262 #include <stdio.h>
15263 int main() {
15264 printf("$xx %d\n", SIG${xx});
15265 return 0;
15266 }
15267 EOCP
15268                 set signal
15269                 if eval $compile; then
15270                         echo "SIG${xx} found."
15271                         $run ./signal$_exe  >> signal.ls1
15272                 else
15273                         echo "SIG${xx} NOT found."
15274                 fi
15275         done
15276         if $test -s signal.ls1; then
15277                 $cat signal.nsg signal.ls1 |
15278                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
15279         fi
15280
15281 fi
15282 if $test -s signal.lst; then
15283         :
15284 else
15285         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
15286         echo 'kill -l' >signal
15287         set X `csh -f <signal`
15288         $rm -f signal
15289         shift
15290         case $# in
15291         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
15292         esac
15293         echo $@ | $tr ' ' $trnl | \
15294             $awk '{ printf "%s %d\n", $1, ++s; }
15295                   END { printf "NSIG %d\n", ++s }' >signal.lst
15296 fi
15297 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
15298 EOS
15299 chmod a+x signal_cmd
15300 $eunicefix signal_cmd
15301
15302 : generate list of signal names
15303 echo " "
15304 case "$sig_name_init" in
15305 '') doinit=yes ;;
15306 *)  case "$sig_num_init" in
15307     ''|*,*) doinit=yes ;;
15308     esac ;;
15309 esac
15310 case "$doinit" in
15311 yes)
15312         echo "Generating a list of signal names and numbers..." >&4
15313         . ./signal_cmd
15314         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
15315         sig_name=`$awk 'BEGIN { printf "ZERO " }
15316                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
15317         sig_num=`$awk  'BEGIN { printf "0 " }
15318                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
15319         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
15320                              !/^NSIG/   { printf "\"%s\", ", $1 }
15321                              END        { printf "0\n" }' signal.lst`
15322         sig_num_init=`$awk  'BEGIN      { printf "0, " }
15323                              !/^NSIG/   { printf "%d, ", $2}
15324                              END        { printf "0\n"}' signal.lst`
15325         ;;
15326 esac
15327 echo "The following $sig_count signals are available:"
15328 echo " "
15329 echo $sig_name | $awk \
15330 'BEGIN { linelen = 0 }
15331 {
15332         for (i = 1; i <= NF; i++) {
15333                 name = "SIG" $i " "
15334                 linelen = linelen + length(name)
15335                 if (linelen > 70) {
15336                         printf "\n"
15337                         linelen = length(name)
15338                 }
15339                 printf "%s", name
15340         }
15341         printf "\n"
15342 }'
15343 sig_size=`echo $sig_name | awk '{print NF}'`
15344 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
15345
15346 echo " "
15347 case "$sizetype" in
15348 *_t) zzz="$sizetype"    ;;
15349 *)   zzz="filesize"     ;;
15350 esac
15351 echo "Checking the size of $zzz..." >&4 
15352 cat > try.c <<EOCP
15353 #include <sys/types.h>
15354 #include <stdio.h>
15355 int main() {
15356     printf("%d\n", (int)sizeof($sizetype));
15357     exit(0);
15358 }
15359 EOCP
15360 set try
15361 if eval $compile_ok; then
15362         yyy=`$run ./try`
15363         case "$yyy" in
15364         '')     sizesize=4
15365                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
15366                 ;;
15367         *)      sizesize=$yyy
15368                 echo "Your $zzz size is $sizesize bytes."
15369                 ;;
15370         esac
15371 else
15372         sizesize=4
15373         echo "(I can't compile the test program--guessing $sizesize.)" >&4
15374 fi
15375
15376
15377 : check for socklen_t
15378 echo " "
15379 echo "Checking to see if you have socklen_t..." >&4
15380 $cat >try.c <<EOCP
15381 #include <sys/types.h>
15382 #$d_socket HAS_SOCKET
15383 #ifdef HAS_SOCKET
15384 #include <sys/socket.h>
15385 #endif
15386 int main() { socklen_t x = 16; }
15387 EOCP
15388 set try
15389 if eval $compile; then
15390         val="$define"
15391         echo "You have socklen_t."
15392 else
15393         val="$undef"
15394         echo "You do not have socklen_t."
15395         case "$sizetype" in
15396         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
15397         esac
15398 fi
15399 $rm -f try try.*
15400 set d_socklen_t
15401 eval $setvar
15402
15403 : see if this is a socks.h system
15404 set socks.h i_socks
15405 eval $inhdr
15406
15407 : check for type of the size argument to socket calls
15408 case "$d_socket" in
15409 "$define")
15410         $cat <<EOM
15411
15412 Checking to see what type is the last argument of accept().
15413 EOM
15414         yyy=''
15415         case "$d_socklen_t" in
15416         "$define") yyy="$yyy socklen_t"
15417         esac
15418         yyy="$yyy $sizetype int long unsigned"
15419         for xxx in $yyy; do
15420                 case "$socksizetype" in
15421                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
15422                         case "$usesocks" in
15423                         "$define")
15424                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
15425                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
15426                                         socksizetype="$xxx"
15427                                 fi
15428                                 ;;
15429                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
15430                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
15431                                         socksizetype="$xxx"
15432                                 fi
15433                                 ;;
15434                         esac
15435                         ;;
15436                 esac
15437         done
15438 : In case none of those worked, prompt the user.
15439         case "$socksizetype" in
15440         '')     rp='What is the type for socket address structure sizes?'
15441                 dflt='int'
15442                 . ./myread
15443                 socksizetype=$ans
15444                 ;;
15445         esac
15446         ;;
15447 *)      : no sockets, so pick relatively harmless default
15448         socksizetype='int'
15449         ;;
15450 esac
15451
15452 : see what type is used for signed size_t
15453 set ssize_t ssizetype int stdio.h sys/types.h
15454 eval $typedef
15455 dflt="$ssizetype"
15456 $cat > try.c <<EOM
15457 #include <stdio.h>
15458 #include <sys/types.h>
15459 #define Size_t $sizetype
15460 #define SSize_t $dflt
15461 int main()
15462 {
15463         if (sizeof(Size_t) == sizeof(SSize_t))
15464                 printf("$dflt\n");
15465         else if (sizeof(Size_t) == sizeof(int))
15466                 printf("int\n");
15467         else 
15468                 printf("long\n");
15469         exit(0);
15470 }
15471 EOM
15472 echo " "
15473 set try
15474 if eval $compile_ok && $run ./try > /dev/null; then
15475         ssizetype=`$run ./try`
15476         echo "I'll be using $ssizetype for functions returning a byte count." >&4
15477 else
15478         $cat >&4 <<EOM
15479 Help! I can't compile and run the ssize_t test program: please enlighten me!
15480 (This is probably a misconfiguration in your system or libraries, and
15481 you really ought to fix it.  Still, I'll try anyway.)
15482
15483 I need a type that is the same size as $sizetype, but is guaranteed to
15484 be signed.  Common values are ssize_t, int and long.
15485
15486 EOM
15487         rp="What signed type is the same size as $sizetype?"
15488         . ./myread
15489         ssizetype="$ans"
15490 fi
15491 $rm -f try try.*
15492
15493 : see what type of char stdio uses.
15494 echo " "
15495 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
15496 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
15497         echo "Your stdio uses unsigned chars." >&4
15498         stdchar="unsigned char"
15499 else
15500         echo "Your stdio uses signed chars." >&4
15501         stdchar="char"
15502 fi
15503 $rm -f stdioh
15504
15505
15506
15507 : see if time exists
15508 echo " "
15509 if test "X$d_time" = X -o X"$timetype" = X; then
15510     if set time val -f d_time; eval $csym; $val; then
15511                 echo 'time() found.' >&4
15512                 val="$define"
15513                 rp="What is the type returned by time() on this system?"
15514                 set time_t timetype long stdio.h sys/types.h
15515                 eval $typedef_ask
15516     else
15517                 echo 'time() not found, hope that will do.' >&4
15518                 val="$undef"
15519                 timetype='int';
15520     fi
15521     set d_time
15522     eval $setvar
15523 fi
15524
15525 : see what type uids are declared as in the kernel
15526 echo " "
15527 echo "Looking for the type for user ids returned by getuid()."
15528 set uid_t uidtype xxx stdio.h sys/types.h
15529 eval $typedef
15530 case "$uidtype" in
15531 xxx)
15532         xxx=`./findhdr sys/user.h`
15533         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
15534         case $1 in
15535         unsigned) dflt="$1 $2" ;;
15536         *) dflt="$1" ;;
15537         esac
15538         ;;
15539 *) dflt="$uidtype";;
15540 esac
15541 case "$uidtype" in
15542 uid_t)  echo "uid_t found." ;;
15543 *)      rp="What is the type for user ids returned by getuid()?"
15544         . ./myread
15545         uidtype="$ans"
15546         ;;
15547 esac
15548
15549 echo " "
15550 case "$uidtype" in
15551 *_t) zzz="$uidtype"     ;;
15552 *)   zzz="uid"          ;;
15553 esac
15554 echo "Checking the size of $zzz..." >&4 
15555 cat > try.c <<EOCP
15556 #include <sys/types.h>
15557 #include <stdio.h>
15558 int main() {
15559     printf("%d\n", (int)sizeof($uidtype));
15560     exit(0);
15561 }
15562 EOCP
15563 set try
15564 if eval $compile_ok; then
15565         yyy=`$run ./try`
15566         case "$yyy" in
15567         '')     uidsize=4
15568                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
15569                 ;;
15570         *)      uidsize=$yyy
15571                 echo "Your $zzz is $uidsize bytes long."
15572                 ;;
15573         esac
15574 else
15575         uidsize=4
15576         echo "(I can't compile the test program--guessing $uidsize.)" >&4
15577 fi
15578
15579 echo " "
15580 case "$uidtype" in
15581 *_t) zzz="$uidtype"     ;;
15582 *)   zzz="uid"          ;;
15583 esac
15584 echo "Checking the sign of $zzz..." >&4
15585 cat > try.c <<EOCP
15586 #include <sys/types.h>
15587 #include <stdio.h>
15588 int main() {
15589         $uidtype foo = -1;
15590         if (foo < 0)
15591                 printf("-1\n");
15592         else
15593                 printf("1\n");
15594 }
15595 EOCP
15596 set try
15597 if eval $compile; then
15598         yyy=`$run ./try`
15599         case "$yyy" in
15600         '')     uidsign=1
15601                 echo "(I can't execute the test program--guessing unsigned.)" >&4
15602                 ;;
15603         *)      uidsign=$yyy
15604                 case "$uidsign" in
15605                  1) echo "Your $zzz is unsigned." ;;
15606                 -1) echo "Your $zzz is signed."   ;;
15607                 esac
15608                 ;;
15609         esac
15610 else
15611         uidsign=1
15612         echo "(I can't compile the test program--guessing unsigned.)" >&4
15613 fi
15614
15615
15616
15617 echo " "
15618 $echo "Checking the format string to be used for uids..." >&4
15619
15620 case "$uidsign" in
15621 -1)     if $test X"$uidsize" = X"$ivsize"; then
15622                 uidformat="$ivdformat"
15623         else
15624                 if $test X"$uidsize" = X"$longsize"; then
15625                         uidformat='"ld"'
15626                 else
15627                         if $test X"$uidsize" = X"$intsize"; then
15628                                 uidformat='"d"'
15629                         else
15630                                 if $test X"$uidsize" = X"$shortsize"; then
15631                                         uidformat='"hd"'
15632                                 fi
15633                         fi
15634                 fi
15635         fi
15636         ;;
15637 *)      if $test X"$uidsize" = X"$uvsize"; then
15638                 uidformat="$uvuformat"
15639         else
15640                 if $test X"$uidsize" = X"$longsize"; then
15641                         uidformat='"lu"'
15642                 else
15643                         if $test X"$uidsize" = X"$intsize"; then
15644                                 uidformat='"u"'
15645                         else
15646                                 if $test X"$uidsize" = X"$shortsize"; then
15647                                         uidformat='"hu"'
15648                                 fi
15649                         fi
15650                 fi
15651         fi
15652         ;;
15653 esac
15654
15655 : determine compiler compiler
15656 case "$yacc" in
15657 '')
15658         dflt=yacc;;
15659 *)
15660         dflt="$yacc";;
15661 esac
15662 echo " "
15663 comp='yacc'
15664 if $test -f "$byacc"; then
15665         dflt="$byacc"
15666         comp="byacc or $comp"
15667 fi
15668 if $test -f "$bison"; then
15669         comp="$comp or bison -y"
15670 fi
15671 rp="Which compiler compiler ($comp) shall I use?"
15672 . ./myread
15673 yacc="$ans"
15674 case "$yacc" in
15675 *bis*)
15676         case "$yacc" in
15677         *-y*) ;;
15678         *)
15679                 yacc="$yacc -y"
15680                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
15681                 ;;
15682         esac
15683         ;;
15684 esac
15685
15686 : see if fcntl.h is there
15687 val=''
15688 set fcntl.h val
15689 eval $inhdr
15690
15691 : see if we can include fcntl.h
15692 case "$val" in
15693 "$define")
15694         echo " "
15695         if $h_fcntl; then
15696                 val="$define"
15697                 echo "We'll be including <fcntl.h>." >&4
15698         else
15699                 val="$undef"
15700                 if $h_sysfile; then
15701         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
15702                 else
15703                         echo "We won't be including <fcntl.h>." >&4
15704                 fi
15705         fi
15706         ;;
15707 *)
15708         h_fcntl=false
15709         val="$undef"
15710         ;;
15711 esac
15712 set i_fcntl
15713 eval $setvar
15714
15715 : see if this is a iconv.h system
15716 set iconv.h i_iconv
15717 eval $inhdr
15718
15719 : see if this is a ieeefp.h system
15720 set ieeefp.h i_ieeefp
15721 eval $inhdr
15722
15723 : see if this is a libutil.h system
15724 set libutil.h i_libutil
15725 eval $inhdr
15726
15727 : see if locale.h is available
15728 set locale.h i_locale
15729 eval $inhdr
15730
15731 : see if mach cthreads are available
15732 if test "X$usethreads" = "X$define"; then
15733         set mach/cthreads.h i_machcthr
15734         eval $inhdr
15735 else
15736         i_machcthr="$undef"
15737 fi
15738
15739
15740
15741 : see if this is a math.h system
15742 set math.h i_math
15743 eval $inhdr
15744
15745 : see if this is a mntent.h system
15746 set mntent.h i_mntent
15747 eval $inhdr
15748
15749 : see if ndbm.h is available
15750 set ndbm.h t_ndbm
15751 eval $inhdr
15752 case "$t_ndbm" in
15753 $define)
15754         : see if dbm_open exists
15755         set dbm_open d_dbm_open
15756         eval $inlibc
15757         case "$d_dbm_open" in
15758         $undef)
15759                 t_ndbm="$undef"
15760                 echo "We won't be including <ndbm.h>"
15761                 ;;
15762         esac
15763         ;;
15764 esac
15765 val="$t_ndbm"
15766 set i_ndbm
15767 eval $setvar
15768
15769 : see if net/errno.h is available
15770 val=''
15771 set net/errno.h val
15772 eval $inhdr
15773
15774 : Unfortunately, it causes problems on some systems.  Arrgh.
15775 case "$val" in
15776 $define)
15777         cat > try.c <<'EOM'
15778 #include <stdio.h>
15779 #include <errno.h>
15780 #include <net/errno.h>
15781 int func()
15782 {
15783         return ENOTSOCK;
15784 }
15785 EOM
15786         if $cc $ccflags -c try.c >/dev/null 2>&1; then
15787                 echo "We'll be including <net/errno.h>." >&4
15788         else
15789                 echo "We won't be including <net/errno.h>." >&4
15790                 val="$undef"
15791         fi
15792         $rm -f try.* try
15793         ;;
15794 esac
15795 set i_neterrno
15796 eval $setvar
15797
15798 : see if netinet/tcp.h is available
15799 set netinet/tcp.h i_netinettcp
15800 eval $inhdr
15801
15802 : see if this is a poll.h system
15803 set poll.h i_poll
15804 eval $inhdr
15805
15806 : see if this is a prot.h system
15807 set prot.h i_prot
15808 eval $inhdr
15809
15810 echo " "
15811 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
15812 $cat <<'EOSH' > Cppsym.know
15813 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
15814 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
15815 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
15816 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
15817 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
15818 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
15819 bull c cadmus clipper CMU COFF COMPILER_VERSION
15820 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
15821 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
15822 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
15823 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
15824 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
15825 H3050R H3050RX hbullx20 hcx host_mips
15826 hp200 hp300 hp700 HP700 hp800 hp9000
15827 hp9000s200 hp9000s300 hp9000s400 hp9000s500
15828 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
15829 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
15830 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
15831 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
15832 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
15833 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
15834 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
15835 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
15836 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
15837 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
15838 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
15839 MATH_HAS_NO_SIDE_EFFECTS
15840 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
15841 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
15842 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
15843 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
15844 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
15845 NetBSD news1500 news1700 news1800 news1900 news3700
15846 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
15847 ns32016 ns32332 ns32k nsc32000
15848 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
15849 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
15850 pc532 pdp11 PGC PIC plexus PORTAR posix
15851 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
15852 POSIX_C_SOURCE POSIX_SOURCE POWER
15853 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
15854 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
15855 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
15856 sony sony_news sonyrisc sparc sparclite spectrum
15857 stardent stdc STDC_EXT stratos sun sun3 sun386
15858 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
15859 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
15860 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
15861 sysV68 sysV88 Tek4132 Tek4300 titan
15862 TM3200 TM5400 TM5600
15863 tower tower32 tower32_200 tower32_600 tower32_700
15864 tower32_800 tower32_850 tss
15865 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
15866 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
15867 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
15868 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
15869 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
15870 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
15871 z8000
15872 EOSH
15873 # Maybe put other stuff here too.
15874 cat <<EOSH >>Cppsym.know
15875 $osname
15876 EOSH
15877 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
15878 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
15879 $cat Cppsym.know > Cppsym.c
15880 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
15881 $rm -f Cppsym.a Cppsym.b Cppsym.c
15882 cat <<EOSH > Cppsym
15883 $startsh
15884 if $test \$# -gt 0; then
15885     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
15886     if $test -s Cppsym.got; then
15887         $rm -f Cppsym.got
15888         exit 0
15889     fi
15890     $rm -f Cppsym.got
15891     exit 1
15892 else
15893     $tr " " "$trnl" | ./Cppsym.try
15894     exit 0
15895 fi
15896 EOSH
15897 chmod +x Cppsym
15898 $eunicefix Cppsym
15899 cat <<EOSH > Cppsym.try
15900 $startsh
15901 cat <<'EOCP' > try.c
15902 #include <stdio.h>
15903 int main() {
15904 EOCP
15905 $awk \\
15906 EOSH
15907 cat <<'EOSH' >> Cppsym.try
15908 'length($1) > 0 {
15909     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
15910     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
15911     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
15912     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
15913 }'       >> try.c
15914 echo 'return 0;}' >> try.c
15915 EOSH
15916 cat <<EOSH >> Cppsym.try
15917 ccflags="$ccflags"
15918 case "$osname-$gccversion" in
15919 irix-) ccflags="\$ccflags -woff 1178" ;;
15920 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
15921 esac
15922 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
15923 EOSH
15924 chmod +x Cppsym.try
15925 $eunicefix Cppsym.try
15926 ./Cppsym < Cppsym.know > Cppsym.true
15927 : now check the C compiler for additional symbols
15928 postprocess_cc_v=''
15929 case "$osname" in
15930 aix) postprocess_cc_v="|$tr , ' '" ;;
15931 esac
15932 $cat >ccsym <<EOS
15933 $startsh
15934 $cat >tmp.c <<EOF
15935 extern int foo;
15936 EOF
15937 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
15938 do
15939         case "\$i" in
15940         -D*) echo "\$i" | $sed 's/^-D//';;
15941         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
15942         esac
15943 done
15944 $rm -f try.c
15945 EOS
15946 postprocess_cc_v=''
15947 chmod +x ccsym
15948 $eunicefix ccsym
15949 ./ccsym > ccsym1.raw
15950 if $test -s ccsym1.raw; then
15951        $sort ccsym1.raw | $uniq >ccsym.raw
15952 else
15953        mv ccsym1.raw ccsym.raw
15954 fi
15955
15956 $awk '/\=/ { print $0; next }
15957         { print $0"=1" }' ccsym.raw >ccsym.list
15958 $awk '/\=/ { print $0; next }
15959         { print $0"=1" }' Cppsym.true >ccsym.true
15960 $comm -13 ccsym.true ccsym.list >ccsym.own
15961 $comm -12 ccsym.true ccsym.list >ccsym.com
15962 $comm -23 ccsym.true ccsym.list >ccsym.cpp
15963 also=''
15964 if $test -z ccsym.raw; then
15965         echo "Your C compiler doesn't seem to define any symbols!" >&4
15966         echo " "
15967         echo "However, your C preprocessor defines the following symbols:"
15968         $cat Cppsym.true
15969         ccsymbols=''
15970         cppsymbols=`$cat Cppsym.true`
15971         cppsymbols=`echo $cppsymbols`
15972         cppccsymbols="$cppsymbols"
15973 else
15974         if $test -s ccsym.com; then
15975                 echo "Your C compiler and pre-processor define these symbols:"
15976                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
15977                 also='also '
15978                 symbols='ones'
15979                 cppccsymbols=`$cat ccsym.com`
15980                 cppccsymbols=`echo $cppccsymbols`
15981                 $test "$silent" || sleep 1
15982         fi
15983         if $test -s ccsym.cpp; then
15984                 $test "$also" && echo " "
15985                 echo "Your C pre-processor ${also}defines the following symbols:"
15986                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
15987                 also='further '
15988                 cppsymbols=`$cat ccsym.cpp`
15989                 cppsymbols=`echo $cppsymbols`
15990                 $test "$silent" || sleep 1
15991         fi
15992         if $test -s ccsym.own; then
15993                 $test "$also" && echo " "
15994                 echo "Your C compiler ${also}defines the following cpp symbols:"
15995                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
15996                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
15997                 ccsymbols=`$cat ccsym.own`
15998                 ccsymbols=`echo $ccsymbols`
15999                 $test "$silent" || sleep 1
16000         fi
16001 fi
16002
16003 : see if this is a termio system
16004 val="$undef"
16005 val2="$undef"
16006 val3="$undef"
16007 if $test `./findhdr termios.h`; then
16008         set tcsetattr i_termios
16009         eval $inlibc
16010         val3="$i_termios"
16011 fi
16012 echo " "
16013 case "$val3" in
16014 "$define") echo "You have POSIX termios.h... good!" >&4;;
16015 *) if ./Cppsym pyr; then
16016                 case "`/bin/universe`" in
16017                 ucb) if $test `./findhdr sgtty.h`; then
16018                                 val2="$define"
16019                                 echo "<sgtty.h> found." >&4
16020                         else
16021                                 echo "System is pyramid with BSD universe."
16022                                 echo "<sgtty.h> not found--you could have problems." >&4
16023                         fi;;
16024                 *) if $test `./findhdr termio.h`; then
16025                                 val="$define"
16026                                 echo "<termio.h> found." >&4
16027                         else
16028                                 echo "System is pyramid with USG universe."
16029                                 echo "<termio.h> not found--you could have problems." >&4
16030                         fi;;
16031                 esac
16032         elif ./usg; then
16033                 if $test `./findhdr termio.h`; then
16034                         echo "<termio.h> found." >&4
16035                         val="$define"
16036                 elif $test `./findhdr sgtty.h`; then
16037                         echo "<sgtty.h> found." >&4
16038                         val2="$define"
16039                 else
16040 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
16041                 fi
16042         else
16043                 if $test `./findhdr sgtty.h`; then
16044                         echo "<sgtty.h> found." >&4
16045                         val2="$define"
16046                 elif $test `./findhdr termio.h`; then
16047                         echo "<termio.h> found." >&4
16048                         val="$define"
16049                 else
16050 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
16051                 fi
16052         fi;;
16053 esac
16054 set i_termio; eval $setvar
16055 val=$val2; set i_sgtty; eval $setvar
16056 val=$val3; set i_termios; eval $setvar
16057
16058 : see if this is a shadow.h system
16059 set shadow.h i_shadow
16060 eval $inhdr
16061
16062 : see if stddef is available
16063 set stddef.h i_stddef
16064 eval $inhdr
16065
16066 : see if this is a sunmath.h system
16067 set sunmath.h i_sunmath
16068 eval $inhdr
16069
16070 : see if sys/access.h is available
16071 set sys/access.h i_sysaccess
16072 eval $inhdr
16073
16074 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
16075 set sys/filio.h i_sysfilio
16076 eval $inhdr
16077 echo " "
16078 if $test `./findhdr sys/ioctl.h`; then
16079         val="$define"
16080         echo '<sys/ioctl.h> found.' >&4
16081 else
16082         val="$undef"
16083         if $test $i_sysfilio = "$define"; then
16084             echo '<sys/ioctl.h> NOT found.' >&4
16085         else
16086                 $test $i_sgtty = "$define" && xxx="sgtty.h"
16087                 $test $i_termio = "$define" && xxx="termio.h"
16088                 $test $i_termios = "$define" && xxx="termios.h"
16089 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
16090         fi
16091 fi
16092 set i_sysioctl
16093 eval $setvar
16094
16095 : see if socket ioctl defs are in sys/sockio.h
16096 echo " "
16097 xxx=`./findhdr sys/sockio.h`
16098 if $test "$xxx"; then
16099         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
16100                 val="$define"
16101                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
16102         else
16103                 val="$undef"
16104                 echo "No socket ioctls found in <sys/sockio.h>." >&4
16105         fi
16106 else
16107         val="$undef"
16108         $cat <<EOM
16109 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
16110 EOM
16111 fi
16112 set i_syssockio
16113 eval $setvar
16114
16115
16116 : see if this is a syslog.h system
16117 set syslog.h i_syslog
16118 eval $inhdr
16119
16120
16121 : see if this is a sys/mode.h system
16122 set sys/mode.h i_sysmode
16123 eval $inhdr
16124
16125 : see if sys/resource.h has to be included
16126 set sys/resource.h i_sysresrc
16127 eval $inhdr
16128
16129 : see if sys/security.h is available
16130 set sys/security.h i_syssecrt
16131 eval $inhdr
16132
16133 : see if this is a sys/statvfs.h system
16134 set sys/statvfs.h i_sysstatvfs
16135 eval $inhdr
16136
16137 : see if this is a sys/un.h system
16138 set sys/un.h i_sysun
16139 eval $inhdr
16140
16141
16142 : see if this is a sys/utsname.h system
16143 set sys/utsname.h i_sysutsname
16144 eval $inhdr
16145
16146 : see if this is a syswait system
16147 set sys/wait.h i_syswait
16148 eval $inhdr
16149
16150 : see if this is a ustat.h system
16151 set ustat.h i_ustat
16152 eval $inhdr
16153
16154 : see if this is an utime system
16155 set utime.h i_utime
16156 eval $inhdr
16157
16158 : see if this is a values.h system
16159 set values.h i_values
16160 eval $inhdr
16161
16162 : see if this is a vfork system
16163 case "$d_vfork" in
16164 "$define")
16165         set vfork.h i_vfork
16166         eval $inhdr
16167         ;;
16168 *)
16169         i_vfork="$undef"
16170         ;;
16171 esac
16172
16173 : see if gdbm.h is available
16174 set gdbm.h t_gdbm
16175 eval $inhdr
16176 case "$t_gdbm" in
16177 $define)
16178         : see if gdbm_open exists
16179         set gdbm_open d_gdbm_open
16180         eval $inlibc
16181         case "$d_gdbm_open" in
16182         $undef)
16183                 t_gdbm="$undef"
16184                 echo "We won't be including <gdbm.h>"
16185                 ;;
16186         esac
16187         ;;
16188 esac
16189 val="$t_gdbm"
16190 set i_gdbm
16191 eval $setvar
16192
16193 echo " "
16194 echo "Looking for extensions..." >&4
16195 : If we are using the old config.sh, known_extensions may contain
16196 : old or inaccurate or duplicate values.
16197 known_extensions=''
16198 nonxs_extensions=''
16199 : We do not use find because it might not be available.
16200 : We do not just use MANIFEST because the user may have dropped
16201 : some additional extensions into the source tree and expect them
16202 : to be built.
16203
16204 : Function to recursively find available extensions, ignoring DynaLoader
16205 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
16206 find_extensions='
16207     for xxx in *; do
16208        case "$xxx" in
16209            DynaLoader|dynaload) ;;
16210            *)
16211            if $test -f $xxx/$xxx.xs; then
16212                known_extensions="$known_extensions $1$xxx";
16213            elif $test -f $xxx/Makefile.PL; then
16214                nonxs_extensions="$nonxs_extensions $1$xxx";
16215            else
16216                if $test -d $xxx -a $# -lt 10; then
16217                    set $1$xxx/ $*;
16218                    cd $xxx;
16219                    eval $find_extensions;
16220                    cd ..;
16221                    shift;
16222                fi;
16223            fi
16224            ;;
16225        esac;
16226     done'
16227 tdir=`pwd`
16228 cd $rsrc/ext
16229 set X
16230 shift
16231 eval $find_extensions
16232 set X $nonxs_extensions
16233 shift
16234 nonxs_extensions="$*"
16235 set X $known_extensions
16236 shift
16237 known_extensions="$*"
16238 cd $tdir
16239
16240 : Now see which are supported on this system.
16241 avail_ext=''
16242 for xxx in $known_extensions ; do
16243         case "$xxx" in
16244         DB_File|db_file)
16245                 case "$i_db" in
16246                 $define) avail_ext="$avail_ext $xxx" ;;
16247                 esac
16248                 ;;
16249         GDBM_File|gdbm_fil)
16250                 case "$i_gdbm" in 
16251                 $define) avail_ext="$avail_ext $xxx" ;;
16252                 esac
16253                 ;;
16254         I18N/Langinfo|i18n_lan)
16255                 case "$i_langinfo$d_nl_langinfo" in 
16256                 $define$define) avail_ext="$avail_ext $xxx" ;;
16257                 esac
16258                 ;;
16259         NDBM_File|ndbm_fil)
16260                 case "$i_ndbm" in
16261                 $define)
16262                     case "$osname-$use64bitint" in
16263                     cygwin-*|hpux-define)
16264                         case "$libs" in
16265                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
16266                         esac
16267                         ;;
16268                     *) avail_ext="$avail_ext $xxx" ;;
16269                     esac
16270                     ;;
16271                 esac
16272                 ;;
16273         ODBM_File|odbm_fil) 
16274                 case "${i_dbm}${i_rpcsvcdbm}" in
16275                 *"${define}"*)
16276                     case "$osname-$use64bitint" in
16277                     cygwin-*|hpux-define)
16278                         case "$libs" in
16279                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
16280                         esac
16281                         ;;
16282                     *) avail_ext="$avail_ext $xxx" ;;
16283                     esac
16284                     ;;
16285                 esac
16286                 ;;
16287         POSIX|posix)
16288                 case "$useposix" in
16289                 true|define|y) avail_ext="$avail_ext $xxx" ;;
16290                 esac
16291                 ;;
16292         Opcode|opcode)
16293                 case "$useopcode" in
16294                 true|define|y) avail_ext="$avail_ext $xxx" ;;
16295                 esac
16296                 ;;
16297         Socket|socket)
16298                 case "$d_socket" in 
16299                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
16300                 esac
16301                 ;;
16302         Sys/Syslog|sys/syslog)
16303                 : XXX syslog requires socket
16304                 case "$d_socket" in 
16305                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
16306                 esac
16307                 ;;
16308         Thread|thread)
16309                 case "$usethreads" in
16310                 true|$define|y)
16311                         case "$useithreads" in
16312                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
16313                         esac
16314                 esac
16315                 ;;
16316         IPC/SysV|ipc/sysv)
16317                 : XXX Do we need a useipcsysv variable here
16318                 case "${d_msg}${d_sem}${d_shm}" in 
16319                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
16320                 esac
16321                 ;;
16322         *)      avail_ext="$avail_ext $xxx"
16323                 ;;
16324         esac
16325 done
16326
16327 set X $avail_ext
16328 shift
16329 avail_ext="$*"
16330
16331 : Now see which nonxs extensions are supported on this system.
16332 : For now assume all are.
16333 nonxs_ext=''
16334 for xxx in $nonxs_extensions ; do
16335         case "$xxx" in
16336         *)      nonxs_ext="$nonxs_ext $xxx"
16337                 ;;
16338         esac
16339 done
16340
16341 set X $nonxs_ext
16342 shift
16343 nonxs_ext="$*"
16344
16345 case $usedl in
16346 $define)
16347         $cat <<EOM
16348 A number of extensions are supplied with $package.  You may choose to
16349 compile these extensions for dynamic loading (the default), compile
16350 them into the $package executable (static loading), or not include
16351 them at all.  Answer "none" to include no extensions.
16352 Note that DynaLoader is always built and need not be mentioned here.
16353
16354 EOM
16355         case "$dynamic_ext" in
16356         '') dflt="$avail_ext" ;;
16357         *)      dflt="$dynamic_ext"
16358                 # Perhaps we are reusing an old out-of-date config.sh.
16359                 case "$hint" in
16360                 previous)
16361                         if test X"$dynamic_ext" != X"$avail_ext"; then
16362                                 $cat <<EOM
16363 NOTICE:  Your previous config.sh list may be incorrect. 
16364 The extensions now available to you are 
16365         ${avail_ext}
16366 but the default list from your previous config.sh is
16367         ${dynamic_ext} 
16368
16369 EOM
16370                         fi
16371                         ;;
16372                 esac
16373                 ;;
16374         esac
16375         case "$dflt" in
16376         '')     dflt=none;;
16377         esac
16378         rp="What extensions do you wish to load dynamically?"
16379         . ./myread
16380         case "$ans" in
16381         none) dynamic_ext=' ' ;;
16382         *) dynamic_ext="$ans" ;;
16383         esac
16384
16385         case "$static_ext" in
16386         '')
16387                 : Exclude those already listed in dynamic linking
16388                 dflt=''
16389                 for xxx in $avail_ext; do
16390                         case " $dynamic_ext " in
16391                         *" $xxx "*) ;;
16392                         *) dflt="$dflt $xxx" ;;
16393                         esac
16394                 done
16395                 set X $dflt
16396                 shift
16397                 dflt="$*"
16398                 ;;
16399         *)  dflt="$static_ext" 
16400                 ;;
16401         esac
16402
16403         case "$dflt" in
16404         '')     dflt=none;;
16405         esac
16406         rp="What extensions do you wish to load statically?"
16407         . ./myread
16408         case "$ans" in
16409         none) static_ext=' ' ;;
16410         *) static_ext="$ans" ;;
16411         esac
16412         ;;
16413 *)
16414         $cat <<EOM
16415 A number of extensions are supplied with $package.  Answer "none" 
16416 to include no extensions. 
16417 Note that DynaLoader is always built and need not be mentioned here.
16418
16419 EOM
16420         case "$static_ext" in
16421         '') dflt="$avail_ext" ;;
16422         *)      dflt="$static_ext"
16423                 # Perhaps we are reusing an old out-of-date config.sh.
16424                 case "$hint" in
16425                 previous)
16426                         if test X"$static_ext" != X"$avail_ext"; then
16427                                 $cat <<EOM
16428 NOTICE:  Your previous config.sh list may be incorrect. 
16429 The extensions now available to you are 
16430         ${avail_ext}
16431 but the default list from your previous config.sh is
16432         ${static_ext} 
16433
16434 EOM
16435                         fi
16436                         ;;
16437                 esac
16438                 ;;
16439         esac
16440         : Exclude those that are not xs extensions
16441         case "$dflt" in
16442         '')     dflt=none;;
16443         esac
16444         rp="What extensions do you wish to include?"
16445         . ./myread
16446         case "$ans" in
16447         none) static_ext=' ' ;;
16448         *) static_ext="$ans" ;;
16449         esac
16450         ;;
16451 esac
16452
16453 set X $dynamic_ext $static_ext $nonxs_ext
16454 shift
16455 extensions="$*"
16456
16457 : Remove libraries needed only for extensions
16458 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
16459 : The exception is SunOS 4.x, which needs them.
16460 case "${osname}X${osvers}" in
16461 sunos*X4*)
16462     perllibs="$libs"
16463     ;;
16464 *) case "$usedl" in
16465     $define|true|[yY]*)
16466             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
16467             shift
16468             perllibs="$*"
16469             ;;
16470     *)  perllibs="$libs"
16471             ;;
16472     esac
16473     ;;
16474 esac
16475
16476 : Remove build directory name from cppstdin so it can be used from
16477 : either the present location or the final installed location.
16478 echo " "
16479 : Get out of the UU directory to get correct path name.
16480 cd ..
16481 case "$cppstdin" in
16482 `pwd`/cppstdin)
16483         echo "Stripping down cppstdin path name"
16484         cppstdin=cppstdin
16485         ;;
16486 esac
16487 cd UU
16488
16489 : end of configuration questions
16490 echo " "
16491 echo "End of configuration questions."
16492 echo " "
16493
16494 : back to where it started
16495 if test -d ../UU; then
16496         cd ..
16497 fi
16498
16499 : configuration may be patched via a 'config.over' file
16500 if $test -f config.over; then
16501         echo " "
16502         dflt=y
16503         rp='I see a config.over file.  Do you wish to load it?'
16504         . UU/myread
16505         case "$ans" in
16506         n*) echo "OK, I'll ignore it.";;
16507         *)      . ./config.over
16508                 echo "Configuration override changes have been loaded."
16509                 ;;
16510         esac
16511 fi
16512
16513 : in case they want portability, strip down executable paths
16514 case "$d_portable" in
16515 "$define")
16516         echo " "
16517         echo "Stripping down executable paths..." >&4
16518         for file in $loclist $trylist; do
16519                 eval temp=\$$file
16520                 eval $file=`basename $temp`
16521         done
16522         ;;
16523 esac
16524
16525 : create config.sh file
16526 echo " "
16527 echo "Creating config.sh..." >&4
16528 $spitshell <<EOT >config.sh
16529 $startsh
16530 #
16531 # This file was produced by running the Configure script. It holds all the
16532 # definitions figured out by Configure. Should you modify one of these values,
16533 # do not forget to propagate your changes by running "Configure -der". You may
16534 # instead choose to run each of the .SH files by yourself, or "Configure -S".
16535 #
16536
16537 # Package name      : $package
16538 # Source directory  : $src
16539 # Configuration time: $cf_time
16540 # Configured by     : $cf_by
16541 # Target system     : $myuname
16542
16543 Author='$Author'
16544 Date='$Date'
16545 Header='$Header'
16546 Id='$Id'
16547 Locker='$Locker'
16548 Log='$Log'
16549 Mcc='$Mcc'
16550 RCSfile='$RCSfile'
16551 Revision='$Revision'
16552 Source='$Source'
16553 State='$State'
16554 _a='$_a'
16555 _exe='$_exe'
16556 _o='$_o'
16557 afs='$afs'
16558 afsroot='$afsroot'
16559 alignbytes='$alignbytes'
16560 ansi2knr='$ansi2knr'
16561 aphostname='$aphostname'
16562 api_revision='$api_revision'
16563 api_subversion='$api_subversion'
16564 api_version='$api_version'
16565 api_versionstring='$api_versionstring'
16566 ar='$ar'
16567 archlib='$archlib'
16568 archlibexp='$archlibexp'
16569 archname64='$archname64'
16570 archname='$archname'
16571 archobjs='$archobjs'
16572 awk='$awk'
16573 baserev='$baserev'
16574 bash='$bash'
16575 bin='$bin'
16576 bincompat5005='$bincompat5005'
16577 binexp='$binexp'
16578 bison='$bison'
16579 byacc='$byacc'
16580 byteorder='$byteorder'
16581 c='$c'
16582 castflags='$castflags'
16583 cat='$cat'
16584 cc='$cc'
16585 cccdlflags='$cccdlflags'
16586 ccdlflags='$ccdlflags'
16587 ccflags='$ccflags'
16588 ccflags_uselargefiles='$ccflags_uselargefiles'
16589 ccname='$ccname'
16590 ccsymbols='$ccsymbols'
16591 ccversion='$ccversion'
16592 cf_by='$cf_by'
16593 cf_email='$cf_email'
16594 cf_time='$cf_time'
16595 charsize='$charsize'
16596 chgrp='$chgrp'
16597 chmod='$chmod'
16598 chown='$chown'
16599 clocktype='$clocktype'
16600 comm='$comm'
16601 compress='$compress'
16602 contains='$contains'
16603 cp='$cp'
16604 cpio='$cpio'
16605 cpp='$cpp'
16606 cpp_stuff='$cpp_stuff'
16607 cppccsymbols='$cppccsymbols'
16608 cppflags='$cppflags'
16609 cpplast='$cpplast'
16610 cppminus='$cppminus'
16611 cpprun='$cpprun'
16612 cppstdin='$cppstdin'
16613 cppsymbols='$cppsymbols'
16614 cryptlib='$cryptlib'
16615 csh='$csh'
16616 d_Gconvert='$d_Gconvert'
16617 d_PRIEUldbl='$d_PRIEUldbl'
16618 d_PRIFUldbl='$d_PRIFUldbl'
16619 d_PRIGUldbl='$d_PRIGUldbl'
16620 d_PRIXU64='$d_PRIXU64'
16621 d_PRId64='$d_PRId64'
16622 d_PRIeldbl='$d_PRIeldbl'
16623 d_PRIfldbl='$d_PRIfldbl'
16624 d_PRIgldbl='$d_PRIgldbl'
16625 d_PRIi64='$d_PRIi64'
16626 d_PRIo64='$d_PRIo64'
16627 d_PRIu64='$d_PRIu64'
16628 d_PRIx64='$d_PRIx64'
16629 d_SCNfldbl='$d_SCNfldbl'
16630 d__fwalk='$d__fwalk'
16631 d_access='$d_access'
16632 d_accessx='$d_accessx'
16633 d_alarm='$d_alarm'
16634 d_archlib='$d_archlib'
16635 d_atolf='$d_atolf'
16636 d_atoll='$d_atoll'
16637 d_attribut='$d_attribut'
16638 d_bcmp='$d_bcmp'
16639 d_bcopy='$d_bcopy'
16640 d_bincompat5005='$d_bincompat5005'
16641 d_bsd='$d_bsd'
16642 d_bsdgetpgrp='$d_bsdgetpgrp'
16643 d_bsdsetpgrp='$d_bsdsetpgrp'
16644 d_bzero='$d_bzero'
16645 d_casti32='$d_casti32'
16646 d_castneg='$d_castneg'
16647 d_charvspr='$d_charvspr'
16648 d_chown='$d_chown'
16649 d_chroot='$d_chroot'
16650 d_chsize='$d_chsize'
16651 d_closedir='$d_closedir'
16652 d_cmsghdr_s='$d_cmsghdr_s'
16653 d_const='$d_const'
16654 d_crypt='$d_crypt'
16655 d_csh='$d_csh'
16656 d_cuserid='$d_cuserid'
16657 d_dbl_dig='$d_dbl_dig'
16658 d_dbminitproto='$d_dbminitproto'
16659 d_difftime='$d_difftime'
16660 d_dirnamlen='$d_dirnamlen'
16661 d_dlerror='$d_dlerror'
16662 d_dlopen='$d_dlopen'
16663 d_dlsymun='$d_dlsymun'
16664 d_dosuid='$d_dosuid'
16665 d_drand48proto='$d_drand48proto'
16666 d_dup2='$d_dup2'
16667 d_eaccess='$d_eaccess'
16668 d_endgrent='$d_endgrent'
16669 d_endhent='$d_endhent'
16670 d_endnent='$d_endnent'
16671 d_endpent='$d_endpent'
16672 d_endpwent='$d_endpwent'
16673 d_endsent='$d_endsent'
16674 d_eofnblk='$d_eofnblk'
16675 d_eunice='$d_eunice'
16676 d_fchdir='$d_fchdir'
16677 d_fchmod='$d_fchmod'
16678 d_fchown='$d_fchown'
16679 d_fcntl='$d_fcntl'
16680 d_fcntl_can_lock='$d_fcntl_can_lock'
16681 d_fd_macros='$d_fd_macros'
16682 d_fd_set='$d_fd_set'
16683 d_fds_bits='$d_fds_bits'
16684 d_fgetpos='$d_fgetpos'
16685 d_flexfnam='$d_flexfnam'
16686 d_flock='$d_flock'
16687 d_flockproto='$d_flockproto'
16688 d_fork='$d_fork'
16689 d_fpathconf='$d_fpathconf'
16690 d_fpos64_t='$d_fpos64_t'
16691 d_frexpl='$d_frexpl'
16692 d_fs_data_s='$d_fs_data_s'
16693 d_fseeko='$d_fseeko'
16694 d_fsetpos='$d_fsetpos'
16695 d_fstatfs='$d_fstatfs'
16696 d_fstatvfs='$d_fstatvfs'
16697 d_fsync='$d_fsync'
16698 d_ftello='$d_ftello'
16699 d_ftime='$d_ftime'
16700 d_getcwd='$d_getcwd'
16701 d_getespwnam='$d_getespwnam'
16702 d_getfsstat='$d_getfsstat'
16703 d_getgrent='$d_getgrent'
16704 d_getgrps='$d_getgrps'
16705 d_gethbyaddr='$d_gethbyaddr'
16706 d_gethbyname='$d_gethbyname'
16707 d_gethent='$d_gethent'
16708 d_gethname='$d_gethname'
16709 d_gethostprotos='$d_gethostprotos'
16710 d_getitimer='$d_getitimer'
16711 d_getlogin='$d_getlogin'
16712 d_getmnt='$d_getmnt'
16713 d_getmntent='$d_getmntent'
16714 d_getnbyaddr='$d_getnbyaddr'
16715 d_getnbyname='$d_getnbyname'
16716 d_getnent='$d_getnent'
16717 d_getnetprotos='$d_getnetprotos'
16718 d_getpagsz='$d_getpagsz'
16719 d_getpbyname='$d_getpbyname'
16720 d_getpbynumber='$d_getpbynumber'
16721 d_getpent='$d_getpent'
16722 d_getpgid='$d_getpgid'
16723 d_getpgrp2='$d_getpgrp2'
16724 d_getpgrp='$d_getpgrp'
16725 d_getppid='$d_getppid'
16726 d_getprior='$d_getprior'
16727 d_getprotoprotos='$d_getprotoprotos'
16728 d_getprpwnam='$d_getprpwnam'
16729 d_getpwent='$d_getpwent'
16730 d_getsbyname='$d_getsbyname'
16731 d_getsbyport='$d_getsbyport'
16732 d_getsent='$d_getsent'
16733 d_getservprotos='$d_getservprotos'
16734 d_getspnam='$d_getspnam'
16735 d_gettimeod='$d_gettimeod'
16736 d_gnulibc='$d_gnulibc'
16737 d_grpasswd='$d_grpasswd'
16738 d_hasmntopt='$d_hasmntopt'
16739 d_htonl='$d_htonl'
16740 d_iconv='$d_iconv'
16741 d_index='$d_index'
16742 d_inetaton='$d_inetaton'
16743 d_int64_t='$d_int64_t'
16744 d_isascii='$d_isascii'
16745 d_isnan='$d_isnan'
16746 d_isnanl='$d_isnanl'
16747 d_killpg='$d_killpg'
16748 d_lchown='$d_lchown'
16749 d_ldbl_dig='$d_ldbl_dig'
16750 d_link='$d_link'
16751 d_locconv='$d_locconv'
16752 d_lockf='$d_lockf'
16753 d_longdbl='$d_longdbl'
16754 d_longlong='$d_longlong'
16755 d_lseekproto='$d_lseekproto'
16756 d_lstat='$d_lstat'
16757 d_madvise='$d_madvise'
16758 d_mblen='$d_mblen'
16759 d_mbstowcs='$d_mbstowcs'
16760 d_mbtowc='$d_mbtowc'
16761 d_memchr='$d_memchr'
16762 d_memcmp='$d_memcmp'
16763 d_memcpy='$d_memcpy'
16764 d_memmove='$d_memmove'
16765 d_memset='$d_memset'
16766 d_mkdir='$d_mkdir'
16767 d_mkdtemp='$d_mkdtemp'
16768 d_mkfifo='$d_mkfifo'
16769 d_mkstemp='$d_mkstemp'
16770 d_mkstemps='$d_mkstemps'
16771 d_mktime='$d_mktime'
16772 d_mmap='$d_mmap'
16773 d_modfl='$d_modfl'
16774 d_modfl_pow32_bug='$d_modfl_pow32_bug'
16775 d_mprotect='$d_mprotect'
16776 d_msg='$d_msg'
16777 d_msg_ctrunc='$d_msg_ctrunc'
16778 d_msg_dontroute='$d_msg_dontroute'
16779 d_msg_oob='$d_msg_oob'
16780 d_msg_peek='$d_msg_peek'
16781 d_msg_proxy='$d_msg_proxy'
16782 d_msgctl='$d_msgctl'
16783 d_msgget='$d_msgget'
16784 d_msghdr_s='$d_msghdr_s'
16785 d_msgrcv='$d_msgrcv'
16786 d_msgsnd='$d_msgsnd'
16787 d_msync='$d_msync'
16788 d_munmap='$d_munmap'
16789 d_mymalloc='$d_mymalloc'
16790 d_nice='$d_nice'
16791 d_nl_langinfo='$d_nl_langinfo'
16792 d_nv_preserves_uv='$d_nv_preserves_uv'
16793 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
16794 d_off64_t='$d_off64_t'
16795 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
16796 d_oldpthreads='$d_oldpthreads'
16797 d_oldsock='$d_oldsock'
16798 d_open3='$d_open3'
16799 d_pathconf='$d_pathconf'
16800 d_pause='$d_pause'
16801 d_perl_otherlibdirs='$d_perl_otherlibdirs'
16802 d_phostname='$d_phostname'
16803 d_pipe='$d_pipe'
16804 d_poll='$d_poll'
16805 d_portable='$d_portable'
16806 d_pthread_yield='$d_pthread_yield'
16807 d_pwage='$d_pwage'
16808 d_pwchange='$d_pwchange'
16809 d_pwclass='$d_pwclass'
16810 d_pwcomment='$d_pwcomment'
16811 d_pwexpire='$d_pwexpire'
16812 d_pwgecos='$d_pwgecos'
16813 d_pwpasswd='$d_pwpasswd'
16814 d_pwquota='$d_pwquota'
16815 d_qgcvt='$d_qgcvt'
16816 d_quad='$d_quad'
16817 d_readdir='$d_readdir'
16818 d_readlink='$d_readlink'
16819 d_readv='$d_readv'
16820 d_recvmsg='$d_recvmsg'
16821 d_rename='$d_rename'
16822 d_rewinddir='$d_rewinddir'
16823 d_rmdir='$d_rmdir'
16824 d_safebcpy='$d_safebcpy'
16825 d_safemcpy='$d_safemcpy'
16826 d_sanemcmp='$d_sanemcmp'
16827 d_sbrkproto='$d_sbrkproto'
16828 d_sched_yield='$d_sched_yield'
16829 d_scm_rights='$d_scm_rights'
16830 d_seekdir='$d_seekdir'
16831 d_select='$d_select'
16832 d_sem='$d_sem'
16833 d_semctl='$d_semctl'
16834 d_semctl_semid_ds='$d_semctl_semid_ds'
16835 d_semctl_semun='$d_semctl_semun'
16836 d_semget='$d_semget'
16837 d_semop='$d_semop'
16838 d_sendmsg='$d_sendmsg'
16839 d_setegid='$d_setegid'
16840 d_seteuid='$d_seteuid'
16841 d_setgrent='$d_setgrent'
16842 d_setgrps='$d_setgrps'
16843 d_sethent='$d_sethent'
16844 d_setitimer='$d_setitimer'
16845 d_setlinebuf='$d_setlinebuf'
16846 d_setlocale='$d_setlocale'
16847 d_setnent='$d_setnent'
16848 d_setpent='$d_setpent'
16849 d_setpgid='$d_setpgid'
16850 d_setpgrp2='$d_setpgrp2'
16851 d_setpgrp='$d_setpgrp'
16852 d_setprior='$d_setprior'
16853 d_setproctitle='$d_setproctitle'
16854 d_setpwent='$d_setpwent'
16855 d_setregid='$d_setregid'
16856 d_setresgid='$d_setresgid'
16857 d_setresuid='$d_setresuid'
16858 d_setreuid='$d_setreuid'
16859 d_setrgid='$d_setrgid'
16860 d_setruid='$d_setruid'
16861 d_setsent='$d_setsent'
16862 d_setsid='$d_setsid'
16863 d_setvbuf='$d_setvbuf'
16864 d_sfio='$d_sfio'
16865 d_shm='$d_shm'
16866 d_shmat='$d_shmat'
16867 d_shmatprototype='$d_shmatprototype'
16868 d_shmctl='$d_shmctl'
16869 d_shmdt='$d_shmdt'
16870 d_shmget='$d_shmget'
16871 d_sigaction='$d_sigaction'
16872 d_sigprocmask='$d_sigprocmask'
16873 d_sigsetjmp='$d_sigsetjmp'
16874 d_sockatmark='$d_sockatmark'
16875 d_sockatmarkproto='$d_sockatmarkproto'
16876 d_socket='$d_socket'
16877 d_socklen_t='$d_socklen_t'
16878 d_sockpair='$d_sockpair'
16879 d_socks5_init='$d_socks5_init'
16880 d_sqrtl='$d_sqrtl'
16881 d_sresgproto='$d_sresgproto'
16882 d_sresuproto='$d_sresuproto'
16883 d_statblks='$d_statblks'
16884 d_statfs_f_flags='$d_statfs_f_flags'
16885 d_statfs_s='$d_statfs_s'
16886 d_statvfs='$d_statvfs'
16887 d_stdio_cnt_lval='$d_stdio_cnt_lval'
16888 d_stdio_ptr_lval='$d_stdio_ptr_lval'
16889 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
16890 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
16891 d_stdio_stream_array='$d_stdio_stream_array'
16892 d_stdiobase='$d_stdiobase'
16893 d_stdstdio='$d_stdstdio'
16894 d_strchr='$d_strchr'
16895 d_strcoll='$d_strcoll'
16896 d_strctcpy='$d_strctcpy'
16897 d_strerrm='$d_strerrm'
16898 d_strerror='$d_strerror'
16899 d_strftime='$d_strftime'
16900 d_strtod='$d_strtod'
16901 d_strtol='$d_strtol'
16902 d_strtold='$d_strtold'
16903 d_strtoll='$d_strtoll'
16904 d_strtoq='$d_strtoq'
16905 d_strtoul='$d_strtoul'
16906 d_strtoull='$d_strtoull'
16907 d_strtouq='$d_strtouq'
16908 d_strxfrm='$d_strxfrm'
16909 d_suidsafe='$d_suidsafe'
16910 d_symlink='$d_symlink'
16911 d_syscall='$d_syscall'
16912 d_syscallproto='$d_syscallproto'
16913 d_sysconf='$d_sysconf'
16914 d_sysernlst='$d_sysernlst'
16915 d_syserrlst='$d_syserrlst'
16916 d_system='$d_system'
16917 d_tcgetpgrp='$d_tcgetpgrp'
16918 d_tcsetpgrp='$d_tcsetpgrp'
16919 d_telldir='$d_telldir'
16920 d_telldirproto='$d_telldirproto'
16921 d_time='$d_time'
16922 d_times='$d_times'
16923 d_truncate='$d_truncate'
16924 d_tzname='$d_tzname'
16925 d_u32align='$d_u32align'
16926 d_ualarm='$d_ualarm'
16927 d_umask='$d_umask'
16928 d_uname='$d_uname'
16929 d_union_semun='$d_union_semun'
16930 d_usleep='$d_usleep'
16931 d_usleepproto='$d_usleepproto'
16932 d_ustat='$d_ustat'
16933 d_vendorarch='$d_vendorarch'
16934 d_vendorbin='$d_vendorbin'
16935 d_vendorlib='$d_vendorlib'
16936 d_vfork='$d_vfork'
16937 d_void_closedir='$d_void_closedir'
16938 d_voidsig='$d_voidsig'
16939 d_voidtty='$d_voidtty'
16940 d_volatile='$d_volatile'
16941 d_vprintf='$d_vprintf'
16942 d_wait4='$d_wait4'
16943 d_waitpid='$d_waitpid'
16944 d_wcstombs='$d_wcstombs'
16945 d_wctomb='$d_wctomb'
16946 d_writev='$d_writev'
16947 d_xenix='$d_xenix'
16948 date='$date'
16949 db_hashtype='$db_hashtype'
16950 db_prefixtype='$db_prefixtype'
16951 db_version_major='$db_version_major'
16952 db_version_minor='$db_version_minor'
16953 db_version_patch='$db_version_patch'
16954 defvoidused='$defvoidused'
16955 direntrytype='$direntrytype'
16956 dlext='$dlext'
16957 dlsrc='$dlsrc'
16958 doublesize='$doublesize'
16959 drand01='$drand01'
16960 dynamic_ext='$dynamic_ext'
16961 eagain='$eagain'
16962 ebcdic='$ebcdic'
16963 echo='$echo'
16964 egrep='$egrep'
16965 emacs='$emacs'
16966 eunicefix='$eunicefix'
16967 exe_ext='$exe_ext'
16968 expr='$expr'
16969 extensions='$extensions'
16970 fflushNULL='$fflushNULL'
16971 fflushall='$fflushall'
16972 find='$find'
16973 firstmakefile='$firstmakefile'
16974 flex='$flex'
16975 fpossize='$fpossize'
16976 fpostype='$fpostype'
16977 freetype='$freetype'
16978 from='$from'
16979 full_ar='$full_ar'
16980 full_csh='$full_csh'
16981 full_sed='$full_sed'
16982 gccosandvers='$gccosandvers'
16983 gccversion='$gccversion'
16984 gidformat='$gidformat'
16985 gidsign='$gidsign'
16986 gidsize='$gidsize'
16987 gidtype='$gidtype'
16988 glibpth='$glibpth'
16989 grep='$grep'
16990 groupcat='$groupcat'
16991 groupstype='$groupstype'
16992 gzip='$gzip'
16993 h_fcntl='$h_fcntl'
16994 h_sysfile='$h_sysfile'
16995 hint='$hint'
16996 hostcat='$hostcat'
16997 i16size='$i16size'
16998 i16type='$i16type'
16999 i32size='$i32size'
17000 i32type='$i32type'
17001 i64size='$i64size'
17002 i64type='$i64type'
17003 i8size='$i8size'
17004 i8type='$i8type'
17005 i_arpainet='$i_arpainet'
17006 i_bsdioctl='$i_bsdioctl'
17007 i_db='$i_db'
17008 i_dbm='$i_dbm'
17009 i_dirent='$i_dirent'
17010 i_dld='$i_dld'
17011 i_dlfcn='$i_dlfcn'
17012 i_fcntl='$i_fcntl'
17013 i_float='$i_float'
17014 i_gdbm='$i_gdbm'
17015 i_grp='$i_grp'
17016 i_iconv='$i_iconv'
17017 i_ieeefp='$i_ieeefp'
17018 i_inttypes='$i_inttypes'
17019 i_langinfo='$i_langinfo'
17020 i_libutil='$i_libutil'
17021 i_limits='$i_limits'
17022 i_locale='$i_locale'
17023 i_machcthr='$i_machcthr'
17024 i_malloc='$i_malloc'
17025 i_math='$i_math'
17026 i_memory='$i_memory'
17027 i_mntent='$i_mntent'
17028 i_ndbm='$i_ndbm'
17029 i_netdb='$i_netdb'
17030 i_neterrno='$i_neterrno'
17031 i_netinettcp='$i_netinettcp'
17032 i_niin='$i_niin'
17033 i_poll='$i_poll'
17034 i_prot='$i_prot'
17035 i_pthread='$i_pthread'
17036 i_pwd='$i_pwd'
17037 i_rpcsvcdbm='$i_rpcsvcdbm'
17038 i_sfio='$i_sfio'
17039 i_sgtty='$i_sgtty'
17040 i_shadow='$i_shadow'
17041 i_socks='$i_socks'
17042 i_stdarg='$i_stdarg'
17043 i_stddef='$i_stddef'
17044 i_stdlib='$i_stdlib'
17045 i_string='$i_string'
17046 i_sunmath='$i_sunmath'
17047 i_sysaccess='$i_sysaccess'
17048 i_sysdir='$i_sysdir'
17049 i_sysfile='$i_sysfile'
17050 i_sysfilio='$i_sysfilio'
17051 i_sysin='$i_sysin'
17052 i_sysioctl='$i_sysioctl'
17053 i_syslog='$i_syslog'
17054 i_sysmman='$i_sysmman'
17055 i_sysmode='$i_sysmode'
17056 i_sysmount='$i_sysmount'
17057 i_sysndir='$i_sysndir'
17058 i_sysparam='$i_sysparam'
17059 i_sysresrc='$i_sysresrc'
17060 i_syssecrt='$i_syssecrt'
17061 i_sysselct='$i_sysselct'
17062 i_syssockio='$i_syssockio'
17063 i_sysstat='$i_sysstat'
17064 i_sysstatfs='$i_sysstatfs'
17065 i_sysstatvfs='$i_sysstatvfs'
17066 i_systime='$i_systime'
17067 i_systimek='$i_systimek'
17068 i_systimes='$i_systimes'
17069 i_systypes='$i_systypes'
17070 i_sysuio='$i_sysuio'
17071 i_sysun='$i_sysun'
17072 i_sysutsname='$i_sysutsname'
17073 i_sysvfs='$i_sysvfs'
17074 i_syswait='$i_syswait'
17075 i_termio='$i_termio'
17076 i_termios='$i_termios'
17077 i_time='$i_time'
17078 i_unistd='$i_unistd'
17079 i_ustat='$i_ustat'
17080 i_utime='$i_utime'
17081 i_values='$i_values'
17082 i_varargs='$i_varargs'
17083 i_varhdr='$i_varhdr'
17084 i_vfork='$i_vfork'
17085 ignore_versioned_solibs='$ignore_versioned_solibs'
17086 inc_version_list='$inc_version_list'
17087 inc_version_list_init='$inc_version_list_init'
17088 incpath='$incpath'
17089 inews='$inews'
17090 installarchlib='$installarchlib'
17091 installbin='$installbin'
17092 installman1dir='$installman1dir'
17093 installman3dir='$installman3dir'
17094 installprefix='$installprefix'
17095 installprefixexp='$installprefixexp'
17096 installprivlib='$installprivlib'
17097 installscript='$installscript'
17098 installsitearch='$installsitearch'
17099 installsitebin='$installsitebin'
17100 installsitelib='$installsitelib'
17101 installstyle='$installstyle'
17102 installusrbinperl='$installusrbinperl'
17103 installvendorarch='$installvendorarch'
17104 installvendorbin='$installvendorbin'
17105 installvendorlib='$installvendorlib'
17106 intsize='$intsize'
17107 issymlink='$issymlink'
17108 ivdformat='$ivdformat'
17109 ivsize='$ivsize'
17110 ivtype='$ivtype'
17111 known_extensions='$known_extensions'
17112 ksh='$ksh'
17113 ld='$ld'
17114 lddlflags='$lddlflags'
17115 ldflags='$ldflags'
17116 ldflags_uselargefiles='$ldflags_uselargefiles'
17117 ldlibpthname='$ldlibpthname'
17118 less='$less'
17119 lib_ext='$lib_ext'
17120 libc='$libc'
17121 libperl='$libperl'
17122 libpth='$libpth'
17123 libs='$libs'
17124 libsdirs='$libsdirs'
17125 libsfiles='$libsfiles'
17126 libsfound='$libsfound'
17127 libspath='$libspath'
17128 libswanted='$libswanted'
17129 libswanted_uselargefiles='$libswanted_uselargefiles'
17130 line='$line'
17131 lint='$lint'
17132 lkflags='$lkflags'
17133 ln='$ln'
17134 lns='$lns'
17135 locincpth='$locincpth'
17136 loclibpth='$loclibpth'
17137 longdblsize='$longdblsize'
17138 longlongsize='$longlongsize'
17139 longsize='$longsize'
17140 lp='$lp'
17141 lpr='$lpr'
17142 ls='$ls'
17143 lseeksize='$lseeksize'
17144 lseektype='$lseektype'
17145 mail='$mail'
17146 mailx='$mailx'
17147 make='$make'
17148 make_set_make='$make_set_make'
17149 mallocobj='$mallocobj'
17150 mallocsrc='$mallocsrc'
17151 malloctype='$malloctype'
17152 man1dir='$man1dir'
17153 man1direxp='$man1direxp'
17154 man1ext='$man1ext'
17155 man3dir='$man3dir'
17156 man3direxp='$man3direxp'
17157 man3ext='$man3ext'
17158 mips_type='$mips_type'
17159 mkdir='$mkdir'
17160 mmaptype='$mmaptype'
17161 modetype='$modetype'
17162 more='$more'
17163 multiarch='$multiarch'
17164 mv='$mv'
17165 myarchname='$myarchname'
17166 mydomain='$mydomain'
17167 myhostname='$myhostname'
17168 myuname='$myuname'
17169 n='$n'
17170 need_va_copy='$need_va_copy'
17171 netdb_hlen_type='$netdb_hlen_type'
17172 netdb_host_type='$netdb_host_type'
17173 netdb_name_type='$netdb_name_type'
17174 netdb_net_type='$netdb_net_type'
17175 nm='$nm'
17176 nm_opt='$nm_opt'
17177 nm_so_opt='$nm_so_opt'
17178 nonxs_ext='$nonxs_ext'
17179 nroff='$nroff'
17180 nvEUformat='$nvEUformat'
17181 nvFUformat='$nvFUformat'
17182 nvGUformat='$nvGUformat'
17183 nveformat='$nveformat'
17184 nvfformat='$nvfformat'
17185 nvgformat='$nvgformat'
17186 nvsize='$nvsize'
17187 nvtype='$nvtype'
17188 o_nonblock='$o_nonblock'
17189 obj_ext='$obj_ext'
17190 old_pthread_create_joinable='$old_pthread_create_joinable'
17191 optimize='$optimize'
17192 orderlib='$orderlib'
17193 osname='$osname'
17194 osvers='$osvers'
17195 otherlibdirs='$otherlibdirs'
17196 package='$package'
17197 pager='$pager'
17198 passcat='$passcat'
17199 patchlevel='$patchlevel'
17200 path_sep='$path_sep'
17201 perl5='$perl5'
17202 perl='$perl'
17203 perl_patchlevel='$perl_patchlevel'
17204 perladmin='$perladmin'
17205 perllibs='$perllibs'
17206 perlpath='$perlpath'
17207 pg='$pg'
17208 phostname='$phostname'
17209 pidtype='$pidtype'
17210 plibpth='$plibpth'
17211 pm_apiversion='$pm_apiversion'
17212 pmake='$pmake'
17213 pr='$pr'
17214 prefix='$prefix'
17215 prefixexp='$prefixexp'
17216 privlib='$privlib'
17217 privlibexp='$privlibexp'
17218 prototype='$prototype'
17219 ptrsize='$ptrsize'
17220 quadkind='$quadkind'
17221 quadtype='$quadtype'
17222 randbits='$randbits'
17223 randfunc='$randfunc'
17224 randseedtype='$randseedtype'
17225 ranlib='$ranlib'
17226 rd_nodata='$rd_nodata'
17227 revision='$revision'
17228 rm='$rm'
17229 rmail='$rmail'
17230 run='$run'
17231 runnm='$runnm'
17232 sPRIEUldbl='$sPRIEUldbl'
17233 sPRIFUldbl='$sPRIFUldbl'
17234 sPRIGUldbl='$sPRIGUldbl'
17235 sPRIXU64='$sPRIXU64'
17236 sPRId64='$sPRId64'
17237 sPRIeldbl='$sPRIeldbl'
17238 sPRIfldbl='$sPRIfldbl'
17239 sPRIgldbl='$sPRIgldbl'
17240 sPRIi64='$sPRIi64'
17241 sPRIo64='$sPRIo64'
17242 sPRIu64='$sPRIu64'
17243 sPRIx64='$sPRIx64'
17244 sSCNfldbl='$sSCNfldbl'
17245 sched_yield='$sched_yield'
17246 scriptdir='$scriptdir'
17247 scriptdirexp='$scriptdirexp'
17248 sed='$sed'
17249 seedfunc='$seedfunc'
17250 selectminbits='$selectminbits'
17251 selecttype='$selecttype'
17252 sendmail='$sendmail'
17253 sh='$sh'
17254 shar='$shar'
17255 sharpbang='$sharpbang'
17256 shmattype='$shmattype'
17257 shortsize='$shortsize'
17258 shrpenv='$shrpenv'
17259 shsharp='$shsharp'
17260 sig_count='$sig_count'
17261 sig_name='$sig_name'
17262 sig_name_init='$sig_name_init'
17263 sig_num='$sig_num'
17264 sig_num_init='$sig_num_init'
17265 sig_size='$sig_size'
17266 signal_t='$signal_t'
17267 sitearch='$sitearch'
17268 sitearchexp='$sitearchexp'
17269 sitebin='$sitebin'
17270 sitebinexp='$sitebinexp'
17271 sitelib='$sitelib'
17272 sitelib_stem='$sitelib_stem'
17273 sitelibexp='$sitelibexp'
17274 siteprefix='$siteprefix'
17275 siteprefixexp='$siteprefixexp'
17276 sizesize='$sizesize'
17277 sizetype='$sizetype'
17278 sleep='$sleep'
17279 smail='$smail'
17280 so='$so'
17281 sockethdr='$sockethdr'
17282 socketlib='$socketlib'
17283 socksizetype='$socksizetype'
17284 sort='$sort'
17285 spackage='$spackage'
17286 spitshell='$spitshell'
17287 src='$src'
17288 ssizetype='$ssizetype'
17289 startperl='$startperl'
17290 startsh='$startsh'
17291 static_ext='$static_ext'
17292 stdchar='$stdchar'
17293 stdio_base='$stdio_base'
17294 stdio_bufsiz='$stdio_bufsiz'
17295 stdio_cnt='$stdio_cnt'
17296 stdio_filbuf='$stdio_filbuf'
17297 stdio_ptr='$stdio_ptr'
17298 stdio_stream_array='$stdio_stream_array'
17299 strings='$strings'
17300 submit='$submit'
17301 subversion='$subversion'
17302 sysman='$sysman'
17303 tail='$tail'
17304 tar='$tar'
17305 targetarch='$targetarch'
17306 tbl='$tbl'
17307 tee='$tee'
17308 test='$test'
17309 timeincl='$timeincl'
17310 timetype='$timetype'
17311 to='$to'
17312 touch='$touch'
17313 tr='$tr'
17314 trnl='$trnl'
17315 troff='$troff'
17316 u16size='$u16size'
17317 u16type='$u16type'
17318 u32size='$u32size'
17319 u32type='$u32type'
17320 u64size='$u64size'
17321 u64type='$u64type'
17322 u8size='$u8size'
17323 u8type='$u8type'
17324 uidformat='$uidformat'
17325 uidsign='$uidsign'
17326 uidsize='$uidsize'
17327 uidtype='$uidtype'
17328 uname='$uname'
17329 uniq='$uniq'
17330 uquadtype='$uquadtype'
17331 use5005threads='$use5005threads'
17332 use64bitall='$use64bitall'
17333 use64bitint='$use64bitint'
17334 usecrosscompile='$usecrosscompile'
17335 usedl='$usedl'
17336 useithreads='$useithreads'
17337 uselargefiles='$uselargefiles'
17338 uselongdouble='$uselongdouble'
17339 usemorebits='$usemorebits'
17340 usemultiplicity='$usemultiplicity'
17341 usemymalloc='$usemymalloc'
17342 usenm='$usenm'
17343 useopcode='$useopcode'
17344 useperlio='$useperlio'
17345 useposix='$useposix'
17346 usereentrant='$usereentrant'
17347 usesfio='$usesfio'
17348 useshrplib='$useshrplib'
17349 usesocks='$usesocks'
17350 usethreads='$usethreads'
17351 usevendorprefix='$usevendorprefix'
17352 usevfork='$usevfork'
17353 usrinc='$usrinc'
17354 uuname='$uuname'
17355 uvXUformat='$uvXUformat'
17356 uvoformat='$uvoformat'
17357 uvsize='$uvsize'
17358 uvtype='$uvtype'
17359 uvuformat='$uvuformat'
17360 uvxformat='$uvxformat'
17361 vendorarch='$vendorarch'
17362 vendorarchexp='$vendorarchexp'
17363 vendorbin='$vendorbin'
17364 vendorbinexp='$vendorbinexp'
17365 vendorlib='$vendorlib'
17366 vendorlib_stem='$vendorlib_stem'
17367 vendorlibexp='$vendorlibexp'
17368 vendorprefix='$vendorprefix'
17369 vendorprefixexp='$vendorprefixexp'
17370 version='$version'
17371 version_patchlevel_string='$version_patchlevel_string'
17372 versiononly='$versiononly'
17373 vi='$vi'
17374 voidflags='$voidflags'
17375 xlibpth='$xlibpth'
17376 xs_apiversion='$xs_apiversion'
17377 yacc='$yacc'
17378 yaccflags='$yaccflags'
17379 zcat='$zcat'
17380 zip='$zip'
17381 EOT
17382
17383 : Add in command line options if available
17384 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
17385
17386 : add special variables
17387 $test -f $src/patchlevel.h && \
17388 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
17389 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
17390 echo "PERL_CONFIG_SH=true" >>config.sh
17391
17392 : propagate old symbols
17393 if $test -f UU/config.sh; then
17394         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
17395         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
17396         $sort | $uniq -u >UU/oldsyms
17397         set X `cat UU/oldsyms`
17398         shift
17399         case $# in
17400         0) ;;
17401         *)
17402                 cat <<EOM
17403 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
17404 EOM
17405                 echo "# Variables propagated from previous config.sh file." >>config.sh
17406                 for sym in `cat UU/oldsyms`; do
17407                         echo "    Propagating $hint variable "'$'"$sym..."
17408                         eval 'tmp="$'"${sym}"'"'
17409                         echo "$tmp" | \
17410                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
17411                 done
17412                 ;;
17413         esac
17414 fi
17415
17416 : Finish up by extracting the .SH files
17417 case "$alldone" in
17418 exit)
17419         $rm -rf UU
17420         echo "Extraction done."
17421         exit 0
17422         ;;
17423 cont)
17424         ;;
17425 '')
17426         dflt=''
17427         nostick=true
17428         $cat <<EOM
17429
17430 If you'd like to make any changes to the config.sh file before I begin
17431 to configure things, do it as a shell escape now (e.g. !vi config.sh).
17432
17433 EOM
17434         rp="Press return or use a shell escape to edit config.sh:"
17435         . UU/myread
17436         nostick=''
17437         case "$ans" in
17438         '') ;;
17439         *) : in case they cannot read
17440                 sh 1>&4 -c "$ans";;
17441         esac
17442         ;;
17443 esac
17444
17445 : if this fails, just run all the .SH files by hand
17446 . ./config.sh
17447
17448 echo " "
17449 exec 1>&4
17450 pwd=`pwd`
17451 . ./UU/extract
17452 cd $pwd
17453
17454 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
17455         dflt=y
17456         case "$silent" in
17457         true) ;;
17458         *)
17459                 $cat <<EOM
17460
17461 Now you need to generate make dependencies by running "$make depend".
17462 You might prefer to run it in background: "$make depend > makedepend.out &"
17463 It can take a while, so you might not want to run it right now.
17464
17465 EOM
17466                 ;;
17467         esac
17468         rp="Run $make depend now?"
17469         . UU/myread
17470         case "$ans" in
17471         y*)
17472                 $make depend && echo "Now you must run '$make'."
17473                 ;;
17474         *)
17475                 echo "You must run '$make depend' then '$make'."
17476                 ;;
17477         esac
17478 elif test -f [Mm]akefile; then
17479         echo " "
17480         echo "Now you must run a $make."
17481 else
17482         echo "Configure done."
17483 fi
17484
17485 if $test -f Policy.sh; then
17486     $cat <<EOM
17487
17488 If you compile $package on a different machine or from a different object
17489 directory, copy the Policy.sh file from this object directory to the
17490 new one before you run Configure -- this will help you with most of
17491 the policy defaults.
17492
17493 EOM
17494 fi
17495 if $test -f config.msg; then
17496     echo "Hmm.  I also noted the following information while running:"
17497     echo " "
17498     $cat config.msg >&4
17499     $rm -f config.msg
17500 fi
17501 $rm -f kit*isdone ark*isdone
17502 $rm -rf UU
17503
17504 : End of Configure
17505