This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
may be uninitialized warning forperl@12003
[perl5.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Tue Sep 11 15:19:00 EET DST 2001 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.org)
25
26 cat >c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat c1$$ c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f c1$$ c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccname=''
164 ccversion=''
165 ccsymbols=''
166 cppccsymbols=''
167 cppsymbols=''
168 from=''
169 run=''
170 targetarch=''
171 to=''
172 usecrosscompile=''
173 perllibs=''
174 dynamic_ext=''
175 extensions=''
176 known_extensions=''
177 nonxs_ext=''
178 static_ext=''
179 useopcode=''
180 useposix=''
181 extras=''
182 d_bsd=''
183 d_eunice=''
184 d_xenix=''
185 eunicefix=''
186 Mcc=''
187 ar=''
188 awk=''
189 bash=''
190 bison=''
191 byacc=''
192 cat=''
193 chgrp=''
194 chmod=''
195 chown=''
196 comm=''
197 compress=''
198 cp=''
199 cpio=''
200 cpp=''
201 csh=''
202 date=''
203 echo=''
204 egrep=''
205 emacs=''
206 expr=''
207 find=''
208 flex=''
209 grep=''
210 gzip=''
211 inews=''
212 ksh=''
213 less=''
214 line=''
215 lint=''
216 ln=''
217 lp=''
218 lpr=''
219 ls=''
220 mail=''
221 mailx=''
222 make=''
223 mkdir=''
224 more=''
225 mv=''
226 nm=''
227 nroff=''
228 perl=''
229 pg=''
230 pmake=''
231 pr=''
232 rm=''
233 rmail=''
234 sed=''
235 sendmail=''
236 shar=''
237 sleep=''
238 smail=''
239 sort=''
240 submit=''
241 tail=''
242 tar=''
243 tbl=''
244 tee=''
245 test=''
246 touch=''
247 tr=''
248 troff=''
249 uname=''
250 uniq=''
251 uuname=''
252 vi=''
253 zcat=''
254 zip=''
255 full_ar=''
256 full_sed=''
257 libswanted=''
258 hint=''
259 myuname=''
260 osname=''
261 osvers=''
262 Author=''
263 Date=''
264 Header=''
265 Id=''
266 Locker=''
267 Log=''
268 RCSfile=''
269 Revision=''
270 Source=''
271 State=''
272 _a=''
273 _exe=''
274 _o=''
275 archobjs=''
276 exe_ext=''
277 firstmakefile=''
278 lib_ext=''
279 obj_ext=''
280 path_sep=''
281 afs=''
282 afsroot=''
283 alignbytes=''
284 ansi2knr=''
285 archlib=''
286 archlibexp=''
287 d_archlib=''
288 installarchlib=''
289 archname=''
290 myarchname=''
291 d_atolf=''
292 d_atoll=''
293 baserev=''
294 bin=''
295 binexp=''
296 installbin=''
297 bincompat5005=''
298 d_bincompat5005=''
299 byteorder=''
300 cc=''
301 ccflags=''
302 cppflags=''
303 ldflags=''
304 lkflags=''
305 locincpth=''
306 optimize=''
307 cf_email=''
308 cf_by=''
309 cf_time=''
310 charsize=''
311 contains=''
312 cpp_stuff=''
313 cpplast=''
314 cppminus=''
315 cpprun=''
316 cppstdin=''
317 d__fwalk=''
318 d_access=''
319 d_accessx=''
320 d_alarm=''
321 d_attribut=''
322 d_bcmp=''
323 d_bcopy=''
324 d_bzero=''
325 d_casti32=''
326 castflags=''
327 d_castneg=''
328 d_chown=''
329 d_chroot=''
330 d_chsize=''
331 d_class=''
332 d_closedir=''
333 d_void_closedir=''
334 d_cmsghdr_s=''
335 d_const=''
336 cryptlib=''
337 d_crypt=''
338 d_csh=''
339 full_csh=''
340 d_cuserid=''
341 d_dbl_dig=''
342 d_dbminitproto=''
343 d_difftime=''
344 d_dlerror=''
345 d_dlopen=''
346 d_dlsymun=''
347 d_dosuid=''
348 d_suidsafe=''
349 d_drand48proto=''
350 d_dup2=''
351 d_eaccess=''
352 d_endgrent=''
353 d_endhent=''
354 d_endnent=''
355 d_endpent=''
356 d_endpwent=''
357 d_endsent=''
358 d_fchdir=''
359 d_fchmod=''
360 d_fchown=''
361 d_fcntl=''
362 d_fcntl_can_lock=''
363 d_fd_macros=''
364 d_fd_set=''
365 d_fds_bits=''
366 d_fgetpos=''
367 d_finite=''
368 d_finitel=''
369 d_flexfnam=''
370 d_flock=''
371 d_flockproto=''
372 d_fork=''
373 d_fp_class=''
374 d_fpclass=''
375 d_fpclassify=''
376 d_fpclassl=''
377 d_fpos64_t=''
378 d_frexpl=''
379 d_fs_data_s=''
380 d_fseeko=''
381 d_fsetpos=''
382 d_fstatfs=''
383 d_fsync=''
384 d_ftello=''
385 d_ftime=''
386 d_gettimeod=''
387 d_Gconvert=''
388 d_getcwd=''
389 d_getespwnam=''
390 d_getfsstat=''
391 d_getgrent=''
392 d_getgrps=''
393 d_gethbyaddr=''
394 d_gethbyname=''
395 d_gethent=''
396 aphostname=''
397 d_gethname=''
398 d_phostname=''
399 d_uname=''
400 d_gethostprotos=''
401 d_getitimer=''
402 d_getlogin=''
403 d_getmnt=''
404 d_getmntent=''
405 d_getnbyaddr=''
406 d_getnbyname=''
407 d_getnent=''
408 d_getnetprotos=''
409 d_getpagsz=''
410 d_getpent=''
411 d_getpgid=''
412 d_getpgrp2=''
413 d_bsdgetpgrp=''
414 d_getpgrp=''
415 d_getppid=''
416 d_getprior=''
417 d_getpbyname=''
418 d_getpbynumber=''
419 d_getprotoprotos=''
420 d_getprpwnam=''
421 d_getpwent=''
422 d_getsent=''
423 d_getservprotos=''
424 d_getspnam=''
425 d_getsbyname=''
426 d_getsbyport=''
427 d_gnulibc=''
428 d_hasmntopt=''
429 d_htonl=''
430 d_iconv=''
431 d_inetaton=''
432 d_int64_t=''
433 d_isascii=''
434 d_isfinite=''
435 d_isinf=''
436 d_isnan=''
437 d_isnanl=''
438 d_killpg=''
439 d_lchown=''
440 d_ldbl_dig=''
441 d_link=''
442 d_locconv=''
443 d_lockf=''
444 d_longdbl=''
445 longdblsize=''
446 d_longlong=''
447 longlongsize=''
448 d_lseekproto=''
449 d_lstat=''
450 d_madvise=''
451 d_mblen=''
452 d_mbstowcs=''
453 d_mbtowc=''
454 d_memchr=''
455 d_memcmp=''
456 d_memcpy=''
457 d_memmove=''
458 d_memset=''
459 d_mkdir=''
460 d_mkdtemp=''
461 d_mkfifo=''
462 d_mkstemp=''
463 d_mkstemps=''
464 d_mktime=''
465 d_mmap=''
466 mmaptype=''
467 d_modfl=''
468 d_modfl_pow32_bug=''
469 d_mprotect=''
470 d_msg=''
471 d_msgctl=''
472 d_msgget=''
473 d_msghdr_s=''
474 d_msgrcv=''
475 d_msgsnd=''
476 d_msync=''
477 d_munmap=''
478 d_nice=''
479 d_nl_langinfo=''
480 d_off64_t=''
481 d_open3=''
482 d_fpathconf=''
483 d_pathconf=''
484 d_pause=''
485 d_pipe=''
486 d_poll=''
487 d_portable=''
488 d_old_pthread_create_joinable=''
489 old_pthread_create_joinable=''
490 d_pthread_atfork=''
491 d_pthread_yield=''
492 d_sched_yield=''
493 sched_yield=''
494 d_qgcvt=''
495 d_readdir=''
496 d_rewinddir=''
497 d_seekdir=''
498 d_telldir=''
499 d_readlink=''
500 d_readv=''
501 d_recvmsg=''
502 d_rename=''
503 d_rmdir=''
504 d_safebcpy=''
505 d_safemcpy=''
506 d_sanemcmp=''
507 d_sbrkproto=''
508 d_select=''
509 d_sem=''
510 d_semctl=''
511 d_semget=''
512 d_semop=''
513 d_sendmsg=''
514 d_setegid=''
515 d_seteuid=''
516 d_setgrent=''
517 d_setgrps=''
518 d_sethent=''
519 d_setitimer=''
520 d_setlinebuf=''
521 d_setlocale=''
522 d_setnent=''
523 d_setpent=''
524 d_setpgid=''
525 d_setpgrp2=''
526 d_bsdsetpgrp=''
527 d_setpgrp=''
528 d_setprior=''
529 d_setproctitle=''
530 d_setpwent=''
531 d_setregid=''
532 d_setresgid=''
533 d_setresuid=''
534 d_setreuid=''
535 d_setrgid=''
536 d_setruid=''
537 d_setsent=''
538 d_setsid=''
539 d_setvbuf=''
540 d_sfio=''
541 usesfio=''
542 d_shm=''
543 d_shmat=''
544 d_shmatprototype=''
545 shmattype=''
546 d_shmctl=''
547 d_shmdt=''
548 d_shmget=''
549 d_sigaction=''
550 d_sigprocmask=''
551 d_sigsetjmp=''
552 d_sockatmark=''
553 d_sockatmarkproto=''
554 d_msg_ctrunc=''
555 d_msg_dontroute=''
556 d_msg_oob=''
557 d_msg_peek=''
558 d_msg_proxy=''
559 d_oldsock=''
560 d_scm_rights=''
561 d_socket=''
562 d_sockpair=''
563 sockethdr=''
564 socketlib=''
565 d_socklen_t=''
566 d_socks5_init=''
567 d_sqrtl=''
568 d_sresgproto=''
569 d_sresuproto=''
570 d_statblks=''
571 d_statfs_f_flags=''
572 d_statfs_s=''
573 d_fstatvfs=''
574 d_statvfs=''
575 d_stdio_cnt_lval=''
576 d_stdio_ptr_lval=''
577 d_stdio_ptr_lval_nochange_cnt=''
578 d_stdio_ptr_lval_sets_cnt=''
579 d_stdiobase=''
580 d_stdstdio=''
581 stdio_base=''
582 stdio_bufsiz=''
583 stdio_cnt=''
584 stdio_filbuf=''
585 stdio_ptr=''
586 d_index=''
587 d_strchr=''
588 d_strcoll=''
589 d_strctcpy=''
590 d_strerrm=''
591 d_strerror=''
592 d_sysernlst=''
593 d_syserrlst=''
594 d_strftime=''
595 d_strtod=''
596 d_strtol=''
597 d_strtold=''
598 d_strtoll=''
599 d_strtoq=''
600 d_strtoul=''
601 d_strtoull=''
602 d_strtouq=''
603 d_strxfrm=''
604 d_symlink=''
605 d_syscall=''
606 d_syscallproto=''
607 d_sysconf=''
608 d_system=''
609 d_tcgetpgrp=''
610 d_tcsetpgrp=''
611 d_telldirproto=''
612 d_time=''
613 timetype=''
614 clocktype=''
615 d_times=''
616 d_truncate=''
617 d_tzname=''
618 d_u32align=''
619 d_ualarm=''
620 d_umask=''
621 d_semctl_semid_ds=''
622 d_semctl_semun=''
623 d_union_semun=''
624 d_unordered=''
625 d_usleep=''
626 d_usleepproto=''
627 d_ustat=''
628 d_vfork=''
629 usevfork=''
630 d_voidsig=''
631 signal_t=''
632 d_volatile=''
633 d_charvspr=''
634 d_vprintf=''
635 d_wait4=''
636 d_waitpid=''
637 d_wcstombs=''
638 d_wctomb=''
639 d_writev=''
640 dlext=''
641 cccdlflags=''
642 ccdlflags=''
643 dlsrc=''
644 ld=''
645 lddlflags=''
646 usedl=''
647 doublesize=''
648 ebcdic=''
649 fflushNULL=''
650 fflushall=''
651 fpossize=''
652 fpostype=''
653 gccosandvers=''
654 gccversion=''
655 gidformat=''
656 gidsign=''
657 gidsize=''
658 gidtype=''
659 groupstype=''
660 h_fcntl=''
661 h_sysfile=''
662 i_arpainet=''
663 db_hashtype=''
664 db_prefixtype=''
665 db_version_major=''
666 db_version_minor=''
667 db_version_patch=''
668 i_db=''
669 i_dbm=''
670 i_rpcsvcdbm=''
671 d_dirnamlen=''
672 direntrytype=''
673 i_dirent=''
674 i_dld=''
675 i_dlfcn=''
676 i_fcntl=''
677 i_float=''
678 i_fp=''
679 i_fp_class=''
680 i_gdbm=''
681 d_grpasswd=''
682 i_grp=''
683 i_iconv=''
684 i_ieeefp=''
685 i_inttypes=''
686 i_langinfo=''
687 i_libutil=''
688 i_limits=''
689 i_locale=''
690 i_machcthr=''
691 i_malloc=''
692 i_math=''
693 i_memory=''
694 i_mntent=''
695 i_ndbm=''
696 i_netdb=''
697 i_neterrno=''
698 i_netinettcp=''
699 i_niin=''
700 i_sysin=''
701 i_poll=''
702 i_prot=''
703 i_pthread=''
704 d_pwage=''
705 d_pwchange=''
706 d_pwclass=''
707 d_pwcomment=''
708 d_pwexpire=''
709 d_pwgecos=''
710 d_pwpasswd=''
711 d_pwquota=''
712 i_pwd=''
713 i_sfio=''
714 i_shadow=''
715 i_socks=''
716 i_stddef=''
717 i_stdlib=''
718 i_string=''
719 strings=''
720 i_sunmath=''
721 i_sysaccess=''
722 i_sysdir=''
723 i_sysfile=''
724 d_voidtty=''
725 i_bsdioctl=''
726 i_sysfilio=''
727 i_sysioctl=''
728 i_syssockio=''
729 i_syslog=''
730 i_sysmman=''
731 i_sysmode=''
732 i_sysmount=''
733 i_sysndir=''
734 i_sysparam=''
735 i_sysresrc=''
736 i_syssecrt=''
737 i_sysselct=''
738 i_sysstat=''
739 i_sysstatfs=''
740 i_sysstatvfs=''
741 i_systimes=''
742 i_systypes=''
743 i_sysuio=''
744 i_sysun=''
745 i_sysutsname=''
746 i_sysvfs=''
747 i_syswait=''
748 i_sgtty=''
749 i_termio=''
750 i_termios=''
751 i_systime=''
752 i_systimek=''
753 i_time=''
754 timeincl=''
755 i_unistd=''
756 i_ustat=''
757 i_utime=''
758 i_values=''
759 i_stdarg=''
760 i_varargs=''
761 i_varhdr=''
762 i_vfork=''
763 inc_version_list=''
764 inc_version_list_init=''
765 installprefix=''
766 installprefixexp=''
767 installstyle=''
768 installusrbinperl=''
769 intsize=''
770 longsize=''
771 shortsize=''
772 issymlink=''
773 libc=''
774 ldlibpthname=''
775 libperl=''
776 shrpenv=''
777 useshrplib=''
778 glibpth=''
779 libpth=''
780 loclibpth=''
781 plibpth=''
782 xlibpth=''
783 ignore_versioned_solibs=''
784 libs=''
785 libsdirs=''
786 libsfiles=''
787 libsfound=''
788 libspath=''
789 lns=''
790 d_PRIEUldbl=''
791 d_PRIFUldbl=''
792 d_PRIGUldbl=''
793 d_PRIeldbl=''
794 d_PRIfldbl=''
795 d_PRIgldbl=''
796 d_SCNfldbl=''
797 sPRIEUldbl=''
798 sPRIFUldbl=''
799 sPRIGUldbl=''
800 sPRIeldbl=''
801 sPRIfldbl=''
802 sPRIgldbl=''
803 sSCNfldbl=''
804 lseeksize=''
805 lseektype=''
806 make_set_make=''
807 d_mymalloc=''
808 freetype=''
809 mallocobj=''
810 mallocsrc=''
811 malloctype=''
812 usemymalloc=''
813 installman1dir=''
814 man1dir=''
815 man1direxp=''
816 man1ext=''
817 installman3dir=''
818 man3dir=''
819 man3direxp=''
820 man3ext=''
821 modetype=''
822 multiarch=''
823 mydomain=''
824 myhostname=''
825 phostname=''
826 c=''
827 n=''
828 d_eofnblk=''
829 eagain=''
830 o_nonblock=''
831 rd_nodata=''
832 need_va_copy=''
833 netdb_hlen_type=''
834 netdb_host_type=''
835 netdb_name_type=''
836 netdb_net_type=''
837 groupcat=''
838 hostcat=''
839 passcat=''
840 orderlib=''
841 ranlib=''
842 d_perl_otherlibdirs=''
843 otherlibdirs=''
844 package=''
845 spackage=''
846 pager=''
847 api_revision=''
848 api_subversion=''
849 api_version=''
850 api_versionstring=''
851 patchlevel=''
852 perl_patchlevel=''
853 revision=''
854 subversion=''
855 version=''
856 version_patchlevel_string=''
857 perl5=''
858 perladmin=''
859 perlpath=''
860 d_nv_preserves_uv=''
861 d_nv_preserves_uv_bits=''
862 i16size=''
863 i16type=''
864 i32size=''
865 i32type=''
866 i64size=''
867 i64type=''
868 i8size=''
869 i8type=''
870 ivsize=''
871 ivtype=''
872 nvsize=''
873 nvtype=''
874 u16size=''
875 u16type=''
876 u32size=''
877 u32type=''
878 u64size=''
879 u64type=''
880 u8size=''
881 u8type=''
882 uvsize=''
883 uvtype=''
884 ivdformat=''
885 nvEUformat=''
886 nvFUformat=''
887 nvGUformat=''
888 nveformat=''
889 nvfformat=''
890 nvgformat=''
891 uvXUformat=''
892 uvoformat=''
893 uvuformat=''
894 uvxformat=''
895 pidtype=''
896 prefix=''
897 prefixexp=''
898 installprivlib=''
899 privlib=''
900 privlibexp=''
901 prototype=''
902 ptrsize=''
903 d_PRIXU64=''
904 d_PRId64=''
905 d_PRIi64=''
906 d_PRIo64=''
907 d_PRIu64=''
908 d_PRIx64=''
909 sPRIXU64=''
910 sPRId64=''
911 sPRIi64=''
912 sPRIo64=''
913 sPRIu64=''
914 sPRIx64=''
915 d_quad=''
916 quadkind=''
917 quadtype=''
918 uquadtype=''
919 drand01=''
920 randbits=''
921 randfunc=''
922 randseedtype=''
923 seedfunc=''
924 installscript=''
925 scriptdir=''
926 scriptdirexp=''
927 selectminbits=''
928 selecttype=''
929 sh=''
930 sig_count=''
931 sig_name=''
932 sig_name_init=''
933 sig_num=''
934 sig_num_init=''
935 sig_size=''
936 installsitearch=''
937 sitearch=''
938 sitearchexp=''
939 installsitebin=''
940 sitebin=''
941 sitebinexp=''
942 installsitelib=''
943 sitelib=''
944 sitelib_stem=''
945 sitelibexp=''
946 siteprefix=''
947 siteprefixexp=''
948 sizesize=''
949 sizetype=''
950 so=''
951 socksizetype=''
952 sharpbang=''
953 shsharp=''
954 spitshell=''
955 src=''
956 ssizetype=''
957 startperl=''
958 startsh=''
959 stdchar=''
960 d_stdio_stream_array=''
961 stdio_stream_array=''
962 sysman=''
963 trnl=''
964 uidformat=''
965 uidsign=''
966 uidsize=''
967 uidtype=''
968 archname64=''
969 use64bitall=''
970 use64bitint=''
971 ccflags_uselargefiles=''
972 ldflags_uselargefiles=''
973 libswanted_uselargefiles=''
974 uselargefiles=''
975 uselongdouble=''
976 usemorebits=''
977 usemultiplicity=''
978 nm_opt=''
979 nm_so_opt=''
980 runnm=''
981 usenm=''
982 useperlio=''
983 usesocks=''
984 d_oldpthreads=''
985 use5005threads=''
986 useithreads=''
987 usereentrant=''
988 usethreads=''
989 incpath=''
990 mips_type=''
991 usrinc=''
992 d_vendorarch=''
993 installvendorarch=''
994 vendorarch=''
995 vendorarchexp=''
996 d_vendorbin=''
997 installvendorbin=''
998 vendorbin=''
999 vendorbinexp=''
1000 d_vendorlib=''
1001 installvendorlib=''
1002 vendorlib=''
1003 vendorlib_stem=''
1004 vendorlibexp=''
1005 usevendorprefix=''
1006 vendorprefix=''
1007 vendorprefixexp=''
1008 versiononly=''
1009 defvoidused=''
1010 voidflags=''
1011 pm_apiversion=''
1012 xs_apiversion=''
1013 yacc=''
1014 yaccflags=''
1015 CONFIG=''
1016
1017 define='define'
1018 undef='undef'
1019 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1020 rmlist=''
1021
1022 : We must find out about Eunice early
1023 eunicefix=':'
1024 if test -f /etc/unixtovms; then
1025         eunicefix=/etc/unixtovms
1026 fi
1027 if test -f /etc/unixtovms.exe; then
1028         eunicefix=/etc/unixtovms.exe
1029 fi
1030
1031 i_whoami=''
1032 ccname=''
1033 ccversion=''
1034 perllibs=''
1035 : set useposix=false in your hint file to disable the POSIX extension.
1036 useposix=true
1037 : set useopcode=false in your hint file to disable the Opcode extension.
1038 useopcode=true
1039 : Trailing extension.  Override this in a hint file, if needed.
1040 _exe=''
1041 : Extra object files, if any, needed on this platform.
1042 archobjs=''
1043 archname=''
1044 : Possible local include directories to search.
1045 : Set locincpth to "" in a hint file to defeat local include searches.
1046 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1047 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1048 :
1049 : no include file wanted by default
1050 inclwanted=''
1051
1052 groupstype=''
1053 libnames=''
1054 : change the next line if compiling for Xenix/286 on Xenix/386
1055 xlibpth='/usr/lib/386 /lib/386'
1056 : Possible local library directories to search.
1057 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1058 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1059
1060 : general looking path for locating libraries
1061 glibpth="/lib /usr/lib $xlibpth"
1062 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1063 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1064 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1065
1066 : Private path used by Configure to find libraries.  Its value
1067 : is prepended to libpth. This variable takes care of special
1068 : machines, like the mips.  Usually, it should be empty.
1069 plibpth=''
1070
1071 : default library list
1072 libswanted=''
1073 : some systems want to use only the non-versioned libso:s
1074 ignore_versioned_solibs=''
1075 archname64=''
1076 ccflags_uselargefiles=''
1077 ldflags_uselargefiles=''
1078 libswanted_uselargefiles=''
1079 : set usemultiplicity on the Configure command line to enable multiplicity.
1080 : set usesocks on the Configure command line to enable socks.
1081 : set usethreads on the Configure command line to enable threads.
1082 usereentrant='undef'
1083 : full support for void wanted by default
1084 defvoidused=15
1085
1086 : List of libraries we want.
1087 : If anyone needs -lnet, put it in a hint file.
1088 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1089 libswanted="$libswanted dld ld sun m c cposix posix"
1090 libswanted="$libswanted ndir dir crypt sec"
1091 libswanted="$libswanted ucb bsd BSD PW x iconv util"
1092 : We probably want to search /usr/shlib before most other libraries.
1093 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1094 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1095 glibpth="/usr/shlib $glibpth"
1096 : Do not use vfork unless overridden by a hint file.
1097 usevfork=false
1098
1099 : Find the basic shell for Bourne shell scripts
1100 case "$sh" in
1101 '')
1102         case "$SYSTYPE" in
1103         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1104         *) xxx='/bin/sh';;
1105         esac
1106         if test -f "$xxx"; then
1107                 sh="$xxx"
1108         else
1109                 : Build up a list and do a single loop so we can 'break' out.
1110                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1111                 for xxx in sh bash ksh pdksh ash; do
1112                         for p in $pth; do
1113                                 try="$try ${p}/${xxx}"
1114                         done
1115                 done
1116                 for xxx in $try; do
1117                         if test -f "$xxx"; then
1118                                 sh="$xxx";
1119                                 break
1120                         elif test -f "$xxx.exe"; then
1121                                 sh="$xxx";
1122                                 break
1123                         fi
1124                 done
1125         fi
1126         ;;
1127 esac
1128
1129 case "$sh" in
1130 '')     cat >&2 <<EOM
1131 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1132
1133 Usually it's in /bin/sh.  How did you even get this far?
1134 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1135 we'll try to straighten this all out.
1136 EOM
1137         exit 1
1138         ;;
1139 esac
1140
1141 : see if sh knows # comments
1142 if `$sh -c '#' >/dev/null 2>&1`; then
1143         shsharp=true
1144         spitshell=cat
1145         xcat=/bin/cat
1146         test -f $xcat || xcat=/usr/bin/cat
1147         echo "#!$xcat" >sharp
1148         $eunicefix sharp
1149         chmod +x sharp
1150         ./sharp > today
1151         if test -s today; then
1152                 sharpbang='#!'
1153         else
1154                 echo "#! $xcat" > sharp
1155                 $eunicefix sharp
1156                 chmod +x sharp
1157                 ./sharp > today
1158                 if test -s today; then
1159                         sharpbang='#! '
1160                 else
1161                         sharpbang=': use '
1162                 fi
1163         fi
1164 else
1165         echo " "
1166         echo "Your $sh doesn't grok # comments--I will strip them later on."
1167         shsharp=false
1168         cd ..
1169         echo "exec grep -v '^[  ]*#'" >spitshell
1170         chmod +x spitshell
1171         $eunicefix spitshell
1172         spitshell=`pwd`/spitshell
1173         cd UU
1174         echo "I presume that if # doesn't work, #! won't work either!"
1175         sharpbang=': use '
1176 fi
1177 rm -f sharp today
1178
1179 : figure out how to guarantee sh startup
1180 case "$startsh" in
1181 '') startsh=${sharpbang}${sh} ;;
1182 *)
1183 esac
1184 cat >sharp <<EOSS
1185 $startsh
1186 set abc
1187 test "$?abc" != 1
1188 EOSS
1189
1190 chmod +x sharp
1191 $eunicefix sharp
1192 if ./sharp; then
1193         : echo "Yup, it does."
1194 else
1195         echo "Hmm... '$startsh' does not guarantee sh startup..."
1196         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1197 fi
1198 rm -f sharp
1199
1200
1201 : Save command line options in file UU/cmdline.opt for later use in
1202 : generating config.sh.
1203 cat > cmdline.opt <<EOSH
1204 # Configure command line arguments.
1205 config_arg0='$0'
1206 config_args='$*'
1207 config_argc=$#
1208 EOSH
1209 argn=1
1210 args_exp=''
1211 args_sep=''
1212 for arg in "$@"; do
1213         cat >>cmdline.opt <<EOSH
1214 config_arg$argn='$arg'
1215 EOSH
1216         # Extreme backslashitis: replace each ' by '"'"'
1217         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1218 $arg
1219 EOC
1220         arg_exp=`cat cmdl.opt`
1221         args_exp="$args_exp$args_sep'$arg_exp'"
1222         argn=`expr $argn + 1`
1223         args_sep=' '
1224 done
1225 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1226 # used by ./hints/os2.sh
1227 rm -f cmdl.opt
1228
1229 : produce awk script to parse command line options
1230 cat >options.awk <<'EOF'
1231 BEGIN {
1232         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1233
1234         len = length(optstr);
1235         for (i = 1; i <= len; i++) {
1236                 c = substr(optstr, i, 1);
1237                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1238                 if (a == ":") {
1239                         arg[c] = 1;
1240                         i++;
1241                 }
1242                 opt[c] = 1;
1243         }
1244 }
1245 {
1246         expect = 0;
1247         str = $0;
1248         if (substr(str, 1, 1) != "-") {
1249                 printf("'%s'\n", str);
1250                 next;
1251         }
1252         len = length($0);
1253         for (i = 2; i <= len; i++) {
1254                 c = substr(str, i, 1);
1255                 if (!opt[c]) {
1256                         printf("-%s\n", substr(str, i));
1257                         next;
1258                 }
1259                 printf("-%s\n", c);
1260                 if (arg[c]) {
1261                         if (i < len)
1262                                 printf("'%s'\n", substr(str, i + 1));
1263                         else
1264                                 expect = 1;
1265                         next;
1266                 }
1267         }
1268 }
1269 END {
1270         if (expect)
1271                 print "?";
1272 }
1273 EOF
1274
1275 : process the command line options
1276 set X `for arg in "$@"; do echo "X$arg"; done |
1277         sed -e s/X// | awk -f options.awk`
1278 eval "set $*"
1279 shift
1280 rm -f options.awk
1281
1282 : set up default values
1283 fastread=''
1284 reuseval=false
1285 config_sh=''
1286 alldone=''
1287 error=''
1288 silent=''
1289 extractsh=''
1290 override=''
1291 knowitall=''
1292 rm -f optdef.sh posthint.sh
1293 cat >optdef.sh <<EOS
1294 $startsh
1295 EOS
1296
1297
1298 : option parsing
1299 while test $# -gt 0; do
1300         case "$1" in
1301         -d) shift; fastread=yes;;
1302         -e) shift; alldone=cont;;
1303         -f)
1304                 shift
1305                 cd ..
1306                 if test -r "$1"; then
1307                         config_sh="$1"
1308                 else
1309                         echo "$me: cannot read config file $1." >&2
1310                         error=true
1311                 fi
1312                 cd UU
1313                 shift;;
1314         -h) shift; error=true;;
1315         -r) shift; reuseval=true;;
1316         -s) shift; silent=true; realsilent=true;;
1317         -E) shift; alldone=exit;;
1318         -K) shift; knowitall=true;;
1319         -O) shift; override=true;;
1320         -S) shift; silent=true; extractsh=true;;
1321         -D)
1322                 shift
1323                 case "$1" in
1324                 *=)
1325                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1326                         echo "$me: ignoring -D $1" >&2
1327                         ;;
1328                 *=*) echo "$1" | \
1329                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1330                 *) echo "$1='define'" >> optdef.sh;;
1331                 esac
1332                 shift
1333                 ;;
1334         -U)
1335                 shift
1336                 case "$1" in
1337                 *=) echo "$1" >> optdef.sh;;
1338                 *=*)
1339                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1340                         echo "$me: ignoring -U $1" >&2
1341                         ;;
1342                 *) echo "$1='undef'" >> optdef.sh;;
1343                 esac
1344                 shift
1345                 ;;
1346         -A)
1347             shift
1348             xxx=''
1349             yyy="$1"
1350             zzz=''
1351             uuu=undef
1352             case "$yyy" in
1353             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1354                  case "$zzz" in
1355                  *:*) zzz='' ;;
1356                  *)   xxx=append
1357                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1358                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1359                  esac
1360                  ;;
1361             esac
1362             case "$xxx" in
1363             '')  case "$yyy" in
1364                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1365                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1366                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1367                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1368                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1369                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1370                  esac
1371                  ;;       
1372             esac
1373             case "$xxx" in
1374             append)
1375                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1376             clear)
1377                 echo "$yyy=''"                  >> posthint.sh ;;
1378             define)
1379                 case "$zzz" in
1380                 '') zzz=define ;;
1381                 esac
1382                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1383             eval)
1384                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1385             prepend)
1386                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1387             undef)
1388                 case "$zzz" in
1389                 '') zzz="$uuu" ;;
1390                 esac
1391                 echo "$yyy=$zzz"                >> posthint.sh ;;
1392             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1393             esac
1394             shift
1395             ;;
1396         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1397             exit 0;;
1398         --) break;;
1399         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1400         *) break;;
1401         esac
1402 done
1403
1404 case "$error" in
1405 true)
1406         cat >&2 <<EOM
1407 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1408                  [-U symbol] [-U symbol=] [-A command:symbol...]
1409   -d : use defaults for all answers.
1410   -e : go on without questioning past the production of config.sh.
1411   -f : specify an alternate default configuration file.
1412   -h : print this help message and exit (with an error status).
1413   -r : reuse C symbols value if possible (skips costly nm extraction).
1414   -s : silent mode, only echoes questions and essential information.
1415   -D : define symbol to have some value:
1416          -D symbol         symbol gets the value 'define'
1417          -D symbol=value   symbol gets the value 'value'
1418   -E : stop at the end of questions, after having produced config.sh.
1419   -K : do not use unless you know what you are doing.
1420   -O : let -D and -U override definitions from loaded configuration file.
1421   -S : perform variable substitutions on all .SH files (can mix with -f)
1422   -U : undefine symbol:
1423          -U symbol    symbol gets the value 'undef'
1424          -U symbol=   symbol gets completely empty
1425   -A : manipulate symbol after the platform specific hints have been applied:
1426          -A symbol=value                append " "value to symbol
1427          -A append:symbol=value         append value to symbol
1428          -A define:symbol=value         define symbol to have value
1429          -A clear:symbol                define symbol to be ''
1430          -A define:symbol               define symbol to be 'define'
1431          -A eval:symbol=value           define symbol to be eval of value
1432          -A prepend:symbol=value        prepend value to symbol
1433          -A undef:symbol                define symbol to be 'undef'
1434          -A undef:symbol=               define symbol to be ''
1435   -V : print version number and exit (with a zero status).
1436 EOM
1437         exit 1
1438         ;;
1439 esac
1440
1441 : Sanity checks
1442 case "$fastread$alldone" in
1443 yescont|yesexit) ;;
1444 *)
1445         case "$extractsh" in
1446         true) ;;
1447         *)
1448                 if test ! -t 0; then
1449                         echo "Say 'sh Configure', not 'sh <Configure'"
1450                         exit 1
1451                 fi
1452                 ;;
1453         esac
1454         ;;
1455 esac
1456
1457 exec 4>&1
1458 case "$silent" in
1459 true) exec 1>/dev/null;;
1460 esac
1461
1462 : run the defines and the undefines, if any, but leave the file out there...
1463 touch optdef.sh
1464 . ./optdef.sh
1465 : create the posthint manipulation script and leave the file out there...
1466 touch posthint.sh
1467
1468 : set package name
1469 package=perl5
1470 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1471 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1472 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1473 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1474 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1475 esac
1476
1477 : Some greps do not return status, grrr.
1478 echo "grimblepritz" >grimble
1479 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1480         contains=contains
1481 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1482         contains=grep
1483 else
1484         contains=contains
1485 fi
1486 rm -f grimble
1487 : the following should work in any shell
1488 case "$contains" in
1489 contains*)
1490         echo " "
1491         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1492         cat >contains <<'EOSS'
1493 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1494 EOSS
1495 chmod +x contains
1496 esac
1497
1498 : Find the path to the source tree
1499 case "$src" in
1500 '') case "$0" in
1501     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1502          case "$src" in
1503          /*)    ;;
1504          .)     ;;
1505          *)     src=`cd ../$src && pwd` ;;
1506          esac
1507          ;;
1508     *)   src='.';;
1509     esac;;
1510 esac
1511 case "$src" in
1512 '')     src=/
1513         rsrc=/
1514         ;;
1515 /*) rsrc="$src";;
1516 *) rsrc="../$src";;
1517 esac
1518 if test -f $rsrc/Configure && \
1519         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1520 then
1521    : found it, so we are ok.
1522 else
1523         rsrc=''
1524         for src in . .. ../.. ../../.. ../../../..; do
1525                 if test -f ../$src/Configure && \
1526                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1527                 then
1528                         rsrc=../$src
1529                         break
1530                 fi
1531         done
1532 fi
1533 case "$rsrc" in
1534 '')
1535         cat <<EOM >&4
1536
1537 Sorry, I can't seem to locate the source dir for $package.  Please start
1538 Configure with an explicit path -- i.e. /some/path/Configure.
1539
1540 EOM
1541         exit 1
1542         ;;
1543 ../.)   rsrc='..';;
1544 *)
1545         echo " "
1546         echo "Sources for $package found in \"$src\"." >&4
1547         ;;
1548 esac
1549
1550 : script used to extract .SH files with variable substitutions
1551 cat >extract <<'EOS'
1552 PERL_CONFIG_SH=true
1553 echo "Doing variable substitutions on .SH files..."
1554 if test -f MANIFEST; then
1555         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1556 else
1557         echo "(Looking for .SH files under the source directory.)"
1558         set x `(cd $src; find . -name "*.SH" -print)`
1559 fi
1560 shift
1561 case $# in
1562 0) set x `(cd $src; echo *.SH)`; shift;;
1563 esac
1564 if test ! -f $src/$1; then
1565         shift
1566 fi
1567 mkdir_p='
1568 name=$1;
1569 create="";
1570 while test $name; do
1571         if test ! -d "$name"; then
1572                 create="$name $create";
1573                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1574                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1575         else
1576                 name="";
1577         fi;
1578 done;
1579 for file in $create; do
1580         mkdir $file;
1581 done
1582 '
1583 for file in $*; do
1584         case "$src" in
1585         ".")
1586                 case "$file" in
1587                 */*)
1588                         dir=`expr X$file : 'X\(.*\)/'`
1589                         file=`expr X$file : 'X.*/\(.*\)'`
1590                         (cd $dir && . ./$file)
1591                         ;;
1592                 *)
1593                         . ./$file
1594                         ;;
1595                 esac
1596                 ;;
1597         *)
1598                 case "$file" in
1599                 */*)
1600                         dir=`expr X$file : 'X\(.*\)/'`
1601                         file=`expr X$file : 'X.*/\(.*\)'`
1602                         (set x $dir; shift; eval $mkdir_p)
1603                         sh <$src/$dir/$file
1604                         ;;
1605                 *)
1606                         sh <$src/$file
1607                         ;;
1608                 esac
1609                 ;;
1610         esac
1611 done
1612 if test -f $src/config_h.SH; then
1613         if test ! -f config.h; then
1614         : oops, they left it out of MANIFEST, probably, so do it anyway.
1615         . $src/config_h.SH
1616         fi
1617 fi
1618 EOS
1619
1620 : extract files and exit if asked to do so
1621 case "$extractsh" in
1622 true)
1623         case "$realsilent" in
1624         true) ;;
1625         *) exec 1>&4;;
1626         esac
1627         case "$config_sh" in
1628         '') config_sh='config.sh';;
1629         esac
1630         echo " "
1631         echo "Fetching answers from $config_sh..."
1632         cd ..
1633         . $config_sh
1634         test "$override" && . ./optdef.sh
1635         echo " "
1636         . UU/extract
1637         rm -rf UU
1638         echo "Extraction done."
1639         exit 0
1640         ;;
1641 esac
1642
1643 : Eunice requires " " instead of "", can you believe it
1644 echo " "
1645 : Here we go...
1646 echo "Beginning of configuration questions for $package."
1647
1648 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1649
1650 : first determine how to suppress newline on echo command
1651 echo " "
1652 echo "Checking echo to see how to suppress newlines..."
1653 (echo "hi there\c" ; echo " ") >.echotmp
1654 if $contains c .echotmp >/dev/null 2>&1 ; then
1655         echo "...using -n."
1656         n='-n'
1657         c=''
1658 else
1659         cat <<'EOM'
1660 ...using \c
1661 EOM
1662         n=''
1663         c='\c'
1664 fi
1665 echo $n "The star should be here-->$c"
1666 echo '*'
1667 rm -f .echotmp
1668
1669 : Now test for existence of everything in MANIFEST
1670 echo " "
1671 if test -f $rsrc/MANIFEST; then
1672         echo "First let's make sure your kit is complete.  Checking..." >&4
1673         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1674         rm -f missing
1675         tmppwd=`pwd`
1676         for filelist in x??; do
1677                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1678         done
1679         if test -s missing; then
1680                 cat missing >&4
1681                 cat >&4 <<'EOM'
1682
1683 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1684
1685 You have the option of continuing the configuration process, despite the
1686 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1687 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1688 and contact the author (perlbug@perl.org).
1689
1690 EOM
1691                 echo $n "Continue? [n] $c" >&4
1692                 read ans
1693                 case "$ans" in
1694                 y*)
1695                         echo "Continuing..." >&4
1696                         rm -f missing
1697                         ;;
1698                 *)
1699                         echo "ABORTING..." >&4
1700                         kill $$
1701                         ;;
1702                 esac
1703         else
1704                 echo "Looks good..."
1705         fi
1706 else
1707         echo "There is no MANIFEST file.  I hope your kit is complete !"
1708 fi
1709 rm -f missing x??
1710
1711 echo " "
1712 : Find the appropriate value for a newline for tr
1713 if test -n "$DJGPP"; then
1714        trnl='\012'
1715 fi
1716 if test X"$trnl" = X; then
1717         case "`echo foo|tr '\n' x 2>/dev/null`" in
1718         foox) trnl='\n' ;;
1719         esac
1720 fi
1721 if test X"$trnl" = X; then
1722         case "`echo foo|tr '\012' x 2>/dev/null`" in
1723         foox) trnl='\012' ;;
1724         esac
1725 fi
1726 if test X"$trnl" = X; then
1727         cat <<EOM >&2
1728
1729 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1730
1731 EOM
1732         exit 1
1733 fi
1734
1735 : compute the number of columns on the terminal for proper question formatting
1736 case "$COLUMNS" in
1737 '') COLUMNS='80';;
1738 esac
1739
1740 : set up the echo used in my read
1741 myecho="case \"\$xxxm\" in
1742 '') echo $n \"\$rp $c\" >&4;;
1743 *) case \"\$rp\" in
1744         '') echo $n \"[\$xxxm] $c\";;
1745         *)
1746                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1747                         echo \"\$rp\" >&4
1748                         echo $n \"[\$xxxm] $c\" >&4
1749                 else
1750                         echo $n \"\$rp [\$xxxm] $c\" >&4
1751                 fi
1752                 ;;
1753         esac;;
1754 esac"
1755
1756 : now set up to do reads with possible shell escape and default assignment
1757 cat <<EOSC >myread
1758 $startsh
1759 xxxm=\$dflt
1760 $myecho
1761 ans='!'
1762 case "\$fastread" in
1763 yes) case "\$dflt" in
1764         '') ;;
1765         *) ans='';
1766                 case "\$silent-\$rp" in
1767                 true-) ;;
1768                 *) echo " " >&4;;
1769                 esac;;
1770         esac;;
1771 *) case "\$silent" in
1772         true) case "\$rp" in
1773                 '') ans='';;
1774                 esac;;
1775         esac;;
1776 esac
1777 while expr "X\$ans" : "X!" >/dev/null; do
1778         read answ
1779         set x \$xxxm
1780         shift
1781         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1782         case  "\$answ" in
1783         "!")
1784                 sh 1>&4
1785                 echo " "
1786                 $myecho
1787                 ;;
1788         !*)
1789                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1790                 shift
1791                 sh 1>&4 -c "\$*"
1792                 echo " "
1793                 $myecho
1794                 ;;
1795         "\$ans")
1796                 case "\$ans" in
1797                 \\&*)
1798                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1799                         shift
1800                         case "\$1" in
1801                         -d)
1802                                 fastread=yes
1803                                 echo "(OK, I'll run with -d after this question.)" >&4
1804                                 ;;
1805                         -*)
1806                                 echo "*** Sorry, \$1 not supported yet." >&4
1807                                 ;;
1808                         esac
1809                         $myecho
1810                         ans=!
1811                         ;;
1812                 esac;;
1813         *)
1814                 case "\$aok" in
1815                 y)
1816                         echo "*** Substitution done -- please confirm."
1817                         xxxm="\$ans"
1818                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1819                         xxxm="\$ans"
1820                         ans=!
1821                         ;;
1822                 *)
1823                         echo "*** Error -- try again."
1824                         ans=!
1825                         ;;
1826                 esac
1827                 $myecho
1828                 ;;
1829         esac
1830         case "\$ans\$xxxm\$nostick" in
1831         '')
1832                 ans=!
1833                 $myecho
1834                 ;;
1835         esac
1836 done
1837 case "\$ans" in
1838 '') ans="\$xxxm";;
1839 esac
1840 EOSC
1841
1842 : create .config dir to save info across Configure sessions
1843 test -d ../.config || mkdir ../.config
1844 cat >../.config/README <<EOF
1845 This directory created by Configure to save information that should
1846 persist across sessions for $package.
1847
1848 You may safely delete it if you wish.
1849 EOF
1850
1851 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1852 case "$usedevel" in
1853 $define|true|[yY]*) ;;
1854 *) case "$xversion" in
1855    *[13579])
1856         cat >&4 <<EOH
1857 *** WHOA THERE!!! ***
1858
1859     This is an UNSTABLE DEVELOPMENT release.
1860     The version of this $package distribution is $xversion, that is, odd,
1861     (as opposed to even) and that signifies a development release.
1862     If you want a maintenance release, you want an even-numbered version.
1863
1864     Do ***NOT*** install this into production use.
1865     Data corruption and crashes are possible.
1866
1867     It is most seriously suggested that you do not continue any further
1868     unless you want to help in developing and debugging Perl.
1869
1870     If you *still* want to build perl, you can answer 'y' now,
1871     or pass -Dusedevel to Configure.
1872
1873 EOH
1874         rp='Do you really want to continue?'
1875         dflt='n'
1876         . ./myread
1877         case "$ans" in
1878         [yY]) echo >&4 "Okay, continuing."
1879               usedevel="$define" ;;
1880         *) echo >&4 "Okay, bye."
1881            exit 1
1882            ;;
1883         esac
1884         ;;
1885     esac
1886     ;;
1887 esac
1888 case "$usedevel" in
1889 $define|true|[yY]*)
1890         case "$versiononly" in
1891         '') versiononly="$define" ;;
1892         esac
1893         case "$installusrbinperl" in
1894         '') installusrbinperl="$undef" ;;
1895         esac
1896         ;;
1897 esac
1898
1899 : general instructions
1900 needman=true
1901 firsttime=true
1902 user=`(logname) 2>/dev/null`
1903 case "$user" in
1904 '') user=`whoami 2>&1`;;
1905 esac
1906 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1907         firsttime=false
1908         echo " "
1909         rp='Would you like to see the instructions?'
1910         dflt=n
1911         . ./myread
1912         case "$ans" in
1913         [yY]*) ;;
1914         *) needman=false;;
1915         esac
1916 fi
1917 if $needman; then
1918         cat <<EOH
1919
1920 This installation shell script will examine your system and ask you questions
1921 to determine how the perl5 package should be installed. If you get
1922 stuck on a question, you may use a ! shell escape to start a subshell or
1923 execute a command.  Many of the questions will have default answers in square
1924 brackets; typing carriage return will give you the default.
1925
1926 On some of the questions which ask for file or directory names you are allowed
1927 to use the ~name construct to specify the login directory belonging to "name",
1928 even if you don't have a shell which knows about that.  Questions where this is
1929 allowed will be marked "(~name ok)".
1930
1931 EOH
1932         rp=''
1933         dflt='Type carriage return to continue'
1934         . ./myread
1935         cat <<'EOH'
1936
1937 The prompter used in this script allows you to use shell variables and
1938 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1939 in the default answer, as if the default line was a set of arguments given to a
1940 script shell.  This means you may also use $* to repeat the whole default line,
1941 so you do not have to re-type everything to add something to the default.
1942
1943 Everytime there is a substitution, you will have to confirm.  If there is an
1944 error (e.g. an unmatched backtick), the default answer will remain unchanged
1945 and you will be prompted again.
1946
1947 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1948 the questions and use the computed defaults (or the previous answers if there
1949 was already a config.sh file). Type 'Configure -h' for a list of options.
1950 You may also start interactively and then answer '& -d' at any prompt to turn
1951 on the non-interactive behaviour for the remainder of the execution.
1952
1953 EOH
1954         . ./myread
1955         cat <<EOH
1956
1957 Much effort has been expended to ensure that this shell script will run on any
1958 Unix system.  If despite that it blows up on yours, your best bet is to edit
1959 Configure and run it again.  If you can't run Configure for some reason,
1960 you'll have to generate a config.sh file by hand.  Whatever problems you
1961 have, let me (perlbug@perl.org) know how I blew it.
1962
1963 This installation script affects things in two ways:
1964
1965 1) it may do direct variable substitutions on some of the files included
1966    in this kit.
1967 2) it builds a config.h file for inclusion in C programs.  You may edit
1968    any of these files as the need arises after running this script.
1969
1970 If you make a mistake on a question, there is no easy way to back up to it
1971 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1972 files.  Configure will offer to let you do this before it runs the SH files.
1973
1974 EOH
1975         dflt='Type carriage return to continue'
1976         . ./myread
1977         case "$firsttime" in
1978         true) echo $user >>../.config/instruct;;
1979         esac
1980 fi
1981
1982 : find out where common programs are
1983 echo " "
1984 echo "Locating common programs..." >&4
1985 cat <<EOSC >loc
1986 $startsh
1987 case \$# in
1988 0) exit 1;;
1989 esac
1990 thing=\$1
1991 shift
1992 dflt=\$1
1993 shift
1994 for dir in \$*; do
1995         case "\$thing" in
1996         .)
1997         if test -d \$dir/\$thing; then
1998                 echo \$dir
1999                 exit 0
2000         fi
2001         ;;
2002         *)
2003         for thisthing in \$dir/\$thing; do
2004                 : just loop through to pick last item
2005         done
2006         if test -f \$thisthing; then
2007                 echo \$thisthing
2008                 exit 0
2009         elif test -f \$dir/\$thing.exe; then
2010                 if test -n "$DJGPP"; then
2011                         echo \$dir/\$thing.exe
2012                 else
2013                         : on Eunice apparently
2014                         echo \$dir/\$thing
2015                 fi
2016                 exit 0
2017         fi
2018         ;;
2019         esac
2020 done
2021 echo \$dflt
2022 exit 1
2023 EOSC
2024 chmod +x loc
2025 $eunicefix loc
2026 loclist="
2027 awk
2028 cat
2029 chmod
2030 comm
2031 cp
2032 echo
2033 expr
2034 grep
2035 ls
2036 make
2037 mkdir
2038 rm
2039 sed
2040 sort
2041 touch
2042 tr
2043 uniq
2044 "
2045 trylist="
2046 Mcc
2047 ar
2048 bison
2049 byacc
2050 cpp
2051 csh
2052 date
2053 egrep
2054 gzip
2055 less
2056 ln
2057 more
2058 nm
2059 nroff
2060 pg
2061 test
2062 uname
2063 zip
2064 "
2065 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2066 pth="$pth /lib /usr/lib"
2067 for file in $loclist; do
2068         eval xxx=\$$file
2069         case "$xxx" in
2070         /*|?:[\\/]*)
2071                 if test -f "$xxx"; then
2072                         : ok
2073                 else
2074                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2075                         xxx=`./loc $file $file $pth`
2076                 fi
2077                 ;;
2078         '') xxx=`./loc $file $file $pth`;;
2079         *) xxx=`./loc $xxx $xxx $pth`;;
2080         esac
2081         eval $file=$xxx
2082         eval _$file=$xxx
2083         case "$xxx" in
2084         /*)
2085                 echo $file is in $xxx.
2086                 ;;
2087         ?:[\\/]*)
2088                 echo $file is in $xxx.
2089                 ;;
2090         *)
2091                 echo "I don't know where '$file' is, and my life depends on it." >&4
2092                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2093                 exit 1
2094                 ;;
2095         esac
2096 done
2097 echo " "
2098 echo "Don't worry if any of the following aren't found..."
2099 say=offhand
2100 for file in $trylist; do
2101         eval xxx=\$$file
2102         case "$xxx" in
2103         /*|?:[\\/]*)
2104                 if test -f "$xxx"; then
2105                         : ok
2106                 else
2107                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2108                         xxx=`./loc $file $file $pth`
2109                 fi
2110                 ;;
2111         '') xxx=`./loc $file $file $pth`;;
2112         *) xxx=`./loc $xxx $xxx $pth`;;
2113         esac
2114         eval $file=$xxx
2115         eval _$file=$xxx
2116         case "$xxx" in
2117         /*)
2118                 echo $file is in $xxx.
2119                 ;;
2120         ?:[\\/]*)
2121                 echo $file is in $xxx.
2122                 ;;
2123         *)
2124                 echo "I don't see $file out there, $say."
2125                 say=either
2126                 ;;
2127         esac
2128 done
2129 case "$egrep" in
2130 egrep)
2131         echo "Substituting grep for egrep."
2132         egrep=$grep
2133         ;;
2134 esac
2135 case "$ln" in
2136 ln)
2137         echo "Substituting cp for ln."
2138         ln=$cp
2139         ;;
2140 esac
2141 case "$test" in
2142 test)
2143         echo "Hopefully test is built into your sh."
2144         ;;
2145 *)
2146         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2147                 echo "Using the test built into your sh."
2148                 test=test
2149                 _test=test
2150         fi
2151         ;;
2152 esac
2153 case "$echo" in
2154 echo)
2155         echo "Hopefully echo is built into your sh."
2156         ;;
2157 '') ;;
2158 *)
2159         echo " "
2160 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2161         $echo $n "hi there$c" >foo1
2162         echo $n "hi there$c" >foo2
2163         if cmp foo1 foo2 >/dev/null 2>&1; then
2164                 echo "They are compatible.  In fact, they may be identical."
2165         else
2166                 case "$n" in
2167                 '-n') n='' c='\c';;
2168                 *) n='-n' c='';;
2169                 esac
2170                 cat <<FOO
2171 They are not compatible!  You are probably running ksh on a non-USG system.
2172 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2173 have echo built in and we may have to run some Bourne shell scripts.  That
2174 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2175
2176 FOO
2177                 $echo $n "The star should be here-->$c"
2178                 $echo "*"
2179         fi
2180         $rm -f foo1 foo2
2181         ;;
2182 esac
2183
2184 cat <<EOS >checkcc
2185 $startsh
2186 EOS
2187 cat <<'EOSC' >>checkcc
2188 case "$cc" in
2189 '') ;;
2190 *)  $rm -f try try.*
2191     $cat >try.c <<EOM
2192 int main(int argc, char *argv[]) {
2193   return 0;
2194 }
2195 EOM
2196     if $cc -o try $ccflags $ldflags try.c; then
2197        :
2198     else
2199         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2200         despair=yes
2201         trygcc=yes
2202         case "$cc" in
2203         *gcc*) trygcc=no ;;
2204         esac
2205         case "`$cc -v -c try.c 2>&1`" in
2206         *gcc*) trygcc=no ;;
2207         esac
2208         if $test X"$trygcc" = Xyes; then
2209             if gcc -o try -c try.c; then
2210                 echo " "
2211                 echo "You seem to have a working gcc, though." >&4
2212                 rp="Would you like to use it?"
2213                 dflt=y
2214                 if $test -f myread; then
2215                     . ./myread
2216                 else
2217                     if $test -f UU/myread; then
2218                         . ./UU/myread
2219                     else
2220                         echo "Cannot find myread, sorry.  Aborting." >&2
2221                         exit 1
2222                     fi
2223                 fi  
2224                 case "$ans" in
2225                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2226                 esac
2227             fi
2228         fi
2229         if $test X"$despair" = Xyes; then
2230             $cat >&4 <<EOM
2231 You need to find a working C compiler.
2232 Either (purchase and) install the C compiler supplied by your OS vendor,
2233 or for a free C compiler try http://gcc.gnu.org/
2234 I cannot continue any further, aborting.
2235 EOM
2236             exit 1
2237         fi
2238     fi
2239     $rm -f try try.*
2240     ;;
2241 esac
2242 EOSC
2243
2244 : determine whether symbolic links are supported
2245 echo " "
2246 $touch blurfl
2247 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2248         echo "Symbolic links are supported." >&4
2249         lns="$ln -s"
2250 else
2251         echo "Symbolic links are NOT supported." >&4
2252         lns="$ln"
2253 fi
2254 $rm -f blurfl sym
2255
2256 : determine whether symbolic links are supported
2257 echo " "
2258 case "$lns" in
2259 *"ln -s")
2260         echo "Checking how to test for symbolic links..." >&4
2261         $lns blurfl sym
2262         if $test "X$issymlink" = X; then
2263                 sh -c "PATH= test -h sym" >/dev/null 2>&1
2264                 if test $? = 0; then
2265                         issymlink="test -h"
2266                 fi              
2267         fi
2268         if $test "X$issymlink" = X; then
2269                 if  $test -h >/dev/null 2>&1; then
2270                         issymlink="$test -h"
2271                         echo "Your builtin 'test -h' may be broken, I'm using external '$test -h'." >&4
2272                 fi              
2273         fi
2274         if $test "X$issymlink" = X; then
2275                 if $test -L sym 2>/dev/null; then
2276                         issymlink="$test -L"
2277                 fi
2278         fi
2279         if $test "X$issymlink" != X; then
2280                 echo "You can test for symbolic links with '$issymlink'." >&4
2281         else
2282                 echo "I do not know how you can test for symbolic links." >&4
2283         fi
2284         $rm -f blurfl sym
2285         ;;
2286 *)      echo "No symbolic links, so not testing for their testing..." >&4
2287         ;;
2288 esac
2289 echo " "
2290
2291
2292 case "$mksymlinks" in
2293 $define|true|[yY]*)
2294         case "$src" in
2295         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2296                 exit 1
2297                 ;;
2298         *)      case "$lns:$issymlink" in
2299                 *"ln -s:"*"test -"?)
2300                         echo "Creating the symbolic links..." >&4
2301                         echo "(First creating the subdirectories...)" >&4
2302                         cd ..
2303                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2304                                 read directory
2305                                 test -z "$directory" && break
2306                                 mkdir -p $directory
2307                         done
2308                         # Sanity check 1.
2309                         if test ! -d t/base; then
2310                                 echo "Failed to create the subdirectories.  Aborting." >&4
2311                                 exit 1
2312                         fi
2313                         echo "(Then creating the symlinks...)" >&4
2314                         awk '{print $1}' $src/MANIFEST | while true; do
2315                                 read filename
2316                                 test -z "$filename" && break
2317                                 if test -f $filename; then
2318                                         if $issymlink $filename; then
2319                                                 rm -f $filename
2320                                         fi
2321                                 fi
2322                                 if test -f $filename; then
2323                                         echo "$filename already exists, not symlinking."
2324                                 else
2325                                         ln -s $src/$filename $filename
2326                                 fi
2327                         done
2328                         # Sanity check 2.
2329                         if test ! -f t/base/lex.t; then
2330                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2331                                 exit 1
2332                         fi
2333                         cd UU
2334                         ;;
2335                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2336                         ;;
2337                 esac
2338                 ;;
2339         esac
2340         ;;
2341 esac
2342
2343
2344 case "$usecrosscompile" in
2345 $define|true|[yY]*)
2346         $echo "Cross-compiling..."
2347         croak=''
2348         case "$cc" in
2349         *-*-gcc) # A cross-compiling gcc, probably.
2350             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2351             ar=$targetarch-ar
2352             # leave out ld, choosing it is more complex
2353             nm=$targetarch-nm
2354             ranlib=$targetarch-ranlib
2355             $echo 'extern int foo;' > try.c
2356             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2357             shift
2358             if $test $# -gt 0; then
2359                 incpth="$incpth $*"
2360                 incpth="`$echo $incpth|$sed 's/^ //'`"
2361                 echo "Guessing incpth '$incpth'." >&4
2362                 for i in $*; do
2363                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2364                     if $test -d $j; then
2365                         libpth="$libpth $j"
2366                     fi
2367                 done   
2368                 libpth="`$echo $libpth|$sed 's/^ //'`"
2369                 echo "Guessing libpth '$libpth'." >&4
2370             fi
2371             $rm -f try.c
2372             ;;
2373         esac
2374         case "$targetarch" in
2375         '') echo "Targetarch not defined." >&4; croak=y ;;
2376         *)  echo "Using targetarch $targetarch." >&4 ;;
2377         esac
2378         case "$incpth" in
2379         '') echo "Incpth not defined." >&4; croak=y ;;
2380         *)  echo "Using incpth '$incpth'." >&4 ;;
2381         esac
2382         case "$libpth" in
2383         '') echo "Libpth not defined." >&4; croak=y ;;
2384         *)  echo "Using libpth '$libpth'." >&4 ;;
2385         esac
2386         case "$usrinc" in
2387         '') for i in $incpth; do
2388                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2389                     usrinc=$i
2390                     echo "Guessing usrinc $usrinc." >&4
2391                     break
2392                 fi
2393             done
2394             case "$usrinc" in
2395             '') echo "Usrinc not defined." >&4; croak=y ;;
2396             esac
2397             ;;
2398         *)  echo "Using usrinc $usrinc." >&4 ;;
2399         esac
2400         case "$targethost" in
2401         '') echo "Targethost not defined." >&4; croak=y ;;
2402         *)  echo "Using targethost $targethost." >&4
2403         esac
2404         locincpth=' '
2405         loclibpth=' '
2406         case "$croak" in
2407         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2408         esac
2409         case "$src" in
2410         /*) run=$src/Cross/run
2411             targetmkdir=$src/Cross/mkdir
2412             to=$src/Cross/to
2413             from=$src/Cross/from
2414             ;;
2415         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2416             run=$pwd/Cross/run
2417             targetmkdir=$pwd/Cross/mkdir
2418             to=$pwd/Cross/to
2419             from=$pwd/Cross/from
2420             ;;
2421         esac
2422         case "$targetrun" in
2423         '') targetrun=ssh ;;
2424         esac
2425         case "$targetto" in
2426         '') targetto=scp ;;
2427         esac
2428         case "$targetfrom" in
2429         '') targetfrom=scp ;;
2430         esac
2431         run=$run-$targetrun
2432         to=$to-$targetto
2433         from=$from-$targetfrom
2434         case "$targetdir" in
2435         '')  targetdir=/tmp
2436              echo "Guessing targetdir $targetdir." >&4
2437              ;;
2438         esac
2439         case "$targetuser" in
2440         '')  targetuser=root
2441              echo "Guessing targetuser $targetuser." >&4
2442              ;;
2443         esac
2444         case "$targetfrom" in
2445         scp)    q=-q ;;
2446         *)      q='' ;;
2447         esac
2448         case "$targetrun" in
2449         ssh|rsh)
2450             cat >$run <<EOF
2451 #!/bin/sh
2452 case "\$1" in
2453 -cwd)
2454   shift
2455   cwd=\$1
2456   shift
2457   ;;
2458 esac
2459 case "\$cwd" in
2460 '') cwd=$targetdir ;;
2461 esac
2462 exe=\$1
2463 shift
2464 if $test ! -f \$exe.xok; then
2465   $to \$exe
2466   $touch \$exe.xok
2467 fi
2468 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2469 EOF
2470             ;;
2471         *)  echo "Unknown targetrun '$targetrun'" >&4
2472             exit 1
2473             ;;
2474         esac
2475         case "$targetmkdir" in
2476         */Cross/mkdir)
2477             cat >$targetmkdir <<EOF
2478 #!/bin/sh
2479 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2480 EOF
2481             $chmod a+rx $targetmkdir
2482             ;;
2483         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2484             exit 1
2485             ;;
2486         esac
2487         case "$targetto" in
2488         scp|rcp)
2489             cat >$to <<EOF
2490 #!/bin/sh
2491 for f in \$@
2492 do
2493   case "\$f" in
2494   /*)
2495     $targetmkdir \`dirname \$f\`
2496     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2497     ;;
2498   *)
2499     $targetmkdir $targetdir/\`dirname \$f\`
2500     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2501     ;;
2502   esac
2503 done
2504 exit 0
2505 EOF
2506             ;;
2507         cp) cat >$to <<EOF
2508 #!/bin/sh
2509 for f in \$@
2510 do
2511   case "\$f" in
2512   /*)
2513     $mkdir -p $targetdir/\`dirname \$f\`
2514     $cp \$f $targetdir/\$f || exit 1
2515     ;;
2516   *)
2517     $targetmkdir $targetdir/\`dirname \$f\`
2518     $cp \$f $targetdir/\$f || exit 1
2519     ;;
2520   esac
2521 done
2522 exit 0
2523 EOF
2524             ;;
2525         *)  echo "Unknown targetto '$targetto'" >&4
2526             exit 1
2527             ;;
2528         esac
2529         case "$targetfrom" in
2530         scp|rcp)
2531           cat >$from <<EOF
2532 #!/bin/sh
2533 for f in \$@
2534 do
2535   $rm -f \$f
2536   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2537 done
2538 exit 0
2539 EOF
2540             ;;
2541         cp) cat >$from <<EOF
2542 #!/bin/sh
2543 for f in \$@
2544 do
2545   $rm -f \$f
2546   cp $targetdir/\$f . || exit 1
2547 done
2548 exit 0
2549 EOF
2550             ;;
2551         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2552             exit 1
2553             ;;
2554         esac
2555         if $test ! -f $run; then
2556             echo "Target 'run' script '$run' not found." >&4
2557         else
2558             $chmod a+rx $run
2559         fi
2560         if $test ! -f $to; then
2561             echo "Target 'to' script '$to' not found." >&4
2562         else
2563             $chmod a+rx $to
2564         fi
2565         if $test ! -f $from; then
2566             echo "Target 'from' script '$from' not found." >&4
2567         else
2568             $chmod a+rx $from
2569         fi
2570         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2571             exit 1
2572         fi
2573         cat >&4 <<EOF
2574 Using '$run' for remote execution,
2575 and '$from' and '$to'
2576 for remote file transfer.
2577 EOF
2578         ;;
2579 *)      run=''
2580         to=:
2581         from=:
2582         usecrosscompile='undef'
2583         targetarch=''
2584         ;;
2585 esac
2586
2587 : see whether [:lower:] and [:upper:] are supported character classes
2588 echo " "
2589 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2590 ABYZ)
2591         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2592         up='[:upper:]'
2593         low='[:lower:]'
2594         ;;
2595 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2596         # (0xc9 and 0xd1), therefore that is a nice testing point.
2597         if test "X$up" = X -o "X$low" = X; then
2598             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2599             ij) up='[A-Z]'
2600                 low='[a-z]'
2601                 ;;
2602             esac
2603         fi
2604         if test "X$up" = X -o "X$low" = X; then
2605             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2606             ij) up='A-Z'
2607                 low='a-z'
2608                 ;;
2609             esac
2610         fi
2611         if test "X$up" = X -o "X$low" = X; then
2612             case "`echo IJ | od -x 2>/dev/null`" in
2613             *C9D1*|*c9d1*)
2614                 echo "Hey, this might be EBCDIC." >&4
2615                 if test "X$up" = X -o "X$low" = X; then
2616                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2617                     ij) up='[A-IJ-RS-Z]'
2618                         low='[a-ij-rs-z]'
2619                         ;;
2620                     esac
2621                 fi
2622                 if test "X$up" = X -o "X$low" = X; then
2623                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2624                     ij) up='A-IJ-RS-Z'
2625                         low='a-ij-rs-z'
2626                         ;;
2627                     esac
2628                 fi
2629                 ;;
2630             esac
2631         fi
2632 esac
2633 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2634 ij)
2635     echo "Using $up and $low to convert case." >&4
2636     ;;
2637 *)
2638     echo "I don't know how to translate letters from upper to lower case." >&4
2639     echo "Your tr is not acting any way I know of." >&4
2640     exit 1
2641     ;;
2642 esac
2643 : set up the translation script tr, must be called with ./tr of course
2644 cat >tr <<EOSC
2645 $startsh
2646 case "\$1\$2" in
2647 '[A-Z][a-z]') exec $tr '$up' '$low';;
2648 '[a-z][A-Z]') exec $tr '$low' '$up';;
2649 esac
2650 exec $tr "\$@"
2651 EOSC
2652 chmod +x tr
2653 $eunicefix tr
2654
2655 : Try to determine whether config.sh was made on this system
2656 case "$config_sh" in
2657 '')
2658 myuname=`$uname -a 2>/dev/null`
2659 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2660 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2661 # because the A-Z/a-z are not consecutive.
2662 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2663         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2664 newmyuname="$myuname"
2665 dflt=n
2666 case "$knowitall" in
2667 '')
2668         if test -f ../config.sh; then
2669                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2670                         eval "`grep myuname= ../config.sh`"
2671                 fi
2672                 if test "X$myuname" = "X$newmyuname"; then
2673                         dflt=y
2674                 fi
2675         fi
2676         ;;
2677 *) dflt=y;;
2678 esac
2679
2680 : Get old answers from old config file if Configure was run on the
2681 : same system, otherwise use the hints.
2682 hint=default
2683 cd ..
2684 if test -f config.sh; then
2685         echo " "
2686         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2687         . UU/myread
2688         case "$ans" in
2689         n*|N*) echo "OK, I'll ignore it."
2690                 mv config.sh config.sh.old
2691                 myuname="$newmyuname"
2692                 ;;
2693         *)  echo "Fetching default answers from your old config.sh file..." >&4
2694                 tmp_n="$n"
2695                 tmp_c="$c"
2696                 tmp_sh="$sh"
2697                 . ./config.sh
2698                 cp config.sh UU
2699                 n="$tmp_n"
2700                 c="$tmp_c"
2701                 : Older versions did not always set $sh.  Catch re-use of such
2702                 : an old config.sh.
2703                 case "$sh" in
2704                 '') sh="$tmp_sh" ;;
2705                 esac
2706                 hint=previous
2707                 ;;
2708         esac
2709 fi
2710 . ./UU/checkcc
2711 if test ! -f config.sh; then
2712         $cat <<EOM
2713
2714 First time through, eh?  I have some defaults handy for some systems
2715 that need some extra help getting the Configure answers right:
2716
2717 EOM
2718         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2719         dflt=''
2720         : Half the following guesses are probably wrong... If you have better
2721         : tests or hints, please send them to perlbug@perl.org
2722         : The metaconfig authors would also appreciate a copy...
2723         $test -f /irix && osname=irix
2724         $test -f /xenix && osname=sco_xenix
2725         $test -f /dynix && osname=dynix
2726         $test -f /dnix && osname=dnix
2727         $test -f /lynx.os && osname=lynxos
2728         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2729         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2730         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2731         $test -f /bin/mips && /bin/mips && osname=mips
2732         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2733                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2734         $test -d /usr/apollo/bin && osname=apollo
2735         $test -f /etc/saf/_sactab && osname=svr4
2736         $test -d /usr/include/minix && osname=minix
2737         if $test -d /MachTen -o -d /MachTen_Folder; then
2738                 osname=machten
2739                 if $test -x /sbin/version; then
2740                         osvers=`/sbin/version | $awk '{print $2}' |
2741                         $sed -e 's/[A-Za-z]$//'`
2742                 elif $test -x /usr/etc/version; then
2743                         osvers=`/usr/etc/version | $awk '{print $2}' |
2744                         $sed -e 's/[A-Za-z]$//'`
2745                 else
2746                         osvers="$2.$3"
2747                 fi
2748         fi
2749
2750         $test -f /sys/posix.dll &&
2751                 $test -f /usr/bin/what &&
2752                 set X `/usr/bin/what /sys/posix.dll` &&
2753                 $test "$3" = UWIN &&
2754                 osname=uwin &&
2755                 osvers="$5"
2756
2757         if $test -f $uname; then
2758                 set X $myuname
2759                 shift
2760
2761                 case "$5" in
2762                 fps*) osname=fps ;;
2763                 mips*)
2764                         case "$4" in
2765                         umips) osname=umips ;;
2766                         *) osname=mips ;;
2767                         esac;;
2768                 [23]100) osname=mips ;;
2769                 next*) osname=next ;;
2770                 i386*)
2771                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2772                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2773                                 osname='sco'
2774                                 osvers=$tmp
2775                         elif $test -f /etc/kconfig; then
2776                                 osname=isc
2777                                 if test "$lns" = "$ln -s"; then
2778                                         osvers=4
2779                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2780                                         osvers=3
2781                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2782                                         osvers=2
2783                                 fi
2784                         fi
2785                         tmp=''
2786                         ;;
2787                 pc*)
2788                         if test -n "$DJGPP"; then
2789                                 osname=dos
2790                                 osvers=djgpp
2791                         fi
2792                         ;;
2793                 esac
2794
2795                 case "$1" in
2796                 aix) osname=aix
2797                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2798                         case "$tmp" in
2799                         'not found') osvers="$4"."$3" ;;
2800                         '<3240'|'<>3240') osvers=3.2.0 ;;
2801                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2802                         '=3250'|'>3250') osvers=3.2.5 ;;
2803                         *) osvers=$tmp;;
2804                         esac
2805                         ;;
2806                 bsd386) osname=bsd386
2807                         osvers=`$uname -r`
2808                         ;;
2809                 cygwin*) osname=cygwin
2810                         osvers="$3"
2811                         ;;
2812                 *dc.osx) osname=dcosx
2813                         osvers="$3"
2814                         ;;
2815                 dnix) osname=dnix
2816                         osvers="$3"
2817                         ;;
2818                 domainos) osname=apollo
2819                         osvers="$3"
2820                         ;;
2821                 dgux) osname=dgux 
2822                         osvers="$3"
2823                         ;;
2824                 dynixptx*) osname=dynixptx
2825                         osvers=`echo "$4"|sed 's/^v//'`
2826                         ;;
2827                 freebsd) osname=freebsd 
2828                         osvers="$3" ;;
2829                 genix) osname=genix ;;
2830                 hp*) osname=hpux 
2831                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2832                         ;;
2833                 irix*) osname=irix
2834                         case "$3" in
2835                         4*) osvers=4 ;;
2836                         5*) osvers=5 ;;
2837                         *)      osvers="$3" ;;
2838                         esac
2839                         ;;
2840                 linux) osname=linux
2841                         case "$3" in
2842                         *)      osvers="$3" ;;
2843                         esac
2844                         ;;
2845                 MiNT) osname=mint
2846                         ;;
2847                 netbsd*) osname=netbsd
2848                         osvers="$3"
2849                         ;;
2850                 news-os) osvers="$3"
2851                         case "$3" in
2852                         4*) osname=newsos4 ;;
2853                         *) osname=newsos ;;
2854                         esac
2855                         ;;
2856                 next*) osname=next ;;
2857                 nonstop-ux) osname=nonstopux ;;
2858                 POSIX-BC | posix-bc ) osname=posix-bc
2859                         osvers="$3"
2860                         ;;
2861                 powerux | power_ux | powermax_os | powermaxos | \
2862                 powerunix | power_unix) osname=powerux
2863                         osvers="$3"
2864                         ;;
2865                 qnx) osname=qnx
2866                         osvers="$4"
2867                         ;;
2868                 solaris) osname=solaris
2869                         case "$3" in
2870                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2871                         *)      osvers="$3" ;;
2872                         esac
2873                         ;;
2874                 sunos) osname=sunos
2875                         case "$3" in
2876                         5*) osname=solaris
2877                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2878                         *)      osvers="$3" ;;
2879                         esac
2880                         ;;
2881                 titanos) osname=titanos
2882                         case "$3" in
2883                         1*) osvers=1 ;;
2884                         2*) osvers=2 ;;
2885                         3*) osvers=3 ;;
2886                         4*) osvers=4 ;;
2887                         *)      osvers="$3" ;;
2888                         esac
2889                         ;;
2890                 ultrix) osname=ultrix
2891                         osvers="$3"
2892                         ;;
2893                 osf1|mls+)      case "$5" in
2894                                 alpha)
2895                                         osname=dec_osf
2896                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2897                                         case "$osvers" in
2898                                         [1-9].[0-9]*) ;;
2899                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2900                                         esac
2901                                         ;;
2902                         hp*)    osname=hp_osf1  ;;
2903                         mips)   osname=mips_osf1 ;;
2904                         esac
2905                         ;;
2906                 unixware) osname=svr5
2907                         osvers="$4"
2908                         ;;
2909                 uts) osname=uts
2910                         osvers="$3"
2911                         ;;
2912                 $2) case "$osname" in
2913                         *isc*) ;;
2914                         *freebsd*) ;;
2915                         svr*)
2916                                 : svr4.x or possibly later
2917                                 case "svr$3" in 
2918                                 ${osname}*)
2919                                         osname=svr$3
2920                                         osvers=$4
2921                                         ;;
2922                                 esac
2923                                 case "$osname" in
2924                                 svr4.0)
2925                                         : Check for ESIX
2926                                         if test -f /stand/boot ; then
2927                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2928                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2929                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2930                                                         if test -n "$isesix"; then
2931                                                                 osname=esix4
2932                                                         fi
2933                                                 fi
2934                                         fi
2935                                         ;;
2936                                 esac
2937                                 ;;
2938                         *)      if test -f /etc/systemid; then
2939                                         osname=sco
2940                                         set `echo $3 | $sed 's/\./ /g'` $4
2941                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2942                                                 osvers=$1.$2.$3
2943                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2944                                                 osvers=$1.$2
2945                                         elif $test -f $src/hints/sco_$1.sh; then
2946                                                 osvers=$1
2947                                         fi
2948                                 else
2949                                         case "$osname" in
2950                                         '') : Still unknown.  Probably a generic Sys V.
2951                                                 osname="sysv"
2952                                                 osvers="$3"
2953                                                 ;;
2954                                         esac
2955                                 fi
2956                                 ;;
2957                         esac
2958                         ;;
2959                 *)      case "$osname" in
2960                         '') : Still unknown.  Probably a generic BSD.
2961                                 osname="$1"
2962                                 osvers="$3"
2963                                 ;;
2964                         esac
2965                         ;;
2966                 esac
2967         else
2968                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2969                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2970                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2971                                 osname=news_os
2972                         fi
2973                         $rm -f UU/kernel.what
2974                 elif test -d c:/.; then
2975                         set X $myuname
2976                         osname=os2
2977                         osvers="$5"
2978                 fi
2979         fi
2980         
2981         case "$targetarch" in
2982         '') ;;
2983         *)  hostarch=$osname
2984             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
2985             osvers=''
2986             ;;
2987         esac
2988
2989         : Now look for a hint file osname_osvers, unless one has been
2990         : specified already.
2991         case "$hintfile" in
2992         ''|' ')
2993                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2994                 : Also try without trailing minor version numbers.
2995                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2996                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2997                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2998                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2999                 case "$file" in
3000                 '') dflt=none ;;
3001                 *)  case "$osvers" in
3002                         '') dflt=$file
3003                                 ;;
3004                         *)  if $test -f $src/hints/$file.sh ; then
3005                                         dflt=$file
3006                                 elif $test -f $src/hints/$xfile.sh ; then
3007                                         dflt=$xfile
3008                                 elif $test -f $src/hints/$xxfile.sh ; then
3009                                         dflt=$xxfile
3010                                 elif $test -f $src/hints/$xxxfile.sh ; then
3011                                         dflt=$xxxfile
3012                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3013                                         dflt=$xxxxfile
3014                                 elif $test -f "$src/hints/${osname}.sh" ; then
3015                                         dflt="${osname}"
3016                                 else
3017                                         dflt=none
3018                                 fi
3019                                 ;;
3020                         esac
3021                         ;;
3022                 esac
3023                 if $test -f Policy.sh ; then
3024                         case "$dflt" in
3025                         *Policy*) ;;
3026                         none) dflt="Policy" ;;
3027                         *) dflt="Policy $dflt" ;;
3028                         esac
3029                 fi
3030                 ;;
3031         *)
3032                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3033                 ;;
3034         esac
3035
3036         if $test -f Policy.sh ; then
3037                 $cat <<EOM
3038
3039 There's also a Policy hint file available, which should make the
3040 site-specific (policy) questions easier to answer.
3041 EOM
3042
3043         fi
3044
3045         $cat <<EOM
3046
3047 You may give one or more space-separated answers, or "none" if appropriate.
3048 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3049 is a good thing.  DO NOT give a wrong version or a wrong OS.
3050
3051 EOM
3052
3053         rp="Which of these apply, if any?"
3054         . UU/myread
3055         tans=$ans
3056         for file in $tans; do
3057                 if $test X$file = XPolicy -a -f Policy.sh; then
3058                         . Policy.sh
3059                         $cat Policy.sh >> UU/config.sh
3060                 elif $test -f $src/hints/$file.sh; then
3061                         . $src/hints/$file.sh
3062                         $cat $src/hints/$file.sh >> UU/config.sh
3063                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3064                         : nothing
3065                 else
3066                         : Give one chance to correct a possible typo.
3067                         echo "$file.sh does not exist"
3068                         dflt=$file
3069                         rp="hint to use instead?"
3070                         . UU/myread
3071                         for file in $ans; do
3072                                 if $test -f "$src/hints/$file.sh"; then
3073                                         . $src/hints/$file.sh
3074                                         $cat $src/hints/$file.sh >> UU/config.sh
3075                                 elif $test X$ans = X -o X$ans = Xnone ; then
3076                                         : nothing
3077                                 else
3078                                         echo "$file.sh does not exist -- ignored."
3079                                 fi
3080                         done
3081                 fi
3082         done
3083
3084         hint=recommended
3085         : Remember our hint file for later.
3086         if $test -f "$src/hints/$file.sh" ; then
3087                 hintfile="$file"
3088         else
3089                 hintfile=''
3090         fi
3091 fi
3092 cd UU
3093 ;;
3094 *)
3095         echo " "
3096         echo "Fetching default answers from $config_sh..." >&4
3097         tmp_n="$n"
3098         tmp_c="$c"
3099         cd ..
3100         cp $config_sh config.sh 2>/dev/null
3101         chmod +w config.sh
3102         . ./config.sh
3103         cd UU
3104         cp ../config.sh .
3105         n="$tmp_n"
3106         c="$tmp_c"
3107         hint=previous
3108         ;;
3109 esac
3110 test "$override" && . ./optdef.sh
3111
3112 : Restore computed paths
3113 for file in $loclist $trylist; do
3114         eval $file="\$_$file"
3115 done
3116
3117 cat << EOM
3118
3119 Configure uses the operating system name and version to set some defaults.
3120 The default value is probably right if the name rings a bell. Otherwise,
3121 since spelling matters for me, either accept the default or answer "none"
3122 to leave it blank.
3123
3124 EOM
3125 case "$osname" in
3126         ''|' ')
3127                 case "$hintfile" in
3128                 ''|' '|none) dflt=none ;;
3129                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3130                 esac
3131                 ;;
3132         *) dflt="$osname" ;;
3133 esac
3134 rp="Operating system name?"
3135 . ./myread
3136 case "$ans" in
3137 none)  osname='' ;;
3138 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3139 esac
3140 echo " "
3141 case "$osvers" in
3142         ''|' ')
3143                 case "$hintfile" in
3144                 ''|' '|none) dflt=none ;;
3145                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3146                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3147                         case "$dflt" in
3148                         ''|' ') dflt=none ;;
3149                         esac
3150                         ;;
3151                 esac
3152                 ;;
3153         *) dflt="$osvers" ;;
3154 esac
3155 rp="Operating system version?"
3156 . ./myread
3157 case "$ans" in
3158 none)  osvers='' ;;
3159 *) osvers="$ans" ;;
3160 esac
3161
3162
3163 . ./posthint.sh
3164
3165 : who configured the system
3166 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3167 cf_by=`(logname) 2>/dev/null`
3168 case "$cf_by" in
3169 "")
3170         cf_by=`(whoami) 2>/dev/null`
3171         case "$cf_by" in
3172         "") cf_by=unknown ;;
3173         esac ;;
3174 esac
3175
3176 : set up the script used to warn in case of inconsistency
3177 cat <<EOS >whoa
3178 $startsh
3179 EOS
3180 cat <<'EOSC' >>whoa
3181 dflt=y
3182 echo " "
3183 echo "*** WHOA THERE!!! ***" >&4
3184 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3185 rp="    Keep the $hint value?"
3186 . ./myread
3187 case "$ans" in
3188 y) td=$was; tu=$was;;
3189 esac
3190 EOSC
3191
3192 : function used to set $1 to $val
3193 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3194 case "$val$was" in
3195 $define$undef) . ./whoa; eval "$var=\$td";;
3196 $undef$define) . ./whoa; eval "$var=\$tu";;
3197 *) eval "$var=$val";;
3198 esac'
3199
3200 case "$usethreads" in
3201 $define|true|[yY]*)     dflt='y';;
3202 *) dflt='n';;
3203 esac
3204 cat <<EOM
3205
3206 Perl can be built to take advantage of threads on some systems.
3207 To do so, Configure can be run with -Dusethreads.
3208
3209 Note that threading is a highly experimental feature, and
3210 some known race conditions still remain.  If you choose to try
3211 it, be very sure to not actually deploy it for production
3212 purposes.  README.threads has more details, and is required
3213 reading if you enable threads.
3214
3215 If this doesn't make any sense to you, just accept the default '$dflt'.
3216 EOM
3217 rp='Build a threading Perl?'
3218 . ./myread
3219 case "$ans" in
3220 y|Y)    val="$define" ;;
3221 *)      val="$undef" ;;
3222 esac
3223 set usethreads
3224 eval $setvar
3225
3226 case "$usethreads" in
3227 $define)
3228         $cat <<EOM
3229
3230 As of 5.5.640, Perl has two different internal threading implementations,
3231 the 5.005 version (5005threads) and an interpreter-based version
3232 (ithreads) that has one interpreter per thread.  Both are very 
3233 experimental.  This arrangement exists to help developers work out
3234 which one is better.
3235
3236 If you're a casual user, you probably don't want interpreter-threads
3237 at this time.  There doesn't yet exist a way to create threads from
3238 within Perl in this model, i.e., "use Thread;" will NOT work.
3239 EOM
3240         : Default to ithreads unless overridden on command line or with
3241         : old config.sh
3242         dflt='y'
3243         case "$use5005threads" in
3244                 $define|true|[yY]*) dflt='n';;
3245         esac
3246         case "$useithreads" in
3247                 $undef|false|[nN]*) dflt='n';;
3248         esac
3249         rp='Use interpreter-based ithreads?'
3250         . ./myread
3251         case "$ans" in
3252         y|Y)    val="$define" ;;
3253         *)      val="$undef" ;;
3254         esac
3255         set useithreads
3256         eval $setvar
3257         : Now set use5005threads to the opposite value.
3258         case "$useithreads" in
3259         $define) val="$undef" ;;
3260         *) val="$define" ;;
3261         esac
3262         set use5005threads
3263         eval $setvar
3264         ;;
3265 *)
3266         useithreads="$undef"
3267         use5005threads="$undef"
3268         ;;
3269 esac
3270
3271 case "$useithreads$use5005threads" in
3272 "$define$define")
3273         $cat >&4 <<EOM
3274
3275 You cannot have both the ithreads and the 5.005 threads enabled
3276 at the same time.  Disabling the 5.005 threads since they are
3277 much less stable than the ithreads.
3278
3279 EOM
3280         use5005threads="$undef"
3281         ;;
3282 esac
3283
3284 case "$d_oldpthreads" in
3285 '')     : Configure tests would be welcome here.  For now, assume undef.
3286         val="$undef" ;;
3287 *)      val="$d_oldpthreads" ;;
3288 esac
3289 set d_oldpthreads
3290 eval $setvar
3291
3292
3293 case "$usethreads" in
3294 "$define"|true|[yY]*)
3295 : Look for a hint-file generated 'call-back-unit'.  If the
3296 : user has specified that a threading perl is to be built,
3297 : we may need to set or change some other defaults.
3298         if $test -f usethreads.cbu; then
3299                 echo "Your platform has some specific hints for threaded builds, using them..."
3300                 . ./usethreads.cbu
3301         else
3302                 $cat <<EOM
3303 (Your platform doesn't have any specific hints for threaded builds.
3304  Assuming POSIX threads, then.)
3305 EOM
3306         fi
3307         ;;
3308 esac
3309
3310 cat <<EOM
3311
3312 Perl can be built so that multiple Perl interpreters can coexist
3313 within the same Perl executable.
3314 EOM
3315
3316 case "$useithreads" in
3317 $define)
3318         cat <<EOM
3319 This multiple interpreter support is required for interpreter-based threads.
3320 EOM
3321         val="$define"
3322         ;;
3323 *)      case "$usemultiplicity" in
3324         $define|true|[yY]*)     dflt='y';;
3325         *) dflt='n';;
3326         esac
3327         echo " "
3328         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3329         rp='Build Perl for multiplicity?'
3330         . ./myread
3331         case "$ans" in
3332         y|Y)    val="$define" ;;
3333         *)      val="$undef" ;;
3334         esac
3335         ;;
3336 esac
3337 set usemultiplicity
3338 eval $setvar
3339
3340
3341 case "$usemorebits" in
3342 "$define"|true|[yY]*)
3343         use64bitint="$define"
3344         uselongdouble="$define"
3345         usemorebits="$define"
3346         ;;
3347 *)      usemorebits="$undef"
3348         ;;
3349 esac
3350
3351 : make some quick guesses about what we are up against
3352 echo " "
3353 $echo $n "Hmm...  $c"
3354 echo exit 1 >bsd
3355 echo exit 1 >usg
3356 echo exit 1 >v7
3357 echo exit 1 >osf1
3358 echo exit 1 >eunice
3359 echo exit 1 >xenix
3360 echo exit 1 >venix
3361 echo exit 1 >os2
3362 d_bsd="$undef"
3363 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3364 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3365 then
3366         echo "Looks kind of like an OSF/1 system, but we'll see..."
3367         echo exit 0 >osf1
3368 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3369         xxx=`./loc addbib blurfl $pth`
3370         if $test -f $xxx; then
3371         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3372                 echo exit 0 >bsd
3373                 echo exit 0 >usg
3374         else
3375                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3376                         echo "Looks kind of like an extended USG system, but we'll see..."
3377                 else
3378                         echo "Looks kind of like a USG system, but we'll see..."
3379                 fi
3380                 echo exit 0 >usg
3381         fi
3382 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3383         echo "Looks kind of like a BSD system, but we'll see..."
3384         d_bsd="$define"
3385         echo exit 0 >bsd
3386 else
3387         echo "Looks kind of like a Version 7 system, but we'll see..."
3388         echo exit 0 >v7
3389 fi
3390 case "$eunicefix" in
3391 *unixtovms*)
3392         $cat <<'EOI'
3393 There is, however, a strange, musty smell in the air that reminds me of
3394 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3395 EOI
3396         echo exit 0 >eunice
3397         d_eunice="$define"
3398 : it so happens the Eunice I know will not run shell scripts in Unix format
3399         ;;
3400 *)
3401         echo " "
3402         echo "Congratulations.  You aren't running Eunice."
3403         d_eunice="$undef"
3404         ;;
3405 esac
3406 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3407 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3408 : semicolon as a patch separator
3409 case "$p_" in
3410 :) ;;
3411 *)
3412         $cat <<'EOI'
3413 I have the feeling something is not exactly right, however...don't tell me...
3414 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3415 (Or you may be running DOS with DJGPP.)
3416 EOI
3417         echo exit 0 >os2
3418         ;;
3419 esac
3420 if test -f /xenix; then
3421         echo "Actually, this looks more like a XENIX system..."
3422         echo exit 0 >xenix
3423         d_xenix="$define"
3424 else
3425         echo " "
3426         echo "It's not Xenix..."
3427         d_xenix="$undef"
3428 fi
3429 chmod +x xenix
3430 $eunicefix xenix
3431 if test -f /venix; then
3432         echo "Actually, this looks more like a VENIX system..."
3433         echo exit 0 >venix
3434 else
3435         echo " "
3436         if ./xenix; then
3437                 : null
3438         else
3439                 echo "Nor is it Venix..."
3440         fi
3441 fi
3442 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3443 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3444 $rm -f foo
3445
3446 case "$cc" in
3447 '') dflt=cc;;
3448 *) dflt="$cc";;
3449 esac
3450 rp="Use which C compiler?"
3451 . ./myread
3452 cc="$ans"
3453 : Look for a hint-file generated 'call-back-unit'.  Now that the
3454 : user has specified the compiler, we may need to set or change some
3455 : other defaults.
3456 if $test -f cc.cbu; then
3457     . ./cc.cbu
3458 fi
3459 . ./checkcc
3460
3461 echo " "
3462 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3463 $cat >try.c <<EOM
3464 #include <stdio.h>
3465 int main() {
3466 #ifdef __GNUC__
3467 #ifdef __VERSION__
3468         printf("%s\n", __VERSION__);
3469 #else
3470         printf("%s\n", "1");
3471 #endif
3472 #endif
3473         exit(0);
3474 }
3475 EOM
3476 if $cc -o try $ccflags $ldflags try.c; then
3477         gccversion=`$run ./try`
3478         case "$gccversion" in
3479         '') echo "You are not using GNU cc." ;;
3480         *)  echo "You are using GNU cc $gccversion."
3481             ccname=gcc  
3482             ;;
3483         esac
3484 else
3485         echo " "
3486         echo "*** WHOA THERE!!! ***" >&4
3487         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3488         case "$knowitall" in
3489         '')
3490         echo "    You'd better start hunting for one and let me know about it." >&4
3491                 exit 1
3492                 ;;
3493         esac
3494 fi
3495 $rm -f try try.*
3496 case "$gccversion" in
3497 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3498 esac
3499 case "$gccversion" in
3500 '') gccosandvers='' ;;
3501 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3502    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3503    gccshortvers=''
3504    case "$gccosandvers" in
3505    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3506    $osname$osvers) ;; # looking good
3507    $osname*) cat <<EOM >&4
3508
3509 *** WHOA THERE!!! ***
3510
3511     Your gcc has not been compiled for the exact release of
3512     your operating system ($gccosandvers versus $osname$osvers).
3513
3514     In general it is a good idea to keep gcc synchronized with
3515     the operating system because otherwise serious problems
3516     may ensue when trying to compile software, like Perl.
3517
3518     I'm trying to be optimistic here, though, and will continue.
3519     If later during the configuration and build icky compilation
3520     problems appear (headerfile conflicts being the most common
3521     manifestation), I suggest reinstalling the gcc to match
3522     your operating system release.
3523
3524 EOM
3525       ;;
3526    *) gccosandvers='' ;; # failed to parse, better be silent
3527    esac
3528    ;;
3529 esac
3530 case "$ccname" in
3531 '') ccname="$cc" ;;
3532 esac
3533
3534
3535 : decide how portable to be.  Allow command line overrides.
3536 case "$d_portable" in
3537 "$undef") ;;
3538 *)      d_portable="$define" ;;
3539 esac
3540
3541 : set up shell script to do ~ expansion
3542 cat >filexp <<EOSS
3543 $startsh
3544 : expand filename
3545 case "\$1" in
3546  ~/*|~)
3547         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3548         ;;
3549  ~*)
3550         if $test -f /bin/csh; then
3551                 /bin/csh -f -c "glob \$1"
3552                 failed=\$?
3553                 echo ""
3554                 exit \$failed
3555         else
3556                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3557                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3558                 if $test ! -d "\$dir"; then
3559                         me=\`basename \$0\`
3560                         echo "\$me: can't locate home directory for: \$name" >&2
3561                         exit 1
3562                 fi
3563                 case "\$1" in
3564                 */*)
3565                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3566                         ;;
3567                 *)
3568                         echo \$dir
3569                         ;;
3570                 esac
3571         fi
3572         ;;
3573 *)
3574         echo \$1
3575         ;;
3576 esac
3577 EOSS
3578 chmod +x filexp
3579 $eunicefix filexp
3580
3581 : now set up to get a file name
3582 cat <<EOS >getfile
3583 $startsh
3584 EOS
3585 cat <<'EOSC' >>getfile
3586 tilde=''
3587 fullpath=''
3588 already=''
3589 skip=''
3590 none_ok=''
3591 exp_file=''
3592 nopath_ok=''
3593 orig_rp="$rp"
3594 orig_dflt="$dflt"
3595 case "$gfpth" in
3596 '') gfpth='.' ;;
3597 esac
3598
3599 case "$fn" in
3600 *\(*)
3601         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3602         fn=`echo $fn | sed 's/(.*)//'`
3603         ;;
3604 esac
3605
3606 case "$fn" in
3607 *:*)
3608         loc_file=`expr $fn : '.*:\(.*\)'`
3609         fn=`expr $fn : '\(.*\):.*'`
3610         ;;
3611 esac
3612
3613 case "$fn" in
3614 *~*) tilde=true;;
3615 esac
3616 case "$fn" in
3617 */*) fullpath=true;;
3618 esac
3619 case "$fn" in
3620 *+*) skip=true;;
3621 esac
3622 case "$fn" in
3623 *n*) none_ok=true;;
3624 esac
3625 case "$fn" in
3626 *e*) exp_file=true;;
3627 esac
3628 case "$fn" in
3629 *p*) nopath_ok=true;;
3630 esac
3631
3632 case "$fn" in
3633 *f*) type='File';;
3634 *d*) type='Directory';;
3635 *l*) type='Locate';;
3636 esac
3637
3638 what="$type"
3639 case "$what" in
3640 Locate) what='File';;
3641 esac
3642
3643 case "$exp_file" in
3644 '')
3645         case "$d_portable" in
3646         "$define") ;;
3647         *) exp_file=true;;
3648         esac
3649         ;;
3650 esac
3651
3652 cd ..
3653 while test "$type"; do
3654         redo=''
3655         rp="$orig_rp"
3656         dflt="$orig_dflt"
3657         case "$tilde" in
3658         true) rp="$rp (~name ok)";;
3659         esac
3660         . UU/myread
3661         if test -f UU/getfile.ok && \
3662                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3663         then
3664                 value="$ans"
3665                 ansexp="$ans"
3666                 break
3667         fi
3668         case "$ans" in
3669         none)
3670                 value=''
3671                 ansexp=''
3672                 case "$none_ok" in
3673                 true) type='';;
3674                 esac
3675                 ;;
3676         *)
3677                 case "$tilde" in
3678                 '') value="$ans"
3679                         ansexp="$ans";;
3680                 *)
3681                         value=`UU/filexp $ans`
3682                         case $? in
3683                         0)
3684                                 if test "$ans" != "$value"; then
3685                                         echo "(That expands to $value on this system.)"
3686                                 fi
3687                                 ;;
3688                         *) value="$ans";;
3689                         esac
3690                         ansexp="$value"
3691                         case "$exp_file" in
3692                         '') value="$ans";;
3693                         esac
3694                         ;;
3695                 esac
3696                 case "$fullpath" in
3697                 true)
3698                         case "$ansexp" in
3699                         /*) value="$ansexp" ;;
3700                         [a-zA-Z]:/*) value="$ansexp" ;;
3701                         *)
3702                                 redo=true
3703                                 case "$already" in
3704                                 true)
3705                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3706                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3707                                         ;;
3708                                 *)
3709                                 echo "Please give a full path name, starting with slash." >&4
3710                                         case "$tilde" in
3711                                         true)
3712                                 echo "Note that using ~name is ok provided it expands well." >&4
3713                                                 already=true
3714                                                 ;;
3715                                         esac
3716                                 esac
3717                                 ;;
3718                         esac
3719                         ;;
3720                 esac
3721                 case "$redo" in
3722                 '')
3723                         case "$type" in
3724                         File)
3725                                 for fp in $gfpth; do
3726                                         if test "X$fp" = X.; then
3727                                             pf="$ansexp"
3728                                         else    
3729                                             pf="$fp/$ansexp"
3730                                         fi
3731                                         if test -f "$pf"; then
3732                                                 type=''
3733                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3734                                         then
3735                                                 echo "($value is not a plain file, but that's ok.)"
3736                                                 type=''
3737                                         fi
3738                                         if test X"$type" = X; then
3739                                             value="$pf"
3740                                             break
3741                                         fi
3742                                 done
3743                                 ;;
3744                         Directory)
3745                                 for fp in $gfpth; do
3746                                         if test "X$fp" = X.; then
3747                                             dir="$ans"
3748                                             direxp="$ansexp"
3749                                         else    
3750                                             dir="$fp/$ansexp"
3751                                             direxp="$fp/$ansexp"
3752                                         fi
3753                                         if test -d "$direxp"; then
3754                                                 type=''
3755                                                 value="$dir"
3756                                                 break
3757                                         fi
3758                                 done
3759                                 ;;
3760                         Locate)
3761                                 if test -d "$ansexp"; then
3762                                         echo "(Looking for $loc_file in directory $value.)"
3763                                         value="$value/$loc_file"
3764                                         ansexp="$ansexp/$loc_file"
3765                                 fi
3766                                 if test -f "$ansexp"; then
3767                                         type=''
3768                                 fi
3769                                 case "$nopath_ok" in
3770                                 true)   case "$value" in
3771                                         */*) ;;
3772                                         *)      echo "Assuming $value will be in people's path."
3773                                                 type=''
3774                                                 ;;
3775                                         esac
3776                                         ;;
3777                                 esac
3778                                 ;;
3779                         esac
3780
3781                         case "$skip" in
3782                         true) type='';
3783                         esac
3784
3785                         case "$type" in
3786                         '') ;;
3787                         *)
3788                                 if test "$fastread" = yes; then
3789                                         dflt=y
3790                                 else
3791                                         dflt=n
3792                                 fi
3793                                 rp="$what $value doesn't exist.  Use that name anyway?"
3794                                 . UU/myread
3795                                 dflt=''
3796                                 case "$ans" in
3797                                 y*) type='';;
3798                                 *) echo " ";;
3799                                 esac
3800                                 ;;
3801                         esac
3802                         ;;
3803                 esac
3804                 ;;
3805         esac
3806 done
3807 cd UU
3808 ans="$value"
3809 rp="$orig_rp"
3810 dflt="$orig_dflt"
3811 rm -f getfile.ok
3812 test "X$gfpthkeep" != Xy && gfpth=""
3813 EOSC
3814
3815 : What should the include directory be ?
3816 echo " "
3817 $echo $n "Hmm...  $c"
3818 dflt='/usr/include'
3819 incpath=''
3820 mips_type=''
3821 if $test -f /bin/mips && /bin/mips; then
3822         echo "Looks like a MIPS system..."
3823         $cat >usr.c <<'EOCP'
3824 #ifdef SYSTYPE_BSD43
3825 /bsd43
3826 #endif
3827 EOCP
3828         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3829                 dflt='/bsd43/usr/include'
3830                 incpath='/bsd43'
3831                 mips_type='BSD 4.3'
3832         else
3833                 mips_type='System V'
3834         fi
3835         $rm -f usr.c usr.out
3836         echo "and you're compiling with the $mips_type compiler and libraries."
3837         xxx_prompt=y
3838         echo "exit 0" >mips
3839 else
3840         echo "Doesn't look like a MIPS system."
3841         xxx_prompt=n
3842         echo "exit 1" >mips
3843 fi
3844 chmod +x mips
3845 $eunicefix mips
3846 case "$usrinc" in
3847 '') ;;
3848 *) dflt="$usrinc";;
3849 esac
3850 case "$xxx_prompt" in
3851 y)      fn=d/
3852         echo " "
3853         rp='Where are the include files you want to use?'
3854         . ./getfile
3855         usrinc="$ans"
3856         ;;
3857 *)      usrinc="$dflt"
3858         ;;
3859 esac
3860
3861 : see how we invoke the C preprocessor
3862 echo " "
3863 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3864 cat <<'EOT' >testcpp.c
3865 #define ABC abc
3866 #define XYZ xyz
3867 ABC.XYZ
3868 EOT
3869 cd ..
3870 if test ! -f cppstdin; then
3871         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3872                 # AIX cc -E doesn't show the absolute headerfile
3873                 # locations but we'll cheat by using the -M flag.
3874                 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
3875         else
3876                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3877         fi
3878 else
3879         echo "Keeping your $hint cppstdin wrapper."
3880 fi
3881 chmod 755 cppstdin
3882 wrapper=`pwd`/cppstdin
3883 ok='false'
3884 cd UU
3885
3886 if $test "X$cppstdin" != "X" && \
3887         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3888         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3889 then
3890         echo "You used to use $cppstdin $cppminus so we'll use that again."
3891         case "$cpprun" in
3892         '') echo "But let's see if we can live without a wrapper..." ;;
3893         *)
3894                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3895                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3896                 then
3897                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3898                         ok='true'
3899                 else
3900                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3901                 fi
3902                 ;;
3903         esac
3904 else
3905         case "$cppstdin" in
3906         '') ;;
3907         *)
3908                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3909                 ;;
3910         esac
3911 fi
3912
3913 if $ok; then
3914         : nothing
3915 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3916         $cc -E <testcpp.c >testcpp.out 2>&1; \
3917         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3918         echo "Yup, it does."
3919         x_cpp="$cc -E"
3920         x_minus='';
3921 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3922         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3923         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3924         echo "Yup, it does."
3925         x_cpp="$cc -E"
3926         x_minus='-';
3927 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3928         $cc -P <testcpp.c >testcpp.out 2>&1; \
3929         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3930         echo "Yipee, that works!"
3931         x_cpp="$cc -P"
3932         x_minus='';
3933 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3934         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3935         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3936         echo "At long last!"
3937         x_cpp="$cc -P"
3938         x_minus='-';
3939 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3940         $cpp <testcpp.c >testcpp.out 2>&1; \
3941         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3942         echo "It works!"
3943         x_cpp="$cpp"
3944         x_minus='';
3945 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3946         $cpp - <testcpp.c >testcpp.out 2>&1; \
3947         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3948         echo "Hooray, it works!  I was beginning to wonder."
3949         x_cpp="$cpp"
3950         x_minus='-';
3951 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3952         $wrapper <testcpp.c >testcpp.out 2>&1; \
3953         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3954         x_cpp="$wrapper"
3955         x_minus=''
3956         echo "Eureka!"
3957 else
3958         dflt=''
3959         rp="No dice.  I can't find a C preprocessor.  Name one:"
3960         . ./myread
3961         x_cpp="$ans"
3962         x_minus=''
3963         $x_cpp <testcpp.c >testcpp.out 2>&1
3964         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3965                 echo "OK, that will do." >&4
3966         else
3967 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3968                 exit 1
3969         fi
3970 fi
3971
3972 case "$ok" in
3973 false)
3974         cppstdin="$x_cpp"
3975         cppminus="$x_minus"
3976         cpprun="$x_cpp"
3977         cpplast="$x_minus"
3978         set X $x_cpp
3979         shift
3980         case "$1" in
3981         "$cpp")
3982                 echo "Perhaps can we force $cc -E using a wrapper..."
3983                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3984                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3985                 then
3986                         echo "Yup, we can."
3987                         cppstdin="$wrapper"
3988                         cppminus='';
3989                 else
3990                         echo "Nope, we'll have to live without it..."
3991                 fi
3992                 ;;
3993         esac
3994         case "$cpprun" in
3995         "$wrapper")
3996                 cpprun=''
3997                 cpplast=''
3998                 ;;
3999         esac
4000         ;;
4001 esac
4002
4003 case "$cppstdin" in
4004 "$wrapper"|'cppstdin') ;;
4005 *) $rm -f $wrapper;;
4006 esac
4007 $rm -f testcpp.c testcpp.out
4008
4009 : Set private lib path
4010 case "$plibpth" in
4011 '') if ./mips; then
4012                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4013         fi;;
4014 esac
4015 case "$libpth" in
4016 ' ') dlist='';;
4017 '') dlist="$loclibpth $plibpth $glibpth";;
4018 *) dlist="$libpth";;
4019 esac
4020
4021 : Now check and see which directories actually exist, avoiding duplicates
4022 libpth=''
4023 for xxx in $dlist
4024 do
4025     if $test -d $xxx; then
4026                 case " $libpth " in
4027                 *" $xxx "*) ;;
4028                 *) libpth="$libpth $xxx";;
4029                 esac
4030     fi
4031 done
4032 $cat <<'EOM'
4033
4034 Some systems have incompatible or broken versions of libraries.  Among
4035 the directories listed in the question below, please remove any you
4036 know not to be holding relevant libraries, and add any that are needed.
4037 Say "none" for none.
4038
4039 EOM
4040 case "$libpth" in
4041 '') dflt='none';;
4042 *)
4043         set X $libpth
4044         shift
4045         dflt=${1+"$@"}
4046         ;;
4047 esac
4048 rp="Directories to use for library searches?"
4049 . ./myread
4050 case "$ans" in
4051 none) libpth=' ';;
4052 *) libpth="$ans";;
4053 esac
4054
4055 : compute shared library extension
4056 case "$so" in
4057 '')
4058         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4059                 dflt='sl'
4060         else
4061                 dflt='so'
4062         fi
4063         ;;
4064 *) dflt="$so";;
4065 esac
4066 $cat <<EOM
4067
4068 On some systems, shared libraries may be available.  Answer 'none' if
4069 you want to suppress searching of shared libraries for the remainder
4070 of this configuration.
4071
4072 EOM
4073 rp='What is the file extension used for shared libraries?'
4074 . ./myread
4075 so="$ans"
4076
4077 : Define several unixisms.
4078 : Hints files or command line option can be used to override them.
4079 : The convoluted testing is in case hints files set either the old
4080 : or the new name.
4081 case "$_exe" in
4082 '')     case "$exe_ext" in
4083     '') ;;
4084         *)      _exe="$exe_ext" ;;
4085         esac
4086         ;;
4087 esac
4088 case "$_a" in
4089 '')     case "$lib_ext" in
4090     '') _a='.a';;
4091         *)      _a="$lib_ext" ;;
4092         esac
4093         ;;
4094 esac
4095 case "$_o" in
4096 '') case "$obj_ext" in
4097         '')     _o='.o';;
4098         *)      _o="$obj_ext";;
4099         esac
4100         ;;
4101 esac
4102 case "$p_" in
4103 '') case "$path_sep" in
4104         '')     p_=':';;
4105         *)      p_="$path_sep";;
4106         esac
4107         ;;
4108 esac
4109 exe_ext=$_exe
4110 lib_ext=$_a
4111 obj_ext=$_o
4112 path_sep=$p_
4113
4114 : Which makefile gets called first.  This is used by make depend.
4115 case "$firstmakefile" in
4116 '') firstmakefile='makefile';;
4117 esac
4118
4119 case "$usesocks" in
4120 $define|true|[yY]*)     dflt='y';;
4121 *) dflt='n';;
4122 esac
4123 cat <<EOM
4124
4125 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4126 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4127 to use the PerlIO abstraction layer, this will be implicitly selected.
4128
4129 If this doesn't make any sense to you, just accept the default '$dflt'.
4130 EOM
4131 rp='Build Perl for SOCKS?'
4132 . ./myread
4133 case "$ans" in
4134 y|Y)    val="$define" ;;     
4135 *)      val="$undef" ;;
4136 esac
4137 set usesocks
4138 eval $setvar
4139
4140 case "$usesocks" in
4141 $define|true|[yY]*) useperlio="$define";;
4142 esac
4143
4144 : Looking for optional libraries
4145 echo " "
4146 echo "Checking for optional libraries..." >&4
4147 case "$libs" in
4148 ' '|'') dflt='';;
4149 *) dflt="$libs";;
4150 esac
4151 case "$libswanted" in
4152 '') libswanted='c_s';;
4153 esac
4154 case "$usesocks" in
4155 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4156 esac
4157 libsfound=''
4158 libsfiles=''
4159 libsdirs=''
4160 libspath=''
4161 for thisdir in $libpth $xlibpth; do
4162   test -d $thisdir && libspath="$libspath $thisdir"
4163 done
4164 for thislib in $libswanted; do
4165         for thisdir in $libspath; do
4166             xxx=''
4167             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4168                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
4169                 $test -f "$xxx" && eval $libscheck
4170                 $test -f "$xxx" && libstyle=shared
4171             fi
4172             if test ! -f "$xxx"; then
4173                 xxx=$thisdir/lib$thislib.$so
4174                 $test -f "$xxx" && eval $libscheck
4175                 $test -f "$xxx" && libstyle=shared
4176             fi  
4177             if test ! -f "$xxx"; then
4178                 xxx=$thisdir/lib$thislib$_a
4179                 $test -f "$xxx" && eval $libscheck
4180                 $test -f "$xxx" && libstyle=static
4181             fi
4182             if test ! -f "$xxx"; then
4183                 xxx=$thisdir/$thislib$_a
4184                 $test -f "$xxx" && eval $libscheck
4185                 $test -f "$xxx" && libstyle=static
4186             fi
4187             if test ! -f "$xxx"; then
4188                 xxx=$thisdir/lib${thislib}_s$_a
4189                 $test -f "$xxx" && eval $libscheck
4190                 $test -f "$xxx" && libstyle=static
4191                 $test -f "$xxx" && thislib=${thislib}_s
4192             fi
4193             if test ! -f "$xxx"; then
4194                 xxx=$thisdir/Slib$thislib$_a
4195                 $test -f "$xxx" && eval $libscheck
4196                 $test -f "$xxx" && libstyle=static
4197             fi
4198             if $test -f "$xxx"; then
4199                 case "$libstyle" in
4200                 shared) echo "Found -l$thislib (shared)." ;;
4201                 static) echo "Found -l$thislib." ;;
4202                 *)      echo "Found -l$thislib ($libstyle)." ;;
4203                 esac
4204                 case " $dflt " in
4205                 *"-l$thislib "*);;
4206                 *) dflt="$dflt -l$thislib"
4207                    libsfound="$libsfound $xxx"
4208                    yyy=`basename $xxx`
4209                    libsfiles="$libsfiles $yyy"
4210                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4211                    case " $libsdirs " in
4212                    *" $yyy "*) ;;
4213                    *) libsdirs="$libsdirs $yyy" ;;
4214                    esac
4215                    ;;
4216                 esac
4217                 break
4218             fi  
4219         done
4220         if $test ! -f "$xxx"; then
4221             echo "No -l$thislib."
4222         fi
4223 done
4224 set X $dflt
4225 shift
4226 dflt="$*"
4227 case "$libs" in
4228 '') dflt="$dflt";;
4229 *) dflt="$libs";;
4230 esac
4231 case "$dflt" in
4232 ' '|'') dflt='none';;
4233 esac
4234
4235 $cat <<EOM
4236
4237 In order to compile $package on your machine, a number of libraries
4238 are usually needed.  Include any other special libraries here as well.
4239 Say "none" for none.  The default list is almost always right.
4240 EOM
4241
4242 echo " "
4243 rp="What libraries to use?"
4244 . ./myread
4245 case "$ans" in
4246 none) libs=' ';;
4247 *) libs="$ans";;
4248 esac
4249
4250 : determine optimization, if desired, or use for debug flag also
4251 case "$optimize" in
4252 ' '|$undef) dflt='none';;
4253 '') dflt='-O';;
4254 *) dflt="$optimize";;
4255 esac
4256 $cat <<EOH
4257
4258 By default, $package compiles with the -O flag to use the optimizer.
4259 Alternately, you might want to use the symbolic debugger, which uses
4260 the -g flag (on traditional Unix systems).  Either flag can be
4261 specified here.  To use neither flag, specify the word "none".
4262
4263 EOH
4264 rp="What optimizer/debugger flag should be used?"
4265 . ./myread
4266 optimize="$ans"
4267 case "$optimize" in
4268 'none') optimize=" ";;
4269 esac
4270
4271 dflt=''
4272 : We will not override a previous value, but we might want to
4273 : augment a hint file
4274 case "$hint" in
4275 default|recommended)
4276         case "$gccversion" in
4277         1*) dflt='-fpcc-struct-return' ;;
4278         esac
4279         case "$optimize" in
4280         *-g*) dflt="$dflt -DDEBUGGING";;
4281         esac
4282         case "$gccversion" in
4283         2*) if test -d /etc/conf/kconfig.d &&
4284                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4285                 then
4286                         dflt="$dflt -posix"
4287                 fi
4288                 ;;
4289         esac
4290         case "$gccversion" in
4291         1*) ;;
4292         2.[0-8]*) ;;
4293         ?*)     echo " "
4294                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4295                 echo 'int main(void) { return 0; }' > gcctest.c
4296                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4297                         echo "Yes, it does." 2>&1
4298                         case "$ccflags" in
4299                         *strict-aliasing*) 
4300                                 echo "Leaving current flags $ccflags alone." 2>&1
4301                                 ;;
4302                         *) dflt="$dflt -fno-strict-aliasing" ;;
4303                         esac
4304                 else
4305                         echo "Nope, it doesn't, but that's ok." 2>&1
4306                 fi
4307                 ;;
4308         esac
4309         ;;
4310 esac
4311
4312 case "$mips_type" in
4313 *BSD*|'') inclwanted="$locincpth $usrinc";;
4314 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4315 esac
4316 for thisincl in $inclwanted; do
4317         if $test -d $thisincl; then
4318                 if $test x$thisincl != x$usrinc; then
4319                         case "$dflt" in
4320                         *" -I$thisincl "*);;
4321                         *) dflt="$dflt -I$thisincl ";;
4322                         esac
4323                 fi
4324         fi
4325 done
4326
4327 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4328         xxx=true;
4329 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4330         xxx=true;
4331 else
4332         xxx=false;
4333 fi;
4334 if $xxx; then
4335         case "$dflt" in
4336         *$2*);;
4337         *) dflt="$dflt -D$2";;
4338         esac;
4339 fi'
4340
4341 set signal.h LANGUAGE_C; eval $inctest
4342
4343 case "$usesocks" in
4344 $define)
4345         ccflags="$ccflags -DSOCKS"
4346         ;;
4347 esac
4348
4349 case "$hint" in
4350 default|recommended) dflt="$ccflags $dflt" ;;
4351 *) dflt="$ccflags";;
4352 esac
4353
4354 case "$dflt" in
4355 ''|' ') dflt=none;;
4356 esac
4357
4358 $cat <<EOH
4359
4360 Your C compiler may want other flags.  For this question you should include
4361 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4362 but you should NOT include libraries or ld flags like -lwhatever.  If you
4363 want $package to honor its debug switch, you should include -DDEBUGGING here.
4364 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4365
4366 To use no flags, specify the word "none".
4367
4368 EOH
4369 set X $dflt
4370 shift
4371 dflt=${1+"$@"}
4372 rp="Any additional cc flags?"
4373 . ./myread
4374 case "$ans" in
4375 none) ccflags='';;
4376 *) ccflags="$ans";;
4377 esac
4378
4379 : the following weeds options from ccflags that are of no interest to cpp
4380 case "$cppflags" in
4381 '') cppflags="$ccflags" ;;
4382 *)  cppflags="$cppflags $ccflags" ;;
4383 esac
4384 case "$gccversion" in
4385 1*) cppflags="$cppflags -D__GNUC__"
4386 esac
4387 case "$mips_type" in
4388 '');;
4389 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4390 esac
4391 case "$cppflags" in
4392 '');;
4393 *)
4394         echo " "
4395         echo "Let me guess what the preprocessor flags are..." >&4
4396         set X $cppflags
4397         shift
4398         cppflags=''
4399         $cat >cpp.c <<'EOM'
4400 #define BLURFL foo
4401
4402 BLURFL xx LFRULB
4403 EOM
4404         previous=''
4405         for flag in $*
4406         do
4407                 case "$flag" in
4408                 -*) ftry="$flag";;
4409                 *) ftry="$previous $flag";;
4410                 esac
4411                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4412                         >cpp1.out 2>/dev/null && \
4413                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4414                         >cpp2.out 2>/dev/null && \
4415                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4416                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4417                 then
4418                         cppflags="$cppflags $ftry"
4419                         previous=''
4420                 else
4421                         previous="$flag"
4422                 fi
4423         done
4424         set X $cppflags
4425         shift
4426         cppflags=${1+"$@"}
4427         case "$cppflags" in
4428         *-*)  echo "They appear to be: $cppflags";;
4429         esac
4430         $rm -f cpp.c cpp?.out
4431         ;;
4432 esac
4433
4434 : flags used in final linking phase
4435 case "$ldflags" in
4436 '') if ./venix; then
4437                 dflt='-i -z'
4438         else
4439                 dflt=''
4440         fi
4441         case "$ccflags" in
4442         *-posix*) dflt="$dflt -posix" ;;
4443         esac
4444         ;;
4445 *) dflt="$ldflags";;
4446 esac
4447
4448 : Try to guess additional flags to pick up local libraries.
4449 for thislibdir in $libpth; do
4450         case " $loclibpth " in
4451         *" $thislibdir "*)
4452                 case "$dflt " in 
4453                 *"-L$thislibdir "*) ;;
4454                 *)  dflt="$dflt -L$thislibdir" ;;
4455                 esac
4456                 ;;
4457         esac
4458 done
4459
4460 case "$dflt" in
4461 '') dflt='none' ;;
4462 esac
4463
4464 $cat <<EOH
4465
4466 Your C linker may need flags.  For this question you should
4467 include -L/whatever and any other flags used by the C linker, but you
4468 should NOT include libraries like -lwhatever.
4469
4470 Make sure you include the appropriate -L/path flags if your C linker
4471 does not normally search all of the directories you specified above,
4472 namely
4473         $libpth
4474 To use no flags, specify the word "none".
4475
4476 EOH
4477
4478 rp="Any additional ld flags (NOT including libraries)?"
4479 . ./myread
4480 case "$ans" in
4481 none) ldflags='';;
4482 *) ldflags="$ans";;
4483 esac
4484 rmlist="$rmlist pdp11"
4485
4486 : coherency check
4487 echo " "
4488 echo "Checking your choice of C compiler and flags for coherency..." >&4
4489 $cat > try.c <<'EOF'
4490 #include <stdio.h>
4491 int main() { printf("Ok\n"); exit(0); }
4492 EOF
4493 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4494 shift
4495 $cat >try.msg <<'EOM'
4496 I've tried to compile and run the following simple program:
4497
4498 EOM
4499 $cat try.c >> try.msg
4500
4501 $cat >> try.msg <<EOM
4502
4503 I used the command:
4504
4505         $*
4506         $run ./try
4507
4508 and I got the following output:
4509
4510 EOM
4511 dflt=y
4512 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4513         if $sh -c "$run ./try" >>try.msg 2>&1; then
4514                 xxx=`$run ./try`
4515                 case "$xxx" in
4516                 "Ok") dflt=n ;;
4517                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4518                         case " $libs " in
4519                         *" -lsfio "*)
4520                                 cat >> try.msg <<'EOQS'
4521 If $libs contains -lsfio, and sfio is mis-configured, then it
4522 sometimes (apparently) runs and exits with a 0 status, but with no
4523 output!  It may have to do with sfio's use of _exit vs. exit.
4524
4525 EOQS
4526                                 rp="You have a big problem.  Shall I abort Configure"
4527                                 dflt=y
4528                                 ;;
4529                         esac
4530                         ;;
4531                 esac
4532         else
4533                 echo "The program compiled OK, but exited with status $?." >>try.msg
4534                 rp="You have a problem.  Shall I abort Configure"
4535                 dflt=y
4536         fi
4537 else
4538         echo "I can't compile the test program." >>try.msg
4539         rp="You have a BIG problem.  Shall I abort Configure"
4540         dflt=y
4541 fi
4542 case "$dflt" in
4543 y)
4544         $cat try.msg >&4
4545         case "$knowitall" in
4546         '')
4547                 echo "(The supplied flags or libraries might be incorrect.)"
4548                 ;;
4549         *) dflt=n;;
4550         esac
4551         echo " "
4552         . ./myread
4553         case "$ans" in
4554         n*|N*) ;;
4555         *)      echo "Ok.  Stopping Configure." >&4
4556                 exit 1
4557                 ;;
4558         esac
4559         ;;
4560 n) echo "OK, that should do.";;
4561 esac
4562 $rm -f try try.* core
4563
4564 : define a shorthand compile call
4565 compile='
4566 mc_file=$1;
4567 shift;
4568 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4569 : define a shorthand compile call for compilations that should be ok.
4570 compile_ok='
4571 mc_file=$1;
4572 shift;
4573 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4574
4575 : check for lengths of integral types
4576 echo " "
4577 case "$intsize" in
4578 '')
4579         echo "Checking to see how big your integers are..." >&4
4580         $cat >try.c <<'EOCP'
4581 #include <stdio.h>
4582 int main()
4583 {
4584         printf("intsize=%d;\n", (int)sizeof(int));
4585         printf("longsize=%d;\n", (int)sizeof(long));
4586         printf("shortsize=%d;\n", (int)sizeof(short));
4587         exit(0);
4588 }
4589 EOCP
4590         set try
4591         if eval $compile_ok && $run ./try > /dev/null; then
4592                 eval `$run ./try`
4593                 echo "Your integers are $intsize bytes long."
4594                 echo "Your long integers are $longsize bytes long."
4595                 echo "Your short integers are $shortsize bytes long."
4596         else
4597                 $cat >&4 <<EOM
4598 !
4599 Help! I can't compile and run the intsize test program: please enlighten me!
4600 (This is probably a misconfiguration in your system or libraries, and
4601 you really ought to fix it.  Still, I'll try anyway.)
4602 !
4603 EOM
4604                 dflt=4
4605                 rp="What is the size of an integer (in bytes)?"
4606                 . ./myread
4607                 intsize="$ans"
4608                 dflt=$intsize
4609                 rp="What is the size of a long integer (in bytes)?"
4610                 . ./myread
4611                 longsize="$ans"
4612                 dflt=2
4613                 rp="What is the size of a short integer (in bytes)?"
4614                 . ./myread
4615                 shortsize="$ans"
4616         fi
4617         ;;
4618 esac
4619 $rm -f try try.*
4620
4621 : check for void type
4622 echo " "
4623 echo "Checking to see how well your C compiler groks the void type..." >&4
4624 case "$voidflags" in
4625 '')
4626         $cat >try.c <<'EOCP'
4627 #if TRY & 1
4628 void sub() {
4629 #else
4630 sub() {
4631 #endif
4632         extern void moo();      /* function returning void */
4633         void (*goo)();          /* ptr to func returning void */
4634 #if TRY & 8
4635         void *hue;              /* generic ptr */
4636 #endif
4637 #if TRY & 2
4638         void (*foo[10])();
4639 #endif
4640
4641 #if TRY & 4
4642         if(goo == moo) {
4643                 exit(0);
4644         }
4645 #endif
4646         exit(0);
4647 }
4648 int main() { sub(); }
4649 EOCP
4650         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4651                 voidflags=$defvoidused
4652         echo "Good.  It appears to support void to the level $package wants.">&4
4653                 if $contains warning .out >/dev/null 2>&1; then
4654                         echo "However, you might get some warnings that look like this:"
4655                         $cat .out
4656                 fi
4657         else
4658 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
4659                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4660                         echo "It supports 1..."
4661                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4662                                 echo "It also supports 2..."
4663                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4664                                         voidflags=7
4665                                         echo "And it supports 4 but not 8 definitely."
4666                                 else
4667                                         echo "It doesn't support 4..."
4668                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4669                                                 voidflags=11
4670                                                 echo "But it supports 8."
4671                                         else
4672                                                 voidflags=3
4673                                                 echo "Neither does it support 8."
4674                                         fi
4675                                 fi
4676                         else
4677                                 echo "It does not support 2..."
4678                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4679                                         voidflags=13
4680                                         echo "But it supports 4 and 8."
4681                                 else
4682                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4683                                                 voidflags=5
4684                                                 echo "And it supports 4 but has not heard about 8."
4685                                         else
4686                                                 echo "However it supports 8 but not 4."
4687                                         fi
4688                                 fi
4689                         fi
4690                 else
4691                         echo "There is no support at all for void."
4692                         voidflags=0
4693                 fi
4694         fi
4695 esac
4696 case "$voidflags" in
4697 "$defvoidused") ;;
4698 *)      $cat >&4 <<'EOM'
4699   Support flag bits are:
4700     1: basic void declarations.
4701     2: arrays of pointers to functions returning void.
4702     4: operations between pointers to and addresses of void functions.
4703     8: generic void pointers.
4704 EOM
4705         dflt="$voidflags";
4706         rp="Your void support flags add up to what?"
4707         . ./myread
4708         voidflags="$ans"
4709         ;;
4710 esac
4711 $rm -f try.* .out
4712
4713 : check for length of pointer
4714 echo " "
4715 case "$ptrsize" in
4716 '')
4717         echo "Checking to see how big your pointers are..." >&4
4718         if test "$voidflags" -gt 7; then
4719                 echo '#define VOID_PTR char *' > try.c
4720         else
4721                 echo '#define VOID_PTR void *' > try.c
4722         fi
4723         $cat >>try.c <<'EOCP'
4724 #include <stdio.h>
4725 int main()
4726 {
4727     printf("%d\n", (int)sizeof(VOID_PTR));
4728     exit(0);
4729 }
4730 EOCP
4731         set try
4732         if eval $compile_ok; then
4733                 ptrsize=`$run ./try`
4734                 echo "Your pointers are $ptrsize bytes long."
4735         else
4736                 dflt='4'
4737                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
4738                 rp="What is the size of a pointer (in bytes)?"
4739                 . ./myread
4740                 ptrsize="$ans"
4741         fi
4742         ;;
4743 esac
4744 $rm -f try.c try
4745
4746 : check for long long
4747 echo " "
4748 echo "Checking to see if you have long long..." >&4
4749 echo 'int main() { long long x = 7; return 0; }' > try.c
4750 set try
4751 if eval $compile; then
4752         val="$define"
4753         echo "You have long long."
4754 else
4755         val="$undef"
4756         echo "You do not have long long."
4757 fi
4758 $rm try.*
4759 set d_longlong
4760 eval $setvar
4761
4762 : check for length of long long
4763 case "${d_longlong}${longlongsize}" in
4764 $define)
4765         echo " "
4766         echo "Checking to see how big your long longs are..." >&4
4767         $cat >try.c <<'EOCP'
4768 #include <stdio.h>
4769 int main()
4770 {
4771     printf("%d\n", (int)sizeof(long long));
4772     return(0);
4773 }
4774 EOCP
4775         set try
4776         if eval $compile_ok; then
4777                 longlongsize=`$run ./try`
4778                 echo "Your long longs are $longlongsize bytes long."
4779         else
4780                 dflt='8'
4781                 echo " "
4782                 echo "(I can't seem to compile the test program.  Guessing...)"
4783                 rp="What is the size of a long long (in bytes)?"
4784                 . ./myread
4785                 longlongsize="$ans"
4786         fi
4787         if $test "X$longsize" = "X$longlongsize"; then
4788                 echo "(That isn't any different from an ordinary long.)"
4789         fi      
4790         ;;
4791 esac
4792 $rm -f try.* try
4793
4794 : determine filename position in cpp output
4795 echo " "
4796 echo "Computing filename position in cpp output for #include directives..." >&4
4797 echo '#include <stdio.h>' > foo.c
4798 $cat >fieldn <<EOF
4799 $startsh
4800 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4801 $grep '^[       ]*#.*stdio\.h' | \
4802 while read cline; do
4803         pos=1
4804         set \$cline
4805         while $test \$# -gt 0; do
4806                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4807                         echo "\$pos"
4808                         exit 0
4809                 fi
4810                 shift
4811                 pos=\`expr \$pos + 1\`
4812         done
4813 done
4814 EOF
4815 chmod +x fieldn
4816 fieldn=`./fieldn`
4817 $rm -f foo.c fieldn
4818 case $fieldn in
4819 '') pos='???';;
4820 1) pos=first;;
4821 2) pos=second;;
4822 3) pos=third;;
4823 *) pos="${fieldn}th";;
4824 esac
4825 echo "Your cpp writes the filename in the $pos field of the line."
4826
4827 : locate header file
4828 $cat >findhdr <<EOF
4829 $startsh
4830 wanted=\$1
4831 name=''
4832 for usrincdir in $usrinc
4833 do
4834         if test -f \$usrincdir/\$wanted; then
4835                 echo "\$usrincdir/\$wanted"
4836                 exit 0
4837         fi
4838 done
4839 awkprg='{ print \$$fieldn }'
4840 echo "#include <\$wanted>" > foo\$\$.c
4841 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4842 $grep "^[       ]*#.*\$wanted" | \
4843 while read cline; do
4844         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4845         case "\$name" in
4846         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4847         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4848         *) exit 2;;
4849         esac;
4850 done;
4851 #
4852 # status = 0: grep returned 0 lines, case statement not executed
4853 # status = 1: headerfile found
4854 # status = 2: while loop executed, no headerfile found
4855 #
4856 status=\$?
4857 $rm -f foo\$\$.c;
4858 if test \$status -eq 1; then
4859         exit 0;
4860 fi
4861 exit 1
4862 EOF
4863 chmod +x findhdr
4864
4865 : define an alternate in-header-list? function
4866 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4867 cont=true; xxf="echo \"<\$1> found.\" >&4";
4868 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4869 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4870 esac;
4871 case $# in 4) instead=instead;; *) instead="at last";; esac;
4872 while $test "$cont"; do
4873         xxx=`./findhdr $1`
4874         var=$2; eval "was=\$$2";
4875         if $test "$xxx" && $test -r "$xxx";
4876         then eval $xxf;
4877         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4878                 cont="";
4879         else eval $xxnf;
4880         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4881         set $yyy; shift; shift; yyy=$@;
4882         case $# in 0) cont="";;
4883         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4884                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4885         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4886                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4887         esac;
4888 done;
4889 while $test "$yyy";
4890 do set $yyy; var=$2; eval "was=\$$2";
4891         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4892         set $yyy; shift; shift; yyy=$@;
4893 done'
4894
4895 : see if inttypes.h is available
4896 : we want a real compile instead of Inhdr because some systems
4897 : have an inttypes.h which includes non-existent headers
4898 echo " "
4899 $cat >try.c <<EOCP
4900 #include <inttypes.h>
4901 int main() {
4902         static int32_t foo32 = 0x12345678;
4903 }
4904 EOCP
4905 set try
4906 if eval $compile; then
4907         echo "<inttypes.h> found." >&4
4908         val="$define"
4909 else
4910         echo "<inttypes.h> NOT found." >&4
4911         val="$undef"
4912 fi
4913 $rm -f try.c try
4914 set i_inttypes
4915 eval $setvar
4916
4917 : check for int64_t
4918 echo " "
4919 echo "Checking to see if you have int64_t..." >&4
4920 $cat >try.c <<EOCP
4921 #include <sys/types.h>
4922 #$i_inttypes I_INTTYPES
4923 #ifdef I_INTTYPES
4924 #include <inttypes.h>
4925 #endif
4926 int main() { int64_t x = 7; }
4927 EOCP
4928 set try
4929 if eval $compile; then
4930         val="$define"
4931         echo "You have int64_t."
4932 else
4933         val="$undef"
4934         echo "You do not have int64_t."
4935 fi
4936 $rm -f try try.*
4937 set d_int64_t
4938 eval $setvar
4939
4940
4941 echo " "
4942 echo "Checking which 64-bit integer type we could use..." >&4
4943
4944 case "$intsize" in
4945 8) val=int
4946    set quadtype
4947    eval $setvar
4948    val='"unsigned int"'
4949    set uquadtype
4950    eval $setvar
4951    quadkind=1
4952    ;;
4953 *) case "$longsize" in
4954    8) val=long
4955       set quadtype
4956       eval $setvar
4957       val='"unsigned long"'
4958       set uquadtype
4959       eval $setvar
4960       quadkind=2
4961       ;;
4962    *) case "$d_longlong:$longlongsize" in
4963       define:8)
4964         val='"long long"'
4965         set quadtype
4966         eval $setvar
4967         val='"unsigned long long"'
4968         set uquadtype
4969         eval $setvar
4970         quadkind=3
4971         ;;
4972       *) case "$d_int64_t" in
4973          define)
4974            val=int64_t
4975            set quadtype
4976            eval $setvar
4977            val=uint64_t
4978            set uquadtype
4979            eval $setvar
4980            quadkind=4
4981            ;;
4982          esac
4983          ;;
4984       esac
4985       ;;
4986    esac
4987    ;;
4988 esac
4989
4990 case "$quadtype" in
4991 '')     echo "Alas, no 64-bit integer types in sight." >&4
4992         d_quad="$undef"
4993         ;;
4994 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
4995         d_quad="$define"
4996         ;;
4997 esac
4998
4999
5000 case "$uselonglong" in
5001 "$define"|true|[yY]*)
5002         cat <<EOM >&4
5003
5004 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5005 EOM
5006         use64bitint="$define"
5007         ;;
5008 esac                          
5009 case "$use64bits" in
5010 "$define"|true|[yY]*)
5011         cat <<EOM >&4
5012
5013 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5014 EOM
5015         use64bitint="$define"
5016         ;;
5017 esac                          
5018 case "$use64bitints" in
5019 "$define"|true|[yY]*)
5020         cat <<EOM >&4
5021
5022 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5023 EOM
5024         use64bitint="$define"
5025         ;;
5026 esac                          
5027 case "$use64bitsint" in
5028 "$define"|true|[yY]*)
5029         cat <<EOM >&4
5030
5031 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5032 EOM
5033         use64bitint="$define"
5034         ;;
5035 esac                          
5036 case "$uselonglongs" in
5037 "$define"|true|[yY]*)
5038         cat <<EOM >&4
5039
5040 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5041 EOM
5042         use64bitint="$define"
5043         ;;
5044 esac                          
5045 case "$use64bitsall" in
5046 "$define"|true|[yY]*)
5047         cat <<EOM >&4
5048
5049 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5050 EOM
5051         use64bitall="$define"
5052         ;;
5053 esac                          
5054
5055 case "$ccflags" in
5056 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5057 esac
5058 case "$use64bitall" in
5059 "$define"|true|[yY]*) use64bitint="$define" ;;
5060 esac
5061
5062 case "$longsize" in
5063 8) cat <<EOM
5064
5065 You have natively 64-bit long integers.
5066 EOM
5067    val="$define"
5068    ;;
5069 *) case "$use64bitint" in
5070    "$define"|true|[yY]*) dflt='y';;
5071    *) dflt='n';;
5072    esac
5073    case "$d_quad" in
5074    "$define") ;;
5075    *) dflt='n' ;;
5076    esac
5077    cat <<EOM
5078
5079 Perl can be built to take advantage of 64-bit integer types
5080 on some systems.  To do so, Configure can be run with -Duse64bitint.
5081 Choosing this option will most probably introduce binary incompatibilities.
5082
5083 If this doesn't make any sense to you, just accept the default '$dflt'.
5084 (The default has been chosen based on your configuration.)
5085 EOM
5086    rp='Try to use 64-bit integers, if available?'
5087    . ./myread
5088    case "$ans" in
5089    [yY]*) val="$define" ;;
5090    *)     val="$undef"  ;;
5091    esac
5092    ;;
5093 esac
5094 set use64bitint
5095 eval $setvar
5096
5097 case "$use64bitall" in
5098 "$define"|true|[yY]*) dflt='y' ;;
5099 *) case "$longsize" in
5100    8) dflt='y' ;;
5101    *) dflt='n' ;;
5102    esac
5103    ;;
5104 esac    
5105 cat <<EOM
5106
5107 You may also choose to try maximal 64-bitness.  It means using as much
5108 64-bitness as possible on the platform.  This in turn means even more
5109 binary incompatibilities.  On the other hand, your platform may not
5110 have any more 64-bitness available than what you already have chosen.
5111
5112 If this doesn't make any sense to you, just accept the default '$dflt'.
5113 (The default has been chosen based on your configuration.)
5114 EOM
5115 rp='Try to use maximal 64-bit support, if available?'
5116 . ./myread
5117 case "$ans" in
5118 [yY]*) val="$define" ;;
5119 *)     val="$undef"  ;;
5120 esac
5121 set use64bitall
5122 eval $setvar
5123 case "$use64bitall" in
5124 "$define")
5125         case "$use64bitint" in
5126         "$undef")
5127                 cat <<EOM
5128
5129 Since you have chosen a maximally 64-bit build, I'm also turning on
5130 the use of 64-bit integers.
5131 EOM
5132                 use64bitint="$define" ;;
5133         esac
5134         ;;
5135 esac
5136
5137 case "$use64bitall" in
5138 "$define"|true|[yY]*)
5139         case "$ptrsize" in
5140         4)      cat <<EOM >&4
5141
5142 *** You have chosen a maximally 64-bit build, but your pointers
5143 *** are only 4 bytes wide, disabling maximal 64-bitness.
5144
5145 EOM
5146                 use64bitall="$undef"
5147                 case "$use64bitint" in
5148                 "$define"|true|[yY]*) ;;
5149                 *)      cat <<EOM >&4
5150
5151 *** Downgrading from maximal 64-bitness to using 64-bit integers.
5152
5153 EOM
5154                         use64bitint="$define"
5155                         ;;
5156                 esac
5157                 ;;
5158         esac
5159         ;;
5160 esac
5161
5162 case "$use64bitint" in
5163 "$define"|true|[yY]*)
5164 : Look for a hint-file generated 'call-back-unit'.  If the
5165 : user has specified that a 64-bit perl is to be built,
5166 : we may need to set or change some other defaults.
5167         if $test -f use64bitint.cbu; then
5168                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5169                 . ./use64bitint.cbu
5170         fi
5171         case "$longsize" in
5172         4) case "$archname64" in
5173            '') archname64=64int ;;
5174            esac
5175            ;;
5176         esac
5177         ;;
5178 esac
5179
5180 case "$use64bitall" in
5181 "$define"|true|[yY]*)
5182 : Look for a hint-file generated 'call-back-unit'.  If the
5183 : user has specified that a maximally 64-bit perl is to be built,
5184 : we may need to set or change some other defaults.
5185         if $test -f use64bitall.cbu; then
5186                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5187                 . ./use64bitall.cbu
5188         fi
5189         case "$longsize" in
5190         4) case "$archname64" in
5191            ''|64int) archname64=64all ;;
5192            esac
5193            ;;
5194         esac
5195         ;;
5196 esac
5197
5198 echo " "
5199 echo "Checking for GNU C Library..." >&4
5200 cat >try.c <<EOM
5201 #include <stdio.h>
5202 int main()
5203 {
5204 #ifdef __GLIBC__
5205     exit(0);
5206 #else
5207     exit(1);
5208 #endif
5209 }
5210 EOM
5211 set try
5212 if eval $compile_ok && $run ./try; then
5213         val="$define"
5214         echo "You are using the GNU C Library"
5215 else
5216         val="$undef"
5217         echo "You are not using the GNU C Library"
5218 fi
5219 $rm -f try try.*
5220 set d_gnulibc
5221 eval $setvar
5222
5223 : see if nm is to be used to determine whether a symbol is defined or not
5224 case "$usenm" in
5225 '')
5226         dflt=''
5227         case "$d_gnulibc" in
5228         "$define")
5229                 echo " "
5230                 echo "nm probably won't work on the GNU C Library." >&4
5231                 dflt=n
5232                 ;;
5233         esac
5234         case "$dflt" in
5235         '') 
5236                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5237                         echo " "
5238                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5239                         echo "'nm' won't be sufficient on this sytem." >&4
5240                         dflt=n
5241                 fi
5242                 ;;
5243         esac
5244         case "$dflt" in
5245         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5246                 if $test $dflt -gt 20; then
5247                         dflt=y
5248                 else
5249                         dflt=n
5250                 fi
5251                 ;;
5252         esac
5253         ;;
5254 *)
5255         case "$usenm" in
5256         true|$define) dflt=y;;
5257         *) dflt=n;;
5258         esac
5259         ;;
5260 esac
5261 $cat <<EOM
5262
5263 I can use $nm to extract the symbols from your C libraries. This
5264 is a time consuming task which may generate huge output on the disk (up
5265 to 3 megabytes) but that should make the symbols extraction faster. The
5266 alternative is to skip the 'nm' extraction part and to compile a small
5267 test program instead to determine whether each symbol is present. If
5268 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5269 this may be the best solution.
5270
5271 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5272
5273 EOM
5274 rp="Shall I use $nm to extract C symbols from the libraries?"
5275 . ./myread
5276 case "$ans" in
5277 [Nn]*) usenm=false;;
5278 *) usenm=true;;
5279 esac
5280
5281 runnm=$usenm
5282 case "$reuseval" in
5283 true) runnm=false;;
5284 esac
5285
5286 : nm options which may be necessary
5287 case "$nm_opt" in
5288 '') if $test -f /mach_boot; then
5289                 nm_opt=''       # Mach
5290         elif $test -d /usr/ccs/lib; then
5291                 nm_opt='-p'     # Solaris (and SunOS?)
5292         elif $test -f /dgux; then
5293                 nm_opt='-p'     # DG-UX
5294         elif $test -f /lib64/rld; then
5295                 nm_opt='-p'     # 64-bit Irix
5296         else
5297                 nm_opt=''
5298         fi;;
5299 esac
5300
5301 : nm options which may be necessary for shared libraries but illegal
5302 : for archive libraries.  Thank you, Linux.
5303 case "$nm_so_opt" in
5304 '')     case "$myuname" in
5305         *linux*)
5306                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5307                         nm_so_opt='--dynamic'
5308                 fi
5309                 ;;
5310         esac
5311         ;;
5312 esac
5313
5314 case "$runnm" in
5315 true)
5316 : get list of predefined functions in a handy place
5317 echo " "
5318 case "$libc" in
5319 '') libc=unknown
5320         case "$libs" in
5321         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5322         esac
5323         ;;
5324 esac
5325 case "$libs" in
5326 '') ;;
5327 *)  for thislib in $libs; do
5328         case "$thislib" in
5329         -lc|-lc_s)
5330                 : Handle C library specially below.
5331                 ;;
5332         -l*)
5333                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5334                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5335                         :
5336                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5337                         :
5338                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5339                         :
5340                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5341                         :
5342                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5343                         :
5344                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5345                         :
5346                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5347                         :
5348                 else
5349                         try=''
5350                 fi
5351                 libnames="$libnames $try"
5352                 ;;
5353         *) libnames="$libnames $thislib" ;;
5354         esac
5355         done
5356         ;;
5357 esac
5358 xxx=normal
5359 case "$libc" in
5360 unknown)
5361         set /lib/libc.$so
5362         for xxx in $libpth; do
5363                 $test -r $1 || set $xxx/libc.$so
5364                 : The messy sed command sorts on library version numbers.
5365                 $test -r $1 || \
5366                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5367                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5368                                 h
5369                                 s/[0-9][0-9]*/0000&/g
5370                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5371                                 G
5372                                 s/\n/ /' | \
5373                          $sort | $sed -e 's/^.* //'`
5374                 eval set \$$#
5375         done
5376         $test -r $1 || set /usr/ccs/lib/libc.$so
5377         $test -r $1 || set /lib/libsys_s$_a
5378         ;;
5379 *)
5380         set blurfl
5381         ;;
5382 esac
5383 if $test -r "$1"; then
5384         echo "Your (shared) C library seems to be in $1."
5385         libc="$1"
5386 elif $test -r /lib/libc && $test -r /lib/clib; then
5387         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5388         xxx=apollo
5389         libc='/lib/clib /lib/libc'
5390         if $test -r /lib/syslib; then
5391                 echo "(Your math library is in /lib/syslib.)"
5392                 libc="$libc /lib/syslib"
5393         fi
5394 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5395         echo "Your C library seems to be in $libc, as you said before."
5396 elif $test -r $incpath/usr/lib/libc$_a; then
5397         libc=$incpath/usr/lib/libc$_a;
5398         echo "Your C library seems to be in $libc.  That's fine."
5399 elif $test -r /lib/libc$_a; then
5400         libc=/lib/libc$_a;
5401         echo "Your C library seems to be in $libc.  You're normal."
5402 else
5403         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5404                 :
5405         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5406                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5407         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5408                 :
5409         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5410                 :
5411         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5412                 :
5413         else
5414                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5415         fi
5416         if $test -r "$tans"; then
5417                 echo "Your C library seems to be in $tans, of all places."
5418                 libc=$tans
5419         else
5420                 libc='blurfl'
5421         fi
5422 fi
5423 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5424         dflt="$libc"
5425         cat <<EOM
5426
5427 If the guess above is wrong (which it might be if you're using a strange
5428 compiler, or your machine supports multiple models), you can override it here.
5429
5430 EOM
5431 else
5432         dflt=''
5433         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5434         cat >&4 <<EOM
5435 I can't seem to find your C library.  I've looked in the following places:
5436
5437 EOM
5438         $sed 's/^/      /' libpath
5439         cat <<EOM
5440
5441 None of these seems to contain your C library. I need to get its name...
5442
5443 EOM
5444 fi
5445 fn=f
5446 rp='Where is your C library?'
5447 . ./getfile
5448 libc="$ans"
5449
5450 echo " "
5451 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5452 set X `cat libnames`
5453 shift
5454 xxx=files
5455 case $# in 1) xxx=file; esac
5456 echo "Extracting names from the following $xxx for later perusal:" >&4
5457 echo " "
5458 $sed 's/^/      /' libnames >&4
5459 echo " "
5460 $echo $n "This may take a while...$c" >&4
5461
5462 for file in $*; do
5463         case $file in
5464         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5465         *) $nm $nm_opt $file 2>/dev/null;;
5466         esac
5467 done >libc.tmp
5468
5469 $echo $n ".$c"
5470 $grep fprintf libc.tmp > libc.ptf
5471 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5472 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5473 xxx='[ADTSIW]'
5474 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5475         eval $xscan;\
5476         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5477                 eval $xrun
5478 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5479         eval $xscan;\
5480         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5481                 eval $xrun
5482 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5483         eval $xscan;\
5484         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5485                 eval $xrun
5486 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5487         eval $xscan;\
5488         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5489                 eval $xrun
5490 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5491         eval $xscan;\
5492         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5493                 eval $xrun
5494 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5495         eval $xscan;\
5496         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5497                 eval $xrun
5498 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5499                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5500         eval $xscan;\
5501         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5502                 eval $xrun
5503 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5504         eval $xscan;\
5505         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5506                 eval $xrun
5507 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5508         eval $xscan;\
5509         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5510                 eval $xrun
5511 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5512         eval $xscan;\
5513         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5514                 eval $xrun
5515 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5516         eval $xscan;\
5517         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5518                 eval $xrun
5519 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5520         eval $xscan;\
5521         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5522                 eval $xrun
5523 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5524         eval $xscan;\
5525         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5526                 eval $xrun
5527 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5528         eval $xscan;\
5529         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5530                 eval $xrun
5531 else
5532         $nm -p $* 2>/dev/null >libc.tmp
5533         $grep fprintf libc.tmp > libc.ptf
5534         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5535                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5536         then
5537                 nm_opt='-p'
5538                 eval $xrun
5539         else
5540                 echo " "
5541                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5542                 com=''
5543                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5544                         for thisname in $libnames $libc; do
5545                                 $ar t $thisname >>libc.tmp
5546                         done
5547                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5548                         echo "Ok." >&4
5549                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5550                         # Repeat libc to extract forwarders to DLL entries too
5551                         for thisname in $libnames $libc; do
5552                                 $ar tv $thisname >>libc.tmp
5553                                 # Revision 50 of EMX has bug in $ar.
5554                                 # it will not extract forwarders to DLL entries
5555                                 # Use emximp which will extract exactly them.
5556                                 emximp -o tmp.imp $thisname \
5557                                     2>/dev/null && \
5558                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5559                                     < tmp.imp >>libc.tmp
5560                                 $rm tmp.imp
5561                         done
5562                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5563                         echo "Ok." >&4
5564                 else
5565                         echo "$ar didn't seem to work right." >&4
5566                         echo "Maybe this is a Cray...trying bld instead..." >&4
5567                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5568                         then
5569                                 for thisname in $libnames; do
5570                                         bld t $libnames | \
5571                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5572                                         $ar t $thisname >>libc.tmp
5573                                 done
5574                                 echo "Ok." >&4
5575                         else
5576                                 echo "That didn't work either.  Giving up." >&4
5577                                 exit 1
5578                         fi
5579                 fi
5580         fi
5581 fi
5582 nm_extract="$com"
5583 if $test -f /lib/syscalls.exp; then
5584         echo " "
5585         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5586         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
5587 fi
5588 ;;
5589 esac
5590 $rm -f libnames libpath
5591
5592 : is a C symbol defined?
5593 csym='tlook=$1;
5594 case "$3" in
5595 -v) tf=libc.tmp; tc=""; tdc="";;
5596 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5597 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5598 esac;
5599 tx=yes;
5600 case "$reuseval-$4" in
5601 true-) ;;
5602 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5603 esac;
5604 case "$tx" in
5605 yes)
5606         case "$runnm" in
5607         true)
5608                 if $contains $tlook $tf >/dev/null 2>&1;
5609                 then tval=true;
5610                 else tval=false;
5611                 fi;;
5612         *)
5613                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5614                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5615                 then tval=true;
5616                 else tval=false;
5617                 fi;
5618                 $rm -f t t.c;;
5619         esac;;
5620 *)
5621         case "$tval" in
5622         $define) tval=true;;
5623         *) tval=false;;
5624         esac;;
5625 esac;
5626 eval "$2=$tval"'
5627
5628 : define an is-in-libc? function
5629 inlibc='echo " "; td=$define; tu=$undef;
5630 sym=$1; var=$2; eval "was=\$$2";
5631 tx=yes;
5632 case "$reuseval$was" in
5633 true) ;;
5634 true*) tx=no;;
5635 esac;
5636 case "$tx" in
5637 yes)
5638         set $sym tres -f;
5639         eval $csym;
5640         case "$tres" in
5641         true)
5642                 echo "$sym() found." >&4;
5643                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5644         *)
5645                 echo "$sym() NOT found." >&4;
5646                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5647         esac;;
5648 *)
5649         case "$was" in
5650         $define) echo "$sym() found." >&4;;
5651         *) echo "$sym() NOT found." >&4;;
5652         esac;;
5653 esac'
5654
5655 : see if sqrtl exists
5656 set sqrtl d_sqrtl
5657 eval $inlibc
5658
5659 case "$ccflags" in
5660 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5661 esac
5662
5663 case "$uselongdouble" in
5664 $define|true|[yY]*)     dflt='y';;
5665 *) dflt='n';;
5666 esac
5667 cat <<EOM
5668
5669 Perl can be built to take advantage of long doubles which
5670 (if available) may give more accuracy and range for floating point numbers.
5671
5672 If this doesn't make any sense to you, just accept the default '$dflt'.
5673 EOM
5674 rp='Try to use long doubles if available?'
5675 . ./myread
5676 case "$ans" in
5677 y|Y)    val="$define"   ;;
5678 *)      val="$undef"    ;;
5679 esac
5680 set uselongdouble
5681 eval $setvar
5682
5683 case "$uselongdouble" in
5684 true|[yY]*) uselongdouble="$define" ;;
5685 esac
5686
5687 case "$uselongdouble" in
5688 $define)
5689 : Look for a hint-file generated 'call-back-unit'.  If the
5690 : user has specified that long doubles should be used,
5691 : we may need to set or change some other defaults.
5692         if $test -f uselongdouble.cbu; then
5693                 echo "Your platform has some specific hints for long doubles, using them..."
5694                 . ./uselongdouble.cbu
5695         else
5696                 $cat <<EOM
5697 (Your platform doesn't have any specific hints for long doubles.)
5698 EOM
5699         fi
5700         ;;
5701 esac
5702
5703 case "$uselongdouble:$d_sqrtl" in
5704 $define:$undef)
5705                 $cat <<EOM >&4
5706
5707 *** You requested the use of long doubles but you do not seem to have
5708 *** the mathematic functions for long doubles.  I'm disabling the use
5709 *** of long doubles.
5710
5711 EOM
5712         uselongdouble=$undef
5713         ;;
5714 esac
5715
5716 : check for length of double
5717 echo " "
5718 case "$doublesize" in
5719 '')
5720         echo "Checking to see how big your double precision numbers are..." >&4
5721         $cat >try.c <<'EOCP'
5722 #include <stdio.h>
5723 int main()
5724 {
5725     printf("%d\n", (int)sizeof(double));
5726     exit(0);
5727 }
5728 EOCP
5729         set try
5730         if eval $compile_ok; then
5731                 doublesize=`$run ./try`
5732                 echo "Your double is $doublesize bytes long."
5733         else
5734                 dflt='8'
5735                 echo "(I can't seem to compile the test program.  Guessing...)"
5736                 rp="What is the size of a double precision number (in bytes)?"
5737                 . ./myread
5738                 doublesize="$ans"
5739         fi
5740         ;;
5741 esac
5742 $rm -f try.c try
5743
5744 : check for long doubles
5745 echo " "
5746 echo "Checking to see if you have long double..." >&4
5747 echo 'int main() { long double x = 7.0; }' > try.c
5748 set try
5749 if eval $compile; then
5750         val="$define"
5751         echo "You have long double."
5752 else
5753         val="$undef"
5754         echo "You do not have long double."
5755 fi
5756 $rm try.*
5757 set d_longdbl
5758 eval $setvar
5759
5760 : check for length of long double
5761 case "${d_longdbl}${longdblsize}" in
5762 $define)
5763         echo " "
5764         echo "Checking to see how big your long doubles are..." >&4
5765         $cat >try.c <<'EOCP'
5766 #include <stdio.h>
5767 int main()
5768 {
5769         printf("%d\n", sizeof(long double));
5770 }
5771 EOCP
5772         set try
5773         set try
5774         if eval $compile; then
5775                 longdblsize=`$run ./try`
5776                 echo "Your long doubles are $longdblsize bytes long."
5777         else
5778                 dflt='8'
5779                 echo " "
5780                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5781                 rp="What is the size of a long double (in bytes)?"
5782                 . ./myread
5783                 longdblsize="$ans"
5784         fi
5785         if $test "X$doublesize" = "X$longdblsize"; then
5786                 echo "(That isn't any different from an ordinary double.)"
5787         fi      
5788         ;;
5789 esac
5790 $rm -f try.* try
5791
5792 case "$useperlio" in
5793 $define|true|[yY]*|'')  dflt='y';;
5794 *) dflt='n';;
5795 esac
5796 cat <<EOM
5797
5798 Previous version of $package used the standard IO mechanisms as
5799 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
5800 alternate IO mechanisms via the PerlIO abstraction layer, but the
5801 stdio mechanism is still available if needed.  The abstraction layer
5802 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
5803 Using PerlIO with sfio may cause problems with some extension modules.
5804
5805 If this doesn't make any sense to you, just accept the default '$dflt'.
5806 EOM
5807 rp='Use the PerlIO abstraction layer?'
5808 . ./myread
5809 case "$ans" in
5810 y|Y) 
5811         val="$define"
5812         ;;
5813 *)      
5814         echo "Ok, doing things the stdio way."
5815         val="$undef"
5816         ;;
5817 esac
5818 set useperlio
5819 eval $setvar 
5820
5821 case "$usesocks" in
5822 $define|true|[yY]*)
5823         case "$useperlio" in
5824         $define|true|[yY]*) ;;
5825         *)      cat >&4 <<EOM
5826
5827 You are using the SOCKS proxy protocol library which means that you
5828 should also use the PerlIO layer.  You may be headed for trouble.
5829
5830 EOM
5831                 ;;
5832         esac
5833         ;;
5834 esac
5835
5836         
5837 : determine the architecture name
5838 echo " "
5839 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5840         tarch=`arch`"-$osname"
5841 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5842         if uname -m > tmparch 2>&1 ; then
5843                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5844                         -e 's/$/'"-$osname/" tmparch`
5845         else
5846                 tarch="$osname"
5847         fi
5848         $rm -f tmparch
5849 else
5850         tarch="$osname"
5851 fi
5852 case "$myarchname" in
5853 ''|"$tarch") ;;
5854 *)
5855         echo "(Your architecture name used to be $myarchname.)"
5856         archname=''
5857         ;;
5858 esac
5859 case "$targetarch" in
5860 '') ;;
5861 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5862 esac
5863 myarchname="$tarch"
5864 case "$archname" in
5865 '') dflt="$tarch";;
5866 *) dflt="$archname";;
5867 esac
5868 rp='What is your architecture name'
5869 . ./myread
5870 archname="$ans"
5871 case "$usethreads" in
5872 $define)
5873         echo "Threads selected." >&4
5874         case "$archname" in
5875         *-thread*) echo "...and architecture name already has -thread." >&4
5876                 ;;
5877         *)      archname="$archname-thread"
5878                 echo "...setting architecture name to $archname." >&4
5879                 ;;
5880         esac
5881         ;;
5882 esac
5883 case "$usemultiplicity" in
5884 $define)
5885         echo "Multiplicity selected." >&4
5886         case "$archname" in
5887         *-multi*) echo "...and architecture name already has -multi." >&4
5888                 ;;
5889         *)      archname="$archname-multi"
5890                 echo "...setting architecture name to $archname." >&4
5891                 ;;
5892         esac
5893         ;;
5894 esac
5895 case "$use64bitint$use64bitall" in
5896 *"$define"*)
5897         case "$archname64" in
5898         '')
5899                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5900                 ;;
5901         *)
5902                 case "$use64bitint" in
5903                 "$define") echo "64 bit integers selected." >&4 ;;
5904                 esac
5905                 case "$use64bitall" in
5906                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5907                 esac
5908                 case "$archname" in
5909                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5910                         ;;
5911                 *)      archname="$archname-$archname64"
5912                         echo "...setting architecture name to $archname." >&4
5913                         ;;
5914                 esac
5915                 ;;
5916         esac
5917 esac
5918 case "$uselongdouble" in
5919 $define)
5920         echo "Long doubles selected." >&4
5921         case "$longdblsize" in
5922         $doublesize)
5923                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5924                 ;;
5925         *)
5926                 case "$archname" in
5927                 *-ld*) echo "...and architecture name already has -ld." >&4
5928                         ;;
5929                 *)      archname="$archname-ld"
5930                         echo "...setting architecture name to $archname." >&4
5931                         ;;
5932                 esac
5933                 ;;
5934         esac
5935         ;;
5936 esac
5937 case "$useperlio" in
5938 $define)
5939         echo "Perlio selected." >&4
5940         ;;
5941 *)
5942         echo "Perlio not selected, using stdio." >&4
5943         case "$archname" in
5944         *-stdio*) echo "...and architecture name already has -stdio." >&4
5945                 ;;
5946         *)      archname="$archname-stdio"
5947                 echo "...setting architecture name to $archname." >&4
5948                 ;;
5949         esac
5950         ;;
5951 esac
5952
5953 : determine root of directory hierarchy where package will be installed.
5954 case "$prefix" in
5955 '')
5956         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5957         ;;
5958 *)
5959         dflt="$prefix"
5960         ;;
5961 esac
5962 $cat <<EOM
5963
5964 By default, $package will be installed in $dflt/bin, manual pages
5965 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5966 installation directories. Typically this is something like /usr/local.
5967 If you wish to have binaries under /usr/bin but other parts of the
5968 installation under /usr/local, that's ok: you will be prompted
5969 separately for each of the installation directories, the prefix being
5970 only used to set the defaults.
5971
5972 EOM
5973 fn=d~
5974 rp='Installation prefix to use?'
5975 . ./getfile
5976 oldprefix=''
5977 case "$prefix" in
5978 '') ;;
5979 *)
5980         case "$ans" in
5981         "$prefix") ;;
5982         *) oldprefix="$prefix";;
5983         esac
5984         ;;
5985 esac
5986 prefix="$ans"
5987 prefixexp="$ansexp"
5988
5989 case "$afsroot" in
5990 '')     afsroot=/afs ;;
5991 *)      afsroot=$afsroot ;;
5992 esac
5993
5994 : is AFS running?
5995 echo " "
5996 case "$afs" in
5997 $define|true)   afs=true ;;
5998 $undef|false)   afs=false ;;
5999 *)      if test -d $afsroot; then
6000                 afs=true
6001         else
6002                 afs=false
6003         fi
6004         ;;
6005 esac
6006 if $afs; then
6007         echo "AFS may be running... I'll be extra cautious then..." >&4
6008 else
6009         echo "AFS does not seem to be running..." >&4
6010 fi
6011
6012 : determine installation prefix for where package is to be installed.
6013 if $afs; then 
6014 $cat <<EOM
6015
6016 Since you are running AFS, I need to distinguish the directory in which
6017 files will reside from the directory in which they are installed (and from
6018 which they are presumably copied to the former directory by occult means).
6019
6020 EOM
6021         case "$installprefix" in
6022         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6023         *) dflt="$installprefix";;
6024         esac
6025 else
6026 $cat <<EOM
6027
6028 In some special cases, particularly when building $package for distribution,
6029 it is convenient to distinguish between the directory in which files should 
6030 be installed from the directory ($prefix) in which they 
6031 will eventually reside.  For most users, these two directories are the same.
6032
6033 EOM
6034         case "$installprefix" in
6035         '') dflt=$prefix ;;
6036         *) dflt=$installprefix;;
6037         esac
6038 fi
6039 fn=d~
6040 rp='What installation prefix should I use for installing files?'
6041 . ./getfile
6042 installprefix="$ans"
6043 installprefixexp="$ansexp"
6044
6045 : set the prefixit variable, to compute a suitable default value
6046 prefixit='case "$3" in
6047 ""|none)
6048         case "$oldprefix" in
6049         "") eval "$1=\"\$$2\"";;
6050         *)
6051                 case "$3" in
6052                 "") eval "$1=";;
6053                 none)
6054                         eval "tp=\"\$$2\"";
6055                         case "$tp" in
6056                         ""|" ") eval "$1=\"\$$2\"";;
6057                         *) eval "$1=";;
6058                         esac;;
6059                 esac;;
6060         esac;;
6061 *)
6062         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6063         case "$tp" in
6064         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6065         /*-$oldprefix/*|\~*-$oldprefix/*)
6066                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6067         *) eval "$1=\"\$$2\"";;
6068         esac;;
6069 esac'
6070
6071 : get the patchlevel
6072 echo " "
6073 echo "Getting the current patchlevel..." >&4
6074 if $test -r $rsrc/patchlevel.h;then
6075         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6076         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6077         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6078         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6079         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6080         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6081        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6082 else
6083         revision=0
6084         patchlevel=0
6085         subversion=0
6086         api_revision=0
6087         api_version=0
6088         api_subversion=0
6089         perl_patchlevel=0
6090         $echo "(You do not have patchlevel.h.  Eek.)"
6091 fi
6092 if $test -r $rsrc/.patch ; then  
6093         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6094                 perl_patchlevel=`cat $rsrc/.patch`
6095         fi
6096 fi
6097 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
6098 version_patchlevel_string="version $patchlevel subversion $subversion"
6099 case "$perl_patchlevel" in
6100 0|'') ;;
6101 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
6102 esac
6103
6104 $echo "(You have $package $version_patchlevel_string.)"
6105
6106 case "$osname" in
6107 dos|vms)
6108         : XXX Should be a Configure test for double-dots in filenames.
6109         version=`echo $revision $patchlevel $subversion | \
6110                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6111         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6112                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6113         ;;
6114 *)
6115         version=`echo $revision $patchlevel $subversion | \
6116                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6117         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6118                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6119         ;;
6120 esac
6121 : Special case the 5.005_xx maintenance series, which used 5.005
6122 : without any subversion label as a subdirectory in $sitelib
6123 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6124         api_versionstring='5.005'
6125 fi
6126
6127 : determine installation style
6128 : For now, try to deduce it from prefix unless it is already set.
6129 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6130 case "$installstyle" in
6131 '')     case "$prefix" in
6132                 *perl*) dflt='lib';;
6133                 *) dflt='lib/perl5' ;;
6134         esac
6135         ;;
6136 *)      dflt="$installstyle" ;;
6137 esac
6138 : Probably not worth prompting for this since we prompt for all
6139 : the directories individually, and the prompt would be too long and
6140 : confusing anyway.
6141 installstyle=$dflt
6142
6143 : determine where private library files go
6144 : Usual default is /usr/local/lib/perl5/$version.
6145 : Also allow things like /opt/perl/lib/$version, since 
6146 : /opt/perl/lib/perl5... would be redundant.
6147 : The default "style" setting is made in installstyle.U
6148 case "$installstyle" in
6149 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6150 *)       set dflt privlib lib/$version ;;
6151 esac
6152 eval $prefixit
6153 $cat <<EOM
6154
6155 There are some auxiliary files for $package that need to be put into a
6156 private library directory that is accessible by everyone.
6157
6158 EOM
6159 fn=d~+
6160 rp='Pathname where the private library files will reside?'
6161 . ./getfile
6162 privlib="$ans"
6163 privlibexp="$ansexp"
6164 : Change installation prefix, if necessary.
6165 if $test X"$prefix" != X"$installprefix"; then
6166         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6167 else
6168         installprivlib="$privlibexp"
6169 fi
6170
6171 : set the prefixup variable, to restore leading tilda escape
6172 prefixup='case "$prefixexp" in
6173 "$prefix") ;;
6174 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6175 esac'
6176
6177 : determine where public architecture dependent libraries go
6178 set archlib archlib
6179 eval $prefixit
6180 : privlib default is /usr/local/lib/$package/$version
6181 : archlib default is /usr/local/lib/$package/$version/$archname
6182 : privlib may have an optional trailing /share.
6183 tdflt=`echo $privlib | $sed 's,/share$,,'`
6184 tdflt=$tdflt/$archname
6185 case "$archlib" in
6186 '')     dflt=$tdflt
6187         ;;
6188 *)      dflt="$archlib"
6189     ;;
6190 esac
6191 $cat <<EOM
6192
6193 $spackage contains architecture-dependent library files.  If you are
6194 sharing libraries in a heterogeneous environment, you might store
6195 these files in a separate location.  Otherwise, you can just include
6196 them with the rest of the public library files.
6197
6198 EOM
6199 fn=d+~
6200 rp='Where do you want to put the public architecture-dependent libraries?'
6201 . ./getfile
6202 archlib="$ans"
6203 archlibexp="$ansexp"
6204 if $test X"$archlib" = X"$privlib"; then
6205         d_archlib="$undef"
6206 else
6207         d_archlib="$define"
6208 fi
6209 : Change installation prefix, if necessary.
6210 if $test X"$prefix" != X"$installprefix"; then
6211         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6212 else
6213         installarchlib="$archlibexp"
6214 fi
6215
6216
6217 : Binary compatibility with 5.005 is not possible for builds
6218 : with advanced features
6219 case "$usethreads$usemultiplicity" in
6220 *define*)
6221         bincompat5005="$undef"
6222         d_bincompat5005="$undef"
6223         ;;
6224 *)      $cat <<EOM
6225
6226 This version of Perl can be compiled for binary compatibility with 5.005.
6227 If you decide to do so, you will be able to continue using most of the
6228 extensions that were compiled for Perl 5.005.
6229
6230 EOM
6231         case "$bincompat5005$d_bincompat5005" in
6232         *"$undef"*) dflt=n ;;
6233         *) dflt=y ;;
6234         esac
6235         rp='Binary compatibility with Perl 5.005?'
6236         . ./myread
6237         case "$ans" in
6238         y*) val="$define" ;;
6239         *)  val="$undef" ;;
6240         esac
6241         set d_bincompat5005
6242         eval $setvar
6243         case "$d_bincompat5005" in
6244         "$define")
6245                 bincompat5005="$define"
6246                 ;;
6247         *)      bincompat5005="$undef"
6248                 d_bincompat5005="$undef"
6249                 ;;
6250         esac
6251         ;;
6252 esac
6253
6254
6255 : see if setuid scripts can be secure
6256 $cat <<EOM
6257
6258 Some kernels have a bug that prevents setuid #! scripts from being
6259 secure.  Some sites have disabled setuid #! scripts because of this.
6260
6261 First let's decide if your kernel supports secure setuid #! scripts.
6262 (If setuid #! scripts would be secure but have been disabled anyway,
6263 don't say that they are secure if asked.)
6264
6265 EOM
6266
6267 val="$undef"
6268 if $test -d /dev/fd; then
6269         echo "#!$ls" >reflect
6270         chmod +x,u+s reflect
6271         ./reflect >flect 2>&1
6272         if $contains "/dev/fd" flect >/dev/null; then
6273                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6274                 val="$define"
6275         else
6276                 $cat <<EOM
6277 If you are not sure if they are secure, I can check but I'll need a
6278 username and password different from the one you are using right now.
6279 If you don't have such a username or don't want me to test, simply
6280 enter 'none'.
6281
6282 EOM
6283                 rp='Other username to test security of setuid scripts with?'
6284                 dflt='none'
6285                 . ./myread
6286                 case "$ans" in
6287                 n|none)
6288                         case "$d_suidsafe" in
6289                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6290                                 dflt=n;;
6291                         "$undef")
6292                                 echo "Well, the $hint value is *not* secure." >&4
6293                                 dflt=n;;
6294                         *)      echo "Well, the $hint value *is* secure." >&4
6295                                 dflt=y;;
6296                         esac
6297                         ;;
6298                 *)
6299                         $rm -f reflect flect
6300                         echo "#!$ls" >reflect
6301                         chmod +x,u+s reflect
6302                         echo >flect
6303                         chmod a+w flect
6304                         echo '"su" will (probably) prompt you for '"$ans's password."
6305                         su $ans -c './reflect >flect'
6306                         if $contains "/dev/fd" flect >/dev/null; then
6307                                 echo "Okay, it looks like setuid scripts are secure." >&4
6308                                 dflt=y
6309                         else
6310                                 echo "I don't think setuid scripts are secure." >&4
6311                                 dflt=n
6312                         fi
6313                         ;;
6314                 esac
6315                 rp='Does your kernel have *secure* setuid scripts?'
6316                 . ./myread
6317                 case "$ans" in
6318                 [yY]*)  val="$define";;
6319                 *)      val="$undef";;
6320                 esac
6321         fi
6322 else
6323         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6324         echo "(That's for file descriptors, not floppy disks.)"
6325         val="$undef"
6326 fi
6327 set d_suidsafe
6328 eval $setvar
6329
6330 $rm -f reflect flect
6331
6332 : now see if they want to do setuid emulation
6333 echo " "
6334 val="$undef"
6335 case "$d_suidsafe" in
6336 "$define")
6337         val="$undef"
6338         echo "No need to emulate SUID scripts since they are secure here." >& 4
6339         ;;
6340 *)
6341         $cat <<EOM
6342 Some systems have disabled setuid scripts, especially systems where
6343 setuid scripts cannot be secure.  On systems where setuid scripts have
6344 been disabled, the setuid/setgid bits on scripts are currently
6345 useless.  It is possible for $package to detect those bits and emulate
6346 setuid/setgid in a secure fashion.  This emulation will only work if
6347 setuid scripts have been disabled in your kernel.
6348
6349 EOM
6350         case "$d_dosuid" in
6351         "$define") dflt=y ;;
6352         *) dflt=n ;;
6353         esac
6354         rp="Do you want to do setuid/setgid emulation?"
6355         . ./myread
6356         case "$ans" in
6357         [yY]*)  val="$define";;
6358         *)      val="$undef";;
6359         esac
6360         ;;
6361 esac
6362 set d_dosuid
6363 eval $setvar
6364
6365 : see if this is a malloc.h system
6366 set malloc.h i_malloc
6367 eval $inhdr
6368
6369 : see if stdlib is available
6370 set stdlib.h i_stdlib
6371 eval $inhdr
6372
6373 : determine which malloc to compile in
6374 echo " "
6375 case "$usemymalloc" in
6376 [yY]*|true|$define)     dflt='y' ;;
6377 [nN]*|false|$undef)     dflt='n' ;;
6378 *)      case "$ptrsize" in
6379         4) dflt='y' ;;
6380         *) dflt='n' ;;
6381         esac
6382         ;;
6383 esac
6384 rp="Do you wish to attempt to use the malloc that comes with $package?"
6385 . ./myread
6386 usemymalloc="$ans"
6387 case "$ans" in
6388 y*|true)
6389         usemymalloc='y'
6390         mallocsrc='malloc.c'
6391         mallocobj="malloc$_o"
6392         d_mymalloc="$define"
6393         case "$libs" in
6394         *-lmalloc*)
6395                 : Remove malloc from list of libraries to use
6396                 echo "Removing unneeded -lmalloc from library list" >&4
6397                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6398                 shift
6399                 libs="$*"
6400                 echo "libs = $libs" >&4
6401                 ;;
6402         esac
6403         ;;
6404 *)
6405         usemymalloc='n'
6406         mallocsrc=''
6407         mallocobj=''
6408         d_mymalloc="$undef"
6409         ;;
6410 esac
6411
6412 : compute the return types of malloc and free
6413 echo " "
6414 $cat >malloc.c <<END
6415 #$i_malloc I_MALLOC
6416 #$i_stdlib I_STDLIB
6417 #include <stdio.h>
6418 #include <sys/types.h>
6419 #ifdef I_MALLOC
6420 #include <malloc.h>
6421 #endif
6422 #ifdef I_STDLIB
6423 #include <stdlib.h>
6424 #endif
6425 #ifdef TRY_MALLOC
6426 void *malloc();
6427 #endif
6428 #ifdef TRY_FREE
6429 void free();
6430 #endif
6431 END
6432 case "$malloctype" in
6433 '')
6434         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6435                 malloctype='void *'
6436         else
6437                 malloctype='char *'
6438         fi
6439         ;;
6440 esac
6441 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6442
6443 case "$freetype" in
6444 '')
6445         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6446                 freetype='void'
6447         else
6448                 freetype='int'
6449         fi
6450         ;;
6451 esac
6452 echo "Your system uses $freetype free(), it would seem." >&4
6453 $rm -f malloc.[co]
6454 $cat <<EOM
6455
6456 After $package is installed, you may wish to install various
6457 add-on modules and utilities.  Typically, these add-ons will
6458 be installed under $prefix with the rest
6459 of this package.  However, you may wish to install such add-ons
6460 elsewhere under a different prefix.
6461
6462 If you do not wish to put everything under a single prefix, that's
6463 ok.  You will be prompted for the individual locations; this siteprefix
6464 is only used to suggest the defaults.
6465
6466 The default should be fine for most people.
6467
6468 EOM
6469 fn=d~+
6470 rp='Installation prefix to use for add-on modules and utilities?'
6471 : XXX Here might be another good place for an installstyle setting.
6472 case "$siteprefix" in
6473 '') dflt=$prefix ;;
6474 *)  dflt=$siteprefix ;;
6475 esac
6476 . ./getfile
6477 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6478 oldsiteprefix=''
6479 case "$siteprefix" in
6480 '') ;;
6481 *)      case "$ans" in
6482         "$prefix") ;;
6483         *) oldsiteprefix="$prefix";;
6484         esac
6485         ;;
6486 esac
6487 siteprefix="$ans"
6488 siteprefixexp="$ansexp"
6489
6490 : determine where site specific libraries go.
6491 : Usual default is /usr/local/lib/perl5/site_perl/$version
6492 : The default "style" setting is made in installstyle.U
6493 : XXX No longer works with Prefixit stuff.
6494 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6495 case "$sitelib" in
6496 '') case "$installstyle" in
6497         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6498         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6499         esac
6500         ;;
6501 *)      dflt="$sitelib"
6502         ;;
6503 esac
6504 $cat <<EOM
6505
6506 The installation process will create a directory for
6507 site-specific extensions and modules.  Most users find it convenient
6508 to place all site-specific files in this directory rather than in the
6509 main distribution directory.
6510
6511 EOM
6512 fn=d~+
6513 rp='Pathname for the site-specific library files?'
6514 . ./getfile
6515 sitelib="$ans"
6516 sitelibexp="$ansexp"
6517 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6518 : Change installation prefix, if necessary.
6519 if $test X"$prefix" != X"$installprefix"; then
6520         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6521 else
6522         installsitelib="$sitelibexp"
6523 fi
6524
6525 : determine where site specific architecture-dependent libraries go.
6526 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6527 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6528 : sitelib may have an optional trailing /share.
6529 case "$sitearch" in
6530 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6531         dflt="$dflt/$archname"
6532         ;;
6533 *)      dflt="$sitearch"
6534         ;;
6535 esac
6536 set sitearch sitearch none
6537 eval $prefixit
6538 $cat <<EOM
6539
6540 The installation process will also create a directory for
6541 architecture-dependent site-specific extensions and modules.
6542
6543 EOM
6544 fn=d~+
6545 rp='Pathname for the site-specific architecture-dependent library files?'
6546 . ./getfile
6547 sitearch="$ans"
6548 sitearchexp="$ansexp"
6549 : Change installation prefix, if necessary.
6550 if $test X"$prefix" != X"$installprefix"; then
6551         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6552 else
6553         installsitearch="$sitearchexp"
6554 fi
6555
6556 $cat <<EOM
6557
6558 The installation process will also create a directory for
6559 vendor-supplied add-ons.  Vendors who supply perl with their system
6560 may find it convenient to place all vendor-supplied files in this
6561 directory rather than in the main distribution directory.  This will
6562 ease upgrades between binary-compatible maintenance versions of perl.
6563
6564 Of course you may also use these directories in whatever way you see
6565 fit.  For example, you might use them to access modules shared over a
6566 company-wide network.
6567
6568 The default answer should be fine for most people.
6569 This causes further questions about vendor add-ons to be skipped
6570 and no vendor-specific directories will be configured for perl.
6571
6572 EOM
6573 rp='Do you want to configure vendor-specific add-on directories?'
6574 case "$usevendorprefix" in
6575 define|true|[yY]*) dflt=y ;;
6576 *)      : User may have set vendorprefix directly on Configure command line.
6577         case "$vendorprefix" in
6578         ''|' ') dflt=n ;;
6579         *)      dflt=y ;;
6580         esac
6581         ;;
6582 esac
6583 . ./myread
6584 case "$ans" in
6585 [yY]*)  fn=d~+
6586         rp='Installation prefix to use for vendor-supplied add-ons?'
6587         case "$vendorprefix" in
6588         '') dflt='' ;;
6589         *)  dflt=$vendorprefix ;;
6590         esac
6591         . ./getfile
6592         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6593         oldvendorprefix=''
6594         case "$vendorprefix" in
6595         '') ;;
6596         *)      case "$ans" in
6597                 "$prefix") ;;
6598                 *) oldvendorprefix="$prefix";;
6599                 esac
6600                 ;;
6601         esac
6602         usevendorprefix="$define"
6603         vendorprefix="$ans"
6604         vendorprefixexp="$ansexp"
6605         ;;
6606 *)      usevendorprefix="$undef"
6607         vendorprefix=''
6608         vendorprefixexp=''
6609         ;;
6610 esac
6611
6612 case "$vendorprefix" in
6613 '')     d_vendorlib="$undef"
6614         vendorlib=''
6615         vendorlibexp=''
6616         ;;
6617 *)      d_vendorlib="$define"
6618         : determine where vendor-supplied modules go.
6619         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6620         case "$vendorlib" in
6621         '')
6622                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6623                 case "$installstyle" in
6624                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6625                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6626                 esac
6627                 ;;
6628         *)      dflt="$vendorlib"
6629                 ;;
6630         esac
6631         fn=d~+
6632         rp='Pathname for the vendor-supplied library files?'
6633         . ./getfile
6634         vendorlib="$ans"
6635         vendorlibexp="$ansexp"
6636         ;;
6637 esac
6638 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6639 : Change installation prefix, if necessary.
6640 if $test X"$prefix" != X"$installprefix"; then
6641         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6642 else
6643         installvendorlib="$vendorlibexp"
6644 fi
6645
6646 case "$vendorprefix" in
6647 '')     d_vendorarch="$undef"
6648         vendorarch=''
6649         vendorarchexp=''
6650         ;;
6651 *)      d_vendorarch="$define"
6652         : determine where vendor-supplied architecture-dependent libraries go.
6653         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6654         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6655         : vendorlib may have an optional trailing /share.
6656         case "$vendorarch" in
6657         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6658                 dflt="$dflt/$archname"
6659                 ;;
6660         *)      dflt="$vendorarch" ;;
6661         esac
6662         fn=d~+
6663         rp='Pathname for vendor-supplied architecture-dependent files?'
6664         . ./getfile
6665         vendorarch="$ans"
6666         vendorarchexp="$ansexp"
6667         ;;
6668 esac
6669 : Change installation prefix, if necessary.
6670 if $test X"$prefix" != X"$installprefix"; then
6671         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6672 else
6673         installvendorarch="$vendorarchexp"
6674 fi
6675
6676 : Final catch-all directories to search
6677 $cat <<EOM
6678
6679 Lastly, you can have perl look in other directories for extensions and
6680 modules in addition to those already specified.
6681 These directories will be searched after 
6682         $sitearch 
6683         $sitelib 
6684 EOM
6685 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6686 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6687 echo ' '
6688 case "$otherlibdirs" in
6689 ''|' ') dflt='none' ;;
6690 *)      dflt="$otherlibdirs" ;;
6691 esac
6692 $cat <<EOM
6693 Enter a colon-separated set of extra paths to include in perl's @INC
6694 search path, or enter 'none' for no extra paths.
6695
6696 EOM
6697
6698 rp='Colon-separated list of additional directories for perl to search?'
6699 . ./myread
6700 case "$ans" in
6701 ' '|''|none)    otherlibdirs=' ' ;;     
6702 *)      otherlibdirs="$ans" ;;
6703 esac
6704 case "$otherlibdirs" in
6705 ' ') val=$undef ;;
6706 *)      val=$define ;;
6707 esac
6708 set d_perl_otherlibdirs
6709 eval $setvar
6710
6711 : Cruising for prototypes
6712 echo " "
6713 echo "Checking out function prototypes..." >&4
6714 $cat >prototype.c <<'EOCP'
6715 int main(int argc, char *argv[]) {
6716         exit(0);}
6717 EOCP
6718 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6719         echo "Your C compiler appears to support function prototypes."
6720         val="$define"
6721 else
6722         echo "Your C compiler doesn't seem to understand function prototypes."
6723         val="$undef"
6724 fi
6725 set prototype
6726 eval $setvar
6727 $rm -f prototype*
6728
6729 case "$prototype" in
6730 "$define") ;;
6731 *)      ansi2knr='ansi2knr'
6732         echo " "
6733         cat <<EOM >&4
6734
6735 $me:  FATAL ERROR:
6736 This version of $package can only be compiled by a compiler that 
6737 understands function prototypes.  Unfortunately, your C compiler 
6738         $cc $ccflags
6739 doesn't seem to understand them.  Sorry about that.
6740
6741 If GNU cc is available for your system, perhaps you could try that instead.  
6742
6743 Eventually, we hope to support building Perl with pre-ANSI compilers.
6744 If you would like to help in that effort, please contact <perlbug@perl.org>.
6745
6746 Aborting Configure now.
6747 EOM
6748         exit 2
6749         ;;
6750 esac
6751
6752 : determine where public executables go
6753 echo " "
6754 set dflt bin bin
6755 eval $prefixit
6756 fn=d~
6757 rp='Pathname where the public executables will reside?'
6758 . ./getfile
6759 if $test "X$ansexp" != "X$binexp"; then
6760         installbin=''
6761 fi
6762 bin="$ans"
6763 binexp="$ansexp"
6764 : Change installation prefix, if necessary.
6765 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6766 if $test X"$prefix" != X"$installprefix"; then
6767         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6768 else
6769         installbin="$binexp"
6770 fi
6771
6772 echo " "
6773 case "$extras" in
6774 '') dflt='n';;
6775 *) dflt='y';;
6776 esac
6777 cat <<EOM
6778 Perl can be built with extra modules or bundles of modules which
6779 will be fetched from the CPAN and installed alongside Perl.
6780
6781 Notice that you will need access to the CPAN; either via the Internet,
6782 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
6783 be asked later to configure the CPAN.pm module which will in turn do
6784 the installation of the rest of the extra modules or bundles.)
6785
6786 Notice also that if the modules require any external software such as
6787 libraries and headers (the libz library and the zlib.h header for the
6788 Compress::Zlib module, for example) you MUST have any such software
6789 already installed, this configuration process will NOT install such
6790 things for you.
6791
6792 If this doesn't make any sense to you, just accept the default '$dflt'.
6793 EOM
6794 rp='Install any extra modules (y or n)?'
6795 . ./myread
6796 case "$ans" in
6797 y|Y)
6798         cat <<EOM
6799
6800 Please list any extra modules or bundles to be installed from CPAN,
6801 with spaces between the names.  The names can be in any format the
6802 'install' command of CPAN.pm will understand.  (Answer 'none',
6803 without the quotes, to install no extra modules or bundles.)
6804 EOM
6805         rp='Extras?'
6806         dflt="$extras"
6807         . ./myread
6808         extras="$ans"
6809 esac
6810 case "$extras" in
6811 ''|'none')
6812         val=''
6813         $rm -f ../extras.lst
6814         ;;
6815 *)      echo "(Saving the list of extras for later...)"
6816         echo "$extras" > ../extras.lst
6817         val="'$extras'"
6818         ;;
6819 esac
6820 set extras
6821 eval $setvar
6822 echo " "
6823
6824 : Find perl5.005 or later.
6825 echo "Looking for a previously installed perl5.005 or later... "
6826 case "$perl5" in
6827 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6828                 : Check if this perl is recent and can load a simple module
6829                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6830                         perl5=$tdir/perl
6831                         break;
6832                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6833                         perl5=$tdir/perl5
6834                         break;
6835                 fi
6836         done
6837         ;;
6838 *)      perl5="$perl5"
6839         ;;
6840 esac
6841 case "$perl5" in
6842 '')     echo "None found.  That's ok.";;
6843 *)      echo "Using $perl5." ;;
6844 esac
6845
6846 : Determine list of previous versions to include in @INC
6847 $cat > getverlist <<EOPL
6848 #!$perl5 -w
6849 use File::Basename;
6850 \$api_versionstring = "$api_versionstring";
6851 \$version = "$version";
6852 \$stem = "$sitelib_stem";
6853 \$archname = "$archname";
6854 EOPL
6855         $cat >> getverlist <<'EOPL'
6856 # Can't have leading @ because metaconfig interprets it as a command!
6857 ;@inc_version_list=();
6858 # XXX Redo to do opendir/readdir? 
6859 if (-d $stem) {
6860     chdir($stem);
6861     ;@candidates = glob("5.*");
6862 }
6863 else {
6864     ;@candidates = ();
6865 }
6866
6867 # XXX ToDo:  These comparisons must be reworked when two-digit
6868 # subversions come along, so that 5.7.10 compares as greater than
6869 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6870 # widespread that we can use the built-in version vectors rather
6871 # than reinventing them here.  For 5.6.0, however, we must
6872 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6873 foreach $d (@candidates) {
6874     if ($d lt $version) {
6875         if ($d ge $api_versionstring) {
6876             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6877         }
6878         elsif ($d ge "5.005") {
6879             unshift(@inc_version_list, grep { -d } $d);
6880         }
6881     }
6882     else {
6883         # Skip newer version.  I.e. don't look in
6884         # 5.7.0 if we're installing 5.6.1.
6885     }
6886 }
6887
6888 if (@inc_version_list) {
6889     print join(' ', @inc_version_list);
6890 }
6891 else {
6892     # Blank space to preserve value for next Configure run.
6893     print " ";
6894 }
6895 EOPL
6896 chmod +x getverlist
6897 case "$inc_version_list" in
6898 '')     if test -x "$perl5$exe_ext"; then
6899                 dflt=`$perl5 getverlist`
6900         else
6901                 dflt='none'
6902         fi
6903         ;;
6904 $undef) dflt='none' ;;
6905 *)  eval dflt=\"$inc_version_list\" ;;
6906 esac
6907 case "$dflt" in
6908 ''|' ') dflt=none ;;
6909 esac
6910 case "$dflt" in
6911 5.005) case "$bincompat5005" in
6912        $define|true|[yY]*) ;;
6913        *) dflt=none ;;
6914        esac
6915        ;;
6916 esac
6917 $cat <<'EOM'
6918
6919 In order to ease the process of upgrading, this version of perl 
6920 can be configured to use modules built and installed with earlier 
6921 versions of perl that were installed under $prefix.  Specify here
6922 the list of earlier versions that this version of perl should check.
6923 If Configure detected no earlier versions of perl installed under
6924 $prefix, then the list will be empty.  Answer 'none' to tell perl
6925 to not search earlier versions.
6926
6927 The default should almost always be sensible, so if you're not sure,
6928 just accept the default.
6929 EOM
6930
6931 rp='List of earlier versions to include in @INC?'
6932 . ./myread
6933 case "$ans" in
6934 [Nn]one|''|' ') inc_version_list=' ' ;;
6935 *) inc_version_list="$ans" ;;
6936 esac
6937 case "$inc_version_list" in
6938 ''|' ') 
6939         inc_version_list_init='0';;
6940 *)      inc_version_list_init=`echo $inc_version_list |
6941                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6942         ;;
6943 esac
6944 $rm -f getverlist
6945
6946 : determine whether to install perl also as /usr/bin/perl
6947
6948 echo " "
6949 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6950         $cat <<EOM
6951 Many scripts expect perl to be installed as /usr/bin/perl.
6952 I can install the perl you are about to compile also as /usr/bin/perl
6953 (in addition to $installbin/perl).
6954 EOM
6955         case "$installusrbinperl" in
6956         "$undef"|[nN]*) dflt='n';;
6957         *)              dflt='y';;
6958         esac
6959         rp="Do you want to install perl as /usr/bin/perl?"
6960         . ./myread
6961         case "$ans" in
6962         [yY]*)  val="$define";;
6963         *)      val="$undef" ;;
6964         esac
6965 else
6966         val="$undef"
6967 fi
6968 set installusrbinperl
6969 eval $setvar
6970
6971 : see if dld is available
6972 set dld.h i_dld
6973 eval $inhdr
6974
6975 : see if dlopen exists
6976 xxx_runnm="$runnm"
6977 runnm=false
6978 set dlopen d_dlopen
6979 eval $inlibc
6980 runnm="$xxx_runnm"
6981
6982 : determine which dynamic loading, if any, to compile in
6983 echo " "
6984 dldir="ext/DynaLoader"
6985 case "$usedl" in
6986 $define|y|true)
6987         dflt='y'
6988         usedl="$define"
6989         ;;
6990 $undef|n|false)
6991         dflt='n'
6992         usedl="$undef"
6993         ;;
6994 *) 
6995         dflt='n'
6996         case "$d_dlopen" in
6997             $define) dflt='y' ;;
6998         esac
6999         case "$i_dld" in
7000             $define) dflt='y' ;;
7001         esac
7002         : Does a dl_xxx.xs file exist for this operating system
7003         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7004         ;;
7005 esac
7006 rp="Do you wish to use dynamic loading?"
7007 . ./myread
7008 usedl="$ans"
7009 case "$ans" in
7010 y*) usedl="$define"
7011         case "$dlsrc" in
7012         '')
7013                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7014                         dflt="$dldir/dl_${osname}.xs"
7015                 elif $test "$d_dlopen" = "$define" ; then
7016                         dflt="$dldir/dl_dlopen.xs"
7017                 elif $test "$i_dld" = "$define" ; then
7018                         dflt="$dldir/dl_dld.xs"
7019                 else
7020                         dflt=''
7021                 fi
7022                 ;;
7023         *)      dflt="$dldir/$dlsrc"
7024                 ;;
7025         esac
7026     echo "The following dynamic loading files are available:"
7027         : Can not go over to $dldir because getfile has path hard-coded in.
7028         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
7029         rp="Source file to use for dynamic loading"
7030         fn="fne"
7031         gfpth="$src"
7032         . ./getfile
7033         usedl="$define"
7034         : emulate basename
7035         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7036
7037         $cat << EOM
7038
7039 Some systems may require passing special flags to $cc -c to
7040 compile modules that will be used to create a shared library.
7041 To use no flags, say "none".
7042
7043 EOM
7044     case "$cccdlflags" in
7045     '') case "$gccversion" in
7046                 '') case "$osname" in
7047                         hpux)   dflt='+z' ;;
7048                         next)   dflt='none' ;;
7049                         irix*)  dflt='-KPIC' ;;
7050                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7051                         sunos)  dflt='-pic' ;;
7052                         *)      dflt='none' ;;
7053                     esac
7054                         ;;
7055                 *)  case "$osname" in
7056                         darwin) dflt='none' ;;
7057                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7058                         *)      dflt='-fpic' ;;
7059                     esac ;;
7060             esac ;;
7061         ' ') dflt='none' ;;
7062     *)  dflt="$cccdlflags" ;;
7063     esac
7064     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7065     . ./myread
7066     case "$ans" in
7067     none) cccdlflags=' ' ;;
7068     *) cccdlflags="$ans" ;;
7069     esac
7070
7071     cat << EOM
7072
7073 Some systems use ld to create libraries that can be dynamically loaded,
7074 while other systems (such as those using ELF) use $cc.
7075
7076 EOM
7077         case "$ld" in
7078         '')     $cat >try.c <<'EOM'
7079 /* Test for whether ELF binaries are produced */
7080 #include <fcntl.h>
7081 #include <stdlib.h>
7082 int main() {
7083         char b[4];
7084         int i = open("a.out",O_RDONLY);
7085         if(i == -1) 
7086                 exit(1); /* fail */
7087         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7088                 exit(0); /* succeed (yes, it's ELF) */
7089         else
7090                 exit(1); /* fail */
7091 }
7092 EOM
7093                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7094                         cat <<EOM
7095 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7096 EOM
7097                         dflt="$cc"
7098                 else
7099                         echo "I'll use ld to build dynamic libraries."
7100                         dflt='ld'
7101                 fi
7102                 rm -f try.c a.out
7103                 ;;
7104         *)      dflt="$ld"
7105                 ;;
7106         esac
7107
7108     rp="What command should be used to create dynamic libraries?"
7109     . ./myread
7110         ld="$ans"
7111
7112     cat << EOM
7113
7114 Some systems may require passing special flags to $ld to create a
7115 library that can be dynamically loaded.  If your ld flags include
7116 -L/other/path options to locate libraries outside your loader's normal
7117 search path, you may need to specify those -L options here as well.  To
7118 use no flags, say "none".
7119
7120 EOM
7121     case "$lddlflags" in
7122     '') case "$osname" in
7123                         beos) dflt='-nostart' ;;
7124                         hpux) dflt='-b';
7125                               case "$gccversion" in
7126                               '') dflt="$dflt +vnocompatwarnings" ;;
7127                               esac
7128                               ;;        
7129                         linux|irix*)    dflt='-shared' ;;
7130                         next)  dflt='none' ;;
7131                         solaris) dflt='-G' ;;
7132                         sunos) dflt='-assert nodefinitions' ;;
7133                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7134                 *)     dflt='none' ;;
7135                         esac
7136                         ;;
7137     *) dflt="$lddlflags" ;;
7138     esac
7139
7140         : Try to guess additional flags to pick up local libraries.
7141         : Be careful not to append to a plain 'none'
7142         case "$dflt" in
7143         none) dflt='' ;;
7144         esac
7145         for thisflag in $ldflags; do
7146                 case "$thisflag" in
7147                 -L*|-R*)
7148                         case " $dflt " in
7149                         *" $thisflag "*) ;;
7150                         *) dflt="$dflt $thisflag" ;;
7151                         esac
7152                         ;;
7153                 esac
7154         done
7155
7156         case "$dflt" in
7157         ''|' ') dflt='none' ;;
7158         esac
7159
7160     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7161     . ./myread
7162     case "$ans" in
7163     none) lddlflags=' ' ;;
7164     *) lddlflags="$ans" ;;
7165     esac
7166
7167         cat <<EOM
7168
7169 Some systems may require passing special flags to $cc to indicate that
7170 the resulting executable will use dynamic linking.  To use no flags,
7171 say "none".
7172
7173 EOM
7174     case "$ccdlflags" in
7175     '') case "$osname" in
7176                 hpux)   dflt='-Wl,-E' ;;
7177                 linux)  dflt='-rdynamic' ;;
7178                 next)   dflt='none' ;;
7179                 sunos)  dflt='none' ;;
7180                 *)      dflt='none' ;;
7181             esac ;;
7182     ' ')  dflt='none' ;;
7183     *)  dflt="$ccdlflags" ;;
7184     esac
7185     rp="Any special flags to pass to $cc to use dynamic linking?"
7186     . ./myread
7187     case "$ans" in
7188     none) ccdlflags=' ' ;;
7189     *) ccdlflags="$ans" ;;
7190     esac
7191     ;;
7192 *)  usedl="$undef"
7193         ld='ld'
7194     dlsrc='dl_none.xs'
7195     lddlflags=''
7196     ccdlflags=''
7197     ;;
7198 esac
7199
7200 also=''
7201 case "$usedl" in
7202 $undef)
7203         # No dynamic loading being used, so don't bother even to prompt.
7204         useshrplib='false'
7205         ;;
7206 *)      case "$useshrplib" in
7207         '')     case "$osname" in
7208                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7209                         dflt=y
7210                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7211                         ;;
7212                 next*)
7213                         case "$osvers" in
7214                         4*)     dflt=y
7215                                 also='Building a shared libperl is needed for MAB support.'
7216                                 ;;
7217                         *)      dflt=n
7218                                 ;;
7219                         esac
7220                         ;;
7221                 *)      dflt=n
7222                         ;;
7223                 esac
7224                 ;;
7225         $define|true|[Yy]*)
7226                 dflt=y
7227                 ;;
7228         *)      dflt=n
7229                 ;;
7230         esac
7231         $cat << EOM
7232
7233 The perl executable is normally obtained by linking perlmain.c with
7234 libperl${_a}, any static extensions (usually just DynaLoader), and
7235 any other libraries needed on this system (such as -lm, etc.).  Since
7236 your system supports dynamic loading, it is probably possible to build
7237 a shared libperl.$so.  If you will have more than one executable linked
7238 to libperl.$so, this will significantly reduce the size of each
7239 executable, but it may have a noticeable affect on performance.  The
7240 default is probably sensible for your system.
7241 $also
7242
7243 EOM
7244         rp="Build a shared libperl.$so (y/n)"
7245         . ./myread
7246         case "$ans" in
7247         true|$define|[Yy]*)
7248                 useshrplib='true'  ;;
7249         *)      useshrplib='false' ;;
7250         esac
7251         ;;
7252 esac
7253
7254 case "$useshrplib" in
7255 true)
7256         case "$libperl" in
7257         '')
7258                 # Figure out a good name for libperl.so.  Since it gets stored in
7259                 # a version-specific architecture-dependent library, the version
7260                 # number isn't really that important, except for making cc/ld happy.
7261                 #
7262                 # A name such as libperl.so.3.1
7263                 majmin="libperl.$so.$patchlevel.$subversion"
7264                 # A name such as libperl.so.301
7265                 majonly=`echo $patchlevel $subversion |
7266                         $awk '{printf "%d%02d", $1, $2}'`
7267                 majonly=libperl.$so.$majonly
7268                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7269                 # rely on figuring it out from the naming of libc.
7270                 case "${osname}${osvers}" in
7271                 next4*)
7272                         dflt=libperl.5.$so
7273                         # XXX How handle the --version stuff for MAB?
7274                         ;;
7275                 linux*)  # ld won't link with a bare -lperl otherwise.
7276                         dflt=libperl.$so
7277                         ;;
7278                 cygwin*) # include version
7279                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
7280                         ;;
7281                 *)      # Try to guess based on whether libc has major.minor.
7282                         case "$libc" in
7283                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7284                         *libc.$so.[0-9]*) dflt=$majonly ;;
7285                         *)      dflt=libperl.$so ;;
7286                         esac
7287                         ;;
7288                 esac
7289                 ;;
7290         *)      dflt=$libperl
7291                 ;;
7292         esac
7293         cat << EOM
7294
7295 I need to select a good name for the shared libperl.  If your system uses
7296 library names with major and minor numbers, then you might want something
7297 like $majmin.  Alternatively, if your system uses a single version
7298 number for shared libraries, then you might want to use $majonly.
7299 Or, your system might be quite happy with a simple libperl.$so.
7300
7301 Since the shared libperl will get installed into a version-specific
7302 architecture-dependent directory, the version number of the shared perl
7303 library probably isn't important, so the default should be o.k.
7304
7305 EOM
7306         rp='What name do you want to give to the shared libperl?'
7307         . ./myread
7308         libperl=$ans
7309         echo "Ok, I'll use $libperl"
7310         ;;
7311 *)
7312         libperl="libperl${_a}"
7313         ;;
7314 esac
7315
7316 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7317 case "$shrpdir" in
7318 '') ;;
7319 *)      $cat >&4 <<EOM
7320 WARNING:  Use of the shrpdir variable for the installation location of
7321 the shared $libperl is not supported.  It was never documented and
7322 will not work in this version.  Let me (perlbug@perl.org)
7323 know of any problems this may cause.
7324
7325 EOM
7326         case "$shrpdir" in
7327         "$archlibexp/CORE")
7328                 $cat >&4 <<EOM
7329 But your current setting of $shrpdir is
7330 the default anyway, so it's harmless.
7331 EOM
7332                 ;;
7333         *)
7334                 $cat >&4 <<EOM
7335 Further, your current attempted setting of $shrpdir
7336 conflicts with the value of $archlibexp/CORE
7337 that installperl will use.
7338 EOM
7339                 ;;
7340         esac
7341         ;;
7342 esac
7343
7344 # How will the perl executable find the installed shared $libperl?
7345 # Add $xxx to ccdlflags.
7346 # If we can't figure out a command-line option, use $shrpenv to
7347 # set env LD_RUN_PATH.  The main perl makefile uses this.
7348 shrpdir=$archlibexp/CORE
7349 xxx=''
7350 tmp_shrpenv=''
7351 if "$useshrplib"; then
7352     case "$osname" in 
7353         aix)
7354                 # We'll set it in Makefile.SH...
7355                 ;;
7356         solaris|netbsd)
7357                 xxx="-R $shrpdir"
7358                 ;;
7359         freebsd)
7360                 xxx="-Wl,-R$shrpdir"
7361                 ;;
7362         linux|irix*|dec_osf)
7363                 xxx="-Wl,-rpath,$shrpdir"
7364                 ;;
7365         next)
7366                 # next doesn't like the default...
7367                 ;;
7368         beos)
7369                 # beos doesn't like the default, either.
7370                 ;;
7371         hpux*)
7372                 # hpux doesn't like the default, either.
7373                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7374                 ;;
7375         *)
7376                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7377                 ;;
7378         esac
7379         case "$xxx" in
7380         '') ;;
7381         *)      
7382                 # Only add $xxx if it isn't already in ccdlflags.
7383                 case " $ccdlflags " in
7384                 *" $xxx "*)     ;;
7385                 *)      ccdlflags="$ccdlflags $xxx"
7386                         cat <<EOM >&4
7387
7388 Adding $xxx to the flags
7389 passed to $ld so that the perl executable will find the 
7390 installed shared $libperl.
7391
7392 EOM
7393                         ;;
7394                 esac
7395                 ;;
7396         esac
7397 fi
7398 # Fix ccdlflags in AIX for building external extensions.
7399 # (For building Perl itself bare -bE:perl.exp is needed,
7400 #  Makefile.SH takes care of this.)
7401 case "$osname" in
7402 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7403 esac
7404 # Respect a hint or command-line value.
7405 case "$shrpenv" in
7406 '') shrpenv="$tmp_shrpenv" ;;
7407 esac
7408 case "$ldlibpthname" in
7409 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7410 none)   ldlibpthname='' ;;
7411 esac
7412
7413 : determine where manual pages are on this system
7414 echo " "
7415 case "$sysman" in
7416 '') 
7417         syspath='/usr/share/man/man1 /usr/man/man1'
7418         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7419         syspath="$syspath /usr/man/u_man/man1"
7420         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7421         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7422         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7423         sysman=`./loc . /usr/man/man1 $syspath`
7424         ;;
7425 esac
7426 if $test -d "$sysman"; then
7427         echo "System manual is in $sysman." >&4
7428 else
7429         echo "Could not find manual pages in source form." >&4
7430 fi
7431
7432 : determine where manual pages go
7433 set man1dir man1dir none
7434 eval $prefixit
7435 $cat <<EOM
7436
7437 $spackage has manual pages available in source form.
7438 EOM
7439 case "$nroff" in
7440 nroff)
7441         echo "However, you don't have nroff, so they're probably useless to you."
7442         case "$man1dir" in
7443         '') man1dir="none";;
7444         esac;;
7445 esac
7446 echo "If you don't want the manual sources installed, answer 'none'."
7447 case "$man1dir" in
7448 ' ') dflt=none
7449         ;;
7450 '')
7451         lookpath="$prefixexp/share/man/man1"
7452         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7453         lookpath="$lookpath $prefixexp/man/p_man/man1"
7454         lookpath="$lookpath $prefixexp/man/u_man/man1"
7455         lookpath="$lookpath $prefixexp/man/man.1"
7456         case "$sysman" in
7457         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7458         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7459         esac
7460         set dflt
7461         eval $prefixup
7462         ;;
7463 *)  dflt="$man1dir"
7464         ;;
7465 esac
7466 echo " "
7467 fn=dn+~
7468 rp="Where do the main $spackage manual pages (source) go?"
7469 . ./getfile
7470 if $test "X$man1direxp" != "X$ansexp"; then
7471         installman1dir=''
7472 fi
7473 man1dir="$ans"
7474 man1direxp="$ansexp"
7475 case "$man1dir" in
7476 '')     man1dir=' '
7477         installman1dir='';;
7478 esac
7479
7480 : Change installation prefix, if necessary.
7481 if $test X"$prefix" != X"$installprefix"; then
7482         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7483 else
7484         installman1dir="$man1direxp"
7485 fi
7486
7487 : What suffix to use on installed man pages
7488
7489 case "$man1dir" in
7490 ' ')
7491         man1ext='0'
7492         ;;
7493 *)
7494         rp="What suffix should be used for the main $spackage man pages?"
7495         case "$man1ext" in
7496         '')     case "$man1dir" in
7497                 *1)  dflt=1 ;;
7498                 *1p) dflt=1p ;;
7499                 *1pm) dflt=1pm ;;
7500                 *l) dflt=l;;
7501                 *n) dflt=n;;
7502                 *o) dflt=o;;
7503                 *p) dflt=p;;
7504                 *C) dflt=C;;
7505                 *L) dflt=L;;
7506                 *L1) dflt=L1;;
7507                 *) dflt=1;;
7508                 esac
7509                 ;;
7510         *)      dflt="$man1ext";;
7511         esac
7512         . ./myread
7513         man1ext="$ans"
7514         ;;
7515 esac
7516
7517 : see if we can have long filenames
7518 echo " "
7519 first=123456789abcdef
7520 $rm -f $first
7521 if (echo hi >$first) 2>/dev/null; then
7522         if $test -f 123456789abcde; then
7523                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
7524                 val="$undef"
7525         else
7526                 echo 'You can have filenames longer than 14 characters.'>&4
7527                 val="$define"
7528         fi
7529 else
7530         $cat <<'EOM'
7531 You can't have filenames longer than 14 chars.
7532 You can't even think about them!
7533 EOM
7534         val="$undef"
7535 fi 
7536 set d_flexfnam
7537 eval $setvar
7538 $rm -rf 123456789abcde*
7539
7540 : determine where library module manual pages go
7541 set man3dir man3dir none
7542 eval $prefixit
7543 $cat <<EOM
7544
7545 $spackage has manual pages for many of the library modules.
7546 EOM
7547
7548 case "$nroff" in
7549 nroff)
7550         $cat <<'EOM'
7551 However, you don't have nroff, so they're probably useless to you.
7552 EOM
7553         case "$man3dir" in
7554         '') man3dir="none";;
7555         esac;;
7556 esac
7557
7558 case "$d_flexfnam" in
7559 undef)
7560         $cat <<'EOM'
7561 However, your system can't handle the long file names like File::Basename.3. 
7562 EOM
7563         case "$man3dir" in
7564         '') man3dir="none";;
7565         esac;;
7566 esac
7567
7568 echo "If you don't want the manual sources installed, answer 'none'."
7569 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7570 case "$man3dir" in
7571 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7572         if $test -d "$privlib/man/man3"; then
7573                 cat <<EOM >&4
7574
7575 WARNING:  Previous versions of perl installed man3 pages into
7576 $privlib/man/man3.  This version will suggest a 
7577 new default of $dflt.  
7578 EOM
7579                 tdflt=$dflt
7580                 dflt='n'
7581                 rp='Do you wish to preserve the old behavior?(y/n)'
7582                 . ./myread
7583                 case "$ans" in
7584                 y*) dflt="$privlib/man/man3" ;;
7585                 *)  dflt=$tdflt ;;
7586                 esac
7587     fi
7588         ;;
7589 *)      dflt="$man3dir" ;;
7590 esac
7591 case "$dflt" in
7592 ' ') dflt=none ;;
7593 esac
7594 echo " "
7595 fn=dn+~
7596 rp="Where do the $package library man pages (source) go?"
7597 . ./getfile
7598 man3dir="$ans"
7599 man3direxp="$ansexp"
7600 case "$man3dir" in
7601 '')     man3dir=' '
7602         installman3dir='';;
7603 esac
7604
7605 : Change installation prefix, if necessary.
7606 if $test X"$prefix" != X"$installprefix"; then
7607         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7608 else
7609         installman3dir="$man3direxp"
7610 fi
7611
7612 : What suffix to use on installed man pages
7613 case "$man3dir" in
7614 ' ')
7615         man3ext='0'
7616         ;;
7617 *)
7618         rp="What suffix should be used for the $package library man pages?"
7619         case "$man3ext" in
7620         '')     case "$man3dir" in
7621                 *3)  dflt=3 ;;
7622                 *3p) dflt=3p ;;
7623                 *3pm) dflt=3pm ;;
7624                 *l) dflt=l;;
7625                 *n) dflt=n;;
7626                 *o) dflt=o;;
7627                 *p) dflt=p;;
7628                 *C) dflt=C;;
7629                 *L) dflt=L;;
7630                 *L3) dflt=L3;;
7631                 *) dflt=3;;
7632                 esac
7633                 ;;
7634         *)      dflt="$man3ext";;
7635         esac
7636         . ./myread
7637         man3ext="$ans"
7638         ;;
7639 esac
7640
7641 : see if we have to deal with yellow pages, now NIS.
7642 if $test -d /usr/etc/yp || $test -d /etc/yp; then
7643         if $test -f /usr/etc/nibindd; then
7644                 echo " "
7645                 echo "I'm fairly confident you're on a NeXT."
7646                 echo " "
7647                 rp='Do you get the hosts file via NetInfo?'
7648                 dflt=y
7649                 case "$hostcat" in
7650                 nidump*) ;;
7651                 '') ;;
7652                 *) dflt=n;;
7653                 esac
7654                 . ./myread
7655                 case "$ans" in
7656                 y*) hostcat='nidump hosts .';;
7657                 *)      case "$hostcat" in
7658                         nidump*) hostcat='';;
7659                         esac
7660                         ;;
7661                 esac
7662         fi
7663         case "$hostcat" in
7664         nidump*) ;;
7665         *)
7666                 case "$hostcat" in
7667                 *ypcat*) dflt=y;;
7668                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7669                                 dflt=y
7670                         else
7671                                 dflt=n
7672                         fi;;
7673                 *) dflt=n;;
7674                 esac
7675                 echo " "
7676                 rp='Are you getting the hosts file via yellow pages?'
7677                 . ./myread
7678                 case "$ans" in
7679                 y*) hostcat='ypcat hosts';;
7680                 *) hostcat='cat /etc/hosts';;
7681                 esac
7682                 ;;
7683         esac
7684 fi
7685 case "$hostcat" in
7686 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7687 esac
7688 case "$groupcat" in
7689 '') test -f /etc/group && groupcat='cat /etc/group';;
7690 esac
7691 case "$passcat" in
7692 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7693 esac
7694
7695 : now get the host name
7696 echo " "
7697 echo "Figuring out host name..." >&4
7698 case "$myhostname" in
7699 '') cont=true
7700         echo 'Maybe "hostname" will work...'
7701         if tans=`sh -c hostname 2>&1` ; then
7702                 myhostname=$tans
7703                 phostname=hostname
7704                 cont=''
7705         fi
7706         ;;
7707 *) cont='';;
7708 esac
7709 if $test "$cont"; then
7710         if ./xenix; then
7711                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7712                 if tans=`cat /etc/systemid 2>&1` ; then
7713                         myhostname=$tans
7714                         phostname='cat /etc/systemid'
7715                         echo "Whadyaknow.  Xenix always was a bit strange..."
7716                         cont=''
7717                 fi
7718         elif $test -r /etc/systemid; then
7719                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7720         fi
7721 fi
7722 if $test "$cont"; then
7723         echo 'No, maybe "uuname -l" will work...'
7724         if tans=`sh -c 'uuname -l' 2>&1` ; then
7725                 myhostname=$tans
7726                 phostname='uuname -l'
7727         else
7728                 echo 'Strange.  Maybe "uname -n" will work...'
7729                 if tans=`sh -c 'uname -n' 2>&1` ; then
7730                         myhostname=$tans
7731                         phostname='uname -n'
7732                 else
7733                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7734                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7735                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7736                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7737                         else
7738                                 case "$myhostname" in
7739                                 '') echo "Does this machine have an identity crisis or something?"
7740                                         phostname='';;
7741                                 *)
7742                                         echo "Well, you said $myhostname before..."
7743                                         phostname='echo $myhostname';;
7744                                 esac
7745                         fi
7746                 fi
7747         fi
7748 fi
7749 : you do not want to know about this
7750 set $myhostname
7751 myhostname=$1
7752
7753 : verify guess
7754 if $test "$myhostname" ; then
7755         dflt=y
7756         rp='Your host name appears to be "'$myhostname'".'" Right?"
7757         . ./myread
7758         case "$ans" in
7759         y*) ;;
7760         *) myhostname='';;
7761         esac
7762 fi
7763
7764 : bad guess or no guess
7765 while $test "X$myhostname" = X ; do
7766         dflt=''
7767         rp="Please type the (one word) name of your host:"
7768         . ./myread
7769         myhostname="$ans"
7770 done
7771
7772 : translate upper to lower if necessary
7773 case "$myhostname" in
7774 *[A-Z]*)
7775         echo "(Normalizing case in your host name)"
7776         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7777         ;;
7778 esac
7779
7780 case "$myhostname" in
7781 *.*)
7782         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7783         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7784         echo "(Trimming domain name from host name--host name is now $myhostname)"
7785         ;;
7786 *) case "$mydomain" in
7787         '')
7788                 {
7789                         test "X$hostcat" = "Xypcat hosts" &&
7790                         ypmatch "$myhostname" hosts 2>/dev/null |\
7791                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7792                         $test -s hosts
7793                 } || {
7794                         test "X$hostcat" != "X" &&
7795                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7796                                         /[       ]$myhostname[  . ]/p" > hosts
7797                 }
7798                 tmp_re="[       . ]"
7799                 if $test -f hosts; then
7800                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7801                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7802                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7803                                 hosts | $sort | $uniq | \
7804                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7805                         case `$echo X$dflt` in
7806                         X*\ *)  echo "(Several hosts in the database matched hostname)"
7807                                 dflt=.
7808                                 ;;
7809                         X.) echo "(You do not have fully-qualified names in the hosts database)"
7810                                 ;;
7811                         esac
7812                 else
7813                         echo "(I cannot locate a hosts database anywhere)"
7814                         dflt=.
7815                 fi
7816                 case "$dflt" in
7817                 .)
7818                         tans=`./loc resolv.conf X /etc /usr/etc`
7819                         if $test -f "$tans"; then
7820                                 echo "(Attempting domain name extraction from $tans)"
7821                                 dflt=.`$sed -n -e 's/   / /g' \
7822                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7823                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7824                                 case "$dflt" in
7825                                 .) dflt=.`$sed -n -e 's/        / /g' \
7826                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7827                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7828                                         ;;
7829                                 esac
7830                         fi
7831                         ;;
7832                 esac
7833                 case "$dflt" in
7834                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7835                         dflt=.`sh -c domainname 2>/dev/null`
7836                         case "$dflt" in
7837                         '') dflt='.';;
7838                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7839                         esac
7840                         ;;
7841                 esac
7842                 case "$dflt$osname" in
7843                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
7844                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
7845                         ;;
7846                 esac
7847                 case "$dflt" in
7848                 .) echo "(Lost all hope -- silly guess then)"
7849                         dflt='.uucp'
7850                         ;;
7851                 esac
7852                 $rm -f hosts
7853                 ;;
7854         *) dflt="$mydomain";;
7855         esac;;
7856 esac
7857 echo " "
7858 rp="What is your domain name?"
7859 . ./myread
7860 tans="$ans"
7861 case "$ans" in
7862 '') ;;
7863 .*) ;;
7864 *) tans=".$tans";;
7865 esac
7866 mydomain="$tans"
7867
7868 : translate upper to lower if necessary
7869 case "$mydomain" in
7870 *[A-Z]*)
7871         echo "(Normalizing case in your domain name)"
7872         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7873         ;;
7874 esac
7875
7876 : a little sanity check here
7877 case "$phostname" in
7878 '') ;;
7879 *)
7880         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7881         $myhostname$mydomain|$myhostname) ;;
7882         *)
7883                 case "$phostname" in
7884                 sed*)
7885                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7886                         ;;
7887                 *)
7888                         echo "(That doesn't agree with your $phostname command, by the way.)"
7889                         ;;
7890                 esac
7891         ;;
7892         esac
7893         ;;
7894 esac
7895
7896 $cat <<EOM
7897
7898 I need to get your e-mail address in Internet format if possible, i.e.
7899 something like user@host.domain. Please answer accurately since I have
7900 no easy means to double check it. The default value provided below
7901 is most probably close to reality but may not be valid from outside
7902 your organization...
7903
7904 EOM
7905 cont=x
7906 while test "$cont"; do
7907         case "$cf_email" in
7908         '') dflt="$cf_by@$myhostname$mydomain";;
7909         *) dflt="$cf_email";;
7910         esac
7911         rp='What is your e-mail address?'
7912         . ./myread
7913         cf_email="$ans"
7914         case "$cf_email" in
7915         *@*.*) cont='' ;;
7916         *)
7917                 rp='Address does not look like an Internet one.  Use it anyway?'
7918                 case "$fastread" in
7919                 yes) dflt=y ;;
7920                 *) dflt=n ;;
7921                 esac
7922                 . ./myread
7923                 case "$ans" in
7924                 y*) cont='' ;;
7925                 *) echo " " ;;
7926                 esac
7927                 ;;
7928         esac
7929 done
7930
7931 $cat <<EOM
7932
7933 If you or somebody else will be maintaining perl at your site, please
7934 fill in the correct e-mail address here so that they may be contacted
7935 if necessary. Currently, the "perlbug" program included with perl
7936 will send mail to this address in addition to perlbug@perl.org. You may
7937 enter "none" for no administrator.
7938
7939 EOM
7940 case "$perladmin" in
7941 '') dflt="$cf_email";;
7942 *) dflt="$perladmin";;
7943 esac
7944 rp='Perl administrator e-mail address'
7945 . ./myread
7946 perladmin="$ans"
7947
7948 : determine whether to only install version-specific parts.
7949 echo " "
7950 $cat <<EOM
7951 Do you want to install only the version-specific parts of the perl
7952 distribution?  Usually you do *not* want to do this.
7953 EOM
7954 case "$versiononly" in
7955 "$define"|[Yy]*|true) dflt='y' ;;
7956 *) dflt='n';
7957 esac
7958 rp="Do you want to install only the version-specific parts of perl?"
7959 . ./myread
7960 case "$ans" in
7961 [yY]*)  val="$define";;
7962 *)      val="$undef" ;;
7963 esac
7964 set versiononly
7965 eval $setvar
7966
7967 : figure out how to guarantee perl startup
7968 case "$startperl" in
7969 '')
7970         case "$sharpbang" in
7971         *!)
7972                 $cat <<EOH
7973
7974 I can use the #! construct to start perl on your system. This will
7975 make startup of perl scripts faster, but may cause problems if you
7976 want to share those scripts and perl is not in a standard place
7977 ($binexp/perl) on all your platforms. The alternative is to force
7978 a shell by starting the script with a single ':' character.
7979
7980 EOH
7981                 case "$versiononly" in
7982                 "$define")      dflt="$binexp/perl$version";;  
7983                 *)              dflt="$binexp/perl";;
7984                 esac
7985                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7986                 . ./myread
7987                 case "$ans" in
7988                 none)   startperl=": # use perl";;
7989                 *)      startperl="#!$ans"
7990                         if $test 30 -lt `echo "$ans" | wc -c`; then
7991                                 $cat >&4 <<EOM
7992
7993 WARNING:  Some systems limit the #! command to 32 characters.
7994 If you experience difficulty running Perl scripts with #!, try
7995 installing Perl in a directory with a shorter pathname.
7996
7997 EOM
7998                         fi ;;
7999                 esac
8000                 ;;
8001         *) startperl=": # use perl"
8002                 ;;
8003         esac
8004         ;;
8005 esac
8006 echo "I'll use $startperl to start perl scripts."
8007
8008 : figure best path for perl in scripts
8009 case "$perlpath" in
8010 '')
8011         perlpath="$binexp/perl"
8012         case "$startperl" in
8013         *!*) ;;
8014         *)
8015                 $cat <<EOH
8016
8017 I will use the "eval 'exec'" idiom to start Perl on your system.
8018 I can use the full path of your Perl binary for this purpose, but
8019 doing so may cause problems if you want to share those scripts and
8020 Perl is not always in a standard place ($binexp/perl).
8021
8022 EOH
8023                 dflt="$binexp/perl"
8024                 rp="What path shall I use in \"eval 'exec'\"?"
8025                 . ./myread
8026                 perlpath="$ans"
8027                 ;;
8028         esac
8029         ;;
8030 esac
8031 case "$startperl" in
8032 *!*)    ;;
8033 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8034 esac
8035
8036 : determine where public executable scripts go
8037 set scriptdir scriptdir
8038 eval $prefixit
8039 case "$scriptdir" in
8040 '')
8041         dflt="$bin"
8042         : guess some guesses
8043         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8044         $test -d /usr/share/bin     && dflt=/usr/share/bin
8045         $test -d /usr/local/script  && dflt=/usr/local/script
8046         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8047         $test -d $prefixexp/script  && dflt=$prefixexp/script
8048         set dflt
8049         eval $prefixup
8050         ;;
8051 *)  dflt="$scriptdir"
8052         ;;
8053 esac
8054 $cat <<EOM
8055  
8056 Some installations have a separate directory just for executable scripts so
8057 that they can mount it across multiple architectures but keep the scripts in
8058 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8059 Or you might just lump your scripts in with all your other executables.
8060  
8061 EOM
8062 fn=d~
8063 rp='Where do you keep publicly executable scripts?'
8064 . ./getfile
8065 if $test "X$ansexp" != "X$scriptdirexp"; then
8066         installscript=''
8067 fi
8068 scriptdir="$ans"
8069 scriptdirexp="$ansexp"
8070 : Change installation prefix, if necessary.
8071 if $test X"$prefix" != X"$installprefix"; then
8072         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8073 else
8074         installscript="$scriptdirexp"
8075 fi
8076
8077 : determine where add-on public executables go
8078 case "$sitebin" in
8079 '')     dflt=$siteprefix/bin ;;
8080 *)      dflt=$sitebin ;;
8081 esac
8082 fn=d~
8083 rp='Pathname where the add-on public executables should be installed?'
8084 . ./getfile
8085 sitebin="$ans"
8086 sitebinexp="$ansexp"
8087 : Change installation prefix, if necessary.
8088 if $test X"$prefix" != X"$installprefix"; then
8089         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8090 else
8091         installsitebin="$sitebinexp"
8092 fi
8093
8094 : define an is-a-typedef? function
8095 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8096 case "$inclist" in
8097 "") inclist="sys/types.h";;
8098 esac;
8099 eval "varval=\$$var";
8100 case "$varval" in
8101 "")
8102         $rm -f temp.c;
8103         for inc in $inclist; do
8104                 echo "#include <$inc>" >>temp.c;
8105         done;
8106         echo "#ifdef $type" >> temp.c;
8107         echo "printf(\"We have $type\");" >> temp.c;
8108         echo "#endif" >> temp.c;
8109         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8110         if $contains $type temp.E >/dev/null 2>&1; then
8111                 eval "$var=\$type";
8112         else
8113                 eval "$var=\$def";
8114         fi;
8115         $rm -f temp.?;;
8116 *) eval "$var=\$varval";;
8117 esac'
8118
8119 : define an is-a-typedef? function that prompts if the type is not available.
8120 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8121 case "$inclist" in
8122 "") inclist="sys/types.h";;
8123 esac;
8124 eval "varval=\$$var";
8125 case "$varval" in
8126 "")
8127         $rm -f temp.c;
8128         for inc in $inclist; do
8129                 echo "#include <$inc>" >>temp.c;
8130         done;
8131         echo "#ifdef $type" >> temp.c;
8132         echo "printf(\"We have $type\");" >> temp.c;
8133         echo "#endif" >> temp.c;
8134         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8135         echo " " ;
8136         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8137         if $contains $type temp.E >/dev/null 2>&1; then
8138                 echo "$type found." >&4;
8139                 eval "$var=\$type";
8140         else
8141                 echo "$type NOT found." >&4;
8142                 dflt="$def";
8143                 . ./myread ;
8144                 eval "$var=\$ans";
8145         fi;
8146         $rm -f temp.?;;
8147 *) eval "$var=\$varval";;
8148 esac'
8149
8150 : see what type lseek is declared as in the kernel
8151 rp="What is the type used for lseek's offset on this system?"
8152 set off_t lseektype long stdio.h sys/types.h
8153 eval $typedef_ask
8154
8155 echo " "
8156 echo "Checking to see how big your file offsets are..." >&4
8157 $cat >try.c <<EOCP
8158 #include <sys/types.h>
8159 #include <stdio.h>
8160 int main()
8161 {
8162     printf("%d\n", (int)sizeof($lseektype));
8163     return(0); 
8164 }
8165 EOCP
8166 set try
8167 if eval $compile_ok; then
8168         lseeksize=`$run ./try`
8169         echo "Your file offsets are $lseeksize bytes long."
8170 else
8171         dflt=$longsize
8172         echo " "
8173         echo "(I can't seem to compile the test program.  Guessing...)"
8174         rp="What is the size of your file offsets (in bytes)?"
8175         . ./myread
8176         lseeksize="$ans"
8177 fi
8178 $rm -f try.c try
8179
8180 : see what type file positions are declared as in the library
8181 rp="What is the type for file position used by fsetpos()?"
8182 set fpos_t fpostype long stdio.h sys/types.h
8183 eval $typedef_ask
8184
8185 echo " "
8186 case "$fpostype" in
8187 *_t) zzz="$fpostype"    ;;
8188 *)   zzz="fpos_t"       ;;
8189 esac
8190 echo "Checking the size of $zzz..." >&4 
8191 cat > try.c <<EOCP
8192 #include <sys/types.h>
8193 #include <stdio.h>
8194 int main() {
8195     printf("%d\n", (int)sizeof($fpostype));
8196     exit(0);
8197 }
8198 EOCP
8199 set try
8200 if eval $compile_ok; then
8201         yyy=`$run ./try`
8202         case "$yyy" in
8203         '')     fpossize=4
8204                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8205                 ;;
8206         *)      fpossize=$yyy
8207                 echo "Your $zzz is $fpossize bytes long."
8208                 ;;
8209         esac
8210 else
8211         dflt="$longsize"
8212         echo " " >&4
8213         echo "(I can't compile the test program.  Guessing...)" >&4
8214         rp="What is the size of your file positions (in bytes)?"
8215         . ./myread
8216         fpossize="$ans"
8217 fi
8218
8219
8220
8221 # Backward compatibility (uselfs is deprecated).
8222 case "$uselfs" in
8223 "$define"|true|[yY]*)
8224         cat <<EOM >&4
8225
8226 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8227 EOM
8228         uselargefiles="$define"
8229         ;;
8230 esac                          
8231
8232 case "$lseeksize:$fpossize" in
8233 8:8) cat <<EOM
8234
8235 You can have files larger than 2 gigabytes.
8236 EOM
8237    val="$define" ;;
8238 *)    case "$uselargefiles" in
8239    "$undef"|false|[nN]*) dflt='n' ;;
8240    *)   dflt='y' ;;
8241    esac
8242    cat <<EOM
8243
8244 Perl can be built to understand large files (files larger than 2 gigabytes)
8245 on some systems.  To do so, Configure can be run with -Duselargefiles.
8246
8247 If this doesn't make any sense to you, just accept the default '$dflt'.
8248 EOM
8249    rp='Try to understand large files, if available?'
8250    . ./myread
8251    case "$ans" in
8252    y|Y)         val="$define" ;;
8253    *)           val="$undef"  ;;
8254    esac
8255    ;;
8256 esac
8257 set uselargefiles
8258 eval $setvar
8259 case "$uselargefiles" in
8260 "$define")
8261 : Look for a hint-file generated 'call-back-unit'.  If the
8262 : user has specified that a large files perl is to be built,
8263 : we may need to set or change some other defaults.
8264         if $test -f uselargefiles.cbu; then
8265                 echo "Your platform has some specific hints for large file builds, using them..."
8266                 . ./uselargefiles.cbu
8267                 echo " "
8268                 echo "Rechecking to see how big your file offsets are..." >&4
8269                 $cat >try.c <<EOCP
8270 #include <sys/types.h>
8271 #include <stdio.h>
8272 int main()
8273 {
8274     printf("%d\n", (int)sizeof($lseektype));
8275     return(0); 
8276 }
8277 EOCP
8278                 set try
8279                 if eval $compile_ok; then
8280                         lseeksize=`$run ./try`
8281                         $echo "Your file offsets are now $lseeksize bytes long."
8282                 else
8283                         dflt="$lseeksize"
8284                         echo " "
8285                         echo "(I can't seem to compile the test program.  Guessing...)"
8286                         rp="What is the size of your file offsets (in bytes)?"
8287                         . ./myread
8288                         lseeksize="$ans"
8289                 fi
8290                 case "$fpostype" in
8291                 *_t) zzz="$fpostype"    ;;
8292                 *)   zzz="fpos_t"       ;;
8293                 esac
8294                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8295                 $cat > try.c <<EOCP
8296 #include <sys/types.h>
8297 #include <stdio.h>
8298 int main() {
8299     printf("%d\n", (int)sizeof($fpostype));
8300     exit(0);
8301 }
8302 EOCP
8303                 set try
8304                 if eval $compile_ok; then
8305                         yyy=`$run ./try`
8306                         dflt="$lseeksize"
8307                         case "$yyy" in
8308                         '')     echo " "
8309                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8310                                 ;;
8311                         *)      fpossize=$yyy
8312                                 echo " $fpossize bytes." >&4
8313                                 ;;
8314                         esac
8315                 else
8316                         dflt="$fpossize"
8317                         echo " "
8318                         echo "(I can't compile the test program.  Guessing...)" >&4
8319                         rp="What is the size of your file positions (in bytes)?"
8320                         . ./myread
8321                         fpossize="$ans"
8322                 fi
8323                 $rm -f try.c try
8324         fi
8325         ;;
8326 esac
8327
8328 case "$vendorprefix" in
8329 '')     d_vendorbin="$undef"
8330         vendorbin=''
8331         vendorbinexp=''
8332         ;;
8333 *)      d_vendorbin="$define"
8334         : determine where vendor-supplied executables go.
8335         case "$vendorbin" in
8336         '') dflt=$vendorprefix/bin ;;
8337         *)      dflt="$vendorbin" ;;
8338         esac
8339         fn=d~+
8340         rp='Pathname for the vendor-supplied executables directory?'
8341         . ./getfile
8342         vendorbin="$ans"
8343         vendorbinexp="$ansexp"
8344         ;;
8345 esac
8346 : Change installation prefix, if necessary.
8347 if $test X"$prefix" != X"$installprefix"; then
8348         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8349 else
8350         installvendorbin="$vendorbinexp"
8351 fi
8352
8353 : see if qgcvt exists
8354 set qgcvt d_qgcvt
8355 eval $inlibc
8356
8357 echo " "
8358
8359 if $test X"$d_longdbl" = X"$define"; then
8360
8361 echo "Checking how to print long doubles..." >&4
8362
8363 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
8364         $cat >try.c <<'EOCP'
8365 #include <sys/types.h>
8366 #include <stdio.h>
8367 int main() {
8368   double d = 123.456;
8369   printf("%.3f\n", d);
8370 }
8371 EOCP
8372         set try
8373         if eval $compile; then
8374                 yyy=`$run ./try`
8375                 case "$yyy" in
8376                 123.456)
8377                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
8378                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
8379                         echo "We will use %f."
8380                         ;;
8381                 esac
8382         fi
8383 fi
8384
8385 if $test X"$sPRIfldbl" = X; then
8386         $cat >try.c <<'EOCP'
8387 #include <sys/types.h>
8388 #include <stdio.h>
8389 int main() {
8390   long double d = 123.456;
8391   printf("%.3Lf\n", d);
8392 }
8393 EOCP
8394         set try
8395         if eval $compile; then
8396                 yyy=`$run ./try`
8397                 case "$yyy" in
8398                 123.456)
8399                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
8400                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
8401                         echo "We will use %Lf."
8402                         ;;
8403                 esac
8404         fi
8405 fi
8406
8407 if $test X"$sPRIfldbl" = X; then
8408         $cat >try.c <<'EOCP'
8409 #include <sys/types.h>
8410 #include <stdio.h>
8411 int main() {
8412   long double d = 123.456;
8413   printf("%.3llf\n", d);
8414 }
8415 EOCP
8416         set try
8417         if eval $compile; then
8418                 yyy=`$run ./try`
8419                 case "$yyy" in
8420                 123.456)
8421                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
8422                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
8423                         echo "We will use %llf."
8424                         ;;
8425                 esac
8426         fi
8427 fi
8428
8429 if $test X"$sPRIfldbl" = X; then
8430         $cat >try.c <<'EOCP'
8431 #include <sys/types.h>
8432 #include <stdio.h>
8433 int main() {
8434   long double d = 123.456;
8435   printf("%.3lf\n", d);
8436 }
8437 EOCP
8438         set try
8439         if eval $compile; then
8440                 yyy=`$run ./try`
8441                 case "$yyy" in
8442                 123.456)
8443                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
8444                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
8445                         echo "We will use %lf."
8446                         ;;
8447                 esac
8448         fi
8449 fi
8450
8451 if $test X"$sPRIfldbl" = X; then
8452         echo "Cannot figure out how to print long doubles." >&4
8453 else
8454         sSCNfldbl=$sPRIfldbl    # expect consistency
8455 fi
8456
8457 $rm -f try try.*
8458
8459 fi # d_longdbl
8460
8461 case "$sPRIfldbl" in
8462 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
8463         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
8464         d_SCNfldbl="$undef";
8465         ;;
8466 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
8467         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
8468         d_SCNfldbl="$define";
8469         ;;
8470 esac
8471
8472 : Check how to convert floats to strings.
8473 echo " "
8474 echo "Checking for an efficient way to convert floats to strings."
8475 echo " " > try.c
8476 case "$uselongdouble" in
8477 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8478 esac
8479 case "$d_longdbl" in
8480 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8481 esac
8482 case "$d_PRIgldbl" in
8483 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
8484 esac
8485 $cat >>try.c <<EOP
8486 #ifdef TRY_gconvert
8487 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8488 char *myname = "gconvert";
8489 #endif
8490 #ifdef TRY_gcvt
8491 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8492 char *myname = "gcvt";
8493 #endif
8494 #ifdef TRY_qgcvt
8495 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8496 char *myname = "qgcvt";
8497 #define DOUBLETYPE long double
8498 #endif
8499 #ifdef TRY_sprintf
8500 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
8501 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8502 #else
8503 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8504 #endif
8505 char *myname = "sprintf";
8506 #endif
8507
8508 #ifndef DOUBLETYPE
8509 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8510 #define DOUBLETYPE long double
8511 #else
8512 #define DOUBLETYPE double
8513 #endif
8514 #endif
8515
8516 #include <stdio.h>
8517
8518 #define I_STDLIB $i_stdlib
8519 #ifdef I_STDLIB
8520 #include <stdlib.h>
8521 #endif
8522
8523 int
8524 checkit(expect, got)
8525 char *expect;
8526 char *got;
8527 {
8528     if (strcmp(expect, got)) {
8529                 printf("%s oddity:  Expected %s, got %s\n",
8530                         myname, expect, got);
8531                 exit(1);
8532         }
8533 }
8534
8535 int main()
8536
8537         char buf[64]; 
8538         buf[63] = '\0';
8539
8540         /* This must be 1st test on (which?) platform */
8541         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8542         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8543         checkit("0.1", buf);
8544
8545         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
8546         checkit("1", buf);
8547
8548         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
8549         checkit("1.1", buf);
8550
8551         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
8552         checkit("1.01", buf);
8553
8554         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
8555         checkit("1.001", buf);
8556
8557         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
8558         checkit("1.0001", buf);
8559
8560         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
8561         checkit("1.00001", buf);
8562
8563         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
8564         checkit("1.000001", buf);
8565
8566         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
8567         checkit("0", buf);
8568
8569         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
8570         checkit("-1", buf);
8571
8572         /* Some Linux gcvt's give 1.e+5 here. */
8573         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
8574         checkit("100000", buf);
8575         
8576         /* Some Linux gcvt's give -1.e+5 here. */
8577         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
8578         checkit("-100000", buf);
8579
8580         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
8581         checkit("123.456", buf);
8582
8583         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
8584         Gconvert((DOUBLETYPE)1e30, 8, 0, buf);
8585         if (strlen(buf) > 5)
8586             checkit("1e+030", buf); /* for Microsoft */
8587         else
8588             checkit("1e+30", buf);
8589
8590         exit(0);
8591 }
8592 EOP
8593 case "$d_Gconvert" in
8594 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
8595 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
8596 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
8597 *) xxx_list='gconvert gcvt sprintf' ;;
8598 esac
8599
8600 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
8601 "$define$define$define")
8602     # for long doubles prefer first qgcvt, then sprintf
8603     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
8604     xxx_list="sprintf $xxx_list"
8605     case "$d_qgcvt" in
8606     "$define") xxx_list="qgcvt $xxx_list" ;;
8607     esac
8608     ;;
8609 esac
8610
8611 for xxx_convert in $xxx_list; do
8612         echo "Trying $xxx_convert..."
8613         $rm -f try try$_o
8614         set try -DTRY_$xxx_convert
8615         if eval $compile; then
8616                 echo "$xxx_convert() found." >&4
8617                 if $run ./try; then
8618                         echo "I'll use $xxx_convert to convert floats into a string." >&4
8619                         break;
8620                 else
8621                         echo "...But $xxx_convert didn't work as I expected."
8622                 fi
8623         else
8624                 echo "$xxx_convert NOT found." >&4
8625         fi
8626 done
8627         
8628 case "$xxx_convert" in
8629 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
8630 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
8631 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
8632 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
8633    "$define$define$define")
8634       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
8635    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
8636    esac
8637    ;;  
8638 esac
8639
8640 : see if _fwalk exists
8641 set fwalk d__fwalk
8642 eval $inlibc
8643
8644 : Initialize h_fcntl
8645 h_fcntl=false
8646
8647 : Initialize h_sysfile
8648 h_sysfile=false
8649
8650 : access call always available on UNIX
8651 set access d_access
8652 eval $inlibc
8653
8654 : locate the flags for 'access()'
8655 case "$d_access" in
8656 "$define")
8657         echo " "
8658         $cat >access.c <<'EOCP'
8659 #include <sys/types.h>
8660 #ifdef I_FCNTL
8661 #include <fcntl.h>
8662 #endif
8663 #ifdef I_SYS_FILE
8664 #include <sys/file.h>
8665 #endif
8666 #ifdef I_UNISTD
8667 #include <unistd.h>
8668 #endif
8669 int main() {
8670         exit(R_OK);
8671 }
8672 EOCP
8673         : check sys/file.h first, no particular reason here
8674         if $test `./findhdr sys/file.h` && \
8675                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
8676                 h_sysfile=true;
8677                 echo "<sys/file.h> defines the *_OK access constants." >&4
8678         elif $test `./findhdr fcntl.h` && \
8679                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
8680                 h_fcntl=true;
8681                 echo "<fcntl.h> defines the *_OK access constants." >&4
8682         elif $test `./findhdr unistd.h` && \
8683                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
8684                 echo "<unistd.h> defines the *_OK access constants." >&4
8685         else
8686                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
8687         fi
8688         ;;
8689 esac
8690 $rm -f access*
8691
8692 : see if accessx exists
8693 set accessx d_accessx
8694 eval $inlibc
8695
8696 : see if alarm exists
8697 set alarm d_alarm
8698 eval $inlibc
8699
8700 : see if atolf exists
8701 set atolf d_atolf
8702 eval $inlibc
8703
8704 : see if atoll exists
8705 set atoll d_atoll
8706 eval $inlibc
8707
8708 : Look for GNU-cc style attribute checking
8709 echo " "
8710 echo "Checking whether your compiler can handle __attribute__ ..." >&4
8711 $cat >attrib.c <<'EOCP'
8712 #include <stdio.h>
8713 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
8714 EOCP
8715 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
8716         if $contains 'warning' attrib.out >/dev/null 2>&1; then
8717                 echo "Your C compiler doesn't fully support __attribute__."
8718                 val="$undef"
8719         else
8720                 echo "Your C compiler supports __attribute__."
8721                 val="$define"
8722         fi
8723 else
8724         echo "Your C compiler doesn't seem to understand __attribute__ at all."
8725         val="$undef"
8726 fi
8727 set d_attribut
8728 eval $setvar
8729 $rm -f attrib*
8730
8731 : see if bcmp exists
8732 set bcmp d_bcmp
8733 eval $inlibc
8734
8735 : see if bcopy exists
8736 set bcopy d_bcopy
8737 eval $inlibc
8738
8739 : see if this is a unistd.h system
8740 set unistd.h i_unistd
8741 eval $inhdr
8742
8743 : see if getpgrp exists
8744 set getpgrp d_getpgrp
8745 eval $inlibc
8746
8747 case "$d_getpgrp" in
8748 "$define")
8749         echo " "
8750         echo "Checking to see which flavor of getpgrp is in use..."
8751         $cat >try.c <<EOP
8752 #$i_unistd I_UNISTD
8753 #include <sys/types.h>
8754 #ifdef I_UNISTD
8755 #  include <unistd.h>
8756 #endif
8757 int main()
8758 {
8759         if (getuid() == 0) {
8760                 printf("(I see you are running Configure as super-user...)\n");
8761                 setuid(1);
8762         }
8763 #ifdef TRY_BSD_PGRP
8764         if (getpgrp(1) == 0)
8765                 exit(0);
8766 #else
8767         if (getpgrp() > 0)
8768                 exit(0);
8769 #endif
8770         exit(1);
8771 }
8772 EOP
8773         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
8774                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
8775                 val="$define"
8776         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
8777                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
8778                 val="$undef"
8779         else
8780                 echo "I can't seem to compile and run the test program."
8781                 if ./usg; then
8782                         xxx="a USG one, i.e. you use getpgrp()."
8783                 else
8784                         # SVR4 systems can appear rather BSD-ish.
8785                         case "$i_unistd" in
8786                         $undef)
8787                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
8788                                 val="$define"
8789                                 ;;
8790                         $define)
8791                                 xxx="probably a USG one, i.e. you use getpgrp()."
8792                                 val="$undef"
8793                                 ;;
8794                         esac
8795                 fi
8796                 echo "Assuming your getpgrp is $xxx" >&4
8797         fi
8798         ;;
8799 *) val="$undef";;
8800 esac
8801 set d_bsdgetpgrp
8802 eval $setvar
8803 $rm -f try try.*
8804
8805 : see if setpgrp exists
8806 set setpgrp d_setpgrp
8807 eval $inlibc
8808
8809 case "$d_setpgrp" in
8810 "$define")
8811         echo " "
8812         echo "Checking to see which flavor of setpgrp is in use..."
8813         $cat >try.c <<EOP
8814 #$i_unistd I_UNISTD
8815 #include <sys/types.h>
8816 #ifdef I_UNISTD
8817 #  include <unistd.h>
8818 #endif
8819 int main()
8820 {
8821         if (getuid() == 0) {
8822                 printf("(I see you are running Configure as super-user...)\n");
8823                 setuid(1);
8824         }
8825 #ifdef TRY_BSD_PGRP
8826         if (-1 == setpgrp(1, 1))
8827                 exit(0);
8828 #else
8829         if (setpgrp() != -1)
8830                 exit(0);
8831 #endif
8832         exit(1);
8833 }
8834 EOP
8835         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
8836                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8837                 val="$define"
8838         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
8839                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8840                 val="$undef"
8841         else
8842                 echo "(I can't seem to compile and run the test program.)"
8843                 if ./usg; then
8844                         xxx="a USG one, i.e. you use setpgrp()."
8845                 else
8846                         # SVR4 systems can appear rather BSD-ish.
8847                         case "$i_unistd" in
8848                         $undef)
8849                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8850                                 val="$define"
8851                                 ;;
8852                         $define)
8853                                 xxx="probably a USG one, i.e. you use setpgrp()."
8854                                 val="$undef"
8855                                 ;;
8856                         esac
8857                 fi
8858                 echo "Assuming your setpgrp is $xxx" >&4
8859         fi
8860         ;;
8861 *) val="$undef";;
8862 esac
8863 set d_bsdsetpgrp
8864 eval $setvar
8865 $rm -f try try.*
8866 : see if bzero exists
8867 set bzero d_bzero
8868 eval $inlibc
8869
8870 : see if signal is declared as pointer to function returning int or void
8871 echo " "
8872 xxx=`./findhdr signal.h`
8873 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8874 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
8875         echo "You have int (*signal())() instead of void." >&4
8876         val="$undef"
8877 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
8878         echo "You have void (*signal())()." >&4
8879         val="$define"
8880 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8881         echo "You have int (*signal())() instead of void." >&4
8882         val="$undef"
8883 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8884         echo "You have void (*signal())()." >&4
8885         val="$define"
8886 else
8887         case "$d_voidsig" in
8888         '')
8889         echo "I can't determine whether signal handler returns void or int..." >&4
8890                 dflt=void
8891                 rp="What type does your signal handler return?"
8892                 . ./myread
8893                 case "$ans" in
8894                 v*) val="$define";;
8895                 *) val="$undef";;
8896                 esac;;
8897         "$define")
8898                 echo "As you already told me, signal handler returns void." >&4
8899                 val="$define"
8900                 ;;
8901         *)      echo "As you already told me, signal handler returns int." >&4
8902                 val="$undef"
8903                 ;;
8904         esac
8905 fi
8906 set d_voidsig
8907 eval $setvar
8908 case "$d_voidsig" in
8909 "$define") signal_t="void";;
8910 *) signal_t="int";;
8911 esac
8912 $rm -f $$.tmp
8913
8914 : check for ability to cast large floats to 32-bit ints.
8915 echo " "
8916 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8917 if $test "$intsize" -ge 4; then
8918         xxx=int
8919 else
8920         xxx=long
8921 fi
8922 $cat >try.c <<EOCP
8923 #include <stdio.h>
8924 #include <sys/types.h>
8925 #include <signal.h>
8926 $signal_t blech(s) int s; { exit(3); }
8927 int main()
8928 {
8929         $xxx i32;
8930         double f, g;
8931         int result = 0;
8932         char str[16];
8933         signal(SIGFPE, blech);
8934
8935         /* Don't let compiler optimize the test away.  Store the number 
8936            in a writable string for gcc to pass to sscanf under HP/UX.
8937         */
8938         sprintf(str, "2147483647");
8939         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8940         g = 10 * f;
8941         i32  = ($xxx) g;
8942
8943         /* x86 processors will probably give 0x8000 0000, which is a
8944        sign change.  We don't want that.  We want to mimic SPARC
8945            behavior here, which is to preserve the sign and give
8946            back 0x7fff ffff.
8947         */
8948         if (i32 != ($xxx) f)
8949                 result |= 1;
8950         exit(result);
8951 }
8952 EOCP
8953 set try
8954 if eval $compile_ok; then
8955         $run ./try
8956         yyy=$?
8957 else
8958         echo "(I can't seem to compile the test program--assuming it can't)"
8959         yyy=1
8960 fi
8961 case "$yyy" in
8962 0)      val="$define"
8963         echo "Yup, it can."
8964         ;;
8965 *)      val="$undef"
8966         echo "Nope, it can't."
8967         ;;
8968 esac
8969 set d_casti32
8970 eval $setvar
8971 $rm -f try try.*
8972
8973 : check for ability to cast negative floats to unsigned
8974 echo " "
8975 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8976 $cat >try.c <<EOCP
8977 #include <stdio.h>
8978 #include <sys/types.h>
8979 #include <signal.h>
8980 $signal_t blech(s) int s; { exit(7); }
8981 $signal_t blech_in_list(s) int s; { exit(4); }
8982 unsigned long dummy_long(p) unsigned long p; { return p; }
8983 unsigned int dummy_int(p) unsigned int p; { return p; }
8984 unsigned short dummy_short(p) unsigned short p; { return p; }
8985 int main()
8986 {
8987         double f;
8988         unsigned long along;
8989         unsigned int aint;
8990         unsigned short ashort;
8991         int result = 0;
8992         char str[16];
8993         
8994         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8995            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8996            optimized the whole file away
8997         */
8998         /* Store the number in a writable string for gcc to pass to 
8999            sscanf under HP/UX.
9000         */
9001         sprintf(str, "-123");
9002         sscanf(str, "%lf", &f);  /* f = -123.; */
9003
9004         signal(SIGFPE, blech);
9005         along = (unsigned long)f;
9006         aint = (unsigned int)f;
9007         ashort = (unsigned short)f;
9008         if (along != (unsigned long)-123)
9009                 result |= 1;
9010         if (aint != (unsigned int)-123)
9011                 result |= 1;
9012         if (ashort != (unsigned short)-123)
9013                 result |= 1;
9014         sprintf(str, "1073741824.");
9015         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
9016         f = f + f;
9017         along = 0;
9018         along = (unsigned long)f;
9019         if (along != 0x80000000)
9020                 result |= 2;
9021         f -= 1.;
9022         along = 0;
9023         along = (unsigned long)f;
9024         if (along != 0x7fffffff)
9025                 result |= 1;
9026         f += 2.;
9027         along = 0;
9028         along = (unsigned long)f;
9029         if (along != 0x80000001)
9030                 result |= 2;
9031         if (result)
9032                 exit(result);
9033         signal(SIGFPE, blech_in_list);
9034         sprintf(str, "123.");
9035         sscanf(str, "%lf", &f);  /* f = 123.; */
9036         along = dummy_long((unsigned long)f);
9037         aint = dummy_int((unsigned int)f);
9038         ashort = dummy_short((unsigned short)f);
9039         if (along != (unsigned long)123)
9040                 result |= 4;
9041         if (aint != (unsigned int)123)
9042                 result |= 4;
9043         if (ashort != (unsigned short)123)
9044                 result |= 4;
9045         exit(result);
9046
9047 }
9048 EOCP
9049 set try
9050 if eval $compile_ok; then
9051         $run ./try
9052         castflags=$?
9053 else
9054         echo "(I can't seem to compile the test program--assuming it can't)"
9055         castflags=7
9056 fi
9057 case "$castflags" in
9058 0)      val="$define"
9059         echo "Yup, it can."
9060         ;;
9061 *)      val="$undef"
9062         echo "Nope, it can't."
9063         ;;
9064 esac
9065 set d_castneg
9066 eval $setvar
9067 $rm -f try.*
9068
9069 : see if vprintf exists
9070 echo " "
9071 if set vprintf val -f d_vprintf; eval $csym; $val; then
9072         echo 'vprintf() found.' >&4
9073         val="$define"
9074         $cat >try.c <<'EOF'
9075 #include <varargs.h>
9076
9077 int main() { xxx("foo"); }
9078
9079 xxx(va_alist)
9080 va_dcl
9081 {
9082         va_list args;
9083         char buf[10];
9084
9085         va_start(args);
9086         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
9087 }
9088 EOF
9089         set try
9090         if eval $compile && $run ./try; then
9091                 echo "Your vsprintf() returns (int)." >&4
9092                 val2="$undef"
9093         else
9094                 echo "Your vsprintf() returns (char*)." >&4
9095                 val2="$define"
9096         fi
9097 else
9098         echo 'vprintf() NOT found.' >&4
9099                 val="$undef"
9100                 val2="$undef"
9101 fi
9102 $rm -f try try.*
9103 set d_vprintf
9104 eval $setvar
9105 val=$val2
9106 set d_charvspr
9107 eval $setvar
9108
9109 : see if chown exists
9110 set chown d_chown
9111 eval $inlibc
9112
9113 : see if chroot exists
9114 set chroot d_chroot
9115 eval $inlibc
9116
9117 : see if chsize exists
9118 set chsize d_chsize
9119 eval $inlibc
9120
9121 : see if class exists
9122 set class d_class
9123 eval $inlibc
9124
9125 hasstruct='varname=$1; struct=$2; shift; shift;
9126 while $test $# -ge 2; do
9127         case "$1" in
9128         $define) echo "#include <$2>";;
9129         esac ;
9130     shift 2;
9131 done > try.c;
9132 echo "int main () { struct $struct foo; }" >> try.c;
9133 set try;
9134 if eval $compile; then
9135         val="$define";
9136 else
9137         val="$undef";
9138 fi;
9139 set $varname;
9140 eval $setvar;
9141 $rm -f try.c try.o'
9142
9143 : see if sys/types.h has to be included
9144 set sys/types.h i_systypes
9145 eval $inhdr
9146
9147 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9148 while $test $# -ge 2; do
9149         case "$1" in
9150         $define) echo "#include <$2>";;
9151         esac ;
9152     shift 2;
9153 done > try.c;
9154 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9155 set try;
9156 if eval $compile; then
9157         val="$define";
9158 else
9159         val="$undef";
9160 fi;
9161 set $varname;
9162 eval $setvar;
9163 $rm -f try.c try.o'
9164
9165 socketlib=''
9166 sockethdr=''
9167 : see whether socket exists
9168 echo " "
9169 $echo $n "Hmm... $c" >&4
9170 if set socket val -f d_socket; eval $csym; $val; then
9171         echo "Looks like you have Berkeley networking support." >&4
9172         d_socket="$define"
9173         if set setsockopt val -f; eval $csym; $val; then
9174                 d_oldsock="$undef"
9175         else
9176                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9177                 d_oldsock="$define"
9178         fi
9179 else
9180         if $contains socklib libc.list >/dev/null 2>&1; then
9181                 echo "Looks like you have Berkeley networking support." >&4
9182                 d_socket="$define"
9183                 : we will have to assume that it supports the 4.2 BSD interface
9184                 d_oldsock="$undef"
9185         else
9186                 echo "You don't have Berkeley networking in libc$_a..." >&4
9187                 if test "X$d_socket" = "X$define"; then
9188                    echo "...but you seem to believe that you have sockets." >&4
9189                 else
9190                         for net in net socket
9191                         do
9192                                 if test -f /usr/lib/lib$net$_a; then
9193                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9194                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9195                                         if $contains socket libc.list >/dev/null 2>&1; then
9196                                                 d_socket="$define"
9197                                                 socketlib="-l$net"
9198                                                 case "$net" in
9199                                                 net)
9200                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9201                                                         sockethdr="-I/usr/netinclude"
9202                                                         ;;
9203                                                 esac
9204                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
9205                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9206                                                         d_oldsock="$undef"
9207                                                 else
9208                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9209                                                         d_oldsock="$define"
9210                                                 fi
9211                                                 break
9212                                         fi
9213                                 fi
9214                         done
9215                         if test "X$d_socket" != "X$define"; then
9216                            echo "or anywhere else I see." >&4
9217                            d_socket="$undef"
9218                            d_oldsock="$undef"
9219                         fi
9220                 fi
9221         fi
9222 fi
9223
9224 : see if socketpair exists
9225 set socketpair d_sockpair
9226 eval $inlibc
9227
9228
9229 echo " "
9230 echo "Checking the availability of certain socket constants..." >& 4
9231 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9232         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9233         $cat >try.c <<EOF
9234 #include <sys/types.h>
9235 #include <sys/socket.h>
9236 int main() {
9237     int i = $ENUM;
9238 }
9239 EOF
9240         val="$undef"
9241         set try; if eval $compile; then
9242                 val="$define"
9243         fi
9244         set d_${enum}; eval $setvar
9245         $rm -f try.c try
9246 done
9247
9248 : see if this is a sys/uio.h system
9249 set sys/uio.h i_sysuio
9250 eval $inhdr
9251
9252
9253 echo " "
9254 echo "Checking to see if your system supports struct cmsghdr..." >&4
9255 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
9256 eval $hasstruct
9257 case "$d_cmsghdr_s" in
9258 "$define")      echo "Yes, it does."   ;;
9259 *)              echo "No, it doesn't." ;;
9260 esac
9261
9262
9263 : check for const keyword
9264 echo " "
9265 echo 'Checking to see if your C compiler knows about "const"...' >&4
9266 $cat >const.c <<'EOCP'
9267 typedef struct spug { int drokk; } spug;
9268 int main()
9269 {
9270         const char *foo;
9271         const spug y;
9272 }
9273 EOCP
9274 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
9275         val="$define"
9276         echo "Yup, it does."
9277 else
9278         val="$undef"
9279         echo "Nope, it doesn't."
9280 fi
9281 set d_const
9282 eval $setvar
9283
9284 : see if crypt exists
9285 echo " "
9286 if set crypt val -f d_crypt; eval $csym; $val; then
9287         echo 'crypt() found.' >&4
9288         val="$define"
9289         cryptlib=''
9290 else
9291         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
9292         if $test -z "$cryptlib"; then
9293                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
9294         else
9295                 cryptlib=-lcrypt
9296         fi
9297         if $test -z "$cryptlib"; then
9298                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
9299         else
9300                 cryptlib=-lcrypt
9301         fi
9302         if $test -z "$cryptlib"; then
9303                 cryptlib=`./loc libcrypt$_a "" $libpth`
9304         else
9305                 cryptlib=-lcrypt
9306         fi
9307         if $test -z "$cryptlib"; then
9308                 echo 'crypt() NOT found.' >&4
9309                 val="$undef"
9310         else
9311                 val="$define"
9312         fi
9313 fi
9314 set d_crypt
9315 eval $setvar
9316
9317 : get csh whereabouts
9318 case "$csh" in
9319 'csh') val="$undef" ;;
9320 *) val="$define" ;;
9321 esac
9322 set d_csh
9323 eval $setvar
9324 : Respect a hint or command line value for full_csh.
9325 case "$full_csh" in
9326 '') full_csh=$csh ;;
9327 esac
9328
9329 : see if cuserid exists
9330 set cuserid d_cuserid
9331 eval $inlibc
9332
9333 : see if this is a limits.h system
9334 set limits.h i_limits
9335 eval $inhdr
9336
9337 : see if this is a float.h system
9338 set float.h i_float
9339 eval $inhdr
9340
9341 : See if number of significant digits in a double precision number is known
9342 echo " "
9343 $cat >dbl_dig.c <<EOM
9344 #$i_limits I_LIMITS
9345 #$i_float I_FLOAT
9346 #ifdef I_LIMITS
9347 #include <limits.h>
9348 #endif
9349 #ifdef I_FLOAT
9350 #include <float.h>
9351 #endif
9352 #ifdef DBL_DIG
9353 printf("Contains DBL_DIG");
9354 #endif
9355 EOM
9356 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
9357 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
9358         echo "DBL_DIG found." >&4
9359         val="$define"
9360 else
9361         echo "DBL_DIG NOT found." >&4
9362         val="$undef"
9363 fi
9364 $rm -f dbl_dig.?
9365 set d_dbl_dig
9366 eval $setvar
9367
9368 hasproto='varname=$1; func=$2; shift; shift;
9369 while $test $# -ge 2; do
9370         case "$1" in
9371         $define) echo "#include <$2>";;
9372         esac ;
9373     shift 2;
9374 done > try.c;
9375 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9376 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9377         echo "$func() prototype found.";
9378         val="$define";
9379 else
9380         echo "$func() prototype NOT found.";
9381         val="$undef";
9382 fi;
9383 set $varname;
9384 eval $setvar;
9385 $rm -f try.c tryout.c'
9386
9387 : see if dbm.h is available
9388 : see if dbmclose exists
9389 set dbmclose d_dbmclose
9390 eval $inlibc
9391
9392 case "$d_dbmclose" in
9393 $define)
9394         set dbm.h i_dbm
9395         eval $inhdr
9396         case "$i_dbm" in
9397         $define)
9398                 val="$undef"
9399                 set i_rpcsvcdbm
9400                 eval $setvar
9401                 ;;
9402         *)      set rpcsvc/dbm.h i_rpcsvcdbm
9403                 eval $inhdr
9404                 ;;
9405         esac
9406         ;;
9407 *)      echo "We won't be including <dbm.h>"
9408         val="$undef"
9409         set i_dbm
9410         eval $setvar
9411         val="$undef"
9412         set i_rpcsvcdbm
9413         eval $setvar
9414         ;;
9415 esac
9416
9417 : see if prototype for dbminit is available
9418 echo " "
9419 set d_dbminitproto dbminit $i_dbm dbm.h
9420 eval $hasproto
9421
9422 : see if difftime exists
9423 set difftime d_difftime
9424 eval $inlibc
9425
9426 : see if this is a dirent system
9427 echo " "
9428 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
9429         val="$define"
9430         echo "<dirent.h> found." >&4
9431 else
9432         val="$undef"
9433         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
9434                 echo "<sys/dir.h> found." >&4
9435                 echo " "
9436         else
9437                 xinc=`./findhdr sys/ndir.h`
9438         fi
9439         echo "<dirent.h> NOT found." >&4
9440 fi
9441 set i_dirent
9442 eval $setvar
9443
9444 : Look for type of directory structure.
9445 echo " "
9446 $cppstdin $cppflags $cppminus < "$xinc" > try.c
9447
9448 case "$direntrytype" in
9449 ''|' ')
9450         case "$i_dirent" in
9451         $define) guess1='struct dirent' ;;
9452         *) guess1='struct direct'  ;;
9453         esac
9454         ;;
9455 *)      guess1="$direntrytype"
9456         ;;
9457 esac
9458
9459 case "$guess1" in
9460 'struct dirent') guess2='struct direct' ;;
9461 *) guess2='struct dirent' ;;
9462 esac
9463                 
9464 if $contains "$guess1" try.c >/dev/null 2>&1; then
9465         direntrytype="$guess1"
9466         echo "Your directory entries are $direntrytype." >&4
9467 elif $contains "$guess2" try.c >/dev/null 2>&1; then
9468         direntrytype="$guess2"
9469         echo "Your directory entries seem to be $direntrytype." >&4
9470 else
9471         echo "I don't recognize your system's directory entries." >&4
9472         rp="What type is used for directory entries on this system?"
9473         dflt="$guess1"
9474         . ./myread
9475         direntrytype="$ans"
9476 fi
9477 $rm -f try.c
9478
9479
9480 : see if the directory entry stores field length
9481 echo " "
9482 $cppstdin $cppflags $cppminus < "$xinc" > try.c
9483 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
9484         echo "Good, your directory entry keeps length information in d_namlen." >&4
9485         val="$define"
9486 else
9487         echo "Your directory entry does not know about the d_namlen field." >&4
9488         val="$undef"
9489 fi
9490 set d_dirnamlen
9491 eval $setvar
9492 $rm -f try.c
9493
9494 : see if dlerror exists
9495 xxx_runnm="$runnm"
9496 runnm=false
9497 set dlerror d_dlerror
9498 eval $inlibc
9499 runnm="$xxx_runnm"
9500
9501 : see if dlfcn is available
9502 set dlfcn.h i_dlfcn
9503 eval $inhdr
9504
9505 case "$usedl" in
9506 $define|y|true)
9507         $cat << EOM
9508
9509 On a few systems, the dynamically loaded modules that perl generates and uses
9510 will need a different extension than shared libs. The default will probably
9511 be appropriate.
9512
9513 EOM
9514         case "$dlext" in
9515         '')     dflt="$so" ;;
9516         *)      dflt="$dlext" ;;
9517         esac
9518         rp='What is the extension of dynamically loaded modules'
9519         . ./myread
9520         dlext="$ans"
9521         ;;
9522 *)
9523         dlext="none"
9524         ;;
9525 esac
9526
9527 : Check if dlsym need a leading underscore
9528 echo " "
9529 val="$undef"
9530
9531 case "$dlsrc" in
9532 dl_dlopen.xs)
9533         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
9534         $cat >dyna.c <<'EOM'
9535 fred () { }
9536 EOM
9537
9538 $cat >fred.c<<EOM
9539
9540 #include <stdio.h>
9541 #$i_dlfcn I_DLFCN
9542 #ifdef I_DLFCN
9543 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
9544 #else
9545 #include <sys/types.h>
9546 #include <nlist.h>
9547 #include <link.h>
9548 #endif
9549
9550 extern int fred() ;
9551
9552 int main()
9553 {
9554     void * handle ;
9555     void * symbol ;
9556 #ifndef RTLD_LAZY
9557     int mode = 1 ;
9558 #else
9559     int mode = RTLD_LAZY ;
9560 #endif
9561     handle = dlopen("./dyna.$dlext", mode) ;
9562     if (handle == NULL) {
9563         printf ("1\n") ;
9564         fflush (stdout) ;
9565         exit(0);
9566     }
9567     symbol = dlsym(handle, "fred") ;
9568     if (symbol == NULL) {
9569         /* try putting a leading underscore */
9570         symbol = dlsym(handle, "_fred") ;
9571         if (symbol == NULL) {
9572             printf ("2\n") ;
9573             fflush (stdout) ;
9574             exit(0);
9575         }
9576         printf ("3\n") ;
9577     }
9578     else
9579         printf ("4\n") ;
9580     fflush (stdout) ;
9581     exit(0);
9582 }
9583 EOM
9584         : Call the object file tmp-dyna.o in case dlext=o.
9585         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
9586                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
9587                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
9588                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
9589                 xxx=`$run ./fred`
9590                 case $xxx in
9591                 1)      echo "Test program failed using dlopen." >&4
9592                         echo "Perhaps you should not use dynamic loading." >&4;;
9593                 2)      echo "Test program failed using dlsym." >&4
9594                         echo "Perhaps you should not use dynamic loading." >&4;;
9595                 3)      echo "dlsym needs a leading underscore" >&4
9596                         val="$define" ;;
9597                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
9598                 esac
9599         else
9600                 echo "I can't compile and run the test program." >&4
9601                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
9602         fi
9603         ;;
9604 esac
9605                 
9606 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
9607
9608 set d_dlsymun
9609 eval $setvar
9610
9611 : see if prototype for drand48 is available
9612 echo " "
9613 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
9614 eval $hasproto
9615
9616 : see if dup2 exists
9617 set dup2 d_dup2
9618 eval $inlibc
9619
9620 : see if eaccess exists
9621 set eaccess d_eaccess
9622 eval $inlibc
9623
9624 : see if endgrent exists
9625 set endgrent d_endgrent
9626 eval $inlibc
9627
9628 : see if endhostent exists
9629 set endhostent d_endhent
9630 eval $inlibc
9631
9632 : see if endnetent exists
9633 set endnetent d_endnent
9634 eval $inlibc
9635
9636 : see if endprotoent exists
9637 set endprotoent d_endpent
9638 eval $inlibc
9639
9640 : see if endpwent exists
9641 set endpwent d_endpwent
9642 eval $inlibc
9643
9644 : see if endservent exists
9645 set endservent d_endsent
9646 eval $inlibc
9647
9648 : Locate the flags for 'open()'
9649 echo " "
9650 $cat >try.c <<'EOCP'
9651 #include <sys/types.h>
9652 #ifdef I_FCNTL
9653 #include <fcntl.h>
9654 #endif
9655 #ifdef I_SYS_FILE
9656 #include <sys/file.h>
9657 #endif
9658 int main() {
9659         if(O_RDONLY);
9660 #ifdef O_TRUNC
9661         exit(0);
9662 #else
9663         exit(1);
9664 #endif
9665 }
9666 EOCP
9667 : check sys/file.h first to get FREAD on Sun
9668 if $test `./findhdr sys/file.h` && \
9669                 set try -DI_SYS_FILE && eval $compile; then
9670         h_sysfile=true;
9671         echo "<sys/file.h> defines the O_* constants..." >&4
9672         if $run ./try; then
9673                 echo "and you have the 3 argument form of open()." >&4
9674                 val="$define"
9675         else
9676                 echo "but not the 3 argument form of open().  Oh, well." >&4
9677                 val="$undef"
9678         fi
9679 elif $test `./findhdr fcntl.h` && \
9680                 set try -DI_FCNTL && eval $compile; then
9681         h_fcntl=true;
9682         echo "<fcntl.h> defines the O_* constants..." >&4
9683         if $run ./try; then
9684                 echo "and you have the 3 argument form of open()." >&4
9685                 val="$define"
9686         else
9687                 echo "but not the 3 argument form of open().  Oh, well." >&4
9688                 val="$undef"
9689         fi
9690 else
9691         val="$undef"
9692         echo "I can't find the O_* constant definitions!  You got problems." >&4
9693 fi
9694 set d_open3
9695 eval $setvar
9696 $rm -f try try.*
9697
9698 : see which of string.h or strings.h is needed
9699 echo " "
9700 strings=`./findhdr string.h`
9701 if $test "$strings" && $test -r "$strings"; then
9702         echo "Using <string.h> instead of <strings.h>." >&4
9703         val="$define"
9704 else
9705         val="$undef"
9706         strings=`./findhdr strings.h`
9707         if $test "$strings" && $test -r "$strings"; then
9708                 echo "Using <strings.h> instead of <string.h>." >&4
9709         else
9710                 echo "No string header found -- You'll surely have problems." >&4
9711         fi
9712 fi
9713 set i_string
9714 eval $setvar
9715 case "$i_string" in
9716 "$undef") strings=`./findhdr strings.h`;;
9717 *)        strings=`./findhdr string.h`;;
9718 esac
9719
9720 : check for non-blocking I/O stuff
9721 case "$h_sysfile" in
9722 true) echo "#include <sys/file.h>" > head.c;;
9723 *)
9724        case "$h_fcntl" in
9725        true) echo "#include <fcntl.h>" > head.c;;
9726        *) echo "#include <sys/fcntl.h>" > head.c;;
9727        esac
9728        ;;
9729 esac
9730 echo " "
9731 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
9732 case "$o_nonblock" in
9733 '')
9734         $cat head.c > try.c
9735         $cat >>try.c <<'EOCP'
9736 #include <stdio.h>
9737 #include <stdlib.h>
9738 int main() {
9739 #ifdef O_NONBLOCK
9740         printf("O_NONBLOCK\n");
9741         exit(0);
9742 #endif
9743 #ifdef O_NDELAY
9744         printf("O_NDELAY\n");
9745         exit(0);
9746 #endif
9747 #ifdef FNDELAY
9748         printf("FNDELAY\n");
9749         exit(0);
9750 #endif
9751         exit(0);
9752 }
9753 EOCP
9754         set try
9755         if eval $compile_ok; then
9756                 o_nonblock=`$run ./try`
9757                 case "$o_nonblock" in
9758                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
9759                 *) echo "Seems like we can use $o_nonblock.";;
9760                 esac
9761         else
9762                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
9763         fi
9764         ;;
9765 *) echo "Using $hint value $o_nonblock.";;
9766 esac
9767 $rm -f try try.* .out core
9768
9769 echo " "
9770 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
9771 case "$eagain" in
9772 '')
9773         $cat head.c > try.c
9774         $cat >>try.c <<EOCP
9775 #include <errno.h>
9776 #include <sys/types.h>
9777 #include <signal.h>
9778 #include <stdio.h> 
9779 #include <stdlib.h> 
9780 #define MY_O_NONBLOCK $o_nonblock
9781 #ifndef errno  /* XXX need better Configure test */
9782 extern int errno;
9783 #endif
9784 #$i_unistd I_UNISTD
9785 #ifdef I_UNISTD
9786 #include <unistd.h>
9787 #endif
9788 #$i_string I_STRING
9789 #ifdef I_STRING
9790 #include <string.h>
9791 #else
9792 #include <strings.h>
9793 #endif
9794 $signal_t blech(x) int x; { exit(3); }
9795 EOCP
9796         $cat >> try.c <<'EOCP'
9797 int main()
9798 {
9799         int pd[2];
9800         int pu[2];
9801         char buf[1];
9802         char string[100];
9803
9804         pipe(pd);       /* Down: child -> parent */
9805         pipe(pu);       /* Up: parent -> child */
9806         if (0 != fork()) {
9807                 int ret;
9808                 close(pd[1]);   /* Parent reads from pd[0] */
9809                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
9810 #ifdef F_SETFL
9811                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
9812                         exit(1);
9813 #else
9814                 exit(4);
9815 #endif
9816                 signal(SIGALRM, blech);
9817                 alarm(5);
9818                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
9819                         exit(2);
9820                 sprintf(string, "%d\n", ret);
9821                 write(2, string, strlen(string));
9822                 alarm(0);
9823 #ifdef EAGAIN
9824                 if (errno == EAGAIN) {
9825                         printf("EAGAIN\n");
9826                         goto ok;
9827                 }
9828 #endif
9829 #ifdef EWOULDBLOCK
9830                 if (errno == EWOULDBLOCK)
9831                         printf("EWOULDBLOCK\n");
9832 #endif
9833         ok:
9834                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
9835                 sleep(2);                               /* Give it time to close our pipe */
9836                 alarm(5);
9837                 ret = read(pd[0], buf, 1);      /* Should read EOF */
9838                 alarm(0);
9839                 sprintf(string, "%d\n", ret);
9840                 write(3, string, strlen(string));
9841                 exit(0);
9842         }
9843
9844         close(pd[0]);                   /* We write to pd[1] */
9845         close(pu[1]);                   /* We read from pu[0] */
9846         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
9847         close(pd[1]);                   /* Pipe pd is now fully closed! */
9848         exit(0);                                /* Bye bye, thank you for playing! */
9849 }
9850 EOCP
9851         set try
9852         if eval $compile_ok; then
9853                 echo "$startsh" >mtry
9854                 echo "$run ./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
9855                 chmod +x mtry
9856                 ./mtry >/dev/null 2>&1
9857                 case $? in
9858                 0) eagain=`$cat try.out`;;
9859                 1) echo "Could not perform non-blocking setting!";;
9860                 2) echo "I did a successful read() for something that was not there!";;
9861                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
9862                 4) echo "Could not find F_SETFL!";;
9863                 *) echo "Something terribly wrong happened during testing.";;
9864                 esac
9865                 rd_nodata=`$cat try.ret`
9866                 echo "A read() system call with no data present returns $rd_nodata."
9867                 case "$rd_nodata" in
9868                 0|-1) ;;
9869                 *)
9870                         echo "(That's peculiar, fixing that to be -1.)"
9871                         rd_nodata=-1
9872                         ;;
9873                 esac
9874                 case "$eagain" in
9875                 '')
9876                         echo "Forcing errno EAGAIN on read() with no data available."
9877                         eagain=EAGAIN
9878                         ;;
9879                 *)
9880                         echo "Your read() sets errno to $eagain when no data is available."
9881                         ;;
9882                 esac
9883                 status=`$cat try.err`
9884                 case "$status" in
9885                 0) echo "And it correctly returns 0 to signal EOF.";;
9886                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
9887                 *) echo "However, your read() returns '$status' on EOF??";;
9888                 esac
9889                 val="$define"
9890                 if test "$status" = "$rd_nodata"; then
9891                         echo "WARNING: you can't distinguish between EOF and no data!"
9892                         val="$undef"
9893                 fi
9894         else
9895                 echo "I can't compile the test program--assuming errno EAGAIN will do."
9896                 eagain=EAGAIN
9897         fi
9898         set d_eofnblk
9899         eval $setvar
9900         ;;
9901 *)
9902         echo "Using $hint value $eagain."
9903         echo "Your read() returns $rd_nodata when no data is present."
9904         case "$d_eofnblk" in
9905         "$define") echo "And you can see EOF because read() returns 0.";;
9906         "$undef") echo "But you can't see EOF status from read() returned value.";;
9907         *)
9908                 echo "(Assuming you can't see EOF status from read anyway.)"
9909                 d_eofnblk=$undef
9910                 ;;
9911         esac
9912         ;;
9913 esac
9914 $rm -f try try.* .out core head.c mtry
9915
9916 : see if fchdir exists
9917 set fchdir d_fchdir
9918 eval $inlibc
9919
9920 : see if fchmod exists
9921 set fchmod d_fchmod
9922 eval $inlibc
9923
9924 : see if fchown exists
9925 set fchown d_fchown
9926 eval $inlibc
9927
9928 : see if this is an fcntl system
9929 set fcntl d_fcntl
9930 eval $inlibc
9931
9932 echo " "
9933 : See if fcntl-based locking works.
9934 $cat >try.c <<EOCP
9935 #include <stdlib.h>
9936 #include <unistd.h>
9937 #include <fcntl.h>
9938 #include <signal.h>
9939 $signal_t blech(x) int x; { exit(3); }
9940 int main() {
9941 #if defined(F_SETLK) && defined(F_SETLKW)
9942      struct flock flock;
9943      int retval, fd;
9944      fd = open("try.c", O_RDONLY);
9945      flock.l_type = F_RDLCK;
9946      flock.l_whence = SEEK_SET;
9947      flock.l_start = flock.l_len = 0;
9948      signal(SIGALRM, blech);
9949      alarm(10);
9950      retval = fcntl(fd, F_SETLK, &flock);
9951      close(fd);
9952      (retval < 0 ? exit(2) : exit(0));
9953 #else
9954      exit(2);
9955 #endif
9956 }
9957 EOCP
9958 echo "Checking if fcntl-based file locking works... "
9959 case "$d_fcntl" in
9960 "$define")
9961         set try
9962         if eval $compile_ok; then
9963                 if $run ./try; then
9964                         echo "Yes, it seems to work."
9965                         val="$define"
9966                 else
9967                         echo "Nope, it didn't work."
9968                         val="$undef"
9969                         case "$?" in
9970                         3) $cat >&4 <<EOM
9971 ***
9972 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
9973 *** This is (almost) impossible.
9974 *** If your NFS lock daemons are not feeling well, something like
9975 *** this may happen, please investigate.  Cannot continue, aborting.
9976 ***
9977 EOM
9978                                 exit 1
9979                                 ;;
9980                         esac
9981                 fi
9982         else
9983                 echo "I'm unable to compile the test program, so I'll assume not."
9984                 val="$undef"
9985         fi
9986         ;;
9987 *) val="$undef";
9988         echo "Nope, since you don't even have fcntl()."
9989         ;;
9990 esac
9991 set d_fcntl_can_lock
9992 eval $setvar
9993 $rm -f try*
9994
9995
9996 : see if sys/select.h has to be included
9997 set sys/select.h i_sysselct
9998 eval $inhdr
9999
10000 : see if we should include time.h, sys/time.h, or both
10001 echo " "
10002 if test "X$timeincl" = X; then
10003         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10004         $echo $n "I'm now running the test program...$c"
10005         $cat >try.c <<'EOCP'
10006 #include <sys/types.h>
10007 #ifdef I_TIME
10008 #include <time.h>
10009 #endif
10010 #ifdef I_SYSTIME
10011 #ifdef SYSTIMEKERNEL
10012 #define KERNEL
10013 #endif
10014 #include <sys/time.h>
10015 #endif
10016 #ifdef I_SYSSELECT
10017 #include <sys/select.h>
10018 #endif
10019 int main()
10020 {
10021         struct tm foo;
10022 #ifdef S_TIMEVAL
10023         struct timeval bar;
10024 #endif
10025 #ifdef S_TIMEZONE
10026         struct timezone tzp;
10027 #endif
10028         if (foo.tm_sec == foo.tm_sec)
10029                 exit(0);
10030 #ifdef S_TIMEVAL
10031         if (bar.tv_sec == bar.tv_sec)
10032                 exit(0);
10033 #endif
10034         exit(1);
10035 }
10036 EOCP
10037         flags=''
10038         for s_timezone in '-DS_TIMEZONE' ''; do
10039         sysselect=''
10040         for s_timeval in '-DS_TIMEVAL' ''; do
10041         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10042         for i_time in '' '-DI_TIME'; do
10043         for i_systime in '-DI_SYSTIME' ''; do
10044                 case "$flags" in
10045                 '') $echo $n ".$c"
10046                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10047                         if eval $compile; then
10048                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10049                                 shift
10050                                 flags="$*"
10051                                 echo " "
10052                                 $echo $n "Succeeded with $flags$c"
10053                         fi
10054                         ;;
10055                 esac
10056         done
10057         done
10058         done
10059         done
10060         done
10061         timeincl=''
10062         echo " "
10063         case "$flags" in
10064         *SYSTIMEKERNEL*) i_systimek="$define"
10065                 timeincl=`./findhdr sys/time.h`
10066                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10067         *) i_systimek="$undef";;
10068         esac
10069         case "$flags" in
10070         *I_TIME*) i_time="$define"
10071                 timeincl=`./findhdr time.h`" $timeincl"
10072                 echo "We'll include <time.h>." >&4;;
10073         *) i_time="$undef";;
10074         esac
10075         case "$flags" in
10076         *I_SYSTIME*) i_systime="$define"
10077                 timeincl=`./findhdr sys/time.h`" $timeincl"
10078                 echo "We'll include <sys/time.h>." >&4;;
10079         *) i_systime="$undef";;
10080         esac
10081         $rm -f try.c try
10082 fi
10083
10084 : check for fd_set items
10085 $cat <<EOM
10086
10087 Checking to see how well your C compiler handles fd_set and friends ...
10088 EOM
10089 $cat >try.c <<EOCP
10090 #$i_systime I_SYS_TIME
10091 #$i_sysselct I_SYS_SELECT
10092 #$d_socket HAS_SOCKET
10093 #include <sys/types.h>
10094 #ifdef HAS_SOCKET
10095 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
10096 #endif
10097 #ifdef I_SYS_TIME
10098 #include <sys/time.h>
10099 #endif
10100 #ifdef I_SYS_SELECT
10101 #include <sys/select.h>
10102 #endif
10103 int main() {
10104         fd_set fds;
10105
10106 #ifdef TRYBITS
10107         if(fds.fds_bits);
10108 #endif
10109
10110 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
10111         exit(0);
10112 #else
10113         exit(1);
10114 #endif
10115 }
10116 EOCP
10117 set try -DTRYBITS
10118 if eval $compile; then
10119         d_fds_bits="$define"
10120         d_fd_set="$define"
10121         echo "Well, your system knows about the normal fd_set typedef..." >&4
10122         if $run ./try; then
10123                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
10124                 d_fd_macros="$define"
10125         else
10126                 $cat >&4 <<'EOM'
10127 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
10128 EOM
10129                 d_fd_macros="$undef"
10130         fi
10131 else
10132         $cat <<'EOM'
10133 Hmm, your compiler has some difficulty with fd_set.  Checking further...
10134 EOM
10135         set try
10136         if eval $compile; then
10137                 d_fds_bits="$undef"
10138                 d_fd_set="$define"
10139                 echo "Well, your system has some sort of fd_set available..." >&4
10140                 if $run ./try; then
10141                         echo "and you have the normal fd_set macros." >&4
10142                         d_fd_macros="$define"
10143                 else
10144                         $cat <<'EOM'
10145 but not the normal fd_set macros!  Gross!  More work for me...
10146 EOM
10147                         d_fd_macros="$undef"
10148                 fi
10149         else
10150         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
10151                 d_fd_set="$undef"
10152                 d_fds_bits="$undef"
10153                 d_fd_macros="$undef"
10154         fi
10155 fi
10156 $rm -f try try.*
10157
10158 : see if fgetpos exists
10159 set fgetpos d_fgetpos
10160 eval $inlibc
10161
10162 : see if finite exists
10163 set finite d_finite
10164 eval $inlibc
10165
10166 : see if finitel exists
10167 set finitel d_finitel
10168 eval $inlibc
10169
10170 : see if flock exists
10171 set flock d_flock
10172 eval $inlibc
10173
10174 : see if this is a sys/file.h system
10175 val=''
10176 set sys/file.h val
10177 eval $inhdr
10178
10179 : do we need to include sys/file.h ?
10180 case "$val" in
10181 "$define")
10182         echo " "
10183         if $h_sysfile; then
10184                 val="$define"
10185                 echo "We'll be including <sys/file.h>." >&4
10186         else
10187                 val="$undef"
10188                 echo "We won't be including <sys/file.h>." >&4
10189         fi
10190         ;;
10191 *)
10192         h_sysfile=false
10193         ;;
10194 esac
10195 set i_sysfile
10196 eval $setvar
10197
10198 : see if prototype for flock is available
10199 echo " "
10200 set d_flockproto flock $i_sysfile sys/file.h
10201 eval $hasproto
10202
10203 : see if fork exists
10204 set fork d_fork
10205 eval $inlibc
10206
10207 : see if fp_class exists
10208 set fp_class d_fp_class
10209 eval $inlibc
10210
10211 : see if pathconf exists
10212 set pathconf d_pathconf
10213 eval $inlibc
10214
10215 : see if fpathconf exists
10216 set fpathconf d_fpathconf
10217 eval $inlibc
10218
10219 : see if fpclass exists
10220 set fpclass d_fpclass
10221 eval $inlibc
10222
10223 : see if fpclassify exists
10224 set fpclassify d_fpclassify
10225 eval $inlibc
10226
10227 : see if fpclassl exists
10228 set fpclassl d_fpclassl
10229 eval $inlibc
10230
10231
10232 : check for fpos64_t
10233 echo " "
10234 echo "Checking to see if you have fpos64_t..." >&4
10235 $cat >try.c <<EOCP
10236 #include <stdio.h>
10237 int main() { fpos64_t x = 7; }
10238 EOCP
10239 set try
10240 if eval $compile; then
10241         val="$define"
10242         echo "You have fpos64_t."
10243 else
10244         val="$undef"
10245         echo "You do not have fpos64_t."
10246         case "$fpossize" in
10247         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
10248         esac
10249 fi
10250 $rm -f try.* try
10251 set d_fpos64_t
10252 eval $setvar
10253
10254 : see if frexpl exists
10255 set frexpl d_frexpl
10256 eval $inlibc
10257
10258 : see if this is a sys/param system
10259 set sys/param.h i_sysparam
10260 eval $inhdr
10261
10262 : see if this is a sys/mount.h system
10263 set sys/mount.h i_sysmount
10264 eval $inhdr
10265
10266
10267 echo " "
10268 echo "Checking to see if your system supports struct fs_data..." >&4
10269 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
10270 eval $hasstruct
10271 case "$d_fs_data_s" in
10272 "$define")      echo "Yes, it does."   ;;
10273 *)              echo "No, it doesn't." ;;
10274 esac
10275
10276 : see if fseeko exists
10277 set fseeko d_fseeko
10278 eval $inlibc
10279 case "$longsize" in
10280 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
10281 esac
10282
10283 : see if fsetpos exists
10284 set fsetpos d_fsetpos
10285 eval $inlibc
10286
10287
10288 : see if fstatfs exists
10289 set fstatfs d_fstatfs
10290 eval $inlibc
10291
10292
10293 : see if statvfs exists
10294 set statvfs d_statvfs
10295 eval $inlibc
10296
10297 : see if fstatvfs exists
10298 set fstatvfs d_fstatvfs
10299 eval $inlibc
10300
10301
10302 : see if fsync exists
10303 set fsync d_fsync
10304 eval $inlibc
10305
10306 : see if ftello exists
10307 set ftello d_ftello
10308 eval $inlibc
10309 case "$longsize" in
10310 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
10311 esac
10312
10313 : see if getcwd exists
10314 set getcwd d_getcwd
10315 eval $inlibc
10316
10317 : see if getespwnam exists
10318 set getespwnam d_getespwnam
10319 eval $inlibc
10320
10321
10322 : see if getfsstat exists
10323 set getfsstat d_getfsstat
10324 eval $inlibc
10325
10326 : see if getgrent exists
10327 set getgrent d_getgrent
10328 eval $inlibc
10329
10330 : see if gethostbyaddr exists
10331 set gethostbyaddr d_gethbyaddr
10332 eval $inlibc
10333
10334 : see if gethostbyname exists
10335 set gethostbyname d_gethbyname
10336 eval $inlibc
10337
10338 : see if gethostent exists
10339 set gethostent d_gethent
10340 eval $inlibc
10341
10342 : see how we will look up host name
10343 echo " "
10344 call=''
10345 if set gethostname val -f d_gethname; eval $csym; $val; then
10346         echo 'gethostname() found.' >&4
10347         d_gethname="$define"
10348         call=gethostname
10349 fi
10350 if set uname val -f d_uname; eval $csym; $val; then
10351         if ./xenix; then
10352                 $cat <<'EOM'
10353 uname() was found, but you're running xenix, and older versions of xenix
10354 have a broken uname(). If you don't really know whether your xenix is old
10355 enough to have a broken system call, use the default answer.
10356
10357 EOM
10358                 dflt=y
10359                 case "$d_uname" in
10360                 "$define") dflt=n;;
10361                 esac
10362                 rp='Is your uname() broken?'
10363                 . ./myread
10364                 case "$ans" in
10365                 n*) d_uname="$define"; call=uname;;
10366                 esac
10367         else
10368                 echo 'uname() found.' >&4
10369                 d_uname="$define"
10370                 case "$call" in
10371                 '') call=uname ;;
10372                 esac
10373         fi
10374 fi
10375 case "$d_gethname" in
10376 '') d_gethname="$undef";;
10377 esac
10378 case "$d_uname" in
10379 '') d_uname="$undef";;
10380 esac
10381 case "$d_uname$d_gethname" in
10382 *define*)
10383         dflt=n
10384         cat <<EOM
10385  
10386 Every now and then someone has a $call() that lies about the hostname
10387 but can't be fixed for political or economic reasons.  If you wish, I can
10388 pretend $call() isn't there and maybe compute hostname at run-time
10389 thanks to the '$phostname' command.
10390
10391 EOM
10392         rp="Shall I ignore $call() from now on?"
10393         . ./myread
10394         case "$ans" in
10395         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
10396         esac;;
10397 esac
10398 case "$phostname" in
10399 '') aphostname='';;
10400 *) case "$aphostname" in
10401         /*) ;;
10402         *) set X $phostname
10403                 shift
10404                 file=$1
10405                 shift
10406                 file=`./loc $file $file $pth`
10407                 aphostname=`echo $file $*`
10408                 ;;
10409         esac
10410         ;;
10411 esac
10412 case "$d_uname$d_gethname" in
10413 *define*) ;;
10414 *)
10415         case "$phostname" in
10416         '')
10417                 echo "There will be no way for $package to get your hostname." >&4;;
10418         *)
10419         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
10420                 ;;
10421         esac;;
10422 esac
10423 case "$d_phostname" in
10424 '') d_phostname="$undef";;
10425 esac
10426
10427 : see if this is a netdb.h system
10428 set netdb.h i_netdb
10429 eval $inhdr
10430
10431 : see if prototypes for various gethostxxx netdb.h functions are available
10432 echo " "
10433 set d_gethostprotos gethostent $i_netdb netdb.h
10434 eval $hasproto
10435
10436 : see if getitimer exists
10437 set getitimer d_getitimer
10438 eval $inlibc
10439
10440 : see if getlogin exists
10441 set getlogin d_getlogin
10442 eval $inlibc
10443
10444 : see if getmnt exists
10445 set getmnt d_getmnt
10446 eval $inlibc
10447
10448 : see if getmntent exists
10449 set getmntent d_getmntent
10450 eval $inlibc
10451
10452 : see if getnetbyaddr exists
10453 set getnetbyaddr d_getnbyaddr
10454 eval $inlibc
10455
10456 : see if getnetbyname exists
10457 set getnetbyname d_getnbyname
10458 eval $inlibc
10459
10460 : see if getnetent exists
10461 set getnetent d_getnent
10462 eval $inlibc
10463
10464 : see if prototypes for various getnetxxx netdb.h functions are available
10465 echo " "
10466 set d_getnetprotos getnetent $i_netdb netdb.h
10467 eval $hasproto
10468
10469 : see if getpagesize exists
10470 set getpagesize d_getpagsz
10471 eval $inlibc
10472
10473
10474 : see if getprotobyname exists
10475 set getprotobyname d_getpbyname
10476 eval $inlibc
10477
10478 : see if getprotobynumber exists
10479 set getprotobynumber d_getpbynumber
10480 eval $inlibc
10481
10482 : see if getprotoent exists
10483 set getprotoent d_getpent
10484 eval $inlibc
10485
10486 : see if getpgid exists
10487 set getpgid d_getpgid
10488 eval $inlibc
10489
10490 : see if getpgrp2 exists
10491 set getpgrp2 d_getpgrp2
10492 eval $inlibc
10493
10494 : see if getppid exists
10495 set getppid d_getppid
10496 eval $inlibc
10497
10498 : see if getpriority exists
10499 set getpriority d_getprior
10500 eval $inlibc
10501
10502 : see if prototypes for various getprotoxxx netdb.h functions are available
10503 echo " "
10504 set d_getprotoprotos getprotoent $i_netdb netdb.h
10505 eval $hasproto
10506
10507 : see if getprpwnam exists
10508 set getprpwnam d_getprpwnam
10509 eval $inlibc
10510
10511 : see if getpwent exists
10512 set getpwent d_getpwent
10513 eval $inlibc
10514
10515
10516 : see if getservbyname exists
10517 set getservbyname d_getsbyname
10518 eval $inlibc
10519
10520 : see if getservbyport exists
10521 set getservbyport d_getsbyport
10522 eval $inlibc
10523
10524 : see if getservent exists
10525 set getservent d_getsent
10526 eval $inlibc
10527
10528 : see if prototypes for various getservxxx netdb.h functions are available
10529 echo " "
10530 set d_getservprotos getservent $i_netdb netdb.h
10531 eval $hasproto
10532
10533 : see if getspnam exists
10534 set getspnam d_getspnam
10535 eval $inlibc
10536
10537 : see if gettimeofday or ftime exists
10538 set gettimeofday d_gettimeod
10539 eval $inlibc
10540 case "$d_gettimeod" in
10541 "$undef")
10542         set ftime d_ftime 
10543         eval $inlibc
10544         ;;
10545 *)
10546         val="$undef"; set d_ftime; eval $setvar
10547         ;;
10548 esac
10549 case "$d_gettimeod$d_ftime" in
10550 "$undef$undef")
10551         echo " "
10552         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
10553         ;;
10554 esac
10555
10556 : see if this is an grp system
10557 set grp.h i_grp
10558 eval $inhdr
10559
10560 case "$i_grp" in
10561 $define)
10562         xxx=`./findhdr grp.h`
10563         $cppstdin $cppflags $cppminus < $xxx >$$.h
10564
10565         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10566                 val="$define"
10567         else
10568                 val="$undef"
10569         fi
10570         set d_grpasswd
10571         eval $setvar
10572
10573         $rm -f $$.h
10574         ;;
10575 *)
10576         val="$undef";
10577         set d_grpasswd; eval $setvar
10578         ;;
10579 esac
10580
10581 : see if hasmntopt exists
10582 set hasmntopt d_hasmntopt
10583 eval $inlibc
10584
10585 : see if this is a netinet/in.h or sys/in.h system
10586 set netinet/in.h i_niin sys/in.h i_sysin
10587 eval $inhdr
10588
10589 : see if arpa/inet.h has to be included
10590 set arpa/inet.h i_arpainet
10591 eval $inhdr
10592
10593 : see if htonl --and friends-- exists
10594 val=''
10595 set htonl val
10596 eval $inlibc
10597
10598 : Maybe they are macros.
10599 case "$val" in
10600 $undef)
10601         $cat >htonl.c <<EOM
10602 #include <stdio.h>
10603 #include <sys/types.h>
10604 #$i_niin I_NETINET_IN
10605 #$i_sysin I_SYS_IN
10606 #$i_arpainet I_ARPA_INET
10607 #ifdef I_NETINET_IN
10608 #include <netinet/in.h>
10609 #endif
10610 #ifdef I_SYS_IN
10611 #include <sys/in.h>
10612 #endif
10613 #ifdef I_ARPA_INET
10614 #include <arpa/inet.h>
10615 #endif
10616 #ifdef htonl
10617 printf("Defined as a macro.");
10618 #endif
10619 EOM
10620         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
10621         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
10622                 val="$define"
10623                 echo "But it seems to be defined as a macro." >&4
10624         fi
10625         $rm -f htonl.?
10626         ;;
10627 esac
10628 set d_htonl
10629 eval $setvar
10630
10631 : see if iconv exists
10632 set iconv d_iconv
10633 eval $inlibc
10634
10635 : index or strchr
10636 echo " "
10637 if set index val -f; eval $csym; $val; then
10638         if set strchr val -f d_strchr; eval $csym; $val; then
10639                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
10640                         val="$define"
10641                         vali="$undef"
10642                         echo "strchr() found." >&4
10643                 else
10644                         val="$undef"
10645                         vali="$define"
10646                         echo "index() found." >&4
10647                 fi
10648         else
10649                 val="$undef"
10650                 vali="$define"
10651                 echo "index() found." >&4
10652         fi
10653 else
10654         if set strchr val -f d_strchr; eval $csym; $val; then
10655                 val="$define"
10656                 vali="$undef"
10657                 echo "strchr() found." >&4
10658         else
10659                 echo "No index() or strchr() found!" >&4
10660                 val="$undef"
10661                 vali="$undef"
10662         fi
10663 fi
10664 set d_strchr; eval $setvar
10665 val="$vali"
10666 set d_index; eval $setvar
10667
10668 : check whether inet_aton exists
10669 set inet_aton d_inetaton
10670 eval $inlibc
10671
10672 : Look for isascii
10673 echo " "
10674 $cat >isascii.c <<'EOCP'
10675 #include <stdio.h>
10676 #include <ctype.h>
10677 int main() {
10678         int c = 'A';
10679         if (isascii(c))
10680                 exit(0);
10681         else
10682                 exit(1);
10683 }
10684 EOCP
10685 set isascii
10686 if eval $compile; then
10687         echo "isascii() found." >&4
10688         val="$define"
10689 else
10690         echo "isascii() NOT found." >&4
10691         val="$undef"
10692 fi
10693 set d_isascii
10694 eval $setvar
10695 $rm -f isascii*
10696
10697 : see if isfinite exists
10698 set isfinite d_isfinite
10699 eval $inlibc
10700
10701 : see if isinf exists
10702 set isinf d_isinf
10703 eval $inlibc
10704
10705 : see if isnan exists
10706 set isnan d_isnan
10707 eval $inlibc
10708
10709 : see if isnanl exists
10710 set isnanl d_isnanl
10711 eval $inlibc
10712
10713 : see if killpg exists
10714 set killpg d_killpg
10715 eval $inlibc
10716
10717 : see if lchown exists
10718 echo " "
10719 $cat > try.c <<'EOCP'
10720 /* System header to define __stub macros and hopefully few prototypes,
10721     which can conflict with char lchown(); below.  */
10722 #include <assert.h>
10723 /* Override any gcc2 internal prototype to avoid an error.  */
10724 /* We use char because int might match the return type of a gcc2
10725    builtin and then its argument prototype would still apply.  */
10726 char lchown();
10727 int main() {
10728     /*  The GNU C library defines this for functions which it implements
10729         to always fail with ENOSYS.  Some functions are actually named
10730         something starting with __ and the normal name is an alias.  */
10731 #if defined (__stub_lchown) || defined (__stub___lchown)
10732 choke me
10733 #else
10734 lchown();
10735 #endif
10736 ; return 0; }
10737 EOCP
10738 set try
10739 if eval $compile; then
10740     $echo "lchown() found." >&4
10741     val="$define"
10742 else
10743     $echo "lchown() NOT found." >&4
10744     val="$undef"
10745 fi
10746 set d_lchown
10747 eval $setvar
10748
10749 : See if number of significant digits in a double precision number is known
10750 echo " "
10751 $cat >ldbl_dig.c <<EOM
10752 #$i_limits I_LIMITS
10753 #$i_float I_FLOAT
10754 #ifdef I_LIMITS
10755 #include <limits.h>
10756 #endif
10757 #ifdef I_FLOAT
10758 #include <float.h>
10759 #endif
10760 #ifdef LDBL_DIG
10761 printf("Contains LDBL_DIG");
10762 #endif
10763 EOM
10764 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
10765 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
10766         echo "LDBL_DIG found." >&4
10767         val="$define"
10768 else
10769         echo "LDBL_DIG NOT found." >&4
10770         val="$undef"
10771 fi
10772 $rm -f ldbl_dig.?
10773 set d_ldbl_dig
10774 eval $setvar
10775
10776 : see if link exists
10777 set link d_link
10778 eval $inlibc
10779
10780 : see if localeconv exists
10781 set localeconv d_locconv
10782 eval $inlibc
10783
10784 : see if lockf exists
10785 set lockf d_lockf
10786 eval $inlibc
10787
10788 : see if prototype for lseek is available
10789 echo " "
10790 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
10791 eval $hasproto
10792
10793 : see if lstat exists
10794 set lstat d_lstat
10795 eval $inlibc
10796
10797 : see if madvise exists
10798 set madvise d_madvise
10799 eval $inlibc
10800
10801 : see if mblen exists
10802 set mblen d_mblen
10803 eval $inlibc
10804
10805 : see if mbstowcs exists
10806 set mbstowcs d_mbstowcs
10807 eval $inlibc
10808
10809 : see if mbtowc exists
10810 set mbtowc d_mbtowc
10811 eval $inlibc
10812
10813 : see if memchr exists
10814 set memchr d_memchr
10815 eval $inlibc
10816
10817 : see if memcmp exists
10818 set memcmp d_memcmp
10819 eval $inlibc
10820
10821 : see if memcpy exists
10822 set memcpy d_memcpy
10823 eval $inlibc
10824
10825 : see if memmove exists
10826 set memmove d_memmove
10827 eval $inlibc
10828
10829 : see if memset exists
10830 set memset d_memset
10831 eval $inlibc
10832
10833 : see if mkdir exists
10834 set mkdir d_mkdir
10835 eval $inlibc
10836
10837 : see if mkdtemp exists
10838 set mkdtemp d_mkdtemp
10839 eval $inlibc
10840
10841 : see if mkfifo exists
10842 set mkfifo d_mkfifo
10843 eval $inlibc
10844
10845 : see if mkstemp exists
10846 set mkstemp d_mkstemp
10847 eval $inlibc
10848
10849 : see if mkstemps exists
10850 set mkstemps d_mkstemps
10851 eval $inlibc
10852
10853 : see if mktime exists
10854 set mktime d_mktime
10855 eval $inlibc
10856
10857 : see if this is a sys/mman.h system
10858 set sys/mman.h i_sysmman
10859 eval $inhdr
10860
10861 : see if mmap exists
10862 set mmap d_mmap
10863 eval $inlibc
10864 : see what shmat returns
10865 : default to something harmless
10866 mmaptype='void *'
10867 case "$i_sysmman$d_mmap" in
10868 "$define$define")
10869         $cat >mmap.c <<'END'
10870 #include <sys/mman.h>
10871 void *mmap();
10872 END
10873         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
10874                 mmaptype='void *'
10875         else
10876                 mmaptype='caddr_t'
10877         fi
10878         echo "and it returns ($mmaptype)." >&4
10879         ;;
10880 esac
10881
10882
10883
10884 : see if modfl exists
10885 set modfl d_modfl
10886 eval $inlibc
10887
10888 d_modfl_pow32_bug="$undef"
10889
10890 case "$d_longdbl$d_modfl" in
10891 $define$define)
10892         $cat <<EOM
10893 Checking to see whether your modfl() is okay for large values...
10894 EOM
10895 $cat >try.c <<EOCP
10896 #include <math.h> 
10897 #include <stdio.h>
10898 int main() {
10899     long double nv = 4294967303.15;
10900     long double v, w;
10901     v = modfl(nv, &w);         
10902 #ifdef __GLIBC__
10903     printf("glibc");
10904 #endif
10905     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
10906     return 0;
10907 }
10908 EOCP
10909         case "$osname:$gccversion" in
10910         aix:)   saveccflags="$ccflags"
10911                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10912         esac
10913         set try
10914         if eval $compile; then
10915                 foo=`$run ./try`
10916                 case "$foo" in
10917                 *" 4294967303.150000 1.150000 4294967302.000000")
10918                         echo >&4 "Your modfl() is broken for large values."
10919                         d_modfl_pow32_bug="$define"
10920                         case "$foo" in
10921                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
10922                         ;;
10923                         esac
10924                         ;;
10925                 *" 4294967303.150000 0.150000 4294967303.000000")
10926                         echo >&4 "Your modfl() seems okay for large values."
10927                         ;;
10928                 *)      echo >&4 "I don't understand your modfl() at all."
10929                         d_modfl="$undef"
10930                         ;;
10931                 esac
10932                 $rm -f try.* try core core.try.*
10933         else
10934                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
10935                 d_modfl="$undef"
10936         fi
10937         case "$osname:$gccversion" in
10938         aix:)   ccflags="$saveccflags" ;; # restore
10939         esac
10940         ;;
10941 esac
10942
10943 : see if mprotect exists
10944 set mprotect d_mprotect
10945 eval $inlibc
10946
10947 : see if msgctl exists
10948 set msgctl d_msgctl
10949 eval $inlibc
10950
10951 : see if msgget exists
10952 set msgget d_msgget
10953 eval $inlibc
10954
10955 : see if msgsnd exists
10956 set msgsnd d_msgsnd
10957 eval $inlibc
10958
10959 : see if msgrcv exists
10960 set msgrcv d_msgrcv
10961 eval $inlibc
10962
10963 : see how much of the 'msg*(2)' library is present.
10964 h_msg=true
10965 echo " "
10966 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
10967 *"$undef"*) h_msg=false;;
10968 esac
10969 case "$osname" in
10970 freebsd)
10971     case "`ipcs 2>&1`" in
10972     "SVID messages"*"not configured"*)
10973         echo "Your $osname does not have the msg*(2) configured." >&4
10974         h_msg=false
10975         val="$undef"
10976         set msgctl d_msgctl
10977         eval $setvar
10978         set msgget d_msgget
10979         eval $setvar
10980         set msgsnd d_msgsnd
10981         eval $setvar
10982         set msgrcv d_msgrcv
10983         eval $setvar
10984         ;;
10985     esac
10986     ;;
10987 esac
10988 : we could also check for sys/ipc.h ...
10989 if $h_msg && $test `./findhdr sys/msg.h`; then
10990         echo "You have the full msg*(2) library." >&4
10991         val="$define"
10992 else
10993         echo "You don't have the full msg*(2) library." >&4
10994         val="$undef"
10995 fi
10996 set d_msg
10997 eval $setvar
10998
10999
11000 echo " "
11001 echo "Checking to see if your system supports struct msghdr..." >&4
11002 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11003 eval $hasstruct
11004 case "$d_msghdr_s" in
11005 "$define")      echo "Yes, it does."   ;;
11006 *)              echo "No, it doesn't." ;;
11007 esac
11008
11009
11010 : see if msync exists
11011 set msync d_msync
11012 eval $inlibc
11013
11014 : see if munmap exists
11015 set munmap d_munmap
11016 eval $inlibc
11017
11018 : see if nice exists
11019 set nice d_nice
11020 eval $inlibc
11021
11022 : see if this is a langinfo.h system
11023 set langinfo.h i_langinfo
11024 eval $inhdr
11025
11026 : see if nl_langinfo exists
11027 set nl_langinfo d_nl_langinfo
11028 eval $inlibc
11029
11030 : check for length of character
11031 echo " "
11032 case "$charsize" in
11033 '')
11034         echo "Checking to see how big your characters are (hey, you never know)..." >&4
11035         $cat >try.c <<'EOCP'
11036 #include <stdio.h>
11037 int main()
11038 {
11039     printf("%d\n", (int)sizeof(char));
11040     exit(0);
11041 }
11042 EOCP
11043         set try
11044         if eval $compile_ok; then
11045                 dflt=`$run ./try`
11046         else
11047                 dflt='1'
11048                 echo "(I can't seem to compile the test program.  Guessing...)"
11049         fi
11050         ;;
11051 *)
11052         dflt="$charsize"
11053         ;;
11054 esac
11055 rp="What is the size of a character (in bytes)?"
11056 . ./myread
11057 charsize="$ans"
11058 $rm -f try.c try
11059
11060 : check for volatile keyword
11061 echo " "
11062 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
11063 $cat >try.c <<'EOCP'
11064 int main()
11065 {
11066         typedef struct _goo_struct goo_struct;
11067         goo_struct * volatile goo = ((goo_struct *)0);
11068         struct _goo_struct {
11069                 long long_int;
11070                 int reg_int;
11071                 char char_var;
11072         };
11073         typedef unsigned short foo_t;
11074         char *volatile foo;
11075         volatile int bar;
11076         volatile foo_t blech;
11077         foo = foo;
11078 }
11079 EOCP
11080 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
11081         val="$define"
11082         echo "Yup, it does."
11083 else
11084         val="$undef"
11085         echo "Nope, it doesn't."
11086 fi
11087 set d_volatile
11088 eval $setvar
11089 $rm -f try.*
11090
11091
11092 echo " "
11093 $echo "Choosing the C types to be used for Perl's internal types..." >&4
11094
11095 case "$use64bitint:$d_quad:$quadtype" in
11096 define:define:?*)
11097         ivtype="$quadtype"
11098         uvtype="$uquadtype"
11099         ivsize=8
11100         uvsize=8
11101         ;;
11102 *)      ivtype="long"
11103         uvtype="unsigned long"
11104         ivsize=$longsize
11105         uvsize=$longsize
11106         ;;
11107 esac
11108
11109 case "$uselongdouble:$d_longdbl" in
11110 define:define)
11111         nvtype="long double"
11112         nvsize=$longdblsize
11113         ;;
11114 *)      nvtype=double
11115         nvsize=$doublesize
11116         ;;
11117 esac
11118
11119 $echo "(IV will be "$ivtype", $ivsize bytes)"
11120 $echo "(UV will be "$uvtype", $uvsize bytes)"
11121 $echo "(NV will be "$nvtype", $nvsize bytes)"
11122
11123 $cat >try.c <<EOCP
11124 #$i_inttypes I_INTTYPES
11125 #ifdef I_INTTYPES
11126 #include <inttypes.h>
11127 #endif
11128 #include <stdio.h>
11129 int main() {
11130 #ifdef INT8
11131    int8_t i =  INT8_MAX;
11132   uint8_t u = UINT8_MAX;
11133   printf("int8_t\n");
11134 #endif
11135 #ifdef INT16
11136    int16_t i =  INT16_MAX;
11137   uint16_t i = UINT16_MAX;
11138   printf("int16_t\n");
11139 #endif
11140 #ifdef INT32
11141    int32_t i =  INT32_MAX;
11142   uint32_t u = UINT32_MAX;
11143   printf("int32_t\n");
11144 #endif
11145 }
11146 EOCP
11147
11148 case "$i8type" in
11149 '')     case "$charsize" in
11150         1)      i8type=char
11151                 u8type="unsigned char"
11152                 i8size=$charsize
11153                 u8size=$charsize
11154                 ;;
11155         esac
11156         ;;
11157 esac
11158 case "$i8type" in
11159 '')     set try -DINT8
11160         if eval $compile; then
11161                 case "`$run ./try`" in
11162                 int8_t) i8type=int8_t
11163                         u8type=uint8_t
11164                         i8size=1
11165                         u8size=1
11166                         ;;
11167                 esac
11168         fi
11169         ;;
11170 esac
11171 case "$i8type" in
11172 '')     if $test $charsize -ge 1; then
11173                 i8type=char
11174                 u8type="unsigned char"
11175                 i8size=$charsize
11176                 u8size=$charsize
11177         fi
11178         ;;
11179 esac
11180
11181 case "$i16type" in
11182 '')     case "$shortsize" in
11183         2)      i16type=short
11184                 u16type="unsigned short"
11185                 i16size=$shortsize
11186                 u16size=$shortsize
11187                 ;;
11188         esac
11189         ;;
11190 esac
11191 case "$i16type" in
11192 '')     set try -DINT16
11193         if eval $compile; then
11194                 case "`$run ./try`" in
11195                 int16_t)
11196                         i16type=int16_t
11197                         u16type=uint16_t
11198                         i16size=2
11199                         u16size=2
11200                         ;;
11201                 esac
11202         fi
11203         ;;
11204 esac
11205 case "$i16type" in
11206 '')     if $test $shortsize -ge 2; then
11207                 i16type=short
11208                 u16type="unsigned short"
11209                 i16size=$shortsize
11210                 u16size=$shortsize
11211         fi
11212         ;;
11213 esac
11214
11215 case "$i32type" in
11216 '')     case "$longsize" in
11217         4)      i32type=long
11218                 u32type="unsigned long"
11219                 i32size=$longsize
11220                 u32size=$longsize
11221                 ;;
11222         *)      case "$intsize" in
11223                 4)      i32type=int
11224                         u32type="unsigned int"
11225                         i32size=$intsize
11226                         u32size=$intsize
11227                         ;;
11228                 esac
11229                 ;;
11230         esac
11231         ;;
11232 esac
11233 case "$i32type" in
11234 '')     set try -DINT32
11235         if eval $compile; then
11236                 case "`$run ./try`" in
11237                 int32_t)
11238                         i32type=int32_t
11239                         u32type=uint32_t
11240                         i32size=4
11241                         u32size=4
11242                         ;;
11243                 esac
11244         fi
11245         ;;
11246 esac
11247 case "$i32type" in
11248 '')     if $test $intsize -ge 4; then
11249                 i32type=int
11250                 u32type="unsigned int"
11251                 i32size=$intsize
11252                 u32size=$intsize
11253         fi
11254         ;;
11255 esac
11256
11257 case "$i64type" in
11258 '')     case "$d_quad:$quadtype" in
11259         define:?*)
11260                 i64type="$quadtype"
11261                 u64type="$uquadtype"
11262                 i64size=8
11263                 u64size=8
11264                 ;;
11265         esac
11266         ;;
11267 esac
11268
11269 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
11270 : volatile so that the compiler has to store it out to memory.
11271 if test X"$d_volatile" = X"$define"; then
11272         volatile=volatile
11273 fi
11274 $cat <<EOP >try.c
11275 #include <stdio.h>
11276 #include <sys/types.h>
11277 #include <signal.h>
11278 #ifdef SIGFPE
11279 $volatile int bletched = 0;
11280 $signal_t blech(s) int s; { bletched = 1; }
11281 #endif
11282 int main() {
11283     $uvtype u = 0;
11284     $nvtype d;
11285     int     n = 8 * $uvsize;
11286     int     i;
11287 #ifdef SIGFPE
11288     signal(SIGFPE, blech);
11289 #endif
11290
11291     for (i = 0; i < n; i++) {
11292       u = u << 1 | ($uvtype)1;
11293       d = ($nvtype)u;
11294       if (($uvtype)d != u)
11295         break;
11296       if (d <= 0)
11297         break;
11298       d = ($nvtype)(u - 1);
11299       if (($uvtype)d != (u - 1))
11300         break;
11301 #ifdef SIGFPE
11302       if (bletched) {
11303         break;
11304 #endif
11305       } 
11306     }
11307     printf("%d\n", ((i == n) ? -n : i));
11308     exit(0);
11309 }
11310 EOP
11311 set try
11312
11313 d_nv_preserves_uv="$undef"
11314 if eval $compile; then
11315         d_nv_preserves_uv_bits="`$run ./try`"
11316 fi
11317 case "$d_nv_preserves_uv_bits" in
11318 \-[1-9]*)       
11319         d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
11320         $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs."  2>&1
11321         d_nv_preserves_uv="$define"
11322         ;;
11323 [1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs."  2>&1
11324         d_nv_preserves_uv="$undef" ;;
11325 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
11326         d_nv_preserves_uv_bits="$undef" ;;
11327 esac
11328
11329 $rm -f try.* try
11330
11331
11332 : check for off64_t
11333 echo " "
11334 echo "Checking to see if you have off64_t..." >&4
11335 $cat >try.c <<EOCP
11336 #include <sys/types.h>
11337 #include <unistd.h>
11338 int main() { off64_t x = 7; }
11339 EOCP
11340 set try
11341 if eval $compile; then
11342         val="$define"
11343         echo "You have off64_t."
11344 else
11345         val="$undef"
11346         echo "You do not have off64_t."
11347         case "$lseeksize" in
11348         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
11349         esac
11350 fi
11351 $rm -f try.* try
11352 set d_off64_t
11353 eval $setvar
11354
11355 : see if POSIX threads are available
11356 set pthread.h i_pthread
11357 eval $inhdr
11358
11359
11360
11361
11362 : how to create joinable pthreads
11363 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
11364         echo " "
11365         echo "Checking what constant to use for creating joinable pthreads..." >&4 
11366         $cat >try.c <<'EOCP'
11367 #include <pthread.h>
11368 int main() {
11369     int detachstate = JOINABLE;
11370 }
11371 EOCP
11372         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
11373         if eval $compile; then
11374                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
11375                 val="$undef" # Yes, undef.
11376                 set d_old_pthread_create_joinable
11377                 eval $setvar
11378                 val=""
11379                 set old_pthread_create_joinable
11380                 eval $setvar
11381         else
11382                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
11383                 if eval $compile; then
11384                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
11385                         val="$define"
11386                         set d_old_pthread_create_joinable
11387                         eval $setvar
11388                         val=PTHREAD_CREATE_UNDETACHED
11389                         set old_pthread_create_joinable
11390                         eval $setvar
11391                 else            
11392                         set try -DJOINABLE=__UNDETACHED
11393                         if eval $compile; then
11394                                 echo "You seem to use __UNDETACHED." >&4
11395                                 val="$define"
11396                                 set d_old_pthread_create_joinable
11397                                 eval $setvar
11398                                 val=__UNDETACHED
11399                                 set old_pthread_create_joinable
11400                                 eval $setvar
11401                         else
11402                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
11403                                 val="$define"
11404                                 set d_old_pthread_create_joinable
11405                                 eval $setvar
11406                                 val=0
11407                                 set old_pthread_create_joinable
11408                                 eval $setvar
11409                         fi
11410                 fi
11411         fi
11412         $rm -f try try.*
11413 else
11414     d_old_pthread_create_joinable="$undef"
11415     old_pthread_create_joinable=""
11416 fi
11417
11418 : see if pause exists
11419 set pause d_pause
11420 eval $inlibc
11421
11422 : see if pipe exists
11423 set pipe d_pipe
11424 eval $inlibc
11425
11426 : see if poll exists
11427 set poll d_poll
11428 eval $inlibc
11429
11430 : see if pthread_atfork exists
11431 set pthread_atfork d_pthread_atfork
11432 eval $inlibc
11433
11434
11435 : see whether the various POSIXish _yields exist
11436 $cat >try.c <<EOP
11437 #include <pthread.h>
11438 #include <stdio.h>
11439 int main() {
11440 #ifdef SCHED_YIELD
11441         sched_yield();
11442 #else
11443 #ifdef PTHREAD_YIELD
11444         pthread_yield();
11445 #else
11446 #ifdef PTHREAD_YIELD_NULL
11447         pthread_yield(NULL);
11448 #endif
11449 #endif
11450 #endif
11451 }
11452 EOP
11453 : see if sched_yield exists
11454 set try -DSCHED_YIELD
11455 if eval $compile; then
11456     val="$define"
11457     sched_yield='sched_yield()'
11458 else
11459     val="$undef"
11460 fi
11461 case "$usethreads" in
11462 $define)
11463         case "$val" in
11464         $define) echo 'sched_yield() found.' >&4        ;;
11465         *)       echo 'sched_yield() NOT found.' >&4    ;;
11466         esac
11467 esac
11468 set d_sched_yield
11469 eval $setvar
11470
11471 : see if pthread_yield exists
11472 set try -DPTHREAD_YIELD
11473 if eval $compile; then
11474     val="$define"
11475     case "$sched_yield" in
11476     '') sched_yield='pthread_yield()' ;;
11477     esac
11478 else
11479     set try -DPTHREAD_YIELD_NULL
11480     if eval $compile; then
11481         val="$define"
11482         case "$sched_yield" in
11483         '') sched_yield='pthread_yield(NULL)' ;;
11484         esac
11485     else
11486         val="$undef"
11487     fi
11488 fi
11489 case "$usethreads" in
11490 $define)
11491         case "$val" in
11492         $define) echo 'pthread_yield() found.' >&4      ;;
11493         *)       echo 'pthread_yield() NOT found.' >&4  ;;
11494         esac
11495         ;;
11496 esac
11497 set d_pthread_yield
11498 eval $setvar
11499
11500 case "$sched_yield" in
11501 '') sched_yield=undef ;;
11502 esac
11503
11504 $rm -f try try.*
11505
11506 : see if this is a pwd.h system
11507 set pwd.h i_pwd
11508 eval $inhdr
11509
11510 case "$i_pwd" in
11511 $define)
11512         xxx=`./findhdr pwd.h`
11513         $cppstdin $cppflags $cppminus < $xxx >$$.h
11514
11515         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11516                 val="$define"
11517         else
11518                 val="$undef"
11519         fi
11520         set d_pwquota
11521         eval $setvar
11522
11523         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11524                 val="$define"
11525         else
11526                 val="$undef"
11527         fi
11528         set d_pwage
11529         eval $setvar
11530
11531         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11532                 val="$define"
11533         else
11534                 val="$undef"
11535         fi
11536         set d_pwchange
11537         eval $setvar
11538
11539         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11540                 val="$define"
11541         else
11542                 val="$undef"
11543         fi
11544         set d_pwclass
11545         eval $setvar
11546
11547         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11548                 val="$define"
11549         else
11550                 val="$undef"
11551         fi
11552         set d_pwexpire
11553         eval $setvar
11554
11555         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11556                 val="$define"
11557         else
11558                 val="$undef"
11559         fi
11560         set d_pwcomment
11561         eval $setvar
11562
11563         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11564                 val="$define"
11565         else
11566                 val="$undef"
11567         fi
11568         set d_pwgecos
11569         eval $setvar
11570
11571         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11572                 val="$define"
11573         else
11574                 val="$undef"
11575         fi
11576         set d_pwpasswd
11577         eval $setvar
11578
11579         $rm -f $$.h
11580         ;;
11581 *)
11582         val="$undef"; 
11583         set d_pwquota; eval $setvar
11584         set d_pwage; eval $setvar
11585         set d_pwchange; eval $setvar
11586         set d_pwclass; eval $setvar
11587         set d_pwexpire; eval $setvar
11588         set d_pwcomment; eval $setvar
11589         set d_pwgecos; eval $setvar
11590         set d_pwpasswd; eval $setvar
11591         ;;
11592 esac
11593
11594 : see if readdir and friends exist
11595 set readdir d_readdir
11596 eval $inlibc
11597 set seekdir d_seekdir
11598 eval $inlibc
11599 set telldir d_telldir
11600 eval $inlibc
11601 set rewinddir d_rewinddir
11602 eval $inlibc
11603
11604 : see if readlink exists
11605 set readlink d_readlink
11606 eval $inlibc
11607
11608 : see if readv exists
11609 set readv d_readv
11610 eval $inlibc
11611
11612 : see if recvmsg exists
11613 set recvmsg d_recvmsg
11614 eval $inlibc
11615
11616 : see if rename exists
11617 set rename d_rename
11618 eval $inlibc
11619
11620 : see if rmdir exists
11621 set rmdir d_rmdir
11622 eval $inlibc
11623
11624 : see if memory.h is available.
11625 val=''
11626 set memory.h val
11627 eval $inhdr
11628
11629 : See if it conflicts with string.h
11630 case "$val" in
11631 $define)
11632         case "$strings" in
11633         '') ;;
11634         *)
11635                 $cppstdin $cppflags $cppminus < $strings > mem.h
11636                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
11637                         echo " "
11638                         echo "We won't be including <memory.h>."
11639                         val="$undef"
11640                 fi
11641                 $rm -f mem.h
11642                 ;;
11643         esac
11644 esac
11645 set i_memory
11646 eval $setvar
11647
11648 : can bcopy handle overlapping blocks?
11649 echo " "
11650 val="$undef"
11651 case "$d_memmove" in
11652 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
11653 *)      case "$d_bcopy" in
11654         "$define")
11655                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
11656                 $cat >try.c <<EOCP
11657 #$i_memory I_MEMORY
11658 #$i_stdlib I_STDLIB
11659 #$i_string I_STRING
11660 #$i_unistd I_UNISTD
11661 EOCP
11662         $cat >>try.c <<'EOCP'
11663 #include <stdio.h>
11664 #ifdef I_MEMORY
11665 #  include <memory.h>
11666 #endif
11667 #ifdef I_STDLIB
11668 #  include <stdlib.h>
11669 #endif
11670 #ifdef I_STRING
11671 #  include <string.h>
11672 #else
11673 #  include <strings.h>
11674 #endif
11675 #ifdef I_UNISTD
11676 #  include <unistd.h>  /* Needed for NetBSD */
11677 #endif
11678 int main()
11679 {
11680 char buf[128], abc[128];
11681 char *b;
11682 int len;
11683 int off;
11684 int align;
11685
11686 /* Copy "abcde..." string to char abc[] so that gcc doesn't
11687    try to store the string in read-only memory. */
11688 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
11689
11690 for (align = 7; align >= 0; align--) {
11691         for (len = 36; len; len--) {
11692                 b = buf+align;
11693                 bcopy(abc, b, len);
11694                 for (off = 1; off <= len; off++) {
11695                         bcopy(b, b+off, len);
11696                         bcopy(b+off, b, len);
11697                         if (bcmp(b, abc, len))
11698                                 exit(1);
11699                 }
11700         }
11701 }
11702 exit(0);
11703 }
11704 EOCP
11705                 set try
11706                 if eval $compile_ok; then
11707                         if ./try 2>/dev/null; then
11708                                 echo "Yes, it can."
11709                                 val="$define"
11710                         else
11711                                 echo "It can't, sorry."
11712                         fi
11713                 else
11714                         echo "(I can't compile the test program, so we'll assume not...)"
11715                 fi
11716                 ;;
11717         esac
11718         $rm -f try.* try core
11719         ;;
11720 esac
11721 set d_safebcpy
11722 eval $setvar
11723
11724 : can memcpy handle overlapping blocks?
11725 echo " "
11726 val="$undef"
11727 case "$d_memmove" in
11728 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
11729 *)      case "$d_memcpy" in
11730         "$define")
11731                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
11732                 $cat >try.c <<EOCP
11733 #$i_memory I_MEMORY
11734 #$i_stdlib I_STDLIB
11735 #$i_string I_STRING
11736 #$i_unistd I_UNISTD
11737 EOCP
11738         $cat >>try.c <<'EOCP'
11739 #include <stdio.h>
11740 #ifdef I_MEMORY
11741 #  include <memory.h>
11742 #endif
11743 #ifdef I_STDLIB
11744 #  include <stdlib.h>
11745 #endif
11746 #ifdef I_STRING
11747 #  include <string.h>
11748 #else
11749 #  include <strings.h>
11750 #endif
11751 #ifdef I_UNISTD
11752 #  include <unistd.h>  /* Needed for NetBSD */
11753 #endif
11754 int main()
11755 {
11756 char buf[128], abc[128];
11757 char *b;
11758 int len;
11759 int off;
11760 int align;
11761
11762 /* Copy "abcde..." string to char abc[] so that gcc doesn't
11763    try to store the string in read-only memory. */
11764 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
11765
11766 for (align = 7; align >= 0; align--) {
11767         for (len = 36; len; len--) {
11768                 b = buf+align;
11769                 memcpy(b, abc, len);
11770                 for (off = 1; off <= len; off++) {
11771                         memcpy(b+off, b, len);
11772                         memcpy(b, b+off, len);
11773                         if (memcmp(b, abc, len))
11774                                 exit(1);
11775                 }
11776         }
11777 }
11778 exit(0);
11779 }
11780 EOCP
11781                 set try
11782                 if eval $compile_ok; then
11783                         if ./try 2>/dev/null; then
11784                                 echo "Yes, it can."
11785                                 val="$define"
11786                         else
11787                                 echo "It can't, sorry."
11788                         fi
11789                 else
11790                         echo "(I can't compile the test program, so we'll assume not...)"
11791                 fi
11792                 ;;
11793         esac
11794         $rm -f try.* try core
11795         ;;
11796 esac
11797 set d_safemcpy
11798 eval $setvar
11799
11800 : can memcmp be trusted to compare relative magnitude?
11801 val="$undef"
11802 case "$d_memcmp" in
11803 "$define")
11804         echo " "
11805         echo "Checking if your memcmp() can compare relative magnitude..." >&4
11806         $cat >try.c <<EOCP
11807 #$i_memory I_MEMORY
11808 #$i_stdlib I_STDLIB
11809 #$i_string I_STRING
11810 #$i_unistd I_UNISTD
11811 EOCP
11812         $cat >>try.c <<'EOCP'
11813 #include <stdio.h>
11814 #ifdef I_MEMORY
11815 #  include <memory.h>
11816 #endif
11817 #ifdef I_STDLIB
11818 #  include <stdlib.h>
11819 #endif
11820 #ifdef I_STRING
11821 #  include <string.h>
11822 #else
11823 #  include <strings.h>
11824 #endif
11825 #ifdef I_UNISTD
11826 #  include <unistd.h>  /* Needed for NetBSD */
11827 #endif
11828 int main()
11829 {
11830 char a = -1;
11831 char b = 0;
11832 if ((a < b) && memcmp(&a, &b, 1) < 0)
11833         exit(1);
11834 exit(0);
11835 }
11836 EOCP
11837         set try
11838         if eval $compile_ok; then
11839                 if $run ./try 2>/dev/null; then
11840                         echo "Yes, it can."
11841                         val="$define"
11842                 else
11843                         echo "No, it can't (it uses signed chars)."
11844                 fi
11845         else
11846                 echo "(I can't compile the test program, so we'll assume not...)"
11847         fi
11848         ;;
11849 esac
11850 $rm -f try.* try core
11851 set d_sanemcmp
11852 eval $setvar
11853
11854 : see if prototype for sbrk is available
11855 echo " "
11856 set d_sbrkproto sbrk $i_unistd unistd.h
11857 eval $hasproto
11858
11859 : see if select exists
11860 set select d_select
11861 eval $inlibc
11862
11863 : see if semctl exists
11864 set semctl d_semctl
11865 eval $inlibc
11866
11867 : see if semget exists
11868 set semget d_semget
11869 eval $inlibc
11870
11871 : see if semop exists
11872 set semop d_semop
11873 eval $inlibc
11874
11875 : see how much of the 'sem*(2)' library is present.
11876 h_sem=true
11877 echo " "
11878 case "$d_semctl$d_semget$d_semop" in
11879 *"$undef"*) h_sem=false;;
11880 esac
11881 case "$osname" in
11882 freebsd)
11883     case "`ipcs 2>&1`" in
11884     "SVID messages"*"not configured"*)
11885         echo "Your $osname does not have the sem*(2) configured." >&4
11886         h_sem=false
11887         val="$undef"
11888         set semctl d_semctl
11889         eval $setvar
11890         set semget d_semget
11891         eval $setvar
11892         set semop d_semop
11893         eval $setvar
11894         ;;
11895     esac
11896     ;;
11897 esac
11898 : we could also check for sys/ipc.h ...
11899 if $h_sem && $test `./findhdr sys/sem.h`; then
11900         echo "You have the full sem*(2) library." >&4
11901         val="$define"
11902 else
11903         echo "You don't have the full sem*(2) library." >&4
11904         val="$undef"
11905 fi
11906 set d_sem
11907 eval $setvar
11908
11909 : see whether sys/sem.h defines union semun
11910 echo " "
11911 $cat > try.c <<'END'
11912 #include <sys/types.h>
11913 #include <sys/ipc.h>
11914 #include <sys/sem.h>
11915 int main () { union semun semun; semun.buf = 0; }
11916 END
11917 set try
11918 if eval $compile; then
11919     echo "You have union semun in <sys/sem.h>." >&4
11920     val="$define"
11921 else
11922     echo "You do not have union semun in <sys/sem.h>." >&4
11923     val="$undef"
11924 fi
11925 $rm -f try try.c try.h
11926 set d_union_semun
11927 eval $setvar
11928
11929 : see how to do semctl IPC_STAT
11930 case "$d_sem" in
11931 $define)
11932     : see whether semctl IPC_STAT can use union semun
11933     echo " "
11934     $cat > try.h <<END
11935 #ifndef S_IRUSR
11936 #   ifdef S_IREAD
11937 #       define S_IRUSR S_IREAD
11938 #       define S_IWUSR S_IWRITE
11939 #       define S_IXUSR S_IEXEC
11940 #   else
11941 #       define S_IRUSR 0400
11942 #       define S_IWUSR 0200
11943 #       define S_IXUSR 0100
11944 #   endif
11945 #   define S_IRGRP (S_IRUSR>>3)
11946 #   define S_IWGRP (S_IWUSR>>3)
11947 #   define S_IXGRP (S_IXUSR>>3)
11948 #   define S_IROTH (S_IRUSR>>6)
11949 #   define S_IWOTH (S_IWUSR>>6)
11950 #   define S_IXOTH (S_IXUSR>>6)
11951 #endif
11952 #ifndef S_IRWXU
11953 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11954 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11955 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11956 #endif
11957 END
11958
11959     $cat > try.c <<END
11960 #include <sys/types.h>
11961 #include <sys/ipc.h>
11962 #include <sys/sem.h>
11963 #include <sys/stat.h>
11964 #include <stdio.h>
11965 #include <errno.h>
11966 #include "try.h"
11967 #ifndef errno
11968 extern int errno;
11969 #endif
11970 #$d_union_semun HAS_UNION_SEMUN
11971 int main() {
11972     union semun
11973 #ifndef HAS_UNION_SEMUN
11974     {
11975         int val;
11976         struct semid_ds *buf;
11977         unsigned short *array;
11978     }
11979 #endif
11980     arg;
11981     int sem, st;
11982
11983 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11984     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11985     if (sem > -1) {
11986         struct semid_ds argbuf;
11987         arg.buf = &argbuf;
11988 #       ifdef IPC_STAT
11989         st = semctl(sem, 0, IPC_STAT, arg);
11990         if (st == 0)
11991             printf("semun\n");
11992         else
11993 #       endif /* IPC_STAT */
11994             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11995 #       ifdef IPC_RMID
11996         if (semctl(sem, 0, IPC_RMID, arg) != 0)
11997 #       endif /* IPC_RMID */
11998             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11999     } else
12000 #endif /* IPC_PRIVATE && ... */
12001         printf("semget failed: errno = %d\n", errno);
12002   return 0;
12003 }
12004 END
12005     val="$undef"
12006     set try
12007     if eval $compile; then
12008         xxx=`$run ./try`
12009         case "$xxx" in
12010         semun) val="$define" ;;
12011         esac
12012     fi
12013     $rm -f try try.c
12014     set d_semctl_semun
12015     eval $setvar
12016     case "$d_semctl_semun" in
12017     $define)
12018         echo "You can use union semun for semctl IPC_STAT." >&4
12019         also='also'
12020         ;;
12021     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
12022         also=''
12023         ;;
12024     esac
12025
12026     : see whether semctl IPC_STAT can use struct semid_ds pointer
12027     $cat > try.c <<'END'
12028 #include <sys/types.h>
12029 #include <sys/ipc.h>
12030 #include <sys/sem.h>
12031 #include <sys/stat.h>
12032 #include "try.h"
12033 #include <stdio.h>
12034 #include <errno.h>
12035 #ifndef errno
12036 extern int errno;
12037 #endif
12038 int main() {
12039     struct semid_ds arg;
12040     int sem, st;
12041
12042 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
12043     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
12044     if (sem > -1) {
12045 #       ifdef IPC_STAT
12046         st = semctl(sem, 0, IPC_STAT, &arg);
12047         if (st == 0)
12048             printf("semid_ds\n");
12049         else
12050 #       endif /* IPC_STAT */
12051             printf("semctl IPC_STAT failed: errno = %d\n", errno);
12052 #       ifdef IPC_RMID
12053         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
12054 #       endif /* IPC_RMID */
12055             printf("semctl IPC_RMID failed: errno = %d\n", errno);
12056     } else
12057 #endif /* IPC_PRIVATE && ... */
12058         printf("semget failed: errno = %d\n", errno);
12059
12060     return 0;
12061 }
12062 END
12063     val="$undef"
12064     set try
12065     if eval $compile; then
12066         xxx=`$run ./try`
12067         case "$xxx" in
12068         semid_ds) val="$define" ;;
12069         esac
12070     fi
12071     $rm -f try try.c
12072     set d_semctl_semid_ds
12073     eval $setvar
12074     case "$d_semctl_semid_ds" in
12075     $define)
12076         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
12077         ;;
12078     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
12079         ;;
12080     esac
12081     $rm -f try.h
12082     ;;
12083 *)  val="$undef"
12084
12085     # We do not have the full sem*(2) library, so assume we can not
12086     # use either.
12087
12088     set d_semctl_semun
12089     eval $setvar
12090
12091     set d_semctl_semid_ds
12092     eval $setvar
12093     ;;
12094 esac
12095
12096 : see if sendmsg exists
12097 set sendmsg d_sendmsg
12098 eval $inlibc
12099
12100 : see if setegid exists
12101 set setegid d_setegid
12102 eval $inlibc
12103
12104 : see if seteuid exists
12105 set seteuid d_seteuid
12106 eval $inlibc
12107
12108 : see if setgrent exists
12109 set setgrent d_setgrent
12110 eval $inlibc
12111
12112 : see if sethostent exists
12113 set sethostent d_sethent
12114 eval $inlibc
12115
12116 : see if setitimer exists
12117 set setitimer d_setitimer
12118 eval $inlibc
12119
12120 : see if setlinebuf exists
12121 set setlinebuf d_setlinebuf
12122 eval $inlibc
12123
12124 : see if setlocale exists
12125 set setlocale d_setlocale
12126 eval $inlibc
12127
12128 : see if setnetent exists
12129 set setnetent d_setnent
12130 eval $inlibc
12131
12132 : see if setprotoent exists
12133 set setprotoent d_setpent
12134 eval $inlibc
12135
12136 : see if setpgid exists
12137 set setpgid d_setpgid
12138 eval $inlibc
12139
12140 : see if setpgrp2 exists
12141 set setpgrp2 d_setpgrp2
12142 eval $inlibc
12143
12144 : see if setpriority exists
12145 set setpriority d_setprior
12146 eval $inlibc
12147
12148 : see if setproctitle exists
12149 set setproctitle d_setproctitle
12150 eval $inlibc
12151
12152 : see if setpwent exists
12153 set setpwent d_setpwent
12154 eval $inlibc
12155
12156 : see if setregid exists
12157 set setregid d_setregid
12158 eval $inlibc
12159 set setresgid d_setresgid
12160 eval $inlibc
12161
12162 : see if setreuid exists
12163 set setreuid d_setreuid
12164 eval $inlibc
12165 set setresuid d_setresuid
12166 eval $inlibc
12167
12168 : see if setrgid exists
12169 set setrgid d_setrgid
12170 eval $inlibc
12171
12172 : see if setruid exists
12173 set setruid d_setruid
12174 eval $inlibc
12175
12176 : see if setservent exists
12177 set setservent d_setsent
12178 eval $inlibc
12179
12180 : see if setsid exists
12181 set setsid d_setsid
12182 eval $inlibc
12183
12184 : see if setvbuf exists
12185 set setvbuf d_setvbuf
12186 eval $inlibc
12187
12188 : see if sfio.h is available
12189 set sfio.h i_sfio
12190 eval $inhdr
12191
12192
12193 : see if sfio library is available
12194 case "$i_sfio" in
12195 $define)
12196         val=''
12197         set sfreserve val
12198         eval $inlibc
12199         ;;
12200 *)
12201         val="$undef"
12202         ;;
12203 esac
12204 : Ok, but do we want to use it.
12205 case "$val" in
12206 $define)
12207         case "$usesfio" in
12208         true|$define|[yY]*) dflt='y';;
12209         *) dflt='n';;
12210         esac
12211         echo "$package can use the sfio library, but it is experimental."
12212         case "$useperlio" in
12213         "$undef")
12214             echo "For sfio also the PerlIO abstraction layer is needed."
12215             echo "Earlier you said you wouldn't want that."
12216             ;;
12217         esac
12218         rp="You seem to have sfio available, do you want to try using it?"
12219         . ./myread
12220         case "$ans" in
12221         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
12222                 useperlio="$define"
12223                 val="$define"
12224                 ;;
12225         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
12226                 val="$undef"
12227                 ;;
12228         esac
12229         ;;
12230 *)      case "$usesfio" in
12231         true|$define|[yY]*)
12232                 echo "Sorry, cannot find sfio on this machine." >&4
12233                 echo "Ignoring your setting of usesfio=$usesfio." >&4
12234                 val="$undef"
12235                 ;;
12236         esac
12237         ;;
12238 esac
12239 set d_sfio
12240 eval $setvar
12241 case "$d_sfio" in
12242 $define) usesfio='true';;
12243 *) usesfio='false';;
12244 esac
12245 case "$d_sfio" in
12246 $define) ;;
12247 *)      : Remove sfio from list of libraries to use
12248         case "$libs" in
12249         *-lsfio*)
12250                 echo "Removing unneeded -lsfio from library list" >&4
12251                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
12252                 shift
12253                 libs="$*"
12254                 echo "libs = $libs" >&4
12255                 ;;
12256         esac
12257 ;;
12258 esac
12259
12260
12261 : see if shmctl exists
12262 set shmctl d_shmctl
12263 eval $inlibc
12264
12265 : see if shmget exists
12266 set shmget d_shmget
12267 eval $inlibc
12268
12269 : see if shmat exists
12270 set shmat d_shmat
12271 eval $inlibc
12272 : see what shmat returns
12273 case "$d_shmat" in
12274 "$define")
12275         $cat >shmat.c <<'END'
12276 #include <sys/shm.h>
12277 void *shmat();
12278 END
12279         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
12280                 shmattype='void *'
12281         else
12282                 shmattype='char *'
12283         fi
12284         echo "and it returns ($shmattype)." >&4
12285         : see if a prototype for shmat is available
12286         xxx=`./findhdr sys/shm.h`
12287         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
12288         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
12289                 val="$define"
12290         else
12291                 val="$undef"
12292         fi
12293         $rm -f shmat.[co]
12294         ;;
12295 *)
12296         val="$undef"
12297         ;;
12298 esac
12299 set d_shmatprototype
12300 eval $setvar
12301
12302 : see if shmdt exists
12303 set shmdt d_shmdt
12304 eval $inlibc
12305
12306 : see how much of the 'shm*(2)' library is present.
12307 h_shm=true
12308 echo " "
12309 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
12310 *"$undef"*) h_shm=false;;
12311 esac
12312 case "$osname" in
12313 freebsd)
12314     case "`ipcs 2>&1`" in
12315     "SVID shared memory"*"not configured"*)
12316         echo "Your $osname does not have the shm*(2) configured." >&4
12317         h_shm=false
12318         val="$undef"
12319         set shmctl d_shmctl
12320         evat $setvar
12321         set shmget d_shmget
12322         evat $setvar
12323         set shmat d_shmat
12324         evat $setvar
12325         set shmdt d_shmdt
12326         evat $setvar
12327         ;;
12328     esac
12329     ;;
12330 esac
12331 : we could also check for sys/ipc.h ...
12332 if $h_shm && $test `./findhdr sys/shm.h`; then
12333         echo "You have the full shm*(2) library." >&4
12334         val="$define"
12335 else
12336         echo "You don't have the full shm*(2) library." >&4
12337         val="$undef"
12338 fi
12339 set d_shm
12340 eval $setvar
12341
12342 echo " "
12343 : see if we have sigaction
12344 if set sigaction val -f d_sigaction; eval $csym; $val; then
12345         echo 'sigaction() found.' >&4
12346         $cat > try.c <<'EOP'
12347 #include <stdio.h>
12348 #include <sys/types.h>
12349 #include <signal.h>
12350 int main()
12351 {
12352     struct sigaction act, oact;
12353     act.sa_flags = 0;
12354     oact.sa_handler = 0;
12355     /* so that act and oact are used */
12356     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
12357 }
12358 EOP
12359         set try
12360         if eval $compile_ok; then
12361                 val="$define"
12362         else
12363                 echo "But you don't seem to have a useable struct sigaction." >&4
12364                 val="$undef"
12365         fi
12366 else
12367         echo 'sigaction NOT found.' >&4
12368         val="$undef"
12369 fi
12370 set d_sigaction; eval $setvar
12371 $rm -f try try$_o try.c
12372
12373 : see if sigprocmask exists
12374 set sigprocmask d_sigprocmask
12375 eval $inlibc
12376
12377 : see if sigsetjmp exists
12378 echo " "
12379 case "$d_sigsetjmp" in
12380 '')
12381         $cat >try.c <<'EOP'
12382 #include <setjmp.h>
12383 sigjmp_buf env;
12384 int set = 1;
12385 int main()
12386 {
12387         if (sigsetjmp(env,1))
12388                 exit(set);
12389         set = 0;
12390         siglongjmp(env, 1);
12391         exit(1);
12392 }
12393 EOP
12394         set try
12395         if eval $compile; then
12396                 if $run ./try >/dev/null 2>&1; then
12397                         echo "POSIX sigsetjmp found." >&4
12398                         val="$define"
12399                 else
12400                         $cat >&4 <<EOM
12401 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
12402 I'll ignore them.
12403 EOM
12404                         val="$undef"
12405                 fi
12406         else
12407                 echo "sigsetjmp not found." >&4
12408                 val="$undef"
12409         fi
12410         ;;
12411 *) val="$d_sigsetjmp"
12412         case "$d_sigsetjmp" in
12413         $define) echo "POSIX sigsetjmp found." >&4;;
12414         $undef) echo "sigsetjmp not found." >&4;;
12415         esac
12416         ;;
12417 esac
12418 set d_sigsetjmp
12419 eval $setvar
12420 $rm -f try.c try
12421
12422 : see if sockatmark exists
12423 set sockatmark d_sockatmark
12424 eval $inlibc
12425
12426 : see if prototype for sockatmark is available
12427 echo " "
12428 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
12429 eval $hasproto
12430
12431 : see if socks5_init exists
12432 set socks5_init d_socks5_init
12433 eval $inlibc
12434
12435 : see if prototype for setresgid is available
12436 echo " "
12437 set d_sresgproto setresgid $i_unistd unistd.h
12438 eval $hasproto
12439
12440 : see if prototype for setresuid is available
12441 echo " "
12442 set d_sresuproto setresuid $i_unistd unistd.h
12443 eval $hasproto
12444
12445 : see if sys/stat.h is available
12446 set sys/stat.h i_sysstat
12447 eval $inhdr
12448
12449
12450 : see if stat knows about block sizes
12451 echo " "
12452 echo "Checking to see if your struct stat has st_blocks field..." >&4
12453 set d_statblks stat st_blocks $i_sysstat sys/stat.h
12454 eval $hasfield
12455
12456
12457 : see if this is a sys/vfs.h system
12458 set sys/vfs.h i_sysvfs
12459 eval $inhdr
12460
12461
12462 : see if this is a sys/statfs.h system
12463 set sys/statfs.h i_sysstatfs
12464 eval $inhdr
12465
12466
12467 echo " "
12468 echo "Checking to see if your system supports struct statfs..." >&4
12469 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
12470 eval $hasstruct
12471 case "$d_statfs_s" in
12472 "$define")      echo "Yes, it does."   ;;
12473 *)              echo "No, it doesn't." ;;
12474 esac
12475
12476
12477
12478 : see if struct statfs knows about f_flags
12479 case "$d_statfs_s" in
12480 define) 
12481         echo " "
12482         echo "Checking to see if your struct statfs has f_flags field..." >&4
12483         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
12484         eval $hasfield
12485         ;;
12486 *)      val="$undef"
12487         set d_statfs_f_flags
12488         eval $setvar
12489         ;;
12490 esac
12491 case "$d_statfs_f_flags" in
12492 "$define")      echo "Yes, it does."   ;;
12493 *)              echo "No, it doesn't." ;;
12494 esac
12495
12496 : see if _ptr and _cnt from stdio act std
12497 echo " "
12498
12499 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12500         echo "(Looks like you have stdio.h from BSD.)"
12501         case "$stdio_ptr" in
12502         '') stdio_ptr='((fp)->_p)'
12503                 ptr_lval=$define
12504                 ;;
12505         *)      ptr_lval=$d_stdio_ptr_lval;;
12506         esac
12507         case "$stdio_cnt" in
12508         '') stdio_cnt='((fp)->_r)'
12509                 cnt_lval=$define
12510                 ;;
12511         *)      cnt_lval=$d_stdio_cnt_lval;;
12512         esac
12513         case "$stdio_base" in
12514         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12515         esac
12516         case "$stdio_bufsiz" in
12517         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12518         esac
12519 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12520         echo "(Looks like you have stdio.h from Linux.)"
12521         case "$stdio_ptr" in
12522         '') stdio_ptr='((fp)->_IO_read_ptr)'
12523                 ptr_lval=$define
12524                 ;;
12525         *)      ptr_lval=$d_stdio_ptr_lval;;
12526         esac
12527         case "$stdio_cnt" in
12528         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12529                 cnt_lval=$undef
12530                 ;;
12531         *)      cnt_lval=$d_stdio_cnt_lval;;
12532         esac
12533         case "$stdio_base" in
12534         '') stdio_base='((fp)->_IO_read_base)';;
12535         esac
12536         case "$stdio_bufsiz" in
12537         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12538         esac
12539 else
12540         case "$stdio_ptr" in
12541         '') stdio_ptr='((fp)->_ptr)'
12542                 ptr_lval=$define
12543                 ;;
12544         *)      ptr_lval=$d_stdio_ptr_lval;;
12545         esac
12546         case "$stdio_cnt" in
12547         '') stdio_cnt='((fp)->_cnt)'
12548                 cnt_lval=$define
12549                 ;;
12550         *)      cnt_lval=$d_stdio_cnt_lval;;
12551         esac
12552         case "$stdio_base" in
12553         '') stdio_base='((fp)->_base)';;
12554         esac
12555         case "$stdio_bufsiz" in
12556         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12557         esac
12558 fi
12559
12560 : test whether _ptr and _cnt really work
12561 echo "Checking how std your stdio is..." >&4
12562 $cat >try.c <<EOP
12563 #include <stdio.h>
12564 #define FILE_ptr(fp)    $stdio_ptr
12565 #define FILE_cnt(fp)    $stdio_cnt
12566 int main() {
12567         FILE *fp = fopen("try.c", "r");
12568         char c = getc(fp);
12569         if (
12570                 18 <= FILE_cnt(fp) &&
12571                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12572         )
12573                 exit(0);
12574         exit(1);
12575 }
12576 EOP
12577 val="$undef"
12578 set try
12579 if eval $compile && $to try.c; then
12580         if $run ./try; then
12581                 echo "Your stdio acts pretty std."
12582                 val="$define"
12583         else
12584                 echo "Your stdio isn't very std."
12585         fi
12586 else
12587         echo "Your stdio doesn't appear very std."
12588 fi
12589 $rm -f try.c try
12590 set d_stdstdio
12591 eval $setvar
12592
12593 : Can _ptr be used as an lvalue?
12594 case "$d_stdstdio$ptr_lval" in
12595 $define$define) val=$define ;;
12596 *) val=$undef ;;
12597 esac
12598 set d_stdio_ptr_lval
12599 eval $setvar
12600
12601 : Can _cnt be used as an lvalue?
12602 case "$d_stdstdio$cnt_lval" in
12603 $define$define) val=$define ;;
12604 *) val=$undef ;;
12605 esac
12606 set d_stdio_cnt_lval
12607 eval $setvar
12608
12609
12610 : test whether setting _ptr sets _cnt as a side effect
12611 d_stdio_ptr_lval_sets_cnt="$undef"
12612 d_stdio_ptr_lval_nochange_cnt="$undef"
12613 case "$d_stdio_ptr_lval$d_stdstdio" in
12614 $define$define)
12615         echo "Checking to see what happens if we set the stdio ptr..." >&4
12616 $cat >try.c <<EOP
12617 #include <stdio.h>
12618 /* Can we scream? */
12619 /* Eat dust sed :-) */
12620 /* In the buffer space, no one can hear you scream. */
12621 #define FILE_ptr(fp)    $stdio_ptr
12622 #define FILE_cnt(fp)    $stdio_cnt
12623 #include <sys/types.h>
12624 int main() {
12625         FILE *fp = fopen("try.c", "r");
12626         int c;
12627         char *ptr;
12628         size_t cnt;
12629         if (!fp) {
12630             puts("Fail even to read");
12631             exit(1);
12632         }
12633         c = getc(fp); /* Read away the first # */
12634         if (c == EOF) {
12635             puts("Fail even to read");
12636             exit(1);
12637         }
12638         if (!(
12639                 18 <= FILE_cnt(fp) &&
12640                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12641         )) {
12642                 puts("Fail even to read");
12643                 exit (1);
12644         }
12645         ptr = (char*) FILE_ptr(fp);
12646         cnt = (size_t)FILE_cnt(fp);
12647
12648         FILE_ptr(fp) += 42;
12649
12650         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12651                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12652                 exit (1);
12653         }
12654         if (FILE_cnt(fp) <= 20) {
12655                 printf ("Fail (<20 chars to test)");
12656                 exit (1);
12657         }
12658         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12659                 puts("Fail compare");
12660                 exit (1);
12661         }
12662         if (cnt == FILE_cnt(fp)) {
12663                 puts("Pass_unchanged");
12664                 exit (0);
12665         }       
12666         if (FILE_cnt(fp) == (cnt - 42)) {
12667                 puts("Pass_changed");
12668                 exit (0);
12669         }
12670         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12671         return 1;
12672
12673 }
12674 EOP
12675         set try
12676         if eval $compile && $to try.c; then
12677                 case `$run ./try` in
12678                 Pass_changed)
12679                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12680                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12681                 Pass_unchanged)
12682                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12683                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12684                 Fail*)
12685                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12686                 *)
12687                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12688         esac
12689         else
12690                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12691         fi
12692         $rm -f try.c try
12693         ;;
12694 esac
12695
12696 : see if _base is also standard
12697 val="$undef"
12698 case "$d_stdstdio" in
12699 $define)
12700         $cat >try.c <<EOP
12701 #include <stdio.h>
12702 #define FILE_base(fp)   $stdio_base
12703 #define FILE_bufsiz(fp) $stdio_bufsiz
12704 int main() {
12705         FILE *fp = fopen("try.c", "r");
12706         char c = getc(fp);
12707         if (
12708                 19 <= FILE_bufsiz(fp) &&
12709                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12710         )
12711                 exit(0);
12712         exit(1);
12713 }
12714 EOP
12715         set try
12716         if eval $compile && $to try.c; then
12717                 if $run ./try; then
12718                         echo "And its _base field acts std."
12719                         val="$define"
12720                 else
12721                         echo "But its _base field isn't std."
12722                 fi
12723         else
12724                 echo "However, it seems to be lacking the _base field."
12725         fi
12726         $rm -f try.c try
12727         ;;
12728 esac
12729 set d_stdiobase
12730 eval $setvar
12731
12732 $cat >&4 <<EOM
12733 Checking how to access stdio streams by file descriptor number...
12734 EOM
12735 case "$stdio_stream_array" in
12736 '')     $cat >try.c <<EOCP
12737 #include <stdio.h>
12738 int main() {
12739   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
12740     printf("yes\n");
12741 }
12742 EOCP
12743         for s in _iob __iob __sF
12744         do
12745                 set try -DSTDIO_STREAM_ARRAY=$s
12746                 if eval $compile; then
12747                         case "`$run ./try`" in
12748                         yes)    stdio_stream_array=$s; break ;;
12749                         esac
12750                 fi
12751         done
12752         $rm -f try.* try$exe_ext
12753 esac
12754 case "$stdio_stream_array" in
12755 '')     $cat >&4 <<EOM
12756 I can't figure out how to access stdio streams by file descriptor number.
12757 EOM
12758         d_stdio_stream_array="$undef"
12759         ;;
12760 *)      $cat >&4 <<EOM
12761 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
12762 EOM
12763         d_stdio_stream_array="$define"
12764         ;;
12765 esac
12766
12767 : see if strcoll exists
12768 set strcoll d_strcoll
12769 eval $inlibc
12770
12771 : check for structure copying
12772 echo " "
12773 echo "Checking to see if your C compiler can copy structs..." >&4
12774 $cat >try.c <<'EOCP'
12775 int main()
12776 {
12777         struct blurfl {
12778                 int dyick;
12779         } foo, bar;
12780
12781         foo = bar;
12782 }
12783 EOCP
12784 if $cc -c try.c >/dev/null 2>&1 ; then
12785         val="$define"
12786         echo "Yup, it can."
12787 else
12788         val="$undef"
12789         echo "Nope, it can't."
12790 fi
12791 set d_strctcpy
12792 eval $setvar
12793 $rm -f try.*
12794
12795 : see if strerror and/or sys_errlist[] exist
12796 echo " "
12797 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
12798     if set strerror val -f d_strerror; eval $csym; $val; then
12799                 echo 'strerror() found.' >&4
12800                 d_strerror="$define"
12801                 d_strerrm='strerror(e)'
12802                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
12803                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
12804                         d_syserrlst="$define"
12805                 else
12806                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
12807                         d_syserrlst="$undef"
12808                 fi
12809     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
12810                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
12811                 echo 'strerror() found in string header.' >&4
12812                 d_strerror="$define"
12813                 d_strerrm='strerror(e)'
12814                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
12815                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
12816                                 d_syserrlst="$define"
12817                 else
12818                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
12819                         d_syserrlst="$undef"
12820                 fi
12821     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
12822                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
12823                 d_strerror="$undef"
12824                 d_syserrlst="$define"
12825                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
12826     else
12827                 echo 'strerror() and sys_errlist[] NOT found.' >&4
12828                 d_strerror="$undef"
12829                 d_syserrlst="$undef"
12830                 d_strerrm='"unknown"'
12831     fi
12832 fi
12833
12834 : see if strftime exists
12835 set strftime d_strftime
12836 eval $inlibc
12837
12838 : see if strtod exists
12839 set strtod d_strtod
12840 eval $inlibc
12841
12842 : see if strtol exists
12843 set strtol d_strtol
12844 eval $inlibc
12845
12846 : see if strtold exists
12847 set strtold d_strtold
12848 eval $inlibc
12849
12850 : see if strtoll exists
12851 set strtoll d_strtoll
12852 eval $inlibc
12853
12854 case "$d_longlong-$d_strtoll" in
12855 "$define-$define")
12856         $cat <<EOM
12857 Checking whether your strtoll() works okay...
12858 EOM
12859         $cat >try.c <<'EOCP'
12860 #include <errno.h>
12861 #ifdef __hpux
12862 #define strtoll __strtoll
12863 #endif
12864 #ifdef __EMX__
12865 #define strtoll _strtoll
12866 #endif
12867 #include <stdio.h>
12868 extern long long int strtoll(char *s, char **, int); 
12869 static int bad = 0;
12870 int check(char *s, long long ell, int een) {
12871         long long gll;
12872         errno = 0;
12873         gll = strtoll(s, 0, 10);
12874         if (!((gll == ell) && (errno == een)))
12875                 bad++;
12876 }
12877 int main() {
12878         check(" 1",                                      1LL, 0);
12879         check(" 0",                                      0LL, 0);
12880         check("-1",                                     -1LL, 0);
12881         check("-9223372036854775808", -9223372036854775808LL, 0);
12882         check("-9223372036854775808", -9223372036854775808LL, 0);
12883         check(" 9223372036854775807",  9223372036854775807LL, 0);
12884         check("-9223372036854775808", -9223372036854775808LL, 0);
12885         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
12886         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
12887         if (!bad)
12888                 printf("ok\n");
12889 }
12890 EOCP
12891         set try
12892         if eval $compile; then
12893                 yyy=`$run ./try`
12894                 case "$yyy" in
12895                 ok) echo "Your strtoll() seems to be working okay." ;;
12896                 *) cat <<EOM >&4
12897 Your strtoll() doesn't seem to be working okay.
12898 EOM
12899                    d_strtoll="$undef"
12900                    ;;
12901                 esac
12902         else
12903                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12904                 d_strtoll="$undef"
12905         fi
12906         ;;
12907 esac
12908
12909 : see if strtoq exists
12910 set strtoq d_strtoq
12911 eval $inlibc
12912
12913 : see if strtoul exists
12914 set strtoul d_strtoul
12915 eval $inlibc
12916
12917 case "$d_strtoul" in
12918 "$define")
12919         $cat <<EOM
12920 Checking whether your strtoul() works okay...
12921 EOM
12922         $cat >try.c <<'EOCP'
12923 #include <errno.h>
12924 #include <stdio.h>
12925 extern unsigned long int strtoul(char *s, char **, int); 
12926 static int bad = 0;
12927 void check(char *s, unsigned long eul, int een) {
12928         unsigned long gul;
12929         errno = 0;
12930         gul = strtoul(s, 0, 10);
12931         if (!((gul == eul) && (errno == een)))
12932                 bad++;
12933 }
12934 int main() {
12935         check(" 1", 1L, 0);
12936         check(" 0", 0L, 0);
12937 EOCP
12938         case "$longsize" in
12939         8)
12940             $cat >>try.c <<'EOCP'
12941         check("18446744073709551615", 18446744073709551615UL, 0);
12942         check("18446744073709551616", 18446744073709551615UL, ERANGE);
12943 #if 0 /* strtoul() for /^-/ strings is undefined. */
12944         check("-1", 18446744073709551615UL, 0);
12945         check("-18446744073709551614", 2, 0);
12946         check("-18446744073709551615", 1, 0);
12947         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
12948         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
12949 #endif
12950 EOCP
12951                 ;;
12952         4)
12953                     $cat >>try.c <<'EOCP'
12954         check("4294967295", 4294967295UL, 0);
12955         check("4294967296", 4294967295UL, ERANGE);
12956 #if 0 /* strtoul() for /^-/ strings is undefined. */
12957         check("-1", 4294967295UL, 0);
12958         check("-4294967294", 2, 0);
12959         check("-4294967295", 1, 0);
12960         check("-4294967296", 4294967295UL, ERANGE);
12961         check("-4294967297", 4294967295UL, ERANGE);
12962 #endif
12963 EOCP
12964                 ;;
12965         *)
12966 : Should we write these tests to be more portable by sprintf-ing
12967 : ~0 and then manipulating that char string as input for strtol?
12968                 ;;
12969         esac
12970         $cat >>try.c <<'EOCP'
12971         if (!bad)
12972                 printf("ok\n");
12973         return 0;
12974 }
12975 EOCP
12976         set try
12977         if eval $compile; then
12978                 case "`$run ./try`" in
12979                 ok) echo "Your strtoul() seems to be working okay." ;;
12980                 *) cat <<EOM >&4
12981 Your strtoul() doesn't seem to be working okay.
12982 EOM
12983                    d_strtoul="$undef"
12984                    ;;
12985                 esac
12986         fi
12987         ;;
12988 esac
12989
12990 : see if strtoull exists
12991 set strtoull d_strtoull
12992 eval $inlibc
12993
12994 case "$d_longlong-$d_strtoull" in
12995 "$define-$define")
12996         $cat <<EOM
12997 Checking whether your strtoull() works okay...
12998 EOM
12999         $cat >try.c <<'EOCP'
13000 #include <errno.h>
13001 #ifdef __hpux
13002 #define strtoull __strtoull
13003 #endif
13004 #include <stdio.h>
13005 extern unsigned long long int strtoull(char *s, char **, int); 
13006 static int bad = 0;
13007 int check(char *s, long long eull, int een) {
13008         long long gull;
13009         errno = 0;
13010         gull = strtoull(s, 0, 10);
13011         if (!((gull == eull) && (errno == een)))
13012                 bad++;
13013 }
13014 int main() {
13015         check(" 1",                                        1LL, 0);
13016         check(" 0",                                        0LL, 0);
13017         check("18446744073709551615",  18446744073709551615ULL, 0);
13018         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
13019 #if 0 /* strtoull() for /^-/ strings is undefined. */
13020         check("-1",                    18446744073709551615ULL, 0);
13021         check("-18446744073709551614",                     2LL, 0);
13022         check("-18446744073709551615",                     1LL, 0);
13023         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
13024         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
13025 #endif
13026         if (!bad)
13027                 printf("ok\n");
13028 }
13029 EOCP
13030         set try
13031         if eval $compile; then
13032                 case "`$run ./try`" in
13033                 ok) echo "Your strtoull() seems to be working okay." ;;
13034                 *) cat <<EOM >&4
13035 Your strtoull() doesn't seem to be working okay.
13036 EOM
13037                    d_strtoull="$undef"
13038                    ;;
13039                 esac
13040         fi
13041         ;;
13042 esac
13043
13044 : see if strtouq exists
13045 set strtouq d_strtouq
13046 eval $inlibc
13047
13048 case "$d_strtouq" in
13049 "$define")
13050         $cat <<EOM
13051 Checking whether your strtouq() works okay...
13052 EOM
13053         $cat >try.c <<'EOCP'
13054 #include <errno.h>
13055 #include <stdio.h>
13056 extern unsigned long long int strtouq(char *s, char **, int); 
13057 static int bad = 0;
13058 void check(char *s, unsigned long long eull, int een) {
13059         unsigned long long gull;
13060         errno = 0;
13061         gull = strtouq(s, 0, 10);
13062         if (!((gull == eull) && (errno == een)))
13063                 bad++;
13064 }
13065 int main() {
13066         check(" 1",                                        1LL, 0);
13067         check(" 0",                                        0LL, 0);
13068         check("18446744073709551615",  18446744073709551615ULL, 0);
13069         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
13070 #if 0 /* strtouq() for /^-/ strings is undefined. */
13071         check("-1",                    18446744073709551615ULL, 0);
13072         check("-18446744073709551614",                     2LL, 0);
13073         check("-18446744073709551615",                     1LL, 0);
13074         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
13075         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
13076 #endif
13077         if (!bad)
13078                 printf("ok\n");
13079         return 0;
13080 }
13081 EOCP
13082         set try
13083         if eval $compile; then
13084                 case "`$run ./try`" in
13085                 ok) echo "Your strtouq() seems to be working okay." ;;
13086                 *) cat <<EOM >&4
13087 Your strtouq() doesn't seem to be working okay.
13088 EOM
13089                    d_strtouq="$undef"
13090                    ;;
13091                 esac
13092         fi
13093         ;;
13094 esac
13095
13096 : see if strxfrm exists
13097 set strxfrm d_strxfrm
13098 eval $inlibc
13099
13100 : see if symlink exists
13101 set symlink d_symlink
13102 eval $inlibc
13103
13104 : see if syscall exists
13105 set syscall d_syscall
13106 eval $inlibc
13107
13108 : see if prototype for syscall is available
13109 echo " "
13110 set d_syscallproto syscall $i_unistd unistd.h
13111 eval $hasproto
13112
13113 : see if sysconf exists
13114 set sysconf d_sysconf
13115 eval $inlibc
13116
13117 : see if system exists
13118 set system d_system
13119 eval $inlibc
13120
13121 : see if tcgetpgrp exists
13122 set tcgetpgrp d_tcgetpgrp
13123 eval $inlibc
13124
13125 : see if tcsetpgrp exists
13126 set tcsetpgrp d_tcsetpgrp
13127 eval $inlibc
13128
13129 : see if prototype for telldir is available
13130 echo " "
13131 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
13132 eval $hasproto
13133
13134 : see if this is a sys/times.h system
13135 set sys/times.h i_systimes
13136 eval $inhdr
13137
13138 : see if times exists
13139 echo " "
13140 if set times val -f d_times; eval $csym; $val; then
13141         echo 'times() found.' >&4
13142         d_times="$define"
13143         inc=''
13144         case "$i_systimes" in
13145         "$define") inc='sys/times.h';;
13146         esac
13147         rp="What is the type returned by times() on this system?"
13148         set clock_t clocktype long stdio.h sys/types.h $inc
13149         eval $typedef_ask
13150 else
13151         echo 'times() NOT found, hope that will do.' >&4
13152         d_times="$undef"
13153         clocktype='int'
13154 fi
13155
13156 : see if truncate exists
13157 set truncate d_truncate
13158 eval $inlibc
13159
13160 : see if tzname[] exists
13161 echo " "
13162 if set tzname val -a d_tzname; eval $csym; $val; then
13163         val="$define"
13164         echo 'tzname[] found.' >&4
13165 else
13166         val="$undef"
13167         echo 'tzname[] NOT found.' >&4
13168 fi
13169 set d_tzname
13170 eval $setvar
13171
13172 case "$osname" in
13173 next|rhapsody|darwin) multiarch="$define" ;;
13174 esac
13175 case "$multiarch" in
13176 ''|[nN]*) multiarch="$undef" ;;
13177 esac
13178
13179 : check for ordering of bytes in a long
13180 echo " "
13181 case "$usecrosscompile$multiarch" in
13182 *$define*)
13183         $cat <<EOM
13184 You seem to be either cross-compiling or doing a multiarchitecture build,
13185 skipping the byteorder check.
13186
13187 EOM
13188         byteorder='ffff'
13189         ;;
13190 *)
13191         case "$byteorder" in
13192         '')
13193                 $cat <<'EOM'
13194 In the following, larger digits indicate more significance.  A big-endian
13195 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
13196 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
13197 machines may have weird orders like 3412.  A Cray will report 87654321,
13198 an Alpha will report 12345678. If the test program works the default is
13199 probably right.
13200 I'm now running the test program...
13201 EOM
13202                 $cat >try.c <<'EOCP'
13203 #include <stdio.h>
13204 int main()
13205 {
13206         int i;
13207         union {
13208                 unsigned long l;
13209                 char c[sizeof(long)];
13210         } u;
13211
13212         if (sizeof(long) > 4)
13213                 u.l = (0x08070605L << 32) | 0x04030201L;
13214         else
13215                 u.l = 0x04030201L;
13216         for (i = 0; i < sizeof(long); i++)
13217                 printf("%c", u.c[i]+'0');
13218         printf("\n");
13219         exit(0);
13220 }
13221 EOCP
13222                 xxx_prompt=y
13223                 set try
13224                 if eval $compile && ./try > /dev/null; then
13225                         dflt=`$run ./try`
13226                         case "$dflt" in
13227                         [1-4][1-4][1-4][1-4]|12345678|87654321)
13228                                 echo "(The test program ran ok.)"
13229                                 echo "byteorder=$dflt"
13230                                 xxx_prompt=n
13231                         ;;
13232                         ????|????????) echo "(The test program ran ok.)" ;;
13233                         *) echo "(The test program didn't run right for some reason.)" ;;
13234                         esac
13235                 else
13236                         dflt='4321'
13237                         cat <<'EOM'
13238 (I can't seem to compile the test program.  Guessing big-endian...)
13239 EOM
13240                 fi
13241                 case "$xxx_prompt" in
13242                 y)
13243                         rp="What is the order of bytes in a long?"
13244                         . ./myread
13245                         byteorder="$ans"
13246                         ;;
13247                 *)      byteorder=$dflt
13248                         ;;
13249                 esac
13250                 ;;
13251         esac
13252         $rm -f try.c try
13253         ;;
13254 esac
13255
13256
13257 $cat <<EOM
13258
13259 Checking to see whether you can access character data unalignedly...
13260 EOM
13261 $cat >try.c <<EOCP
13262 #include <stdio.h>
13263 #define U32 $u32type
13264 #define BYTEORDER $byteorder
13265 int main() {
13266 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
13267     U8 buf[] = "\0\0\0\1\0\0\0\0";
13268     U32 *up;
13269     int i;
13270
13271     if (sizeof(U32) != 4) {
13272         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
13273         exit(1);
13274     }
13275
13276     fflush(stdout);
13277
13278     for (i = 0; i < 4; i++) {
13279         up = (U32*)(buf + i);
13280         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
13281                (*up == 1 << (8*(3-i)))  /* little-endian */
13282               )
13283            )
13284         {
13285             printf("read failed (%x)\n", *up);
13286             exit(2);
13287         }
13288     }
13289
13290     /* write test */
13291     for (i = 0; i < 4; i++) {
13292         up = (U32*)(buf + i);
13293         *up = 0xBeef;
13294         if (*up != 0xBeef) {
13295             printf("write failed (%x)\n", *up);
13296             exit(3);
13297         }
13298     }
13299
13300     exit(0);
13301 #else
13302     printf("1\n");
13303     exit(1);
13304 #endif
13305     return 0;
13306 }
13307 EOCP
13308 set try
13309 if eval $compile_ok; then
13310         echo "(Testing for character data alignment may dump core.)" >&4
13311         $run ./try 2>&1 >/dev/null
13312         case "$?" in
13313         0)      cat >&4 <<EOM
13314 You can access character data pretty unalignedly.
13315 EOM
13316                 d_u32align="$undef"
13317                 ;;
13318         *)      cat >&4 <<EOM
13319 It seems that you must access character data in an aligned manner.
13320 EOM
13321                 d_u32align="$define"
13322                 ;;
13323         esac
13324         $rm -f core core.try.* try.core
13325 else
13326         rp='Can you access character data at unaligned addresses?'
13327         dflt='n'
13328         . ./myread
13329         case "$ans" in
13330         [yY]*)  d_u32align="$undef"  ;;
13331         *)      d_u32align="$define" ;;
13332         esac
13333 fi
13334
13335 : see if ualarm exists
13336 set ualarm d_ualarm
13337 eval $inlibc
13338
13339 : see if umask exists
13340 set umask d_umask
13341 eval $inlibc
13342
13343 : see if unordered exists
13344 set unordered d_unordered
13345 eval $inlibc
13346
13347 : see if usleep exists
13348 set usleep d_usleep
13349 eval $inlibc
13350
13351 : see if prototype for usleep is available
13352 echo " "
13353 set d_usleepproto usleep $i_unistd unistd.h
13354 eval $hasproto
13355
13356 : see if ustat exists
13357 set ustat d_ustat
13358 eval $inlibc
13359
13360 : backward compatibility for d_hvfork
13361 if test X$d_hvfork != X; then
13362         d_vfork="$d_hvfork"
13363         d_hvfork=''
13364 fi
13365 : see if there is a vfork
13366 val=''
13367 set vfork val
13368 eval $inlibc
13369
13370 : Ok, but do we want to use it. vfork is reportedly unreliable in 
13371 : perl on Solaris 2.x, and probably elsewhere.
13372 case "$val" in
13373 $define)
13374         echo " "
13375         case "$usevfork" in
13376         false) dflt='n';;
13377         *) dflt='y';;
13378         esac
13379         cat <<'EOM'
13380  
13381 Perl can only use a vfork() that doesn't suffer from strict
13382 restrictions on calling functions or modifying global data in
13383 the child.  For example, glibc-2.1 contains such a vfork()
13384 that is unsuitable.  If your system provides a proper fork()
13385 call, chances are that you do NOT want perl to use vfork().
13386
13387 EOM
13388         rp="Do you still want to use vfork()?"
13389         . ./myread
13390         case "$ans" in
13391         y|Y) ;;
13392         *)
13393                 echo "Ok, we won't use vfork()."
13394                 val="$undef"
13395                 ;;
13396         esac
13397         ;;
13398 esac
13399 set d_vfork
13400 eval $setvar
13401 case "$d_vfork" in
13402 $define) usevfork='true';;
13403 *) usevfork='false';;
13404 esac
13405
13406 : see if this is an sysdir system
13407 set sys/dir.h i_sysdir
13408 eval $inhdr
13409
13410 : see if this is an sysndir system
13411 set sys/ndir.h i_sysndir
13412 eval $inhdr
13413
13414 : see if closedir exists
13415 set closedir d_closedir
13416 eval $inlibc
13417
13418 case "$d_closedir" in
13419 "$define")
13420         echo " "
13421         echo "Checking whether closedir() returns a status..." >&4
13422         cat > try.c <<EOM
13423 #$i_dirent I_DIRENT             /**/
13424 #$i_sysdir I_SYS_DIR            /**/
13425 #$i_sysndir I_SYS_NDIR          /**/
13426 #$i_systypes I_SYS_TYPES        /**/
13427
13428 #if defined(I_SYS_TYPES)
13429 #include <sys/types.h>
13430 #endif
13431 #if defined(I_DIRENT)
13432 #include <dirent.h>
13433 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
13434 #include <sys/dir.h>
13435 #endif
13436 #else
13437 #ifdef I_SYS_NDIR
13438 #include <sys/ndir.h>
13439 #else
13440 #ifdef I_SYS_DIR
13441 #ifdef hp9000s500
13442 #include <ndir.h>       /* may be wrong in the future */
13443 #else
13444 #include <sys/dir.h>
13445 #endif
13446 #endif
13447 #endif
13448 #endif 
13449 int main() { return closedir(opendir(".")); }
13450 EOM
13451         set try
13452         if eval $compile_ok; then
13453                 if $run ./try > /dev/null 2>&1 ; then
13454                         echo "Yes, it does."
13455                         val="$undef"
13456                 else
13457                         echo "No, it doesn't."
13458                         val="$define"
13459                 fi
13460         else
13461                 echo "(I can't seem to compile the test program--assuming it doesn't)"
13462                 val="$define"
13463         fi
13464         ;;
13465 *)
13466         val="$undef";
13467         ;;
13468 esac
13469 set d_void_closedir
13470 eval $setvar
13471 $rm -f try try.*
13472 : see if there is a wait4
13473 set wait4 d_wait4
13474 eval $inlibc
13475
13476 : see if waitpid exists
13477 set waitpid d_waitpid
13478 eval $inlibc
13479
13480 : see if wcstombs exists
13481 set wcstombs d_wcstombs
13482 eval $inlibc
13483
13484 : see if wctomb exists
13485 set wctomb d_wctomb
13486 eval $inlibc
13487
13488 : see if writev exists
13489 set writev d_writev
13490 eval $inlibc
13491
13492 : preserve RCS keywords in files with variable substitution, grrr
13493 Date='$Date'
13494 Id='$Id'
13495 Log='$Log'
13496 RCSfile='$RCSfile'
13497 Revision='$Revision'
13498
13499 : check for alignment requirements
13500 echo " "
13501 case "$usecrosscompile$multiarch" in
13502 *$define*)
13503         $cat <<EOM
13504 You seem to be either cross-compiling or doing a multiarchitecture build,
13505 skipping the memory alignment check.
13506
13507 EOM
13508         case "$alignbytes" in
13509         '') alignbytes=8 ;;
13510         esac
13511         ;;
13512 *)
13513         case "$alignbytes" in
13514         '') echo "Checking alignment constraints..." >&4
13515                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
13516                         $cat >try.c <<'EOCP'
13517 typedef long double NV;
13518 EOCP
13519                 else
13520                         $cat >try.c <<'EOCP'
13521 typedef double NV;
13522 EOCP
13523                 fi
13524                 $cat >>try.c <<'EOCP'
13525 #include <stdio.h>
13526 struct foobar {
13527         char foo;
13528         NV bar;
13529 } try_algn;
13530 int main()
13531 {
13532     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
13533     return(0);
13534 }
13535 EOCP
13536                 set try
13537                 if eval $compile_ok; then
13538                         dflt=`$run ./try`
13539                 else
13540                         dflt='8'
13541                         echo "(I can't seem to compile the test program...)"
13542                 fi
13543                 ;;
13544         *) dflt="$alignbytes"
13545                 ;;
13546         esac
13547         rp="Doubles must be aligned on a how-many-byte boundary?"
13548         . ./myread
13549         alignbytes="$ans"
13550         $rm -f try.c try
13551         ;;
13552 esac
13553
13554
13555 : set the base revision
13556 baserev=5.0
13557
13558 : how do we catenate cpp tokens here?
13559 echo " "
13560 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
13561 $cat >cpp_stuff.c <<'EOCP'
13562 #define RCAT(a,b)a/**/b
13563 #define ACAT(a,b)a ## b
13564 RCAT(Rei,ser)
13565 ACAT(Cir,cus)
13566 EOCP
13567 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
13568 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
13569         echo "Oh!  Smells like ANSI's been here." >&4
13570         echo "We can catify or stringify, separately or together!"
13571         cpp_stuff=42
13572 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
13573         echo "Ah, yes!  The good old days!" >&4
13574         echo "However, in the good old days we don't know how to stringify and"
13575         echo "catify at the same time."
13576         cpp_stuff=1
13577 else
13578         $cat >&4 <<EOM
13579 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
13580 to have to edit the values of CAT[2-5] in config.h...
13581 EOM
13582         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
13583 fi
13584 $rm -f cpp_stuff.*
13585
13586 : see if this is a db.h system
13587 set db.h i_db
13588 eval $inhdr
13589
13590 case "$i_db" in
13591 $define)
13592         : Check db version.
13593         echo " "
13594         echo "Checking Berkeley DB version ..." >&4
13595         $cat >try.c <<EOCP
13596 #$d_const HASCONST
13597 #ifndef HASCONST
13598 #define const
13599 #endif
13600 #include <sys/types.h>
13601 #include <stdio.h>
13602 #include <db.h>
13603 int main(int argc, char *argv[])
13604 {
13605 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
13606     int Major, Minor, Patch ;
13607     unsigned long Version ;
13608     (void)db_version(&Major, &Minor, &Patch) ;
13609     if (argc == 2) {
13610         printf("%d %d %d %d %d %d\n",
13611                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
13612                Major, Minor, Patch);
13613         exit(0);
13614     }
13615     printf("You have Berkeley DB Version 2 or greater.\n");
13616
13617     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
13618                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
13619     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
13620                 Major, Minor, Patch) ;
13621
13622     /* check that db.h & libdb are compatible */
13623     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
13624         printf("db.h and libdb are incompatible.\n") ;
13625         exit(3);        
13626     }
13627
13628     printf("db.h and libdb are compatible.\n") ;
13629
13630     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
13631                 + DB_VERSION_PATCH ;
13632
13633     /* needs to be >= 2.3.4 */
13634     if (Version < 2003004) {
13635     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
13636         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
13637         exit(2);        
13638     }
13639
13640     exit(0);
13641 #else
13642 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
13643     if (argc == 2) {
13644         printf("1 0 0\n");
13645         exit(0);
13646     }
13647     printf("You have Berkeley DB Version 1.\n");
13648     exit(0);    /* DB version < 2: the coast is clear. */
13649 #else
13650     exit(1);    /* <db.h> not Berkeley DB? */
13651 #endif
13652 #endif
13653 }
13654 EOCP
13655         set try
13656         if eval $compile_ok && $run ./try; then
13657                 echo 'Looks OK.' >&4
13658                 set `$run ./try 1`
13659                 db_version_major=$1
13660                 db_version_minor=$2
13661                 db_version_patch=$3
13662         else
13663                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
13664                 i_db=$undef
13665                 case " $libs " in
13666                 *"-ldb "*)
13667                         : Remove db from list of libraries to use
13668                         echo "Removing unusable -ldb from library list" >&4
13669                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
13670                         shift
13671                         libs="$*"
13672                         echo "libs = $libs" >&4
13673                         ;;
13674                 esac
13675         fi
13676         $rm -f try.*
13677         ;;
13678 esac
13679
13680 case "$i_db" in
13681 define)
13682         : Check the return type needed for hash 
13683         echo " "
13684         echo "Checking return type needed for hash for Berkeley DB ..." >&4
13685         $cat >try.c <<EOCP
13686 #$d_const HASCONST
13687 #ifndef HASCONST
13688 #define const
13689 #endif
13690 #include <sys/types.h>
13691 #include <db.h>
13692
13693 #ifndef DB_VERSION_MAJOR
13694 u_int32_t hash_cb (ptr, size)
13695 const void *ptr;
13696 size_t size;
13697 {
13698 }
13699 HASHINFO info;
13700 int main()
13701 {
13702         info.hash = hash_cb;
13703 }
13704 #endif
13705 EOCP
13706         if $cc $ccflags -c try.c >try.out 2>&1 ; then
13707                 if $contains warning try.out >>/dev/null 2>&1 ; then
13708                         db_hashtype='int'
13709                 else
13710                         db_hashtype='u_int32_t'
13711                 fi
13712         else
13713                 : XXX Maybe we should just give up here.
13714                 db_hashtype=u_int32_t
13715                 $cat try.out >&4
13716                 echo "Help:  I can't seem to compile the db test program." >&4
13717                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
13718         fi
13719         $rm -f try.*
13720         echo "Your version of Berkeley DB uses $db_hashtype for hash."
13721         ;;
13722 *)      db_hashtype=u_int32_t
13723         ;;
13724 esac
13725 case "$i_db" in
13726 define)
13727         : Check the return type needed for prefix 
13728         echo " "
13729         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
13730         cat >try.c <<EOCP
13731 #$d_const HASCONST
13732 #ifndef HASCONST
13733 #define const
13734 #endif
13735 #include <sys/types.h>
13736 #include <db.h>
13737
13738 #ifndef DB_VERSION_MAJOR
13739 size_t prefix_cb (key1, key2)
13740 const DBT *key1;
13741 const DBT *key2;
13742 {
13743 }
13744 BTREEINFO info;
13745 int main()
13746 {
13747         info.prefix = prefix_cb;
13748 }
13749 #endif
13750 EOCP
13751         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
13752                 if $contains warning try.out >>/dev/null 2>&1 ; then
13753                         db_prefixtype='int'
13754                 else
13755                         db_prefixtype='size_t'
13756                 fi
13757         else
13758                 db_prefixtype='size_t'
13759                 : XXX Maybe we should just give up here.
13760                 $cat try.out >&4
13761                 echo "Help:  I can't seem to compile the db test program." >&4
13762                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
13763         fi
13764         $rm -f try.*
13765         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
13766         ;;
13767 *)      db_prefixtype='size_t'
13768         ;;
13769 esac
13770
13771
13772 : How can we generate normalized random numbers ?
13773 echo " "
13774 echo "Looking for a random number function..." >&4
13775 case "$randfunc" in
13776 '')
13777         if set drand48 val -f; eval $csym; $val; then
13778                 dflt="drand48"
13779                 echo "Good, found drand48()." >&4
13780         elif set random val -f; eval $csym; $val; then
13781                 dflt="random"
13782                 echo "OK, found random()." >&4
13783         else
13784                 dflt="rand"
13785                 echo "Yick, looks like I have to use rand()." >&4
13786         fi
13787         echo " "
13788         ;;
13789 *)
13790         dflt="$randfunc"
13791         ;;
13792 esac
13793 cont=true
13794
13795 case "$ccflags" in
13796 *-Dmy_rand=*|*-Dmy_srand=*)
13797         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
13798         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
13799         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
13800         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
13801         ;;
13802 esac
13803
13804 while $test "$cont"; do
13805         rp="Use which function to generate random numbers?"
13806         . ./myread
13807         if $test "$ans" = "$dflt"; then
13808                 : null
13809         else
13810                 randbits=''
13811         fi
13812         randfunc="$ans"
13813         if set $ans val -f; eval $csym; $val; then
13814                 cont=''
13815         else
13816                 dflt=y
13817                 rp="I cannot find function $ans. Use that name anyway?"
13818                 . ./myread
13819                 dflt=rand
13820                 case "$ans" in
13821                         [yY]*) cont='';;
13822                 esac
13823         fi
13824         case "$cont" in
13825         '')
13826                 case "$randfunc" in
13827                 drand48)
13828                         drand01="drand48()"
13829                         seedfunc="srand48"
13830                         randbits=48
13831                         randseedtype=long
13832                         ;;
13833                 rand|random)
13834                         case "$randbits" in
13835                         '')
13836 echo "Checking to see how many bits your $randfunc() function produces..." >&4
13837                                 $cat >try.c <<EOCP
13838 #$i_unistd I_UNISTD
13839 #$i_stdlib I_STDLIB
13840 #include <stdio.h>
13841 #ifdef I_UNISTD
13842 #  include <unistd.h>
13843 #endif
13844 #ifdef I_STDLIB
13845 #  include <stdlib.h>
13846 #endif
13847 int main()
13848 {
13849         register int i;
13850         register unsigned long tmp;
13851         register unsigned long max = 0L;
13852
13853         for (i = 1000; i; i--) {
13854                 tmp = (unsigned long) $randfunc();
13855                 if (tmp > max) max = tmp;
13856         }
13857         for (i = 0; max; i++)
13858                 max /= 2;
13859         printf("%d\n",i);
13860 }
13861 EOCP
13862                                 set try
13863                                 if eval $compile_ok; then
13864                                         dflt=`try`
13865                                 else
13866                                         dflt='?'
13867                                         echo "(I can't seem to compile the test program...)"
13868                                 fi
13869                                 ;;
13870                         *)
13871                                 dflt="$randbits"
13872                                 ;;
13873                         esac
13874                         rp="How many bits does your $randfunc() function produce?"
13875                         . ./myread
13876                         randbits="$ans"
13877                         $rm -f try.c try
13878                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13879                         seedfunc="s$randfunc"
13880                         randseedtype=unsigned
13881                         ;;
13882                 *)
13883                         dflt="31"
13884                         rp="How many bits does your $randfunc() function produce?"
13885                         . ./myread
13886                         randbits="$ans"
13887                         seedfunc="s$randfunc"
13888                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13889                         if set $seedfunc val -f; eval $csym; $val; then
13890                                 echo "(Using $seedfunc() to seed random generator)"
13891                         else
13892                                 echo "(Warning: no $seedfunc() to seed random generator)"
13893                                 seedfunc=rand
13894                         fi
13895                         randseedtype=unsigned
13896                         ;;
13897                 esac
13898                 ;;
13899         esac
13900 done
13901
13902 echo " "
13903 echo "Determining whether or not we are on an EBCDIC system..." >&4
13904 $cat >try.c <<'EOM'
13905 int main()
13906 {
13907   if ('M'==0xd4) return 0;
13908   return 1;
13909 }
13910 EOM
13911
13912 val=$undef
13913 set try
13914 if eval $compile_ok; then
13915         if $run ./try; then
13916                 echo "You seem to speak EBCDIC." >&4
13917                 val="$define"
13918         else
13919                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
13920         fi
13921 else
13922         echo "I'm unable to compile the test program." >&4
13923         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
13924 fi
13925 $rm -f try try.*
13926 set ebcdic
13927 eval $setvar
13928
13929 echo " "
13930 $cat >&4 <<EOM
13931 Checking how to flush all pending stdio output...
13932 EOM
13933 # I only know how to find the first 32 possibly open files on SunOS.
13934 # See also hints/sunos_4_1.sh and util.c  --AD
13935 case "$osname" in
13936 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
13937 esac
13938 $cat >>try.c <<EOCP
13939 #include <stdio.h>
13940 #$i_unistd I_UNISTD
13941 #ifdef I_UNISTD
13942 # include <unistd.h>
13943 #endif
13944 #$d_sysconf HAS_SYSCONF
13945 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
13946 #ifdef HAS_STDIO_STREAM_ARRAY
13947 # define STDIO_STREAM_ARRAY $stdio_stream_array
13948 #endif
13949 int main() {
13950   FILE* p;
13951   unlink("try.out");
13952   p = fopen("try.out", "w");
13953 #ifdef TRY_FPUTC
13954   fputc('x', p);
13955 #else
13956 # ifdef TRY_FPRINTF
13957   fprintf(p, "x");
13958 # endif
13959 #endif
13960 #ifdef TRY_FFLUSH_NULL
13961   fflush(NULL);
13962 #endif
13963 #ifdef TRY_FFLUSH_ALL
13964   {
13965     long open_max = -1;
13966 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
13967     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
13968 # else
13969 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
13970     open_max = sysconf(_SC_OPEN_MAX);
13971 #  else
13972 #   ifdef FOPEN_MAX
13973     open_max = FOPEN_MAX;
13974 #   else
13975 #    ifdef OPEN_MAX
13976     open_max = OPEN_MAX;
13977 #    else
13978 #     ifdef _NFILE
13979     open_max = _NFILE;
13980 #     endif
13981 #    endif
13982 #   endif
13983 #  endif
13984 # endif 
13985 # ifdef HAS_STDIO_STREAM_ARRAY
13986     if (open_max > 0) {
13987       long i;
13988       for (i = 0; i < open_max; i++)
13989             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
13990                 STDIO_STREAM_ARRAY[i]._file < open_max &&
13991                 STDIO_STREAM_ARRAY[i]._flag)
13992                 fflush(&STDIO_STREAM_ARRAY[i]);
13993     }   
13994   }
13995 # endif
13996 #endif
13997   _exit(42);
13998 }
13999 EOCP
14000 : first we have to find out how _not_ to flush
14001 $to try.c
14002 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
14003     output=''
14004     set try -DTRY_FPUTC
14005     if eval $compile; then
14006             $run ./try 2>/dev/null
14007             code="$?"
14008             $from try.out
14009             if $test ! -s try.out -a "X$code" = X42; then
14010                 output=-DTRY_FPUTC
14011             fi
14012     fi
14013     case "$output" in
14014     '')
14015             set try -DTRY_FPRINTF
14016             if eval $compile; then
14017                     $run ./try 2>/dev/null
14018                     code="$?"
14019                     $from try.out
14020                     if $test ! -s try.out -a "X$code" = X42; then
14021                         output=-DTRY_FPRINTF
14022                     fi
14023             fi
14024         ;;
14025     esac
14026 fi
14027 : check for fflush NULL behaviour
14028 case "$fflushNULL" in
14029 '')     set try -DTRY_FFLUSH_NULL $output
14030         if eval $compile; then
14031                 $run ./try 2>/dev/null
14032                 code="$?"
14033                 $from try.out
14034                 if $test -s try.out -a "X$code" = X42; then
14035                         fflushNULL="`$cat try.out`"
14036                 else
14037                         if $test "X$code" != X42; then
14038                                 $cat >&4 <<EOM
14039 (If this test failed, don't worry, we'll try another method shortly.)
14040 EOM
14041                         fi
14042                 fi
14043         fi
14044         $rm -f core try.core core.try.*
14045         case "$fflushNULL" in
14046         x)      $cat >&4 <<EOM
14047 Your fflush(NULL) works okay for output streams.
14048 Let's see if it clobbers input pipes...
14049 EOM
14050 # As of mid-March 2000 all versions of Solaris appear to have a stdio
14051 # bug that improperly flushes the input end of pipes.  So we avoid the
14052 # autoflush on fork/system/exec support for now. :-(
14053 $cat >tryp.c <<EOCP
14054 #include <stdio.h>
14055 int
14056 main(int argc, char **argv)
14057 {
14058     char buf[1024];
14059     int i;
14060     char *bp = buf;
14061     while (1) {
14062         while ((i = getc(stdin)) != -1
14063                && (*bp++ = i) != '\n'
14064                && bp < &buf[1024])
14065         /* DO NOTHING */ ;
14066         *bp = '\0';
14067         fprintf(stdout, "%s", buf);
14068         fflush(NULL);
14069         if (i == -1)
14070             return 0;
14071         bp = buf;
14072     }
14073 }
14074 EOCP
14075                 fflushNULL="$define"
14076                 set tryp
14077                 if eval $compile; then
14078                     $rm -f tryp.out
14079                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
14080                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
14081                        $cat >&4 <<EOM
14082 fflush(NULL) seems to behave okay with input streams.
14083 EOM
14084                         fflushNULL="$define"
14085                     else
14086                         $cat >&4 <<EOM
14087 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
14088 EOM
14089                         fflushNULL="$undef"
14090                     fi
14091                 fi
14092                 $rm -f core tryp.c tryp.core core.tryp.*
14093                 ;;
14094         '')     $cat >&4 <<EOM
14095 Your fflush(NULL) isn't working (contrary to ANSI C).
14096 EOM
14097                 fflushNULL="$undef"
14098                 ;;
14099         *)      $cat >&4 <<EOM
14100 Cannot figure out whether your fflush(NULL) works or not.
14101 I'm assuming it doesn't (contrary to ANSI C).
14102 EOM
14103                 fflushNULL="$undef"
14104                 ;;
14105         esac
14106         ;;
14107 $define|true|[yY]*)
14108         fflushNULL="$define"
14109         ;;
14110 *)
14111         fflushNULL="$undef"
14112         ;;
14113 esac
14114 : check explicit looping only if NULL did not work, and if the pipe
14115 : bug does not show up on an explicit flush too
14116 case "$fflushNULL" in
14117 "$undef")
14118         $cat >tryp.c <<EOCP
14119 #include <stdio.h>
14120 int
14121 main(int argc, char **argv)
14122 {
14123     char buf[1024];
14124     int i;
14125     char *bp = buf;
14126     while (1) {
14127         while ((i = getc(stdin)) != -1
14128                && (*bp++ = i) != '\n'
14129                && bp < &buf[1024])
14130         /* DO NOTHING */ ;
14131         *bp = '\0';
14132         fprintf(stdout, "%s", buf);
14133         fflush(stdin);
14134         if (i == -1)
14135             return 0;
14136         bp = buf;
14137     }
14138 }
14139 EOCP
14140         set tryp
14141         if eval $compile; then
14142             $rm -f tryp.out
14143             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
14144             if cmp tryp.c tryp.out >/dev/null 2>&1; then
14145                $cat >&4 <<EOM
14146 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
14147 EOM
14148                 : now check for fflushall behaviour
14149                 case "$fflushall" in
14150                 '')     set try -DTRY_FFLUSH_ALL $output
14151                         if eval $compile; then
14152                                 $cat >&4 <<EOM
14153 (Now testing the other method--but note that this also may fail.)
14154 EOM
14155                                 $run ./try 2>/dev/null
14156                                 code=$?
14157                                 $from try.out
14158                                 if $test -s try.out -a "X$code" = X42; then
14159                                         fflushall="`$cat try.out`"
14160                                 fi
14161                         fi
14162                         $rm -f core try.core core.try.*
14163                         case "$fflushall" in
14164                         x)      $cat >&4 <<EOM
14165 Whew. Flushing explicitly all the stdio streams works.
14166 EOM
14167                                 fflushall="$define"
14168                                 ;;
14169                         '')     $cat >&4 <<EOM
14170 Sigh. Flushing explicitly all the stdio streams doesn't work.
14171 EOM
14172                                 fflushall="$undef"
14173                                 ;;
14174                         *)      $cat >&4 <<EOM
14175 Cannot figure out whether flushing stdio streams explicitly works or not.
14176 I'm assuming it doesn't.
14177 EOM
14178                                 fflushall="$undef"
14179                                 ;;
14180                         esac
14181                         ;;
14182                 "$define"|true|[yY]*)
14183                         fflushall="$define"
14184                         ;;
14185                 *)
14186                         fflushall="$undef"
14187                         ;;
14188                 esac
14189             else
14190                 $cat >&4 <<EOM
14191 All is futile.  Even fflush(stdin) clobbers input pipes!
14192 EOM
14193                 fflushall="$undef"
14194             fi
14195         else
14196             fflushall="$undef"
14197         fi
14198         $rm -f core tryp.c tryp.core core.tryp.*
14199         ;;
14200 *)      fflushall="$undef"
14201         ;;
14202 esac
14203
14204 case "$fflushNULL$fflushall" in
14205 undefundef)
14206         $cat <<EOM
14207 OK, I give up.  I cannot figure out how to flush pending stdio output.
14208 We won't be flushing handles at all before fork/exec/popen.
14209 EOM
14210         ;;
14211 esac
14212 $rm -f try.* try$exe_ext
14213
14214 : Store the full pathname to the ar program for use in the C program
14215 : Respect a hint or command line value for full_ar.
14216 case "$full_ar" in
14217 '') full_ar=$ar ;;
14218 esac
14219
14220 : Store the full pathname to the sed program for use in the C program
14221 full_sed=$sed
14222
14223 : see what type gids are declared as in the kernel
14224 echo " "
14225 echo "Looking for the type for group ids returned by getgid()."
14226 set gid_t gidtype xxx stdio.h sys/types.h
14227 eval $typedef
14228 case "$gidtype" in
14229 xxx)
14230         xxx=`./findhdr sys/user.h`
14231         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
14232         case $1 in
14233         unsigned) dflt="$1 $2" ;;
14234         *) dflt="$1" ;;
14235         esac
14236         ;;
14237 *) dflt="$gidtype";;
14238 esac
14239 case "$gidtype" in
14240 gid_t) echo "gid_t found." ;;
14241 *)      rp="What is the type for group ids returned by getgid()?"
14242         . ./myread
14243         gidtype="$ans"
14244         ;;
14245 esac
14246
14247 echo " "
14248 case "$gidtype" in
14249 *_t) zzz="$gidtype"     ;;
14250 *)   zzz="gid"          ;;
14251 esac
14252 echo "Checking the size of $zzz..." >&4 
14253 cat > try.c <<EOCP
14254 #include <sys/types.h>
14255 #include <stdio.h>
14256 int main() {
14257     printf("%d\n", (int)sizeof($gidtype));
14258     exit(0);
14259 }
14260 EOCP
14261 set try
14262 if eval $compile_ok; then
14263         yyy=`$run ./try`
14264         case "$yyy" in
14265         '')     gidsize=4
14266                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
14267                 ;;
14268         *)      gidsize=$yyy
14269                 echo "Your $zzz is $gidsize bytes long."
14270                 ;;
14271         esac
14272 else
14273         gidsize=4
14274         echo "(I can't compile the test program--guessing $gidsize.)" >&4
14275 fi
14276
14277
14278 echo " "
14279 case "$gidtype" in
14280 *_t) zzz="$gidtype"     ;;
14281 *)   zzz="gid"          ;;
14282 esac
14283 echo "Checking the sign of $zzz..." >&4 
14284 cat > try.c <<EOCP
14285 #include <sys/types.h>
14286 #include <stdio.h>
14287 int main() {
14288         $gidtype foo = -1;
14289         if (foo < 0)
14290                 printf("-1\n");
14291         else
14292                 printf("1\n");
14293 }
14294 EOCP
14295 set try
14296 if eval $compile; then
14297         yyy=`$run ./try`
14298         case "$yyy" in
14299         '')     gidsign=1
14300                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14301                 ;;
14302         *)      gidsign=$yyy
14303                 case "$gidsign" in
14304                  1) echo "Your $zzz is unsigned." ;;
14305                 -1) echo "Your $zzz is signed."   ;;
14306                 esac
14307                 ;;
14308         esac
14309 else
14310         gidsign=1
14311         echo "(I can't compile the test program--guessing unsigned.)" >&4
14312 fi
14313
14314
14315 echo " "
14316
14317 if $test X"$quadtype" != X; then
14318
14319 echo "Checking how to print 64-bit integers..." >&4
14320
14321 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
14322         $cat >try.c <<'EOCP'
14323 #include <sys/types.h>
14324 #include <stdio.h>
14325 int main() {
14326   int q = 12345678901;
14327   printf("%ld\n", q);
14328 }
14329 EOCP
14330         set try
14331         if eval $compile; then
14332                 yyy=`$run ./try`
14333                 case "$yyy" in
14334                 12345678901)
14335                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
14336                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
14337                         echo "We will use %d."
14338                         ;;
14339                 esac
14340         fi
14341 fi
14342
14343 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
14344         $cat >try.c <<'EOCP'
14345 #include <sys/types.h>
14346 #include <stdio.h>
14347 int main() {
14348   long q = 12345678901;
14349   printf("%ld\n", q);
14350 }
14351 EOCP
14352         set try
14353         if eval $compile; then
14354                 yyy=`$run ./try`
14355                 case "$yyy" in
14356                 12345678901)
14357                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
14358                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
14359                         echo "We will use %ld."
14360                         ;;
14361                 esac
14362         fi
14363 fi
14364
14365 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
14366         $cat >try.c <<'EOCP'
14367 #include <sys/types.h>
14368 #include <inttypes.h>
14369 #include <stdio.h>
14370 int main() {
14371   int64_t q = 12345678901;
14372   printf("%" PRId64 "\n", q);
14373 }
14374 EOCP
14375         set try
14376         if eval $compile; then
14377                 yyy=`$run ./try`
14378                 case "$yyy" in
14379                 12345678901)
14380                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
14381                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
14382                         echo "We will use the C9X style."
14383                         ;;
14384                 esac
14385         fi
14386 fi
14387
14388 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
14389         $cat >try.c <<EOCP
14390 #include <sys/types.h>
14391 #include <stdio.h>
14392 int main() {
14393   $quadtype q = 12345678901;
14394   printf("%Ld\n", q);
14395 }
14396 EOCP
14397         set try
14398         if eval $compile; then
14399                 yyy=`$run ./try`
14400                 case "$yyy" in
14401                 12345678901)
14402                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
14403                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
14404                         echo "We will use %Ld."
14405                         ;;
14406                 esac
14407         fi
14408 fi
14409
14410 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
14411         $cat >try.c <<'EOCP'
14412 #include <sys/types.h>
14413 #include <stdio.h>
14414 int main() {
14415   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
14416   printf("%lld\n", q);
14417 }
14418 EOCP
14419         set try
14420         if eval $compile; then
14421                 yyy=`$run ./try`
14422                 case "$yyy" in
14423                 12345678901)
14424                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
14425                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
14426                         echo "We will use the %lld style."
14427                         ;;
14428                 esac
14429         fi
14430 fi
14431
14432 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
14433         $cat >try.c <<EOCP
14434 #include <sys/types.h>
14435 #include <stdio.h>
14436 int main() {
14437   $quadtype q = 12345678901;
14438   printf("%qd\n", q);
14439 }
14440 EOCP
14441         set try
14442         if eval $compile; then
14443                 yyy=`$run ./try`
14444                 case "$yyy" in
14445                 12345678901)
14446                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
14447                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
14448                         echo "We will use %qd."
14449                         ;;
14450                 esac
14451         fi
14452 fi
14453
14454 if $test X"$sPRId64" = X; then
14455         echo "Cannot figure out how to print 64-bit integers." >&4
14456 fi
14457
14458 $rm -f try try.*
14459
14460 fi
14461
14462 case "$sPRId64" in
14463 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
14464         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
14465         ;;
14466 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
14467         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
14468         ;;
14469 esac
14470
14471
14472 echo " "
14473 $echo "Checking the format strings to be used for Perl's internal types..." >&4
14474
14475 if $test X"$ivsize" = X8; then
14476         ivdformat="$sPRId64"
14477         uvuformat="$sPRIu64"
14478         uvoformat="$sPRIo64"
14479         uvxformat="$sPRIx64"
14480         uvXUformat="$sPRIXU64"
14481 else
14482         if $test X"$ivsize" = X"$longsize"; then
14483                 ivdformat='"ld"'
14484                 uvuformat='"lu"'
14485                 uvoformat='"lo"'
14486                 uvxformat='"lx"'
14487                 uvXUformat='"lX"'
14488         else
14489                 if $test X"$ivsize" = X"$intsize"; then
14490                         ivdformat='"d"'
14491                         uvuformat='"u"'
14492                         uvoformat='"o"'
14493                         uvxformat='"x"'
14494                         uvXUformat='"X"'
14495                 else
14496                         : far out
14497                         if $test X"$ivsize" = X"$shortsize"; then
14498                                 ivdformat='"hd"'
14499                                 uvuformat='"hu"'
14500                                 uvoformat='"ho"'
14501                                 uvxformat='"hx"'
14502                                 uvXUformat='"hX"'
14503                         fi
14504                 fi
14505         fi
14506 fi
14507
14508 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
14509         nveformat="$sPRIeldbl"
14510         nvfformat="$sPRIfldbl"
14511         nvgformat="$sPRIgldbl"
14512         nvEUformat="$sPRIEUldbl"
14513         nvFUformat="$sPRIFUldbl"
14514         nvGUformat="$sPRIGUldbl"
14515 else
14516         nveformat='"e"'
14517         nvfformat='"f"'
14518         nvgformat='"g"'
14519         nvEUformat='"E"'
14520         nvFUformat='"F"'
14521         nvGUformat='"G"'
14522 fi
14523
14524 case "$ivdformat" in
14525 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
14526     exit 1
14527     ;;
14528 esac
14529
14530
14531 echo " "
14532 $echo "Checking the format string to be used for gids..." >&4
14533
14534 case "$gidsign" in
14535 -1)     if $test X"$gidsize" = X"$ivsize"; then
14536                 gidformat="$ivdformat"
14537         else
14538                 if $test X"$gidsize" = X"$longsize"; then
14539                         gidformat='"ld"'
14540                 else
14541                         if $test X"$gidsize" = X"$intsize"; then
14542                                 gidformat='"d"'
14543                         else
14544                                 if $test X"$gidsize" = X"$shortsize"; then
14545                                         gidformat='"hd"'
14546                                 fi
14547                         fi
14548                 fi
14549         fi
14550         ;;
14551 *)      if $test X"$gidsize" = X"$uvsize"; then
14552                 gidformat="$uvuformat"
14553         else
14554                 if $test X"$gidsize" = X"$longsize"; then
14555                         gidformat='"lu"'
14556                 else
14557                         if $test X"$gidsize" = X"$intsize"; then
14558                                 gidformat='"u"'
14559                         else
14560                                 if $test X"$gidsize" = X"$shortsize"; then
14561                                         gidformat='"hu"'
14562                                 fi
14563                         fi
14564                 fi
14565         fi
14566         ;;
14567 esac
14568
14569 : see if getgroups exists
14570 set getgroups d_getgrps
14571 eval $inlibc
14572
14573 : see if setgroups exists
14574 set setgroups d_setgrps
14575 eval $inlibc
14576
14577
14578 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
14579 echo " "
14580 case "$d_getgrps$d_setgrps" in
14581 *define*)
14582         case "$groupstype" in
14583         '') dflt="$gidtype" ;;
14584         *)  dflt="$groupstype" ;;
14585         esac
14586         $cat <<EOM
14587 What type of pointer is the second argument to getgroups() and setgroups()?
14588 Usually this is the same as group ids, $gidtype, but not always.
14589
14590 EOM
14591         rp='What type pointer is the second argument to getgroups() and setgroups()?'
14592         . ./myread
14593         groupstype="$ans"
14594         ;;
14595 *)  groupstype="$gidtype";;
14596 esac
14597
14598 echo " "
14599 echo "Checking if your $make program sets \$(MAKE)..." >&4
14600 case "$make_set_make" in
14601 '')
14602         $sed 's/^X //' > testmake.mak << 'EOF'
14603 Xall:
14604 X       @echo 'maketemp="$(MAKE)"'
14605 EOF
14606         case "`$make -f testmake.mak 2>/dev/null`" in
14607         *maketemp=*) make_set_make='#' ;;
14608         *)      make_set_make="MAKE=$make" ;;
14609         esac
14610         $rm -f testmake.mak
14611         ;;
14612 esac
14613 case "$make_set_make" in
14614 '#') echo "Yup, it does.";;
14615 *) echo "Nope, it doesn't.";;
14616 esac
14617
14618 : see what type is used for mode_t
14619 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
14620 set mode_t modetype int stdio.h sys/types.h
14621 eval $typedef_ask
14622
14623 : see if stdarg is available
14624 echo " "
14625 if $test `./findhdr stdarg.h`; then
14626         echo "<stdarg.h> found." >&4
14627         valstd="$define"
14628 else
14629         echo "<stdarg.h> NOT found." >&4
14630         valstd="$undef"
14631 fi
14632
14633 : see if varags is available
14634 echo " "
14635 if $test `./findhdr varargs.h`; then
14636         echo "<varargs.h> found." >&4
14637 else
14638         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
14639 fi
14640
14641 : set up the varargs testing programs
14642 $cat > varargs.c <<EOP
14643 #ifdef I_STDARG
14644 #include <stdarg.h>
14645 #endif
14646 #ifdef I_VARARGS
14647 #include <varargs.h>
14648 #endif
14649
14650 #ifdef I_STDARG
14651 int f(char *p, ...)
14652 #else
14653 int f(va_alist)
14654 va_dcl
14655 #endif
14656 {
14657         va_list ap;
14658 #ifndef I_STDARG
14659         char *p;
14660 #endif
14661 #ifdef I_STDARG
14662         va_start(ap,p);
14663 #else
14664         va_start(ap);
14665         p = va_arg(ap, char *);
14666 #endif
14667         va_end(ap);
14668 }
14669 EOP
14670 $cat > varargs <<EOP
14671 $startsh
14672 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
14673         echo "true"
14674 else
14675         echo "false"
14676 fi
14677 $rm -f varargs$_o
14678 EOP
14679 chmod +x varargs
14680
14681 : now check which varargs header should be included
14682 echo " "
14683 i_varhdr=''
14684 case "$valstd" in
14685 "$define")
14686         if `./varargs I_STDARG`; then
14687                 val='stdarg.h'
14688         elif `./varargs I_VARARGS`; then
14689                 val='varargs.h'
14690         fi
14691         ;;
14692 *)
14693         if `./varargs I_VARARGS`; then
14694                 val='varargs.h'
14695         fi
14696         ;;
14697 esac
14698 case "$val" in
14699 '')
14700 echo "I could not find the definition for va_dcl... You have problems..." >&4
14701         val="$undef"; set i_stdarg; eval $setvar
14702         val="$undef"; set i_varargs; eval $setvar
14703         ;;
14704 *) 
14705         set i_varhdr
14706         eval $setvar
14707         case "$i_varhdr" in
14708         stdarg.h)
14709                 val="$define"; set i_stdarg; eval $setvar
14710                 val="$undef"; set i_varargs; eval $setvar
14711                 ;;
14712         varargs.h)
14713                 val="$undef"; set i_stdarg; eval $setvar
14714                 val="$define"; set i_varargs; eval $setvar
14715                 ;;
14716         esac
14717         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
14718 esac
14719 $rm -f varargs*
14720
14721 : see if we need va_copy
14722 echo " "
14723 case "$i_stdarg" in
14724 "$define")
14725         $cat >try.c <<EOCP
14726 #include <stdarg.h>
14727 #include <stdio.h>
14728 #$i_stdlib I_STDLIB
14729 #ifdef I_STDLIB
14730 #include <stdlib.h>
14731 #endif
14732 #include <signal.h>
14733
14734 int
14735 ivfprintf(FILE *f, const char *fmt, va_list *valp)
14736 {
14737   return vfprintf(f, fmt, *valp);
14738 }
14739  
14740 int    
14741 myvfprintf(FILE *f, const  char *fmt, va_list val)
14742 {
14743   return ivfprintf(f, fmt, &val);
14744 }
14745       
14746 int
14747 myprintf(char *fmt, ...) 
14748 {
14749   va_list val;
14750   va_start(val, fmt);
14751   return myvfprintf(stdout, fmt, val); 
14752 }         
14753
14754 int
14755 main(int ac, char **av)
14756 {
14757   signal(SIGSEGV, exit);
14758
14759   myprintf("%s%cs all right, then\n", "that", '\'');                            
14760   exit(0);      
14761 }
14762 EOCP
14763         set try
14764         if eval $compile && $run ./try 2>&1 >/dev/null; then
14765                 case "`$run ./try`" in
14766                 "that's all right, then")
14767                         okay=yes
14768                         ;;
14769                 esac
14770         fi
14771         case "$okay" in
14772         yes)    echo "It seems that you don't need va_copy()." >&4
14773                 need_va_copy="$undef"
14774                 ;;
14775         *)      echo "It seems that va_copy() or similar will be needed." >&4
14776                 need_va_copy="$define"
14777                 ;;
14778         esac
14779         $rm -f try.* core core.* *.core *.core.*
14780         ;;
14781 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
14782         ;;
14783 esac
14784
14785 : define a fucntion to check prototypes
14786 $cat > protochk <<EOSH
14787 $startsh
14788 cc="$cc"
14789 optimize="$optimize"
14790 ccflags="$ccflags"
14791 prototype="$prototype"
14792 define="$define"
14793 rm=$rm
14794 EOSH
14795
14796 $cat >> protochk <<'EOSH'
14797
14798 $rm -f try.c
14799 foo="$1"
14800 shift
14801 while test $# -ge 2; do
14802         case "$1" in
14803                 $define) echo "#include <$2>" >> try.c ;;
14804                 literal) echo "$2" >> try.c ;;
14805         esac
14806     shift 2
14807 done
14808 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
14809 cat >> try.c <<'EOCP'
14810 #ifdef CAN_PROTOTYPE
14811 #define _(args) args
14812 #else
14813 #define _(args) ()
14814 #endif
14815 EOCP
14816 echo "$foo" >> try.c
14817 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
14818 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
14819 status=$?
14820 $rm -f try.[co]
14821 exit $status
14822 EOSH
14823 chmod +x protochk
14824 $eunicefix protochk
14825
14826 : see what type is used for size_t
14827 rp="What is the type used for the length parameter for string functions?"
14828 set size_t sizetype 'unsigned int' stdio.h sys/types.h
14829 eval $typedef_ask
14830
14831 : check for type of arguments to gethostbyaddr. 
14832 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
14833         case "$d_gethbyaddr" in
14834         $define)
14835                 $cat <<EOM
14836
14837 Checking to see what type of arguments are accepted by gethostbyaddr().
14838 EOM
14839                 hdrs="$define sys/types.h
14840                         $d_socket sys/socket.h 
14841                         $i_niin netinet/in.h 
14842                         $i_netdb netdb.h
14843                         $i_unistd unistd.h"
14844                 : The first arg can 'char *' or 'void *'
14845                 : The second arg is some of integral type
14846                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
14847                         for yyy in size_t long int; do
14848                                 case "$netdb_host_type" in
14849                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
14850                                         if ./protochk "$try" $hdrs; then
14851                                                 echo "Your system accepts $xxx for the first arg."
14852                                                 echo "...and $yyy for the second arg."
14853                                                 netdb_host_type="$xxx"
14854                                                 netdb_hlen_type="$yyy"
14855                                         fi
14856                                         ;;
14857                                 esac
14858                         done
14859                 done
14860                 : In case none of those worked, prompt the user.
14861                 case "$netdb_host_type" in
14862                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
14863                         dflt='char *'
14864                         . ./myread
14865                         netdb_host_type=$ans
14866                         rp='What is the type for the 2nd argument to gethostbyaddr?'
14867                         dflt="$sizetype"
14868                         . ./myread
14869                         netdb_hlen_type=$ans
14870                         ;;
14871                 esac
14872                 ;;
14873         *)      : no gethostbyaddr, so pick harmless defaults
14874                 netdb_host_type='char *'
14875                 netdb_hlen_type="$sizetype"
14876                 ;;
14877         esac
14878         # Remove the "const" if needed. -- but then we'll have a 
14879         # prototype clash!
14880         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
14881 fi
14882
14883 : check for type of argument to gethostbyname. 
14884 if test "X$netdb_name_type" = X ; then
14885         case "$d_gethbyname" in
14886         $define)
14887                 $cat <<EOM
14888
14889 Checking to see what type of argument is accepted by gethostbyname().
14890 EOM
14891                 hdrs="$define sys/types.h
14892                         $d_socket sys/socket.h 
14893                         $i_niin netinet/in.h 
14894                         $i_netdb netdb.h
14895                         $i_unistd unistd.h"
14896                 for xxx in "const char *" "char *"; do
14897                         case "$netdb_name_type" in
14898                         '')     try="extern struct hostent *gethostbyname($xxx);"
14899                                 if ./protochk "$try" $hdrs; then
14900                                         echo "Your system accepts $xxx."
14901                                         netdb_name_type="$xxx"
14902                                 fi
14903                                 ;;
14904                         esac
14905                 done
14906                 : In case none of those worked, prompt the user.
14907                 case "$netdb_name_type" in
14908                 '')     rp='What is the type for the 1st argument to gethostbyname?'
14909                         dflt='char *'
14910                         . ./myread
14911                         netdb_name_type=$ans
14912                         ;;
14913                 esac
14914                 ;;
14915         *)      : no gethostbyname, so pick harmless default
14916                 netdb_name_type='char *'
14917                 ;;
14918         esac
14919 fi
14920
14921 : check for type of 1st argument to getnetbyaddr. 
14922 if test "X$netdb_net_type" = X ; then
14923         case "$d_getnbyaddr" in
14924         $define)
14925                 $cat <<EOM
14926
14927 Checking to see what type of 1st argument is accepted by getnetbyaddr().
14928 EOM
14929                 hdrs="$define sys/types.h
14930                         $d_socket sys/socket.h 
14931                         $i_niin netinet/in.h 
14932                         $i_netdb netdb.h
14933                         $i_unistd unistd.h"
14934                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
14935                         case "$netdb_net_type" in
14936                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
14937                                 if ./protochk "$try" $hdrs; then
14938                                         echo "Your system accepts $xxx."
14939                                         netdb_net_type="$xxx"
14940                                 fi
14941                                 ;;
14942                         esac
14943                 done
14944                 : In case none of those worked, prompt the user.
14945                 case "$netdb_net_type" in
14946                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
14947                         dflt='long'
14948                         . ./myread
14949                         netdb_net_type=$ans
14950                         ;;
14951                 esac
14952                 ;;
14953         *)      : no getnetbyaddr, so pick harmless default
14954                 netdb_net_type='long'
14955                 ;;
14956         esac
14957 fi
14958 : locate the preferred pager for this system
14959 case "$pager" in
14960 '')
14961         dflt=''
14962         case "$pg" in
14963         /*) dflt=$pg;;
14964         [a-zA-Z]:/*) dflt=$pg;;
14965         esac
14966         case "$more" in
14967         /*) dflt=$more;;
14968         [a-zA-Z]:/*) dflt=$more;;
14969         esac
14970         case "$less" in
14971         /*) dflt=$less;;
14972         [a-zA-Z]:/*) dflt=$less;;
14973         esac
14974         case "$dflt" in
14975         '') dflt=/usr/ucb/more;;
14976         esac
14977         ;;
14978 *) dflt="$pager";;
14979 esac
14980 echo " "
14981 fn=f/
14982 rp='What pager is used on your system?'
14983 . ./getfile
14984 pager="$ans"
14985
14986 : see what type pids are declared as in the kernel
14987 rp="What is the type of process ids on this system?"
14988 set pid_t pidtype int stdio.h sys/types.h
14989 eval $typedef_ask
14990
14991 : Find earliest binary compatible site_perl subdirectory perl can use.
14992 case "$bincompat5005" in
14993 "$define") xs_apiversion='5.005' ;;
14994 *) xs_apiversion=$version ;;   # The current site_perl version.
14995 esac
14996 : Find earliest pure perl site_perl subdirectory perl can use.
14997 : The versioned directories started at 5.005.
14998 pm_apiversion='5.005'
14999
15000 : see if ar generates random libraries by itself
15001 echo " "
15002 echo "Checking how to generate random libraries on your machine..." >&4
15003 echo 'int bar1() { return bar2(); }' > bar1.c
15004 echo 'int bar2() { return 2; }' > bar2.c
15005 $cat > foo.c <<'EOP'
15006 int main() { printf("%d\n", bar1()); exit(0); }
15007 EOP
15008 $cc $ccflags -c bar1.c >/dev/null 2>&1
15009 $cc $ccflags -c bar2.c >/dev/null 2>&1
15010 $cc $ccflags -c foo.c >/dev/null 2>&1
15011 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
15012 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
15013         $run ./foobar >/dev/null 2>&1; then
15014         echo "$ar appears to generate random libraries itself."
15015         orderlib=false
15016         ranlib=":"
15017 elif $ar ts bar$_a >/dev/null 2>&1 &&
15018         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
15019         $run ./foobar >/dev/null 2>&1; then
15020                 echo "a table of contents needs to be added with '$ar ts'."
15021                 orderlib=false
15022                 ranlib="$ar ts"
15023 else
15024         case "$ranlib" in
15025         :) ranlib='';;
15026         '')
15027                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
15028                 $test -f $ranlib || ranlib=''
15029                 ;;
15030         esac
15031         if $test -n "$ranlib"; then
15032                 echo "your system has '$ranlib'; we'll use that."
15033                 orderlib=false
15034         else
15035                 echo "your system doesn't seem to support random libraries"
15036                 echo "so we'll use lorder and tsort to order the libraries."
15037                 orderlib=true
15038                 ranlib=":"
15039         fi
15040 fi
15041 $rm -f foo* bar* 
15042
15043 : check for type of arguments to select. 
15044 case "$selecttype" in
15045 '') case "$d_select" in
15046         $define)
15047                 echo " "
15048                 $cat <<EOM
15049 Checking to see what type of arguments are accepted by select().
15050 EOM
15051                 hdrs="$define sys/types.h
15052                         $i_systime sys/time.h 
15053                         $i_sysselct sys/select.h
15054                         $d_socket sys/socket.h"
15055                 : The first arg can be int, unsigned, or size_t
15056                 : The last arg may or may not be 'const'
15057                 val=''
15058                 : void pointer has been seen but using that
15059                 : breaks the selectminbits test
15060                 for xxx in 'fd_set *' 'int *'; do
15061                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
15062                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
15063                                         case "$val" in
15064                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
15065                                                 if ./protochk "$try" $hdrs; then
15066                                                         echo "Your system accepts $xxx."
15067                                                         val="$xxx"
15068                                                 fi
15069                                                 ;;
15070                                         esac
15071                                 done
15072                         done
15073                 done
15074                 case "$val" in
15075                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
15076                         case "$d_fd_set" in
15077                                 $define) dflt="fd_set *" ;;
15078                                 *)              dflt="int *" ;;
15079                         esac
15080                         . ./myread
15081                         val=$ans
15082                         ;;
15083                 esac
15084                 selecttype="$val"
15085                 ;;
15086         *)      : no select, so pick a harmless default
15087                 selecttype='int *'
15088                 ;;
15089         esac
15090         ;;
15091 esac
15092
15093 : check for the select 'width'
15094 case "$selectminbits" in
15095 '') case "$d_select" in
15096         $define)
15097                 $cat <<EOM
15098
15099 Checking to see on how many bits at a time your select() operates...
15100 EOM
15101                 $cat >try.c <<EOCP
15102 #include <sys/types.h>
15103 #$i_time I_TIME
15104 #$i_systime I_SYS_TIME
15105 #$i_systimek I_SYS_TIME_KERNEL
15106 #ifdef I_TIME
15107 #   include <time.h>
15108 #endif
15109 #ifdef I_SYS_TIME
15110 #   ifdef I_SYS_TIME_KERNEL
15111 #       define KERNEL
15112 #   endif
15113 #   include <sys/time.h>
15114 #   ifdef I_SYS_TIME_KERNEL
15115 #       undef KERNEL
15116 #   endif
15117 #endif
15118 #$i_sysselct I_SYS_SELECT
15119 #ifdef I_SYS_SELECT
15120 #include <sys/select.h>
15121 #endif
15122 #$d_socket HAS_SOCKET
15123 #ifdef HAS_SOCKET
15124 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
15125 #endif
15126 #include <stdio.h>
15127 $selecttype b;
15128 #define S sizeof(*(b))
15129 #define MINBITS 64
15130 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
15131 #define NBITS  (NBYTES * 8)
15132 int main() {
15133     char s[NBYTES];
15134     struct timeval t;
15135     int i;
15136     FILE* fp;
15137     int fd;
15138
15139     fclose(stdin);
15140     fp = fopen("try.c", "r");
15141     if (fp == 0)
15142       exit(1);
15143     fd = fileno(fp);
15144     if (fd < 0)
15145       exit(2);
15146     b = ($selecttype)s;
15147     for (i = 0; i < NBITS; i++)
15148         FD_SET(i, b);
15149     t.tv_sec  = 0;
15150     t.tv_usec = 0;
15151     select(fd + 1, b, 0, 0, &t);
15152     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
15153     printf("%d\n", i + 1);
15154     return 0;
15155 }
15156 EOCP
15157                 set try
15158                 if eval $compile_ok; then
15159                         selectminbits=`$run ./try`
15160                         case "$selectminbits" in
15161                         '')     cat >&4 <<EOM
15162 Cannot figure out on how many bits at a time your select() operates.
15163 I'll play safe and guess it is 32 bits.
15164 EOM
15165                                 selectminbits=32
15166                                 bits="32 bits"
15167                                 ;;
15168                         1)      bits="1 bit" ;;
15169                         *)      bits="$selectminbits bits" ;;
15170                         esac
15171                         echo "Your select() operates on $bits at a time." >&4
15172                 else
15173                         rp='What is the minimum number of bits your select() operates on?'
15174                         case "$byteorder" in
15175                         1234|12345678)  dflt=32 ;;
15176                         *)              dflt=1  ;;
15177                         esac
15178                         . ./myread
15179                         val=$ans
15180                         selectminbits="$val"
15181                 fi
15182                 $rm -f try.* try
15183                 ;;
15184         *)      : no select, so pick a harmless default
15185                 selectminbits='32'
15186                 ;;
15187         esac
15188         ;;
15189 esac
15190
15191 : Trace out the files included by signal.h, then look for SIGxxx names.
15192 : Remove SIGARRAYSIZE used by HPUX.
15193 : Remove SIGSTKSIZE used by Linux.
15194 : Remove SIGSTKSZ used by Posix.
15195 : Remove SIGTYP void lines used by OS2.
15196 : Some cpps, like os390, dont give the file name anywhere
15197 if [ "X$fieldn" = X ]; then
15198         : Just make some guesses.  We check them later.
15199         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
15200 else
15201         xxx=`echo '#include <signal.h>' |
15202         $cppstdin $cppminus $cppflags 2>/dev/null |
15203         $grep '^[       ]*#.*include' | 
15204         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
15205 fi
15206 : Check this list of files to be sure we have parsed the cpp output ok.
15207 : This will also avoid potentially non-existent files, such 
15208 : as ../foo/bar.h
15209 xxxfiles=''
15210 for xx in $xxx /dev/null ; do
15211         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
15212 done
15213 : If we have found no files, at least try signal.h
15214 case "$xxxfiles" in
15215 '')     xxxfiles=`./findhdr signal.h` ;;
15216 esac
15217 xxx=`awk '
15218 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
15219         print substr($2, 4, 20)
15220 }
15221 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
15222         print substr($3, 4, 20)
15223 }' $xxxfiles`
15224 : Append some common names just in case the awk scan failed.
15225 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
15226 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
15227 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
15228 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
15229 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
15230
15231 : generate a few handy files for later
15232 $cat > signal.c <<'EOCP'
15233 #include <sys/types.h>
15234 #include <signal.h>
15235 #include <stdio.h>
15236 int main() {
15237
15238 /* Strange style to avoid deeply-nested #if/#else/#endif */
15239 #ifndef NSIG
15240 #  ifdef _NSIG
15241 #    define NSIG (_NSIG)
15242 #  endif
15243 #endif
15244
15245 #ifndef NSIG
15246 #  ifdef SIGMAX
15247 #    define NSIG (SIGMAX+1)
15248 #  endif
15249 #endif
15250
15251 #ifndef NSIG
15252 #  ifdef SIG_MAX
15253 #    define NSIG (SIG_MAX+1)
15254 #  endif
15255 #endif
15256
15257 #ifndef NSIG
15258 #  ifdef MAXSIG
15259 #    define NSIG (MAXSIG+1)
15260 #  endif
15261 #endif
15262
15263 #ifndef NSIG
15264 #  ifdef MAX_SIG
15265 #    define NSIG (MAX_SIG+1)
15266 #  endif
15267 #endif
15268
15269 #ifndef NSIG
15270 #  ifdef SIGARRAYSIZE
15271 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
15272 #  endif
15273 #endif
15274
15275 #ifndef NSIG
15276 #  ifdef _sys_nsig
15277 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
15278 #  endif
15279 #endif
15280
15281 /* Default to some arbitrary number that's big enough to get most
15282    of the common signals.
15283 */
15284 #ifndef NSIG
15285 #    define NSIG 50
15286 #endif
15287
15288 printf("NSIG %d\n", NSIG);
15289
15290 #ifndef JUST_NSIG
15291
15292 EOCP
15293
15294 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
15295 {
15296         printf "#ifdef SIG"; printf $1; printf "\n"
15297         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
15298         printf $1; printf ");\n"
15299         printf "#endif\n"
15300 }
15301 END {
15302         printf "#endif /* JUST_NSIG */\n";
15303         printf "exit(0);\n}\n";
15304 }
15305 ' >>signal.c
15306 $cat >signal.awk <<'EOP'
15307 BEGIN { ndups = 0 }
15308 $1 ~ /^NSIG$/ { nsig = $2 }
15309 ($1 !~ /^NSIG$/) && (NF == 2) {
15310     if ($2 > maxsig) { maxsig = $2 }
15311     if (sig_name[$2]) {
15312         dup_name[ndups] = $1
15313         dup_num[ndups] = $2
15314         ndups++ 
15315     }
15316     else {
15317         sig_name[$2] = $1
15318         sig_num[$2] = $2
15319     }
15320 }
15321 END { 
15322     if (nsig == 0) {
15323         nsig = maxsig + 1
15324     }
15325     printf("NSIG %d\n", nsig);
15326     for (n = 1; n < nsig; n++) {
15327         if (sig_name[n]) {
15328             printf("%s %d\n", sig_name[n], sig_num[n])
15329         }
15330         else {
15331             printf("NUM%d %d\n", n, n) 
15332         }
15333     }
15334     for (n = 0; n < ndups; n++) {
15335         printf("%s %d\n", dup_name[n], dup_num[n])
15336     }
15337 }
15338 EOP
15339 $cat >signal_cmd <<EOS
15340 $startsh
15341 if $test -s signal.lst; then
15342     echo "Using your existing signal.lst file"
15343         exit 0
15344 fi
15345 xxx="$xxx"
15346 EOS
15347 $cat >>signal_cmd <<'EOS'
15348
15349 set signal
15350 if eval $compile_ok; then
15351         $run ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
15352 else
15353         echo "(I can't seem be able to compile the whole test program)" >&4
15354         echo "(I'll try it in little pieces.)" >&4
15355         set signal -DJUST_NSIG
15356         if eval $compile_ok; then
15357                 $run ./signal$_exe > signal.nsg
15358                 $cat signal.nsg
15359         else
15360                 echo "I can't seem to figure out how many signals you have." >&4
15361                 echo "Guessing 50." >&4
15362                 echo 'NSIG 50' > signal.nsg
15363         fi
15364         : Now look at all the signal names, one at a time.
15365         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
15366                 $cat > signal.c <<EOCP
15367 #include <sys/types.h>
15368 #include <signal.h>
15369 #include <stdio.h>
15370 int main() {
15371 printf("$xx %d\n", SIG${xx});
15372 return 0;
15373 }
15374 EOCP
15375                 set signal
15376                 if eval $compile; then
15377                         echo "SIG${xx} found."
15378                         $run ./signal$_exe  >> signal.ls1
15379                 else
15380                         echo "SIG${xx} NOT found."
15381                 fi
15382         done
15383         if $test -s signal.ls1; then
15384                 $cat signal.nsg signal.ls1 |
15385                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
15386         fi
15387
15388 fi
15389 if $test -s signal.lst; then
15390         :
15391 else
15392         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
15393         echo 'kill -l' >signal
15394         set X `csh -f <signal`
15395         $rm -f signal
15396         shift
15397         case $# in
15398         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
15399         esac
15400         echo $@ | $tr ' ' $trnl | \
15401             $awk '{ printf "%s %d\n", $1, ++s; }
15402                   END { printf "NSIG %d\n", ++s }' >signal.lst
15403 fi
15404 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
15405 EOS
15406 chmod a+x signal_cmd
15407 $eunicefix signal_cmd
15408
15409 : generate list of signal names
15410 echo " "
15411 case "$sig_name_init" in
15412 '') doinit=yes ;;
15413 *)  case "$sig_num_init" in
15414     ''|*,*) doinit=yes ;;
15415     esac ;;
15416 esac
15417 case "$doinit" in
15418 yes)
15419         echo "Generating a list of signal names and numbers..." >&4
15420         . ./signal_cmd
15421         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
15422         sig_name=`$awk 'BEGIN { printf "ZERO " }
15423                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
15424         sig_num=`$awk  'BEGIN { printf "0 " }
15425                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
15426         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
15427                              !/^NSIG/   { printf "\"%s\", ", $1 }
15428                              END        { printf "0\n" }' signal.lst`
15429         sig_num_init=`$awk  'BEGIN      { printf "0, " }
15430                              !/^NSIG/   { printf "%d, ", $2}
15431                              END        { printf "0\n"}' signal.lst`
15432         ;;
15433 esac
15434 echo "The following $sig_count signals are available:"
15435 echo " "
15436 echo $sig_name | $awk \
15437 'BEGIN { linelen = 0 }
15438 {
15439         for (i = 1; i <= NF; i++) {
15440                 name = "SIG" $i " "
15441                 linelen = linelen + length(name)
15442                 if (linelen > 70) {
15443                         printf "\n"
15444                         linelen = length(name)
15445                 }
15446                 printf "%s", name
15447         }
15448         printf "\n"
15449 }'
15450 sig_size=`echo $sig_name | awk '{print NF}'`
15451 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
15452
15453 echo " "
15454 case "$sizetype" in
15455 *_t) zzz="$sizetype"    ;;
15456 *)   zzz="filesize"     ;;
15457 esac
15458 echo "Checking the size of $zzz..." >&4 
15459 cat > try.c <<EOCP
15460 #include <sys/types.h>
15461 #include <stdio.h>
15462 int main() {
15463     printf("%d\n", (int)sizeof($sizetype));
15464     exit(0);
15465 }
15466 EOCP
15467 set try
15468 if eval $compile_ok; then
15469         yyy=`$run ./try`
15470         case "$yyy" in
15471         '')     sizesize=4
15472                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
15473                 ;;
15474         *)      sizesize=$yyy
15475                 echo "Your $zzz size is $sizesize bytes."
15476                 ;;
15477         esac
15478 else
15479         sizesize=4
15480         echo "(I can't compile the test program--guessing $sizesize.)" >&4
15481 fi
15482
15483
15484 : check for socklen_t
15485 echo " "
15486 echo "Checking to see if you have socklen_t..." >&4
15487 $cat >try.c <<EOCP
15488 #include <sys/types.h>
15489 #$d_socket HAS_SOCKET
15490 #ifdef HAS_SOCKET
15491 #include <sys/socket.h>
15492 #endif
15493 int main() { socklen_t x = 16; }
15494 EOCP
15495 set try
15496 if eval $compile; then
15497         val="$define"
15498         echo "You have socklen_t."
15499 else
15500         val="$undef"
15501         echo "You do not have socklen_t."
15502         case "$sizetype" in
15503         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
15504         esac
15505 fi
15506 $rm -f try try.*
15507 set d_socklen_t
15508 eval $setvar
15509
15510 : see if this is a socks.h system
15511 set socks.h i_socks
15512 eval $inhdr
15513
15514 : check for type of the size argument to socket calls
15515 case "$d_socket" in
15516 "$define")
15517         $cat <<EOM
15518
15519 Checking to see what type is the last argument of accept().
15520 EOM
15521         yyy=''
15522         case "$d_socklen_t" in
15523         "$define") yyy="$yyy socklen_t"
15524         esac
15525         yyy="$yyy $sizetype int long unsigned"
15526         for xxx in $yyy; do
15527                 case "$socksizetype" in
15528                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
15529                         case "$usesocks" in
15530                         "$define")
15531                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
15532                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
15533                                         socksizetype="$xxx"
15534                                 fi
15535                                 ;;
15536                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
15537                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
15538                                         socksizetype="$xxx"
15539                                 fi
15540                                 ;;
15541                         esac
15542                         ;;
15543                 esac
15544         done
15545 : In case none of those worked, prompt the user.
15546         case "$socksizetype" in
15547         '')     rp='What is the type for socket address structure sizes?'
15548                 dflt='int'
15549                 . ./myread
15550                 socksizetype=$ans
15551                 ;;
15552         esac
15553         ;;
15554 *)      : no sockets, so pick relatively harmless default
15555         socksizetype='int'
15556         ;;
15557 esac
15558
15559 : see what type is used for signed size_t
15560 set ssize_t ssizetype int stdio.h sys/types.h
15561 eval $typedef
15562 dflt="$ssizetype"
15563 $cat > try.c <<EOM
15564 #include <stdio.h>
15565 #include <sys/types.h>
15566 #define Size_t $sizetype
15567 #define SSize_t $dflt
15568 int main()
15569 {
15570         if (sizeof(Size_t) == sizeof(SSize_t))
15571                 printf("$dflt\n");
15572         else if (sizeof(Size_t) == sizeof(int))
15573                 printf("int\n");
15574         else 
15575                 printf("long\n");
15576         exit(0);
15577 }
15578 EOM
15579 echo " "
15580 set try
15581 if eval $compile_ok && $run ./try > /dev/null; then
15582         ssizetype=`$run ./try`
15583         echo "I'll be using $ssizetype for functions returning a byte count." >&4
15584 else
15585         $cat >&4 <<EOM
15586 Help! I can't compile and run the ssize_t test program: please enlighten me!
15587 (This is probably a misconfiguration in your system or libraries, and
15588 you really ought to fix it.  Still, I'll try anyway.)
15589
15590 I need a type that is the same size as $sizetype, but is guaranteed to
15591 be signed.  Common values are ssize_t, int and long.
15592
15593 EOM
15594         rp="What signed type is the same size as $sizetype?"
15595         . ./myread
15596         ssizetype="$ans"
15597 fi
15598 $rm -f try try.*
15599
15600 : see what type of char stdio uses.
15601 echo " "
15602 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
15603 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
15604         echo "Your stdio uses unsigned chars." >&4
15605         stdchar="unsigned char"
15606 else
15607         echo "Your stdio uses signed chars." >&4
15608         stdchar="char"
15609 fi
15610 $rm -f stdioh
15611
15612
15613
15614 : see if time exists
15615 echo " "
15616 if test "X$d_time" = X -o X"$timetype" = X; then
15617     if set time val -f d_time; eval $csym; $val; then
15618                 echo 'time() found.' >&4
15619                 val="$define"
15620                 rp="What is the type returned by time() on this system?"
15621                 set time_t timetype long stdio.h sys/types.h
15622                 eval $typedef_ask
15623     else
15624                 echo 'time() not found, hope that will do.' >&4
15625                 val="$undef"
15626                 timetype='int';
15627     fi
15628     set d_time
15629     eval $setvar
15630 fi
15631
15632 : see what type uids are declared as in the kernel
15633 echo " "
15634 echo "Looking for the type for user ids returned by getuid()."
15635 set uid_t uidtype xxx stdio.h sys/types.h
15636 eval $typedef
15637 case "$uidtype" in
15638 xxx)
15639         xxx=`./findhdr sys/user.h`
15640         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
15641         case $1 in
15642         unsigned) dflt="$1 $2" ;;
15643         *) dflt="$1" ;;
15644         esac
15645         ;;
15646 *) dflt="$uidtype";;
15647 esac
15648 case "$uidtype" in
15649 uid_t)  echo "uid_t found." ;;
15650 *)      rp="What is the type for user ids returned by getuid()?"
15651         . ./myread
15652         uidtype="$ans"
15653         ;;
15654 esac
15655
15656 echo " "
15657 case "$uidtype" in
15658 *_t) zzz="$uidtype"     ;;
15659 *)   zzz="uid"          ;;
15660 esac
15661 echo "Checking the size of $zzz..." >&4 
15662 cat > try.c <<EOCP
15663 #include <sys/types.h>
15664 #include <stdio.h>
15665 int main() {
15666     printf("%d\n", (int)sizeof($uidtype));
15667     exit(0);
15668 }
15669 EOCP
15670 set try
15671 if eval $compile_ok; then
15672         yyy=`$run ./try`
15673         case "$yyy" in
15674         '')     uidsize=4
15675                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
15676                 ;;
15677         *)      uidsize=$yyy
15678                 echo "Your $zzz is $uidsize bytes long."
15679                 ;;
15680         esac
15681 else
15682         uidsize=4
15683         echo "(I can't compile the test program--guessing $uidsize.)" >&4
15684 fi
15685
15686 echo " "
15687 case "$uidtype" in
15688 *_t) zzz="$uidtype"     ;;
15689 *)   zzz="uid"          ;;
15690 esac
15691 echo "Checking the sign of $zzz..." >&4
15692 cat > try.c <<EOCP
15693 #include <sys/types.h>
15694 #include <stdio.h>
15695 int main() {
15696         $uidtype foo = -1;
15697         if (foo < 0)
15698                 printf("-1\n");
15699         else
15700                 printf("1\n");
15701 }
15702 EOCP
15703 set try
15704 if eval $compile; then
15705         yyy=`$run ./try`
15706         case "$yyy" in
15707         '')     uidsign=1
15708                 echo "(I can't execute the test program--guessing unsigned.)" >&4
15709                 ;;
15710         *)      uidsign=$yyy
15711                 case "$uidsign" in
15712                  1) echo "Your $zzz is unsigned." ;;
15713                 -1) echo "Your $zzz is signed."   ;;
15714                 esac
15715                 ;;
15716         esac
15717 else
15718         uidsign=1
15719         echo "(I can't compile the test program--guessing unsigned.)" >&4
15720 fi
15721
15722
15723
15724 echo " "
15725 $echo "Checking the format string to be used for uids..." >&4
15726
15727 case "$uidsign" in
15728 -1)     if $test X"$uidsize" = X"$ivsize"; then
15729                 uidformat="$ivdformat"
15730         else
15731                 if $test X"$uidsize" = X"$longsize"; then
15732                         uidformat='"ld"'
15733                 else
15734                         if $test X"$uidsize" = X"$intsize"; then
15735                                 uidformat='"d"'
15736                         else
15737                                 if $test X"$uidsize" = X"$shortsize"; then
15738                                         uidformat='"hd"'
15739                                 fi
15740                         fi
15741                 fi
15742         fi
15743         ;;
15744 *)      if $test X"$uidsize" = X"$uvsize"; then
15745                 uidformat="$uvuformat"
15746         else
15747                 if $test X"$uidsize" = X"$longsize"; then
15748                         uidformat='"lu"'
15749                 else
15750                         if $test X"$uidsize" = X"$intsize"; then
15751                                 uidformat='"u"'
15752                         else
15753                                 if $test X"$uidsize" = X"$shortsize"; then
15754                                         uidformat='"hu"'
15755                                 fi
15756                         fi
15757                 fi
15758         fi
15759         ;;
15760 esac
15761
15762 : determine compiler compiler
15763 case "$yacc" in
15764 '')
15765         dflt=yacc;;
15766 *)
15767         dflt="$yacc";;
15768 esac
15769 echo " "
15770 comp='yacc'
15771 if $test -f "$byacc"; then
15772         dflt="$byacc"
15773         comp="byacc or $comp"
15774 fi
15775 if $test -f "$bison"; then
15776         comp="$comp or bison -y"
15777 fi
15778 rp="Which compiler compiler ($comp) shall I use?"
15779 . ./myread
15780 yacc="$ans"
15781 case "$yacc" in
15782 *bis*)
15783         case "$yacc" in
15784         *-y*) ;;
15785         *)
15786                 yacc="$yacc -y"
15787                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
15788                 ;;
15789         esac
15790         ;;
15791 esac
15792
15793 : see if fcntl.h is there
15794 val=''
15795 set fcntl.h val
15796 eval $inhdr
15797
15798 : see if we can include fcntl.h
15799 case "$val" in
15800 "$define")
15801         echo " "
15802         if $h_fcntl; then
15803                 val="$define"
15804                 echo "We'll be including <fcntl.h>." >&4
15805         else
15806                 val="$undef"
15807                 if $h_sysfile; then
15808         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
15809                 else
15810                         echo "We won't be including <fcntl.h>." >&4
15811                 fi
15812         fi
15813         ;;
15814 *)
15815         h_fcntl=false
15816         val="$undef"
15817         ;;
15818 esac
15819 set i_fcntl
15820 eval $setvar
15821
15822 : see if this is a fp.h system
15823 set fp.h i_fp
15824 eval $inhdr
15825
15826 : see if this is a fp_class.h system
15827 set fp_class.h i_fp_class
15828 eval $inhdr
15829
15830 : see if this is a iconv.h system
15831 set iconv.h i_iconv
15832 eval $inhdr
15833
15834 : see if this is a ieeefp.h system
15835 set ieeefp.h i_ieeefp
15836 eval $inhdr
15837
15838 : see if this is a libutil.h system
15839 set libutil.h i_libutil
15840 eval $inhdr
15841
15842 : see if locale.h is available
15843 set locale.h i_locale
15844 eval $inhdr
15845
15846 : see if mach cthreads are available
15847 if test "X$usethreads" = "X$define"; then
15848         set mach/cthreads.h i_machcthr
15849         eval $inhdr
15850 else
15851         i_machcthr="$undef"
15852 fi
15853
15854
15855
15856 : see if this is a math.h system
15857 set math.h i_math
15858 eval $inhdr
15859
15860 : see if this is a mntent.h system
15861 set mntent.h i_mntent
15862 eval $inhdr
15863
15864 : see if ndbm.h is available
15865 set ndbm.h t_ndbm
15866 eval $inhdr
15867 case "$t_ndbm" in
15868 $define)
15869         : see if dbm_open exists
15870         set dbm_open d_dbm_open
15871         eval $inlibc
15872         case "$d_dbm_open" in
15873         $undef)
15874                 t_ndbm="$undef"
15875                 echo "We won't be including <ndbm.h>"
15876                 ;;
15877         esac
15878         ;;
15879 esac
15880 val="$t_ndbm"
15881 set i_ndbm
15882 eval $setvar
15883
15884 : see if net/errno.h is available
15885 val=''
15886 set net/errno.h val
15887 eval $inhdr
15888
15889 : Unfortunately, it causes problems on some systems.  Arrgh.
15890 case "$val" in
15891 $define)
15892         cat > try.c <<'EOM'
15893 #include <stdio.h>
15894 #include <errno.h>
15895 #include <net/errno.h>
15896 int func()
15897 {
15898         return ENOTSOCK;
15899 }
15900 EOM
15901         if $cc $ccflags -c try.c >/dev/null 2>&1; then
15902                 echo "We'll be including <net/errno.h>." >&4
15903         else
15904                 echo "We won't be including <net/errno.h>." >&4
15905                 val="$undef"
15906         fi
15907         $rm -f try.* try
15908         ;;
15909 esac
15910 set i_neterrno
15911 eval $setvar
15912
15913 : see if netinet/tcp.h is available
15914 set netinet/tcp.h i_netinettcp
15915 eval $inhdr
15916
15917 : see if this is a poll.h system
15918 set poll.h i_poll
15919 eval $inhdr
15920
15921 : see if this is a prot.h system
15922 set prot.h i_prot
15923 eval $inhdr
15924
15925 echo " "
15926 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
15927 $cat <<'EOSH' > Cppsym.know
15928 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
15929 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
15930 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
15931 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
15932 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
15933 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
15934 bull c cadmus clipper CMU COFF COMPILER_VERSION
15935 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
15936 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
15937 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
15938 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
15939 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
15940 H3050R H3050RX hbullx20 hcx host_mips
15941 hp200 hp300 hp700 HP700 hp800 hp9000
15942 hp9000s200 hp9000s300 hp9000s400 hp9000s500
15943 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
15944 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
15945 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
15946 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
15947 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
15948 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
15949 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
15950 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
15951 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
15952 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
15953 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
15954 MATH_HAS_NO_SIDE_EFFECTS
15955 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
15956 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
15957 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
15958 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
15959 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
15960 NetBSD news1500 news1700 news1800 news1900 news3700
15961 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
15962 ns32016 ns32332 ns32k nsc32000
15963 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
15964 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
15965 pc532 pdp11 PGC PIC plexus PORTAR posix
15966 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
15967 POSIX_C_SOURCE POSIX_SOURCE POWER
15968 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
15969 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
15970 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
15971 sony sony_news sonyrisc sparc sparclite spectrum
15972 stardent stdc STDC_EXT stratos sun sun3 sun386
15973 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
15974 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
15975 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
15976 sysV68 sysV88 Tek4132 Tek4300 titan
15977 TM3200 TM5400 TM5600
15978 tower tower32 tower32_200 tower32_600 tower32_700
15979 tower32_800 tower32_850 tss
15980 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
15981 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
15982 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
15983 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
15984 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
15985 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
15986 z8000
15987 EOSH
15988 # Maybe put other stuff here too.
15989 cat <<EOSH >>Cppsym.know
15990 $osname
15991 EOSH
15992 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
15993 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
15994 $cat Cppsym.know > Cppsym.c
15995 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
15996 $rm -f Cppsym.a Cppsym.b Cppsym.c
15997 cat <<EOSH > Cppsym
15998 $startsh
15999 if $test \$# -gt 0; then
16000     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
16001     if $test -s Cppsym.got; then
16002         $rm -f Cppsym.got
16003         exit 0
16004     fi
16005     $rm -f Cppsym.got
16006     exit 1
16007 else
16008     $tr " " "$trnl" | ./Cppsym.try
16009     exit 0
16010 fi
16011 EOSH
16012 chmod +x Cppsym
16013 $eunicefix Cppsym
16014 cat <<EOSH > Cppsym.try
16015 $startsh
16016 cat <<'EOCP' > try.c
16017 #include <stdio.h>
16018 int main() {
16019 EOCP
16020 $awk \\
16021 EOSH
16022 cat <<'EOSH' >> Cppsym.try
16023 'length($1) > 0 {
16024     printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", (long)%s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
16025     printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", (long)_%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
16026     printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", (long)__%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
16027     printf "#ifdef __%s__\n#if __%s__+0\nprintf(\"__%s__=%%ld\\n\", (long)__%s__);\n#else\nprintf(\"__%s__\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
16028 }'       >> try.c
16029 echo 'return 0;}' >> try.c
16030 EOSH
16031 cat <<EOSH >> Cppsym.try
16032 ccflags="$ccflags"
16033 case "$osname-$gccversion" in
16034 irix-) ccflags="\$ccflags -woff 1178" ;;
16035 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
16036 esac
16037 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
16038 EOSH
16039 chmod +x Cppsym.try
16040 $eunicefix Cppsym.try
16041 ./Cppsym < Cppsym.know > Cppsym.true
16042 : now check the C compiler for additional symbols
16043 postprocess_cc_v=''
16044 case "$osname" in
16045 aix) postprocess_cc_v="|$tr , ' '" ;;
16046 esac
16047 $cat >ccsym <<EOS
16048 $startsh
16049 $cat >tmp.c <<EOF
16050 extern int foo;
16051 EOF
16052 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
16053 do
16054         case "\$i" in
16055         -D*) echo "\$i" | $sed 's/^-D//';;
16056         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
16057         esac
16058 done
16059 $rm -f try.c
16060 EOS
16061 postprocess_cc_v=''
16062 chmod +x ccsym
16063 $eunicefix ccsym
16064 ./ccsym > ccsym1.raw
16065 if $test -s ccsym1.raw; then
16066        $sort ccsym1.raw | $uniq >ccsym.raw
16067 else
16068        mv ccsym1.raw ccsym.raw
16069 fi
16070
16071 $awk '/\=/ { print $0; next }
16072         { print $0"=1" }' ccsym.raw >ccsym.list
16073 $awk '/\=/ { print $0; next }
16074         { print $0"=1" }' Cppsym.true >ccsym.true
16075 $comm -13 ccsym.true ccsym.list >ccsym.own
16076 $comm -12 ccsym.true ccsym.list >ccsym.com
16077 $comm -23 ccsym.true ccsym.list >ccsym.cpp
16078 also=''
16079 if $test -z ccsym.raw; then
16080         echo "Your C compiler doesn't seem to define any symbols!" >&4
16081         echo " "
16082         echo "However, your C preprocessor defines the following symbols:"
16083         $cat Cppsym.true
16084         ccsymbols=''
16085         cppsymbols=`$cat Cppsym.true`
16086         cppsymbols=`echo $cppsymbols`
16087         cppccsymbols="$cppsymbols"
16088 else
16089         if $test -s ccsym.com; then
16090                 echo "Your C compiler and pre-processor define these symbols:"
16091                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
16092                 also='also '
16093                 symbols='ones'
16094                 cppccsymbols=`$cat ccsym.com`
16095                 cppccsymbols=`echo $cppccsymbols`
16096                 $test "$silent" || sleep 1
16097         fi
16098         if $test -s ccsym.cpp; then
16099                 $test "$also" && echo " "
16100                 echo "Your C pre-processor ${also}defines the following symbols:"
16101                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
16102                 also='further '
16103                 cppsymbols=`$cat ccsym.cpp`
16104                 cppsymbols=`echo $cppsymbols`
16105                 $test "$silent" || sleep 1
16106         fi
16107         if $test -s ccsym.own; then
16108                 $test "$also" && echo " "
16109                 echo "Your C compiler ${also}defines the following cpp symbols:"
16110                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
16111                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
16112                 ccsymbols=`$cat ccsym.own`
16113                 ccsymbols=`echo $ccsymbols`
16114                 $test "$silent" || sleep 1
16115         fi
16116 fi
16117
16118 : see if this is a termio system
16119 val="$undef"
16120 val2="$undef"
16121 val3="$undef"
16122 if $test `./findhdr termios.h`; then
16123         set tcsetattr i_termios
16124         eval $inlibc
16125         val3="$i_termios"
16126 fi
16127 echo " "
16128 case "$val3" in
16129 "$define") echo "You have POSIX termios.h... good!" >&4;;
16130 *) if ./Cppsym pyr; then
16131                 case "`/bin/universe`" in
16132                 ucb) if $test `./findhdr sgtty.h`; then
16133                                 val2="$define"
16134                                 echo "<sgtty.h> found." >&4
16135                         else
16136                                 echo "System is pyramid with BSD universe."
16137                                 echo "<sgtty.h> not found--you could have problems." >&4
16138                         fi;;
16139                 *) if $test `./findhdr termio.h`; then
16140                                 val="$define"
16141                                 echo "<termio.h> found." >&4
16142                         else
16143                                 echo "System is pyramid with USG universe."
16144                                 echo "<termio.h> not found--you could have problems." >&4
16145                         fi;;
16146                 esac
16147         elif ./usg; then
16148                 if $test `./findhdr termio.h`; then
16149                         echo "<termio.h> found." >&4
16150                         val="$define"
16151                 elif $test `./findhdr sgtty.h`; then
16152                         echo "<sgtty.h> found." >&4
16153                         val2="$define"
16154                 else
16155 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
16156                 fi
16157         else
16158                 if $test `./findhdr sgtty.h`; then
16159                         echo "<sgtty.h> found." >&4
16160                         val2="$define"
16161                 elif $test `./findhdr termio.h`; then
16162                         echo "<termio.h> found." >&4
16163                         val="$define"
16164                 else
16165 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
16166                 fi
16167         fi;;
16168 esac
16169 set i_termio; eval $setvar
16170 val=$val2; set i_sgtty; eval $setvar
16171 val=$val3; set i_termios; eval $setvar
16172
16173 : see if this is a shadow.h system
16174 set shadow.h i_shadow
16175 eval $inhdr
16176
16177 : see if stddef is available
16178 set stddef.h i_stddef
16179 eval $inhdr
16180
16181 : see if this is a sunmath.h system
16182 set sunmath.h i_sunmath
16183 eval $inhdr
16184
16185 : see if sys/access.h is available
16186 set sys/access.h i_sysaccess
16187 eval $inhdr
16188
16189 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
16190 set sys/filio.h i_sysfilio
16191 eval $inhdr
16192 echo " "
16193 if $test `./findhdr sys/ioctl.h`; then
16194         val="$define"
16195         echo '<sys/ioctl.h> found.' >&4
16196 else
16197         val="$undef"
16198         if $test $i_sysfilio = "$define"; then
16199             echo '<sys/ioctl.h> NOT found.' >&4
16200         else
16201                 $test $i_sgtty = "$define" && xxx="sgtty.h"
16202                 $test $i_termio = "$define" && xxx="termio.h"
16203                 $test $i_termios = "$define" && xxx="termios.h"
16204 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
16205         fi
16206 fi
16207 set i_sysioctl
16208 eval $setvar
16209
16210 : see if socket ioctl defs are in sys/sockio.h
16211 echo " "
16212 xxx=`./findhdr sys/sockio.h`
16213 if $test "$xxx"; then
16214         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
16215                 val="$define"
16216                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
16217         else
16218                 val="$undef"
16219                 echo "No socket ioctls found in <sys/sockio.h>." >&4
16220         fi
16221 else
16222         val="$undef"
16223         $cat <<EOM
16224 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
16225 EOM
16226 fi
16227 set i_syssockio
16228 eval $setvar
16229
16230
16231 : see if this is a syslog.h system
16232 set syslog.h i_syslog
16233 eval $inhdr
16234
16235
16236 : see if this is a sys/mode.h system
16237 set sys/mode.h i_sysmode
16238 eval $inhdr
16239
16240 : see if sys/resource.h has to be included
16241 set sys/resource.h i_sysresrc
16242 eval $inhdr
16243
16244 : see if sys/security.h is available
16245 set sys/security.h i_syssecrt
16246 eval $inhdr
16247
16248 : see if this is a sys/statvfs.h system
16249 set sys/statvfs.h i_sysstatvfs
16250 eval $inhdr
16251
16252 : see if this is a sys/un.h system
16253 set sys/un.h i_sysun
16254 eval $inhdr
16255
16256
16257 : see if this is a sys/utsname.h system
16258 set sys/utsname.h i_sysutsname
16259 eval $inhdr
16260
16261 : see if this is a syswait system
16262 set sys/wait.h i_syswait
16263 eval $inhdr
16264
16265 : see if this is a ustat.h system
16266 set ustat.h i_ustat
16267 eval $inhdr
16268
16269 : see if this is an utime system
16270 set utime.h i_utime
16271 eval $inhdr
16272
16273 : see if this is a values.h system
16274 set values.h i_values
16275 eval $inhdr
16276
16277 : see if this is a vfork system
16278 case "$d_vfork" in
16279 "$define")
16280         set vfork.h i_vfork
16281         eval $inhdr
16282         ;;
16283 *)
16284         i_vfork="$undef"
16285         ;;
16286 esac
16287
16288 : see if gdbm.h is available
16289 set gdbm.h t_gdbm
16290 eval $inhdr
16291 case "$t_gdbm" in
16292 $define)
16293         : see if gdbm_open exists
16294         set gdbm_open d_gdbm_open
16295         eval $inlibc
16296         case "$d_gdbm_open" in
16297         $undef)
16298                 t_gdbm="$undef"
16299                 echo "We won't be including <gdbm.h>"
16300                 ;;
16301         esac
16302         ;;
16303 esac
16304 val="$t_gdbm"
16305 set i_gdbm
16306 eval $setvar
16307
16308 echo " "
16309 echo "Looking for extensions..." >&4
16310 : If we are using the old config.sh, known_extensions may contain
16311 : old or inaccurate or duplicate values.
16312 known_extensions=''
16313 nonxs_extensions=''
16314 : We do not use find because it might not be available.
16315 : We do not just use MANIFEST because the user may have dropped
16316 : some additional extensions into the source tree and expect them
16317 : to be built.
16318
16319 : Function to recursively find available extensions, ignoring DynaLoader
16320 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
16321 find_extensions='
16322     for xxx in *; do
16323        case "$xxx" in
16324            DynaLoader|dynaload) ;;
16325            *)
16326            if $test -f $xxx/$xxx.xs; then
16327                known_extensions="$known_extensions $1$xxx";
16328            elif $test -f $xxx/Makefile.PL; then
16329                nonxs_extensions="$nonxs_extensions $1$xxx";
16330            else
16331                if $test -d $xxx -a $# -lt 10; then
16332                    set $1$xxx/ $*;
16333                    cd $xxx;
16334                    eval $find_extensions;
16335                    cd ..;
16336                    shift;
16337                fi;
16338            fi
16339            ;;
16340        esac;
16341     done'
16342 tdir=`pwd`
16343 cd $rsrc/ext
16344 set X
16345 shift
16346 eval $find_extensions
16347 set X $nonxs_extensions
16348 shift
16349 nonxs_extensions="$*"
16350 set X $known_extensions
16351 shift
16352 known_extensions="$*"
16353 cd $tdir
16354
16355 : Now see which are supported on this system.
16356 avail_ext=''
16357 for xxx in $known_extensions ; do
16358         case "$xxx" in
16359         DB_File|db_file)
16360                 case "$i_db" in
16361                 $define) avail_ext="$avail_ext $xxx" ;;
16362                 esac
16363                 ;;
16364         GDBM_File|gdbm_fil)
16365                 case "$i_gdbm" in 
16366                 $define) avail_ext="$avail_ext $xxx" ;;
16367                 esac
16368                 ;;
16369         I18N/Langinfo|i18n_lan)
16370                 case "$i_langinfo$d_nl_langinfo" in 
16371                 $define$define) avail_ext="$avail_ext $xxx" ;;
16372                 esac
16373                 ;;
16374         NDBM_File|ndbm_fil)
16375                 case "$i_ndbm" in
16376                 $define)
16377                     case "$osname-$use64bitint" in
16378                     cygwin-*|hpux-define)
16379                         case "$libs" in
16380                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
16381                         esac
16382                         ;;
16383                     *) avail_ext="$avail_ext $xxx" ;;
16384                     esac
16385                     ;;
16386                 esac
16387                 ;;
16388         ODBM_File|odbm_fil) 
16389                 case "${i_dbm}${i_rpcsvcdbm}" in
16390                 *"${define}"*)
16391                     case "$osname-$use64bitint" in
16392                     cygwin-*|hpux-define)
16393                         case "$libs" in
16394                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
16395                         esac
16396                         ;;
16397                     *) avail_ext="$avail_ext $xxx" ;;
16398                     esac
16399                     ;;
16400                 esac
16401                 ;;
16402         POSIX|posix)
16403                 case "$useposix" in
16404                 true|define|y) avail_ext="$avail_ext $xxx" ;;
16405                 esac
16406                 ;;
16407         Opcode|opcode)
16408                 case "$useopcode" in
16409                 true|define|y) avail_ext="$avail_ext $xxx" ;;
16410                 esac
16411                 ;;
16412         Socket|socket)
16413                 case "$d_socket" in 
16414                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
16415                 esac
16416                 ;;
16417         Sys/Syslog|sys/syslog)
16418                 : XXX syslog requires socket
16419                 case "$d_socket" in 
16420                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
16421                 esac
16422                 ;;
16423         Thread|thread)
16424                 case "$usethreads" in
16425                 true|$define|y)
16426                         case "$useithreads" in
16427                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
16428                         esac
16429                 esac
16430                 ;;
16431         threads)
16432                 case "$usethreads" in
16433                 true|$define|y)
16434                         case "$useithreads" in
16435                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
16436                         esac
16437                 esac
16438                 ;;
16439         IPC/SysV|ipc/sysv)
16440                 : XXX Do we need a useipcsysv variable here
16441                 case "${d_msg}${d_sem}${d_shm}" in 
16442                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
16443                 esac
16444                 ;;
16445         *)      avail_ext="$avail_ext $xxx"
16446                 ;;
16447         esac
16448 done
16449
16450 set X $avail_ext
16451 shift
16452 avail_ext="$*"
16453
16454 : Now see which nonxs extensions are supported on this system.
16455 : For now assume all are.
16456 nonxs_ext=''
16457 for xxx in $nonxs_extensions ; do
16458         case "$xxx" in
16459         *)      nonxs_ext="$nonxs_ext $xxx"
16460                 ;;
16461         esac
16462 done
16463
16464 set X $nonxs_ext
16465 shift
16466 nonxs_ext="$*"
16467
16468 case $usedl in
16469 $define)
16470         $cat <<EOM
16471 A number of extensions are supplied with $package.  You may choose to
16472 compile these extensions for dynamic loading (the default), compile
16473 them into the $package executable (static loading), or not include
16474 them at all.  Answer "none" to include no extensions.
16475 Note that DynaLoader is always built and need not be mentioned here.
16476
16477 EOM
16478         case "$dynamic_ext" in
16479         '') dflt="$avail_ext" ;;
16480         *)      dflt="$dynamic_ext"
16481                 # Perhaps we are reusing an old out-of-date config.sh.
16482                 case "$hint" in
16483                 previous)
16484                         if test X"$dynamic_ext" != X"$avail_ext"; then
16485                                 $cat <<EOM
16486 NOTICE:  Your previous config.sh list may be incorrect. 
16487 The extensions now available to you are 
16488         ${avail_ext}
16489 but the default list from your previous config.sh is
16490         ${dynamic_ext} 
16491
16492 EOM
16493                         fi
16494                         ;;
16495                 esac
16496                 ;;
16497         esac
16498         case "$dflt" in
16499         '')     dflt=none;;
16500         esac
16501         rp="What extensions do you wish to load dynamically?"
16502         . ./myread
16503         case "$ans" in
16504         none) dynamic_ext=' ' ;;
16505         *) dynamic_ext="$ans" ;;
16506         esac
16507
16508         case "$static_ext" in
16509         '')
16510                 : Exclude those already listed in dynamic linking
16511                 dflt=''
16512                 for xxx in $avail_ext; do
16513                         case " $dynamic_ext " in
16514                         *" $xxx "*) ;;
16515                         *) dflt="$dflt $xxx" ;;
16516                         esac
16517                 done
16518                 set X $dflt
16519                 shift
16520                 dflt="$*"
16521                 ;;
16522         *)  dflt="$static_ext" 
16523                 ;;
16524         esac
16525
16526         case "$dflt" in
16527         '')     dflt=none;;
16528         esac
16529         rp="What extensions do you wish to load statically?"
16530         . ./myread
16531         case "$ans" in
16532         none) static_ext=' ' ;;
16533         *) static_ext="$ans" ;;
16534         esac
16535         ;;
16536 *)
16537         $cat <<EOM
16538 A number of extensions are supplied with $package.  Answer "none" 
16539 to include no extensions. 
16540 Note that DynaLoader is always built and need not be mentioned here.
16541
16542 EOM
16543         case "$static_ext" in
16544         '') dflt="$avail_ext" ;;
16545         *)      dflt="$static_ext"
16546                 # Perhaps we are reusing an old out-of-date config.sh.
16547                 case "$hint" in
16548                 previous)
16549                         if test X"$static_ext" != X"$avail_ext"; then
16550                                 $cat <<EOM
16551 NOTICE:  Your previous config.sh list may be incorrect. 
16552 The extensions now available to you are 
16553         ${avail_ext}
16554 but the default list from your previous config.sh is
16555         ${static_ext} 
16556
16557 EOM
16558                         fi
16559                         ;;
16560                 esac
16561                 ;;
16562         esac
16563         : Exclude those that are not xs extensions
16564         case "$dflt" in
16565         '')     dflt=none;;
16566         esac
16567         rp="What extensions do you wish to include?"
16568         . ./myread
16569         case "$ans" in
16570         none) static_ext=' ' ;;
16571         *) static_ext="$ans" ;;
16572         esac
16573         ;;
16574 esac
16575
16576 set X $dynamic_ext $static_ext $nonxs_ext
16577 shift
16578 extensions="$*"
16579
16580 : Remove libraries needed only for extensions
16581 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
16582 : The exception is SunOS 4.x, which needs them.
16583 case "${osname}X${osvers}" in
16584 sunos*X4*)
16585     perllibs="$libs"
16586     ;;
16587 *) case "$usedl" in
16588     $define|true|[yY]*)
16589             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
16590             shift
16591             perllibs="$*"
16592             ;;
16593     *)  perllibs="$libs"
16594             ;;
16595     esac
16596     ;;
16597 esac
16598
16599 : Remove build directory name from cppstdin so it can be used from
16600 : either the present location or the final installed location.
16601 echo " "
16602 : Get out of the UU directory to get correct path name.
16603 cd ..
16604 case "$cppstdin" in
16605 `pwd`/cppstdin)
16606         echo "Stripping down cppstdin path name"
16607         cppstdin=cppstdin
16608         ;;
16609 esac
16610 cd UU
16611
16612 : end of configuration questions
16613 echo " "
16614 echo "End of configuration questions."
16615 echo " "
16616
16617 : back to where it started
16618 if test -d ../UU; then
16619         cd ..
16620 fi
16621
16622 : configuration may be patched via a 'config.over' file
16623 if $test -f config.over; then
16624         echo " "
16625         dflt=y
16626         rp='I see a config.over file.  Do you wish to load it?'
16627         . UU/myread
16628         case "$ans" in
16629         n*) echo "OK, I'll ignore it.";;
16630         *)      . ./config.over
16631                 echo "Configuration override changes have been loaded."
16632                 ;;
16633         esac
16634 fi
16635
16636 : in case they want portability, strip down executable paths
16637 case "$d_portable" in
16638 "$define")
16639         echo " "
16640         echo "Stripping down executable paths..." >&4
16641         for file in $loclist $trylist; do
16642                 eval temp=\$$file
16643                 eval $file=`basename $temp`
16644         done
16645         ;;
16646 esac
16647
16648 : create config.sh file
16649 echo " "
16650 echo "Creating config.sh..." >&4
16651 $spitshell <<EOT >config.sh
16652 $startsh
16653 #
16654 # This file was produced by running the Configure script. It holds all the
16655 # definitions figured out by Configure. Should you modify one of these values,
16656 # do not forget to propagate your changes by running "Configure -der". You may
16657 # instead choose to run each of the .SH files by yourself, or "Configure -S".
16658 #
16659
16660 # Package name      : $package
16661 # Source directory  : $src
16662 # Configuration time: $cf_time
16663 # Configured by     : $cf_by
16664 # Target system     : $myuname
16665
16666 Author='$Author'
16667 Date='$Date'
16668 Header='$Header'
16669 Id='$Id'
16670 Locker='$Locker'
16671 Log='$Log'
16672 Mcc='$Mcc'
16673 RCSfile='$RCSfile'
16674 Revision='$Revision'
16675 Source='$Source'
16676 State='$State'
16677 _a='$_a'
16678 _exe='$_exe'
16679 _o='$_o'
16680 afs='$afs'
16681 afsroot='$afsroot'
16682 alignbytes='$alignbytes'
16683 ansi2knr='$ansi2knr'
16684 aphostname='$aphostname'
16685 api_revision='$api_revision'
16686 api_subversion='$api_subversion'
16687 api_version='$api_version'
16688 api_versionstring='$api_versionstring'
16689 ar='$ar'
16690 archlib='$archlib'
16691 archlibexp='$archlibexp'
16692 archname64='$archname64'
16693 archname='$archname'
16694 archobjs='$archobjs'
16695 awk='$awk'
16696 baserev='$baserev'
16697 bash='$bash'
16698 bin='$bin'
16699 bincompat5005='$bincompat5005'
16700 binexp='$binexp'
16701 bison='$bison'
16702 byacc='$byacc'
16703 byteorder='$byteorder'
16704 c='$c'
16705 castflags='$castflags'
16706 cat='$cat'
16707 cc='$cc'
16708 cccdlflags='$cccdlflags'
16709 ccdlflags='$ccdlflags'
16710 ccflags='$ccflags'
16711 ccflags_uselargefiles='$ccflags_uselargefiles'
16712 ccname='$ccname'
16713 ccsymbols='$ccsymbols'
16714 ccversion='$ccversion'
16715 cf_by='$cf_by'
16716 cf_email='$cf_email'
16717 cf_time='$cf_time'
16718 charsize='$charsize'
16719 chgrp='$chgrp'
16720 chmod='$chmod'
16721 chown='$chown'
16722 clocktype='$clocktype'
16723 comm='$comm'
16724 compress='$compress'
16725 contains='$contains'
16726 cp='$cp'
16727 cpio='$cpio'
16728 cpp='$cpp'
16729 cpp_stuff='$cpp_stuff'
16730 cppccsymbols='$cppccsymbols'
16731 cppflags='$cppflags'
16732 cpplast='$cpplast'
16733 cppminus='$cppminus'
16734 cpprun='$cpprun'
16735 cppstdin='$cppstdin'
16736 cppsymbols='$cppsymbols'
16737 cryptlib='$cryptlib'
16738 csh='$csh'
16739 d_Gconvert='$d_Gconvert'
16740 d_PRIEUldbl='$d_PRIEUldbl'
16741 d_PRIFUldbl='$d_PRIFUldbl'
16742 d_PRIGUldbl='$d_PRIGUldbl'
16743 d_PRIXU64='$d_PRIXU64'
16744 d_PRId64='$d_PRId64'
16745 d_PRIeldbl='$d_PRIeldbl'
16746 d_PRIfldbl='$d_PRIfldbl'
16747 d_PRIgldbl='$d_PRIgldbl'
16748 d_PRIi64='$d_PRIi64'
16749 d_PRIo64='$d_PRIo64'
16750 d_PRIu64='$d_PRIu64'
16751 d_PRIx64='$d_PRIx64'
16752 d_SCNfldbl='$d_SCNfldbl'
16753 d__fwalk='$d__fwalk'
16754 d_access='$d_access'
16755 d_accessx='$d_accessx'
16756 d_alarm='$d_alarm'
16757 d_archlib='$d_archlib'
16758 d_atolf='$d_atolf'
16759 d_atoll='$d_atoll'
16760 d_attribut='$d_attribut'
16761 d_bcmp='$d_bcmp'
16762 d_bcopy='$d_bcopy'
16763 d_bincompat5005='$d_bincompat5005'
16764 d_bsd='$d_bsd'
16765 d_bsdgetpgrp='$d_bsdgetpgrp'
16766 d_bsdsetpgrp='$d_bsdsetpgrp'
16767 d_bzero='$d_bzero'
16768 d_casti32='$d_casti32'
16769 d_castneg='$d_castneg'
16770 d_charvspr='$d_charvspr'
16771 d_chown='$d_chown'
16772 d_chroot='$d_chroot'
16773 d_chsize='$d_chsize'
16774 d_class='$d_class'
16775 d_closedir='$d_closedir'
16776 d_cmsghdr_s='$d_cmsghdr_s'
16777 d_const='$d_const'
16778 d_crypt='$d_crypt'
16779 d_csh='$d_csh'
16780 d_cuserid='$d_cuserid'
16781 d_dbl_dig='$d_dbl_dig'
16782 d_dbminitproto='$d_dbminitproto'
16783 d_difftime='$d_difftime'
16784 d_dirnamlen='$d_dirnamlen'
16785 d_dlerror='$d_dlerror'
16786 d_dlopen='$d_dlopen'
16787 d_dlsymun='$d_dlsymun'
16788 d_dosuid='$d_dosuid'
16789 d_drand48proto='$d_drand48proto'
16790 d_dup2='$d_dup2'
16791 d_eaccess='$d_eaccess'
16792 d_endgrent='$d_endgrent'
16793 d_endhent='$d_endhent'
16794 d_endnent='$d_endnent'
16795 d_endpent='$d_endpent'
16796 d_endpwent='$d_endpwent'
16797 d_endsent='$d_endsent'
16798 d_eofnblk='$d_eofnblk'
16799 d_eunice='$d_eunice'
16800 d_fchdir='$d_fchdir'
16801 d_fchmod='$d_fchmod'
16802 d_fchown='$d_fchown'
16803 d_fcntl='$d_fcntl'
16804 d_fcntl_can_lock='$d_fcntl_can_lock'
16805 d_fd_macros='$d_fd_macros'
16806 d_fd_set='$d_fd_set'
16807 d_fds_bits='$d_fds_bits'
16808 d_fgetpos='$d_fgetpos'
16809 d_finite='$d_finite'
16810 d_finitel='$d_finitel'
16811 d_flexfnam='$d_flexfnam'
16812 d_flock='$d_flock'
16813 d_flockproto='$d_flockproto'
16814 d_fork='$d_fork'
16815 d_fp_class='$d_fp_class'
16816 d_fpathconf='$d_fpathconf'
16817 d_fpclass='$d_fpclass'
16818 d_fpclassify='$d_fpclassify'
16819 d_fpclassl='$d_fpclassl'
16820 d_fpos64_t='$d_fpos64_t'
16821 d_frexpl='$d_frexpl'
16822 d_fs_data_s='$d_fs_data_s'
16823 d_fseeko='$d_fseeko'
16824 d_fsetpos='$d_fsetpos'
16825 d_fstatfs='$d_fstatfs'
16826 d_fstatvfs='$d_fstatvfs'
16827 d_fsync='$d_fsync'
16828 d_ftello='$d_ftello'
16829 d_ftime='$d_ftime'
16830 d_getcwd='$d_getcwd'
16831 d_getespwnam='$d_getespwnam'
16832 d_getfsstat='$d_getfsstat'
16833 d_getgrent='$d_getgrent'
16834 d_getgrps='$d_getgrps'
16835 d_gethbyaddr='$d_gethbyaddr'
16836 d_gethbyname='$d_gethbyname'
16837 d_gethent='$d_gethent'
16838 d_gethname='$d_gethname'
16839 d_gethostprotos='$d_gethostprotos'
16840 d_getitimer='$d_getitimer'
16841 d_getlogin='$d_getlogin'
16842 d_getmnt='$d_getmnt'
16843 d_getmntent='$d_getmntent'
16844 d_getnbyaddr='$d_getnbyaddr'
16845 d_getnbyname='$d_getnbyname'
16846 d_getnent='$d_getnent'
16847 d_getnetprotos='$d_getnetprotos'
16848 d_getpagsz='$d_getpagsz'
16849 d_getpbyname='$d_getpbyname'
16850 d_getpbynumber='$d_getpbynumber'
16851 d_getpent='$d_getpent'
16852 d_getpgid='$d_getpgid'
16853 d_getpgrp2='$d_getpgrp2'
16854 d_getpgrp='$d_getpgrp'
16855 d_getppid='$d_getppid'
16856 d_getprior='$d_getprior'
16857 d_getprotoprotos='$d_getprotoprotos'
16858 d_getprpwnam='$d_getprpwnam'
16859 d_getpwent='$d_getpwent'
16860 d_getsbyname='$d_getsbyname'
16861 d_getsbyport='$d_getsbyport'
16862 d_getsent='$d_getsent'
16863 d_getservprotos='$d_getservprotos'
16864 d_getspnam='$d_getspnam'
16865 d_gettimeod='$d_gettimeod'
16866 d_gnulibc='$d_gnulibc'
16867 d_grpasswd='$d_grpasswd'
16868 d_hasmntopt='$d_hasmntopt'
16869 d_htonl='$d_htonl'
16870 d_iconv='$d_iconv'
16871 d_index='$d_index'
16872 d_inetaton='$d_inetaton'
16873 d_int64_t='$d_int64_t'
16874 d_isascii='$d_isascii'
16875 d_isfinite='$d_isfinite'
16876 d_isinf='$d_isinf'
16877 d_isnan='$d_isnan'
16878 d_isnanl='$d_isnanl'
16879 d_killpg='$d_killpg'
16880 d_lchown='$d_lchown'
16881 d_ldbl_dig='$d_ldbl_dig'
16882 d_link='$d_link'
16883 d_locconv='$d_locconv'
16884 d_lockf='$d_lockf'
16885 d_longdbl='$d_longdbl'
16886 d_longlong='$d_longlong'
16887 d_lseekproto='$d_lseekproto'
16888 d_lstat='$d_lstat'
16889 d_madvise='$d_madvise'
16890 d_mblen='$d_mblen'
16891 d_mbstowcs='$d_mbstowcs'
16892 d_mbtowc='$d_mbtowc'
16893 d_memchr='$d_memchr'
16894 d_memcmp='$d_memcmp'
16895 d_memcpy='$d_memcpy'
16896 d_memmove='$d_memmove'
16897 d_memset='$d_memset'
16898 d_mkdir='$d_mkdir'
16899 d_mkdtemp='$d_mkdtemp'
16900 d_mkfifo='$d_mkfifo'
16901 d_mkstemp='$d_mkstemp'
16902 d_mkstemps='$d_mkstemps'
16903 d_mktime='$d_mktime'
16904 d_mmap='$d_mmap'
16905 d_modfl='$d_modfl'
16906 d_modfl_pow32_bug='$d_modfl_pow32_bug'
16907 d_mprotect='$d_mprotect'
16908 d_msg='$d_msg'
16909 d_msg_ctrunc='$d_msg_ctrunc'
16910 d_msg_dontroute='$d_msg_dontroute'
16911 d_msg_oob='$d_msg_oob'
16912 d_msg_peek='$d_msg_peek'
16913 d_msg_proxy='$d_msg_proxy'
16914 d_msgctl='$d_msgctl'
16915 d_msgget='$d_msgget'
16916 d_msghdr_s='$d_msghdr_s'
16917 d_msgrcv='$d_msgrcv'
16918 d_msgsnd='$d_msgsnd'
16919 d_msync='$d_msync'
16920 d_munmap='$d_munmap'
16921 d_mymalloc='$d_mymalloc'
16922 d_nice='$d_nice'
16923 d_nl_langinfo='$d_nl_langinfo'
16924 d_nv_preserves_uv='$d_nv_preserves_uv'
16925 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
16926 d_off64_t='$d_off64_t'
16927 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
16928 d_oldpthreads='$d_oldpthreads'
16929 d_oldsock='$d_oldsock'
16930 d_open3='$d_open3'
16931 d_pathconf='$d_pathconf'
16932 d_pause='$d_pause'
16933 d_perl_otherlibdirs='$d_perl_otherlibdirs'
16934 d_phostname='$d_phostname'
16935 d_pipe='$d_pipe'
16936 d_poll='$d_poll'
16937 d_portable='$d_portable'
16938 d_pthread_atfork='$d_pthread_atfork'
16939 d_pthread_yield='$d_pthread_yield'
16940 d_pwage='$d_pwage'
16941 d_pwchange='$d_pwchange'
16942 d_pwclass='$d_pwclass'
16943 d_pwcomment='$d_pwcomment'
16944 d_pwexpire='$d_pwexpire'
16945 d_pwgecos='$d_pwgecos'
16946 d_pwpasswd='$d_pwpasswd'
16947 d_pwquota='$d_pwquota'
16948 d_qgcvt='$d_qgcvt'
16949 d_quad='$d_quad'
16950 d_readdir='$d_readdir'
16951 d_readlink='$d_readlink'
16952 d_readv='$d_readv'
16953 d_recvmsg='$d_recvmsg'
16954 d_rename='$d_rename'
16955 d_rewinddir='$d_rewinddir'
16956 d_rmdir='$d_rmdir'
16957 d_safebcpy='$d_safebcpy'
16958 d_safemcpy='$d_safemcpy'
16959 d_sanemcmp='$d_sanemcmp'
16960 d_sbrkproto='$d_sbrkproto'
16961 d_sched_yield='$d_sched_yield'
16962 d_scm_rights='$d_scm_rights'
16963 d_seekdir='$d_seekdir'
16964 d_select='$d_select'
16965 d_sem='$d_sem'
16966 d_semctl='$d_semctl'
16967 d_semctl_semid_ds='$d_semctl_semid_ds'
16968 d_semctl_semun='$d_semctl_semun'
16969 d_semget='$d_semget'
16970 d_semop='$d_semop'
16971 d_sendmsg='$d_sendmsg'
16972 d_setegid='$d_setegid'
16973 d_seteuid='$d_seteuid'
16974 d_setgrent='$d_setgrent'
16975 d_setgrps='$d_setgrps'
16976 d_sethent='$d_sethent'
16977 d_setitimer='$d_setitimer'
16978 d_setlinebuf='$d_setlinebuf'
16979 d_setlocale='$d_setlocale'
16980 d_setnent='$d_setnent'
16981 d_setpent='$d_setpent'
16982 d_setpgid='$d_setpgid'
16983 d_setpgrp2='$d_setpgrp2'
16984 d_setpgrp='$d_setpgrp'
16985 d_setprior='$d_setprior'
16986 d_setproctitle='$d_setproctitle'
16987 d_setpwent='$d_setpwent'
16988 d_setregid='$d_setregid'
16989 d_setresgid='$d_setresgid'
16990 d_setresuid='$d_setresuid'
16991 d_setreuid='$d_setreuid'
16992 d_setrgid='$d_setrgid'
16993 d_setruid='$d_setruid'
16994 d_setsent='$d_setsent'
16995 d_setsid='$d_setsid'
16996 d_setvbuf='$d_setvbuf'
16997 d_sfio='$d_sfio'
16998 d_shm='$d_shm'
16999 d_shmat='$d_shmat'
17000 d_shmatprototype='$d_shmatprototype'
17001 d_shmctl='$d_shmctl'
17002 d_shmdt='$d_shmdt'
17003 d_shmget='$d_shmget'
17004 d_sigaction='$d_sigaction'
17005 d_sigprocmask='$d_sigprocmask'
17006 d_sigsetjmp='$d_sigsetjmp'
17007 d_sockatmark='$d_sockatmark'
17008 d_sockatmarkproto='$d_sockatmarkproto'
17009 d_socket='$d_socket'
17010 d_socklen_t='$d_socklen_t'
17011 d_sockpair='$d_sockpair'
17012 d_socks5_init='$d_socks5_init'
17013 d_sqrtl='$d_sqrtl'
17014 d_sresgproto='$d_sresgproto'
17015 d_sresuproto='$d_sresuproto'
17016 d_statblks='$d_statblks'
17017 d_statfs_f_flags='$d_statfs_f_flags'
17018 d_statfs_s='$d_statfs_s'
17019 d_statvfs='$d_statvfs'
17020 d_stdio_cnt_lval='$d_stdio_cnt_lval'
17021 d_stdio_ptr_lval='$d_stdio_ptr_lval'
17022 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
17023 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
17024 d_stdio_stream_array='$d_stdio_stream_array'
17025 d_stdiobase='$d_stdiobase'
17026 d_stdstdio='$d_stdstdio'
17027 d_strchr='$d_strchr'
17028 d_strcoll='$d_strcoll'
17029 d_strctcpy='$d_strctcpy'
17030 d_strerrm='$d_strerrm'
17031 d_strerror='$d_strerror'
17032 d_strftime='$d_strftime'
17033 d_strtod='$d_strtod'
17034 d_strtol='$d_strtol'
17035 d_strtold='$d_strtold'
17036 d_strtoll='$d_strtoll'
17037 d_strtoq='$d_strtoq'
17038 d_strtoul='$d_strtoul'
17039 d_strtoull='$d_strtoull'
17040 d_strtouq='$d_strtouq'
17041 d_strxfrm='$d_strxfrm'
17042 d_suidsafe='$d_suidsafe'
17043 d_symlink='$d_symlink'
17044 d_syscall='$d_syscall'
17045 d_syscallproto='$d_syscallproto'
17046 d_sysconf='$d_sysconf'
17047 d_sysernlst='$d_sysernlst'
17048 d_syserrlst='$d_syserrlst'
17049 d_system='$d_system'
17050 d_tcgetpgrp='$d_tcgetpgrp'
17051 d_tcsetpgrp='$d_tcsetpgrp'
17052 d_telldir='$d_telldir'
17053 d_telldirproto='$d_telldirproto'
17054 d_time='$d_time'
17055 d_times='$d_times'
17056 d_truncate='$d_truncate'
17057 d_tzname='$d_tzname'
17058 d_u32align='$d_u32align'
17059 d_ualarm='$d_ualarm'
17060 d_umask='$d_umask'
17061 d_uname='$d_uname'
17062 d_union_semun='$d_union_semun'
17063 d_unordered='$d_unordered'
17064 d_usleep='$d_usleep'
17065 d_usleepproto='$d_usleepproto'
17066 d_ustat='$d_ustat'
17067 d_vendorarch='$d_vendorarch'
17068 d_vendorbin='$d_vendorbin'
17069 d_vendorlib='$d_vendorlib'
17070 d_vfork='$d_vfork'
17071 d_void_closedir='$d_void_closedir'
17072 d_voidsig='$d_voidsig'
17073 d_voidtty='$d_voidtty'
17074 d_volatile='$d_volatile'
17075 d_vprintf='$d_vprintf'
17076 d_wait4='$d_wait4'
17077 d_waitpid='$d_waitpid'
17078 d_wcstombs='$d_wcstombs'
17079 d_wctomb='$d_wctomb'
17080 d_writev='$d_writev'
17081 d_xenix='$d_xenix'
17082 date='$date'
17083 db_hashtype='$db_hashtype'
17084 db_prefixtype='$db_prefixtype'
17085 db_version_major='$db_version_major'
17086 db_version_minor='$db_version_minor'
17087 db_version_patch='$db_version_patch'
17088 defvoidused='$defvoidused'
17089 direntrytype='$direntrytype'
17090 dlext='$dlext'
17091 dlsrc='$dlsrc'
17092 doublesize='$doublesize'
17093 drand01='$drand01'
17094 dynamic_ext='$dynamic_ext'
17095 eagain='$eagain'
17096 ebcdic='$ebcdic'
17097 echo='$echo'
17098 egrep='$egrep'
17099 emacs='$emacs'
17100 eunicefix='$eunicefix'
17101 exe_ext='$exe_ext'
17102 expr='$expr'
17103 extensions='$extensions'
17104 extras='$extras'
17105 fflushNULL='$fflushNULL'
17106 fflushall='$fflushall'
17107 find='$find'
17108 firstmakefile='$firstmakefile'
17109 flex='$flex'
17110 fpossize='$fpossize'
17111 fpostype='$fpostype'
17112 freetype='$freetype'
17113 from='$from'
17114 full_ar='$full_ar'
17115 full_csh='$full_csh'
17116 full_sed='$full_sed'
17117 gccosandvers='$gccosandvers'
17118 gccversion='$gccversion'
17119 gidformat='$gidformat'
17120 gidsign='$gidsign'
17121 gidsize='$gidsize'
17122 gidtype='$gidtype'
17123 glibpth='$glibpth'
17124 grep='$grep'
17125 groupcat='$groupcat'
17126 groupstype='$groupstype'
17127 gzip='$gzip'
17128 h_fcntl='$h_fcntl'
17129 h_sysfile='$h_sysfile'
17130 hint='$hint'
17131 hostcat='$hostcat'
17132 i16size='$i16size'
17133 i16type='$i16type'
17134 i32size='$i32size'
17135 i32type='$i32type'
17136 i64size='$i64size'
17137 i64type='$i64type'
17138 i8size='$i8size'
17139 i8type='$i8type'
17140 i_arpainet='$i_arpainet'
17141 i_bsdioctl='$i_bsdioctl'
17142 i_db='$i_db'
17143 i_dbm='$i_dbm'
17144 i_dirent='$i_dirent'
17145 i_dld='$i_dld'
17146 i_dlfcn='$i_dlfcn'
17147 i_fcntl='$i_fcntl'
17148 i_float='$i_float'
17149 i_fp='$i_fp'
17150 i_fp_class='$i_fp_class'
17151 i_gdbm='$i_gdbm'
17152 i_grp='$i_grp'
17153 i_iconv='$i_iconv'
17154 i_ieeefp='$i_ieeefp'
17155 i_inttypes='$i_inttypes'
17156 i_langinfo='$i_langinfo'
17157 i_libutil='$i_libutil'
17158 i_limits='$i_limits'
17159 i_locale='$i_locale'
17160 i_machcthr='$i_machcthr'
17161 i_malloc='$i_malloc'
17162 i_math='$i_math'
17163 i_memory='$i_memory'
17164 i_mntent='$i_mntent'
17165 i_ndbm='$i_ndbm'
17166 i_netdb='$i_netdb'
17167 i_neterrno='$i_neterrno'
17168 i_netinettcp='$i_netinettcp'
17169 i_niin='$i_niin'
17170 i_poll='$i_poll'
17171 i_prot='$i_prot'
17172 i_pthread='$i_pthread'
17173 i_pwd='$i_pwd'
17174 i_rpcsvcdbm='$i_rpcsvcdbm'
17175 i_sfio='$i_sfio'
17176 i_sgtty='$i_sgtty'
17177 i_shadow='$i_shadow'
17178 i_socks='$i_socks'
17179 i_stdarg='$i_stdarg'
17180 i_stddef='$i_stddef'
17181 i_stdlib='$i_stdlib'
17182 i_string='$i_string'
17183 i_sunmath='$i_sunmath'
17184 i_sysaccess='$i_sysaccess'
17185 i_sysdir='$i_sysdir'
17186 i_sysfile='$i_sysfile'
17187 i_sysfilio='$i_sysfilio'
17188 i_sysin='$i_sysin'
17189 i_sysioctl='$i_sysioctl'
17190 i_syslog='$i_syslog'
17191 i_sysmman='$i_sysmman'
17192 i_sysmode='$i_sysmode'
17193 i_sysmount='$i_sysmount'
17194 i_sysndir='$i_sysndir'
17195 i_sysparam='$i_sysparam'
17196 i_sysresrc='$i_sysresrc'
17197 i_syssecrt='$i_syssecrt'
17198 i_sysselct='$i_sysselct'
17199 i_syssockio='$i_syssockio'
17200 i_sysstat='$i_sysstat'
17201 i_sysstatfs='$i_sysstatfs'
17202 i_sysstatvfs='$i_sysstatvfs'
17203 i_systime='$i_systime'
17204 i_systimek='$i_systimek'
17205 i_systimes='$i_systimes'
17206 i_systypes='$i_systypes'
17207 i_sysuio='$i_sysuio'
17208 i_sysun='$i_sysun'
17209 i_sysutsname='$i_sysutsname'
17210 i_sysvfs='$i_sysvfs'
17211 i_syswait='$i_syswait'
17212 i_termio='$i_termio'
17213 i_termios='$i_termios'
17214 i_time='$i_time'
17215 i_unistd='$i_unistd'
17216 i_ustat='$i_ustat'
17217 i_utime='$i_utime'
17218 i_values='$i_values'
17219 i_varargs='$i_varargs'
17220 i_varhdr='$i_varhdr'
17221 i_vfork='$i_vfork'
17222 ignore_versioned_solibs='$ignore_versioned_solibs'
17223 inc_version_list='$inc_version_list'
17224 inc_version_list_init='$inc_version_list_init'
17225 incpath='$incpath'
17226 inews='$inews'
17227 installarchlib='$installarchlib'
17228 installbin='$installbin'
17229 installman1dir='$installman1dir'
17230 installman3dir='$installman3dir'
17231 installprefix='$installprefix'
17232 installprefixexp='$installprefixexp'
17233 installprivlib='$installprivlib'
17234 installscript='$installscript'
17235 installsitearch='$installsitearch'
17236 installsitebin='$installsitebin'
17237 installsitelib='$installsitelib'
17238 installstyle='$installstyle'
17239 installusrbinperl='$installusrbinperl'
17240 installvendorarch='$installvendorarch'
17241 installvendorbin='$installvendorbin'
17242 installvendorlib='$installvendorlib'
17243 intsize='$intsize'
17244 issymlink='$issymlink'
17245 ivdformat='$ivdformat'
17246 ivsize='$ivsize'
17247 ivtype='$ivtype'
17248 known_extensions='$known_extensions'
17249 ksh='$ksh'
17250 ld='$ld'
17251 lddlflags='$lddlflags'
17252 ldflags='$ldflags'
17253 ldflags_uselargefiles='$ldflags_uselargefiles'
17254 ldlibpthname='$ldlibpthname'
17255 less='$less'
17256 lib_ext='$lib_ext'
17257 libc='$libc'
17258 libperl='$libperl'
17259 libpth='$libpth'
17260 libs='$libs'
17261 libsdirs='$libsdirs'
17262 libsfiles='$libsfiles'
17263 libsfound='$libsfound'
17264 libspath='$libspath'
17265 libswanted='$libswanted'
17266 libswanted_uselargefiles='$libswanted_uselargefiles'
17267 line='$line'
17268 lint='$lint'
17269 lkflags='$lkflags'
17270 ln='$ln'
17271 lns='$lns'
17272 locincpth='$locincpth'
17273 loclibpth='$loclibpth'
17274 longdblsize='$longdblsize'
17275 longlongsize='$longlongsize'
17276 longsize='$longsize'
17277 lp='$lp'
17278 lpr='$lpr'
17279 ls='$ls'
17280 lseeksize='$lseeksize'
17281 lseektype='$lseektype'
17282 mail='$mail'
17283 mailx='$mailx'
17284 make='$make'
17285 make_set_make='$make_set_make'
17286 mallocobj='$mallocobj'
17287 mallocsrc='$mallocsrc'
17288 malloctype='$malloctype'
17289 man1dir='$man1dir'
17290 man1direxp='$man1direxp'
17291 man1ext='$man1ext'
17292 man3dir='$man3dir'
17293 man3direxp='$man3direxp'
17294 man3ext='$man3ext'
17295 mips_type='$mips_type'
17296 mkdir='$mkdir'
17297 mmaptype='$mmaptype'
17298 modetype='$modetype'
17299 more='$more'
17300 multiarch='$multiarch'
17301 mv='$mv'
17302 myarchname='$myarchname'
17303 mydomain='$mydomain'
17304 myhostname='$myhostname'
17305 myuname='$myuname'
17306 n='$n'
17307 need_va_copy='$need_va_copy'
17308 netdb_hlen_type='$netdb_hlen_type'
17309 netdb_host_type='$netdb_host_type'
17310 netdb_name_type='$netdb_name_type'
17311 netdb_net_type='$netdb_net_type'
17312 nm='$nm'
17313 nm_opt='$nm_opt'
17314 nm_so_opt='$nm_so_opt'
17315 nonxs_ext='$nonxs_ext'
17316 nroff='$nroff'
17317 nvEUformat='$nvEUformat'
17318 nvFUformat='$nvFUformat'
17319 nvGUformat='$nvGUformat'
17320 nveformat='$nveformat'
17321 nvfformat='$nvfformat'
17322 nvgformat='$nvgformat'
17323 nvsize='$nvsize'
17324 nvtype='$nvtype'
17325 o_nonblock='$o_nonblock'
17326 obj_ext='$obj_ext'
17327 old_pthread_create_joinable='$old_pthread_create_joinable'
17328 optimize='$optimize'
17329 orderlib='$orderlib'
17330 osname='$osname'
17331 osvers='$osvers'
17332 otherlibdirs='$otherlibdirs'
17333 package='$package'
17334 pager='$pager'
17335 passcat='$passcat'
17336 patchlevel='$patchlevel'
17337 path_sep='$path_sep'
17338 perl5='$perl5'
17339 perl='$perl'
17340 perl_patchlevel='$perl_patchlevel'
17341 perladmin='$perladmin'
17342 perllibs='$perllibs'
17343 perlpath='$perlpath'
17344 pg='$pg'
17345 phostname='$phostname'
17346 pidtype='$pidtype'
17347 plibpth='$plibpth'
17348 pm_apiversion='$pm_apiversion'
17349 pmake='$pmake'
17350 pr='$pr'
17351 prefix='$prefix'
17352 prefixexp='$prefixexp'
17353 privlib='$privlib'
17354 privlibexp='$privlibexp'
17355 prototype='$prototype'
17356 ptrsize='$ptrsize'
17357 quadkind='$quadkind'
17358 quadtype='$quadtype'
17359 randbits='$randbits'
17360 randfunc='$randfunc'
17361 randseedtype='$randseedtype'
17362 ranlib='$ranlib'
17363 rd_nodata='$rd_nodata'
17364 revision='$revision'
17365 rm='$rm'
17366 rmail='$rmail'
17367 run='$run'
17368 runnm='$runnm'
17369 sPRIEUldbl='$sPRIEUldbl'
17370 sPRIFUldbl='$sPRIFUldbl'
17371 sPRIGUldbl='$sPRIGUldbl'
17372 sPRIXU64='$sPRIXU64'
17373 sPRId64='$sPRId64'
17374 sPRIeldbl='$sPRIeldbl'
17375 sPRIfldbl='$sPRIfldbl'
17376 sPRIgldbl='$sPRIgldbl'
17377 sPRIi64='$sPRIi64'
17378 sPRIo64='$sPRIo64'
17379 sPRIu64='$sPRIu64'
17380 sPRIx64='$sPRIx64'
17381 sSCNfldbl='$sSCNfldbl'
17382 sched_yield='$sched_yield'
17383 scriptdir='$scriptdir'
17384 scriptdirexp='$scriptdirexp'
17385 sed='$sed'
17386 seedfunc='$seedfunc'
17387 selectminbits='$selectminbits'
17388 selecttype='$selecttype'
17389 sendmail='$sendmail'
17390 sh='$sh'
17391 shar='$shar'
17392 sharpbang='$sharpbang'
17393 shmattype='$shmattype'
17394 shortsize='$shortsize'
17395 shrpenv='$shrpenv'
17396 shsharp='$shsharp'
17397 sig_count='$sig_count'
17398 sig_name='$sig_name'
17399 sig_name_init='$sig_name_init'
17400 sig_num='$sig_num'
17401 sig_num_init='$sig_num_init'
17402 sig_size='$sig_size'
17403 signal_t='$signal_t'
17404 sitearch='$sitearch'
17405 sitearchexp='$sitearchexp'
17406 sitebin='$sitebin'
17407 sitebinexp='$sitebinexp'
17408 sitelib='$sitelib'
17409 sitelib_stem='$sitelib_stem'
17410 sitelibexp='$sitelibexp'
17411 siteprefix='$siteprefix'
17412 siteprefixexp='$siteprefixexp'
17413 sizesize='$sizesize'
17414 sizetype='$sizetype'
17415 sleep='$sleep'
17416 smail='$smail'
17417 so='$so'
17418 sockethdr='$sockethdr'
17419 socketlib='$socketlib'
17420 socksizetype='$socksizetype'
17421 sort='$sort'
17422 spackage='$spackage'
17423 spitshell='$spitshell'
17424 src='$src'
17425 ssizetype='$ssizetype'
17426 startperl='$startperl'
17427 startsh='$startsh'
17428 static_ext='$static_ext'
17429 stdchar='$stdchar'
17430 stdio_base='$stdio_base'
17431 stdio_bufsiz='$stdio_bufsiz'
17432 stdio_cnt='$stdio_cnt'
17433 stdio_filbuf='$stdio_filbuf'
17434 stdio_ptr='$stdio_ptr'
17435 stdio_stream_array='$stdio_stream_array'
17436 strings='$strings'
17437 submit='$submit'
17438 subversion='$subversion'
17439 sysman='$sysman'
17440 tail='$tail'
17441 tar='$tar'
17442 targetarch='$targetarch'
17443 tbl='$tbl'
17444 tee='$tee'
17445 test='$test'
17446 timeincl='$timeincl'
17447 timetype='$timetype'
17448 to='$to'
17449 touch='$touch'
17450 tr='$tr'
17451 trnl='$trnl'
17452 troff='$troff'
17453 u16size='$u16size'
17454 u16type='$u16type'
17455 u32size='$u32size'
17456 u32type='$u32type'
17457 u64size='$u64size'
17458 u64type='$u64type'
17459 u8size='$u8size'
17460 u8type='$u8type'
17461 uidformat='$uidformat'
17462 uidsign='$uidsign'
17463 uidsize='$uidsize'
17464 uidtype='$uidtype'
17465 uname='$uname'
17466 uniq='$uniq'
17467 uquadtype='$uquadtype'
17468 use5005threads='$use5005threads'
17469 use64bitall='$use64bitall'
17470 use64bitint='$use64bitint'
17471 usecrosscompile='$usecrosscompile'
17472 usedl='$usedl'
17473 useithreads='$useithreads'
17474 uselargefiles='$uselargefiles'
17475 uselongdouble='$uselongdouble'
17476 usemorebits='$usemorebits'
17477 usemultiplicity='$usemultiplicity'
17478 usemymalloc='$usemymalloc'
17479 usenm='$usenm'
17480 useopcode='$useopcode'
17481 useperlio='$useperlio'
17482 useposix='$useposix'
17483 usereentrant='$usereentrant'
17484 usesfio='$usesfio'
17485 useshrplib='$useshrplib'
17486 usesocks='$usesocks'
17487 usethreads='$usethreads'
17488 usevendorprefix='$usevendorprefix'
17489 usevfork='$usevfork'
17490 usrinc='$usrinc'
17491 uuname='$uuname'
17492 uvXUformat='$uvXUformat'
17493 uvoformat='$uvoformat'
17494 uvsize='$uvsize'
17495 uvtype='$uvtype'
17496 uvuformat='$uvuformat'
17497 uvxformat='$uvxformat'
17498 vendorarch='$vendorarch'
17499 vendorarchexp='$vendorarchexp'
17500 vendorbin='$vendorbin'
17501 vendorbinexp='$vendorbinexp'
17502 vendorlib='$vendorlib'
17503 vendorlib_stem='$vendorlib_stem'
17504 vendorlibexp='$vendorlibexp'
17505 vendorprefix='$vendorprefix'
17506 vendorprefixexp='$vendorprefixexp'
17507 version='$version'
17508 version_patchlevel_string='$version_patchlevel_string'
17509 versiononly='$versiononly'
17510 vi='$vi'
17511 voidflags='$voidflags'
17512 xlibpth='$xlibpth'
17513 xs_apiversion='$xs_apiversion'
17514 yacc='$yacc'
17515 yaccflags='$yaccflags'
17516 zcat='$zcat'
17517 zip='$zip'
17518 EOT
17519
17520 : Add in command line options if available
17521 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
17522
17523 : add special variables
17524 $test -f $src/patchlevel.h && \
17525 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
17526 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
17527 echo "PERL_CONFIG_SH=true" >>config.sh
17528
17529 : propagate old symbols
17530 if $test -f UU/config.sh; then
17531         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
17532         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
17533         $sort | $uniq -u >UU/oldsyms
17534         set X `cat UU/oldsyms`
17535         shift
17536         case $# in
17537         0) ;;
17538         *)
17539                 cat <<EOM
17540 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
17541 EOM
17542                 echo "# Variables propagated from previous config.sh file." >>config.sh
17543                 for sym in `cat UU/oldsyms`; do
17544                         echo "    Propagating $hint variable "'$'"$sym..."
17545                         eval 'tmp="$'"${sym}"'"'
17546                         echo "$tmp" | \
17547                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
17548                 done
17549                 ;;
17550         esac
17551 fi
17552
17553 : Finish up by extracting the .SH files
17554 case "$alldone" in
17555 exit)
17556         $rm -rf UU
17557         echo "Extraction done."
17558         exit 0
17559         ;;
17560 cont)
17561         ;;
17562 '')
17563         dflt=''
17564         nostick=true
17565         $cat <<EOM
17566
17567 If you'd like to make any changes to the config.sh file before I begin
17568 to configure things, do it as a shell escape now (e.g. !vi config.sh).
17569
17570 EOM
17571         rp="Press return or use a shell escape to edit config.sh:"
17572         . UU/myread
17573         nostick=''
17574         case "$ans" in
17575         '') ;;
17576         *) : in case they cannot read
17577                 sh 1>&4 -c "$ans";;
17578         esac
17579         ;;
17580 esac
17581
17582 : if this fails, just run all the .SH files by hand
17583 . ./config.sh
17584
17585 echo " "
17586 exec 1>&4
17587 pwd=`pwd`
17588 . ./UU/extract
17589 cd $pwd
17590
17591 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
17592         dflt=y
17593         case "$silent" in
17594         true) ;;
17595         *)
17596                 $cat <<EOM
17597
17598 Now you need to generate make dependencies by running "$make depend".
17599 You might prefer to run it in background: "$make depend > makedepend.out &"
17600 It can take a while, so you might not want to run it right now.
17601
17602 EOM
17603                 ;;
17604         esac
17605         rp="Run $make depend now?"
17606         . UU/myread
17607         case "$ans" in
17608         y*)
17609                 $make depend && echo "Now you must run '$make'."
17610                 ;;
17611         *)
17612                 echo "You must run '$make depend' then '$make'."
17613                 ;;
17614         esac
17615 elif test -f [Mm]akefile; then
17616         echo " "
17617         echo "Now you must run a $make."
17618 else
17619         echo "Configure done."
17620 fi
17621
17622 if $test -f Policy.sh; then
17623     $cat <<EOM
17624
17625 If you compile $package on a different machine or from a different object
17626 directory, copy the Policy.sh file from this object directory to the
17627 new one before you run Configure -- this will help you with most of
17628 the policy defaults.
17629
17630 EOM
17631 fi
17632 if $test -f config.msg; then
17633     echo "Hmm.  I also noted the following information while running:"
17634     echo " "
17635     $cat config.msg >&4
17636     $rm -f config.msg
17637 fi
17638 $rm -f kit*isdone ark*isdone
17639 $rm -rf UU
17640
17641 : End of Configure
17642