3e845c5f9652fd5be6b84e269673c6136b4deeff
[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 Fri Jan 12 22:28:01 EET 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 perllibs=''
169 dynamic_ext=''
170 extensions=''
171 known_extensions=''
172 nonxs_ext=''
173 static_ext=''
174 useopcode=''
175 useposix=''
176 d_bsd=''
177 d_eunice=''
178 d_xenix=''
179 eunicefix=''
180 Mcc=''
181 ar=''
182 awk=''
183 bash=''
184 bison=''
185 byacc=''
186 cat=''
187 chgrp=''
188 chmod=''
189 chown=''
190 comm=''
191 compress=''
192 cp=''
193 cpio=''
194 cpp=''
195 csh=''
196 date=''
197 echo=''
198 egrep=''
199 emacs=''
200 expr=''
201 find=''
202 flex=''
203 grep=''
204 gzip=''
205 inews=''
206 ksh=''
207 less=''
208 line=''
209 lint=''
210 ln=''
211 lp=''
212 lpr=''
213 ls=''
214 mail=''
215 mailx=''
216 make=''
217 mkdir=''
218 more=''
219 mv=''
220 nm=''
221 nroff=''
222 perl=''
223 pg=''
224 pmake=''
225 pr=''
226 rm=''
227 rmail=''
228 sed=''
229 sendmail=''
230 shar=''
231 sleep=''
232 smail=''
233 sort=''
234 submit=''
235 tail=''
236 tar=''
237 tbl=''
238 tee=''
239 test=''
240 touch=''
241 tr=''
242 troff=''
243 uname=''
244 uniq=''
245 uuname=''
246 vi=''
247 zcat=''
248 zip=''
249 full_ar=''
250 full_sed=''
251 libswanted=''
252 hint=''
253 myuname=''
254 osname=''
255 osvers=''
256 Author=''
257 Date=''
258 Header=''
259 Id=''
260 Locker=''
261 Log=''
262 RCSfile=''
263 Revision=''
264 Source=''
265 State=''
266 _a=''
267 _exe=''
268 _o=''
269 archobjs=''
270 exe_ext=''
271 firstmakefile=''
272 lib_ext=''
273 obj_ext=''
274 path_sep=''
275 afs=''
276 alignbytes=''
277 ansi2knr=''
278 archlib=''
279 archlibexp=''
280 d_archlib=''
281 installarchlib=''
282 archname=''
283 myarchname=''
284 d_atolf=''
285 d_atoll=''
286 baserev=''
287 bin=''
288 binexp=''
289 installbin=''
290 bincompat5005=''
291 d_bincompat5005=''
292 byteorder=''
293 cc=''
294 ccflags=''
295 cppflags=''
296 ldflags=''
297 lkflags=''
298 locincpth=''
299 optimize=''
300 cf_email=''
301 cf_by=''
302 cf_time=''
303 charsize=''
304 contains=''
305 cpp_stuff=''
306 cpplast=''
307 cppminus=''
308 cpprun=''
309 cppstdin=''
310 crosscompile=''
311 d__fwalk=''
312 d_access=''
313 d_accessx=''
314 d_alarm=''
315 d_attribut=''
316 d_bcmp=''
317 d_bcopy=''
318 d_bzero=''
319 d_casti32=''
320 castflags=''
321 d_castneg=''
322 d_chown=''
323 d_chroot=''
324 d_chsize=''
325 d_closedir=''
326 d_void_closedir=''
327 d_const=''
328 cryptlib=''
329 d_crypt=''
330 d_csh=''
331 full_csh=''
332 d_cuserid=''
333 d_dbl_dig=''
334 d_difftime=''
335 d_dlerror=''
336 d_dlopen=''
337 d_dlsymun=''
338 d_dosuid=''
339 d_suidsafe=''
340 d_drand48proto=''
341 d_dup2=''
342 d_eaccess=''
343 d_endgrent=''
344 d_endhent=''
345 d_endnent=''
346 d_endpent=''
347 d_endpwent=''
348 d_endsent=''
349 d_fchmod=''
350 d_fchown=''
351 d_fcntl=''
352 d_fcntl_can_lock=''
353 d_fd_macros=''
354 d_fd_set=''
355 d_fds_bits=''
356 d_fgetpos=''
357 d_flexfnam=''
358 d_flock=''
359 d_fork=''
360 d_fpos64_t=''
361 d_frexpl=''
362 d_fs_data_s=''
363 d_fseeko=''
364 d_fsetpos=''
365 d_fstatfs=''
366 d_fsync=''
367 d_ftello=''
368 d_ftime=''
369 d_gettimeod=''
370 d_Gconvert=''
371 d_getcwd=''
372 d_getespwnam=''
373 d_getfsstat=''
374 d_getgrent=''
375 d_getgrps=''
376 d_gethbyaddr=''
377 d_gethbyname=''
378 d_gethent=''
379 aphostname=''
380 d_gethname=''
381 d_phostname=''
382 d_uname=''
383 d_gethostprotos=''
384 d_getlogin=''
385 d_getmnt=''
386 d_getmntent=''
387 d_getnbyaddr=''
388 d_getnbyname=''
389 d_getnent=''
390 d_getnetprotos=''
391 d_getpagsz=''
392 d_getpent=''
393 d_getpgid=''
394 d_getpgrp2=''
395 d_bsdgetpgrp=''
396 d_getpgrp=''
397 d_getppid=''
398 d_getprior=''
399 d_getpbyname=''
400 d_getpbynumber=''
401 d_getprotoprotos=''
402 d_getprpwnam=''
403 d_getpwent=''
404 d_getsent=''
405 d_getservprotos=''
406 d_getspnam=''
407 d_getsbyname=''
408 d_getsbyport=''
409 d_gnulibc=''
410 d_hasmntopt=''
411 d_htonl=''
412 d_iconv=''
413 d_inetaton=''
414 d_int64_t=''
415 d_isascii=''
416 d_isnan=''
417 d_isnanl=''
418 d_killpg=''
419 d_lchown=''
420 d_ldbl_dig=''
421 d_link=''
422 d_locconv=''
423 d_lockf=''
424 d_longdbl=''
425 longdblsize=''
426 d_longlong=''
427 longlongsize=''
428 d_lseekproto=''
429 d_lstat=''
430 d_madvise=''
431 d_mblen=''
432 d_mbstowcs=''
433 d_mbtowc=''
434 d_memchr=''
435 d_memcmp=''
436 d_memcpy=''
437 d_memmove=''
438 d_memset=''
439 d_mkdir=''
440 d_mkdtemp=''
441 d_mkfifo=''
442 d_mkstemp=''
443 d_mkstemps=''
444 d_mktime=''
445 d_mmap=''
446 mmaptype=''
447 d_modfl=''
448 d_mprotect=''
449 d_msg=''
450 d_msgctl=''
451 d_msgget=''
452 d_msgrcv=''
453 d_msgsnd=''
454 d_msync=''
455 d_munmap=''
456 d_nice=''
457 d_off64_t=''
458 d_open3=''
459 d_fpathconf=''
460 d_pathconf=''
461 d_pause=''
462 d_pipe=''
463 d_poll=''
464 d_portable=''
465 d_old_pthread_create_joinable=''
466 old_pthread_create_joinable=''
467 d_pthread_yield=''
468 d_sched_yield=''
469 sched_yield=''
470 d_qgcvt=''
471 d_readdir=''
472 d_rewinddir=''
473 d_seekdir=''
474 d_telldir=''
475 d_readlink=''
476 d_rename=''
477 d_rmdir=''
478 d_safebcpy=''
479 d_safemcpy=''
480 d_sanemcmp=''
481 d_sbrkproto=''
482 d_select=''
483 d_sem=''
484 d_semctl=''
485 d_semget=''
486 d_semop=''
487 d_setegid=''
488 d_seteuid=''
489 d_setgrent=''
490 d_setgrps=''
491 d_sethent=''
492 d_setlinebuf=''
493 d_setlocale=''
494 d_setnent=''
495 d_setpent=''
496 d_setpgid=''
497 d_setpgrp2=''
498 d_bsdsetpgrp=''
499 d_setpgrp=''
500 d_setprior=''
501 d_setproctitle=''
502 d_setpwent=''
503 d_setregid=''
504 d_setresgid=''
505 d_setresuid=''
506 d_setreuid=''
507 d_setrgid=''
508 d_setruid=''
509 d_setsent=''
510 d_setsid=''
511 d_setvbuf=''
512 d_sfio=''
513 usesfio=''
514 d_shm=''
515 d_shmat=''
516 d_shmatprototype=''
517 shmattype=''
518 d_shmctl=''
519 d_shmdt=''
520 d_shmget=''
521 d_sigaction=''
522 d_sigprocmask=''
523 d_sigsetjmp=''
524 d_msg_ctrunc=''
525 d_msg_dontroute=''
526 d_msg_oob=''
527 d_msg_peek=''
528 d_msg_proxy=''
529 d_oldsock=''
530 d_scm_rights=''
531 d_socket=''
532 d_sockpair=''
533 sockethdr=''
534 socketlib=''
535 d_socklen_t=''
536 d_socks5_init=''
537 d_sqrtl=''
538 d_statblks=''
539 d_statfs_f_flags=''
540 d_statfs_s=''
541 d_fstatvfs=''
542 d_statvfs=''
543 d_stdio_cnt_lval=''
544 d_stdio_ptr_lval=''
545 d_stdio_ptr_lval_nochange_cnt=''
546 d_stdio_ptr_lval_sets_cnt=''
547 d_stdiobase=''
548 d_stdstdio=''
549 stdio_base=''
550 stdio_bufsiz=''
551 stdio_cnt=''
552 stdio_filbuf=''
553 stdio_ptr=''
554 d_index=''
555 d_strchr=''
556 d_strcoll=''
557 d_strctcpy=''
558 d_strerrm=''
559 d_strerror=''
560 d_sysernlst=''
561 d_syserrlst=''
562 d_strtod=''
563 d_strtol=''
564 d_strtold=''
565 d_strtoll=''
566 d_strtoq=''
567 d_strtoul=''
568 d_strtoull=''
569 d_strtouq=''
570 d_strxfrm=''
571 d_symlink=''
572 d_syscall=''
573 d_sysconf=''
574 d_system=''
575 d_tcgetpgrp=''
576 d_tcsetpgrp=''
577 d_telldirproto=''
578 d_time=''
579 timetype=''
580 clocktype=''
581 d_times=''
582 d_truncate=''
583 d_tzname=''
584 d_umask=''
585 d_semctl_semid_ds=''
586 d_semctl_semun=''
587 d_union_semun=''
588 d_ustat=''
589 d_vfork=''
590 usevfork=''
591 d_voidsig=''
592 signal_t=''
593 d_volatile=''
594 d_charvspr=''
595 d_vprintf=''
596 d_wait4=''
597 d_waitpid=''
598 d_wcstombs=''
599 d_wctomb=''
600 dlext=''
601 cccdlflags=''
602 ccdlflags=''
603 dlsrc=''
604 ld=''
605 lddlflags=''
606 usedl=''
607 doublesize=''
608 ebcdic=''
609 fflushNULL=''
610 fflushall=''
611 fpossize=''
612 fpostype=''
613 gccosandvers=''
614 gccversion=''
615 gidformat=''
616 gidsign=''
617 gidsize=''
618 gidtype=''
619 groupstype=''
620 h_fcntl=''
621 h_sysfile=''
622 i_arpainet=''
623 db_hashtype=''
624 db_prefixtype=''
625 i_db=''
626 i_dbm=''
627 i_rpcsvcdbm=''
628 d_dirnamlen=''
629 direntrytype=''
630 i_dirent=''
631 i_dld=''
632 i_dlfcn=''
633 i_fcntl=''
634 i_float=''
635 i_gdbm=''
636 d_grpasswd=''
637 i_grp=''
638 i_iconv=''
639 i_ieeefp=''
640 i_inttypes=''
641 i_libutil=''
642 i_limits=''
643 i_locale=''
644 i_machcthr=''
645 i_malloc=''
646 i_math=''
647 i_memory=''
648 i_mntent=''
649 i_ndbm=''
650 i_netdb=''
651 i_neterrno=''
652 i_netinettcp=''
653 i_niin=''
654 i_sysin=''
655 i_poll=''
656 i_prot=''
657 i_pthread=''
658 d_pwage=''
659 d_pwchange=''
660 d_pwclass=''
661 d_pwcomment=''
662 d_pwexpire=''
663 d_pwgecos=''
664 d_pwpasswd=''
665 d_pwquota=''
666 i_pwd=''
667 i_sfio=''
668 i_shadow=''
669 i_socks=''
670 i_stddef=''
671 i_stdlib=''
672 i_string=''
673 strings=''
674 i_sunmath=''
675 i_sysaccess=''
676 i_sysdir=''
677 i_sysfile=''
678 d_voidtty=''
679 i_bsdioctl=''
680 i_sysfilio=''
681 i_sysioctl=''
682 i_syssockio=''
683 i_syslog=''
684 i_sysmman=''
685 i_sysmode=''
686 i_sysmount=''
687 i_sysndir=''
688 i_sysparam=''
689 i_sysresrc=''
690 i_syssecrt=''
691 i_sysselct=''
692 i_sysstat=''
693 i_sysstatfs=''
694 i_sysstatvfs=''
695 i_systimes=''
696 i_systypes=''
697 i_sysuio=''
698 i_sysun=''
699 i_sysutsname=''
700 i_sysvfs=''
701 i_syswait=''
702 i_sgtty=''
703 i_termio=''
704 i_termios=''
705 i_systime=''
706 i_systimek=''
707 i_time=''
708 timeincl=''
709 i_unistd=''
710 i_ustat=''
711 i_utime=''
712 i_values=''
713 i_stdarg=''
714 i_varargs=''
715 i_varhdr=''
716 i_vfork=''
717 inc_version_list=''
718 inc_version_list_init=''
719 installprefix=''
720 installprefixexp=''
721 installstyle=''
722 installusrbinperl=''
723 intsize=''
724 longsize=''
725 shortsize=''
726 issymlink=''
727 libc=''
728 ldlibpthname=''
729 libperl=''
730 shrpenv=''
731 useshrplib=''
732 glibpth=''
733 libpth=''
734 loclibpth=''
735 plibpth=''
736 xlibpth=''
737 ignore_versioned_solibs=''
738 libs=''
739 libsdirs=''
740 libsfiles=''
741 libsfound=''
742 libspath=''
743 lns=''
744 d_PRIEUldbl=''
745 d_PRIFUldbl=''
746 d_PRIGUldbl=''
747 d_PRIeldbl=''
748 d_PRIfldbl=''
749 d_PRIgldbl=''
750 d_SCNfldbl=''
751 sPRIEUldbl=''
752 sPRIFUldbl=''
753 sPRIGUldbl=''
754 sPRIeldbl=''
755 sPRIfldbl=''
756 sPRIgldbl=''
757 sSCNfldbl=''
758 lseeksize=''
759 lseektype=''
760 make_set_make=''
761 d_mymalloc=''
762 freetype=''
763 mallocobj=''
764 mallocsrc=''
765 malloctype=''
766 usemymalloc=''
767 installman1dir=''
768 man1dir=''
769 man1direxp=''
770 man1ext=''
771 installman3dir=''
772 man3dir=''
773 man3direxp=''
774 man3ext=''
775 modetype=''
776 multiarch=''
777 mydomain=''
778 myhostname=''
779 phostname=''
780 c=''
781 n=''
782 d_eofnblk=''
783 eagain=''
784 o_nonblock=''
785 rd_nodata=''
786 need_va_copy=''
787 netdb_hlen_type=''
788 netdb_host_type=''
789 netdb_name_type=''
790 netdb_net_type=''
791 groupcat=''
792 hostcat=''
793 passcat=''
794 orderlib=''
795 ranlib=''
796 d_perl_otherlibdirs=''
797 otherlibdirs=''
798 package=''
799 spackage=''
800 pager=''
801 api_revision=''
802 api_subversion=''
803 api_version=''
804 api_versionstring=''
805 patchlevel=''
806 revision=''
807 subversion=''
808 version=''
809 perl5=''
810 perladmin=''
811 perlpath=''
812 d_nv_preserves_uv=''
813 d_nv_preserves_uv_bits=''
814 i16size=''
815 i16type=''
816 i32size=''
817 i32type=''
818 i64size=''
819 i64type=''
820 i8size=''
821 i8type=''
822 ivsize=''
823 ivtype=''
824 nvsize=''
825 nvtype=''
826 u16size=''
827 u16type=''
828 u32size=''
829 u32type=''
830 u64size=''
831 u64type=''
832 u8size=''
833 u8type=''
834 uvsize=''
835 uvtype=''
836 ivdformat=''
837 nvEUformat=''
838 nvFUformat=''
839 nvGUformat=''
840 nveformat=''
841 nvfformat=''
842 nvgformat=''
843 uvXUformat=''
844 uvoformat=''
845 uvuformat=''
846 uvxformat=''
847 pidtype=''
848 prefix=''
849 prefixexp=''
850 installprivlib=''
851 privlib=''
852 privlibexp=''
853 prototype=''
854 ptrsize=''
855 d_PRIXU64=''
856 d_PRId64=''
857 d_PRIi64=''
858 d_PRIo64=''
859 d_PRIu64=''
860 d_PRIx64=''
861 sPRIXU64=''
862 sPRId64=''
863 sPRIi64=''
864 sPRIo64=''
865 sPRIu64=''
866 sPRIx64=''
867 d_quad=''
868 quadkind=''
869 quadtype=''
870 uquadtype=''
871 drand01=''
872 randbits=''
873 randfunc=''
874 randseedtype=''
875 seedfunc=''
876 installscript=''
877 scriptdir=''
878 scriptdirexp=''
879 selectminbits=''
880 selecttype=''
881 sh=''
882 sig_count=''
883 sig_name=''
884 sig_name_init=''
885 sig_num=''
886 sig_num_init=''
887 installsitearch=''
888 sitearch=''
889 sitearchexp=''
890 installsitebin=''
891 sitebin=''
892 sitebinexp=''
893 installsitelib=''
894 sitelib=''
895 sitelib_stem=''
896 sitelibexp=''
897 siteprefix=''
898 siteprefixexp=''
899 sizesize=''
900 sizetype=''
901 so=''
902 socksizetype=''
903 sharpbang=''
904 shsharp=''
905 spitshell=''
906 src=''
907 ssizetype=''
908 startperl=''
909 startsh=''
910 stdchar=''
911 d_stdio_stream_array=''
912 stdio_stream_array=''
913 sysman=''
914 trnl=''
915 uidformat=''
916 uidsign=''
917 uidsize=''
918 uidtype=''
919 archname64=''
920 use64bitall=''
921 use64bitint=''
922 ccflags_uselargefiles=''
923 ldflags_uselargefiles=''
924 libswanted_uselargefiles=''
925 uselargefiles=''
926 uselongdouble=''
927 usemorebits=''
928 usemultiplicity=''
929 nm_opt=''
930 nm_so_opt=''
931 runnm=''
932 usenm=''
933 useperlio=''
934 usesocks=''
935 d_oldpthreads=''
936 use5005threads=''
937 useithreads=''
938 usethreads=''
939 incpath=''
940 mips_type=''
941 usrinc=''
942 d_vendorarch=''
943 installvendorarch=''
944 vendorarch=''
945 vendorarchexp=''
946 d_vendorbin=''
947 installvendorbin=''
948 vendorbin=''
949 vendorbinexp=''
950 d_vendorlib=''
951 installvendorlib=''
952 vendorlib=''
953 vendorlib_stem=''
954 vendorlibexp=''
955 usevendorprefix=''
956 vendorprefix=''
957 vendorprefixexp=''
958 versiononly=''
959 defvoidused=''
960 voidflags=''
961 pm_apiversion=''
962 xs_apiversion=''
963 CONFIG=''
964
965 define='define'
966 undef='undef'
967 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
968 rmlist=''
969
970 : We must find out about Eunice early
971 eunicefix=':'
972 if test -f /etc/unixtovms; then
973         eunicefix=/etc/unixtovms
974 fi
975 if test -f /etc/unixtovms.exe; then
976         eunicefix=/etc/unixtovms.exe
977 fi
978
979 i_whoami=''
980 ccname=''
981 ccversion=''
982 perllibs=''
983 : set useposix=false in your hint file to disable the POSIX extension.
984 useposix=true
985 : set useopcode=false in your hint file to disable the Opcode extension.
986 useopcode=true
987 : Trailing extension.  Override this in a hint file, if needed.
988 _exe=''
989 : Extra object files, if any, needed on this platform.
990 archobjs=''
991 archname=''
992 : Possible local include directories to search.
993 : Set locincpth to "" in a hint file to defeat local include searches.
994 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
995 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
996 :
997 : no include file wanted by default
998 inclwanted=''
999
1000 groupstype=''
1001 : change the next line if compiling for Xenix/286 on Xenix/386
1002 xlibpth='/usr/lib/386 /lib/386'
1003 : Possible local library directories to search.
1004 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1005 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1006
1007 : general looking path for locating libraries
1008 glibpth="/lib /usr/lib $xlibpth"
1009 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1010 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1011 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1012
1013 : Private path used by Configure to find libraries.  Its value
1014 : is prepended to libpth. This variable takes care of special
1015 : machines, like the mips.  Usually, it should be empty.
1016 plibpth=''
1017
1018 : default library list
1019 libswanted=''
1020 : some systems want to use only the non-versioned libso:s
1021 ignore_versioned_solibs=''
1022 archname64=''
1023 ccflags_uselargefiles=''
1024 ldflags_uselargefiles=''
1025 libswanted_uselargefiles=''
1026 : set usemultiplicity on the Configure command line to enable multiplicity.
1027 : set usesocks on the Configure command line to enable socks.
1028 : set usethreads on the Configure command line to enable threads.
1029 : full support for void wanted by default
1030 defvoidused=15
1031
1032 : List of libraries we want.
1033 : If anyone needs -lnet, put it in a hint file.
1034 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1035 libswanted="$libswanted dld ld sun m c cposix posix"
1036 libswanted="$libswanted ndir dir crypt sec"
1037 libswanted="$libswanted ucb bsd BSD PW x iconv util"
1038 : We probably want to search /usr/shlib before most other libraries.
1039 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1040 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1041 glibpth="/usr/shlib $glibpth"
1042 : Do not use vfork unless overridden by a hint file.
1043 usevfork=false
1044
1045 : Find the basic shell for Bourne shell scripts
1046 case "$sh" in
1047 '')
1048         case "$SYSTYPE" in
1049         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1050         *) xxx='/bin/sh';;
1051         esac
1052         if test -f "$xxx"; then
1053                 sh="$xxx"
1054         else
1055                 : Build up a list and do a single loop so we can 'break' out.
1056                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1057                 for xxx in sh bash ksh pdksh ash; do
1058                         for p in $pth; do
1059                                 try="$try ${p}/${xxx}"
1060                         done
1061                 done
1062                 for xxx in $try; do
1063                         if test -f "$xxx"; then
1064                                 sh="$xxx";
1065                                 break
1066                         elif test -f "$xxx.exe"; then
1067                                 sh="$xxx";
1068                                 break
1069                         fi
1070                 done
1071         fi
1072         ;;
1073 esac
1074
1075 case "$sh" in
1076 '')     cat <<EOM >&2
1077 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1078
1079 Usually it's in /bin/sh.  How did you even get this far?
1080 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1081 we'll try to straighten this all out.
1082 EOM
1083         exit 1
1084         ;;
1085 esac
1086
1087 : see if sh knows # comments
1088 if `$sh -c '#' >/dev/null 2>&1`; then
1089         shsharp=true
1090         spitshell=cat
1091         xcat=/bin/cat
1092         test -f $xcat || xcat=/usr/bin/cat
1093         echo "#!$xcat" >try
1094         $eunicefix try
1095         chmod +x try
1096         ./try > today
1097         if test -s today; then
1098                 sharpbang='#!'
1099         else
1100                 echo "#! $xcat" > try
1101                 $eunicefix try
1102                 chmod +x try
1103                 ./try > today
1104                 if test -s today; then
1105                         sharpbang='#! '
1106                 else
1107                         sharpbang=': use '
1108                 fi
1109         fi
1110 else
1111         echo " "
1112         echo "Your $sh doesn't grok # comments--I will strip them later on."
1113         shsharp=false
1114         cd ..
1115         echo "exec grep -v '^[  ]*#'" >spitshell
1116         chmod +x spitshell
1117         $eunicefix spitshell
1118         spitshell=`pwd`/spitshell
1119         cd UU
1120         echo "I presume that if # doesn't work, #! won't work either!"
1121         sharpbang=': use '
1122 fi
1123 rm -f try today
1124
1125 : figure out how to guarantee sh startup
1126 case "$startsh" in
1127 '') startsh=${sharpbang}${sh} ;;
1128 *)
1129 esac
1130 cat >try <<EOSS
1131 $startsh
1132 set abc
1133 test "$?abc" != 1
1134 EOSS
1135
1136 chmod +x try
1137 $eunicefix try
1138 if ./try; then
1139         : echo "Yup, it does."
1140 else
1141         echo "Hmm... '$startsh' does not guarantee sh startup..."
1142         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1143 fi
1144 rm -f try
1145
1146
1147 : Save command line options in file UU/cmdline.opt for later use in
1148 : generating config.sh.
1149 cat > cmdline.opt <<EOSH
1150 # Configure command line arguments.
1151 config_arg0='$0'
1152 config_args='$*'
1153 config_argc=$#
1154 EOSH
1155 argn=1
1156 for arg in "$@"; do
1157         cat >>cmdline.opt <<EOSH
1158 config_arg$argn='$arg'
1159 EOSH
1160         argn=`expr $argn + 1`
1161 done
1162
1163 : produce awk script to parse command line options
1164 cat >options.awk <<'EOF'
1165 BEGIN {
1166         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1167
1168         len = length(optstr);
1169         for (i = 1; i <= len; i++) {
1170                 c = substr(optstr, i, 1);
1171                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1172                 if (a == ":") {
1173                         arg[c] = 1;
1174                         i++;
1175                 }
1176                 opt[c] = 1;
1177         }
1178 }
1179 {
1180         expect = 0;
1181         str = $0;
1182         if (substr(str, 1, 1) != "-") {
1183                 printf("'%s'\n", str);
1184                 next;
1185         }
1186         len = length($0);
1187         for (i = 2; i <= len; i++) {
1188                 c = substr(str, i, 1);
1189                 if (!opt[c]) {
1190                         printf("-%s\n", substr(str, i));
1191                         next;
1192                 }
1193                 printf("-%s\n", c);
1194                 if (arg[c]) {
1195                         if (i < len)
1196                                 printf("'%s'\n", substr(str, i + 1));
1197                         else
1198                                 expect = 1;
1199                         next;
1200                 }
1201         }
1202 }
1203 END {
1204         if (expect)
1205                 print "?";
1206 }
1207 EOF
1208
1209 : process the command line options
1210 set X `for arg in "$@"; do echo "X$arg"; done |
1211         sed -e s/X// | awk -f options.awk`
1212 eval "set $*"
1213 shift
1214 rm -f options.awk
1215
1216 : set up default values
1217 fastread=''
1218 reuseval=false
1219 config_sh=''
1220 alldone=''
1221 error=''
1222 silent=''
1223 extractsh=''
1224 override=''
1225 knowitall=''
1226 rm -f optdef.sh posthint.sh
1227 cat >optdef.sh <<EOS
1228 $startsh
1229 EOS
1230
1231
1232 : option parsing
1233 while test $# -gt 0; do
1234         case "$1" in
1235         -d) shift; fastread=yes;;
1236         -e) shift; alldone=cont;;
1237         -f)
1238                 shift
1239                 cd ..
1240                 if test -r "$1"; then
1241                         config_sh="$1"
1242                 else
1243                         echo "$me: cannot read config file $1." >&2
1244                         error=true
1245                 fi
1246                 cd UU
1247                 shift;;
1248         -h) shift; error=true;;
1249         -r) shift; reuseval=true;;
1250         -s) shift; silent=true; realsilent=true;;
1251         -E) shift; alldone=exit;;
1252         -K) shift; knowitall=true;;
1253         -O) shift; override=true;;
1254         -S) shift; silent=true; extractsh=true;;
1255         -D)
1256                 shift
1257                 case "$1" in
1258                 *=)
1259                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1260                         echo "$me: ignoring -D $1" >&2
1261                         ;;
1262                 *=*) echo "$1" | \
1263                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1264                 *) echo "$1='define'" >> optdef.sh;;
1265                 esac
1266                 shift
1267                 ;;
1268         -U)
1269                 shift
1270                 case "$1" in
1271                 *=) echo "$1" >> optdef.sh;;
1272                 *=*)
1273                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1274                         echo "$me: ignoring -U $1" >&2
1275                         ;;
1276                 *) echo "$1='undef'" >> optdef.sh;;
1277                 esac
1278                 shift
1279                 ;;
1280         -A)
1281             shift
1282             xxx=''
1283             yyy="$1"
1284             zzz=''
1285             uuu=undef
1286             case "$yyy" in
1287             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1288                  case "$zzz" in
1289                  *:*) zzz='' ;;
1290                  *)   xxx=append
1291                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1292                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1293                  esac
1294                  ;;
1295             esac
1296             case "$xxx" in
1297             '')  case "$yyy" in
1298                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1299                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1300                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1301                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1302                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1303                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1304                  esac
1305                  ;;       
1306             esac
1307             case "$xxx" in
1308             append)
1309                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1310             clear)
1311                 echo "$yyy=''"                  >> posthint.sh ;;
1312             define)
1313                 case "$zzz" in
1314                 '') zzz=define ;;
1315                 esac
1316                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1317             eval)
1318                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1319             prepend)
1320                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1321             undef)
1322                 case "$zzz" in
1323                 '') zzz="$uuu" ;;
1324                 esac
1325                 echo "$yyy=$zzz"                >> posthint.sh ;;
1326             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1327             esac
1328             shift
1329             ;;
1330         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1331             exit 0;;
1332         --) break;;
1333         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1334         *) break;;
1335         esac
1336 done
1337
1338 case "$error" in
1339 true)
1340         cat >&2 <<EOM
1341 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1342                  [-U symbol] [-U symbol=] [-A command:symbol...]
1343   -d : use defaults for all answers.
1344   -e : go on without questioning past the production of config.sh.
1345   -f : specify an alternate default configuration file.
1346   -h : print this help message and exit (with an error status).
1347   -r : reuse C symbols value if possible (skips costly nm extraction).
1348   -s : silent mode, only echoes questions and essential information.
1349   -D : define symbol to have some value:
1350          -D symbol         symbol gets the value 'define'
1351          -D symbol=value   symbol gets the value 'value'
1352   -E : stop at the end of questions, after having produced config.sh.
1353   -K : do not use unless you know what you are doing.
1354   -O : let -D and -U override definitions from loaded configuration file.
1355   -S : perform variable substitutions on all .SH files (can mix with -f)
1356   -U : undefine symbol:
1357          -U symbol    symbol gets the value 'undef'
1358          -U symbol=   symbol gets completely empty
1359   -A : manipulate symbol after the platform specific hints have been applied:
1360          -A symbol=value                append " "value to symbol
1361          -A append:symbol=value         append value to symbol
1362          -A define:symbol=value         define symbol to have value
1363          -A clear:symbol                define symbol to be ''
1364          -A define:symbol               define symbol to be 'define'
1365          -A eval:symbol=value           define symbol to be eval of value
1366          -A prepend:symbol=value        prepend value to symbol
1367          -A undef:symbol                define symbol to be 'undef'
1368          -A undef:symbol=               define symbol to be ''
1369   -V : print version number and exit (with a zero status).
1370 EOM
1371         exit 1
1372         ;;
1373 esac
1374
1375 : Sanity checks
1376 case "$fastread$alldone" in
1377 yescont|yesexit) ;;
1378 *)
1379         case "$extractsh" in
1380         true) ;;
1381         *)
1382                 if test ! -t 0; then
1383                         echo "Say 'sh Configure', not 'sh <Configure'"
1384                         exit 1
1385                 fi
1386                 ;;
1387         esac
1388         ;;
1389 esac
1390
1391 exec 4>&1
1392 case "$silent" in
1393 true) exec 1>/dev/null;;
1394 esac
1395
1396 : run the defines and the undefines, if any, but leave the file out there...
1397 touch optdef.sh
1398 . ./optdef.sh
1399 : create the posthint manipulation script and leave the file out there...
1400 touch posthint.sh
1401
1402 : set package name
1403 package=perl5
1404 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1405 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1406 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1407 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1408 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1409 esac
1410
1411 : Some greps do not return status, grrr.
1412 echo "grimblepritz" >grimble
1413 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1414         contains=contains
1415 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1416         contains=grep
1417 else
1418         contains=contains
1419 fi
1420 rm -f grimble
1421 : the following should work in any shell
1422 case "$contains" in
1423 contains*)
1424         echo " "
1425         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1426         cat >contains <<'EOSS'
1427 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1428 EOSS
1429 chmod +x contains
1430 esac
1431
1432 : Find the path to the source tree
1433 case "$src" in
1434 '') case "$0" in
1435     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1436          case "$src" in
1437          /*)    ;;
1438          .)     ;;
1439          *)     src=`cd ../$src && pwd` ;;
1440          esac
1441          ;;
1442     *)   src='.';;
1443     esac;;
1444 esac
1445 case "$src" in
1446 '')     src=/
1447         rsrc=/
1448         ;;
1449 /*) rsrc="$src";;
1450 *) rsrc="../$src";;
1451 esac
1452 if test -f $rsrc/Configure && \
1453         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1454 then
1455    : found it, so we are ok.
1456 else
1457         rsrc=''
1458         for src in . .. ../.. ../../.. ../../../..; do
1459                 if test -f ../$src/Configure && \
1460                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1461                 then
1462                         rsrc=../$src
1463                         break
1464                 fi
1465         done
1466 fi
1467 case "$rsrc" in
1468 '')
1469         cat <<EOM >&4
1470
1471 Sorry, I can't seem to locate the source dir for $package.  Please start
1472 Configure with an explicit path -- i.e. /some/path/Configure.
1473
1474 EOM
1475         exit 1
1476         ;;
1477 ../.)   rsrc='..';;
1478 *)
1479         echo " "
1480         echo "Sources for $package found in \"$src\"." >&4
1481         ;;
1482 esac
1483
1484 : script used to extract .SH files with variable substitutions
1485 cat >extract <<'EOS'
1486 CONFIGDOTSH=true
1487 echo "Doing variable substitutions on .SH files..."
1488 if test -f $src/MANIFEST; then
1489         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1490 else
1491         echo "(Looking for .SH files under the source directory.)"
1492         set x `(cd $src; find . -name "*.SH" -print)`
1493 fi
1494 shift
1495 case $# in
1496 0) set x `(cd $src; echo *.SH)`; shift;;
1497 esac
1498 if test ! -f $src/$1; then
1499         shift
1500 fi
1501 mkdir_p='
1502 name=$1;
1503 create="";
1504 while test $name; do
1505         if test ! -d "$name"; then
1506                 create="$name $create";
1507                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1508                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1509         else
1510                 name="";
1511         fi;
1512 done;
1513 for file in $create; do
1514         mkdir $file;
1515 done
1516 '
1517 for file in $*; do
1518         case "$src" in
1519         ".")
1520                 case "$file" in
1521                 */*)
1522                         dir=`expr X$file : 'X\(.*\)/'`
1523                         file=`expr X$file : 'X.*/\(.*\)'`
1524                         (cd $dir && . ./$file)
1525                         ;;
1526                 *)
1527                         . ./$file
1528                         ;;
1529                 esac
1530                 ;;
1531         *)
1532                 case "$file" in
1533                 */*)
1534                         dir=`expr X$file : 'X\(.*\)/'`
1535                         file=`expr X$file : 'X.*/\(.*\)'`
1536                         (set x $dir; shift; eval $mkdir_p)
1537                         sh <$src/$dir/$file
1538                         ;;
1539                 *)
1540                         sh <$src/$file
1541                         ;;
1542                 esac
1543                 ;;
1544         esac
1545 done
1546 if test -f $src/config_h.SH; then
1547         if test ! -f config.h; then
1548         : oops, they left it out of MANIFEST, probably, so do it anyway.
1549         . $src/config_h.SH
1550         fi
1551 fi
1552 EOS
1553
1554 : extract files and exit if asked to do so
1555 case "$extractsh" in
1556 true)
1557         case "$realsilent" in
1558         true) ;;
1559         *) exec 1>&4;;
1560         esac
1561         case "$config_sh" in
1562         '') config_sh='config.sh';;
1563         esac
1564         echo " "
1565         echo "Fetching answers from $config_sh..."
1566         cd ..
1567         . $config_sh
1568         test "$override" && . ./optdef.sh
1569         echo " "
1570         . UU/extract
1571         rm -rf UU
1572         echo "Done."
1573         exit 0
1574         ;;
1575 esac
1576
1577 : Eunice requires " " instead of "", can you believe it
1578 echo " "
1579 : Here we go...
1580 echo "Beginning of configuration questions for $package."
1581
1582 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1583
1584 : first determine how to suppress newline on echo command
1585 echo " "
1586 echo "Checking echo to see how to suppress newlines..."
1587 (echo "hi there\c" ; echo " ") >.echotmp
1588 if $contains c .echotmp >/dev/null 2>&1 ; then
1589         echo "...using -n."
1590         n='-n'
1591         c=''
1592 else
1593         cat <<'EOM'
1594 ...using \c
1595 EOM
1596         n=''
1597         c='\c'
1598 fi
1599 echo $n "The star should be here-->$c"
1600 echo '*'
1601 rm -f .echotmp
1602
1603 : Now test for existence of everything in MANIFEST
1604 echo " "
1605 if test -f $rsrc/MANIFEST; then
1606         echo "First let's make sure your kit is complete.  Checking..." >&4
1607         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1608         rm -f missing
1609         tmppwd=`pwd`
1610         for filelist in x??; do
1611                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1612         done
1613         if test -s missing; then
1614                 cat missing >&4
1615                 cat >&4 <<'EOM'
1616
1617 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1618
1619 You have the option of continuing the configuration process, despite the
1620 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1621 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1622 and contact the author (perlbug@perl.org).
1623
1624 EOM
1625                 echo $n "Continue? [n] $c" >&4
1626                 read ans
1627                 case "$ans" in
1628                 y*)
1629                         echo "Continuing..." >&4
1630                         rm -f missing
1631                         ;;
1632                 *)
1633                         echo "ABORTING..." >&4
1634                         kill $$
1635                         ;;
1636                 esac
1637         else
1638                 echo "Looks good..."
1639         fi
1640 else
1641         echo "There is no MANIFEST file.  I hope your kit is complete !"
1642 fi
1643 rm -f missing x??
1644
1645 echo " "
1646 : Find the appropriate value for a newline for tr
1647 if test -n "$DJGPP"; then
1648        trnl='\012'
1649 fi
1650 if test X"$trnl" = X; then
1651         case "`echo foo|tr '\n' x 2>/dev/null`" in
1652         foox) trnl='\n' ;;
1653         esac
1654 fi
1655 if test X"$trnl" = X; then
1656         case "`echo foo|tr '\012' x 2>/dev/null`" in
1657         foox) trnl='\012' ;;
1658         esac
1659 fi
1660 if test X"$trnl" = X; then
1661         cat <<EOM >&2
1662
1663 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1664
1665 EOM
1666         exit 1
1667 fi
1668
1669 : compute the number of columns on the terminal for proper question formatting
1670 case "$COLUMNS" in
1671 '') COLUMNS='80';;
1672 esac
1673
1674 : set up the echo used in my read
1675 myecho="case \"\$xxxm\" in
1676 '') echo $n \"\$rp $c\" >&4;;
1677 *) case \"\$rp\" in
1678         '') echo $n \"[\$xxxm] $c\";;
1679         *)
1680                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1681                         echo \"\$rp\" >&4
1682                         echo $n \"[\$xxxm] $c\" >&4
1683                 else
1684                         echo $n \"\$rp [\$xxxm] $c\" >&4
1685                 fi
1686                 ;;
1687         esac;;
1688 esac"
1689
1690 : now set up to do reads with possible shell escape and default assignment
1691 cat <<EOSC >myread
1692 $startsh
1693 xxxm=\$dflt
1694 $myecho
1695 ans='!'
1696 case "\$fastread" in
1697 yes) case "\$dflt" in
1698         '') ;;
1699         *) ans='';
1700                 case "\$silent-\$rp" in
1701                 true-) ;;
1702                 *) echo " " >&4;;
1703                 esac;;
1704         esac;;
1705 *) case "\$silent" in
1706         true) case "\$rp" in
1707                 '') ans='';;
1708                 esac;;
1709         esac;;
1710 esac
1711 while expr "X\$ans" : "X!" >/dev/null; do
1712         read answ
1713         set x \$xxxm
1714         shift
1715         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1716         case  "\$answ" in
1717         "!")
1718                 sh 1>&4
1719                 echo " "
1720                 $myecho
1721                 ;;
1722         !*)
1723                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1724                 shift
1725                 sh 1>&4 -c "\$*"
1726                 echo " "
1727                 $myecho
1728                 ;;
1729         "\$ans")
1730                 case "\$ans" in
1731                 \\&*)
1732                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1733                         shift
1734                         case "\$1" in
1735                         -d)
1736                                 fastread=yes
1737                                 echo "(OK, I'll run with -d after this question.)" >&4
1738                                 ;;
1739                         -*)
1740                                 echo "*** Sorry, \$1 not supported yet." >&4
1741                                 ;;
1742                         esac
1743                         $myecho
1744                         ans=!
1745                         ;;
1746                 esac;;
1747         *)
1748                 case "\$aok" in
1749                 y)
1750                         echo "*** Substitution done -- please confirm."
1751                         xxxm="\$ans"
1752                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1753                         xxxm="\$ans"
1754                         ans=!
1755                         ;;
1756                 *)
1757                         echo "*** Error -- try again."
1758                         ans=!
1759                         ;;
1760                 esac
1761                 $myecho
1762                 ;;
1763         esac
1764         case "\$ans\$xxxm\$nostick" in
1765         '')
1766                 ans=!
1767                 $myecho
1768                 ;;
1769         esac
1770 done
1771 case "\$ans" in
1772 '') ans="\$xxxm";;
1773 esac
1774 EOSC
1775
1776 : create .config dir to save info across Configure sessions
1777 test -d ../.config || mkdir ../.config
1778 cat >../.config/README <<EOF
1779 This directory created by Configure to save information that should
1780 persist across sessions for $package.
1781
1782 You may safely delete it if you wish.
1783 EOF
1784
1785 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1786 case "$usedevel" in
1787 $define|true|[yY]*) ;;
1788 *) case "$xversion" in
1789    *[13579])
1790         cat >&4 <<EOH
1791 *** WHOA THERE!!! ***
1792
1793     This is an UNSTABLE DEVELOPMENT release.
1794     The version of this $package distribution is $xversion, that is, odd,
1795     (as opposed to even) and that signifies a development release.
1796     If you want a maintenance release, you want an even-numbered version.
1797
1798     Do ***NOT*** install this into production use.
1799     Data corruption and crashes are possible.
1800
1801     It is most seriously suggested that you do not continue any further
1802     unless you want to help in developing and debugging Perl.
1803
1804 EOH
1805         rp='Do you really want to continue?'
1806         dflt='n'
1807         . ./myread
1808         case "$ans" in
1809         [yY]) echo >&4 "Okay, continuing." ;;
1810         *) echo >&4 "Okay, bye."
1811            exit 1
1812            ;;
1813         esac
1814         ;;
1815     esac
1816     ;;
1817 esac
1818
1819 : general instructions
1820 needman=true
1821 firsttime=true
1822 user=`(logname) 2>/dev/null`
1823 case "$user" in
1824 '') user=`whoami 2>&1`;;
1825 esac
1826 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1827         firsttime=false
1828         echo " "
1829         rp='Would you like to see the instructions?'
1830         dflt=n
1831         . ./myread
1832         case "$ans" in
1833         [yY]*) ;;
1834         *) needman=false;;
1835         esac
1836 fi
1837 if $needman; then
1838         cat <<EOH
1839
1840 This installation shell script will examine your system and ask you questions
1841 to determine how the perl5 package should be installed. If you get
1842 stuck on a question, you may use a ! shell escape to start a subshell or
1843 execute a command.  Many of the questions will have default answers in square
1844 brackets; typing carriage return will give you the default.
1845
1846 On some of the questions which ask for file or directory names you are allowed
1847 to use the ~name construct to specify the login directory belonging to "name",
1848 even if you don't have a shell which knows about that.  Questions where this is
1849 allowed will be marked "(~name ok)".
1850
1851 EOH
1852         rp=''
1853         dflt='Type carriage return to continue'
1854         . ./myread
1855         cat <<'EOH'
1856
1857 The prompter used in this script allows you to use shell variables and
1858 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1859 in the default answer, as if the default line was a set of arguments given to a
1860 script shell.  This means you may also use $* to repeat the whole default line,
1861 so you do not have to re-type everything to add something to the default.
1862
1863 Everytime there is a substitution, you will have to confirm.  If there is an
1864 error (e.g. an unmatched backtick), the default answer will remain unchanged
1865 and you will be prompted again.
1866
1867 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1868 the questions and use the computed defaults (or the previous answers if there
1869 was already a config.sh file). Type 'Configure -h' for a list of options.
1870 You may also start interactively and then answer '& -d' at any prompt to turn
1871 on the non-interactive behaviour for the remainder of the execution.
1872
1873 EOH
1874         . ./myread
1875         cat <<EOH
1876
1877 Much effort has been expended to ensure that this shell script will run on any
1878 Unix system.  If despite that it blows up on yours, your best bet is to edit
1879 Configure and run it again.  If you can't run Configure for some reason,
1880 you'll have to generate a config.sh file by hand.  Whatever problems you
1881 have, let me (perlbug@perl.org) know how I blew it.
1882
1883 This installation script affects things in two ways:
1884
1885 1) it may do direct variable substitutions on some of the files included
1886    in this kit.
1887 2) it builds a config.h file for inclusion in C programs.  You may edit
1888    any of these files as the need arises after running this script.
1889
1890 If you make a mistake on a question, there is no easy way to back up to it
1891 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1892 files.  Configure will offer to let you do this before it runs the SH files.
1893
1894 EOH
1895         dflt='Type carriage return to continue'
1896         . ./myread
1897         case "$firsttime" in
1898         true) echo $user >>../.config/instruct;;
1899         esac
1900 fi
1901
1902 : find out where common programs are
1903 echo " "
1904 echo "Locating common programs..." >&4
1905 cat <<EOSC >loc
1906 $startsh
1907 case \$# in
1908 0) exit 1;;
1909 esac
1910 thing=\$1
1911 shift
1912 dflt=\$1
1913 shift
1914 for dir in \$*; do
1915         case "\$thing" in
1916         .)
1917         if test -d \$dir/\$thing; then
1918                 echo \$dir
1919                 exit 0
1920         fi
1921         ;;
1922         *)
1923         for thisthing in \$dir/\$thing; do
1924                 : just loop through to pick last item
1925         done
1926         if test -f \$thisthing; then
1927                 echo \$thisthing
1928                 exit 0
1929         elif test -f \$dir/\$thing.exe; then
1930                 if test -n "$DJGPP"; then
1931                         echo \$dir/\$thing.exe
1932                 else
1933                         : on Eunice apparently
1934                         echo \$dir/\$thing
1935                 fi
1936                 exit 0
1937         fi
1938         ;;
1939         esac
1940 done
1941 echo \$dflt
1942 exit 1
1943 EOSC
1944 chmod +x loc
1945 $eunicefix loc
1946 loclist="
1947 awk
1948 cat
1949 comm
1950 cp
1951 echo
1952 expr
1953 grep
1954 ls
1955 make
1956 mkdir
1957 rm
1958 sed
1959 sort
1960 touch
1961 tr
1962 uniq
1963 "
1964 trylist="
1965 Mcc
1966 ar
1967 byacc
1968 cpp
1969 csh
1970 date
1971 egrep
1972 gzip
1973 less
1974 ln
1975 more
1976 nm
1977 nroff
1978 pg
1979 test
1980 uname
1981 zip
1982 "
1983 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1984 pth="$pth /lib /usr/lib"
1985 for file in $loclist; do
1986         eval xxx=\$$file
1987         case "$xxx" in
1988         /*|?:[\\/]*)
1989                 if test -f "$xxx"; then
1990                         : ok
1991                 else
1992                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1993                         xxx=`./loc $file $file $pth`
1994                 fi
1995                 ;;
1996         '') xxx=`./loc $file $file $pth`;;
1997         *) xxx=`./loc $xxx $xxx $pth`;;
1998         esac
1999         eval $file=$xxx
2000         eval _$file=$xxx
2001         case "$xxx" in
2002         /*)
2003                 echo $file is in $xxx.
2004                 ;;
2005         ?:[\\/]*)
2006                 echo $file is in $xxx.
2007                 ;;
2008         *)
2009                 echo "I don't know where '$file' is, and my life depends on it." >&4
2010                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2011                 exit 1
2012                 ;;
2013         esac
2014 done
2015 echo " "
2016 echo "Don't worry if any of the following aren't found..."
2017 say=offhand
2018 for file in $trylist; do
2019         eval xxx=\$$file
2020         case "$xxx" in
2021         /*|?:[\\/]*)
2022                 if test -f "$xxx"; then
2023                         : ok
2024                 else
2025                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2026                         xxx=`./loc $file $file $pth`
2027                 fi
2028                 ;;
2029         '') xxx=`./loc $file $file $pth`;;
2030         *) xxx=`./loc $xxx $xxx $pth`;;
2031         esac
2032         eval $file=$xxx
2033         eval _$file=$xxx
2034         case "$xxx" in
2035         /*)
2036                 echo $file is in $xxx.
2037                 ;;
2038         ?:[\\/]*)
2039                 echo $file is in $xxx.
2040                 ;;
2041         *)
2042                 echo "I don't see $file out there, $say."
2043                 say=either
2044                 ;;
2045         esac
2046 done
2047 case "$egrep" in
2048 egrep)
2049         echo "Substituting grep for egrep."
2050         egrep=$grep
2051         ;;
2052 esac
2053 case "$ln" in
2054 ln)
2055         echo "Substituting cp for ln."
2056         ln=$cp
2057         ;;
2058 esac
2059 case "$test" in
2060 test)
2061         echo "Hopefully test is built into your sh."
2062         ;;
2063 *)
2064         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2065                 echo "Using the test built into your sh."
2066                 echo "Using the test built into your sh."
2067                 test=test
2068                 _test=test
2069         fi
2070         ;;
2071 esac
2072 case "$echo" in
2073 echo)
2074         echo "Hopefully echo is built into your sh."
2075         ;;
2076 '') ;;
2077 *)
2078         echo " "
2079 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2080         $echo $n "hi there$c" >foo1
2081         echo $n "hi there$c" >foo2
2082         if cmp foo1 foo2 >/dev/null 2>&1; then
2083                 echo "They are compatible.  In fact, they may be identical."
2084         else
2085                 case "$n" in
2086                 '-n') n='' c='\c';;
2087                 *) n='-n' c='';;
2088                 esac
2089                 cat <<FOO
2090 They are not compatible!  You are probably running ksh on a non-USG system.
2091 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2092 have echo built in and we may have to run some Bourne shell scripts.  That
2093 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2094
2095 FOO
2096                 $echo $n "The star should be here-->$c"
2097                 $echo "*"
2098         fi
2099         $rm -f foo1 foo2
2100         ;;
2101 esac
2102
2103 cat <<EOS >checkcc
2104 $startsh
2105 EOS
2106 cat <<'EOSC' >>checkcc
2107 case "$cc" in
2108 '') ;;
2109 *)  $rm -f try try.*
2110     $cat >try.c <<EOM
2111 int main(int argc, char *argv[]) {
2112   return 0;
2113 }
2114 EOM
2115     if $cc -o try $ccflags try.c; then
2116        :
2117     else
2118         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2119         despair=yes
2120         trygcc=yes
2121         case "$cc" in
2122         *gcc*) trygcc=no ;;
2123         esac
2124         case "`$cc -v -c try.c 2>&1`" in
2125         *gcc*) trygcc=no ;;
2126         esac
2127         if $test X"$trygcc" = Xyes; then
2128             if gcc -o try -c try.c; then
2129                 echo " "
2130                 echo "You seem to have a working gcc, though." >&4
2131                 rp="Would you like to use it?"
2132                 dflt=y
2133                 if $test -f myread; then
2134                     . ./myread
2135                 else
2136                     if $test -f UU/myread; then
2137                         . ./UU/myread
2138                     else
2139                         echo "Cannot find myread, sorry.  Aborting." >&2
2140                         exit 1
2141                     fi
2142                 fi  
2143                 case "$ans" in
2144                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2145                 esac
2146             fi
2147         fi
2148         if $test X"$despair" = Xyes; then
2149             $cat >&4 <<EOM
2150 You need to find a working C compiler.
2151 Either (purchase and) install the C compiler supplied by your OS vendor,
2152 or for a free C compiler try http://gcc.gnu.org/
2153 I cannot continue any further, aborting.
2154 EOM
2155             exit 1
2156         fi
2157     fi
2158     $rm -f try try.*
2159     ;;
2160 esac
2161 EOSC
2162
2163 : determine whether symbolic links are supported
2164 echo " "
2165 $touch blurfl
2166 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2167         echo "Symbolic links are supported." >&4
2168         lns="$ln -s"
2169 else
2170         echo "Symbolic links are NOT supported." >&4
2171         lns="$ln"
2172 fi
2173 $rm -f blurfl sym
2174
2175 : determine whether symbolic links are supported
2176 echo " "
2177 case "$lns" in
2178 *"ln -s")
2179         echo "Checking how to test for symbolic links..." >&4
2180         $lns blurfl sym
2181         if $test "X$issymlink" = X; then
2182                 sh -c "PATH= test -h sym" >/dev/null 2>&1
2183                 if test $? = 0; then
2184                         issymlink="test -h"
2185                 fi              
2186         fi
2187         if $test "X$issymlink" = X; then
2188                 if  $test -h >/dev/null 2>&1; then
2189                         issymlink="$test -h"
2190                         echo "Your builtin 'test -h' may be broken, I'm using external '$test -h'." >&4
2191                 fi              
2192         fi
2193         if $test "X$issymlink" = X; then
2194                 if $test -L sym 2>/dev/null; then
2195                         issymlink="$test -L"
2196                 fi
2197         fi
2198         if $test "X$issymlink" != X; then
2199                 echo "You can test for symbolic links with '$issymlink'." >&4
2200         else
2201                 echo "I do not know how you can test for symbolic links." >&4
2202         fi
2203         $rm -f blurfl sym
2204         ;;
2205 *)      echo "No symbolic links, so not testing for their testing..." >&4
2206         ;;
2207 esac
2208 echo " "
2209
2210
2211 case "$mksymlinks" in
2212 $define|true|[yY]*)
2213         case "$src" in
2214         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2215                 exit 1
2216                 ;;
2217         *)      case "$lns:$issymlink" in
2218                 *"ln -s:"*"test -"?)
2219                         echo "Creating the symbolic links..." >&4
2220                         echo "(First creating the subdirectories...)" >&4
2221                         cd ..
2222                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2223                                 read directory
2224                                 test -z "$directory" && break
2225                                 mkdir -p $directory
2226                         done
2227                         # Sanity check 1.
2228                         if test ! -d t/base; then
2229                                 echo "Failed to create the subdirectories.  Aborting." >&4
2230                                 exit 1
2231                         fi
2232                         echo "(Then creating the symlinks...)" >&4
2233                         awk '{print $1}' $src/MANIFEST | while true; do
2234                                 read filename
2235                                 test -z "$filename" && break
2236                                 if test -f $filename; then
2237                                         if $issymlink $filename; then
2238                                                 rm -f $filename
2239                                         fi
2240                                 fi
2241                                 if test -f $filename; then
2242                                         echo "$filename already exists, not symlinking."
2243                                 else
2244                                         ln -s $src/$filename $filename
2245                                 fi
2246                         done
2247                         # Sanity check 2.
2248                         if test ! -f t/base/commonsense.t; then
2249                                 echo "Failed to create the symlinks.  Aborting." >&4
2250                                 exit 1
2251                         fi
2252                         cd UU
2253                         ;;
2254                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2255                         ;;
2256                 esac
2257                 ;;
2258         esac
2259         ;;
2260 esac
2261
2262 : see whether [:lower:] and [:upper:] are supported character classes
2263 echo " "
2264 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2265 ABYZ)
2266         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2267         up='[:upper:]'
2268         low='[:lower:]'
2269         ;;
2270 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2271         # (0xc9 and 0xd1), therefore that is a nice testing point.
2272         if test "X$up" = X -o "X$low" = X; then
2273             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2274             ij) up='[A-Z]'
2275                 low='[a-z]'
2276                 ;;
2277             esac
2278         fi
2279         if test "X$up" = X -o "X$low" = X; then
2280             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2281             ij) up='A-Z'
2282                 low='a-z'
2283                 ;;
2284             esac
2285         fi
2286         if test "X$up" = X -o "X$low" = X; then
2287             case "`echo IJ | od -x 2>/dev/null`" in
2288             *C9D1*|*c9d1*)
2289                 echo "Hey, this might be EBCDIC." >&4
2290                 if test "X$up" = X -o "X$low" = X; then
2291                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2292                     ij) up='[A-IJ-RS-Z]'
2293                         low='[a-ij-rs-z]'
2294                         ;;
2295                     esac
2296                 fi
2297                 if test "X$up" = X -o "X$low" = X; then
2298                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2299                     ij) up='A-IJ-RS-Z'
2300                         low='a-ij-rs-z'
2301                         ;;
2302                     esac
2303                 fi
2304                 ;;
2305             esac
2306         fi
2307 esac
2308 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2309 ij)
2310     echo "Using $up and $low to convert case." >&4
2311     ;;
2312 *)
2313     echo "I don't know how to translate letters from upper to lower case." >&4
2314     echo "Your tr is not acting any way I know of." >&4
2315     exit 1
2316     ;;
2317 esac
2318 : set up the translation script tr, must be called with ./tr of course
2319 cat >tr <<EOSC
2320 $startsh
2321 case "\$1\$2" in
2322 '[A-Z][a-z]') exec $tr '$up' '$low';;
2323 '[a-z][A-Z]') exec $tr '$low' '$up';;
2324 esac
2325 exec $tr "\$@"
2326 EOSC
2327 chmod +x tr
2328 $eunicefix tr
2329
2330 : Try to determine whether config.sh was made on this system
2331 case "$config_sh" in
2332 '')
2333 myuname=`$uname -a 2>/dev/null`
2334 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2335 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2336 # because the A-Z/a-z are not consecutive.
2337 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2338         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2339 newmyuname="$myuname"
2340 dflt=n
2341 case "$knowitall" in
2342 '')
2343         if test -f ../config.sh; then
2344                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2345                         eval "`grep myuname= ../config.sh`"
2346                 fi
2347                 if test "X$myuname" = "X$newmyuname"; then
2348                         dflt=y
2349                 fi
2350         fi
2351         ;;
2352 *) dflt=y;;
2353 esac
2354
2355 : Get old answers from old config file if Configure was run on the
2356 : same system, otherwise use the hints.
2357 hint=default
2358 cd ..
2359 if test -f config.sh; then
2360         echo " "
2361         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2362         . UU/myread
2363         case "$ans" in
2364         n*|N*) echo "OK, I'll ignore it."
2365                 mv config.sh config.sh.old
2366                 myuname="$newmyuname"
2367                 ;;
2368         *)  echo "Fetching default answers from your old config.sh file..." >&4
2369                 tmp_n="$n"
2370                 tmp_c="$c"
2371                 tmp_sh="$sh"
2372                 . ./config.sh
2373                 cp config.sh UU
2374                 n="$tmp_n"
2375                 c="$tmp_c"
2376                 : Older versions did not always set $sh.  Catch re-use of such
2377                 : an old config.sh.
2378                 case "$sh" in
2379                 '') sh="$tmp_sh" ;;
2380                 esac
2381                 hint=previous
2382                 ;;
2383         esac
2384 fi
2385 . ./UU/checkcc
2386 if test ! -f config.sh; then
2387         $cat <<EOM
2388
2389 First time through, eh?  I have some defaults handy for some systems
2390 that need some extra help getting the Configure answers right:
2391
2392 EOM
2393         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2394         dflt=''
2395         : Half the following guesses are probably wrong... If you have better
2396         : tests or hints, please send them to perlbug@perl.org
2397         : The metaconfig authors would also appreciate a copy...
2398         $test -f /irix && osname=irix
2399         $test -f /xenix && osname=sco_xenix
2400         $test -f /dynix && osname=dynix
2401         $test -f /dnix && osname=dnix
2402         $test -f /lynx.os && osname=lynxos
2403         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2404         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2405         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2406         $test -f /bin/mips && /bin/mips && osname=mips
2407         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2408                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2409         $test -d /usr/apollo/bin && osname=apollo
2410         $test -f /etc/saf/_sactab && osname=svr4
2411         $test -d /usr/include/minix && osname=minix
2412         if $test -d /MachTen -o -d /MachTen_Folder; then
2413                 osname=machten
2414                 if $test -x /sbin/version; then
2415                         osvers=`/sbin/version | $awk '{print $2}' |
2416                         $sed -e 's/[A-Za-z]$//'`
2417                 elif $test -x /usr/etc/version; then
2418                         osvers=`/usr/etc/version | $awk '{print $2}' |
2419                         $sed -e 's/[A-Za-z]$//'`
2420                 else
2421                         osvers="$2.$3"
2422                 fi
2423         fi
2424
2425         $test -f /sys/posix.dll &&
2426                 $test -f /usr/bin/what &&
2427                 set X `/usr/bin/what /sys/posix.dll` &&
2428                 $test "$3" = UWIN &&
2429                 osname=uwin &&
2430                 osvers="$5"
2431
2432         if $test -f $uname; then
2433                 set X $myuname
2434                 shift
2435
2436                 case "$5" in
2437                 fps*) osname=fps ;;
2438                 mips*)
2439                         case "$4" in
2440                         umips) osname=umips ;;
2441                         *) osname=mips ;;
2442                         esac;;
2443                 [23]100) osname=mips ;;
2444                 next*) osname=next ;;
2445                 i386*)
2446                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2447                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2448                                 osname='sco'
2449                                 osvers=$tmp
2450                         elif $test -f /etc/kconfig; then
2451                                 osname=isc
2452                                 if test "$lns" = "$ln -s"; then
2453                                         osvers=4
2454                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2455                                         osvers=3
2456                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2457                                         osvers=2
2458                                 fi
2459                         fi
2460                         tmp=''
2461                         ;;
2462                 pc*)
2463                         if test -n "$DJGPP"; then
2464                                 osname=dos
2465                                 osvers=djgpp
2466                         fi
2467                         ;;
2468                 esac
2469
2470                 case "$1" in
2471                 aix) osname=aix
2472                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2473                         case "$tmp" in
2474                         'not found') osvers="$4"."$3" ;;
2475                         '<3240'|'<>3240') osvers=3.2.0 ;;
2476                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2477                         '=3250'|'>3250') osvers=3.2.5 ;;
2478                         *) osvers=$tmp;;
2479                         esac
2480                         ;;
2481                 bsd386) osname=bsd386
2482                         osvers=`$uname -r`
2483                         ;;
2484                 cygwin*) osname=cygwin
2485                         osvers="$3"
2486                         ;;
2487                 *dc.osx) osname=dcosx
2488                         osvers="$3"
2489                         ;;
2490                 dnix) osname=dnix
2491                         osvers="$3"
2492                         ;;
2493                 domainos) osname=apollo
2494                         osvers="$3"
2495                         ;;
2496                 dgux) osname=dgux 
2497                         osvers="$3"
2498                         ;;
2499                 dynixptx*) osname=dynixptx
2500                         osvers=`echo "$4"|sed 's/^v//'`
2501                         ;;
2502                 freebsd) osname=freebsd 
2503                         osvers="$3" ;;
2504                 genix) osname=genix ;;
2505                 hp*) osname=hpux 
2506                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2507                         ;;
2508                 irix*) osname=irix
2509                         case "$3" in
2510                         4*) osvers=4 ;;
2511                         5*) osvers=5 ;;
2512                         *)      osvers="$3" ;;
2513                         esac
2514                         ;;
2515                 linux) osname=linux
2516                         case "$3" in
2517                         *)      osvers="$3" ;;
2518                         esac
2519                         ;;
2520                 MiNT) osname=mint
2521                         ;;
2522                 netbsd*) osname=netbsd
2523                         osvers="$3"
2524                         ;;
2525                 news-os) osvers="$3"
2526                         case "$3" in
2527                         4*) osname=newsos4 ;;
2528                         *) osname=newsos ;;
2529                         esac
2530                         ;;
2531                 next*) osname=next ;;
2532                 nonstop-ux) osname=nonstopux ;;
2533                 POSIX-BC | posix-bc ) osname=posix-bc
2534                         osvers="$3"
2535                         ;;
2536                 powerux | power_ux | powermax_os | powermaxos | \
2537                 powerunix | power_unix) osname=powerux
2538                         osvers="$3"
2539                         ;;
2540                 qnx) osname=qnx
2541                         osvers="$4"
2542                         ;;
2543                 solaris) osname=solaris
2544                         case "$3" in
2545                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2546                         *)      osvers="$3" ;;
2547                         esac
2548                         ;;
2549                 sunos) osname=sunos
2550                         case "$3" in
2551                         5*) osname=solaris
2552                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2553                         *)      osvers="$3" ;;
2554                         esac
2555                         ;;
2556                 titanos) osname=titanos
2557                         case "$3" in
2558                         1*) osvers=1 ;;
2559                         2*) osvers=2 ;;
2560                         3*) osvers=3 ;;
2561                         4*) osvers=4 ;;
2562                         *)      osvers="$3" ;;
2563                         esac
2564                         ;;
2565                 ultrix) osname=ultrix
2566                         osvers="$3"
2567                         ;;
2568                 osf1|mls+)      case "$5" in
2569                                 alpha)
2570                                         osname=dec_osf
2571                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2572                                         case "$osvers" in
2573                                         [1-9].[0-9]*) ;;
2574                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2575                                         esac
2576                                         ;;
2577                         hp*)    osname=hp_osf1  ;;
2578                         mips)   osname=mips_osf1 ;;
2579                         esac
2580                         ;;
2581                 unixware) osname=svr5
2582                         osvers="$4"
2583                         ;;
2584                 uts) osname=uts
2585                         osvers="$3"
2586                         ;;
2587                 $2) case "$osname" in
2588                         *isc*) ;;
2589                         *freebsd*) ;;
2590                         svr*)
2591                                 : svr4.x or possibly later
2592                                 case "svr$3" in 
2593                                 ${osname}*)
2594                                         osname=svr$3
2595                                         osvers=$4
2596                                         ;;
2597                                 esac
2598                                 case "$osname" in
2599                                 svr4.0)
2600                                         : Check for ESIX
2601                                         if test -f /stand/boot ; then
2602                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2603                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2604                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2605                                                         if test -n "$isesix"; then
2606                                                                 osname=esix4
2607                                                         fi
2608                                                 fi
2609                                         fi
2610                                         ;;
2611                                 esac
2612                                 ;;
2613                         *)      if test -f /etc/systemid; then
2614                                         osname=sco
2615                                         set `echo $3 | $sed 's/\./ /g'` $4
2616                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2617                                                 osvers=$1.$2.$3
2618                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2619                                                 osvers=$1.$2
2620                                         elif $test -f $src/hints/sco_$1.sh; then
2621                                                 osvers=$1
2622                                         fi
2623                                 else
2624                                         case "$osname" in
2625                                         '') : Still unknown.  Probably a generic Sys V.
2626                                                 osname="sysv"
2627                                                 osvers="$3"
2628                                                 ;;
2629                                         esac
2630                                 fi
2631                                 ;;
2632                         esac
2633                         ;;
2634                 *)      case "$osname" in
2635                         '') : Still unknown.  Probably a generic BSD.
2636                                 osname="$1"
2637                                 osvers="$3"
2638                                 ;;
2639                         esac
2640                         ;;
2641                 esac
2642         else
2643                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2644                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2645                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2646                                 osname=news_os
2647                         fi
2648                         $rm -f UU/kernel.what
2649                 elif test -d c:/.; then
2650                         set X $myuname
2651                         osname=os2
2652                         osvers="$5"
2653                 fi
2654         fi
2655         
2656         : Now look for a hint file osname_osvers, unless one has been
2657         : specified already.
2658         case "$hintfile" in
2659         ''|' ')
2660                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2661                 : Also try without trailing minor version numbers.
2662                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2663                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2664                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2665                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2666                 case "$file" in
2667                 '') dflt=none ;;
2668                 *)  case "$osvers" in
2669                         '') dflt=$file
2670                                 ;;
2671                         *)  if $test -f $src/hints/$file.sh ; then
2672                                         dflt=$file
2673                                 elif $test -f $src/hints/$xfile.sh ; then
2674                                         dflt=$xfile
2675                                 elif $test -f $src/hints/$xxfile.sh ; then
2676                                         dflt=$xxfile
2677                                 elif $test -f $src/hints/$xxxfile.sh ; then
2678                                         dflt=$xxxfile
2679                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2680                                         dflt=$xxxxfile
2681                                 elif $test -f "$src/hints/${osname}.sh" ; then
2682                                         dflt="${osname}"
2683                                 else
2684                                         dflt=none
2685                                 fi
2686                                 ;;
2687                         esac
2688                         ;;
2689                 esac
2690                 if $test -f Policy.sh ; then
2691                         case "$dflt" in
2692                         *Policy*) ;;
2693                         none) dflt="Policy" ;;
2694                         *) dflt="Policy $dflt" ;;
2695                         esac
2696                 fi
2697                 ;;
2698         *)
2699                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2700                 ;;
2701         esac
2702
2703         if $test -f Policy.sh ; then
2704                 $cat <<EOM
2705
2706 There's also a Policy hint file available, which should make the
2707 site-specific (policy) questions easier to answer.
2708 EOM
2709
2710         fi
2711
2712         $cat <<EOM
2713
2714 You may give one or more space-separated answers, or "none" if appropriate.
2715 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2716 is a good thing.  DO NOT give a wrong version or a wrong OS.
2717
2718 EOM
2719
2720         rp="Which of these apply, if any?"
2721         . UU/myread
2722         tans=$ans
2723         for file in $tans; do
2724                 if $test X$file = XPolicy -a -f Policy.sh; then
2725                         . Policy.sh
2726                         $cat Policy.sh >> UU/config.sh
2727                 elif $test -f $src/hints/$file.sh; then
2728                         . $src/hints/$file.sh
2729                         $cat $src/hints/$file.sh >> UU/config.sh
2730                 elif $test X$tans = X -o X$tans = Xnone ; then
2731                         : nothing
2732                 else
2733                         : Give one chance to correct a possible typo.
2734                         echo "$file.sh does not exist"
2735                         dflt=$file
2736                         rp="hint to use instead?"
2737                         . UU/myread
2738                         for file in $ans; do
2739                                 if $test -f "$src/hints/$file.sh"; then
2740                                         . $src/hints/$file.sh
2741                                         $cat $src/hints/$file.sh >> UU/config.sh
2742                                 elif $test X$ans = X -o X$ans = Xnone ; then
2743                                         : nothing
2744                                 else
2745                                         echo "$file.sh does not exist -- ignored."
2746                                 fi
2747                         done
2748                 fi
2749         done
2750
2751         hint=recommended
2752         : Remember our hint file for later.
2753         if $test -f "$src/hints/$file.sh" ; then
2754                 hintfile="$file"
2755         else
2756                 hintfile=''
2757         fi
2758 fi
2759 cd UU
2760 ;;
2761 *)
2762         echo " "
2763         echo "Fetching default answers from $config_sh..." >&4
2764         tmp_n="$n"
2765         tmp_c="$c"
2766         cd ..
2767         cp $config_sh config.sh 2>/dev/null
2768         chmod +w config.sh
2769         . ./config.sh
2770         cd UU
2771         cp ../config.sh .
2772         n="$tmp_n"
2773         c="$tmp_c"
2774         hint=previous
2775         ;;
2776 esac
2777 test "$override" && . ./optdef.sh
2778
2779 : Restore computed paths
2780 for file in $loclist $trylist; do
2781         eval $file="\$_$file"
2782 done
2783
2784 cat << EOM
2785
2786 Configure uses the operating system name and version to set some defaults.
2787 The default value is probably right if the name rings a bell. Otherwise,
2788 since spelling matters for me, either accept the default or answer "none"
2789 to leave it blank.
2790
2791 EOM
2792 case "$osname" in
2793         ''|' ')
2794                 case "$hintfile" in
2795                 ''|' '|none) dflt=none ;;
2796                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2797                 esac
2798                 ;;
2799         *) dflt="$osname" ;;
2800 esac
2801 rp="Operating system name?"
2802 . ./myread
2803 case "$ans" in
2804 none)  osname='' ;;
2805 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2806 esac
2807 echo " "
2808 case "$osvers" in
2809         ''|' ')
2810                 case "$hintfile" in
2811                 ''|' '|none) dflt=none ;;
2812                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2813                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2814                         case "$dflt" in
2815                         ''|' ') dflt=none ;;
2816                         esac
2817                         ;;
2818                 esac
2819                 ;;
2820         *) dflt="$osvers" ;;
2821 esac
2822 rp="Operating system version?"
2823 . ./myread
2824 case "$ans" in
2825 none)  osvers='' ;;
2826 *) osvers="$ans" ;;
2827 esac
2828
2829
2830 . ./posthint.sh
2831
2832 : who configured the system
2833 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2834 cf_by=`(logname) 2>/dev/null`
2835 case "$cf_by" in
2836 "")
2837         cf_by=`(whoami) 2>/dev/null`
2838         case "$cf_by" in
2839         "") cf_by=unknown ;;
2840         esac ;;
2841 esac
2842
2843 : set up the script used to warn in case of inconsistency
2844 cat <<EOS >whoa
2845 $startsh
2846 EOS
2847 cat <<'EOSC' >>whoa
2848 dflt=y
2849 echo " "
2850 echo "*** WHOA THERE!!! ***" >&4
2851 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2852 rp="    Keep the $hint value?"
2853 . ./myread
2854 case "$ans" in
2855 y) td=$was; tu=$was;;
2856 esac
2857 EOSC
2858
2859 : function used to set $1 to $val
2860 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2861 case "$val$was" in
2862 $define$undef) . ./whoa; eval "$var=\$td";;
2863 $undef$define) . ./whoa; eval "$var=\$tu";;
2864 *) eval "$var=$val";;
2865 esac'
2866
2867 case "$usethreads" in
2868 $define|true|[yY]*)     dflt='y';;
2869 *) dflt='n';;
2870 esac
2871 cat <<EOM
2872
2873 Perl can be built to take advantage of threads on some systems.
2874 To do so, Configure can be run with -Dusethreads.
2875
2876 Note that threading is a highly experimental feature, and
2877 some known race conditions still remain.  If you choose to try
2878 it, be very sure to not actually deploy it for production
2879 purposes.  README.threads has more details, and is required
2880 reading if you enable threads.
2881
2882 If this doesn't make any sense to you, just accept the default '$dflt'.
2883 EOM
2884 rp='Build a threading Perl?'
2885 . ./myread
2886 case "$ans" in
2887 y|Y)    val="$define" ;;
2888 *)      val="$undef" ;;
2889 esac
2890 set usethreads
2891 eval $setvar
2892
2893 case "$usethreads" in
2894 $define)
2895         $cat <<EOM
2896
2897 As of 5.5.640, Perl has two different internal threading implementations,
2898 the 5.005 version (5005threads) and an interpreter-based version
2899 (ithreads) that has one interpreter per thread.  Both are very 
2900 experimental.  This arrangement exists to help developers work out
2901 which one is better.
2902
2903 If you're a casual user, you probably don't want interpreter-threads
2904 at this time.  There doesn't yet exist a way to create threads from
2905 within Perl in this model, i.e., "use Thread;" will NOT work.
2906 EOM
2907         : Default to ithreads unless overridden on command line or with
2908         : old config.sh
2909         dflt='y'
2910         case "$use5005threads" in
2911                 $define|true|[yY]*) dflt='n';;
2912         esac
2913         case "$useithreads" in
2914                 $undef|false|[nN]*) dflt='n';;
2915         esac
2916         rp='Use interpreter-based ithreads?'
2917         . ./myread
2918         case "$ans" in
2919         y|Y)    val="$define" ;;
2920         *)      val="$undef" ;;
2921         esac
2922         set useithreads
2923         eval $setvar
2924         : Now set use5005threads to the opposite value.
2925         case "$useithreads" in
2926         $define) val="$undef" ;;
2927         *) val="$define" ;;
2928         esac
2929         set use5005threads
2930         eval $setvar
2931         ;;
2932 *)
2933         useithreads="$undef"
2934         use5005threads="$undef"
2935         ;;
2936 esac
2937
2938 case "$d_oldpthreads" in
2939 '')     : Configure tests would be welcome here.  For now, assume undef.
2940         val="$undef" ;;
2941 *)      val="$d_oldpthreads" ;;
2942 esac
2943 set d_oldpthreads
2944 eval $setvar
2945
2946
2947 case "$usethreads" in
2948 "$define"|true|[yY]*)
2949 : Look for a hint-file generated 'call-back-unit'.  If the
2950 : user has specified that a threading perl is to be built,
2951 : we may need to set or change some other defaults.
2952         if $test -f usethreads.cbu; then
2953                 echo "Your platform has some specific hints for threaded builds, using them..."
2954                 . ./usethreads.cbu
2955         else
2956                 $cat <<EOM
2957 (Your platform doesn't have any specific hints for threaded builds.
2958  Assuming POSIX threads, then.)
2959 EOM
2960         fi
2961         ;;
2962 esac
2963
2964 cat <<EOM
2965
2966 Perl can be built so that multiple Perl interpreters can coexist
2967 within the same Perl executable.
2968 EOM
2969
2970 case "$useithreads" in
2971 $define)
2972         cat <<EOM
2973 This multiple interpreter support is required for interpreter-based threads.
2974 EOM
2975         val="$define"
2976         ;;
2977 *)      case "$usemultiplicity" in
2978         $define|true|[yY]*)     dflt='y';;
2979         *) dflt='n';;
2980         esac
2981         echo " "
2982         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
2983         rp='Build Perl for multiplicity?'
2984         . ./myread
2985         case "$ans" in
2986         y|Y)    val="$define" ;;
2987         *)      val="$undef" ;;
2988         esac
2989         ;;
2990 esac
2991 set usemultiplicity
2992 eval $setvar
2993
2994 : make some quick guesses about what we are up against
2995 echo " "
2996 $echo $n "Hmm...  $c"
2997 echo exit 1 >bsd
2998 echo exit 1 >usg
2999 echo exit 1 >v7
3000 echo exit 1 >osf1
3001 echo exit 1 >eunice
3002 echo exit 1 >xenix
3003 echo exit 1 >venix
3004 echo exit 1 >os2
3005 d_bsd="$undef"
3006 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3007 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3008 then
3009         echo "Looks kind of like an OSF/1 system, but we'll see..."
3010         echo exit 0 >osf1
3011 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3012         xxx=`./loc addbib blurfl $pth`
3013         if $test -f $xxx; then
3014         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3015                 echo exit 0 >bsd
3016                 echo exit 0 >usg
3017         else
3018                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3019                         echo "Looks kind of like an extended USG system, but we'll see..."
3020                 else
3021                         echo "Looks kind of like a USG system, but we'll see..."
3022                 fi
3023                 echo exit 0 >usg
3024         fi
3025 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3026         echo "Looks kind of like a BSD system, but we'll see..."
3027         d_bsd="$define"
3028         echo exit 0 >bsd
3029 else
3030         echo "Looks kind of like a Version 7 system, but we'll see..."
3031         echo exit 0 >v7
3032 fi
3033 case "$eunicefix" in
3034 *unixtovms*)
3035         $cat <<'EOI'
3036 There is, however, a strange, musty smell in the air that reminds me of
3037 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3038 EOI
3039         echo exit 0 >eunice
3040         d_eunice="$define"
3041 : it so happens the Eunice I know will not run shell scripts in Unix format
3042         ;;
3043 *)
3044         echo " "
3045         echo "Congratulations.  You aren't running Eunice."
3046         d_eunice="$undef"
3047         ;;
3048 esac
3049 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3050 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3051 : semicolon as a patch separator
3052 case "$p_" in
3053 :) ;;
3054 *)
3055         $cat <<'EOI'
3056 I have the feeling something is not exactly right, however...don't tell me...
3057 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3058 (Or you may be running DOS with DJGPP.)
3059 EOI
3060         echo exit 0 >os2
3061         ;;
3062 esac
3063 if test -f /xenix; then
3064         echo "Actually, this looks more like a XENIX system..."
3065         echo exit 0 >xenix
3066         d_xenix="$define"
3067 else
3068         echo " "
3069         echo "It's not Xenix..."
3070         d_xenix="$undef"
3071 fi
3072 chmod +x xenix
3073 $eunicefix xenix
3074 if test -f /venix; then
3075         echo "Actually, this looks more like a VENIX system..."
3076         echo exit 0 >venix
3077 else
3078         echo " "
3079         if ./xenix; then
3080                 : null
3081         else
3082                 echo "Nor is it Venix..."
3083         fi
3084 fi
3085 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3086 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3087 $rm -f foo
3088
3089 case "$cc" in
3090 '') dflt=cc;;
3091 *) dflt="$cc";;
3092 esac
3093 rp="Use which C compiler?"
3094 . ./myread
3095 cc="$ans"
3096 : Look for a hint-file generated 'call-back-unit'.  Now that the
3097 : user has specified the compiler, we may need to set or change some
3098 : other defaults.
3099 if $test -f cc.cbu; then
3100     . ./cc.cbu
3101 fi
3102 . ./checkcc
3103
3104 echo " "
3105 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3106 $cat >gccvers.c <<EOM
3107 #include <stdio.h>
3108 int main() {
3109 #ifdef __GNUC__
3110 #ifdef __VERSION__
3111         printf("%s\n", __VERSION__);
3112 #else
3113         printf("%s\n", "1");
3114 #endif
3115 #endif
3116         exit(0);
3117 }
3118 EOM
3119 if $cc -o gccvers $ldflags gccvers.c; then
3120         gccversion=`./gccvers`
3121         case "$gccversion" in
3122         '') echo "You are not using GNU cc." ;;
3123         *)  echo "You are using GNU cc $gccversion."
3124             ccname=gcc  
3125             ;;
3126         esac
3127 else
3128         echo " "
3129         echo "*** WHOA THERE!!! ***" >&4
3130         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3131         case "$knowitall" in
3132         '')
3133         echo "    You'd better start hunting for one and let me know about it." >&4
3134                 exit 1
3135                 ;;
3136         esac
3137 fi
3138 $rm -f gccvers*
3139 case "$gccversion" in
3140 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3141 esac
3142 case "$gccversion" in
3143 '') gccosandvers='' ;;
3144 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3145    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3146    gccshortvers=''
3147    case "$gccosandvers" in
3148    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3149    $osname$osvers) ;; # looking good
3150    $osname*) cat <<EOM >&4
3151
3152 *** WHOA THERE!!! ***
3153
3154     Your gcc has not been compiled for the exact release of
3155     your operating system ($gccosandvers versus $osname$osvers).
3156
3157     In general it is a good idea to keep gcc synchronized with
3158     the operating system because otherwise serious problems
3159     may ensue when trying to compile software, like Perl.
3160
3161     I'm trying to be optimistic here, though, and will continue.
3162     If later during the configuration and build icky compilation
3163     problems appear (headerfile conflicts being the most common
3164     manifestation), I suggest reinstalling the gcc to match
3165     your operating system release.
3166
3167 EOM
3168       ;;
3169    *) gccosandvers='' ;; # failed to parse, better be silent
3170    esac
3171    ;;
3172 esac
3173 case "$ccname" in
3174 '') ccname="$cc" ;;
3175 esac
3176
3177 : see how we invoke the C preprocessor
3178 echo " "
3179 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3180 cat <<'EOT' >testcpp.c
3181 #define ABC abc
3182 #define XYZ xyz
3183 ABC.XYZ
3184 EOT
3185 cd ..
3186 if test ! -f cppstdin; then
3187         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3188                 # AIX cc -E doesn't show the absolute headerfile
3189                 # locations but we'll cheat by using the -M flag.
3190                 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
3191         else
3192                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3193         fi
3194 else
3195         echo "Keeping your $hint cppstdin wrapper."
3196 fi
3197 chmod 755 cppstdin
3198 wrapper=`pwd`/cppstdin
3199 ok='false'
3200 cd UU
3201
3202 if $test "X$cppstdin" != "X" && \
3203         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3204         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3205 then
3206         echo "You used to use $cppstdin $cppminus so we'll use that again."
3207         case "$cpprun" in
3208         '') echo "But let's see if we can live without a wrapper..." ;;
3209         *)
3210                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3211                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3212                 then
3213                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3214                         ok='true'
3215                 else
3216                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3217                 fi
3218                 ;;
3219         esac
3220 else
3221         case "$cppstdin" in
3222         '') ;;
3223         *)
3224                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3225                 ;;
3226         esac
3227 fi
3228
3229 if $ok; then
3230         : nothing
3231 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3232         $cc -E <testcpp.c >testcpp.out 2>&1; \
3233         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3234         echo "Yup, it does."
3235         x_cpp="$cc -E"
3236         x_minus='';
3237 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3238         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3239         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3240         echo "Yup, it does."
3241         x_cpp="$cc -E"
3242         x_minus='-';
3243 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3244         $cc -P <testcpp.c >testcpp.out 2>&1; \
3245         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3246         echo "Yipee, that works!"
3247         x_cpp="$cc -P"
3248         x_minus='';
3249 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3250         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3251         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3252         echo "At long last!"
3253         x_cpp="$cc -P"
3254         x_minus='-';
3255 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3256         $cpp <testcpp.c >testcpp.out 2>&1; \
3257         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3258         echo "It works!"
3259         x_cpp="$cpp"
3260         x_minus='';
3261 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3262         $cpp - <testcpp.c >testcpp.out 2>&1; \
3263         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3264         echo "Hooray, it works!  I was beginning to wonder."
3265         x_cpp="$cpp"
3266         x_minus='-';
3267 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3268         $wrapper <testcpp.c >testcpp.out 2>&1; \
3269         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3270         x_cpp="$wrapper"
3271         x_minus=''
3272         echo "Eureka!"
3273 else
3274         dflt=''
3275         rp="No dice.  I can't find a C preprocessor.  Name one:"
3276         . ./myread
3277         x_cpp="$ans"
3278         x_minus=''
3279         $x_cpp <testcpp.c >testcpp.out 2>&1
3280         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3281                 echo "OK, that will do." >&4
3282         else
3283 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3284                 exit 1
3285         fi
3286 fi
3287
3288 case "$ok" in
3289 false)
3290         cppstdin="$x_cpp"
3291         cppminus="$x_minus"
3292         cpprun="$x_cpp"
3293         cpplast="$x_minus"
3294         set X $x_cpp
3295         shift
3296         case "$1" in
3297         "$cpp")
3298                 echo "Perhaps can we force $cc -E using a wrapper..."
3299                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3300                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3301                 then
3302                         echo "Yup, we can."
3303                         cppstdin="$wrapper"
3304                         cppminus='';
3305                 else
3306                         echo "Nope, we'll have to live without it..."
3307                 fi
3308                 ;;
3309         esac
3310         case "$cpprun" in
3311         "$wrapper")
3312                 cpprun=''
3313                 cpplast=''
3314                 ;;
3315         esac
3316         ;;
3317 esac
3318
3319 case "$cppstdin" in
3320 "$wrapper"|'cppstdin') ;;
3321 *) $rm -f $wrapper;;
3322 esac
3323 $rm -f testcpp.c testcpp.out
3324
3325 : decide how portable to be.  Allow command line overrides.
3326 case "$d_portable" in
3327 "$undef") ;;
3328 *)      d_portable="$define" ;;
3329 esac
3330
3331 : set up shell script to do ~ expansion
3332 cat >filexp <<EOSS
3333 $startsh
3334 : expand filename
3335 case "\$1" in
3336  ~/*|~)
3337         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3338         ;;
3339  ~*)
3340         if $test -f /bin/csh; then
3341                 /bin/csh -f -c "glob \$1"
3342                 failed=\$?
3343                 echo ""
3344                 exit \$failed
3345         else
3346                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3347                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3348                 if $test ! -d "\$dir"; then
3349                         me=\`basename \$0\`
3350                         echo "\$me: can't locate home directory for: \$name" >&2
3351                         exit 1
3352                 fi
3353                 case "\$1" in
3354                 */*)
3355                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3356                         ;;
3357                 *)
3358                         echo \$dir
3359                         ;;
3360                 esac
3361         fi
3362         ;;
3363 *)
3364         echo \$1
3365         ;;
3366 esac
3367 EOSS
3368 chmod +x filexp
3369 $eunicefix filexp
3370
3371 : now set up to get a file name
3372 cat <<EOS >getfile
3373 $startsh
3374 EOS
3375 cat <<'EOSC' >>getfile
3376 tilde=''
3377 fullpath=''
3378 already=''
3379 skip=''
3380 none_ok=''
3381 exp_file=''
3382 nopath_ok=''
3383 orig_rp="$rp"
3384 orig_dflt="$dflt"
3385 case "$gfpth" in
3386 '') gfpth='.' ;;
3387 esac
3388
3389 case "$fn" in
3390 *\(*)
3391         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3392         fn=`echo $fn | sed 's/(.*)//'`
3393         ;;
3394 esac
3395
3396 case "$fn" in
3397 *:*)
3398         loc_file=`expr $fn : '.*:\(.*\)'`
3399         fn=`expr $fn : '\(.*\):.*'`
3400         ;;
3401 esac
3402
3403 case "$fn" in
3404 *~*) tilde=true;;
3405 esac
3406 case "$fn" in
3407 */*) fullpath=true;;
3408 esac
3409 case "$fn" in
3410 *+*) skip=true;;
3411 esac
3412 case "$fn" in
3413 *n*) none_ok=true;;
3414 esac
3415 case "$fn" in
3416 *e*) exp_file=true;;
3417 esac
3418 case "$fn" in
3419 *p*) nopath_ok=true;;
3420 esac
3421
3422 case "$fn" in
3423 *f*) type='File';;
3424 *d*) type='Directory';;
3425 *l*) type='Locate';;
3426 esac
3427
3428 what="$type"
3429 case "$what" in
3430 Locate) what='File';;
3431 esac
3432
3433 case "$exp_file" in
3434 '')
3435         case "$d_portable" in
3436         "$define") ;;
3437         *) exp_file=true;;
3438         esac
3439         ;;
3440 esac
3441
3442 cd ..
3443 while test "$type"; do
3444         redo=''
3445         rp="$orig_rp"
3446         dflt="$orig_dflt"
3447         case "$tilde" in
3448         true) rp="$rp (~name ok)";;
3449         esac
3450         . UU/myread
3451         if test -f UU/getfile.ok && \
3452                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3453         then
3454                 value="$ans"
3455                 ansexp="$ans"
3456                 break
3457         fi
3458         case "$ans" in
3459         none)
3460                 value=''
3461                 ansexp=''
3462                 case "$none_ok" in
3463                 true) type='';;
3464                 esac
3465                 ;;
3466         *)
3467                 case "$tilde" in
3468                 '') value="$ans"
3469                         ansexp="$ans";;
3470                 *)
3471                         value=`UU/filexp $ans`
3472                         case $? in
3473                         0)
3474                                 if test "$ans" != "$value"; then
3475                                         echo "(That expands to $value on this system.)"
3476                                 fi
3477                                 ;;
3478                         *) value="$ans";;
3479                         esac
3480                         ansexp="$value"
3481                         case "$exp_file" in
3482                         '') value="$ans";;
3483                         esac
3484                         ;;
3485                 esac
3486                 case "$fullpath" in
3487                 true)
3488                         case "$ansexp" in
3489                         /*) value="$ansexp" ;;
3490                         [a-zA-Z]:/*) value="$ansexp" ;;
3491                         *)
3492                                 redo=true
3493                                 case "$already" in
3494                                 true)
3495                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3496                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3497                                         ;;
3498                                 *)
3499                                 echo "Please give a full path name, starting with slash." >&4
3500                                         case "$tilde" in
3501                                         true)
3502                                 echo "Note that using ~name is ok provided it expands well." >&4
3503                                                 already=true
3504                                                 ;;
3505                                         esac
3506                                 esac
3507                                 ;;
3508                         esac
3509                         ;;
3510                 esac
3511                 case "$redo" in
3512                 '')
3513                         case "$type" in
3514                         File)
3515                                 for fp in $gfpth; do
3516                                         if test "X$fp" = X.; then
3517                                             pf="$ansexp"
3518                                         else    
3519                                             pf="$fp/$ansexp"
3520                                         fi
3521                                         if test -f "$pf"; then
3522                                                 type=''
3523                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3524                                         then
3525                                                 echo "($value is not a plain file, but that's ok.)"
3526                                                 type=''
3527                                         fi
3528                                         if test X"$type" = X; then
3529                                             value="$pf"
3530                                             break
3531                                         fi
3532                                 done
3533                                 ;;
3534                         Directory)
3535                                 for fp in $gfpth; do
3536                                         if test "X$fp" = X.; then
3537                                             dir="$ans"
3538                                             direxp="$ansexp"
3539                                         else    
3540                                             dir="$fp/$ansexp"
3541                                             direxp="$fp/$ansexp"
3542                                         fi
3543                                         if test -d "$direxp"; then
3544                                                 type=''
3545                                                 value="$dir"
3546                                                 break
3547                                         fi
3548                                 done
3549                                 ;;
3550                         Locate)
3551                                 if test -d "$ansexp"; then
3552                                         echo "(Looking for $loc_file in directory $value.)"
3553                                         value="$value/$loc_file"
3554                                         ansexp="$ansexp/$loc_file"
3555                                 fi
3556                                 if test -f "$ansexp"; then
3557                                         type=''
3558                                 fi
3559                                 case "$nopath_ok" in
3560                                 true)   case "$value" in
3561                                         */*) ;;
3562                                         *)      echo "Assuming $value will be in people's path."
3563                                                 type=''
3564                                                 ;;
3565                                         esac
3566                                         ;;
3567                                 esac
3568                                 ;;
3569                         esac
3570
3571                         case "$skip" in
3572                         true) type='';
3573                         esac
3574
3575                         case "$type" in
3576                         '') ;;
3577                         *)
3578                                 if test "$fastread" = yes; then
3579                                         dflt=y
3580                                 else
3581                                         dflt=n
3582                                 fi
3583                                 rp="$what $value doesn't exist.  Use that name anyway?"
3584                                 . UU/myread
3585                                 dflt=''
3586                                 case "$ans" in
3587                                 y*) type='';;
3588                                 *) echo " ";;
3589                                 esac
3590                                 ;;
3591                         esac
3592                         ;;
3593                 esac
3594                 ;;
3595         esac
3596 done
3597 cd UU
3598 ans="$value"
3599 rp="$orig_rp"
3600 dflt="$orig_dflt"
3601 rm -f getfile.ok
3602 test "X$gfpthkeep" != Xy && gfpth=""
3603 EOSC
3604
3605 : What should the include directory be ?
3606 echo " "
3607 $echo $n "Hmm...  $c"
3608 dflt='/usr/include'
3609 incpath=''
3610 mips_type=''
3611 if $test -f /bin/mips && /bin/mips; then
3612         echo "Looks like a MIPS system..."
3613         $cat >usr.c <<'EOCP'
3614 #ifdef SYSTYPE_BSD43
3615 /bsd43
3616 #endif
3617 EOCP
3618         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3619                 dflt='/bsd43/usr/include'
3620                 incpath='/bsd43'
3621                 mips_type='BSD 4.3'
3622         else
3623                 mips_type='System V'
3624         fi
3625         $rm -f usr.c usr.out
3626         echo "and you're compiling with the $mips_type compiler and libraries."
3627         xxx_prompt=y
3628         echo "exit 0" >mips
3629 else
3630         echo "Doesn't look like a MIPS system."
3631         xxx_prompt=n
3632         echo "exit 1" >mips
3633 fi
3634 chmod +x mips
3635 $eunicefix mips
3636 case "$usrinc" in
3637 '') ;;
3638 *) dflt="$usrinc";;
3639 esac
3640 case "$xxx_prompt" in
3641 y)      fn=d/
3642         echo " "
3643         rp='Where are the include files you want to use?'
3644         . ./getfile
3645         usrinc="$ans"
3646         ;;
3647 *)      usrinc="$dflt"
3648         ;;
3649 esac
3650
3651 : Set private lib path
3652 case "$plibpth" in
3653 '') if ./mips; then
3654                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3655         fi;;
3656 esac
3657 case "$libpth" in
3658 ' ') dlist='';;
3659 '') dlist="$loclibpth $plibpth $glibpth";;
3660 *) dlist="$libpth";;
3661 esac
3662
3663 : Now check and see which directories actually exist, avoiding duplicates
3664 libpth=''
3665 for xxx in $dlist
3666 do
3667     if $test -d $xxx; then
3668                 case " $libpth " in
3669                 *" $xxx "*) ;;
3670                 *) libpth="$libpth $xxx";;
3671                 esac
3672     fi
3673 done
3674 $cat <<'EOM'
3675
3676 Some systems have incompatible or broken versions of libraries.  Among
3677 the directories listed in the question below, please remove any you
3678 know not to be holding relevant libraries, and add any that are needed.
3679 Say "none" for none.
3680
3681 EOM
3682 case "$libpth" in
3683 '') dflt='none';;
3684 *)
3685         set X $libpth
3686         shift
3687         dflt=${1+"$@"}
3688         ;;
3689 esac
3690 rp="Directories to use for library searches?"
3691 . ./myread
3692 case "$ans" in
3693 none) libpth=' ';;
3694 *) libpth="$ans";;
3695 esac
3696
3697 : compute shared library extension
3698 case "$so" in
3699 '')
3700         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3701                 dflt='sl'
3702         else
3703                 dflt='so'
3704         fi
3705         ;;
3706 *) dflt="$so";;
3707 esac
3708 $cat <<EOM
3709
3710 On some systems, shared libraries may be available.  Answer 'none' if
3711 you want to suppress searching of shared libraries for the remainder
3712 of this configuration.
3713
3714 EOM
3715 rp='What is the file extension used for shared libraries?'
3716 . ./myread
3717 so="$ans"
3718
3719 : Define several unixisms.
3720 : Hints files or command line option can be used to override them.
3721 : The convoluted testing is in case hints files set either the old
3722 : or the new name.
3723 case "$_exe" in
3724 '')     case "$exe_ext" in
3725     '') ;;
3726         *)      _exe="$exe_ext" ;;
3727         esac
3728         ;;
3729 esac
3730 case "$_a" in
3731 '')     case "$lib_ext" in
3732     '') _a='.a';;
3733         *)      _a="$lib_ext" ;;
3734         esac
3735         ;;
3736 esac
3737 case "$_o" in
3738 '') case "$obj_ext" in
3739         '')     _o='.o';;
3740         *)      _o="$obj_ext";;
3741         esac
3742         ;;
3743 esac
3744 case "$p_" in
3745 '') case "$path_sep" in
3746         '')     p_=':';;
3747         *)      p_="$path_sep";;
3748         esac
3749         ;;
3750 esac
3751 exe_ext=$_exe
3752 lib_ext=$_a
3753 obj_ext=$_o
3754 path_sep=$p_
3755
3756 : Which makefile gets called first.  This is used by make depend.
3757 case "$firstmakefile" in
3758 '') firstmakefile='makefile';;
3759 esac
3760
3761 case "$usesocks" in
3762 $define|true|[yY]*)     dflt='y';;
3763 *) dflt='n';;
3764 esac
3765 cat <<EOM
3766
3767 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3768 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3769 to use the PerlIO abstraction layer, this will be implicitly selected.
3770
3771 If this doesn't make any sense to you, just accept the default '$dflt'.
3772 EOM
3773 rp='Build Perl for SOCKS?'
3774 . ./myread
3775 case "$ans" in
3776 y|Y)    val="$define" ;;     
3777 *)      val="$undef" ;;
3778 esac
3779 set usesocks
3780 eval $setvar
3781
3782 case "$usesocks" in
3783 $define|true|[yY]*) useperlio="$define";;
3784 esac
3785
3786 : Looking for optional libraries
3787 echo " "
3788 echo "Checking for optional libraries..." >&4
3789 case "$libs" in
3790 ' '|'') dflt='';;
3791 *) dflt="$libs";;
3792 esac
3793 case "$libswanted" in
3794 '') libswanted='c_s';;
3795 esac
3796 case "$usesocks" in
3797 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3798 esac
3799 libsfound=''
3800 libsfiles=''
3801 libsdirs=''
3802 libspath=''
3803 for thisdir in $libpth $xlibpth; do
3804   test -d $thisdir && libspath="$libspath $thisdir"
3805 done
3806 for thislib in $libswanted; do
3807         for thisdir in $libspath; do
3808             xxx=''
3809             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3810                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3811                 $test -f "$xxx" && eval $libscheck
3812                 $test -f "$xxx" && libstyle=shared
3813             fi
3814             if test ! -f "$xxx"; then
3815                 xxx=$thisdir/lib$thislib.$so
3816                 $test -f "$xxx" && eval $libscheck
3817                 $test -f "$xxx" && libstyle=shared
3818             fi  
3819             if test ! -f "$xxx"; then
3820                 xxx=$thisdir/lib$thislib$_a
3821                 $test -f "$xxx" && eval $libscheck
3822                 $test -f "$xxx" && libstyle=static
3823             fi
3824             if test ! -f "$xxx"; then
3825                 xxx=$thisdir/$thislib$_a
3826                 $test -f "$xxx" && eval $libscheck
3827                 $test -f "$xxx" && libstyle=static
3828             fi
3829             if test ! -f "$xxx"; then
3830                 xxx=$thisdir/lib${thislib}_s$_a
3831                 $test -f "$xxx" && eval $libscheck
3832                 $test -f "$xxx" && libstyle=static
3833                 $test -f "$xxx" && thislib=${thislib}_s
3834             fi
3835             if test ! -f "$xxx"; then
3836                 xxx=$thisdir/Slib$thislib$_a
3837                 $test -f "$xxx" && eval $libscheck
3838                 $test -f "$xxx" && libstyle=static
3839             fi
3840             if $test -f "$xxx"; then
3841                 case "$libstyle" in
3842                 shared) echo "Found -l$thislib (shared)." ;;
3843                 static) echo "Found -l$thislib." ;;
3844                 *)      echo "Found -l$thislib ($libstyle)." ;;
3845                 esac
3846                 case " $dflt " in
3847                 *"-l$thislib "*);;
3848                 *) dflt="$dflt -l$thislib"
3849                    libsfound="$libsfound $xxx"
3850                    yyy=`basename $xxx`
3851                    libsfiles="$libsfiles $yyy"
3852                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3853                    case " $libsdirs " in
3854                    *" $yyy "*) ;;
3855                    *) libsdirs="$libsdirs $yyy" ;;
3856                    esac
3857                    ;;
3858                 esac
3859                 break
3860             fi  
3861         done
3862         if $test ! -f "$xxx"; then
3863             echo "No -l$thislib."
3864         fi
3865 done
3866 set X $dflt
3867 shift
3868 dflt="$*"
3869 case "$libs" in
3870 '') dflt="$dflt";;
3871 *) dflt="$libs";;
3872 esac
3873 case "$dflt" in
3874 ' '|'') dflt='none';;
3875 esac
3876
3877 $cat <<EOM
3878
3879 In order to compile $package on your machine, a number of libraries
3880 are usually needed.  Include any other special libraries here as well.
3881 Say "none" for none.  The default list is almost always right.
3882 EOM
3883
3884 echo " "
3885 rp="What libraries to use?"
3886 . ./myread
3887 case "$ans" in
3888 none) libs=' ';;
3889 *) libs="$ans";;
3890 esac
3891
3892 : determine optimization, if desired, or use for debug flag also
3893 case "$optimize" in
3894 ' '|$undef) dflt='none';;
3895 '') dflt='-O';;
3896 *) dflt="$optimize";;
3897 esac
3898 $cat <<EOH
3899
3900 By default, $package compiles with the -O flag to use the optimizer.
3901 Alternately, you might want to use the symbolic debugger, which uses
3902 the -g flag (on traditional Unix systems).  Either flag can be
3903 specified here.  To use neither flag, specify the word "none".
3904
3905 EOH
3906 rp="What optimizer/debugger flag should be used?"
3907 . ./myread
3908 optimize="$ans"
3909 case "$optimize" in
3910 'none') optimize=" ";;
3911 esac
3912
3913 dflt=''
3914 : We will not override a previous value, but we might want to
3915 : augment a hint file
3916 case "$hint" in
3917 default|recommended)
3918         case "$gccversion" in
3919         1*) dflt='-fpcc-struct-return' ;;
3920         esac
3921         case "$optimize" in
3922         *-g*) dflt="$dflt -DDEBUGGING";;
3923         esac
3924         case "$gccversion" in
3925         2*) if test -d /etc/conf/kconfig.d &&
3926                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3927                 then
3928                         dflt="$dflt -posix"
3929                 fi
3930                 ;;
3931         esac
3932         case "$gccversion" in
3933         1*) ;;
3934         2.[0-8]*) ;;
3935         ?*)     echo " "
3936                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3937                 echo 'int main(void) { return 0; }' > gcctest.c
3938                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3939                         echo "Yes, it does." 2>&1
3940                         case "$ccflags" in
3941                         *strict-aliasing*) 
3942                                 echo "Leaving current flags $ccflags alone." 2>&1
3943                                 ;;
3944                         *) dflt="$dflt -fno-strict-aliasing" ;;
3945                         esac
3946                 else
3947                         echo "Nope, it doesn't, but that's ok." 2>&1
3948                 fi
3949                 ;;
3950         esac
3951         ;;
3952 esac
3953
3954 case "$mips_type" in
3955 *BSD*|'') inclwanted="$locincpth $usrinc";;
3956 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3957 esac
3958 for thisincl in $inclwanted; do
3959         if $test -d $thisincl; then
3960                 if $test x$thisincl != x$usrinc; then
3961                         case "$dflt" in
3962                         *" -I$thisincl "*);;
3963                         *) dflt="$dflt -I$thisincl ";;
3964                         esac
3965                 fi
3966         fi
3967 done
3968
3969 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3970         xxx=true;
3971 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3972         xxx=true;
3973 else
3974         xxx=false;
3975 fi;
3976 if $xxx; then
3977         case "$dflt" in
3978         *$2*);;
3979         *) dflt="$dflt -D$2";;
3980         esac;
3981 fi'
3982
3983 set signal.h LANGUAGE_C; eval $inctest
3984
3985 case "$usesocks" in
3986 $define)
3987         ccflags="$ccflags -DSOCKS"
3988         ;;
3989 esac
3990
3991 case "$hint" in
3992 default|recommended) dflt="$ccflags $dflt" ;;
3993 *) dflt="$ccflags";;
3994 esac
3995
3996 case "$dflt" in
3997 ''|' ') dflt=none;;
3998 esac
3999
4000 $cat <<EOH
4001
4002 Your C compiler may want other flags.  For this question you should include
4003 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4004 but you should NOT include libraries or ld flags like -lwhatever.  If you
4005 want $package to honor its debug switch, you should include -DDEBUGGING here.
4006 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4007
4008 To use no flags, specify the word "none".
4009
4010 EOH
4011 set X $dflt
4012 shift
4013 dflt=${1+"$@"}
4014 rp="Any additional cc flags?"
4015 . ./myread
4016 case "$ans" in
4017 none) ccflags='';;
4018 *) ccflags="$ans";;
4019 esac
4020
4021 : the following weeds options from ccflags that are of no interest to cpp
4022 cppflags="$ccflags"
4023 case "$gccversion" in
4024 1*) cppflags="$cppflags -D__GNUC__"
4025 esac
4026 case "$mips_type" in
4027 '');;
4028 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4029 esac
4030 case "$cppflags" in
4031 '');;
4032 *)
4033         echo " "
4034         echo "Let me guess what the preprocessor flags are..." >&4
4035         set X $cppflags
4036         shift
4037         cppflags=''
4038         $cat >cpp.c <<'EOM'
4039 #define BLURFL foo
4040
4041 BLURFL xx LFRULB
4042 EOM
4043         previous=''
4044         for flag in $*
4045         do
4046                 case "$flag" in
4047                 -*) ftry="$flag";;
4048                 *) ftry="$previous $flag";;
4049                 esac
4050                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4051                         >cpp1.out 2>/dev/null && \
4052                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4053                         >cpp2.out 2>/dev/null && \
4054                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4055                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4056                 then
4057                         cppflags="$cppflags $ftry"
4058                         previous=''
4059                 else
4060                         previous="$flag"
4061                 fi
4062         done
4063         set X $cppflags
4064         shift
4065         cppflags=${1+"$@"}
4066         case "$cppflags" in
4067         *-*)  echo "They appear to be: $cppflags";;
4068         esac
4069         $rm -f cpp.c cpp?.out
4070         ;;
4071 esac
4072
4073 : flags used in final linking phase
4074 case "$ldflags" in
4075 '') if ./venix; then
4076                 dflt='-i -z'
4077         else
4078                 dflt=''
4079         fi
4080         case "$ccflags" in
4081         *-posix*) dflt="$dflt -posix" ;;
4082         esac
4083         ;;
4084 *) dflt="$ldflags";;
4085 esac
4086
4087 : Try to guess additional flags to pick up local libraries.
4088 for thislibdir in $libpth; do
4089         case " $loclibpth " in
4090         *" $thislibdir "*)
4091                 case "$dflt " in 
4092                 *"-L$thislibdir "*) ;;
4093                 *)  dflt="$dflt -L$thislibdir" ;;
4094                 esac
4095                 ;;
4096         esac
4097 done
4098
4099 case "$dflt" in
4100 '') dflt='none' ;;
4101 esac
4102
4103 $cat <<EOH
4104
4105 Your C linker may need flags.  For this question you should
4106 include -L/whatever and any other flags used by the C linker, but you
4107 should NOT include libraries like -lwhatever.
4108
4109 Make sure you include the appropriate -L/path flags if your C linker
4110 does not normally search all of the directories you specified above,
4111 namely
4112         $libpth
4113 To use no flags, specify the word "none".
4114
4115 EOH
4116
4117 rp="Any additional ld flags (NOT including libraries)?"
4118 . ./myread
4119 case "$ans" in
4120 none) ldflags='';;
4121 *) ldflags="$ans";;
4122 esac
4123 rmlist="$rmlist pdp11"
4124
4125 : coherency check
4126 echo " "
4127 echo "Checking your choice of C compiler and flags for coherency..." >&4
4128 $cat > try.c <<'EOF'
4129 #include <stdio.h>
4130 int main() { printf("Ok\n"); exit(0); }
4131 EOF
4132 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4133 shift
4134 $cat >try.msg <<'EOM'
4135 I've tried to compile and run the following simple program:
4136
4137 EOM
4138 $cat try.c >> try.msg
4139
4140 $cat >> try.msg <<EOM
4141
4142 I used the command:
4143
4144         $*
4145         ./try
4146
4147 and I got the following output:
4148
4149 EOM
4150 dflt=y
4151 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4152         if $sh -c './try' >>try.msg 2>&1; then
4153                 xxx=`./try`
4154                 case "$xxx" in
4155                 "Ok") dflt=n ;;
4156                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4157                         case " $libs " in
4158                         *" -lsfio "*)
4159                                 cat >> try.msg <<'EOQS'
4160 If $libs contains -lsfio, and sfio is mis-configured, then it
4161 sometimes (apparently) runs and exits with a 0 status, but with no
4162 output!  It may have to do with sfio's use of _exit vs. exit.
4163
4164 EOQS
4165                                 rp="You have a big problem.  Shall I abort Configure"
4166                                 dflt=y
4167                                 ;;
4168                         esac
4169                         ;;
4170                 esac
4171         else
4172                 echo "The program compiled OK, but exited with status $?." >>try.msg
4173                 rp="You have a problem.  Shall I abort Configure"
4174                 dflt=y
4175         fi
4176 else
4177         echo "I can't compile the test program." >>try.msg
4178         rp="You have a BIG problem.  Shall I abort Configure"
4179         dflt=y
4180 fi
4181 case "$dflt" in
4182 y)
4183         $cat try.msg >&4
4184         case "$knowitall" in
4185         '')
4186                 echo "(The supplied flags or libraries might be incorrect.)"
4187                 ;;
4188         *) dflt=n;;
4189         esac
4190         echo " "
4191         . ./myread
4192         case "$ans" in
4193         n*|N*) ;;
4194         *)      echo "Ok.  Stopping Configure." >&4
4195                 exit 1
4196                 ;;
4197         esac
4198         ;;
4199 n) echo "OK, that should do.";;
4200 esac
4201 $rm -f try try.* core
4202
4203 : define an is-a-typedef? function
4204 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4205 case "$inclist" in
4206 "") inclist="sys/types.h";;
4207 esac;
4208 eval "varval=\$$var";
4209 case "$varval" in
4210 "")
4211         $rm -f temp.c;
4212         for inc in $inclist; do
4213                 echo "#include <$inc>" >>temp.c;
4214         done;
4215         echo "#ifdef $type" >> temp.c;
4216         echo "printf(\"We have $type\");" >> temp.c;
4217         echo "#endif" >> temp.c;
4218         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4219         if $contains $type temp.E >/dev/null 2>&1; then
4220                 eval "$var=\$type";
4221         else
4222                 eval "$var=\$def";
4223         fi;
4224         $rm -f temp.?;;
4225 *) eval "$var=\$varval";;
4226 esac'
4227
4228 : define an is-a-typedef? function that prompts if the type is not available.
4229 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4230 case "$inclist" in
4231 "") inclist="sys/types.h";;
4232 esac;
4233 eval "varval=\$$var";
4234 case "$varval" in
4235 "")
4236         $rm -f temp.c;
4237         for inc in $inclist; do
4238                 echo "#include <$inc>" >>temp.c;
4239         done;
4240         echo "#ifdef $type" >> temp.c;
4241         echo "printf(\"We have $type\");" >> temp.c;
4242         echo "#endif" >> temp.c;
4243         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4244         echo " " ;
4245         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4246         if $contains $type temp.E >/dev/null 2>&1; then
4247                 echo "$type found." >&4;
4248                 eval "$var=\$type";
4249         else
4250                 echo "$type NOT found." >&4;
4251                 dflt="$def";
4252                 . ./myread ;
4253                 eval "$var=\$ans";
4254         fi;
4255         $rm -f temp.?;;
4256 *) eval "$var=\$varval";;
4257 esac'
4258
4259 : define a shorthand compile call
4260 compile='
4261 mc_file=$1;
4262 shift;
4263 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4264 : define a shorthand compile call for compilations that should be ok.
4265 compile_ok='
4266 mc_file=$1;
4267 shift;
4268 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4269
4270 : check for lengths of integral types
4271 echo " "
4272 case "$intsize" in
4273 '')
4274         echo "Checking to see how big your integers are..." >&4
4275         $cat >intsize.c <<'EOCP'
4276 #include <stdio.h>
4277 int main()
4278 {
4279         printf("intsize=%d;\n", (int)sizeof(int));
4280         printf("longsize=%d;\n", (int)sizeof(long));
4281         printf("shortsize=%d;\n", (int)sizeof(short));
4282         exit(0);
4283 }
4284 EOCP
4285         set intsize
4286         if eval $compile_ok && ./intsize > /dev/null; then
4287                 eval `./intsize`
4288                 echo "Your integers are $intsize bytes long."
4289                 echo "Your long integers are $longsize bytes long."
4290                 echo "Your short integers are $shortsize bytes long."
4291         else
4292                 $cat >&4 <<EOM
4293 !
4294 Help! I can't compile and run the intsize test program: please enlighten me!
4295 (This is probably a misconfiguration in your system or libraries, and
4296 you really ought to fix it.  Still, I'll try anyway.)
4297 !
4298 EOM
4299                 dflt=4
4300                 rp="What is the size of an integer (in bytes)?"
4301                 . ./myread
4302                 intsize="$ans"
4303                 dflt=$intsize
4304                 rp="What is the size of a long integer (in bytes)?"
4305                 . ./myread
4306                 longsize="$ans"
4307                 dflt=2
4308                 rp="What is the size of a short integer (in bytes)?"
4309                 . ./myread
4310                 shortsize="$ans"
4311         fi
4312         ;;
4313 esac
4314 $rm -f intsize intsize.*
4315
4316 : see what type lseek is declared as in the kernel
4317 rp="What is the type used for lseek's offset on this system?"
4318 set off_t lseektype long stdio.h sys/types.h
4319 eval $typedef_ask
4320
4321 echo " "
4322 echo "Checking to see how big your file offsets are..." >&4
4323 $cat >try.c <<EOCP
4324 #include <sys/types.h>
4325 #include <stdio.h>
4326 int main()
4327 {
4328     printf("%d\n", (int)sizeof($lseektype));
4329     return(0); 
4330 }
4331 EOCP
4332 set try
4333 if eval $compile_ok; then
4334         lseeksize=`./try`
4335         echo "Your file offsets are $lseeksize bytes long."
4336 else
4337         dflt=$longsize
4338         echo " "
4339         echo "(I can't seem to compile the test program.  Guessing...)"
4340         rp="What is the size of your file offsets (in bytes)?"
4341         . ./myread
4342         lseeksize="$ans"
4343 fi
4344 $rm -f try.c try
4345
4346 : see what type file positions are declared as in the library
4347 rp="What is the type for file position used by fsetpos()?"
4348 set fpos_t fpostype long stdio.h sys/types.h
4349 eval $typedef_ask
4350
4351 echo " "
4352 case "$fpostype" in
4353 *_t) zzz="$fpostype"    ;;
4354 *)   zzz="fpos_t"       ;;
4355 esac
4356 echo "Checking the size of $zzz..." >&4 
4357 cat > try.c <<EOCP
4358 #include <sys/types.h>
4359 #include <stdio.h>
4360 int main() {
4361     printf("%d\n", (int)sizeof($fpostype));
4362     exit(0);
4363 }
4364 EOCP
4365 set try
4366 if eval $compile_ok; then
4367         yyy=`./try`
4368         case "$yyy" in
4369         '')     fpossize=4
4370                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4371                 ;;
4372         *)      fpossize=$yyy
4373                 echo "Your $zzz is $fpossize bytes long."
4374                 ;;
4375         esac
4376 else
4377         dflt="$longsize"
4378         echo " " >&4
4379         echo "(I can't compile the test program.  Guessing...)" >&4
4380         rp="What is the size of your file positions (in bytes)?"
4381         . ./myread
4382         fpossize="$ans"
4383 fi
4384
4385
4386
4387 # Backward compatibility (uselfs is deprecated).
4388 case "$uselfs" in
4389 "$define"|true|[yY]*)
4390         cat <<EOM >&4
4391
4392 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4393 EOM
4394         uselargefiles="$define"
4395         ;;
4396 esac                          
4397
4398 case "$lseeksize:$fpossize" in
4399 8:8) cat <<EOM
4400
4401 You can have files larger than 2 gigabytes.
4402 EOM
4403    val="$define" ;;
4404 *)    case "$uselargefiles" in
4405    "$undef"|false|[nN]*) dflt='n' ;;
4406    *)   dflt='y' ;;
4407    esac
4408    cat <<EOM
4409
4410 Perl can be built to understand large files (files larger than 2 gigabytes)
4411 on some systems.  To do so, Configure can be run with -Duselargefiles.
4412
4413 If this doesn't make any sense to you, just accept the default '$dflt'.
4414 EOM
4415    rp='Try to understand large files, if available?'
4416    . ./myread
4417    case "$ans" in
4418    y|Y)         val="$define" ;;
4419    *)           val="$undef"  ;;
4420    esac
4421    ;;
4422 esac
4423 set uselargefiles
4424 eval $setvar
4425 case "$uselargefiles" in
4426 "$define")
4427 : Look for a hint-file generated 'call-back-unit'.  If the
4428 : user has specified that a large files perl is to be built,
4429 : we may need to set or change some other defaults.
4430         if $test -f uselargefiles.cbu; then
4431                 echo "Your platform has some specific hints for large file builds, using them..."
4432                 . ./uselargefiles.cbu
4433                 echo " "
4434                 echo "Rechecking to see how big your file offsets are..." >&4
4435                 $cat >try.c <<EOCP
4436 #include <sys/types.h>
4437 #include <stdio.h>
4438 int main()
4439 {
4440     printf("%d\n", (int)sizeof($lseektype));
4441     return(0); 
4442 }
4443 EOCP
4444                 set try
4445                 if eval $compile_ok; then
4446                         lseeksize=`./try`
4447                         $echo "Your file offsets are now $lseeksize bytes long."
4448                 else
4449                         dflt="$lseeksize"
4450                         echo " "
4451                         echo "(I can't seem to compile the test program.  Guessing...)"
4452                         rp="What is the size of your file offsets (in bytes)?"
4453                         . ./myread
4454                         lseeksize="$ans"
4455                 fi
4456                 case "$fpostype" in
4457                 *_t) zzz="$fpostype"    ;;
4458                 *)   zzz="fpos_t"       ;;
4459                 esac
4460                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4461                 $cat > try.c <<EOCP
4462 #include <sys/types.h>
4463 #include <stdio.h>
4464 int main() {
4465     printf("%d\n", (int)sizeof($fpostype));
4466     exit(0);
4467 }
4468 EOCP
4469                 set try
4470                 if eval $compile_ok; then
4471                         yyy=`./try`
4472                         dflt="$lseeksize"
4473                         case "$yyy" in
4474                         '')     echo " "
4475                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4476                                 ;;
4477                         *)      fpossize=$yyy
4478                                 echo " $fpossize bytes." >&4
4479                                 ;;
4480                         esac
4481                 else
4482                         dflt="$fpossize"
4483                         echo " "
4484                         echo "(I can't compile the test program.  Guessing...)" >&4
4485                         rp="What is the size of your file positions (in bytes)?"
4486                         . ./myread
4487                         fpossize="$ans"
4488                 fi
4489                 $rm -f try.c try
4490         fi
4491         ;;
4492 esac
4493
4494
4495 case "$usemorebits" in
4496 "$define"|true|[yY]*)
4497         use64bitint="$define"
4498         uselongdouble="$define"
4499         usemorebits="$define"
4500         ;;
4501 *)      usemorebits="$undef"
4502         ;;
4503 esac
4504
4505
4506 case "$uselonglong" in
4507 "$define"|true|[yY]*)
4508         cat <<EOM >&4
4509
4510 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4511 EOM
4512         use64bitint="$define"
4513         ;;
4514 esac                          
4515 case "$use64bits" in
4516 "$define"|true|[yY]*)
4517         cat <<EOM >&4
4518
4519 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4520 EOM
4521         use64bitint="$define"
4522         ;;
4523 esac                          
4524 case "$use64bitints" in
4525 "$define"|true|[yY]*)
4526         cat <<EOM >&4
4527
4528 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4529 EOM
4530         use64bitint="$define"
4531         ;;
4532 esac                          
4533 case "$use64bitsint" in
4534 "$define"|true|[yY]*)
4535         cat <<EOM >&4
4536
4537 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4538 EOM
4539         use64bitint="$define"
4540         ;;
4541 esac                          
4542 case "$uselonglongs" in
4543 "$define"|true|[yY]*)
4544         cat <<EOM >&4
4545
4546 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4547 EOM
4548         use64bitint="$define"
4549         ;;
4550 esac                          
4551 case "$use64bitsall" in
4552 "$define"|true|[yY]*)
4553         cat <<EOM >&4
4554
4555 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4556 EOM
4557         use64bitall="$define"
4558         ;;
4559 esac                          
4560
4561 case "$ccflags" in
4562 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4563 esac
4564 case "$use64bitall" in
4565 "$define"|true|[yY]*) use64bitint="$define" ;;
4566 esac
4567
4568 case "$longsize" in
4569 8) cat <<EOM
4570
4571 You have natively 64-bit long integers.
4572 EOM
4573    val="$define"
4574    ;;
4575 *) case "$use64bitint" in
4576    "$define"|true|[yY]*) dflt='y';;
4577    *) dflt='n';;
4578    esac
4579    cat <<EOM
4580
4581 Perl can be built to take advantage of 64-bit integer types
4582 on some systems.  To do so, Configure can be run with -Duse64bitint.
4583 Choosing this option will most probably introduce binary incompatibilities.
4584
4585 If this doesn't make any sense to you, just accept the default '$dflt'.
4586 EOM
4587    rp='Try to use 64-bit integers, if available?'
4588    . ./myread
4589    case "$ans" in
4590    [yY]*) val="$define" ;;
4591    *)     val="$undef"  ;;
4592    esac
4593    ;;
4594 esac
4595 set use64bitint
4596 eval $setvar
4597
4598 case "$use64bitall" in
4599 "$define"|true|[yY]*) dflt='y' ;;
4600 *) case "$longsize" in
4601    8) dflt='y' ;;
4602    *) dflt='n' ;;
4603    esac
4604    ;;
4605 esac    
4606 cat <<EOM
4607
4608 You may also choose to try maximal 64-bitness.  It means using as much
4609 64-bitness as possible on the platform.  This in turn means even more
4610 binary incompatibilities.  On the other hand, your platform may not
4611 have any more 64-bitness available than what you already have chosen.
4612
4613 If this doesn't make any sense to you, just accept the default '$dflt'.
4614 EOM
4615 rp='Try to use maximal 64-bit support, if available?'
4616 . ./myread
4617 case "$ans" in
4618 [yY]*) val="$define" ;;
4619 *)     val="$undef"  ;;
4620 esac
4621 set use64bitall
4622 eval $setvar
4623 case "$use64bitall" in
4624 "$define")
4625         case "$use64bitint" in
4626         "$undef")
4627                 cat <<EOM
4628
4629 Since you have chosen a maximally 64-bit build, I'm also turning on
4630 the use of 64-bit integers.
4631 EOM
4632                 use64bitint="$define" ;;
4633         esac
4634         ;;
4635 esac
4636
4637 case "$use64bitint" in
4638 "$define"|true|[yY]*)
4639 : Look for a hint-file generated 'call-back-unit'.  If the
4640 : user has specified that a 64-bit perl is to be built,
4641 : we may need to set or change some other defaults.
4642         if $test -f use64bitint.cbu; then
4643                 echo "Your platform has some specific hints for 64-bit integers, using them..."
4644                 . ./use64bitint.cbu
4645         fi
4646         case "$longsize" in
4647         4) case "$archname64" in
4648            '') archname64=64int ;;
4649            esac
4650            ;;
4651         esac
4652         ;;
4653 esac
4654
4655 case "$use64bitall" in
4656 "$define"|true|[yY]*)
4657 : Look for a hint-file generated 'call-back-unit'.  If the
4658 : user has specified that a maximally 64-bit perl is to be built,
4659 : we may need to set or change some other defaults.
4660         if $test -f use64bitall.cbu; then
4661                 echo "Your platform has some specific hints for 64-bit builds, using them..."
4662                 . ./use64bitall.cbu
4663         fi
4664         case "$longsize" in
4665         4) case "$archname64" in
4666            ''|64int) archname64=64all ;;
4667            esac
4668            ;;
4669         esac
4670         ;;
4671 esac
4672
4673 echo " "
4674 echo "Checking for GNU C Library..." >&4
4675 cat >gnulibc.c <<EOM
4676 #include <stdio.h>
4677 int main()
4678 {
4679 #ifdef __GLIBC__
4680     exit(0);
4681 #else
4682     exit(1);
4683 #endif
4684 }
4685 EOM
4686 set gnulibc
4687 if eval $compile_ok && ./gnulibc; then
4688         val="$define"
4689         echo "You are using the GNU C Library"
4690 else
4691         val="$undef"
4692         echo "You are not using the GNU C Library"
4693 fi
4694 $rm -f gnulibc*
4695 set d_gnulibc
4696 eval $setvar
4697
4698 : see if nm is to be used to determine whether a symbol is defined or not
4699 case "$usenm" in
4700 '')
4701         dflt=''
4702         case "$d_gnulibc" in
4703         "$define")
4704                 echo " "
4705                 echo "nm probably won't work on the GNU C Library." >&4
4706                 dflt=n
4707                 ;;
4708         esac
4709         case "$dflt" in
4710         '') 
4711                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4712                         echo " "
4713                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4714                         echo "'nm' won't be sufficient on this sytem." >&4
4715                         dflt=n
4716                 fi
4717                 ;;
4718         esac
4719         case "$dflt" in
4720         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4721                 if $test $dflt -gt 20; then
4722                         dflt=y
4723                 else
4724                         dflt=n
4725                 fi
4726                 ;;
4727         esac
4728         ;;
4729 *)
4730         case "$usenm" in
4731         true|$define) dflt=y;;
4732         *) dflt=n;;
4733         esac
4734         ;;
4735 esac
4736 $cat <<EOM
4737
4738 I can use $nm to extract the symbols from your C libraries. This
4739 is a time consuming task which may generate huge output on the disk (up
4740 to 3 megabytes) but that should make the symbols extraction faster. The
4741 alternative is to skip the 'nm' extraction part and to compile a small
4742 test program instead to determine whether each symbol is present. If
4743 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4744 this may be the best solution.
4745
4746 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4747
4748 EOM
4749 rp="Shall I use $nm to extract C symbols from the libraries?"
4750 . ./myread
4751 case "$ans" in
4752 [Nn]*) usenm=false;;
4753 *) usenm=true;;
4754 esac
4755
4756 runnm=$usenm
4757 case "$reuseval" in
4758 true) runnm=false;;
4759 esac
4760
4761 : nm options which may be necessary
4762 case "$nm_opt" in
4763 '') if $test -f /mach_boot; then
4764                 nm_opt=''       # Mach
4765         elif $test -d /usr/ccs/lib; then
4766                 nm_opt='-p'     # Solaris (and SunOS?)
4767         elif $test -f /dgux; then
4768                 nm_opt='-p'     # DG-UX
4769         elif $test -f /lib64/rld; then
4770                 nm_opt='-p'     # 64-bit Irix
4771         else
4772                 nm_opt=''
4773         fi;;
4774 esac
4775
4776 : nm options which may be necessary for shared libraries but illegal
4777 : for archive libraries.  Thank you, Linux.
4778 case "$nm_so_opt" in
4779 '')     case "$myuname" in
4780         *linux*)
4781                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4782                         nm_so_opt='--dynamic'
4783                 fi
4784                 ;;
4785         esac
4786         ;;
4787 esac
4788
4789 case "$runnm" in
4790 true)
4791 : get list of predefined functions in a handy place
4792 echo " "
4793 case "$libc" in
4794 '') libc=unknown
4795         case "$libs" in
4796         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
4797         esac
4798         ;;
4799 esac
4800 libnames='';
4801 case "$libs" in
4802 '') ;;
4803 *)  for thislib in $libs; do
4804         case "$thislib" in
4805         -lc|-lc_s)
4806                 : Handle C library specially below.
4807                 ;;
4808         -l*)
4809                 thislib=`echo $thislib | $sed -e 's/^-l//'`
4810                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4811                         :
4812                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4813                         :
4814                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4815                         :
4816                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4817                         :
4818                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4819                         :
4820                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4821                         :
4822                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4823                         :
4824                 else
4825                         try=''
4826                 fi
4827                 libnames="$libnames $try"
4828                 ;;
4829         *) libnames="$libnames $thislib" ;;
4830         esac
4831         done
4832         ;;
4833 esac
4834 xxx=normal
4835 case "$libc" in
4836 unknown)
4837         set /lib/libc.$so
4838         for xxx in $libpth; do
4839                 $test -r $1 || set $xxx/libc.$so
4840                 : The messy sed command sorts on library version numbers.
4841                 $test -r $1 || \
4842                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4843                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
4844                                 h
4845                                 s/[0-9][0-9]*/0000&/g
4846                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4847                                 G
4848                                 s/\n/ /' | \
4849                          $sort | $sed -e 's/^.* //'`
4850                 eval set \$$#
4851         done
4852         $test -r $1 || set /usr/ccs/lib/libc.$so
4853         $test -r $1 || set /lib/libsys_s$_a
4854         ;;
4855 *)
4856         set blurfl
4857         ;;
4858 esac
4859 if $test -r "$1"; then
4860         echo "Your (shared) C library seems to be in $1."
4861         libc="$1"
4862 elif $test -r /lib/libc && $test -r /lib/clib; then
4863         echo "Your C library seems to be in both /lib/clib and /lib/libc."
4864         xxx=apollo
4865         libc='/lib/clib /lib/libc'
4866         if $test -r /lib/syslib; then
4867                 echo "(Your math library is in /lib/syslib.)"
4868                 libc="$libc /lib/syslib"
4869         fi
4870 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4871         echo "Your C library seems to be in $libc, as you said before."
4872 elif $test -r $incpath/usr/lib/libc$_a; then
4873         libc=$incpath/usr/lib/libc$_a;
4874         echo "Your C library seems to be in $libc.  That's fine."
4875 elif $test -r /lib/libc$_a; then
4876         libc=/lib/libc$_a;
4877         echo "Your C library seems to be in $libc.  You're normal."
4878 else
4879         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
4880                 :
4881         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
4882                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
4883         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
4884                 :
4885         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4886                 :
4887         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4888                 :
4889         else
4890                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4891         fi
4892         if $test -r "$tans"; then
4893                 echo "Your C library seems to be in $tans, of all places."
4894                 libc=$tans
4895         else
4896                 libc='blurfl'
4897         fi
4898 fi
4899 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4900         dflt="$libc"
4901         cat <<EOM
4902
4903 If the guess above is wrong (which it might be if you're using a strange
4904 compiler, or your machine supports multiple models), you can override it here.
4905
4906 EOM
4907 else
4908         dflt=''
4909         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
4910         cat >&4 <<EOM
4911 I can't seem to find your C library.  I've looked in the following places:
4912
4913 EOM
4914         $sed 's/^/      /' libpath
4915         cat <<EOM
4916
4917 None of these seems to contain your C library. I need to get its name...
4918
4919 EOM
4920 fi
4921 fn=f
4922 rp='Where is your C library?'
4923 . ./getfile
4924 libc="$ans"
4925
4926 echo " "
4927 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
4928 set X `cat libnames`
4929 shift
4930 xxx=files
4931 case $# in 1) xxx=file; esac
4932 echo "Extracting names from the following $xxx for later perusal:" >&4
4933 echo " "
4934 $sed 's/^/      /' libnames >&4
4935 echo " "
4936 $echo $n "This may take a while...$c" >&4
4937
4938 for file in $*; do
4939         case $file in
4940         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
4941         *) $nm $nm_opt $file 2>/dev/null;;
4942         esac
4943 done >libc.tmp
4944
4945 $echo $n ".$c"
4946 $grep fprintf libc.tmp > libc.ptf
4947 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
4948 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
4949 xxx='[ADTSIW]'
4950 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
4951         eval $xscan;\
4952         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4953                 eval $xrun
4954 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
4955         eval $xscan;\
4956         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4957                 eval $xrun
4958 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
4959         eval $xscan;\
4960         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4961                 eval $xrun
4962 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
4963         eval $xscan;\
4964         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4965                 eval $xrun
4966 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
4967         eval $xscan;\
4968         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4969                 eval $xrun
4970 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
4971         eval $xscan;\
4972         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4973                 eval $xrun
4974 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
4975                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
4976         eval $xscan;\
4977         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4978                 eval $xrun
4979 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
4980         eval $xscan;\
4981         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4982                 eval $xrun
4983 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
4984         eval $xscan;\
4985         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4986                 eval $xrun
4987 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
4988         eval $xscan;\
4989         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4990                 eval $xrun
4991 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
4992         eval $xscan;\
4993         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4994                 eval $xrun
4995 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
4996         eval $xscan;\
4997         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4998                 eval $xrun
4999 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5000         eval $xscan;\
5001         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5002                 eval $xrun
5003 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5004         eval $xscan;\
5005         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5006                 eval $xrun
5007 else
5008         $nm -p $* 2>/dev/null >libc.tmp
5009         $grep fprintf libc.tmp > libc.ptf
5010         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5011                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5012         then
5013                 nm_opt='-p'
5014                 eval $xrun
5015         else
5016                 echo " "
5017                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5018                 com=''
5019                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5020                         for thisname in $libnames $libc; do
5021                                 $ar t $thisname >>libc.tmp
5022                         done
5023                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5024                         echo "Ok." >&4
5025                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5026                         # Repeat libc to extract forwarders to DLL entries too
5027                         for thisname in $libnames $libc; do
5028                                 $ar tv $thisname >>libc.tmp
5029                                 # Revision 50 of EMX has bug in $ar.
5030                                 # it will not extract forwarders to DLL entries
5031                                 # Use emximp which will extract exactly them.
5032                                 emximp -o tmp.imp $thisname \
5033                                     2>/dev/null && \
5034                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5035                                     < tmp.imp >>libc.tmp
5036                                 $rm tmp.imp
5037                         done
5038                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5039                         echo "Ok." >&4
5040                 else
5041                         echo "$ar didn't seem to work right." >&4
5042                         echo "Maybe this is a Cray...trying bld instead..." >&4
5043                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5044                         then
5045                                 for thisname in $libnames; do
5046                                         bld t $libnames | \
5047                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5048                                         $ar t $thisname >>libc.tmp
5049                                 done
5050                                 echo "Ok." >&4
5051                         else
5052                                 echo "That didn't work either.  Giving up." >&4
5053                                 exit 1
5054                         fi
5055                 fi
5056         fi
5057 fi
5058 nm_extract="$com"
5059 if $test -f /lib/syscalls.exp; then
5060         echo " "
5061         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5062         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5063 fi
5064 ;;
5065 esac
5066 $rm -f libnames libpath
5067
5068 : is a C symbol defined?
5069 csym='tlook=$1;
5070 case "$3" in
5071 -v) tf=libc.tmp; tc=""; tdc="";;
5072 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5073 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5074 esac;
5075 tx=yes;
5076 case "$reuseval-$4" in
5077 true-) ;;
5078 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5079 esac;
5080 case "$tx" in
5081 yes)
5082         case "$runnm" in
5083         true)
5084                 if $contains $tlook $tf >/dev/null 2>&1;
5085                 then tval=true;
5086                 else tval=false;
5087                 fi;;
5088         *)
5089                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5090                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5091                 then tval=true;
5092                 else tval=false;
5093                 fi;
5094                 $rm -f t t.c;;
5095         esac;;
5096 *)
5097         case "$tval" in
5098         $define) tval=true;;
5099         *) tval=false;;
5100         esac;;
5101 esac;
5102 eval "$2=$tval"'
5103
5104 : define an is-in-libc? function
5105 inlibc='echo " "; td=$define; tu=$undef;
5106 sym=$1; var=$2; eval "was=\$$2";
5107 tx=yes;
5108 case "$reuseval$was" in
5109 true) ;;
5110 true*) tx=no;;
5111 esac;
5112 case "$tx" in
5113 yes)
5114         set $sym tres -f;
5115         eval $csym;
5116         case "$tres" in
5117         true)
5118                 echo "$sym() found." >&4;
5119                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5120         *)
5121                 echo "$sym() NOT found." >&4;
5122                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5123         esac;;
5124 *)
5125         case "$was" in
5126         $define) echo "$sym() found." >&4;;
5127         *) echo "$sym() NOT found." >&4;;
5128         esac;;
5129 esac'
5130
5131 : see if sqrtl exists
5132 set sqrtl d_sqrtl
5133 eval $inlibc
5134
5135 case "$ccflags" in
5136 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5137 esac
5138
5139 case "$uselongdouble" in
5140 $define|true|[yY]*)     dflt='y';;
5141 *) dflt='n';;
5142 esac
5143 cat <<EOM
5144
5145 Perl can be built to take advantage of long doubles which
5146 (if available) may give more accuracy and range for floating point numbers.
5147
5148 If this doesn't make any sense to you, just accept the default '$dflt'.
5149 EOM
5150 rp='Try to use long doubles if available?'
5151 . ./myread
5152 case "$ans" in
5153 y|Y)    val="$define"   ;;
5154 *)      val="$undef"    ;;
5155 esac
5156 set uselongdouble
5157 eval $setvar
5158
5159 case "$uselongdouble" in
5160 true|[yY]*) uselongdouble="$define" ;;
5161 esac
5162
5163 case "$uselongdouble" in
5164 $define)
5165 : Look for a hint-file generated 'call-back-unit'.  If the
5166 : user has specified that long doubles should be used,
5167 : we may need to set or change some other defaults.
5168         if $test -f uselongdouble.cbu; then
5169                 echo "Your platform has some specific hints for long doubles, using them..."
5170                 . ./uselongdouble.cbu
5171         else
5172                 $cat <<EOM
5173 (Your platform doesn't have any specific hints for long doubles.)
5174 EOM
5175         fi
5176         ;;
5177 esac
5178
5179 case "$uselongdouble:$d_sqrtl" in
5180 $define:$undef)
5181                 $cat <<EOM >&4
5182
5183 *** You requested the use of long doubles but you do not seem to have
5184 *** the mathematic functions for long doubles.  I'm disabling the use
5185 *** of long doubles.
5186
5187 EOM
5188         uselongdouble=$undef
5189         ;;
5190 esac
5191
5192 : check for length of double
5193 echo " "
5194 case "$doublesize" in
5195 '')
5196         echo "Checking to see how big your double precision numbers are..." >&4
5197         $cat >try.c <<'EOCP'
5198 #include <stdio.h>
5199 int main()
5200 {
5201     printf("%d\n", (int)sizeof(double));
5202     exit(0);
5203 }
5204 EOCP
5205         set try
5206         if eval $compile_ok; then
5207                 doublesize=`./try`
5208                 echo "Your double is $doublesize bytes long."
5209         else
5210                 dflt='8'
5211                 echo "(I can't seem to compile the test program.  Guessing...)"
5212                 rp="What is the size of a double precision number (in bytes)?"
5213                 . ./myread
5214                 doublesize="$ans"
5215         fi
5216         ;;
5217 esac
5218 $rm -f try.c try
5219
5220 : check for long doubles
5221 echo " "
5222 echo "Checking to see if you have long double..." >&4
5223 echo 'int main() { long double x = 7.0; }' > try.c
5224 set try
5225 if eval $compile; then
5226         val="$define"
5227         echo "You have long double."
5228 else
5229         val="$undef"
5230         echo "You do not have long double."
5231 fi
5232 $rm try.*
5233 set d_longdbl
5234 eval $setvar
5235
5236 : check for length of long double
5237 case "${d_longdbl}${longdblsize}" in
5238 $define)
5239         echo " "
5240         echo "Checking to see how big your long doubles are..." >&4
5241         $cat >try.c <<'EOCP'
5242 #include <stdio.h>
5243 int main()
5244 {
5245         printf("%d\n", sizeof(long double));
5246 }
5247 EOCP
5248         set try
5249         set try
5250         if eval $compile; then
5251                 longdblsize=`./try$exe_ext`
5252                 echo "Your long doubles are $longdblsize bytes long."
5253         else
5254                 dflt='8'
5255                 echo " "
5256                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5257                 rp="What is the size of a long double (in bytes)?"
5258                 . ./myread
5259                 longdblsize="$ans"
5260         fi
5261         if $test "X$doublesize" = "X$longdblsize"; then
5262                 echo "(That isn't any different from an ordinary double.)"
5263         fi      
5264         ;;
5265 esac
5266 $rm -f try.* try
5267
5268 : determine the architecture name
5269 echo " "
5270 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5271         tarch=`arch`"-$osname"
5272 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5273         if uname -m > tmparch 2>&1 ; then
5274                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5275                         -e 's/$/'"-$osname/" tmparch`
5276         else
5277                 tarch="$osname"
5278         fi
5279         $rm -f tmparch
5280 else
5281         tarch="$osname"
5282 fi
5283 case "$myarchname" in
5284 ''|"$tarch") ;;
5285 *)
5286         echo "(Your architecture name used to be $myarchname.)"
5287         archname=''
5288         ;;
5289 esac
5290 myarchname="$tarch"
5291 case "$archname" in
5292 '') dflt="$tarch";;
5293 *) dflt="$archname";;
5294 esac
5295 rp='What is your architecture name'
5296 . ./myread
5297 archname="$ans"
5298 case "$usethreads" in
5299 $define)
5300         echo "Threads selected." >&4
5301         case "$archname" in
5302         *-thread*) echo "...and architecture name already has -thread." >&4
5303                 ;;
5304         *)      archname="$archname-thread"
5305                 echo "...setting architecture name to $archname." >&4
5306                 ;;
5307         esac
5308         ;;
5309 esac
5310 case "$usemultiplicity" in
5311 $define)
5312         echo "Multiplicity selected." >&4
5313         case "$archname" in
5314         *-multi*) echo "...and architecture name already has -multi." >&4
5315                 ;;
5316         *)      archname="$archname-multi"
5317                 echo "...setting architecture name to $archname." >&4
5318                 ;;
5319         esac
5320         ;;
5321 esac
5322 case "$use64bitint$use64bitall" in
5323 *"$define"*)
5324         case "$archname64" in
5325         '')
5326                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5327                 ;;
5328         *)
5329                 case "$use64bitint" in
5330                 "$define") echo "64 bit integers selected." >&4 ;;
5331                 esac
5332                 case "$use64bitall" in
5333                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5334                 esac
5335                 case "$archname" in
5336                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5337                         ;;
5338                 *)      archname="$archname-$archname64"
5339                         echo "...setting architecture name to $archname." >&4
5340                         ;;
5341                 esac
5342                 ;;
5343         esac
5344 esac
5345 case "$uselongdouble" in
5346 $define)
5347         echo "Long doubles selected." >&4
5348         case "$longdblsize" in
5349         $doublesize)
5350                 "...but long doubles are equal to doubles, not changing architecture name." >&4
5351                 ;;
5352         *)
5353                 case "$archname" in
5354                 *-ld*) echo "...and architecture name already has -ld." >&4
5355                         ;;
5356                 *)      archname="$archname-ld"
5357                         echo "...setting architecture name to $archname." >&4
5358                         ;;
5359                 esac
5360                 ;;
5361         esac
5362         ;;
5363 esac
5364
5365 : determine root of directory hierarchy where package will be installed.
5366 case "$prefix" in
5367 '')
5368         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5369         ;;
5370 *)
5371         dflt="$prefix"
5372         ;;
5373 esac
5374 $cat <<EOM
5375
5376 By default, $package will be installed in $dflt/bin, manual pages
5377 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5378 installation directories. Typically this is something like /usr/local.
5379 If you wish to have binaries under /usr/bin but other parts of the
5380 installation under /usr/local, that's ok: you will be prompted
5381 separately for each of the installation directories, the prefix being
5382 only used to set the defaults.
5383
5384 EOM
5385 fn=d~
5386 rp='Installation prefix to use?'
5387 . ./getfile
5388 oldprefix=''
5389 case "$prefix" in
5390 '') ;;
5391 *)
5392         case "$ans" in
5393         "$prefix") ;;
5394         *) oldprefix="$prefix";;
5395         esac
5396         ;;
5397 esac
5398 prefix="$ans"
5399 prefixexp="$ansexp"
5400
5401 : is AFS running?
5402 echo " "
5403 case "$afs" in
5404 $define|true)   afs=true ;;
5405 $undef|false)   afs=false ;;
5406 *)      if test -d /afs; then
5407                 afs=true
5408         else
5409                 afs=false
5410         fi
5411         ;;
5412 esac
5413 if $afs; then
5414         echo "AFS may be running... I'll be extra cautious then..." >&4
5415 else
5416         echo "AFS does not seem to be running..." >&4
5417 fi
5418
5419 : determine installation prefix for where package is to be installed.
5420 if $afs; then 
5421 $cat <<EOM
5422
5423 Since you are running AFS, I need to distinguish the directory in which
5424 files will reside from the directory in which they are installed (and from
5425 which they are presumably copied to the former directory by occult means).
5426
5427 EOM
5428         case "$installprefix" in
5429         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5430         *) dflt="$installprefix";;
5431         esac
5432 else
5433 $cat <<EOM
5434
5435 In some special cases, particularly when building $package for distribution,
5436 it is convenient to distinguish between the directory in which files should 
5437 be installed from the directory ($prefix) in which they 
5438 will eventually reside.  For most users, these two directories are the same.
5439
5440 EOM
5441         case "$installprefix" in
5442         '') dflt=$prefix ;;
5443         *) dflt=$installprefix;;
5444         esac
5445 fi
5446 fn=d~
5447 rp='What installation prefix should I use for installing files?'
5448 . ./getfile
5449 installprefix="$ans"
5450 installprefixexp="$ansexp"
5451
5452 : set the prefixit variable, to compute a suitable default value
5453 prefixit='case "$3" in
5454 ""|none)
5455         case "$oldprefix" in
5456         "") eval "$1=\"\$$2\"";;
5457         *)
5458                 case "$3" in
5459                 "") eval "$1=";;
5460                 none)
5461                         eval "tp=\"\$$2\"";
5462                         case "$tp" in
5463                         ""|" ") eval "$1=\"\$$2\"";;
5464                         *) eval "$1=";;
5465                         esac;;
5466                 esac;;
5467         esac;;
5468 *)
5469         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5470         case "$tp" in
5471         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5472         /*-$oldprefix/*|\~*-$oldprefix/*)
5473                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5474         *) eval "$1=\"\$$2\"";;
5475         esac;;
5476 esac'
5477
5478
5479 : get the patchlevel
5480 echo " "
5481 echo "Getting the current patchlevel..." >&4
5482 if $test -r $rsrc/patchlevel.h;then
5483         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5484         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5485         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5486         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5487         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5488         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5489 else
5490         revision=0
5491         patchlevel=0
5492         subversion=0
5493         api_revision=0
5494         api_version=0
5495         api_subversion=0
5496 fi
5497 $echo "(You have $package version $patchlevel subversion $subversion.)"
5498 case "$osname" in
5499 dos|vms)
5500         : XXX Should be a Configure test for double-dots in filenames.
5501         version=`echo $revision $patchlevel $subversion | \
5502                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5503         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5504                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5505         ;;
5506 *)
5507         version=`echo $revision $patchlevel $subversion | \
5508                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5509         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5510                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5511         ;;
5512 esac
5513 : Special case the 5.005_xx maintenance series, which used 5.005
5514 : without any subversion label as a subdirectory in $sitelib
5515 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5516         api_versionstring='5.005'
5517 fi
5518
5519 : determine installation style
5520 : For now, try to deduce it from prefix unless it is already set.
5521 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5522 case "$installstyle" in
5523 '')     case "$prefix" in
5524                 *perl*) dflt='lib';;
5525                 *) dflt='lib/perl5' ;;
5526         esac
5527         ;;
5528 *)      dflt="$installstyle" ;;
5529 esac
5530 : Probably not worth prompting for this since we prompt for all
5531 : the directories individually, and the prompt would be too long and
5532 : confusing anyway.
5533 installstyle=$dflt
5534
5535 : determine where private library files go
5536 : Usual default is /usr/local/lib/perl5/$version.
5537 : Also allow things like /opt/perl/lib/$version, since 
5538 : /opt/perl/lib/perl5... would be redundant.
5539 : The default "style" setting is made in installstyle.U
5540 case "$installstyle" in
5541 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5542 *)       set dflt privlib lib/$version ;;
5543 esac
5544 eval $prefixit
5545 $cat <<EOM
5546
5547 There are some auxiliary files for $package that need to be put into a
5548 private library directory that is accessible by everyone.
5549
5550 EOM
5551 fn=d~+
5552 rp='Pathname where the private library files will reside?'
5553 . ./getfile
5554 privlib="$ans"
5555 privlibexp="$ansexp"
5556 : Change installation prefix, if necessary.
5557 if $test X"$prefix" != X"$installprefix"; then
5558         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5559 else
5560         installprivlib="$privlibexp"
5561 fi
5562
5563 : set the prefixup variable, to restore leading tilda escape
5564 prefixup='case "$prefixexp" in
5565 "$prefix") ;;
5566 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5567 esac'
5568
5569 : determine where public architecture dependent libraries go
5570 set archlib archlib
5571 eval $prefixit
5572 : privlib default is /usr/local/lib/$package/$version
5573 : archlib default is /usr/local/lib/$package/$version/$archname
5574 : privlib may have an optional trailing /share.
5575 tdflt=`echo $privlib | $sed 's,/share$,,'`
5576 tdflt=$tdflt/$archname
5577 case "$archlib" in
5578 '')     dflt=$tdflt
5579         ;;
5580 *)      dflt="$archlib"
5581     ;;
5582 esac
5583 $cat <<EOM
5584
5585 $spackage contains architecture-dependent library files.  If you are
5586 sharing libraries in a heterogeneous environment, you might store
5587 these files in a separate location.  Otherwise, you can just include
5588 them with the rest of the public library files.
5589
5590 EOM
5591 fn=d+~
5592 rp='Where do you want to put the public architecture-dependent libraries?'
5593 . ./getfile
5594 archlib="$ans"
5595 archlibexp="$ansexp"
5596 if $test X"$archlib" = X"$privlib"; then
5597         d_archlib="$undef"
5598 else
5599         d_archlib="$define"
5600 fi
5601 : Change installation prefix, if necessary.
5602 if $test X"$prefix" != X"$installprefix"; then
5603         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
5604 else
5605         installarchlib="$archlibexp"
5606 fi
5607
5608
5609 : Binary compatibility with 5.005 is not possible for builds
5610 : with advanced features
5611 case "$usethreads$usemultiplicity" in
5612 *define*)
5613         bincompat5005="$undef"
5614         d_bincompat5005="$undef"
5615         ;;
5616 *)      $cat <<EOM
5617
5618 This version of Perl can be compiled for binary compatibility with 5.005.
5619 If you decide to do so, you will be able to continue using most of the
5620 extensions that were compiled for Perl 5.005.
5621
5622 EOM
5623         case "$bincompat5005$d_bincompat5005" in
5624         *"$undef"*) dflt=n ;;
5625         *) dflt=y ;;
5626         esac
5627         rp='Binary compatibility with Perl 5.005?'
5628         . ./myread
5629         case "$ans" in
5630         y*) val="$define" ;;
5631         *)  val="$undef" ;;
5632         esac
5633         set d_bincompat5005
5634         eval $setvar
5635         case "$d_bincompat5005" in
5636         "$define")
5637                 bincompat5005="$define"
5638                 ;;
5639         *)      bincompat5005="$undef"
5640                 d_bincompat5005="$undef"
5641                 ;;
5642         esac
5643         ;;
5644 esac
5645
5646
5647 : see if setuid scripts can be secure
5648 $cat <<EOM
5649
5650 Some kernels have a bug that prevents setuid #! scripts from being
5651 secure.  Some sites have disabled setuid #! scripts because of this.
5652
5653 First let's decide if your kernel supports secure setuid #! scripts.
5654 (If setuid #! scripts would be secure but have been disabled anyway,
5655 don't say that they are secure if asked.)
5656
5657 EOM
5658
5659 val="$undef"
5660 if $test -d /dev/fd; then
5661         echo "#!$ls" >reflect
5662         chmod +x,u+s reflect
5663         ./reflect >flect 2>&1
5664         if $contains "/dev/fd" flect >/dev/null; then
5665                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
5666                 val="$define"
5667         else
5668                 $cat <<EOM
5669 If you are not sure if they are secure, I can check but I'll need a
5670 username and password different from the one you are using right now.
5671 If you don't have such a username or don't want me to test, simply
5672 enter 'none'.
5673
5674 EOM
5675                 rp='Other username to test security of setuid scripts with?'
5676                 dflt='none'
5677                 . ./myread
5678                 case "$ans" in
5679                 n|none)
5680                         case "$d_suidsafe" in
5681                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
5682                                 dflt=n;;
5683                         "$undef")
5684                                 echo "Well, the $hint value is *not* secure." >&4
5685                                 dflt=n;;
5686                         *)      echo "Well, the $hint value *is* secure." >&4
5687                                 dflt=y;;
5688                         esac
5689                         ;;
5690                 *)
5691                         $rm -f reflect flect
5692                         echo "#!$ls" >reflect
5693                         chmod +x,u+s reflect
5694                         echo >flect
5695                         chmod a+w flect
5696                         echo '"su" will (probably) prompt you for '"$ans's password."
5697                         su $ans -c './reflect >flect'
5698                         if $contains "/dev/fd" flect >/dev/null; then
5699                                 echo "Okay, it looks like setuid scripts are secure." >&4
5700                                 dflt=y
5701                         else
5702                                 echo "I don't think setuid scripts are secure." >&4
5703                                 dflt=n
5704                         fi
5705                         ;;
5706                 esac
5707                 rp='Does your kernel have *secure* setuid scripts?'
5708                 . ./myread
5709                 case "$ans" in
5710                 [yY]*)  val="$define";;
5711                 *)      val="$undef";;
5712                 esac
5713         fi
5714 else
5715         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
5716         echo "(That's for file descriptors, not floppy disks.)"
5717         val="$undef"
5718 fi
5719 set d_suidsafe
5720 eval $setvar
5721
5722 $rm -f reflect flect
5723
5724 : now see if they want to do setuid emulation
5725 echo " "
5726 val="$undef"
5727 case "$d_suidsafe" in
5728 "$define")
5729         val="$undef"
5730         echo "No need to emulate SUID scripts since they are secure here." >& 4
5731         ;;
5732 *)
5733         $cat <<EOM
5734 Some systems have disabled setuid scripts, especially systems where
5735 setuid scripts cannot be secure.  On systems where setuid scripts have
5736 been disabled, the setuid/setgid bits on scripts are currently
5737 useless.  It is possible for $package to detect those bits and emulate
5738 setuid/setgid in a secure fashion.  This emulation will only work if
5739 setuid scripts have been disabled in your kernel.
5740
5741 EOM
5742         case "$d_dosuid" in
5743         "$define") dflt=y ;;
5744         *) dflt=n ;;
5745         esac
5746         rp="Do you want to do setuid/setgid emulation?"
5747         . ./myread
5748         case "$ans" in
5749         [yY]*)  val="$define";;
5750         *)      val="$undef";;
5751         esac
5752         ;;
5753 esac
5754 set d_dosuid
5755 eval $setvar
5756
5757 : determine filename position in cpp output
5758 echo " "
5759 echo "Computing filename position in cpp output for #include directives..." >&4
5760 echo '#include <stdio.h>' > foo.c
5761 $cat >fieldn <<EOF
5762 $startsh
5763 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5764 $grep '^[       ]*#.*stdio\.h' | \
5765 while read cline; do
5766         pos=1
5767         set \$cline
5768         while $test \$# -gt 0; do
5769                 if $test -r \`echo \$1 | $tr -d '"'\`; then
5770                         echo "\$pos"
5771                         exit 0
5772                 fi
5773                 shift
5774                 pos=\`expr \$pos + 1\`
5775         done
5776 done
5777 EOF
5778 chmod +x fieldn
5779 fieldn=`./fieldn`
5780 $rm -f foo.c fieldn
5781 case $fieldn in
5782 '') pos='???';;
5783 1) pos=first;;
5784 2) pos=second;;
5785 3) pos=third;;
5786 *) pos="${fieldn}th";;
5787 esac
5788 echo "Your cpp writes the filename in the $pos field of the line."
5789
5790 : locate header file
5791 $cat >findhdr <<EOF
5792 $startsh
5793 wanted=\$1
5794 name=''
5795 for usrincdir in $usrinc
5796 do
5797         if test -f \$usrincdir/\$wanted; then
5798                 echo "\$usrincdir/\$wanted"
5799                 exit 0
5800         fi
5801 done
5802 awkprg='{ print \$$fieldn }'
5803 echo "#include <\$wanted>" > foo\$\$.c
5804 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5805 $grep "^[       ]*#.*\$wanted" | \
5806 while read cline; do
5807         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5808         case "\$name" in
5809         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5810         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5811         *) exit 2;;
5812         esac;
5813 done;
5814 #
5815 # status = 0: grep returned 0 lines, case statement not executed
5816 # status = 1: headerfile found
5817 # status = 2: while loop executed, no headerfile found
5818 #
5819 status=\$?
5820 $rm -f foo\$\$.c;
5821 if test \$status -eq 1; then
5822         exit 0;
5823 fi
5824 exit 1
5825 EOF
5826 chmod +x findhdr
5827
5828 : define an alternate in-header-list? function
5829 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5830 cont=true; xxf="echo \"<\$1> found.\" >&4";
5831 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5832 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5833 esac;
5834 case $# in 4) instead=instead;; *) instead="at last";; esac;
5835 while $test "$cont"; do
5836         xxx=`./findhdr $1`
5837         var=$2; eval "was=\$$2";
5838         if $test "$xxx" && $test -r "$xxx";
5839         then eval $xxf;
5840         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5841                 cont="";
5842         else eval $xxnf;
5843         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5844         set $yyy; shift; shift; yyy=$@;
5845         case $# in 0) cont="";;
5846         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5847                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5848         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5849                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5850         esac;
5851 done;
5852 while $test "$yyy";
5853 do set $yyy; var=$2; eval "was=\$$2";
5854         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5855         set $yyy; shift; shift; yyy=$@;
5856 done'
5857
5858 : see if this is a malloc.h system
5859 set malloc.h i_malloc
5860 eval $inhdr
5861
5862 : see if stdlib is available
5863 set stdlib.h i_stdlib
5864 eval $inhdr
5865
5866 : determine which malloc to compile in
5867 echo " "
5868 case "$usemymalloc" in
5869 ''|[yY]*|true|$define)  dflt='y' ;;
5870 *)      dflt='n' ;;
5871 esac
5872 rp="Do you wish to attempt to use the malloc that comes with $package?"
5873 . ./myread
5874 usemymalloc="$ans"
5875 case "$ans" in
5876 y*|true)
5877         usemymalloc='y'
5878         mallocsrc='malloc.c'
5879         mallocobj="malloc$_o"
5880         d_mymalloc="$define"
5881         case "$libs" in
5882         *-lmalloc*)
5883                 : Remove malloc from list of libraries to use
5884                 echo "Removing unneeded -lmalloc from library list" >&4
5885                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
5886                 shift
5887                 libs="$*"
5888                 echo "libs = $libs" >&4
5889                 ;;
5890         esac
5891         ;;
5892 *)
5893         usemymalloc='n'
5894         mallocsrc=''
5895         mallocobj=''
5896         d_mymalloc="$undef"
5897         ;;
5898 esac
5899
5900 : compute the return types of malloc and free
5901 echo " "
5902 $cat >malloc.c <<END
5903 #$i_malloc I_MALLOC
5904 #$i_stdlib I_STDLIB
5905 #include <stdio.h>
5906 #include <sys/types.h>
5907 #ifdef I_MALLOC
5908 #include <malloc.h>
5909 #endif
5910 #ifdef I_STDLIB
5911 #include <stdlib.h>
5912 #endif
5913 #ifdef TRY_MALLOC
5914 void *malloc();
5915 #endif
5916 #ifdef TRY_FREE
5917 void free();
5918 #endif
5919 END
5920 case "$malloctype" in
5921 '')
5922         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
5923                 malloctype='void *'
5924         else
5925                 malloctype='char *'
5926         fi
5927         ;;
5928 esac
5929 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
5930
5931 case "$freetype" in
5932 '')
5933         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
5934                 freetype='void'
5935         else
5936                 freetype='int'
5937         fi
5938         ;;
5939 esac
5940 echo "Your system uses $freetype free(), it would seem." >&4
5941 $rm -f malloc.[co]
5942 $cat <<EOM
5943
5944 After $package is installed, you may wish to install various
5945 add-on modules and utilities.  Typically, these add-ons will
5946 be installed under $prefix with the rest
5947 of this package.  However, you may wish to install such add-ons
5948 elsewhere under a different prefix.
5949
5950 If you do not wish to put everything under a single prefix, that's
5951 ok.  You will be prompted for the individual locations; this siteprefix
5952 is only used to suggest the defaults.
5953
5954 The default should be fine for most people.
5955
5956 EOM
5957 fn=d~+
5958 rp='Installation prefix to use for add-on modules and utilities?'
5959 : XXX Here might be another good place for an installstyle setting.
5960 case "$siteprefix" in
5961 '') dflt=$prefix ;;
5962 *)  dflt=$siteprefix ;;
5963 esac
5964 . ./getfile
5965 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
5966 oldsiteprefix=''
5967 case "$siteprefix" in
5968 '') ;;
5969 *)      case "$ans" in
5970         "$prefix") ;;
5971         *) oldsiteprefix="$prefix";;
5972         esac
5973         ;;
5974 esac
5975 siteprefix="$ans"
5976 siteprefixexp="$ansexp"
5977
5978 : determine where site specific libraries go.
5979 : Usual default is /usr/local/lib/perl5/site_perl/$version
5980 : The default "style" setting is made in installstyle.U
5981 : XXX No longer works with Prefixit stuff.
5982 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5983 case "$sitelib" in
5984 '') case "$installstyle" in
5985         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
5986         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
5987         esac
5988         ;;
5989 *)      dflt="$sitelib"
5990         ;;
5991 esac
5992 $cat <<EOM
5993
5994 The installation process will create a directory for
5995 site-specific extensions and modules.  Most users find it convenient
5996 to place all site-specific files in this directory rather than in the
5997 main distribution directory.
5998
5999 EOM
6000 fn=d~+
6001 rp='Pathname for the site-specific library files?'
6002 . ./getfile
6003 sitelib="$ans"
6004 sitelibexp="$ansexp"
6005 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6006 : Change installation prefix, if necessary.
6007 if $test X"$prefix" != X"$installprefix"; then
6008         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6009 else
6010         installsitelib="$sitelibexp"
6011 fi
6012
6013 : determine where site specific architecture-dependent libraries go.
6014 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6015 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6016 : sitelib may have an optional trailing /share.
6017 case "$sitearch" in
6018 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6019         dflt="$dflt/$archname"
6020         ;;
6021 *)      dflt="$sitearch"
6022         ;;
6023 esac
6024 set sitearch sitearch none
6025 eval $prefixit
6026 $cat <<EOM
6027
6028 The installation process will also create a directory for
6029 architecture-dependent site-specific extensions and modules.
6030
6031 EOM
6032 fn=d~+
6033 rp='Pathname for the site-specific architecture-dependent library files?'
6034 . ./getfile
6035 sitearch="$ans"
6036 sitearchexp="$ansexp"
6037 : Change installation prefix, if necessary.
6038 if $test X"$prefix" != X"$installprefix"; then
6039         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6040 else
6041         installsitearch="$sitearchexp"
6042 fi
6043
6044 $cat <<EOM
6045
6046 The installation process will also create a directory for
6047 vendor-supplied add-ons.  Vendors who supply perl with their system
6048 may find it convenient to place all vendor-supplied files in this
6049 directory rather than in the main distribution directory.  This will
6050 ease upgrades between binary-compatible maintenance versions of perl.
6051
6052 Of course you may also use these directories in whatever way you see
6053 fit.  For example, you might use them to access modules shared over a
6054 company-wide network.
6055
6056 The default answer should be fine for most people.
6057 This causes further questions about vendor add-ons to be skipped
6058 and no vendor-specific directories will be configured for perl.
6059
6060 EOM
6061 rp='Do you want to configure vendor-specific add-on directories?'
6062 case "$usevendorprefix" in
6063 define|true|[yY]*) dflt=y ;;
6064 *)      : User may have set vendorprefix directly on Configure command line.
6065         case "$vendorprefix" in
6066         ''|' ') dflt=n ;;
6067         *)      dflt=y ;;
6068         esac
6069         ;;
6070 esac
6071 . ./myread
6072 case "$ans" in
6073 [yY]*)  fn=d~+
6074         rp='Installation prefix to use for vendor-supplied add-ons?'
6075         case "$vendorprefix" in
6076         '') dflt='' ;;
6077         *)  dflt=$vendorprefix ;;
6078         esac
6079         . ./getfile
6080         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6081         oldvendorprefix=''
6082         case "$vendorprefix" in
6083         '') ;;
6084         *)      case "$ans" in
6085                 "$prefix") ;;
6086                 *) oldvendorprefix="$prefix";;
6087                 esac
6088                 ;;
6089         esac
6090         usevendorprefix="$define"
6091         vendorprefix="$ans"
6092         vendorprefixexp="$ansexp"
6093         ;;
6094 *)      usevendorprefix="$undef"
6095         vendorprefix=''
6096         vendorprefixexp=''
6097         ;;
6098 esac
6099
6100 case "$vendorprefix" in
6101 '')     d_vendorlib="$undef"
6102         vendorlib=''
6103         vendorlibexp=''
6104         ;;
6105 *)      d_vendorlib="$define"
6106         : determine where vendor-supplied modules go.
6107         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6108         case "$vendorlib" in
6109         '')
6110                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6111                 case "$installstyle" in
6112                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6113                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6114                 esac
6115                 ;;
6116         *)      dflt="$vendorlib"
6117                 ;;
6118         esac
6119         fn=d~+
6120         rp='Pathname for the vendor-supplied library files?'
6121         . ./getfile
6122         vendorlib="$ans"
6123         vendorlibexp="$ansexp"
6124         ;;
6125 esac
6126 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6127 : Change installation prefix, if necessary.
6128 if $test X"$prefix" != X"$installprefix"; then
6129         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6130 else
6131         installvendorlib="$vendorlibexp"
6132 fi
6133
6134 case "$vendorprefix" in
6135 '')     d_vendorarch="$undef"
6136         vendorarch=''
6137         vendorarchexp=''
6138         ;;
6139 *)      d_vendorarch="$define"
6140         : determine where vendor-supplied architecture-dependent libraries go.
6141         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6142         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6143         : vendorlib may have an optional trailing /share.
6144         case "$vendorarch" in
6145         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6146                 dflt="$dflt/$archname"
6147                 ;;
6148         *)      dflt="$vendorarch" ;;
6149         esac
6150         fn=d~+
6151         rp='Pathname for vendor-supplied architecture-dependent files?'
6152         . ./getfile
6153         vendorarch="$ans"
6154         vendorarchexp="$ansexp"
6155         ;;
6156 esac
6157 : Change installation prefix, if necessary.
6158 if $test X"$prefix" != X"$installprefix"; then
6159         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6160 else
6161         installvendorarch="$vendorarchexp"
6162 fi
6163
6164 : Final catch-all directories to search
6165 $cat <<EOM
6166
6167 Lastly, you can have perl look in other directories for extensions and
6168 modules in addition to those already specified.
6169 These directories will be searched after 
6170         $sitearch 
6171         $sitelib 
6172 EOM
6173 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6174 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6175 echo ' '
6176 case "$otherlibdirs" in
6177 ''|' ') dflt='none' ;;
6178 *)      dflt="$otherlibdirs" ;;
6179 esac
6180 $cat <<EOM
6181 Enter a colon-separated set of extra paths to include in perl's @INC
6182 search path, or enter 'none' for no extra paths.
6183
6184 EOM
6185
6186 rp='Colon-separated list of additional directories for perl to search?'
6187 . ./myread
6188 case "$ans" in
6189 ' '|''|none)    otherlibdirs=' ' ;;     
6190 *)      otherlibdirs="$ans" ;;
6191 esac
6192 case "$otherlibdirs" in
6193 ' ') val=$undef ;;
6194 *)      val=$define ;;
6195 esac
6196 set d_perl_otherlibdirs
6197 eval $setvar
6198
6199 : Cruising for prototypes
6200 echo " "
6201 echo "Checking out function prototypes..." >&4
6202 $cat >prototype.c <<'EOCP'
6203 int main(int argc, char *argv[]) {
6204         exit(0);}
6205 EOCP
6206 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6207         echo "Your C compiler appears to support function prototypes."
6208         val="$define"
6209 else
6210         echo "Your C compiler doesn't seem to understand function prototypes."
6211         val="$undef"
6212 fi
6213 set prototype
6214 eval $setvar
6215 $rm -f prototype*
6216
6217 case "$prototype" in
6218 "$define") ;;
6219 *)      ansi2knr='ansi2knr'
6220         echo " "
6221         cat <<EOM >&4
6222
6223 $me:  FATAL ERROR:
6224 This version of $package can only be compiled by a compiler that 
6225 understands function prototypes.  Unfortunately, your C compiler 
6226         $cc $ccflags
6227 doesn't seem to understand them.  Sorry about that.
6228
6229 If GNU cc is available for your system, perhaps you could try that instead.  
6230
6231 Eventually, we hope to support building Perl with pre-ANSI compilers.
6232 If you would like to help in that effort, please contact <perlbug@perl.org>.
6233
6234 Aborting Configure now.
6235 EOM
6236         exit 2
6237         ;;
6238 esac
6239
6240 : determine where public executables go
6241 echo " "
6242 set dflt bin bin
6243 eval $prefixit
6244 fn=d~
6245 rp='Pathname where the public executables will reside?'
6246 . ./getfile
6247 if $test "X$ansexp" != "X$binexp"; then
6248         installbin=''
6249 fi
6250 bin="$ans"
6251 binexp="$ansexp"
6252 : Change installation prefix, if necessary.
6253 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6254 if $test X"$prefix" != X"$installprefix"; then
6255         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6256 else
6257         installbin="$binexp"
6258 fi
6259
6260 : Find perl5.005 or later.
6261 echo "Looking for a previously installed perl5.005 or later... "
6262 case "$perl5" in
6263 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
6264                 : Check if this perl is recent and can load a simple module
6265                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6266                         perl5=$tdir/perl
6267                         break;
6268                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6269                         perl5=$tdir/perl
6270                         break;
6271                 fi
6272         done
6273         ;;
6274 *)      perl5="$perl5"
6275         ;;
6276 esac
6277 case "$perl5" in
6278 '')     echo "None found.  That's ok.";;
6279 *)      echo "Using $perl5." ;;
6280 esac
6281
6282 : Determine list of previous versions to include in @INC
6283 $cat > getverlist <<EOPL
6284 #!$perl5 -w
6285 use File::Basename;
6286 \$api_versionstring = "$api_versionstring";
6287 \$version = "$version";
6288 \$stem = "$sitelib_stem";
6289 \$archname = "$archname";
6290 EOPL
6291         $cat >> getverlist <<'EOPL'
6292 # Can't have leading @ because metaconfig interprets it as a command!
6293 ;@inc_version_list=();
6294 # XXX Redo to do opendir/readdir? 
6295 if (-d $stem) {
6296     chdir($stem);
6297     ;@candidates = glob("5.*");
6298 }
6299 else {
6300     ;@candidates = ();
6301 }
6302
6303 # XXX ToDo:  These comparisons must be reworked when two-digit
6304 # subversions come along, so that 5.7.10 compares as greater than
6305 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6306 # widespread that we can use the built-in version vectors rather
6307 # than reinventing them here.  For 5.6.0, however, we must
6308 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6309 foreach $d (@candidates) {
6310     if ($d lt $version) {
6311         if ($d ge $api_versionstring) {
6312             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6313         }
6314         elsif ($d ge "5.005") {
6315             unshift(@inc_version_list, grep { -d } $d);
6316         }
6317     }
6318     else {
6319         # Skip newer version.  I.e. don't look in
6320         # 5.7.0 if we're installing 5.6.1.
6321     }
6322 }
6323
6324 if (@inc_version_list) {
6325     print join(' ', @inc_version_list);
6326 }
6327 else {
6328     # Blank space to preserve value for next Configure run.
6329     print " ";
6330 }
6331 EOPL
6332 chmod +x getverlist
6333 case "$inc_version_list" in
6334 '')     if test -x "$perl5"; then
6335                 dflt=`$perl5 getverlist`
6336         else
6337                 dflt='none'
6338         fi
6339         ;;
6340 $undef) dflt='none' ;;
6341 *)  dflt="$inc_version_list" ;;
6342 esac
6343 case "$dflt" in
6344 ''|' ') dflt=none ;;
6345 esac
6346 case "$dflt" in
6347 5.005) case "$bincompat5005" in
6348        $define|true|[yY]*) ;;
6349        *) dflt=none ;;
6350        esac
6351        ;;
6352 esac
6353 $cat <<'EOM'
6354
6355 In order to ease the process of upgrading, this version of perl 
6356 can be configured to use modules built and installed with earlier 
6357 versions of perl that were installed under $prefix.  Specify here
6358 the list of earlier versions that this version of perl should check.
6359 If Configure detected no earlier versions of perl installed under
6360 $prefix, then the list will be empty.  Answer 'none' to tell perl
6361 to not search earlier versions.
6362
6363 The default should almost always be sensible, so if you're not sure,
6364 just accept the default.
6365 EOM
6366
6367 rp='List of earlier versions to include in @INC?'
6368 . ./myread
6369 case "$ans" in
6370 [Nn]one|''|' ') inc_version_list=' ' ;;
6371 *) inc_version_list="$ans" ;;
6372 esac
6373 case "$inc_version_list" in
6374 ''|' ') 
6375         inc_version_list_init='0';;
6376 *)      inc_version_list_init=`echo $inc_version_list |
6377                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6378         ;;
6379 esac
6380 $rm -f getverlist
6381
6382 : determine whether to install perl also as /usr/bin/perl
6383
6384 echo " "
6385 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6386         $cat <<EOM
6387 Many scripts expect perl to be installed as /usr/bin/perl.
6388 I can install the perl you are about to compile also as /usr/bin/perl
6389 (in addition to $installbin/perl).
6390 EOM
6391         case "$installusrbinperl" in
6392         "$undef"|[nN]*) dflt='n';;
6393         *)              dflt='y';;
6394         esac
6395         rp="Do you want to install perl as /usr/bin/perl?"
6396         . ./myread
6397         case "$ans" in
6398         [yY]*)  val="$define";;
6399         *)      val="$undef" ;;
6400         esac
6401 else
6402         val="$undef"
6403 fi
6404 set installusrbinperl
6405 eval $setvar
6406
6407 : see if dld is available
6408 set dld.h i_dld
6409 eval $inhdr
6410
6411 : see if dlopen exists
6412 xxx_runnm="$runnm"
6413 runnm=false
6414 set dlopen d_dlopen
6415 eval $inlibc
6416 runnm="$xxx_runnm"
6417
6418 : determine which dynamic loading, if any, to compile in
6419 echo " "
6420 dldir="ext/DynaLoader"
6421 case "$usedl" in
6422 $define|y|true)
6423         dflt='y'
6424         usedl="$define"
6425         ;;
6426 $undef|n|false)
6427         dflt='n'
6428         usedl="$undef"
6429         ;;
6430 *) 
6431         dflt='n'
6432         case "$d_dlopen" in
6433             $define) dflt='y' ;;
6434         esac
6435         case "$i_dld" in
6436             $define) dflt='y' ;;
6437         esac
6438         : Does a dl_xxx.xs file exist for this operating system
6439         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6440         ;;
6441 esac
6442 rp="Do you wish to use dynamic loading?"
6443 . ./myread
6444 usedl="$ans"
6445 case "$ans" in
6446 y*) usedl="$define"
6447         case "$dlsrc" in
6448         '')
6449                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6450                         dflt="$dldir/dl_${osname}.xs"
6451                 elif $test "$d_dlopen" = "$define" ; then
6452                         dflt="$dldir/dl_dlopen.xs"
6453                 elif $test "$i_dld" = "$define" ; then
6454                         dflt="$dldir/dl_dld.xs"
6455                 else
6456                         dflt=''
6457                 fi
6458                 ;;
6459         *)      dflt="$dldir/$dlsrc"
6460                 ;;
6461         esac
6462     echo "The following dynamic loading files are available:"
6463         : Can not go over to $dldir because getfile has path hard-coded in.
6464         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6465         rp="Source file to use for dynamic loading"
6466         fn="fne"
6467         gfpth="$src"
6468         . ./getfile
6469         usedl="$define"
6470         : emulate basename
6471         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6472
6473         $cat << EOM
6474
6475 Some systems may require passing special flags to $cc -c to
6476 compile modules that will be used to create a shared library.
6477 To use no flags, say "none".
6478
6479 EOM
6480     case "$cccdlflags" in
6481     '') case "$gccversion" in
6482                 '') case "$osname" in
6483                         hpux)   dflt='+z' ;;
6484                         next)   dflt='none' ;;
6485                         irix*)  dflt='-KPIC' ;;
6486                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
6487                         sunos)  dflt='-pic' ;;
6488                         *)      dflt='none' ;;
6489                     esac
6490                         ;;
6491                 *)  case "$osname" in
6492                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
6493                         *)      dflt='-fpic' ;;
6494                     esac ;;
6495             esac ;;
6496         ' ') dflt='none' ;;
6497     *)  dflt="$cccdlflags" ;;
6498     esac
6499     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6500     . ./myread
6501     case "$ans" in
6502     none) cccdlflags=' ' ;;
6503     *) cccdlflags="$ans" ;;
6504     esac
6505
6506     cat << EOM
6507
6508 Some systems use ld to create libraries that can be dynamically loaded,
6509 while other systems (such as those using ELF) use $cc.
6510
6511 EOM
6512         case "$ld" in
6513         '')     $cat >try.c <<'EOM'
6514 /* Test for whether ELF binaries are produced */
6515 #include <fcntl.h>
6516 #include <stdlib.h>
6517 int main() {
6518         char b[4];
6519         int i = open("a.out",O_RDONLY);
6520         if(i == -1) 
6521                 exit(1); /* fail */
6522         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6523                 exit(0); /* succeed (yes, it's ELF) */
6524         else
6525                 exit(1); /* fail */
6526 }
6527 EOM
6528                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6529                         cat <<EOM
6530 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6531 EOM
6532                         dflt="$cc"
6533                 else
6534                         echo "I'll use ld to build dynamic libraries."
6535                         dflt='ld'
6536                 fi
6537                 rm -f try.c a.out
6538                 ;;
6539         *)      dflt="$ld"
6540                 ;;
6541         esac
6542
6543     rp="What command should be used to create dynamic libraries?"
6544     . ./myread
6545         ld="$ans"
6546
6547     cat << EOM
6548
6549 Some systems may require passing special flags to $ld to create a
6550 library that can be dynamically loaded.  If your ld flags include
6551 -L/other/path options to locate libraries outside your loader's normal
6552 search path, you may need to specify those -L options here as well.  To
6553 use no flags, say "none".
6554
6555 EOM
6556     case "$lddlflags" in
6557     '') case "$osname" in
6558                         beos) dflt='-nostart' ;;
6559                         hpux) dflt='-b';
6560                               case "$gccversion" in
6561                               '') dflt="$dflt +vnocompatwarnings" ;;
6562                               esac
6563                               ;;        
6564                         linux|irix*)    dflt='-shared' ;;
6565                         next)  dflt='none' ;;
6566                         solaris) dflt='-G' ;;
6567                         sunos) dflt='-assert nodefinitions' ;;
6568                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
6569                 *)     dflt='none' ;;
6570                         esac
6571                         ;;
6572     *) dflt="$lddlflags" ;;
6573     esac
6574
6575         : Try to guess additional flags to pick up local libraries.
6576         : Be careful not to append to a plain 'none'
6577         case "$dflt" in
6578         none) dflt='' ;;
6579         esac
6580         for thisflag in $ldflags; do
6581                 case "$thisflag" in
6582                 -L*|-R*)
6583                         case " $dflt " in
6584                         *" $thisflag "*) ;;
6585                         *) dflt="$dflt $thisflag" ;;
6586                         esac
6587                         ;;
6588                 esac
6589         done
6590
6591         case "$dflt" in
6592         ''|' ') dflt='none' ;;
6593         esac
6594
6595     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6596     . ./myread
6597     case "$ans" in
6598     none) lddlflags=' ' ;;
6599     *) lddlflags="$ans" ;;
6600     esac
6601
6602         cat <<EOM
6603
6604 Some systems may require passing special flags to $cc to indicate that
6605 the resulting executable will use dynamic linking.  To use no flags,
6606 say "none".
6607
6608 EOM
6609     case "$ccdlflags" in
6610     '') case "$osname" in
6611                 hpux)   dflt='-Wl,-E' ;;
6612                 linux)  dflt='-rdynamic' ;;
6613                 next)   dflt='none' ;;
6614                 sunos)  dflt='none' ;;
6615                 *)      dflt='none' ;;
6616             esac ;;
6617     ' ')  dflt='none' ;;
6618     *)  dflt="$ccdlflags" ;;
6619     esac
6620     rp="Any special flags to pass to $cc to use dynamic linking?"
6621     . ./myread
6622     case "$ans" in
6623     none) ccdlflags=' ' ;;
6624     *) ccdlflags="$ans" ;;
6625     esac
6626     ;;
6627 *)  usedl="$undef"
6628         ld='ld'
6629     dlsrc='dl_none.xs'
6630     lddlflags=''
6631     ccdlflags=''
6632     ;;
6633 esac
6634
6635 also=''
6636 case "$usedl" in
6637 $undef)
6638         # No dynamic loading being used, so don't bother even to prompt.
6639         useshrplib='false'
6640         ;;
6641 *)      case "$useshrplib" in
6642         '')     case "$osname" in
6643                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
6644                         dflt=y
6645                         also='Building a shared libperl is required for dynamic loading to work on your system.'
6646                         ;;
6647                 next*)
6648                         case "$osvers" in
6649                         4*)     dflt=y
6650                                 also='Building a shared libperl is needed for MAB support.'
6651                                 ;;
6652                         *)      dflt=n
6653                                 ;;
6654                         esac
6655                         ;;
6656                 *)      dflt=n
6657                         ;;
6658                 esac
6659                 ;;
6660         $define|true|[Yy]*)
6661                 dflt=y
6662                 ;;
6663         *)      dflt=n
6664                 ;;
6665         esac
6666         $cat << EOM
6667
6668 The perl executable is normally obtained by linking perlmain.c with
6669 libperl${_a}, any static extensions (usually just DynaLoader), and
6670 any other libraries needed on this system (such as -lm, etc.).  Since
6671 your system supports dynamic loading, it is probably possible to build
6672 a shared libperl.$so.  If you will have more than one executable linked
6673 to libperl.$so, this will significantly reduce the size of each
6674 executable, but it may have a noticeable affect on performance.  The
6675 default is probably sensible for your system.
6676 $also
6677
6678 EOM
6679         rp="Build a shared libperl.$so (y/n)"
6680         . ./myread
6681         case "$ans" in
6682         true|$define|[Yy]*)
6683                 useshrplib='true'  ;;
6684         *)      useshrplib='false' ;;
6685         esac
6686         ;;
6687 esac
6688
6689 case "$useshrplib" in
6690 true)
6691         case "$libperl" in
6692         '')
6693                 # Figure out a good name for libperl.so.  Since it gets stored in
6694                 # a version-specific architecture-dependent library, the version
6695                 # number isn't really that important, except for making cc/ld happy.
6696                 #
6697                 # A name such as libperl.so.3.1
6698                 majmin="libperl.$so.$patchlevel.$subversion"
6699                 # A name such as libperl.so.301
6700                 majonly=`echo $patchlevel $subversion |
6701                         $awk '{printf "%d%02d", $1, $2}'`
6702                 majonly=libperl.$so.$majonly
6703                 # I'd prefer to keep the os-specific stuff here to a minimum, and
6704                 # rely on figuring it out from the naming of libc.
6705                 case "${osname}${osvers}" in
6706                 next4*)
6707                         dflt=libperl.5.$so
6708                         # XXX How handle the --version stuff for MAB?
6709                         ;;
6710                 linux*)  # ld won't link with a bare -lperl otherwise.
6711                         dflt=libperl.$so
6712                         ;;
6713                 cygwin*) # include version
6714                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
6715                         ;;
6716                 *)      # Try to guess based on whether libc has major.minor.
6717                         case "$libc" in
6718                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
6719                         *libc.$so.[0-9]*) dflt=$majonly ;;
6720                         *)      dflt=libperl.$so ;;
6721                         esac
6722                         ;;
6723                 esac
6724                 ;;
6725         *)      dflt=$libperl
6726                 ;;
6727         esac
6728         cat << EOM
6729
6730 I need to select a good name for the shared libperl.  If your system uses
6731 library names with major and minor numbers, then you might want something
6732 like $majmin.  Alternatively, if your system uses a single version
6733 number for shared libraries, then you might want to use $majonly.
6734 Or, your system might be quite happy with a simple libperl.$so.
6735
6736 Since the shared libperl will get installed into a version-specific
6737 architecture-dependent directory, the version number of the shared perl
6738 library probably isn't important, so the default should be o.k.
6739
6740 EOM
6741         rp='What name do you want to give to the shared libperl?'
6742         . ./myread
6743         libperl=$ans
6744         echo "Ok, I'll use $libperl"
6745         ;;
6746 *)
6747         libperl="libperl${_a}"
6748         ;;
6749 esac
6750
6751 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
6752 case "$shrpdir" in
6753 '') ;;
6754 *)      $cat >&4 <<EOM
6755 WARNING:  Use of the shrpdir variable for the installation location of
6756 the shared $libperl is not supported.  It was never documented and
6757 will not work in this version.  Let me (perlbug@perl.org)
6758 know of any problems this may cause.
6759
6760 EOM
6761         case "$shrpdir" in
6762         "$archlibexp/CORE")
6763                 $cat >&4 <<EOM
6764 But your current setting of $shrpdir is
6765 the default anyway, so it's harmless.
6766 EOM
6767                 ;;
6768         *)
6769                 $cat >&4 <<EOM
6770 Further, your current attempted setting of $shrpdir
6771 conflicts with the value of $archlibexp/CORE
6772 that installperl will use.
6773 EOM
6774                 ;;
6775         esac
6776         ;;
6777 esac
6778
6779 # How will the perl executable find the installed shared $libperl?
6780 # Add $xxx to ccdlflags.
6781 # If we can't figure out a command-line option, use $shrpenv to
6782 # set env LD_RUN_PATH.  The main perl makefile uses this.
6783 shrpdir=$archlibexp/CORE
6784 xxx=''
6785 tmp_shrpenv=''
6786 if "$useshrplib"; then
6787     case "$osname" in 
6788         aix)
6789                 # We'll set it in Makefile.SH...
6790                 ;;
6791         solaris|netbsd)
6792                 xxx="-R $shrpdir"
6793                 ;;
6794         freebsd)
6795                 xxx="-Wl,-R$shrpdir"
6796                 ;;
6797         linux|irix*|dec_osf)
6798                 xxx="-Wl,-rpath,$shrpdir"
6799                 ;;
6800         next)
6801                 # next doesn't like the default...
6802                 ;;
6803         beos)
6804                 # beos doesn't like the default, either.
6805                 ;;
6806         hpux*)
6807                 # hpux doesn't like the default, either.
6808                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
6809                 ;;
6810         *)
6811                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
6812                 ;;
6813         esac
6814         case "$xxx" in
6815         '') ;;
6816         *)      
6817                 # Only add $xxx if it isn't already in ccdlflags.
6818                 case " $ccdlflags " in
6819                 *" $xxx "*)     ;;
6820                 *)      ccdlflags="$ccdlflags $xxx"
6821                         cat <<EOM >&4
6822
6823 Adding $xxx to the flags
6824 passed to $ld so that the perl executable will find the 
6825 installed shared $libperl.
6826
6827 EOM
6828                         ;;
6829                 esac
6830                 ;;
6831         esac
6832 fi
6833 # Fix ccdlflags in AIX for building external extensions.
6834 # (For building Perl itself bare -bE:perl.exp is needed,
6835 #  Makefile.SH takes care of this.)
6836 case "$osname" in
6837 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
6838 esac
6839 # Respect a hint or command-line value.
6840 case "$shrpenv" in
6841 '') shrpenv="$tmp_shrpenv" ;;
6842 esac
6843 case "$ldlibpthname" in
6844 '')     ldlibpthname=LD_LIBRARY_PATH ;;
6845 none)   ldlibpthname='' ;;
6846 esac
6847
6848 : determine where manual pages are on this system
6849 echo " "
6850 case "$sysman" in
6851 '') 
6852         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
6853         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
6854         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
6855         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
6856         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
6857         sysman=`./loc . /usr/man/man1 $syspath`
6858         ;;
6859 esac
6860 if $test -d "$sysman"; then
6861         echo "System manual is in $sysman." >&4
6862 else
6863         echo "Could not find manual pages in source form." >&4
6864 fi
6865
6866 : determine where manual pages go
6867 set man1dir man1dir none
6868 eval $prefixit
6869 $cat <<EOM
6870
6871 $spackage has manual pages available in source form.
6872 EOM
6873 case "$nroff" in
6874 nroff)
6875         echo "However, you don't have nroff, so they're probably useless to you."
6876         case "$man1dir" in
6877         '') man1dir="none";;
6878         esac;;
6879 esac
6880 echo "If you don't want the manual sources installed, answer 'none'."
6881 case "$man1dir" in
6882 ' ') dflt=none
6883         ;;
6884 '')
6885         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
6886         lookpath="$lookpath $prefixexp/man/p_man/man1"
6887         lookpath="$lookpath $prefixexp/man/u_man/man1"
6888         lookpath="$lookpath $prefixexp/man/man.1"
6889         case "$sysman" in
6890         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
6891         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
6892         esac
6893         set dflt
6894         eval $prefixup
6895         ;;
6896 *)  dflt="$man1dir"
6897         ;;
6898 esac
6899 echo " "
6900 fn=dn+~
6901 rp="Where do the main $spackage manual pages (source) go?"
6902 . ./getfile
6903 if $test "X$man1direxp" != "X$ansexp"; then
6904         installman1dir=''
6905 fi
6906 man1dir="$ans"
6907 man1direxp="$ansexp"
6908 case "$man1dir" in
6909 '')     man1dir=' '
6910         installman1dir='';;
6911 esac
6912
6913 : Change installation prefix, if necessary.
6914 if $test X"$prefix" != X"$installprefix"; then
6915         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
6916 else
6917         installman1dir="$man1direxp"
6918 fi
6919
6920 : What suffix to use on installed man pages
6921
6922 case "$man1dir" in
6923 ' ')
6924         man1ext='0'
6925         ;;
6926 *)
6927         rp="What suffix should be used for the main $spackage man pages?"
6928         case "$man1ext" in
6929         '')     case "$man1dir" in
6930                 *1)  dflt=1 ;;
6931                 *1p) dflt=1p ;;
6932                 *1pm) dflt=1pm ;;
6933                 *l) dflt=l;;
6934                 *n) dflt=n;;
6935                 *o) dflt=o;;
6936                 *p) dflt=p;;
6937                 *C) dflt=C;;
6938                 *L) dflt=L;;
6939                 *L1) dflt=L1;;
6940                 *) dflt=1;;
6941                 esac
6942                 ;;
6943         *)      dflt="$man1ext";;
6944         esac
6945         . ./myread
6946         man1ext="$ans"
6947         ;;
6948 esac
6949
6950 : see if we can have long filenames
6951 echo " "
6952 first=123456789abcdef
6953 $rm -f $first
6954 if (echo hi >$first) 2>/dev/null; then
6955         if $test -f 123456789abcde; then
6956                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
6957                 val="$undef"
6958         else
6959                 echo 'You can have filenames longer than 14 characters.'>&4
6960                 val="$define"
6961         fi
6962 else
6963         $cat <<'EOM'
6964 You can't have filenames longer than 14 chars.
6965 You can't even think about them!
6966 EOM
6967         val="$undef"
6968 fi 
6969 set d_flexfnam
6970 eval $setvar
6971 $rm -rf 123456789abcde*
6972
6973 : determine where library module manual pages go
6974 set man3dir man3dir none
6975 eval $prefixit
6976 $cat <<EOM
6977
6978 $spackage has manual pages for many of the library modules.
6979 EOM
6980
6981 case "$nroff" in
6982 nroff)
6983         $cat <<'EOM'
6984 However, you don't have nroff, so they're probably useless to you.
6985 EOM
6986         case "$man3dir" in
6987         '') man3dir="none";;
6988         esac;;
6989 esac
6990
6991 case "$d_flexfnam" in
6992 undef)
6993         $cat <<'EOM'
6994 However, your system can't handle the long file names like File::Basename.3. 
6995 EOM
6996         case "$man3dir" in
6997         '') man3dir="none";;
6998         esac;;
6999 esac
7000
7001 echo "If you don't want the manual sources installed, answer 'none'."
7002 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7003 case "$man3dir" in
7004 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7005         if $test -d "$privlib/man/man3"; then
7006                 cat <<EOM >&4
7007
7008 WARNING:  Previous versions of perl installed man3 pages into
7009 $privlib/man/man3.  This version will suggest a 
7010 new default of $dflt.  
7011 EOM
7012                 tdflt=$dflt
7013                 dflt='n'
7014                 rp='Do you wish to preserve the old behavior?(y/n)'
7015                 . ./myread
7016                 case "$ans" in
7017                 y*) dflt="$privlib/man/man3" ;;
7018                 *)  dflt=$tdflt ;;
7019                 esac
7020     fi
7021         ;;
7022 *)      dflt="$man3dir" ;;
7023 esac
7024 case "$dflt" in
7025 ' ') dflt=none ;;
7026 esac
7027 echo " "
7028 fn=dn+~
7029 rp="Where do the $package library man pages (source) go?"
7030 . ./getfile
7031 man3dir="$ans"
7032 man3direxp="$ansexp"
7033 case "$man3dir" in
7034 '')     man3dir=' '
7035         installman3dir='';;
7036 esac
7037
7038 : Change installation prefix, if necessary.
7039 if $test X"$prefix" != X"$installprefix"; then
7040         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7041 else
7042         installman3dir="$man3direxp"
7043 fi
7044
7045 : What suffix to use on installed man pages
7046 case "$man3dir" in
7047 ' ')
7048         man3ext='0'
7049         ;;
7050 *)
7051         rp="What suffix should be used for the $package library man pages?"
7052         case "$man3ext" in
7053         '')     case "$man3dir" in
7054                 *3)  dflt=3 ;;
7055                 *3p) dflt=3p ;;
7056                 *3pm) dflt=3pm ;;
7057                 *l) dflt=l;;
7058                 *n) dflt=n;;
7059                 *o) dflt=o;;
7060                 *p) dflt=p;;
7061                 *C) dflt=C;;
7062                 *L) dflt=L;;
7063                 *L3) dflt=L3;;
7064                 *) dflt=3;;
7065                 esac
7066                 ;;
7067         *)      dflt="$man3ext";;
7068         esac
7069         . ./myread
7070         man3ext="$ans"
7071         ;;
7072 esac
7073
7074 : see if we have to deal with yellow pages, now NIS.
7075 if $test -d /usr/etc/yp || $test -d /etc/yp; then
7076         if $test -f /usr/etc/nibindd; then
7077                 echo " "
7078                 echo "I'm fairly confident you're on a NeXT."
7079                 echo " "
7080                 rp='Do you get the hosts file via NetInfo?'
7081                 dflt=y
7082                 case "$hostcat" in
7083                 nidump*) ;;
7084                 '') ;;
7085                 *) dflt=n;;
7086                 esac
7087                 . ./myread
7088                 case "$ans" in
7089                 y*) hostcat='nidump hosts .';;
7090                 *)      case "$hostcat" in
7091                         nidump*) hostcat='';;
7092                         esac
7093                         ;;
7094                 esac
7095         fi
7096         case "$hostcat" in
7097         nidump*) ;;
7098         *)
7099                 case "$hostcat" in
7100                 *ypcat*) dflt=y;;
7101                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7102                                 dflt=y
7103                         else
7104                                 dflt=n
7105                         fi;;
7106                 *) dflt=n;;
7107                 esac
7108                 echo " "
7109                 rp='Are you getting the hosts file via yellow pages?'
7110                 . ./myread
7111                 case "$ans" in
7112                 y*) hostcat='ypcat hosts';;
7113                 *) hostcat='cat /etc/hosts';;
7114                 esac
7115                 ;;
7116         esac
7117 fi
7118 case "$hostcat" in
7119 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7120 esac
7121 case "$groupcat" in
7122 '') test -f /etc/group && groupcat='cat /etc/group';;
7123 esac
7124 case "$passcat" in
7125 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7126 esac
7127
7128 : now get the host name
7129 echo " "
7130 echo "Figuring out host name..." >&4
7131 case "$myhostname" in
7132 '') cont=true
7133         echo 'Maybe "hostname" will work...'
7134         if tans=`sh -c hostname 2>&1` ; then
7135                 myhostname=$tans
7136                 phostname=hostname
7137                 cont=''
7138         fi
7139         ;;
7140 *) cont='';;
7141 esac
7142 if $test "$cont"; then
7143         if ./xenix; then
7144                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7145                 if tans=`cat /etc/systemid 2>&1` ; then
7146                         myhostname=$tans
7147                         phostname='cat /etc/systemid'
7148                         echo "Whadyaknow.  Xenix always was a bit strange..."
7149                         cont=''
7150                 fi
7151         elif $test -r /etc/systemid; then
7152                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7153         fi
7154 fi
7155 if $test "$cont"; then
7156         echo 'No, maybe "uuname -l" will work...'
7157         if tans=`sh -c 'uuname -l' 2>&1` ; then
7158                 myhostname=$tans
7159                 phostname='uuname -l'
7160         else
7161                 echo 'Strange.  Maybe "uname -n" will work...'
7162                 if tans=`sh -c 'uname -n' 2>&1` ; then
7163                         myhostname=$tans
7164                         phostname='uname -n'
7165                 else
7166                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7167                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7168                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7169                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7170                         else
7171                                 case "$myhostname" in
7172                                 '') echo "Does this machine have an identity crisis or something?"
7173                                         phostname='';;
7174                                 *)
7175                                         echo "Well, you said $myhostname before..."
7176                                         phostname='echo $myhostname';;
7177                                 esac
7178                         fi
7179                 fi
7180         fi
7181 fi
7182 : you do not want to know about this
7183 set $myhostname
7184 myhostname=$1
7185
7186 : verify guess
7187 if $test "$myhostname" ; then
7188         dflt=y
7189         rp='Your host name appears to be "'$myhostname'".'" Right?"
7190         . ./myread
7191         case "$ans" in
7192         y*) ;;
7193         *) myhostname='';;
7194         esac
7195 fi
7196
7197 : bad guess or no guess
7198 while $test "X$myhostname" = X ; do
7199         dflt=''
7200         rp="Please type the (one word) name of your host:"
7201         . ./myread
7202         myhostname="$ans"
7203 done
7204
7205 : translate upper to lower if necessary
7206 case "$myhostname" in
7207 *[A-Z]*)
7208         echo "(Normalizing case in your host name)"
7209         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7210         ;;
7211 esac
7212
7213 case "$myhostname" in
7214 *.*)
7215         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7216         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7217         echo "(Trimming domain name from host name--host name is now $myhostname)"
7218         ;;
7219 *) case "$mydomain" in
7220         '')
7221                 {
7222                         test "X$hostcat" = "Xypcat hosts" &&
7223                         ypmatch "$myhostname" hosts 2>/dev/null |\
7224                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7225                         $test -s hosts
7226                 } || {
7227                         test "X$hostcat" != "X" &&
7228                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7229                                         /[       ]$myhostname[  . ]/p" > hosts
7230                 }
7231                 tmp_re="[       . ]"
7232                 if $test -f hosts; then
7233                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7234                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7235                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7236                                 hosts | $sort | $uniq | \
7237                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7238                         case `$echo X$dflt` in
7239                         X*\ *)  echo "(Several hosts in the database matched hostname)"
7240                                 dflt=.
7241                                 ;;
7242                         X.) echo "(You do not have fully-qualified names in the hosts database)"
7243                                 ;;
7244                         esac
7245                 else
7246                         echo "(I cannot locate a hosts database anywhere)"
7247                         dflt=.
7248                 fi
7249                 case "$dflt" in
7250                 .)
7251                         tans=`./loc resolv.conf X /etc /usr/etc`
7252                         if $test -f "$tans"; then
7253                                 echo "(Attempting domain name extraction from $tans)"
7254                                 dflt=.`$sed -n -e 's/   / /g' \
7255                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7256                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7257                                 case "$dflt" in
7258                                 .) dflt=.`$sed -n -e 's/        / /g' \
7259                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7260                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7261                                         ;;
7262                                 esac
7263                         fi
7264                         ;;
7265                 esac
7266                 case "$dflt" in
7267                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7268                         dflt=.`sh -c domainname 2>/dev/null`
7269                         case "$dflt" in
7270                         '') dflt='.';;
7271                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7272                         esac
7273                         ;;
7274                 esac
7275                 case "$dflt" in
7276                 .) echo "(Lost all hope -- silly guess then)"
7277                         dflt='.uucp'
7278                         ;;
7279                 esac
7280                 $rm -f hosts
7281                 ;;
7282         *) dflt="$mydomain";;
7283         esac;;
7284 esac
7285 echo " "
7286 rp="What is your domain name?"
7287 . ./myread
7288 tans="$ans"
7289 case "$ans" in
7290 '') ;;
7291 .*) ;;
7292 *) tans=".$tans";;
7293 esac
7294 mydomain="$tans"
7295
7296 : translate upper to lower if necessary
7297 case "$mydomain" in
7298 *[A-Z]*)
7299         echo "(Normalizing case in your domain name)"
7300         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7301         ;;
7302 esac
7303
7304 : a little sanity check here
7305 case "$phostname" in
7306 '') ;;
7307 *)
7308         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7309         $myhostname$mydomain|$myhostname) ;;
7310         *)
7311                 case "$phostname" in
7312                 sed*)
7313                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7314                         ;;
7315                 *)
7316                         echo "(That doesn't agree with your $phostname command, by the way.)"
7317                         ;;
7318                 esac
7319         ;;
7320         esac
7321         ;;
7322 esac
7323
7324 $cat <<EOM
7325
7326 I need to get your e-mail address in Internet format if possible, i.e.
7327 something like user@host.domain. Please answer accurately since I have
7328 no easy means to double check it. The default value provided below
7329 is most probably close to reality but may not be valid from outside
7330 your organization...
7331
7332 EOM
7333 cont=x
7334 while test "$cont"; do
7335         case "$cf_email" in
7336         '') dflt="$cf_by@$myhostname$mydomain";;
7337         *) dflt="$cf_email";;
7338         esac
7339         rp='What is your e-mail address?'
7340         . ./myread
7341         cf_email="$ans"
7342         case "$cf_email" in
7343         *@*.*) cont='' ;;
7344         *)
7345                 rp='Address does not look like an Internet one.  Use it anyway?'
7346                 case "$fastread" in
7347                 yes) dflt=y ;;
7348                 *) dflt=n ;;
7349                 esac
7350                 . ./myread
7351                 case "$ans" in
7352                 y*) cont='' ;;
7353                 *) echo " " ;;
7354                 esac
7355                 ;;
7356         esac
7357 done
7358
7359 $cat <<EOM
7360
7361 If you or somebody else will be maintaining perl at your site, please
7362 fill in the correct e-mail address here so that they may be contacted
7363 if necessary. Currently, the "perlbug" program included with perl
7364 will send mail to this address in addition to perlbug@perl.org. You may
7365 enter "none" for no administrator.
7366
7367 EOM
7368 case "$perladmin" in
7369 '') dflt="$cf_email";;
7370 *) dflt="$perladmin";;
7371 esac
7372 rp='Perl administrator e-mail address'
7373 . ./myread
7374 perladmin="$ans"
7375
7376 : determine whether to only install version-specific parts.
7377 echo " "
7378 $cat <<EOM
7379 Do you want to install only the version-specific parts of the perl
7380 distribution?  Usually you do *not* want to do this.
7381 EOM
7382 case "$versiononly" in
7383 "$define"|[Yy]*|true) dflt='y' ;;
7384 *) dflt='n';
7385 esac
7386 rp="Do you want to install only the version-specific parts of perl?"
7387 . ./myread
7388 case "$ans" in
7389 [yY]*)  val="$define";;
7390 *)      val="$undef" ;;
7391 esac
7392 set versiononly
7393 eval $setvar
7394
7395 : figure out how to guarantee perl startup
7396 case "$startperl" in
7397 '')
7398         case "$sharpbang" in
7399         *!)
7400                 $cat <<EOH
7401
7402 I can use the #! construct to start perl on your system. This will
7403 make startup of perl scripts faster, but may cause problems if you
7404 want to share those scripts and perl is not in a standard place
7405 ($binexp/perl) on all your platforms. The alternative is to force
7406 a shell by starting the script with a single ':' character.
7407
7408 EOH
7409                 case "$versiononly" in
7410                 "$define")      dflt="$binexp/perl$version";;  
7411                 *)              dflt="$binexp/perl";;
7412                 esac
7413                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7414                 . ./myread
7415                 case "$ans" in
7416                 none)   startperl=": # use perl";;
7417                 *)      startperl="#!$ans"
7418                         if $test 30 -lt `echo "$ans" | wc -c`; then
7419                                 $cat >&4 <<EOM
7420
7421 WARNING:  Some systems limit the #! command to 32 characters.
7422 If you experience difficulty running Perl scripts with #!, try
7423 installing Perl in a directory with a shorter pathname.
7424
7425 EOM
7426                         fi ;;
7427                 esac
7428                 ;;
7429         *) startperl=": # use perl"
7430                 ;;
7431         esac
7432         ;;
7433 esac
7434 echo "I'll use $startperl to start perl scripts."
7435
7436 : figure best path for perl in scripts
7437 case "$perlpath" in
7438 '')
7439         perlpath="$binexp/perl"
7440         case "$startperl" in
7441         *!*) ;;
7442         *)
7443                 $cat <<EOH
7444
7445 I will use the "eval 'exec'" idiom to start Perl on your system.
7446 I can use the full path of your Perl binary for this purpose, but
7447 doing so may cause problems if you want to share those scripts and
7448 Perl is not always in a standard place ($binexp/perl).
7449
7450 EOH
7451                 dflt="$binexp/perl"
7452                 rp="What path shall I use in \"eval 'exec'\"?"
7453                 . ./myread
7454                 perlpath="$ans"
7455                 ;;
7456         esac
7457         ;;
7458 esac
7459 case "$startperl" in
7460 *!*)    ;;
7461 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7462 esac
7463
7464 : determine where public executable scripts go
7465 set scriptdir scriptdir
7466 eval $prefixit
7467 case "$scriptdir" in
7468 '')
7469         dflt="$bin"
7470         : guess some guesses
7471         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7472         $test -d /usr/share/bin     && dflt=/usr/share/bin
7473         $test -d /usr/local/script  && dflt=/usr/local/script
7474         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7475         $test -d $prefixexp/script  && dflt=$prefixexp/script
7476         set dflt
7477         eval $prefixup
7478         ;;
7479 *)  dflt="$scriptdir"
7480         ;;
7481 esac
7482 $cat <<EOM
7483  
7484 Some installations have a separate directory just for executable scripts so
7485 that they can mount it across multiple architectures but keep the scripts in
7486 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7487 Or you might just lump your scripts in with all your other executables.
7488  
7489 EOM
7490 fn=d~
7491 rp='Where do you keep publicly executable scripts?'
7492 . ./getfile
7493 if $test "X$ansexp" != "X$scriptdirexp"; then
7494         installscript=''
7495 fi
7496 scriptdir="$ans"
7497 scriptdirexp="$ansexp"
7498 : Change installation prefix, if necessary.
7499 if $test X"$prefix" != X"$installprefix"; then
7500         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7501 else
7502         installscript="$scriptdirexp"
7503 fi
7504
7505 : determine where add-on public executables go
7506 case "$sitebin" in
7507 '')     dflt=$siteprefix/bin ;;
7508 *)      dflt=$sitebin ;;
7509 esac
7510 fn=d~
7511 rp='Pathname where the add-on public executables should be installed?'
7512 . ./getfile
7513 sitebin="$ans"
7514 sitebinexp="$ansexp"
7515 : Change installation prefix, if necessary.
7516 if $test X"$prefix" != X"$installprefix"; then
7517         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7518 else
7519         installsitebin="$sitebinexp"
7520 fi
7521
7522 case "$useperlio" in
7523 $define|true|[yY]*)     dflt='y';;
7524 *) dflt='n';;
7525 esac
7526 cat <<EOM
7527
7528 Previous version of $package used the standard IO mechanisms as
7529 defined in <stdio.h>.  Versions 5.003_02 and later of perl allow
7530 alternate IO mechanisms via the PerlIO abstraction layer, but the
7531 stdio mechanism is still the default.  This abstraction layer can
7532 use AT&T's sfio (if you already have sfio installed) or regular stdio.
7533 Using PerlIO with sfio may cause problems with some extension modules.
7534
7535 If this doesn't make any sense to you, just accept the default '$dflt'.
7536 EOM
7537 rp='Use the experimental PerlIO abstraction layer?'
7538 . ./myread
7539 case "$ans" in
7540 y|Y) 
7541         val="$define"
7542         ;;     
7543 *)      
7544         echo "Ok, doing things the stdio way."
7545         val="$undef"
7546         ;;
7547 esac
7548 set useperlio
7549 eval $setvar 
7550
7551 case "$usesocks" in
7552 $define|true|[yY]*)
7553         case "$useperlio" in
7554         $define|true|[yY]*) ;;
7555         *)      cat >&4 <<EOM
7556
7557 You are using the SOCKS proxy protocol library which means that you
7558 should also use the PerlIO layer.  You may be headed for trouble.
7559
7560 EOM
7561                 ;;
7562         esac
7563         ;;
7564 esac
7565
7566         
7567 case "$vendorprefix" in
7568 '')     d_vendorbin="$undef"
7569         vendorbin=''
7570         vendorbinexp=''
7571         ;;
7572 *)      d_vendorbin="$define"
7573         : determine where vendor-supplied executables go.
7574         case "$vendorbin" in
7575         '') dflt=$vendorprefix/bin ;;
7576         *)      dflt="$vendorbin" ;;
7577         esac
7578         fn=d~+
7579         rp='Pathname for the vendor-supplied executables directory?'
7580         . ./getfile
7581         vendorbin="$ans"
7582         vendorbinexp="$ansexp"
7583         ;;
7584 esac
7585 : Change installation prefix, if necessary.
7586 if $test X"$prefix" != X"$installprefix"; then
7587         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7588 else
7589         installvendorbin="$vendorbinexp"
7590 fi
7591
7592 : see if qgcvt exists
7593 set qgcvt d_qgcvt
7594 eval $inlibc
7595
7596 echo " "
7597
7598 if $test X"$d_longdbl" = X"$define"; then
7599
7600 echo "Checking how to print long doubles..." >&4
7601
7602 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7603         $cat >try.c <<'EOCP'
7604 #include <sys/types.h>
7605 #include <stdio.h>
7606 int main() {
7607   double d = 123.456;
7608   printf("%.3f\n", d);
7609 }
7610 EOCP
7611         set try
7612         if eval $compile; then
7613                 yyy=`./try$exe_ext`
7614                 case "$yyy" in
7615                 123.456)
7616                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7617                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
7618                         echo "We will use %f."
7619                         ;;
7620                 esac
7621         fi
7622 fi
7623
7624 if $test X"$sPRIfldbl" = X; then
7625         $cat >try.c <<'EOCP'
7626 #include <sys/types.h>
7627 #include <stdio.h>
7628 int main() {
7629   long double d = 123.456;
7630   printf("%.3llf\n", d);
7631 }
7632 EOCP
7633         set try
7634         if eval $compile; then
7635                 yyy=`./try$exe_ext`
7636                 case "$yyy" in
7637                 123.456)
7638                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7639                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
7640                         echo "We will use %llf."
7641                         ;;
7642                 esac
7643         fi
7644 fi
7645
7646 if $test X"$sPRIfldbl" = X; then
7647         $cat >try.c <<'EOCP'
7648 #include <sys/types.h>
7649 #include <stdio.h>
7650 int main() {
7651   long double d = 123.456;
7652   printf("%.3Lf\n", d);
7653 }
7654 EOCP
7655         set try
7656         if eval $compile; then
7657                 yyy=`./try$exe_ext`
7658                 case "$yyy" in
7659                 123.456)
7660                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7661                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
7662                         echo "We will use %Lf."
7663                         ;;
7664                 esac
7665         fi
7666 fi
7667
7668 if $test X"$sPRIfldbl" = X; then
7669         $cat >try.c <<'EOCP'
7670 #include <sys/types.h>
7671 #include <stdio.h>
7672 int main() {
7673   long double d = 123.456;
7674   printf("%.3lf\n", d);
7675 }
7676 EOCP
7677         set try
7678         if eval $compile; then
7679                 yyy=`./try$exe_ext`
7680                 case "$yyy" in
7681                 123.456)
7682                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7683                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
7684                         echo "We will use %lf."
7685                         ;;
7686                 esac
7687         fi
7688 fi
7689
7690 if $test X"$sPRIfldbl" = X; then
7691         echo "Cannot figure out how to print long doubles." >&4
7692 else
7693         sSCNfldbl=$sPRIfldbl    # expect consistency
7694 fi
7695
7696 $rm -f try try.*
7697
7698 fi # d_longdbl
7699
7700 case "$sPRIfldbl" in
7701 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7702         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
7703         d_SCNfldbl="$undef";
7704         ;;
7705 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7706         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
7707         d_SCNfldbl="$define";
7708         ;;
7709 esac
7710
7711 : Check how to convert floats to strings.
7712 echo " "
7713 echo "Checking for an efficient way to convert floats to strings."
7714 echo " " > try.c
7715 case "$uselongdouble" in
7716 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
7717 esac
7718 case "$d_longdbl" in
7719 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
7720 esac
7721 case "$d_PRIgldbl" in
7722 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
7723 esac
7724 $cat >>try.c <<EOP
7725 #ifdef TRY_gconvert
7726 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
7727 char *myname = "gconvert";
7728 #endif
7729 #ifdef TRY_gcvt
7730 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
7731 char *myname = "gcvt";
7732 #endif
7733 #ifdef TRY_qgcvt
7734 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
7735 char *myname = "qgcvt";
7736 #define DOUBLETYPE long double
7737 #endif
7738 #ifdef TRY_sprintf
7739 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
7740 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
7741 #else
7742 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
7743 #endif
7744 char *myname = "sprintf";
7745 #endif
7746
7747 #ifndef DOUBLETYPE
7748 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
7749 #define DOUBLETYPE long double
7750 #else
7751 #define DOUBLETYPE double
7752 #endif
7753 #endif
7754
7755 #include <stdio.h>
7756
7757 #define I_STDLIB $i_stdlib
7758 #ifdef I_STDLIB
7759 #include <stdlib.h>
7760 #endif
7761
7762 int
7763 checkit(expect, got)
7764 char *expect;
7765 char *got;
7766 {
7767     if (strcmp(expect, got)) {
7768                 printf("%s oddity:  Expected %s, got %s\n",
7769                         myname, expect, got);
7770                 exit(1);
7771         }
7772 }
7773
7774 int main()
7775
7776         char buf[64]; 
7777         buf[63] = '\0';
7778
7779         /* This must be 1st test on (which?) platform */
7780         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
7781         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
7782         checkit("0.1", buf);
7783
7784         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
7785         checkit("1", buf);
7786
7787         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
7788         checkit("1.1", buf);
7789
7790         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
7791         checkit("1.01", buf);
7792
7793         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
7794         checkit("1.001", buf);
7795
7796         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
7797         checkit("1.0001", buf);
7798
7799         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
7800         checkit("1.00001", buf);
7801
7802         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
7803         checkit("1.000001", buf);
7804
7805         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
7806         checkit("0", buf);
7807
7808         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
7809         checkit("-1", buf);
7810
7811         /* Some Linux gcvt's give 1.e+5 here. */
7812         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
7813         checkit("100000", buf);
7814         
7815         /* Some Linux gcvt's give -1.e+5 here. */
7816         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
7817         checkit("-100000", buf);
7818
7819         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
7820         checkit("123.456", buf);
7821
7822         exit(0);
7823 }
7824 EOP
7825 case "$d_Gconvert" in
7826 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
7827 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
7828 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
7829 *) xxx_list='gconvert gcvt sprintf' ;;
7830 esac
7831
7832 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
7833 "$define$define$define")
7834     # for long doubles prefer first qgcvt, then sprintf
7835     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
7836     xxx_list="sprintf $xxx_list"
7837     case "$d_qgcvt" in
7838     "$define") xxx_list="qgcvt $xxx_list" ;;
7839     esac
7840     ;;
7841 esac
7842
7843 for xxx_convert in $xxx_list; do
7844         echo "Trying $xxx_convert..."
7845         $rm -f try try$_o
7846         set try -DTRY_$xxx_convert
7847         if eval $compile; then
7848                 echo "$xxx_convert() found." >&4
7849                 if ./try; then
7850                         echo "I'll use $xxx_convert to convert floats into a string." >&4
7851                         break;
7852                 else
7853                         echo "...But $xxx_convert didn't work as I expected."
7854                 fi
7855         else
7856                 echo "$xxx_convert NOT found." >&4
7857         fi
7858 done
7859         
7860 case "$xxx_convert" in
7861 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
7862 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
7863 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
7864 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
7865    "$define$define$define")
7866       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
7867    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
7868    esac
7869    ;;  
7870 esac
7871
7872 : see if _fwalk exists
7873 set fwalk d__fwalk
7874 eval $inlibc
7875
7876 : Initialize h_fcntl
7877 h_fcntl=false
7878
7879 : Initialize h_sysfile
7880 h_sysfile=false
7881
7882 : access call always available on UNIX
7883 set access d_access
7884 eval $inlibc
7885
7886 : locate the flags for 'access()'
7887 case "$d_access" in
7888 "$define")
7889         echo " "
7890         $cat >access.c <<'EOCP'
7891 #include <sys/types.h>
7892 #ifdef I_FCNTL
7893 #include <fcntl.h>
7894 #endif
7895 #ifdef I_SYS_FILE
7896 #include <sys/file.h>
7897 #endif
7898 #ifdef I_UNISTD
7899 #include <unistd.h>
7900 #endif
7901 int main() {
7902         exit(R_OK);
7903 }
7904 EOCP
7905         : check sys/file.h first, no particular reason here
7906         if $test `./findhdr sys/file.h` && \
7907                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
7908                 h_sysfile=true;
7909                 echo "<sys/file.h> defines the *_OK access constants." >&4
7910         elif $test `./findhdr fcntl.h` && \
7911                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
7912                 h_fcntl=true;
7913                 echo "<fcntl.h> defines the *_OK access constants." >&4
7914         elif $test `./findhdr unistd.h` && \
7915                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
7916                 echo "<unistd.h> defines the *_OK access constants." >&4
7917         else
7918                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7919         fi
7920         ;;
7921 esac
7922 $rm -f access*
7923
7924 : see if accessx exists
7925 set accessx d_accessx
7926 eval $inlibc
7927
7928 : see if alarm exists
7929 set alarm d_alarm
7930 eval $inlibc
7931
7932 : see if atolf exists
7933 set atolf d_atolf
7934 eval $inlibc
7935
7936 : see if atoll exists
7937 set atoll d_atoll
7938 eval $inlibc
7939
7940 : Look for GNU-cc style attribute checking
7941 echo " "
7942 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7943 $cat >attrib.c <<'EOCP'
7944 #include <stdio.h>
7945 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7946 EOCP
7947 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7948         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7949                 echo "Your C compiler doesn't fully support __attribute__."
7950                 val="$undef"
7951         else
7952                 echo "Your C compiler supports __attribute__."
7953                 val="$define"
7954         fi
7955 else
7956         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7957         val="$undef"
7958 fi
7959 set d_attribut
7960 eval $setvar
7961 $rm -f attrib*
7962
7963 : see if bcmp exists
7964 set bcmp d_bcmp
7965 eval $inlibc
7966
7967 : see if bcopy exists
7968 set bcopy d_bcopy
7969 eval $inlibc
7970
7971 : see if this is a unistd.h system
7972 set unistd.h i_unistd
7973 eval $inhdr
7974
7975 : see if getpgrp exists
7976 set getpgrp d_getpgrp
7977 eval $inlibc
7978
7979 case "$d_getpgrp" in
7980 "$define")
7981         echo " "
7982         echo "Checking to see which flavor of getpgrp is in use..."
7983         $cat >set.c <<EOP
7984 #$i_unistd I_UNISTD
7985 #include <sys/types.h>
7986 #ifdef I_UNISTD
7987 #  include <unistd.h>
7988 #endif
7989 int main()
7990 {
7991         if (getuid() == 0) {
7992                 printf("(I see you are running Configure as super-user...)\n");
7993                 setuid(1);
7994         }
7995 #ifdef TRY_BSD_PGRP
7996         if (getpgrp(1) == 0)
7997                 exit(0);
7998 #else
7999         if (getpgrp() > 0)
8000                 exit(0);
8001 #endif
8002         exit(1);
8003 }
8004 EOP
8005         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8006                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
8007                 val="$define"
8008         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8009                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
8010                 val="$undef"
8011         else
8012                 echo "I can't seem to compile and run the test program."
8013                 if ./usg; then
8014                         xxx="a USG one, i.e. you use getpgrp()."
8015                 else
8016                         # SVR4 systems can appear rather BSD-ish.
8017                         case "$i_unistd" in
8018                         $undef)
8019                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
8020                                 val="$define"
8021                                 ;;
8022                         $define)
8023                                 xxx="probably a USG one, i.e. you use getpgrp()."
8024                                 val="$undef"
8025                                 ;;
8026                         esac
8027                 fi
8028                 echo "Assuming your getpgrp is $xxx" >&4
8029         fi
8030         ;;
8031 *) val="$undef";;
8032 esac
8033 set d_bsdgetpgrp
8034 eval $setvar
8035 $rm -f set set.c
8036
8037 : see if setpgrp exists
8038 set setpgrp d_setpgrp
8039 eval $inlibc
8040
8041 case "$d_setpgrp" in
8042 "$define")
8043         echo " "
8044         echo "Checking to see which flavor of setpgrp is in use..."
8045         $cat >set.c <<EOP
8046 #$i_unistd I_UNISTD
8047 #include <sys/types.h>
8048 #ifdef I_UNISTD
8049 #  include <unistd.h>
8050 #endif
8051 int main()
8052 {
8053         if (getuid() == 0) {
8054                 printf("(I see you are running Configure as super-user...)\n");
8055                 setuid(1);
8056         }
8057 #ifdef TRY_BSD_PGRP
8058         if (-1 == setpgrp(1, 1))
8059                 exit(0);
8060 #else
8061         if (setpgrp() != -1)
8062                 exit(0);
8063 #endif
8064         exit(1);
8065 }
8066 EOP
8067         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8068                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8069                 val="$define"
8070         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8071                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8072                 val="$undef"
8073         else
8074                 echo "(I can't seem to compile and run the test program.)"
8075                 if ./usg; then
8076                         xxx="a USG one, i.e. you use setpgrp()."
8077                 else
8078                         # SVR4 systems can appear rather BSD-ish.
8079                         case "$i_unistd" in
8080                         $undef)
8081                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8082                                 val="$define"
8083                                 ;;
8084                         $define)
8085                                 xxx="probably a USG one, i.e. you use setpgrp()."
8086                                 val="$undef"
8087                                 ;;
8088                         esac
8089                 fi
8090                 echo "Assuming your setpgrp is $xxx" >&4
8091         fi
8092         ;;
8093 *) val="$undef";;
8094 esac
8095 set d_bsdsetpgrp
8096 eval $setvar
8097 $rm -f set set.c
8098 : see if bzero exists
8099 set bzero d_bzero
8100 eval $inlibc
8101
8102 : see if signal is declared as pointer to function returning int or void
8103 echo " "
8104 xxx=`./findhdr signal.h`
8105 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8106 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
8107         echo "You have int (*signal())() instead of void." >&4
8108         val="$undef"
8109 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
8110         echo "You have void (*signal())()." >&4
8111         val="$define"
8112 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8113         echo "You have int (*signal())() instead of void." >&4
8114         val="$undef"
8115 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8116         echo "You have void (*signal())()." >&4
8117         val="$define"
8118 else
8119         case "$d_voidsig" in
8120         '')
8121         echo "I can't determine whether signal handler returns void or int..." >&4
8122                 dflt=void
8123                 rp="What type does your signal handler return?"
8124                 . ./myread
8125                 case "$ans" in
8126                 v*) val="$define";;
8127                 *) val="$undef";;
8128                 esac;;
8129         "$define")
8130                 echo "As you already told me, signal handler returns void." >&4
8131                 val="$define"
8132                 ;;
8133         *)      echo "As you already told me, signal handler returns int." >&4
8134                 val="$undef"
8135                 ;;
8136         esac
8137 fi
8138 set d_voidsig
8139 eval $setvar
8140 case "$d_voidsig" in
8141 "$define") signal_t="void";;
8142 *) signal_t="int";;
8143 esac
8144 $rm -f $$.tmp
8145
8146 : check for ability to cast large floats to 32-bit ints.
8147 echo " "
8148 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8149 if $test "$intsize" -ge 4; then
8150         xxx=int
8151 else
8152         xxx=long
8153 fi
8154 $cat >try.c <<EOCP
8155 #include <stdio.h>
8156 #include <sys/types.h>
8157 #include <signal.h>
8158 $signal_t blech(s) int s; { exit(3); }
8159 int main()
8160 {
8161         $xxx i32;
8162         double f, g;
8163         int result = 0;
8164         char str[16];
8165         signal(SIGFPE, blech);
8166
8167         /* Don't let compiler optimize the test away.  Store the number 
8168            in a writable string for gcc to pass to sscanf under HP/UX.
8169         */
8170         sprintf(str, "2147483647");
8171         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8172         g = 10 * f;
8173         i32  = ($xxx) g;
8174
8175         /* x86 processors will probably give 0x8000 0000, which is a
8176        sign change.  We don't want that.  We want to mimic SPARC
8177            behavior here, which is to preserve the sign and give
8178            back 0x7fff ffff.
8179         */
8180         if (i32 != ($xxx) f)
8181                 result |= 1;
8182         exit(result);
8183 }
8184 EOCP
8185 set try
8186 if eval $compile_ok; then
8187         ./try
8188         yyy=$?
8189 else
8190         echo "(I can't seem to compile the test program--assuming it can't)"
8191         yyy=1
8192 fi
8193 case "$yyy" in
8194 0)      val="$define"
8195         echo "Yup, it can."
8196         ;;
8197 *)      val="$undef"
8198         echo "Nope, it can't."
8199         ;;
8200 esac
8201 set d_casti32
8202 eval $setvar
8203 $rm -f try try.*
8204
8205 : check for ability to cast negative floats to unsigned
8206 echo " "
8207 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8208 $cat >try.c <<EOCP
8209 #include <stdio.h>
8210 #include <sys/types.h>
8211 #include <signal.h>
8212 $signal_t blech(s) int s; { exit(7); }
8213 $signal_t blech_in_list(s) int s; { exit(4); }
8214 unsigned long dummy_long(p) unsigned long p; { return p; }
8215 unsigned int dummy_int(p) unsigned int p; { return p; }
8216 unsigned short dummy_short(p) unsigned short p; { return p; }
8217 int main()
8218 {
8219         double f;
8220         unsigned long along;
8221         unsigned int aint;
8222         unsigned short ashort;
8223         int result = 0;
8224         char str[16];
8225         
8226         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8227            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8228            optimized the whole file away
8229         */
8230         /* Store the number in a writable string for gcc to pass to 
8231            sscanf under HP/UX.
8232         */
8233         sprintf(str, "-123");
8234         sscanf(str, "%lf", &f);  /* f = -123.; */
8235
8236         signal(SIGFPE, blech);
8237         along = (unsigned long)f;
8238         aint = (unsigned int)f;
8239         ashort = (unsigned short)f;
8240         if (along != (unsigned long)-123)
8241                 result |= 1;
8242         if (aint != (unsigned int)-123)
8243                 result |= 1;
8244         if (ashort != (unsigned short)-123)
8245                 result |= 1;
8246         sprintf(str, "1073741824.");
8247         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8248         f = f + f;
8249         along = 0;
8250         along = (unsigned long)f;
8251         if (along != 0x80000000)
8252                 result |= 2;
8253         f -= 1.;
8254         along = 0;
8255         along = (unsigned long)f;
8256         if (along != 0x7fffffff)
8257                 result |= 1;
8258         f += 2.;
8259         along = 0;
8260         along = (unsigned long)f;
8261         if (along != 0x80000001)
8262                 result |= 2;
8263         if (result)
8264                 exit(result);
8265         signal(SIGFPE, blech_in_list);
8266         sprintf(str, "123.");
8267         sscanf(str, "%lf", &f);  /* f = 123.; */
8268         along = dummy_long((unsigned long)f);
8269         aint = dummy_int((unsigned int)f);
8270         ashort = dummy_short((unsigned short)f);
8271         if (along != (unsigned long)123)
8272                 result |= 4;
8273         if (aint != (unsigned int)123)
8274                 result |= 4;
8275         if (ashort != (unsigned short)123)
8276                 result |= 4;
8277         exit(result);
8278
8279 }
8280 EOCP
8281 set try
8282 if eval $compile_ok; then
8283         ./try
8284         castflags=$?
8285 else
8286         echo "(I can't seem to compile the test program--assuming it can't)"
8287         castflags=7
8288 fi
8289 case "$castflags" in
8290 0)      val="$define"
8291         echo "Yup, it can."
8292         ;;
8293 *)      val="$undef"
8294         echo "Nope, it can't."
8295         ;;
8296 esac
8297 set d_castneg
8298 eval $setvar
8299 $rm -f try.*
8300
8301 : see if vprintf exists
8302 echo " "
8303 if set vprintf val -f d_vprintf; eval $csym; $val; then
8304         echo 'vprintf() found.' >&4
8305         val="$define"
8306         $cat >vprintf.c <<'EOF'
8307 #include <varargs.h>
8308
8309 int main() { xxx("foo"); }
8310
8311 xxx(va_alist)
8312 va_dcl
8313 {
8314         va_list args;
8315         char buf[10];
8316
8317         va_start(args);
8318         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8319 }
8320 EOF
8321         set vprintf
8322         if eval $compile && ./vprintf; then
8323                 echo "Your vsprintf() returns (int)." >&4
8324                 val2="$undef"
8325         else
8326                 echo "Your vsprintf() returns (char*)." >&4
8327                 val2="$define"
8328         fi
8329 else
8330         echo 'vprintf() NOT found.' >&4
8331                 val="$undef"
8332                 val2="$undef"
8333 fi
8334 set d_vprintf
8335 eval $setvar
8336 val=$val2
8337 set d_charvspr
8338 eval $setvar
8339
8340 : see if chown exists
8341 set chown d_chown
8342 eval $inlibc
8343
8344 : see if chroot exists
8345 set chroot d_chroot
8346 eval $inlibc
8347
8348 : see if chsize exists
8349 set chsize d_chsize
8350 eval $inlibc
8351
8352 : check for const keyword
8353 echo " "
8354 echo 'Checking to see if your C compiler knows about "const"...' >&4
8355 $cat >const.c <<'EOCP'
8356 typedef struct spug { int drokk; } spug;
8357 int main()
8358 {
8359         const char *foo;
8360         const spug y;
8361 }
8362 EOCP
8363 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8364         val="$define"
8365         echo "Yup, it does."
8366 else
8367         val="$undef"
8368         echo "Nope, it doesn't."
8369 fi
8370 set d_const
8371 eval $setvar
8372
8373 : see if crypt exists
8374 echo " "
8375 if set crypt val -f d_crypt; eval $csym; $val; then
8376         echo 'crypt() found.' >&4
8377         val="$define"
8378         cryptlib=''
8379 else
8380         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8381         if $test -z "$cryptlib"; then
8382                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8383         else
8384                 cryptlib=-lcrypt
8385         fi
8386         if $test -z "$cryptlib"; then
8387                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8388         else
8389                 cryptlib=-lcrypt
8390         fi
8391         if $test -z "$cryptlib"; then
8392                 cryptlib=`./loc libcrypt$_a "" $libpth`
8393         else
8394                 cryptlib=-lcrypt
8395         fi
8396         if $test -z "$cryptlib"; then
8397                 echo 'crypt() NOT found.' >&4
8398                 val="$undef"
8399         else
8400                 val="$define"
8401         fi
8402 fi
8403 set d_crypt
8404 eval $setvar
8405
8406 : get csh whereabouts
8407 case "$csh" in
8408 'csh') val="$undef" ;;
8409 *) val="$define" ;;
8410 esac
8411 set d_csh
8412 eval $setvar
8413 : Respect a hint or command line value for full_csh.
8414 case "$full_csh" in
8415 '') full_csh=$csh ;;
8416 esac
8417
8418 : see if cuserid exists
8419 set cuserid d_cuserid
8420 eval $inlibc
8421
8422 : see if this is a limits.h system
8423 set limits.h i_limits
8424 eval $inhdr
8425
8426 : see if this is a float.h system
8427 set float.h i_float
8428 eval $inhdr
8429
8430 : See if number of significant digits in a double precision number is known
8431 echo " "
8432 $cat >dbl_dig.c <<EOM
8433 #$i_limits I_LIMITS
8434 #$i_float I_FLOAT
8435 #ifdef I_LIMITS
8436 #include <limits.h>
8437 #endif
8438 #ifdef I_FLOAT
8439 #include <float.h>
8440 #endif
8441 #ifdef DBL_DIG
8442 printf("Contains DBL_DIG");
8443 #endif
8444 EOM
8445 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8446 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8447         echo "DBL_DIG found." >&4
8448         val="$define"
8449 else
8450         echo "DBL_DIG NOT found." >&4
8451         val="$undef"
8452 fi
8453 $rm -f dbl_dig.?
8454 set d_dbl_dig
8455 eval $setvar
8456
8457 : see if difftime exists
8458 set difftime d_difftime
8459 eval $inlibc
8460
8461 : see if this is a dirent system
8462 echo " "
8463 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8464         val="$define"
8465         echo "<dirent.h> found." >&4
8466 else
8467         val="$undef"
8468         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8469                 echo "<sys/dir.h> found." >&4
8470                 echo " "
8471         else
8472                 xinc=`./findhdr sys/ndir.h`
8473         fi
8474         echo "<dirent.h> NOT found." >&4
8475 fi
8476 set i_dirent
8477 eval $setvar
8478
8479 : Look for type of directory structure.
8480 echo " "
8481 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8482
8483 case "$direntrytype" in
8484 ''|' ')
8485         case "$i_dirent" in
8486         $define) guess1='struct dirent' ;;
8487         *) guess1='struct direct'  ;;
8488         esac
8489         ;;
8490 *)      guess1="$direntrytype"
8491         ;;
8492 esac
8493
8494 case "$guess1" in
8495 'struct dirent') guess2='struct direct' ;;
8496 *) guess2='struct dirent' ;;
8497 esac
8498                 
8499 if $contains "$guess1" try.c >/dev/null 2>&1; then
8500         direntrytype="$guess1"
8501         echo "Your directory entries are $direntrytype." >&4
8502 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8503         direntrytype="$guess2"
8504         echo "Your directory entries seem to be $direntrytype." >&4
8505 else
8506         echo "I don't recognize your system's directory entries." >&4
8507         rp="What type is used for directory entries on this system?"
8508         dflt="$guess1"
8509         . ./myread
8510         direntrytype="$ans"
8511 fi
8512 $rm -f try.c
8513
8514
8515 : see if the directory entry stores field length
8516 echo " "
8517 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8518 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8519         echo "Good, your directory entry keeps length information in d_namlen." >&4
8520         val="$define"
8521 else
8522         echo "Your directory entry does not know about the d_namlen field." >&4
8523         val="$undef"
8524 fi
8525 set d_dirnamlen
8526 eval $setvar
8527 $rm -f try.c
8528
8529 : see if dlerror exists
8530 xxx_runnm="$runnm"
8531 runnm=false
8532 set dlerror d_dlerror
8533 eval $inlibc
8534 runnm="$xxx_runnm"
8535
8536 : see if dlfcn is available
8537 set dlfcn.h i_dlfcn
8538 eval $inhdr
8539
8540 case "$usedl" in
8541 $define|y|true)
8542         $cat << EOM
8543
8544 On a few systems, the dynamically loaded modules that perl generates and uses
8545 will need a different extension than shared libs. The default will probably
8546 be appropriate.
8547
8548 EOM
8549         case "$dlext" in
8550         '')     dflt="$so" ;;
8551         *)      dflt="$dlext" ;;
8552         esac
8553         rp='What is the extension of dynamically loaded modules'
8554         . ./myread
8555         dlext="$ans"
8556         ;;
8557 *)
8558         dlext="none"
8559         ;;
8560 esac
8561
8562 : Check if dlsym need a leading underscore
8563 echo " "
8564 val="$undef"
8565
8566 case "$dlsrc" in
8567 dl_dlopen.xs)
8568         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8569         $cat >dyna.c <<'EOM'
8570 fred () { }
8571 EOM
8572
8573 $cat >fred.c<<EOM
8574
8575 #include <stdio.h>
8576 #$i_dlfcn I_DLFCN
8577 #ifdef I_DLFCN
8578 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8579 #else
8580 #include <sys/types.h>
8581 #include <nlist.h>
8582 #include <link.h>
8583 #endif
8584
8585 extern int fred() ;
8586
8587 int main()
8588 {
8589     void * handle ;
8590     void * symbol ;
8591 #ifndef RTLD_LAZY
8592     int mode = 1 ;
8593 #else
8594     int mode = RTLD_LAZY ;
8595 #endif
8596     handle = dlopen("./dyna.$dlext", mode) ;
8597     if (handle == NULL) {
8598         printf ("1\n") ;
8599         fflush (stdout) ;
8600         exit(0);
8601     }
8602     symbol = dlsym(handle, "fred") ;
8603     if (symbol == NULL) {
8604         /* try putting a leading underscore */
8605         symbol = dlsym(handle, "_fred") ;
8606         if (symbol == NULL) {
8607             printf ("2\n") ;
8608             fflush (stdout) ;
8609             exit(0);
8610         }
8611         printf ("3\n") ;
8612     }
8613     else
8614         printf ("4\n") ;
8615     fflush (stdout) ;
8616     exit(0);
8617 }
8618 EOM
8619         : Call the object file tmp-dyna.o in case dlext=o.
8620         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8621                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8622                 $ld -o dyna.$dlext $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
8623                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8624                 xxx=`./fred`
8625                 case $xxx in
8626                 1)      echo "Test program failed using dlopen." >&4
8627                         echo "Perhaps you should not use dynamic loading." >&4;;
8628                 2)      echo "Test program failed using dlsym." >&4
8629                         echo "Perhaps you should not use dynamic loading." >&4;;
8630                 3)      echo "dlsym needs a leading underscore" >&4
8631                         val="$define" ;;
8632                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8633                 esac
8634         else
8635                 echo "I can't compile and run the test program." >&4
8636                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8637         fi
8638         ;;
8639 esac
8640                 
8641 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8642
8643 set d_dlsymun
8644 eval $setvar
8645
8646 hasproto='varname=$1; func=$2; shift; shift;
8647 while $test $# -ge 2; do
8648         case "$1" in
8649         $define) echo "#include <$2>";;
8650         esac ;
8651     shift 2;
8652 done > try.c;
8653 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8654 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8655         echo "$func() prototype found.";
8656         val="$define";
8657 else
8658         echo "$func() prototype NOT found.";
8659         val="$undef";
8660 fi;
8661 set $varname;
8662 eval $setvar;
8663 $rm -f try.c tryout.c'
8664
8665 : see if prototype for drand48 is available
8666 echo " "
8667 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8668 eval $hasproto
8669
8670 : see if dup2 exists
8671 set dup2 d_dup2
8672 eval $inlibc
8673
8674 : see if eaccess exists
8675 set eaccess d_eaccess
8676 eval $inlibc
8677
8678 : see if endgrent exists
8679 set endgrent d_endgrent
8680 eval $inlibc
8681
8682 : see if endhostent exists
8683 set endhostent d_endhent
8684 eval $inlibc
8685
8686 : see if endnetent exists
8687 set endnetent d_endnent
8688 eval $inlibc
8689
8690 : see if endprotoent exists
8691 set endprotoent d_endpent
8692 eval $inlibc
8693
8694 : see if endpwent exists
8695 set endpwent d_endpwent
8696 eval $inlibc
8697
8698 : see if endservent exists
8699 set endservent d_endsent
8700 eval $inlibc
8701
8702 : Locate the flags for 'open()'
8703 echo " "
8704 $cat >open3.c <<'EOCP'
8705 #include <sys/types.h>
8706 #ifdef I_FCNTL
8707 #include <fcntl.h>
8708 #endif
8709 #ifdef I_SYS_FILE
8710 #include <sys/file.h>
8711 #endif
8712 int main() {
8713         if(O_RDONLY);
8714 #ifdef O_TRUNC
8715         exit(0);
8716 #else
8717         exit(1);
8718 #endif
8719 }
8720 EOCP
8721 : check sys/file.h first to get FREAD on Sun
8722 if $test `./findhdr sys/file.h` && \
8723                 set open3 -DI_SYS_FILE && eval $compile; then
8724         h_sysfile=true;
8725         echo "<sys/file.h> defines the O_* constants..." >&4
8726         if ./open3; then
8727                 echo "and you have the 3 argument form of open()." >&4
8728                 val="$define"
8729         else
8730                 echo "but not the 3 argument form of open().  Oh, well." >&4
8731                 val="$undef"
8732         fi
8733 elif $test `./findhdr fcntl.h` && \
8734                 set open3 -DI_FCNTL && eval $compile; then
8735         h_fcntl=true;
8736         echo "<fcntl.h> defines the O_* constants..." >&4
8737         if ./open3; then
8738                 echo "and you have the 3 argument form of open()." >&4
8739                 val="$define"
8740         else
8741                 echo "but not the 3 argument form of open().  Oh, well." >&4
8742                 val="$undef"
8743         fi
8744 else
8745         val="$undef"
8746         echo "I can't find the O_* constant definitions!  You got problems." >&4
8747 fi
8748 set d_open3
8749 eval $setvar
8750 $rm -f open3*
8751
8752 : see which of string.h or strings.h is needed
8753 echo " "
8754 strings=`./findhdr string.h`
8755 if $test "$strings" && $test -r "$strings"; then
8756         echo "Using <string.h> instead of <strings.h>." >&4
8757         val="$define"
8758 else
8759         val="$undef"
8760         strings=`./findhdr strings.h`
8761         if $test "$strings" && $test -r "$strings"; then
8762                 echo "Using <strings.h> instead of <string.h>." >&4
8763         else
8764                 echo "No string header found -- You'll surely have problems." >&4
8765         fi
8766 fi
8767 set i_string
8768 eval $setvar
8769 case "$i_string" in
8770 "$undef") strings=`./findhdr strings.h`;;
8771 *)        strings=`./findhdr string.h`;;
8772 esac
8773
8774 : check for non-blocking I/O stuff
8775 case "$h_sysfile" in
8776 true) echo "#include <sys/file.h>" > head.c;;
8777 *)
8778         case "$h_fcntl" in
8779         true) echo "#include <fcntl.h>" > head.c;;
8780         *) echo "#include <sys/fcntl.h>" > head.c;;
8781         esac
8782         ;;
8783 esac
8784 echo " "
8785 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8786 case "$o_nonblock" in
8787 '')
8788         $cat head.c > try.c
8789         $cat >>try.c <<'EOCP'
8790 #include <stdio.h>
8791 int main() {
8792 #ifdef O_NONBLOCK
8793         printf("O_NONBLOCK\n");
8794         exit(0);
8795 #endif
8796 #ifdef O_NDELAY
8797         printf("O_NDELAY\n");
8798         exit(0);
8799 #endif
8800 #ifdef FNDELAY
8801         printf("FNDELAY\n");
8802         exit(0);
8803 #endif
8804         exit(0);
8805 }
8806 EOCP
8807         set try
8808         if eval $compile_ok; then
8809                 o_nonblock=`./try`
8810                 case "$o_nonblock" in
8811                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8812                 *) echo "Seems like we can use $o_nonblock.";;
8813                 esac
8814         else
8815                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8816         fi
8817         ;;
8818 *) echo "Using $hint value $o_nonblock.";;
8819 esac
8820 $rm -f try try.* .out core
8821
8822 echo " "
8823 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8824 case "$eagain" in
8825 '')
8826         $cat head.c > try.c
8827         $cat >>try.c <<EOCP
8828 #include <errno.h>
8829 #include <sys/types.h>
8830 #include <signal.h>
8831 #include <stdio.h> 
8832 #define MY_O_NONBLOCK $o_nonblock
8833 #ifndef errno  /* XXX need better Configure test */
8834 extern int errno;
8835 #endif
8836 #$i_unistd I_UNISTD
8837 #ifdef I_UNISTD
8838 #include <unistd.h>
8839 #endif
8840 #$i_string I_STRING
8841 #ifdef I_STRING
8842 #include <string.h>
8843 #else
8844 #include <strings.h>
8845 #endif
8846 $signal_t blech(x) int x; { exit(3); }
8847 EOCP
8848         $cat >> try.c <<'EOCP'
8849 int main()
8850 {
8851         int pd[2];
8852         int pu[2];
8853         char buf[1];
8854         char string[100];
8855
8856         pipe(pd);       /* Down: child -> parent */
8857         pipe(pu);       /* Up: parent -> child */
8858         if (0 != fork()) {
8859                 int ret;
8860                 close(pd[1]);   /* Parent reads from pd[0] */
8861                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8862                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8863                         exit(1);
8864                 signal(SIGALRM, blech);
8865                 alarm(5);
8866                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8867                         exit(2);
8868                 sprintf(string, "%d\n", ret);
8869                 write(2, string, strlen(string));
8870                 alarm(0);
8871 #ifdef EAGAIN
8872                 if (errno == EAGAIN) {
8873                         printf("EAGAIN\n");
8874                         goto ok;
8875                 }
8876 #endif
8877 #ifdef EWOULDBLOCK
8878                 if (errno == EWOULDBLOCK)
8879                         printf("EWOULDBLOCK\n");
8880 #endif
8881         ok:
8882                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8883                 sleep(2);                               /* Give it time to close our pipe */
8884                 alarm(5);
8885                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8886                 alarm(0);
8887                 sprintf(string, "%d\n", ret);
8888                 write(3, string, strlen(string));
8889                 exit(0);
8890         }
8891
8892         close(pd[0]);                   /* We write to pd[1] */
8893         close(pu[1]);                   /* We read from pu[0] */
8894         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8895         close(pd[1]);                   /* Pipe pd is now fully closed! */
8896         exit(0);                                /* Bye bye, thank you for playing! */
8897 }
8898 EOCP
8899         set try
8900         if eval $compile_ok; then
8901                 echo "$startsh" >mtry
8902                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8903                 chmod +x mtry
8904                 ./mtry >/dev/null 2>&1
8905                 case $? in
8906                 0) eagain=`$cat try.out`;;
8907                 1) echo "Could not perform non-blocking setting!";;
8908                 2) echo "I did a successful read() for something that was not there!";;
8909                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8910                 *) echo "Something terribly wrong happened during testing.";;
8911                 esac
8912                 rd_nodata=`$cat try.ret`
8913                 echo "A read() system call with no data present returns $rd_nodata."
8914                 case "$rd_nodata" in
8915                 0|-1) ;;
8916                 *)
8917                         echo "(That's peculiar, fixing that to be -1.)"
8918                         rd_nodata=-1
8919                         ;;
8920                 esac
8921                 case "$eagain" in
8922                 '')
8923                         echo "Forcing errno EAGAIN on read() with no data available."
8924                         eagain=EAGAIN
8925                         ;;
8926                 *)
8927                         echo "Your read() sets errno to $eagain when no data is available."
8928                         ;;
8929                 esac
8930                 status=`$cat try.err`
8931                 case "$status" in
8932                 0) echo "And it correctly returns 0 to signal EOF.";;
8933                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8934                 *) echo "However, your read() returns '$status' on EOF??";;
8935                 esac
8936                 val="$define"
8937                 if test "$status" = "$rd_nodata"; then
8938                         echo "WARNING: you can't distinguish between EOF and no data!"
8939                         val="$undef"
8940                 fi
8941         else
8942                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8943                 eagain=EAGAIN
8944         fi
8945         set d_eofnblk
8946         eval $setvar
8947         ;;
8948 *)
8949         echo "Using $hint value $eagain."
8950         echo "Your read() returns $rd_nodata when no data is present."
8951         case "$d_eofnblk" in
8952         "$define") echo "And you can see EOF because read() returns 0.";;
8953         "$undef") echo "But you can't see EOF status from read() returned value.";;
8954         *)
8955                 echo "(Assuming you can't see EOF status from read anyway.)"
8956                 d_eofnblk=$undef
8957                 ;;
8958         esac
8959         ;;
8960 esac
8961 $rm -f try try.* .out core head.c mtry
8962
8963 : see if fchmod exists
8964 set fchmod d_fchmod
8965 eval $inlibc
8966
8967 : see if fchown exists
8968 set fchown d_fchown
8969 eval $inlibc
8970
8971 : see if this is an fcntl system
8972 set fcntl d_fcntl
8973 eval $inlibc
8974
8975 echo " "
8976 : See if fcntl-based locking works.
8977 $cat >try.c <<'EOCP'
8978 #include <stdlib.h>
8979 #include <unistd.h>
8980 #include <fcntl.h>
8981 int main() {
8982 #if defined(F_SETLK) && defined(F_SETLKW)
8983      struct flock flock;
8984      int retval, fd;
8985      fd = open("try.c", O_RDONLY);
8986      flock.l_type = F_RDLCK;
8987      flock.l_whence = SEEK_SET;
8988      flock.l_start = flock.l_len = 0;
8989      retval = fcntl(fd, F_SETLK, &flock);
8990      close(fd);
8991      (retval < 0 ? exit(2) : exit(0));
8992 #else
8993      exit(2);
8994 #endif
8995 }
8996 EOCP
8997 echo "Checking if fcntl-based file locking works... "
8998 case "$d_fcntl" in
8999 "$define")
9000         set try
9001         if eval $compile_ok; then
9002                 if ./try; then
9003                         echo "Yes, it seems to work."
9004                         val="$define"
9005                 else
9006                         echo "Nope, it didn't work."
9007                         val="$undef"
9008                 fi
9009         else
9010                 echo "I'm unable to compile the test program, so I'll assume not."
9011                 val="$undef"
9012         fi
9013         ;;
9014 *) val="$undef";
9015         echo "Nope, since you don't even have fcntl()."
9016         ;;
9017 esac
9018 set d_fcntl_can_lock
9019 eval $setvar
9020 $rm -f try*
9021
9022
9023 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9024 while $test $# -ge 2; do
9025         case "$1" in
9026         $define) echo "#include <$2>";;
9027         esac ;
9028     shift 2;
9029 done > try.c;
9030 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9031 set try;
9032 if eval $compile; then
9033         val="$define";
9034 else
9035         val="$undef";
9036 fi;
9037 set $varname;
9038 eval $setvar;
9039 $rm -f try.c try.o'
9040
9041 socketlib=''
9042 sockethdr=''
9043 : see whether socket exists
9044 echo " "
9045 $echo $n "Hmm... $c" >&4
9046 if set socket val -f d_socket; eval $csym; $val; then
9047         echo "Looks like you have Berkeley networking support." >&4
9048         d_socket="$define"
9049         if set setsockopt val -f; eval $csym; $val; then
9050                 d_oldsock="$undef"
9051         else
9052                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9053                 d_oldsock="$define"
9054         fi
9055 else
9056         if $contains socklib libc.list >/dev/null 2>&1; then
9057                 echo "Looks like you have Berkeley networking support." >&4
9058                 d_socket="$define"
9059                 : we will have to assume that it supports the 4.2 BSD interface
9060                 d_oldsock="$undef"
9061         else
9062                 echo "You don't have Berkeley networking in libc$_a..." >&4
9063                 if test "X$d_socket" = "X$define"; then
9064                    echo "...but you seem to believe that you have sockets." >&4
9065                 else
9066                         for net in net socket
9067                         do
9068                                 if test -f /usr/lib/lib$net$_a; then
9069                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9070                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9071                                         if $contains socket libc.list >/dev/null 2>&1; then
9072                                                 d_socket="$define"
9073                                                 socketlib="-l$net"
9074                                                 case "$net" in
9075                                                 net)
9076                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9077                                                         sockethdr="-I/usr/netinclude"
9078                                                         ;;
9079                                                 esac
9080                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
9081                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9082                                                         d_oldsock="$undef"
9083                                                 else
9084                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9085                                                         d_oldsock="$define"
9086                                                 fi
9087                                                 break
9088                                         fi
9089                                 fi
9090                         done
9091                         if test "X$d_socket" != "X$define"; then
9092                            echo "or anywhere else I see." >&4
9093                            d_socket="$undef"
9094                            d_oldsock="$undef"
9095                         fi
9096                 fi
9097         fi
9098 fi
9099
9100 : see if socketpair exists
9101 set socketpair d_sockpair
9102 eval $inlibc
9103
9104
9105 echo " "
9106 echo "Checking the availability of certain socket constants..." >& 4
9107 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9108         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9109         $cat >try.c <<EOF
9110 #include <sys/types.h>
9111 #include <sys/socket.h>
9112 int main() {
9113     int i = $ENUM;
9114 }
9115 EOF
9116         val="$undef"
9117         set try; if eval $compile; then
9118                 val="$define"
9119         fi
9120         set d_${enum}; eval $setvar
9121         $rm -f try.c try
9122 done
9123
9124 : see if sys/select.h has to be included
9125 set sys/select.h i_sysselct
9126 eval $inhdr
9127
9128 : see if we should include time.h, sys/time.h, or both
9129 echo " "
9130 if test "X$timeincl" = X; then
9131         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9132         $echo $n "I'm now running the test program...$c"
9133         $cat >try.c <<'EOCP'
9134 #include <sys/types.h>
9135 #ifdef I_TIME
9136 #include <time.h>
9137 #endif
9138 #ifdef I_SYSTIME
9139 #ifdef SYSTIMEKERNEL
9140 #define KERNEL
9141 #endif
9142 #include <sys/time.h>
9143 #endif
9144 #ifdef I_SYSSELECT
9145 #include <sys/select.h>
9146 #endif
9147 int main()
9148 {
9149         struct tm foo;
9150 #ifdef S_TIMEVAL
9151         struct timeval bar;
9152 #endif
9153 #ifdef S_TIMEZONE
9154         struct timezone tzp;
9155 #endif
9156         if (foo.tm_sec == foo.tm_sec)
9157                 exit(0);
9158 #ifdef S_TIMEVAL
9159         if (bar.tv_sec == bar.tv_sec)
9160                 exit(0);
9161 #endif
9162         exit(1);
9163 }
9164 EOCP
9165         flags=''
9166         for s_timezone in '-DS_TIMEZONE' ''; do
9167         sysselect=''
9168         for s_timeval in '-DS_TIMEVAL' ''; do
9169         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9170         for i_time in '' '-DI_TIME'; do
9171         for i_systime in '-DI_SYSTIME' ''; do
9172                 case "$flags" in
9173                 '') $echo $n ".$c"
9174                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9175                         if eval $compile; then
9176                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9177                                 shift
9178                                 flags="$*"
9179                                 echo " "
9180                                 $echo $n "Succeeded with $flags$c"
9181                         fi
9182                         ;;
9183                 esac
9184         done
9185         done
9186         done
9187         done
9188         done
9189         timeincl=''
9190         echo " "
9191         case "$flags" in
9192         *SYSTIMEKERNEL*) i_systimek="$define"
9193                 timeincl=`./findhdr sys/time.h`
9194                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9195         *) i_systimek="$undef";;
9196         esac
9197         case "$flags" in
9198         *I_TIME*) i_time="$define"
9199                 timeincl=`./findhdr time.h`" $timeincl"
9200                 echo "We'll include <time.h>." >&4;;
9201         *) i_time="$undef";;
9202         esac
9203         case "$flags" in
9204         *I_SYSTIME*) i_systime="$define"
9205                 timeincl=`./findhdr sys/time.h`" $timeincl"
9206                 echo "We'll include <sys/time.h>." >&4;;
9207         *) i_systime="$undef";;
9208         esac
9209         $rm -f try.c try
9210 fi
9211
9212 : check for fd_set items
9213 $cat <<EOM
9214
9215 Checking to see how well your C compiler handles fd_set and friends ...
9216 EOM
9217 $cat >fd_set.c <<EOCP
9218 #$i_systime I_SYS_TIME
9219 #$i_sysselct I_SYS_SELECT
9220 #$d_socket HAS_SOCKET
9221 #include <sys/types.h>
9222 #ifdef HAS_SOCKET
9223 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9224 #endif
9225 #ifdef I_SYS_TIME
9226 #include <sys/time.h>
9227 #endif
9228 #ifdef I_SYS_SELECT
9229 #include <sys/select.h>
9230 #endif
9231 int main() {
9232         fd_set fds;
9233
9234 #ifdef TRYBITS
9235         if(fds.fds_bits);
9236 #endif
9237
9238 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9239         exit(0);
9240 #else
9241         exit(1);
9242 #endif
9243 }
9244 EOCP
9245 set fd_set -DTRYBITS
9246 if eval $compile; then
9247         d_fds_bits="$define"
9248         d_fd_set="$define"
9249         echo "Well, your system knows about the normal fd_set typedef..." >&4
9250         if ./fd_set; then
9251                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9252                 d_fd_macros="$define"
9253         else
9254                 $cat >&4 <<'EOM'
9255 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9256 EOM
9257                 d_fd_macros="$undef"
9258         fi
9259 else
9260         $cat <<'EOM'
9261 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9262 EOM
9263         set fd_set
9264         if eval $compile; then
9265                 d_fds_bits="$undef"
9266                 d_fd_set="$define"
9267                 echo "Well, your system has some sort of fd_set available..." >&4
9268                 if ./fd_set; then
9269                         echo "and you have the normal fd_set macros." >&4
9270                         d_fd_macros="$define"
9271                 else
9272                         $cat <<'EOM'
9273 but not the normal fd_set macros!  Gross!  More work for me...
9274 EOM
9275                         d_fd_macros="$undef"
9276                 fi
9277         else
9278         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9279                 d_fd_set="$undef"
9280                 d_fds_bits="$undef"
9281                 d_fd_macros="$undef"
9282         fi
9283 fi
9284 $rm -f fd_set*
9285
9286 : see if fgetpos exists
9287 set fgetpos d_fgetpos
9288 eval $inlibc
9289
9290 : see if flock exists
9291 set flock d_flock
9292 eval $inlibc
9293
9294 : see if fork exists
9295 set fork d_fork
9296 eval $inlibc
9297
9298 : see if pathconf exists
9299 set pathconf d_pathconf
9300 eval $inlibc
9301
9302 : see if fpathconf exists
9303 set fpathconf d_fpathconf
9304 eval $inlibc
9305
9306
9307 : check for fpos64_t
9308 echo " "
9309 echo "Checking to see if you have fpos64_t..." >&4
9310 $cat >try.c <<EOCP
9311 #include <stdio.h>
9312 int main() { fpos64_t x = 7; }
9313 EOCP
9314 set try
9315 if eval $compile; then
9316         val="$define"
9317         echo "You have fpos64_t."
9318 else
9319         val="$undef"
9320         echo "You do not have fpos64_t."
9321         case "$fpossize" in
9322         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9323         esac
9324 fi
9325 $rm -f try.* try
9326 set d_fpos64_t
9327 eval $setvar
9328
9329 : see if frexpl exists
9330 set frexpl d_frexpl
9331 eval $inlibc
9332
9333 hasstruct='varname=$1; struct=$2; shift; shift;
9334 while $test $# -ge 2; do
9335         case "$1" in
9336         $define) echo "#include <$2>";;
9337         esac ;
9338     shift 2;
9339 done > try.c;
9340 echo "int main () { struct $struct foo; }" >> try.c;
9341 set try;
9342 if eval $compile; then
9343         val="$define";
9344 else
9345         val="$undef";
9346 fi;
9347 set $varname;
9348 eval $setvar;
9349 $rm -f try.c try.o'
9350
9351 : see if this is a sys/param system
9352 set sys/param.h i_sysparam
9353 eval $inhdr
9354
9355 : see if this is a sys/mount.h system
9356 set sys/mount.h i_sysmount
9357 eval $inhdr
9358
9359 : see if sys/types.h has to be included
9360 set sys/types.h i_systypes
9361 eval $inhdr
9362
9363
9364 echo " "
9365 echo "Checking to see if your system supports struct fs_data..." >&4
9366 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9367 eval $hasstruct
9368 case "$d_fs_data_s" in
9369 "$define")      echo "Yes, it does."   ;;
9370 *)              echo "No, it doesn't." ;;
9371 esac
9372
9373 : see if fseeko exists
9374 set fseeko d_fseeko
9375 eval $inlibc
9376 case "$longsize" in
9377 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9378 esac
9379
9380 : see if fsetpos exists
9381 set fsetpos d_fsetpos
9382 eval $inlibc
9383
9384
9385 : see if fstatfs exists
9386 set fstatfs d_fstatfs
9387 eval $inlibc
9388
9389
9390 : see if statvfs exists
9391 set statvfs d_statvfs
9392 eval $inlibc
9393
9394 : see if fstatvfs exists
9395 set fstatvfs d_fstatvfs
9396 eval $inlibc
9397
9398
9399 : see if fsync exists
9400 set fsync d_fsync
9401 eval $inlibc
9402
9403 : see if ftello exists
9404 set ftello d_ftello
9405 eval $inlibc
9406 case "$longsize" in
9407 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9408 esac
9409
9410 : see if getcwd exists
9411 set getcwd d_getcwd
9412 eval $inlibc
9413
9414 : see if getespwnam exists
9415 set getespwnam d_getespwnam
9416 eval $inlibc
9417
9418
9419 : see if getfsstat exists
9420 set getfsstat d_getfsstat
9421 eval $inlibc
9422
9423 : see if getgrent exists
9424 set getgrent d_getgrent
9425 eval $inlibc
9426
9427 : see if gethostbyaddr exists
9428 set gethostbyaddr d_gethbyaddr
9429 eval $inlibc
9430
9431 : see if gethostbyname exists
9432 set gethostbyname d_gethbyname
9433 eval $inlibc
9434
9435 : see if gethostent exists
9436 set gethostent d_gethent
9437 eval $inlibc
9438
9439 : see how we will look up host name
9440 echo " "
9441 call=''
9442 if set gethostname val -f d_gethname; eval $csym; $val; then
9443         echo 'gethostname() found.' >&4
9444         d_gethname="$define"
9445         call=gethostname
9446 fi
9447 if set uname val -f d_uname; eval $csym; $val; then
9448         if ./xenix; then
9449                 $cat <<'EOM'
9450 uname() was found, but you're running xenix, and older versions of xenix
9451 have a broken uname(). If you don't really know whether your xenix is old
9452 enough to have a broken system call, use the default answer.
9453
9454 EOM
9455                 dflt=y
9456                 case "$d_uname" in
9457                 "$define") dflt=n;;
9458                 esac
9459                 rp='Is your uname() broken?'
9460                 . ./myread
9461                 case "$ans" in
9462                 n*) d_uname="$define"; call=uname;;
9463                 esac
9464         else
9465                 echo 'uname() found.' >&4
9466                 d_uname="$define"
9467                 case "$call" in
9468                 '') call=uname ;;
9469                 esac
9470         fi
9471 fi
9472 case "$d_gethname" in
9473 '') d_gethname="$undef";;
9474 esac
9475 case "$d_uname" in
9476 '') d_uname="$undef";;
9477 esac
9478 case "$d_uname$d_gethname" in
9479 *define*)
9480         dflt=n
9481         cat <<EOM
9482  
9483 Every now and then someone has a $call() that lies about the hostname
9484 but can't be fixed for political or economic reasons.  If you wish, I can
9485 pretend $call() isn't there and maybe compute hostname at run-time
9486 thanks to the '$phostname' command.
9487
9488 EOM
9489         rp="Shall I ignore $call() from now on?"
9490         . ./myread
9491         case "$ans" in
9492         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9493         esac;;
9494 esac
9495 case "$phostname" in
9496 '') aphostname='';;
9497 *) case "$aphostname" in
9498         /*) ;;
9499         *) set X $phostname
9500                 shift
9501                 file=$1
9502                 shift
9503                 file=`./loc $file $file $pth`
9504                 aphostname=`echo $file $*`
9505                 ;;
9506         esac
9507         ;;
9508 esac
9509 case "$d_uname$d_gethname" in
9510 *define*) ;;
9511 *)
9512         case "$phostname" in
9513         '')
9514                 echo "There will be no way for $package to get your hostname." >&4;;
9515         *)
9516         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9517                 ;;
9518         esac;;
9519 esac
9520 case "$d_phostname" in
9521 '') d_phostname="$undef";;
9522 esac
9523
9524 : see if this is a netdb.h system
9525 set netdb.h i_netdb
9526 eval $inhdr
9527
9528 : see if prototypes for various gethostxxx netdb.h functions are available
9529 echo " "
9530 set d_gethostprotos gethostent $i_netdb netdb.h
9531 eval $hasproto
9532
9533 : see if getlogin exists
9534 set getlogin d_getlogin
9535 eval $inlibc
9536
9537 : see if getmnt exists
9538 set getmnt d_getmnt
9539 eval $inlibc
9540
9541 : see if getmntent exists
9542 set getmntent d_getmntent
9543 eval $inlibc
9544
9545 : see if getnetbyaddr exists
9546 set getnetbyaddr d_getnbyaddr
9547 eval $inlibc
9548
9549 : see if getnetbyname exists
9550 set getnetbyname d_getnbyname
9551 eval $inlibc
9552
9553 : see if getnetent exists
9554 set getnetent d_getnent
9555 eval $inlibc
9556
9557 : see if prototypes for various getnetxxx netdb.h functions are available
9558 echo " "
9559 set d_getnetprotos getnetent $i_netdb netdb.h
9560 eval $hasproto
9561
9562 : see if getpagesize exists
9563 set getpagesize d_getpagsz
9564 eval $inlibc
9565
9566
9567 : see if getprotobyname exists
9568 set getprotobyname d_getpbyname
9569 eval $inlibc
9570
9571 : see if getprotobynumber exists
9572 set getprotobynumber d_getpbynumber
9573 eval $inlibc
9574
9575 : see if getprotoent exists
9576 set getprotoent d_getpent
9577 eval $inlibc
9578
9579 : see if getpgid exists
9580 set getpgid d_getpgid
9581 eval $inlibc
9582
9583 : see if getpgrp2 exists
9584 set getpgrp2 d_getpgrp2
9585 eval $inlibc
9586
9587 : see if getppid exists
9588 set getppid d_getppid
9589 eval $inlibc
9590
9591 : see if getpriority exists
9592 set getpriority d_getprior
9593 eval $inlibc
9594
9595 : see if prototypes for various getprotoxxx netdb.h functions are available
9596 echo " "
9597 set d_getprotoprotos getprotoent $i_netdb netdb.h
9598 eval $hasproto
9599
9600 : see if getprpwnam exists
9601 set getprpwnam d_getprpwnam
9602 eval $inlibc
9603
9604 : see if getpwent exists
9605 set getpwent d_getpwent
9606 eval $inlibc
9607
9608
9609 : see if getservbyname exists
9610 set getservbyname d_getsbyname
9611 eval $inlibc
9612
9613 : see if getservbyport exists
9614 set getservbyport d_getsbyport
9615 eval $inlibc
9616
9617 : see if getservent exists
9618 set getservent d_getsent
9619 eval $inlibc
9620
9621 : see if prototypes for various getservxxx netdb.h functions are available
9622 echo " "
9623 set d_getservprotos getservent $i_netdb netdb.h
9624 eval $hasproto
9625
9626 : see if getspnam exists
9627 set getspnam d_getspnam
9628 eval $inlibc
9629
9630 : see if gettimeofday or ftime exists
9631 set gettimeofday d_gettimeod
9632 eval $inlibc
9633 case "$d_gettimeod" in
9634 "$undef")
9635         set ftime d_ftime 
9636         eval $inlibc
9637         ;;
9638 *)
9639         val="$undef"; set d_ftime; eval $setvar
9640         ;;
9641 esac
9642 case "$d_gettimeod$d_ftime" in
9643 "$undef$undef")
9644         echo " "
9645         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
9646         ;;
9647 esac
9648
9649 : see if this is an grp system
9650 set grp.h i_grp
9651 eval $inhdr
9652
9653 case "$i_grp" in
9654 $define)
9655         xxx=`./findhdr grp.h`
9656         $cppstdin $cppflags $cppminus < $xxx >$$.h
9657
9658         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
9659                 val="$define"
9660         else
9661                 val="$undef"
9662         fi
9663         set d_grpasswd
9664         eval $setvar
9665
9666         $rm -f $$.h
9667         ;;
9668 *)
9669         val="$undef";
9670         set d_grpasswd; eval $setvar
9671         ;;
9672 esac
9673
9674 : see if hasmntopt exists
9675 set hasmntopt d_hasmntopt
9676 eval $inlibc
9677
9678 : see if this is a netinet/in.h or sys/in.h system
9679 set netinet/in.h i_niin sys/in.h i_sysin
9680 eval $inhdr
9681
9682 : see if arpa/inet.h has to be included
9683 set arpa/inet.h i_arpainet
9684 eval $inhdr
9685
9686 : see if htonl --and friends-- exists
9687 val=''
9688 set htonl val
9689 eval $inlibc
9690
9691 : Maybe they are macros.
9692 case "$val" in
9693 $undef)
9694         $cat >htonl.c <<EOM
9695 #include <stdio.h>
9696 #include <sys/types.h>
9697 #$i_niin I_NETINET_IN
9698 #$i_sysin I_SYS_IN
9699 #$i_arpainet I_ARPA_INET
9700 #ifdef I_NETINET_IN
9701 #include <netinet/in.h>
9702 #endif
9703 #ifdef I_SYS_IN
9704 #include <sys/in.h>
9705 #endif
9706 #ifdef I_ARPA_INET
9707 #include <arpa/inet.h>
9708 #endif
9709 #ifdef htonl
9710 printf("Defined as a macro.");
9711 #endif
9712 EOM
9713         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9714         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9715                 val="$define"
9716                 echo "But it seems to be defined as a macro." >&4
9717         fi
9718         $rm -f htonl.?
9719         ;;
9720 esac
9721 set d_htonl
9722 eval $setvar
9723
9724 : see if iconv exists
9725 set iconv d_iconv
9726 eval $inlibc
9727
9728 : index or strchr
9729 echo " "
9730 if set index val -f; eval $csym; $val; then
9731         if set strchr val -f d_strchr; eval $csym; $val; then
9732                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9733                         val="$define"
9734                         vali="$undef"
9735                         echo "strchr() found." >&4
9736                 else
9737                         val="$undef"
9738                         vali="$define"
9739                         echo "index() found." >&4
9740                 fi
9741         else
9742                 val="$undef"
9743                 vali="$define"
9744                 echo "index() found." >&4
9745         fi
9746 else
9747         if set strchr val -f d_strchr; eval $csym; $val; then
9748                 val="$define"
9749                 vali="$undef"
9750                 echo "strchr() found." >&4
9751         else
9752                 echo "No index() or strchr() found!" >&4
9753                 val="$undef"
9754                 vali="$undef"
9755         fi
9756 fi
9757 set d_strchr; eval $setvar
9758 val="$vali"
9759 set d_index; eval $setvar
9760
9761 : check whether inet_aton exists
9762 set inet_aton d_inetaton
9763 eval $inlibc
9764
9765 : see if inttypes.h is available
9766 : we want a real compile instead of Inhdr because some systems
9767 : have an inttypes.h which includes non-existent headers
9768 echo " "
9769 $cat >try.c <<EOCP
9770 #include <inttypes.h>
9771 int main() {
9772         static int32_t foo32 = 0x12345678;
9773 }
9774 EOCP
9775 set try
9776 if eval $compile; then
9777         echo "<inttypes.h> found." >&4
9778         val="$define"
9779 else
9780         echo "<inttypes.h> NOT found." >&4
9781         val="$undef"
9782 fi
9783 $rm -f try.c try
9784 set i_inttypes
9785 eval $setvar
9786
9787 : check for int64_t
9788 echo " "
9789 echo "Checking to see if you have int64_t..." >&4
9790 $cat >try.c <<EOCP
9791 #include <sys/types.h>
9792 #$i_inttypes I_INTTYPES
9793 #ifdef I_INTTYPES
9794 #include <inttypes.h>
9795 #endif
9796 int main() { int64_t x = 7; }
9797 EOCP
9798 set try
9799 if eval $compile; then
9800         val="$define"
9801         echo "You have int64_t."
9802 else
9803         val="$undef"
9804         echo "You do not have int64_t."
9805 fi
9806 $rm -f try try.*
9807 set d_int64_t
9808 eval $setvar
9809
9810 : Look for isascii
9811 echo " "
9812 $cat >isascii.c <<'EOCP'
9813 #include <stdio.h>
9814 #include <ctype.h>
9815 int main() {
9816         int c = 'A';
9817         if (isascii(c))
9818                 exit(0);
9819         else
9820                 exit(1);
9821 }
9822 EOCP
9823 set isascii
9824 if eval $compile; then
9825         echo "isascii() found." >&4
9826         val="$define"
9827 else
9828         echo "isascii() NOT found." >&4
9829         val="$undef"
9830 fi
9831 set d_isascii
9832 eval $setvar
9833 $rm -f isascii*
9834
9835 : see if isnan exists
9836 set isnan d_isnan
9837 eval $inlibc
9838
9839 : see if isnanl exists
9840 set isnanl d_isnanl
9841 eval $inlibc
9842
9843 : see if killpg exists
9844 set killpg d_killpg
9845 eval $inlibc
9846
9847 : see if lchown exists
9848 echo " "
9849 $cat > try.c <<'EOCP'
9850 /* System header to define __stub macros and hopefully few prototypes,
9851     which can conflict with char lchown(); below.  */
9852 #include <assert.h>
9853 /* Override any gcc2 internal prototype to avoid an error.  */
9854 /* We use char because int might match the return type of a gcc2
9855    builtin and then its argument prototype would still apply.  */
9856 char lchown();
9857 int main() {
9858     /*  The GNU C library defines this for functions which it implements
9859         to always fail with ENOSYS.  Some functions are actually named
9860         something starting with __ and the normal name is an alias.  */
9861 #if defined (__stub_lchown) || defined (__stub___lchown)
9862 choke me
9863 #else
9864 lchown();
9865 #endif
9866 ; return 0; }
9867 EOCP
9868 set try
9869 if eval $compile; then
9870     $echo "lchown() found." >&4
9871     val="$define"
9872 else
9873     $echo "lchown() NOT found." >&4
9874     val="$undef"
9875 fi
9876 set d_lchown
9877 eval $setvar
9878
9879 : See if number of significant digits in a double precision number is known
9880 echo " "
9881 $cat >ldbl_dig.c <<EOM
9882 #$i_limits I_LIMITS
9883 #$i_float I_FLOAT
9884 #ifdef I_LIMITS
9885 #include <limits.h>
9886 #endif
9887 #ifdef I_FLOAT
9888 #include <float.h>
9889 #endif
9890 #ifdef LDBL_DIG
9891 printf("Contains LDBL_DIG");
9892 #endif
9893 EOM
9894 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9895 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9896         echo "LDBL_DIG found." >&4
9897         val="$define"
9898 else
9899         echo "LDBL_DIG NOT found." >&4
9900         val="$undef"
9901 fi
9902 $rm -f ldbl_dig.?
9903 set d_ldbl_dig
9904 eval $setvar
9905
9906 : see if link exists
9907 set link d_link
9908 eval $inlibc
9909
9910 : see if localeconv exists
9911 set localeconv d_locconv
9912 eval $inlibc
9913
9914 : see if lockf exists
9915 set lockf d_lockf
9916 eval $inlibc
9917
9918 : check for long long
9919 echo " "
9920 echo "Checking to see if you have long long..." >&4
9921 echo 'int main() { long long x = 7; return 0; }' > try.c
9922 set try
9923 if eval $compile; then
9924         val="$define"
9925         echo "You have long long."
9926 else
9927         val="$undef"
9928         echo "You do not have long long."
9929 fi
9930 $rm try.*
9931 set d_longlong
9932 eval $setvar
9933
9934 : check for length of long long
9935 case "${d_longlong}${longlongsize}" in
9936 $define)
9937         echo " "
9938         echo "Checking to see how big your long longs are..." >&4
9939         $cat >try.c <<'EOCP'
9940 #include <stdio.h>
9941 int main()
9942 {
9943     printf("%d\n", (int)sizeof(long long));
9944     return(0);
9945 }
9946 EOCP
9947         set try
9948         if eval $compile_ok; then
9949                 longlongsize=`./try$exe_ext`
9950                 echo "Your long longs are $longlongsize bytes long."
9951         else
9952                 dflt='8'
9953                 echo " "
9954                 echo "(I can't seem to compile the test program.  Guessing...)"
9955                 rp="What is the size of a long long (in bytes)?"
9956                 . ./myread
9957                 longlongsize="$ans"
9958         fi
9959         if $test "X$longsize" = "X$longlongsize"; then
9960                 echo "(That isn't any different from an ordinary long.)"
9961         fi      
9962         ;;
9963 esac
9964 $rm -f try.* try
9965
9966 : see if prototype for lseek is available
9967 echo " "
9968 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
9969 eval $hasproto
9970
9971 : see if lstat exists
9972 set lstat d_lstat
9973 eval $inlibc
9974
9975 : see if madvise exists
9976 set madvise d_madvise
9977 eval $inlibc
9978
9979 : see if mblen exists
9980 set mblen d_mblen
9981 eval $inlibc
9982
9983 : see if mbstowcs exists
9984 set mbstowcs d_mbstowcs
9985 eval $inlibc
9986
9987 : see if mbtowc exists
9988 set mbtowc d_mbtowc
9989 eval $inlibc
9990
9991 : see if memchr exists
9992 set memchr d_memchr
9993 eval $inlibc
9994
9995 : see if memcmp exists
9996 set memcmp d_memcmp
9997 eval $inlibc
9998
9999 : see if memcpy exists
10000 set memcpy d_memcpy
10001 eval $inlibc
10002
10003 : see if memmove exists
10004 set memmove d_memmove
10005 eval $inlibc
10006
10007 : see if memset exists
10008 set memset d_memset
10009 eval $inlibc
10010
10011 : see if mkdir exists
10012 set mkdir d_mkdir
10013 eval $inlibc
10014
10015 : see if mkdtemp exists
10016 set mkdtemp d_mkdtemp
10017 eval $inlibc
10018
10019 : see if mkfifo exists
10020 set mkfifo d_mkfifo
10021 eval $inlibc
10022
10023 : see if mkstemp exists
10024 set mkstemp d_mkstemp
10025 eval $inlibc
10026
10027 : see if mkstemps exists
10028 set mkstemps d_mkstemps
10029 eval $inlibc
10030
10031 : see if mktime exists
10032 set mktime d_mktime
10033 eval $inlibc
10034
10035 : see if this is a sys/mman.h system
10036 set sys/mman.h i_sysmman
10037 eval $inhdr
10038
10039 : see if mmap exists
10040 set mmap d_mmap
10041 eval $inlibc
10042 : see what shmat returns
10043 : default to something harmless
10044 mmaptype='void *'
10045 case "$i_sysmman$d_mmap" in
10046 "$define$define")
10047         $cat >mmap.c <<'END'
10048 #include <sys/mman.h>
10049 void *mmap();
10050 END
10051         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
10052                 mmaptype='void *'
10053         else
10054                 mmaptype='caddr_t'
10055         fi
10056         echo "and it returns ($mmaptype)." >&4
10057         ;;
10058 esac
10059
10060
10061
10062 : see if modfl exists
10063 set modfl d_modfl
10064 eval $inlibc
10065
10066 : see if mprotect exists
10067 set mprotect d_mprotect
10068 eval $inlibc
10069
10070 : see if msgctl exists
10071 set msgctl d_msgctl
10072 eval $inlibc
10073
10074 : see if msgget exists
10075 set msgget d_msgget
10076 eval $inlibc
10077
10078 : see if msgsnd exists
10079 set msgsnd d_msgsnd
10080 eval $inlibc
10081
10082 : see if msgrcv exists
10083 set msgrcv d_msgrcv
10084 eval $inlibc
10085
10086 : see how much of the 'msg*(2)' library is present.
10087 h_msg=true
10088 echo " "
10089 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
10090 *"$undef"*) h_msg=false;;
10091 esac
10092 case "$osname" in
10093 freebsd)
10094     case "`ipcs 2>&1`" in
10095     "SVID messages"*"not configured"*)
10096         echo "Your $osname does not have the msg*(2) configured." >&4
10097         h_msg=false
10098         val="$undef"
10099         set msgctl d_msgctl
10100         eval $setvar
10101         set msgget d_msgget
10102         eval $setvar
10103         set msgsnd d_msgsnd
10104         eval $setvar
10105         set msgrcv d_msgrcv
10106         eval $setvar
10107         ;;
10108     esac
10109     ;;
10110 esac
10111 : we could also check for sys/ipc.h ...
10112 if $h_msg && $test `./findhdr sys/msg.h`; then
10113         echo "You have the full msg*(2) library." >&4
10114         val="$define"
10115 else
10116         echo "You don't have the full msg*(2) library." >&4
10117         val="$undef"
10118 fi
10119 set d_msg
10120 eval $setvar
10121
10122 : see if msync exists
10123 set msync d_msync
10124 eval $inlibc
10125
10126 : see if munmap exists
10127 set munmap d_munmap
10128 eval $inlibc
10129
10130 : see if nice exists
10131 set nice d_nice
10132 eval $inlibc
10133
10134
10135 echo " "
10136 echo "Checking which 64-bit integer type we could use..." >&4
10137
10138 case "$intsize" in
10139 8) val=int
10140    set quadtype
10141    eval $setvar
10142    val='"unsigned int"'
10143    set uquadtype
10144    eval $setvar
10145    quadkind=1
10146    ;;
10147 *) case "$longsize" in
10148    8) val=long
10149       set quadtype
10150       eval $setvar
10151       val='"unsigned long"'
10152       set uquadtype
10153       eval $setvar
10154       quadkind=2
10155       ;;
10156    *) case "$d_longlong:$longlongsize" in
10157       define:8)
10158         val='"long long"'
10159         set quadtype
10160         eval $setvar
10161         val='"unsigned long long"'
10162         set uquadtype
10163         eval $setvar
10164         quadkind=3
10165         ;;
10166       *) case "$d_int64_t" in
10167          define)
10168            val=int64_t
10169            set quadtype
10170            eval $setvar
10171            val=uint64_t
10172            set uquadtype
10173            eval $setvar
10174            quadkind=4
10175            ;;
10176          esac
10177          ;;
10178       esac
10179       ;;
10180    esac
10181    ;;
10182 esac
10183
10184 case "$quadtype" in
10185 '')     echo "Alas, no 64-bit integer types in sight." >&4
10186         d_quad="$undef"
10187         ;;
10188 *)      if test X"$use64bitint" = Xdefine -o X"$longsize" = X8; then
10189             verb="will"
10190         else
10191             verb="could"
10192         fi
10193         echo "We $verb use '$quadtype' for 64-bit integers." >&4
10194         d_quad="$define"
10195         ;;
10196 esac
10197
10198 : check for length of character
10199 echo " "
10200 case "$charsize" in
10201 '')
10202         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10203         $cat >try.c <<'EOCP'
10204 #include <stdio.h>
10205 int main()
10206 {
10207     printf("%d\n", (int)sizeof(char));
10208     exit(0);
10209 }
10210 EOCP
10211         set try
10212         if eval $compile_ok; then
10213                 dflt=`./try`
10214         else
10215                 dflt='1'
10216                 echo "(I can't seem to compile the test program.  Guessing...)"
10217         fi
10218         ;;
10219 *)
10220         dflt="$charsize"
10221         ;;
10222 esac
10223 rp="What is the size of a character (in bytes)?"
10224 . ./myread
10225 charsize="$ans"
10226 $rm -f try.c try
10227
10228 : check for volatile keyword
10229 echo " "
10230 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10231 $cat >try.c <<'EOCP'
10232 int main()
10233 {
10234         typedef struct _goo_struct goo_struct;
10235         goo_struct * volatile goo = ((goo_struct *)0);
10236         struct _goo_struct {
10237                 long long_int;
10238                 int reg_int;
10239                 char char_var;
10240         };
10241         typedef unsigned short foo_t;
10242         char *volatile foo;
10243         volatile int bar;
10244         volatile foo_t blech;
10245         foo = foo;
10246 }
10247 EOCP
10248 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10249         val="$define"
10250         echo "Yup, it does."
10251 else
10252         val="$undef"
10253         echo "Nope, it doesn't."
10254 fi
10255 set d_volatile
10256 eval $setvar
10257 $rm -f try.*
10258
10259
10260 echo " "
10261 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10262
10263 case "$use64bitint:$d_quad:$quadtype" in
10264 define:define:?*)
10265         ivtype="$quadtype"
10266         uvtype="$uquadtype"
10267         ivsize=8
10268         uvsize=8
10269         ;;
10270 *)      ivtype="long"
10271         uvtype="unsigned long"
10272         ivsize=$longsize
10273         uvsize=$longsize
10274         ;;
10275 esac
10276
10277 case "$uselongdouble:$d_longdbl" in
10278 define:define)
10279         nvtype="long double"
10280         nvsize=$longdblsize
10281         ;;
10282 *)      nvtype=double
10283         nvsize=$doublesize
10284         ;;
10285 esac
10286
10287 $echo "(IV will be "$ivtype", $ivsize bytes)"
10288 $echo "(UV will be "$uvtype", $uvsize bytes)"
10289 $echo "(NV will be "$nvtype", $nvsize bytes)"
10290
10291 $cat >try.c <<EOCP
10292 #$i_inttypes I_INTTYPES
10293 #ifdef I_INTTYPES
10294 #include <inttypes.h>
10295 #endif
10296 #include <stdio.h>
10297 int main() {
10298 #ifdef INT8
10299    int8_t i =  INT8_MAX;
10300   uint8_t u = UINT8_MAX;
10301   printf("int8_t\n");
10302 #endif
10303 #ifdef INT16
10304    int16_t i =  INT16_MAX;
10305   uint16_t i = UINT16_MAX;
10306   printf("int16_t\n");
10307 #endif
10308 #ifdef INT32
10309    int32_t i =  INT32_MAX;
10310   uint32_t u = UINT32_MAX;
10311   printf("int32_t\n");
10312 #endif
10313 }
10314 EOCP
10315
10316 case "$i8type" in
10317 '')     case "$charsize" in
10318         1)      i8type=char
10319                 u8type="unsigned char"
10320                 i8size=$charsize
10321                 u8size=$charsize
10322                 ;;
10323         esac
10324         ;;
10325 esac
10326 case "$i8type" in
10327 '')     set try -DINT8
10328         if eval $compile; then
10329                 case "`./try$exe_ext`" in
10330                 int8_t) i8type=int8_t
10331                         u8type=uint8_t
10332                         i8size=1
10333                         u8size=1
10334                         ;;
10335                 esac
10336         fi
10337         ;;
10338 esac
10339 case "$i8type" in
10340 '')     if $test $charsize -ge 1; then
10341                 i8type=char
10342                 u8type="unsigned char"
10343                 i8size=$charsize
10344                 u8size=$charsize
10345         fi
10346         ;;
10347 esac
10348
10349 case "$i16type" in
10350 '')     case "$shortsize" in
10351         2)      i16type=short
10352                 u16type="unsigned short"
10353                 i16size=$shortsize
10354                 u16size=$shortsize
10355                 ;;
10356         esac
10357         ;;
10358 esac
10359 case "$i16type" in
10360 '')     set try -DINT16
10361         if eval $compile; then
10362                 case "`./try$exe_ext`" in
10363                 int16_t)
10364                         i16type=int16_t
10365                         u16type=uint16_t
10366                         i16size=2
10367                         u16size=2
10368                         ;;
10369                 esac
10370         fi
10371         ;;
10372 esac
10373 case "$i16type" in
10374 '')     if $test $shortsize -ge 2; then
10375                 i16type=short
10376                 u16type="unsigned short"
10377                 i16size=$shortsize
10378                 u16size=$shortsize
10379         fi
10380         ;;
10381 esac
10382
10383 case "$i32type" in
10384 '')     case "$longsize" in
10385         4)      i32type=long
10386                 u32type="unsigned long"
10387                 i32size=$longsize
10388                 u32size=$longsize
10389                 ;;
10390         *)      case "$intsize" in
10391                 4)      i32type=int
10392                         u32type="unsigned int"
10393                         i32size=$intsize
10394                         u32size=$intsize
10395                         ;;
10396                 esac
10397                 ;;
10398         esac
10399         ;;
10400 esac
10401 case "$i32type" in
10402 '')     set try -DINT32
10403         if eval $compile; then
10404                 case "`./try$exe_ext`" in
10405                 int32_t)
10406                         i32type=int32_t
10407                         u32type=uint32_t
10408                         i32size=4
10409                         u32size=4
10410                         ;;
10411                 esac
10412         fi
10413         ;;
10414 esac
10415 case "$i32type" in
10416 '')     if $test $intsize -ge 4; then
10417                 i32type=int
10418                 u32type="unsigned int"
10419                 i32size=$intsize
10420                 u32size=$intsize
10421         fi
10422         ;;
10423 esac
10424
10425 case "$i64type" in
10426 '')     case "$d_quad:$quadtype" in
10427         define:?*)
10428                 i64type="$quadtype"
10429                 u64type="$uquadtype"
10430                 i64size=8
10431                 u64size=8
10432                 ;;
10433         esac
10434         ;;
10435 esac
10436
10437 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10438 : volatile so that the compiler has to store it out to memory.
10439 if test X"$d_volatile" = X"$define"; then
10440         volatile=volatile
10441 fi
10442 $cat <<EOP >try.c
10443 #include <stdio.h>
10444 #include <sys/types.h>
10445 #include <signal.h>
10446 #ifdef SIGFPE
10447 $volatile int bletched = 0;
10448 $signal_t blech(s) int s; { bletched = 1; }
10449 #endif
10450 int main() {
10451     $uvtype u = 0;
10452     $nvtype d;
10453     int     n = 8 * $uvsize;
10454     int     i;
10455 #ifdef SIGFPE
10456     signal(SIGFPE, blech);
10457 #endif
10458
10459     for (i = 0; i < n; i++) {
10460       u = u << 1 | ($uvtype)1;
10461       d = ($nvtype)u;
10462       if (($uvtype)d != u)
10463         break;
10464       if (d <= 0)
10465         break;
10466       d = ($nvtype)(u - 1);
10467       if (($uvtype)d != (u - 1))
10468         break;
10469 #ifdef SIGFPE
10470       if (bletched) {
10471         break;
10472 #endif
10473       } 
10474     }
10475     printf("%d\n", ((i == n) ? -n : i));
10476     exit(0);
10477 }
10478 EOP
10479 set try
10480
10481 d_nv_preserves_uv="$undef"
10482 if eval $compile; then
10483         d_nv_preserves_uv_bits="`./try$exe_ext`"
10484 fi
10485 case "$d_nv_preserves_uv_bits" in
10486 \-[1-9]*)       
10487         d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
10488         $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10489         d_nv_preserves_uv="$define"
10490         ;;
10491 [1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10492         d_nv_preserves_uv="$undef" ;;
10493 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10494         d_nv_preserves_uv_bits="$undef" ;;
10495 esac
10496
10497 $rm -f try.* try
10498
10499
10500 : check for off64_t
10501 echo " "
10502 echo "Checking to see if you have off64_t..." >&4
10503 $cat >try.c <<EOCP
10504 #include <sys/types.h>
10505 #include <unistd.h>
10506 int main() { off64_t x = 7; }
10507 EOCP
10508 set try
10509 if eval $compile; then
10510         val="$define"
10511         echo "You have off64_t."
10512 else
10513         val="$undef"
10514         echo "You do not have off64_t."
10515         case "$lseeksize" in
10516         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10517         esac
10518 fi
10519 $rm -f try.* try
10520 set d_off64_t
10521 eval $setvar
10522
10523 : see if POSIX threads are available
10524 set pthread.h i_pthread
10525 eval $inhdr
10526
10527
10528
10529
10530 : how to create joinable pthreads
10531 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10532         echo " "
10533         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10534         $cat >try.c <<'EOCP'
10535 #include <pthread.h>
10536 int main() {
10537     int detachstate = JOINABLE;
10538 }
10539 EOCP
10540         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10541         if eval $compile; then
10542                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10543                 val="$undef" # Yes, undef.
10544                 set d_old_pthread_create_joinable
10545                 eval $setvar
10546                 val=""
10547                 set old_pthread_create_joinable
10548                 eval $setvar
10549         else
10550                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10551                 if eval $compile; then
10552                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10553                         val="$define"
10554                         set d_old_pthread_create_joinable
10555                         eval $setvar
10556                         val=PTHREAD_CREATE_UNDETACHED
10557                         set old_pthread_create_joinable
10558                         eval $setvar
10559                 else            
10560                         set try -DJOINABLE=__UNDETACHED
10561                         if eval $compile; then
10562                                 echo "You seem to use __UNDETACHED." >&4
10563                                 val="$define"
10564                                 set d_old_pthread_create_joinable
10565                                 eval $setvar
10566                                 val=__UNDETACHED
10567                                 set old_pthread_create_joinable
10568                                 eval $setvar
10569                         else
10570                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10571                                 val="$define"
10572                                 set d_old_pthread_create_joinable
10573                                 eval $setvar
10574                                 val=0
10575                                 set old_pthread_create_joinable
10576                                 eval $setvar
10577                         fi
10578                 fi
10579         fi
10580         $rm -f try try.*
10581 else
10582     d_old_pthread_create_joinable="$undef"
10583     old_pthread_create_joinable=""
10584 fi
10585
10586 : see if pause exists
10587 set pause d_pause
10588 eval $inlibc
10589
10590 : see if pipe exists
10591 set pipe d_pipe
10592 eval $inlibc
10593
10594 : see if poll exists
10595 set poll d_poll
10596 eval $inlibc
10597
10598
10599 : see whether the various POSIXish _yields exist
10600 $cat >try.c <<EOP
10601 #include <pthread.h>
10602 #include <stdio.h>
10603 int main() {
10604 #ifdef SCHED_YIELD
10605         sched_yield();
10606 #else
10607 #ifdef PTHREAD_YIELD
10608         pthread_yield();
10609 #else
10610 #ifdef PTHREAD_YIELD_NULL
10611         pthread_yield(NULL);
10612 #endif
10613 #endif
10614 #endif
10615 }
10616 EOP
10617 : see if sched_yield exists
10618 set try -DSCHED_YIELD
10619 if eval $compile; then
10620     val="$define"
10621     sched_yield='sched_yield()'
10622 else
10623     val="$undef"
10624 fi
10625 case "$usethreads" in
10626 $define)
10627         case "$val" in
10628         $define) echo 'sched_yield() found.' >&4        ;;
10629         *)       echo 'sched_yield() NOT found.' >&4    ;;
10630         esac
10631 esac
10632 set d_sched_yield
10633 eval $setvar
10634
10635 : see if pthread_yield exists
10636 set try -DPTHREAD_YIELD
10637 if eval $compile; then
10638     val="$define"
10639     case "$sched_yield" in
10640     '') sched_yield='pthread_yield()' ;;
10641     esac
10642 else
10643     set try -DPTHREAD_YIELD_NULL
10644     if eval $compile; then
10645         val="$define"
10646         case "$sched_yield" in
10647         '') sched_yield='pthread_yield(NULL)' ;;
10648         esac
10649     else
10650         val="$undef"
10651     fi
10652 fi
10653 case "$usethreads" in
10654 $define)
10655         case "$val" in
10656         $define) echo 'pthread_yield() found.' >&4      ;;
10657         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10658         esac
10659         ;;
10660 esac
10661 set d_pthread_yield
10662 eval $setvar
10663
10664 case "$sched_yield" in
10665 '') sched_yield=undef ;;
10666 esac
10667
10668 $rm -f try try.*
10669
10670 : see if this is a pwd.h system
10671 set pwd.h i_pwd
10672 eval $inhdr
10673
10674 case "$i_pwd" in
10675 $define)
10676         xxx=`./findhdr pwd.h`
10677         $cppstdin $cppflags $cppminus < $xxx >$$.h
10678
10679         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10680                 val="$define"
10681         else
10682                 val="$undef"
10683         fi
10684         set d_pwquota
10685         eval $setvar
10686
10687         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10688                 val="$define"
10689         else
10690                 val="$undef"
10691         fi
10692         set d_pwage
10693         eval $setvar
10694
10695         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10696                 val="$define"
10697         else
10698                 val="$undef"
10699         fi
10700         set d_pwchange
10701         eval $setvar
10702
10703         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10704                 val="$define"
10705         else
10706                 val="$undef"
10707         fi
10708         set d_pwclass
10709         eval $setvar
10710
10711         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10712                 val="$define"
10713         else
10714                 val="$undef"
10715         fi
10716         set d_pwexpire
10717         eval $setvar
10718
10719         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10720                 val="$define"
10721         else
10722                 val="$undef"
10723         fi
10724         set d_pwcomment
10725         eval $setvar
10726
10727         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10728                 val="$define"
10729         else
10730                 val="$undef"
10731         fi
10732         set d_pwgecos
10733         eval $setvar
10734
10735         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10736                 val="$define"
10737         else
10738                 val="$undef"
10739         fi
10740         set d_pwpasswd
10741         eval $setvar
10742
10743         $rm -f $$.h
10744         ;;
10745 *)
10746         val="$undef"; 
10747         set d_pwquota; eval $setvar
10748         set d_pwage; eval $setvar
10749         set d_pwchange; eval $setvar
10750         set d_pwclass; eval $setvar
10751         set d_pwexpire; eval $setvar
10752         set d_pwcomment; eval $setvar
10753         set d_pwgecos; eval $setvar
10754         set d_pwpasswd; eval $setvar
10755         ;;
10756 esac
10757
10758 : see if readdir and friends exist
10759 set readdir d_readdir
10760 eval $inlibc
10761 set seekdir d_seekdir
10762 eval $inlibc
10763 set telldir d_telldir
10764 eval $inlibc
10765 set rewinddir d_rewinddir
10766 eval $inlibc
10767
10768 : see if readlink exists
10769 set readlink d_readlink
10770 eval $inlibc
10771
10772 : see if rename exists
10773 set rename d_rename
10774 eval $inlibc
10775
10776 : see if rmdir exists
10777 set rmdir d_rmdir
10778 eval $inlibc
10779
10780 : see if memory.h is available.
10781 val=''
10782 set memory.h val
10783 eval $inhdr
10784
10785 : See if it conflicts with string.h
10786 case "$val" in
10787 $define)
10788         case "$strings" in
10789         '') ;;
10790         *)
10791                 $cppstdin $cppflags $cppminus < $strings > mem.h
10792                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
10793                         echo " "
10794                         echo "We won't be including <memory.h>."
10795                         val="$undef"
10796                 fi
10797                 $rm -f mem.h
10798                 ;;
10799         esac
10800 esac
10801 set i_memory
10802 eval $setvar
10803
10804 : can bcopy handle overlapping blocks?
10805 val="$undef"
10806 case "$d_bcopy" in
10807 "$define")
10808         echo " "
10809         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
10810         $cat >try.c <<EOCP
10811 #$i_memory I_MEMORY
10812 #$i_stdlib I_STDLIB
10813 #$i_string I_STRING
10814 #$i_unistd I_UNISTD
10815 EOCP
10816         $cat >>try.c <<'EOCP'
10817 #include <stdio.h>
10818 #ifdef I_MEMORY
10819 #  include <memory.h>
10820 #endif
10821 #ifdef I_STDLIB
10822 #  include <stdlib.h>
10823 #endif
10824 #ifdef I_STRING
10825 #  include <string.h>
10826 #else
10827 #  include <strings.h>
10828 #endif
10829 #ifdef I_UNISTD
10830 #  include <unistd.h>  /* Needed for NetBSD */
10831 #endif
10832 int main()
10833 {
10834 char buf[128], abc[128];
10835 char *b;
10836 int len;
10837 int off;
10838 int align;
10839
10840 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
10841
10842 for (align = 7; align >= 0; align--) {
10843         for (len = 36; len; len--) {
10844                 b = buf+align;
10845                 bcopy(abc, b, len);
10846                 for (off = 1; off <= len; off++) {
10847                         bcopy(b, b+off, len);
10848                         bcopy(b+off, b, len);
10849                         if (bcmp(b, abc, len))
10850                                 exit(1);
10851                 }
10852         }
10853 }
10854 exit(0);
10855 }
10856 EOCP
10857         set try
10858         if eval $compile_ok; then
10859                 if ./try 2>/dev/null; then
10860                         echo "Yes, it can."
10861                         val="$define"
10862                 else
10863                         echo "It can't, sorry."
10864                         case "$d_memmove" in
10865                         "$define") echo "But that's Ok since you have memmove()." ;;
10866                         esac
10867                 fi
10868         else
10869                 echo "(I can't compile the test program, so we'll assume not...)"
10870                 case "$d_memmove" in
10871                 "$define") echo "But that's Ok since you have memmove()." ;;
10872                 esac
10873         fi
10874         ;;
10875 esac
10876 $rm -f try.* try core
10877 set d_safebcpy
10878 eval $setvar
10879
10880 : can memcpy handle overlapping blocks?
10881 val="$undef"
10882 case "$d_memcpy" in
10883 "$define")
10884         echo " "
10885         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
10886         $cat >try.c <<EOCP
10887 #$i_memory I_MEMORY
10888 #$i_stdlib I_STDLIB
10889 #$i_string I_STRING
10890 #$i_unistd I_UNISTD
10891 EOCP
10892         $cat >>try.c <<'EOCP'
10893 #include <stdio.h>
10894 #ifdef I_MEMORY
10895 #  include <memory.h>
10896 #endif
10897 #ifdef I_STDLIB
10898 #  include <stdlib.h>
10899 #endif
10900 #ifdef I_STRING
10901 #  include <string.h>
10902 #else
10903 #  include <strings.h>
10904 #endif
10905 #ifdef I_UNISTD
10906 #  include <unistd.h>  /* Needed for NetBSD */
10907 #endif
10908 int main()
10909 {
10910 char buf[128], abc[128];
10911 char *b;
10912 int len;
10913 int off;
10914 int align;
10915
10916 /* Copy "abcde..." string to char abc[] so that gcc doesn't
10917    try to store the string in read-only memory. */
10918 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
10919
10920 for (align = 7; align >= 0; align--) {
10921         for (len = 36; len; len--) {
10922                 b = buf+align;
10923                 memcpy(b, abc, len);
10924                 for (off = 1; off <= len; off++) {
10925                         memcpy(b+off, b, len);
10926                         memcpy(b, b+off, len);
10927                         if (memcmp(b, abc, len))
10928                                 exit(1);
10929                 }
10930         }
10931 }
10932 exit(0);
10933 }
10934 EOCP
10935         set try
10936         if eval $compile_ok; then
10937                 if ./try 2>/dev/null; then
10938                         echo "Yes, it can."
10939                         val="$define"
10940                 else
10941                         echo "It can't, sorry."
10942                         case "$d_memmove" in
10943                         "$define") echo "But that's Ok since you have memmove()." ;;
10944                         esac
10945                 fi
10946         else
10947                 echo "(I can't compile the test program, so we'll assume not...)"
10948                 case "$d_memmove" in
10949                 "$define") echo "But that's Ok since you have memmove()." ;;
10950                 esac
10951         fi
10952         ;;
10953 esac
10954 $rm -f try.* try core
10955 set d_safemcpy
10956 eval $setvar
10957
10958 : can memcmp be trusted to compare relative magnitude?
10959 val="$undef"
10960 case "$d_memcmp" in
10961 "$define")
10962         echo " "
10963         echo "Checking if your memcmp() can compare relative magnitude..." >&4
10964         $cat >try.c <<EOCP
10965 #$i_memory I_MEMORY
10966 #$i_stdlib I_STDLIB
10967 #$i_string I_STRING
10968 #$i_unistd I_UNISTD
10969 EOCP
10970         $cat >>try.c <<'EOCP'
10971 #include <stdio.h>
10972 #ifdef I_MEMORY
10973 #  include <memory.h>
10974 #endif
10975 #ifdef I_STDLIB
10976 #  include <stdlib.h>
10977 #endif
10978 #ifdef I_STRING
10979 #  include <string.h>
10980 #else
10981 #  include <strings.h>
10982 #endif
10983 #ifdef I_UNISTD
10984 #  include <unistd.h>  /* Needed for NetBSD */
10985 #endif
10986 int main()
10987 {
10988 char a = -1;
10989 char b = 0;
10990 if ((a < b) && memcmp(&a, &b, 1) < 0)
10991         exit(1);
10992 exit(0);
10993 }
10994 EOCP
10995         set try
10996         if eval $compile_ok; then
10997                 if ./try 2>/dev/null; then
10998                         echo "Yes, it can."
10999                         val="$define"
11000                 else
11001                         echo "No, it can't (it uses signed chars)."
11002                 fi
11003         else
11004                 echo "(I can't compile the test program, so we'll assume not...)"
11005         fi
11006         ;;
11007 esac
11008 $rm -f try.* try core
11009 set d_sanemcmp
11010 eval $setvar
11011
11012 : see if prototype for sbrk is available
11013 echo " "
11014 set d_sbrkproto sbrk $i_unistd unistd.h
11015 eval $hasproto
11016
11017 : see if select exists
11018 set select d_select
11019 eval $inlibc
11020
11021 : see if semctl exists
11022 set semctl d_semctl
11023 eval $inlibc
11024
11025 : see if semget exists
11026 set semget d_semget
11027 eval $inlibc
11028
11029 : see if semop exists
11030 set semop d_semop
11031 eval $inlibc
11032
11033 : see how much of the 'sem*(2)' library is present.
11034 h_sem=true
11035 echo " "
11036 case "$d_semctl$d_semget$d_semop" in
11037 *"$undef"*) h_sem=false;;
11038 esac
11039 case "$osname" in
11040 freebsd)
11041     case "`ipcs 2>&1`" in
11042     "SVID messages"*"not configured"*)
11043         echo "Your $osname does not have the sem*(2) configured." >&4
11044         h_sem=false
11045         val="$undef"
11046         set semctl d_semctl
11047         eval $setvar
11048         set semget d_semget
11049         eval $setvar
11050         set semop d_semop
11051         eval $setvar
11052         ;;
11053     esac
11054     ;;
11055 esac
11056 : we could also check for sys/ipc.h ...
11057 if $h_sem && $test `./findhdr sys/sem.h`; then
11058         echo "You have the full sem*(2) library." >&4
11059         val="$define"
11060 else
11061         echo "You don't have the full sem*(2) library." >&4
11062         val="$undef"
11063 fi
11064 set d_sem
11065 eval $setvar
11066
11067 : see whether sys/sem.h defines union semun
11068 echo " "
11069 $cat > try.c <<'END'
11070 #include <sys/types.h>
11071 #include <sys/ipc.h>
11072 #include <sys/sem.h>
11073 int main () { union semun semun; semun.buf = 0; }
11074 END
11075 set try
11076 if eval $compile; then
11077     echo "You have union semun in <sys/sem.h>." >&4
11078     val="$define"
11079 else
11080     echo "You do not have union semun in <sys/sem.h>." >&4
11081     val="$undef"
11082 fi
11083 $rm -f try try.c try.h
11084 set d_union_semun
11085 eval $setvar
11086
11087 : see how to do semctl IPC_STAT
11088 case "$d_sem" in
11089 $define)
11090     : see whether semctl IPC_STAT can use union semun
11091     echo " "
11092     $cat > try.h <<END
11093 #ifndef S_IRUSR
11094 #   ifdef S_IREAD
11095 #       define S_IRUSR S_IREAD
11096 #       define S_IWUSR S_IWRITE
11097 #       define S_IXUSR S_IEXEC
11098 #   else
11099 #       define S_IRUSR 0400
11100 #       define S_IWUSR 0200
11101 #       define S_IXUSR 0100
11102 #   endif
11103 #   define S_IRGRP (S_IRUSR>>3)
11104 #   define S_IWGRP (S_IWUSR>>3)
11105 #   define S_IXGRP (S_IXUSR>>3)
11106 #   define S_IROTH (S_IRUSR>>6)
11107 #   define S_IWOTH (S_IWUSR>>6)
11108 #   define S_IXOTH (S_IXUSR>>6)
11109 #endif
11110 #ifndef S_IRWXU
11111 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11112 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11113 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11114 #endif
11115 END
11116
11117     $cat > try.c <<END
11118 #include <sys/types.h>
11119 #include <sys/ipc.h>
11120 #include <sys/sem.h>
11121 #include <sys/stat.h>
11122 #include <stdio.h>
11123 #include <errno.h>
11124 #include "try.h"
11125 #ifndef errno
11126 extern int errno;
11127 #endif
11128 #$d_union_semun HAS_UNION_SEMUN
11129 int main() {
11130     union semun
11131 #ifndef HAS_UNION_SEMUN
11132     {
11133         int val;
11134         struct semid_ds *buf;
11135         unsigned short *array;
11136     }
11137 #endif
11138     arg;
11139     int sem, st;
11140
11141 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11142     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11143     if (sem > -1) {
11144         struct semid_ds argbuf;
11145         arg.buf = &argbuf;
11146 #       ifdef IPC_STAT
11147         st = semctl(sem, 0, IPC_STAT, arg);
11148         if (st == 0)
11149             printf("semun\n");
11150         else
11151 #       endif /* IPC_STAT */
11152             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11153 #       ifdef IPC_RMID
11154         if (semctl(sem, 0, IPC_RMID, arg) != 0)
11155 #       endif /* IPC_RMID */
11156             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11157     } else
11158 #endif /* IPC_PRIVATE && ... */
11159         printf("semget failed: errno = %d\n", errno);
11160   return 0;
11161 }
11162 END
11163     val="$undef"
11164     set try
11165     if eval $compile; then
11166         xxx=`./try`
11167         case "$xxx" in
11168         semun) val="$define" ;;
11169         esac
11170     fi
11171     $rm -f try try.c
11172     set d_semctl_semun
11173     eval $setvar
11174     case "$d_semctl_semun" in
11175     $define)
11176         echo "You can use union semun for semctl IPC_STAT." >&4
11177         also='also'
11178         ;;
11179     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11180         also=''
11181         ;;
11182     esac
11183
11184     : see whether semctl IPC_STAT can use struct semid_ds pointer
11185     $cat > try.c <<'END'
11186 #include <sys/types.h>
11187 #include <sys/ipc.h>
11188 #include <sys/sem.h>
11189 #include <sys/stat.h>
11190 #include "try.h"
11191 #include <stdio.h>
11192 #include <errno.h>
11193 #ifndef errno
11194 extern int errno;
11195 #endif
11196 int main() {
11197     struct semid_ds arg;
11198     int sem, st;
11199
11200 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11201     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11202     if (sem > -1) {
11203 #       ifdef IPC_STAT
11204         st = semctl(sem, 0, IPC_STAT, &arg);
11205         if (st == 0)
11206             printf("semid_ds\n");
11207         else
11208 #       endif /* IPC_STAT */
11209             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11210 #       ifdef IPC_RMID
11211         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11212 #       endif /* IPC_RMID */
11213             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11214     } else
11215 #endif /* IPC_PRIVATE && ... */
11216         printf("semget failed: errno = %d\n", errno);
11217
11218     return 0;
11219 }
11220 END
11221     val="$undef"
11222     set try
11223     if eval $compile; then
11224         xxx=`./try`
11225         case "$xxx" in
11226         semid_ds) val="$define" ;;
11227         esac
11228     fi
11229     $rm -f try try.c
11230     set d_semctl_semid_ds
11231     eval $setvar
11232     case "$d_semctl_semid_ds" in
11233     $define)
11234         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11235         ;;
11236     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11237         ;;
11238     esac
11239     $rm -f try.h
11240     ;;
11241 *)  val="$undef"
11242
11243     # We do not have the full sem*(2) library, so assume we can not
11244     # use either.
11245
11246     set d_semctl_semun
11247     eval $setvar
11248
11249     set d_semctl_semid_ds
11250     eval $setvar
11251     ;;
11252 esac
11253
11254 : see if setegid exists
11255 set setegid d_setegid
11256 eval $inlibc
11257
11258 : see if seteuid exists
11259 set seteuid d_seteuid
11260 eval $inlibc
11261
11262 : see if setgrent exists
11263 set setgrent d_setgrent
11264 eval $inlibc
11265
11266 : see if sethostent exists
11267 set sethostent d_sethent
11268 eval $inlibc
11269
11270 : see if setlinebuf exists
11271 set setlinebuf d_setlinebuf
11272 eval $inlibc
11273
11274 : see if setlocale exists
11275 set setlocale d_setlocale
11276 eval $inlibc
11277
11278 : see if setnetent exists
11279 set setnetent d_setnent
11280 eval $inlibc
11281
11282 : see if setprotoent exists
11283 set setprotoent d_setpent
11284 eval $inlibc
11285
11286 : see if setpgid exists
11287 set setpgid d_setpgid
11288 eval $inlibc
11289
11290 : see if setpgrp2 exists
11291 set setpgrp2 d_setpgrp2
11292 eval $inlibc
11293
11294 : see if setpriority exists
11295 set setpriority d_setprior
11296 eval $inlibc
11297
11298 : see if setproctitle exists
11299 set setproctitle d_setproctitle
11300 eval $inlibc
11301
11302 : see if setpwent exists
11303 set setpwent d_setpwent
11304 eval $inlibc
11305
11306 : see if setregid exists
11307 set setregid d_setregid
11308 eval $inlibc
11309 set setresgid d_setresgid
11310 eval $inlibc
11311
11312 : see if setreuid exists
11313 set setreuid d_setreuid
11314 eval $inlibc
11315 set setresuid d_setresuid
11316 eval $inlibc
11317
11318 : see if setrgid exists
11319 set setrgid d_setrgid
11320 eval $inlibc
11321
11322 : see if setruid exists
11323 set setruid d_setruid
11324 eval $inlibc
11325
11326 : see if setservent exists
11327 set setservent d_setsent
11328 eval $inlibc
11329
11330 : see if setsid exists
11331 set setsid d_setsid
11332 eval $inlibc
11333
11334 : see if setvbuf exists
11335 set setvbuf d_setvbuf
11336 eval $inlibc
11337
11338 : see if sfio.h is available
11339 set sfio.h i_sfio
11340 eval $inhdr
11341
11342
11343 : see if sfio library is available
11344 case "$i_sfio" in
11345 $define)
11346         val=''
11347         set sfreserve val
11348         eval $inlibc
11349         ;;
11350 *)
11351         val="$undef"
11352         ;;
11353 esac
11354 : Ok, but do we want to use it.
11355 case "$val" in
11356 $define)
11357         case "$usesfio" in
11358         true|$define|[yY]*) dflt='y';;
11359         *) dflt='n';;
11360         esac
11361         echo "$package can use the sfio library, but it is experimental."
11362         case "$useperlio" in
11363         "$undef")
11364             echo "For sfio also the PerlIO abstraction layer is needed."
11365             echo "Earlier you said you wouldn't want that."
11366             ;;
11367         esac
11368         rp="You seem to have sfio available, do you want to try using it?"
11369         . ./myread
11370         case "$ans" in
11371         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
11372                 useperlio="$define"
11373                 val="$define"
11374                 ;;
11375         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11376                 val="$undef"
11377                 : Remove sfio from list of libraries to use
11378                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11379                 shift
11380                 libs="$*"
11381                 echo "libs = $libs" >&4
11382                 ;;
11383         esac
11384         ;;
11385 *)      case "$usesfio" in
11386         true|$define|[yY]*)
11387                 echo "Sorry, cannot find sfio on this machine." >&4
11388                 echo "Ignoring your setting of usesfio=$usesfio." >&4
11389                 val="$undef"
11390                 ;;
11391         esac
11392         ;;
11393 esac
11394 set d_sfio
11395 eval $setvar
11396 case "$d_sfio" in
11397 $define) usesfio='true';;
11398 *) usesfio='false';;
11399 esac
11400
11401 : see if shmctl exists
11402 set shmctl d_shmctl
11403 eval $inlibc
11404
11405 : see if shmget exists
11406 set shmget d_shmget
11407 eval $inlibc
11408
11409 : see if shmat exists
11410 set shmat d_shmat
11411 eval $inlibc
11412 : see what shmat returns
11413 case "$d_shmat" in
11414 "$define")
11415         $cat >shmat.c <<'END'
11416 #include <sys/shm.h>
11417 void *shmat();
11418 END
11419         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11420                 shmattype='void *'
11421         else
11422                 shmattype='char *'
11423         fi
11424         echo "and it returns ($shmattype)." >&4
11425         : see if a prototype for shmat is available
11426         xxx=`./findhdr sys/shm.h`
11427         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11428         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11429                 val="$define"
11430         else
11431                 val="$undef"
11432         fi
11433         $rm -f shmat.[co]
11434         ;;
11435 *)
11436         val="$undef"
11437         ;;
11438 esac
11439 set d_shmatprototype
11440 eval $setvar
11441
11442 : see if shmdt exists
11443 set shmdt d_shmdt
11444 eval $inlibc
11445
11446 : see how much of the 'shm*(2)' library is present.
11447 h_shm=true
11448 echo " "
11449 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11450 *"$undef"*) h_shm=false;;
11451 esac
11452 case "$osname" in
11453 freebsd)
11454     case "`ipcs 2>&1`" in
11455     "SVID shared memory"*"not configured"*)
11456         echo "Your $osname does not have the shm*(2) configured." >&4
11457         h_shm=false
11458         val="$undef"
11459         set shmctl d_shmctl
11460         evat $setvar
11461         set shmget d_shmget
11462         evat $setvar
11463         set shmat d_shmat
11464         evat $setvar
11465         set shmdt d_shmdt
11466         evat $setvar
11467         ;;
11468     esac
11469     ;;
11470 esac
11471 : we could also check for sys/ipc.h ...
11472 if $h_shm && $test `./findhdr sys/shm.h`; then
11473         echo "You have the full shm*(2) library." >&4
11474         val="$define"
11475 else
11476         echo "You don't have the full shm*(2) library." >&4
11477         val="$undef"
11478 fi
11479 set d_shm
11480 eval $setvar
11481
11482 echo " "
11483 : see if we have sigaction
11484 if set sigaction val -f d_sigaction; eval $csym; $val; then
11485         echo 'sigaction() found.' >&4
11486         $cat > try.c <<'EOP'
11487 #include <stdio.h>
11488 #include <sys/types.h>
11489 #include <signal.h>
11490 int main()
11491 {
11492     struct sigaction act, oact;
11493     act.sa_flags = 0;
11494     oact.sa_handler = 0;
11495     /* so that act and oact are used */
11496     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11497 }
11498 EOP
11499         set try
11500         if eval $compile_ok; then
11501                 val="$define"
11502         else
11503                 echo "But you don't seem to have a useable struct sigaction." >&4
11504                 val="$undef"
11505         fi
11506 else
11507         echo 'sigaction NOT found.' >&4
11508         val="$undef"
11509 fi
11510 set d_sigaction; eval $setvar
11511 $rm -f try try$_o try.c
11512
11513 : see if sigprocmask exists
11514 set sigprocmask d_sigprocmask
11515 eval $inlibc
11516
11517 : see if sigsetjmp exists
11518 echo " "
11519 case "$d_sigsetjmp" in
11520 '')
11521         $cat >try.c <<'EOP'
11522 #include <setjmp.h>
11523 sigjmp_buf env;
11524 int set = 1;
11525 int main()
11526 {
11527         if (sigsetjmp(env,1))
11528                 exit(set);
11529         set = 0;
11530         siglongjmp(env, 1);
11531         exit(1);
11532 }
11533 EOP
11534         set try
11535         if eval $compile; then
11536                 if ./try >/dev/null 2>&1; then
11537                         echo "POSIX sigsetjmp found." >&4
11538                         val="$define"
11539                 else
11540                         $cat >&4 <<EOM
11541 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11542 I'll ignore them.
11543 EOM
11544                         val="$undef"
11545                 fi
11546         else
11547                 echo "sigsetjmp not found." >&4
11548                 val="$undef"
11549         fi
11550         ;;
11551 *) val="$d_sigsetjmp"
11552         case "$d_sigsetjmp" in
11553         $define) echo "POSIX sigsetjmp found." >&4;;
11554         $undef) echo "sigsetjmp not found." >&4;;
11555         esac
11556         ;;
11557 esac
11558 set d_sigsetjmp
11559 eval $setvar
11560 $rm -f try.c try
11561
11562 : see if socks5_init exists
11563 set socks5_init d_socks5_init
11564 eval $inlibc
11565
11566 : see if sys/stat.h is available
11567 set sys/stat.h i_sysstat
11568 eval $inhdr
11569
11570
11571 : see if stat knows about block sizes
11572 echo " "
11573 echo "Checking to see if your struct stat has st_blocks field..." >&4
11574 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11575 eval $hasfield
11576
11577
11578 : see if this is a sys/vfs.h system
11579 set sys/vfs.h i_sysvfs
11580 eval $inhdr
11581
11582
11583 : see if this is a sys/statfs.h system
11584 set sys/statfs.h i_sysstatfs
11585 eval $inhdr
11586
11587
11588 echo " "
11589 echo "Checking to see if your system supports struct statfs..." >&4
11590 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
11591 eval $hasstruct
11592 case "$d_statfs_s" in
11593 "$define")      echo "Yes, it does."   ;;
11594 *)              echo "No, it doesn't." ;;
11595 esac
11596
11597
11598
11599 : see if struct statfs knows about f_flags
11600 case "$d_statfs_s" in
11601 define) 
11602         echo " "
11603         echo "Checking to see if your struct statfs has f_flags field..." >&4
11604         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
11605         eval $hasfield
11606         ;;
11607 *)      val="$undef"
11608         set d_statfs_f_flags
11609         eval $setvar
11610         ;;
11611 esac
11612 case "$d_statfs_f_flags" in
11613 "$define")      echo "Yes, it does."   ;;
11614 *)              echo "No, it doesn't." ;;
11615 esac
11616
11617 : see if _ptr and _cnt from stdio act std
11618 echo " "
11619
11620 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11621         echo "(Looks like you have stdio.h from BSD.)"
11622         case "$stdio_ptr" in
11623         '') stdio_ptr='((fp)->_p)'
11624                 ptr_lval=$define
11625                 ;;
11626         *)      ptr_lval=$d_stdio_ptr_lval;;
11627         esac
11628         case "$stdio_cnt" in
11629         '') stdio_cnt='((fp)->_r)'
11630                 cnt_lval=$define
11631                 ;;
11632         *)      cnt_lval=$d_stdio_cnt_lval;;
11633         esac
11634         case "$stdio_base" in
11635         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11636         esac
11637         case "$stdio_bufsiz" in
11638         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11639         esac
11640 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11641         echo "(Looks like you have stdio.h from Linux.)"
11642         case "$stdio_ptr" in
11643         '') stdio_ptr='((fp)->_IO_read_ptr)'
11644                 ptr_lval=$define
11645                 ;;
11646         *)      ptr_lval=$d_stdio_ptr_lval;;
11647         esac
11648         case "$stdio_cnt" in
11649         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11650                 cnt_lval=$undef
11651                 ;;
11652         *)      cnt_lval=$d_stdio_cnt_lval;;
11653         esac
11654         case "$stdio_base" in
11655         '') stdio_base='((fp)->_IO_read_base)';;
11656         esac
11657         case "$stdio_bufsiz" in
11658         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11659         esac
11660 else
11661         case "$stdio_ptr" in
11662         '') stdio_ptr='((fp)->_ptr)'
11663                 ptr_lval=$define
11664                 ;;
11665         *)      ptr_lval=$d_stdio_ptr_lval;;
11666         esac
11667         case "$stdio_cnt" in
11668         '') stdio_cnt='((fp)->_cnt)'
11669                 cnt_lval=$define
11670                 ;;
11671         *)      cnt_lval=$d_stdio_cnt_lval;;
11672         esac
11673         case "$stdio_base" in
11674         '') stdio_base='((fp)->_base)';;
11675         esac
11676         case "$stdio_bufsiz" in
11677         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11678         esac
11679 fi
11680
11681 : test whether _ptr and _cnt really work
11682 echo "Checking how std your stdio is..." >&4
11683 $cat >try.c <<EOP
11684 #include <stdio.h>
11685 #define FILE_ptr(fp)    $stdio_ptr
11686 #define FILE_cnt(fp)    $stdio_cnt
11687 int main() {
11688         FILE *fp = fopen("try.c", "r");
11689         char c = getc(fp);
11690         if (
11691                 18 <= FILE_cnt(fp) &&
11692                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11693         )
11694                 exit(0);
11695         exit(1);
11696 }
11697 EOP
11698 val="$undef"
11699 set try
11700 if eval $compile; then
11701         if ./try; then
11702                 echo "Your stdio acts pretty std."
11703                 val="$define"
11704         else
11705                 echo "Your stdio isn't very std."
11706         fi
11707 else
11708         echo "Your stdio doesn't appear very std."
11709 fi
11710 $rm -f try.c try
11711 set d_stdstdio
11712 eval $setvar
11713
11714 : Can _ptr be used as an lvalue?
11715 case "$d_stdstdio$ptr_lval" in
11716 $define$define) val=$define ;;
11717 *) val=$undef ;;
11718 esac
11719 set d_stdio_ptr_lval
11720 eval $setvar
11721
11722 : Can _cnt be used as an lvalue?
11723 case "$d_stdstdio$cnt_lval" in
11724 $define$define) val=$define ;;
11725 *) val=$undef ;;
11726 esac
11727 set d_stdio_cnt_lval
11728 eval $setvar
11729
11730
11731 : test whether setting _ptr sets _cnt as a side effect
11732 d_stdio_ptr_lval_sets_cnt="$undef"
11733 d_stdio_ptr_lval_nochange_cnt="$undef"
11734 case "$d_stdio_ptr_lval$d_stdstdio" in
11735 $define$define)
11736         echo "Checking to see what happens if we set the stdio ptr..." >&4
11737 $cat >try.c <<EOP
11738 #include <stdio.h>
11739 /* Can we scream? */
11740 /* Eat dust sed :-) */
11741 /* In the buffer space, no one can hear you scream. */
11742 #define FILE_ptr(fp)    $stdio_ptr
11743 #define FILE_cnt(fp)    $stdio_cnt
11744 #include <sys/types.h>
11745 int main() {
11746         FILE *fp = fopen("try.c", "r");
11747         int c;
11748         char *ptr;
11749         size_t cnt;
11750         if (!fp) {
11751             puts("Fail even to read");
11752             exit(1);
11753         }
11754         c = getc(fp); /* Read away the first # */
11755         if (c == EOF) {
11756             puts("Fail even to read");
11757             exit(1);
11758         }
11759         if (!(
11760                 18 <= FILE_cnt(fp) &&
11761                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11762         )) {
11763                 puts("Fail even to read");
11764                 exit (1);
11765         }
11766         ptr = (char*) FILE_ptr(fp);
11767         cnt = (size_t)FILE_cnt(fp);
11768
11769         FILE_ptr(fp) += 42;
11770
11771         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
11772                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
11773                 exit (1);
11774         }
11775         if (FILE_cnt(fp) <= 20) {
11776                 printf ("Fail (<20 chars to test)");
11777                 exit (1);
11778         }
11779         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
11780                 puts("Fail compare");
11781                 exit (1);
11782         }
11783         if (cnt == FILE_cnt(fp)) {
11784                 puts("Pass_unchanged");
11785                 exit (0);
11786         }       
11787         if (FILE_cnt(fp) == (cnt - 42)) {
11788                 puts("Pass_changed");
11789                 exit (0);
11790         }
11791         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
11792         return 1;
11793
11794 }
11795 EOP
11796         set try
11797         if eval $compile; then
11798                 case `./try$exe_ext` in
11799                 Pass_changed)
11800                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
11801                         d_stdio_ptr_lval_sets_cnt="$define" ;;
11802                 Pass_unchanged)
11803                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
11804                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
11805                 Fail*)
11806                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
11807                 *)
11808                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
11809         esac
11810         else
11811                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
11812         fi
11813         $rm -f try.c try
11814         ;;
11815 esac
11816
11817 : see if _base is also standard
11818 val="$undef"
11819 case "$d_stdstdio" in
11820 $define)
11821         $cat >try.c <<EOP
11822 #include <stdio.h>
11823 #define FILE_base(fp)   $stdio_base
11824 #define FILE_bufsiz(fp) $stdio_bufsiz
11825 int main() {
11826         FILE *fp = fopen("try.c", "r");
11827         char c = getc(fp);
11828         if (
11829                 19 <= FILE_bufsiz(fp) &&
11830                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11831         )
11832                 exit(0);
11833         exit(1);
11834 }
11835 EOP
11836         set try
11837         if eval $compile; then
11838                 if ./try; then
11839                         echo "And its _base field acts std."
11840                         val="$define"
11841                 else
11842                         echo "But its _base field isn't std."
11843                 fi
11844         else
11845                 echo "However, it seems to be lacking the _base field."
11846         fi
11847         $rm -f try.c try
11848         ;;
11849 esac
11850 set d_stdiobase
11851 eval $setvar
11852
11853 $cat >&4 <<EOM
11854 Checking how to access stdio streams by file descriptor number...
11855 EOM
11856 case "$stdio_stream_array" in
11857 '')     $cat >try.c <<EOCP
11858 #include <stdio.h>
11859 int main() {
11860   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
11861     printf("yes\n");
11862 }
11863 EOCP
11864         for s in _iob __iob __sF
11865         do
11866                 set try -DSTDIO_STREAM_ARRAY=$s
11867                 if eval $compile; then
11868                         case "`./try$exe_ext`" in
11869                         yes)    stdio_stream_array=$s; break ;;
11870                         esac
11871                 fi
11872         done
11873         $rm -f try.* try$exe_ext
11874 esac
11875 case "$stdio_stream_array" in
11876 '')     $cat >&4 <<EOM
11877 I can't figure out how to access stdio streams by file descriptor number.
11878 EOM
11879         d_stdio_stream_array="$undef"
11880         ;;
11881 *)      $cat >&4 <<EOM
11882 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
11883 EOM
11884         d_stdio_stream_array="$define"
11885         ;;
11886 esac
11887
11888 : see if strcoll exists
11889 set strcoll d_strcoll
11890 eval $inlibc
11891
11892 : check for structure copying
11893 echo " "
11894 echo "Checking to see if your C compiler can copy structs..." >&4
11895 $cat >try.c <<'EOCP'
11896 int main()
11897 {
11898         struct blurfl {
11899                 int dyick;
11900         } foo, bar;
11901
11902         foo = bar;
11903 }
11904 EOCP
11905 if $cc -c try.c >/dev/null 2>&1 ; then
11906         val="$define"
11907         echo "Yup, it can."
11908 else
11909         val="$undef"
11910         echo "Nope, it can't."
11911 fi
11912 set d_strctcpy
11913 eval $setvar
11914 $rm -f try.*
11915
11916 : see if strerror and/or sys_errlist[] exist
11917 echo " "
11918 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
11919     if set strerror val -f d_strerror; eval $csym; $val; then
11920                 echo 'strerror() found.' >&4
11921                 d_strerror="$define"
11922                 d_strerrm='strerror(e)'
11923                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11924                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
11925                         d_syserrlst="$define"
11926                 else
11927                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
11928                         d_syserrlst="$undef"
11929                 fi
11930     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
11931                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
11932                 echo 'strerror() found in string header.' >&4
11933                 d_strerror="$define"
11934                 d_strerrm='strerror(e)'
11935                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
11936                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
11937                                 d_syserrlst="$define"
11938                 else
11939                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
11940                         d_syserrlst="$undef"
11941                 fi
11942     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
11943                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
11944                 d_strerror="$undef"
11945                 d_syserrlst="$define"
11946                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
11947     else
11948                 echo 'strerror() and sys_errlist[] NOT found.' >&4
11949                 d_strerror="$undef"
11950                 d_syserrlst="$undef"
11951                 d_strerrm='"unknown"'
11952     fi
11953 fi
11954
11955 : see if strtod exists
11956 set strtod d_strtod
11957 eval $inlibc
11958
11959 : see if strtol exists
11960 set strtol d_strtol
11961 eval $inlibc
11962
11963 : see if strtold exists
11964 set strtold d_strtold
11965 eval $inlibc
11966
11967 : see if strtoll exists
11968 set strtoll d_strtoll
11969 eval $inlibc
11970
11971 case "$d_longlong-$d_strtoll" in
11972 "$define-$define")
11973         $cat <<EOM
11974 Checking whether your strtoll() works okay...
11975 EOM
11976         $cat >try.c <<'EOCP'
11977 #include <errno.h>
11978 #ifdef __hpux
11979 #define strtoll __strtoll
11980 #endif
11981 #ifdef __EMX__
11982 #define strtoll _strtoll
11983 #endif
11984 #include <stdio.h>
11985 extern long long int strtoll(char *s, char **, int); 
11986 static int bad = 0;
11987 int check(char *s, long long ell, int een) {
11988         long long gll;
11989         errno = 0;
11990         gll = strtoll(s, 0, 10);
11991         if (!((gll == ell) && (errno == een)))
11992                 bad++;
11993 }
11994 int main() {
11995         check(" 1",                                      1LL, 0);
11996         check(" 0",                                      0LL, 0);
11997         check("-1",                                     -1LL, 0);
11998         check("-9223372036854775808", -9223372036854775808LL, 0);
11999         check("-9223372036854775808", -9223372036854775808LL, 0);
12000         check(" 9223372036854775807",  9223372036854775807LL, 0);
12001         check("-9223372036854775808", -9223372036854775808LL, 0);
12002         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
12003         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
12004         if (!bad)
12005                 printf("ok\n");
12006 }
12007 EOCP
12008         set try
12009         if eval $compile; then
12010                 yyy=`./try`
12011                 case "$yyy" in
12012                 ok) echo "Your strtoll() seems to be working okay." ;;
12013                 *) cat <<EOM >&4
12014 Your strtoll() doesn't seem to be working okay.
12015 EOM
12016                    d_strtoll="$undef"
12017                    ;;
12018                 esac
12019         else
12020                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12021                 d_strtoll="$undef"
12022         fi
12023         ;;
12024 esac
12025
12026 : see if strtoq exists
12027 set strtoq d_strtoq
12028 eval $inlibc
12029
12030 : see if strtoul exists
12031 set strtoul d_strtoul
12032 eval $inlibc
12033
12034 case "$d_strtoul" in
12035 "$define")
12036         $cat <<EOM
12037 Checking whether your strtoul() works okay...
12038 EOM
12039         $cat >try.c <<'EOCP'
12040 #include <errno.h>
12041 #include <stdio.h>
12042 extern unsigned long int strtoul(char *s, char **, int); 
12043 static int bad = 0;
12044 void check(char *s, unsigned long eul, int een) {
12045         unsigned long gul;
12046         errno = 0;
12047         gul = strtoul(s, 0, 10);
12048         if (!((gul == eul) && (errno == een)))
12049                 bad++;
12050 }
12051 int main() {
12052         check(" 1", 1L, 0);
12053         check(" 0", 0L, 0);
12054 EOCP
12055         case "$longsize" in
12056         8)
12057             $cat >>try.c <<'EOCP'
12058         check("18446744073709551615", 18446744073709551615UL, 0);
12059         check("18446744073709551616", 18446744073709551615UL, ERANGE);
12060 #if 0 /* strtoul() for /^-/ strings is undefined. */
12061         check("-1", 18446744073709551615UL, 0);
12062         check("-18446744073709551614", 2, 0);
12063         check("-18446744073709551615", 1, 0);
12064         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
12065         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
12066 #endif
12067 EOCP
12068                 ;;
12069         4)
12070                     $cat >>try.c <<'EOCP'
12071         check("4294967295", 4294967295UL, 0);
12072         check("4294967296", 4294967295UL, ERANGE);
12073 #if 0 /* strtoul() for /^-/ strings is undefined. */
12074         check("-1", 4294967295UL, 0);
12075         check("-4294967294", 2, 0);
12076         check("-4294967295", 1, 0);
12077         check("-4294967296", 4294967295UL, ERANGE);
12078         check("-4294967297", 4294967295UL, ERANGE);
12079 #endif
12080 EOCP
12081                 ;;
12082         *)
12083 : Should we write these tests to be more portable by sprintf-ing
12084 : ~0 and then manipulating that char string as input for strtol?
12085                 ;;
12086         esac
12087         $cat >>try.c <<'EOCP'
12088         if (!bad)
12089                 printf("ok\n");
12090         return 0;
12091 }
12092 EOCP
12093         set try
12094         if eval $compile; then
12095                 case "`./try`" in
12096                 ok) echo "Your strtoul() seems to be working okay." ;;
12097                 *) cat <<EOM >&4
12098 Your strtoul() doesn't seem to be working okay.
12099 EOM
12100                    d_strtoul="$undef"
12101                    ;;
12102                 esac
12103         fi
12104         ;;
12105 esac
12106
12107 : see if strtoull exists
12108 set strtoull d_strtoull
12109 eval $inlibc
12110
12111 case "$d_longlong-$d_strtoull" in
12112 "$define-$define")
12113         $cat <<EOM
12114 Checking whether your strtoull() works okay...
12115 EOM
12116         $cat >try.c <<'EOCP'
12117 #include <errno.h>
12118 #ifdef __hpux
12119 #define strtoull __strtoull
12120 #endif
12121 #include <stdio.h>
12122 extern unsigned long long int strtoull(char *s, char **, int); 
12123 static int bad = 0;
12124 int check(char *s, long long eull, int een) {
12125         long long gull;
12126         errno = 0;
12127         gull = strtoull(s, 0, 10);
12128         if (!((gull == eull) && (errno == een)))
12129                 bad++;
12130 }
12131 int main() {
12132         check(" 1",                                        1LL, 0);
12133         check(" 0",                                        0LL, 0);
12134         check("18446744073709551615",  18446744073709551615ULL, 0);
12135         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12136 #if 0 /* strtoull() for /^-/ strings is undefined. */
12137         check("-1",                    18446744073709551615ULL, 0);
12138         check("-18446744073709551614",                     2LL, 0);
12139         check("-18446744073709551615",                     1LL, 0);
12140         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12141         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12142 #endif
12143         if (!bad)
12144                 printf("ok\n");
12145 }
12146 EOCP
12147         set try
12148         if eval $compile; then
12149                 case "`./try`" in
12150                 ok) echo "Your strtoull() seems to be working okay." ;;
12151                 *) cat <<EOM >&4
12152 Your strtoull() doesn't seem to be working okay.
12153 EOM
12154                    d_strtoull="$undef"
12155                    ;;
12156                 esac
12157         fi
12158         ;;
12159 esac
12160
12161 : see if strtouq exists
12162 set strtouq d_strtouq
12163 eval $inlibc
12164
12165 case "$d_strtouq" in
12166 "$define")
12167         $cat <<EOM
12168 Checking whether your strtouq() works okay...
12169 EOM
12170         $cat >try.c <<'EOCP'
12171 #include <errno.h>
12172 #include <stdio.h>
12173 extern unsigned long long int strtouq(char *s, char **, int); 
12174 static int bad = 0;
12175 void check(char *s, unsigned long long eull, int een) {
12176         unsigned long long gull;
12177         errno = 0;
12178         gull = strtouq(s, 0, 10);
12179         if (!((gull == eull) && (errno == een)))
12180                 bad++;
12181 }
12182 int main() {
12183         check(" 1",                                        1LL, 0);
12184         check(" 0",                                        0LL, 0);
12185         check("18446744073709551615",  18446744073709551615ULL, 0);
12186         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12187 #if 0 /* strtouq() for /^-/ strings is undefined. */
12188         check("-1",                    18446744073709551615ULL, 0);
12189         check("-18446744073709551614",                     2LL, 0);
12190         check("-18446744073709551615",                     1LL, 0);
12191         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12192         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12193 #endif
12194         if (!bad)
12195                 printf("ok\n");
12196         return 0;
12197 }
12198 EOCP
12199         set try
12200         if eval $compile; then
12201                 case "`./try`" in
12202                 ok) echo "Your strtouq() seems to be working okay." ;;
12203                 *) cat <<EOM >&4
12204 Your strtouq() doesn't seem to be working okay.
12205 EOM
12206                    d_strtouq="$undef"
12207                    ;;
12208                 esac
12209         fi
12210         ;;
12211 esac
12212
12213 : see if strxfrm exists
12214 set strxfrm d_strxfrm
12215 eval $inlibc
12216
12217 : see if symlink exists
12218 set symlink d_symlink
12219 eval $inlibc
12220
12221 : see if syscall exists
12222 set syscall d_syscall
12223 eval $inlibc
12224
12225 : see if sysconf exists
12226 set sysconf d_sysconf
12227 eval $inlibc
12228
12229 : see if system exists
12230 set system d_system
12231 eval $inlibc
12232
12233 : see if tcgetpgrp exists
12234 set tcgetpgrp d_tcgetpgrp
12235 eval $inlibc
12236
12237 : see if tcsetpgrp exists
12238 set tcsetpgrp d_tcsetpgrp
12239 eval $inlibc
12240
12241 : see if prototype for telldir is available
12242 echo " "
12243 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
12244 eval $hasproto
12245
12246 : see if this is a sys/times.h system
12247 set sys/times.h i_systimes
12248 eval $inhdr
12249
12250 : see if times exists
12251 echo " "
12252 if set times val -f d_times; eval $csym; $val; then
12253         echo 'times() found.' >&4
12254         d_times="$define"
12255         inc=''
12256         case "$i_systimes" in
12257         "$define") inc='sys/times.h';;
12258         esac
12259         rp="What is the type returned by times() on this system?"
12260         set clock_t clocktype long stdio.h sys/types.h $inc
12261         eval $typedef_ask
12262 else
12263         echo 'times() NOT found, hope that will do.' >&4
12264         d_times="$undef"
12265         clocktype='int'
12266 fi
12267
12268 : see if truncate exists
12269 set truncate d_truncate
12270 eval $inlibc
12271
12272 : see if tzname[] exists
12273 echo " "
12274 if set tzname val -a d_tzname; eval $csym; $val; then
12275         val="$define"
12276         echo 'tzname[] found.' >&4
12277 else
12278         val="$undef"
12279         echo 'tzname[] NOT found.' >&4
12280 fi
12281 set d_tzname
12282 eval $setvar
12283
12284 : see if umask exists
12285 set umask d_umask
12286 eval $inlibc
12287
12288 : see if ustat exists
12289 set ustat d_ustat
12290 eval $inlibc
12291
12292 : backward compatibility for d_hvfork
12293 if test X$d_hvfork != X; then
12294         d_vfork="$d_hvfork"
12295         d_hvfork=''
12296 fi
12297 : see if there is a vfork
12298 val=''
12299 set vfork val
12300 eval $inlibc
12301
12302 : Ok, but do we want to use it. vfork is reportedly unreliable in 
12303 : perl on Solaris 2.x, and probably elsewhere.
12304 case "$val" in
12305 $define)
12306         echo " "
12307         case "$usevfork" in
12308         false) dflt='n';;
12309         *) dflt='y';;
12310         esac
12311         cat <<'EOM'
12312  
12313 Perl can only use a vfork() that doesn't suffer from strict
12314 restrictions on calling functions or modifying global data in
12315 the child.  For example, glibc-2.1 contains such a vfork()
12316 that is unsuitable.  If your system provides a proper fork()
12317 call, chances are that you do NOT want perl to use vfork().
12318
12319 EOM
12320         rp="Do you still want to use vfork()?"
12321         . ./myread
12322         case "$ans" in
12323         y|Y) ;;
12324         *)
12325                 echo "Ok, we won't use vfork()."
12326                 val="$undef"
12327                 ;;
12328         esac
12329         ;;
12330 esac
12331 set d_vfork
12332 eval $setvar
12333 case "$d_vfork" in
12334 $define) usevfork='true';;
12335 *) usevfork='false';;
12336 esac
12337
12338 : see if this is an sysdir system
12339 set sys/dir.h i_sysdir
12340 eval $inhdr
12341
12342 : see if this is an sysndir system
12343 set sys/ndir.h i_sysndir
12344 eval $inhdr
12345
12346 : see if closedir exists
12347 set closedir d_closedir
12348 eval $inlibc
12349
12350 case "$d_closedir" in
12351 "$define")
12352         echo " "
12353         echo "Checking whether closedir() returns a status..." >&4
12354         cat > closedir.c <<EOM
12355 #$i_dirent I_DIRENT             /**/
12356 #$i_sysdir I_SYS_DIR            /**/
12357 #$i_sysndir I_SYS_NDIR          /**/
12358 #$i_systypes I_SYS_TYPES        /**/
12359
12360 #if defined(I_SYS_TYPES)
12361 #include <sys/types.h>
12362 #endif
12363 #if defined(I_DIRENT)
12364 #include <dirent.h>
12365 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12366 #include <sys/dir.h>
12367 #endif
12368 #else
12369 #ifdef I_SYS_NDIR
12370 #include <sys/ndir.h>
12371 #else
12372 #ifdef I_SYS_DIR
12373 #ifdef hp9000s500
12374 #include <ndir.h>       /* may be wrong in the future */
12375 #else
12376 #include <sys/dir.h>
12377 #endif
12378 #endif
12379 #endif
12380 #endif 
12381 int main() { return closedir(opendir(".")); }
12382 EOM
12383         set closedir
12384         if eval $compile_ok; then
12385                 if ./closedir > /dev/null 2>&1 ; then
12386                         echo "Yes, it does."
12387                         val="$undef"
12388                 else
12389                         echo "No, it doesn't."
12390                         val="$define"
12391                 fi
12392         else
12393                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12394                 val="$define"
12395         fi
12396         ;;
12397 *)
12398         val="$undef";
12399         ;;
12400 esac
12401 set d_void_closedir
12402 eval $setvar
12403 $rm -f closedir*
12404 : see if there is a wait4
12405 set wait4 d_wait4
12406 eval $inlibc
12407
12408 : see if waitpid exists
12409 set waitpid d_waitpid
12410 eval $inlibc
12411
12412 : see if wcstombs exists
12413 set wcstombs d_wcstombs
12414 eval $inlibc
12415
12416 : see if wctomb exists
12417 set wctomb d_wctomb
12418 eval $inlibc
12419
12420 : preserve RCS keywords in files with variable substitution, grrr
12421 Date='$Date'
12422 Id='$Id'
12423 Log='$Log'
12424 RCSfile='$RCSfile'
12425 Revision='$Revision'
12426
12427 case "$crosscompile" in
12428 ''|[nN]*) crosscompile="$undef" ;;
12429 esac
12430
12431 case "$osname" in
12432 next|rhapsody|darwin) multiarch="$define" ;;
12433 esac
12434 case "$multiarch" in
12435 ''|[nN]*) multiarch="$undef" ;;
12436 esac
12437
12438 : check for alignment requirements
12439 echo " "
12440 case "$crosscompile$multiarch" in
12441 *$define*)
12442         $cat <<EOM
12443 You seem to be either cross-compiling or doing a multiarchitecture build,
12444 skipping the memory alignment check.
12445
12446 EOM
12447         case "$alignbytes" in
12448         '') alignbytes=8 ;;
12449         esac
12450         ;;
12451 *)
12452         case "$alignbytes" in
12453         '') echo "Checking alignment constraints..." >&4
12454                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12455                         $cat >try.c <<'EOCP'
12456 typedef long double NV;
12457 EOCP
12458                 else
12459                         $cat >try.c <<'EOCP'
12460 typedef double NV;
12461 EOCP
12462                 fi
12463                 $cat >>try.c <<'EOCP'
12464 #include <stdio.h>
12465 struct foobar {
12466         char foo;
12467         NV bar;
12468 } try_algn;
12469 int main()
12470 {
12471     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12472     return(0);
12473 }
12474 EOCP
12475                 set try
12476                 if eval $compile_ok; then
12477                         dflt=`./try`
12478                 else
12479                         dflt='8'
12480                         echo "(I can't seem to compile the test program...)"
12481                 fi
12482                 ;;
12483         *) dflt="$alignbytes"
12484                 ;;
12485         esac
12486         rp="Doubles must be aligned on a how-many-byte boundary?"
12487         . ./myread
12488         alignbytes="$ans"
12489         $rm -f try.c try
12490         ;;
12491 esac
12492
12493
12494 : set the base revision
12495 baserev=5.0
12496
12497 : check for ordering of bytes in a long
12498 echo " "
12499 case "$crosscompile$multiarch" in
12500 *$define*)
12501         $cat <<EOM
12502 You seem to be either cross-compiling or doing a multiarchitecture build,
12503 skipping the byteorder check.
12504
12505 EOM
12506         byteorder='0xffff'
12507         ;;
12508 *)
12509         case "$byteorder" in
12510         '')
12511                 $cat <<'EOM'
12512 In the following, larger digits indicate more significance.  A big-endian
12513 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12514 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12515 machines may have weird orders like 3412.  A Cray will report 87654321,
12516 an Alpha will report 12345678. If the test program works the default is
12517 probably right.
12518 I'm now running the test program...
12519 EOM
12520                 $cat >try.c <<'EOCP'
12521 #include <stdio.h>
12522 int main()
12523 {
12524         int i;
12525         union {
12526                 unsigned long l;
12527                 char c[sizeof(long)];
12528         } u;
12529
12530         if (sizeof(long) > 4)
12531                 u.l = (0x08070605L << 32) | 0x04030201L;
12532         else
12533                 u.l = 0x04030201L;
12534         for (i = 0; i < sizeof(long); i++)
12535                 printf("%c", u.c[i]+'0');
12536         printf("\n");
12537         exit(0);
12538 }
12539 EOCP
12540                 xxx_prompt=y
12541                 set try
12542                 if eval $compile && ./try > /dev/null; then
12543                         dflt=`./try`
12544                         case "$dflt" in
12545                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12546                                 echo "(The test program ran ok.)"
12547                                 echo "byteorder=$dflt"
12548                                 xxx_prompt=n
12549                         ;;
12550                         ????|????????) echo "(The test program ran ok.)" ;;
12551                         *) echo "(The test program didn't run right for some reason.)" ;;
12552                         esac
12553                 else
12554                         dflt='4321'
12555                         cat <<'EOM'
12556 (I can't seem to compile the test program.  Guessing big-endian...)
12557 EOM
12558                 fi
12559                 case "$xxx_prompt" in
12560                 y)
12561                         rp="What is the order of bytes in a long?"
12562                         . ./myread
12563                         byteorder="$ans"
12564                         ;;
12565                 *)      byteorder=$dflt
12566                         ;;
12567                 esac
12568                 ;;
12569         esac
12570         $rm -f try.c try
12571         ;;
12572 esac
12573
12574
12575 : how do we catenate cpp tokens here?
12576 echo " "
12577 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12578 $cat >cpp_stuff.c <<'EOCP'
12579 #define RCAT(a,b)a/**/b
12580 #define ACAT(a,b)a ## b
12581 RCAT(Rei,ser)
12582 ACAT(Cir,cus)
12583 EOCP
12584 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12585 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12586         echo "Oh!  Smells like ANSI's been here." >&4
12587         echo "We can catify or stringify, separately or together!"
12588         cpp_stuff=42
12589 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12590         echo "Ah, yes!  The good old days!" >&4
12591         echo "However, in the good old days we don't know how to stringify and"
12592         echo "catify at the same time."
12593         cpp_stuff=1
12594 else
12595         $cat >&4 <<EOM
12596 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
12597 to have to edit the values of CAT[2-5] in config.h...
12598 EOM
12599         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12600 fi
12601 $rm -f cpp_stuff.*
12602
12603 : see if this is a db.h system
12604 set db.h i_db
12605 eval $inhdr
12606
12607 case "$i_db" in
12608 $define)
12609         : Check db version.
12610         echo " "
12611         echo "Checking Berkeley DB version ..." >&4
12612         $cat >try.c <<EOCP
12613 #$d_const HASCONST
12614 #ifndef HASCONST
12615 #define const
12616 #endif
12617 #include <sys/types.h>
12618 #include <stdio.h>
12619 #include <db.h>
12620 int main()
12621 {
12622 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12623     int Major, Minor, Patch ;
12624     unsigned long Version ;
12625     (void)db_version(&Major, &Minor, &Patch) ;
12626     printf("You have Berkeley DB Version 2 or greater\n");
12627
12628     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12629                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12630     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12631                 Major, Minor, Patch) ;
12632
12633     /* check that db.h & libdb are compatible */
12634     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12635         printf("db.h and libdb are incompatible\n") ;
12636         exit(3);        
12637     }
12638
12639     printf("db.h and libdb are compatible\n") ;
12640
12641     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12642                 + DB_VERSION_PATCH ;
12643
12644     /* needs to be >= 2.3.4 */
12645     if (Version < 2003004) {
12646     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12647         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12648         exit(2);        
12649     }
12650
12651     exit(0);
12652 #else
12653 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12654     printf("You have Berkeley DB Version 1\n");
12655     exit(0);    /* DB version < 2: the coast is clear. */
12656 #else
12657     exit(1);    /* <db.h> not Berkeley DB? */
12658 #endif
12659 #endif
12660 }
12661 EOCP
12662         set try
12663         if eval $compile_ok && ./try; then
12664                 echo 'Looks OK.' >&4
12665         else
12666                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
12667                 i_db=$undef
12668                 case " $libs " in
12669                 *"-ldb "*)
12670                         : Remove db from list of libraries to use
12671                         echo "Removing unusable -ldb from library list" >&4
12672                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12673                         shift
12674                         libs="$*"
12675                         echo "libs = $libs" >&4
12676                         ;;
12677                 esac
12678         fi
12679         $rm -f try.*
12680         ;;
12681 esac
12682
12683 case "$i_db" in
12684 define)
12685         : Check the return type needed for hash 
12686         echo " "
12687         echo "Checking return type needed for hash for Berkeley DB ..." >&4
12688         $cat >try.c <<EOCP
12689 #$d_const HASCONST
12690 #ifndef HASCONST
12691 #define const
12692 #endif
12693 #include <sys/types.h>
12694 #include <db.h>
12695
12696 #ifndef DB_VERSION_MAJOR
12697 u_int32_t hash_cb (ptr, size)
12698 const void *ptr;
12699 size_t size;
12700 {
12701 }
12702 HASHINFO info;
12703 int main()
12704 {
12705         info.hash = hash_cb;
12706 }
12707 #endif
12708 EOCP
12709         if $cc $ccflags -c try.c >try.out 2>&1 ; then
12710                 if $contains warning try.out >>/dev/null 2>&1 ; then
12711                         db_hashtype='int'
12712                 else
12713                         db_hashtype='u_int32_t'
12714                 fi
12715         else
12716                 : XXX Maybe we should just give up here.
12717                 db_hashtype=u_int32_t
12718                 $cat try.out >&4
12719                 echo "Help:  I can't seem to compile the db test program." >&4
12720                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12721         fi
12722         $rm -f try.*
12723         echo "Your version of Berkeley DB uses $db_hashtype for hash."
12724         ;;
12725 *)      db_hashtype=u_int32_t
12726         ;;
12727 esac
12728 case "$i_db" in
12729 define)
12730         : Check the return type needed for prefix 
12731         echo " "
12732         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12733         cat >try.c <<EOCP
12734 #$d_const HASCONST
12735 #ifndef HASCONST
12736 #define const
12737 #endif
12738 #include <sys/types.h>
12739 #include <db.h>
12740
12741 #ifndef DB_VERSION_MAJOR
12742 size_t prefix_cb (key1, key2)
12743 const DBT *key1;
12744 const DBT *key2;
12745 {
12746 }
12747 BTREEINFO info;
12748 int main()
12749 {
12750         info.prefix = prefix_cb;
12751 }
12752 #endif
12753 EOCP
12754         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
12755                 if $contains warning try.out >>/dev/null 2>&1 ; then
12756                         db_prefixtype='int'
12757                 else
12758                         db_prefixtype='size_t'
12759                 fi
12760         else
12761                 db_prefixtype='size_t'
12762                 : XXX Maybe we should just give up here.
12763                 $cat try.out >&4
12764                 echo "Help:  I can't seem to compile the db test program." >&4
12765                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12766         fi
12767         $rm -f try.*
12768         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12769         ;;
12770 *)      db_prefixtype='size_t'
12771         ;;
12772 esac
12773
12774 : check for void type
12775 echo " "
12776 echo "Checking to see how well your C compiler groks the void type..." >&4
12777 case "$voidflags" in
12778 '')
12779         $cat >try.c <<'EOCP'
12780 #if TRY & 1
12781 void sub() {
12782 #else
12783 sub() {
12784 #endif
12785         extern void moo();      /* function returning void */
12786         void (*goo)();          /* ptr to func returning void */
12787 #if TRY & 8
12788         void *hue;              /* generic ptr */
12789 #endif
12790 #if TRY & 2
12791         void (*foo[10])();
12792 #endif
12793
12794 #if TRY & 4
12795         if(goo == moo) {
12796                 exit(0);
12797         }
12798 #endif
12799         exit(0);
12800 }
12801 int main() { sub(); }
12802 EOCP
12803         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
12804                 voidflags=$defvoidused
12805         echo "Good.  It appears to support void to the level $package wants.">&4
12806                 if $contains warning .out >/dev/null 2>&1; then
12807                         echo "However, you might get some warnings that look like this:"
12808                         $cat .out
12809                 fi
12810         else
12811 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
12812                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
12813                         echo "It supports 1..."
12814                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
12815                                 echo "It also supports 2..."
12816                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
12817                                         voidflags=7
12818                                         echo "And it supports 4 but not 8 definitely."
12819                                 else
12820                                         echo "It doesn't support 4..."
12821                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
12822                                                 voidflags=11
12823                                                 echo "But it supports 8."
12824                                         else
12825                                                 voidflags=3
12826                                                 echo "Neither does it support 8."
12827                                         fi
12828                                 fi
12829                         else
12830                                 echo "It does not support 2..."
12831                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
12832                                         voidflags=13
12833                                         echo "But it supports 4 and 8."
12834                                 else
12835                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
12836                                                 voidflags=5
12837                                                 echo "And it supports 4 but has not heard about 8."
12838                                         else
12839                                                 echo "However it supports 8 but not 4."
12840                                         fi
12841                                 fi
12842                         fi
12843                 else
12844                         echo "There is no support at all for void."
12845                         voidflags=0
12846                 fi
12847         fi
12848 esac
12849 case "$voidflags" in
12850 "$defvoidused") ;;
12851 *)      $cat >&4 <<'EOM'
12852   Support flag bits are:
12853     1: basic void declarations.
12854     2: arrays of pointers to functions returning void.
12855     4: operations between pointers to and addresses of void functions.
12856     8: generic void pointers.
12857 EOM
12858         dflt="$voidflags";
12859         rp="Your void support flags add up to what?"
12860         . ./myread
12861         voidflags="$ans"
12862         ;;
12863 esac
12864 $rm -f try.* .out
12865
12866
12867 : How can we generate normalized random numbers ?
12868 echo " "
12869 echo "Looking for a random number function..." >&4
12870 case "$randfunc" in
12871 '')
12872         if set drand48 val -f; eval $csym; $val; then
12873                 dflt="drand48"
12874                 echo "Good, found drand48()." >&4
12875         elif set random val -f; eval $csym; $val; then
12876                 dflt="random"
12877                 echo "OK, found random()." >&4
12878         else
12879                 dflt="rand"
12880                 echo "Yick, looks like I have to use rand()." >&4
12881         fi
12882         echo " "
12883         ;;
12884 *)
12885         dflt="$randfunc"
12886         ;;
12887 esac
12888 cont=true
12889
12890 case "$ccflags" in
12891 *-Dmy_rand=*|*-Dmy_srand=*)
12892         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
12893         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
12894         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
12895         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
12896         ;;
12897 esac
12898
12899 while $test "$cont"; do
12900         rp="Use which function to generate random numbers?"
12901         . ./myread
12902         if $test "$ans" = "$dflt"; then
12903                 : null
12904         else
12905                 randbits=''
12906         fi
12907         randfunc="$ans"
12908         if set $ans val -f; eval $csym; $val; then
12909                 cont=''
12910         else
12911                 dflt=y
12912                 rp="I cannot find function $ans. Use that name anyway?"
12913                 . ./myread
12914                 dflt=rand
12915                 case "$ans" in
12916                         [yY]*) cont='';;
12917                 esac
12918         fi
12919         case "$cont" in
12920         '')
12921                 case "$randfunc" in
12922                 drand48)
12923                         drand01="drand48()"
12924                         seedfunc="srand48"
12925                         randbits=48
12926                         randseedtype=long
12927                         ;;
12928                 rand|random)
12929                         case "$randbits" in
12930                         '')
12931 echo "Checking to see how many bits your $randfunc() function produces..." >&4
12932                                 $cat >try.c <<EOCP
12933 #$i_unistd I_UNISTD
12934 #$i_stdlib I_STDLIB
12935 #include <stdio.h>
12936 #ifdef I_UNISTD
12937 #  include <unistd.h>
12938 #endif
12939 #ifdef I_STDLIB
12940 #  include <stdlib.h>
12941 #endif
12942 int main()
12943 {
12944         register int i;
12945         register unsigned long tmp;
12946         register unsigned long max = 0L;
12947
12948         for (i = 1000; i; i--) {
12949                 tmp = (unsigned long) $randfunc();
12950                 if (tmp > max) max = tmp;
12951         }
12952         for (i = 0; max; i++)
12953                 max /= 2;
12954         printf("%d\n",i);
12955 }
12956 EOCP
12957                                 set try
12958                                 if eval $compile_ok; then
12959                                         dflt=`try`
12960                                 else
12961                                         dflt='?'
12962                                         echo "(I can't seem to compile the test program...)"
12963                                 fi
12964                                 ;;
12965                         *)
12966                                 dflt="$randbits"
12967                                 ;;
12968                         esac
12969                         rp="How many bits does your $randfunc() function produce?"
12970                         . ./myread
12971                         randbits="$ans"
12972                         $rm -f try.c try
12973                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12974                         seedfunc="s$randfunc"
12975                         randseedtype=unsigned
12976                         ;;
12977                 *)
12978                         dflt="31"
12979                         rp="How many bits does your $randfunc() function produce?"
12980                         . ./myread
12981                         randbits="$ans"
12982                         seedfunc="s$randfunc"
12983                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
12984                         if set $seedfunc val -f; eval $csym; $val; then
12985                                 echo "(Using $seedfunc() to seed random generator)"
12986                         else
12987                                 echo "(Warning: no $seedfunc() to seed random generator)"
12988                                 seedfunc=rand
12989                         fi
12990                         randseedtype=unsigned
12991                         ;;
12992                 esac
12993                 ;;
12994         esac
12995 done
12996
12997 echo " "
12998 echo "Determining whether or not we are on an EBCDIC system..." >&4
12999 $cat >tebcdic.c <<'EOM'
13000 int main()
13001 {
13002   if ('M'==0xd4) return 0;
13003   return 1;
13004 }
13005 EOM
13006
13007 val=$undef
13008 set tebcdic
13009 if eval $compile_ok; then
13010         if ./tebcdic; then
13011                 echo "You seem to speak EBCDIC." >&4
13012                 val="$define"
13013         else
13014                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
13015         fi
13016 else
13017         echo "I'm unable to compile the test program." >&4
13018         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
13019 fi
13020 $rm -f tebcdic.c tebcdic
13021 set ebcdic
13022 eval $setvar
13023
13024 echo " "
13025 $cat >&4 <<EOM
13026 Checking how to flush all pending stdio output...
13027 EOM
13028 # I only know how to find the first 32 possibly open files on SunOS.
13029 # See also hints/sunos_4_1.sh and util.c  --AD
13030 case "$osname" in
13031 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
13032 esac
13033 $cat >>try.c <<EOCP
13034 #include <stdio.h>
13035 #$i_unistd I_UNISTD
13036 #ifdef I_UNISTD
13037 # include <unistd.h>
13038 #endif
13039 #$d_sysconf HAS_SYSCONF
13040 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
13041 #ifdef HAS_STDIO_STREAM_ARRAY
13042 # define STDIO_STREAM_ARRAY $stdio_stream_array
13043 #endif
13044 int main() {
13045   FILE* p = fopen("try.out", "w");
13046 #ifdef TRY_FPUTC
13047   fputc('x', p);
13048 #else
13049 # ifdef TRY_FPRINTF
13050   fprintf(p, "x");
13051 # endif
13052 #endif
13053 #ifdef TRY_FFLUSH_NULL
13054   fflush(NULL);
13055 #endif
13056 #ifdef TRY_FFLUSH_ALL
13057   {
13058     long open_max = -1;
13059 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
13060     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
13061 # else
13062 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
13063     open_max = sysconf(_SC_OPEN_MAX);
13064 #  else
13065 #   ifdef FOPEN_MAX
13066     open_max = FOPEN_MAX;
13067 #   else
13068 #    ifdef OPEN_MAX
13069     open_max = OPEN_MAX;
13070 #    else
13071 #     ifdef _NFILE
13072     open_max = _NFILE;
13073 #     endif
13074 #    endif
13075 #   endif
13076 #  endif
13077 # endif 
13078 # ifdef HAS_STDIO_STREAM_ARRAY
13079     if (open_max > 0) {
13080       long i;
13081       for (i = 0; i < open_max; i++)
13082             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
13083                 STDIO_STREAM_ARRAY[i]._file < open_max &&
13084                 STDIO_STREAM_ARRAY[i]._flag)
13085                 fflush(&STDIO_STREAM_ARRAY[i]);
13086     }   
13087   }
13088 # endif
13089 #endif
13090   _exit(42);
13091 }
13092 EOCP
13093 : first we have to find out how _not_ to flush
13094 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
13095     output=''
13096     set try -DTRY_FPUTC
13097     if eval $compile; then
13098             $rm -f try.out
13099             ./try$exe_ext 2>/dev/null
13100             if $test ! -s try.out -a "X$?" = X42; then
13101                 output=-DTRY_FPUTC
13102             fi
13103     fi
13104     case "$output" in
13105     '')
13106             set try -DTRY_FPRINTF
13107             $rm -f try.out
13108             if eval $compile; then
13109                     $rm -f try.out
13110                     ./try$exe_ext 2>/dev/null
13111                     if $test ! -s try.out -a "X$?" = X42; then
13112                         output=-DTRY_FPRINTF
13113                     fi
13114             fi
13115         ;;
13116     esac
13117 fi
13118 : check for fflush NULL behaviour
13119 case "$fflushNULL" in
13120 '')     set try -DTRY_FFLUSH_NULL $output
13121         if eval $compile; then
13122                 $rm -f try.out
13123                 ./try$exe_ext 2>/dev/null
13124                 code="$?"
13125                 if $test -s try.out -a "X$code" = X42; then
13126                         fflushNULL="`$cat try.out`"
13127                 else
13128                         if $test "X$code" != X42; then
13129                                 $cat >&4 <<EOM
13130 (If this test failed, don't worry, we'll try another method shortly.)
13131 EOM
13132                         fi
13133                 fi
13134         fi
13135         $rm -f core try.core core.try.*
13136         case "$fflushNULL" in
13137         x)      $cat >&4 <<EOM
13138 Your fflush(NULL) works okay for output streams.
13139 Let's see if it clobbers input pipes...
13140 EOM
13141 # As of mid-March 2000 all versions of Solaris appear to have a stdio
13142 # bug that improperly flushes the input end of pipes.  So we avoid the
13143 # autoflush on fork/system/exec support for now. :-(
13144 $cat >tryp.c <<EOCP
13145 #include <stdio.h>
13146 int
13147 main(int argc, char **argv)
13148 {
13149     char buf[1024];
13150     int i;
13151     char *bp = buf;
13152     while (1) {
13153         while ((i = getc(stdin)) != -1
13154                && (*bp++ = i) != '\n'
13155                && bp < &buf[1024])
13156         /* DO NOTHING */ ;
13157         *bp = '\0';
13158         fprintf(stdout, "%s", buf);
13159         fflush(NULL);
13160         if (i == -1)
13161             return 0;
13162         bp = buf;
13163     }
13164 }
13165 EOCP
13166                 fflushNULL="$define"
13167                 set tryp
13168                 if eval $compile; then
13169                     $rm -f tryp.out
13170                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13171                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
13172                        $cat >&4 <<EOM
13173 fflush(NULL) seems to behave okay with input streams.
13174 EOM
13175                         fflushNULL="$define"
13176                     else
13177                         $cat >&4 <<EOM
13178 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
13179 EOM
13180                         fflushNULL="$undef"
13181                     fi
13182                 fi
13183                 $rm -f core tryp.c tryp.core core.tryp.*
13184                 ;;
13185         '')     $cat >&4 <<EOM
13186 Your fflush(NULL) isn't working (contrary to ANSI C).
13187 EOM
13188                 fflushNULL="$undef"
13189                 ;;
13190         *)      $cat >&4 <<EOM
13191 Cannot figure out whether your fflush(NULL) works or not.
13192 I'm assuming it doesn't (contrary to ANSI C).
13193 EOM
13194                 fflushNULL="$undef"
13195                 ;;
13196         esac
13197         ;;
13198 $define|true|[yY]*)
13199         fflushNULL="$define"
13200         ;;
13201 *)
13202         fflushNULL="$undef"
13203         ;;
13204 esac
13205 : check explicit looping only if NULL did not work, and if the pipe
13206 : bug does not show up on an explicit flush too
13207 case "$fflushNULL" in
13208 "$undef")
13209         $cat >tryp.c <<EOCP
13210 #include <stdio.h>
13211 int
13212 main(int argc, char **argv)
13213 {
13214     char buf[1024];
13215     int i;
13216     char *bp = buf;
13217     while (1) {
13218         while ((i = getc(stdin)) != -1
13219                && (*bp++ = i) != '\n'
13220                && bp < &buf[1024])
13221         /* DO NOTHING */ ;
13222         *bp = '\0';
13223         fprintf(stdout, "%s", buf);
13224         fflush(stdin);
13225         if (i == -1)
13226             return 0;
13227         bp = buf;
13228     }
13229 }
13230 EOCP
13231         set tryp
13232         if eval $compile; then
13233             $rm -f tryp.out
13234             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13235             if cmp tryp.c tryp.out >/dev/null 2>&1; then
13236                $cat >&4 <<EOM
13237 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
13238 EOM
13239                 : now check for fflushall behaviour
13240                 case "$fflushall" in
13241                 '')     set try -DTRY_FFLUSH_ALL $output
13242                         if eval $compile; then
13243                                 $cat >&4 <<EOM
13244 (Now testing the other method--but note that this also may fail.)
13245 EOM
13246                                 $rm -f try.out
13247                                 ./try$exe_ext 2>/dev/null
13248                                 if $test -s try.out -a "X$?" = X42; then
13249                                         fflushall="`$cat try.out`"
13250                                 fi
13251                         fi
13252                         $rm -f core try.core core.try.*
13253                         case "$fflushall" in
13254                         x)      $cat >&4 <<EOM
13255 Whew. Flushing explicitly all the stdio streams works.
13256 EOM
13257                                 fflushall="$define"
13258                                 ;;
13259                         '')     $cat >&4 <<EOM
13260 Sigh. Flushing explicitly all the stdio streams doesn't work.
13261 EOM
13262                                 fflushall="$undef"
13263                                 ;;
13264                         *)      $cat >&4 <<EOM
13265 Cannot figure out whether flushing stdio streams explicitly works or not.
13266 I'm assuming it doesn't.
13267 EOM
13268                                 fflushall="$undef"
13269                                 ;;
13270                         esac
13271                         ;;
13272                 "$define"|true|[yY]*)
13273                         fflushall="$define"
13274                         ;;
13275                 *)
13276                         fflushall="$undef"
13277                         ;;
13278                 esac
13279             else
13280                 $cat >&4 <<EOM
13281 All is futile.  Even fflush(stdin) clobbers input pipes!
13282 EOM
13283                 fflushall="$undef"
13284             fi
13285         else
13286             fflushall="$undef"
13287         fi
13288         $rm -f core tryp.c tryp.core core.tryp.*
13289         ;;
13290 *)      fflushall="$undef"
13291         ;;
13292 esac
13293
13294 case "$fflushNULL$fflushall" in
13295 undefundef)
13296         $cat <<EOM
13297 OK, I give up.  I cannot figure out how to flush pending stdio output.
13298 We won't be flushing handles at all before fork/exec/popen.
13299 EOM
13300         ;;
13301 esac
13302 $rm -f try.* try$exe_ext
13303
13304 : Store the full pathname to the ar program for use in the C program
13305 : Respect a hint or command line value for full_ar.
13306 case "$full_ar" in
13307 '') full_ar=$ar ;;
13308 esac
13309
13310 : Store the full pathname to the sed program for use in the C program
13311 full_sed=$sed
13312
13313 : see what type gids are declared as in the kernel
13314 echo " "
13315 echo "Looking for the type for group ids returned by getgid()."
13316 set gid_t gidtype xxx stdio.h sys/types.h
13317 eval $typedef
13318 case "$gidtype" in
13319 xxx)
13320         xxx=`./findhdr sys/user.h`
13321         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13322         case $1 in
13323         unsigned) dflt="$1 $2" ;;
13324         *) dflt="$1" ;;
13325         esac
13326         ;;
13327 *) dflt="$gidtype";;
13328 esac
13329 case "$gidtype" in
13330 gid_t) echo "gid_t found." ;;
13331 *)      rp="What is the type for group ids returned by getgid()?"
13332         . ./myread
13333         gidtype="$ans"
13334         ;;
13335 esac
13336
13337 echo " "
13338 case "$gidtype" in
13339 *_t) zzz="$gidtype"     ;;
13340 *)   zzz="gid"          ;;
13341 esac
13342 echo "Checking the size of $zzz..." >&4 
13343 cat > try.c <<EOCP
13344 #include <sys/types.h>
13345 #include <stdio.h>
13346 int main() {
13347     printf("%d\n", (int)sizeof($gidtype));
13348     exit(0);
13349 }
13350 EOCP
13351 set try
13352 if eval $compile_ok; then
13353         yyy=`./try`
13354         case "$yyy" in
13355         '')     gidsize=4
13356                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13357                 ;;
13358         *)      gidsize=$yyy
13359                 echo "Your $zzz is $gidsize bytes long."
13360                 ;;
13361         esac
13362 else
13363         gidsize=4
13364         echo "(I can't compile the test program--guessing $gidsize.)" >&4
13365 fi
13366
13367
13368 echo " "
13369 case "$gidtype" in
13370 *_t) zzz="$gidtype"     ;;
13371 *)   zzz="gid"          ;;
13372 esac
13373 echo "Checking the sign of $zzz..." >&4 
13374 cat > try.c <<EOCP
13375 #include <sys/types.h>
13376 #include <stdio.h>
13377 int main() {
13378         $gidtype foo = -1;
13379         if (foo < 0)
13380                 printf("-1\n");
13381         else
13382                 printf("1\n");
13383 }
13384 EOCP
13385 set try
13386 if eval $compile; then
13387         yyy=`./try`
13388         case "$yyy" in
13389         '')     gidsign=1
13390                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13391                 ;;
13392         *)      gidsign=$yyy
13393                 case "$gidsign" in
13394                  1) echo "Your $zzz is unsigned." ;;
13395                 -1) echo "Your $zzz is signed."   ;;
13396                 esac
13397                 ;;
13398         esac
13399 else
13400         gidsign=1
13401         echo "(I can't compile the test program--guessing unsigned.)" >&4
13402 fi
13403
13404
13405 echo " "
13406
13407 if $test X"$quadtype" != X; then
13408
13409 echo "Checking how to print 64-bit integers..." >&4
13410
13411 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13412         $cat >try.c <<'EOCP'
13413 #include <sys/types.h>
13414 #include <stdio.h>
13415 int main() {
13416   int q = 12345678901;
13417   printf("%ld\n", q);
13418 }
13419 EOCP
13420         set try
13421         if eval $compile; then
13422                 yyy=`./try$exe_ext`
13423                 case "$yyy" in
13424                 12345678901)
13425                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13426                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13427                         echo "We will use %d."
13428                         ;;
13429                 esac
13430         fi
13431 fi
13432
13433 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13434         $cat >try.c <<'EOCP'
13435 #include <sys/types.h>
13436 #include <stdio.h>
13437 int main() {
13438   long q = 12345678901;
13439   printf("%ld\n", q);
13440 }
13441 EOCP
13442         set try
13443         if eval $compile; then
13444                 yyy=`./try$exe_ext`
13445                 case "$yyy" in
13446                 12345678901)
13447                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13448                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13449                         echo "We will use %ld."
13450                         ;;
13451                 esac
13452         fi
13453 fi
13454
13455 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13456         $cat >try.c <<'EOCP'
13457 #include <sys/types.h>
13458 #include <inttypes.h>
13459 #include <stdio.h>
13460 int main() {
13461   int64_t q = 12345678901;
13462   printf("%" PRId64 "\n", q);
13463 }
13464 EOCP
13465         set try
13466         if eval $compile; then
13467                 yyy=`./try$exe_ext`
13468                 case "$yyy" in
13469                 12345678901)
13470                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13471                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13472                         echo "We will use the C9X style."
13473                         ;;
13474                 esac
13475         fi
13476 fi
13477
13478 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13479         $cat >try.c <<'EOCP'
13480 #include <sys/types.h>
13481 #include <stdio.h>
13482 int main() {
13483   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13484   printf("%lld\n", q);
13485 }
13486 EOCP
13487         set try
13488         if eval $compile; then
13489                 yyy=`./try$exe_ext`
13490                 case "$yyy" in
13491                 12345678901)
13492                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13493                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
13494                         echo "We will use the %lld style."
13495                         ;;
13496                 esac
13497         fi
13498 fi
13499
13500 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13501         $cat >try.c <<EOCP
13502 #include <sys/types.h>
13503 #include <stdio.h>
13504 int main() {
13505   $quadtype q = 12345678901;
13506   printf("%Ld\n", q);
13507 }
13508 EOCP
13509         set try
13510         if eval $compile; then
13511                 yyy=`./try$exe_ext`
13512                 case "$yyy" in
13513                 12345678901)
13514                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13515                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13516                         echo "We will use %Ld."
13517                         ;;
13518                 esac
13519         fi
13520 fi
13521
13522 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13523         $cat >try.c <<EOCP
13524 #include <sys/types.h>
13525 #include <stdio.h>
13526 int main() {
13527   $quadtype q = 12345678901;
13528   printf("%qd\n", q);
13529 }
13530 EOCP
13531         set try
13532         if eval $compile; then
13533                 yyy=`./try$exe_ext`
13534                 case "$yyy" in
13535                 12345678901)
13536                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13537                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
13538                         echo "We will use %qd."
13539                         ;;
13540                 esac
13541         fi
13542 fi
13543
13544 if $test X"$sPRId64" = X; then
13545         echo "Cannot figure out how to print 64-bit integers." >&4
13546 fi
13547
13548 $rm -f try try.*
13549
13550 fi
13551
13552 case "$sPRId64" in
13553 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
13554         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
13555         ;;
13556 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
13557         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
13558         ;;
13559 esac
13560
13561
13562 echo " "
13563 $echo "Checking the format strings to be used for Perl's internal types..." >&4
13564
13565 if $test X"$ivsize" = X8; then
13566         ivdformat="$sPRId64"
13567         uvuformat="$sPRIu64"
13568         uvoformat="$sPRIo64"
13569         uvxformat="$sPRIx64"
13570         uvXUformat="$sPRIXU64"
13571 else
13572         if $test X"$ivsize" = X"$longsize"; then
13573                 ivdformat='"ld"'
13574                 uvuformat='"lu"'
13575                 uvoformat='"lo"'
13576                 uvxformat='"lx"'
13577                 uvXUformat='"lX"'
13578         else
13579                 if $test X"$ivsize" = X"$intsize"; then
13580                         ivdformat='"d"'
13581                         uvuformat='"u"'
13582                         uvoformat='"o"'
13583                         uvxformat='"x"'
13584                         uvXUformat='"X"'
13585                 else
13586                         : far out
13587                         if $test X"$ivsize" = X"$shortsize"; then
13588                                 ivdformat='"hd"'
13589                                 uvuformat='"hu"'
13590                                 uvoformat='"ho"'
13591                                 uvxformat='"hx"'
13592                                 uvXUformat='"hX"'
13593                         fi
13594                 fi
13595         fi
13596 fi
13597
13598 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
13599         nveformat="$sPRIeldbl"
13600         nvfformat="$sPRIfldbl"
13601         nvgformat="$sPRIgldbl"
13602         nvEUformat="$sPRIEUldbl"
13603         nvFUformat="$sPRIFUldbl"
13604         nvGUformat="$sPRIGUldbl"
13605 else
13606         nveformat='"e"'
13607         nvfformat='"f"'
13608         nvgformat='"g"'
13609         nvEUformat='"E"'
13610         nvFUformat='"F"'
13611         nvGUformat='"G"'
13612 fi
13613
13614 case "$ivdformat" in
13615 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13616     exit 1
13617     ;;
13618 esac
13619
13620
13621 echo " "
13622 $echo "Checking the format string to be used for gids..." >&4
13623
13624 case "$gidsign" in
13625 -1)     if $test X"$gidsize" = X"$ivsize"; then
13626                 gidformat="$ivdformat"
13627         else
13628                 if $test X"$gidsize" = X"$longsize"; then
13629                         gidformat='"ld"'
13630                 else
13631                         if $test X"$gidsize" = X"$intsize"; then
13632                                 gidformat='"d"'
13633                         else
13634                                 if $test X"$gidsize" = X"$shortsize"; then
13635                                         gidformat='"hd"'
13636                                 fi
13637                         fi
13638                 fi
13639         fi
13640         ;;
13641 *)      if $test X"$gidsize" = X"$uvsize"; then
13642                 gidformat="$uvuformat"
13643         else
13644                 if $test X"$gidsize" = X"$longsize"; then
13645                         gidformat='"lu"'
13646                 else
13647                         if $test X"$gidsize" = X"$intsize"; then
13648                                 gidformat='"u"'
13649                         else
13650                                 if $test X"$gidsize" = X"$shortsize"; then
13651                                         gidformat='"hu"'
13652                                 fi
13653                         fi
13654                 fi
13655         fi
13656         ;;
13657 esac
13658
13659 : see if getgroups exists
13660 set getgroups d_getgrps
13661 eval $inlibc
13662
13663 : see if setgroups exists
13664 set setgroups d_setgrps
13665 eval $inlibc
13666
13667
13668 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13669 echo " "
13670 case "$d_getgrps$d_setgrps" in
13671 *define*)
13672         case "$groupstype" in
13673         '') dflt="$gidtype" ;;
13674         *)  dflt="$groupstype" ;;
13675         esac
13676         $cat <<EOM
13677 What type of pointer is the second argument to getgroups() and setgroups()?
13678 Usually this is the same as group ids, $gidtype, but not always.
13679
13680 EOM
13681         rp='What type pointer is the second argument to getgroups() and setgroups()?'
13682         . ./myread
13683         groupstype="$ans"
13684         ;;
13685 *)  groupstype="$gidtype";;
13686 esac
13687
13688 echo " "
13689 echo "Checking if your $make program sets \$(MAKE)..." >&4
13690 case "$make_set_make" in
13691 '')
13692         $sed 's/^X //' > testmake.mak << 'EOF'
13693 Xall:
13694 X       @echo 'maketemp="$(MAKE)"'
13695 EOF
13696         case "`$make -f testmake.mak 2>/dev/null`" in
13697         *maketemp=*) make_set_make='#' ;;
13698         *)      make_set_make="MAKE=$make" ;;
13699         esac
13700         $rm -f testmake.mak
13701         ;;
13702 esac
13703 case "$make_set_make" in
13704 '#') echo "Yup, it does.";;
13705 *) echo "Nope, it doesn't.";;
13706 esac
13707
13708 : see what type is used for mode_t
13709 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13710 set mode_t modetype int stdio.h sys/types.h
13711 eval $typedef_ask
13712
13713 : see if stdarg is available
13714 echo " "
13715 if $test `./findhdr stdarg.h`; then
13716         echo "<stdarg.h> found." >&4
13717         valstd="$define"
13718 else
13719         echo "<stdarg.h> NOT found." >&4
13720         valstd="$undef"
13721 fi
13722
13723 : see if varags is available
13724 echo " "
13725 if $test `./findhdr varargs.h`; then
13726         echo "<varargs.h> found." >&4
13727 else
13728         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
13729 fi
13730
13731 : set up the varargs testing programs
13732 $cat > varargs.c <<EOP
13733 #ifdef I_STDARG
13734 #include <stdarg.h>
13735 #endif
13736 #ifdef I_VARARGS
13737 #include <varargs.h>
13738 #endif
13739
13740 #ifdef I_STDARG
13741 int f(char *p, ...)
13742 #else
13743 int f(va_alist)
13744 va_dcl
13745 #endif
13746 {
13747         va_list ap;
13748 #ifndef I_STDARG
13749         char *p;
13750 #endif
13751 #ifdef I_STDARG
13752         va_start(ap,p);
13753 #else
13754         va_start(ap);
13755         p = va_arg(ap, char *);
13756 #endif
13757         va_end(ap);
13758 }
13759 EOP
13760 $cat > varargs <<EOP
13761 $startsh
13762 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
13763         echo "true"
13764 else
13765         echo "false"
13766 fi
13767 $rm -f varargs$_o
13768 EOP
13769 chmod +x varargs
13770
13771 : now check which varargs header should be included
13772 echo " "
13773 i_varhdr=''
13774 case "$valstd" in
13775 "$define")
13776         if `./varargs I_STDARG`; then
13777                 val='stdarg.h'
13778         elif `./varargs I_VARARGS`; then
13779                 val='varargs.h'
13780         fi
13781         ;;
13782 *)
13783         if `./varargs I_VARARGS`; then
13784                 val='varargs.h'
13785         fi
13786         ;;
13787 esac
13788 case "$val" in
13789 '')
13790 echo "I could not find the definition for va_dcl... You have problems..." >&4
13791         val="$undef"; set i_stdarg; eval $setvar
13792         val="$undef"; set i_varargs; eval $setvar
13793         ;;
13794 *) 
13795         set i_varhdr
13796         eval $setvar
13797         case "$i_varhdr" in
13798         stdarg.h)
13799                 val="$define"; set i_stdarg; eval $setvar
13800                 val="$undef"; set i_varargs; eval $setvar
13801                 ;;
13802         varargs.h)
13803                 val="$undef"; set i_stdarg; eval $setvar
13804                 val="$define"; set i_varargs; eval $setvar
13805                 ;;
13806         esac
13807         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
13808 esac
13809 $rm -f varargs*
13810
13811 : see if we need va_copy
13812 echo " "
13813 case "$i_stdarg" in
13814 "$define")
13815         $cat >try.c <<EOCP
13816 #include <stdarg.h>
13817 #include <stdio.h>
13818 #$i_stdlib I_STDLIB
13819 #ifdef I_STDLIB
13820 #include <stdlib.h>
13821 #endif
13822 #include <signal.h>
13823
13824 int
13825 ivfprintf(FILE *f, const char *fmt, va_list *valp)
13826 {
13827   return vfprintf(f, fmt, *valp);
13828 }
13829  
13830 int    
13831 myvfprintf(FILE *f, const  char *fmt, va_list val)
13832 {
13833   return ivfprintf(f, fmt, &val);
13834 }
13835       
13836 int
13837 myprintf(char *fmt, ...) 
13838 {
13839   va_list val;
13840   va_start(val, fmt);
13841   return myvfprintf(stdout, fmt, val); 
13842 }         
13843
13844 int
13845 main(int ac, char **av)
13846 {
13847   signal(SIGSEGV, exit);
13848
13849   myprintf("%s%cs all right, then\n", "that", '\'');                            
13850   exit(0);      
13851 }
13852 EOCP
13853         set try
13854         if eval $compile && ./try 2>&1 >/dev/null; then
13855                 case "`./try`" in
13856                 "that's all right, then")
13857                         okay=yes
13858                         ;;
13859                 esac
13860         fi
13861         case "$okay" in
13862         yes)    echo "It seems that you don't need va_copy()." >&4
13863                 need_va_copy="$undef"
13864                 ;;
13865         *)      echo "It seems that va_copy() or similar will be needed." >&4
13866                 need_va_copy="$define"
13867                 ;;
13868         esac
13869         $rm -f try.* core core.* *.core *.core.*
13870         ;;
13871 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
13872         ;;
13873 esac
13874
13875 : define a fucntion to check prototypes
13876 $cat > protochk <<EOSH
13877 $startsh
13878 cc="$cc"
13879 optimize="$optimize"
13880 ccflags="$ccflags"
13881 prototype="$prototype"
13882 define="$define"
13883 rm=$rm
13884 EOSH
13885
13886 $cat >> protochk <<'EOSH'
13887
13888 $rm -f try.c
13889 foo="$1"
13890 shift
13891 while test $# -ge 2; do
13892         case "$1" in
13893                 $define) echo "#include <$2>" >> try.c ;;
13894                 literal) echo "$2" >> try.c ;;
13895         esac
13896     shift 2
13897 done
13898 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
13899 cat >> try.c <<'EOCP'
13900 #ifdef CAN_PROTOTYPE
13901 #define _(args) args
13902 #else
13903 #define _(args) ()
13904 #endif
13905 EOCP
13906 echo "$foo" >> try.c
13907 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
13908 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
13909 status=$?
13910 $rm -f try.[co]
13911 exit $status
13912 EOSH
13913 chmod +x protochk
13914 $eunicefix protochk
13915
13916 : see what type is used for size_t
13917 rp="What is the type used for the length parameter for string functions?"
13918 set size_t sizetype 'unsigned int' stdio.h sys/types.h
13919 eval $typedef_ask
13920
13921 : check for type of arguments to gethostbyaddr. 
13922 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
13923         case "$d_gethbyaddr" in
13924         $define)
13925                 $cat <<EOM
13926
13927 Checking to see what type of arguments are accepted by gethostbyaddr().
13928 EOM
13929                 hdrs="$define sys/types.h
13930                         $d_socket sys/socket.h 
13931                         $i_niin netinet/in.h 
13932                         $i_netdb netdb.h
13933                         $i_unistd unistd.h"
13934                 : The first arg can 'char *' or 'void *'
13935                 : The second arg is some of integral type
13936                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
13937                         for yyy in size_t long int; do
13938                                 case "$netdb_host_type" in
13939                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
13940                                         if ./protochk "$try" $hdrs; then
13941                                                 echo "Your system accepts $xxx for the first arg."
13942                                                 echo "...and $yyy for the second arg."
13943                                                 netdb_host_type="$xxx"
13944                                                 netdb_hlen_type="$yyy"
13945                                         fi
13946                                         ;;
13947                                 esac
13948                         done
13949                 done
13950                 : In case none of those worked, prompt the user.
13951                 case "$netdb_host_type" in
13952                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
13953                         dflt='char *'
13954                         . ./myread
13955                         netdb_host_type=$ans
13956                         rp='What is the type for the 2nd argument to gethostbyaddr?'
13957                         dflt="$sizetype"
13958                         . ./myread
13959                         netdb_hlen_type=$ans
13960                         ;;
13961                 esac
13962                 ;;
13963         *)      : no gethostbyaddr, so pick harmless defaults
13964                 netdb_host_type='char *'
13965                 netdb_hlen_type="$sizetype"
13966                 ;;
13967         esac
13968         # Remove the "const" if needed. -- but then we'll have a 
13969         # prototype clash!
13970         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
13971 fi
13972
13973 : check for type of argument to gethostbyname. 
13974 if test "X$netdb_name_type" = X ; then
13975         case "$d_gethbyname" in
13976         $define)
13977                 $cat <<EOM
13978
13979 Checking to see what type of argument is accepted by gethostbyname().
13980 EOM
13981                 hdrs="$define sys/types.h
13982                         $d_socket sys/socket.h 
13983                         $i_niin netinet/in.h 
13984                         $i_netdb netdb.h
13985                         $i_unistd unistd.h"
13986                 for xxx in "const char *" "char *"; do
13987                         case "$netdb_name_type" in
13988                         '')     try="extern struct hostent *gethostbyname($xxx);"
13989                                 if ./protochk "$try" $hdrs; then
13990                                         echo "Your system accepts $xxx."
13991                                         netdb_name_type="$xxx"
13992                                 fi
13993                                 ;;
13994                         esac
13995                 done
13996                 : In case none of those worked, prompt the user.
13997                 case "$netdb_name_type" in
13998                 '')     rp='What is the type for the 1st argument to gethostbyname?'
13999                         dflt='char *'
14000                         . ./myread
14001                         netdb_name_type=$ans
14002                         ;;
14003                 esac
14004                 ;;
14005         *)      : no gethostbyname, so pick harmless default
14006                 netdb_name_type='char *'
14007                 ;;
14008         esac
14009 fi
14010
14011 : check for type of 1st argument to getnetbyaddr. 
14012 if test "X$netdb_net_type" = X ; then
14013         case "$d_getnbyaddr" in
14014         $define)
14015                 $cat <<EOM
14016
14017 Checking to see what type of 1st argument is accepted by getnetbyaddr().
14018 EOM
14019                 hdrs="$define sys/types.h
14020                         $d_socket sys/socket.h 
14021                         $i_niin netinet/in.h 
14022                         $i_netdb netdb.h
14023                         $i_unistd unistd.h"
14024                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
14025                         case "$netdb_net_type" in
14026                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
14027                                 if ./protochk "$try" $hdrs; then
14028                                         echo "Your system accepts $xxx."
14029                                         netdb_net_type="$xxx"
14030                                 fi
14031                                 ;;
14032                         esac
14033                 done
14034                 : In case none of those worked, prompt the user.
14035                 case "$netdb_net_type" in
14036                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
14037                         dflt='long'
14038                         . ./myread
14039                         netdb_net_type=$ans
14040                         ;;
14041                 esac
14042                 ;;
14043         *)      : no getnetbyaddr, so pick harmless default
14044                 netdb_net_type='long'
14045                 ;;
14046         esac
14047 fi
14048 : locate the preferred pager for this system
14049 case "$pager" in
14050 '')
14051         dflt=''
14052         case "$pg" in
14053         /*) dflt=$pg;;
14054         [a-zA-Z]:/*) dflt=$pg;;
14055         esac
14056         case "$more" in
14057         /*) dflt=$more;;
14058         [a-zA-Z]:/*) dflt=$more;;
14059         esac
14060         case "$less" in
14061         /*) dflt=$less;;
14062         [a-zA-Z]:/*) dflt=$less;;
14063         esac
14064         case "$dflt" in
14065         '') dflt=/usr/ucb/more;;
14066         esac
14067         ;;
14068 *) dflt="$pager";;
14069 esac
14070 echo " "
14071 fn=f/
14072 rp='What pager is used on your system?'
14073 . ./getfile
14074 pager="$ans"
14075
14076 : see what type pids are declared as in the kernel
14077 rp="What is the type of process ids on this system?"
14078 set pid_t pidtype int stdio.h sys/types.h
14079 eval $typedef_ask
14080
14081 : Find earliest binary compatible site_perl subdirectory perl can use.
14082 case "$bincompat5005" in
14083 "$define") xs_apiversion='5.005' ;;
14084 *) xs_apiversion=$version ;;   # The current site_perl version.
14085 esac
14086 : Find earliest pure perl site_perl subdirectory perl can use.
14087 : The versioned directories started at 5.005.
14088 pm_apiversion='5.005'
14089
14090 : check for length of pointer
14091 echo " "
14092 case "$ptrsize" in
14093 '')
14094         echo "Checking to see how big your pointers are..." >&4
14095         if test "$voidflags" -gt 7; then
14096                 echo '#define VOID_PTR char *' > try.c
14097         else
14098                 echo '#define VOID_PTR void *' > try.c
14099         fi
14100         $cat >>try.c <<'EOCP'
14101 #include <stdio.h>
14102 int main()
14103 {
14104     printf("%d\n", (int)sizeof(VOID_PTR));
14105     exit(0);
14106 }
14107 EOCP
14108         set try
14109         if eval $compile_ok; then
14110                 ptrsize=`./try`
14111                 echo "Your pointers are $ptrsize bytes long."
14112         else
14113                 dflt='4'
14114                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
14115                 rp="What is the size of a pointer (in bytes)?"
14116                 . ./myread
14117                 ptrsize="$ans"
14118         fi
14119         ;;
14120 esac
14121 $rm -f try.c try
14122
14123 : see if ar generates random libraries by itself
14124 echo " "
14125 echo "Checking how to generate random libraries on your machine..." >&4
14126 echo 'int bar1() { return bar2(); }' > bar1.c
14127 echo 'int bar2() { return 2; }' > bar2.c
14128 $cat > foo.c <<'EOP'
14129 int main() { printf("%d\n", bar1()); exit(0); }
14130 EOP
14131 $cc $ccflags -c bar1.c >/dev/null 2>&1
14132 $cc $ccflags -c bar2.c >/dev/null 2>&1
14133 $cc $ccflags -c foo.c >/dev/null 2>&1
14134 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
14135 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14136         ./foobar >/dev/null 2>&1; then
14137         echo "$ar appears to generate random libraries itself."
14138         orderlib=false
14139         ranlib=":"
14140 elif $ar ts bar$_a >/dev/null 2>&1 &&
14141         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14142         ./foobar >/dev/null 2>&1; then
14143                 echo "a table of contents needs to be added with '$ar ts'."
14144                 orderlib=false
14145                 ranlib="$ar ts"
14146 else
14147         case "$ranlib" in
14148         :) ranlib='';;
14149         '')
14150                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
14151                 $test -f $ranlib || ranlib=''
14152                 ;;
14153         esac
14154         if $test -n "$ranlib"; then
14155                 echo "your system has '$ranlib'; we'll use that."
14156                 orderlib=false
14157         else
14158                 echo "your system doesn't seem to support random libraries"
14159                 echo "so we'll use lorder and tsort to order the libraries."
14160                 orderlib=true
14161                 ranlib=":"
14162         fi
14163 fi
14164 $rm -f foo* bar* 
14165
14166 : check for type of arguments to select. 
14167 case "$selecttype" in
14168 '') case "$d_select" in
14169         $define)
14170                 echo " "
14171                 $cat <<EOM
14172 Checking to see what type of arguments are accepted by select().
14173 EOM
14174                 hdrs="$define sys/types.h
14175                         $i_systime sys/time.h 
14176                         $i_sysselct sys/select.h
14177                         $d_socket sys/socket.h"
14178                 : The first arg can be int, unsigned, or size_t
14179                 : The last arg may or may not be 'const'
14180                 val=''
14181                 : void pointer has been seen but using that
14182                 : breaks the selectminbits test
14183                 for xxx in 'fd_set *' 'int *'; do
14184                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
14185                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
14186                                         case "$val" in
14187                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
14188                                                 if ./protochk "$try" $hdrs; then
14189                                                         echo "Your system accepts $xxx."
14190                                                         val="$xxx"
14191                                                 fi
14192                                                 ;;
14193                                         esac
14194                                 done
14195                         done
14196                 done
14197                 case "$val" in
14198                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
14199                         case "$d_fd_set" in
14200                                 $define) dflt="fd_set *" ;;
14201                                 *)              dflt="int *" ;;
14202                         esac
14203                         . ./myread
14204                         val=$ans
14205                         ;;
14206                 esac
14207                 selecttype="$val"
14208                 ;;
14209         *)      : no select, so pick a harmless default
14210                 selecttype='int *'
14211                 ;;
14212         esac
14213         ;;
14214 esac
14215
14216 : check for the select 'width'
14217 case "$selectminbits" in
14218 '') case "$d_select" in
14219         $define)
14220                 $cat <<EOM
14221
14222 Checking to see on how many bits at a time your select() operates...
14223 EOM
14224                 $cat >try.c <<EOCP
14225 #include <sys/types.h>
14226 #$i_time I_TIME
14227 #$i_systime I_SYS_TIME
14228 #$i_systimek I_SYS_TIME_KERNEL
14229 #ifdef I_TIME
14230 #   include <time.h>
14231 #endif
14232 #ifdef I_SYS_TIME
14233 #   ifdef I_SYS_TIME_KERNEL
14234 #       define KERNEL
14235 #   endif
14236 #   include <sys/time.h>
14237 #   ifdef I_SYS_TIME_KERNEL
14238 #       undef KERNEL
14239 #   endif
14240 #endif
14241 #$i_sysselct I_SYS_SELECT
14242 #ifdef I_SYS_SELECT
14243 #include <sys/select.h>
14244 #endif
14245 #$d_socket HAS_SOCKET
14246 #ifdef HAS_SOCKET
14247 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
14248 #endif
14249 #include <stdio.h>
14250 $selecttype b;
14251 #define S sizeof(*(b))
14252 #define MINBITS 64
14253 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
14254 #define NBITS  (NBYTES * 8)
14255 int main() {
14256     char s[NBYTES];
14257     struct timeval t;
14258     int i;
14259     FILE* fp;
14260     int fd;
14261
14262     fclose(stdin);
14263     fp = fopen("try.c", "r");
14264     if (fp == 0)
14265       exit(1);
14266     fd = fileno(fp);
14267     if (fd < 0)
14268       exit(2);
14269     b = ($selecttype)s;
14270     for (i = 0; i < NBITS; i++)
14271         FD_SET(i, b);
14272     t.tv_sec  = 0;
14273     t.tv_usec = 0;
14274     select(fd + 1, b, 0, 0, &t);
14275     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
14276     printf("%d\n", i + 1);
14277     return 0;
14278 }
14279 EOCP
14280                 set try
14281                 if eval $compile_ok; then
14282                         selectminbits=`./try`
14283                         case "$selectminbits" in
14284                         '')     cat >&4 <<EOM
14285 Cannot figure out on how many bits at a time your select() operates.
14286 I'll play safe and guess it is 32 bits.
14287 EOM
14288                                 selectminbits=32
14289                                 bits="32 bits"
14290                                 ;;
14291                         1)      bits="1 bit" ;;
14292                         *)      bits="$selectminbits bits" ;;
14293                         esac
14294                         echo "Your select() operates on $bits at a time." >&4
14295                 else
14296                         rp='What is the minimum number of bits your select() operates on?'
14297                         case "$byteorder" in
14298                         1234|12345678)  dflt=32 ;;
14299                         *)              dflt=1  ;;
14300                         esac
14301                         . ./myread
14302                         val=$ans
14303                         selectminbits="$val"
14304                 fi
14305                 $rm -f try.* try
14306                 ;;
14307         *)      : no select, so pick a harmless default
14308                 selectminbits='32'
14309                 ;;
14310         esac
14311         ;;
14312 esac
14313
14314 : Trace out the files included by signal.h, then look for SIGxxx names.
14315 : Remove SIGARRAYSIZE used by HPUX.
14316 : Remove SIGSTKSIZE used by Linux.
14317 : Remove SIGSTKSZ used by Posix.
14318 : Remove SIGTYP void lines used by OS2.
14319 : Some cpps, like os390, dont give the file name anywhere
14320 if [ "X$fieldn" = X ]; then
14321         : Just make some guesses.  We check them later.
14322         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
14323 else
14324         xxx=`echo '#include <signal.h>' |
14325         $cppstdin $cppminus $cppflags 2>/dev/null |
14326         $grep '^[       ]*#.*include' | 
14327         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
14328 fi
14329 : Check this list of files to be sure we have parsed the cpp output ok.
14330 : This will also avoid potentially non-existent files, such 
14331 : as ../foo/bar.h
14332 xxxfiles=''
14333 for xx in $xxx /dev/null ; do
14334         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
14335 done
14336 : If we have found no files, at least try signal.h
14337 case "$xxxfiles" in
14338 '')     xxxfiles=`./findhdr signal.h` ;;
14339 esac
14340 xxx=`awk '
14341 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
14342         print substr($2, 4, 20)
14343 }
14344 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
14345         print substr($3, 4, 20)
14346 }' $xxxfiles`
14347 : Append some common names just in case the awk scan failed.
14348 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
14349 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
14350 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
14351 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
14352 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
14353
14354 : generate a few handy files for later
14355 $cat > signal.c <<'EOCP'
14356 #include <sys/types.h>
14357 #include <signal.h>
14358 #include <stdio.h>
14359 int main() {
14360
14361 /* Strange style to avoid deeply-nested #if/#else/#endif */
14362 #ifndef NSIG
14363 #  ifdef _NSIG
14364 #    define NSIG (_NSIG)
14365 #  endif
14366 #endif
14367
14368 #ifndef NSIG
14369 #  ifdef SIGMAX
14370 #    define NSIG (SIGMAX+1)
14371 #  endif
14372 #endif
14373
14374 #ifndef NSIG
14375 #  ifdef SIG_MAX
14376 #    define NSIG (SIG_MAX+1)
14377 #  endif
14378 #endif
14379
14380 #ifndef NSIG
14381 #  ifdef MAXSIG
14382 #    define NSIG (MAXSIG+1)
14383 #  endif
14384 #endif
14385
14386 #ifndef NSIG
14387 #  ifdef MAX_SIG
14388 #    define NSIG (MAX_SIG+1)
14389 #  endif
14390 #endif
14391
14392 #ifndef NSIG
14393 #  ifdef SIGARRAYSIZE
14394 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
14395 #  endif
14396 #endif
14397
14398 #ifndef NSIG
14399 #  ifdef _sys_nsig
14400 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
14401 #  endif
14402 #endif
14403
14404 /* Default to some arbitrary number that's big enough to get most
14405    of the common signals.
14406 */
14407 #ifndef NSIG
14408 #    define NSIG 50
14409 #endif
14410
14411 printf("NSIG %d\n", NSIG);
14412
14413 #ifndef JUST_NSIG
14414
14415 EOCP
14416
14417 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
14418 {
14419         printf "#ifdef SIG"; printf $1; printf "\n"
14420         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
14421         printf $1; printf ");\n"
14422         printf "#endif\n"
14423 }
14424 END {
14425         printf "#endif /* JUST_NSIG */\n";
14426         printf "exit(0);\n}\n";
14427 }
14428 ' >>signal.c
14429 $cat >signal.awk <<'EOP'
14430 BEGIN { ndups = 0 }
14431 $1 ~ /^NSIG$/ { nsig = $2 }
14432 ($1 !~ /^NSIG$/) && (NF == 2) {
14433     if ($2 > maxsig) { maxsig = $2 }
14434     if (sig_name[$2]) {
14435         dup_name[ndups] = $1
14436         dup_num[ndups] = $2
14437         ndups++ 
14438     }
14439     else {
14440         sig_name[$2] = $1
14441         sig_num[$2] = $2
14442     }
14443 }
14444 END { 
14445     if (nsig == 0) {
14446         nsig = maxsig + 1
14447     }
14448     printf("NSIG %d\n", nsig);
14449     for (n = 1; n < nsig; n++) {
14450         if (sig_name[n]) {
14451             printf("%s %d\n", sig_name[n], sig_num[n])
14452         }
14453         else {
14454             printf("NUM%d %d\n", n, n) 
14455         }
14456     }
14457     for (n = 0; n < ndups; n++) {
14458         printf("%s %d\n", dup_name[n], dup_num[n])
14459     }
14460 }
14461 EOP
14462 $cat >signal_cmd <<EOS
14463 $startsh
14464 if $test -s signal.lst; then
14465     echo "Using your existing signal.lst file"
14466         exit 0
14467 fi
14468 xxx="$xxx"
14469 EOS
14470 $cat >>signal_cmd <<'EOS'
14471
14472 set signal
14473 if eval $compile_ok; then
14474         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14475 else
14476         echo "(I can't seem be able to compile the whole test program)" >&4
14477         echo "(I'll try it in little pieces.)" >&4
14478         set signal -DJUST_NSIG
14479         if eval $compile_ok; then
14480                 ./signal$_exe > signal.nsg
14481                 $cat signal.nsg
14482         else
14483                 echo "I can't seem to figure out how many signals you have." >&4
14484                 echo "Guessing 50." >&4
14485                 echo 'NSIG 50' > signal.nsg
14486         fi
14487         : Now look at all the signal names, one at a time.
14488         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14489                 $cat > signal.c <<EOCP
14490 #include <sys/types.h>
14491 #include <signal.h>
14492 #include <stdio.h>
14493 int main() {
14494 printf("$xx %d\n", SIG${xx});
14495 return 0;
14496 }
14497 EOCP
14498                 set signal
14499                 if eval $compile; then
14500                         echo "SIG${xx} found."
14501                         ./signal$_exe  >> signal.ls1
14502                 else
14503                         echo "SIG${xx} NOT found."
14504                 fi
14505         done
14506         if $test -s signal.ls1; then
14507                 $cat signal.nsg signal.ls1 |
14508                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14509         fi
14510
14511 fi
14512 if $test -s signal.lst; then
14513         :
14514 else
14515         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14516         echo 'kill -l' >signal
14517         set X `csh -f <signal`
14518         $rm -f signal
14519         shift
14520         case $# in
14521         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14522         esac
14523         echo $@ | $tr ' ' $trnl | \
14524             $awk '{ printf "%s %d\n", $1, ++s; }
14525                   END { printf "NSIG %d\n", ++s }' >signal.lst
14526 fi
14527 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14528 EOS
14529 chmod a+x signal_cmd
14530 $eunicefix signal_cmd
14531
14532 : generate list of signal names
14533 echo " "
14534 case "$sig_name_init" in
14535 '') doinit=yes ;;
14536 *)  case "$sig_num_init" in
14537     ''|*,*) doinit=yes ;;
14538     esac ;;
14539 esac
14540 case "$doinit" in
14541 yes)
14542         echo "Generating a list of signal names and numbers..." >&4
14543         . ./signal_cmd
14544         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14545         sig_name=`$awk 'BEGIN { printf "ZERO " }
14546                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14547         sig_num=`$awk  'BEGIN { printf "0 " }
14548                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14549         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
14550                              !/^NSIG/   { printf "\"%s\", ", $1 }
14551                              END        { printf "0\n" }' signal.lst`
14552         sig_num_init=`$awk  'BEGIN      { printf "0, " }
14553                              !/^NSIG/   { printf "%d, ", $2}
14554                              END        { printf "0\n"}' signal.lst`
14555         ;;
14556 esac
14557 echo "The following $sig_count signals are available:"
14558 echo " "
14559 echo $sig_name | $awk \
14560 'BEGIN { linelen = 0 }
14561 {
14562         for (i = 1; i <= NF; i++) {
14563                 name = "SIG" $i " "
14564                 linelen = linelen + length(name)
14565                 if (linelen > 70) {
14566                         printf "\n"
14567                         linelen = length(name)
14568                 }
14569                 printf "%s", name
14570         }
14571         printf "\n"
14572 }'
14573 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
14574
14575 echo " "
14576 case "$sizetype" in
14577 *_t) zzz="$sizetype"    ;;
14578 *)   zzz="filesize"     ;;
14579 esac
14580 echo "Checking the size of $zzz..." >&4 
14581 cat > try.c <<EOCP
14582 #include <sys/types.h>
14583 #include <stdio.h>
14584 int main() {
14585     printf("%d\n", (int)sizeof($sizetype));
14586     exit(0);
14587 }
14588 EOCP
14589 set try
14590 if eval $compile_ok; then
14591         yyy=`./try`
14592         case "$yyy" in
14593         '')     sizesize=4
14594                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14595                 ;;
14596         *)      sizesize=$yyy
14597                 echo "Your $zzz size is $sizesize bytes."
14598                 ;;
14599         esac
14600 else
14601         sizesize=4
14602         echo "(I can't compile the test program--guessing $sizesize.)" >&4
14603 fi
14604
14605
14606 : check for socklen_t
14607 echo " "
14608 echo "Checking to see if you have socklen_t..." >&4
14609 $cat >try.c <<EOCP
14610 #include <sys/types.h>
14611 #$d_socket HAS_SOCKET
14612 #ifdef HAS_SOCKET
14613 #include <sys/socket.h>
14614 #endif
14615 int main() { socklen_t x = 16; }
14616 EOCP
14617 set try
14618 if eval $compile; then
14619         val="$define"
14620         echo "You have socklen_t."
14621 else
14622         val="$undef"
14623         echo "You do not have socklen_t."
14624         case "$sizetype" in
14625         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14626         esac
14627 fi
14628 $rm -f try try.*
14629 set d_socklen_t
14630 eval $setvar
14631
14632 : see if this is a socks.h system
14633 set socks.h i_socks
14634 eval $inhdr
14635
14636 : check for type of the size argument to socket calls
14637 case "$d_socket" in
14638 "$define")
14639         $cat <<EOM
14640
14641 Checking to see what type is the last argument of accept().
14642 EOM
14643         yyy=''
14644         case "$d_socklen_t" in
14645         "$define") yyy="$yyy socklen_t"
14646         esac
14647         yyy="$yyy $sizetype int long unsigned"
14648         for xxx in $yyy; do
14649                 case "$socksizetype" in
14650                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
14651                         case "$usesocks" in
14652                         "$define")
14653                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
14654                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
14655                                         socksizetype="$xxx"
14656                                 fi
14657                                 ;;
14658                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
14659                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
14660                                         socksizetype="$xxx"
14661                                 fi
14662                                 ;;
14663                         esac
14664                         ;;
14665                 esac
14666         done
14667 : In case none of those worked, prompt the user.
14668         case "$socksizetype" in
14669         '')     rp='What is the type for socket address structure sizes?'
14670                 dflt='int'
14671                 . ./myread
14672                 socksizetype=$ans
14673                 ;;
14674         esac
14675         ;;
14676 *)      : no sockets, so pick relatively harmless default
14677         socksizetype='int'
14678         ;;
14679 esac
14680
14681 : see what type is used for signed size_t
14682 set ssize_t ssizetype int stdio.h sys/types.h
14683 eval $typedef
14684 dflt="$ssizetype"
14685 $cat > ssize.c <<EOM
14686 #include <stdio.h>
14687 #include <sys/types.h>
14688 #define Size_t $sizetype
14689 #define SSize_t $dflt
14690 int main()
14691 {
14692         if (sizeof(Size_t) == sizeof(SSize_t))
14693                 printf("$dflt\n");
14694         else if (sizeof(Size_t) == sizeof(int))
14695                 printf("int\n");
14696         else 
14697                 printf("long\n");
14698         exit(0);
14699 }
14700 EOM
14701 echo " "
14702 set ssize
14703 if eval $compile_ok && ./ssize > /dev/null; then
14704         ssizetype=`./ssize`
14705         echo "I'll be using $ssizetype for functions returning a byte count." >&4
14706 else
14707         $cat >&4 <<EOM
14708 Help! I can't compile and run the ssize_t test program: please enlighten me!
14709 (This is probably a misconfiguration in your system or libraries, and
14710 you really ought to fix it.  Still, I'll try anyway.)
14711
14712 I need a type that is the same size as $sizetype, but is guaranteed to
14713 be signed.  Common values are ssize_t, int and long.
14714
14715 EOM
14716         rp="What signed type is the same size as $sizetype?"
14717         . ./myread
14718         ssizetype="$ans"
14719 fi
14720 $rm -f ssize ssize.*
14721
14722 : see what type of char stdio uses.
14723 echo " "
14724 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
14725 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
14726         echo "Your stdio uses unsigned chars." >&4
14727         stdchar="unsigned char"
14728 else
14729         echo "Your stdio uses signed chars." >&4
14730         stdchar="char"
14731 fi
14732 $rm -f stdioh
14733
14734
14735
14736 : see if time exists
14737 echo " "
14738 if test "X$d_time" = X -o X"$timetype" = X; then
14739     if set time val -f d_time; eval $csym; $val; then
14740                 echo 'time() found.' >&4
14741                 val="$define"
14742                 rp="What is the type returned by time() on this system?"
14743                 set time_t timetype long stdio.h sys/types.h
14744                 eval $typedef_ask
14745     else
14746                 echo 'time() not found, hope that will do.' >&4
14747                 val="$undef"
14748                 timetype='int';
14749     fi
14750     set d_time
14751     eval $setvar
14752 fi
14753
14754 : see what type uids are declared as in the kernel
14755 echo " "
14756 echo "Looking for the type for user ids returned by getuid()."
14757 set uid_t uidtype xxx stdio.h sys/types.h
14758 eval $typedef
14759 case "$uidtype" in
14760 xxx)
14761         xxx=`./findhdr sys/user.h`
14762         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
14763         case $1 in
14764         unsigned) dflt="$1 $2" ;;
14765         *) dflt="$1" ;;
14766         esac
14767         ;;
14768 *) dflt="$uidtype";;
14769 esac
14770 case "$uidtype" in
14771 uid_t)  echo "uid_t found." ;;
14772 *)      rp="What is the type for user ids returned by getuid()?"
14773         . ./myread
14774         uidtype="$ans"
14775         ;;
14776 esac
14777
14778 echo " "
14779 case "$uidtype" in
14780 *_t) zzz="$uidtype"     ;;
14781 *)   zzz="uid"          ;;
14782 esac
14783 echo "Checking the size of $zzz..." >&4 
14784 cat > try.c <<EOCP
14785 #include <sys/types.h>
14786 #include <stdio.h>
14787 int main() {
14788     printf("%d\n", (int)sizeof($uidtype));
14789     exit(0);
14790 }
14791 EOCP
14792 set try
14793 if eval $compile_ok; then
14794         yyy=`./try`
14795         case "$yyy" in
14796         '')     uidsize=4
14797                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
14798                 ;;
14799         *)      uidsize=$yyy
14800                 echo "Your $zzz is $uidsize bytes long."
14801                 ;;
14802         esac
14803 else
14804         uidsize=4
14805         echo "(I can't compile the test program--guessing $uidsize.)" >&4
14806 fi
14807
14808 echo " "
14809 case "$uidtype" in
14810 *_t) zzz="$uidtype"     ;;
14811 *)   zzz="uid"          ;;
14812 esac
14813 echo "Checking the sign of $zzz..." >&4
14814 cat > try.c <<EOCP
14815 #include <sys/types.h>
14816 #include <stdio.h>
14817 int main() {
14818         $uidtype foo = -1;
14819         if (foo < 0)
14820                 printf("-1\n");
14821         else
14822                 printf("1\n");
14823 }
14824 EOCP
14825 set try
14826 if eval $compile; then
14827         yyy=`./try`
14828         case "$yyy" in
14829         '')     uidsign=1
14830                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14831                 ;;
14832         *)      uidsign=$yyy
14833                 case "$uidsign" in
14834                  1) echo "Your $zzz is unsigned." ;;
14835                 -1) echo "Your $zzz is signed."   ;;
14836                 esac
14837                 ;;
14838         esac
14839 else
14840         uidsign=1
14841         echo "(I can't compile the test program--guessing unsigned.)" >&4
14842 fi
14843
14844
14845
14846 echo " "
14847 $echo "Checking the format string to be used for uids..." >&4
14848
14849 case "$uidsign" in
14850 -1)     if $test X"$uidsize" = X"$ivsize"; then
14851                 uidformat="$ivdformat"
14852         else
14853                 if $test X"$uidsize" = X"$longsize"; then
14854                         uidformat='"ld"'
14855                 else
14856                         if $test X"$uidsize" = X"$intsize"; then
14857                                 uidformat='"d"'
14858                         else
14859                                 if $test X"$uidsize" = X"$shortsize"; then
14860                                         uidformat='"hd"'
14861                                 fi
14862                         fi
14863                 fi
14864         fi
14865         ;;
14866 *)      if $test X"$uidsize" = X"$uvsize"; then
14867                 uidformat="$uvuformat"
14868         else
14869                 if $test X"$uidsize" = X"$longsize"; then
14870                         uidformat='"lu"'
14871                 else
14872                         if $test X"$uidsize" = X"$intsize"; then
14873                                 uidformat='"u"'
14874                         else
14875                                 if $test X"$uidsize" = X"$shortsize"; then
14876                                         uidformat='"hu"'
14877                                 fi
14878                         fi
14879                 fi
14880         fi
14881         ;;
14882 esac
14883
14884 : see if dbm.h is available
14885 : see if dbmclose exists
14886 set dbmclose d_dbmclose
14887 eval $inlibc
14888
14889 case "$d_dbmclose" in
14890 $define)
14891         set dbm.h i_dbm
14892         eval $inhdr
14893         case "$i_dbm" in
14894         $define)
14895                 val="$undef"
14896                 set i_rpcsvcdbm
14897                 eval $setvar
14898                 ;;
14899         *)      set rpcsvc/dbm.h i_rpcsvcdbm
14900                 eval $inhdr
14901                 ;;
14902         esac
14903         ;;
14904 *)      echo "We won't be including <dbm.h>"
14905         val="$undef"
14906         set i_dbm
14907         eval $setvar
14908         val="$undef"
14909         set i_rpcsvcdbm
14910         eval $setvar
14911         ;;
14912 esac
14913
14914 : see if this is a sys/file.h system
14915 val=''
14916 set sys/file.h val
14917 eval $inhdr
14918
14919 : do we need to include sys/file.h ?
14920 case "$val" in
14921 "$define")
14922         echo " "
14923         if $h_sysfile; then
14924                 val="$define"
14925                 echo "We'll be including <sys/file.h>." >&4
14926         else
14927                 val="$undef"
14928                 echo "We won't be including <sys/file.h>." >&4
14929         fi
14930         ;;
14931 *)
14932         h_sysfile=false
14933         ;;
14934 esac
14935 set i_sysfile
14936 eval $setvar
14937
14938 : see if fcntl.h is there
14939 val=''
14940 set fcntl.h val
14941 eval $inhdr
14942
14943 : see if we can include fcntl.h
14944 case "$val" in
14945 "$define")
14946         echo " "
14947         if $h_fcntl; then
14948                 val="$define"
14949                 echo "We'll be including <fcntl.h>." >&4
14950         else
14951                 val="$undef"
14952                 if $h_sysfile; then
14953         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
14954                 else
14955                         echo "We won't be including <fcntl.h>." >&4
14956                 fi
14957         fi
14958         ;;
14959 *)
14960         h_fcntl=false
14961         val="$undef"
14962         ;;
14963 esac
14964 set i_fcntl
14965 eval $setvar
14966
14967 : see if this is a iconv.h system
14968 set iconv.h i_iconv
14969 eval $inhdr
14970
14971 : see if this is a ieeefp.h system
14972 set ieeefp.h i_ieeefp
14973 eval $inhdr
14974
14975 : see if this is a libutil.h system
14976 set libutil.h i_libutil
14977 eval $inhdr
14978
14979 : see if locale.h is available
14980 set locale.h i_locale
14981 eval $inhdr
14982
14983 : see if mach cthreads are available
14984 if test "X$usethreads" = "X$define"; then
14985         set mach/cthreads.h i_machcthr
14986         eval $inhdr
14987 else
14988         i_machcthr="$undef"
14989 fi
14990
14991
14992
14993 : see if this is a math.h system
14994 set math.h i_math
14995 eval $inhdr
14996
14997 : see if this is a mntent.h system
14998 set mntent.h i_mntent
14999 eval $inhdr
15000
15001 : see if ndbm.h is available
15002 set ndbm.h t_ndbm
15003 eval $inhdr
15004 case "$t_ndbm" in
15005 $define)
15006         : see if dbm_open exists
15007         set dbm_open d_dbm_open
15008         eval $inlibc
15009         case "$d_dbm_open" in
15010         $undef)
15011                 t_ndbm="$undef"
15012                 echo "We won't be including <ndbm.h>"
15013                 ;;
15014         esac
15015         ;;
15016 esac
15017 val="$t_ndbm"
15018 set i_ndbm
15019 eval $setvar
15020
15021 : see if net/errno.h is available
15022 val=''
15023 set net/errno.h val
15024 eval $inhdr
15025
15026 : Unfortunately, it causes problems on some systems.  Arrgh.
15027 case "$val" in
15028 $define)
15029         cat > try.c <<'EOM'
15030 #include <stdio.h>
15031 #include <errno.h>
15032 #include <net/errno.h>
15033 int func()
15034 {
15035         return ENOTSOCK;
15036 }
15037 EOM
15038         if $cc $ccflags -c try.c >/dev/null 2>&1; then
15039                 echo "We'll be including <net/errno.h>." >&4
15040         else
15041                 echo "We won't be including <net/errno.h>." >&4
15042                 val="$undef"
15043         fi
15044         $rm -f try.* try
15045         ;;
15046 esac
15047 set i_neterrno
15048 eval $setvar
15049
15050 : see if netinet/tcp.h is available
15051 set netinet/tcp.h i_netinettcp
15052 eval $inhdr
15053
15054 : see if this is a poll.h system
15055 set poll.h i_poll
15056 eval $inhdr
15057
15058 : see if this is a prot.h system
15059 set prot.h i_prot
15060 eval $inhdr
15061
15062 echo " "
15063 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
15064 $cat <<'EOSH' > Cppsym.know
15065 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
15066 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
15067 alliant alpha am29000 AM29000 amiga AMIGAOS AMIX
15068 ansi ANSI_C_SOURCE apollo ardent atarist att386 att3b BeOS
15069 BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
15070 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
15071 bull c cadmus clipper CMU COFF COMPILER_VERSION
15072 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
15073 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
15074 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
15075 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
15076 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
15077 H3050R H3050RX hbullx20 hcx host_mips
15078 hp200 hp300 hp700 HP700 hp800 hp9000
15079 hp9000s200 hp9000s300 hp9000s400 hp9000s500
15080 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
15081 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
15082 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
15083 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
15084 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
15085 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
15086 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
15087 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
15088 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
15089 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
15090 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
15091 MATH_HAS_NO_SIDE_EFFECTS
15092 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
15093 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
15094 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
15095 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
15096 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
15097 NetBSD news1500 news1700 news1800 news1900 news3700
15098 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
15099 ns32016 ns32332 ns32k nsc32000
15100 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
15101 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
15102 pc532 pdp11 PGC PIC plexus PORTAR posix
15103 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
15104 POSIX_C_SOURCE POSIX_SOURCE POWER
15105 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
15106 riscix riscos RT scs SCO sequent sgi SGI_SOURCE sinix
15107 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
15108 sony sony_news sonyrisc sparc sparclite spectrum
15109 stardent stdc STDC_EXT stratos sun sun3 sun386
15110 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
15111 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
15112 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
15113 sysV68 sysV88 Tek4132 Tek4300 titan
15114 tower tower32 tower32_200 tower32_600 tower32_700
15115 tower32_800 tower32_850 tss
15116 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
15117 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
15118 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
15119 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
15120 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
15121 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
15122 z8000
15123 EOSH
15124 # Maybe put other stuff here too.
15125 cat <<EOSH >>Cppsym.know
15126 $osname
15127 EOSH
15128 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
15129 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
15130 $cat Cppsym.know > Cppsym.c
15131 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
15132 $rm -f Cppsym.a Cppsym.b Cppsym.c
15133 cat <<EOSH > Cppsym
15134 $startsh
15135 if $test \$# -gt 0; then
15136     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
15137     if $test -s Cppsym.got; then
15138         $rm -f Cppsym.got
15139         exit 0
15140     fi
15141     $rm -f Cppsym.got
15142     exit 1
15143 else
15144     $tr " " "$trnl" | ./Cppsym.try
15145     exit 0
15146 fi
15147 EOSH
15148 chmod +x Cppsym
15149 $eunicefix Cppsym
15150 cat <<EOSH > Cppsym.try
15151 $startsh
15152 cat <<'EOCP' > try.c
15153 #include <stdio.h>
15154 int main() {
15155 EOCP
15156 $awk \\
15157 EOSH
15158 cat <<'EOSH' >> Cppsym.try
15159 'length($1) > 0 {
15160     printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", %s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15161     printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", _%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15162     printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", __%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15163     printf "#ifdef __%s__\n#if __%s__+0\nprintf(\"__%s__=%%ld\\n\", __%s__);\n#else\nprintf(\"__%s__\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15164 }'       >> try.c
15165 echo '}' >> try.c
15166 EOSH
15167 cat <<EOSH >> Cppsym.try
15168 ccflags="$ccflags"
15169 case "$osname-$gccversion" in
15170 irix-) ccflags="\$ccflags -woff 1178" ;;
15171 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
15172 esac
15173 $cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
15174 EOSH
15175 chmod +x Cppsym.try
15176 $eunicefix Cppsym.try
15177 ./Cppsym < Cppsym.know > Cppsym.true
15178 : now check the C compiler for additional symbols
15179 postprocess_cc_v=''
15180 case "$osname" in
15181 aix) postprocess_cc_v="|$tr , ' '" ;;
15182 esac
15183 $cat >ccsym <<EOS
15184 $startsh
15185 $cat >tmp.c <<EOF
15186 extern int foo;
15187 EOF
15188 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
15189 do
15190         case "\$i" in
15191         -D*) echo "\$i" | $sed 's/^-D//';;
15192         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
15193         esac
15194 done
15195 $rm -f try.c
15196 EOS
15197 postprocess_cc_v=''
15198 chmod +x ccsym
15199 $eunicefix ccsym
15200 ./ccsym > ccsym1.raw
15201 if $test -s ccsym1.raw; then
15202        $sort ccsym1.raw | $uniq >ccsym.raw
15203 else
15204        mv ccsym1.raw ccsym.raw
15205 fi
15206
15207 $awk '/\=/ { print $0; next }
15208         { print $0"=1" }' ccsym.raw >ccsym.list
15209 $awk '/\=/ { print $0; next }
15210         { print $0"=1" }' Cppsym.true >ccsym.true
15211 $comm -13 ccsym.true ccsym.list >ccsym.own
15212 $comm -12 ccsym.true ccsym.list >ccsym.com
15213 $comm -23 ccsym.true ccsym.list >ccsym.cpp
15214 also=''
15215 if $test -z ccsym.raw; then
15216         echo "Your C compiler doesn't seem to define any symbols!" >&4
15217         echo " "
15218         echo "However, your C preprocessor defines the following symbols:"
15219         $cat Cppsym.true
15220         ccsymbols=''
15221         cppsymbols=`$cat Cppsym.true`
15222         cppsymbols=`echo $cppsymbols`
15223         cppccsymbols="$cppsymbols"
15224 else
15225         if $test -s ccsym.com; then
15226                 echo "Your C compiler and pre-processor define these symbols:"
15227                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
15228                 also='also '
15229                 symbols='ones'
15230                 cppccsymbols=`$cat ccsym.com`
15231                 cppccsymbols=`echo $cppccsymbols`
15232                 $test "$silent" || sleep 1
15233         fi
15234         if $test -s ccsym.cpp; then
15235                 $test "$also" && echo " "
15236                 echo "Your C pre-processor ${also}defines the following symbols:"
15237                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
15238                 also='further '
15239                 cppsymbols=`$cat ccsym.cpp`
15240                 cppsymbols=`echo $cppsymbols`
15241                 $test "$silent" || sleep 1
15242         fi
15243         if $test -s ccsym.own; then
15244                 $test "$also" && echo " "
15245                 echo "Your C compiler ${also}defines the following cpp symbols:"
15246                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
15247                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
15248                 ccsymbols=`$cat ccsym.own`
15249                 ccsymbols=`echo $ccsymbols`
15250                 $test "$silent" || sleep 1
15251         fi
15252 fi
15253 $rm -f ccsym* Cppsym.*
15254
15255 : see if this is a termio system
15256 val="$undef"
15257 val2="$undef"
15258 val3="$undef"
15259 if $test `./findhdr termios.h`; then
15260         set tcsetattr i_termios
15261         eval $inlibc
15262         val3="$i_termios"
15263 fi
15264 echo " "
15265 case "$val3" in
15266 "$define") echo "You have POSIX termios.h... good!" >&4;;
15267 *) if ./Cppsym pyr; then
15268                 case "`/bin/universe`" in
15269                 ucb) if $test `./findhdr sgtty.h`; then
15270                                 val2="$define"
15271                                 echo "<sgtty.h> found." >&4
15272                         else
15273                                 echo "System is pyramid with BSD universe."
15274                                 echo "<sgtty.h> not found--you could have problems." >&4
15275                         fi;;
15276                 *) if $test `./findhdr termio.h`; then
15277                                 val="$define"
15278                                 echo "<termio.h> found." >&4
15279                         else
15280                                 echo "System is pyramid with USG universe."
15281                                 echo "<termio.h> not found--you could have problems." >&4
15282                         fi;;
15283                 esac
15284         elif ./usg; then
15285                 if $test `./findhdr termio.h`; then
15286                         echo "<termio.h> found." >&4
15287                         val="$define"
15288                 elif $test `./findhdr sgtty.h`; then
15289                         echo "<sgtty.h> found." >&4
15290                         val2="$define"
15291                 else
15292 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
15293                 fi
15294         else
15295                 if $test `./findhdr sgtty.h`; then
15296                         echo "<sgtty.h> found." >&4
15297                         val2="$define"
15298                 elif $test `./findhdr termio.h`; then
15299                         echo "<termio.h> found." >&4
15300                         val="$define"
15301                 else
15302 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
15303                 fi
15304         fi;;
15305 esac
15306 set i_termio; eval $setvar
15307 val=$val2; set i_sgtty; eval $setvar
15308 val=$val3; set i_termios; eval $setvar
15309
15310 : see if this is a shadow.h system
15311 set shadow.h i_shadow
15312 eval $inhdr
15313
15314 : see if stddef is available
15315 set stddef.h i_stddef
15316 eval $inhdr
15317
15318 : see if this is a sunmath.h system
15319 set sunmath.h i_sunmath
15320 eval $inhdr
15321
15322 : see if sys/access.h is available
15323 set sys/access.h i_sysaccess
15324 eval $inhdr
15325
15326 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
15327 set sys/filio.h i_sysfilio
15328 eval $inhdr
15329 echo " "
15330 if $test `./findhdr sys/ioctl.h`; then
15331         val="$define"
15332         echo '<sys/ioctl.h> found.' >&4
15333 else
15334         val="$undef"
15335         if $test $i_sysfilio = "$define"; then
15336             echo '<sys/ioctl.h> NOT found.' >&4
15337         else
15338                 $test $i_sgtty = "$define" && xxx="sgtty.h"
15339                 $test $i_termio = "$define" && xxx="termio.h"
15340                 $test $i_termios = "$define" && xxx="termios.h"
15341 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
15342         fi
15343 fi
15344 set i_sysioctl
15345 eval $setvar
15346
15347
15348 : see if this is a syslog.h system
15349 set syslog.h i_syslog
15350 eval $inhdr
15351
15352
15353 : see if this is a sys/mode.h system
15354 set sys/mode.h i_sysmode
15355 eval $inhdr
15356
15357 : see if sys/resource.h has to be included
15358 set sys/resource.h i_sysresrc
15359 eval $inhdr
15360
15361 : see if sys/security.h is available
15362 set sys/security.h i_syssecrt
15363 eval $inhdr
15364
15365 : see if this is a sys/statvfs.h system
15366 set sys/statvfs.h i_sysstatvfs
15367 eval $inhdr
15368
15369 : see if this is a sys/uio.h system
15370 set sys/uio.h i_sysuio
15371 eval $inhdr
15372
15373 : see if this is a sys/un.h system
15374 set sys/un.h i_sysun
15375 eval $inhdr
15376
15377
15378 : see if this is a sys/utsname.h system
15379 set sys/utsname.h i_sysutsname
15380 eval $inhdr
15381
15382 : see if this is a syswait system
15383 set sys/wait.h i_syswait
15384 eval $inhdr
15385
15386 : see if this is a ustat.h system
15387 set ustat.h i_ustat
15388 eval $inhdr
15389
15390 : see if this is an utime system
15391 set utime.h i_utime
15392 eval $inhdr
15393
15394 : see if this is a values.h system
15395 set values.h i_values
15396 eval $inhdr
15397
15398 : see if this is a vfork system
15399 case "$d_vfork" in
15400 "$define")
15401         set vfork.h i_vfork
15402         eval $inhdr
15403         ;;
15404 *)
15405         i_vfork="$undef"
15406         ;;
15407 esac
15408
15409 : see if gdbm.h is available
15410 set gdbm.h t_gdbm
15411 eval $inhdr
15412 case "$t_gdbm" in
15413 $define)
15414         : see if gdbm_open exists
15415         set gdbm_open d_gdbm_open
15416         eval $inlibc
15417         case "$d_gdbm_open" in
15418         $undef)
15419                 t_gdbm="$undef"
15420                 echo "We won't be including <gdbm.h>"
15421                 ;;
15422         esac
15423         ;;
15424 esac
15425 val="$t_gdbm"
15426 set i_gdbm
15427 eval $setvar
15428
15429 echo " "
15430 echo "Looking for extensions..." >&4
15431 : If we are using the old config.sh, known_extensions may contain
15432 : old or inaccurate or duplicate values.
15433 known_extensions=''
15434 nonxs_extensions=''
15435 : We do not use find because it might not be available.
15436 : We do not just use MANIFEST because the user may have dropped
15437 : some additional extensions into the source tree and expect them
15438 : to be built.
15439
15440 : Function to recursively find available extensions, ignoring DynaLoader
15441 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15442 find_extensions='
15443     for xxx in *; do
15444        case "$xxx" in
15445            DynaLoader|dynaload) ;;
15446            *)
15447            if $test -f $xxx/$xxx.xs; then
15448                known_extensions="$known_extensions $1$xxx";
15449            elif $test -f $xxx/Makefile.PL; then
15450                nonxs_extensions="$nonxs_extensions $1$xxx";
15451            else
15452                if $test -d $xxx -a $# -lt 10; then
15453                    set $1$xxx/ $*;
15454                    cd $xxx;
15455                    eval $find_extensions;
15456                    cd ..;
15457                    shift;
15458                fi;
15459            fi
15460            ;;
15461        esac;
15462     done'
15463 tdir=`pwd`
15464 cd $rsrc/ext
15465 set X
15466 shift
15467 eval $find_extensions
15468 set X $nonxs_extensions
15469 shift
15470 nonxs_extensions="$*"
15471 set X $known_extensions
15472 shift
15473 known_extensions="$*"
15474 cd $tdir
15475
15476 : Now see which are supported on this system.
15477 avail_ext=''
15478 for xxx in $known_extensions ; do
15479         case "$xxx" in
15480         DB_File|db_file)
15481                 case "$i_db" in
15482                 $define) avail_ext="$avail_ext $xxx" ;;
15483                 esac
15484                 ;;
15485         GDBM_File|gdbm_fil)
15486                 case "$i_gdbm" in 
15487                 $define) avail_ext="$avail_ext $xxx" ;;
15488                 esac
15489                 ;;
15490         NDBM_File|ndbm_fil)
15491                 case "$i_ndbm" in
15492                 $define)
15493                     case "$osname-$use64bitint" in
15494                     hpux-define)
15495                         case "$libs" in
15496                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15497                         esac
15498                         ;;
15499                     *) avail_ext="$avail_ext $xxx" ;;
15500                     esac
15501                     ;;
15502                 esac
15503                 ;;
15504         ODBM_File|odbm_fil) 
15505                 case "${i_dbm}${i_rpcsvcdbm}" in
15506                 *"${define}"*)
15507                     case "$osname-$use64bitint" in
15508                     hpux-define)
15509                         case "$libs" in
15510                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15511                         esac
15512                         ;;
15513                     *) avail_ext="$avail_ext $xxx" ;;
15514                     esac
15515                     ;;
15516                 esac
15517                 ;;
15518         POSIX|posix)
15519                 case "$useposix" in
15520                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15521                 esac
15522                 ;;
15523         Opcode|opcode)
15524                 case "$useopcode" in
15525                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15526                 esac
15527                 ;;
15528         Socket|socket)
15529                 case "$d_socket" in 
15530                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15531                 esac
15532                 ;;
15533         Sys/Syslog|sys/syslog)
15534                 : XXX syslog requires socket
15535                 case "$d_socket" in 
15536                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15537                 esac
15538                 ;;
15539         Thread|thread)
15540                 case "$usethreads" in 
15541                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15542                 esac
15543                 ;;
15544         IPC/SysV|ipc/sysv)
15545                 : XXX Do we need a useipcsysv variable here
15546                 case "${d_msg}${d_sem}${d_shm}" in 
15547                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15548                 esac
15549                 ;;
15550         *)      avail_ext="$avail_ext $xxx"
15551                 ;;
15552         esac
15553 done
15554
15555 set X $avail_ext
15556 shift
15557 avail_ext="$*"
15558
15559 : Now see which nonxs extensions are supported on this system.
15560 : For now assume all are.
15561 nonxs_ext=''
15562 for xxx in $nonxs_extensions ; do
15563         case "$xxx" in
15564         *)      nonxs_ext="$nonxs_ext $xxx"
15565                 ;;
15566         esac
15567 done
15568
15569 set X $nonxs_ext
15570 shift
15571 nonxs_ext="$*"
15572
15573 case $usedl in
15574 $define)
15575         $cat <<EOM
15576 A number of extensions are supplied with $package.  You may choose to
15577 compile these extensions for dynamic loading (the default), compile
15578 them into the $package executable (static loading), or not include
15579 them at all.  Answer "none" to include no extensions.
15580 Note that DynaLoader is always built and need not be mentioned here.
15581
15582 EOM
15583         case "$dynamic_ext" in
15584         '') dflt="$avail_ext" ;;
15585         *)      dflt="$dynamic_ext"
15586                 # Perhaps we are reusing an old out-of-date config.sh.
15587                 case "$hint" in
15588                 previous)
15589                         if test X"$dynamic_ext" != X"$avail_ext"; then
15590                                 $cat <<EOM
15591 NOTICE:  Your previous config.sh list may be incorrect. 
15592 The extensions now available to you are 
15593         ${avail_ext}
15594 but the default list from your previous config.sh is
15595         ${dynamic_ext} 
15596
15597 EOM
15598                         fi
15599                         ;;
15600                 esac
15601                 ;;
15602         esac
15603         case "$dflt" in
15604         '')     dflt=none;;
15605         esac
15606         rp="What extensions do you wish to load dynamically?"
15607         . ./myread
15608         case "$ans" in
15609         none) dynamic_ext=' ' ;;
15610         *) dynamic_ext="$ans" ;;
15611         esac
15612
15613         case "$static_ext" in
15614         '')
15615                 : Exclude those already listed in dynamic linking
15616                 dflt=''
15617                 for xxx in $avail_ext; do
15618                         case " $dynamic_ext " in
15619                         *" $xxx "*) ;;
15620                         *) dflt="$dflt $xxx" ;;
15621                         esac
15622                 done
15623                 set X $dflt
15624                 shift
15625                 dflt="$*"
15626                 ;;
15627         *)  dflt="$static_ext" 
15628                 ;;
15629         esac
15630
15631         case "$dflt" in
15632         '')     dflt=none;;
15633         esac
15634         rp="What extensions do you wish to load statically?"
15635         . ./myread
15636         case "$ans" in
15637         none) static_ext=' ' ;;
15638         *) static_ext="$ans" ;;
15639         esac
15640         ;;
15641 *)
15642         $cat <<EOM
15643 A number of extensions are supplied with $package.  Answer "none" 
15644 to include no extensions. 
15645 Note that DynaLoader is always built and need not be mentioned here.
15646
15647 EOM
15648         case "$static_ext" in
15649         '') dflt="$avail_ext" ;;
15650         *)      dflt="$static_ext"
15651                 # Perhaps we are reusing an old out-of-date config.sh.
15652                 case "$hint" in
15653                 previous)
15654                         if test X"$static_ext" != X"$avail_ext"; then
15655                                 $cat <<EOM
15656 NOTICE:  Your previous config.sh list may be incorrect. 
15657 The extensions now available to you are 
15658         ${avail_ext}
15659 but the default list from your previous config.sh is
15660         ${static_ext} 
15661
15662 EOM
15663                         fi
15664                         ;;
15665                 esac
15666                 ;;
15667         esac
15668         : Exclude those that are not xs extensions
15669         case "$dflt" in
15670         '')     dflt=none;;
15671         esac
15672         rp="What extensions do you wish to include?"
15673         . ./myread
15674         case "$ans" in
15675         none) static_ext=' ' ;;
15676         *) static_ext="$ans" ;;
15677         esac
15678         ;;
15679 esac
15680
15681 set X $dynamic_ext $static_ext $nonxs_ext
15682 shift
15683 extensions="$*"
15684
15685 : Remove libraries needed only for extensions
15686 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
15687 : The exception is SunOS 4.x, which needs them.
15688 case "${osname}X${osvers}" in
15689 sunos*X4*)
15690     perllibs="$libs"
15691     ;;
15692 *) case "$usedl" in
15693     $define|true|[yY]*)
15694             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
15695             shift
15696             perllibs="$*"
15697             ;;
15698     *)  perllibs="$libs"
15699             ;;
15700     esac
15701     ;;
15702 esac
15703
15704 : Remove build directory name from cppstdin so it can be used from
15705 : either the present location or the final installed location.
15706 echo " "
15707 : Get out of the UU directory to get correct path name.
15708 cd ..
15709 case "$cppstdin" in
15710 `pwd`/cppstdin)
15711         echo "Stripping down cppstdin path name"
15712         cppstdin=cppstdin
15713         ;;
15714 esac
15715 cd UU
15716
15717 : end of configuration questions
15718 echo " "
15719 echo "End of configuration questions."
15720 echo " "
15721
15722 : back to where it started
15723 if test -d ../UU; then
15724         cd ..
15725 fi
15726
15727 : configuration may be patched via a 'config.over' file
15728 if $test -f config.over; then
15729         echo " "
15730         dflt=y
15731         rp='I see a config.over file.  Do you wish to load it?'
15732         . UU/myread
15733         case "$ans" in
15734         n*) echo "OK, I'll ignore it.";;
15735         *)      . ./config.over
15736                 echo "Configuration override changes have been loaded."
15737                 ;;
15738         esac
15739 fi
15740
15741 : in case they want portability, strip down executable paths
15742 case "$d_portable" in
15743 "$define")
15744         echo " "
15745         echo "Stripping down executable paths..." >&4
15746         for file in $loclist $trylist; do
15747                 eval temp=\$$file
15748                 eval $file=`basename $temp`
15749         done
15750         ;;
15751 esac
15752
15753 : create config.sh file
15754 echo " "
15755 echo "Creating config.sh..." >&4
15756 $spitshell <<EOT >config.sh
15757 $startsh
15758 #
15759 # This file was produced by running the Configure script. It holds all the
15760 # definitions figured out by Configure. Should you modify one of these values,
15761 # do not forget to propagate your changes by running "Configure -der". You may
15762 # instead choose to run each of the .SH files by yourself, or "Configure -S".
15763 #
15764
15765 # Package name      : $package
15766 # Source directory  : $src
15767 # Configuration time: $cf_time
15768 # Configured by     : $cf_by
15769 # Target system     : $myuname
15770
15771 Author='$Author'
15772 Date='$Date'
15773 Header='$Header'
15774 Id='$Id'
15775 Locker='$Locker'
15776 Log='$Log'
15777 Mcc='$Mcc'
15778 RCSfile='$RCSfile'
15779 Revision='$Revision'
15780 Source='$Source'
15781 State='$State'
15782 _a='$_a'
15783 _exe='$_exe'
15784 _o='$_o'
15785 afs='$afs'
15786 alignbytes='$alignbytes'
15787 ansi2knr='$ansi2knr'
15788 aphostname='$aphostname'
15789 api_revision='$api_revision'
15790 api_subversion='$api_subversion'
15791 api_version='$api_version'
15792 api_versionstring='$api_versionstring'
15793 ar='$ar'
15794 archlib='$archlib'
15795 archlibexp='$archlibexp'
15796 archname64='$archname64'
15797 archname='$archname'
15798 archobjs='$archobjs'
15799 awk='$awk'
15800 baserev='$baserev'
15801 bash='$bash'
15802 bin='$bin'
15803 bincompat5005='$bincompat5005'
15804 binexp='$binexp'
15805 bison='$bison'
15806 byacc='$byacc'
15807 byteorder='$byteorder'
15808 c='$c'
15809 castflags='$castflags'
15810 cat='$cat'
15811 cc='$cc'
15812 cccdlflags='$cccdlflags'
15813 ccdlflags='$ccdlflags'
15814 ccflags='$ccflags'
15815 ccflags_uselargefiles='$ccflags_uselargefiles'
15816 ccname='$ccname'
15817 ccsymbols='$ccsymbols'
15818 ccversion='$ccversion'
15819 cf_by='$cf_by'
15820 cf_email='$cf_email'
15821 cf_time='$cf_time'
15822 charsize='$charsize'
15823 chgrp='$chgrp'
15824 chmod='$chmod'
15825 chown='$chown'
15826 clocktype='$clocktype'
15827 comm='$comm'
15828 compress='$compress'
15829 contains='$contains'
15830 cp='$cp'
15831 cpio='$cpio'
15832 cpp='$cpp'
15833 cpp_stuff='$cpp_stuff'
15834 cppccsymbols='$cppccsymbols'
15835 cppflags='$cppflags'
15836 cpplast='$cpplast'
15837 cppminus='$cppminus'
15838 cpprun='$cpprun'
15839 cppstdin='$cppstdin'
15840 cppsymbols='$cppsymbols'
15841 crosscompile='$crosscompile'
15842 cryptlib='$cryptlib'
15843 csh='$csh'
15844 d_Gconvert='$d_Gconvert'
15845 d_PRIEUldbl='$d_PRIEUldbl'
15846 d_PRIFUldbl='$d_PRIFUldbl'
15847 d_PRIGUldbl='$d_PRIGUldbl'
15848 d_PRIXU64='$d_PRIXU64'
15849 d_PRId64='$d_PRId64'
15850 d_PRIeldbl='$d_PRIeldbl'
15851 d_PRIfldbl='$d_PRIfldbl'
15852 d_PRIgldbl='$d_PRIgldbl'
15853 d_PRIi64='$d_PRIi64'
15854 d_PRIo64='$d_PRIo64'
15855 d_PRIu64='$d_PRIu64'
15856 d_PRIx64='$d_PRIx64'
15857 d_SCNfldbl='$d_SCNfldbl'
15858 d__fwalk='$d__fwalk'
15859 d_access='$d_access'
15860 d_accessx='$d_accessx'
15861 d_alarm='$d_alarm'
15862 d_archlib='$d_archlib'
15863 d_atolf='$d_atolf'
15864 d_atoll='$d_atoll'
15865 d_attribut='$d_attribut'
15866 d_bcmp='$d_bcmp'
15867 d_bcopy='$d_bcopy'
15868 d_bincompat5005='$d_bincompat5005'
15869 d_bsd='$d_bsd'
15870 d_bsdgetpgrp='$d_bsdgetpgrp'
15871 d_bsdsetpgrp='$d_bsdsetpgrp'
15872 d_bzero='$d_bzero'
15873 d_casti32='$d_casti32'
15874 d_castneg='$d_castneg'
15875 d_charvspr='$d_charvspr'
15876 d_chown='$d_chown'
15877 d_chroot='$d_chroot'
15878 d_chsize='$d_chsize'
15879 d_closedir='$d_closedir'
15880 d_const='$d_const'
15881 d_crypt='$d_crypt'
15882 d_csh='$d_csh'
15883 d_cuserid='$d_cuserid'
15884 d_dbl_dig='$d_dbl_dig'
15885 d_difftime='$d_difftime'
15886 d_dirnamlen='$d_dirnamlen'
15887 d_dlerror='$d_dlerror'
15888 d_dlopen='$d_dlopen'
15889 d_dlsymun='$d_dlsymun'
15890 d_dosuid='$d_dosuid'
15891 d_drand48proto='$d_drand48proto'
15892 d_dup2='$d_dup2'
15893 d_eaccess='$d_eaccess'
15894 d_endgrent='$d_endgrent'
15895 d_endhent='$d_endhent'
15896 d_endnent='$d_endnent'
15897 d_endpent='$d_endpent'
15898 d_endpwent='$d_endpwent'
15899 d_endsent='$d_endsent'
15900 d_eofnblk='$d_eofnblk'
15901 d_eunice='$d_eunice'
15902 d_fchmod='$d_fchmod'
15903 d_fchown='$d_fchown'
15904 d_fcntl='$d_fcntl'
15905 d_fcntl_can_lock='$d_fcntl_can_lock'
15906 d_fd_macros='$d_fd_macros'
15907 d_fd_set='$d_fd_set'
15908 d_fds_bits='$d_fds_bits'
15909 d_fgetpos='$d_fgetpos'
15910 d_flexfnam='$d_flexfnam'
15911 d_flock='$d_flock'
15912 d_fork='$d_fork'
15913 d_fpathconf='$d_fpathconf'
15914 d_fpos64_t='$d_fpos64_t'
15915 d_frexpl='$d_frexpl'
15916 d_fs_data_s='$d_fs_data_s'
15917 d_fseeko='$d_fseeko'
15918 d_fsetpos='$d_fsetpos'
15919 d_fstatfs='$d_fstatfs'
15920 d_fstatvfs='$d_fstatvfs'
15921 d_fsync='$d_fsync'
15922 d_ftello='$d_ftello'
15923 d_ftime='$d_ftime'
15924 d_getcwd='$d_getcwd'
15925 d_getespwnam='$d_getespwnam'
15926 d_getfsstat='$d_getfsstat'
15927 d_getgrent='$d_getgrent'
15928 d_getgrps='$d_getgrps'
15929 d_gethbyaddr='$d_gethbyaddr'
15930 d_gethbyname='$d_gethbyname'
15931 d_gethent='$d_gethent'
15932 d_gethname='$d_gethname'
15933 d_gethostprotos='$d_gethostprotos'
15934 d_getlogin='$d_getlogin'
15935 d_getmnt='$d_getmnt'
15936 d_getmntent='$d_getmntent'
15937 d_getnbyaddr='$d_getnbyaddr'
15938 d_getnbyname='$d_getnbyname'
15939 d_getnent='$d_getnent'
15940 d_getnetprotos='$d_getnetprotos'
15941 d_getpagsz='$d_getpagsz'
15942 d_getpbyname='$d_getpbyname'
15943 d_getpbynumber='$d_getpbynumber'
15944 d_getpent='$d_getpent'
15945 d_getpgid='$d_getpgid'
15946 d_getpgrp2='$d_getpgrp2'
15947 d_getpgrp='$d_getpgrp'
15948 d_getppid='$d_getppid'
15949 d_getprior='$d_getprior'
15950 d_getprotoprotos='$d_getprotoprotos'
15951 d_getprpwnam='$d_getprpwnam'
15952 d_getpwent='$d_getpwent'
15953 d_getsbyname='$d_getsbyname'
15954 d_getsbyport='$d_getsbyport'
15955 d_getsent='$d_getsent'
15956 d_getservprotos='$d_getservprotos'
15957 d_getspnam='$d_getspnam'
15958 d_gettimeod='$d_gettimeod'
15959 d_gnulibc='$d_gnulibc'
15960 d_grpasswd='$d_grpasswd'
15961 d_hasmntopt='$d_hasmntopt'
15962 d_htonl='$d_htonl'
15963 d_iconv='$d_iconv'
15964 d_index='$d_index'
15965 d_inetaton='$d_inetaton'
15966 d_int64_t='$d_int64_t'
15967 d_isascii='$d_isascii'
15968 d_isnan='$d_isnan'
15969 d_isnanl='$d_isnanl'
15970 d_killpg='$d_killpg'
15971 d_lchown='$d_lchown'
15972 d_ldbl_dig='$d_ldbl_dig'
15973 d_link='$d_link'
15974 d_locconv='$d_locconv'
15975 d_lockf='$d_lockf'
15976 d_longdbl='$d_longdbl'
15977 d_longlong='$d_longlong'
15978 d_lseekproto='$d_lseekproto'
15979 d_lstat='$d_lstat'
15980 d_madvise='$d_madvise'
15981 d_mblen='$d_mblen'
15982 d_mbstowcs='$d_mbstowcs'
15983 d_mbtowc='$d_mbtowc'
15984 d_memchr='$d_memchr'
15985 d_memcmp='$d_memcmp'
15986 d_memcpy='$d_memcpy'
15987 d_memmove='$d_memmove'
15988 d_memset='$d_memset'
15989 d_mkdir='$d_mkdir'
15990 d_mkdtemp='$d_mkdtemp'
15991 d_mkfifo='$d_mkfifo'
15992 d_mkstemp='$d_mkstemp'
15993 d_mkstemps='$d_mkstemps'
15994 d_mktime='$d_mktime'
15995 d_mmap='$d_mmap'
15996 d_modfl='$d_modfl'
15997 d_mprotect='$d_mprotect'
15998 d_msg='$d_msg'
15999 d_msg_ctrunc='$d_msg_ctrunc'
16000 d_msg_dontroute='$d_msg_dontroute'
16001 d_msg_oob='$d_msg_oob'
16002 d_msg_peek='$d_msg_peek'
16003 d_msg_proxy='$d_msg_proxy'
16004 d_msgctl='$d_msgctl'
16005 d_msgget='$d_msgget'
16006 d_msgrcv='$d_msgrcv'
16007 d_msgsnd='$d_msgsnd'
16008 d_msync='$d_msync'
16009 d_munmap='$d_munmap'
16010 d_mymalloc='$d_mymalloc'
16011 d_nice='$d_nice'
16012 d_nv_preserves_uv='$d_nv_preserves_uv'
16013 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
16014 d_off64_t='$d_off64_t'
16015 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
16016 d_oldpthreads='$d_oldpthreads'
16017 d_oldsock='$d_oldsock'
16018 d_open3='$d_open3'
16019 d_pathconf='$d_pathconf'
16020 d_pause='$d_pause'
16021 d_perl_otherlibdirs='$d_perl_otherlibdirs'
16022 d_phostname='$d_phostname'
16023 d_pipe='$d_pipe'
16024 d_poll='$d_poll'
16025 d_portable='$d_portable'
16026 d_pthread_yield='$d_pthread_yield'
16027 d_pwage='$d_pwage'
16028 d_pwchange='$d_pwchange'
16029 d_pwclass='$d_pwclass'
16030 d_pwcomment='$d_pwcomment'
16031 d_pwexpire='$d_pwexpire'
16032 d_pwgecos='$d_pwgecos'
16033 d_pwpasswd='$d_pwpasswd'
16034 d_pwquota='$d_pwquota'
16035 d_qgcvt='$d_qgcvt'
16036 d_quad='$d_quad'
16037 d_readdir='$d_readdir'
16038 d_readlink='$d_readlink'
16039 d_rename='$d_rename'
16040 d_rewinddir='$d_rewinddir'
16041 d_rmdir='$d_rmdir'
16042 d_safebcpy='$d_safebcpy'
16043 d_safemcpy='$d_safemcpy'
16044 d_sanemcmp='$d_sanemcmp'
16045 d_sbrkproto='$d_sbrkproto'
16046 d_sched_yield='$d_sched_yield'
16047 d_scm_rights='$d_scm_rights'
16048 d_seekdir='$d_seekdir'
16049 d_select='$d_select'
16050 d_sem='$d_sem'
16051 d_semctl='$d_semctl'
16052 d_semctl_semid_ds='$d_semctl_semid_ds'
16053 d_semctl_semun='$d_semctl_semun'
16054 d_semget='$d_semget'
16055 d_semop='$d_semop'
16056 d_setegid='$d_setegid'
16057 d_seteuid='$d_seteuid'
16058 d_setgrent='$d_setgrent'
16059 d_setgrps='$d_setgrps'
16060 d_sethent='$d_sethent'
16061 d_setlinebuf='$d_setlinebuf'
16062 d_setlocale='$d_setlocale'
16063 d_setnent='$d_setnent'
16064 d_setpent='$d_setpent'
16065 d_setpgid='$d_setpgid'
16066 d_setpgrp2='$d_setpgrp2'
16067 d_setpgrp='$d_setpgrp'
16068 d_setprior='$d_setprior'
16069 d_setproctitle='$d_setproctitle'
16070 d_setpwent='$d_setpwent'
16071 d_setregid='$d_setregid'
16072 d_setresgid='$d_setresgid'
16073 d_setresuid='$d_setresuid'
16074 d_setreuid='$d_setreuid'
16075 d_setrgid='$d_setrgid'
16076 d_setruid='$d_setruid'
16077 d_setsent='$d_setsent'
16078 d_setsid='$d_setsid'
16079 d_setvbuf='$d_setvbuf'
16080 d_sfio='$d_sfio'
16081 d_shm='$d_shm'
16082 d_shmat='$d_shmat'
16083 d_shmatprototype='$d_shmatprototype'
16084 d_shmctl='$d_shmctl'
16085 d_shmdt='$d_shmdt'
16086 d_shmget='$d_shmget'
16087 d_sigaction='$d_sigaction'
16088 d_sigprocmask='$d_sigprocmask'
16089 d_sigsetjmp='$d_sigsetjmp'
16090 d_socket='$d_socket'
16091 d_socklen_t='$d_socklen_t'
16092 d_sockpair='$d_sockpair'
16093 d_socks5_init='$d_socks5_init'
16094 d_sqrtl='$d_sqrtl'
16095 d_statblks='$d_statblks'
16096 d_statfs_f_flags='$d_statfs_f_flags'
16097 d_statfs_s='$d_statfs_s'
16098 d_statvfs='$d_statvfs'
16099 d_stdio_cnt_lval='$d_stdio_cnt_lval'
16100 d_stdio_ptr_lval='$d_stdio_ptr_lval'
16101 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
16102 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
16103 d_stdio_stream_array='$d_stdio_stream_array'
16104 d_stdiobase='$d_stdiobase'
16105 d_stdstdio='$d_stdstdio'
16106 d_strchr='$d_strchr'
16107 d_strcoll='$d_strcoll'
16108 d_strctcpy='$d_strctcpy'
16109 d_strerrm='$d_strerrm'
16110 d_strerror='$d_strerror'
16111 d_strtod='$d_strtod'
16112 d_strtol='$d_strtol'
16113 d_strtold='$d_strtold'
16114 d_strtoll='$d_strtoll'
16115 d_strtoq='$d_strtoq'
16116 d_strtoul='$d_strtoul'
16117 d_strtoull='$d_strtoull'
16118 d_strtouq='$d_strtouq'
16119 d_strxfrm='$d_strxfrm'
16120 d_suidsafe='$d_suidsafe'
16121 d_symlink='$d_symlink'
16122 d_syscall='$d_syscall'
16123 d_sysconf='$d_sysconf'
16124 d_sysernlst='$d_sysernlst'
16125 d_syserrlst='$d_syserrlst'
16126 d_system='$d_system'
16127 d_tcgetpgrp='$d_tcgetpgrp'
16128 d_tcsetpgrp='$d_tcsetpgrp'
16129 d_telldir='$d_telldir'
16130 d_telldirproto='$d_telldirproto'
16131 d_time='$d_time'
16132 d_times='$d_times'
16133 d_truncate='$d_truncate'
16134 d_tzname='$d_tzname'
16135 d_umask='$d_umask'
16136 d_uname='$d_uname'
16137 d_union_semun='$d_union_semun'
16138 d_ustat='$d_ustat'
16139 d_vendorarch='$d_vendorarch'
16140 d_vendorbin='$d_vendorbin'
16141 d_vendorlib='$d_vendorlib'
16142 d_vfork='$d_vfork'
16143 d_void_closedir='$d_void_closedir'
16144 d_voidsig='$d_voidsig'
16145 d_voidtty='$d_voidtty'
16146 d_volatile='$d_volatile'
16147 d_vprintf='$d_vprintf'
16148 d_wait4='$d_wait4'
16149 d_waitpid='$d_waitpid'
16150 d_wcstombs='$d_wcstombs'
16151 d_wctomb='$d_wctomb'
16152 d_xenix='$d_xenix'
16153 date='$date'
16154 db_hashtype='$db_hashtype'
16155 db_prefixtype='$db_prefixtype'
16156 defvoidused='$defvoidused'
16157 direntrytype='$direntrytype'
16158 dlext='$dlext'
16159 dlsrc='$dlsrc'
16160 doublesize='$doublesize'
16161 drand01='$drand01'
16162 dynamic_ext='$dynamic_ext'
16163 eagain='$eagain'
16164 ebcdic='$ebcdic'
16165 echo='$echo'
16166 egrep='$egrep'
16167 emacs='$emacs'
16168 eunicefix='$eunicefix'
16169 exe_ext='$exe_ext'
16170 expr='$expr'
16171 extensions='$extensions'
16172 fflushNULL='$fflushNULL'
16173 fflushall='$fflushall'
16174 find='$find'
16175 firstmakefile='$firstmakefile'
16176 flex='$flex'
16177 fpossize='$fpossize'
16178 fpostype='$fpostype'
16179 freetype='$freetype'
16180 full_ar='$full_ar'
16181 full_csh='$full_csh'
16182 full_sed='$full_sed'
16183 gccosandvers='$gccosandvers'
16184 gccversion='$gccversion'
16185 gidformat='$gidformat'
16186 gidsign='$gidsign'
16187 gidsize='$gidsize'
16188 gidtype='$gidtype'
16189 glibpth='$glibpth'
16190 grep='$grep'
16191 groupcat='$groupcat'
16192 groupstype='$groupstype'
16193 gzip='$gzip'
16194 h_fcntl='$h_fcntl'
16195 h_sysfile='$h_sysfile'
16196 hint='$hint'
16197 hostcat='$hostcat'
16198 i16size='$i16size'
16199 i16type='$i16type'
16200 i32size='$i32size'
16201 i32type='$i32type'
16202 i64size='$i64size'
16203 i64type='$i64type'
16204 i8size='$i8size'
16205 i8type='$i8type'
16206 i_arpainet='$i_arpainet'
16207 i_bsdioctl='$i_bsdioctl'
16208 i_db='$i_db'
16209 i_dbm='$i_dbm'
16210 i_dirent='$i_dirent'
16211 i_dld='$i_dld'
16212 i_dlfcn='$i_dlfcn'
16213 i_fcntl='$i_fcntl'
16214 i_float='$i_float'
16215 i_gdbm='$i_gdbm'
16216 i_grp='$i_grp'
16217 i_iconv='$i_iconv'
16218 i_ieeefp='$i_ieeefp'
16219 i_inttypes='$i_inttypes'
16220 i_libutil='$i_libutil'
16221 i_limits='$i_limits'
16222 i_locale='$i_locale'
16223 i_machcthr='$i_machcthr'
16224 i_malloc='$i_malloc'
16225 i_math='$i_math'
16226 i_memory='$i_memory'
16227 i_mntent='$i_mntent'
16228 i_ndbm='$i_ndbm'
16229 i_netdb='$i_netdb'
16230 i_neterrno='$i_neterrno'
16231 i_netinettcp='$i_netinettcp'
16232 i_niin='$i_niin'
16233 i_poll='$i_poll'
16234 i_prot='$i_prot'
16235 i_pthread='$i_pthread'
16236 i_pwd='$i_pwd'
16237 i_rpcsvcdbm='$i_rpcsvcdbm'
16238 i_sfio='$i_sfio'
16239 i_sgtty='$i_sgtty'
16240 i_shadow='$i_shadow'
16241 i_socks='$i_socks'
16242 i_stdarg='$i_stdarg'
16243 i_stddef='$i_stddef'
16244 i_stdlib='$i_stdlib'
16245 i_string='$i_string'
16246 i_sunmath='$i_sunmath'
16247 i_sysaccess='$i_sysaccess'
16248 i_sysdir='$i_sysdir'
16249 i_sysfile='$i_sysfile'
16250 i_sysfilio='$i_sysfilio'
16251 i_sysin='$i_sysin'
16252 i_sysioctl='$i_sysioctl'
16253 i_syslog='$i_syslog'
16254 i_sysmman='$i_sysmman'
16255 i_sysmode='$i_sysmode'
16256 i_sysmount='$i_sysmount'
16257 i_sysndir='$i_sysndir'
16258 i_sysparam='$i_sysparam'
16259 i_sysresrc='$i_sysresrc'
16260 i_syssecrt='$i_syssecrt'
16261 i_sysselct='$i_sysselct'
16262 i_syssockio='$i_syssockio'
16263 i_sysstat='$i_sysstat'
16264 i_sysstatfs='$i_sysstatfs'
16265 i_sysstatvfs='$i_sysstatvfs'
16266 i_systime='$i_systime'
16267 i_systimek='$i_systimek'
16268 i_systimes='$i_systimes'
16269 i_systypes='$i_systypes'
16270 i_sysuio='$i_sysuio'
16271 i_sysun='$i_sysun'
16272 i_sysutsname='$i_sysutsname'
16273 i_sysvfs='$i_sysvfs'
16274 i_syswait='$i_syswait'
16275 i_termio='$i_termio'
16276 i_termios='$i_termios'
16277 i_time='$i_time'
16278 i_unistd='$i_unistd'
16279 i_ustat='$i_ustat'
16280 i_utime='$i_utime'
16281 i_values='$i_values'
16282 i_varargs='$i_varargs'
16283 i_varhdr='$i_varhdr'
16284 i_vfork='$i_vfork'
16285 ignore_versioned_solibs='$ignore_versioned_solibs'
16286 inc_version_list='$inc_version_list'
16287 inc_version_list_init='$inc_version_list_init'
16288 incpath='$incpath'
16289 inews='$inews'
16290 installarchlib='$installarchlib'
16291 installbin='$installbin'
16292 installman1dir='$installman1dir'
16293 installman3dir='$installman3dir'
16294 installprefix='$installprefix'
16295 installprefixexp='$installprefixexp'
16296 installprivlib='$installprivlib'
16297 installscript='$installscript'
16298 installsitearch='$installsitearch'
16299 installsitebin='$installsitebin'
16300 installsitelib='$installsitelib'
16301 installstyle='$installstyle'
16302 installusrbinperl='$installusrbinperl'
16303 installvendorarch='$installvendorarch'
16304 installvendorbin='$installvendorbin'
16305 installvendorlib='$installvendorlib'
16306 intsize='$intsize'
16307 issymlink='$issymlink'
16308 ivdformat='$ivdformat'
16309 ivsize='$ivsize'
16310 ivtype='$ivtype'
16311 known_extensions='$known_extensions'
16312 ksh='$ksh'
16313 ld='$ld'
16314 lddlflags='$lddlflags'
16315 ldflags='$ldflags'
16316 ldflags_uselargefiles='$ldflags_uselargefiles'
16317 ldlibpthname='$ldlibpthname'
16318 less='$less'
16319 lib_ext='$lib_ext'
16320 libc='$libc'
16321 libperl='$libperl'
16322 libpth='$libpth'
16323 libs='$libs'
16324 libsdirs='$libsdirs'
16325 libsfiles='$libsfiles'
16326 libsfound='$libsfound'
16327 libspath='$libspath'
16328 libswanted='$libswanted'
16329 libswanted_uselargefiles='$libswanted_uselargefiles'
16330 line='$line'
16331 lint='$lint'
16332 lkflags='$lkflags'
16333 ln='$ln'
16334 lns='$lns'
16335 locincpth='$locincpth'
16336 loclibpth='$loclibpth'
16337 longdblsize='$longdblsize'
16338 longlongsize='$longlongsize'
16339 longsize='$longsize'
16340 lp='$lp'
16341 lpr='$lpr'
16342 ls='$ls'
16343 lseeksize='$lseeksize'
16344 lseektype='$lseektype'
16345 mail='$mail'
16346 mailx='$mailx'
16347 make='$make'
16348 make_set_make='$make_set_make'
16349 mallocobj='$mallocobj'
16350 mallocsrc='$mallocsrc'
16351 malloctype='$malloctype'
16352 man1dir='$man1dir'
16353 man1direxp='$man1direxp'
16354 man1ext='$man1ext'
16355 man3dir='$man3dir'
16356 man3direxp='$man3direxp'
16357 man3ext='$man3ext'
16358 mips_type='$mips_type'
16359 mkdir='$mkdir'
16360 mmaptype='$mmaptype'
16361 modetype='$modetype'
16362 more='$more'
16363 multiarch='$multiarch'
16364 mv='$mv'
16365 myarchname='$myarchname'
16366 mydomain='$mydomain'
16367 myhostname='$myhostname'
16368 myuname='$myuname'
16369 n='$n'
16370 need_va_copy='$need_va_copy'
16371 netdb_hlen_type='$netdb_hlen_type'
16372 netdb_host_type='$netdb_host_type'
16373 netdb_name_type='$netdb_name_type'
16374 netdb_net_type='$netdb_net_type'
16375 nm='$nm'
16376 nm_opt='$nm_opt'
16377 nm_so_opt='$nm_so_opt'
16378 nonxs_ext='$nonxs_ext'
16379 nroff='$nroff'
16380 nvEUformat='$nvEUformat'
16381 nvFUformat='$nvFUformat'
16382 nvGUformat='$nvGUformat'
16383 nveformat='$nveformat'
16384 nvfformat='$nvfformat'
16385 nvgformat='$nvgformat'
16386 nvsize='$nvsize'
16387 nvtype='$nvtype'
16388 o_nonblock='$o_nonblock'
16389 obj_ext='$obj_ext'
16390 old_pthread_create_joinable='$old_pthread_create_joinable'
16391 optimize='$optimize'
16392 orderlib='$orderlib'
16393 osname='$osname'
16394 osvers='$osvers'
16395 otherlibdirs='$otherlibdirs'
16396 package='$package'
16397 pager='$pager'
16398 passcat='$passcat'
16399 patchlevel='$patchlevel'
16400 path_sep='$path_sep'
16401 perl5='$perl5'
16402 perl='$perl'
16403 perladmin='$perladmin'
16404 perllibs='$perllibs'
16405 perlpath='$perlpath'
16406 pg='$pg'
16407 phostname='$phostname'
16408 pidtype='$pidtype'
16409 plibpth='$plibpth'
16410 pm_apiversion='$pm_apiversion'
16411 pmake='$pmake'
16412 pr='$pr'
16413 prefix='$prefix'
16414 prefixexp='$prefixexp'
16415 privlib='$privlib'
16416 privlibexp='$privlibexp'
16417 prototype='$prototype'
16418 ptrsize='$ptrsize'
16419 quadkind='$quadkind'
16420 quadtype='$quadtype'
16421 randbits='$randbits'
16422 randfunc='$randfunc'
16423 randseedtype='$randseedtype'
16424 ranlib='$ranlib'
16425 rd_nodata='$rd_nodata'
16426 revision='$revision'
16427 rm='$rm'
16428 rmail='$rmail'
16429 runnm='$runnm'
16430 sPRIEUldbl='$sPRIEUldbl'
16431 sPRIFUldbl='$sPRIFUldbl'
16432 sPRIGUldbl='$sPRIGUldbl'
16433 sPRIXU64='$sPRIXU64'
16434 sPRId64='$sPRId64'
16435 sPRIeldbl='$sPRIeldbl'
16436 sPRIfldbl='$sPRIfldbl'
16437 sPRIgldbl='$sPRIgldbl'
16438 sPRIi64='$sPRIi64'
16439 sPRIo64='$sPRIo64'
16440 sPRIu64='$sPRIu64'
16441 sPRIx64='$sPRIx64'
16442 sSCNfldbl='$sSCNfldbl'
16443 sched_yield='$sched_yield'
16444 scriptdir='$scriptdir'
16445 scriptdirexp='$scriptdirexp'
16446 sed='$sed'
16447 seedfunc='$seedfunc'
16448 selectminbits='$selectminbits'
16449 selecttype='$selecttype'
16450 sendmail='$sendmail'
16451 sh='$sh'
16452 shar='$shar'
16453 sharpbang='$sharpbang'
16454 shmattype='$shmattype'
16455 shortsize='$shortsize'
16456 shrpenv='$shrpenv'
16457 shsharp='$shsharp'
16458 sig_count='$sig_count'
16459 sig_name='$sig_name'
16460 sig_name_init='$sig_name_init'
16461 sig_num='$sig_num'
16462 sig_num_init='$sig_num_init'
16463 signal_t='$signal_t'
16464 sitearch='$sitearch'
16465 sitearchexp='$sitearchexp'
16466 sitebin='$sitebin'
16467 sitebinexp='$sitebinexp'
16468 sitelib='$sitelib'
16469 sitelib_stem='$sitelib_stem'
16470 sitelibexp='$sitelibexp'
16471 siteprefix='$siteprefix'
16472 siteprefixexp='$siteprefixexp'
16473 sizesize='$sizesize'
16474 sizetype='$sizetype'
16475 sleep='$sleep'
16476 smail='$smail'
16477 so='$so'
16478 sockethdr='$sockethdr'
16479 socketlib='$socketlib'
16480 socksizetype='$socksizetype'
16481 sort='$sort'
16482 spackage='$spackage'
16483 spitshell='$spitshell'
16484 src='$src'
16485 ssizetype='$ssizetype'
16486 startperl='$startperl'
16487 startsh='$startsh'
16488 static_ext='$static_ext'
16489 stdchar='$stdchar'
16490 stdio_base='$stdio_base'
16491 stdio_bufsiz='$stdio_bufsiz'
16492 stdio_cnt='$stdio_cnt'
16493 stdio_filbuf='$stdio_filbuf'
16494 stdio_ptr='$stdio_ptr'
16495 stdio_stream_array='$stdio_stream_array'
16496 strings='$strings'
16497 submit='$submit'
16498 subversion='$subversion'
16499 sysman='$sysman'
16500 tail='$tail'
16501 tar='$tar'
16502 tbl='$tbl'
16503 tee='$tee'
16504 test='$test'
16505 timeincl='$timeincl'
16506 timetype='$timetype'
16507 touch='$touch'
16508 tr='$tr'
16509 trnl='$trnl'
16510 troff='$troff'
16511 u16size='$u16size'
16512 u16type='$u16type'
16513 u32size='$u32size'
16514 u32type='$u32type'
16515 u64size='$u64size'
16516 u64type='$u64type'
16517 u8size='$u8size'
16518 u8type='$u8type'
16519 uidformat='$uidformat'
16520 uidsign='$uidsign'
16521 uidsize='$uidsize'
16522 uidtype='$uidtype'
16523 uname='$uname'
16524 uniq='$uniq'
16525 uquadtype='$uquadtype'
16526 use5005threads='$use5005threads'
16527 use64bitall='$use64bitall'
16528 use64bitint='$use64bitint'
16529 usedl='$usedl'
16530 useithreads='$useithreads'
16531 uselargefiles='$uselargefiles'
16532 uselongdouble='$uselongdouble'
16533 usemorebits='$usemorebits'
16534 usemultiplicity='$usemultiplicity'
16535 usemymalloc='$usemymalloc'
16536 usenm='$usenm'
16537 useopcode='$useopcode'
16538 useperlio='$useperlio'
16539 useposix='$useposix'
16540 usesfio='$usesfio'
16541 useshrplib='$useshrplib'
16542 usesocks='$usesocks'
16543 usethreads='$usethreads'
16544 usevendorprefix='$usevendorprefix'
16545 usevfork='$usevfork'
16546 usrinc='$usrinc'
16547 uuname='$uuname'
16548 uvXUformat='$uvXUformat'
16549 uvoformat='$uvoformat'
16550 uvsize='$uvsize'
16551 uvtype='$uvtype'
16552 uvuformat='$uvuformat'
16553 uvxformat='$uvxformat'
16554 vendorarch='$vendorarch'
16555 vendorarchexp='$vendorarchexp'
16556 vendorbin='$vendorbin'
16557 vendorbinexp='$vendorbinexp'
16558 vendorlib='$vendorlib'
16559 vendorlib_stem='$vendorlib_stem'
16560 vendorlibexp='$vendorlibexp'
16561 vendorprefix='$vendorprefix'
16562 vendorprefixexp='$vendorprefixexp'
16563 version='$version'
16564 versiononly='$versiononly'
16565 vi='$vi'
16566 voidflags='$voidflags'
16567 xlibpth='$xlibpth'
16568 xs_apiversion='$xs_apiversion'
16569 zcat='$zcat'
16570 zip='$zip'
16571 EOT
16572
16573 : Add in command line options if available
16574 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16575
16576 : add special variables
16577 $test -f $src/patchlevel.h && \
16578 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
16579 echo "CONFIGDOTSH=true" >>config.sh
16580
16581 : propagate old symbols
16582 if $test -f UU/config.sh; then
16583         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
16584         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
16585         $sort | $uniq -u >UU/oldsyms
16586         set X `cat UU/oldsyms`
16587         shift
16588         case $# in
16589         0) ;;
16590         *)
16591                 cat <<EOM
16592 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16593 EOM
16594                 echo "# Variables propagated from previous config.sh file." >>config.sh
16595                 for sym in `cat UU/oldsyms`; do
16596                         echo "    Propagating $hint variable "'$'"$sym..."
16597                         eval 'tmp="$'"${sym}"'"'
16598                         echo "$tmp" | \
16599                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16600                 done
16601                 ;;
16602         esac
16603 fi
16604
16605 : Finish up by extracting the .SH files
16606 case "$alldone" in
16607 exit)
16608         $rm -rf UU
16609         echo "Done."
16610         exit 0
16611         ;;
16612 cont)
16613         ;;
16614 '')
16615         dflt=''
16616         nostick=true
16617         $cat <<EOM
16618
16619 If you'd like to make any changes to the config.sh file before I begin
16620 to configure things, do it as a shell escape now (e.g. !vi config.sh).
16621
16622 EOM
16623         rp="Press return or use a shell escape to edit config.sh:"
16624         . UU/myread
16625         nostick=''
16626         case "$ans" in
16627         '') ;;
16628         *) : in case they cannot read
16629                 sh 1>&4 -c "$ans";;
16630         esac
16631         ;;
16632 esac
16633
16634 : if this fails, just run all the .SH files by hand
16635 . ./config.sh
16636
16637 echo " "
16638 exec 1>&4
16639 . ./UU/extract
16640
16641 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16642         dflt=y
16643         case "$silent" in
16644         true) ;;
16645         *)
16646                 $cat <<EOM
16647
16648 Now you need to generate make dependencies by running "$make depend".
16649 You might prefer to run it in background: "$make depend > makedepend.out &"
16650 It can take a while, so you might not want to run it right now.
16651
16652 EOM
16653                 ;;
16654         esac
16655         rp="Run $make depend now?"
16656         . UU/myread
16657         case "$ans" in
16658         y*)
16659                 $make depend && echo "Now you must run '$make'."
16660                 ;;
16661         *)
16662                 echo "You must run '$make depend' then '$make'."
16663                 ;;
16664         esac
16665 elif test -f [Mm]akefile; then
16666         echo " "
16667         echo "Now you must run a $make."
16668 else
16669         echo "Done."
16670 fi
16671
16672 if $test -f Policy.sh; then
16673     $cat <<EOM
16674
16675 If you compile $package on a different machine or from a different object
16676 directory, copy the Policy.sh file from this object directory to the
16677 new one before you run Configure -- this will help you with most of
16678 the policy defaults.
16679
16680 EOM
16681 fi
16682 if $test -f config.msg; then
16683     echo "Hmm.  I also noted the following information while running:"
16684     echo " "
16685     $cat config.msg >&4
16686     $rm -f config.msg
16687 fi
16688 $rm -f kit*isdone ark*isdone
16689 $rm -rf UU
16690
16691 : End of Configure
16692