Configure sanity checks:
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Tue Apr  3 04:12:27 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 perllibs=''
169 dynamic_ext=''
170 extensions=''
171 known_extensions=''
172 nonxs_ext=''
173 static_ext=''
174 useopcode=''
175 useposix=''
176 d_bsd=''
177 d_eunice=''
178 d_xenix=''
179 eunicefix=''
180 Mcc=''
181 ar=''
182 awk=''
183 bash=''
184 bison=''
185 byacc=''
186 cat=''
187 chgrp=''
188 chmod=''
189 chown=''
190 comm=''
191 compress=''
192 cp=''
193 cpio=''
194 cpp=''
195 csh=''
196 date=''
197 echo=''
198 egrep=''
199 emacs=''
200 expr=''
201 find=''
202 flex=''
203 grep=''
204 gzip=''
205 inews=''
206 ksh=''
207 less=''
208 line=''
209 lint=''
210 ln=''
211 lp=''
212 lpr=''
213 ls=''
214 mail=''
215 mailx=''
216 make=''
217 mkdir=''
218 more=''
219 mv=''
220 nm=''
221 nroff=''
222 perl=''
223 pg=''
224 pmake=''
225 pr=''
226 rm=''
227 rmail=''
228 sed=''
229 sendmail=''
230 shar=''
231 sleep=''
232 smail=''
233 sort=''
234 submit=''
235 tail=''
236 tar=''
237 tbl=''
238 tee=''
239 test=''
240 touch=''
241 tr=''
242 troff=''
243 uname=''
244 uniq=''
245 uuname=''
246 vi=''
247 zcat=''
248 zip=''
249 full_ar=''
250 full_sed=''
251 libswanted=''
252 hint=''
253 myuname=''
254 osname=''
255 osvers=''
256 Author=''
257 Date=''
258 Header=''
259 Id=''
260 Locker=''
261 Log=''
262 RCSfile=''
263 Revision=''
264 Source=''
265 State=''
266 _a=''
267 _exe=''
268 _o=''
269 archobjs=''
270 exe_ext=''
271 firstmakefile=''
272 lib_ext=''
273 obj_ext=''
274 path_sep=''
275 afs=''
276 alignbytes=''
277 ansi2knr=''
278 archlib=''
279 archlibexp=''
280 d_archlib=''
281 installarchlib=''
282 archname=''
283 myarchname=''
284 d_atolf=''
285 d_atoll=''
286 baserev=''
287 bin=''
288 binexp=''
289 installbin=''
290 bincompat5005=''
291 d_bincompat5005=''
292 byteorder=''
293 cc=''
294 ccflags=''
295 cppflags=''
296 ldflags=''
297 lkflags=''
298 locincpth=''
299 optimize=''
300 cf_email=''
301 cf_by=''
302 cf_time=''
303 charsize=''
304 contains=''
305 cpp_stuff=''
306 cpplast=''
307 cppminus=''
308 cpprun=''
309 cppstdin=''
310 crosscompile=''
311 d__fwalk=''
312 d_access=''
313 d_accessx=''
314 d_alarm=''
315 d_attribut=''
316 d_bcmp=''
317 d_bcopy=''
318 d_bzero=''
319 d_casti32=''
320 castflags=''
321 d_castneg=''
322 d_chown=''
323 d_chroot=''
324 d_chsize=''
325 d_closedir=''
326 d_void_closedir=''
327 d_const=''
328 cryptlib=''
329 d_crypt=''
330 d_csh=''
331 full_csh=''
332 d_cuserid=''
333 d_dbl_dig=''
334 d_difftime=''
335 d_dlerror=''
336 d_dlopen=''
337 d_dlsymun=''
338 d_dosuid=''
339 d_suidsafe=''
340 d_drand48proto=''
341 d_dup2=''
342 d_eaccess=''
343 d_endgrent=''
344 d_endhent=''
345 d_endnent=''
346 d_endpent=''
347 d_endpwent=''
348 d_endsent=''
349 d_fchmod=''
350 d_fchown=''
351 d_fcntl=''
352 d_fcntl_can_lock=''
353 d_fd_macros=''
354 d_fd_set=''
355 d_fds_bits=''
356 d_fgetpos=''
357 d_flexfnam=''
358 d_flock=''
359 d_fork=''
360 d_fpos64_t=''
361 d_frexpl=''
362 d_fs_data_s=''
363 d_fseeko=''
364 d_fsetpos=''
365 d_fstatfs=''
366 d_fsync=''
367 d_ftello=''
368 d_ftime=''
369 d_gettimeod=''
370 d_Gconvert=''
371 d_getcwd=''
372 d_getespwnam=''
373 d_getfsstat=''
374 d_getgrent=''
375 d_getgrps=''
376 d_gethbyaddr=''
377 d_gethbyname=''
378 d_gethent=''
379 aphostname=''
380 d_gethname=''
381 d_phostname=''
382 d_uname=''
383 d_gethostprotos=''
384 d_getlogin=''
385 d_getmnt=''
386 d_getmntent=''
387 d_getnbyaddr=''
388 d_getnbyname=''
389 d_getnent=''
390 d_getnetprotos=''
391 d_getpagsz=''
392 d_getpent=''
393 d_getpgid=''
394 d_getpgrp2=''
395 d_bsdgetpgrp=''
396 d_getpgrp=''
397 d_getppid=''
398 d_getprior=''
399 d_getpbyname=''
400 d_getpbynumber=''
401 d_getprotoprotos=''
402 d_getprpwnam=''
403 d_getpwent=''
404 d_getsent=''
405 d_getservprotos=''
406 d_getspnam=''
407 d_getsbyname=''
408 d_getsbyport=''
409 d_gnulibc=''
410 d_hasmntopt=''
411 d_htonl=''
412 d_iconv=''
413 d_inetaton=''
414 d_int64_t=''
415 d_isascii=''
416 d_isnan=''
417 d_isnanl=''
418 d_killpg=''
419 d_lchown=''
420 d_ldbl_dig=''
421 d_link=''
422 d_locconv=''
423 d_lockf=''
424 d_longdbl=''
425 longdblsize=''
426 d_longlong=''
427 longlongsize=''
428 d_lseekproto=''
429 d_lstat=''
430 d_madvise=''
431 d_mblen=''
432 d_mbstowcs=''
433 d_mbtowc=''
434 d_memchr=''
435 d_memcmp=''
436 d_memcpy=''
437 d_memmove=''
438 d_memset=''
439 d_mkdir=''
440 d_mkdtemp=''
441 d_mkfifo=''
442 d_mkstemp=''
443 d_mkstemps=''
444 d_mktime=''
445 d_mmap=''
446 mmaptype=''
447 d_modfl=''
448 d_mprotect=''
449 d_msg=''
450 d_msgctl=''
451 d_msgget=''
452 d_msgrcv=''
453 d_msgsnd=''
454 d_msync=''
455 d_munmap=''
456 d_nice=''
457 d_off64_t=''
458 d_open3=''
459 d_fpathconf=''
460 d_pathconf=''
461 d_pause=''
462 d_pipe=''
463 d_poll=''
464 d_portable=''
465 d_old_pthread_create_joinable=''
466 old_pthread_create_joinable=''
467 d_pthread_yield=''
468 d_sched_yield=''
469 sched_yield=''
470 d_qgcvt=''
471 d_readdir=''
472 d_rewinddir=''
473 d_seekdir=''
474 d_telldir=''
475 d_readlink=''
476 d_rename=''
477 d_rmdir=''
478 d_safebcpy=''
479 d_safemcpy=''
480 d_sanemcmp=''
481 d_sbrkproto=''
482 d_select=''
483 d_sem=''
484 d_semctl=''
485 d_semget=''
486 d_semop=''
487 d_setegid=''
488 d_seteuid=''
489 d_setgrent=''
490 d_setgrps=''
491 d_sethent=''
492 d_setlinebuf=''
493 d_setlocale=''
494 d_setnent=''
495 d_setpent=''
496 d_setpgid=''
497 d_setpgrp2=''
498 d_bsdsetpgrp=''
499 d_setpgrp=''
500 d_setprior=''
501 d_setproctitle=''
502 d_setpwent=''
503 d_setregid=''
504 d_setresgid=''
505 d_setresuid=''
506 d_setreuid=''
507 d_setrgid=''
508 d_setruid=''
509 d_setsent=''
510 d_setsid=''
511 d_setvbuf=''
512 d_sfio=''
513 usesfio=''
514 d_shm=''
515 d_shmat=''
516 d_shmatprototype=''
517 shmattype=''
518 d_shmctl=''
519 d_shmdt=''
520 d_shmget=''
521 d_sigaction=''
522 d_sigprocmask=''
523 d_sigsetjmp=''
524 d_sockatmark=''
525 d_msg_ctrunc=''
526 d_msg_dontroute=''
527 d_msg_oob=''
528 d_msg_peek=''
529 d_msg_proxy=''
530 d_oldsock=''
531 d_scm_rights=''
532 d_socket=''
533 d_sockpair=''
534 sockethdr=''
535 socketlib=''
536 d_socklen_t=''
537 d_socks5_init=''
538 d_sqrtl=''
539 d_statblks=''
540 d_statfs_f_flags=''
541 d_statfs_s=''
542 d_fstatvfs=''
543 d_statvfs=''
544 d_stdio_cnt_lval=''
545 d_stdio_ptr_lval=''
546 d_stdio_ptr_lval_nochange_cnt=''
547 d_stdio_ptr_lval_sets_cnt=''
548 d_stdiobase=''
549 d_stdstdio=''
550 stdio_base=''
551 stdio_bufsiz=''
552 stdio_cnt=''
553 stdio_filbuf=''
554 stdio_ptr=''
555 d_index=''
556 d_strchr=''
557 d_strcoll=''
558 d_strctcpy=''
559 d_strerrm=''
560 d_strerror=''
561 d_sysernlst=''
562 d_syserrlst=''
563 d_strtod=''
564 d_strtol=''
565 d_strtold=''
566 d_strtoll=''
567 d_strtoq=''
568 d_strtoul=''
569 d_strtoull=''
570 d_strtouq=''
571 d_strxfrm=''
572 d_symlink=''
573 d_syscall=''
574 d_sysconf=''
575 d_system=''
576 d_tcgetpgrp=''
577 d_tcsetpgrp=''
578 d_telldirproto=''
579 d_time=''
580 timetype=''
581 clocktype=''
582 d_times=''
583 d_truncate=''
584 d_tzname=''
585 d_umask=''
586 d_semctl_semid_ds=''
587 d_semctl_semun=''
588 d_union_semun=''
589 d_ustat=''
590 d_vfork=''
591 usevfork=''
592 d_voidsig=''
593 signal_t=''
594 d_volatile=''
595 d_charvspr=''
596 d_vprintf=''
597 d_wait4=''
598 d_waitpid=''
599 d_wcstombs=''
600 d_wctomb=''
601 dlext=''
602 cccdlflags=''
603 ccdlflags=''
604 dlsrc=''
605 ld=''
606 lddlflags=''
607 usedl=''
608 doublesize=''
609 ebcdic=''
610 fflushNULL=''
611 fflushall=''
612 fpossize=''
613 fpostype=''
614 gccosandvers=''
615 gccversion=''
616 gidformat=''
617 gidsign=''
618 gidsize=''
619 gidtype=''
620 groupstype=''
621 h_fcntl=''
622 h_sysfile=''
623 i_arpainet=''
624 db_hashtype=''
625 db_prefixtype=''
626 i_db=''
627 i_dbm=''
628 i_rpcsvcdbm=''
629 d_dirnamlen=''
630 direntrytype=''
631 i_dirent=''
632 i_dld=''
633 i_dlfcn=''
634 i_fcntl=''
635 i_float=''
636 i_gdbm=''
637 d_grpasswd=''
638 i_grp=''
639 i_iconv=''
640 i_ieeefp=''
641 i_inttypes=''
642 i_libutil=''
643 i_limits=''
644 i_locale=''
645 i_machcthr=''
646 i_malloc=''
647 i_math=''
648 i_memory=''
649 i_mntent=''
650 i_ndbm=''
651 i_netdb=''
652 i_neterrno=''
653 i_netinettcp=''
654 i_niin=''
655 i_sysin=''
656 i_poll=''
657 i_prot=''
658 i_pthread=''
659 d_pwage=''
660 d_pwchange=''
661 d_pwclass=''
662 d_pwcomment=''
663 d_pwexpire=''
664 d_pwgecos=''
665 d_pwpasswd=''
666 d_pwquota=''
667 i_pwd=''
668 i_sfio=''
669 i_shadow=''
670 i_socks=''
671 i_stddef=''
672 i_stdlib=''
673 i_string=''
674 strings=''
675 i_sunmath=''
676 i_sysaccess=''
677 i_sysdir=''
678 i_sysfile=''
679 d_voidtty=''
680 i_bsdioctl=''
681 i_sysfilio=''
682 i_sysioctl=''
683 i_syssockio=''
684 i_syslog=''
685 i_sysmman=''
686 i_sysmode=''
687 i_sysmount=''
688 i_sysndir=''
689 i_sysparam=''
690 i_sysresrc=''
691 i_syssecrt=''
692 i_sysselct=''
693 i_sysstat=''
694 i_sysstatfs=''
695 i_sysstatvfs=''
696 i_systimes=''
697 i_systypes=''
698 i_sysuio=''
699 i_sysun=''
700 i_sysutsname=''
701 i_sysvfs=''
702 i_syswait=''
703 i_sgtty=''
704 i_termio=''
705 i_termios=''
706 i_systime=''
707 i_systimek=''
708 i_time=''
709 timeincl=''
710 i_unistd=''
711 i_ustat=''
712 i_utime=''
713 i_values=''
714 i_stdarg=''
715 i_varargs=''
716 i_varhdr=''
717 i_vfork=''
718 inc_version_list=''
719 inc_version_list_init=''
720 installprefix=''
721 installprefixexp=''
722 installstyle=''
723 installusrbinperl=''
724 intsize=''
725 longsize=''
726 shortsize=''
727 issymlink=''
728 libc=''
729 ldlibpthname=''
730 libperl=''
731 shrpenv=''
732 useshrplib=''
733 glibpth=''
734 libpth=''
735 loclibpth=''
736 plibpth=''
737 xlibpth=''
738 ignore_versioned_solibs=''
739 libs=''
740 libsdirs=''
741 libsfiles=''
742 libsfound=''
743 libspath=''
744 lns=''
745 d_PRIEUldbl=''
746 d_PRIFUldbl=''
747 d_PRIGUldbl=''
748 d_PRIeldbl=''
749 d_PRIfldbl=''
750 d_PRIgldbl=''
751 d_SCNfldbl=''
752 sPRIEUldbl=''
753 sPRIFUldbl=''
754 sPRIGUldbl=''
755 sPRIeldbl=''
756 sPRIfldbl=''
757 sPRIgldbl=''
758 sSCNfldbl=''
759 lseeksize=''
760 lseektype=''
761 make_set_make=''
762 d_mymalloc=''
763 freetype=''
764 mallocobj=''
765 mallocsrc=''
766 malloctype=''
767 usemymalloc=''
768 installman1dir=''
769 man1dir=''
770 man1direxp=''
771 man1ext=''
772 installman3dir=''
773 man3dir=''
774 man3direxp=''
775 man3ext=''
776 modetype=''
777 multiarch=''
778 mydomain=''
779 myhostname=''
780 phostname=''
781 c=''
782 n=''
783 d_eofnblk=''
784 eagain=''
785 o_nonblock=''
786 rd_nodata=''
787 need_va_copy=''
788 netdb_hlen_type=''
789 netdb_host_type=''
790 netdb_name_type=''
791 netdb_net_type=''
792 groupcat=''
793 hostcat=''
794 passcat=''
795 orderlib=''
796 ranlib=''
797 d_perl_otherlibdirs=''
798 otherlibdirs=''
799 package=''
800 spackage=''
801 pager=''
802 api_revision=''
803 api_subversion=''
804 api_version=''
805 api_versionstring=''
806 patchlevel=''
807 revision=''
808 subversion=''
809 version=''
810 perl5=''
811 perladmin=''
812 perlpath=''
813 d_nv_preserves_uv=''
814 d_nv_preserves_uv_bits=''
815 i16size=''
816 i16type=''
817 i32size=''
818 i32type=''
819 i64size=''
820 i64type=''
821 i8size=''
822 i8type=''
823 ivsize=''
824 ivtype=''
825 nvsize=''
826 nvtype=''
827 u16size=''
828 u16type=''
829 u32size=''
830 u32type=''
831 u64size=''
832 u64type=''
833 u8size=''
834 u8type=''
835 uvsize=''
836 uvtype=''
837 ivdformat=''
838 nvEUformat=''
839 nvFUformat=''
840 nvGUformat=''
841 nveformat=''
842 nvfformat=''
843 nvgformat=''
844 uvXUformat=''
845 uvoformat=''
846 uvuformat=''
847 uvxformat=''
848 pidtype=''
849 prefix=''
850 prefixexp=''
851 installprivlib=''
852 privlib=''
853 privlibexp=''
854 prototype=''
855 ptrsize=''
856 d_PRIXU64=''
857 d_PRId64=''
858 d_PRIi64=''
859 d_PRIo64=''
860 d_PRIu64=''
861 d_PRIx64=''
862 sPRIXU64=''
863 sPRId64=''
864 sPRIi64=''
865 sPRIo64=''
866 sPRIu64=''
867 sPRIx64=''
868 d_quad=''
869 quadkind=''
870 quadtype=''
871 uquadtype=''
872 drand01=''
873 randbits=''
874 randfunc=''
875 randseedtype=''
876 seedfunc=''
877 installscript=''
878 scriptdir=''
879 scriptdirexp=''
880 selectminbits=''
881 selecttype=''
882 sh=''
883 sig_count=''
884 sig_name=''
885 sig_name_init=''
886 sig_num=''
887 sig_num_init=''
888 sig_size=''
889 installsitearch=''
890 sitearch=''
891 sitearchexp=''
892 installsitebin=''
893 sitebin=''
894 sitebinexp=''
895 installsitelib=''
896 sitelib=''
897 sitelib_stem=''
898 sitelibexp=''
899 siteprefix=''
900 siteprefixexp=''
901 sizesize=''
902 sizetype=''
903 so=''
904 socksizetype=''
905 sharpbang=''
906 shsharp=''
907 spitshell=''
908 src=''
909 ssizetype=''
910 startperl=''
911 startsh=''
912 stdchar=''
913 d_stdio_stream_array=''
914 stdio_stream_array=''
915 sysman=''
916 trnl=''
917 uidformat=''
918 uidsign=''
919 uidsize=''
920 uidtype=''
921 archname64=''
922 use64bitall=''
923 use64bitint=''
924 ccflags_uselargefiles=''
925 ldflags_uselargefiles=''
926 libswanted_uselargefiles=''
927 uselargefiles=''
928 uselongdouble=''
929 usemorebits=''
930 usemultiplicity=''
931 nm_opt=''
932 nm_so_opt=''
933 runnm=''
934 usenm=''
935 useperlio=''
936 usesocks=''
937 d_oldpthreads=''
938 use5005threads=''
939 useithreads=''
940 usethreads=''
941 incpath=''
942 mips_type=''
943 usrinc=''
944 d_vendorarch=''
945 installvendorarch=''
946 vendorarch=''
947 vendorarchexp=''
948 d_vendorbin=''
949 installvendorbin=''
950 vendorbin=''
951 vendorbinexp=''
952 d_vendorlib=''
953 installvendorlib=''
954 vendorlib=''
955 vendorlib_stem=''
956 vendorlibexp=''
957 usevendorprefix=''
958 vendorprefix=''
959 vendorprefixexp=''
960 versiononly=''
961 defvoidused=''
962 voidflags=''
963 pm_apiversion=''
964 xs_apiversion=''
965 yacc=''
966 yaccflags=''
967 CONFIG=''
968
969 define='define'
970 undef='undef'
971 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
972 rmlist=''
973
974 : We must find out about Eunice early
975 eunicefix=':'
976 if test -f /etc/unixtovms; then
977         eunicefix=/etc/unixtovms
978 fi
979 if test -f /etc/unixtovms.exe; then
980         eunicefix=/etc/unixtovms.exe
981 fi
982
983 i_whoami=''
984 ccname=''
985 ccversion=''
986 perllibs=''
987 : set useposix=false in your hint file to disable the POSIX extension.
988 useposix=true
989 : set useopcode=false in your hint file to disable the Opcode extension.
990 useopcode=true
991 : Trailing extension.  Override this in a hint file, if needed.
992 _exe=''
993 : Extra object files, if any, needed on this platform.
994 archobjs=''
995 archname=''
996 : Possible local include directories to search.
997 : Set locincpth to "" in a hint file to defeat local include searches.
998 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
999 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1000 :
1001 : no include file wanted by default
1002 inclwanted=''
1003
1004 groupstype=''
1005 : change the next line if compiling for Xenix/286 on Xenix/386
1006 xlibpth='/usr/lib/386 /lib/386'
1007 : Possible local library directories to search.
1008 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1009 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1010
1011 : general looking path for locating libraries
1012 glibpth="/lib /usr/lib $xlibpth"
1013 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1014 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1015 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1016
1017 : Private path used by Configure to find libraries.  Its value
1018 : is prepended to libpth. This variable takes care of special
1019 : machines, like the mips.  Usually, it should be empty.
1020 plibpth=''
1021
1022 : default library list
1023 libswanted=''
1024 : some systems want to use only the non-versioned libso:s
1025 ignore_versioned_solibs=''
1026 archname64=''
1027 ccflags_uselargefiles=''
1028 ldflags_uselargefiles=''
1029 libswanted_uselargefiles=''
1030 : set usemultiplicity on the Configure command line to enable multiplicity.
1031 : set usesocks on the Configure command line to enable socks.
1032 : set usethreads on the Configure command line to enable threads.
1033 : full support for void wanted by default
1034 defvoidused=15
1035
1036 : List of libraries we want.
1037 : If anyone needs -lnet, put it in a hint file.
1038 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1039 libswanted="$libswanted dld ld sun m c cposix posix"
1040 libswanted="$libswanted ndir dir crypt sec"
1041 libswanted="$libswanted ucb bsd BSD PW x iconv util"
1042 : We probably want to search /usr/shlib before most other libraries.
1043 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1044 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1045 glibpth="/usr/shlib $glibpth"
1046 : Do not use vfork unless overridden by a hint file.
1047 usevfork=false
1048
1049 : Find the basic shell for Bourne shell scripts
1050 case "$sh" in
1051 '')
1052         case "$SYSTYPE" in
1053         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1054         *) xxx='/bin/sh';;
1055         esac
1056         if test -f "$xxx"; then
1057                 sh="$xxx"
1058         else
1059                 : Build up a list and do a single loop so we can 'break' out.
1060                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1061                 for xxx in sh bash ksh pdksh ash; do
1062                         for p in $pth; do
1063                                 try="$try ${p}/${xxx}"
1064                         done
1065                 done
1066                 for xxx in $try; do
1067                         if test -f "$xxx"; then
1068                                 sh="$xxx";
1069                                 break
1070                         elif test -f "$xxx.exe"; then
1071                                 sh="$xxx";
1072                                 break
1073                         fi
1074                 done
1075         fi
1076         ;;
1077 esac
1078
1079 case "$sh" in
1080 '')     cat <<EOM >&2
1081 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1082
1083 Usually it's in /bin/sh.  How did you even get this far?
1084 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1085 we'll try to straighten this all out.
1086 EOM
1087         exit 1
1088         ;;
1089 esac
1090
1091 : see if sh knows # comments
1092 if `$sh -c '#' >/dev/null 2>&1`; then
1093         shsharp=true
1094         spitshell=cat
1095         xcat=/bin/cat
1096         test -f $xcat || xcat=/usr/bin/cat
1097         echo "#!$xcat" >try
1098         $eunicefix try
1099         chmod +x try
1100         ./try > today
1101         if test -s today; then
1102                 sharpbang='#!'
1103         else
1104                 echo "#! $xcat" > try
1105                 $eunicefix try
1106                 chmod +x try
1107                 ./try > today
1108                 if test -s today; then
1109                         sharpbang='#! '
1110                 else
1111                         sharpbang=': use '
1112                 fi
1113         fi
1114 else
1115         echo " "
1116         echo "Your $sh doesn't grok # comments--I will strip them later on."
1117         shsharp=false
1118         cd ..
1119         echo "exec grep -v '^[  ]*#'" >spitshell
1120         chmod +x spitshell
1121         $eunicefix spitshell
1122         spitshell=`pwd`/spitshell
1123         cd UU
1124         echo "I presume that if # doesn't work, #! won't work either!"
1125         sharpbang=': use '
1126 fi
1127 rm -f try today
1128
1129 : figure out how to guarantee sh startup
1130 case "$startsh" in
1131 '') startsh=${sharpbang}${sh} ;;
1132 *)
1133 esac
1134 cat >try <<EOSS
1135 $startsh
1136 set abc
1137 test "$?abc" != 1
1138 EOSS
1139
1140 chmod +x try
1141 $eunicefix try
1142 if ./try; then
1143         : echo "Yup, it does."
1144 else
1145         echo "Hmm... '$startsh' does not guarantee sh startup..."
1146         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1147 fi
1148 rm -f try
1149
1150
1151 : Save command line options in file UU/cmdline.opt for later use in
1152 : generating config.sh.
1153 cat > cmdline.opt <<EOSH
1154 # Configure command line arguments.
1155 config_arg0='$0'
1156 config_args='$*'
1157 config_argc=$#
1158 EOSH
1159 argn=1
1160 for arg in "$@"; do
1161         cat >>cmdline.opt <<EOSH
1162 config_arg$argn='$arg'
1163 EOSH
1164         argn=`expr $argn + 1`
1165 done
1166
1167 : produce awk script to parse command line options
1168 cat >options.awk <<'EOF'
1169 BEGIN {
1170         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1171
1172         len = length(optstr);
1173         for (i = 1; i <= len; i++) {
1174                 c = substr(optstr, i, 1);
1175                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1176                 if (a == ":") {
1177                         arg[c] = 1;
1178                         i++;
1179                 }
1180                 opt[c] = 1;
1181         }
1182 }
1183 {
1184         expect = 0;
1185         str = $0;
1186         if (substr(str, 1, 1) != "-") {
1187                 printf("'%s'\n", str);
1188                 next;
1189         }
1190         len = length($0);
1191         for (i = 2; i <= len; i++) {
1192                 c = substr(str, i, 1);
1193                 if (!opt[c]) {
1194                         printf("-%s\n", substr(str, i));
1195                         next;
1196                 }
1197                 printf("-%s\n", c);
1198                 if (arg[c]) {
1199                         if (i < len)
1200                                 printf("'%s'\n", substr(str, i + 1));
1201                         else
1202                                 expect = 1;
1203                         next;
1204                 }
1205         }
1206 }
1207 END {
1208         if (expect)
1209                 print "?";
1210 }
1211 EOF
1212
1213 : process the command line options
1214 set X `for arg in "$@"; do echo "X$arg"; done |
1215         sed -e s/X// | awk -f options.awk`
1216 eval "set $*"
1217 shift
1218 rm -f options.awk
1219
1220 : set up default values
1221 fastread=''
1222 reuseval=false
1223 config_sh=''
1224 alldone=''
1225 error=''
1226 silent=''
1227 extractsh=''
1228 override=''
1229 knowitall=''
1230 rm -f optdef.sh posthint.sh
1231 cat >optdef.sh <<EOS
1232 $startsh
1233 EOS
1234
1235
1236 : option parsing
1237 while test $# -gt 0; do
1238         case "$1" in
1239         -d) shift; fastread=yes;;
1240         -e) shift; alldone=cont;;
1241         -f)
1242                 shift
1243                 cd ..
1244                 if test -r "$1"; then
1245                         config_sh="$1"
1246                 else
1247                         echo "$me: cannot read config file $1." >&2
1248                         error=true
1249                 fi
1250                 cd UU
1251                 shift;;
1252         -h) shift; error=true;;
1253         -r) shift; reuseval=true;;
1254         -s) shift; silent=true; realsilent=true;;
1255         -E) shift; alldone=exit;;
1256         -K) shift; knowitall=true;;
1257         -O) shift; override=true;;
1258         -S) shift; silent=true; extractsh=true;;
1259         -D)
1260                 shift
1261                 case "$1" in
1262                 *=)
1263                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1264                         echo "$me: ignoring -D $1" >&2
1265                         ;;
1266                 *=*) echo "$1" | \
1267                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1268                 *) echo "$1='define'" >> optdef.sh;;
1269                 esac
1270                 shift
1271                 ;;
1272         -U)
1273                 shift
1274                 case "$1" in
1275                 *=) echo "$1" >> optdef.sh;;
1276                 *=*)
1277                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1278                         echo "$me: ignoring -U $1" >&2
1279                         ;;
1280                 *) echo "$1='undef'" >> optdef.sh;;
1281                 esac
1282                 shift
1283                 ;;
1284         -A)
1285             shift
1286             xxx=''
1287             yyy="$1"
1288             zzz=''
1289             uuu=undef
1290             case "$yyy" in
1291             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1292                  case "$zzz" in
1293                  *:*) zzz='' ;;
1294                  *)   xxx=append
1295                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1296                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1297                  esac
1298                  ;;
1299             esac
1300             case "$xxx" in
1301             '')  case "$yyy" in
1302                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1303                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1304                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1305                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1306                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1307                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1308                  esac
1309                  ;;       
1310             esac
1311             case "$xxx" in
1312             append)
1313                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1314             clear)
1315                 echo "$yyy=''"                  >> posthint.sh ;;
1316             define)
1317                 case "$zzz" in
1318                 '') zzz=define ;;
1319                 esac
1320                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1321             eval)
1322                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1323             prepend)
1324                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1325             undef)
1326                 case "$zzz" in
1327                 '') zzz="$uuu" ;;
1328                 esac
1329                 echo "$yyy=$zzz"                >> posthint.sh ;;
1330             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1331             esac
1332             shift
1333             ;;
1334         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1335             exit 0;;
1336         --) break;;
1337         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1338         *) break;;
1339         esac
1340 done
1341
1342 case "$error" in
1343 true)
1344         cat >&2 <<EOM
1345 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1346                  [-U symbol] [-U symbol=] [-A command:symbol...]
1347   -d : use defaults for all answers.
1348   -e : go on without questioning past the production of config.sh.
1349   -f : specify an alternate default configuration file.
1350   -h : print this help message and exit (with an error status).
1351   -r : reuse C symbols value if possible (skips costly nm extraction).
1352   -s : silent mode, only echoes questions and essential information.
1353   -D : define symbol to have some value:
1354          -D symbol         symbol gets the value 'define'
1355          -D symbol=value   symbol gets the value 'value'
1356   -E : stop at the end of questions, after having produced config.sh.
1357   -K : do not use unless you know what you are doing.
1358   -O : let -D and -U override definitions from loaded configuration file.
1359   -S : perform variable substitutions on all .SH files (can mix with -f)
1360   -U : undefine symbol:
1361          -U symbol    symbol gets the value 'undef'
1362          -U symbol=   symbol gets completely empty
1363   -A : manipulate symbol after the platform specific hints have been applied:
1364          -A symbol=value                append " "value to symbol
1365          -A append:symbol=value         append value to symbol
1366          -A define:symbol=value         define symbol to have value
1367          -A clear:symbol                define symbol to be ''
1368          -A define:symbol               define symbol to be 'define'
1369          -A eval:symbol=value           define symbol to be eval of value
1370          -A prepend:symbol=value        prepend value to symbol
1371          -A undef:symbol                define symbol to be 'undef'
1372          -A undef:symbol=               define symbol to be ''
1373   -V : print version number and exit (with a zero status).
1374 EOM
1375         exit 1
1376         ;;
1377 esac
1378
1379 : Sanity checks
1380 case "$fastread$alldone" in
1381 yescont|yesexit) ;;
1382 *)
1383         case "$extractsh" in
1384         true) ;;
1385         *)
1386                 if test ! -t 0; then
1387                         echo "Say 'sh Configure', not 'sh <Configure'"
1388                         exit 1
1389                 fi
1390                 ;;
1391         esac
1392         ;;
1393 esac
1394
1395 exec 4>&1
1396 case "$silent" in
1397 true) exec 1>/dev/null;;
1398 esac
1399
1400 : run the defines and the undefines, if any, but leave the file out there...
1401 touch optdef.sh
1402 . ./optdef.sh
1403 : create the posthint manipulation script and leave the file out there...
1404 touch posthint.sh
1405
1406 : set package name
1407 package=perl5
1408 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1409 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1410 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1411 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1412 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1413 esac
1414
1415 : Some greps do not return status, grrr.
1416 echo "grimblepritz" >grimble
1417 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1418         contains=contains
1419 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1420         contains=grep
1421 else
1422         contains=contains
1423 fi
1424 rm -f grimble
1425 : the following should work in any shell
1426 case "$contains" in
1427 contains*)
1428         echo " "
1429         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1430         cat >contains <<'EOSS'
1431 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1432 EOSS
1433 chmod +x contains
1434 esac
1435
1436 : Find the path to the source tree
1437 case "$src" in
1438 '') case "$0" in
1439     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1440          case "$src" in
1441          /*)    ;;
1442          .)     ;;
1443          *)     src=`cd ../$src && pwd` ;;
1444          esac
1445          ;;
1446     *)   src='.';;
1447     esac;;
1448 esac
1449 case "$src" in
1450 '')     src=/
1451         rsrc=/
1452         ;;
1453 /*) rsrc="$src";;
1454 *) rsrc="../$src";;
1455 esac
1456 if test -f $rsrc/Configure && \
1457         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1458 then
1459    : found it, so we are ok.
1460 else
1461         rsrc=''
1462         for src in . .. ../.. ../../.. ../../../..; do
1463                 if test -f ../$src/Configure && \
1464                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1465                 then
1466                         rsrc=../$src
1467                         break
1468                 fi
1469         done
1470 fi
1471 case "$rsrc" in
1472 '')
1473         cat <<EOM >&4
1474
1475 Sorry, I can't seem to locate the source dir for $package.  Please start
1476 Configure with an explicit path -- i.e. /some/path/Configure.
1477
1478 EOM
1479         exit 1
1480         ;;
1481 ../.)   rsrc='..';;
1482 *)
1483         echo " "
1484         echo "Sources for $package found in \"$src\"." >&4
1485         ;;
1486 esac
1487
1488 : script used to extract .SH files with variable substitutions
1489 cat >extract <<'EOS'
1490 CONFIGDOTSH=true
1491 echo "Doing variable substitutions on .SH files..."
1492 if test -f $src/MANIFEST; then
1493         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1494 else
1495         echo "(Looking for .SH files under the source directory.)"
1496         set x `(cd $src; find . -name "*.SH" -print)`
1497 fi
1498 shift
1499 case $# in
1500 0) set x `(cd $src; echo *.SH)`; shift;;
1501 esac
1502 if test ! -f $src/$1; then
1503         shift
1504 fi
1505 mkdir_p='
1506 name=$1;
1507 create="";
1508 while test $name; do
1509         if test ! -d "$name"; then
1510                 create="$name $create";
1511                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1512                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1513         else
1514                 name="";
1515         fi;
1516 done;
1517 for file in $create; do
1518         mkdir $file;
1519 done
1520 '
1521 for file in $*; do
1522         case "$src" in
1523         ".")
1524                 case "$file" in
1525                 */*)
1526                         dir=`expr X$file : 'X\(.*\)/'`
1527                         file=`expr X$file : 'X.*/\(.*\)'`
1528                         (cd $dir && . ./$file)
1529                         ;;
1530                 *)
1531                         . ./$file
1532                         ;;
1533                 esac
1534                 ;;
1535         *)
1536                 case "$file" in
1537                 */*)
1538                         dir=`expr X$file : 'X\(.*\)/'`
1539                         file=`expr X$file : 'X.*/\(.*\)'`
1540                         (set x $dir; shift; eval $mkdir_p)
1541                         sh <$src/$dir/$file
1542                         ;;
1543                 *)
1544                         sh <$src/$file
1545                         ;;
1546                 esac
1547                 ;;
1548         esac
1549 done
1550 if test -f $src/config_h.SH; then
1551         if test ! -f config.h; then
1552         : oops, they left it out of MANIFEST, probably, so do it anyway.
1553         . $src/config_h.SH
1554         fi
1555 fi
1556 EOS
1557
1558 : extract files and exit if asked to do so
1559 case "$extractsh" in
1560 true)
1561         case "$realsilent" in
1562         true) ;;
1563         *) exec 1>&4;;
1564         esac
1565         case "$config_sh" in
1566         '') config_sh='config.sh';;
1567         esac
1568         echo " "
1569         echo "Fetching answers from $config_sh..."
1570         cd ..
1571         . $config_sh
1572         test "$override" && . ./optdef.sh
1573         echo " "
1574         . UU/extract
1575         rm -rf UU
1576         echo "Done."
1577         exit 0
1578         ;;
1579 esac
1580
1581 : Eunice requires " " instead of "", can you believe it
1582 echo " "
1583 : Here we go...
1584 echo "Beginning of configuration questions for $package."
1585
1586 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1587
1588 : first determine how to suppress newline on echo command
1589 echo " "
1590 echo "Checking echo to see how to suppress newlines..."
1591 (echo "hi there\c" ; echo " ") >.echotmp
1592 if $contains c .echotmp >/dev/null 2>&1 ; then
1593         echo "...using -n."
1594         n='-n'
1595         c=''
1596 else
1597         cat <<'EOM'
1598 ...using \c
1599 EOM
1600         n=''
1601         c='\c'
1602 fi
1603 echo $n "The star should be here-->$c"
1604 echo '*'
1605 rm -f .echotmp
1606
1607 : Now test for existence of everything in MANIFEST
1608 echo " "
1609 if test -f $rsrc/MANIFEST; then
1610         echo "First let's make sure your kit is complete.  Checking..." >&4
1611         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1612         rm -f missing
1613         tmppwd=`pwd`
1614         for filelist in x??; do
1615                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1616         done
1617         if test -s missing; then
1618                 cat missing >&4
1619                 cat >&4 <<'EOM'
1620
1621 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1622
1623 You have the option of continuing the configuration process, despite the
1624 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1625 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1626 and contact the author (perlbug@perl.org).
1627
1628 EOM
1629                 echo $n "Continue? [n] $c" >&4
1630                 read ans
1631                 case "$ans" in
1632                 y*)
1633                         echo "Continuing..." >&4
1634                         rm -f missing
1635                         ;;
1636                 *)
1637                         echo "ABORTING..." >&4
1638                         kill $$
1639                         ;;
1640                 esac
1641         else
1642                 echo "Looks good..."
1643         fi
1644 else
1645         echo "There is no MANIFEST file.  I hope your kit is complete !"
1646 fi
1647 rm -f missing x??
1648
1649 echo " "
1650 : Find the appropriate value for a newline for tr
1651 if test -n "$DJGPP"; then
1652        trnl='\012'
1653 fi
1654 if test X"$trnl" = X; then
1655         case "`echo foo|tr '\n' x 2>/dev/null`" in
1656         foox) trnl='\n' ;;
1657         esac
1658 fi
1659 if test X"$trnl" = X; then
1660         case "`echo foo|tr '\012' x 2>/dev/null`" in
1661         foox) trnl='\012' ;;
1662         esac
1663 fi
1664 if test X"$trnl" = X; then
1665         cat <<EOM >&2
1666
1667 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1668
1669 EOM
1670         exit 1
1671 fi
1672
1673 : compute the number of columns on the terminal for proper question formatting
1674 case "$COLUMNS" in
1675 '') COLUMNS='80';;
1676 esac
1677
1678 : set up the echo used in my read
1679 myecho="case \"\$xxxm\" in
1680 '') echo $n \"\$rp $c\" >&4;;
1681 *) case \"\$rp\" in
1682         '') echo $n \"[\$xxxm] $c\";;
1683         *)
1684                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1685                         echo \"\$rp\" >&4
1686                         echo $n \"[\$xxxm] $c\" >&4
1687                 else
1688                         echo $n \"\$rp [\$xxxm] $c\" >&4
1689                 fi
1690                 ;;
1691         esac;;
1692 esac"
1693
1694 : now set up to do reads with possible shell escape and default assignment
1695 cat <<EOSC >myread
1696 $startsh
1697 xxxm=\$dflt
1698 $myecho
1699 ans='!'
1700 case "\$fastread" in
1701 yes) case "\$dflt" in
1702         '') ;;
1703         *) ans='';
1704                 case "\$silent-\$rp" in
1705                 true-) ;;
1706                 *) echo " " >&4;;
1707                 esac;;
1708         esac;;
1709 *) case "\$silent" in
1710         true) case "\$rp" in
1711                 '') ans='';;
1712                 esac;;
1713         esac;;
1714 esac
1715 while expr "X\$ans" : "X!" >/dev/null; do
1716         read answ
1717         set x \$xxxm
1718         shift
1719         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1720         case  "\$answ" in
1721         "!")
1722                 sh 1>&4
1723                 echo " "
1724                 $myecho
1725                 ;;
1726         !*)
1727                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1728                 shift
1729                 sh 1>&4 -c "\$*"
1730                 echo " "
1731                 $myecho
1732                 ;;
1733         "\$ans")
1734                 case "\$ans" in
1735                 \\&*)
1736                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1737                         shift
1738                         case "\$1" in
1739                         -d)
1740                                 fastread=yes
1741                                 echo "(OK, I'll run with -d after this question.)" >&4
1742                                 ;;
1743                         -*)
1744                                 echo "*** Sorry, \$1 not supported yet." >&4
1745                                 ;;
1746                         esac
1747                         $myecho
1748                         ans=!
1749                         ;;
1750                 esac;;
1751         *)
1752                 case "\$aok" in
1753                 y)
1754                         echo "*** Substitution done -- please confirm."
1755                         xxxm="\$ans"
1756                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1757                         xxxm="\$ans"
1758                         ans=!
1759                         ;;
1760                 *)
1761                         echo "*** Error -- try again."
1762                         ans=!
1763                         ;;
1764                 esac
1765                 $myecho
1766                 ;;
1767         esac
1768         case "\$ans\$xxxm\$nostick" in
1769         '')
1770                 ans=!
1771                 $myecho
1772                 ;;
1773         esac
1774 done
1775 case "\$ans" in
1776 '') ans="\$xxxm";;
1777 esac
1778 EOSC
1779
1780 : create .config dir to save info across Configure sessions
1781 test -d ../.config || mkdir ../.config
1782 cat >../.config/README <<EOF
1783 This directory created by Configure to save information that should
1784 persist across sessions for $package.
1785
1786 You may safely delete it if you wish.
1787 EOF
1788
1789 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1790 case "$usedevel" in
1791 $define|true|[yY]*) ;;
1792 *) case "$xversion" in
1793    *[13579])
1794         cat >&4 <<EOH
1795 *** WHOA THERE!!! ***
1796
1797     This is an UNSTABLE DEVELOPMENT release.
1798     The version of this $package distribution is $xversion, that is, odd,
1799     (as opposed to even) and that signifies a development release.
1800     If you want a maintenance release, you want an even-numbered version.
1801
1802     Do ***NOT*** install this into production use.
1803     Data corruption and crashes are possible.
1804
1805     It is most seriously suggested that you do not continue any further
1806     unless you want to help in developing and debugging Perl.
1807
1808     If you *still* want to build perl, you can answer 'y' now,
1809     or pass -Dusedevel to Configure.
1810
1811 EOH
1812         rp='Do you really want to continue?'
1813         dflt='n'
1814         . ./myread
1815         case "$ans" in
1816         [yY]) echo >&4 "Okay, continuing."
1817               usedevel="$define" ;;
1818         *) echo >&4 "Okay, bye."
1819            exit 1
1820            ;;
1821         esac
1822         ;;
1823     esac
1824     ;;
1825 esac
1826 case "$usedevel" in
1827 $define|true|[yY]*)
1828         case "$versiononly" in
1829         '') versiononly="$define" ;;
1830         esac
1831         case "$installusrbinperl" in
1832         '') installusrbinperl="$undef" ;;
1833         esac
1834         ;;
1835 esac
1836
1837 : general instructions
1838 needman=true
1839 firsttime=true
1840 user=`(logname) 2>/dev/null`
1841 case "$user" in
1842 '') user=`whoami 2>&1`;;
1843 esac
1844 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1845         firsttime=false
1846         echo " "
1847         rp='Would you like to see the instructions?'
1848         dflt=n
1849         . ./myread
1850         case "$ans" in
1851         [yY]*) ;;
1852         *) needman=false;;
1853         esac
1854 fi
1855 if $needman; then
1856         cat <<EOH
1857
1858 This installation shell script will examine your system and ask you questions
1859 to determine how the perl5 package should be installed. If you get
1860 stuck on a question, you may use a ! shell escape to start a subshell or
1861 execute a command.  Many of the questions will have default answers in square
1862 brackets; typing carriage return will give you the default.
1863
1864 On some of the questions which ask for file or directory names you are allowed
1865 to use the ~name construct to specify the login directory belonging to "name",
1866 even if you don't have a shell which knows about that.  Questions where this is
1867 allowed will be marked "(~name ok)".
1868
1869 EOH
1870         rp=''
1871         dflt='Type carriage return to continue'
1872         . ./myread
1873         cat <<'EOH'
1874
1875 The prompter used in this script allows you to use shell variables and
1876 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1877 in the default answer, as if the default line was a set of arguments given to a
1878 script shell.  This means you may also use $* to repeat the whole default line,
1879 so you do not have to re-type everything to add something to the default.
1880
1881 Everytime there is a substitution, you will have to confirm.  If there is an
1882 error (e.g. an unmatched backtick), the default answer will remain unchanged
1883 and you will be prompted again.
1884
1885 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1886 the questions and use the computed defaults (or the previous answers if there
1887 was already a config.sh file). Type 'Configure -h' for a list of options.
1888 You may also start interactively and then answer '& -d' at any prompt to turn
1889 on the non-interactive behaviour for the remainder of the execution.
1890
1891 EOH
1892         . ./myread
1893         cat <<EOH
1894
1895 Much effort has been expended to ensure that this shell script will run on any
1896 Unix system.  If despite that it blows up on yours, your best bet is to edit
1897 Configure and run it again.  If you can't run Configure for some reason,
1898 you'll have to generate a config.sh file by hand.  Whatever problems you
1899 have, let me (perlbug@perl.org) know how I blew it.
1900
1901 This installation script affects things in two ways:
1902
1903 1) it may do direct variable substitutions on some of the files included
1904    in this kit.
1905 2) it builds a config.h file for inclusion in C programs.  You may edit
1906    any of these files as the need arises after running this script.
1907
1908 If you make a mistake on a question, there is no easy way to back up to it
1909 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1910 files.  Configure will offer to let you do this before it runs the SH files.
1911
1912 EOH
1913         dflt='Type carriage return to continue'
1914         . ./myread
1915         case "$firsttime" in
1916         true) echo $user >>../.config/instruct;;
1917         esac
1918 fi
1919
1920 : find out where common programs are
1921 echo " "
1922 echo "Locating common programs..." >&4
1923 cat <<EOSC >loc
1924 $startsh
1925 case \$# in
1926 0) exit 1;;
1927 esac
1928 thing=\$1
1929 shift
1930 dflt=\$1
1931 shift
1932 for dir in \$*; do
1933         case "\$thing" in
1934         .)
1935         if test -d \$dir/\$thing; then
1936                 echo \$dir
1937                 exit 0
1938         fi
1939         ;;
1940         *)
1941         for thisthing in \$dir/\$thing; do
1942                 : just loop through to pick last item
1943         done
1944         if test -f \$thisthing; then
1945                 echo \$thisthing
1946                 exit 0
1947         elif test -f \$dir/\$thing.exe; then
1948                 if test -n "$DJGPP"; then
1949                         echo \$dir/\$thing.exe
1950                 else
1951                         : on Eunice apparently
1952                         echo \$dir/\$thing
1953                 fi
1954                 exit 0
1955         fi
1956         ;;
1957         esac
1958 done
1959 echo \$dflt
1960 exit 1
1961 EOSC
1962 chmod +x loc
1963 $eunicefix loc
1964 loclist="
1965 awk
1966 cat
1967 comm
1968 cp
1969 echo
1970 expr
1971 grep
1972 ls
1973 make
1974 mkdir
1975 rm
1976 sed
1977 sort
1978 touch
1979 tr
1980 uniq
1981 "
1982 trylist="
1983 Mcc
1984 ar
1985 bison
1986 byacc
1987 cpp
1988 csh
1989 date
1990 egrep
1991 gzip
1992 less
1993 ln
1994 more
1995 nm
1996 nroff
1997 pg
1998 test
1999 uname
2000 zip
2001 "
2002 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2003 pth="$pth /lib /usr/lib"
2004 for file in $loclist; do
2005         eval xxx=\$$file
2006         case "$xxx" in
2007         /*|?:[\\/]*)
2008                 if test -f "$xxx"; then
2009                         : ok
2010                 else
2011                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2012                         xxx=`./loc $file $file $pth`
2013                 fi
2014                 ;;
2015         '') xxx=`./loc $file $file $pth`;;
2016         *) xxx=`./loc $xxx $xxx $pth`;;
2017         esac
2018         eval $file=$xxx
2019         eval _$file=$xxx
2020         case "$xxx" in
2021         /*)
2022                 echo $file is in $xxx.
2023                 ;;
2024         ?:[\\/]*)
2025                 echo $file is in $xxx.
2026                 ;;
2027         *)
2028                 echo "I don't know where '$file' is, and my life depends on it." >&4
2029                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2030                 exit 1
2031                 ;;
2032         esac
2033 done
2034 echo " "
2035 echo "Don't worry if any of the following aren't found..."
2036 say=offhand
2037 for file in $trylist; do
2038         eval xxx=\$$file
2039         case "$xxx" in
2040         /*|?:[\\/]*)
2041                 if test -f "$xxx"; then
2042                         : ok
2043                 else
2044                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2045                         xxx=`./loc $file $file $pth`
2046                 fi
2047                 ;;
2048         '') xxx=`./loc $file $file $pth`;;
2049         *) xxx=`./loc $xxx $xxx $pth`;;
2050         esac
2051         eval $file=$xxx
2052         eval _$file=$xxx
2053         case "$xxx" in
2054         /*)
2055                 echo $file is in $xxx.
2056                 ;;
2057         ?:[\\/]*)
2058                 echo $file is in $xxx.
2059                 ;;
2060         *)
2061                 echo "I don't see $file out there, $say."
2062                 say=either
2063                 ;;
2064         esac
2065 done
2066 case "$egrep" in
2067 egrep)
2068         echo "Substituting grep for egrep."
2069         egrep=$grep
2070         ;;
2071 esac
2072 case "$ln" in
2073 ln)
2074         echo "Substituting cp for ln."
2075         ln=$cp
2076         ;;
2077 esac
2078 case "$test" in
2079 test)
2080         echo "Hopefully test is built into your sh."
2081         ;;
2082 *)
2083         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2084                 echo "Using the test built into your sh."
2085                 test=test
2086                 _test=test
2087         fi
2088         ;;
2089 esac
2090 case "$echo" in
2091 echo)
2092         echo "Hopefully echo is built into your sh."
2093         ;;
2094 '') ;;
2095 *)
2096         echo " "
2097 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2098         $echo $n "hi there$c" >foo1
2099         echo $n "hi there$c" >foo2
2100         if cmp foo1 foo2 >/dev/null 2>&1; then
2101                 echo "They are compatible.  In fact, they may be identical."
2102         else
2103                 case "$n" in
2104                 '-n') n='' c='\c';;
2105                 *) n='-n' c='';;
2106                 esac
2107                 cat <<FOO
2108 They are not compatible!  You are probably running ksh on a non-USG system.
2109 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2110 have echo built in and we may have to run some Bourne shell scripts.  That
2111 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2112
2113 FOO
2114                 $echo $n "The star should be here-->$c"
2115                 $echo "*"
2116         fi
2117         $rm -f foo1 foo2
2118         ;;
2119 esac
2120
2121 cat <<EOS >checkcc
2122 $startsh
2123 EOS
2124 cat <<'EOSC' >>checkcc
2125 case "$cc" in
2126 '') ;;
2127 *)  $rm -f try try.*
2128     $cat >try.c <<EOM
2129 int main(int argc, char *argv[]) {
2130   return 0;
2131 }
2132 EOM
2133     if $cc -o try $ccflags try.c; then
2134        :
2135     else
2136         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2137         despair=yes
2138         trygcc=yes
2139         case "$cc" in
2140         *gcc*) trygcc=no ;;
2141         esac
2142         case "`$cc -v -c try.c 2>&1`" in
2143         *gcc*) trygcc=no ;;
2144         esac
2145         if $test X"$trygcc" = Xyes; then
2146             if gcc -o try -c try.c; then
2147                 echo " "
2148                 echo "You seem to have a working gcc, though." >&4
2149                 rp="Would you like to use it?"
2150                 dflt=y
2151                 if $test -f myread; then
2152                     . ./myread
2153                 else
2154                     if $test -f UU/myread; then
2155                         . ./UU/myread
2156                     else
2157                         echo "Cannot find myread, sorry.  Aborting." >&2
2158                         exit 1
2159                     fi
2160                 fi  
2161                 case "$ans" in
2162                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
2163                 esac
2164             fi
2165         fi
2166         if $test X"$despair" = Xyes; then
2167             $cat >&4 <<EOM
2168 You need to find a working C compiler.
2169 Either (purchase and) install the C compiler supplied by your OS vendor,
2170 or for a free C compiler try http://gcc.gnu.org/
2171 I cannot continue any further, aborting.
2172 EOM
2173             exit 1
2174         fi
2175     fi
2176     $rm -f try try.*
2177     ;;
2178 esac
2179 EOSC
2180
2181 : determine whether symbolic links are supported
2182 echo " "
2183 $touch blurfl
2184 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2185         echo "Symbolic links are supported." >&4
2186         lns="$ln -s"
2187 else
2188         echo "Symbolic links are NOT supported." >&4
2189         lns="$ln"
2190 fi
2191 $rm -f blurfl sym
2192
2193 : determine whether symbolic links are supported
2194 echo " "
2195 case "$lns" in
2196 *"ln -s")
2197         echo "Checking how to test for symbolic links..." >&4
2198         $lns blurfl sym
2199         if $test "X$issymlink" = X; then
2200                 sh -c "PATH= test -h sym" >/dev/null 2>&1
2201                 if test $? = 0; then
2202                         issymlink="test -h"
2203                 fi              
2204         fi
2205         if $test "X$issymlink" = X; then
2206                 if  $test -h >/dev/null 2>&1; then
2207                         issymlink="$test -h"
2208                         echo "Your builtin 'test -h' may be broken, I'm using external '$test -h'." >&4
2209                 fi              
2210         fi
2211         if $test "X$issymlink" = X; then
2212                 if $test -L sym 2>/dev/null; then
2213                         issymlink="$test -L"
2214                 fi
2215         fi
2216         if $test "X$issymlink" != X; then
2217                 echo "You can test for symbolic links with '$issymlink'." >&4
2218         else
2219                 echo "I do not know how you can test for symbolic links." >&4
2220         fi
2221         $rm -f blurfl sym
2222         ;;
2223 *)      echo "No symbolic links, so not testing for their testing..." >&4
2224         ;;
2225 esac
2226 echo " "
2227
2228
2229 case "$mksymlinks" in
2230 $define|true|[yY]*)
2231         case "$src" in
2232         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2233                 exit 1
2234                 ;;
2235         *)      case "$lns:$issymlink" in
2236                 *"ln -s:"*"test -"?)
2237                         echo "Creating the symbolic links..." >&4
2238                         echo "(First creating the subdirectories...)" >&4
2239                         cd ..
2240                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2241                                 read directory
2242                                 test -z "$directory" && break
2243                                 mkdir -p $directory
2244                         done
2245                         # Sanity check 1.
2246                         if test ! -d t/base; then
2247                                 echo "Failed to create the subdirectories.  Aborting." >&4
2248                                 exit 1
2249                         fi
2250                         echo "(Then creating the symlinks...)" >&4
2251                         awk '{print $1}' $src/MANIFEST | while true; do
2252                                 read filename
2253                                 test -z "$filename" && break
2254                                 if test -f $filename; then
2255                                         if $issymlink $filename; then
2256                                                 rm -f $filename
2257                                         fi
2258                                 fi
2259                                 if test -f $filename; then
2260                                         echo "$filename already exists, not symlinking."
2261                                 else
2262                                         ln -s $src/$filename $filename
2263                                 fi
2264                         done
2265                         # Sanity check 2.
2266                         if test ! -f t/base/commonsense.t; then
2267                                 echo "Failed to create the symlinks.  Aborting." >&4
2268                                 exit 1
2269                         fi
2270                         cd UU
2271                         ;;
2272                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2273                         ;;
2274                 esac
2275                 ;;
2276         esac
2277         ;;
2278 esac
2279
2280 : see whether [:lower:] and [:upper:] are supported character classes
2281 echo " "
2282 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2283 ABYZ)
2284         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2285         up='[:upper:]'
2286         low='[:lower:]'
2287         ;;
2288 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2289         # (0xc9 and 0xd1), therefore that is a nice testing point.
2290         if test "X$up" = X -o "X$low" = X; then
2291             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2292             ij) up='[A-Z]'
2293                 low='[a-z]'
2294                 ;;
2295             esac
2296         fi
2297         if test "X$up" = X -o "X$low" = X; then
2298             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2299             ij) up='A-Z'
2300                 low='a-z'
2301                 ;;
2302             esac
2303         fi
2304         if test "X$up" = X -o "X$low" = X; then
2305             case "`echo IJ | od -x 2>/dev/null`" in
2306             *C9D1*|*c9d1*)
2307                 echo "Hey, this might be EBCDIC." >&4
2308                 if test "X$up" = X -o "X$low" = X; then
2309                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2310                     ij) up='[A-IJ-RS-Z]'
2311                         low='[a-ij-rs-z]'
2312                         ;;
2313                     esac
2314                 fi
2315                 if test "X$up" = X -o "X$low" = X; then
2316                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2317                     ij) up='A-IJ-RS-Z'
2318                         low='a-ij-rs-z'
2319                         ;;
2320                     esac
2321                 fi
2322                 ;;
2323             esac
2324         fi
2325 esac
2326 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2327 ij)
2328     echo "Using $up and $low to convert case." >&4
2329     ;;
2330 *)
2331     echo "I don't know how to translate letters from upper to lower case." >&4
2332     echo "Your tr is not acting any way I know of." >&4
2333     exit 1
2334     ;;
2335 esac
2336 : set up the translation script tr, must be called with ./tr of course
2337 cat >tr <<EOSC
2338 $startsh
2339 case "\$1\$2" in
2340 '[A-Z][a-z]') exec $tr '$up' '$low';;
2341 '[a-z][A-Z]') exec $tr '$low' '$up';;
2342 esac
2343 exec $tr "\$@"
2344 EOSC
2345 chmod +x tr
2346 $eunicefix tr
2347
2348 : Try to determine whether config.sh was made on this system
2349 case "$config_sh" in
2350 '')
2351 myuname=`$uname -a 2>/dev/null`
2352 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2353 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2354 # because the A-Z/a-z are not consecutive.
2355 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2356         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2357 newmyuname="$myuname"
2358 dflt=n
2359 case "$knowitall" in
2360 '')
2361         if test -f ../config.sh; then
2362                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2363                         eval "`grep myuname= ../config.sh`"
2364                 fi
2365                 if test "X$myuname" = "X$newmyuname"; then
2366                         dflt=y
2367                 fi
2368         fi
2369         ;;
2370 *) dflt=y;;
2371 esac
2372
2373 : Get old answers from old config file if Configure was run on the
2374 : same system, otherwise use the hints.
2375 hint=default
2376 cd ..
2377 if test -f config.sh; then
2378         echo " "
2379         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2380         . UU/myread
2381         case "$ans" in
2382         n*|N*) echo "OK, I'll ignore it."
2383                 mv config.sh config.sh.old
2384                 myuname="$newmyuname"
2385                 ;;
2386         *)  echo "Fetching default answers from your old config.sh file..." >&4
2387                 tmp_n="$n"
2388                 tmp_c="$c"
2389                 tmp_sh="$sh"
2390                 . ./config.sh
2391                 cp config.sh UU
2392                 n="$tmp_n"
2393                 c="$tmp_c"
2394                 : Older versions did not always set $sh.  Catch re-use of such
2395                 : an old config.sh.
2396                 case "$sh" in
2397                 '') sh="$tmp_sh" ;;
2398                 esac
2399                 hint=previous
2400                 ;;
2401         esac
2402 fi
2403 . ./UU/checkcc
2404 if test ! -f config.sh; then
2405         $cat <<EOM
2406
2407 First time through, eh?  I have some defaults handy for some systems
2408 that need some extra help getting the Configure answers right:
2409
2410 EOM
2411         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2412         dflt=''
2413         : Half the following guesses are probably wrong... If you have better
2414         : tests or hints, please send them to perlbug@perl.org
2415         : The metaconfig authors would also appreciate a copy...
2416         $test -f /irix && osname=irix
2417         $test -f /xenix && osname=sco_xenix
2418         $test -f /dynix && osname=dynix
2419         $test -f /dnix && osname=dnix
2420         $test -f /lynx.os && osname=lynxos
2421         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2422         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
2423         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2424         $test -f /bin/mips && /bin/mips && osname=mips
2425         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2426                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2427         $test -d /usr/apollo/bin && osname=apollo
2428         $test -f /etc/saf/_sactab && osname=svr4
2429         $test -d /usr/include/minix && osname=minix
2430         if $test -d /MachTen -o -d /MachTen_Folder; then
2431                 osname=machten
2432                 if $test -x /sbin/version; then
2433                         osvers=`/sbin/version | $awk '{print $2}' |
2434                         $sed -e 's/[A-Za-z]$//'`
2435                 elif $test -x /usr/etc/version; then
2436                         osvers=`/usr/etc/version | $awk '{print $2}' |
2437                         $sed -e 's/[A-Za-z]$//'`
2438                 else
2439                         osvers="$2.$3"
2440                 fi
2441         fi
2442
2443         $test -f /sys/posix.dll &&
2444                 $test -f /usr/bin/what &&
2445                 set X `/usr/bin/what /sys/posix.dll` &&
2446                 $test "$3" = UWIN &&
2447                 osname=uwin &&
2448                 osvers="$5"
2449
2450         if $test -f $uname; then
2451                 set X $myuname
2452                 shift
2453
2454                 case "$5" in
2455                 fps*) osname=fps ;;
2456                 mips*)
2457                         case "$4" in
2458                         umips) osname=umips ;;
2459                         *) osname=mips ;;
2460                         esac;;
2461                 [23]100) osname=mips ;;
2462                 next*) osname=next ;;
2463                 i386*)
2464                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2465                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2466                                 osname='sco'
2467                                 osvers=$tmp
2468                         elif $test -f /etc/kconfig; then
2469                                 osname=isc
2470                                 if test "$lns" = "$ln -s"; then
2471                                         osvers=4
2472                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2473                                         osvers=3
2474                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2475                                         osvers=2
2476                                 fi
2477                         fi
2478                         tmp=''
2479                         ;;
2480                 pc*)
2481                         if test -n "$DJGPP"; then
2482                                 osname=dos
2483                                 osvers=djgpp
2484                         fi
2485                         ;;
2486                 esac
2487
2488                 case "$1" in
2489                 aix) osname=aix
2490                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2491                         case "$tmp" in
2492                         'not found') osvers="$4"."$3" ;;
2493                         '<3240'|'<>3240') osvers=3.2.0 ;;
2494                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2495                         '=3250'|'>3250') osvers=3.2.5 ;;
2496                         *) osvers=$tmp;;
2497                         esac
2498                         ;;
2499                 bsd386) osname=bsd386
2500                         osvers=`$uname -r`
2501                         ;;
2502                 cygwin*) osname=cygwin
2503                         osvers="$3"
2504                         ;;
2505                 *dc.osx) osname=dcosx
2506                         osvers="$3"
2507                         ;;
2508                 dnix) osname=dnix
2509                         osvers="$3"
2510                         ;;
2511                 domainos) osname=apollo
2512                         osvers="$3"
2513                         ;;
2514                 dgux) osname=dgux 
2515                         osvers="$3"
2516                         ;;
2517                 dynixptx*) osname=dynixptx
2518                         osvers=`echo "$4"|sed 's/^v//'`
2519                         ;;
2520                 freebsd) osname=freebsd 
2521                         osvers="$3" ;;
2522                 genix) osname=genix ;;
2523                 hp*) osname=hpux 
2524                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2525                         ;;
2526                 irix*) osname=irix
2527                         case "$3" in
2528                         4*) osvers=4 ;;
2529                         5*) osvers=5 ;;
2530                         *)      osvers="$3" ;;
2531                         esac
2532                         ;;
2533                 linux) osname=linux
2534                         case "$3" in
2535                         *)      osvers="$3" ;;
2536                         esac
2537                         ;;
2538                 MiNT) osname=mint
2539                         ;;
2540                 netbsd*) osname=netbsd
2541                         osvers="$3"
2542                         ;;
2543                 news-os) osvers="$3"
2544                         case "$3" in
2545                         4*) osname=newsos4 ;;
2546                         *) osname=newsos ;;
2547                         esac
2548                         ;;
2549                 next*) osname=next ;;
2550                 nonstop-ux) osname=nonstopux ;;
2551                 POSIX-BC | posix-bc ) osname=posix-bc
2552                         osvers="$3"
2553                         ;;
2554                 powerux | power_ux | powermax_os | powermaxos | \
2555                 powerunix | power_unix) osname=powerux
2556                         osvers="$3"
2557                         ;;
2558                 qnx) osname=qnx
2559                         osvers="$4"
2560                         ;;
2561                 solaris) osname=solaris
2562                         case "$3" in
2563                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2564                         *)      osvers="$3" ;;
2565                         esac
2566                         ;;
2567                 sunos) osname=sunos
2568                         case "$3" in
2569                         5*) osname=solaris
2570                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2571                         *)      osvers="$3" ;;
2572                         esac
2573                         ;;
2574                 titanos) osname=titanos
2575                         case "$3" in
2576                         1*) osvers=1 ;;
2577                         2*) osvers=2 ;;
2578                         3*) osvers=3 ;;
2579                         4*) osvers=4 ;;
2580                         *)      osvers="$3" ;;
2581                         esac
2582                         ;;
2583                 ultrix) osname=ultrix
2584                         osvers="$3"
2585                         ;;
2586                 osf1|mls+)      case "$5" in
2587                                 alpha)
2588                                         osname=dec_osf
2589                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2590                                         case "$osvers" in
2591                                         [1-9].[0-9]*) ;;
2592                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2593                                         esac
2594                                         ;;
2595                         hp*)    osname=hp_osf1  ;;
2596                         mips)   osname=mips_osf1 ;;
2597                         esac
2598                         ;;
2599                 unixware) osname=svr5
2600                         osvers="$4"
2601                         ;;
2602                 uts) osname=uts
2603                         osvers="$3"
2604                         ;;
2605                 $2) case "$osname" in
2606                         *isc*) ;;
2607                         *freebsd*) ;;
2608                         svr*)
2609                                 : svr4.x or possibly later
2610                                 case "svr$3" in 
2611                                 ${osname}*)
2612                                         osname=svr$3
2613                                         osvers=$4
2614                                         ;;
2615                                 esac
2616                                 case "$osname" in
2617                                 svr4.0)
2618                                         : Check for ESIX
2619                                         if test -f /stand/boot ; then
2620                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2621                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2622                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2623                                                         if test -n "$isesix"; then
2624                                                                 osname=esix4
2625                                                         fi
2626                                                 fi
2627                                         fi
2628                                         ;;
2629                                 esac
2630                                 ;;
2631                         *)      if test -f /etc/systemid; then
2632                                         osname=sco
2633                                         set `echo $3 | $sed 's/\./ /g'` $4
2634                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2635                                                 osvers=$1.$2.$3
2636                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2637                                                 osvers=$1.$2
2638                                         elif $test -f $src/hints/sco_$1.sh; then
2639                                                 osvers=$1
2640                                         fi
2641                                 else
2642                                         case "$osname" in
2643                                         '') : Still unknown.  Probably a generic Sys V.
2644                                                 osname="sysv"
2645                                                 osvers="$3"
2646                                                 ;;
2647                                         esac
2648                                 fi
2649                                 ;;
2650                         esac
2651                         ;;
2652                 *)      case "$osname" in
2653                         '') : Still unknown.  Probably a generic BSD.
2654                                 osname="$1"
2655                                 osvers="$3"
2656                                 ;;
2657                         esac
2658                         ;;
2659                 esac
2660         else
2661                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2662                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2663                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2664                                 osname=news_os
2665                         fi
2666                         $rm -f UU/kernel.what
2667                 elif test -d c:/.; then
2668                         set X $myuname
2669                         osname=os2
2670                         osvers="$5"
2671                 fi
2672         fi
2673         
2674         : Now look for a hint file osname_osvers, unless one has been
2675         : specified already.
2676         case "$hintfile" in
2677         ''|' ')
2678                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
2679                 : Also try without trailing minor version numbers.
2680                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
2681                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
2682                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
2683                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
2684                 case "$file" in
2685                 '') dflt=none ;;
2686                 *)  case "$osvers" in
2687                         '') dflt=$file
2688                                 ;;
2689                         *)  if $test -f $src/hints/$file.sh ; then
2690                                         dflt=$file
2691                                 elif $test -f $src/hints/$xfile.sh ; then
2692                                         dflt=$xfile
2693                                 elif $test -f $src/hints/$xxfile.sh ; then
2694                                         dflt=$xxfile
2695                                 elif $test -f $src/hints/$xxxfile.sh ; then
2696                                         dflt=$xxxfile
2697                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2698                                         dflt=$xxxxfile
2699                                 elif $test -f "$src/hints/${osname}.sh" ; then
2700                                         dflt="${osname}"
2701                                 else
2702                                         dflt=none
2703                                 fi
2704                                 ;;
2705                         esac
2706                         ;;
2707                 esac
2708                 if $test -f Policy.sh ; then
2709                         case "$dflt" in
2710                         *Policy*) ;;
2711                         none) dflt="Policy" ;;
2712                         *) dflt="Policy $dflt" ;;
2713                         esac
2714                 fi
2715                 ;;
2716         *)
2717                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2718                 ;;
2719         esac
2720
2721         if $test -f Policy.sh ; then
2722                 $cat <<EOM
2723
2724 There's also a Policy hint file available, which should make the
2725 site-specific (policy) questions easier to answer.
2726 EOM
2727
2728         fi
2729
2730         $cat <<EOM
2731
2732 You may give one or more space-separated answers, or "none" if appropriate.
2733 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2734 is a good thing.  DO NOT give a wrong version or a wrong OS.
2735
2736 EOM
2737
2738         rp="Which of these apply, if any?"
2739         . UU/myread
2740         tans=$ans
2741         for file in $tans; do
2742                 if $test X$file = XPolicy -a -f Policy.sh; then
2743                         . Policy.sh
2744                         $cat Policy.sh >> UU/config.sh
2745                 elif $test -f $src/hints/$file.sh; then
2746                         . $src/hints/$file.sh
2747                         $cat $src/hints/$file.sh >> UU/config.sh
2748                 elif $test X$tans = X -o X$tans = Xnone ; then
2749                         : nothing
2750                 else
2751                         : Give one chance to correct a possible typo.
2752                         echo "$file.sh does not exist"
2753                         dflt=$file
2754                         rp="hint to use instead?"
2755                         . UU/myread
2756                         for file in $ans; do
2757                                 if $test -f "$src/hints/$file.sh"; then
2758                                         . $src/hints/$file.sh
2759                                         $cat $src/hints/$file.sh >> UU/config.sh
2760                                 elif $test X$ans = X -o X$ans = Xnone ; then
2761                                         : nothing
2762                                 else
2763                                         echo "$file.sh does not exist -- ignored."
2764                                 fi
2765                         done
2766                 fi
2767         done
2768
2769         hint=recommended
2770         : Remember our hint file for later.
2771         if $test -f "$src/hints/$file.sh" ; then
2772                 hintfile="$file"
2773         else
2774                 hintfile=''
2775         fi
2776 fi
2777 cd UU
2778 ;;
2779 *)
2780         echo " "
2781         echo "Fetching default answers from $config_sh..." >&4
2782         tmp_n="$n"
2783         tmp_c="$c"
2784         cd ..
2785         cp $config_sh config.sh 2>/dev/null
2786         chmod +w config.sh
2787         . ./config.sh
2788         cd UU
2789         cp ../config.sh .
2790         n="$tmp_n"
2791         c="$tmp_c"
2792         hint=previous
2793         ;;
2794 esac
2795 test "$override" && . ./optdef.sh
2796
2797 : Restore computed paths
2798 for file in $loclist $trylist; do
2799         eval $file="\$_$file"
2800 done
2801
2802 cat << EOM
2803
2804 Configure uses the operating system name and version to set some defaults.
2805 The default value is probably right if the name rings a bell. Otherwise,
2806 since spelling matters for me, either accept the default or answer "none"
2807 to leave it blank.
2808
2809 EOM
2810 case "$osname" in
2811         ''|' ')
2812                 case "$hintfile" in
2813                 ''|' '|none) dflt=none ;;
2814                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2815                 esac
2816                 ;;
2817         *) dflt="$osname" ;;
2818 esac
2819 rp="Operating system name?"
2820 . ./myread
2821 case "$ans" in
2822 none)  osname='' ;;
2823 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2824 esac
2825 echo " "
2826 case "$osvers" in
2827         ''|' ')
2828                 case "$hintfile" in
2829                 ''|' '|none) dflt=none ;;
2830                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2831                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2832                         case "$dflt" in
2833                         ''|' ') dflt=none ;;
2834                         esac
2835                         ;;
2836                 esac
2837                 ;;
2838         *) dflt="$osvers" ;;
2839 esac
2840 rp="Operating system version?"
2841 . ./myread
2842 case "$ans" in
2843 none)  osvers='' ;;
2844 *) osvers="$ans" ;;
2845 esac
2846
2847
2848 . ./posthint.sh
2849
2850 : who configured the system
2851 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2852 cf_by=`(logname) 2>/dev/null`
2853 case "$cf_by" in
2854 "")
2855         cf_by=`(whoami) 2>/dev/null`
2856         case "$cf_by" in
2857         "") cf_by=unknown ;;
2858         esac ;;
2859 esac
2860
2861 : set up the script used to warn in case of inconsistency
2862 cat <<EOS >whoa
2863 $startsh
2864 EOS
2865 cat <<'EOSC' >>whoa
2866 dflt=y
2867 echo " "
2868 echo "*** WHOA THERE!!! ***" >&4
2869 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2870 rp="    Keep the $hint value?"
2871 . ./myread
2872 case "$ans" in
2873 y) td=$was; tu=$was;;
2874 esac
2875 EOSC
2876
2877 : function used to set $1 to $val
2878 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2879 case "$val$was" in
2880 $define$undef) . ./whoa; eval "$var=\$td";;
2881 $undef$define) . ./whoa; eval "$var=\$tu";;
2882 *) eval "$var=$val";;
2883 esac'
2884
2885 case "$usethreads" in
2886 $define|true|[yY]*)     dflt='y';;
2887 *) dflt='n';;
2888 esac
2889 cat <<EOM
2890
2891 Perl can be built to take advantage of threads on some systems.
2892 To do so, Configure can be run with -Dusethreads.
2893
2894 Note that threading is a highly experimental feature, and
2895 some known race conditions still remain.  If you choose to try
2896 it, be very sure to not actually deploy it for production
2897 purposes.  README.threads has more details, and is required
2898 reading if you enable threads.
2899
2900 If this doesn't make any sense to you, just accept the default '$dflt'.
2901 EOM
2902 rp='Build a threading Perl?'
2903 . ./myread
2904 case "$ans" in
2905 y|Y)    val="$define" ;;
2906 *)      val="$undef" ;;
2907 esac
2908 set usethreads
2909 eval $setvar
2910
2911 case "$usethreads" in
2912 $define)
2913         $cat <<EOM
2914
2915 As of 5.5.640, Perl has two different internal threading implementations,
2916 the 5.005 version (5005threads) and an interpreter-based version
2917 (ithreads) that has one interpreter per thread.  Both are very 
2918 experimental.  This arrangement exists to help developers work out
2919 which one is better.
2920
2921 If you're a casual user, you probably don't want interpreter-threads
2922 at this time.  There doesn't yet exist a way to create threads from
2923 within Perl in this model, i.e., "use Thread;" will NOT work.
2924 EOM
2925         : Default to ithreads unless overridden on command line or with
2926         : old config.sh
2927         dflt='y'
2928         case "$use5005threads" in
2929                 $define|true|[yY]*) dflt='n';;
2930         esac
2931         case "$useithreads" in
2932                 $undef|false|[nN]*) dflt='n';;
2933         esac
2934         rp='Use interpreter-based ithreads?'
2935         . ./myread
2936         case "$ans" in
2937         y|Y)    val="$define" ;;
2938         *)      val="$undef" ;;
2939         esac
2940         set useithreads
2941         eval $setvar
2942         : Now set use5005threads to the opposite value.
2943         case "$useithreads" in
2944         $define) val="$undef" ;;
2945         *) val="$define" ;;
2946         esac
2947         set use5005threads
2948         eval $setvar
2949         ;;
2950 *)
2951         useithreads="$undef"
2952         use5005threads="$undef"
2953         ;;
2954 esac
2955
2956 case "$useithreads$use5005threads" in
2957 "$define$define")
2958         $cat >&4 <<EOM
2959
2960 You cannot have both the ithreads and the 5.005 threads enabled
2961 at the same time.  Disabling the 5.005 threads since they are
2962 much less stable than the ithreads.
2963
2964 EOM
2965         use5005threads="$undef"
2966         ;;
2967 esac
2968
2969 case "$d_oldpthreads" in
2970 '')     : Configure tests would be welcome here.  For now, assume undef.
2971         val="$undef" ;;
2972 *)      val="$d_oldpthreads" ;;
2973 esac
2974 set d_oldpthreads
2975 eval $setvar
2976
2977
2978 case "$usethreads" in
2979 "$define"|true|[yY]*)
2980 : Look for a hint-file generated 'call-back-unit'.  If the
2981 : user has specified that a threading perl is to be built,
2982 : we may need to set or change some other defaults.
2983         if $test -f usethreads.cbu; then
2984                 echo "Your platform has some specific hints for threaded builds, using them..."
2985                 . ./usethreads.cbu
2986         else
2987                 $cat <<EOM
2988 (Your platform doesn't have any specific hints for threaded builds.
2989  Assuming POSIX threads, then.)
2990 EOM
2991         fi
2992         ;;
2993 esac
2994
2995 cat <<EOM
2996
2997 Perl can be built so that multiple Perl interpreters can coexist
2998 within the same Perl executable.
2999 EOM
3000
3001 case "$useithreads" in
3002 $define)
3003         cat <<EOM
3004 This multiple interpreter support is required for interpreter-based threads.
3005 EOM
3006         val="$define"
3007         ;;
3008 *)      case "$usemultiplicity" in
3009         $define|true|[yY]*)     dflt='y';;
3010         *) dflt='n';;
3011         esac
3012         echo " "
3013         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3014         rp='Build Perl for multiplicity?'
3015         . ./myread
3016         case "$ans" in
3017         y|Y)    val="$define" ;;
3018         *)      val="$undef" ;;
3019         esac
3020         ;;
3021 esac
3022 set usemultiplicity
3023 eval $setvar
3024
3025 : make some quick guesses about what we are up against
3026 echo " "
3027 $echo $n "Hmm...  $c"
3028 echo exit 1 >bsd
3029 echo exit 1 >usg
3030 echo exit 1 >v7
3031 echo exit 1 >osf1
3032 echo exit 1 >eunice
3033 echo exit 1 >xenix
3034 echo exit 1 >venix
3035 echo exit 1 >os2
3036 d_bsd="$undef"
3037 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3038 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3039 then
3040         echo "Looks kind of like an OSF/1 system, but we'll see..."
3041         echo exit 0 >osf1
3042 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3043         xxx=`./loc addbib blurfl $pth`
3044         if $test -f $xxx; then
3045         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3046                 echo exit 0 >bsd
3047                 echo exit 0 >usg
3048         else
3049                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3050                         echo "Looks kind of like an extended USG system, but we'll see..."
3051                 else
3052                         echo "Looks kind of like a USG system, but we'll see..."
3053                 fi
3054                 echo exit 0 >usg
3055         fi
3056 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3057         echo "Looks kind of like a BSD system, but we'll see..."
3058         d_bsd="$define"
3059         echo exit 0 >bsd
3060 else
3061         echo "Looks kind of like a Version 7 system, but we'll see..."
3062         echo exit 0 >v7
3063 fi
3064 case "$eunicefix" in
3065 *unixtovms*)
3066         $cat <<'EOI'
3067 There is, however, a strange, musty smell in the air that reminds me of
3068 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3069 EOI
3070         echo exit 0 >eunice
3071         d_eunice="$define"
3072 : it so happens the Eunice I know will not run shell scripts in Unix format
3073         ;;
3074 *)
3075         echo " "
3076         echo "Congratulations.  You aren't running Eunice."
3077         d_eunice="$undef"
3078         ;;
3079 esac
3080 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3081 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3082 : semicolon as a patch separator
3083 case "$p_" in
3084 :) ;;
3085 *)
3086         $cat <<'EOI'
3087 I have the feeling something is not exactly right, however...don't tell me...
3088 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3089 (Or you may be running DOS with DJGPP.)
3090 EOI
3091         echo exit 0 >os2
3092         ;;
3093 esac
3094 if test -f /xenix; then
3095         echo "Actually, this looks more like a XENIX system..."
3096         echo exit 0 >xenix
3097         d_xenix="$define"
3098 else
3099         echo " "
3100         echo "It's not Xenix..."
3101         d_xenix="$undef"
3102 fi
3103 chmod +x xenix
3104 $eunicefix xenix
3105 if test -f /venix; then
3106         echo "Actually, this looks more like a VENIX system..."
3107         echo exit 0 >venix
3108 else
3109         echo " "
3110         if ./xenix; then
3111                 : null
3112         else
3113                 echo "Nor is it Venix..."
3114         fi
3115 fi
3116 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3117 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3118 $rm -f foo
3119
3120 case "$cc" in
3121 '') dflt=cc;;
3122 *) dflt="$cc";;
3123 esac
3124 rp="Use which C compiler?"
3125 . ./myread
3126 cc="$ans"
3127 : Look for a hint-file generated 'call-back-unit'.  Now that the
3128 : user has specified the compiler, we may need to set or change some
3129 : other defaults.
3130 if $test -f cc.cbu; then
3131     . ./cc.cbu
3132 fi
3133 . ./checkcc
3134
3135 echo " "
3136 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3137 $cat >gccvers.c <<EOM
3138 #include <stdio.h>
3139 int main() {
3140 #ifdef __GNUC__
3141 #ifdef __VERSION__
3142         printf("%s\n", __VERSION__);
3143 #else
3144         printf("%s\n", "1");
3145 #endif
3146 #endif
3147         exit(0);
3148 }
3149 EOM
3150 if $cc -o gccvers $ccflags $ldflags gccvers.c; then
3151         gccversion=`./gccvers`
3152         case "$gccversion" in
3153         '') echo "You are not using GNU cc." ;;
3154         *)  echo "You are using GNU cc $gccversion."
3155             ccname=gcc  
3156             ;;
3157         esac
3158 else
3159         echo " "
3160         echo "*** WHOA THERE!!! ***" >&4
3161         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3162         case "$knowitall" in
3163         '')
3164         echo "    You'd better start hunting for one and let me know about it." >&4
3165                 exit 1
3166                 ;;
3167         esac
3168 fi
3169 $rm -f gccvers*
3170 case "$gccversion" in
3171 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3172 esac
3173 case "$gccversion" in
3174 '') gccosandvers='' ;;
3175 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3176    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3177    gccshortvers=''
3178    case "$gccosandvers" in
3179    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3180    $osname$osvers) ;; # looking good
3181    $osname*) cat <<EOM >&4
3182
3183 *** WHOA THERE!!! ***
3184
3185     Your gcc has not been compiled for the exact release of
3186     your operating system ($gccosandvers versus $osname$osvers).
3187
3188     In general it is a good idea to keep gcc synchronized with
3189     the operating system because otherwise serious problems
3190     may ensue when trying to compile software, like Perl.
3191
3192     I'm trying to be optimistic here, though, and will continue.
3193     If later during the configuration and build icky compilation
3194     problems appear (headerfile conflicts being the most common
3195     manifestation), I suggest reinstalling the gcc to match
3196     your operating system release.
3197
3198 EOM
3199       ;;
3200    *) gccosandvers='' ;; # failed to parse, better be silent
3201    esac
3202    ;;
3203 esac
3204 case "$ccname" in
3205 '') ccname="$cc" ;;
3206 esac
3207
3208 : see how we invoke the C preprocessor
3209 echo " "
3210 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3211 cat <<'EOT' >testcpp.c
3212 #define ABC abc
3213 #define XYZ xyz
3214 ABC.XYZ
3215 EOT
3216 cd ..
3217 if test ! -f cppstdin; then
3218         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3219                 # AIX cc -E doesn't show the absolute headerfile
3220                 # locations but we'll cheat by using the -M flag.
3221                 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
3222         else
3223                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3224         fi
3225 else
3226         echo "Keeping your $hint cppstdin wrapper."
3227 fi
3228 chmod 755 cppstdin
3229 wrapper=`pwd`/cppstdin
3230 ok='false'
3231 cd UU
3232
3233 if $test "X$cppstdin" != "X" && \
3234         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3235         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3236 then
3237         echo "You used to use $cppstdin $cppminus so we'll use that again."
3238         case "$cpprun" in
3239         '') echo "But let's see if we can live without a wrapper..." ;;
3240         *)
3241                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3242                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3243                 then
3244                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3245                         ok='true'
3246                 else
3247                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3248                 fi
3249                 ;;
3250         esac
3251 else
3252         case "$cppstdin" in
3253         '') ;;
3254         *)
3255                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3256                 ;;
3257         esac
3258 fi
3259
3260 if $ok; then
3261         : nothing
3262 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3263         $cc -E <testcpp.c >testcpp.out 2>&1; \
3264         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3265         echo "Yup, it does."
3266         x_cpp="$cc -E"
3267         x_minus='';
3268 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3269         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3270         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3271         echo "Yup, it does."
3272         x_cpp="$cc -E"
3273         x_minus='-';
3274 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3275         $cc -P <testcpp.c >testcpp.out 2>&1; \
3276         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3277         echo "Yipee, that works!"
3278         x_cpp="$cc -P"
3279         x_minus='';
3280 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3281         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3282         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3283         echo "At long last!"
3284         x_cpp="$cc -P"
3285         x_minus='-';
3286 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3287         $cpp <testcpp.c >testcpp.out 2>&1; \
3288         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3289         echo "It works!"
3290         x_cpp="$cpp"
3291         x_minus='';
3292 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3293         $cpp - <testcpp.c >testcpp.out 2>&1; \
3294         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3295         echo "Hooray, it works!  I was beginning to wonder."
3296         x_cpp="$cpp"
3297         x_minus='-';
3298 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3299         $wrapper <testcpp.c >testcpp.out 2>&1; \
3300         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3301         x_cpp="$wrapper"
3302         x_minus=''
3303         echo "Eureka!"
3304 else
3305         dflt=''
3306         rp="No dice.  I can't find a C preprocessor.  Name one:"
3307         . ./myread
3308         x_cpp="$ans"
3309         x_minus=''
3310         $x_cpp <testcpp.c >testcpp.out 2>&1
3311         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3312                 echo "OK, that will do." >&4
3313         else
3314 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3315                 exit 1
3316         fi
3317 fi
3318
3319 case "$ok" in
3320 false)
3321         cppstdin="$x_cpp"
3322         cppminus="$x_minus"
3323         cpprun="$x_cpp"
3324         cpplast="$x_minus"
3325         set X $x_cpp
3326         shift
3327         case "$1" in
3328         "$cpp")
3329                 echo "Perhaps can we force $cc -E using a wrapper..."
3330                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3331                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3332                 then
3333                         echo "Yup, we can."
3334                         cppstdin="$wrapper"
3335                         cppminus='';
3336                 else
3337                         echo "Nope, we'll have to live without it..."
3338                 fi
3339                 ;;
3340         esac
3341         case "$cpprun" in
3342         "$wrapper")
3343                 cpprun=''
3344                 cpplast=''
3345                 ;;
3346         esac
3347         ;;
3348 esac
3349
3350 case "$cppstdin" in
3351 "$wrapper"|'cppstdin') ;;
3352 *) $rm -f $wrapper;;
3353 esac
3354 $rm -f testcpp.c testcpp.out
3355
3356 : decide how portable to be.  Allow command line overrides.
3357 case "$d_portable" in
3358 "$undef") ;;
3359 *)      d_portable="$define" ;;
3360 esac
3361
3362 : set up shell script to do ~ expansion
3363 cat >filexp <<EOSS
3364 $startsh
3365 : expand filename
3366 case "\$1" in
3367  ~/*|~)
3368         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3369         ;;
3370  ~*)
3371         if $test -f /bin/csh; then
3372                 /bin/csh -f -c "glob \$1"
3373                 failed=\$?
3374                 echo ""
3375                 exit \$failed
3376         else
3377                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3378                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3379                 if $test ! -d "\$dir"; then
3380                         me=\`basename \$0\`
3381                         echo "\$me: can't locate home directory for: \$name" >&2
3382                         exit 1
3383                 fi
3384                 case "\$1" in
3385                 */*)
3386                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3387                         ;;
3388                 *)
3389                         echo \$dir
3390                         ;;
3391                 esac
3392         fi
3393         ;;
3394 *)
3395         echo \$1
3396         ;;
3397 esac
3398 EOSS
3399 chmod +x filexp
3400 $eunicefix filexp
3401
3402 : now set up to get a file name
3403 cat <<EOS >getfile
3404 $startsh
3405 EOS
3406 cat <<'EOSC' >>getfile
3407 tilde=''
3408 fullpath=''
3409 already=''
3410 skip=''
3411 none_ok=''
3412 exp_file=''
3413 nopath_ok=''
3414 orig_rp="$rp"
3415 orig_dflt="$dflt"
3416 case "$gfpth" in
3417 '') gfpth='.' ;;
3418 esac
3419
3420 case "$fn" in
3421 *\(*)
3422         expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3423         fn=`echo $fn | sed 's/(.*)//'`
3424         ;;
3425 esac
3426
3427 case "$fn" in
3428 *:*)
3429         loc_file=`expr $fn : '.*:\(.*\)'`
3430         fn=`expr $fn : '\(.*\):.*'`
3431         ;;
3432 esac
3433
3434 case "$fn" in
3435 *~*) tilde=true;;
3436 esac
3437 case "$fn" in
3438 */*) fullpath=true;;
3439 esac
3440 case "$fn" in
3441 *+*) skip=true;;
3442 esac
3443 case "$fn" in
3444 *n*) none_ok=true;;
3445 esac
3446 case "$fn" in
3447 *e*) exp_file=true;;
3448 esac
3449 case "$fn" in
3450 *p*) nopath_ok=true;;
3451 esac
3452
3453 case "$fn" in
3454 *f*) type='File';;
3455 *d*) type='Directory';;
3456 *l*) type='Locate';;
3457 esac
3458
3459 what="$type"
3460 case "$what" in
3461 Locate) what='File';;
3462 esac
3463
3464 case "$exp_file" in
3465 '')
3466         case "$d_portable" in
3467         "$define") ;;
3468         *) exp_file=true;;
3469         esac
3470         ;;
3471 esac
3472
3473 cd ..
3474 while test "$type"; do
3475         redo=''
3476         rp="$orig_rp"
3477         dflt="$orig_dflt"
3478         case "$tilde" in
3479         true) rp="$rp (~name ok)";;
3480         esac
3481         . UU/myread
3482         if test -f UU/getfile.ok && \
3483                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3484         then
3485                 value="$ans"
3486                 ansexp="$ans"
3487                 break
3488         fi
3489         case "$ans" in
3490         none)
3491                 value=''
3492                 ansexp=''
3493                 case "$none_ok" in
3494                 true) type='';;
3495                 esac
3496                 ;;
3497         *)
3498                 case "$tilde" in
3499                 '') value="$ans"
3500                         ansexp="$ans";;
3501                 *)
3502                         value=`UU/filexp $ans`
3503                         case $? in
3504                         0)
3505                                 if test "$ans" != "$value"; then
3506                                         echo "(That expands to $value on this system.)"
3507                                 fi
3508                                 ;;
3509                         *) value="$ans";;
3510                         esac
3511                         ansexp="$value"
3512                         case "$exp_file" in
3513                         '') value="$ans";;
3514                         esac
3515                         ;;
3516                 esac
3517                 case "$fullpath" in
3518                 true)
3519                         case "$ansexp" in
3520                         /*) value="$ansexp" ;;
3521                         [a-zA-Z]:/*) value="$ansexp" ;;
3522                         *)
3523                                 redo=true
3524                                 case "$already" in
3525                                 true)
3526                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3527                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3528                                         ;;
3529                                 *)
3530                                 echo "Please give a full path name, starting with slash." >&4
3531                                         case "$tilde" in
3532                                         true)
3533                                 echo "Note that using ~name is ok provided it expands well." >&4
3534                                                 already=true
3535                                                 ;;
3536                                         esac
3537                                 esac
3538                                 ;;
3539                         esac
3540                         ;;
3541                 esac
3542                 case "$redo" in
3543                 '')
3544                         case "$type" in
3545                         File)
3546                                 for fp in $gfpth; do
3547                                         if test "X$fp" = X.; then
3548                                             pf="$ansexp"
3549                                         else    
3550                                             pf="$fp/$ansexp"
3551                                         fi
3552                                         if test -f "$pf"; then
3553                                                 type=''
3554                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3555                                         then
3556                                                 echo "($value is not a plain file, but that's ok.)"
3557                                                 type=''
3558                                         fi
3559                                         if test X"$type" = X; then
3560                                             value="$pf"
3561                                             break
3562                                         fi
3563                                 done
3564                                 ;;
3565                         Directory)
3566                                 for fp in $gfpth; do
3567                                         if test "X$fp" = X.; then
3568                                             dir="$ans"
3569                                             direxp="$ansexp"
3570                                         else    
3571                                             dir="$fp/$ansexp"
3572                                             direxp="$fp/$ansexp"
3573                                         fi
3574                                         if test -d "$direxp"; then
3575                                                 type=''
3576                                                 value="$dir"
3577                                                 break
3578                                         fi
3579                                 done
3580                                 ;;
3581                         Locate)
3582                                 if test -d "$ansexp"; then
3583                                         echo "(Looking for $loc_file in directory $value.)"
3584                                         value="$value/$loc_file"
3585                                         ansexp="$ansexp/$loc_file"
3586                                 fi
3587                                 if test -f "$ansexp"; then
3588                                         type=''
3589                                 fi
3590                                 case "$nopath_ok" in
3591                                 true)   case "$value" in
3592                                         */*) ;;
3593                                         *)      echo "Assuming $value will be in people's path."
3594                                                 type=''
3595                                                 ;;
3596                                         esac
3597                                         ;;
3598                                 esac
3599                                 ;;
3600                         esac
3601
3602                         case "$skip" in
3603                         true) type='';
3604                         esac
3605
3606                         case "$type" in
3607                         '') ;;
3608                         *)
3609                                 if test "$fastread" = yes; then
3610                                         dflt=y
3611                                 else
3612                                         dflt=n
3613                                 fi
3614                                 rp="$what $value doesn't exist.  Use that name anyway?"
3615                                 . UU/myread
3616                                 dflt=''
3617                                 case "$ans" in
3618                                 y*) type='';;
3619                                 *) echo " ";;
3620                                 esac
3621                                 ;;
3622                         esac
3623                         ;;
3624                 esac
3625                 ;;
3626         esac
3627 done
3628 cd UU
3629 ans="$value"
3630 rp="$orig_rp"
3631 dflt="$orig_dflt"
3632 rm -f getfile.ok
3633 test "X$gfpthkeep" != Xy && gfpth=""
3634 EOSC
3635
3636 : What should the include directory be ?
3637 echo " "
3638 $echo $n "Hmm...  $c"
3639 dflt='/usr/include'
3640 incpath=''
3641 mips_type=''
3642 if $test -f /bin/mips && /bin/mips; then
3643         echo "Looks like a MIPS system..."
3644         $cat >usr.c <<'EOCP'
3645 #ifdef SYSTYPE_BSD43
3646 /bsd43
3647 #endif
3648 EOCP
3649         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3650                 dflt='/bsd43/usr/include'
3651                 incpath='/bsd43'
3652                 mips_type='BSD 4.3'
3653         else
3654                 mips_type='System V'
3655         fi
3656         $rm -f usr.c usr.out
3657         echo "and you're compiling with the $mips_type compiler and libraries."
3658         xxx_prompt=y
3659         echo "exit 0" >mips
3660 else
3661         echo "Doesn't look like a MIPS system."
3662         xxx_prompt=n
3663         echo "exit 1" >mips
3664 fi
3665 chmod +x mips
3666 $eunicefix mips
3667 case "$usrinc" in
3668 '') ;;
3669 *) dflt="$usrinc";;
3670 esac
3671 case "$xxx_prompt" in
3672 y)      fn=d/
3673         echo " "
3674         rp='Where are the include files you want to use?'
3675         . ./getfile
3676         usrinc="$ans"
3677         ;;
3678 *)      usrinc="$dflt"
3679         ;;
3680 esac
3681
3682 : Set private lib path
3683 case "$plibpth" in
3684 '') if ./mips; then
3685                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3686         fi;;
3687 esac
3688 case "$libpth" in
3689 ' ') dlist='';;
3690 '') dlist="$loclibpth $plibpth $glibpth";;
3691 *) dlist="$libpth";;
3692 esac
3693
3694 : Now check and see which directories actually exist, avoiding duplicates
3695 libpth=''
3696 for xxx in $dlist
3697 do
3698     if $test -d $xxx; then
3699                 case " $libpth " in
3700                 *" $xxx "*) ;;
3701                 *) libpth="$libpth $xxx";;
3702                 esac
3703     fi
3704 done
3705 $cat <<'EOM'
3706
3707 Some systems have incompatible or broken versions of libraries.  Among
3708 the directories listed in the question below, please remove any you
3709 know not to be holding relevant libraries, and add any that are needed.
3710 Say "none" for none.
3711
3712 EOM
3713 case "$libpth" in
3714 '') dflt='none';;
3715 *)
3716         set X $libpth
3717         shift
3718         dflt=${1+"$@"}
3719         ;;
3720 esac
3721 rp="Directories to use for library searches?"
3722 . ./myread
3723 case "$ans" in
3724 none) libpth=' ';;
3725 *) libpth="$ans";;
3726 esac
3727
3728 : compute shared library extension
3729 case "$so" in
3730 '')
3731         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3732                 dflt='sl'
3733         else
3734                 dflt='so'
3735         fi
3736         ;;
3737 *) dflt="$so";;
3738 esac
3739 $cat <<EOM
3740
3741 On some systems, shared libraries may be available.  Answer 'none' if
3742 you want to suppress searching of shared libraries for the remainder
3743 of this configuration.
3744
3745 EOM
3746 rp='What is the file extension used for shared libraries?'
3747 . ./myread
3748 so="$ans"
3749
3750 : Define several unixisms.
3751 : Hints files or command line option can be used to override them.
3752 : The convoluted testing is in case hints files set either the old
3753 : or the new name.
3754 case "$_exe" in
3755 '')     case "$exe_ext" in
3756     '') ;;
3757         *)      _exe="$exe_ext" ;;
3758         esac
3759         ;;
3760 esac
3761 case "$_a" in
3762 '')     case "$lib_ext" in
3763     '') _a='.a';;
3764         *)      _a="$lib_ext" ;;
3765         esac
3766         ;;
3767 esac
3768 case "$_o" in
3769 '') case "$obj_ext" in
3770         '')     _o='.o';;
3771         *)      _o="$obj_ext";;
3772         esac
3773         ;;
3774 esac
3775 case "$p_" in
3776 '') case "$path_sep" in
3777         '')     p_=':';;
3778         *)      p_="$path_sep";;
3779         esac
3780         ;;
3781 esac
3782 exe_ext=$_exe
3783 lib_ext=$_a
3784 obj_ext=$_o
3785 path_sep=$p_
3786
3787 : Which makefile gets called first.  This is used by make depend.
3788 case "$firstmakefile" in
3789 '') firstmakefile='makefile';;
3790 esac
3791
3792 case "$usesocks" in
3793 $define|true|[yY]*)     dflt='y';;
3794 *) dflt='n';;
3795 esac
3796 cat <<EOM
3797
3798 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3799 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3800 to use the PerlIO abstraction layer, this will be implicitly selected.
3801
3802 If this doesn't make any sense to you, just accept the default '$dflt'.
3803 EOM
3804 rp='Build Perl for SOCKS?'
3805 . ./myread
3806 case "$ans" in
3807 y|Y)    val="$define" ;;     
3808 *)      val="$undef" ;;
3809 esac
3810 set usesocks
3811 eval $setvar
3812
3813 case "$usesocks" in
3814 $define|true|[yY]*) useperlio="$define";;
3815 esac
3816
3817 : Looking for optional libraries
3818 echo " "
3819 echo "Checking for optional libraries..." >&4
3820 case "$libs" in
3821 ' '|'') dflt='';;
3822 *) dflt="$libs";;
3823 esac
3824 case "$libswanted" in
3825 '') libswanted='c_s';;
3826 esac
3827 case "$usesocks" in
3828 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
3829 esac
3830 libsfound=''
3831 libsfiles=''
3832 libsdirs=''
3833 libspath=''
3834 for thisdir in $libpth $xlibpth; do
3835   test -d $thisdir && libspath="$libspath $thisdir"
3836 done
3837 for thislib in $libswanted; do
3838         for thisdir in $libspath; do
3839             xxx=''
3840             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3841                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
3842                 $test -f "$xxx" && eval $libscheck
3843                 $test -f "$xxx" && libstyle=shared
3844             fi
3845             if test ! -f "$xxx"; then
3846                 xxx=$thisdir/lib$thislib.$so
3847                 $test -f "$xxx" && eval $libscheck
3848                 $test -f "$xxx" && libstyle=shared
3849             fi  
3850             if test ! -f "$xxx"; then
3851                 xxx=$thisdir/lib$thislib$_a
3852                 $test -f "$xxx" && eval $libscheck
3853                 $test -f "$xxx" && libstyle=static
3854             fi
3855             if test ! -f "$xxx"; then
3856                 xxx=$thisdir/$thislib$_a
3857                 $test -f "$xxx" && eval $libscheck
3858                 $test -f "$xxx" && libstyle=static
3859             fi
3860             if test ! -f "$xxx"; then
3861                 xxx=$thisdir/lib${thislib}_s$_a
3862                 $test -f "$xxx" && eval $libscheck
3863                 $test -f "$xxx" && libstyle=static
3864                 $test -f "$xxx" && thislib=${thislib}_s
3865             fi
3866             if test ! -f "$xxx"; then
3867                 xxx=$thisdir/Slib$thislib$_a
3868                 $test -f "$xxx" && eval $libscheck
3869                 $test -f "$xxx" && libstyle=static
3870             fi
3871             if $test -f "$xxx"; then
3872                 case "$libstyle" in
3873                 shared) echo "Found -l$thislib (shared)." ;;
3874                 static) echo "Found -l$thislib." ;;
3875                 *)      echo "Found -l$thislib ($libstyle)." ;;
3876                 esac
3877                 case " $dflt " in
3878                 *"-l$thislib "*);;
3879                 *) dflt="$dflt -l$thislib"
3880                    libsfound="$libsfound $xxx"
3881                    yyy=`basename $xxx`
3882                    libsfiles="$libsfiles $yyy"
3883                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
3884                    case " $libsdirs " in
3885                    *" $yyy "*) ;;
3886                    *) libsdirs="$libsdirs $yyy" ;;
3887                    esac
3888                    ;;
3889                 esac
3890                 break
3891             fi  
3892         done
3893         if $test ! -f "$xxx"; then
3894             echo "No -l$thislib."
3895         fi
3896 done
3897 set X $dflt
3898 shift
3899 dflt="$*"
3900 case "$libs" in
3901 '') dflt="$dflt";;
3902 *) dflt="$libs";;
3903 esac
3904 case "$dflt" in
3905 ' '|'') dflt='none';;
3906 esac
3907
3908 $cat <<EOM
3909
3910 In order to compile $package on your machine, a number of libraries
3911 are usually needed.  Include any other special libraries here as well.
3912 Say "none" for none.  The default list is almost always right.
3913 EOM
3914
3915 echo " "
3916 rp="What libraries to use?"
3917 . ./myread
3918 case "$ans" in
3919 none) libs=' ';;
3920 *) libs="$ans";;
3921 esac
3922
3923 : determine optimization, if desired, or use for debug flag also
3924 case "$optimize" in
3925 ' '|$undef) dflt='none';;
3926 '') dflt='-O';;
3927 *) dflt="$optimize";;
3928 esac
3929 $cat <<EOH
3930
3931 By default, $package compiles with the -O flag to use the optimizer.
3932 Alternately, you might want to use the symbolic debugger, which uses
3933 the -g flag (on traditional Unix systems).  Either flag can be
3934 specified here.  To use neither flag, specify the word "none".
3935
3936 EOH
3937 rp="What optimizer/debugger flag should be used?"
3938 . ./myread
3939 optimize="$ans"
3940 case "$optimize" in
3941 'none') optimize=" ";;
3942 esac
3943
3944 dflt=''
3945 : We will not override a previous value, but we might want to
3946 : augment a hint file
3947 case "$hint" in
3948 default|recommended)
3949         case "$gccversion" in
3950         1*) dflt='-fpcc-struct-return' ;;
3951         esac
3952         case "$optimize" in
3953         *-g*) dflt="$dflt -DDEBUGGING";;
3954         esac
3955         case "$gccversion" in
3956         2*) if test -d /etc/conf/kconfig.d &&
3957                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3958                 then
3959                         dflt="$dflt -posix"
3960                 fi
3961                 ;;
3962         esac
3963         case "$gccversion" in
3964         1*) ;;
3965         2.[0-8]*) ;;
3966         ?*)     echo " "
3967                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3968                 echo 'int main(void) { return 0; }' > gcctest.c
3969                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3970                         echo "Yes, it does." 2>&1
3971                         case "$ccflags" in
3972                         *strict-aliasing*) 
3973                                 echo "Leaving current flags $ccflags alone." 2>&1
3974                                 ;;
3975                         *) dflt="$dflt -fno-strict-aliasing" ;;
3976                         esac
3977                 else
3978                         echo "Nope, it doesn't, but that's ok." 2>&1
3979                 fi
3980                 ;;
3981         esac
3982         ;;
3983 esac
3984
3985 case "$mips_type" in
3986 *BSD*|'') inclwanted="$locincpth $usrinc";;
3987 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3988 esac
3989 for thisincl in $inclwanted; do
3990         if $test -d $thisincl; then
3991                 if $test x$thisincl != x$usrinc; then
3992                         case "$dflt" in
3993                         *" -I$thisincl "*);;
3994                         *) dflt="$dflt -I$thisincl ";;
3995                         esac
3996                 fi
3997         fi
3998 done
3999
4000 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4001         xxx=true;
4002 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4003         xxx=true;
4004 else
4005         xxx=false;
4006 fi;
4007 if $xxx; then
4008         case "$dflt" in
4009         *$2*);;
4010         *) dflt="$dflt -D$2";;
4011         esac;
4012 fi'
4013
4014 set signal.h LANGUAGE_C; eval $inctest
4015
4016 case "$usesocks" in
4017 $define)
4018         ccflags="$ccflags -DSOCKS"
4019         ;;
4020 esac
4021
4022 case "$hint" in
4023 default|recommended) dflt="$ccflags $dflt" ;;
4024 *) dflt="$ccflags";;
4025 esac
4026
4027 case "$dflt" in
4028 ''|' ') dflt=none;;
4029 esac
4030
4031 $cat <<EOH
4032
4033 Your C compiler may want other flags.  For this question you should include
4034 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4035 but you should NOT include libraries or ld flags like -lwhatever.  If you
4036 want $package to honor its debug switch, you should include -DDEBUGGING here.
4037 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4038
4039 To use no flags, specify the word "none".
4040
4041 EOH
4042 set X $dflt
4043 shift
4044 dflt=${1+"$@"}
4045 rp="Any additional cc flags?"
4046 . ./myread
4047 case "$ans" in
4048 none) ccflags='';;
4049 *) ccflags="$ans";;
4050 esac
4051
4052 : the following weeds options from ccflags that are of no interest to cpp
4053 cppflags="$ccflags"
4054 case "$gccversion" in
4055 1*) cppflags="$cppflags -D__GNUC__"
4056 esac
4057 case "$mips_type" in
4058 '');;
4059 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4060 esac
4061 case "$cppflags" in
4062 '');;
4063 *)
4064         echo " "
4065         echo "Let me guess what the preprocessor flags are..." >&4
4066         set X $cppflags
4067         shift
4068         cppflags=''
4069         $cat >cpp.c <<'EOM'
4070 #define BLURFL foo
4071
4072 BLURFL xx LFRULB
4073 EOM
4074         previous=''
4075         for flag in $*
4076         do
4077                 case "$flag" in
4078                 -*) ftry="$flag";;
4079                 *) ftry="$previous $flag";;
4080                 esac
4081                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4082                         >cpp1.out 2>/dev/null && \
4083                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4084                         >cpp2.out 2>/dev/null && \
4085                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4086                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4087                 then
4088                         cppflags="$cppflags $ftry"
4089                         previous=''
4090                 else
4091                         previous="$flag"
4092                 fi
4093         done
4094         set X $cppflags
4095         shift
4096         cppflags=${1+"$@"}
4097         case "$cppflags" in
4098         *-*)  echo "They appear to be: $cppflags";;
4099         esac
4100         $rm -f cpp.c cpp?.out
4101         ;;
4102 esac
4103
4104 : flags used in final linking phase
4105 case "$ldflags" in
4106 '') if ./venix; then
4107                 dflt='-i -z'
4108         else
4109                 dflt=''
4110         fi
4111         case "$ccflags" in
4112         *-posix*) dflt="$dflt -posix" ;;
4113         esac
4114         ;;
4115 *) dflt="$ldflags";;
4116 esac
4117
4118 : Try to guess additional flags to pick up local libraries.
4119 for thislibdir in $libpth; do
4120         case " $loclibpth " in
4121         *" $thislibdir "*)
4122                 case "$dflt " in 
4123                 *"-L$thislibdir "*) ;;
4124                 *)  dflt="$dflt -L$thislibdir" ;;
4125                 esac
4126                 ;;
4127         esac
4128 done
4129
4130 case "$dflt" in
4131 '') dflt='none' ;;
4132 esac
4133
4134 $cat <<EOH
4135
4136 Your C linker may need flags.  For this question you should
4137 include -L/whatever and any other flags used by the C linker, but you
4138 should NOT include libraries like -lwhatever.
4139
4140 Make sure you include the appropriate -L/path flags if your C linker
4141 does not normally search all of the directories you specified above,
4142 namely
4143         $libpth
4144 To use no flags, specify the word "none".
4145
4146 EOH
4147
4148 rp="Any additional ld flags (NOT including libraries)?"
4149 . ./myread
4150 case "$ans" in
4151 none) ldflags='';;
4152 *) ldflags="$ans";;
4153 esac
4154 rmlist="$rmlist pdp11"
4155
4156 : coherency check
4157 echo " "
4158 echo "Checking your choice of C compiler and flags for coherency..." >&4
4159 $cat > try.c <<'EOF'
4160 #include <stdio.h>
4161 int main() { printf("Ok\n"); exit(0); }
4162 EOF
4163 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4164 shift
4165 $cat >try.msg <<'EOM'
4166 I've tried to compile and run the following simple program:
4167
4168 EOM
4169 $cat try.c >> try.msg
4170
4171 $cat >> try.msg <<EOM
4172
4173 I used the command:
4174
4175         $*
4176         ./try
4177
4178 and I got the following output:
4179
4180 EOM
4181 dflt=y
4182 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4183         if $sh -c './try' >>try.msg 2>&1; then
4184                 xxx=`./try`
4185                 case "$xxx" in
4186                 "Ok") dflt=n ;;
4187                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4188                         case " $libs " in
4189                         *" -lsfio "*)
4190                                 cat >> try.msg <<'EOQS'
4191 If $libs contains -lsfio, and sfio is mis-configured, then it
4192 sometimes (apparently) runs and exits with a 0 status, but with no
4193 output!  It may have to do with sfio's use of _exit vs. exit.
4194
4195 EOQS
4196                                 rp="You have a big problem.  Shall I abort Configure"
4197                                 dflt=y
4198                                 ;;
4199                         esac
4200                         ;;
4201                 esac
4202         else
4203                 echo "The program compiled OK, but exited with status $?." >>try.msg
4204                 rp="You have a problem.  Shall I abort Configure"
4205                 dflt=y
4206         fi
4207 else
4208         echo "I can't compile the test program." >>try.msg
4209         rp="You have a BIG problem.  Shall I abort Configure"
4210         dflt=y
4211 fi
4212 case "$dflt" in
4213 y)
4214         $cat try.msg >&4
4215         case "$knowitall" in
4216         '')
4217                 echo "(The supplied flags or libraries might be incorrect.)"
4218                 ;;
4219         *) dflt=n;;
4220         esac
4221         echo " "
4222         . ./myread
4223         case "$ans" in
4224         n*|N*) ;;
4225         *)      echo "Ok.  Stopping Configure." >&4
4226                 exit 1
4227                 ;;
4228         esac
4229         ;;
4230 n) echo "OK, that should do.";;
4231 esac
4232 $rm -f try try.* core
4233
4234 : define an is-a-typedef? function
4235 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4236 case "$inclist" in
4237 "") inclist="sys/types.h";;
4238 esac;
4239 eval "varval=\$$var";
4240 case "$varval" in
4241 "")
4242         $rm -f temp.c;
4243         for inc in $inclist; do
4244                 echo "#include <$inc>" >>temp.c;
4245         done;
4246         echo "#ifdef $type" >> temp.c;
4247         echo "printf(\"We have $type\");" >> temp.c;
4248         echo "#endif" >> temp.c;
4249         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4250         if $contains $type temp.E >/dev/null 2>&1; then
4251                 eval "$var=\$type";
4252         else
4253                 eval "$var=\$def";
4254         fi;
4255         $rm -f temp.?;;
4256 *) eval "$var=\$varval";;
4257 esac'
4258
4259 : define an is-a-typedef? function that prompts if the type is not available.
4260 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
4261 case "$inclist" in
4262 "") inclist="sys/types.h";;
4263 esac;
4264 eval "varval=\$$var";
4265 case "$varval" in
4266 "")
4267         $rm -f temp.c;
4268         for inc in $inclist; do
4269                 echo "#include <$inc>" >>temp.c;
4270         done;
4271         echo "#ifdef $type" >> temp.c;
4272         echo "printf(\"We have $type\");" >> temp.c;
4273         echo "#endif" >> temp.c;
4274         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
4275         echo " " ;
4276         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
4277         if $contains $type temp.E >/dev/null 2>&1; then
4278                 echo "$type found." >&4;
4279                 eval "$var=\$type";
4280         else
4281                 echo "$type NOT found." >&4;
4282                 dflt="$def";
4283                 . ./myread ;
4284                 eval "$var=\$ans";
4285         fi;
4286         $rm -f temp.?;;
4287 *) eval "$var=\$varval";;
4288 esac'
4289
4290 : define a shorthand compile call
4291 compile='
4292 mc_file=$1;
4293 shift;
4294 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4295 : define a shorthand compile call for compilations that should be ok.
4296 compile_ok='
4297 mc_file=$1;
4298 shift;
4299 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4300
4301 : check for lengths of integral types
4302 echo " "
4303 case "$intsize" in
4304 '')
4305         echo "Checking to see how big your integers are..." >&4
4306         $cat >intsize.c <<'EOCP'
4307 #include <stdio.h>
4308 int main()
4309 {
4310         printf("intsize=%d;\n", (int)sizeof(int));
4311         printf("longsize=%d;\n", (int)sizeof(long));
4312         printf("shortsize=%d;\n", (int)sizeof(short));
4313         exit(0);
4314 }
4315 EOCP
4316         set intsize
4317         if eval $compile_ok && ./intsize > /dev/null; then
4318                 eval `./intsize`
4319                 echo "Your integers are $intsize bytes long."
4320                 echo "Your long integers are $longsize bytes long."
4321                 echo "Your short integers are $shortsize bytes long."
4322         else
4323                 $cat >&4 <<EOM
4324 !
4325 Help! I can't compile and run the intsize test program: please enlighten me!
4326 (This is probably a misconfiguration in your system or libraries, and
4327 you really ought to fix it.  Still, I'll try anyway.)
4328 !
4329 EOM
4330                 dflt=4
4331                 rp="What is the size of an integer (in bytes)?"
4332                 . ./myread
4333                 intsize="$ans"
4334                 dflt=$intsize
4335                 rp="What is the size of a long integer (in bytes)?"
4336                 . ./myread
4337                 longsize="$ans"
4338                 dflt=2
4339                 rp="What is the size of a short integer (in bytes)?"
4340                 . ./myread
4341                 shortsize="$ans"
4342         fi
4343         ;;
4344 esac
4345 $rm -f intsize intsize.*
4346
4347 : see what type lseek is declared as in the kernel
4348 rp="What is the type used for lseek's offset on this system?"
4349 set off_t lseektype long stdio.h sys/types.h
4350 eval $typedef_ask
4351
4352 echo " "
4353 echo "Checking to see how big your file offsets are..." >&4
4354 $cat >try.c <<EOCP
4355 #include <sys/types.h>
4356 #include <stdio.h>
4357 int main()
4358 {
4359     printf("%d\n", (int)sizeof($lseektype));
4360     return(0); 
4361 }
4362 EOCP
4363 set try
4364 if eval $compile_ok; then
4365         lseeksize=`./try`
4366         echo "Your file offsets are $lseeksize bytes long."
4367 else
4368         dflt=$longsize
4369         echo " "
4370         echo "(I can't seem to compile the test program.  Guessing...)"
4371         rp="What is the size of your file offsets (in bytes)?"
4372         . ./myread
4373         lseeksize="$ans"
4374 fi
4375 $rm -f try.c try
4376
4377 : see what type file positions are declared as in the library
4378 rp="What is the type for file position used by fsetpos()?"
4379 set fpos_t fpostype long stdio.h sys/types.h
4380 eval $typedef_ask
4381
4382 echo " "
4383 case "$fpostype" in
4384 *_t) zzz="$fpostype"    ;;
4385 *)   zzz="fpos_t"       ;;
4386 esac
4387 echo "Checking the size of $zzz..." >&4 
4388 cat > try.c <<EOCP
4389 #include <sys/types.h>
4390 #include <stdio.h>
4391 int main() {
4392     printf("%d\n", (int)sizeof($fpostype));
4393     exit(0);
4394 }
4395 EOCP
4396 set try
4397 if eval $compile_ok; then
4398         yyy=`./try`
4399         case "$yyy" in
4400         '')     fpossize=4
4401                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4402                 ;;
4403         *)      fpossize=$yyy
4404                 echo "Your $zzz is $fpossize bytes long."
4405                 ;;
4406         esac
4407 else
4408         dflt="$longsize"
4409         echo " " >&4
4410         echo "(I can't compile the test program.  Guessing...)" >&4
4411         rp="What is the size of your file positions (in bytes)?"
4412         . ./myread
4413         fpossize="$ans"
4414 fi
4415
4416
4417
4418 # Backward compatibility (uselfs is deprecated).
4419 case "$uselfs" in
4420 "$define"|true|[yY]*)
4421         cat <<EOM >&4
4422
4423 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
4424 EOM
4425         uselargefiles="$define"
4426         ;;
4427 esac                          
4428
4429 case "$lseeksize:$fpossize" in
4430 8:8) cat <<EOM
4431
4432 You can have files larger than 2 gigabytes.
4433 EOM
4434    val="$define" ;;
4435 *)    case "$uselargefiles" in
4436    "$undef"|false|[nN]*) dflt='n' ;;
4437    *)   dflt='y' ;;
4438    esac
4439    cat <<EOM
4440
4441 Perl can be built to understand large files (files larger than 2 gigabytes)
4442 on some systems.  To do so, Configure can be run with -Duselargefiles.
4443
4444 If this doesn't make any sense to you, just accept the default '$dflt'.
4445 EOM
4446    rp='Try to understand large files, if available?'
4447    . ./myread
4448    case "$ans" in
4449    y|Y)         val="$define" ;;
4450    *)           val="$undef"  ;;
4451    esac
4452    ;;
4453 esac
4454 set uselargefiles
4455 eval $setvar
4456 case "$uselargefiles" in
4457 "$define")
4458 : Look for a hint-file generated 'call-back-unit'.  If the
4459 : user has specified that a large files perl is to be built,
4460 : we may need to set or change some other defaults.
4461         if $test -f uselargefiles.cbu; then
4462                 echo "Your platform has some specific hints for large file builds, using them..."
4463                 . ./uselargefiles.cbu
4464                 echo " "
4465                 echo "Rechecking to see how big your file offsets are..." >&4
4466                 $cat >try.c <<EOCP
4467 #include <sys/types.h>
4468 #include <stdio.h>
4469 int main()
4470 {
4471     printf("%d\n", (int)sizeof($lseektype));
4472     return(0); 
4473 }
4474 EOCP
4475                 set try
4476                 if eval $compile_ok; then
4477                         lseeksize=`./try`
4478                         $echo "Your file offsets are now $lseeksize bytes long."
4479                 else
4480                         dflt="$lseeksize"
4481                         echo " "
4482                         echo "(I can't seem to compile the test program.  Guessing...)"
4483                         rp="What is the size of your file offsets (in bytes)?"
4484                         . ./myread
4485                         lseeksize="$ans"
4486                 fi
4487                 case "$fpostype" in
4488                 *_t) zzz="$fpostype"    ;;
4489                 *)   zzz="fpos_t"       ;;
4490                 esac
4491                 $echo $n "Rechecking the size of $zzz...$c" >&4 
4492                 $cat > try.c <<EOCP
4493 #include <sys/types.h>
4494 #include <stdio.h>
4495 int main() {
4496     printf("%d\n", (int)sizeof($fpostype));
4497     exit(0);
4498 }
4499 EOCP
4500                 set try
4501                 if eval $compile_ok; then
4502                         yyy=`./try`
4503                         dflt="$lseeksize"
4504                         case "$yyy" in
4505                         '')     echo " "
4506                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
4507                                 ;;
4508                         *)      fpossize=$yyy
4509                                 echo " $fpossize bytes." >&4
4510                                 ;;
4511                         esac
4512                 else
4513                         dflt="$fpossize"
4514                         echo " "
4515                         echo "(I can't compile the test program.  Guessing...)" >&4
4516                         rp="What is the size of your file positions (in bytes)?"
4517                         . ./myread
4518                         fpossize="$ans"
4519                 fi
4520                 $rm -f try.c try
4521         fi
4522         ;;
4523 esac
4524
4525
4526 case "$usemorebits" in
4527 "$define"|true|[yY]*)
4528         use64bitint="$define"
4529         uselongdouble="$define"
4530         usemorebits="$define"
4531         ;;
4532 *)      usemorebits="$undef"
4533         ;;
4534 esac
4535
4536 : check for void type
4537 echo " "
4538 echo "Checking to see how well your C compiler groks the void type..." >&4
4539 case "$voidflags" in
4540 '')
4541         $cat >try.c <<'EOCP'
4542 #if TRY & 1
4543 void sub() {
4544 #else
4545 sub() {
4546 #endif
4547         extern void moo();      /* function returning void */
4548         void (*goo)();          /* ptr to func returning void */
4549 #if TRY & 8
4550         void *hue;              /* generic ptr */
4551 #endif
4552 #if TRY & 2
4553         void (*foo[10])();
4554 #endif
4555
4556 #if TRY & 4
4557         if(goo == moo) {
4558                 exit(0);
4559         }
4560 #endif
4561         exit(0);
4562 }
4563 int main() { sub(); }
4564 EOCP
4565         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4566                 voidflags=$defvoidused
4567         echo "Good.  It appears to support void to the level $package wants.">&4
4568                 if $contains warning .out >/dev/null 2>&1; then
4569                         echo "However, you might get some warnings that look like this:"
4570                         $cat .out
4571                 fi
4572         else
4573 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
4574                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4575                         echo "It supports 1..."
4576                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4577                                 echo "It also supports 2..."
4578                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4579                                         voidflags=7
4580                                         echo "And it supports 4 but not 8 definitely."
4581                                 else
4582                                         echo "It doesn't support 4..."
4583                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4584                                                 voidflags=11
4585                                                 echo "But it supports 8."
4586                                         else
4587                                                 voidflags=3
4588                                                 echo "Neither does it support 8."
4589                                         fi
4590                                 fi
4591                         else
4592                                 echo "It does not support 2..."
4593                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4594                                         voidflags=13
4595                                         echo "But it supports 4 and 8."
4596                                 else
4597                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4598                                                 voidflags=5
4599                                                 echo "And it supports 4 but has not heard about 8."
4600                                         else
4601                                                 echo "However it supports 8 but not 4."
4602                                         fi
4603                                 fi
4604                         fi
4605                 else
4606                         echo "There is no support at all for void."
4607                         voidflags=0
4608                 fi
4609         fi
4610 esac
4611 case "$voidflags" in
4612 "$defvoidused") ;;
4613 *)      $cat >&4 <<'EOM'
4614   Support flag bits are:
4615     1: basic void declarations.
4616     2: arrays of pointers to functions returning void.
4617     4: operations between pointers to and addresses of void functions.
4618     8: generic void pointers.
4619 EOM
4620         dflt="$voidflags";
4621         rp="Your void support flags add up to what?"
4622         . ./myread
4623         voidflags="$ans"
4624         ;;
4625 esac
4626 $rm -f try.* .out
4627
4628 : check for length of pointer
4629 echo " "
4630 case "$ptrsize" in
4631 '')
4632         echo "Checking to see how big your pointers are..." >&4
4633         if test "$voidflags" -gt 7; then
4634                 echo '#define VOID_PTR char *' > try.c
4635         else
4636                 echo '#define VOID_PTR void *' > try.c
4637         fi
4638         $cat >>try.c <<'EOCP'
4639 #include <stdio.h>
4640 int main()
4641 {
4642     printf("%d\n", (int)sizeof(VOID_PTR));
4643     exit(0);
4644 }
4645 EOCP
4646         set try
4647         if eval $compile_ok; then
4648                 ptrsize=`./try`
4649                 echo "Your pointers are $ptrsize bytes long."
4650         else
4651                 dflt='4'
4652                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
4653                 rp="What is the size of a pointer (in bytes)?"
4654                 . ./myread
4655                 ptrsize="$ans"
4656         fi
4657         ;;
4658 esac
4659 $rm -f try.c try
4660
4661 : check for long long
4662 echo " "
4663 echo "Checking to see if you have long long..." >&4
4664 echo 'int main() { long long x = 7; return 0; }' > try.c
4665 set try
4666 if eval $compile; then
4667         val="$define"
4668         echo "You have long long."
4669 else
4670         val="$undef"
4671         echo "You do not have long long."
4672 fi
4673 $rm try.*
4674 set d_longlong
4675 eval $setvar
4676
4677 : check for length of long long
4678 case "${d_longlong}${longlongsize}" in
4679 $define)
4680         echo " "
4681         echo "Checking to see how big your long longs are..." >&4
4682         $cat >try.c <<'EOCP'
4683 #include <stdio.h>
4684 int main()
4685 {
4686     printf("%d\n", (int)sizeof(long long));
4687     return(0);
4688 }
4689 EOCP
4690         set try
4691         if eval $compile_ok; then
4692                 longlongsize=`./try$exe_ext`
4693                 echo "Your long longs are $longlongsize bytes long."
4694         else
4695                 dflt='8'
4696                 echo " "
4697                 echo "(I can't seem to compile the test program.  Guessing...)"
4698                 rp="What is the size of a long long (in bytes)?"
4699                 . ./myread
4700                 longlongsize="$ans"
4701         fi
4702         if $test "X$longsize" = "X$longlongsize"; then
4703                 echo "(That isn't any different from an ordinary long.)"
4704         fi      
4705         ;;
4706 esac
4707 $rm -f try.* try
4708
4709 : determine filename position in cpp output
4710 echo " "
4711 echo "Computing filename position in cpp output for #include directives..." >&4
4712 echo '#include <stdio.h>' > foo.c
4713 $cat >fieldn <<EOF
4714 $startsh
4715 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4716 $grep '^[       ]*#.*stdio\.h' | \
4717 while read cline; do
4718         pos=1
4719         set \$cline
4720         while $test \$# -gt 0; do
4721                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4722                         echo "\$pos"
4723                         exit 0
4724                 fi
4725                 shift
4726                 pos=\`expr \$pos + 1\`
4727         done
4728 done
4729 EOF
4730 chmod +x fieldn
4731 fieldn=`./fieldn`
4732 $rm -f foo.c fieldn
4733 case $fieldn in
4734 '') pos='???';;
4735 1) pos=first;;
4736 2) pos=second;;
4737 3) pos=third;;
4738 *) pos="${fieldn}th";;
4739 esac
4740 echo "Your cpp writes the filename in the $pos field of the line."
4741
4742 : locate header file
4743 $cat >findhdr <<EOF
4744 $startsh
4745 wanted=\$1
4746 name=''
4747 for usrincdir in $usrinc
4748 do
4749         if test -f \$usrincdir/\$wanted; then
4750                 echo "\$usrincdir/\$wanted"
4751                 exit 0
4752         fi
4753 done
4754 awkprg='{ print \$$fieldn }'
4755 echo "#include <\$wanted>" > foo\$\$.c
4756 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4757 $grep "^[       ]*#.*\$wanted" | \
4758 while read cline; do
4759         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4760         case "\$name" in
4761         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4762         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4763         *) exit 2;;
4764         esac;
4765 done;
4766 #
4767 # status = 0: grep returned 0 lines, case statement not executed
4768 # status = 1: headerfile found
4769 # status = 2: while loop executed, no headerfile found
4770 #
4771 status=\$?
4772 $rm -f foo\$\$.c;
4773 if test \$status -eq 1; then
4774         exit 0;
4775 fi
4776 exit 1
4777 EOF
4778 chmod +x findhdr
4779
4780 : define an alternate in-header-list? function
4781 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4782 cont=true; xxf="echo \"<\$1> found.\" >&4";
4783 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4784 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4785 esac;
4786 case $# in 4) instead=instead;; *) instead="at last";; esac;
4787 while $test "$cont"; do
4788         xxx=`./findhdr $1`
4789         var=$2; eval "was=\$$2";
4790         if $test "$xxx" && $test -r "$xxx";
4791         then eval $xxf;
4792         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4793                 cont="";
4794         else eval $xxnf;
4795         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4796         set $yyy; shift; shift; yyy=$@;
4797         case $# in 0) cont="";;
4798         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4799                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4800         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4801                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4802         esac;
4803 done;
4804 while $test "$yyy";
4805 do set $yyy; var=$2; eval "was=\$$2";
4806         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4807         set $yyy; shift; shift; yyy=$@;
4808 done'
4809
4810 : see if inttypes.h is available
4811 : we want a real compile instead of Inhdr because some systems
4812 : have an inttypes.h which includes non-existent headers
4813 echo " "
4814 $cat >try.c <<EOCP
4815 #include <inttypes.h>
4816 int main() {
4817         static int32_t foo32 = 0x12345678;
4818 }
4819 EOCP
4820 set try
4821 if eval $compile; then
4822         echo "<inttypes.h> found." >&4
4823         val="$define"
4824 else
4825         echo "<inttypes.h> NOT found." >&4
4826         val="$undef"
4827 fi
4828 $rm -f try.c try
4829 set i_inttypes
4830 eval $setvar
4831
4832 : check for int64_t
4833 echo " "
4834 echo "Checking to see if you have int64_t..." >&4
4835 $cat >try.c <<EOCP
4836 #include <sys/types.h>
4837 #$i_inttypes I_INTTYPES
4838 #ifdef I_INTTYPES
4839 #include <inttypes.h>
4840 #endif
4841 int main() { int64_t x = 7; }
4842 EOCP
4843 set try
4844 if eval $compile; then
4845         val="$define"
4846         echo "You have int64_t."
4847 else
4848         val="$undef"
4849         echo "You do not have int64_t."
4850 fi
4851 $rm -f try try.*
4852 set d_int64_t
4853 eval $setvar
4854
4855
4856 echo " "
4857 echo "Checking which 64-bit integer type we could use..." >&4
4858
4859 case "$intsize" in
4860 8) val=int
4861    set quadtype
4862    eval $setvar
4863    val='"unsigned int"'
4864    set uquadtype
4865    eval $setvar
4866    quadkind=1
4867    ;;
4868 *) case "$longsize" in
4869    8) val=long
4870       set quadtype
4871       eval $setvar
4872       val='"unsigned long"'
4873       set uquadtype
4874       eval $setvar
4875       quadkind=2
4876       ;;
4877    *) case "$d_longlong:$longlongsize" in
4878       define:8)
4879         val='"long long"'
4880         set quadtype
4881         eval $setvar
4882         val='"unsigned long long"'
4883         set uquadtype
4884         eval $setvar
4885         quadkind=3
4886         ;;
4887       *) case "$d_int64_t" in
4888          define)
4889            val=int64_t
4890            set quadtype
4891            eval $setvar
4892            val=uint64_t
4893            set uquadtype
4894            eval $setvar
4895            quadkind=4
4896            ;;
4897          esac
4898          ;;
4899       esac
4900       ;;
4901    esac
4902    ;;
4903 esac
4904
4905 case "$quadtype" in
4906 '')     echo "Alas, no 64-bit integer types in sight." >&4
4907         d_quad="$undef"
4908         ;;
4909 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
4910         d_quad="$define"
4911         ;;
4912 esac
4913
4914
4915 case "$uselonglong" in
4916 "$define"|true|[yY]*)
4917         cat <<EOM >&4
4918
4919 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
4920 EOM
4921         use64bitint="$define"
4922         ;;
4923 esac                          
4924 case "$use64bits" in
4925 "$define"|true|[yY]*)
4926         cat <<EOM >&4
4927
4928 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
4929 EOM
4930         use64bitint="$define"
4931         ;;
4932 esac                          
4933 case "$use64bitints" in
4934 "$define"|true|[yY]*)
4935         cat <<EOM >&4
4936
4937 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
4938 EOM
4939         use64bitint="$define"
4940         ;;
4941 esac                          
4942 case "$use64bitsint" in
4943 "$define"|true|[yY]*)
4944         cat <<EOM >&4
4945
4946 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
4947 EOM
4948         use64bitint="$define"
4949         ;;
4950 esac                          
4951 case "$uselonglongs" in
4952 "$define"|true|[yY]*)
4953         cat <<EOM >&4
4954
4955 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
4956 EOM
4957         use64bitint="$define"
4958         ;;
4959 esac                          
4960 case "$use64bitsall" in
4961 "$define"|true|[yY]*)
4962         cat <<EOM >&4
4963
4964 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
4965 EOM
4966         use64bitall="$define"
4967         ;;
4968 esac                          
4969
4970 case "$ccflags" in
4971 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
4972 esac
4973 case "$use64bitall" in
4974 "$define"|true|[yY]*) use64bitint="$define" ;;
4975 esac
4976
4977 case "$longsize" in
4978 8) cat <<EOM
4979
4980 You have natively 64-bit long integers.
4981 EOM
4982    val="$define"
4983    ;;
4984 *) case "$use64bitint" in
4985    "$define"|true|[yY]*) dflt='y';;
4986    *) dflt='n';;
4987    esac
4988    case "$d_quad" in
4989    "$define") ;;
4990    *) dflt='n' ;;
4991    esac
4992    cat <<EOM
4993
4994 Perl can be built to take advantage of 64-bit integer types
4995 on some systems.  To do so, Configure can be run with -Duse64bitint.
4996 Choosing this option will most probably introduce binary incompatibilities.
4997
4998 If this doesn't make any sense to you, just accept the default '$dflt'.
4999 (The default has been chosen based on your configuration.)
5000 EOM
5001    rp='Try to use 64-bit integers, if available?'
5002    . ./myread
5003    case "$ans" in
5004    [yY]*) val="$define" ;;
5005    *)     val="$undef"  ;;
5006    esac
5007    ;;
5008 esac
5009 set use64bitint
5010 eval $setvar
5011
5012 case "$use64bitall" in
5013 "$define"|true|[yY]*) dflt='y' ;;
5014 *) case "$longsize" in
5015    8) dflt='y' ;;
5016    *) dflt='n' ;;
5017    esac
5018    ;;
5019 esac    
5020 cat <<EOM
5021
5022 You may also choose to try maximal 64-bitness.  It means using as much
5023 64-bitness as possible on the platform.  This in turn means even more
5024 binary incompatibilities.  On the other hand, your platform may not
5025 have any more 64-bitness available than what you already have chosen.
5026
5027 If this doesn't make any sense to you, just accept the default '$dflt'.
5028 (The default has been chosen based on your configuration.)
5029 EOM
5030 rp='Try to use maximal 64-bit support, if available?'
5031 . ./myread
5032 case "$ans" in
5033 [yY]*) val="$define" ;;
5034 *)     val="$undef"  ;;
5035 esac
5036 set use64bitall
5037 eval $setvar
5038 case "$use64bitall" in
5039 "$define")
5040         case "$use64bitint" in
5041         "$undef")
5042                 cat <<EOM
5043
5044 Since you have chosen a maximally 64-bit build, I'm also turning on
5045 the use of 64-bit integers.
5046 EOM
5047                 use64bitint="$define" ;;
5048         esac
5049         ;;
5050 esac
5051
5052 case "$use64bitall" in
5053 "$define"|true|[yY]*)
5054         case "$ptrsize" in
5055         4)      cat <<EOM >&4
5056
5057 *** You have chosen a maximally 64-bit build, but your pointers
5058 *** are only 4 bytes wide, disabling maximal 64-bitness.
5059
5060 EOM
5061                 use64bitall="$undef"
5062                 case "$use64bitint" in
5063                 "$define"|true|[yY]*) ;;
5064                 *)      cat <<EOM >&4
5065
5066 *** Downgrading from maximal 64-bitness to using 64-bit integers.
5067
5068 EOM
5069                         use64bitint="$define"
5070                         ;;
5071                 esac
5072                 ;;
5073         esac
5074         ;;
5075 esac
5076
5077 case "$use64bitint" in
5078 "$define"|true|[yY]*)
5079 : Look for a hint-file generated 'call-back-unit'.  If the
5080 : user has specified that a 64-bit perl is to be built,
5081 : we may need to set or change some other defaults.
5082         if $test -f use64bitint.cbu; then
5083                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5084                 . ./use64bitint.cbu
5085         fi
5086         case "$longsize" in
5087         4) case "$archname64" in
5088            '') archname64=64int ;;
5089            esac
5090            ;;
5091         esac
5092         ;;
5093 esac
5094
5095 case "$use64bitall" in
5096 "$define"|true|[yY]*)
5097 : Look for a hint-file generated 'call-back-unit'.  If the
5098 : user has specified that a maximally 64-bit perl is to be built,
5099 : we may need to set or change some other defaults.
5100         if $test -f use64bitall.cbu; then
5101                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5102                 . ./use64bitall.cbu
5103         fi
5104         case "$longsize" in
5105         4) case "$archname64" in
5106            ''|64int) archname64=64all ;;
5107            esac
5108            ;;
5109         esac
5110         ;;
5111 esac
5112
5113 echo " "
5114 echo "Checking for GNU C Library..." >&4
5115 cat >gnulibc.c <<EOM
5116 #include <stdio.h>
5117 int main()
5118 {
5119 #ifdef __GLIBC__
5120     exit(0);
5121 #else
5122     exit(1);
5123 #endif
5124 }
5125 EOM
5126 set gnulibc
5127 if eval $compile_ok && ./gnulibc; then
5128         val="$define"
5129         echo "You are using the GNU C Library"
5130 else
5131         val="$undef"
5132         echo "You are not using the GNU C Library"
5133 fi
5134 $rm -f gnulibc*
5135 set d_gnulibc
5136 eval $setvar
5137
5138 : see if nm is to be used to determine whether a symbol is defined or not
5139 case "$usenm" in
5140 '')
5141         dflt=''
5142         case "$d_gnulibc" in
5143         "$define")
5144                 echo " "
5145                 echo "nm probably won't work on the GNU C Library." >&4
5146                 dflt=n
5147                 ;;
5148         esac
5149         case "$dflt" in
5150         '') 
5151                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
5152                         echo " "
5153                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5154                         echo "'nm' won't be sufficient on this sytem." >&4
5155                         dflt=n
5156                 fi
5157                 ;;
5158         esac
5159         case "$dflt" in
5160         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5161                 if $test $dflt -gt 20; then
5162                         dflt=y
5163                 else
5164                         dflt=n
5165                 fi
5166                 ;;
5167         esac
5168         ;;
5169 *)
5170         case "$usenm" in
5171         true|$define) dflt=y;;
5172         *) dflt=n;;
5173         esac
5174         ;;
5175 esac
5176 $cat <<EOM
5177
5178 I can use $nm to extract the symbols from your C libraries. This
5179 is a time consuming task which may generate huge output on the disk (up
5180 to 3 megabytes) but that should make the symbols extraction faster. The
5181 alternative is to skip the 'nm' extraction part and to compile a small
5182 test program instead to determine whether each symbol is present. If
5183 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5184 this may be the best solution.
5185
5186 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5187
5188 EOM
5189 rp="Shall I use $nm to extract C symbols from the libraries?"
5190 . ./myread
5191 case "$ans" in
5192 [Nn]*) usenm=false;;
5193 *) usenm=true;;
5194 esac
5195
5196 runnm=$usenm
5197 case "$reuseval" in
5198 true) runnm=false;;
5199 esac
5200
5201 : nm options which may be necessary
5202 case "$nm_opt" in
5203 '') if $test -f /mach_boot; then
5204                 nm_opt=''       # Mach
5205         elif $test -d /usr/ccs/lib; then
5206                 nm_opt='-p'     # Solaris (and SunOS?)
5207         elif $test -f /dgux; then
5208                 nm_opt='-p'     # DG-UX
5209         elif $test -f /lib64/rld; then
5210                 nm_opt='-p'     # 64-bit Irix
5211         else
5212                 nm_opt=''
5213         fi;;
5214 esac
5215
5216 : nm options which may be necessary for shared libraries but illegal
5217 : for archive libraries.  Thank you, Linux.
5218 case "$nm_so_opt" in
5219 '')     case "$myuname" in
5220         *linux*)
5221                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5222                         nm_so_opt='--dynamic'
5223                 fi
5224                 ;;
5225         esac
5226         ;;
5227 esac
5228
5229 case "$runnm" in
5230 true)
5231 : get list of predefined functions in a handy place
5232 echo " "
5233 case "$libc" in
5234 '') libc=unknown
5235         case "$libs" in
5236         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5237         esac
5238         ;;
5239 esac
5240 libnames='';
5241 case "$libs" in
5242 '') ;;
5243 *)  for thislib in $libs; do
5244         case "$thislib" in
5245         -lc|-lc_s)
5246                 : Handle C library specially below.
5247                 ;;
5248         -l*)
5249                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5250                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5251                         :
5252                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5253                         :
5254                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5255                         :
5256                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5257                         :
5258                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5259                         :
5260                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5261                         :
5262                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5263                         :
5264                 else
5265                         try=''
5266                 fi
5267                 libnames="$libnames $try"
5268                 ;;
5269         *) libnames="$libnames $thislib" ;;
5270         esac
5271         done
5272         ;;
5273 esac
5274 xxx=normal
5275 case "$libc" in
5276 unknown)
5277         set /lib/libc.$so
5278         for xxx in $libpth; do
5279                 $test -r $1 || set $xxx/libc.$so
5280                 : The messy sed command sorts on library version numbers.
5281                 $test -r $1 || \
5282                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5283                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5284                                 h
5285                                 s/[0-9][0-9]*/0000&/g
5286                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5287                                 G
5288                                 s/\n/ /' | \
5289                          $sort | $sed -e 's/^.* //'`
5290                 eval set \$$#
5291         done
5292         $test -r $1 || set /usr/ccs/lib/libc.$so
5293         $test -r $1 || set /lib/libsys_s$_a
5294         ;;
5295 *)
5296         set blurfl
5297         ;;
5298 esac
5299 if $test -r "$1"; then
5300         echo "Your (shared) C library seems to be in $1."
5301         libc="$1"
5302 elif $test -r /lib/libc && $test -r /lib/clib; then
5303         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5304         xxx=apollo
5305         libc='/lib/clib /lib/libc'
5306         if $test -r /lib/syslib; then
5307                 echo "(Your math library is in /lib/syslib.)"
5308                 libc="$libc /lib/syslib"
5309         fi
5310 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5311         echo "Your C library seems to be in $libc, as you said before."
5312 elif $test -r $incpath/usr/lib/libc$_a; then
5313         libc=$incpath/usr/lib/libc$_a;
5314         echo "Your C library seems to be in $libc.  That's fine."
5315 elif $test -r /lib/libc$_a; then
5316         libc=/lib/libc$_a;
5317         echo "Your C library seems to be in $libc.  You're normal."
5318 else
5319         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5320                 :
5321         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5322                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5323         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5324                 :
5325         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5326                 :
5327         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5328                 :
5329         else
5330                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5331         fi
5332         if $test -r "$tans"; then
5333                 echo "Your C library seems to be in $tans, of all places."
5334                 libc=$tans
5335         else
5336                 libc='blurfl'
5337         fi
5338 fi
5339 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5340         dflt="$libc"
5341         cat <<EOM
5342
5343 If the guess above is wrong (which it might be if you're using a strange
5344 compiler, or your machine supports multiple models), you can override it here.
5345
5346 EOM
5347 else
5348         dflt=''
5349         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5350         cat >&4 <<EOM
5351 I can't seem to find your C library.  I've looked in the following places:
5352
5353 EOM
5354         $sed 's/^/      /' libpath
5355         cat <<EOM
5356
5357 None of these seems to contain your C library. I need to get its name...
5358
5359 EOM
5360 fi
5361 fn=f
5362 rp='Where is your C library?'
5363 . ./getfile
5364 libc="$ans"
5365
5366 echo " "
5367 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5368 set X `cat libnames`
5369 shift
5370 xxx=files
5371 case $# in 1) xxx=file; esac
5372 echo "Extracting names from the following $xxx for later perusal:" >&4
5373 echo " "
5374 $sed 's/^/      /' libnames >&4
5375 echo " "
5376 $echo $n "This may take a while...$c" >&4
5377
5378 for file in $*; do
5379         case $file in
5380         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5381         *) $nm $nm_opt $file 2>/dev/null;;
5382         esac
5383 done >libc.tmp
5384
5385 $echo $n ".$c"
5386 $grep fprintf libc.tmp > libc.ptf
5387 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5388 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5389 xxx='[ADTSIW]'
5390 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5391         eval $xscan;\
5392         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5393                 eval $xrun
5394 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5395         eval $xscan;\
5396         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5397                 eval $xrun
5398 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5399         eval $xscan;\
5400         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5401                 eval $xrun
5402 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5403         eval $xscan;\
5404         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5405                 eval $xrun
5406 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5407         eval $xscan;\
5408         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5409                 eval $xrun
5410 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5411         eval $xscan;\
5412         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5413                 eval $xrun
5414 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5415                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5416         eval $xscan;\
5417         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5418                 eval $xrun
5419 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5420         eval $xscan;\
5421         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5422                 eval $xrun
5423 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5424         eval $xscan;\
5425         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5426                 eval $xrun
5427 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5428         eval $xscan;\
5429         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5430                 eval $xrun
5431 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5432         eval $xscan;\
5433         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5434                 eval $xrun
5435 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5436         eval $xscan;\
5437         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5438                 eval $xrun
5439 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5440         eval $xscan;\
5441         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5442                 eval $xrun
5443 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5444         eval $xscan;\
5445         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5446                 eval $xrun
5447 else
5448         $nm -p $* 2>/dev/null >libc.tmp
5449         $grep fprintf libc.tmp > libc.ptf
5450         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5451                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5452         then
5453                 nm_opt='-p'
5454                 eval $xrun
5455         else
5456                 echo " "
5457                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5458                 com=''
5459                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5460                         for thisname in $libnames $libc; do
5461                                 $ar t $thisname >>libc.tmp
5462                         done
5463                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5464                         echo "Ok." >&4
5465                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5466                         # Repeat libc to extract forwarders to DLL entries too
5467                         for thisname in $libnames $libc; do
5468                                 $ar tv $thisname >>libc.tmp
5469                                 # Revision 50 of EMX has bug in $ar.
5470                                 # it will not extract forwarders to DLL entries
5471                                 # Use emximp which will extract exactly them.
5472                                 emximp -o tmp.imp $thisname \
5473                                     2>/dev/null && \
5474                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5475                                     < tmp.imp >>libc.tmp
5476                                 $rm tmp.imp
5477                         done
5478                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5479                         echo "Ok." >&4
5480                 else
5481                         echo "$ar didn't seem to work right." >&4
5482                         echo "Maybe this is a Cray...trying bld instead..." >&4
5483                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5484                         then
5485                                 for thisname in $libnames; do
5486                                         bld t $libnames | \
5487                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5488                                         $ar t $thisname >>libc.tmp
5489                                 done
5490                                 echo "Ok." >&4
5491                         else
5492                                 echo "That didn't work either.  Giving up." >&4
5493                                 exit 1
5494                         fi
5495                 fi
5496         fi
5497 fi
5498 nm_extract="$com"
5499 if $test -f /lib/syscalls.exp; then
5500         echo " "
5501         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5502         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5503 fi
5504 ;;
5505 esac
5506 $rm -f libnames libpath
5507
5508 : is a C symbol defined?
5509 csym='tlook=$1;
5510 case "$3" in
5511 -v) tf=libc.tmp; tc=""; tdc="";;
5512 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5513 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5514 esac;
5515 tx=yes;
5516 case "$reuseval-$4" in
5517 true-) ;;
5518 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5519 esac;
5520 case "$tx" in
5521 yes)
5522         case "$runnm" in
5523         true)
5524                 if $contains $tlook $tf >/dev/null 2>&1;
5525                 then tval=true;
5526                 else tval=false;
5527                 fi;;
5528         *)
5529                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5530                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5531                 then tval=true;
5532                 else tval=false;
5533                 fi;
5534                 $rm -f t t.c;;
5535         esac;;
5536 *)
5537         case "$tval" in
5538         $define) tval=true;;
5539         *) tval=false;;
5540         esac;;
5541 esac;
5542 eval "$2=$tval"'
5543
5544 : define an is-in-libc? function
5545 inlibc='echo " "; td=$define; tu=$undef;
5546 sym=$1; var=$2; eval "was=\$$2";
5547 tx=yes;
5548 case "$reuseval$was" in
5549 true) ;;
5550 true*) tx=no;;
5551 esac;
5552 case "$tx" in
5553 yes)
5554         set $sym tres -f;
5555         eval $csym;
5556         case "$tres" in
5557         true)
5558                 echo "$sym() found." >&4;
5559                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5560         *)
5561                 echo "$sym() NOT found." >&4;
5562                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5563         esac;;
5564 *)
5565         case "$was" in
5566         $define) echo "$sym() found." >&4;;
5567         *) echo "$sym() NOT found." >&4;;
5568         esac;;
5569 esac'
5570
5571 : see if sqrtl exists
5572 set sqrtl d_sqrtl
5573 eval $inlibc
5574
5575 case "$ccflags" in
5576 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5577 esac
5578
5579 case "$uselongdouble" in
5580 $define|true|[yY]*)     dflt='y';;
5581 *) dflt='n';;
5582 esac
5583 cat <<EOM
5584
5585 Perl can be built to take advantage of long doubles which
5586 (if available) may give more accuracy and range for floating point numbers.
5587
5588 If this doesn't make any sense to you, just accept the default '$dflt'.
5589 EOM
5590 rp='Try to use long doubles if available?'
5591 . ./myread
5592 case "$ans" in
5593 y|Y)    val="$define"   ;;
5594 *)      val="$undef"    ;;
5595 esac
5596 set uselongdouble
5597 eval $setvar
5598
5599 case "$uselongdouble" in
5600 true|[yY]*) uselongdouble="$define" ;;
5601 esac
5602
5603 case "$uselongdouble" in
5604 $define)
5605 : Look for a hint-file generated 'call-back-unit'.  If the
5606 : user has specified that long doubles should be used,
5607 : we may need to set or change some other defaults.
5608         if $test -f uselongdouble.cbu; then
5609                 echo "Your platform has some specific hints for long doubles, using them..."
5610                 . ./uselongdouble.cbu
5611         else
5612                 $cat <<EOM
5613 (Your platform doesn't have any specific hints for long doubles.)
5614 EOM
5615         fi
5616         ;;
5617 esac
5618
5619 case "$uselongdouble:$d_sqrtl" in
5620 $define:$undef)
5621                 $cat <<EOM >&4
5622
5623 *** You requested the use of long doubles but you do not seem to have
5624 *** the mathematic functions for long doubles.  I'm disabling the use
5625 *** of long doubles.
5626
5627 EOM
5628         uselongdouble=$undef
5629         ;;
5630 esac
5631
5632 : check for length of double
5633 echo " "
5634 case "$doublesize" in
5635 '')
5636         echo "Checking to see how big your double precision numbers are..." >&4
5637         $cat >try.c <<'EOCP'
5638 #include <stdio.h>
5639 int main()
5640 {
5641     printf("%d\n", (int)sizeof(double));
5642     exit(0);
5643 }
5644 EOCP
5645         set try
5646         if eval $compile_ok; then
5647                 doublesize=`./try`
5648                 echo "Your double is $doublesize bytes long."
5649         else
5650                 dflt='8'
5651                 echo "(I can't seem to compile the test program.  Guessing...)"
5652                 rp="What is the size of a double precision number (in bytes)?"
5653                 . ./myread
5654                 doublesize="$ans"
5655         fi
5656         ;;
5657 esac
5658 $rm -f try.c try
5659
5660 : check for long doubles
5661 echo " "
5662 echo "Checking to see if you have long double..." >&4
5663 echo 'int main() { long double x = 7.0; }' > try.c
5664 set try
5665 if eval $compile; then
5666         val="$define"
5667         echo "You have long double."
5668 else
5669         val="$undef"
5670         echo "You do not have long double."
5671 fi
5672 $rm try.*
5673 set d_longdbl
5674 eval $setvar
5675
5676 : check for length of long double
5677 case "${d_longdbl}${longdblsize}" in
5678 $define)
5679         echo " "
5680         echo "Checking to see how big your long doubles are..." >&4
5681         $cat >try.c <<'EOCP'
5682 #include <stdio.h>
5683 int main()
5684 {
5685         printf("%d\n", sizeof(long double));
5686 }
5687 EOCP
5688         set try
5689         set try
5690         if eval $compile; then
5691                 longdblsize=`./try$exe_ext`
5692                 echo "Your long doubles are $longdblsize bytes long."
5693         else
5694                 dflt='8'
5695                 echo " "
5696                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5697                 rp="What is the size of a long double (in bytes)?"
5698                 . ./myread
5699                 longdblsize="$ans"
5700         fi
5701         if $test "X$doublesize" = "X$longdblsize"; then
5702                 echo "(That isn't any different from an ordinary double.)"
5703         fi      
5704         ;;
5705 esac
5706 $rm -f try.* try
5707
5708 case "$useperlio" in
5709 $define|true|[yY]*|'')  dflt='y';;
5710 *) dflt='n';;
5711 esac
5712 cat <<EOM
5713
5714 Previous version of $package used the standard IO mechanisms as
5715 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
5716 alternate IO mechanisms via the PerlIO abstraction layer, but the
5717 stdio mechanism is still available if needed.  The abstraction layer
5718 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
5719 Using PerlIO with sfio may cause problems with some extension modules.
5720
5721 If this doesn't make any sense to you, just accept the default '$dflt'.
5722 EOM
5723 rp='Use the PerlIO abstraction layer?'
5724 . ./myread
5725 case "$ans" in
5726 y|Y) 
5727         val="$define"
5728         ;;
5729 *)      
5730         echo "Ok, doing things the stdio way."
5731         val="$undef"
5732         ;;
5733 esac
5734 set useperlio
5735 eval $setvar 
5736
5737 case "$usesocks" in
5738 $define|true|[yY]*)
5739         case "$useperlio" in
5740         $define|true|[yY]*) ;;
5741         *)      cat >&4 <<EOM
5742
5743 You are using the SOCKS proxy protocol library which means that you
5744 should also use the PerlIO layer.  You may be headed for trouble.
5745
5746 EOM
5747                 ;;
5748         esac
5749         ;;
5750 esac
5751
5752         
5753 : determine the architecture name
5754 echo " "
5755 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5756         tarch=`arch`"-$osname"
5757 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5758         if uname -m > tmparch 2>&1 ; then
5759                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5760                         -e 's/$/'"-$osname/" tmparch`
5761         else
5762                 tarch="$osname"
5763         fi
5764         $rm -f tmparch
5765 else
5766         tarch="$osname"
5767 fi
5768 case "$myarchname" in
5769 ''|"$tarch") ;;
5770 *)
5771         echo "(Your architecture name used to be $myarchname.)"
5772         archname=''
5773         ;;
5774 esac
5775 myarchname="$tarch"
5776 case "$archname" in
5777 '') dflt="$tarch";;
5778 *) dflt="$archname";;
5779 esac
5780 rp='What is your architecture name'
5781 . ./myread
5782 archname="$ans"
5783 case "$usethreads" in
5784 $define)
5785         echo "Threads selected." >&4
5786         case "$archname" in
5787         *-thread*) echo "...and architecture name already has -thread." >&4
5788                 ;;
5789         *)      archname="$archname-thread"
5790                 echo "...setting architecture name to $archname." >&4
5791                 ;;
5792         esac
5793         ;;
5794 esac
5795 case "$usemultiplicity" in
5796 $define)
5797         echo "Multiplicity selected." >&4
5798         case "$archname" in
5799         *-multi*) echo "...and architecture name already has -multi." >&4
5800                 ;;
5801         *)      archname="$archname-multi"
5802                 echo "...setting architecture name to $archname." >&4
5803                 ;;
5804         esac
5805         ;;
5806 esac
5807 case "$use64bitint$use64bitall" in
5808 *"$define"*)
5809         case "$archname64" in
5810         '')
5811                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5812                 ;;
5813         *)
5814                 case "$use64bitint" in
5815                 "$define") echo "64 bit integers selected." >&4 ;;
5816                 esac
5817                 case "$use64bitall" in
5818                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5819                 esac
5820                 case "$archname" in
5821                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5822                         ;;
5823                 *)      archname="$archname-$archname64"
5824                         echo "...setting architecture name to $archname." >&4
5825                         ;;
5826                 esac
5827                 ;;
5828         esac
5829 esac
5830 case "$uselongdouble" in
5831 $define)
5832         echo "Long doubles selected." >&4
5833         case "$longdblsize" in
5834         $doublesize)
5835                 "...but long doubles are equal to doubles, not changing architecture name." >&4
5836                 ;;
5837         *)
5838                 case "$archname" in
5839                 *-ld*) echo "...and architecture name already has -ld." >&4
5840                         ;;
5841                 *)      archname="$archname-ld"
5842                         echo "...setting architecture name to $archname." >&4
5843                         ;;
5844                 esac
5845                 ;;
5846         esac
5847         ;;
5848 esac
5849 case "$useperlio" in
5850 $define)
5851         echo "Perlio selected." >&4
5852         ;;
5853 *)
5854         echo "Perlio not selected, using stdio." >&4
5855         case "$archname" in
5856         *-stdio*) echo "...and architecture name already has -stdio." >&4
5857                 ;;
5858         *)      archname="$archname-stdio"
5859                 echo "...setting architecture name to $archname." >&4
5860                 ;;
5861         esac
5862         ;;
5863 esac
5864
5865 : determine root of directory hierarchy where package will be installed.
5866 case "$prefix" in
5867 '')
5868         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5869         ;;
5870 *)
5871         dflt="$prefix"
5872         ;;
5873 esac
5874 $cat <<EOM
5875
5876 By default, $package will be installed in $dflt/bin, manual pages
5877 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5878 installation directories. Typically this is something like /usr/local.
5879 If you wish to have binaries under /usr/bin but other parts of the
5880 installation under /usr/local, that's ok: you will be prompted
5881 separately for each of the installation directories, the prefix being
5882 only used to set the defaults.
5883
5884 EOM
5885 fn=d~
5886 rp='Installation prefix to use?'
5887 . ./getfile
5888 oldprefix=''
5889 case "$prefix" in
5890 '') ;;
5891 *)
5892         case "$ans" in
5893         "$prefix") ;;
5894         *) oldprefix="$prefix";;
5895         esac
5896         ;;
5897 esac
5898 prefix="$ans"
5899 prefixexp="$ansexp"
5900
5901 : is AFS running?
5902 echo " "
5903 case "$afs" in
5904 $define|true)   afs=true ;;
5905 $undef|false)   afs=false ;;
5906 *)      if test -d /afs; then
5907                 afs=true
5908         else
5909                 afs=false
5910         fi
5911         ;;
5912 esac
5913 if $afs; then
5914         echo "AFS may be running... I'll be extra cautious then..." >&4
5915 else
5916         echo "AFS does not seem to be running..." >&4
5917 fi
5918
5919 : determine installation prefix for where package is to be installed.
5920 if $afs; then 
5921 $cat <<EOM
5922
5923 Since you are running AFS, I need to distinguish the directory in which
5924 files will reside from the directory in which they are installed (and from
5925 which they are presumably copied to the former directory by occult means).
5926
5927 EOM
5928         case "$installprefix" in
5929         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5930         *) dflt="$installprefix";;
5931         esac
5932 else
5933 $cat <<EOM
5934
5935 In some special cases, particularly when building $package for distribution,
5936 it is convenient to distinguish between the directory in which files should 
5937 be installed from the directory ($prefix) in which they 
5938 will eventually reside.  For most users, these two directories are the same.
5939
5940 EOM
5941         case "$installprefix" in
5942         '') dflt=$prefix ;;
5943         *) dflt=$installprefix;;
5944         esac
5945 fi
5946 fn=d~
5947 rp='What installation prefix should I use for installing files?'
5948 . ./getfile
5949 installprefix="$ans"
5950 installprefixexp="$ansexp"
5951
5952 : set the prefixit variable, to compute a suitable default value
5953 prefixit='case "$3" in
5954 ""|none)
5955         case "$oldprefix" in
5956         "") eval "$1=\"\$$2\"";;
5957         *)
5958                 case "$3" in
5959                 "") eval "$1=";;
5960                 none)
5961                         eval "tp=\"\$$2\"";
5962                         case "$tp" in
5963                         ""|" ") eval "$1=\"\$$2\"";;
5964                         *) eval "$1=";;
5965                         esac;;
5966                 esac;;
5967         esac;;
5968 *)
5969         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5970         case "$tp" in
5971         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5972         /*-$oldprefix/*|\~*-$oldprefix/*)
5973                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5974         *) eval "$1=\"\$$2\"";;
5975         esac;;
5976 esac'
5977
5978
5979 : get the patchlevel
5980 echo " "
5981 echo "Getting the current patchlevel..." >&4
5982 if $test -r $rsrc/patchlevel.h;then
5983         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5984         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5985         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5986         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5987         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5988         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5989 else
5990         revision=0
5991         patchlevel=0
5992         subversion=0
5993         api_revision=0
5994         api_version=0
5995         api_subversion=0
5996 fi
5997 $echo "(You have $package version $patchlevel subversion $subversion.)"
5998 case "$osname" in
5999 dos|vms)
6000         : XXX Should be a Configure test for double-dots in filenames.
6001         version=`echo $revision $patchlevel $subversion | \
6002                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6003         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6004                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6005         ;;
6006 *)
6007         version=`echo $revision $patchlevel $subversion | \
6008                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6009         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6010                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6011         ;;
6012 esac
6013 : Special case the 5.005_xx maintenance series, which used 5.005
6014 : without any subversion label as a subdirectory in $sitelib
6015 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6016         api_versionstring='5.005'
6017 fi
6018
6019 : determine installation style
6020 : For now, try to deduce it from prefix unless it is already set.
6021 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6022 case "$installstyle" in
6023 '')     case "$prefix" in
6024                 *perl*) dflt='lib';;
6025                 *) dflt='lib/perl5' ;;
6026         esac
6027         ;;
6028 *)      dflt="$installstyle" ;;
6029 esac
6030 : Probably not worth prompting for this since we prompt for all
6031 : the directories individually, and the prompt would be too long and
6032 : confusing anyway.
6033 installstyle=$dflt
6034
6035 : determine where private library files go
6036 : Usual default is /usr/local/lib/perl5/$version.
6037 : Also allow things like /opt/perl/lib/$version, since 
6038 : /opt/perl/lib/perl5... would be redundant.
6039 : The default "style" setting is made in installstyle.U
6040 case "$installstyle" in
6041 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6042 *)       set dflt privlib lib/$version ;;
6043 esac
6044 eval $prefixit
6045 $cat <<EOM
6046
6047 There are some auxiliary files for $package that need to be put into a
6048 private library directory that is accessible by everyone.
6049
6050 EOM
6051 fn=d~+
6052 rp='Pathname where the private library files will reside?'
6053 . ./getfile
6054 privlib="$ans"
6055 privlibexp="$ansexp"
6056 : Change installation prefix, if necessary.
6057 if $test X"$prefix" != X"$installprefix"; then
6058         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6059 else
6060         installprivlib="$privlibexp"
6061 fi
6062
6063 : set the prefixup variable, to restore leading tilda escape
6064 prefixup='case "$prefixexp" in
6065 "$prefix") ;;
6066 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6067 esac'
6068
6069 : determine where public architecture dependent libraries go
6070 set archlib archlib
6071 eval $prefixit
6072 : privlib default is /usr/local/lib/$package/$version
6073 : archlib default is /usr/local/lib/$package/$version/$archname
6074 : privlib may have an optional trailing /share.
6075 tdflt=`echo $privlib | $sed 's,/share$,,'`
6076 tdflt=$tdflt/$archname
6077 case "$archlib" in
6078 '')     dflt=$tdflt
6079         ;;
6080 *)      dflt="$archlib"
6081     ;;
6082 esac
6083 $cat <<EOM
6084
6085 $spackage contains architecture-dependent library files.  If you are
6086 sharing libraries in a heterogeneous environment, you might store
6087 these files in a separate location.  Otherwise, you can just include
6088 them with the rest of the public library files.
6089
6090 EOM
6091 fn=d+~
6092 rp='Where do you want to put the public architecture-dependent libraries?'
6093 . ./getfile
6094 archlib="$ans"
6095 archlibexp="$ansexp"
6096 if $test X"$archlib" = X"$privlib"; then
6097         d_archlib="$undef"
6098 else
6099         d_archlib="$define"
6100 fi
6101 : Change installation prefix, if necessary.
6102 if $test X"$prefix" != X"$installprefix"; then
6103         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6104 else
6105         installarchlib="$archlibexp"
6106 fi
6107
6108
6109 : Binary compatibility with 5.005 is not possible for builds
6110 : with advanced features
6111 case "$usethreads$usemultiplicity" in
6112 *define*)
6113         bincompat5005="$undef"
6114         d_bincompat5005="$undef"
6115         ;;
6116 *)      $cat <<EOM
6117
6118 This version of Perl can be compiled for binary compatibility with 5.005.
6119 If you decide to do so, you will be able to continue using most of the
6120 extensions that were compiled for Perl 5.005.
6121
6122 EOM
6123         case "$bincompat5005$d_bincompat5005" in
6124         *"$undef"*) dflt=n ;;
6125         *) dflt=y ;;
6126         esac
6127         rp='Binary compatibility with Perl 5.005?'
6128         . ./myread
6129         case "$ans" in
6130         y*) val="$define" ;;
6131         *)  val="$undef" ;;
6132         esac
6133         set d_bincompat5005
6134         eval $setvar
6135         case "$d_bincompat5005" in
6136         "$define")
6137                 bincompat5005="$define"
6138                 ;;
6139         *)      bincompat5005="$undef"
6140                 d_bincompat5005="$undef"
6141                 ;;
6142         esac
6143         ;;
6144 esac
6145
6146
6147 : see if setuid scripts can be secure
6148 $cat <<EOM
6149
6150 Some kernels have a bug that prevents setuid #! scripts from being
6151 secure.  Some sites have disabled setuid #! scripts because of this.
6152
6153 First let's decide if your kernel supports secure setuid #! scripts.
6154 (If setuid #! scripts would be secure but have been disabled anyway,
6155 don't say that they are secure if asked.)
6156
6157 EOM
6158
6159 val="$undef"
6160 if $test -d /dev/fd; then
6161         echo "#!$ls" >reflect
6162         chmod +x,u+s reflect
6163         ./reflect >flect 2>&1
6164         if $contains "/dev/fd" flect >/dev/null; then
6165                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6166                 val="$define"
6167         else
6168                 $cat <<EOM
6169 If you are not sure if they are secure, I can check but I'll need a
6170 username and password different from the one you are using right now.
6171 If you don't have such a username or don't want me to test, simply
6172 enter 'none'.
6173
6174 EOM
6175                 rp='Other username to test security of setuid scripts with?'
6176                 dflt='none'
6177                 . ./myread
6178                 case "$ans" in
6179                 n|none)
6180                         case "$d_suidsafe" in
6181                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6182                                 dflt=n;;
6183                         "$undef")
6184                                 echo "Well, the $hint value is *not* secure." >&4
6185                                 dflt=n;;
6186                         *)      echo "Well, the $hint value *is* secure." >&4
6187                                 dflt=y;;
6188                         esac
6189                         ;;
6190                 *)
6191                         $rm -f reflect flect
6192                         echo "#!$ls" >reflect
6193                         chmod +x,u+s reflect
6194                         echo >flect
6195                         chmod a+w flect
6196                         echo '"su" will (probably) prompt you for '"$ans's password."
6197                         su $ans -c './reflect >flect'
6198                         if $contains "/dev/fd" flect >/dev/null; then
6199                                 echo "Okay, it looks like setuid scripts are secure." >&4
6200                                 dflt=y
6201                         else
6202                                 echo "I don't think setuid scripts are secure." >&4
6203                                 dflt=n
6204                         fi
6205                         ;;
6206                 esac
6207                 rp='Does your kernel have *secure* setuid scripts?'
6208                 . ./myread
6209                 case "$ans" in
6210                 [yY]*)  val="$define";;
6211                 *)      val="$undef";;
6212                 esac
6213         fi
6214 else
6215         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6216         echo "(That's for file descriptors, not floppy disks.)"
6217         val="$undef"
6218 fi
6219 set d_suidsafe
6220 eval $setvar
6221
6222 $rm -f reflect flect
6223
6224 : now see if they want to do setuid emulation
6225 echo " "
6226 val="$undef"
6227 case "$d_suidsafe" in
6228 "$define")
6229         val="$undef"
6230         echo "No need to emulate SUID scripts since they are secure here." >& 4
6231         ;;
6232 *)
6233         $cat <<EOM
6234 Some systems have disabled setuid scripts, especially systems where
6235 setuid scripts cannot be secure.  On systems where setuid scripts have
6236 been disabled, the setuid/setgid bits on scripts are currently
6237 useless.  It is possible for $package to detect those bits and emulate
6238 setuid/setgid in a secure fashion.  This emulation will only work if
6239 setuid scripts have been disabled in your kernel.
6240
6241 EOM
6242         case "$d_dosuid" in
6243         "$define") dflt=y ;;
6244         *) dflt=n ;;
6245         esac
6246         rp="Do you want to do setuid/setgid emulation?"
6247         . ./myread
6248         case "$ans" in
6249         [yY]*)  val="$define";;
6250         *)      val="$undef";;
6251         esac
6252         ;;
6253 esac
6254 set d_dosuid
6255 eval $setvar
6256
6257 : see if this is a malloc.h system
6258 set malloc.h i_malloc
6259 eval $inhdr
6260
6261 : see if stdlib is available
6262 set stdlib.h i_stdlib
6263 eval $inhdr
6264
6265 : determine which malloc to compile in
6266 echo " "
6267 case "$usemymalloc" in
6268 ''|[yY]*|true|$define)  dflt='y' ;;
6269 *)      dflt='n' ;;
6270 esac
6271 case "$ptrsize" in
6272 4) ;;
6273 *) dflt='n' ;;
6274 esac
6275 rp="Do you wish to attempt to use the malloc that comes with $package?"
6276 . ./myread
6277 usemymalloc="$ans"
6278 case "$ans" in
6279 y*|true)
6280         usemymalloc='y'
6281         mallocsrc='malloc.c'
6282         mallocobj="malloc$_o"
6283         d_mymalloc="$define"
6284         case "$libs" in
6285         *-lmalloc*)
6286                 : Remove malloc from list of libraries to use
6287                 echo "Removing unneeded -lmalloc from library list" >&4
6288                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6289                 shift
6290                 libs="$*"
6291                 echo "libs = $libs" >&4
6292                 ;;
6293         esac
6294         ;;
6295 *)
6296         usemymalloc='n'
6297         mallocsrc=''
6298         mallocobj=''
6299         d_mymalloc="$undef"
6300         ;;
6301 esac
6302
6303 : compute the return types of malloc and free
6304 echo " "
6305 $cat >malloc.c <<END
6306 #$i_malloc I_MALLOC
6307 #$i_stdlib I_STDLIB
6308 #include <stdio.h>
6309 #include <sys/types.h>
6310 #ifdef I_MALLOC
6311 #include <malloc.h>
6312 #endif
6313 #ifdef I_STDLIB
6314 #include <stdlib.h>
6315 #endif
6316 #ifdef TRY_MALLOC
6317 void *malloc();
6318 #endif
6319 #ifdef TRY_FREE
6320 void free();
6321 #endif
6322 END
6323 case "$malloctype" in
6324 '')
6325         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6326                 malloctype='void *'
6327         else
6328                 malloctype='char *'
6329         fi
6330         ;;
6331 esac
6332 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6333
6334 case "$freetype" in
6335 '')
6336         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6337                 freetype='void'
6338         else
6339                 freetype='int'
6340         fi
6341         ;;
6342 esac
6343 echo "Your system uses $freetype free(), it would seem." >&4
6344 $rm -f malloc.[co]
6345 $cat <<EOM
6346
6347 After $package is installed, you may wish to install various
6348 add-on modules and utilities.  Typically, these add-ons will
6349 be installed under $prefix with the rest
6350 of this package.  However, you may wish to install such add-ons
6351 elsewhere under a different prefix.
6352
6353 If you do not wish to put everything under a single prefix, that's
6354 ok.  You will be prompted for the individual locations; this siteprefix
6355 is only used to suggest the defaults.
6356
6357 The default should be fine for most people.
6358
6359 EOM
6360 fn=d~+
6361 rp='Installation prefix to use for add-on modules and utilities?'
6362 : XXX Here might be another good place for an installstyle setting.
6363 case "$siteprefix" in
6364 '') dflt=$prefix ;;
6365 *)  dflt=$siteprefix ;;
6366 esac
6367 . ./getfile
6368 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6369 oldsiteprefix=''
6370 case "$siteprefix" in
6371 '') ;;
6372 *)      case "$ans" in
6373         "$prefix") ;;
6374         *) oldsiteprefix="$prefix";;
6375         esac
6376         ;;
6377 esac
6378 siteprefix="$ans"
6379 siteprefixexp="$ansexp"
6380
6381 : determine where site specific libraries go.
6382 : Usual default is /usr/local/lib/perl5/site_perl/$version
6383 : The default "style" setting is made in installstyle.U
6384 : XXX No longer works with Prefixit stuff.
6385 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6386 case "$sitelib" in
6387 '') case "$installstyle" in
6388         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6389         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6390         esac
6391         ;;
6392 *)      dflt="$sitelib"
6393         ;;
6394 esac
6395 $cat <<EOM
6396
6397 The installation process will create a directory for
6398 site-specific extensions and modules.  Most users find it convenient
6399 to place all site-specific files in this directory rather than in the
6400 main distribution directory.
6401
6402 EOM
6403 fn=d~+
6404 rp='Pathname for the site-specific library files?'
6405 . ./getfile
6406 sitelib="$ans"
6407 sitelibexp="$ansexp"
6408 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6409 : Change installation prefix, if necessary.
6410 if $test X"$prefix" != X"$installprefix"; then
6411         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6412 else
6413         installsitelib="$sitelibexp"
6414 fi
6415
6416 : determine where site specific architecture-dependent libraries go.
6417 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6418 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6419 : sitelib may have an optional trailing /share.
6420 case "$sitearch" in
6421 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6422         dflt="$dflt/$archname"
6423         ;;
6424 *)      dflt="$sitearch"
6425         ;;
6426 esac
6427 set sitearch sitearch none
6428 eval $prefixit
6429 $cat <<EOM
6430
6431 The installation process will also create a directory for
6432 architecture-dependent site-specific extensions and modules.
6433
6434 EOM
6435 fn=d~+
6436 rp='Pathname for the site-specific architecture-dependent library files?'
6437 . ./getfile
6438 sitearch="$ans"
6439 sitearchexp="$ansexp"
6440 : Change installation prefix, if necessary.
6441 if $test X"$prefix" != X"$installprefix"; then
6442         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6443 else
6444         installsitearch="$sitearchexp"
6445 fi
6446
6447 $cat <<EOM
6448
6449 The installation process will also create a directory for
6450 vendor-supplied add-ons.  Vendors who supply perl with their system
6451 may find it convenient to place all vendor-supplied files in this
6452 directory rather than in the main distribution directory.  This will
6453 ease upgrades between binary-compatible maintenance versions of perl.
6454
6455 Of course you may also use these directories in whatever way you see
6456 fit.  For example, you might use them to access modules shared over a
6457 company-wide network.
6458
6459 The default answer should be fine for most people.
6460 This causes further questions about vendor add-ons to be skipped
6461 and no vendor-specific directories will be configured for perl.
6462
6463 EOM
6464 rp='Do you want to configure vendor-specific add-on directories?'
6465 case "$usevendorprefix" in
6466 define|true|[yY]*) dflt=y ;;
6467 *)      : User may have set vendorprefix directly on Configure command line.
6468         case "$vendorprefix" in
6469         ''|' ') dflt=n ;;
6470         *)      dflt=y ;;
6471         esac
6472         ;;
6473 esac
6474 . ./myread
6475 case "$ans" in
6476 [yY]*)  fn=d~+
6477         rp='Installation prefix to use for vendor-supplied add-ons?'
6478         case "$vendorprefix" in
6479         '') dflt='' ;;
6480         *)  dflt=$vendorprefix ;;
6481         esac
6482         . ./getfile
6483         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6484         oldvendorprefix=''
6485         case "$vendorprefix" in
6486         '') ;;
6487         *)      case "$ans" in
6488                 "$prefix") ;;
6489                 *) oldvendorprefix="$prefix";;
6490                 esac
6491                 ;;
6492         esac
6493         usevendorprefix="$define"
6494         vendorprefix="$ans"
6495         vendorprefixexp="$ansexp"
6496         ;;
6497 *)      usevendorprefix="$undef"
6498         vendorprefix=''
6499         vendorprefixexp=''
6500         ;;
6501 esac
6502
6503 case "$vendorprefix" in
6504 '')     d_vendorlib="$undef"
6505         vendorlib=''
6506         vendorlibexp=''
6507         ;;
6508 *)      d_vendorlib="$define"
6509         : determine where vendor-supplied modules go.
6510         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6511         case "$vendorlib" in
6512         '')
6513                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6514                 case "$installstyle" in
6515                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6516                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6517                 esac
6518                 ;;
6519         *)      dflt="$vendorlib"
6520                 ;;
6521         esac
6522         fn=d~+
6523         rp='Pathname for the vendor-supplied library files?'
6524         . ./getfile
6525         vendorlib="$ans"
6526         vendorlibexp="$ansexp"
6527         ;;
6528 esac
6529 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6530 : Change installation prefix, if necessary.
6531 if $test X"$prefix" != X"$installprefix"; then
6532         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6533 else
6534         installvendorlib="$vendorlibexp"
6535 fi
6536
6537 case "$vendorprefix" in
6538 '')     d_vendorarch="$undef"
6539         vendorarch=''
6540         vendorarchexp=''
6541         ;;
6542 *)      d_vendorarch="$define"
6543         : determine where vendor-supplied architecture-dependent libraries go.
6544         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6545         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6546         : vendorlib may have an optional trailing /share.
6547         case "$vendorarch" in
6548         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6549                 dflt="$dflt/$archname"
6550                 ;;
6551         *)      dflt="$vendorarch" ;;
6552         esac
6553         fn=d~+
6554         rp='Pathname for vendor-supplied architecture-dependent files?'
6555         . ./getfile
6556         vendorarch="$ans"
6557         vendorarchexp="$ansexp"
6558         ;;
6559 esac
6560 : Change installation prefix, if necessary.
6561 if $test X"$prefix" != X"$installprefix"; then
6562         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6563 else
6564         installvendorarch="$vendorarchexp"
6565 fi
6566
6567 : Final catch-all directories to search
6568 $cat <<EOM
6569
6570 Lastly, you can have perl look in other directories for extensions and
6571 modules in addition to those already specified.
6572 These directories will be searched after 
6573         $sitearch 
6574         $sitelib 
6575 EOM
6576 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6577 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6578 echo ' '
6579 case "$otherlibdirs" in
6580 ''|' ') dflt='none' ;;
6581 *)      dflt="$otherlibdirs" ;;
6582 esac
6583 $cat <<EOM
6584 Enter a colon-separated set of extra paths to include in perl's @INC
6585 search path, or enter 'none' for no extra paths.
6586
6587 EOM
6588
6589 rp='Colon-separated list of additional directories for perl to search?'
6590 . ./myread
6591 case "$ans" in
6592 ' '|''|none)    otherlibdirs=' ' ;;     
6593 *)      otherlibdirs="$ans" ;;
6594 esac
6595 case "$otherlibdirs" in
6596 ' ') val=$undef ;;
6597 *)      val=$define ;;
6598 esac
6599 set d_perl_otherlibdirs
6600 eval $setvar
6601
6602 : Cruising for prototypes
6603 echo " "
6604 echo "Checking out function prototypes..." >&4
6605 $cat >prototype.c <<'EOCP'
6606 int main(int argc, char *argv[]) {
6607         exit(0);}
6608 EOCP
6609 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6610         echo "Your C compiler appears to support function prototypes."
6611         val="$define"
6612 else
6613         echo "Your C compiler doesn't seem to understand function prototypes."
6614         val="$undef"
6615 fi
6616 set prototype
6617 eval $setvar
6618 $rm -f prototype*
6619
6620 case "$prototype" in
6621 "$define") ;;
6622 *)      ansi2knr='ansi2knr'
6623         echo " "
6624         cat <<EOM >&4
6625
6626 $me:  FATAL ERROR:
6627 This version of $package can only be compiled by a compiler that 
6628 understands function prototypes.  Unfortunately, your C compiler 
6629         $cc $ccflags
6630 doesn't seem to understand them.  Sorry about that.
6631
6632 If GNU cc is available for your system, perhaps you could try that instead.  
6633
6634 Eventually, we hope to support building Perl with pre-ANSI compilers.
6635 If you would like to help in that effort, please contact <perlbug@perl.org>.
6636
6637 Aborting Configure now.
6638 EOM
6639         exit 2
6640         ;;
6641 esac
6642
6643 : determine where public executables go
6644 echo " "
6645 set dflt bin bin
6646 eval $prefixit
6647 fn=d~
6648 rp='Pathname where the public executables will reside?'
6649 . ./getfile
6650 if $test "X$ansexp" != "X$binexp"; then
6651         installbin=''
6652 fi
6653 bin="$ans"
6654 binexp="$ansexp"
6655 : Change installation prefix, if necessary.
6656 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6657 if $test X"$prefix" != X"$installprefix"; then
6658         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6659 else
6660         installbin="$binexp"
6661 fi
6662
6663 : Find perl5.005 or later.
6664 echo "Looking for a previously installed perl5.005 or later... "
6665 case "$perl5" in
6666 '')     for tdir in `echo "$binexp:$PATH" | $sed "s/$path_sep/ /g"`; do
6667                 : Check if this perl is recent and can load a simple module
6668                 if $test -x $tdir/perl && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6669                         perl5=$tdir/perl
6670                         break;
6671                 elif $test -x $tdir/perl5 && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6672                         perl5=$tdir/perl
6673                         break;
6674                 fi
6675         done
6676         ;;
6677 *)      perl5="$perl5"
6678         ;;
6679 esac
6680 case "$perl5" in
6681 '')     echo "None found.  That's ok.";;
6682 *)      echo "Using $perl5." ;;
6683 esac
6684
6685 : Determine list of previous versions to include in @INC
6686 $cat > getverlist <<EOPL
6687 #!$perl5 -w
6688 use File::Basename;
6689 \$api_versionstring = "$api_versionstring";
6690 \$version = "$version";
6691 \$stem = "$sitelib_stem";
6692 \$archname = "$archname";
6693 EOPL
6694         $cat >> getverlist <<'EOPL'
6695 # Can't have leading @ because metaconfig interprets it as a command!
6696 ;@inc_version_list=();
6697 # XXX Redo to do opendir/readdir? 
6698 if (-d $stem) {
6699     chdir($stem);
6700     ;@candidates = glob("5.*");
6701 }
6702 else {
6703     ;@candidates = ();
6704 }
6705
6706 # XXX ToDo:  These comparisons must be reworked when two-digit
6707 # subversions come along, so that 5.7.10 compares as greater than
6708 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6709 # widespread that we can use the built-in version vectors rather
6710 # than reinventing them here.  For 5.6.0, however, we must
6711 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6712 foreach $d (@candidates) {
6713     if ($d lt $version) {
6714         if ($d ge $api_versionstring) {
6715             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6716         }
6717         elsif ($d ge "5.005") {
6718             unshift(@inc_version_list, grep { -d } $d);
6719         }
6720     }
6721     else {
6722         # Skip newer version.  I.e. don't look in
6723         # 5.7.0 if we're installing 5.6.1.
6724     }
6725 }
6726
6727 if (@inc_version_list) {
6728     print join(' ', @inc_version_list);
6729 }
6730 else {
6731     # Blank space to preserve value for next Configure run.
6732     print " ";
6733 }
6734 EOPL
6735 chmod +x getverlist
6736 case "$inc_version_list" in
6737 '')     if test -x "$perl5"; then
6738                 dflt=`$perl5 getverlist`
6739         else
6740                 dflt='none'
6741         fi
6742         ;;
6743 $undef) dflt='none' ;;
6744 *)  dflt="$inc_version_list" ;;
6745 esac
6746 case "$dflt" in
6747 ''|' ') dflt=none ;;
6748 esac
6749 case "$dflt" in
6750 5.005) case "$bincompat5005" in
6751        $define|true|[yY]*) ;;
6752        *) dflt=none ;;
6753        esac
6754        ;;
6755 esac
6756 $cat <<'EOM'
6757
6758 In order to ease the process of upgrading, this version of perl 
6759 can be configured to use modules built and installed with earlier 
6760 versions of perl that were installed under $prefix.  Specify here
6761 the list of earlier versions that this version of perl should check.
6762 If Configure detected no earlier versions of perl installed under
6763 $prefix, then the list will be empty.  Answer 'none' to tell perl
6764 to not search earlier versions.
6765
6766 The default should almost always be sensible, so if you're not sure,
6767 just accept the default.
6768 EOM
6769
6770 rp='List of earlier versions to include in @INC?'
6771 . ./myread
6772 case "$ans" in
6773 [Nn]one|''|' ') inc_version_list=' ' ;;
6774 *) inc_version_list="$ans" ;;
6775 esac
6776 case "$inc_version_list" in
6777 ''|' ') 
6778         inc_version_list_init='0';;
6779 *)      inc_version_list_init=`echo $inc_version_list |
6780                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6781         ;;
6782 esac
6783 $rm -f getverlist
6784
6785 : determine whether to install perl also as /usr/bin/perl
6786
6787 echo " "
6788 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6789         $cat <<EOM
6790 Many scripts expect perl to be installed as /usr/bin/perl.
6791 I can install the perl you are about to compile also as /usr/bin/perl
6792 (in addition to $installbin/perl).
6793 EOM
6794         case "$installusrbinperl" in
6795         "$undef"|[nN]*) dflt='n';;
6796         *)              dflt='y';;
6797         esac
6798         rp="Do you want to install perl as /usr/bin/perl?"
6799         . ./myread
6800         case "$ans" in
6801         [yY]*)  val="$define";;
6802         *)      val="$undef" ;;
6803         esac
6804 else
6805         val="$undef"
6806 fi
6807 set installusrbinperl
6808 eval $setvar
6809
6810 : see if dld is available
6811 set dld.h i_dld
6812 eval $inhdr
6813
6814 : see if dlopen exists
6815 xxx_runnm="$runnm"
6816 runnm=false
6817 set dlopen d_dlopen
6818 eval $inlibc
6819 runnm="$xxx_runnm"
6820
6821 : determine which dynamic loading, if any, to compile in
6822 echo " "
6823 dldir="ext/DynaLoader"
6824 case "$usedl" in
6825 $define|y|true)
6826         dflt='y'
6827         usedl="$define"
6828         ;;
6829 $undef|n|false)
6830         dflt='n'
6831         usedl="$undef"
6832         ;;
6833 *) 
6834         dflt='n'
6835         case "$d_dlopen" in
6836             $define) dflt='y' ;;
6837         esac
6838         case "$i_dld" in
6839             $define) dflt='y' ;;
6840         esac
6841         : Does a dl_xxx.xs file exist for this operating system
6842         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
6843         ;;
6844 esac
6845 rp="Do you wish to use dynamic loading?"
6846 . ./myread
6847 usedl="$ans"
6848 case "$ans" in
6849 y*) usedl="$define"
6850         case "$dlsrc" in
6851         '')
6852                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
6853                         dflt="$dldir/dl_${osname}.xs"
6854                 elif $test "$d_dlopen" = "$define" ; then
6855                         dflt="$dldir/dl_dlopen.xs"
6856                 elif $test "$i_dld" = "$define" ; then
6857                         dflt="$dldir/dl_dld.xs"
6858                 else
6859                         dflt=''
6860                 fi
6861                 ;;
6862         *)      dflt="$dldir/$dlsrc"
6863                 ;;
6864         esac
6865     echo "The following dynamic loading files are available:"
6866         : Can not go over to $dldir because getfile has path hard-coded in.
6867         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
6868         rp="Source file to use for dynamic loading"
6869         fn="fne"
6870         gfpth="$src"
6871         . ./getfile
6872         usedl="$define"
6873         : emulate basename
6874         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
6875
6876         $cat << EOM
6877
6878 Some systems may require passing special flags to $cc -c to
6879 compile modules that will be used to create a shared library.
6880 To use no flags, say "none".
6881
6882 EOM
6883     case "$cccdlflags" in
6884     '') case "$gccversion" in
6885                 '') case "$osname" in
6886                         hpux)   dflt='+z' ;;
6887                         next)   dflt='none' ;;
6888                         irix*)  dflt='-KPIC' ;;
6889                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
6890                         sunos)  dflt='-pic' ;;
6891                         *)      dflt='none' ;;
6892                     esac
6893                         ;;
6894                 *)  case "$osname" in
6895                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
6896                         *)      dflt='-fpic' ;;
6897                     esac ;;
6898             esac ;;
6899         ' ') dflt='none' ;;
6900     *)  dflt="$cccdlflags" ;;
6901     esac
6902     rp="Any special flags to pass to $cc -c to compile shared library modules?"
6903     . ./myread
6904     case "$ans" in
6905     none) cccdlflags=' ' ;;
6906     *) cccdlflags="$ans" ;;
6907     esac
6908
6909     cat << EOM
6910
6911 Some systems use ld to create libraries that can be dynamically loaded,
6912 while other systems (such as those using ELF) use $cc.
6913
6914 EOM
6915         case "$ld" in
6916         '')     $cat >try.c <<'EOM'
6917 /* Test for whether ELF binaries are produced */
6918 #include <fcntl.h>
6919 #include <stdlib.h>
6920 int main() {
6921         char b[4];
6922         int i = open("a.out",O_RDONLY);
6923         if(i == -1) 
6924                 exit(1); /* fail */
6925         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
6926                 exit(0); /* succeed (yes, it's ELF) */
6927         else
6928                 exit(1); /* fail */
6929 }
6930 EOM
6931                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
6932                         cat <<EOM
6933 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
6934 EOM
6935                         dflt="$cc"
6936                 else
6937                         echo "I'll use ld to build dynamic libraries."
6938                         dflt='ld'
6939                 fi
6940                 rm -f try.c a.out
6941                 ;;
6942         *)      dflt="$ld"
6943                 ;;
6944         esac
6945
6946     rp="What command should be used to create dynamic libraries?"
6947     . ./myread
6948         ld="$ans"
6949
6950     cat << EOM
6951
6952 Some systems may require passing special flags to $ld to create a
6953 library that can be dynamically loaded.  If your ld flags include
6954 -L/other/path options to locate libraries outside your loader's normal
6955 search path, you may need to specify those -L options here as well.  To
6956 use no flags, say "none".
6957
6958 EOM
6959     case "$lddlflags" in
6960     '') case "$osname" in
6961                         beos) dflt='-nostart' ;;
6962                         hpux) dflt='-b';
6963                               case "$gccversion" in
6964                               '') dflt="$dflt +vnocompatwarnings" ;;
6965                               esac
6966                               ;;        
6967                         linux|irix*)    dflt='-shared' ;;
6968                         next)  dflt='none' ;;
6969                         solaris) dflt='-G' ;;
6970                         sunos) dflt='-assert nodefinitions' ;;
6971                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
6972                 *)     dflt='none' ;;
6973                         esac
6974                         ;;
6975     *) dflt="$lddlflags" ;;
6976     esac
6977
6978         : Try to guess additional flags to pick up local libraries.
6979         : Be careful not to append to a plain 'none'
6980         case "$dflt" in
6981         none) dflt='' ;;
6982         esac
6983         for thisflag in $ldflags; do
6984                 case "$thisflag" in
6985                 -L*|-R*)
6986                         case " $dflt " in
6987                         *" $thisflag "*) ;;
6988                         *) dflt="$dflt $thisflag" ;;
6989                         esac
6990                         ;;
6991                 esac
6992         done
6993
6994         case "$dflt" in
6995         ''|' ') dflt='none' ;;
6996         esac
6997
6998     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
6999     . ./myread
7000     case "$ans" in
7001     none) lddlflags=' ' ;;
7002     *) lddlflags="$ans" ;;
7003     esac
7004
7005         cat <<EOM
7006
7007 Some systems may require passing special flags to $cc to indicate that
7008 the resulting executable will use dynamic linking.  To use no flags,
7009 say "none".
7010
7011 EOM
7012     case "$ccdlflags" in
7013     '') case "$osname" in
7014                 hpux)   dflt='-Wl,-E' ;;
7015                 linux)  dflt='-rdynamic' ;;
7016                 next)   dflt='none' ;;
7017                 sunos)  dflt='none' ;;
7018                 *)      dflt='none' ;;
7019             esac ;;
7020     ' ')  dflt='none' ;;
7021     *)  dflt="$ccdlflags" ;;
7022     esac
7023     rp="Any special flags to pass to $cc to use dynamic linking?"
7024     . ./myread
7025     case "$ans" in
7026     none) ccdlflags=' ' ;;
7027     *) ccdlflags="$ans" ;;
7028     esac
7029     ;;
7030 *)  usedl="$undef"
7031         ld='ld'
7032     dlsrc='dl_none.xs'
7033     lddlflags=''
7034     ccdlflags=''
7035     ;;
7036 esac
7037
7038 also=''
7039 case "$usedl" in
7040 $undef)
7041         # No dynamic loading being used, so don't bother even to prompt.
7042         useshrplib='false'
7043         ;;
7044 *)      case "$useshrplib" in
7045         '')     case "$osname" in
7046                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7047                         dflt=y
7048                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7049                         ;;
7050                 next*)
7051                         case "$osvers" in
7052                         4*)     dflt=y
7053                                 also='Building a shared libperl is needed for MAB support.'
7054                                 ;;
7055                         *)      dflt=n
7056                                 ;;
7057                         esac
7058                         ;;
7059                 *)      dflt=n
7060                         ;;
7061                 esac
7062                 ;;
7063         $define|true|[Yy]*)
7064                 dflt=y
7065                 ;;
7066         *)      dflt=n
7067                 ;;
7068         esac
7069         $cat << EOM
7070
7071 The perl executable is normally obtained by linking perlmain.c with
7072 libperl${_a}, any static extensions (usually just DynaLoader), and
7073 any other libraries needed on this system (such as -lm, etc.).  Since
7074 your system supports dynamic loading, it is probably possible to build
7075 a shared libperl.$so.  If you will have more than one executable linked
7076 to libperl.$so, this will significantly reduce the size of each
7077 executable, but it may have a noticeable affect on performance.  The
7078 default is probably sensible for your system.
7079 $also
7080
7081 EOM
7082         rp="Build a shared libperl.$so (y/n)"
7083         . ./myread
7084         case "$ans" in
7085         true|$define|[Yy]*)
7086                 useshrplib='true'  ;;
7087         *)      useshrplib='false' ;;
7088         esac
7089         ;;
7090 esac
7091
7092 case "$useshrplib" in
7093 true)
7094         case "$libperl" in
7095         '')
7096                 # Figure out a good name for libperl.so.  Since it gets stored in
7097                 # a version-specific architecture-dependent library, the version
7098                 # number isn't really that important, except for making cc/ld happy.
7099                 #
7100                 # A name such as libperl.so.3.1
7101                 majmin="libperl.$so.$patchlevel.$subversion"
7102                 # A name such as libperl.so.301
7103                 majonly=`echo $patchlevel $subversion |
7104                         $awk '{printf "%d%02d", $1, $2}'`
7105                 majonly=libperl.$so.$majonly
7106                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7107                 # rely on figuring it out from the naming of libc.
7108                 case "${osname}${osvers}" in
7109                 next4*)
7110                         dflt=libperl.5.$so
7111                         # XXX How handle the --version stuff for MAB?
7112                         ;;
7113                 linux*)  # ld won't link with a bare -lperl otherwise.
7114                         dflt=libperl.$so
7115                         ;;
7116                 cygwin*) # include version
7117                         dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
7118                         ;;
7119                 *)      # Try to guess based on whether libc has major.minor.
7120                         case "$libc" in
7121                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7122                         *libc.$so.[0-9]*) dflt=$majonly ;;
7123                         *)      dflt=libperl.$so ;;
7124                         esac
7125                         ;;
7126                 esac
7127                 ;;
7128         *)      dflt=$libperl
7129                 ;;
7130         esac
7131         cat << EOM
7132
7133 I need to select a good name for the shared libperl.  If your system uses
7134 library names with major and minor numbers, then you might want something
7135 like $majmin.  Alternatively, if your system uses a single version
7136 number for shared libraries, then you might want to use $majonly.
7137 Or, your system might be quite happy with a simple libperl.$so.
7138
7139 Since the shared libperl will get installed into a version-specific
7140 architecture-dependent directory, the version number of the shared perl
7141 library probably isn't important, so the default should be o.k.
7142
7143 EOM
7144         rp='What name do you want to give to the shared libperl?'
7145         . ./myread
7146         libperl=$ans
7147         echo "Ok, I'll use $libperl"
7148         ;;
7149 *)
7150         libperl="libperl${_a}"
7151         ;;
7152 esac
7153
7154 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7155 case "$shrpdir" in
7156 '') ;;
7157 *)      $cat >&4 <<EOM
7158 WARNING:  Use of the shrpdir variable for the installation location of
7159 the shared $libperl is not supported.  It was never documented and
7160 will not work in this version.  Let me (perlbug@perl.org)
7161 know of any problems this may cause.
7162
7163 EOM
7164         case "$shrpdir" in
7165         "$archlibexp/CORE")
7166                 $cat >&4 <<EOM
7167 But your current setting of $shrpdir is
7168 the default anyway, so it's harmless.
7169 EOM
7170                 ;;
7171         *)
7172                 $cat >&4 <<EOM
7173 Further, your current attempted setting of $shrpdir
7174 conflicts with the value of $archlibexp/CORE
7175 that installperl will use.
7176 EOM
7177                 ;;
7178         esac
7179         ;;
7180 esac
7181
7182 # How will the perl executable find the installed shared $libperl?
7183 # Add $xxx to ccdlflags.
7184 # If we can't figure out a command-line option, use $shrpenv to
7185 # set env LD_RUN_PATH.  The main perl makefile uses this.
7186 shrpdir=$archlibexp/CORE
7187 xxx=''
7188 tmp_shrpenv=''
7189 if "$useshrplib"; then
7190     case "$osname" in 
7191         aix)
7192                 # We'll set it in Makefile.SH...
7193                 ;;
7194         solaris|netbsd)
7195                 xxx="-R $shrpdir"
7196                 ;;
7197         freebsd)
7198                 xxx="-Wl,-R$shrpdir"
7199                 ;;
7200         linux|irix*|dec_osf)
7201                 xxx="-Wl,-rpath,$shrpdir"
7202                 ;;
7203         next)
7204                 # next doesn't like the default...
7205                 ;;
7206         beos)
7207                 # beos doesn't like the default, either.
7208                 ;;
7209         hpux*)
7210                 # hpux doesn't like the default, either.
7211                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7212                 ;;
7213         *)
7214                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7215                 ;;
7216         esac
7217         case "$xxx" in
7218         '') ;;
7219         *)      
7220                 # Only add $xxx if it isn't already in ccdlflags.
7221                 case " $ccdlflags " in
7222                 *" $xxx "*)     ;;
7223                 *)      ccdlflags="$ccdlflags $xxx"
7224                         cat <<EOM >&4
7225
7226 Adding $xxx to the flags
7227 passed to $ld so that the perl executable will find the 
7228 installed shared $libperl.
7229
7230 EOM
7231                         ;;
7232                 esac
7233                 ;;
7234         esac
7235 fi
7236 # Fix ccdlflags in AIX for building external extensions.
7237 # (For building Perl itself bare -bE:perl.exp is needed,
7238 #  Makefile.SH takes care of this.)
7239 case "$osname" in
7240 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7241 esac
7242 # Respect a hint or command-line value.
7243 case "$shrpenv" in
7244 '') shrpenv="$tmp_shrpenv" ;;
7245 esac
7246 case "$ldlibpthname" in
7247 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7248 none)   ldlibpthname='' ;;
7249 esac
7250
7251 : determine where manual pages are on this system
7252 echo " "
7253 case "$sysman" in
7254 '') 
7255         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
7256         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
7257         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7258         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7259         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7260         sysman=`./loc . /usr/man/man1 $syspath`
7261         ;;
7262 esac
7263 if $test -d "$sysman"; then
7264         echo "System manual is in $sysman." >&4
7265 else
7266         echo "Could not find manual pages in source form." >&4
7267 fi
7268
7269 : determine where manual pages go
7270 set man1dir man1dir none
7271 eval $prefixit
7272 $cat <<EOM
7273
7274 $spackage has manual pages available in source form.
7275 EOM
7276 case "$nroff" in
7277 nroff)
7278         echo "However, you don't have nroff, so they're probably useless to you."
7279         case "$man1dir" in
7280         '') man1dir="none";;
7281         esac;;
7282 esac
7283 echo "If you don't want the manual sources installed, answer 'none'."
7284 case "$man1dir" in
7285 ' ') dflt=none
7286         ;;
7287 '')
7288         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
7289         lookpath="$lookpath $prefixexp/man/p_man/man1"
7290         lookpath="$lookpath $prefixexp/man/u_man/man1"
7291         lookpath="$lookpath $prefixexp/man/man.1"
7292         case "$sysman" in
7293         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7294         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7295         esac
7296         set dflt
7297         eval $prefixup
7298         ;;
7299 *)  dflt="$man1dir"
7300         ;;
7301 esac
7302 echo " "
7303 fn=dn+~
7304 rp="Where do the main $spackage manual pages (source) go?"
7305 . ./getfile
7306 if $test "X$man1direxp" != "X$ansexp"; then
7307         installman1dir=''
7308 fi
7309 man1dir="$ans"
7310 man1direxp="$ansexp"
7311 case "$man1dir" in
7312 '')     man1dir=' '
7313         installman1dir='';;
7314 esac
7315
7316 : Change installation prefix, if necessary.
7317 if $test X"$prefix" != X"$installprefix"; then
7318         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7319 else
7320         installman1dir="$man1direxp"
7321 fi
7322
7323 : What suffix to use on installed man pages
7324
7325 case "$man1dir" in
7326 ' ')
7327         man1ext='0'
7328         ;;
7329 *)
7330         rp="What suffix should be used for the main $spackage man pages?"
7331         case "$man1ext" in
7332         '')     case "$man1dir" in
7333                 *1)  dflt=1 ;;
7334                 *1p) dflt=1p ;;
7335                 *1pm) dflt=1pm ;;
7336                 *l) dflt=l;;
7337                 *n) dflt=n;;
7338                 *o) dflt=o;;
7339                 *p) dflt=p;;
7340                 *C) dflt=C;;
7341                 *L) dflt=L;;
7342                 *L1) dflt=L1;;
7343                 *) dflt=1;;
7344                 esac
7345                 ;;
7346         *)      dflt="$man1ext";;
7347         esac
7348         . ./myread
7349         man1ext="$ans"
7350         ;;
7351 esac
7352
7353 : see if we can have long filenames
7354 echo " "
7355 first=123456789abcdef
7356 $rm -f $first
7357 if (echo hi >$first) 2>/dev/null; then
7358         if $test -f 123456789abcde; then
7359                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
7360                 val="$undef"
7361         else
7362                 echo 'You can have filenames longer than 14 characters.'>&4
7363                 val="$define"
7364         fi
7365 else
7366         $cat <<'EOM'
7367 You can't have filenames longer than 14 chars.
7368 You can't even think about them!
7369 EOM
7370         val="$undef"
7371 fi 
7372 set d_flexfnam
7373 eval $setvar
7374 $rm -rf 123456789abcde*
7375
7376 : determine where library module manual pages go
7377 set man3dir man3dir none
7378 eval $prefixit
7379 $cat <<EOM
7380
7381 $spackage has manual pages for many of the library modules.
7382 EOM
7383
7384 case "$nroff" in
7385 nroff)
7386         $cat <<'EOM'
7387 However, you don't have nroff, so they're probably useless to you.
7388 EOM
7389         case "$man3dir" in
7390         '') man3dir="none";;
7391         esac;;
7392 esac
7393
7394 case "$d_flexfnam" in
7395 undef)
7396         $cat <<'EOM'
7397 However, your system can't handle the long file names like File::Basename.3. 
7398 EOM
7399         case "$man3dir" in
7400         '') man3dir="none";;
7401         esac;;
7402 esac
7403
7404 echo "If you don't want the manual sources installed, answer 'none'."
7405 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7406 case "$man3dir" in
7407 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
7408         if $test -d "$privlib/man/man3"; then
7409                 cat <<EOM >&4
7410
7411 WARNING:  Previous versions of perl installed man3 pages into
7412 $privlib/man/man3.  This version will suggest a 
7413 new default of $dflt.  
7414 EOM
7415                 tdflt=$dflt
7416                 dflt='n'
7417                 rp='Do you wish to preserve the old behavior?(y/n)'
7418                 . ./myread
7419                 case "$ans" in
7420                 y*) dflt="$privlib/man/man3" ;;
7421                 *)  dflt=$tdflt ;;
7422                 esac
7423     fi
7424         ;;
7425 *)      dflt="$man3dir" ;;
7426 esac
7427 case "$dflt" in
7428 ' ') dflt=none ;;
7429 esac
7430 echo " "
7431 fn=dn+~
7432 rp="Where do the $package library man pages (source) go?"
7433 . ./getfile
7434 man3dir="$ans"
7435 man3direxp="$ansexp"
7436 case "$man3dir" in
7437 '')     man3dir=' '
7438         installman3dir='';;
7439 esac
7440
7441 : Change installation prefix, if necessary.
7442 if $test X"$prefix" != X"$installprefix"; then
7443         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
7444 else
7445         installman3dir="$man3direxp"
7446 fi
7447
7448 : What suffix to use on installed man pages
7449 case "$man3dir" in
7450 ' ')
7451         man3ext='0'
7452         ;;
7453 *)
7454         rp="What suffix should be used for the $package library man pages?"
7455         case "$man3ext" in
7456         '')     case "$man3dir" in
7457                 *3)  dflt=3 ;;
7458                 *3p) dflt=3p ;;
7459                 *3pm) dflt=3pm ;;
7460                 *l) dflt=l;;
7461                 *n) dflt=n;;
7462                 *o) dflt=o;;
7463                 *p) dflt=p;;
7464                 *C) dflt=C;;
7465                 *L) dflt=L;;
7466                 *L3) dflt=L3;;
7467                 *) dflt=3;;
7468                 esac
7469                 ;;
7470         *)      dflt="$man3ext";;
7471         esac
7472         . ./myread
7473         man3ext="$ans"
7474         ;;
7475 esac
7476
7477 : see if we have to deal with yellow pages, now NIS.
7478 if $test -d /usr/etc/yp || $test -d /etc/yp; then
7479         if $test -f /usr/etc/nibindd; then
7480                 echo " "
7481                 echo "I'm fairly confident you're on a NeXT."
7482                 echo " "
7483                 rp='Do you get the hosts file via NetInfo?'
7484                 dflt=y
7485                 case "$hostcat" in
7486                 nidump*) ;;
7487                 '') ;;
7488                 *) dflt=n;;
7489                 esac
7490                 . ./myread
7491                 case "$ans" in
7492                 y*) hostcat='nidump hosts .';;
7493                 *)      case "$hostcat" in
7494                         nidump*) hostcat='';;
7495                         esac
7496                         ;;
7497                 esac
7498         fi
7499         case "$hostcat" in
7500         nidump*) ;;
7501         *)
7502                 case "$hostcat" in
7503                 *ypcat*) dflt=y;;
7504                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
7505                                 dflt=y
7506                         else
7507                                 dflt=n
7508                         fi;;
7509                 *) dflt=n;;
7510                 esac
7511                 echo " "
7512                 rp='Are you getting the hosts file via yellow pages?'
7513                 . ./myread
7514                 case "$ans" in
7515                 y*) hostcat='ypcat hosts';;
7516                 *) hostcat='cat /etc/hosts';;
7517                 esac
7518                 ;;
7519         esac
7520 fi
7521 case "$hostcat" in
7522 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
7523 esac
7524 case "$groupcat" in
7525 '') test -f /etc/group && groupcat='cat /etc/group';;
7526 esac
7527 case "$passcat" in
7528 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
7529 esac
7530
7531 : now get the host name
7532 echo " "
7533 echo "Figuring out host name..." >&4
7534 case "$myhostname" in
7535 '') cont=true
7536         echo 'Maybe "hostname" will work...'
7537         if tans=`sh -c hostname 2>&1` ; then
7538                 myhostname=$tans
7539                 phostname=hostname
7540                 cont=''
7541         fi
7542         ;;
7543 *) cont='';;
7544 esac
7545 if $test "$cont"; then
7546         if ./xenix; then
7547                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
7548                 if tans=`cat /etc/systemid 2>&1` ; then
7549                         myhostname=$tans
7550                         phostname='cat /etc/systemid'
7551                         echo "Whadyaknow.  Xenix always was a bit strange..."
7552                         cont=''
7553                 fi
7554         elif $test -r /etc/systemid; then
7555                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
7556         fi
7557 fi
7558 if $test "$cont"; then
7559         echo 'No, maybe "uuname -l" will work...'
7560         if tans=`sh -c 'uuname -l' 2>&1` ; then
7561                 myhostname=$tans
7562                 phostname='uuname -l'
7563         else
7564                 echo 'Strange.  Maybe "uname -n" will work...'
7565                 if tans=`sh -c 'uname -n' 2>&1` ; then
7566                         myhostname=$tans
7567                         phostname='uname -n'
7568                 else
7569                         echo 'Oh well, maybe I can mine it out of whoami.h...'
7570                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
7571                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
7572                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
7573                         else
7574                                 case "$myhostname" in
7575                                 '') echo "Does this machine have an identity crisis or something?"
7576                                         phostname='';;
7577                                 *)
7578                                         echo "Well, you said $myhostname before..."
7579                                         phostname='echo $myhostname';;
7580                                 esac
7581                         fi
7582                 fi
7583         fi
7584 fi
7585 : you do not want to know about this
7586 set $myhostname
7587 myhostname=$1
7588
7589 : verify guess
7590 if $test "$myhostname" ; then
7591         dflt=y
7592         rp='Your host name appears to be "'$myhostname'".'" Right?"
7593         . ./myread
7594         case "$ans" in
7595         y*) ;;
7596         *) myhostname='';;
7597         esac
7598 fi
7599
7600 : bad guess or no guess
7601 while $test "X$myhostname" = X ; do
7602         dflt=''
7603         rp="Please type the (one word) name of your host:"
7604         . ./myread
7605         myhostname="$ans"
7606 done
7607
7608 : translate upper to lower if necessary
7609 case "$myhostname" in
7610 *[A-Z]*)
7611         echo "(Normalizing case in your host name)"
7612         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
7613         ;;
7614 esac
7615
7616 case "$myhostname" in
7617 *.*)
7618         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
7619         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
7620         echo "(Trimming domain name from host name--host name is now $myhostname)"
7621         ;;
7622 *) case "$mydomain" in
7623         '')
7624                 {
7625                         test "X$hostcat" = "Xypcat hosts" &&
7626                         ypmatch "$myhostname" hosts 2>/dev/null |\
7627                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
7628                         $test -s hosts
7629                 } || {
7630                         test "X$hostcat" != "X" &&
7631                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
7632                                         /[       ]$myhostname[  . ]/p" > hosts
7633                 }
7634                 tmp_re="[       . ]"
7635                 if $test -f hosts; then
7636                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
7637                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
7638                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
7639                                 hosts | $sort | $uniq | \
7640                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
7641                         case `$echo X$dflt` in
7642                         X*\ *)  echo "(Several hosts in the database matched hostname)"
7643                                 dflt=.
7644                                 ;;
7645                         X.) echo "(You do not have fully-qualified names in the hosts database)"
7646                                 ;;
7647                         esac
7648                 else
7649                         echo "(I cannot locate a hosts database anywhere)"
7650                         dflt=.
7651                 fi
7652                 case "$dflt" in
7653                 .)
7654                         tans=`./loc resolv.conf X /etc /usr/etc`
7655                         if $test -f "$tans"; then
7656                                 echo "(Attempting domain name extraction from $tans)"
7657                                 dflt=.`$sed -n -e 's/   / /g' \
7658                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
7659                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7660                                 case "$dflt" in
7661                                 .) dflt=.`$sed -n -e 's/        / /g' \
7662                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
7663                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
7664                                         ;;
7665                                 esac
7666                         fi
7667                         ;;
7668                 esac
7669                 case "$dflt" in
7670                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
7671                         dflt=.`sh -c domainname 2>/dev/null`
7672                         case "$dflt" in
7673                         '') dflt='.';;
7674                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
7675                         esac
7676                         ;;
7677                 esac
7678                 case "$dflt$osname" in
7679                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
7680                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
7681                         ;;
7682                 esac
7683                 case "$dflt" in
7684                 .) echo "(Lost all hope -- silly guess then)"
7685                         dflt='.uucp'
7686                         ;;
7687                 esac
7688                 $rm -f hosts
7689                 ;;
7690         *) dflt="$mydomain";;
7691         esac;;
7692 esac
7693 echo " "
7694 rp="What is your domain name?"
7695 . ./myread
7696 tans="$ans"
7697 case "$ans" in
7698 '') ;;
7699 .*) ;;
7700 *) tans=".$tans";;
7701 esac
7702 mydomain="$tans"
7703
7704 : translate upper to lower if necessary
7705 case "$mydomain" in
7706 *[A-Z]*)
7707         echo "(Normalizing case in your domain name)"
7708         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
7709         ;;
7710 esac
7711
7712 : a little sanity check here
7713 case "$phostname" in
7714 '') ;;
7715 *)
7716         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
7717         $myhostname$mydomain|$myhostname) ;;
7718         *)
7719                 case "$phostname" in
7720                 sed*)
7721                         echo "(That doesn't agree with your whoami.h file, by the way.)"
7722                         ;;
7723                 *)
7724                         echo "(That doesn't agree with your $phostname command, by the way.)"
7725                         ;;
7726                 esac
7727         ;;
7728         esac
7729         ;;
7730 esac
7731
7732 $cat <<EOM
7733
7734 I need to get your e-mail address in Internet format if possible, i.e.
7735 something like user@host.domain. Please answer accurately since I have
7736 no easy means to double check it. The default value provided below
7737 is most probably close to reality but may not be valid from outside
7738 your organization...
7739
7740 EOM
7741 cont=x
7742 while test "$cont"; do
7743         case "$cf_email" in
7744         '') dflt="$cf_by@$myhostname$mydomain";;
7745         *) dflt="$cf_email";;
7746         esac
7747         rp='What is your e-mail address?'
7748         . ./myread
7749         cf_email="$ans"
7750         case "$cf_email" in
7751         *@*.*) cont='' ;;
7752         *)
7753                 rp='Address does not look like an Internet one.  Use it anyway?'
7754                 case "$fastread" in
7755                 yes) dflt=y ;;
7756                 *) dflt=n ;;
7757                 esac
7758                 . ./myread
7759                 case "$ans" in
7760                 y*) cont='' ;;
7761                 *) echo " " ;;
7762                 esac
7763                 ;;
7764         esac
7765 done
7766
7767 $cat <<EOM
7768
7769 If you or somebody else will be maintaining perl at your site, please
7770 fill in the correct e-mail address here so that they may be contacted
7771 if necessary. Currently, the "perlbug" program included with perl
7772 will send mail to this address in addition to perlbug@perl.org. You may
7773 enter "none" for no administrator.
7774
7775 EOM
7776 case "$perladmin" in
7777 '') dflt="$cf_email";;
7778 *) dflt="$perladmin";;
7779 esac
7780 rp='Perl administrator e-mail address'
7781 . ./myread
7782 perladmin="$ans"
7783
7784 : determine whether to only install version-specific parts.
7785 echo " "
7786 $cat <<EOM
7787 Do you want to install only the version-specific parts of the perl
7788 distribution?  Usually you do *not* want to do this.
7789 EOM
7790 case "$versiononly" in
7791 "$define"|[Yy]*|true) dflt='y' ;;
7792 *) dflt='n';
7793 esac
7794 rp="Do you want to install only the version-specific parts of perl?"
7795 . ./myread
7796 case "$ans" in
7797 [yY]*)  val="$define";;
7798 *)      val="$undef" ;;
7799 esac
7800 set versiononly
7801 eval $setvar
7802
7803 : figure out how to guarantee perl startup
7804 case "$startperl" in
7805 '')
7806         case "$sharpbang" in
7807         *!)
7808                 $cat <<EOH
7809
7810 I can use the #! construct to start perl on your system. This will
7811 make startup of perl scripts faster, but may cause problems if you
7812 want to share those scripts and perl is not in a standard place
7813 ($binexp/perl) on all your platforms. The alternative is to force
7814 a shell by starting the script with a single ':' character.
7815
7816 EOH
7817                 case "$versiononly" in
7818                 "$define")      dflt="$binexp/perl$version";;  
7819                 *)              dflt="$binexp/perl";;
7820                 esac
7821                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
7822                 . ./myread
7823                 case "$ans" in
7824                 none)   startperl=": # use perl";;
7825                 *)      startperl="#!$ans"
7826                         if $test 30 -lt `echo "$ans" | wc -c`; then
7827                                 $cat >&4 <<EOM
7828
7829 WARNING:  Some systems limit the #! command to 32 characters.
7830 If you experience difficulty running Perl scripts with #!, try
7831 installing Perl in a directory with a shorter pathname.
7832
7833 EOM
7834                         fi ;;
7835                 esac
7836                 ;;
7837         *) startperl=": # use perl"
7838                 ;;
7839         esac
7840         ;;
7841 esac
7842 echo "I'll use $startperl to start perl scripts."
7843
7844 : figure best path for perl in scripts
7845 case "$perlpath" in
7846 '')
7847         perlpath="$binexp/perl"
7848         case "$startperl" in
7849         *!*) ;;
7850         *)
7851                 $cat <<EOH
7852
7853 I will use the "eval 'exec'" idiom to start Perl on your system.
7854 I can use the full path of your Perl binary for this purpose, but
7855 doing so may cause problems if you want to share those scripts and
7856 Perl is not always in a standard place ($binexp/perl).
7857
7858 EOH
7859                 dflt="$binexp/perl"
7860                 rp="What path shall I use in \"eval 'exec'\"?"
7861                 . ./myread
7862                 perlpath="$ans"
7863                 ;;
7864         esac
7865         ;;
7866 esac
7867 case "$startperl" in
7868 *!*)    ;;
7869 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
7870 esac
7871
7872 : determine where public executable scripts go
7873 set scriptdir scriptdir
7874 eval $prefixit
7875 case "$scriptdir" in
7876 '')
7877         dflt="$bin"
7878         : guess some guesses
7879         $test -d /usr/share/scripts && dflt=/usr/share/scripts
7880         $test -d /usr/share/bin     && dflt=/usr/share/bin
7881         $test -d /usr/local/script  && dflt=/usr/local/script
7882         $test -d /usr/local/scripts && dflt=/usr/local/scripts
7883         $test -d $prefixexp/script  && dflt=$prefixexp/script
7884         set dflt
7885         eval $prefixup
7886         ;;
7887 *)  dflt="$scriptdir"
7888         ;;
7889 esac
7890 $cat <<EOM
7891  
7892 Some installations have a separate directory just for executable scripts so
7893 that they can mount it across multiple architectures but keep the scripts in
7894 one spot.  You might, for example, have a subdirectory of /usr/share for this.
7895 Or you might just lump your scripts in with all your other executables.
7896  
7897 EOM
7898 fn=d~
7899 rp='Where do you keep publicly executable scripts?'
7900 . ./getfile
7901 if $test "X$ansexp" != "X$scriptdirexp"; then
7902         installscript=''
7903 fi
7904 scriptdir="$ans"
7905 scriptdirexp="$ansexp"
7906 : Change installation prefix, if necessary.
7907 if $test X"$prefix" != X"$installprefix"; then
7908         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
7909 else
7910         installscript="$scriptdirexp"
7911 fi
7912
7913 : determine where add-on public executables go
7914 case "$sitebin" in
7915 '')     dflt=$siteprefix/bin ;;
7916 *)      dflt=$sitebin ;;
7917 esac
7918 fn=d~
7919 rp='Pathname where the add-on public executables should be installed?'
7920 . ./getfile
7921 sitebin="$ans"
7922 sitebinexp="$ansexp"
7923 : Change installation prefix, if necessary.
7924 if $test X"$prefix" != X"$installprefix"; then
7925         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
7926 else
7927         installsitebin="$sitebinexp"
7928 fi
7929
7930 case "$vendorprefix" in
7931 '')     d_vendorbin="$undef"
7932         vendorbin=''
7933         vendorbinexp=''
7934         ;;
7935 *)      d_vendorbin="$define"
7936         : determine where vendor-supplied executables go.
7937         case "$vendorbin" in
7938         '') dflt=$vendorprefix/bin ;;
7939         *)      dflt="$vendorbin" ;;
7940         esac
7941         fn=d~+
7942         rp='Pathname for the vendor-supplied executables directory?'
7943         . ./getfile
7944         vendorbin="$ans"
7945         vendorbinexp="$ansexp"
7946         ;;
7947 esac
7948 : Change installation prefix, if necessary.
7949 if $test X"$prefix" != X"$installprefix"; then
7950         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
7951 else
7952         installvendorbin="$vendorbinexp"
7953 fi
7954
7955 : see if qgcvt exists
7956 set qgcvt d_qgcvt
7957 eval $inlibc
7958
7959 echo " "
7960
7961 if $test X"$d_longdbl" = X"$define"; then
7962
7963 echo "Checking how to print long doubles..." >&4
7964
7965 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7966         $cat >try.c <<'EOCP'
7967 #include <sys/types.h>
7968 #include <stdio.h>
7969 int main() {
7970   double d = 123.456;
7971   printf("%.3f\n", d);
7972 }
7973 EOCP
7974         set try
7975         if eval $compile; then
7976                 yyy=`./try$exe_ext`
7977                 case "$yyy" in
7978                 123.456)
7979                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7980                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
7981                         echo "We will use %f."
7982                         ;;
7983                 esac
7984         fi
7985 fi
7986
7987 if $test X"$sPRIfldbl" = X; then
7988         $cat >try.c <<'EOCP'
7989 #include <sys/types.h>
7990 #include <stdio.h>
7991 int main() {
7992   long double d = 123.456;
7993   printf("%.3llf\n", d);
7994 }
7995 EOCP
7996         set try
7997         if eval $compile; then
7998                 yyy=`./try$exe_ext`
7999                 case "$yyy" in
8000                 123.456)
8001                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
8002                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
8003                         echo "We will use %llf."
8004                         ;;
8005                 esac
8006         fi
8007 fi
8008
8009 if $test X"$sPRIfldbl" = X; then
8010         $cat >try.c <<'EOCP'
8011 #include <sys/types.h>
8012 #include <stdio.h>
8013 int main() {
8014   long double d = 123.456;
8015   printf("%.3Lf\n", d);
8016 }
8017 EOCP
8018         set try
8019         if eval $compile; then
8020                 yyy=`./try$exe_ext`
8021                 case "$yyy" in
8022                 123.456)
8023                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
8024                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
8025                         echo "We will use %Lf."
8026                         ;;
8027                 esac
8028         fi
8029 fi
8030
8031 if $test X"$sPRIfldbl" = X; then
8032         $cat >try.c <<'EOCP'
8033 #include <sys/types.h>
8034 #include <stdio.h>
8035 int main() {
8036   long double d = 123.456;
8037   printf("%.3lf\n", d);
8038 }
8039 EOCP
8040         set try
8041         if eval $compile; then
8042                 yyy=`./try$exe_ext`
8043                 case "$yyy" in
8044                 123.456)
8045                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
8046                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
8047                         echo "We will use %lf."
8048                         ;;
8049                 esac
8050         fi
8051 fi
8052
8053 if $test X"$sPRIfldbl" = X; then
8054         echo "Cannot figure out how to print long doubles." >&4
8055 else
8056         sSCNfldbl=$sPRIfldbl    # expect consistency
8057 fi
8058
8059 $rm -f try try.*
8060
8061 fi # d_longdbl
8062
8063 case "$sPRIfldbl" in
8064 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
8065         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
8066         d_SCNfldbl="$undef";
8067         ;;
8068 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
8069         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
8070         d_SCNfldbl="$define";
8071         ;;
8072 esac
8073
8074 : Check how to convert floats to strings.
8075 echo " "
8076 echo "Checking for an efficient way to convert floats to strings."
8077 echo " " > try.c
8078 case "$uselongdouble" in
8079 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
8080 esac
8081 case "$d_longdbl" in
8082 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
8083 esac
8084 case "$d_PRIgldbl" in
8085 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
8086 esac
8087 $cat >>try.c <<EOP
8088 #ifdef TRY_gconvert
8089 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
8090 char *myname = "gconvert";
8091 #endif
8092 #ifdef TRY_gcvt
8093 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
8094 char *myname = "gcvt";
8095 #endif
8096 #ifdef TRY_qgcvt
8097 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
8098 char *myname = "qgcvt";
8099 #define DOUBLETYPE long double
8100 #endif
8101 #ifdef TRY_sprintf
8102 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
8103 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
8104 #else
8105 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
8106 #endif
8107 char *myname = "sprintf";
8108 #endif
8109
8110 #ifndef DOUBLETYPE
8111 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
8112 #define DOUBLETYPE long double
8113 #else
8114 #define DOUBLETYPE double
8115 #endif
8116 #endif
8117
8118 #include <stdio.h>
8119
8120 #define I_STDLIB $i_stdlib
8121 #ifdef I_STDLIB
8122 #include <stdlib.h>
8123 #endif
8124
8125 int
8126 checkit(expect, got)
8127 char *expect;
8128 char *got;
8129 {
8130     if (strcmp(expect, got)) {
8131                 printf("%s oddity:  Expected %s, got %s\n",
8132                         myname, expect, got);
8133                 exit(1);
8134         }
8135 }
8136
8137 int main()
8138
8139         char buf[64]; 
8140         buf[63] = '\0';
8141
8142         /* This must be 1st test on (which?) platform */
8143         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
8144         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
8145         checkit("0.1", buf);
8146
8147         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
8148         checkit("1", buf);
8149
8150         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
8151         checkit("1.1", buf);
8152
8153         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
8154         checkit("1.01", buf);
8155
8156         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
8157         checkit("1.001", buf);
8158
8159         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
8160         checkit("1.0001", buf);
8161
8162         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
8163         checkit("1.00001", buf);
8164
8165         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
8166         checkit("1.000001", buf);
8167
8168         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
8169         checkit("0", buf);
8170
8171         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
8172         checkit("-1", buf);
8173
8174         /* Some Linux gcvt's give 1.e+5 here. */
8175         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
8176         checkit("100000", buf);
8177         
8178         /* Some Linux gcvt's give -1.e+5 here. */
8179         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
8180         checkit("-100000", buf);
8181
8182         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
8183         checkit("123.456", buf);
8184
8185         exit(0);
8186 }
8187 EOP
8188 case "$d_Gconvert" in
8189 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
8190 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
8191 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
8192 *) xxx_list='gconvert gcvt sprintf' ;;
8193 esac
8194
8195 case "$d_longdbl$uselongdouble$d_PRIgldbl" in
8196 "$define$define$define")
8197     # for long doubles prefer first qgcvt, then sprintf
8198     xxx_list="`echo $xxx_list|sed s/sprintf//`" 
8199     xxx_list="sprintf $xxx_list"
8200     case "$d_qgcvt" in
8201     "$define") xxx_list="qgcvt $xxx_list" ;;
8202     esac
8203     ;;
8204 esac
8205
8206 for xxx_convert in $xxx_list; do
8207         echo "Trying $xxx_convert..."
8208         $rm -f try try$_o
8209         set try -DTRY_$xxx_convert
8210         if eval $compile; then
8211                 echo "$xxx_convert() found." >&4
8212                 if ./try; then
8213                         echo "I'll use $xxx_convert to convert floats into a string." >&4
8214                         break;
8215                 else
8216                         echo "...But $xxx_convert didn't work as I expected."
8217                 fi
8218         else
8219                 echo "$xxx_convert NOT found." >&4
8220         fi
8221 done
8222         
8223 case "$xxx_convert" in
8224 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
8225 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
8226 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
8227 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
8228    "$define$define$define")
8229       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
8230    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
8231    esac
8232    ;;  
8233 esac
8234
8235 : see if _fwalk exists
8236 set fwalk d__fwalk
8237 eval $inlibc
8238
8239 : Initialize h_fcntl
8240 h_fcntl=false
8241
8242 : Initialize h_sysfile
8243 h_sysfile=false
8244
8245 : access call always available on UNIX
8246 set access d_access
8247 eval $inlibc
8248
8249 : locate the flags for 'access()'
8250 case "$d_access" in
8251 "$define")
8252         echo " "
8253         $cat >access.c <<'EOCP'
8254 #include <sys/types.h>
8255 #ifdef I_FCNTL
8256 #include <fcntl.h>
8257 #endif
8258 #ifdef I_SYS_FILE
8259 #include <sys/file.h>
8260 #endif
8261 #ifdef I_UNISTD
8262 #include <unistd.h>
8263 #endif
8264 int main() {
8265         exit(R_OK);
8266 }
8267 EOCP
8268         : check sys/file.h first, no particular reason here
8269         if $test `./findhdr sys/file.h` && \
8270                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
8271                 h_sysfile=true;
8272                 echo "<sys/file.h> defines the *_OK access constants." >&4
8273         elif $test `./findhdr fcntl.h` && \
8274                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
8275                 h_fcntl=true;
8276                 echo "<fcntl.h> defines the *_OK access constants." >&4
8277         elif $test `./findhdr unistd.h` && \
8278                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
8279                 echo "<unistd.h> defines the *_OK access constants." >&4
8280         else
8281                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
8282         fi
8283         ;;
8284 esac
8285 $rm -f access*
8286
8287 : see if accessx exists
8288 set accessx d_accessx
8289 eval $inlibc
8290
8291 : see if alarm exists
8292 set alarm d_alarm
8293 eval $inlibc
8294
8295 : see if atolf exists
8296 set atolf d_atolf
8297 eval $inlibc
8298
8299 : see if atoll exists
8300 set atoll d_atoll
8301 eval $inlibc
8302
8303 : Look for GNU-cc style attribute checking
8304 echo " "
8305 echo "Checking whether your compiler can handle __attribute__ ..." >&4
8306 $cat >attrib.c <<'EOCP'
8307 #include <stdio.h>
8308 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
8309 EOCP
8310 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
8311         if $contains 'warning' attrib.out >/dev/null 2>&1; then
8312                 echo "Your C compiler doesn't fully support __attribute__."
8313                 val="$undef"
8314         else
8315                 echo "Your C compiler supports __attribute__."
8316                 val="$define"
8317         fi
8318 else
8319         echo "Your C compiler doesn't seem to understand __attribute__ at all."
8320         val="$undef"
8321 fi
8322 set d_attribut
8323 eval $setvar
8324 $rm -f attrib*
8325
8326 : see if bcmp exists
8327 set bcmp d_bcmp
8328 eval $inlibc
8329
8330 : see if bcopy exists
8331 set bcopy d_bcopy
8332 eval $inlibc
8333
8334 : see if this is a unistd.h system
8335 set unistd.h i_unistd
8336 eval $inhdr
8337
8338 : see if getpgrp exists
8339 set getpgrp d_getpgrp
8340 eval $inlibc
8341
8342 case "$d_getpgrp" in
8343 "$define")
8344         echo " "
8345         echo "Checking to see which flavor of getpgrp is in use..."
8346         $cat >set.c <<EOP
8347 #$i_unistd I_UNISTD
8348 #include <sys/types.h>
8349 #ifdef I_UNISTD
8350 #  include <unistd.h>
8351 #endif
8352 int main()
8353 {
8354         if (getuid() == 0) {
8355                 printf("(I see you are running Configure as super-user...)\n");
8356                 setuid(1);
8357         }
8358 #ifdef TRY_BSD_PGRP
8359         if (getpgrp(1) == 0)
8360                 exit(0);
8361 #else
8362         if (getpgrp() > 0)
8363                 exit(0);
8364 #endif
8365         exit(1);
8366 }
8367 EOP
8368         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8369                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
8370                 val="$define"
8371         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8372                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
8373                 val="$undef"
8374         else
8375                 echo "I can't seem to compile and run the test program."
8376                 if ./usg; then
8377                         xxx="a USG one, i.e. you use getpgrp()."
8378                 else
8379                         # SVR4 systems can appear rather BSD-ish.
8380                         case "$i_unistd" in
8381                         $undef)
8382                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
8383                                 val="$define"
8384                                 ;;
8385                         $define)
8386                                 xxx="probably a USG one, i.e. you use getpgrp()."
8387                                 val="$undef"
8388                                 ;;
8389                         esac
8390                 fi
8391                 echo "Assuming your getpgrp is $xxx" >&4
8392         fi
8393         ;;
8394 *) val="$undef";;
8395 esac
8396 set d_bsdgetpgrp
8397 eval $setvar
8398 $rm -f set set.c
8399
8400 : see if setpgrp exists
8401 set setpgrp d_setpgrp
8402 eval $inlibc
8403
8404 case "$d_setpgrp" in
8405 "$define")
8406         echo " "
8407         echo "Checking to see which flavor of setpgrp is in use..."
8408         $cat >set.c <<EOP
8409 #$i_unistd I_UNISTD
8410 #include <sys/types.h>
8411 #ifdef I_UNISTD
8412 #  include <unistd.h>
8413 #endif
8414 int main()
8415 {
8416         if (getuid() == 0) {
8417                 printf("(I see you are running Configure as super-user...)\n");
8418                 setuid(1);
8419         }
8420 #ifdef TRY_BSD_PGRP
8421         if (-1 == setpgrp(1, 1))
8422                 exit(0);
8423 #else
8424         if (setpgrp() != -1)
8425                 exit(0);
8426 #endif
8427         exit(1);
8428 }
8429 EOP
8430         if $cc -o set -DTRY_BSD_PGRP $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8431                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
8432                 val="$define"
8433         elif $cc -o set $ccflags $ldflags set.c $libs >/dev/null 2>&1 && ./set; then
8434                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
8435                 val="$undef"
8436         else
8437                 echo "(I can't seem to compile and run the test program.)"
8438                 if ./usg; then
8439                         xxx="a USG one, i.e. you use setpgrp()."
8440                 else
8441                         # SVR4 systems can appear rather BSD-ish.
8442                         case "$i_unistd" in
8443                         $undef)
8444                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
8445                                 val="$define"
8446                                 ;;
8447                         $define)
8448                                 xxx="probably a USG one, i.e. you use setpgrp()."
8449                                 val="$undef"
8450                                 ;;
8451                         esac
8452                 fi
8453                 echo "Assuming your setpgrp is $xxx" >&4
8454         fi
8455         ;;
8456 *) val="$undef";;
8457 esac
8458 set d_bsdsetpgrp
8459 eval $setvar
8460 $rm -f set set.c
8461 : see if bzero exists
8462 set bzero d_bzero
8463 eval $inlibc
8464
8465 : see if signal is declared as pointer to function returning int or void
8466 echo " "
8467 xxx=`./findhdr signal.h`
8468 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
8469 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
8470         echo "You have int (*signal())() instead of void." >&4
8471         val="$undef"
8472 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
8473         echo "You have void (*signal())()." >&4
8474         val="$define"
8475 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
8476         echo "You have int (*signal())() instead of void." >&4
8477         val="$undef"
8478 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
8479         echo "You have void (*signal())()." >&4
8480         val="$define"
8481 else
8482         case "$d_voidsig" in
8483         '')
8484         echo "I can't determine whether signal handler returns void or int..." >&4
8485                 dflt=void
8486                 rp="What type does your signal handler return?"
8487                 . ./myread
8488                 case "$ans" in
8489                 v*) val="$define";;
8490                 *) val="$undef";;
8491                 esac;;
8492         "$define")
8493                 echo "As you already told me, signal handler returns void." >&4
8494                 val="$define"
8495                 ;;
8496         *)      echo "As you already told me, signal handler returns int." >&4
8497                 val="$undef"
8498                 ;;
8499         esac
8500 fi
8501 set d_voidsig
8502 eval $setvar
8503 case "$d_voidsig" in
8504 "$define") signal_t="void";;
8505 *) signal_t="int";;
8506 esac
8507 $rm -f $$.tmp
8508
8509 : check for ability to cast large floats to 32-bit ints.
8510 echo " "
8511 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
8512 if $test "$intsize" -ge 4; then
8513         xxx=int
8514 else
8515         xxx=long
8516 fi
8517 $cat >try.c <<EOCP
8518 #include <stdio.h>
8519 #include <sys/types.h>
8520 #include <signal.h>
8521 $signal_t blech(s) int s; { exit(3); }
8522 int main()
8523 {
8524         $xxx i32;
8525         double f, g;
8526         int result = 0;
8527         char str[16];
8528         signal(SIGFPE, blech);
8529
8530         /* Don't let compiler optimize the test away.  Store the number 
8531            in a writable string for gcc to pass to sscanf under HP/UX.
8532         */
8533         sprintf(str, "2147483647");
8534         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
8535         g = 10 * f;
8536         i32  = ($xxx) g;
8537
8538         /* x86 processors will probably give 0x8000 0000, which is a
8539        sign change.  We don't want that.  We want to mimic SPARC
8540            behavior here, which is to preserve the sign and give
8541            back 0x7fff ffff.
8542         */
8543         if (i32 != ($xxx) f)
8544                 result |= 1;
8545         exit(result);
8546 }
8547 EOCP
8548 set try
8549 if eval $compile_ok; then
8550         ./try
8551         yyy=$?
8552 else
8553         echo "(I can't seem to compile the test program--assuming it can't)"
8554         yyy=1
8555 fi
8556 case "$yyy" in
8557 0)      val="$define"
8558         echo "Yup, it can."
8559         ;;
8560 *)      val="$undef"
8561         echo "Nope, it can't."
8562         ;;
8563 esac
8564 set d_casti32
8565 eval $setvar
8566 $rm -f try try.*
8567
8568 : check for ability to cast negative floats to unsigned
8569 echo " "
8570 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
8571 $cat >try.c <<EOCP
8572 #include <stdio.h>
8573 #include <sys/types.h>
8574 #include <signal.h>
8575 $signal_t blech(s) int s; { exit(7); }
8576 $signal_t blech_in_list(s) int s; { exit(4); }
8577 unsigned long dummy_long(p) unsigned long p; { return p; }
8578 unsigned int dummy_int(p) unsigned int p; { return p; }
8579 unsigned short dummy_short(p) unsigned short p; { return p; }
8580 int main()
8581 {
8582         double f;
8583         unsigned long along;
8584         unsigned int aint;
8585         unsigned short ashort;
8586         int result = 0;
8587         char str[16];
8588         
8589         /* Frustrate gcc-2.7.2's optimizer which failed this test with
8590            a direct f = -123. assignment.  gcc-2.8.0 reportedly
8591            optimized the whole file away
8592         */
8593         /* Store the number in a writable string for gcc to pass to 
8594            sscanf under HP/UX.
8595         */
8596         sprintf(str, "-123");
8597         sscanf(str, "%lf", &f);  /* f = -123.; */
8598
8599         signal(SIGFPE, blech);
8600         along = (unsigned long)f;
8601         aint = (unsigned int)f;
8602         ashort = (unsigned short)f;
8603         if (along != (unsigned long)-123)
8604                 result |= 1;
8605         if (aint != (unsigned int)-123)
8606                 result |= 1;
8607         if (ashort != (unsigned short)-123)
8608                 result |= 1;
8609         sprintf(str, "1073741824.");
8610         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
8611         f = f + f;
8612         along = 0;
8613         along = (unsigned long)f;
8614         if (along != 0x80000000)
8615                 result |= 2;
8616         f -= 1.;
8617         along = 0;
8618         along = (unsigned long)f;
8619         if (along != 0x7fffffff)
8620                 result |= 1;
8621         f += 2.;
8622         along = 0;
8623         along = (unsigned long)f;
8624         if (along != 0x80000001)
8625                 result |= 2;
8626         if (result)
8627                 exit(result);
8628         signal(SIGFPE, blech_in_list);
8629         sprintf(str, "123.");
8630         sscanf(str, "%lf", &f);  /* f = 123.; */
8631         along = dummy_long((unsigned long)f);
8632         aint = dummy_int((unsigned int)f);
8633         ashort = dummy_short((unsigned short)f);
8634         if (along != (unsigned long)123)
8635                 result |= 4;
8636         if (aint != (unsigned int)123)
8637                 result |= 4;
8638         if (ashort != (unsigned short)123)
8639                 result |= 4;
8640         exit(result);
8641
8642 }
8643 EOCP
8644 set try
8645 if eval $compile_ok; then
8646         ./try
8647         castflags=$?
8648 else
8649         echo "(I can't seem to compile the test program--assuming it can't)"
8650         castflags=7
8651 fi
8652 case "$castflags" in
8653 0)      val="$define"
8654         echo "Yup, it can."
8655         ;;
8656 *)      val="$undef"
8657         echo "Nope, it can't."
8658         ;;
8659 esac
8660 set d_castneg
8661 eval $setvar
8662 $rm -f try.*
8663
8664 : see if vprintf exists
8665 echo " "
8666 if set vprintf val -f d_vprintf; eval $csym; $val; then
8667         echo 'vprintf() found.' >&4
8668         val="$define"
8669         $cat >vprintf.c <<'EOF'
8670 #include <varargs.h>
8671
8672 int main() { xxx("foo"); }
8673
8674 xxx(va_alist)
8675 va_dcl
8676 {
8677         va_list args;
8678         char buf[10];
8679
8680         va_start(args);
8681         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
8682 }
8683 EOF
8684         set vprintf
8685         if eval $compile && ./vprintf; then
8686                 echo "Your vsprintf() returns (int)." >&4
8687                 val2="$undef"
8688         else
8689                 echo "Your vsprintf() returns (char*)." >&4
8690                 val2="$define"
8691         fi
8692 else
8693         echo 'vprintf() NOT found.' >&4
8694                 val="$undef"
8695                 val2="$undef"
8696 fi
8697 set d_vprintf
8698 eval $setvar
8699 val=$val2
8700 set d_charvspr
8701 eval $setvar
8702
8703 : see if chown exists
8704 set chown d_chown
8705 eval $inlibc
8706
8707 : see if chroot exists
8708 set chroot d_chroot
8709 eval $inlibc
8710
8711 : see if chsize exists
8712 set chsize d_chsize
8713 eval $inlibc
8714
8715 : check for const keyword
8716 echo " "
8717 echo 'Checking to see if your C compiler knows about "const"...' >&4
8718 $cat >const.c <<'EOCP'
8719 typedef struct spug { int drokk; } spug;
8720 int main()
8721 {
8722         const char *foo;
8723         const spug y;
8724 }
8725 EOCP
8726 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
8727         val="$define"
8728         echo "Yup, it does."
8729 else
8730         val="$undef"
8731         echo "Nope, it doesn't."
8732 fi
8733 set d_const
8734 eval $setvar
8735
8736 : see if crypt exists
8737 echo " "
8738 if set crypt val -f d_crypt; eval $csym; $val; then
8739         echo 'crypt() found.' >&4
8740         val="$define"
8741         cryptlib=''
8742 else
8743         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
8744         if $test -z "$cryptlib"; then
8745                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
8746         else
8747                 cryptlib=-lcrypt
8748         fi
8749         if $test -z "$cryptlib"; then
8750                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
8751         else
8752                 cryptlib=-lcrypt
8753         fi
8754         if $test -z "$cryptlib"; then
8755                 cryptlib=`./loc libcrypt$_a "" $libpth`
8756         else
8757                 cryptlib=-lcrypt
8758         fi
8759         if $test -z "$cryptlib"; then
8760                 echo 'crypt() NOT found.' >&4
8761                 val="$undef"
8762         else
8763                 val="$define"
8764         fi
8765 fi
8766 set d_crypt
8767 eval $setvar
8768
8769 : get csh whereabouts
8770 case "$csh" in
8771 'csh') val="$undef" ;;
8772 *) val="$define" ;;
8773 esac
8774 set d_csh
8775 eval $setvar
8776 : Respect a hint or command line value for full_csh.
8777 case "$full_csh" in
8778 '') full_csh=$csh ;;
8779 esac
8780
8781 : see if cuserid exists
8782 set cuserid d_cuserid
8783 eval $inlibc
8784
8785 : see if this is a limits.h system
8786 set limits.h i_limits
8787 eval $inhdr
8788
8789 : see if this is a float.h system
8790 set float.h i_float
8791 eval $inhdr
8792
8793 : See if number of significant digits in a double precision number is known
8794 echo " "
8795 $cat >dbl_dig.c <<EOM
8796 #$i_limits I_LIMITS
8797 #$i_float I_FLOAT
8798 #ifdef I_LIMITS
8799 #include <limits.h>
8800 #endif
8801 #ifdef I_FLOAT
8802 #include <float.h>
8803 #endif
8804 #ifdef DBL_DIG
8805 printf("Contains DBL_DIG");
8806 #endif
8807 EOM
8808 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
8809 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
8810         echo "DBL_DIG found." >&4
8811         val="$define"
8812 else
8813         echo "DBL_DIG NOT found." >&4
8814         val="$undef"
8815 fi
8816 $rm -f dbl_dig.?
8817 set d_dbl_dig
8818 eval $setvar
8819
8820 : see if difftime exists
8821 set difftime d_difftime
8822 eval $inlibc
8823
8824 : see if this is a dirent system
8825 echo " "
8826 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
8827         val="$define"
8828         echo "<dirent.h> found." >&4
8829 else
8830         val="$undef"
8831         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
8832                 echo "<sys/dir.h> found." >&4
8833                 echo " "
8834         else
8835                 xinc=`./findhdr sys/ndir.h`
8836         fi
8837         echo "<dirent.h> NOT found." >&4
8838 fi
8839 set i_dirent
8840 eval $setvar
8841
8842 : Look for type of directory structure.
8843 echo " "
8844 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8845
8846 case "$direntrytype" in
8847 ''|' ')
8848         case "$i_dirent" in
8849         $define) guess1='struct dirent' ;;
8850         *) guess1='struct direct'  ;;
8851         esac
8852         ;;
8853 *)      guess1="$direntrytype"
8854         ;;
8855 esac
8856
8857 case "$guess1" in
8858 'struct dirent') guess2='struct direct' ;;
8859 *) guess2='struct dirent' ;;
8860 esac
8861                 
8862 if $contains "$guess1" try.c >/dev/null 2>&1; then
8863         direntrytype="$guess1"
8864         echo "Your directory entries are $direntrytype." >&4
8865 elif $contains "$guess2" try.c >/dev/null 2>&1; then
8866         direntrytype="$guess2"
8867         echo "Your directory entries seem to be $direntrytype." >&4
8868 else
8869         echo "I don't recognize your system's directory entries." >&4
8870         rp="What type is used for directory entries on this system?"
8871         dflt="$guess1"
8872         . ./myread
8873         direntrytype="$ans"
8874 fi
8875 $rm -f try.c
8876
8877
8878 : see if the directory entry stores field length
8879 echo " "
8880 $cppstdin $cppflags $cppminus < "$xinc" > try.c
8881 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
8882         echo "Good, your directory entry keeps length information in d_namlen." >&4
8883         val="$define"
8884 else
8885         echo "Your directory entry does not know about the d_namlen field." >&4
8886         val="$undef"
8887 fi
8888 set d_dirnamlen
8889 eval $setvar
8890 $rm -f try.c
8891
8892 : see if dlerror exists
8893 xxx_runnm="$runnm"
8894 runnm=false
8895 set dlerror d_dlerror
8896 eval $inlibc
8897 runnm="$xxx_runnm"
8898
8899 : see if dlfcn is available
8900 set dlfcn.h i_dlfcn
8901 eval $inhdr
8902
8903 case "$usedl" in
8904 $define|y|true)
8905         $cat << EOM
8906
8907 On a few systems, the dynamically loaded modules that perl generates and uses
8908 will need a different extension than shared libs. The default will probably
8909 be appropriate.
8910
8911 EOM
8912         case "$dlext" in
8913         '')     dflt="$so" ;;
8914         *)      dflt="$dlext" ;;
8915         esac
8916         rp='What is the extension of dynamically loaded modules'
8917         . ./myread
8918         dlext="$ans"
8919         ;;
8920 *)
8921         dlext="none"
8922         ;;
8923 esac
8924
8925 : Check if dlsym need a leading underscore
8926 echo " "
8927 val="$undef"
8928
8929 case "$dlsrc" in
8930 dl_dlopen.xs)
8931         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8932         $cat >dyna.c <<'EOM'
8933 fred () { }
8934 EOM
8935
8936 $cat >fred.c<<EOM
8937
8938 #include <stdio.h>
8939 #$i_dlfcn I_DLFCN
8940 #ifdef I_DLFCN
8941 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8942 #else
8943 #include <sys/types.h>
8944 #include <nlist.h>
8945 #include <link.h>
8946 #endif
8947
8948 extern int fred() ;
8949
8950 int main()
8951 {
8952     void * handle ;
8953     void * symbol ;
8954 #ifndef RTLD_LAZY
8955     int mode = 1 ;
8956 #else
8957     int mode = RTLD_LAZY ;
8958 #endif
8959     handle = dlopen("./dyna.$dlext", mode) ;
8960     if (handle == NULL) {
8961         printf ("1\n") ;
8962         fflush (stdout) ;
8963         exit(0);
8964     }
8965     symbol = dlsym(handle, "fred") ;
8966     if (symbol == NULL) {
8967         /* try putting a leading underscore */
8968         symbol = dlsym(handle, "_fred") ;
8969         if (symbol == NULL) {
8970             printf ("2\n") ;
8971             fflush (stdout) ;
8972             exit(0);
8973         }
8974         printf ("3\n") ;
8975     }
8976     else
8977         printf ("4\n") ;
8978     fflush (stdout) ;
8979     exit(0);
8980 }
8981 EOM
8982         : Call the object file tmp-dyna.o in case dlext=o.
8983         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8984                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8985                 $ld -o dyna.$dlext $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
8986                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8987                 xxx=`./fred`
8988                 case $xxx in
8989                 1)      echo "Test program failed using dlopen." >&4
8990                         echo "Perhaps you should not use dynamic loading." >&4;;
8991                 2)      echo "Test program failed using dlsym." >&4
8992                         echo "Perhaps you should not use dynamic loading." >&4;;
8993                 3)      echo "dlsym needs a leading underscore" >&4
8994                         val="$define" ;;
8995                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8996                 esac
8997         else
8998                 echo "I can't compile and run the test program." >&4
8999                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
9000         fi
9001         ;;
9002 esac
9003                 
9004 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
9005
9006 set d_dlsymun
9007 eval $setvar
9008
9009 hasproto='varname=$1; func=$2; shift; shift;
9010 while $test $# -ge 2; do
9011         case "$1" in
9012         $define) echo "#include <$2>";;
9013         esac ;
9014     shift 2;
9015 done > try.c;
9016 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9017 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9018         echo "$func() prototype found.";
9019         val="$define";
9020 else
9021         echo "$func() prototype NOT found.";
9022         val="$undef";
9023 fi;
9024 set $varname;
9025 eval $setvar;
9026 $rm -f try.c tryout.c'
9027
9028 : see if prototype for drand48 is available
9029 echo " "
9030 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
9031 eval $hasproto
9032
9033 : see if dup2 exists
9034 set dup2 d_dup2
9035 eval $inlibc
9036
9037 : see if eaccess exists
9038 set eaccess d_eaccess
9039 eval $inlibc
9040
9041 : see if endgrent exists
9042 set endgrent d_endgrent
9043 eval $inlibc
9044
9045 : see if endhostent exists
9046 set endhostent d_endhent
9047 eval $inlibc
9048
9049 : see if endnetent exists
9050 set endnetent d_endnent
9051 eval $inlibc
9052
9053 : see if endprotoent exists
9054 set endprotoent d_endpent
9055 eval $inlibc
9056
9057 : see if endpwent exists
9058 set endpwent d_endpwent
9059 eval $inlibc
9060
9061 : see if endservent exists
9062 set endservent d_endsent
9063 eval $inlibc
9064
9065 : Locate the flags for 'open()'
9066 echo " "
9067 $cat >open3.c <<'EOCP'
9068 #include <sys/types.h>
9069 #ifdef I_FCNTL
9070 #include <fcntl.h>
9071 #endif
9072 #ifdef I_SYS_FILE
9073 #include <sys/file.h>
9074 #endif
9075 int main() {
9076         if(O_RDONLY);
9077 #ifdef O_TRUNC
9078         exit(0);
9079 #else
9080         exit(1);
9081 #endif
9082 }
9083 EOCP
9084 : check sys/file.h first to get FREAD on Sun
9085 if $test `./findhdr sys/file.h` && \
9086                 set open3 -DI_SYS_FILE && eval $compile; then
9087         h_sysfile=true;
9088         echo "<sys/file.h> defines the O_* constants..." >&4
9089         if ./open3; then
9090                 echo "and you have the 3 argument form of open()." >&4
9091                 val="$define"
9092         else
9093                 echo "but not the 3 argument form of open().  Oh, well." >&4
9094                 val="$undef"
9095         fi
9096 elif $test `./findhdr fcntl.h` && \
9097                 set open3 -DI_FCNTL && eval $compile; then
9098         h_fcntl=true;
9099         echo "<fcntl.h> defines the O_* constants..." >&4
9100         if ./open3; then
9101                 echo "and you have the 3 argument form of open()." >&4
9102                 val="$define"
9103         else
9104                 echo "but not the 3 argument form of open().  Oh, well." >&4
9105                 val="$undef"
9106         fi
9107 else
9108         val="$undef"
9109         echo "I can't find the O_* constant definitions!  You got problems." >&4
9110 fi
9111 set d_open3
9112 eval $setvar
9113 $rm -f open3*
9114
9115 : see which of string.h or strings.h is needed
9116 echo " "
9117 strings=`./findhdr string.h`
9118 if $test "$strings" && $test -r "$strings"; then
9119         echo "Using <string.h> instead of <strings.h>." >&4
9120         val="$define"
9121 else
9122         val="$undef"
9123         strings=`./findhdr strings.h`
9124         if $test "$strings" && $test -r "$strings"; then
9125                 echo "Using <strings.h> instead of <string.h>." >&4
9126         else
9127                 echo "No string header found -- You'll surely have problems." >&4
9128         fi
9129 fi
9130 set i_string
9131 eval $setvar
9132 case "$i_string" in
9133 "$undef") strings=`./findhdr strings.h`;;
9134 *)        strings=`./findhdr string.h`;;
9135 esac
9136
9137 : check for non-blocking I/O stuff
9138 case "$h_sysfile" in
9139 true) echo "#include <sys/file.h>" > head.c;;
9140 *)
9141        case "$h_fcntl" in
9142        true) echo "#include <fcntl.h>" > head.c;;
9143        *) echo "#include <sys/fcntl.h>" > head.c;;
9144        esac
9145        ;;
9146 esac
9147 echo " "
9148 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
9149 case "$o_nonblock" in
9150 '')
9151         $cat head.c > try.c
9152         $cat >>try.c <<'EOCP'
9153 #include <stdio.h>
9154 int main() {
9155 #ifdef O_NONBLOCK
9156         printf("O_NONBLOCK\n");
9157         exit(0);
9158 #endif
9159 #ifdef O_NDELAY
9160         printf("O_NDELAY\n");
9161         exit(0);
9162 #endif
9163 #ifdef FNDELAY
9164         printf("FNDELAY\n");
9165         exit(0);
9166 #endif
9167         exit(0);
9168 }
9169 EOCP
9170         set try
9171         if eval $compile_ok; then
9172                 o_nonblock=`./try`
9173                 case "$o_nonblock" in
9174                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
9175                 *) echo "Seems like we can use $o_nonblock.";;
9176                 esac
9177         else
9178                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
9179         fi
9180         ;;
9181 *) echo "Using $hint value $o_nonblock.";;
9182 esac
9183 $rm -f try try.* .out core
9184
9185 echo " "
9186 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
9187 case "$eagain" in
9188 '')
9189         $cat head.c > try.c
9190         $cat >>try.c <<EOCP
9191 #include <errno.h>
9192 #include <sys/types.h>
9193 #include <signal.h>
9194 #include <stdio.h> 
9195 #define MY_O_NONBLOCK $o_nonblock
9196 #ifndef errno  /* XXX need better Configure test */
9197 extern int errno;
9198 #endif
9199 #$i_unistd I_UNISTD
9200 #ifdef I_UNISTD
9201 #include <unistd.h>
9202 #endif
9203 #$i_string I_STRING
9204 #ifdef I_STRING
9205 #include <string.h>
9206 #else
9207 #include <strings.h>
9208 #endif
9209 $signal_t blech(x) int x; { exit(3); }
9210 EOCP
9211         $cat >> try.c <<'EOCP'
9212 int main()
9213 {
9214         int pd[2];
9215         int pu[2];
9216         char buf[1];
9217         char string[100];
9218
9219         pipe(pd);       /* Down: child -> parent */
9220         pipe(pu);       /* Up: parent -> child */
9221         if (0 != fork()) {
9222                 int ret;
9223                 close(pd[1]);   /* Parent reads from pd[0] */
9224                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
9225 #ifdef F_SETFL
9226                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
9227                         exit(1);
9228 #else
9229                 exit(4);
9230 #endif
9231                 signal(SIGALRM, blech);
9232                 alarm(5);
9233                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
9234                         exit(2);
9235                 sprintf(string, "%d\n", ret);
9236                 write(2, string, strlen(string));
9237                 alarm(0);
9238 #ifdef EAGAIN
9239                 if (errno == EAGAIN) {
9240                         printf("EAGAIN\n");
9241                         goto ok;
9242                 }
9243 #endif
9244 #ifdef EWOULDBLOCK
9245                 if (errno == EWOULDBLOCK)
9246                         printf("EWOULDBLOCK\n");
9247 #endif
9248         ok:
9249                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
9250                 sleep(2);                               /* Give it time to close our pipe */
9251                 alarm(5);
9252                 ret = read(pd[0], buf, 1);      /* Should read EOF */
9253                 alarm(0);
9254                 sprintf(string, "%d\n", ret);
9255                 write(3, string, strlen(string));
9256                 exit(0);
9257         }
9258
9259         close(pd[0]);                   /* We write to pd[1] */
9260         close(pu[1]);                   /* We read from pu[0] */
9261         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
9262         close(pd[1]);                   /* Pipe pd is now fully closed! */
9263         exit(0);                                /* Bye bye, thank you for playing! */
9264 }
9265 EOCP
9266         set try
9267         if eval $compile_ok; then
9268                 echo "$startsh" >mtry
9269                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
9270                 chmod +x mtry
9271                 ./mtry >/dev/null 2>&1
9272                 case $? in
9273                 0) eagain=`$cat try.out`;;
9274                 1) echo "Could not perform non-blocking setting!";;
9275                 2) echo "I did a successful read() for something that was not there!";;
9276                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
9277                 4) echo "Could not find F_SETFL!";;
9278                 *) echo "Something terribly wrong happened during testing.";;
9279                 esac
9280                 rd_nodata=`$cat try.ret`
9281                 echo "A read() system call with no data present returns $rd_nodata."
9282                 case "$rd_nodata" in
9283                 0|-1) ;;
9284                 *)
9285                         echo "(That's peculiar, fixing that to be -1.)"
9286                         rd_nodata=-1
9287                         ;;
9288                 esac
9289                 case "$eagain" in
9290                 '')
9291                         echo "Forcing errno EAGAIN on read() with no data available."
9292                         eagain=EAGAIN
9293                         ;;
9294                 *)
9295                         echo "Your read() sets errno to $eagain when no data is available."
9296                         ;;
9297                 esac
9298                 status=`$cat try.err`
9299                 case "$status" in
9300                 0) echo "And it correctly returns 0 to signal EOF.";;
9301                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
9302                 *) echo "However, your read() returns '$status' on EOF??";;
9303                 esac
9304                 val="$define"
9305                 if test "$status" = "$rd_nodata"; then
9306                         echo "WARNING: you can't distinguish between EOF and no data!"
9307                         val="$undef"
9308                 fi
9309         else
9310                 echo "I can't compile the test program--assuming errno EAGAIN will do."
9311                 eagain=EAGAIN
9312         fi
9313         set d_eofnblk
9314         eval $setvar
9315         ;;
9316 *)
9317         echo "Using $hint value $eagain."
9318         echo "Your read() returns $rd_nodata when no data is present."
9319         case "$d_eofnblk" in
9320         "$define") echo "And you can see EOF because read() returns 0.";;
9321         "$undef") echo "But you can't see EOF status from read() returned value.";;
9322         *)
9323                 echo "(Assuming you can't see EOF status from read anyway.)"
9324                 d_eofnblk=$undef
9325                 ;;
9326         esac
9327         ;;
9328 esac
9329 $rm -f try try.* .out core head.c mtry
9330
9331 : see if fchmod exists
9332 set fchmod d_fchmod
9333 eval $inlibc
9334
9335 : see if fchown exists
9336 set fchown d_fchown
9337 eval $inlibc
9338
9339 : see if this is an fcntl system
9340 set fcntl d_fcntl
9341 eval $inlibc
9342
9343 echo " "
9344 : See if fcntl-based locking works.
9345 $cat >try.c <<'EOCP'
9346 #include <stdlib.h>
9347 #include <unistd.h>
9348 #include <fcntl.h>
9349 int main() {
9350 #if defined(F_SETLK) && defined(F_SETLKW)
9351      struct flock flock;
9352      int retval, fd;
9353      fd = open("try.c", O_RDONLY);
9354      flock.l_type = F_RDLCK;
9355      flock.l_whence = SEEK_SET;
9356      flock.l_start = flock.l_len = 0;
9357      retval = fcntl(fd, F_SETLK, &flock);
9358      close(fd);
9359      (retval < 0 ? exit(2) : exit(0));
9360 #else
9361      exit(2);
9362 #endif
9363 }
9364 EOCP
9365 echo "Checking if fcntl-based file locking works... "
9366 case "$d_fcntl" in
9367 "$define")
9368         set try
9369         if eval $compile_ok; then
9370                 if ./try; then
9371                         echo "Yes, it seems to work."
9372                         val="$define"
9373                 else
9374                         echo "Nope, it didn't work."
9375                         val="$undef"
9376                 fi
9377         else
9378                 echo "I'm unable to compile the test program, so I'll assume not."
9379                 val="$undef"
9380         fi
9381         ;;
9382 *) val="$undef";
9383         echo "Nope, since you don't even have fcntl()."
9384         ;;
9385 esac
9386 set d_fcntl_can_lock
9387 eval $setvar
9388 $rm -f try*
9389
9390
9391 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9392 while $test $# -ge 2; do
9393         case "$1" in
9394         $define) echo "#include <$2>";;
9395         esac ;
9396     shift 2;
9397 done > try.c;
9398 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9399 set try;
9400 if eval $compile; then
9401         val="$define";
9402 else
9403         val="$undef";
9404 fi;
9405 set $varname;
9406 eval $setvar;
9407 $rm -f try.c try.o'
9408
9409 socketlib=''
9410 sockethdr=''
9411 : see whether socket exists
9412 echo " "
9413 $echo $n "Hmm... $c" >&4
9414 if set socket val -f d_socket; eval $csym; $val; then
9415         echo "Looks like you have Berkeley networking support." >&4
9416         d_socket="$define"
9417         if set setsockopt val -f; eval $csym; $val; then
9418                 d_oldsock="$undef"
9419         else
9420                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
9421                 d_oldsock="$define"
9422         fi
9423 else
9424         if $contains socklib libc.list >/dev/null 2>&1; then
9425                 echo "Looks like you have Berkeley networking support." >&4
9426                 d_socket="$define"
9427                 : we will have to assume that it supports the 4.2 BSD interface
9428                 d_oldsock="$undef"
9429         else
9430                 echo "You don't have Berkeley networking in libc$_a..." >&4
9431                 if test "X$d_socket" = "X$define"; then
9432                    echo "...but you seem to believe that you have sockets." >&4
9433                 else
9434                         for net in net socket
9435                         do
9436                                 if test -f /usr/lib/lib$net$_a; then
9437                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
9438                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
9439                                         if $contains socket libc.list >/dev/null 2>&1; then
9440                                                 d_socket="$define"
9441                                                 socketlib="-l$net"
9442                                                 case "$net" in
9443                                                 net)
9444                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
9445                                                         sockethdr="-I/usr/netinclude"
9446                                                         ;;
9447                                                 esac
9448                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
9449                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
9450                                                         d_oldsock="$undef"
9451                                                 else
9452                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
9453                                                         d_oldsock="$define"
9454                                                 fi
9455                                                 break
9456                                         fi
9457                                 fi
9458                         done
9459                         if test "X$d_socket" != "X$define"; then
9460                            echo "or anywhere else I see." >&4
9461                            d_socket="$undef"
9462                            d_oldsock="$undef"
9463                         fi
9464                 fi
9465         fi
9466 fi
9467
9468 : see if socketpair exists
9469 set socketpair d_sockpair
9470 eval $inlibc
9471
9472
9473 echo " "
9474 echo "Checking the availability of certain socket constants..." >& 4
9475 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
9476         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
9477         $cat >try.c <<EOF
9478 #include <sys/types.h>
9479 #include <sys/socket.h>
9480 int main() {
9481     int i = $ENUM;
9482 }
9483 EOF
9484         val="$undef"
9485         set try; if eval $compile; then
9486                 val="$define"
9487         fi
9488         set d_${enum}; eval $setvar
9489         $rm -f try.c try
9490 done
9491
9492 : see if sys/select.h has to be included
9493 set sys/select.h i_sysselct
9494 eval $inhdr
9495
9496 : see if we should include time.h, sys/time.h, or both
9497 echo " "
9498 if test "X$timeincl" = X; then
9499         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9500         $echo $n "I'm now running the test program...$c"
9501         $cat >try.c <<'EOCP'
9502 #include <sys/types.h>
9503 #ifdef I_TIME
9504 #include <time.h>
9505 #endif
9506 #ifdef I_SYSTIME
9507 #ifdef SYSTIMEKERNEL
9508 #define KERNEL
9509 #endif
9510 #include <sys/time.h>
9511 #endif
9512 #ifdef I_SYSSELECT
9513 #include <sys/select.h>
9514 #endif
9515 int main()
9516 {
9517         struct tm foo;
9518 #ifdef S_TIMEVAL
9519         struct timeval bar;
9520 #endif
9521 #ifdef S_TIMEZONE
9522         struct timezone tzp;
9523 #endif
9524         if (foo.tm_sec == foo.tm_sec)
9525                 exit(0);
9526 #ifdef S_TIMEVAL
9527         if (bar.tv_sec == bar.tv_sec)
9528                 exit(0);
9529 #endif
9530         exit(1);
9531 }
9532 EOCP
9533         flags=''
9534         for s_timezone in '-DS_TIMEZONE' ''; do
9535         sysselect=''
9536         for s_timeval in '-DS_TIMEVAL' ''; do
9537         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9538         for i_time in '' '-DI_TIME'; do
9539         for i_systime in '-DI_SYSTIME' ''; do
9540                 case "$flags" in
9541                 '') $echo $n ".$c"
9542                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9543                         if eval $compile; then
9544                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9545                                 shift
9546                                 flags="$*"
9547                                 echo " "
9548                                 $echo $n "Succeeded with $flags$c"
9549                         fi
9550                         ;;
9551                 esac
9552         done
9553         done
9554         done
9555         done
9556         done
9557         timeincl=''
9558         echo " "
9559         case "$flags" in
9560         *SYSTIMEKERNEL*) i_systimek="$define"
9561                 timeincl=`./findhdr sys/time.h`
9562                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9563         *) i_systimek="$undef";;
9564         esac
9565         case "$flags" in
9566         *I_TIME*) i_time="$define"
9567                 timeincl=`./findhdr time.h`" $timeincl"
9568                 echo "We'll include <time.h>." >&4;;
9569         *) i_time="$undef";;
9570         esac
9571         case "$flags" in
9572         *I_SYSTIME*) i_systime="$define"
9573                 timeincl=`./findhdr sys/time.h`" $timeincl"
9574                 echo "We'll include <sys/time.h>." >&4;;
9575         *) i_systime="$undef";;
9576         esac
9577         $rm -f try.c try
9578 fi
9579
9580 : check for fd_set items
9581 $cat <<EOM
9582
9583 Checking to see how well your C compiler handles fd_set and friends ...
9584 EOM
9585 $cat >fd_set.c <<EOCP
9586 #$i_systime I_SYS_TIME
9587 #$i_sysselct I_SYS_SELECT
9588 #$d_socket HAS_SOCKET
9589 #include <sys/types.h>
9590 #ifdef HAS_SOCKET
9591 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9592 #endif
9593 #ifdef I_SYS_TIME
9594 #include <sys/time.h>
9595 #endif
9596 #ifdef I_SYS_SELECT
9597 #include <sys/select.h>
9598 #endif
9599 int main() {
9600         fd_set fds;
9601
9602 #ifdef TRYBITS
9603         if(fds.fds_bits);
9604 #endif
9605
9606 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9607         exit(0);
9608 #else
9609         exit(1);
9610 #endif
9611 }
9612 EOCP
9613 set fd_set -DTRYBITS
9614 if eval $compile; then
9615         d_fds_bits="$define"
9616         d_fd_set="$define"
9617         echo "Well, your system knows about the normal fd_set typedef..." >&4
9618         if ./fd_set; then
9619                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9620                 d_fd_macros="$define"
9621         else
9622                 $cat >&4 <<'EOM'
9623 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9624 EOM
9625                 d_fd_macros="$undef"
9626         fi
9627 else
9628         $cat <<'EOM'
9629 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9630 EOM
9631         set fd_set
9632         if eval $compile; then
9633                 d_fds_bits="$undef"
9634                 d_fd_set="$define"
9635                 echo "Well, your system has some sort of fd_set available..." >&4
9636                 if ./fd_set; then
9637                         echo "and you have the normal fd_set macros." >&4
9638                         d_fd_macros="$define"
9639                 else
9640                         $cat <<'EOM'
9641 but not the normal fd_set macros!  Gross!  More work for me...
9642 EOM
9643                         d_fd_macros="$undef"
9644                 fi
9645         else
9646         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9647                 d_fd_set="$undef"
9648                 d_fds_bits="$undef"
9649                 d_fd_macros="$undef"
9650         fi
9651 fi
9652 $rm -f fd_set*
9653
9654 : see if fgetpos exists
9655 set fgetpos d_fgetpos
9656 eval $inlibc
9657
9658 : see if flock exists
9659 set flock d_flock
9660 eval $inlibc
9661
9662 : see if fork exists
9663 set fork d_fork
9664 eval $inlibc
9665
9666 : see if pathconf exists
9667 set pathconf d_pathconf
9668 eval $inlibc
9669
9670 : see if fpathconf exists
9671 set fpathconf d_fpathconf
9672 eval $inlibc
9673
9674
9675 : check for fpos64_t
9676 echo " "
9677 echo "Checking to see if you have fpos64_t..." >&4
9678 $cat >try.c <<EOCP
9679 #include <stdio.h>
9680 int main() { fpos64_t x = 7; }
9681 EOCP
9682 set try
9683 if eval $compile; then
9684         val="$define"
9685         echo "You have fpos64_t."
9686 else
9687         val="$undef"
9688         echo "You do not have fpos64_t."
9689         case "$fpossize" in
9690         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
9691         esac
9692 fi
9693 $rm -f try.* try
9694 set d_fpos64_t
9695 eval $setvar
9696
9697 : see if frexpl exists
9698 set frexpl d_frexpl
9699 eval $inlibc
9700
9701 hasstruct='varname=$1; struct=$2; shift; shift;
9702 while $test $# -ge 2; do
9703         case "$1" in
9704         $define) echo "#include <$2>";;
9705         esac ;
9706     shift 2;
9707 done > try.c;
9708 echo "int main () { struct $struct foo; }" >> try.c;
9709 set try;
9710 if eval $compile; then
9711         val="$define";
9712 else
9713         val="$undef";
9714 fi;
9715 set $varname;
9716 eval $setvar;
9717 $rm -f try.c try.o'
9718
9719 : see if this is a sys/param system
9720 set sys/param.h i_sysparam
9721 eval $inhdr
9722
9723 : see if this is a sys/mount.h system
9724 set sys/mount.h i_sysmount
9725 eval $inhdr
9726
9727 : see if sys/types.h has to be included
9728 set sys/types.h i_systypes
9729 eval $inhdr
9730
9731
9732 echo " "
9733 echo "Checking to see if your system supports struct fs_data..." >&4
9734 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
9735 eval $hasstruct
9736 case "$d_fs_data_s" in
9737 "$define")      echo "Yes, it does."   ;;
9738 *)              echo "No, it doesn't." ;;
9739 esac
9740
9741 : see if fseeko exists
9742 set fseeko d_fseeko
9743 eval $inlibc
9744 case "$longsize" in
9745 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
9746 esac
9747
9748 : see if fsetpos exists
9749 set fsetpos d_fsetpos
9750 eval $inlibc
9751
9752
9753 : see if fstatfs exists
9754 set fstatfs d_fstatfs
9755 eval $inlibc
9756
9757
9758 : see if statvfs exists
9759 set statvfs d_statvfs
9760 eval $inlibc
9761
9762 : see if fstatvfs exists
9763 set fstatvfs d_fstatvfs
9764 eval $inlibc
9765
9766
9767 : see if fsync exists
9768 set fsync d_fsync
9769 eval $inlibc
9770
9771 : see if ftello exists
9772 set ftello d_ftello
9773 eval $inlibc
9774 case "$longsize" in
9775 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
9776 esac
9777
9778 : see if getcwd exists
9779 set getcwd d_getcwd
9780 eval $inlibc
9781
9782 : see if getespwnam exists
9783 set getespwnam d_getespwnam
9784 eval $inlibc
9785
9786
9787 : see if getfsstat exists
9788 set getfsstat d_getfsstat
9789 eval $inlibc
9790
9791 : see if getgrent exists
9792 set getgrent d_getgrent
9793 eval $inlibc
9794
9795 : see if gethostbyaddr exists
9796 set gethostbyaddr d_gethbyaddr
9797 eval $inlibc
9798
9799 : see if gethostbyname exists
9800 set gethostbyname d_gethbyname
9801 eval $inlibc
9802
9803 : see if gethostent exists
9804 set gethostent d_gethent
9805 eval $inlibc
9806
9807 : see how we will look up host name
9808 echo " "
9809 call=''
9810 if set gethostname val -f d_gethname; eval $csym; $val; then
9811         echo 'gethostname() found.' >&4
9812         d_gethname="$define"
9813         call=gethostname
9814 fi
9815 if set uname val -f d_uname; eval $csym; $val; then
9816         if ./xenix; then
9817                 $cat <<'EOM'
9818 uname() was found, but you're running xenix, and older versions of xenix
9819 have a broken uname(). If you don't really know whether your xenix is old
9820 enough to have a broken system call, use the default answer.
9821
9822 EOM
9823                 dflt=y
9824                 case "$d_uname" in
9825                 "$define") dflt=n;;
9826                 esac
9827                 rp='Is your uname() broken?'
9828                 . ./myread
9829                 case "$ans" in
9830                 n*) d_uname="$define"; call=uname;;
9831                 esac
9832         else
9833                 echo 'uname() found.' >&4
9834                 d_uname="$define"
9835                 case "$call" in
9836                 '') call=uname ;;
9837                 esac
9838         fi
9839 fi
9840 case "$d_gethname" in
9841 '') d_gethname="$undef";;
9842 esac
9843 case "$d_uname" in
9844 '') d_uname="$undef";;
9845 esac
9846 case "$d_uname$d_gethname" in
9847 *define*)
9848         dflt=n
9849         cat <<EOM
9850  
9851 Every now and then someone has a $call() that lies about the hostname
9852 but can't be fixed for political or economic reasons.  If you wish, I can
9853 pretend $call() isn't there and maybe compute hostname at run-time
9854 thanks to the '$phostname' command.
9855
9856 EOM
9857         rp="Shall I ignore $call() from now on?"
9858         . ./myread
9859         case "$ans" in
9860         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
9861         esac;;
9862 esac
9863 case "$phostname" in
9864 '') aphostname='';;
9865 *) case "$aphostname" in
9866         /*) ;;
9867         *) set X $phostname
9868                 shift
9869                 file=$1
9870                 shift
9871                 file=`./loc $file $file $pth`
9872                 aphostname=`echo $file $*`
9873                 ;;
9874         esac
9875         ;;
9876 esac
9877 case "$d_uname$d_gethname" in
9878 *define*) ;;
9879 *)
9880         case "$phostname" in
9881         '')
9882                 echo "There will be no way for $package to get your hostname." >&4;;
9883         *)
9884         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
9885                 ;;
9886         esac;;
9887 esac
9888 case "$d_phostname" in
9889 '') d_phostname="$undef";;
9890 esac
9891
9892 : see if this is a netdb.h system
9893 set netdb.h i_netdb
9894 eval $inhdr
9895
9896 : see if prototypes for various gethostxxx netdb.h functions are available
9897 echo " "
9898 set d_gethostprotos gethostent $i_netdb netdb.h
9899 eval $hasproto
9900
9901 : see if getlogin exists
9902 set getlogin d_getlogin
9903 eval $inlibc
9904
9905 : see if getmnt exists
9906 set getmnt d_getmnt
9907 eval $inlibc
9908
9909 : see if getmntent exists
9910 set getmntent d_getmntent
9911 eval $inlibc
9912
9913 : see if getnetbyaddr exists
9914 set getnetbyaddr d_getnbyaddr
9915 eval $inlibc
9916
9917 : see if getnetbyname exists
9918 set getnetbyname d_getnbyname
9919 eval $inlibc
9920
9921 : see if getnetent exists
9922 set getnetent d_getnent
9923 eval $inlibc
9924
9925 : see if prototypes for various getnetxxx netdb.h functions are available
9926 echo " "
9927 set d_getnetprotos getnetent $i_netdb netdb.h
9928 eval $hasproto
9929
9930 : see if getpagesize exists
9931 set getpagesize d_getpagsz
9932 eval $inlibc
9933
9934
9935 : see if getprotobyname exists
9936 set getprotobyname d_getpbyname
9937 eval $inlibc
9938
9939 : see if getprotobynumber exists
9940 set getprotobynumber d_getpbynumber
9941 eval $inlibc
9942
9943 : see if getprotoent exists
9944 set getprotoent d_getpent
9945 eval $inlibc
9946
9947 : see if getpgid exists
9948 set getpgid d_getpgid
9949 eval $inlibc
9950
9951 : see if getpgrp2 exists
9952 set getpgrp2 d_getpgrp2
9953 eval $inlibc
9954
9955 : see if getppid exists
9956 set getppid d_getppid
9957 eval $inlibc
9958
9959 : see if getpriority exists
9960 set getpriority d_getprior
9961 eval $inlibc
9962
9963 : see if prototypes for various getprotoxxx netdb.h functions are available
9964 echo " "
9965 set d_getprotoprotos getprotoent $i_netdb netdb.h
9966 eval $hasproto
9967
9968 : see if getprpwnam exists
9969 set getprpwnam d_getprpwnam
9970 eval $inlibc
9971
9972 : see if getpwent exists
9973 set getpwent d_getpwent
9974 eval $inlibc
9975
9976
9977 : see if getservbyname exists
9978 set getservbyname d_getsbyname
9979 eval $inlibc
9980
9981 : see if getservbyport exists
9982 set getservbyport d_getsbyport
9983 eval $inlibc
9984
9985 : see if getservent exists
9986 set getservent d_getsent
9987 eval $inlibc
9988
9989 : see if prototypes for various getservxxx netdb.h functions are available
9990 echo " "
9991 set d_getservprotos getservent $i_netdb netdb.h
9992 eval $hasproto
9993
9994 : see if getspnam exists
9995 set getspnam d_getspnam
9996 eval $inlibc
9997
9998 : see if gettimeofday or ftime exists
9999 set gettimeofday d_gettimeod
10000 eval $inlibc
10001 case "$d_gettimeod" in
10002 "$undef")
10003         set ftime d_ftime 
10004         eval $inlibc
10005         ;;
10006 *)
10007         val="$undef"; set d_ftime; eval $setvar
10008         ;;
10009 esac
10010 case "$d_gettimeod$d_ftime" in
10011 "$undef$undef")
10012         echo " "
10013         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
10014         ;;
10015 esac
10016
10017 : see if this is an grp system
10018 set grp.h i_grp
10019 eval $inhdr
10020
10021 case "$i_grp" in
10022 $define)
10023         xxx=`./findhdr grp.h`
10024         $cppstdin $cppflags $cppminus < $xxx >$$.h
10025
10026         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10027                 val="$define"
10028         else
10029                 val="$undef"
10030         fi
10031         set d_grpasswd
10032         eval $setvar
10033
10034         $rm -f $$.h
10035         ;;
10036 *)
10037         val="$undef";
10038         set d_grpasswd; eval $setvar
10039         ;;
10040 esac
10041
10042 : see if hasmntopt exists
10043 set hasmntopt d_hasmntopt
10044 eval $inlibc
10045
10046 : see if this is a netinet/in.h or sys/in.h system
10047 set netinet/in.h i_niin sys/in.h i_sysin
10048 eval $inhdr
10049
10050 : see if arpa/inet.h has to be included
10051 set arpa/inet.h i_arpainet
10052 eval $inhdr
10053
10054 : see if htonl --and friends-- exists
10055 val=''
10056 set htonl val
10057 eval $inlibc
10058
10059 : Maybe they are macros.
10060 case "$val" in
10061 $undef)
10062         $cat >htonl.c <<EOM
10063 #include <stdio.h>
10064 #include <sys/types.h>
10065 #$i_niin I_NETINET_IN
10066 #$i_sysin I_SYS_IN
10067 #$i_arpainet I_ARPA_INET
10068 #ifdef I_NETINET_IN
10069 #include <netinet/in.h>
10070 #endif
10071 #ifdef I_SYS_IN
10072 #include <sys/in.h>
10073 #endif
10074 #ifdef I_ARPA_INET
10075 #include <arpa/inet.h>
10076 #endif
10077 #ifdef htonl
10078 printf("Defined as a macro.");
10079 #endif
10080 EOM
10081         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
10082         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
10083                 val="$define"
10084                 echo "But it seems to be defined as a macro." >&4
10085         fi
10086         $rm -f htonl.?
10087         ;;
10088 esac
10089 set d_htonl
10090 eval $setvar
10091
10092 : see if iconv exists
10093 set iconv d_iconv
10094 eval $inlibc
10095
10096 : index or strchr
10097 echo " "
10098 if set index val -f; eval $csym; $val; then
10099         if set strchr val -f d_strchr; eval $csym; $val; then
10100                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
10101                         val="$define"
10102                         vali="$undef"
10103                         echo "strchr() found." >&4
10104                 else
10105                         val="$undef"
10106                         vali="$define"
10107                         echo "index() found." >&4
10108                 fi
10109         else
10110                 val="$undef"
10111                 vali="$define"
10112                 echo "index() found." >&4
10113         fi
10114 else
10115         if set strchr val -f d_strchr; eval $csym; $val; then
10116                 val="$define"
10117                 vali="$undef"
10118                 echo "strchr() found." >&4
10119         else
10120                 echo "No index() or strchr() found!" >&4
10121                 val="$undef"
10122                 vali="$undef"
10123         fi
10124 fi
10125 set d_strchr; eval $setvar
10126 val="$vali"
10127 set d_index; eval $setvar
10128
10129 : check whether inet_aton exists
10130 set inet_aton d_inetaton
10131 eval $inlibc
10132
10133 : Look for isascii
10134 echo " "
10135 $cat >isascii.c <<'EOCP'
10136 #include <stdio.h>
10137 #include <ctype.h>
10138 int main() {
10139         int c = 'A';
10140         if (isascii(c))
10141                 exit(0);
10142         else
10143                 exit(1);
10144 }
10145 EOCP
10146 set isascii
10147 if eval $compile; then
10148         echo "isascii() found." >&4
10149         val="$define"
10150 else
10151         echo "isascii() NOT found." >&4
10152         val="$undef"
10153 fi
10154 set d_isascii
10155 eval $setvar
10156 $rm -f isascii*
10157
10158 : see if isnan exists
10159 set isnan d_isnan
10160 eval $inlibc
10161
10162 : see if isnanl exists
10163 set isnanl d_isnanl
10164 eval $inlibc
10165
10166 : see if killpg exists
10167 set killpg d_killpg
10168 eval $inlibc
10169
10170 : see if lchown exists
10171 echo " "
10172 $cat > try.c <<'EOCP'
10173 /* System header to define __stub macros and hopefully few prototypes,
10174     which can conflict with char lchown(); below.  */
10175 #include <assert.h>
10176 /* Override any gcc2 internal prototype to avoid an error.  */
10177 /* We use char because int might match the return type of a gcc2
10178    builtin and then its argument prototype would still apply.  */
10179 char lchown();
10180 int main() {
10181     /*  The GNU C library defines this for functions which it implements
10182         to always fail with ENOSYS.  Some functions are actually named
10183         something starting with __ and the normal name is an alias.  */
10184 #if defined (__stub_lchown) || defined (__stub___lchown)
10185 choke me
10186 #else
10187 lchown();
10188 #endif
10189 ; return 0; }
10190 EOCP
10191 set try
10192 if eval $compile; then
10193     $echo "lchown() found." >&4
10194     val="$define"
10195 else
10196     $echo "lchown() NOT found." >&4
10197     val="$undef"
10198 fi
10199 set d_lchown
10200 eval $setvar
10201
10202 : See if number of significant digits in a double precision number is known
10203 echo " "
10204 $cat >ldbl_dig.c <<EOM
10205 #$i_limits I_LIMITS
10206 #$i_float I_FLOAT
10207 #ifdef I_LIMITS
10208 #include <limits.h>
10209 #endif
10210 #ifdef I_FLOAT
10211 #include <float.h>
10212 #endif
10213 #ifdef LDBL_DIG
10214 printf("Contains LDBL_DIG");
10215 #endif
10216 EOM
10217 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
10218 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
10219         echo "LDBL_DIG found." >&4
10220         val="$define"
10221 else
10222         echo "LDBL_DIG NOT found." >&4
10223         val="$undef"
10224 fi
10225 $rm -f ldbl_dig.?
10226 set d_ldbl_dig
10227 eval $setvar
10228
10229 : see if link exists
10230 set link d_link
10231 eval $inlibc
10232
10233 : see if localeconv exists
10234 set localeconv d_locconv
10235 eval $inlibc
10236
10237 : see if lockf exists
10238 set lockf d_lockf
10239 eval $inlibc
10240
10241 : see if prototype for lseek is available
10242 echo " "
10243 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
10244 eval $hasproto
10245
10246 : see if lstat exists
10247 set lstat d_lstat
10248 eval $inlibc
10249
10250 : see if madvise exists
10251 set madvise d_madvise
10252 eval $inlibc
10253
10254 : see if mblen exists
10255 set mblen d_mblen
10256 eval $inlibc
10257
10258 : see if mbstowcs exists
10259 set mbstowcs d_mbstowcs
10260 eval $inlibc
10261
10262 : see if mbtowc exists
10263 set mbtowc d_mbtowc
10264 eval $inlibc
10265
10266 : see if memchr exists
10267 set memchr d_memchr
10268 eval $inlibc
10269
10270 : see if memcmp exists
10271 set memcmp d_memcmp
10272 eval $inlibc
10273
10274 : see if memcpy exists
10275 set memcpy d_memcpy
10276 eval $inlibc
10277
10278 : see if memmove exists
10279 set memmove d_memmove
10280 eval $inlibc
10281
10282 : see if memset exists
10283 set memset d_memset
10284 eval $inlibc
10285
10286 : see if mkdir exists
10287 set mkdir d_mkdir
10288 eval $inlibc
10289
10290 : see if mkdtemp exists
10291 set mkdtemp d_mkdtemp
10292 eval $inlibc
10293
10294 : see if mkfifo exists
10295 set mkfifo d_mkfifo
10296 eval $inlibc
10297
10298 : see if mkstemp exists
10299 set mkstemp d_mkstemp
10300 eval $inlibc
10301
10302 : see if mkstemps exists
10303 set mkstemps d_mkstemps
10304 eval $inlibc
10305
10306 : see if mktime exists
10307 set mktime d_mktime
10308 eval $inlibc
10309
10310 : see if this is a sys/mman.h system
10311 set sys/mman.h i_sysmman
10312 eval $inhdr
10313
10314 : see if mmap exists
10315 set mmap d_mmap
10316 eval $inlibc
10317 : see what shmat returns
10318 : default to something harmless
10319 mmaptype='void *'
10320 case "$i_sysmman$d_mmap" in
10321 "$define$define")
10322         $cat >mmap.c <<'END'
10323 #include <sys/mman.h>
10324 void *mmap();
10325 END
10326         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
10327                 mmaptype='void *'
10328         else
10329                 mmaptype='caddr_t'
10330         fi
10331         echo "and it returns ($mmaptype)." >&4
10332         ;;
10333 esac
10334
10335
10336
10337 : see if modfl exists
10338 set modfl d_modfl
10339 eval $inlibc
10340
10341 : see if mprotect exists
10342 set mprotect d_mprotect
10343 eval $inlibc
10344
10345 : see if msgctl exists
10346 set msgctl d_msgctl
10347 eval $inlibc
10348
10349 : see if msgget exists
10350 set msgget d_msgget
10351 eval $inlibc
10352
10353 : see if msgsnd exists
10354 set msgsnd d_msgsnd
10355 eval $inlibc
10356
10357 : see if msgrcv exists
10358 set msgrcv d_msgrcv
10359 eval $inlibc
10360
10361 : see how much of the 'msg*(2)' library is present.
10362 h_msg=true
10363 echo " "
10364 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
10365 *"$undef"*) h_msg=false;;
10366 esac
10367 case "$osname" in
10368 freebsd)
10369     case "`ipcs 2>&1`" in
10370     "SVID messages"*"not configured"*)
10371         echo "Your $osname does not have the msg*(2) configured." >&4
10372         h_msg=false
10373         val="$undef"
10374         set msgctl d_msgctl
10375         eval $setvar
10376         set msgget d_msgget
10377         eval $setvar
10378         set msgsnd d_msgsnd
10379         eval $setvar
10380         set msgrcv d_msgrcv
10381         eval $setvar
10382         ;;
10383     esac
10384     ;;
10385 esac
10386 : we could also check for sys/ipc.h ...
10387 if $h_msg && $test `./findhdr sys/msg.h`; then
10388         echo "You have the full msg*(2) library." >&4
10389         val="$define"
10390 else
10391         echo "You don't have the full msg*(2) library." >&4
10392         val="$undef"
10393 fi
10394 set d_msg
10395 eval $setvar
10396
10397 : see if msync exists
10398 set msync d_msync
10399 eval $inlibc
10400
10401 : see if munmap exists
10402 set munmap d_munmap
10403 eval $inlibc
10404
10405 : see if nice exists
10406 set nice d_nice
10407 eval $inlibc
10408
10409 : check for length of character
10410 echo " "
10411 case "$charsize" in
10412 '')
10413         echo "Checking to see how big your characters are (hey, you never know)..." >&4
10414         $cat >try.c <<'EOCP'
10415 #include <stdio.h>
10416 int main()
10417 {
10418     printf("%d\n", (int)sizeof(char));
10419     exit(0);
10420 }
10421 EOCP
10422         set try
10423         if eval $compile_ok; then
10424                 dflt=`./try`
10425         else
10426                 dflt='1'
10427                 echo "(I can't seem to compile the test program.  Guessing...)"
10428         fi
10429         ;;
10430 *)
10431         dflt="$charsize"
10432         ;;
10433 esac
10434 rp="What is the size of a character (in bytes)?"
10435 . ./myread
10436 charsize="$ans"
10437 $rm -f try.c try
10438
10439 : check for volatile keyword
10440 echo " "
10441 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10442 $cat >try.c <<'EOCP'
10443 int main()
10444 {
10445         typedef struct _goo_struct goo_struct;
10446         goo_struct * volatile goo = ((goo_struct *)0);
10447         struct _goo_struct {
10448                 long long_int;
10449                 int reg_int;
10450                 char char_var;
10451         };
10452         typedef unsigned short foo_t;
10453         char *volatile foo;
10454         volatile int bar;
10455         volatile foo_t blech;
10456         foo = foo;
10457 }
10458 EOCP
10459 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10460         val="$define"
10461         echo "Yup, it does."
10462 else
10463         val="$undef"
10464         echo "Nope, it doesn't."
10465 fi
10466 set d_volatile
10467 eval $setvar
10468 $rm -f try.*
10469
10470
10471 echo " "
10472 $echo "Choosing the C types to be used for Perl's internal types..." >&4
10473
10474 case "$use64bitint:$d_quad:$quadtype" in
10475 define:define:?*)
10476         ivtype="$quadtype"
10477         uvtype="$uquadtype"
10478         ivsize=8
10479         uvsize=8
10480         ;;
10481 *)      ivtype="long"
10482         uvtype="unsigned long"
10483         ivsize=$longsize
10484         uvsize=$longsize
10485         ;;
10486 esac
10487
10488 case "$uselongdouble:$d_longdbl" in
10489 define:define)
10490         nvtype="long double"
10491         nvsize=$longdblsize
10492         ;;
10493 *)      nvtype=double
10494         nvsize=$doublesize
10495         ;;
10496 esac
10497
10498 $echo "(IV will be "$ivtype", $ivsize bytes)"
10499 $echo "(UV will be "$uvtype", $uvsize bytes)"
10500 $echo "(NV will be "$nvtype", $nvsize bytes)"
10501
10502 $cat >try.c <<EOCP
10503 #$i_inttypes I_INTTYPES
10504 #ifdef I_INTTYPES
10505 #include <inttypes.h>
10506 #endif
10507 #include <stdio.h>
10508 int main() {
10509 #ifdef INT8
10510    int8_t i =  INT8_MAX;
10511   uint8_t u = UINT8_MAX;
10512   printf("int8_t\n");
10513 #endif
10514 #ifdef INT16
10515    int16_t i =  INT16_MAX;
10516   uint16_t i = UINT16_MAX;
10517   printf("int16_t\n");
10518 #endif
10519 #ifdef INT32
10520    int32_t i =  INT32_MAX;
10521   uint32_t u = UINT32_MAX;
10522   printf("int32_t\n");
10523 #endif
10524 }
10525 EOCP
10526
10527 case "$i8type" in
10528 '')     case "$charsize" in
10529         1)      i8type=char
10530                 u8type="unsigned char"
10531                 i8size=$charsize
10532                 u8size=$charsize
10533                 ;;
10534         esac
10535         ;;
10536 esac
10537 case "$i8type" in
10538 '')     set try -DINT8
10539         if eval $compile; then
10540                 case "`./try$exe_ext`" in
10541                 int8_t) i8type=int8_t
10542                         u8type=uint8_t
10543                         i8size=1
10544                         u8size=1
10545                         ;;
10546                 esac
10547         fi
10548         ;;
10549 esac
10550 case "$i8type" in
10551 '')     if $test $charsize -ge 1; then
10552                 i8type=char
10553                 u8type="unsigned char"
10554                 i8size=$charsize
10555                 u8size=$charsize
10556         fi
10557         ;;
10558 esac
10559
10560 case "$i16type" in
10561 '')     case "$shortsize" in
10562         2)      i16type=short
10563                 u16type="unsigned short"
10564                 i16size=$shortsize
10565                 u16size=$shortsize
10566                 ;;
10567         esac
10568         ;;
10569 esac
10570 case "$i16type" in
10571 '')     set try -DINT16
10572         if eval $compile; then
10573                 case "`./try$exe_ext`" in
10574                 int16_t)
10575                         i16type=int16_t
10576                         u16type=uint16_t
10577                         i16size=2
10578                         u16size=2
10579                         ;;
10580                 esac
10581         fi
10582         ;;
10583 esac
10584 case "$i16type" in
10585 '')     if $test $shortsize -ge 2; then
10586                 i16type=short
10587                 u16type="unsigned short"
10588                 i16size=$shortsize
10589                 u16size=$shortsize
10590         fi
10591         ;;
10592 esac
10593
10594 case "$i32type" in
10595 '')     case "$longsize" in
10596         4)      i32type=long
10597                 u32type="unsigned long"
10598                 i32size=$longsize
10599                 u32size=$longsize
10600                 ;;
10601         *)      case "$intsize" in
10602                 4)      i32type=int
10603                         u32type="unsigned int"
10604                         i32size=$intsize
10605                         u32size=$intsize
10606                         ;;
10607                 esac
10608                 ;;
10609         esac
10610         ;;
10611 esac
10612 case "$i32type" in
10613 '')     set try -DINT32
10614         if eval $compile; then
10615                 case "`./try$exe_ext`" in
10616                 int32_t)
10617                         i32type=int32_t
10618                         u32type=uint32_t
10619                         i32size=4
10620                         u32size=4
10621                         ;;
10622                 esac
10623         fi
10624         ;;
10625 esac
10626 case "$i32type" in
10627 '')     if $test $intsize -ge 4; then
10628                 i32type=int
10629                 u32type="unsigned int"
10630                 i32size=$intsize
10631                 u32size=$intsize
10632         fi
10633         ;;
10634 esac
10635
10636 case "$i64type" in
10637 '')     case "$d_quad:$quadtype" in
10638         define:?*)
10639                 i64type="$quadtype"
10640                 u64type="$uquadtype"
10641                 i64size=8
10642                 u64size=8
10643                 ;;
10644         esac
10645         ;;
10646 esac
10647
10648 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
10649 : volatile so that the compiler has to store it out to memory.
10650 if test X"$d_volatile" = X"$define"; then
10651         volatile=volatile
10652 fi
10653 $cat <<EOP >try.c
10654 #include <stdio.h>
10655 #include <sys/types.h>
10656 #include <signal.h>
10657 #ifdef SIGFPE
10658 $volatile int bletched = 0;
10659 $signal_t blech(s) int s; { bletched = 1; }
10660 #endif
10661 int main() {
10662     $uvtype u = 0;
10663     $nvtype d;
10664     int     n = 8 * $uvsize;
10665     int     i;
10666 #ifdef SIGFPE
10667     signal(SIGFPE, blech);
10668 #endif
10669
10670     for (i = 0; i < n; i++) {
10671       u = u << 1 | ($uvtype)1;
10672       d = ($nvtype)u;
10673       if (($uvtype)d != u)
10674         break;
10675       if (d <= 0)
10676         break;
10677       d = ($nvtype)(u - 1);
10678       if (($uvtype)d != (u - 1))
10679         break;
10680 #ifdef SIGFPE
10681       if (bletched) {
10682         break;
10683 #endif
10684       } 
10685     }
10686     printf("%d\n", ((i == n) ? -n : i));
10687     exit(0);
10688 }
10689 EOP
10690 set try
10691
10692 d_nv_preserves_uv="$undef"
10693 if eval $compile; then
10694         d_nv_preserves_uv_bits="`./try$exe_ext`"
10695 fi
10696 case "$d_nv_preserves_uv_bits" in
10697 \-[1-9]*)       
10698         d_nv_preserves_uv_bits=`expr 0 - $d_nv_preserves_uv_bits`
10699         $echo "Your NVs can preserve all $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10700         d_nv_preserves_uv="$define"
10701         ;;
10702 [1-9]*) $echo "Your NVs can preserve only $d_nv_preserves_uv_bits bits of your UVs."  2>&1
10703         d_nv_preserves_uv="$undef" ;;
10704 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
10705         d_nv_preserves_uv_bits="$undef" ;;
10706 esac
10707
10708 $rm -f try.* try
10709
10710
10711 : check for off64_t
10712 echo " "
10713 echo "Checking to see if you have off64_t..." >&4
10714 $cat >try.c <<EOCP
10715 #include <sys/types.h>
10716 #include <unistd.h>
10717 int main() { off64_t x = 7; }
10718 EOCP
10719 set try
10720 if eval $compile; then
10721         val="$define"
10722         echo "You have off64_t."
10723 else
10724         val="$undef"
10725         echo "You do not have off64_t."
10726         case "$lseeksize" in
10727         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
10728         esac
10729 fi
10730 $rm -f try.* try
10731 set d_off64_t
10732 eval $setvar
10733
10734 : see if POSIX threads are available
10735 set pthread.h i_pthread
10736 eval $inhdr
10737
10738
10739
10740
10741 : how to create joinable pthreads
10742 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
10743         echo " "
10744         echo "Checking what constant to use for creating joinable pthreads..." >&4 
10745         $cat >try.c <<'EOCP'
10746 #include <pthread.h>
10747 int main() {
10748     int detachstate = JOINABLE;
10749 }
10750 EOCP
10751         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
10752         if eval $compile; then
10753                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
10754                 val="$undef" # Yes, undef.
10755                 set d_old_pthread_create_joinable
10756                 eval $setvar
10757                 val=""
10758                 set old_pthread_create_joinable
10759                 eval $setvar
10760         else
10761                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
10762                 if eval $compile; then
10763                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
10764                         val="$define"
10765                         set d_old_pthread_create_joinable
10766                         eval $setvar
10767                         val=PTHREAD_CREATE_UNDETACHED
10768                         set old_pthread_create_joinable
10769                         eval $setvar
10770                 else            
10771                         set try -DJOINABLE=__UNDETACHED
10772                         if eval $compile; then
10773                                 echo "You seem to use __UNDETACHED." >&4
10774                                 val="$define"
10775                                 set d_old_pthread_create_joinable
10776                                 eval $setvar
10777                                 val=__UNDETACHED
10778                                 set old_pthread_create_joinable
10779                                 eval $setvar
10780                         else
10781                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
10782                                 val="$define"
10783                                 set d_old_pthread_create_joinable
10784                                 eval $setvar
10785                                 val=0
10786                                 set old_pthread_create_joinable
10787                                 eval $setvar
10788                         fi
10789                 fi
10790         fi
10791         $rm -f try try.*
10792 else
10793     d_old_pthread_create_joinable="$undef"
10794     old_pthread_create_joinable=""
10795 fi
10796
10797 : see if pause exists
10798 set pause d_pause
10799 eval $inlibc
10800
10801 : see if pipe exists
10802 set pipe d_pipe
10803 eval $inlibc
10804
10805 : see if poll exists
10806 set poll d_poll
10807 eval $inlibc
10808
10809
10810 : see whether the various POSIXish _yields exist
10811 $cat >try.c <<EOP
10812 #include <pthread.h>
10813 #include <stdio.h>
10814 int main() {
10815 #ifdef SCHED_YIELD
10816         sched_yield();
10817 #else
10818 #ifdef PTHREAD_YIELD
10819         pthread_yield();
10820 #else
10821 #ifdef PTHREAD_YIELD_NULL
10822         pthread_yield(NULL);
10823 #endif
10824 #endif
10825 #endif
10826 }
10827 EOP
10828 : see if sched_yield exists
10829 set try -DSCHED_YIELD
10830 if eval $compile; then
10831     val="$define"
10832     sched_yield='sched_yield()'
10833 else
10834     val="$undef"
10835 fi
10836 case "$usethreads" in
10837 $define)
10838         case "$val" in
10839         $define) echo 'sched_yield() found.' >&4        ;;
10840         *)       echo 'sched_yield() NOT found.' >&4    ;;
10841         esac
10842 esac
10843 set d_sched_yield
10844 eval $setvar
10845
10846 : see if pthread_yield exists
10847 set try -DPTHREAD_YIELD
10848 if eval $compile; then
10849     val="$define"
10850     case "$sched_yield" in
10851     '') sched_yield='pthread_yield()' ;;
10852     esac
10853 else
10854     set try -DPTHREAD_YIELD_NULL
10855     if eval $compile; then
10856         val="$define"
10857         case "$sched_yield" in
10858         '') sched_yield='pthread_yield(NULL)' ;;
10859         esac
10860     else
10861         val="$undef"
10862     fi
10863 fi
10864 case "$usethreads" in
10865 $define)
10866         case "$val" in
10867         $define) echo 'pthread_yield() found.' >&4      ;;
10868         *)       echo 'pthread_yield() NOT found.' >&4  ;;
10869         esac
10870         ;;
10871 esac
10872 set d_pthread_yield
10873 eval $setvar
10874
10875 case "$sched_yield" in
10876 '') sched_yield=undef ;;
10877 esac
10878
10879 $rm -f try try.*
10880
10881 : see if this is a pwd.h system
10882 set pwd.h i_pwd
10883 eval $inhdr
10884
10885 case "$i_pwd" in
10886 $define)
10887         xxx=`./findhdr pwd.h`
10888         $cppstdin $cppflags $cppminus < $xxx >$$.h
10889
10890         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
10891                 val="$define"
10892         else
10893                 val="$undef"
10894         fi
10895         set d_pwquota
10896         eval $setvar
10897
10898         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
10899                 val="$define"
10900         else
10901                 val="$undef"
10902         fi
10903         set d_pwage
10904         eval $setvar
10905
10906         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
10907                 val="$define"
10908         else
10909                 val="$undef"
10910         fi
10911         set d_pwchange
10912         eval $setvar
10913
10914         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
10915                 val="$define"
10916         else
10917                 val="$undef"
10918         fi
10919         set d_pwclass
10920         eval $setvar
10921
10922         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
10923                 val="$define"
10924         else
10925                 val="$undef"
10926         fi
10927         set d_pwexpire
10928         eval $setvar
10929
10930         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
10931                 val="$define"
10932         else
10933                 val="$undef"
10934         fi
10935         set d_pwcomment
10936         eval $setvar
10937
10938         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
10939                 val="$define"
10940         else
10941                 val="$undef"
10942         fi
10943         set d_pwgecos
10944         eval $setvar
10945
10946         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
10947                 val="$define"
10948         else
10949                 val="$undef"
10950         fi
10951         set d_pwpasswd
10952         eval $setvar
10953
10954         $rm -f $$.h
10955         ;;
10956 *)
10957         val="$undef"; 
10958         set d_pwquota; eval $setvar
10959         set d_pwage; eval $setvar
10960         set d_pwchange; eval $setvar
10961         set d_pwclass; eval $setvar
10962         set d_pwexpire; eval $setvar
10963         set d_pwcomment; eval $setvar
10964         set d_pwgecos; eval $setvar
10965         set d_pwpasswd; eval $setvar
10966         ;;
10967 esac
10968
10969 : see if readdir and friends exist
10970 set readdir d_readdir
10971 eval $inlibc
10972 set seekdir d_seekdir
10973 eval $inlibc
10974 set telldir d_telldir
10975 eval $inlibc
10976 set rewinddir d_rewinddir
10977 eval $inlibc
10978
10979 : see if readlink exists
10980 set readlink d_readlink
10981 eval $inlibc
10982
10983 : see if rename exists
10984 set rename d_rename
10985 eval $inlibc
10986
10987 : see if rmdir exists
10988 set rmdir d_rmdir
10989 eval $inlibc
10990
10991 : see if memory.h is available.
10992 val=''
10993 set memory.h val
10994 eval $inhdr
10995
10996 : See if it conflicts with string.h
10997 case "$val" in
10998 $define)
10999         case "$strings" in
11000         '') ;;
11001         *)
11002                 $cppstdin $cppflags $cppminus < $strings > mem.h
11003                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
11004                         echo " "
11005                         echo "We won't be including <memory.h>."
11006                         val="$undef"
11007                 fi
11008                 $rm -f mem.h
11009                 ;;
11010         esac
11011 esac
11012 set i_memory
11013 eval $setvar
11014
11015 : can bcopy handle overlapping blocks?
11016 val="$undef"
11017 case "$d_bcopy" in
11018 "$define")
11019         echo " "
11020         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
11021         $cat >try.c <<EOCP
11022 #$i_memory I_MEMORY
11023 #$i_stdlib I_STDLIB
11024 #$i_string I_STRING
11025 #$i_unistd I_UNISTD
11026 EOCP
11027         $cat >>try.c <<'EOCP'
11028 #include <stdio.h>
11029 #ifdef I_MEMORY
11030 #  include <memory.h>
11031 #endif
11032 #ifdef I_STDLIB
11033 #  include <stdlib.h>
11034 #endif
11035 #ifdef I_STRING
11036 #  include <string.h>
11037 #else
11038 #  include <strings.h>
11039 #endif
11040 #ifdef I_UNISTD
11041 #  include <unistd.h>  /* Needed for NetBSD */
11042 #endif
11043 int main()
11044 {
11045 char buf[128], abc[128];
11046 char *b;
11047 int len;
11048 int off;
11049 int align;
11050
11051 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
11052
11053 for (align = 7; align >= 0; align--) {
11054         for (len = 36; len; len--) {
11055                 b = buf+align;
11056                 bcopy(abc, b, len);
11057                 for (off = 1; off <= len; off++) {
11058                         bcopy(b, b+off, len);
11059                         bcopy(b+off, b, len);
11060                         if (bcmp(b, abc, len))
11061                                 exit(1);
11062                 }
11063         }
11064 }
11065 exit(0);
11066 }
11067 EOCP
11068         set try
11069         if eval $compile_ok; then
11070                 if ./try 2>/dev/null; then
11071                         echo "Yes, it can."
11072                         val="$define"
11073                 else
11074                         echo "It can't, sorry."
11075                         case "$d_memmove" in
11076                         "$define") echo "But that's Ok since you have memmove()." ;;
11077                         esac
11078                 fi
11079         else
11080                 echo "(I can't compile the test program, so we'll assume not...)"
11081                 case "$d_memmove" in
11082                 "$define") echo "But that's Ok since you have memmove()." ;;
11083                 esac
11084         fi
11085         ;;
11086 esac
11087 $rm -f try.* try core
11088 set d_safebcpy
11089 eval $setvar
11090
11091 : can memcpy handle overlapping blocks?
11092 val="$undef"
11093 case "$d_memcpy" in
11094 "$define")
11095         echo " "
11096         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
11097         $cat >try.c <<EOCP
11098 #$i_memory I_MEMORY
11099 #$i_stdlib I_STDLIB
11100 #$i_string I_STRING
11101 #$i_unistd I_UNISTD
11102 EOCP
11103         $cat >>try.c <<'EOCP'
11104 #include <stdio.h>
11105 #ifdef I_MEMORY
11106 #  include <memory.h>
11107 #endif
11108 #ifdef I_STDLIB
11109 #  include <stdlib.h>
11110 #endif
11111 #ifdef I_STRING
11112 #  include <string.h>
11113 #else
11114 #  include <strings.h>
11115 #endif
11116 #ifdef I_UNISTD
11117 #  include <unistd.h>  /* Needed for NetBSD */
11118 #endif
11119 int main()
11120 {
11121 char buf[128], abc[128];
11122 char *b;
11123 int len;
11124 int off;
11125 int align;
11126
11127 /* Copy "abcde..." string to char abc[] so that gcc doesn't
11128    try to store the string in read-only memory. */
11129 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
11130
11131 for (align = 7; align >= 0; align--) {
11132         for (len = 36; len; len--) {
11133                 b = buf+align;
11134                 memcpy(b, abc, len);
11135                 for (off = 1; off <= len; off++) {
11136                         memcpy(b+off, b, len);
11137                         memcpy(b, b+off, len);
11138                         if (memcmp(b, abc, len))
11139                                 exit(1);
11140                 }
11141         }
11142 }
11143 exit(0);
11144 }
11145 EOCP
11146         set try
11147         if eval $compile_ok; then
11148                 if ./try 2>/dev/null; then
11149                         echo "Yes, it can."
11150                         val="$define"
11151                 else
11152                         echo "It can't, sorry."
11153                         case "$d_memmove" in
11154                         "$define") echo "But that's Ok since you have memmove()." ;;
11155                         esac
11156                 fi
11157         else
11158                 echo "(I can't compile the test program, so we'll assume not...)"
11159                 case "$d_memmove" in
11160                 "$define") echo "But that's Ok since you have memmove()." ;;
11161                 esac
11162         fi
11163         ;;
11164 esac
11165 $rm -f try.* try core
11166 set d_safemcpy
11167 eval $setvar
11168
11169 : can memcmp be trusted to compare relative magnitude?
11170 val="$undef"
11171 case "$d_memcmp" in
11172 "$define")
11173         echo " "
11174         echo "Checking if your memcmp() can compare relative magnitude..." >&4
11175         $cat >try.c <<EOCP
11176 #$i_memory I_MEMORY
11177 #$i_stdlib I_STDLIB
11178 #$i_string I_STRING
11179 #$i_unistd I_UNISTD
11180 EOCP
11181         $cat >>try.c <<'EOCP'
11182 #include <stdio.h>
11183 #ifdef I_MEMORY
11184 #  include <memory.h>
11185 #endif
11186 #ifdef I_STDLIB
11187 #  include <stdlib.h>
11188 #endif
11189 #ifdef I_STRING
11190 #  include <string.h>
11191 #else
11192 #  include <strings.h>
11193 #endif
11194 #ifdef I_UNISTD
11195 #  include <unistd.h>  /* Needed for NetBSD */
11196 #endif
11197 int main()
11198 {
11199 char a = -1;
11200 char b = 0;
11201 if ((a < b) && memcmp(&a, &b, 1) < 0)
11202         exit(1);
11203 exit(0);
11204 }
11205 EOCP
11206         set try
11207         if eval $compile_ok; then
11208                 if ./try 2>/dev/null; then
11209                         echo "Yes, it can."
11210                         val="$define"
11211                 else
11212                         echo "No, it can't (it uses signed chars)."
11213                 fi
11214         else
11215                 echo "(I can't compile the test program, so we'll assume not...)"
11216         fi
11217         ;;
11218 esac
11219 $rm -f try.* try core
11220 set d_sanemcmp
11221 eval $setvar
11222
11223 : see if prototype for sbrk is available
11224 echo " "
11225 set d_sbrkproto sbrk $i_unistd unistd.h
11226 eval $hasproto
11227
11228 : see if select exists
11229 set select d_select
11230 eval $inlibc
11231
11232 : see if semctl exists
11233 set semctl d_semctl
11234 eval $inlibc
11235
11236 : see if semget exists
11237 set semget d_semget
11238 eval $inlibc
11239
11240 : see if semop exists
11241 set semop d_semop
11242 eval $inlibc
11243
11244 : see how much of the 'sem*(2)' library is present.
11245 h_sem=true
11246 echo " "
11247 case "$d_semctl$d_semget$d_semop" in
11248 *"$undef"*) h_sem=false;;
11249 esac
11250 case "$osname" in
11251 freebsd)
11252     case "`ipcs 2>&1`" in
11253     "SVID messages"*"not configured"*)
11254         echo "Your $osname does not have the sem*(2) configured." >&4
11255         h_sem=false
11256         val="$undef"
11257         set semctl d_semctl
11258         eval $setvar
11259         set semget d_semget
11260         eval $setvar
11261         set semop d_semop
11262         eval $setvar
11263         ;;
11264     esac
11265     ;;
11266 esac
11267 : we could also check for sys/ipc.h ...
11268 if $h_sem && $test `./findhdr sys/sem.h`; then
11269         echo "You have the full sem*(2) library." >&4
11270         val="$define"
11271 else
11272         echo "You don't have the full sem*(2) library." >&4
11273         val="$undef"
11274 fi
11275 set d_sem
11276 eval $setvar
11277
11278 : see whether sys/sem.h defines union semun
11279 echo " "
11280 $cat > try.c <<'END'
11281 #include <sys/types.h>
11282 #include <sys/ipc.h>
11283 #include <sys/sem.h>
11284 int main () { union semun semun; semun.buf = 0; }
11285 END
11286 set try
11287 if eval $compile; then
11288     echo "You have union semun in <sys/sem.h>." >&4
11289     val="$define"
11290 else
11291     echo "You do not have union semun in <sys/sem.h>." >&4
11292     val="$undef"
11293 fi
11294 $rm -f try try.c try.h
11295 set d_union_semun
11296 eval $setvar
11297
11298 : see how to do semctl IPC_STAT
11299 case "$d_sem" in
11300 $define)
11301     : see whether semctl IPC_STAT can use union semun
11302     echo " "
11303     $cat > try.h <<END
11304 #ifndef S_IRUSR
11305 #   ifdef S_IREAD
11306 #       define S_IRUSR S_IREAD
11307 #       define S_IWUSR S_IWRITE
11308 #       define S_IXUSR S_IEXEC
11309 #   else
11310 #       define S_IRUSR 0400
11311 #       define S_IWUSR 0200
11312 #       define S_IXUSR 0100
11313 #   endif
11314 #   define S_IRGRP (S_IRUSR>>3)
11315 #   define S_IWGRP (S_IWUSR>>3)
11316 #   define S_IXGRP (S_IXUSR>>3)
11317 #   define S_IROTH (S_IRUSR>>6)
11318 #   define S_IWOTH (S_IWUSR>>6)
11319 #   define S_IXOTH (S_IXUSR>>6)
11320 #endif
11321 #ifndef S_IRWXU
11322 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
11323 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
11324 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
11325 #endif
11326 END
11327
11328     $cat > try.c <<END
11329 #include <sys/types.h>
11330 #include <sys/ipc.h>
11331 #include <sys/sem.h>
11332 #include <sys/stat.h>
11333 #include <stdio.h>
11334 #include <errno.h>
11335 #include "try.h"
11336 #ifndef errno
11337 extern int errno;
11338 #endif
11339 #$d_union_semun HAS_UNION_SEMUN
11340 int main() {
11341     union semun
11342 #ifndef HAS_UNION_SEMUN
11343     {
11344         int val;
11345         struct semid_ds *buf;
11346         unsigned short *array;
11347     }
11348 #endif
11349     arg;
11350     int sem, st;
11351
11352 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
11353     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11354     if (sem > -1) {
11355         struct semid_ds argbuf;
11356         arg.buf = &argbuf;
11357 #       ifdef IPC_STAT
11358         st = semctl(sem, 0, IPC_STAT, arg);
11359         if (st == 0)
11360             printf("semun\n");
11361         else
11362 #       endif /* IPC_STAT */
11363             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11364 #       ifdef IPC_RMID
11365         if (semctl(sem, 0, IPC_RMID, arg) != 0)
11366 #       endif /* IPC_RMID */
11367             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11368     } else
11369 #endif /* IPC_PRIVATE && ... */
11370         printf("semget failed: errno = %d\n", errno);
11371   return 0;
11372 }
11373 END
11374     val="$undef"
11375     set try
11376     if eval $compile; then
11377         xxx=`./try`
11378         case "$xxx" in
11379         semun) val="$define" ;;
11380         esac
11381     fi
11382     $rm -f try try.c
11383     set d_semctl_semun
11384     eval $setvar
11385     case "$d_semctl_semun" in
11386     $define)
11387         echo "You can use union semun for semctl IPC_STAT." >&4
11388         also='also'
11389         ;;
11390     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
11391         also=''
11392         ;;
11393     esac
11394
11395     : see whether semctl IPC_STAT can use struct semid_ds pointer
11396     $cat > try.c <<'END'
11397 #include <sys/types.h>
11398 #include <sys/ipc.h>
11399 #include <sys/sem.h>
11400 #include <sys/stat.h>
11401 #include "try.h"
11402 #include <stdio.h>
11403 #include <errno.h>
11404 #ifndef errno
11405 extern int errno;
11406 #endif
11407 int main() {
11408     struct semid_ds arg;
11409     int sem, st;
11410
11411 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
11412     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
11413     if (sem > -1) {
11414 #       ifdef IPC_STAT
11415         st = semctl(sem, 0, IPC_STAT, &arg);
11416         if (st == 0)
11417             printf("semid_ds\n");
11418         else
11419 #       endif /* IPC_STAT */
11420             printf("semctl IPC_STAT failed: errno = %d\n", errno);
11421 #       ifdef IPC_RMID
11422         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
11423 #       endif /* IPC_RMID */
11424             printf("semctl IPC_RMID failed: errno = %d\n", errno);
11425     } else
11426 #endif /* IPC_PRIVATE && ... */
11427         printf("semget failed: errno = %d\n", errno);
11428
11429     return 0;
11430 }
11431 END
11432     val="$undef"
11433     set try
11434     if eval $compile; then
11435         xxx=`./try`
11436         case "$xxx" in
11437         semid_ds) val="$define" ;;
11438         esac
11439     fi
11440     $rm -f try try.c
11441     set d_semctl_semid_ds
11442     eval $setvar
11443     case "$d_semctl_semid_ds" in
11444     $define)
11445         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
11446         ;;
11447     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
11448         ;;
11449     esac
11450     $rm -f try.h
11451     ;;
11452 *)  val="$undef"
11453
11454     # We do not have the full sem*(2) library, so assume we can not
11455     # use either.
11456
11457     set d_semctl_semun
11458     eval $setvar
11459
11460     set d_semctl_semid_ds
11461     eval $setvar
11462     ;;
11463 esac
11464
11465 : see if setegid exists
11466 set setegid d_setegid
11467 eval $inlibc
11468
11469 : see if seteuid exists
11470 set seteuid d_seteuid
11471 eval $inlibc
11472
11473 : see if setgrent exists
11474 set setgrent d_setgrent
11475 eval $inlibc
11476
11477 : see if sethostent exists
11478 set sethostent d_sethent
11479 eval $inlibc
11480
11481 : see if setlinebuf exists
11482 set setlinebuf d_setlinebuf
11483 eval $inlibc
11484
11485 : see if setlocale exists
11486 set setlocale d_setlocale
11487 eval $inlibc
11488
11489 : see if setnetent exists
11490 set setnetent d_setnent
11491 eval $inlibc
11492
11493 : see if setprotoent exists
11494 set setprotoent d_setpent
11495 eval $inlibc
11496
11497 : see if setpgid exists
11498 set setpgid d_setpgid
11499 eval $inlibc
11500
11501 : see if setpgrp2 exists
11502 set setpgrp2 d_setpgrp2
11503 eval $inlibc
11504
11505 : see if setpriority exists
11506 set setpriority d_setprior
11507 eval $inlibc
11508
11509 : see if setproctitle exists
11510 set setproctitle d_setproctitle
11511 eval $inlibc
11512
11513 : see if setpwent exists
11514 set setpwent d_setpwent
11515 eval $inlibc
11516
11517 : see if setregid exists
11518 set setregid d_setregid
11519 eval $inlibc
11520 set setresgid d_setresgid
11521 eval $inlibc
11522
11523 : see if setreuid exists
11524 set setreuid d_setreuid
11525 eval $inlibc
11526 set setresuid d_setresuid
11527 eval $inlibc
11528
11529 : see if setrgid exists
11530 set setrgid d_setrgid
11531 eval $inlibc
11532
11533 : see if setruid exists
11534 set setruid d_setruid
11535 eval $inlibc
11536
11537 : see if setservent exists
11538 set setservent d_setsent
11539 eval $inlibc
11540
11541 : see if setsid exists
11542 set setsid d_setsid
11543 eval $inlibc
11544
11545 : see if setvbuf exists
11546 set setvbuf d_setvbuf
11547 eval $inlibc
11548
11549 : see if sfio.h is available
11550 set sfio.h i_sfio
11551 eval $inhdr
11552
11553
11554 : see if sfio library is available
11555 case "$i_sfio" in
11556 $define)
11557         val=''
11558         set sfreserve val
11559         eval $inlibc
11560         ;;
11561 *)
11562         val="$undef"
11563         ;;
11564 esac
11565 : Ok, but do we want to use it.
11566 case "$val" in
11567 $define)
11568         case "$usesfio" in
11569         true|$define|[yY]*) dflt='y';;
11570         *) dflt='n';;
11571         esac
11572         echo "$package can use the sfio library, but it is experimental."
11573         case "$useperlio" in
11574         "$undef")
11575             echo "For sfio also the PerlIO abstraction layer is needed."
11576             echo "Earlier you said you wouldn't want that."
11577             ;;
11578         esac
11579         rp="You seem to have sfio available, do you want to try using it?"
11580         . ./myread
11581         case "$ans" in
11582         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
11583                 useperlio="$define"
11584                 val="$define"
11585                 ;;
11586         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
11587                 val="$undef"
11588                 ;;
11589         esac
11590         ;;
11591 *)      case "$usesfio" in
11592         true|$define|[yY]*)
11593                 echo "Sorry, cannot find sfio on this machine." >&4
11594                 echo "Ignoring your setting of usesfio=$usesfio." >&4
11595                 val="$undef"
11596                 ;;
11597         esac
11598         ;;
11599 esac
11600 set d_sfio
11601 eval $setvar
11602 case "$d_sfio" in
11603 $define) usesfio='true';;
11604 *) usesfio='false';;
11605 esac
11606 case "$d_sfio" in
11607 $define) ;;
11608 *)      : Remove sfio from list of libraries to use
11609         set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
11610         shift
11611         libs="$*"
11612         echo "libs = $libs" >&4
11613 ;;
11614 esac
11615
11616
11617 : see if shmctl exists
11618 set shmctl d_shmctl
11619 eval $inlibc
11620
11621 : see if shmget exists
11622 set shmget d_shmget
11623 eval $inlibc
11624
11625 : see if shmat exists
11626 set shmat d_shmat
11627 eval $inlibc
11628 : see what shmat returns
11629 case "$d_shmat" in
11630 "$define")
11631         $cat >shmat.c <<'END'
11632 #include <sys/shm.h>
11633 void *shmat();
11634 END
11635         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
11636                 shmattype='void *'
11637         else
11638                 shmattype='char *'
11639         fi
11640         echo "and it returns ($shmattype)." >&4
11641         : see if a prototype for shmat is available
11642         xxx=`./findhdr sys/shm.h`
11643         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
11644         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
11645                 val="$define"
11646         else
11647                 val="$undef"
11648         fi
11649         $rm -f shmat.[co]
11650         ;;
11651 *)
11652         val="$undef"
11653         ;;
11654 esac
11655 set d_shmatprototype
11656 eval $setvar
11657
11658 : see if shmdt exists
11659 set shmdt d_shmdt
11660 eval $inlibc
11661
11662 : see how much of the 'shm*(2)' library is present.
11663 h_shm=true
11664 echo " "
11665 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
11666 *"$undef"*) h_shm=false;;
11667 esac
11668 case "$osname" in
11669 freebsd)
11670     case "`ipcs 2>&1`" in
11671     "SVID shared memory"*"not configured"*)
11672         echo "Your $osname does not have the shm*(2) configured." >&4
11673         h_shm=false
11674         val="$undef"
11675         set shmctl d_shmctl
11676         evat $setvar
11677         set shmget d_shmget
11678         evat $setvar
11679         set shmat d_shmat
11680         evat $setvar
11681         set shmdt d_shmdt
11682         evat $setvar
11683         ;;
11684     esac
11685     ;;
11686 esac
11687 : we could also check for sys/ipc.h ...
11688 if $h_shm && $test `./findhdr sys/shm.h`; then
11689         echo "You have the full shm*(2) library." >&4
11690         val="$define"
11691 else
11692         echo "You don't have the full shm*(2) library." >&4
11693         val="$undef"
11694 fi
11695 set d_shm
11696 eval $setvar
11697
11698 echo " "
11699 : see if we have sigaction
11700 if set sigaction val -f d_sigaction; eval $csym; $val; then
11701         echo 'sigaction() found.' >&4
11702         $cat > try.c <<'EOP'
11703 #include <stdio.h>
11704 #include <sys/types.h>
11705 #include <signal.h>
11706 int main()
11707 {
11708     struct sigaction act, oact;
11709     act.sa_flags = 0;
11710     oact.sa_handler = 0;
11711     /* so that act and oact are used */
11712     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
11713 }
11714 EOP
11715         set try
11716         if eval $compile_ok; then
11717                 val="$define"
11718         else
11719                 echo "But you don't seem to have a useable struct sigaction." >&4
11720                 val="$undef"
11721         fi
11722 else
11723         echo 'sigaction NOT found.' >&4
11724         val="$undef"
11725 fi
11726 set d_sigaction; eval $setvar
11727 $rm -f try try$_o try.c
11728
11729 : see if sigprocmask exists
11730 set sigprocmask d_sigprocmask
11731 eval $inlibc
11732
11733 : see if sigsetjmp exists
11734 echo " "
11735 case "$d_sigsetjmp" in
11736 '')
11737         $cat >try.c <<'EOP'
11738 #include <setjmp.h>
11739 sigjmp_buf env;
11740 int set = 1;
11741 int main()
11742 {
11743         if (sigsetjmp(env,1))
11744                 exit(set);
11745         set = 0;
11746         siglongjmp(env, 1);
11747         exit(1);
11748 }
11749 EOP
11750         set try
11751         if eval $compile; then
11752                 if ./try >/dev/null 2>&1; then
11753                         echo "POSIX sigsetjmp found." >&4
11754                         val="$define"
11755                 else
11756                         $cat >&4 <<EOM
11757 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
11758 I'll ignore them.
11759 EOM
11760                         val="$undef"
11761                 fi
11762         else
11763                 echo "sigsetjmp not found." >&4
11764                 val="$undef"
11765         fi
11766         ;;
11767 *) val="$d_sigsetjmp"
11768         case "$d_sigsetjmp" in
11769         $define) echo "POSIX sigsetjmp found." >&4;;
11770         $undef) echo "sigsetjmp not found." >&4;;
11771         esac
11772         ;;
11773 esac
11774 set d_sigsetjmp
11775 eval $setvar
11776 $rm -f try.c try
11777
11778 : see if sockatmark exists
11779 set sockatmark d_sockatmark
11780 eval $inlibc
11781
11782 : see if socks5_init exists
11783 set socks5_init d_socks5_init
11784 eval $inlibc
11785
11786 : see if sys/stat.h is available
11787 set sys/stat.h i_sysstat
11788 eval $inhdr
11789
11790
11791 : see if stat knows about block sizes
11792 echo " "
11793 echo "Checking to see if your struct stat has st_blocks field..." >&4
11794 set d_statblks stat st_blocks $i_sysstat sys/stat.h
11795 eval $hasfield
11796
11797
11798 : see if this is a sys/vfs.h system
11799 set sys/vfs.h i_sysvfs
11800 eval $inhdr
11801
11802
11803 : see if this is a sys/statfs.h system
11804 set sys/statfs.h i_sysstatfs
11805 eval $inhdr
11806
11807
11808 echo " "
11809 echo "Checking to see if your system supports struct statfs..." >&4
11810 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
11811 eval $hasstruct
11812 case "$d_statfs_s" in
11813 "$define")      echo "Yes, it does."   ;;
11814 *)              echo "No, it doesn't." ;;
11815 esac
11816
11817
11818
11819 : see if struct statfs knows about f_flags
11820 case "$d_statfs_s" in
11821 define) 
11822         echo " "
11823         echo "Checking to see if your struct statfs has f_flags field..." >&4
11824         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
11825         eval $hasfield
11826         ;;
11827 *)      val="$undef"
11828         set d_statfs_f_flags
11829         eval $setvar
11830         ;;
11831 esac
11832 case "$d_statfs_f_flags" in
11833 "$define")      echo "Yes, it does."   ;;
11834 *)              echo "No, it doesn't." ;;
11835 esac
11836
11837 : see if _ptr and _cnt from stdio act std
11838 echo " "
11839
11840 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11841         echo "(Looks like you have stdio.h from BSD.)"
11842         case "$stdio_ptr" in
11843         '') stdio_ptr='((fp)->_p)'
11844                 ptr_lval=$define
11845                 ;;
11846         *)      ptr_lval=$d_stdio_ptr_lval;;
11847         esac
11848         case "$stdio_cnt" in
11849         '') stdio_cnt='((fp)->_r)'
11850                 cnt_lval=$define
11851                 ;;
11852         *)      cnt_lval=$d_stdio_cnt_lval;;
11853         esac
11854         case "$stdio_base" in
11855         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11856         esac
11857         case "$stdio_bufsiz" in
11858         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11859         esac
11860 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11861         echo "(Looks like you have stdio.h from Linux.)"
11862         case "$stdio_ptr" in
11863         '') stdio_ptr='((fp)->_IO_read_ptr)'
11864                 ptr_lval=$define
11865                 ;;
11866         *)      ptr_lval=$d_stdio_ptr_lval;;
11867         esac
11868         case "$stdio_cnt" in
11869         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11870                 cnt_lval=$undef
11871                 ;;
11872         *)      cnt_lval=$d_stdio_cnt_lval;;
11873         esac
11874         case "$stdio_base" in
11875         '') stdio_base='((fp)->_IO_read_base)';;
11876         esac
11877         case "$stdio_bufsiz" in
11878         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11879         esac
11880 else
11881         case "$stdio_ptr" in
11882         '') stdio_ptr='((fp)->_ptr)'
11883                 ptr_lval=$define
11884                 ;;
11885         *)      ptr_lval=$d_stdio_ptr_lval;;
11886         esac
11887         case "$stdio_cnt" in
11888         '') stdio_cnt='((fp)->_cnt)'
11889                 cnt_lval=$define
11890                 ;;
11891         *)      cnt_lval=$d_stdio_cnt_lval;;
11892         esac
11893         case "$stdio_base" in
11894         '') stdio_base='((fp)->_base)';;
11895         esac
11896         case "$stdio_bufsiz" in
11897         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11898         esac
11899 fi
11900
11901 : test whether _ptr and _cnt really work
11902 echo "Checking how std your stdio is..." >&4
11903 $cat >try.c <<EOP
11904 #include <stdio.h>
11905 #define FILE_ptr(fp)    $stdio_ptr
11906 #define FILE_cnt(fp)    $stdio_cnt
11907 int main() {
11908         FILE *fp = fopen("try.c", "r");
11909         char c = getc(fp);
11910         if (
11911                 18 <= FILE_cnt(fp) &&
11912                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11913         )
11914                 exit(0);
11915         exit(1);
11916 }
11917 EOP
11918 val="$undef"
11919 set try
11920 if eval $compile; then
11921         if ./try; then
11922                 echo "Your stdio acts pretty std."
11923                 val="$define"
11924         else
11925                 echo "Your stdio isn't very std."
11926         fi
11927 else
11928         echo "Your stdio doesn't appear very std."
11929 fi
11930 $rm -f try.c try
11931 set d_stdstdio
11932 eval $setvar
11933
11934 : Can _ptr be used as an lvalue?
11935 case "$d_stdstdio$ptr_lval" in
11936 $define$define) val=$define ;;
11937 *) val=$undef ;;
11938 esac
11939 set d_stdio_ptr_lval
11940 eval $setvar
11941
11942 : Can _cnt be used as an lvalue?
11943 case "$d_stdstdio$cnt_lval" in
11944 $define$define) val=$define ;;
11945 *) val=$undef ;;
11946 esac
11947 set d_stdio_cnt_lval
11948 eval $setvar
11949
11950
11951 : test whether setting _ptr sets _cnt as a side effect
11952 d_stdio_ptr_lval_sets_cnt="$undef"
11953 d_stdio_ptr_lval_nochange_cnt="$undef"
11954 case "$d_stdio_ptr_lval$d_stdstdio" in
11955 $define$define)
11956         echo "Checking to see what happens if we set the stdio ptr..." >&4
11957 $cat >try.c <<EOP
11958 #include <stdio.h>
11959 /* Can we scream? */
11960 /* Eat dust sed :-) */
11961 /* In the buffer space, no one can hear you scream. */
11962 #define FILE_ptr(fp)    $stdio_ptr
11963 #define FILE_cnt(fp)    $stdio_cnt
11964 #include <sys/types.h>
11965 int main() {
11966         FILE *fp = fopen("try.c", "r");
11967         int c;
11968         char *ptr;
11969         size_t cnt;
11970         if (!fp) {
11971             puts("Fail even to read");
11972             exit(1);
11973         }
11974         c = getc(fp); /* Read away the first # */
11975         if (c == EOF) {
11976             puts("Fail even to read");
11977             exit(1);
11978         }
11979         if (!(
11980                 18 <= FILE_cnt(fp) &&
11981                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11982         )) {
11983                 puts("Fail even to read");
11984                 exit (1);
11985         }
11986         ptr = (char*) FILE_ptr(fp);
11987         cnt = (size_t)FILE_cnt(fp);
11988
11989         FILE_ptr(fp) += 42;
11990
11991         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
11992                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
11993                 exit (1);
11994         }
11995         if (FILE_cnt(fp) <= 20) {
11996                 printf ("Fail (<20 chars to test)");
11997                 exit (1);
11998         }
11999         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12000                 puts("Fail compare");
12001                 exit (1);
12002         }
12003         if (cnt == FILE_cnt(fp)) {
12004                 puts("Pass_unchanged");
12005                 exit (0);
12006         }       
12007         if (FILE_cnt(fp) == (cnt - 42)) {
12008                 puts("Pass_changed");
12009                 exit (0);
12010         }
12011         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12012         return 1;
12013
12014 }
12015 EOP
12016         set try
12017         if eval $compile; then
12018                 case `./try$exe_ext` in
12019                 Pass_changed)
12020                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12021                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12022                 Pass_unchanged)
12023                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12024                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12025                 Fail*)
12026                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12027                 *)
12028                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12029         esac
12030         else
12031                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12032         fi
12033         $rm -f try.c try
12034         ;;
12035 esac
12036
12037 : see if _base is also standard
12038 val="$undef"
12039 case "$d_stdstdio" in
12040 $define)
12041         $cat >try.c <<EOP
12042 #include <stdio.h>
12043 #define FILE_base(fp)   $stdio_base
12044 #define FILE_bufsiz(fp) $stdio_bufsiz
12045 int main() {
12046         FILE *fp = fopen("try.c", "r");
12047         char c = getc(fp);
12048         if (
12049                 19 <= FILE_bufsiz(fp) &&
12050                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12051         )
12052                 exit(0);
12053         exit(1);
12054 }
12055 EOP
12056         set try
12057         if eval $compile; then
12058                 if ./try; then
12059                         echo "And its _base field acts std."
12060                         val="$define"
12061                 else
12062                         echo "But its _base field isn't std."
12063                 fi
12064         else
12065                 echo "However, it seems to be lacking the _base field."
12066         fi
12067         $rm -f try.c try
12068         ;;
12069 esac
12070 set d_stdiobase
12071 eval $setvar
12072
12073 $cat >&4 <<EOM
12074 Checking how to access stdio streams by file descriptor number...
12075 EOM
12076 case "$stdio_stream_array" in
12077 '')     $cat >try.c <<EOCP
12078 #include <stdio.h>
12079 int main() {
12080   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
12081     printf("yes\n");
12082 }
12083 EOCP
12084         for s in _iob __iob __sF
12085         do
12086                 set try -DSTDIO_STREAM_ARRAY=$s
12087                 if eval $compile; then
12088                         case "`./try$exe_ext`" in
12089                         yes)    stdio_stream_array=$s; break ;;
12090                         esac
12091                 fi
12092         done
12093         $rm -f try.* try$exe_ext
12094 esac
12095 case "$stdio_stream_array" in
12096 '')     $cat >&4 <<EOM
12097 I can't figure out how to access stdio streams by file descriptor number.
12098 EOM
12099         d_stdio_stream_array="$undef"
12100         ;;
12101 *)      $cat >&4 <<EOM
12102 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
12103 EOM
12104         d_stdio_stream_array="$define"
12105         ;;
12106 esac
12107
12108 : see if strcoll exists
12109 set strcoll d_strcoll
12110 eval $inlibc
12111
12112 : check for structure copying
12113 echo " "
12114 echo "Checking to see if your C compiler can copy structs..." >&4
12115 $cat >try.c <<'EOCP'
12116 int main()
12117 {
12118         struct blurfl {
12119                 int dyick;
12120         } foo, bar;
12121
12122         foo = bar;
12123 }
12124 EOCP
12125 if $cc -c try.c >/dev/null 2>&1 ; then
12126         val="$define"
12127         echo "Yup, it can."
12128 else
12129         val="$undef"
12130         echo "Nope, it can't."
12131 fi
12132 set d_strctcpy
12133 eval $setvar
12134 $rm -f try.*
12135
12136 : see if strerror and/or sys_errlist[] exist
12137 echo " "
12138 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
12139     if set strerror val -f d_strerror; eval $csym; $val; then
12140                 echo 'strerror() found.' >&4
12141                 d_strerror="$define"
12142                 d_strerrm='strerror(e)'
12143                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
12144                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
12145                         d_syserrlst="$define"
12146                 else
12147                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
12148                         d_syserrlst="$undef"
12149                 fi
12150     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
12151                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
12152                 echo 'strerror() found in string header.' >&4
12153                 d_strerror="$define"
12154                 d_strerrm='strerror(e)'
12155                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
12156                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
12157                                 d_syserrlst="$define"
12158                 else
12159                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
12160                         d_syserrlst="$undef"
12161                 fi
12162     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
12163                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
12164                 d_strerror="$undef"
12165                 d_syserrlst="$define"
12166                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
12167     else
12168                 echo 'strerror() and sys_errlist[] NOT found.' >&4
12169                 d_strerror="$undef"
12170                 d_syserrlst="$undef"
12171                 d_strerrm='"unknown"'
12172     fi
12173 fi
12174
12175 : see if strtod exists
12176 set strtod d_strtod
12177 eval $inlibc
12178
12179 : see if strtol exists
12180 set strtol d_strtol
12181 eval $inlibc
12182
12183 : see if strtold exists
12184 set strtold d_strtold
12185 eval $inlibc
12186
12187 : see if strtoll exists
12188 set strtoll d_strtoll
12189 eval $inlibc
12190
12191 case "$d_longlong-$d_strtoll" in
12192 "$define-$define")
12193         $cat <<EOM
12194 Checking whether your strtoll() works okay...
12195 EOM
12196         $cat >try.c <<'EOCP'
12197 #include <errno.h>
12198 #ifdef __hpux
12199 #define strtoll __strtoll
12200 #endif
12201 #ifdef __EMX__
12202 #define strtoll _strtoll
12203 #endif
12204 #include <stdio.h>
12205 extern long long int strtoll(char *s, char **, int); 
12206 static int bad = 0;
12207 int check(char *s, long long ell, int een) {
12208         long long gll;
12209         errno = 0;
12210         gll = strtoll(s, 0, 10);
12211         if (!((gll == ell) && (errno == een)))
12212                 bad++;
12213 }
12214 int main() {
12215         check(" 1",                                      1LL, 0);
12216         check(" 0",                                      0LL, 0);
12217         check("-1",                                     -1LL, 0);
12218         check("-9223372036854775808", -9223372036854775808LL, 0);
12219         check("-9223372036854775808", -9223372036854775808LL, 0);
12220         check(" 9223372036854775807",  9223372036854775807LL, 0);
12221         check("-9223372036854775808", -9223372036854775808LL, 0);
12222         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
12223         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
12224         if (!bad)
12225                 printf("ok\n");
12226 }
12227 EOCP
12228         set try
12229         if eval $compile; then
12230                 yyy=`./try`
12231                 case "$yyy" in
12232                 ok) echo "Your strtoll() seems to be working okay." ;;
12233                 *) cat <<EOM >&4
12234 Your strtoll() doesn't seem to be working okay.
12235 EOM
12236                    d_strtoll="$undef"
12237                    ;;
12238                 esac
12239         else
12240                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12241                 d_strtoll="$undef"
12242         fi
12243         ;;
12244 esac
12245
12246 : see if strtoq exists
12247 set strtoq d_strtoq
12248 eval $inlibc
12249
12250 : see if strtoul exists
12251 set strtoul d_strtoul
12252 eval $inlibc
12253
12254 case "$d_strtoul" in
12255 "$define")
12256         $cat <<EOM
12257 Checking whether your strtoul() works okay...
12258 EOM
12259         $cat >try.c <<'EOCP'
12260 #include <errno.h>
12261 #include <stdio.h>
12262 extern unsigned long int strtoul(char *s, char **, int); 
12263 static int bad = 0;
12264 void check(char *s, unsigned long eul, int een) {
12265         unsigned long gul;
12266         errno = 0;
12267         gul = strtoul(s, 0, 10);
12268         if (!((gul == eul) && (errno == een)))
12269                 bad++;
12270 }
12271 int main() {
12272         check(" 1", 1L, 0);
12273         check(" 0", 0L, 0);
12274 EOCP
12275         case "$longsize" in
12276         8)
12277             $cat >>try.c <<'EOCP'
12278         check("18446744073709551615", 18446744073709551615UL, 0);
12279         check("18446744073709551616", 18446744073709551615UL, ERANGE);
12280 #if 0 /* strtoul() for /^-/ strings is undefined. */
12281         check("-1", 18446744073709551615UL, 0);
12282         check("-18446744073709551614", 2, 0);
12283         check("-18446744073709551615", 1, 0);
12284         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
12285         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
12286 #endif
12287 EOCP
12288                 ;;
12289         4)
12290                     $cat >>try.c <<'EOCP'
12291         check("4294967295", 4294967295UL, 0);
12292         check("4294967296", 4294967295UL, ERANGE);
12293 #if 0 /* strtoul() for /^-/ strings is undefined. */
12294         check("-1", 4294967295UL, 0);
12295         check("-4294967294", 2, 0);
12296         check("-4294967295", 1, 0);
12297         check("-4294967296", 4294967295UL, ERANGE);
12298         check("-4294967297", 4294967295UL, ERANGE);
12299 #endif
12300 EOCP
12301                 ;;
12302         *)
12303 : Should we write these tests to be more portable by sprintf-ing
12304 : ~0 and then manipulating that char string as input for strtol?
12305                 ;;
12306         esac
12307         $cat >>try.c <<'EOCP'
12308         if (!bad)
12309                 printf("ok\n");
12310         return 0;
12311 }
12312 EOCP
12313         set try
12314         if eval $compile; then
12315                 case "`./try`" in
12316                 ok) echo "Your strtoul() seems to be working okay." ;;
12317                 *) cat <<EOM >&4
12318 Your strtoul() doesn't seem to be working okay.
12319 EOM
12320                    d_strtoul="$undef"
12321                    ;;
12322                 esac
12323         fi
12324         ;;
12325 esac
12326
12327 : see if strtoull exists
12328 set strtoull d_strtoull
12329 eval $inlibc
12330
12331 case "$d_longlong-$d_strtoull" in
12332 "$define-$define")
12333         $cat <<EOM
12334 Checking whether your strtoull() works okay...
12335 EOM
12336         $cat >try.c <<'EOCP'
12337 #include <errno.h>
12338 #ifdef __hpux
12339 #define strtoull __strtoull
12340 #endif
12341 #include <stdio.h>
12342 extern unsigned long long int strtoull(char *s, char **, int); 
12343 static int bad = 0;
12344 int check(char *s, long long eull, int een) {
12345         long long gull;
12346         errno = 0;
12347         gull = strtoull(s, 0, 10);
12348         if (!((gull == eull) && (errno == een)))
12349                 bad++;
12350 }
12351 int main() {
12352         check(" 1",                                        1LL, 0);
12353         check(" 0",                                        0LL, 0);
12354         check("18446744073709551615",  18446744073709551615ULL, 0);
12355         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12356 #if 0 /* strtoull() for /^-/ strings is undefined. */
12357         check("-1",                    18446744073709551615ULL, 0);
12358         check("-18446744073709551614",                     2LL, 0);
12359         check("-18446744073709551615",                     1LL, 0);
12360         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12361         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12362 #endif
12363         if (!bad)
12364                 printf("ok\n");
12365 }
12366 EOCP
12367         set try
12368         if eval $compile; then
12369                 case "`./try`" in
12370                 ok) echo "Your strtoull() seems to be working okay." ;;
12371                 *) cat <<EOM >&4
12372 Your strtoull() doesn't seem to be working okay.
12373 EOM
12374                    d_strtoull="$undef"
12375                    ;;
12376                 esac
12377         fi
12378         ;;
12379 esac
12380
12381 : see if strtouq exists
12382 set strtouq d_strtouq
12383 eval $inlibc
12384
12385 case "$d_strtouq" in
12386 "$define")
12387         $cat <<EOM
12388 Checking whether your strtouq() works okay...
12389 EOM
12390         $cat >try.c <<'EOCP'
12391 #include <errno.h>
12392 #include <stdio.h>
12393 extern unsigned long long int strtouq(char *s, char **, int); 
12394 static int bad = 0;
12395 void check(char *s, unsigned long long eull, int een) {
12396         unsigned long long gull;
12397         errno = 0;
12398         gull = strtouq(s, 0, 10);
12399         if (!((gull == eull) && (errno == een)))
12400                 bad++;
12401 }
12402 int main() {
12403         check(" 1",                                        1LL, 0);
12404         check(" 0",                                        0LL, 0);
12405         check("18446744073709551615",  18446744073709551615ULL, 0);
12406         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
12407 #if 0 /* strtouq() for /^-/ strings is undefined. */
12408         check("-1",                    18446744073709551615ULL, 0);
12409         check("-18446744073709551614",                     2LL, 0);
12410         check("-18446744073709551615",                     1LL, 0);
12411         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
12412         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
12413 #endif
12414         if (!bad)
12415                 printf("ok\n");
12416         return 0;
12417 }
12418 EOCP
12419         set try
12420         if eval $compile; then
12421                 case "`./try`" in
12422                 ok) echo "Your strtouq() seems to be working okay." ;;
12423                 *) cat <<EOM >&4
12424 Your strtouq() doesn't seem to be working okay.
12425 EOM
12426                    d_strtouq="$undef"
12427                    ;;
12428                 esac
12429         fi
12430         ;;
12431 esac
12432
12433 : see if strxfrm exists
12434 set strxfrm d_strxfrm
12435 eval $inlibc
12436
12437 : see if symlink exists
12438 set symlink d_symlink
12439 eval $inlibc
12440
12441 : see if syscall exists
12442 set syscall d_syscall
12443 eval $inlibc
12444
12445 : see if sysconf exists
12446 set sysconf d_sysconf
12447 eval $inlibc
12448
12449 : see if system exists
12450 set system d_system
12451 eval $inlibc
12452
12453 : see if tcgetpgrp exists
12454 set tcgetpgrp d_tcgetpgrp
12455 eval $inlibc
12456
12457 : see if tcsetpgrp exists
12458 set tcsetpgrp d_tcsetpgrp
12459 eval $inlibc
12460
12461 : see if prototype for telldir is available
12462 echo " "
12463 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
12464 eval $hasproto
12465
12466 : see if this is a sys/times.h system
12467 set sys/times.h i_systimes
12468 eval $inhdr
12469
12470 : see if times exists
12471 echo " "
12472 if set times val -f d_times; eval $csym; $val; then
12473         echo 'times() found.' >&4
12474         d_times="$define"
12475         inc=''
12476         case "$i_systimes" in
12477         "$define") inc='sys/times.h';;
12478         esac
12479         rp="What is the type returned by times() on this system?"
12480         set clock_t clocktype long stdio.h sys/types.h $inc
12481         eval $typedef_ask
12482 else
12483         echo 'times() NOT found, hope that will do.' >&4
12484         d_times="$undef"
12485         clocktype='int'
12486 fi
12487
12488 : see if truncate exists
12489 set truncate d_truncate
12490 eval $inlibc
12491
12492 : see if tzname[] exists
12493 echo " "
12494 if set tzname val -a d_tzname; eval $csym; $val; then
12495         val="$define"
12496         echo 'tzname[] found.' >&4
12497 else
12498         val="$undef"
12499         echo 'tzname[] NOT found.' >&4
12500 fi
12501 set d_tzname
12502 eval $setvar
12503
12504 : see if umask exists
12505 set umask d_umask
12506 eval $inlibc
12507
12508 : see if ustat exists
12509 set ustat d_ustat
12510 eval $inlibc
12511
12512 : backward compatibility for d_hvfork
12513 if test X$d_hvfork != X; then
12514         d_vfork="$d_hvfork"
12515         d_hvfork=''
12516 fi
12517 : see if there is a vfork
12518 val=''
12519 set vfork val
12520 eval $inlibc
12521
12522 : Ok, but do we want to use it. vfork is reportedly unreliable in 
12523 : perl on Solaris 2.x, and probably elsewhere.
12524 case "$val" in
12525 $define)
12526         echo " "
12527         case "$usevfork" in
12528         false) dflt='n';;
12529         *) dflt='y';;
12530         esac
12531         cat <<'EOM'
12532  
12533 Perl can only use a vfork() that doesn't suffer from strict
12534 restrictions on calling functions or modifying global data in
12535 the child.  For example, glibc-2.1 contains such a vfork()
12536 that is unsuitable.  If your system provides a proper fork()
12537 call, chances are that you do NOT want perl to use vfork().
12538
12539 EOM
12540         rp="Do you still want to use vfork()?"
12541         . ./myread
12542         case "$ans" in
12543         y|Y) ;;
12544         *)
12545                 echo "Ok, we won't use vfork()."
12546                 val="$undef"
12547                 ;;
12548         esac
12549         ;;
12550 esac
12551 set d_vfork
12552 eval $setvar
12553 case "$d_vfork" in
12554 $define) usevfork='true';;
12555 *) usevfork='false';;
12556 esac
12557
12558 : see if this is an sysdir system
12559 set sys/dir.h i_sysdir
12560 eval $inhdr
12561
12562 : see if this is an sysndir system
12563 set sys/ndir.h i_sysndir
12564 eval $inhdr
12565
12566 : see if closedir exists
12567 set closedir d_closedir
12568 eval $inlibc
12569
12570 case "$d_closedir" in
12571 "$define")
12572         echo " "
12573         echo "Checking whether closedir() returns a status..." >&4
12574         cat > closedir.c <<EOM
12575 #$i_dirent I_DIRENT             /**/
12576 #$i_sysdir I_SYS_DIR            /**/
12577 #$i_sysndir I_SYS_NDIR          /**/
12578 #$i_systypes I_SYS_TYPES        /**/
12579
12580 #if defined(I_SYS_TYPES)
12581 #include <sys/types.h>
12582 #endif
12583 #if defined(I_DIRENT)
12584 #include <dirent.h>
12585 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12586 #include <sys/dir.h>
12587 #endif
12588 #else
12589 #ifdef I_SYS_NDIR
12590 #include <sys/ndir.h>
12591 #else
12592 #ifdef I_SYS_DIR
12593 #ifdef hp9000s500
12594 #include <ndir.h>       /* may be wrong in the future */
12595 #else
12596 #include <sys/dir.h>
12597 #endif
12598 #endif
12599 #endif
12600 #endif 
12601 int main() { return closedir(opendir(".")); }
12602 EOM
12603         set closedir
12604         if eval $compile_ok; then
12605                 if ./closedir > /dev/null 2>&1 ; then
12606                         echo "Yes, it does."
12607                         val="$undef"
12608                 else
12609                         echo "No, it doesn't."
12610                         val="$define"
12611                 fi
12612         else
12613                 echo "(I can't seem to compile the test program--assuming it doesn't)"
12614                 val="$define"
12615         fi
12616         ;;
12617 *)
12618         val="$undef";
12619         ;;
12620 esac
12621 set d_void_closedir
12622 eval $setvar
12623 $rm -f closedir*
12624 : see if there is a wait4
12625 set wait4 d_wait4
12626 eval $inlibc
12627
12628 : see if waitpid exists
12629 set waitpid d_waitpid
12630 eval $inlibc
12631
12632 : see if wcstombs exists
12633 set wcstombs d_wcstombs
12634 eval $inlibc
12635
12636 : see if wctomb exists
12637 set wctomb d_wctomb
12638 eval $inlibc
12639
12640 : preserve RCS keywords in files with variable substitution, grrr
12641 Date='$Date'
12642 Id='$Id'
12643 Log='$Log'
12644 RCSfile='$RCSfile'
12645 Revision='$Revision'
12646
12647 case "$crosscompile" in
12648 ''|[nN]*) crosscompile="$undef" ;;
12649 esac
12650
12651 case "$osname" in
12652 next|rhapsody|darwin) multiarch="$define" ;;
12653 esac
12654 case "$multiarch" in
12655 ''|[nN]*) multiarch="$undef" ;;
12656 esac
12657
12658 : check for alignment requirements
12659 echo " "
12660 case "$crosscompile$multiarch" in
12661 *$define*)
12662         $cat <<EOM
12663 You seem to be either cross-compiling or doing a multiarchitecture build,
12664 skipping the memory alignment check.
12665
12666 EOM
12667         case "$alignbytes" in
12668         '') alignbytes=8 ;;
12669         esac
12670         ;;
12671 *)
12672         case "$alignbytes" in
12673         '') echo "Checking alignment constraints..." >&4
12674                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
12675                         $cat >try.c <<'EOCP'
12676 typedef long double NV;
12677 EOCP
12678                 else
12679                         $cat >try.c <<'EOCP'
12680 typedef double NV;
12681 EOCP
12682                 fi
12683                 $cat >>try.c <<'EOCP'
12684 #include <stdio.h>
12685 struct foobar {
12686         char foo;
12687         NV bar;
12688 } try_algn;
12689 int main()
12690 {
12691     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
12692     return(0);
12693 }
12694 EOCP
12695                 set try
12696                 if eval $compile_ok; then
12697                         dflt=`./try`
12698                 else
12699                         dflt='8'
12700                         echo "(I can't seem to compile the test program...)"
12701                 fi
12702                 ;;
12703         *) dflt="$alignbytes"
12704                 ;;
12705         esac
12706         rp="Doubles must be aligned on a how-many-byte boundary?"
12707         . ./myread
12708         alignbytes="$ans"
12709         $rm -f try.c try
12710         ;;
12711 esac
12712
12713
12714 : set the base revision
12715 baserev=5.0
12716
12717 : check for ordering of bytes in a long
12718 echo " "
12719 case "$crosscompile$multiarch" in
12720 *$define*)
12721         $cat <<EOM
12722 You seem to be either cross-compiling or doing a multiarchitecture build,
12723 skipping the byteorder check.
12724
12725 EOM
12726         byteorder='0xffff'
12727         ;;
12728 *)
12729         case "$byteorder" in
12730         '')
12731                 $cat <<'EOM'
12732 In the following, larger digits indicate more significance.  A big-endian
12733 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
12734 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
12735 machines may have weird orders like 3412.  A Cray will report 87654321,
12736 an Alpha will report 12345678. If the test program works the default is
12737 probably right.
12738 I'm now running the test program...
12739 EOM
12740                 $cat >try.c <<'EOCP'
12741 #include <stdio.h>
12742 int main()
12743 {
12744         int i;
12745         union {
12746                 unsigned long l;
12747                 char c[sizeof(long)];
12748         } u;
12749
12750         if (sizeof(long) > 4)
12751                 u.l = (0x08070605L << 32) | 0x04030201L;
12752         else
12753                 u.l = 0x04030201L;
12754         for (i = 0; i < sizeof(long); i++)
12755                 printf("%c", u.c[i]+'0');
12756         printf("\n");
12757         exit(0);
12758 }
12759 EOCP
12760                 xxx_prompt=y
12761                 set try
12762                 if eval $compile && ./try > /dev/null; then
12763                         dflt=`./try`
12764                         case "$dflt" in
12765                         [1-4][1-4][1-4][1-4]|12345678|87654321)
12766                                 echo "(The test program ran ok.)"
12767                                 echo "byteorder=$dflt"
12768                                 xxx_prompt=n
12769                         ;;
12770                         ????|????????) echo "(The test program ran ok.)" ;;
12771                         *) echo "(The test program didn't run right for some reason.)" ;;
12772                         esac
12773                 else
12774                         dflt='4321'
12775                         cat <<'EOM'
12776 (I can't seem to compile the test program.  Guessing big-endian...)
12777 EOM
12778                 fi
12779                 case "$xxx_prompt" in
12780                 y)
12781                         rp="What is the order of bytes in a long?"
12782                         . ./myread
12783                         byteorder="$ans"
12784                         ;;
12785                 *)      byteorder=$dflt
12786                         ;;
12787                 esac
12788                 ;;
12789         esac
12790         $rm -f try.c try
12791         ;;
12792 esac
12793
12794
12795 : how do we catenate cpp tokens here?
12796 echo " "
12797 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
12798 $cat >cpp_stuff.c <<'EOCP'
12799 #define RCAT(a,b)a/**/b
12800 #define ACAT(a,b)a ## b
12801 RCAT(Rei,ser)
12802 ACAT(Cir,cus)
12803 EOCP
12804 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
12805 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
12806         echo "Oh!  Smells like ANSI's been here." >&4
12807         echo "We can catify or stringify, separately or together!"
12808         cpp_stuff=42
12809 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
12810         echo "Ah, yes!  The good old days!" >&4
12811         echo "However, in the good old days we don't know how to stringify and"
12812         echo "catify at the same time."
12813         cpp_stuff=1
12814 else
12815         $cat >&4 <<EOM
12816 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
12817 to have to edit the values of CAT[2-5] in config.h...
12818 EOM
12819         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
12820 fi
12821 $rm -f cpp_stuff.*
12822
12823 : see if this is a db.h system
12824 set db.h i_db
12825 eval $inhdr
12826
12827 case "$i_db" in
12828 $define)
12829         : Check db version.
12830         echo " "
12831         echo "Checking Berkeley DB version ..." >&4
12832         $cat >try.c <<EOCP
12833 #$d_const HASCONST
12834 #ifndef HASCONST
12835 #define const
12836 #endif
12837 #include <sys/types.h>
12838 #include <stdio.h>
12839 #include <db.h>
12840 int main()
12841 {
12842 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
12843     int Major, Minor, Patch ;
12844     unsigned long Version ;
12845     (void)db_version(&Major, &Minor, &Patch) ;
12846     printf("You have Berkeley DB Version 2 or greater\n");
12847
12848     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
12849                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
12850     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
12851                 Major, Minor, Patch) ;
12852
12853     /* check that db.h & libdb are compatible */
12854     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
12855         printf("db.h and libdb are incompatible\n") ;
12856         exit(3);        
12857     }
12858
12859     printf("db.h and libdb are compatible\n") ;
12860
12861     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
12862                 + DB_VERSION_PATCH ;
12863
12864     /* needs to be >= 2.3.4 */
12865     if (Version < 2003004) {
12866     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
12867         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
12868         exit(2);        
12869     }
12870
12871     exit(0);
12872 #else
12873 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
12874     printf("You have Berkeley DB Version 1\n");
12875     exit(0);    /* DB version < 2: the coast is clear. */
12876 #else
12877     exit(1);    /* <db.h> not Berkeley DB? */
12878 #endif
12879 #endif
12880 }
12881 EOCP
12882         set try
12883         if eval $compile_ok && ./try; then
12884                 echo 'Looks OK.' >&4
12885         else
12886                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
12887                 i_db=$undef
12888                 case " $libs " in
12889                 *"-ldb "*)
12890                         : Remove db from list of libraries to use
12891                         echo "Removing unusable -ldb from library list" >&4
12892                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
12893                         shift
12894                         libs="$*"
12895                         echo "libs = $libs" >&4
12896                         ;;
12897                 esac
12898         fi
12899         $rm -f try.*
12900         ;;
12901 esac
12902
12903 case "$i_db" in
12904 define)
12905         : Check the return type needed for hash 
12906         echo " "
12907         echo "Checking return type needed for hash for Berkeley DB ..." >&4
12908         $cat >try.c <<EOCP
12909 #$d_const HASCONST
12910 #ifndef HASCONST
12911 #define const
12912 #endif
12913 #include <sys/types.h>
12914 #include <db.h>
12915
12916 #ifndef DB_VERSION_MAJOR
12917 u_int32_t hash_cb (ptr, size)
12918 const void *ptr;
12919 size_t size;
12920 {
12921 }
12922 HASHINFO info;
12923 int main()
12924 {
12925         info.hash = hash_cb;
12926 }
12927 #endif
12928 EOCP
12929         if $cc $ccflags -c try.c >try.out 2>&1 ; then
12930                 if $contains warning try.out >>/dev/null 2>&1 ; then
12931                         db_hashtype='int'
12932                 else
12933                         db_hashtype='u_int32_t'
12934                 fi
12935         else
12936                 : XXX Maybe we should just give up here.
12937                 db_hashtype=u_int32_t
12938                 $cat try.out >&4
12939                 echo "Help:  I can't seem to compile the db test program." >&4
12940                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
12941         fi
12942         $rm -f try.*
12943         echo "Your version of Berkeley DB uses $db_hashtype for hash."
12944         ;;
12945 *)      db_hashtype=u_int32_t
12946         ;;
12947 esac
12948 case "$i_db" in
12949 define)
12950         : Check the return type needed for prefix 
12951         echo " "
12952         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
12953         cat >try.c <<EOCP
12954 #$d_const HASCONST
12955 #ifndef HASCONST
12956 #define const
12957 #endif
12958 #include <sys/types.h>
12959 #include <db.h>
12960
12961 #ifndef DB_VERSION_MAJOR
12962 size_t prefix_cb (key1, key2)
12963 const DBT *key1;
12964 const DBT *key2;
12965 {
12966 }
12967 BTREEINFO info;
12968 int main()
12969 {
12970         info.prefix = prefix_cb;
12971 }
12972 #endif
12973 EOCP
12974         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
12975                 if $contains warning try.out >>/dev/null 2>&1 ; then
12976                         db_prefixtype='int'
12977                 else
12978                         db_prefixtype='size_t'
12979                 fi
12980         else
12981                 db_prefixtype='size_t'
12982                 : XXX Maybe we should just give up here.
12983                 $cat try.out >&4
12984                 echo "Help:  I can't seem to compile the db test program." >&4
12985                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
12986         fi
12987         $rm -f try.*
12988         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
12989         ;;
12990 *)      db_prefixtype='size_t'
12991         ;;
12992 esac
12993
12994
12995 : How can we generate normalized random numbers ?
12996 echo " "
12997 echo "Looking for a random number function..." >&4
12998 case "$randfunc" in
12999 '')
13000         if set drand48 val -f; eval $csym; $val; then
13001                 dflt="drand48"
13002                 echo "Good, found drand48()." >&4
13003         elif set random val -f; eval $csym; $val; then
13004                 dflt="random"
13005                 echo "OK, found random()." >&4
13006         else
13007                 dflt="rand"
13008                 echo "Yick, looks like I have to use rand()." >&4
13009         fi
13010         echo " "
13011         ;;
13012 *)
13013         dflt="$randfunc"
13014         ;;
13015 esac
13016 cont=true
13017
13018 case "$ccflags" in
13019 *-Dmy_rand=*|*-Dmy_srand=*)
13020         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
13021         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
13022         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
13023         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
13024         ;;
13025 esac
13026
13027 while $test "$cont"; do
13028         rp="Use which function to generate random numbers?"
13029         . ./myread
13030         if $test "$ans" = "$dflt"; then
13031                 : null
13032         else
13033                 randbits=''
13034         fi
13035         randfunc="$ans"
13036         if set $ans val -f; eval $csym; $val; then
13037                 cont=''
13038         else
13039                 dflt=y
13040                 rp="I cannot find function $ans. Use that name anyway?"
13041                 . ./myread
13042                 dflt=rand
13043                 case "$ans" in
13044                         [yY]*) cont='';;
13045                 esac
13046         fi
13047         case "$cont" in
13048         '')
13049                 case "$randfunc" in
13050                 drand48)
13051                         drand01="drand48()"
13052                         seedfunc="srand48"
13053                         randbits=48
13054                         randseedtype=long
13055                         ;;
13056                 rand|random)
13057                         case "$randbits" in
13058                         '')
13059 echo "Checking to see how many bits your $randfunc() function produces..." >&4
13060                                 $cat >try.c <<EOCP
13061 #$i_unistd I_UNISTD
13062 #$i_stdlib I_STDLIB
13063 #include <stdio.h>
13064 #ifdef I_UNISTD
13065 #  include <unistd.h>
13066 #endif
13067 #ifdef I_STDLIB
13068 #  include <stdlib.h>
13069 #endif
13070 int main()
13071 {
13072         register int i;
13073         register unsigned long tmp;
13074         register unsigned long max = 0L;
13075
13076         for (i = 1000; i; i--) {
13077                 tmp = (unsigned long) $randfunc();
13078                 if (tmp > max) max = tmp;
13079         }
13080         for (i = 0; max; i++)
13081                 max /= 2;
13082         printf("%d\n",i);
13083 }
13084 EOCP
13085                                 set try
13086                                 if eval $compile_ok; then
13087                                         dflt=`try`
13088                                 else
13089                                         dflt='?'
13090                                         echo "(I can't seem to compile the test program...)"
13091                                 fi
13092                                 ;;
13093                         *)
13094                                 dflt="$randbits"
13095                                 ;;
13096                         esac
13097                         rp="How many bits does your $randfunc() function produce?"
13098                         . ./myread
13099                         randbits="$ans"
13100                         $rm -f try.c try
13101                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13102                         seedfunc="s$randfunc"
13103                         randseedtype=unsigned
13104                         ;;
13105                 *)
13106                         dflt="31"
13107                         rp="How many bits does your $randfunc() function produce?"
13108                         . ./myread
13109                         randbits="$ans"
13110                         seedfunc="s$randfunc"
13111                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
13112                         if set $seedfunc val -f; eval $csym; $val; then
13113                                 echo "(Using $seedfunc() to seed random generator)"
13114                         else
13115                                 echo "(Warning: no $seedfunc() to seed random generator)"
13116                                 seedfunc=rand
13117                         fi
13118                         randseedtype=unsigned
13119                         ;;
13120                 esac
13121                 ;;
13122         esac
13123 done
13124
13125 echo " "
13126 echo "Determining whether or not we are on an EBCDIC system..." >&4
13127 $cat >tebcdic.c <<'EOM'
13128 int main()
13129 {
13130   if ('M'==0xd4) return 0;
13131   return 1;
13132 }
13133 EOM
13134
13135 val=$undef
13136 set tebcdic
13137 if eval $compile_ok; then
13138         if ./tebcdic; then
13139                 echo "You seem to speak EBCDIC." >&4
13140                 val="$define"
13141         else
13142                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF8." >&4
13143         fi
13144 else
13145         echo "I'm unable to compile the test program." >&4
13146         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
13147 fi
13148 $rm -f tebcdic.c tebcdic
13149 set ebcdic
13150 eval $setvar
13151
13152 echo " "
13153 $cat >&4 <<EOM
13154 Checking how to flush all pending stdio output...
13155 EOM
13156 # I only know how to find the first 32 possibly open files on SunOS.
13157 # See also hints/sunos_4_1.sh and util.c  --AD
13158 case "$osname" in
13159 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
13160 esac
13161 $cat >>try.c <<EOCP
13162 #include <stdio.h>
13163 #$i_unistd I_UNISTD
13164 #ifdef I_UNISTD
13165 # include <unistd.h>
13166 #endif
13167 #$d_sysconf HAS_SYSCONF
13168 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
13169 #ifdef HAS_STDIO_STREAM_ARRAY
13170 # define STDIO_STREAM_ARRAY $stdio_stream_array
13171 #endif
13172 int main() {
13173   FILE* p = fopen("try.out", "w");
13174 #ifdef TRY_FPUTC
13175   fputc('x', p);
13176 #else
13177 # ifdef TRY_FPRINTF
13178   fprintf(p, "x");
13179 # endif
13180 #endif
13181 #ifdef TRY_FFLUSH_NULL
13182   fflush(NULL);
13183 #endif
13184 #ifdef TRY_FFLUSH_ALL
13185   {
13186     long open_max = -1;
13187 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
13188     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
13189 # else
13190 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
13191     open_max = sysconf(_SC_OPEN_MAX);
13192 #  else
13193 #   ifdef FOPEN_MAX
13194     open_max = FOPEN_MAX;
13195 #   else
13196 #    ifdef OPEN_MAX
13197     open_max = OPEN_MAX;
13198 #    else
13199 #     ifdef _NFILE
13200     open_max = _NFILE;
13201 #     endif
13202 #    endif
13203 #   endif
13204 #  endif
13205 # endif 
13206 # ifdef HAS_STDIO_STREAM_ARRAY
13207     if (open_max > 0) {
13208       long i;
13209       for (i = 0; i < open_max; i++)
13210             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
13211                 STDIO_STREAM_ARRAY[i]._file < open_max &&
13212                 STDIO_STREAM_ARRAY[i]._flag)
13213                 fflush(&STDIO_STREAM_ARRAY[i]);
13214     }   
13215   }
13216 # endif
13217 #endif
13218   _exit(42);
13219 }
13220 EOCP
13221 : first we have to find out how _not_ to flush
13222 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
13223     output=''
13224     set try -DTRY_FPUTC
13225     if eval $compile; then
13226             $rm -f try.out
13227             ./try$exe_ext 2>/dev/null
13228             if $test ! -s try.out -a "X$?" = X42; then
13229                 output=-DTRY_FPUTC
13230             fi
13231     fi
13232     case "$output" in
13233     '')
13234             set try -DTRY_FPRINTF
13235             $rm -f try.out
13236             if eval $compile; then
13237                     $rm -f try.out
13238                     ./try$exe_ext 2>/dev/null
13239                     if $test ! -s try.out -a "X$?" = X42; then
13240                         output=-DTRY_FPRINTF
13241                     fi
13242             fi
13243         ;;
13244     esac
13245 fi
13246 : check for fflush NULL behaviour
13247 case "$fflushNULL" in
13248 '')     set try -DTRY_FFLUSH_NULL $output
13249         if eval $compile; then
13250                 $rm -f try.out
13251                 ./try$exe_ext 2>/dev/null
13252                 code="$?"
13253                 if $test -s try.out -a "X$code" = X42; then
13254                         fflushNULL="`$cat try.out`"
13255                 else
13256                         if $test "X$code" != X42; then
13257                                 $cat >&4 <<EOM
13258 (If this test failed, don't worry, we'll try another method shortly.)
13259 EOM
13260                         fi
13261                 fi
13262         fi
13263         $rm -f core try.core core.try.*
13264         case "$fflushNULL" in
13265         x)      $cat >&4 <<EOM
13266 Your fflush(NULL) works okay for output streams.
13267 Let's see if it clobbers input pipes...
13268 EOM
13269 # As of mid-March 2000 all versions of Solaris appear to have a stdio
13270 # bug that improperly flushes the input end of pipes.  So we avoid the
13271 # autoflush on fork/system/exec support for now. :-(
13272 $cat >tryp.c <<EOCP
13273 #include <stdio.h>
13274 int
13275 main(int argc, char **argv)
13276 {
13277     char buf[1024];
13278     int i;
13279     char *bp = buf;
13280     while (1) {
13281         while ((i = getc(stdin)) != -1
13282                && (*bp++ = i) != '\n'
13283                && bp < &buf[1024])
13284         /* DO NOTHING */ ;
13285         *bp = '\0';
13286         fprintf(stdout, "%s", buf);
13287         fflush(NULL);
13288         if (i == -1)
13289             return 0;
13290         bp = buf;
13291     }
13292 }
13293 EOCP
13294                 fflushNULL="$define"
13295                 set tryp
13296                 if eval $compile; then
13297                     $rm -f tryp.out
13298                     $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13299                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
13300                        $cat >&4 <<EOM
13301 fflush(NULL) seems to behave okay with input streams.
13302 EOM
13303                         fflushNULL="$define"
13304                     else
13305                         $cat >&4 <<EOM
13306 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
13307 EOM
13308                         fflushNULL="$undef"
13309                     fi
13310                 fi
13311                 $rm -f core tryp.c tryp.core core.tryp.*
13312                 ;;
13313         '')     $cat >&4 <<EOM
13314 Your fflush(NULL) isn't working (contrary to ANSI C).
13315 EOM
13316                 fflushNULL="$undef"
13317                 ;;
13318         *)      $cat >&4 <<EOM
13319 Cannot figure out whether your fflush(NULL) works or not.
13320 I'm assuming it doesn't (contrary to ANSI C).
13321 EOM
13322                 fflushNULL="$undef"
13323                 ;;
13324         esac
13325         ;;
13326 $define|true|[yY]*)
13327         fflushNULL="$define"
13328         ;;
13329 *)
13330         fflushNULL="$undef"
13331         ;;
13332 esac
13333 : check explicit looping only if NULL did not work, and if the pipe
13334 : bug does not show up on an explicit flush too
13335 case "$fflushNULL" in
13336 "$undef")
13337         $cat >tryp.c <<EOCP
13338 #include <stdio.h>
13339 int
13340 main(int argc, char **argv)
13341 {
13342     char buf[1024];
13343     int i;
13344     char *bp = buf;
13345     while (1) {
13346         while ((i = getc(stdin)) != -1
13347                && (*bp++ = i) != '\n'
13348                && bp < &buf[1024])
13349         /* DO NOTHING */ ;
13350         *bp = '\0';
13351         fprintf(stdout, "%s", buf);
13352         fflush(stdin);
13353         if (i == -1)
13354             return 0;
13355         bp = buf;
13356     }
13357 }
13358 EOCP
13359         set tryp
13360         if eval $compile; then
13361             $rm -f tryp.out
13362             $cat tryp.c | ./tryp$exe_ext 2>/dev/null > tryp.out
13363             if cmp tryp.c tryp.out >/dev/null 2>&1; then
13364                $cat >&4 <<EOM
13365 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
13366 EOM
13367                 : now check for fflushall behaviour
13368                 case "$fflushall" in
13369                 '')     set try -DTRY_FFLUSH_ALL $output
13370                         if eval $compile; then
13371                                 $cat >&4 <<EOM
13372 (Now testing the other method--but note that this also may fail.)
13373 EOM
13374                                 $rm -f try.out
13375                                 ./try$exe_ext 2>/dev/null
13376                                 if $test -s try.out -a "X$?" = X42; then
13377                                         fflushall="`$cat try.out`"
13378                                 fi
13379                         fi
13380                         $rm -f core try.core core.try.*
13381                         case "$fflushall" in
13382                         x)      $cat >&4 <<EOM
13383 Whew. Flushing explicitly all the stdio streams works.
13384 EOM
13385                                 fflushall="$define"
13386                                 ;;
13387                         '')     $cat >&4 <<EOM
13388 Sigh. Flushing explicitly all the stdio streams doesn't work.
13389 EOM
13390                                 fflushall="$undef"
13391                                 ;;
13392                         *)      $cat >&4 <<EOM
13393 Cannot figure out whether flushing stdio streams explicitly works or not.
13394 I'm assuming it doesn't.
13395 EOM
13396                                 fflushall="$undef"
13397                                 ;;
13398                         esac
13399                         ;;
13400                 "$define"|true|[yY]*)
13401                         fflushall="$define"
13402                         ;;
13403                 *)
13404                         fflushall="$undef"
13405                         ;;
13406                 esac
13407             else
13408                 $cat >&4 <<EOM
13409 All is futile.  Even fflush(stdin) clobbers input pipes!
13410 EOM
13411                 fflushall="$undef"
13412             fi
13413         else
13414             fflushall="$undef"
13415         fi
13416         $rm -f core tryp.c tryp.core core.tryp.*
13417         ;;
13418 *)      fflushall="$undef"
13419         ;;
13420 esac
13421
13422 case "$fflushNULL$fflushall" in
13423 undefundef)
13424         $cat <<EOM
13425 OK, I give up.  I cannot figure out how to flush pending stdio output.
13426 We won't be flushing handles at all before fork/exec/popen.
13427 EOM
13428         ;;
13429 esac
13430 $rm -f try.* try$exe_ext
13431
13432 : Store the full pathname to the ar program for use in the C program
13433 : Respect a hint or command line value for full_ar.
13434 case "$full_ar" in
13435 '') full_ar=$ar ;;
13436 esac
13437
13438 : Store the full pathname to the sed program for use in the C program
13439 full_sed=$sed
13440
13441 : see what type gids are declared as in the kernel
13442 echo " "
13443 echo "Looking for the type for group ids returned by getgid()."
13444 set gid_t gidtype xxx stdio.h sys/types.h
13445 eval $typedef
13446 case "$gidtype" in
13447 xxx)
13448         xxx=`./findhdr sys/user.h`
13449         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
13450         case $1 in
13451         unsigned) dflt="$1 $2" ;;
13452         *) dflt="$1" ;;
13453         esac
13454         ;;
13455 *) dflt="$gidtype";;
13456 esac
13457 case "$gidtype" in
13458 gid_t) echo "gid_t found." ;;
13459 *)      rp="What is the type for group ids returned by getgid()?"
13460         . ./myread
13461         gidtype="$ans"
13462         ;;
13463 esac
13464
13465 echo " "
13466 case "$gidtype" in
13467 *_t) zzz="$gidtype"     ;;
13468 *)   zzz="gid"          ;;
13469 esac
13470 echo "Checking the size of $zzz..." >&4 
13471 cat > try.c <<EOCP
13472 #include <sys/types.h>
13473 #include <stdio.h>
13474 int main() {
13475     printf("%d\n", (int)sizeof($gidtype));
13476     exit(0);
13477 }
13478 EOCP
13479 set try
13480 if eval $compile_ok; then
13481         yyy=`./try`
13482         case "$yyy" in
13483         '')     gidsize=4
13484                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
13485                 ;;
13486         *)      gidsize=$yyy
13487                 echo "Your $zzz is $gidsize bytes long."
13488                 ;;
13489         esac
13490 else
13491         gidsize=4
13492         echo "(I can't compile the test program--guessing $gidsize.)" >&4
13493 fi
13494
13495
13496 echo " "
13497 case "$gidtype" in
13498 *_t) zzz="$gidtype"     ;;
13499 *)   zzz="gid"          ;;
13500 esac
13501 echo "Checking the sign of $zzz..." >&4 
13502 cat > try.c <<EOCP
13503 #include <sys/types.h>
13504 #include <stdio.h>
13505 int main() {
13506         $gidtype foo = -1;
13507         if (foo < 0)
13508                 printf("-1\n");
13509         else
13510                 printf("1\n");
13511 }
13512 EOCP
13513 set try
13514 if eval $compile; then
13515         yyy=`./try`
13516         case "$yyy" in
13517         '')     gidsign=1
13518                 echo "(I can't execute the test program--guessing unsigned.)" >&4
13519                 ;;
13520         *)      gidsign=$yyy
13521                 case "$gidsign" in
13522                  1) echo "Your $zzz is unsigned." ;;
13523                 -1) echo "Your $zzz is signed."   ;;
13524                 esac
13525                 ;;
13526         esac
13527 else
13528         gidsign=1
13529         echo "(I can't compile the test program--guessing unsigned.)" >&4
13530 fi
13531
13532
13533 echo " "
13534
13535 if $test X"$quadtype" != X; then
13536
13537 echo "Checking how to print 64-bit integers..." >&4
13538
13539 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
13540         $cat >try.c <<'EOCP'
13541 #include <sys/types.h>
13542 #include <stdio.h>
13543 int main() {
13544   int q = 12345678901;
13545   printf("%ld\n", q);
13546 }
13547 EOCP
13548         set try
13549         if eval $compile; then
13550                 yyy=`./try$exe_ext`
13551                 case "$yyy" in
13552                 12345678901)
13553                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
13554                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
13555                         echo "We will use %d."
13556                         ;;
13557                 esac
13558         fi
13559 fi
13560
13561 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
13562         $cat >try.c <<'EOCP'
13563 #include <sys/types.h>
13564 #include <stdio.h>
13565 int main() {
13566   long q = 12345678901;
13567   printf("%ld\n", q);
13568 }
13569 EOCP
13570         set try
13571         if eval $compile; then
13572                 yyy=`./try$exe_ext`
13573                 case "$yyy" in
13574                 12345678901)
13575                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
13576                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
13577                         echo "We will use %ld."
13578                         ;;
13579                 esac
13580         fi
13581 fi
13582
13583 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
13584         $cat >try.c <<'EOCP'
13585 #include <sys/types.h>
13586 #include <inttypes.h>
13587 #include <stdio.h>
13588 int main() {
13589   int64_t q = 12345678901;
13590   printf("%" PRId64 "\n", q);
13591 }
13592 EOCP
13593         set try
13594         if eval $compile; then
13595                 yyy=`./try$exe_ext`
13596                 case "$yyy" in
13597                 12345678901)
13598                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
13599                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
13600                         echo "We will use the C9X style."
13601                         ;;
13602                 esac
13603         fi
13604 fi
13605
13606 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
13607         $cat >try.c <<'EOCP'
13608 #include <sys/types.h>
13609 #include <stdio.h>
13610 int main() {
13611   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
13612   printf("%lld\n", q);
13613 }
13614 EOCP
13615         set try
13616         if eval $compile; then
13617                 yyy=`./try$exe_ext`
13618                 case "$yyy" in
13619                 12345678901)
13620                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
13621                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
13622                         echo "We will use the %lld style."
13623                         ;;
13624                 esac
13625         fi
13626 fi
13627
13628 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13629         $cat >try.c <<EOCP
13630 #include <sys/types.h>
13631 #include <stdio.h>
13632 int main() {
13633   $quadtype q = 12345678901;
13634   printf("%Ld\n", q);
13635 }
13636 EOCP
13637         set try
13638         if eval $compile; then
13639                 yyy=`./try$exe_ext`
13640                 case "$yyy" in
13641                 12345678901)
13642                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
13643                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
13644                         echo "We will use %Ld."
13645                         ;;
13646                 esac
13647         fi
13648 fi
13649
13650 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
13651         $cat >try.c <<EOCP
13652 #include <sys/types.h>
13653 #include <stdio.h>
13654 int main() {
13655   $quadtype q = 12345678901;
13656   printf("%qd\n", q);
13657 }
13658 EOCP
13659         set try
13660         if eval $compile; then
13661                 yyy=`./try$exe_ext`
13662                 case "$yyy" in
13663                 12345678901)
13664                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
13665                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
13666                         echo "We will use %qd."
13667                         ;;
13668                 esac
13669         fi
13670 fi
13671
13672 if $test X"$sPRId64" = X; then
13673         echo "Cannot figure out how to print 64-bit integers." >&4
13674 fi
13675
13676 $rm -f try try.*
13677
13678 fi
13679
13680 case "$sPRId64" in
13681 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
13682         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
13683         ;;
13684 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
13685         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
13686         ;;
13687 esac
13688
13689
13690 echo " "
13691 $echo "Checking the format strings to be used for Perl's internal types..." >&4
13692
13693 if $test X"$ivsize" = X8; then
13694         ivdformat="$sPRId64"
13695         uvuformat="$sPRIu64"
13696         uvoformat="$sPRIo64"
13697         uvxformat="$sPRIx64"
13698         uvXUformat="$sPRIXU64"
13699 else
13700         if $test X"$ivsize" = X"$longsize"; then
13701                 ivdformat='"ld"'
13702                 uvuformat='"lu"'
13703                 uvoformat='"lo"'
13704                 uvxformat='"lx"'
13705                 uvXUformat='"lX"'
13706         else
13707                 if $test X"$ivsize" = X"$intsize"; then
13708                         ivdformat='"d"'
13709                         uvuformat='"u"'
13710                         uvoformat='"o"'
13711                         uvxformat='"x"'
13712                         uvXUformat='"X"'
13713                 else
13714                         : far out
13715                         if $test X"$ivsize" = X"$shortsize"; then
13716                                 ivdformat='"hd"'
13717                                 uvuformat='"hu"'
13718                                 uvoformat='"ho"'
13719                                 uvxformat='"hx"'
13720                                 uvXUformat='"hX"'
13721                         fi
13722                 fi
13723         fi
13724 fi
13725
13726 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
13727         nveformat="$sPRIeldbl"
13728         nvfformat="$sPRIfldbl"
13729         nvgformat="$sPRIgldbl"
13730         nvEUformat="$sPRIEUldbl"
13731         nvFUformat="$sPRIFUldbl"
13732         nvGUformat="$sPRIGUldbl"
13733 else
13734         nveformat='"e"'
13735         nvfformat='"f"'
13736         nvgformat='"g"'
13737         nvEUformat='"E"'
13738         nvFUformat='"F"'
13739         nvGUformat='"G"'
13740 fi
13741
13742 case "$ivdformat" in
13743 '') echo "$0: Fatal: failed to find format strings, cannot continue." >& 4
13744     exit 1
13745     ;;
13746 esac
13747
13748
13749 echo " "
13750 $echo "Checking the format string to be used for gids..." >&4
13751
13752 case "$gidsign" in
13753 -1)     if $test X"$gidsize" = X"$ivsize"; then
13754                 gidformat="$ivdformat"
13755         else
13756                 if $test X"$gidsize" = X"$longsize"; then
13757                         gidformat='"ld"'
13758                 else
13759                         if $test X"$gidsize" = X"$intsize"; then
13760                                 gidformat='"d"'
13761                         else
13762                                 if $test X"$gidsize" = X"$shortsize"; then
13763                                         gidformat='"hd"'
13764                                 fi
13765                         fi
13766                 fi
13767         fi
13768         ;;
13769 *)      if $test X"$gidsize" = X"$uvsize"; then
13770                 gidformat="$uvuformat"
13771         else
13772                 if $test X"$gidsize" = X"$longsize"; then
13773                         gidformat='"lu"'
13774                 else
13775                         if $test X"$gidsize" = X"$intsize"; then
13776                                 gidformat='"u"'
13777                         else
13778                                 if $test X"$gidsize" = X"$shortsize"; then
13779                                         gidformat='"hu"'
13780                                 fi
13781                         fi
13782                 fi
13783         fi
13784         ;;
13785 esac
13786
13787 : see if getgroups exists
13788 set getgroups d_getgrps
13789 eval $inlibc
13790
13791 : see if setgroups exists
13792 set setgroups d_setgrps
13793 eval $inlibc
13794
13795
13796 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
13797 echo " "
13798 case "$d_getgrps$d_setgrps" in
13799 *define*)
13800         case "$groupstype" in
13801         '') dflt="$gidtype" ;;
13802         *)  dflt="$groupstype" ;;
13803         esac
13804         $cat <<EOM
13805 What type of pointer is the second argument to getgroups() and setgroups()?
13806 Usually this is the same as group ids, $gidtype, but not always.
13807
13808 EOM
13809         rp='What type pointer is the second argument to getgroups() and setgroups()?'
13810         . ./myread
13811         groupstype="$ans"
13812         ;;
13813 *)  groupstype="$gidtype";;
13814 esac
13815
13816 echo " "
13817 echo "Checking if your $make program sets \$(MAKE)..." >&4
13818 case "$make_set_make" in
13819 '')
13820         $sed 's/^X //' > testmake.mak << 'EOF'
13821 Xall:
13822 X       @echo 'maketemp="$(MAKE)"'
13823 EOF
13824         case "`$make -f testmake.mak 2>/dev/null`" in
13825         *maketemp=*) make_set_make='#' ;;
13826         *)      make_set_make="MAKE=$make" ;;
13827         esac
13828         $rm -f testmake.mak
13829         ;;
13830 esac
13831 case "$make_set_make" in
13832 '#') echo "Yup, it does.";;
13833 *) echo "Nope, it doesn't.";;
13834 esac
13835
13836 : see what type is used for mode_t
13837 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
13838 set mode_t modetype int stdio.h sys/types.h
13839 eval $typedef_ask
13840
13841 : see if stdarg is available
13842 echo " "
13843 if $test `./findhdr stdarg.h`; then
13844         echo "<stdarg.h> found." >&4
13845         valstd="$define"
13846 else
13847         echo "<stdarg.h> NOT found." >&4
13848         valstd="$undef"
13849 fi
13850
13851 : see if varags is available
13852 echo " "
13853 if $test `./findhdr varargs.h`; then
13854         echo "<varargs.h> found." >&4
13855 else
13856         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
13857 fi
13858
13859 : set up the varargs testing programs
13860 $cat > varargs.c <<EOP
13861 #ifdef I_STDARG
13862 #include <stdarg.h>
13863 #endif
13864 #ifdef I_VARARGS
13865 #include <varargs.h>
13866 #endif
13867
13868 #ifdef I_STDARG
13869 int f(char *p, ...)
13870 #else
13871 int f(va_alist)
13872 va_dcl
13873 #endif
13874 {
13875         va_list ap;
13876 #ifndef I_STDARG
13877         char *p;
13878 #endif
13879 #ifdef I_STDARG
13880         va_start(ap,p);
13881 #else
13882         va_start(ap);
13883         p = va_arg(ap, char *);
13884 #endif
13885         va_end(ap);
13886 }
13887 EOP
13888 $cat > varargs <<EOP
13889 $startsh
13890 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
13891         echo "true"
13892 else
13893         echo "false"
13894 fi
13895 $rm -f varargs$_o
13896 EOP
13897 chmod +x varargs
13898
13899 : now check which varargs header should be included
13900 echo " "
13901 i_varhdr=''
13902 case "$valstd" in
13903 "$define")
13904         if `./varargs I_STDARG`; then
13905                 val='stdarg.h'
13906         elif `./varargs I_VARARGS`; then
13907                 val='varargs.h'
13908         fi
13909         ;;
13910 *)
13911         if `./varargs I_VARARGS`; then
13912                 val='varargs.h'
13913         fi
13914         ;;
13915 esac
13916 case "$val" in
13917 '')
13918 echo "I could not find the definition for va_dcl... You have problems..." >&4
13919         val="$undef"; set i_stdarg; eval $setvar
13920         val="$undef"; set i_varargs; eval $setvar
13921         ;;
13922 *) 
13923         set i_varhdr
13924         eval $setvar
13925         case "$i_varhdr" in
13926         stdarg.h)
13927                 val="$define"; set i_stdarg; eval $setvar
13928                 val="$undef"; set i_varargs; eval $setvar
13929                 ;;
13930         varargs.h)
13931                 val="$undef"; set i_stdarg; eval $setvar
13932                 val="$define"; set i_varargs; eval $setvar
13933                 ;;
13934         esac
13935         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
13936 esac
13937 $rm -f varargs*
13938
13939 : see if we need va_copy
13940 echo " "
13941 case "$i_stdarg" in
13942 "$define")
13943         $cat >try.c <<EOCP
13944 #include <stdarg.h>
13945 #include <stdio.h>
13946 #$i_stdlib I_STDLIB
13947 #ifdef I_STDLIB
13948 #include <stdlib.h>
13949 #endif
13950 #include <signal.h>
13951
13952 int
13953 ivfprintf(FILE *f, const char *fmt, va_list *valp)
13954 {
13955   return vfprintf(f, fmt, *valp);
13956 }
13957  
13958 int    
13959 myvfprintf(FILE *f, const  char *fmt, va_list val)
13960 {
13961   return ivfprintf(f, fmt, &val);
13962 }
13963       
13964 int
13965 myprintf(char *fmt, ...) 
13966 {
13967   va_list val;
13968   va_start(val, fmt);
13969   return myvfprintf(stdout, fmt, val); 
13970 }         
13971
13972 int
13973 main(int ac, char **av)
13974 {
13975   signal(SIGSEGV, exit);
13976
13977   myprintf("%s%cs all right, then\n", "that", '\'');                            
13978   exit(0);      
13979 }
13980 EOCP
13981         set try
13982         if eval $compile && ./try 2>&1 >/dev/null; then
13983                 case "`./try`" in
13984                 "that's all right, then")
13985                         okay=yes
13986                         ;;
13987                 esac
13988         fi
13989         case "$okay" in
13990         yes)    echo "It seems that you don't need va_copy()." >&4
13991                 need_va_copy="$undef"
13992                 ;;
13993         *)      echo "It seems that va_copy() or similar will be needed." >&4
13994                 need_va_copy="$define"
13995                 ;;
13996         esac
13997         $rm -f try.* core core.* *.core *.core.*
13998         ;;
13999 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
14000         ;;
14001 esac
14002
14003 : define a fucntion to check prototypes
14004 $cat > protochk <<EOSH
14005 $startsh
14006 cc="$cc"
14007 optimize="$optimize"
14008 ccflags="$ccflags"
14009 prototype="$prototype"
14010 define="$define"
14011 rm=$rm
14012 EOSH
14013
14014 $cat >> protochk <<'EOSH'
14015
14016 $rm -f try.c
14017 foo="$1"
14018 shift
14019 while test $# -ge 2; do
14020         case "$1" in
14021                 $define) echo "#include <$2>" >> try.c ;;
14022                 literal) echo "$2" >> try.c ;;
14023         esac
14024     shift 2
14025 done
14026 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
14027 cat >> try.c <<'EOCP'
14028 #ifdef CAN_PROTOTYPE
14029 #define _(args) args
14030 #else
14031 #define _(args) ()
14032 #endif
14033 EOCP
14034 echo "$foo" >> try.c
14035 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
14036 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
14037 status=$?
14038 $rm -f try.[co]
14039 exit $status
14040 EOSH
14041 chmod +x protochk
14042 $eunicefix protochk
14043
14044 : see what type is used for size_t
14045 rp="What is the type used for the length parameter for string functions?"
14046 set size_t sizetype 'unsigned int' stdio.h sys/types.h
14047 eval $typedef_ask
14048
14049 : check for type of arguments to gethostbyaddr. 
14050 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
14051         case "$d_gethbyaddr" in
14052         $define)
14053                 $cat <<EOM
14054
14055 Checking to see what type of arguments are accepted by gethostbyaddr().
14056 EOM
14057                 hdrs="$define sys/types.h
14058                         $d_socket sys/socket.h 
14059                         $i_niin netinet/in.h 
14060                         $i_netdb netdb.h
14061                         $i_unistd unistd.h"
14062                 : The first arg can 'char *' or 'void *'
14063                 : The second arg is some of integral type
14064                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
14065                         for yyy in size_t long int; do
14066                                 case "$netdb_host_type" in
14067                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
14068                                         if ./protochk "$try" $hdrs; then
14069                                                 echo "Your system accepts $xxx for the first arg."
14070                                                 echo "...and $yyy for the second arg."
14071                                                 netdb_host_type="$xxx"
14072                                                 netdb_hlen_type="$yyy"
14073                                         fi
14074                                         ;;
14075                                 esac
14076                         done
14077                 done
14078                 : In case none of those worked, prompt the user.
14079                 case "$netdb_host_type" in
14080                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
14081                         dflt='char *'
14082                         . ./myread
14083                         netdb_host_type=$ans
14084                         rp='What is the type for the 2nd argument to gethostbyaddr?'
14085                         dflt="$sizetype"
14086                         . ./myread
14087                         netdb_hlen_type=$ans
14088                         ;;
14089                 esac
14090                 ;;
14091         *)      : no gethostbyaddr, so pick harmless defaults
14092                 netdb_host_type='char *'
14093                 netdb_hlen_type="$sizetype"
14094                 ;;
14095         esac
14096         # Remove the "const" if needed. -- but then we'll have a 
14097         # prototype clash!
14098         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
14099 fi
14100
14101 : check for type of argument to gethostbyname. 
14102 if test "X$netdb_name_type" = X ; then
14103         case "$d_gethbyname" in
14104         $define)
14105                 $cat <<EOM
14106
14107 Checking to see what type of argument is accepted by gethostbyname().
14108 EOM
14109                 hdrs="$define sys/types.h
14110                         $d_socket sys/socket.h 
14111                         $i_niin netinet/in.h 
14112                         $i_netdb netdb.h
14113                         $i_unistd unistd.h"
14114                 for xxx in "const char *" "char *"; do
14115                         case "$netdb_name_type" in
14116                         '')     try="extern struct hostent *gethostbyname($xxx);"
14117                                 if ./protochk "$try" $hdrs; then
14118                                         echo "Your system accepts $xxx."
14119                                         netdb_name_type="$xxx"
14120                                 fi
14121                                 ;;
14122                         esac
14123                 done
14124                 : In case none of those worked, prompt the user.
14125                 case "$netdb_name_type" in
14126                 '')     rp='What is the type for the 1st argument to gethostbyname?'
14127                         dflt='char *'
14128                         . ./myread
14129                         netdb_name_type=$ans
14130                         ;;
14131                 esac
14132                 ;;
14133         *)      : no gethostbyname, so pick harmless default
14134                 netdb_name_type='char *'
14135                 ;;
14136         esac
14137 fi
14138
14139 : check for type of 1st argument to getnetbyaddr. 
14140 if test "X$netdb_net_type" = X ; then
14141         case "$d_getnbyaddr" in
14142         $define)
14143                 $cat <<EOM
14144
14145 Checking to see what type of 1st argument is accepted by getnetbyaddr().
14146 EOM
14147                 hdrs="$define sys/types.h
14148                         $d_socket sys/socket.h 
14149                         $i_niin netinet/in.h 
14150                         $i_netdb netdb.h
14151                         $i_unistd unistd.h"
14152                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
14153                         case "$netdb_net_type" in
14154                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
14155                                 if ./protochk "$try" $hdrs; then
14156                                         echo "Your system accepts $xxx."
14157                                         netdb_net_type="$xxx"
14158                                 fi
14159                                 ;;
14160                         esac
14161                 done
14162                 : In case none of those worked, prompt the user.
14163                 case "$netdb_net_type" in
14164                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
14165                         dflt='long'
14166                         . ./myread
14167                         netdb_net_type=$ans
14168                         ;;
14169                 esac
14170                 ;;
14171         *)      : no getnetbyaddr, so pick harmless default
14172                 netdb_net_type='long'
14173                 ;;
14174         esac
14175 fi
14176 : locate the preferred pager for this system
14177 case "$pager" in
14178 '')
14179         dflt=''
14180         case "$pg" in
14181         /*) dflt=$pg;;
14182         [a-zA-Z]:/*) dflt=$pg;;
14183         esac
14184         case "$more" in
14185         /*) dflt=$more;;
14186         [a-zA-Z]:/*) dflt=$more;;
14187         esac
14188         case "$less" in
14189         /*) dflt=$less;;
14190         [a-zA-Z]:/*) dflt=$less;;
14191         esac
14192         case "$dflt" in
14193         '') dflt=/usr/ucb/more;;
14194         esac
14195         ;;
14196 *) dflt="$pager";;
14197 esac
14198 echo " "
14199 fn=f/
14200 rp='What pager is used on your system?'
14201 . ./getfile
14202 pager="$ans"
14203
14204 : see what type pids are declared as in the kernel
14205 rp="What is the type of process ids on this system?"
14206 set pid_t pidtype int stdio.h sys/types.h
14207 eval $typedef_ask
14208
14209 : Find earliest binary compatible site_perl subdirectory perl can use.
14210 case "$bincompat5005" in
14211 "$define") xs_apiversion='5.005' ;;
14212 *) xs_apiversion=$version ;;   # The current site_perl version.
14213 esac
14214 : Find earliest pure perl site_perl subdirectory perl can use.
14215 : The versioned directories started at 5.005.
14216 pm_apiversion='5.005'
14217
14218 : see if ar generates random libraries by itself
14219 echo " "
14220 echo "Checking how to generate random libraries on your machine..." >&4
14221 echo 'int bar1() { return bar2(); }' > bar1.c
14222 echo 'int bar2() { return 2; }' > bar2.c
14223 $cat > foo.c <<'EOP'
14224 int main() { printf("%d\n", bar1()); exit(0); }
14225 EOP
14226 $cc $ccflags -c bar1.c >/dev/null 2>&1
14227 $cc $ccflags -c bar2.c >/dev/null 2>&1
14228 $cc $ccflags -c foo.c >/dev/null 2>&1
14229 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
14230 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14231         ./foobar >/dev/null 2>&1; then
14232         echo "$ar appears to generate random libraries itself."
14233         orderlib=false
14234         ranlib=":"
14235 elif $ar ts bar$_a >/dev/null 2>&1 &&
14236         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
14237         ./foobar >/dev/null 2>&1; then
14238                 echo "a table of contents needs to be added with '$ar ts'."
14239                 orderlib=false
14240                 ranlib="$ar ts"
14241 else
14242         case "$ranlib" in
14243         :) ranlib='';;
14244         '')
14245                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
14246                 $test -f $ranlib || ranlib=''
14247                 ;;
14248         esac
14249         if $test -n "$ranlib"; then
14250                 echo "your system has '$ranlib'; we'll use that."
14251                 orderlib=false
14252         else
14253                 echo "your system doesn't seem to support random libraries"
14254                 echo "so we'll use lorder and tsort to order the libraries."
14255                 orderlib=true
14256                 ranlib=":"
14257         fi
14258 fi
14259 $rm -f foo* bar* 
14260
14261 : check for type of arguments to select. 
14262 case "$selecttype" in
14263 '') case "$d_select" in
14264         $define)
14265                 echo " "
14266                 $cat <<EOM
14267 Checking to see what type of arguments are accepted by select().
14268 EOM
14269                 hdrs="$define sys/types.h
14270                         $i_systime sys/time.h 
14271                         $i_sysselct sys/select.h
14272                         $d_socket sys/socket.h"
14273                 : The first arg can be int, unsigned, or size_t
14274                 : The last arg may or may not be 'const'
14275                 val=''
14276                 : void pointer has been seen but using that
14277                 : breaks the selectminbits test
14278                 for xxx in 'fd_set *' 'int *'; do
14279                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
14280                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
14281                                         case "$val" in
14282                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
14283                                                 if ./protochk "$try" $hdrs; then
14284                                                         echo "Your system accepts $xxx."
14285                                                         val="$xxx"
14286                                                 fi
14287                                                 ;;
14288                                         esac
14289                                 done
14290                         done
14291                 done
14292                 case "$val" in
14293                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
14294                         case "$d_fd_set" in
14295                                 $define) dflt="fd_set *" ;;
14296                                 *)              dflt="int *" ;;
14297                         esac
14298                         . ./myread
14299                         val=$ans
14300                         ;;
14301                 esac
14302                 selecttype="$val"
14303                 ;;
14304         *)      : no select, so pick a harmless default
14305                 selecttype='int *'
14306                 ;;
14307         esac
14308         ;;
14309 esac
14310
14311 : check for the select 'width'
14312 case "$selectminbits" in
14313 '') case "$d_select" in
14314         $define)
14315                 $cat <<EOM
14316
14317 Checking to see on how many bits at a time your select() operates...
14318 EOM
14319                 $cat >try.c <<EOCP
14320 #include <sys/types.h>
14321 #$i_time I_TIME
14322 #$i_systime I_SYS_TIME
14323 #$i_systimek I_SYS_TIME_KERNEL
14324 #ifdef I_TIME
14325 #   include <time.h>
14326 #endif
14327 #ifdef I_SYS_TIME
14328 #   ifdef I_SYS_TIME_KERNEL
14329 #       define KERNEL
14330 #   endif
14331 #   include <sys/time.h>
14332 #   ifdef I_SYS_TIME_KERNEL
14333 #       undef KERNEL
14334 #   endif
14335 #endif
14336 #$i_sysselct I_SYS_SELECT
14337 #ifdef I_SYS_SELECT
14338 #include <sys/select.h>
14339 #endif
14340 #$d_socket HAS_SOCKET
14341 #ifdef HAS_SOCKET
14342 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
14343 #endif
14344 #include <stdio.h>
14345 $selecttype b;
14346 #define S sizeof(*(b))
14347 #define MINBITS 64
14348 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
14349 #define NBITS  (NBYTES * 8)
14350 int main() {
14351     char s[NBYTES];
14352     struct timeval t;
14353     int i;
14354     FILE* fp;
14355     int fd;
14356
14357     fclose(stdin);
14358     fp = fopen("try.c", "r");
14359     if (fp == 0)
14360       exit(1);
14361     fd = fileno(fp);
14362     if (fd < 0)
14363       exit(2);
14364     b = ($selecttype)s;
14365     for (i = 0; i < NBITS; i++)
14366         FD_SET(i, b);
14367     t.tv_sec  = 0;
14368     t.tv_usec = 0;
14369     select(fd + 1, b, 0, 0, &t);
14370     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
14371     printf("%d\n", i + 1);
14372     return 0;
14373 }
14374 EOCP
14375                 set try
14376                 if eval $compile_ok; then
14377                         selectminbits=`./try`
14378                         case "$selectminbits" in
14379                         '')     cat >&4 <<EOM
14380 Cannot figure out on how many bits at a time your select() operates.
14381 I'll play safe and guess it is 32 bits.
14382 EOM
14383                                 selectminbits=32
14384                                 bits="32 bits"
14385                                 ;;
14386                         1)      bits="1 bit" ;;
14387                         *)      bits="$selectminbits bits" ;;
14388                         esac
14389                         echo "Your select() operates on $bits at a time." >&4
14390                 else
14391                         rp='What is the minimum number of bits your select() operates on?'
14392                         case "$byteorder" in
14393                         1234|12345678)  dflt=32 ;;
14394                         *)              dflt=1  ;;
14395                         esac
14396                         . ./myread
14397                         val=$ans
14398                         selectminbits="$val"
14399                 fi
14400                 $rm -f try.* try
14401                 ;;
14402         *)      : no select, so pick a harmless default
14403                 selectminbits='32'
14404                 ;;
14405         esac
14406         ;;
14407 esac
14408
14409 : Trace out the files included by signal.h, then look for SIGxxx names.
14410 : Remove SIGARRAYSIZE used by HPUX.
14411 : Remove SIGSTKSIZE used by Linux.
14412 : Remove SIGSTKSZ used by Posix.
14413 : Remove SIGTYP void lines used by OS2.
14414 : Some cpps, like os390, dont give the file name anywhere
14415 if [ "X$fieldn" = X ]; then
14416         : Just make some guesses.  We check them later.
14417         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
14418 else
14419         xxx=`echo '#include <signal.h>' |
14420         $cppstdin $cppminus $cppflags 2>/dev/null |
14421         $grep '^[       ]*#.*include' | 
14422         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
14423 fi
14424 : Check this list of files to be sure we have parsed the cpp output ok.
14425 : This will also avoid potentially non-existent files, such 
14426 : as ../foo/bar.h
14427 xxxfiles=''
14428 for xx in $xxx /dev/null ; do
14429         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
14430 done
14431 : If we have found no files, at least try signal.h
14432 case "$xxxfiles" in
14433 '')     xxxfiles=`./findhdr signal.h` ;;
14434 esac
14435 xxx=`awk '
14436 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
14437         print substr($2, 4, 20)
14438 }
14439 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
14440         print substr($3, 4, 20)
14441 }' $xxxfiles`
14442 : Append some common names just in case the awk scan failed.
14443 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
14444 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
14445 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
14446 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
14447 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
14448
14449 : generate a few handy files for later
14450 $cat > signal.c <<'EOCP'
14451 #include <sys/types.h>
14452 #include <signal.h>
14453 #include <stdio.h>
14454 int main() {
14455
14456 /* Strange style to avoid deeply-nested #if/#else/#endif */
14457 #ifndef NSIG
14458 #  ifdef _NSIG
14459 #    define NSIG (_NSIG)
14460 #  endif
14461 #endif
14462
14463 #ifndef NSIG
14464 #  ifdef SIGMAX
14465 #    define NSIG (SIGMAX+1)
14466 #  endif
14467 #endif
14468
14469 #ifndef NSIG
14470 #  ifdef SIG_MAX
14471 #    define NSIG (SIG_MAX+1)
14472 #  endif
14473 #endif
14474
14475 #ifndef NSIG
14476 #  ifdef MAXSIG
14477 #    define NSIG (MAXSIG+1)
14478 #  endif
14479 #endif
14480
14481 #ifndef NSIG
14482 #  ifdef MAX_SIG
14483 #    define NSIG (MAX_SIG+1)
14484 #  endif
14485 #endif
14486
14487 #ifndef NSIG
14488 #  ifdef SIGARRAYSIZE
14489 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
14490 #  endif
14491 #endif
14492
14493 #ifndef NSIG
14494 #  ifdef _sys_nsig
14495 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
14496 #  endif
14497 #endif
14498
14499 /* Default to some arbitrary number that's big enough to get most
14500    of the common signals.
14501 */
14502 #ifndef NSIG
14503 #    define NSIG 50
14504 #endif
14505
14506 printf("NSIG %d\n", NSIG);
14507
14508 #ifndef JUST_NSIG
14509
14510 EOCP
14511
14512 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
14513 {
14514         printf "#ifdef SIG"; printf $1; printf "\n"
14515         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
14516         printf $1; printf ");\n"
14517         printf "#endif\n"
14518 }
14519 END {
14520         printf "#endif /* JUST_NSIG */\n";
14521         printf "exit(0);\n}\n";
14522 }
14523 ' >>signal.c
14524 $cat >signal.awk <<'EOP'
14525 BEGIN { ndups = 0 }
14526 $1 ~ /^NSIG$/ { nsig = $2 }
14527 ($1 !~ /^NSIG$/) && (NF == 2) {
14528     if ($2 > maxsig) { maxsig = $2 }
14529     if (sig_name[$2]) {
14530         dup_name[ndups] = $1
14531         dup_num[ndups] = $2
14532         ndups++ 
14533     }
14534     else {
14535         sig_name[$2] = $1
14536         sig_num[$2] = $2
14537     }
14538 }
14539 END { 
14540     if (nsig == 0) {
14541         nsig = maxsig + 1
14542     }
14543     printf("NSIG %d\n", nsig);
14544     for (n = 1; n < nsig; n++) {
14545         if (sig_name[n]) {
14546             printf("%s %d\n", sig_name[n], sig_num[n])
14547         }
14548         else {
14549             printf("NUM%d %d\n", n, n) 
14550         }
14551     }
14552     for (n = 0; n < ndups; n++) {
14553         printf("%s %d\n", dup_name[n], dup_num[n])
14554     }
14555 }
14556 EOP
14557 $cat >signal_cmd <<EOS
14558 $startsh
14559 if $test -s signal.lst; then
14560     echo "Using your existing signal.lst file"
14561         exit 0
14562 fi
14563 xxx="$xxx"
14564 EOS
14565 $cat >>signal_cmd <<'EOS'
14566
14567 set signal
14568 if eval $compile_ok; then
14569         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14570 else
14571         echo "(I can't seem be able to compile the whole test program)" >&4
14572         echo "(I'll try it in little pieces.)" >&4
14573         set signal -DJUST_NSIG
14574         if eval $compile_ok; then
14575                 ./signal$_exe > signal.nsg
14576                 $cat signal.nsg
14577         else
14578                 echo "I can't seem to figure out how many signals you have." >&4
14579                 echo "Guessing 50." >&4
14580                 echo 'NSIG 50' > signal.nsg
14581         fi
14582         : Now look at all the signal names, one at a time.
14583         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
14584                 $cat > signal.c <<EOCP
14585 #include <sys/types.h>
14586 #include <signal.h>
14587 #include <stdio.h>
14588 int main() {
14589 printf("$xx %d\n", SIG${xx});
14590 return 0;
14591 }
14592 EOCP
14593                 set signal
14594                 if eval $compile; then
14595                         echo "SIG${xx} found."
14596                         ./signal$_exe  >> signal.ls1
14597                 else
14598                         echo "SIG${xx} NOT found."
14599                 fi
14600         done
14601         if $test -s signal.ls1; then
14602                 $cat signal.nsg signal.ls1 |
14603                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
14604         fi
14605
14606 fi
14607 if $test -s signal.lst; then
14608         :
14609 else
14610         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
14611         echo 'kill -l' >signal
14612         set X `csh -f <signal`
14613         $rm -f signal
14614         shift
14615         case $# in
14616         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
14617         esac
14618         echo $@ | $tr ' ' $trnl | \
14619             $awk '{ printf "%s %d\n", $1, ++s; }
14620                   END { printf "NSIG %d\n", ++s }' >signal.lst
14621 fi
14622 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
14623 EOS
14624 chmod a+x signal_cmd
14625 $eunicefix signal_cmd
14626
14627 : generate list of signal names
14628 echo " "
14629 case "$sig_name_init" in
14630 '') doinit=yes ;;
14631 *)  case "$sig_num_init" in
14632     ''|*,*) doinit=yes ;;
14633     esac ;;
14634 esac
14635 case "$doinit" in
14636 yes)
14637         echo "Generating a list of signal names and numbers..." >&4
14638         . ./signal_cmd
14639         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
14640         sig_name=`$awk 'BEGIN { printf "ZERO " }
14641                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
14642         sig_num=`$awk  'BEGIN { printf "0 " }
14643                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
14644         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
14645                              !/^NSIG/   { printf "\"%s\", ", $1 }
14646                              END        { printf "0\n" }' signal.lst`
14647         sig_num_init=`$awk  'BEGIN      { printf "0, " }
14648                              !/^NSIG/   { printf "%d, ", $2}
14649                              END        { printf "0\n"}' signal.lst`
14650         ;;
14651 esac
14652 echo "The following $sig_count signals are available:"
14653 echo " "
14654 echo $sig_name | $awk \
14655 'BEGIN { linelen = 0 }
14656 {
14657         for (i = 1; i <= NF; i++) {
14658                 name = "SIG" $i " "
14659                 linelen = linelen + length(name)
14660                 if (linelen > 70) {
14661                         printf "\n"
14662                         linelen = length(name)
14663                 }
14664                 printf "%s", name
14665         }
14666         printf "\n"
14667 }'
14668 sig_size=`echo $sig_name | awk '{print NF}'`
14669 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
14670
14671 echo " "
14672 case "$sizetype" in
14673 *_t) zzz="$sizetype"    ;;
14674 *)   zzz="filesize"     ;;
14675 esac
14676 echo "Checking the size of $zzz..." >&4 
14677 cat > try.c <<EOCP
14678 #include <sys/types.h>
14679 #include <stdio.h>
14680 int main() {
14681     printf("%d\n", (int)sizeof($sizetype));
14682     exit(0);
14683 }
14684 EOCP
14685 set try
14686 if eval $compile_ok; then
14687         yyy=`./try`
14688         case "$yyy" in
14689         '')     sizesize=4
14690                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
14691                 ;;
14692         *)      sizesize=$yyy
14693                 echo "Your $zzz size is $sizesize bytes."
14694                 ;;
14695         esac
14696 else
14697         sizesize=4
14698         echo "(I can't compile the test program--guessing $sizesize.)" >&4
14699 fi
14700
14701
14702 : check for socklen_t
14703 echo " "
14704 echo "Checking to see if you have socklen_t..." >&4
14705 $cat >try.c <<EOCP
14706 #include <sys/types.h>
14707 #$d_socket HAS_SOCKET
14708 #ifdef HAS_SOCKET
14709 #include <sys/socket.h>
14710 #endif
14711 int main() { socklen_t x = 16; }
14712 EOCP
14713 set try
14714 if eval $compile; then
14715         val="$define"
14716         echo "You have socklen_t."
14717 else
14718         val="$undef"
14719         echo "You do not have socklen_t."
14720         case "$sizetype" in
14721         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
14722         esac
14723 fi
14724 $rm -f try try.*
14725 set d_socklen_t
14726 eval $setvar
14727
14728 : see if this is a socks.h system
14729 set socks.h i_socks
14730 eval $inhdr
14731
14732 : check for type of the size argument to socket calls
14733 case "$d_socket" in
14734 "$define")
14735         $cat <<EOM
14736
14737 Checking to see what type is the last argument of accept().
14738 EOM
14739         yyy=''
14740         case "$d_socklen_t" in
14741         "$define") yyy="$yyy socklen_t"
14742         esac
14743         yyy="$yyy $sizetype int long unsigned"
14744         for xxx in $yyy; do
14745                 case "$socksizetype" in
14746                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
14747                         case "$usesocks" in
14748                         "$define")
14749                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
14750                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
14751                                         socksizetype="$xxx"
14752                                 fi
14753                                 ;;
14754                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
14755                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
14756                                         socksizetype="$xxx"
14757                                 fi
14758                                 ;;
14759                         esac
14760                         ;;
14761                 esac
14762         done
14763 : In case none of those worked, prompt the user.
14764         case "$socksizetype" in
14765         '')     rp='What is the type for socket address structure sizes?'
14766                 dflt='int'
14767                 . ./myread
14768                 socksizetype=$ans
14769                 ;;
14770         esac
14771         ;;
14772 *)      : no sockets, so pick relatively harmless default
14773         socksizetype='int'
14774         ;;
14775 esac
14776
14777 : see what type is used for signed size_t
14778 set ssize_t ssizetype int stdio.h sys/types.h
14779 eval $typedef
14780 dflt="$ssizetype"
14781 $cat > ssize.c <<EOM
14782 #include <stdio.h>
14783 #include <sys/types.h>
14784 #define Size_t $sizetype
14785 #define SSize_t $dflt
14786 int main()
14787 {
14788         if (sizeof(Size_t) == sizeof(SSize_t))
14789                 printf("$dflt\n");
14790         else if (sizeof(Size_t) == sizeof(int))
14791                 printf("int\n");
14792         else 
14793                 printf("long\n");
14794         exit(0);
14795 }
14796 EOM
14797 echo " "
14798 set ssize
14799 if eval $compile_ok && ./ssize > /dev/null; then
14800         ssizetype=`./ssize`
14801         echo "I'll be using $ssizetype for functions returning a byte count." >&4
14802 else
14803         $cat >&4 <<EOM
14804 Help! I can't compile and run the ssize_t test program: please enlighten me!
14805 (This is probably a misconfiguration in your system or libraries, and
14806 you really ought to fix it.  Still, I'll try anyway.)
14807
14808 I need a type that is the same size as $sizetype, but is guaranteed to
14809 be signed.  Common values are ssize_t, int and long.
14810
14811 EOM
14812         rp="What signed type is the same size as $sizetype?"
14813         . ./myread
14814         ssizetype="$ans"
14815 fi
14816 $rm -f ssize ssize.*
14817
14818 : see what type of char stdio uses.
14819 echo " "
14820 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
14821 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
14822         echo "Your stdio uses unsigned chars." >&4
14823         stdchar="unsigned char"
14824 else
14825         echo "Your stdio uses signed chars." >&4
14826         stdchar="char"
14827 fi
14828 $rm -f stdioh
14829
14830
14831
14832 : see if time exists
14833 echo " "
14834 if test "X$d_time" = X -o X"$timetype" = X; then
14835     if set time val -f d_time; eval $csym; $val; then
14836                 echo 'time() found.' >&4
14837                 val="$define"
14838                 rp="What is the type returned by time() on this system?"
14839                 set time_t timetype long stdio.h sys/types.h
14840                 eval $typedef_ask
14841     else
14842                 echo 'time() not found, hope that will do.' >&4
14843                 val="$undef"
14844                 timetype='int';
14845     fi
14846     set d_time
14847     eval $setvar
14848 fi
14849
14850 : see what type uids are declared as in the kernel
14851 echo " "
14852 echo "Looking for the type for user ids returned by getuid()."
14853 set uid_t uidtype xxx stdio.h sys/types.h
14854 eval $typedef
14855 case "$uidtype" in
14856 xxx)
14857         xxx=`./findhdr sys/user.h`
14858         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
14859         case $1 in
14860         unsigned) dflt="$1 $2" ;;
14861         *) dflt="$1" ;;
14862         esac
14863         ;;
14864 *) dflt="$uidtype";;
14865 esac
14866 case "$uidtype" in
14867 uid_t)  echo "uid_t found." ;;
14868 *)      rp="What is the type for user ids returned by getuid()?"
14869         . ./myread
14870         uidtype="$ans"
14871         ;;
14872 esac
14873
14874 echo " "
14875 case "$uidtype" in
14876 *_t) zzz="$uidtype"     ;;
14877 *)   zzz="uid"          ;;
14878 esac
14879 echo "Checking the size of $zzz..." >&4 
14880 cat > try.c <<EOCP
14881 #include <sys/types.h>
14882 #include <stdio.h>
14883 int main() {
14884     printf("%d\n", (int)sizeof($uidtype));
14885     exit(0);
14886 }
14887 EOCP
14888 set try
14889 if eval $compile_ok; then
14890         yyy=`./try`
14891         case "$yyy" in
14892         '')     uidsize=4
14893                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
14894                 ;;
14895         *)      uidsize=$yyy
14896                 echo "Your $zzz is $uidsize bytes long."
14897                 ;;
14898         esac
14899 else
14900         uidsize=4
14901         echo "(I can't compile the test program--guessing $uidsize.)" >&4
14902 fi
14903
14904 echo " "
14905 case "$uidtype" in
14906 *_t) zzz="$uidtype"     ;;
14907 *)   zzz="uid"          ;;
14908 esac
14909 echo "Checking the sign of $zzz..." >&4
14910 cat > try.c <<EOCP
14911 #include <sys/types.h>
14912 #include <stdio.h>
14913 int main() {
14914         $uidtype foo = -1;
14915         if (foo < 0)
14916                 printf("-1\n");
14917         else
14918                 printf("1\n");
14919 }
14920 EOCP
14921 set try
14922 if eval $compile; then
14923         yyy=`./try`
14924         case "$yyy" in
14925         '')     uidsign=1
14926                 echo "(I can't execute the test program--guessing unsigned.)" >&4
14927                 ;;
14928         *)      uidsign=$yyy
14929                 case "$uidsign" in
14930                  1) echo "Your $zzz is unsigned." ;;
14931                 -1) echo "Your $zzz is signed."   ;;
14932                 esac
14933                 ;;
14934         esac
14935 else
14936         uidsign=1
14937         echo "(I can't compile the test program--guessing unsigned.)" >&4
14938 fi
14939
14940
14941
14942 echo " "
14943 $echo "Checking the format string to be used for uids..." >&4
14944
14945 case "$uidsign" in
14946 -1)     if $test X"$uidsize" = X"$ivsize"; then
14947                 uidformat="$ivdformat"
14948         else
14949                 if $test X"$uidsize" = X"$longsize"; then
14950                         uidformat='"ld"'
14951                 else
14952                         if $test X"$uidsize" = X"$intsize"; then
14953                                 uidformat='"d"'
14954                         else
14955                                 if $test X"$uidsize" = X"$shortsize"; then
14956                                         uidformat='"hd"'
14957                                 fi
14958                         fi
14959                 fi
14960         fi
14961         ;;
14962 *)      if $test X"$uidsize" = X"$uvsize"; then
14963                 uidformat="$uvuformat"
14964         else
14965                 if $test X"$uidsize" = X"$longsize"; then
14966                         uidformat='"lu"'
14967                 else
14968                         if $test X"$uidsize" = X"$intsize"; then
14969                                 uidformat='"u"'
14970                         else
14971                                 if $test X"$uidsize" = X"$shortsize"; then
14972                                         uidformat='"hu"'
14973                                 fi
14974                         fi
14975                 fi
14976         fi
14977         ;;
14978 esac
14979
14980 : determine compiler compiler
14981 case "$yacc" in
14982 '')
14983         dflt=yacc;;
14984 *)
14985         dflt="$yacc";;
14986 esac
14987 echo " "
14988 comp='yacc'
14989 if $test -f "$byacc"; then
14990         dflt="$byacc"
14991         comp="byacc or $comp"
14992 fi
14993 if $test -f "$bison"; then
14994         comp="$comp or bison -y"
14995 fi
14996 rp="Which compiler compiler ($comp) shall I use?"
14997 . ./myread
14998 yacc="$ans"
14999 case "$yacc" in
15000 *bis*)
15001         case "$yacc" in
15002         *-y*) ;;
15003         *)
15004                 yacc="$yacc -y"
15005                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
15006                 ;;
15007         esac
15008         ;;
15009 esac
15010
15011 : see if dbm.h is available
15012 : see if dbmclose exists
15013 set dbmclose d_dbmclose
15014 eval $inlibc
15015
15016 case "$d_dbmclose" in
15017 $define)
15018         set dbm.h i_dbm
15019         eval $inhdr
15020         case "$i_dbm" in
15021         $define)
15022                 val="$undef"
15023                 set i_rpcsvcdbm
15024                 eval $setvar
15025                 ;;
15026         *)      set rpcsvc/dbm.h i_rpcsvcdbm
15027                 eval $inhdr
15028                 ;;
15029         esac
15030         ;;
15031 *)      echo "We won't be including <dbm.h>"
15032         val="$undef"
15033         set i_dbm
15034         eval $setvar
15035         val="$undef"
15036         set i_rpcsvcdbm
15037         eval $setvar
15038         ;;
15039 esac
15040
15041 : see if this is a sys/file.h system
15042 val=''
15043 set sys/file.h val
15044 eval $inhdr
15045
15046 : do we need to include sys/file.h ?
15047 case "$val" in
15048 "$define")
15049         echo " "
15050         if $h_sysfile; then
15051                 val="$define"
15052                 echo "We'll be including <sys/file.h>." >&4
15053         else
15054                 val="$undef"
15055                 echo "We won't be including <sys/file.h>." >&4
15056         fi
15057         ;;
15058 *)
15059         h_sysfile=false
15060         ;;
15061 esac
15062 set i_sysfile
15063 eval $setvar
15064
15065 : see if fcntl.h is there
15066 val=''
15067 set fcntl.h val
15068 eval $inhdr
15069
15070 : see if we can include fcntl.h
15071 case "$val" in
15072 "$define")
15073         echo " "
15074         if $h_fcntl; then
15075                 val="$define"
15076                 echo "We'll be including <fcntl.h>." >&4
15077         else
15078                 val="$undef"
15079                 if $h_sysfile; then
15080         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
15081                 else
15082                         echo "We won't be including <fcntl.h>." >&4
15083                 fi
15084         fi
15085         ;;
15086 *)
15087         h_fcntl=false
15088         val="$undef"
15089         ;;
15090 esac
15091 set i_fcntl
15092 eval $setvar
15093
15094 : see if this is a iconv.h system
15095 set iconv.h i_iconv
15096 eval $inhdr
15097
15098 : see if this is a ieeefp.h system
15099 set ieeefp.h i_ieeefp
15100 eval $inhdr
15101
15102 : see if this is a libutil.h system
15103 set libutil.h i_libutil
15104 eval $inhdr
15105
15106 : see if locale.h is available
15107 set locale.h i_locale
15108 eval $inhdr
15109
15110 : see if mach cthreads are available
15111 if test "X$usethreads" = "X$define"; then
15112         set mach/cthreads.h i_machcthr
15113         eval $inhdr
15114 else
15115         i_machcthr="$undef"
15116 fi
15117
15118
15119
15120 : see if this is a math.h system
15121 set math.h i_math
15122 eval $inhdr
15123
15124 : see if this is a mntent.h system
15125 set mntent.h i_mntent
15126 eval $inhdr
15127
15128 : see if ndbm.h is available
15129 set ndbm.h t_ndbm
15130 eval $inhdr
15131 case "$t_ndbm" in
15132 $define)
15133         : see if dbm_open exists
15134         set dbm_open d_dbm_open
15135         eval $inlibc
15136         case "$d_dbm_open" in
15137         $undef)
15138                 t_ndbm="$undef"
15139                 echo "We won't be including <ndbm.h>"
15140                 ;;
15141         esac
15142         ;;
15143 esac
15144 val="$t_ndbm"
15145 set i_ndbm
15146 eval $setvar
15147
15148 : see if net/errno.h is available
15149 val=''
15150 set net/errno.h val
15151 eval $inhdr
15152
15153 : Unfortunately, it causes problems on some systems.  Arrgh.
15154 case "$val" in
15155 $define)
15156         cat > try.c <<'EOM'
15157 #include <stdio.h>
15158 #include <errno.h>
15159 #include <net/errno.h>
15160 int func()
15161 {
15162         return ENOTSOCK;
15163 }
15164 EOM
15165         if $cc $ccflags -c try.c >/dev/null 2>&1; then
15166                 echo "We'll be including <net/errno.h>." >&4
15167         else
15168                 echo "We won't be including <net/errno.h>." >&4
15169                 val="$undef"
15170         fi
15171         $rm -f try.* try
15172         ;;
15173 esac
15174 set i_neterrno
15175 eval $setvar
15176
15177 : see if netinet/tcp.h is available
15178 set netinet/tcp.h i_netinettcp
15179 eval $inhdr
15180
15181 : see if this is a poll.h system
15182 set poll.h i_poll
15183 eval $inhdr
15184
15185 : see if this is a prot.h system
15186 set prot.h i_prot
15187 eval $inhdr
15188
15189 echo " "
15190 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
15191 $cat <<'EOSH' > Cppsym.know
15192 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
15193 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
15194 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
15195 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
15196 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
15197 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
15198 bull c cadmus clipper CMU COFF COMPILER_VERSION
15199 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
15200 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
15201 Dynix DynixPTX ELF encore EPI EXTENSIONS FILE_OFFSET_BITS
15202 FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
15203 GNU_SOURCE GNUC GNUC_MINOR GO32 gould GOULD_PN
15204 H3050R H3050RX hbullx20 hcx host_mips
15205 hp200 hp300 hp700 HP700 hp800 hp9000
15206 hp9000s200 hp9000s300 hp9000s400 hp9000s500
15207 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
15208 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
15209 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
15210 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
15211 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
15212 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
15213 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
15214 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
15215 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
15216 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
15217 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
15218 MATH_HAS_NO_SIDE_EFFECTS
15219 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
15220 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
15221 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
15222 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
15223 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
15224 NetBSD news1500 news1700 news1800 news1900 news3700
15225 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
15226 ns32016 ns32332 ns32k nsc32000
15227 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
15228 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
15229 pc532 pdp11 PGC PIC plexus PORTAR posix
15230 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
15231 POSIX_C_SOURCE POSIX_SOURCE POWER
15232 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
15233 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
15234 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
15235 sony sony_news sonyrisc sparc sparclite spectrum
15236 stardent stdc STDC_EXT stratos sun sun3 sun386
15237 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
15238 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
15239 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
15240 sysV68 sysV88 Tek4132 Tek4300 titan
15241 TM3200 TM5400 TM5600
15242 tower tower32 tower32_200 tower32_600 tower32_700
15243 tower32_800 tower32_850 tss
15244 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
15245 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
15246 unix UNIX95 UNIX99 unixpc unos USGr4 USGr4_2
15247 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
15248 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
15249 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
15250 z8000
15251 EOSH
15252 # Maybe put other stuff here too.
15253 cat <<EOSH >>Cppsym.know
15254 $osname
15255 EOSH
15256 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
15257 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
15258 $cat Cppsym.know > Cppsym.c
15259 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
15260 $rm -f Cppsym.a Cppsym.b Cppsym.c
15261 cat <<EOSH > Cppsym
15262 $startsh
15263 if $test \$# -gt 0; then
15264     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
15265     if $test -s Cppsym.got; then
15266         $rm -f Cppsym.got
15267         exit 0
15268     fi
15269     $rm -f Cppsym.got
15270     exit 1
15271 else
15272     $tr " " "$trnl" | ./Cppsym.try
15273     exit 0
15274 fi
15275 EOSH
15276 chmod +x Cppsym
15277 $eunicefix Cppsym
15278 cat <<EOSH > Cppsym.try
15279 $startsh
15280 cat <<'EOCP' > try.c
15281 #include <stdio.h>
15282 int main() {
15283 EOCP
15284 $awk \\
15285 EOSH
15286 cat <<'EOSH' >> Cppsym.try
15287 'length($1) > 0 {
15288     printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", %s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15289     printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", _%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15290     printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", __%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15291     printf "#ifdef __%s__\n#if __%s__+0\nprintf(\"__%s__=%%ld\\n\", __%s__);\n#else\nprintf(\"__%s__\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
15292 }'       >> try.c
15293 echo '}' >> try.c
15294 EOSH
15295 cat <<EOSH >> Cppsym.try
15296 ccflags="$ccflags"
15297 case "$osname-$gccversion" in
15298 irix-) ccflags="\$ccflags -woff 1178" ;;
15299 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
15300 esac
15301 $cc -o try $optimize \$ccflags $ldflags try.c $libs && ./try$exe_ext
15302 EOSH
15303 chmod +x Cppsym.try
15304 $eunicefix Cppsym.try
15305 ./Cppsym < Cppsym.know > Cppsym.true
15306 : now check the C compiler for additional symbols
15307 postprocess_cc_v=''
15308 case "$osname" in
15309 aix) postprocess_cc_v="|$tr , ' '" ;;
15310 esac
15311 $cat >ccsym <<EOS
15312 $startsh
15313 $cat >tmp.c <<EOF
15314 extern int foo;
15315 EOF
15316 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
15317 do
15318         case "\$i" in
15319         -D*) echo "\$i" | $sed 's/^-D//';;
15320         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
15321         esac
15322 done
15323 $rm -f try.c
15324 EOS
15325 postprocess_cc_v=''
15326 chmod +x ccsym
15327 $eunicefix ccsym
15328 ./ccsym > ccsym1.raw
15329 if $test -s ccsym1.raw; then
15330        $sort ccsym1.raw | $uniq >ccsym.raw
15331 else
15332        mv ccsym1.raw ccsym.raw
15333 fi
15334
15335 $awk '/\=/ { print $0; next }
15336         { print $0"=1" }' ccsym.raw >ccsym.list
15337 $awk '/\=/ { print $0; next }
15338         { print $0"=1" }' Cppsym.true >ccsym.true
15339 $comm -13 ccsym.true ccsym.list >ccsym.own
15340 $comm -12 ccsym.true ccsym.list >ccsym.com
15341 $comm -23 ccsym.true ccsym.list >ccsym.cpp
15342 also=''
15343 if $test -z ccsym.raw; then
15344         echo "Your C compiler doesn't seem to define any symbols!" >&4
15345         echo " "
15346         echo "However, your C preprocessor defines the following symbols:"
15347         $cat Cppsym.true
15348         ccsymbols=''
15349         cppsymbols=`$cat Cppsym.true`
15350         cppsymbols=`echo $cppsymbols`
15351         cppccsymbols="$cppsymbols"
15352 else
15353         if $test -s ccsym.com; then
15354                 echo "Your C compiler and pre-processor define these symbols:"
15355                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
15356                 also='also '
15357                 symbols='ones'
15358                 cppccsymbols=`$cat ccsym.com`
15359                 cppccsymbols=`echo $cppccsymbols`
15360                 $test "$silent" || sleep 1
15361         fi
15362         if $test -s ccsym.cpp; then
15363                 $test "$also" && echo " "
15364                 echo "Your C pre-processor ${also}defines the following symbols:"
15365                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
15366                 also='further '
15367                 cppsymbols=`$cat ccsym.cpp`
15368                 cppsymbols=`echo $cppsymbols`
15369                 $test "$silent" || sleep 1
15370         fi
15371         if $test -s ccsym.own; then
15372                 $test "$also" && echo " "
15373                 echo "Your C compiler ${also}defines the following cpp symbols:"
15374                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
15375                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
15376                 ccsymbols=`$cat ccsym.own`
15377                 ccsymbols=`echo $ccsymbols`
15378                 $test "$silent" || sleep 1
15379         fi
15380 fi
15381 $rm -f ccsym* Cppsym.*
15382
15383 : see if this is a termio system
15384 val="$undef"
15385 val2="$undef"
15386 val3="$undef"
15387 if $test `./findhdr termios.h`; then
15388         set tcsetattr i_termios
15389         eval $inlibc
15390         val3="$i_termios"
15391 fi
15392 echo " "
15393 case "$val3" in
15394 "$define") echo "You have POSIX termios.h... good!" >&4;;
15395 *) if ./Cppsym pyr; then
15396                 case "`/bin/universe`" in
15397                 ucb) if $test `./findhdr sgtty.h`; then
15398                                 val2="$define"
15399                                 echo "<sgtty.h> found." >&4
15400                         else
15401                                 echo "System is pyramid with BSD universe."
15402                                 echo "<sgtty.h> not found--you could have problems." >&4
15403                         fi;;
15404                 *) if $test `./findhdr termio.h`; then
15405                                 val="$define"
15406                                 echo "<termio.h> found." >&4
15407                         else
15408                                 echo "System is pyramid with USG universe."
15409                                 echo "<termio.h> not found--you could have problems." >&4
15410                         fi;;
15411                 esac
15412         elif ./usg; then
15413                 if $test `./findhdr termio.h`; then
15414                         echo "<termio.h> found." >&4
15415                         val="$define"
15416                 elif $test `./findhdr sgtty.h`; then
15417                         echo "<sgtty.h> found." >&4
15418                         val2="$define"
15419                 else
15420 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
15421                 fi
15422         else
15423                 if $test `./findhdr sgtty.h`; then
15424                         echo "<sgtty.h> found." >&4
15425                         val2="$define"
15426                 elif $test `./findhdr termio.h`; then
15427                         echo "<termio.h> found." >&4
15428                         val="$define"
15429                 else
15430 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
15431                 fi
15432         fi;;
15433 esac
15434 set i_termio; eval $setvar
15435 val=$val2; set i_sgtty; eval $setvar
15436 val=$val3; set i_termios; eval $setvar
15437
15438 : see if this is a shadow.h system
15439 set shadow.h i_shadow
15440 eval $inhdr
15441
15442 : see if stddef is available
15443 set stddef.h i_stddef
15444 eval $inhdr
15445
15446 : see if this is a sunmath.h system
15447 set sunmath.h i_sunmath
15448 eval $inhdr
15449
15450 : see if sys/access.h is available
15451 set sys/access.h i_sysaccess
15452 eval $inhdr
15453
15454 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
15455 set sys/filio.h i_sysfilio
15456 eval $inhdr
15457 echo " "
15458 if $test `./findhdr sys/ioctl.h`; then
15459         val="$define"
15460         echo '<sys/ioctl.h> found.' >&4
15461 else
15462         val="$undef"
15463         if $test $i_sysfilio = "$define"; then
15464             echo '<sys/ioctl.h> NOT found.' >&4
15465         else
15466                 $test $i_sgtty = "$define" && xxx="sgtty.h"
15467                 $test $i_termio = "$define" && xxx="termio.h"
15468                 $test $i_termios = "$define" && xxx="termios.h"
15469 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
15470         fi
15471 fi
15472 set i_sysioctl
15473 eval $setvar
15474
15475 : see if socket ioctl defs are in sys/sockio.h
15476 echo " "
15477 xxx=`./findhdr sys/sockio.h`
15478 if $test "$xxx"; then
15479         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
15480                 val="$define"
15481                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
15482         else
15483                 val="$undef"
15484                 echo "No socket ioctls found in <sys/sockio.h>." >&4
15485         fi
15486 else
15487         val="$undef"
15488         $cat <<EOM
15489 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
15490 EOM
15491 fi
15492 set i_syssockio
15493 eval $setvar
15494
15495
15496 : see if this is a syslog.h system
15497 set syslog.h i_syslog
15498 eval $inhdr
15499
15500
15501 : see if this is a sys/mode.h system
15502 set sys/mode.h i_sysmode
15503 eval $inhdr
15504
15505 : see if sys/resource.h has to be included
15506 set sys/resource.h i_sysresrc
15507 eval $inhdr
15508
15509 : see if sys/security.h is available
15510 set sys/security.h i_syssecrt
15511 eval $inhdr
15512
15513 : see if this is a sys/statvfs.h system
15514 set sys/statvfs.h i_sysstatvfs
15515 eval $inhdr
15516
15517 : see if this is a sys/uio.h system
15518 set sys/uio.h i_sysuio
15519 eval $inhdr
15520
15521 : see if this is a sys/un.h system
15522 set sys/un.h i_sysun
15523 eval $inhdr
15524
15525
15526 : see if this is a sys/utsname.h system
15527 set sys/utsname.h i_sysutsname
15528 eval $inhdr
15529
15530 : see if this is a syswait system
15531 set sys/wait.h i_syswait
15532 eval $inhdr
15533
15534 : see if this is a ustat.h system
15535 set ustat.h i_ustat
15536 eval $inhdr
15537
15538 : see if this is an utime system
15539 set utime.h i_utime
15540 eval $inhdr
15541
15542 : see if this is a values.h system
15543 set values.h i_values
15544 eval $inhdr
15545
15546 : see if this is a vfork system
15547 case "$d_vfork" in
15548 "$define")
15549         set vfork.h i_vfork
15550         eval $inhdr
15551         ;;
15552 *)
15553         i_vfork="$undef"
15554         ;;
15555 esac
15556
15557 : see if gdbm.h is available
15558 set gdbm.h t_gdbm
15559 eval $inhdr
15560 case "$t_gdbm" in
15561 $define)
15562         : see if gdbm_open exists
15563         set gdbm_open d_gdbm_open
15564         eval $inlibc
15565         case "$d_gdbm_open" in
15566         $undef)
15567                 t_gdbm="$undef"
15568                 echo "We won't be including <gdbm.h>"
15569                 ;;
15570         esac
15571         ;;
15572 esac
15573 val="$t_gdbm"
15574 set i_gdbm
15575 eval $setvar
15576
15577 echo " "
15578 echo "Looking for extensions..." >&4
15579 : If we are using the old config.sh, known_extensions may contain
15580 : old or inaccurate or duplicate values.
15581 known_extensions=''
15582 nonxs_extensions=''
15583 : We do not use find because it might not be available.
15584 : We do not just use MANIFEST because the user may have dropped
15585 : some additional extensions into the source tree and expect them
15586 : to be built.
15587
15588 : Function to recursively find available extensions, ignoring DynaLoader
15589 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
15590 find_extensions='
15591     for xxx in *; do
15592        case "$xxx" in
15593            DynaLoader|dynaload) ;;
15594            *)
15595            if $test -f $xxx/$xxx.xs; then
15596                known_extensions="$known_extensions $1$xxx";
15597            elif $test -f $xxx/Makefile.PL; then
15598                nonxs_extensions="$nonxs_extensions $1$xxx";
15599            else
15600                if $test -d $xxx -a $# -lt 10; then
15601                    set $1$xxx/ $*;
15602                    cd $xxx;
15603                    eval $find_extensions;
15604                    cd ..;
15605                    shift;
15606                fi;
15607            fi
15608            ;;
15609        esac;
15610     done'
15611 tdir=`pwd`
15612 cd $rsrc/ext
15613 set X
15614 shift
15615 eval $find_extensions
15616 set X $nonxs_extensions
15617 shift
15618 nonxs_extensions="$*"
15619 set X $known_extensions
15620 shift
15621 known_extensions="$*"
15622 cd $tdir
15623
15624 : Now see which are supported on this system.
15625 avail_ext=''
15626 for xxx in $known_extensions ; do
15627         case "$xxx" in
15628         DB_File|db_file)
15629                 case "$i_db" in
15630                 $define) avail_ext="$avail_ext $xxx" ;;
15631                 esac
15632                 ;;
15633         GDBM_File|gdbm_fil)
15634                 case "$i_gdbm" in 
15635                 $define) avail_ext="$avail_ext $xxx" ;;
15636                 esac
15637                 ;;
15638         NDBM_File|ndbm_fil)
15639                 case "$i_ndbm" in
15640                 $define)
15641                     case "$osname-$use64bitint" in
15642                     hpux-define)
15643                         case "$libs" in
15644                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
15645                         esac
15646                         ;;
15647                     *) avail_ext="$avail_ext $xxx" ;;
15648                     esac
15649                     ;;
15650                 esac
15651                 ;;
15652         ODBM_File|odbm_fil) 
15653                 case "${i_dbm}${i_rpcsvcdbm}" in
15654                 *"${define}"*)
15655                     case "$osname-$use64bitint" in
15656                     hpux-define)
15657                         case "$libs" in
15658                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
15659                         esac
15660                         ;;
15661                     *) avail_ext="$avail_ext $xxx" ;;
15662                     esac
15663                     ;;
15664                 esac
15665                 ;;
15666         POSIX|posix)
15667                 case "$useposix" in
15668                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15669                 esac
15670                 ;;
15671         Opcode|opcode)
15672                 case "$useopcode" in
15673                 true|define|y) avail_ext="$avail_ext $xxx" ;;
15674                 esac
15675                 ;;
15676         Socket|socket)
15677                 case "$d_socket" in 
15678                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15679                 esac
15680                 ;;
15681         Sys/Syslog|sys/syslog)
15682                 : XXX syslog requires socket
15683                 case "$d_socket" in 
15684                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15685                 esac
15686                 ;;
15687         Thread|thread)
15688                 case "$usethreads" in 
15689                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
15690                 esac
15691                 ;;
15692         IPC/SysV|ipc/sysv)
15693                 : XXX Do we need a useipcsysv variable here
15694                 case "${d_msg}${d_sem}${d_shm}" in 
15695                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
15696                 esac
15697                 ;;
15698         *)      avail_ext="$avail_ext $xxx"
15699                 ;;
15700         esac
15701 done
15702
15703 set X $avail_ext
15704 shift
15705 avail_ext="$*"
15706
15707 : Now see which nonxs extensions are supported on this system.
15708 : For now assume all are.
15709 nonxs_ext=''
15710 for xxx in $nonxs_extensions ; do
15711         case "$xxx" in
15712         *)      nonxs_ext="$nonxs_ext $xxx"
15713                 ;;
15714         esac
15715 done
15716
15717 set X $nonxs_ext
15718 shift
15719 nonxs_ext="$*"
15720
15721 case $usedl in
15722 $define)
15723         $cat <<EOM
15724 A number of extensions are supplied with $package.  You may choose to
15725 compile these extensions for dynamic loading (the default), compile
15726 them into the $package executable (static loading), or not include
15727 them at all.  Answer "none" to include no extensions.
15728 Note that DynaLoader is always built and need not be mentioned here.
15729
15730 EOM
15731         case "$dynamic_ext" in
15732         '') dflt="$avail_ext" ;;
15733         *)      dflt="$dynamic_ext"
15734                 # Perhaps we are reusing an old out-of-date config.sh.
15735                 case "$hint" in
15736                 previous)
15737                         if test X"$dynamic_ext" != X"$avail_ext"; then
15738                                 $cat <<EOM
15739 NOTICE:  Your previous config.sh list may be incorrect. 
15740 The extensions now available to you are 
15741         ${avail_ext}
15742 but the default list from your previous config.sh is
15743         ${dynamic_ext} 
15744
15745 EOM
15746                         fi
15747                         ;;
15748                 esac
15749                 ;;
15750         esac
15751         case "$dflt" in
15752         '')     dflt=none;;
15753         esac
15754         rp="What extensions do you wish to load dynamically?"
15755         . ./myread
15756         case "$ans" in
15757         none) dynamic_ext=' ' ;;
15758         *) dynamic_ext="$ans" ;;
15759         esac
15760
15761         case "$static_ext" in
15762         '')
15763                 : Exclude those already listed in dynamic linking
15764                 dflt=''
15765                 for xxx in $avail_ext; do
15766                         case " $dynamic_ext " in
15767                         *" $xxx "*) ;;
15768                         *) dflt="$dflt $xxx" ;;
15769                         esac
15770                 done
15771                 set X $dflt
15772                 shift
15773                 dflt="$*"
15774                 ;;
15775         *)  dflt="$static_ext" 
15776                 ;;
15777         esac
15778
15779         case "$dflt" in
15780         '')     dflt=none;;
15781         esac
15782         rp="What extensions do you wish to load statically?"
15783         . ./myread
15784         case "$ans" in
15785         none) static_ext=' ' ;;
15786         *) static_ext="$ans" ;;
15787         esac
15788         ;;
15789 *)
15790         $cat <<EOM
15791 A number of extensions are supplied with $package.  Answer "none" 
15792 to include no extensions. 
15793 Note that DynaLoader is always built and need not be mentioned here.
15794
15795 EOM
15796         case "$static_ext" in
15797         '') dflt="$avail_ext" ;;
15798         *)      dflt="$static_ext"
15799                 # Perhaps we are reusing an old out-of-date config.sh.
15800                 case "$hint" in
15801                 previous)
15802                         if test X"$static_ext" != X"$avail_ext"; then
15803                                 $cat <<EOM
15804 NOTICE:  Your previous config.sh list may be incorrect. 
15805 The extensions now available to you are 
15806         ${avail_ext}
15807 but the default list from your previous config.sh is
15808         ${static_ext} 
15809
15810 EOM
15811                         fi
15812                         ;;
15813                 esac
15814                 ;;
15815         esac
15816         : Exclude those that are not xs extensions
15817         case "$dflt" in
15818         '')     dflt=none;;
15819         esac
15820         rp="What extensions do you wish to include?"
15821         . ./myread
15822         case "$ans" in
15823         none) static_ext=' ' ;;
15824         *) static_ext="$ans" ;;
15825         esac
15826         ;;
15827 esac
15828
15829 set X $dynamic_ext $static_ext $nonxs_ext
15830 shift
15831 extensions="$*"
15832
15833 : Remove libraries needed only for extensions
15834 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
15835 : The exception is SunOS 4.x, which needs them.
15836 case "${osname}X${osvers}" in
15837 sunos*X4*)
15838     perllibs="$libs"
15839     ;;
15840 *) case "$usedl" in
15841     $define|true|[yY]*)
15842             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
15843             shift
15844             perllibs="$*"
15845             ;;
15846     *)  perllibs="$libs"
15847             ;;
15848     esac
15849     ;;
15850 esac
15851
15852 : Remove build directory name from cppstdin so it can be used from
15853 : either the present location or the final installed location.
15854 echo " "
15855 : Get out of the UU directory to get correct path name.
15856 cd ..
15857 case "$cppstdin" in
15858 `pwd`/cppstdin)
15859         echo "Stripping down cppstdin path name"
15860         cppstdin=cppstdin
15861         ;;
15862 esac
15863 cd UU
15864
15865 : end of configuration questions
15866 echo " "
15867 echo "End of configuration questions."
15868 echo " "
15869
15870 : back to where it started
15871 if test -d ../UU; then
15872         cd ..
15873 fi
15874
15875 : configuration may be patched via a 'config.over' file
15876 if $test -f config.over; then
15877         echo " "
15878         dflt=y
15879         rp='I see a config.over file.  Do you wish to load it?'
15880         . UU/myread
15881         case "$ans" in
15882         n*) echo "OK, I'll ignore it.";;
15883         *)      . ./config.over
15884                 echo "Configuration override changes have been loaded."
15885                 ;;
15886         esac
15887 fi
15888
15889 : in case they want portability, strip down executable paths
15890 case "$d_portable" in
15891 "$define")
15892         echo " "
15893         echo "Stripping down executable paths..." >&4
15894         for file in $loclist $trylist; do
15895                 eval temp=\$$file
15896                 eval $file=`basename $temp`
15897         done
15898         ;;
15899 esac
15900
15901 : create config.sh file
15902 echo " "
15903 echo "Creating config.sh..." >&4
15904 $spitshell <<EOT >config.sh
15905 $startsh
15906 #
15907 # This file was produced by running the Configure script. It holds all the
15908 # definitions figured out by Configure. Should you modify one of these values,
15909 # do not forget to propagate your changes by running "Configure -der". You may
15910 # instead choose to run each of the .SH files by yourself, or "Configure -S".
15911 #
15912
15913 # Package name      : $package
15914 # Source directory  : $src
15915 # Configuration time: $cf_time
15916 # Configured by     : $cf_by
15917 # Target system     : $myuname
15918
15919 Author='$Author'
15920 Date='$Date'
15921 Header='$Header'
15922 Id='$Id'
15923 Locker='$Locker'
15924 Log='$Log'
15925 Mcc='$Mcc'
15926 RCSfile='$RCSfile'
15927 Revision='$Revision'
15928 Source='$Source'
15929 State='$State'
15930 _a='$_a'
15931 _exe='$_exe'
15932 _o='$_o'
15933 afs='$afs'
15934 alignbytes='$alignbytes'
15935 ansi2knr='$ansi2knr'
15936 aphostname='$aphostname'
15937 api_revision='$api_revision'
15938 api_subversion='$api_subversion'
15939 api_version='$api_version'
15940 api_versionstring='$api_versionstring'
15941 ar='$ar'
15942 archlib='$archlib'
15943 archlibexp='$archlibexp'
15944 archname64='$archname64'
15945 archname='$archname'
15946 archobjs='$archobjs'
15947 awk='$awk'
15948 baserev='$baserev'
15949 bash='$bash'
15950 bin='$bin'
15951 bincompat5005='$bincompat5005'
15952 binexp='$binexp'
15953 bison='$bison'
15954 byacc='$byacc'
15955 byteorder='$byteorder'
15956 c='$c'
15957 castflags='$castflags'
15958 cat='$cat'
15959 cc='$cc'
15960 cccdlflags='$cccdlflags'
15961 ccdlflags='$ccdlflags'
15962 ccflags='$ccflags'
15963 ccflags_uselargefiles='$ccflags_uselargefiles'
15964 ccname='$ccname'
15965 ccsymbols='$ccsymbols'
15966 ccversion='$ccversion'
15967 cf_by='$cf_by'
15968 cf_email='$cf_email'
15969 cf_time='$cf_time'
15970 charsize='$charsize'
15971 chgrp='$chgrp'
15972 chmod='$chmod'
15973 chown='$chown'
15974 clocktype='$clocktype'
15975 comm='$comm'
15976 compress='$compress'
15977 contains='$contains'
15978 cp='$cp'
15979 cpio='$cpio'
15980 cpp='$cpp'
15981 cpp_stuff='$cpp_stuff'
15982 cppccsymbols='$cppccsymbols'
15983 cppflags='$cppflags'
15984 cpplast='$cpplast'
15985 cppminus='$cppminus'
15986 cpprun='$cpprun'
15987 cppstdin='$cppstdin'
15988 cppsymbols='$cppsymbols'
15989 crosscompile='$crosscompile'
15990 cryptlib='$cryptlib'
15991 csh='$csh'
15992 d_Gconvert='$d_Gconvert'
15993 d_PRIEUldbl='$d_PRIEUldbl'
15994 d_PRIFUldbl='$d_PRIFUldbl'
15995 d_PRIGUldbl='$d_PRIGUldbl'
15996 d_PRIXU64='$d_PRIXU64'
15997 d_PRId64='$d_PRId64'
15998 d_PRIeldbl='$d_PRIeldbl'
15999 d_PRIfldbl='$d_PRIfldbl'
16000 d_PRIgldbl='$d_PRIgldbl'
16001 d_PRIi64='$d_PRIi64'
16002 d_PRIo64='$d_PRIo64'
16003 d_PRIu64='$d_PRIu64'
16004 d_PRIx64='$d_PRIx64'
16005 d_SCNfldbl='$d_SCNfldbl'
16006 d__fwalk='$d__fwalk'
16007 d_access='$d_access'
16008 d_accessx='$d_accessx'
16009 d_alarm='$d_alarm'
16010 d_archlib='$d_archlib'
16011 d_atolf='$d_atolf'
16012 d_atoll='$d_atoll'
16013 d_attribut='$d_attribut'
16014 d_bcmp='$d_bcmp'
16015 d_bcopy='$d_bcopy'
16016 d_bincompat5005='$d_bincompat5005'
16017 d_bsd='$d_bsd'
16018 d_bsdgetpgrp='$d_bsdgetpgrp'
16019 d_bsdsetpgrp='$d_bsdsetpgrp'
16020 d_bzero='$d_bzero'
16021 d_casti32='$d_casti32'
16022 d_castneg='$d_castneg'
16023 d_charvspr='$d_charvspr'
16024 d_chown='$d_chown'
16025 d_chroot='$d_chroot'
16026 d_chsize='$d_chsize'
16027 d_closedir='$d_closedir'
16028 d_const='$d_const'
16029 d_crypt='$d_crypt'
16030 d_csh='$d_csh'
16031 d_cuserid='$d_cuserid'
16032 d_dbl_dig='$d_dbl_dig'
16033 d_difftime='$d_difftime'
16034 d_dirnamlen='$d_dirnamlen'
16035 d_dlerror='$d_dlerror'
16036 d_dlopen='$d_dlopen'
16037 d_dlsymun='$d_dlsymun'
16038 d_dosuid='$d_dosuid'
16039 d_drand48proto='$d_drand48proto'
16040 d_dup2='$d_dup2'
16041 d_eaccess='$d_eaccess'
16042 d_endgrent='$d_endgrent'
16043 d_endhent='$d_endhent'
16044 d_endnent='$d_endnent'
16045 d_endpent='$d_endpent'
16046 d_endpwent='$d_endpwent'
16047 d_endsent='$d_endsent'
16048 d_eofnblk='$d_eofnblk'
16049 d_eunice='$d_eunice'
16050 d_fchmod='$d_fchmod'
16051 d_fchown='$d_fchown'
16052 d_fcntl='$d_fcntl'
16053 d_fcntl_can_lock='$d_fcntl_can_lock'
16054 d_fd_macros='$d_fd_macros'
16055 d_fd_set='$d_fd_set'
16056 d_fds_bits='$d_fds_bits'
16057 d_fgetpos='$d_fgetpos'
16058 d_flexfnam='$d_flexfnam'
16059 d_flock='$d_flock'
16060 d_fork='$d_fork'
16061 d_fpathconf='$d_fpathconf'
16062 d_fpos64_t='$d_fpos64_t'
16063 d_frexpl='$d_frexpl'
16064 d_fs_data_s='$d_fs_data_s'
16065 d_fseeko='$d_fseeko'
16066 d_fsetpos='$d_fsetpos'
16067 d_fstatfs='$d_fstatfs'
16068 d_fstatvfs='$d_fstatvfs'
16069 d_fsync='$d_fsync'
16070 d_ftello='$d_ftello'
16071 d_ftime='$d_ftime'
16072 d_getcwd='$d_getcwd'
16073 d_getespwnam='$d_getespwnam'
16074 d_getfsstat='$d_getfsstat'
16075 d_getgrent='$d_getgrent'
16076 d_getgrps='$d_getgrps'
16077 d_gethbyaddr='$d_gethbyaddr'
16078 d_gethbyname='$d_gethbyname'
16079 d_gethent='$d_gethent'
16080 d_gethname='$d_gethname'
16081 d_gethostprotos='$d_gethostprotos'
16082 d_getlogin='$d_getlogin'
16083 d_getmnt='$d_getmnt'
16084 d_getmntent='$d_getmntent'
16085 d_getnbyaddr='$d_getnbyaddr'
16086 d_getnbyname='$d_getnbyname'
16087 d_getnent='$d_getnent'
16088 d_getnetprotos='$d_getnetprotos'
16089 d_getpagsz='$d_getpagsz'
16090 d_getpbyname='$d_getpbyname'
16091 d_getpbynumber='$d_getpbynumber'
16092 d_getpent='$d_getpent'
16093 d_getpgid='$d_getpgid'
16094 d_getpgrp2='$d_getpgrp2'
16095 d_getpgrp='$d_getpgrp'
16096 d_getppid='$d_getppid'
16097 d_getprior='$d_getprior'
16098 d_getprotoprotos='$d_getprotoprotos'
16099 d_getprpwnam='$d_getprpwnam'
16100 d_getpwent='$d_getpwent'
16101 d_getsbyname='$d_getsbyname'
16102 d_getsbyport='$d_getsbyport'
16103 d_getsent='$d_getsent'
16104 d_getservprotos='$d_getservprotos'
16105 d_getspnam='$d_getspnam'
16106 d_gettimeod='$d_gettimeod'
16107 d_gnulibc='$d_gnulibc'
16108 d_grpasswd='$d_grpasswd'
16109 d_hasmntopt='$d_hasmntopt'
16110 d_htonl='$d_htonl'
16111 d_iconv='$d_iconv'
16112 d_index='$d_index'
16113 d_inetaton='$d_inetaton'
16114 d_int64_t='$d_int64_t'
16115 d_isascii='$d_isascii'
16116 d_isnan='$d_isnan'
16117 d_isnanl='$d_isnanl'
16118 d_killpg='$d_killpg'
16119 d_lchown='$d_lchown'
16120 d_ldbl_dig='$d_ldbl_dig'
16121 d_link='$d_link'
16122 d_locconv='$d_locconv'
16123 d_lockf='$d_lockf'
16124 d_longdbl='$d_longdbl'
16125 d_longlong='$d_longlong'
16126 d_lseekproto='$d_lseekproto'
16127 d_lstat='$d_lstat'
16128 d_madvise='$d_madvise'
16129 d_mblen='$d_mblen'
16130 d_mbstowcs='$d_mbstowcs'
16131 d_mbtowc='$d_mbtowc'
16132 d_memchr='$d_memchr'
16133 d_memcmp='$d_memcmp'
16134 d_memcpy='$d_memcpy'
16135 d_memmove='$d_memmove'
16136 d_memset='$d_memset'
16137 d_mkdir='$d_mkdir'
16138 d_mkdtemp='$d_mkdtemp'
16139 d_mkfifo='$d_mkfifo'
16140 d_mkstemp='$d_mkstemp'
16141 d_mkstemps='$d_mkstemps'
16142 d_mktime='$d_mktime'
16143 d_mmap='$d_mmap'
16144 d_modfl='$d_modfl'
16145 d_mprotect='$d_mprotect'
16146 d_msg='$d_msg'
16147 d_msg_ctrunc='$d_msg_ctrunc'
16148 d_msg_dontroute='$d_msg_dontroute'
16149 d_msg_oob='$d_msg_oob'
16150 d_msg_peek='$d_msg_peek'
16151 d_msg_proxy='$d_msg_proxy'
16152 d_msgctl='$d_msgctl'
16153 d_msgget='$d_msgget'
16154 d_msgrcv='$d_msgrcv'
16155 d_msgsnd='$d_msgsnd'
16156 d_msync='$d_msync'
16157 d_munmap='$d_munmap'
16158 d_mymalloc='$d_mymalloc'
16159 d_nice='$d_nice'
16160 d_nv_preserves_uv='$d_nv_preserves_uv'
16161 d_nv_preserves_uv_bits='$d_nv_preserves_uv_bits'
16162 d_off64_t='$d_off64_t'
16163 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
16164 d_oldpthreads='$d_oldpthreads'
16165 d_oldsock='$d_oldsock'
16166 d_open3='$d_open3'
16167 d_pathconf='$d_pathconf'
16168 d_pause='$d_pause'
16169 d_perl_otherlibdirs='$d_perl_otherlibdirs'
16170 d_phostname='$d_phostname'
16171 d_pipe='$d_pipe'
16172 d_poll='$d_poll'
16173 d_portable='$d_portable'
16174 d_pthread_yield='$d_pthread_yield'
16175 d_pwage='$d_pwage'
16176 d_pwchange='$d_pwchange'
16177 d_pwclass='$d_pwclass'
16178 d_pwcomment='$d_pwcomment'
16179 d_pwexpire='$d_pwexpire'
16180 d_pwgecos='$d_pwgecos'
16181 d_pwpasswd='$d_pwpasswd'
16182 d_pwquota='$d_pwquota'
16183 d_qgcvt='$d_qgcvt'
16184 d_quad='$d_quad'
16185 d_readdir='$d_readdir'
16186 d_readlink='$d_readlink'
16187 d_rename='$d_rename'
16188 d_rewinddir='$d_rewinddir'
16189 d_rmdir='$d_rmdir'
16190 d_safebcpy='$d_safebcpy'
16191 d_safemcpy='$d_safemcpy'
16192 d_sanemcmp='$d_sanemcmp'
16193 d_sbrkproto='$d_sbrkproto'
16194 d_sched_yield='$d_sched_yield'
16195 d_scm_rights='$d_scm_rights'
16196 d_seekdir='$d_seekdir'
16197 d_select='$d_select'
16198 d_sem='$d_sem'
16199 d_semctl='$d_semctl'
16200 d_semctl_semid_ds='$d_semctl_semid_ds'
16201 d_semctl_semun='$d_semctl_semun'
16202 d_semget='$d_semget'
16203 d_semop='$d_semop'
16204 d_setegid='$d_setegid'
16205 d_seteuid='$d_seteuid'
16206 d_setgrent='$d_setgrent'
16207 d_setgrps='$d_setgrps'
16208 d_sethent='$d_sethent'
16209 d_setlinebuf='$d_setlinebuf'
16210 d_setlocale='$d_setlocale'
16211 d_setnent='$d_setnent'
16212 d_setpent='$d_setpent'
16213 d_setpgid='$d_setpgid'
16214 d_setpgrp2='$d_setpgrp2'
16215 d_setpgrp='$d_setpgrp'
16216 d_setprior='$d_setprior'
16217 d_setproctitle='$d_setproctitle'
16218 d_setpwent='$d_setpwent'
16219 d_setregid='$d_setregid'
16220 d_setresgid='$d_setresgid'
16221 d_setresuid='$d_setresuid'
16222 d_setreuid='$d_setreuid'
16223 d_setrgid='$d_setrgid'
16224 d_setruid='$d_setruid'
16225 d_setsent='$d_setsent'
16226 d_setsid='$d_setsid'
16227 d_setvbuf='$d_setvbuf'
16228 d_sfio='$d_sfio'
16229 d_shm='$d_shm'
16230 d_shmat='$d_shmat'
16231 d_shmatprototype='$d_shmatprototype'
16232 d_shmctl='$d_shmctl'
16233 d_shmdt='$d_shmdt'
16234 d_shmget='$d_shmget'
16235 d_sigaction='$d_sigaction'
16236 d_sigprocmask='$d_sigprocmask'
16237 d_sigsetjmp='$d_sigsetjmp'
16238 d_sockatmark='$d_sockatmark'
16239 d_socket='$d_socket'
16240 d_socklen_t='$d_socklen_t'
16241 d_sockpair='$d_sockpair'
16242 d_socks5_init='$d_socks5_init'
16243 d_sqrtl='$d_sqrtl'
16244 d_statblks='$d_statblks'
16245 d_statfs_f_flags='$d_statfs_f_flags'
16246 d_statfs_s='$d_statfs_s'
16247 d_statvfs='$d_statvfs'
16248 d_stdio_cnt_lval='$d_stdio_cnt_lval'
16249 d_stdio_ptr_lval='$d_stdio_ptr_lval'
16250 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
16251 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
16252 d_stdio_stream_array='$d_stdio_stream_array'
16253 d_stdiobase='$d_stdiobase'
16254 d_stdstdio='$d_stdstdio'
16255 d_strchr='$d_strchr'
16256 d_strcoll='$d_strcoll'
16257 d_strctcpy='$d_strctcpy'
16258 d_strerrm='$d_strerrm'
16259 d_strerror='$d_strerror'
16260 d_strtod='$d_strtod'
16261 d_strtol='$d_strtol'
16262 d_strtold='$d_strtold'
16263 d_strtoll='$d_strtoll'
16264 d_strtoq='$d_strtoq'
16265 d_strtoul='$d_strtoul'
16266 d_strtoull='$d_strtoull'
16267 d_strtouq='$d_strtouq'
16268 d_strxfrm='$d_strxfrm'
16269 d_suidsafe='$d_suidsafe'
16270 d_symlink='$d_symlink'
16271 d_syscall='$d_syscall'
16272 d_sysconf='$d_sysconf'
16273 d_sysernlst='$d_sysernlst'
16274 d_syserrlst='$d_syserrlst'
16275 d_system='$d_system'
16276 d_tcgetpgrp='$d_tcgetpgrp'
16277 d_tcsetpgrp='$d_tcsetpgrp'
16278 d_telldir='$d_telldir'
16279 d_telldirproto='$d_telldirproto'
16280 d_time='$d_time'
16281 d_times='$d_times'
16282 d_truncate='$d_truncate'
16283 d_tzname='$d_tzname'
16284 d_umask='$d_umask'
16285 d_uname='$d_uname'
16286 d_union_semun='$d_union_semun'
16287 d_ustat='$d_ustat'
16288 d_vendorarch='$d_vendorarch'
16289 d_vendorbin='$d_vendorbin'
16290 d_vendorlib='$d_vendorlib'
16291 d_vfork='$d_vfork'
16292 d_void_closedir='$d_void_closedir'
16293 d_voidsig='$d_voidsig'
16294 d_voidtty='$d_voidtty'
16295 d_volatile='$d_volatile'
16296 d_vprintf='$d_vprintf'
16297 d_wait4='$d_wait4'
16298 d_waitpid='$d_waitpid'
16299 d_wcstombs='$d_wcstombs'
16300 d_wctomb='$d_wctomb'
16301 d_xenix='$d_xenix'
16302 date='$date'
16303 db_hashtype='$db_hashtype'
16304 db_prefixtype='$db_prefixtype'
16305 defvoidused='$defvoidused'
16306 direntrytype='$direntrytype'
16307 dlext='$dlext'
16308 dlsrc='$dlsrc'
16309 doublesize='$doublesize'
16310 drand01='$drand01'
16311 dynamic_ext='$dynamic_ext'
16312 eagain='$eagain'
16313 ebcdic='$ebcdic'
16314 echo='$echo'
16315 egrep='$egrep'
16316 emacs='$emacs'
16317 eunicefix='$eunicefix'
16318 exe_ext='$exe_ext'
16319 expr='$expr'
16320 extensions='$extensions'
16321 fflushNULL='$fflushNULL'
16322 fflushall='$fflushall'
16323 find='$find'
16324 firstmakefile='$firstmakefile'
16325 flex='$flex'
16326 fpossize='$fpossize'
16327 fpostype='$fpostype'
16328 freetype='$freetype'
16329 full_ar='$full_ar'
16330 full_csh='$full_csh'
16331 full_sed='$full_sed'
16332 gccosandvers='$gccosandvers'
16333 gccversion='$gccversion'
16334 gidformat='$gidformat'
16335 gidsign='$gidsign'
16336 gidsize='$gidsize'
16337 gidtype='$gidtype'
16338 glibpth='$glibpth'
16339 grep='$grep'
16340 groupcat='$groupcat'
16341 groupstype='$groupstype'
16342 gzip='$gzip'
16343 h_fcntl='$h_fcntl'
16344 h_sysfile='$h_sysfile'
16345 hint='$hint'
16346 hostcat='$hostcat'
16347 i16size='$i16size'
16348 i16type='$i16type'
16349 i32size='$i32size'
16350 i32type='$i32type'
16351 i64size='$i64size'
16352 i64type='$i64type'
16353 i8size='$i8size'
16354 i8type='$i8type'
16355 i_arpainet='$i_arpainet'
16356 i_bsdioctl='$i_bsdioctl'
16357 i_db='$i_db'
16358 i_dbm='$i_dbm'
16359 i_dirent='$i_dirent'
16360 i_dld='$i_dld'
16361 i_dlfcn='$i_dlfcn'
16362 i_fcntl='$i_fcntl'
16363 i_float='$i_float'
16364 i_gdbm='$i_gdbm'
16365 i_grp='$i_grp'
16366 i_iconv='$i_iconv'
16367 i_ieeefp='$i_ieeefp'
16368 i_inttypes='$i_inttypes'
16369 i_libutil='$i_libutil'
16370 i_limits='$i_limits'
16371 i_locale='$i_locale'
16372 i_machcthr='$i_machcthr'
16373 i_malloc='$i_malloc'
16374 i_math='$i_math'
16375 i_memory='$i_memory'
16376 i_mntent='$i_mntent'
16377 i_ndbm='$i_ndbm'
16378 i_netdb='$i_netdb'
16379 i_neterrno='$i_neterrno'
16380 i_netinettcp='$i_netinettcp'
16381 i_niin='$i_niin'
16382 i_poll='$i_poll'
16383 i_prot='$i_prot'
16384 i_pthread='$i_pthread'
16385 i_pwd='$i_pwd'
16386 i_rpcsvcdbm='$i_rpcsvcdbm'
16387 i_sfio='$i_sfio'
16388 i_sgtty='$i_sgtty'
16389 i_shadow='$i_shadow'
16390 i_socks='$i_socks'
16391 i_stdarg='$i_stdarg'
16392 i_stddef='$i_stddef'
16393 i_stdlib='$i_stdlib'
16394 i_string='$i_string'
16395 i_sunmath='$i_sunmath'
16396 i_sysaccess='$i_sysaccess'
16397 i_sysdir='$i_sysdir'
16398 i_sysfile='$i_sysfile'
16399 i_sysfilio='$i_sysfilio'
16400 i_sysin='$i_sysin'
16401 i_sysioctl='$i_sysioctl'
16402 i_syslog='$i_syslog'
16403 i_sysmman='$i_sysmman'
16404 i_sysmode='$i_sysmode'
16405 i_sysmount='$i_sysmount'
16406 i_sysndir='$i_sysndir'
16407 i_sysparam='$i_sysparam'
16408 i_sysresrc='$i_sysresrc'
16409 i_syssecrt='$i_syssecrt'
16410 i_sysselct='$i_sysselct'
16411 i_syssockio='$i_syssockio'
16412 i_sysstat='$i_sysstat'
16413 i_sysstatfs='$i_sysstatfs'
16414 i_sysstatvfs='$i_sysstatvfs'
16415 i_systime='$i_systime'
16416 i_systimek='$i_systimek'
16417 i_systimes='$i_systimes'
16418 i_systypes='$i_systypes'
16419 i_sysuio='$i_sysuio'
16420 i_sysun='$i_sysun'
16421 i_sysutsname='$i_sysutsname'
16422 i_sysvfs='$i_sysvfs'
16423 i_syswait='$i_syswait'
16424 i_termio='$i_termio'
16425 i_termios='$i_termios'
16426 i_time='$i_time'
16427 i_unistd='$i_unistd'
16428 i_ustat='$i_ustat'
16429 i_utime='$i_utime'
16430 i_values='$i_values'
16431 i_varargs='$i_varargs'
16432 i_varhdr='$i_varhdr'
16433 i_vfork='$i_vfork'
16434 ignore_versioned_solibs='$ignore_versioned_solibs'
16435 inc_version_list='$inc_version_list'
16436 inc_version_list_init='$inc_version_list_init'
16437 incpath='$incpath'
16438 inews='$inews'
16439 installarchlib='$installarchlib'
16440 installbin='$installbin'
16441 installman1dir='$installman1dir'
16442 installman3dir='$installman3dir'
16443 installprefix='$installprefix'
16444 installprefixexp='$installprefixexp'
16445 installprivlib='$installprivlib'
16446 installscript='$installscript'
16447 installsitearch='$installsitearch'
16448 installsitebin='$installsitebin'
16449 installsitelib='$installsitelib'
16450 installstyle='$installstyle'
16451 installusrbinperl='$installusrbinperl'
16452 installvendorarch='$installvendorarch'
16453 installvendorbin='$installvendorbin'
16454 installvendorlib='$installvendorlib'
16455 intsize='$intsize'
16456 issymlink='$issymlink'
16457 ivdformat='$ivdformat'
16458 ivsize='$ivsize'
16459 ivtype='$ivtype'
16460 known_extensions='$known_extensions'
16461 ksh='$ksh'
16462 ld='$ld'
16463 lddlflags='$lddlflags'
16464 ldflags='$ldflags'
16465 ldflags_uselargefiles='$ldflags_uselargefiles'
16466 ldlibpthname='$ldlibpthname'
16467 less='$less'
16468 lib_ext='$lib_ext'
16469 libc='$libc'
16470 libperl='$libperl'
16471 libpth='$libpth'
16472 libs='$libs'
16473 libsdirs='$libsdirs'
16474 libsfiles='$libsfiles'
16475 libsfound='$libsfound'
16476 libspath='$libspath'
16477 libswanted='$libswanted'
16478 libswanted_uselargefiles='$libswanted_uselargefiles'
16479 line='$line'
16480 lint='$lint'
16481 lkflags='$lkflags'
16482 ln='$ln'
16483 lns='$lns'
16484 locincpth='$locincpth'
16485 loclibpth='$loclibpth'
16486 longdblsize='$longdblsize'
16487 longlongsize='$longlongsize'
16488 longsize='$longsize'
16489 lp='$lp'
16490 lpr='$lpr'
16491 ls='$ls'
16492 lseeksize='$lseeksize'
16493 lseektype='$lseektype'
16494 mail='$mail'
16495 mailx='$mailx'
16496 make='$make'
16497 make_set_make='$make_set_make'
16498 mallocobj='$mallocobj'
16499 mallocsrc='$mallocsrc'
16500 malloctype='$malloctype'
16501 man1dir='$man1dir'
16502 man1direxp='$man1direxp'
16503 man1ext='$man1ext'
16504 man3dir='$man3dir'
16505 man3direxp='$man3direxp'
16506 man3ext='$man3ext'
16507 mips_type='$mips_type'
16508 mkdir='$mkdir'
16509 mmaptype='$mmaptype'
16510 modetype='$modetype'
16511 more='$more'
16512 multiarch='$multiarch'
16513 mv='$mv'
16514 myarchname='$myarchname'
16515 mydomain='$mydomain'
16516 myhostname='$myhostname'
16517 myuname='$myuname'
16518 n='$n'
16519 need_va_copy='$need_va_copy'
16520 netdb_hlen_type='$netdb_hlen_type'
16521 netdb_host_type='$netdb_host_type'
16522 netdb_name_type='$netdb_name_type'
16523 netdb_net_type='$netdb_net_type'
16524 nm='$nm'
16525 nm_opt='$nm_opt'
16526 nm_so_opt='$nm_so_opt'
16527 nonxs_ext='$nonxs_ext'
16528 nroff='$nroff'
16529 nvEUformat='$nvEUformat'
16530 nvFUformat='$nvFUformat'
16531 nvGUformat='$nvGUformat'
16532 nveformat='$nveformat'
16533 nvfformat='$nvfformat'
16534 nvgformat='$nvgformat'
16535 nvsize='$nvsize'
16536 nvtype='$nvtype'
16537 o_nonblock='$o_nonblock'
16538 obj_ext='$obj_ext'
16539 old_pthread_create_joinable='$old_pthread_create_joinable'
16540 optimize='$optimize'
16541 orderlib='$orderlib'
16542 osname='$osname'
16543 osvers='$osvers'
16544 otherlibdirs='$otherlibdirs'
16545 package='$package'
16546 pager='$pager'
16547 passcat='$passcat'
16548 patchlevel='$patchlevel'
16549 path_sep='$path_sep'
16550 perl5='$perl5'
16551 perl='$perl'
16552 perladmin='$perladmin'
16553 perllibs='$perllibs'
16554 perlpath='$perlpath'
16555 pg='$pg'
16556 phostname='$phostname'
16557 pidtype='$pidtype'
16558 plibpth='$plibpth'
16559 pm_apiversion='$pm_apiversion'
16560 pmake='$pmake'
16561 pr='$pr'
16562 prefix='$prefix'
16563 prefixexp='$prefixexp'
16564 privlib='$privlib'
16565 privlibexp='$privlibexp'
16566 prototype='$prototype'
16567 ptrsize='$ptrsize'
16568 quadkind='$quadkind'
16569 quadtype='$quadtype'
16570 randbits='$randbits'
16571 randfunc='$randfunc'
16572 randseedtype='$randseedtype'
16573 ranlib='$ranlib'
16574 rd_nodata='$rd_nodata'
16575 revision='$revision'
16576 rm='$rm'
16577 rmail='$rmail'
16578 runnm='$runnm'
16579 sPRIEUldbl='$sPRIEUldbl'
16580 sPRIFUldbl='$sPRIFUldbl'
16581 sPRIGUldbl='$sPRIGUldbl'
16582 sPRIXU64='$sPRIXU64'
16583 sPRId64='$sPRId64'
16584 sPRIeldbl='$sPRIeldbl'
16585 sPRIfldbl='$sPRIfldbl'
16586 sPRIgldbl='$sPRIgldbl'
16587 sPRIi64='$sPRIi64'
16588 sPRIo64='$sPRIo64'
16589 sPRIu64='$sPRIu64'
16590 sPRIx64='$sPRIx64'
16591 sSCNfldbl='$sSCNfldbl'
16592 sched_yield='$sched_yield'
16593 scriptdir='$scriptdir'
16594 scriptdirexp='$scriptdirexp'
16595 sed='$sed'
16596 seedfunc='$seedfunc'
16597 selectminbits='$selectminbits'
16598 selecttype='$selecttype'
16599 sendmail='$sendmail'
16600 sh='$sh'
16601 shar='$shar'
16602 sharpbang='$sharpbang'
16603 shmattype='$shmattype'
16604 shortsize='$shortsize'
16605 shrpenv='$shrpenv'
16606 shsharp='$shsharp'
16607 sig_count='$sig_count'
16608 sig_name='$sig_name'
16609 sig_name_init='$sig_name_init'
16610 sig_num='$sig_num'
16611 sig_num_init='$sig_num_init'
16612 sig_size='$sig_size'
16613 signal_t='$signal_t'
16614 sitearch='$sitearch'
16615 sitearchexp='$sitearchexp'
16616 sitebin='$sitebin'
16617 sitebinexp='$sitebinexp'
16618 sitelib='$sitelib'
16619 sitelib_stem='$sitelib_stem'
16620 sitelibexp='$sitelibexp'
16621 siteprefix='$siteprefix'
16622 siteprefixexp='$siteprefixexp'
16623 sizesize='$sizesize'
16624 sizetype='$sizetype'
16625 sleep='$sleep'
16626 smail='$smail'
16627 so='$so'
16628 sockethdr='$sockethdr'
16629 socketlib='$socketlib'
16630 socksizetype='$socksizetype'
16631 sort='$sort'
16632 spackage='$spackage'
16633 spitshell='$spitshell'
16634 src='$src'
16635 ssizetype='$ssizetype'
16636 startperl='$startperl'
16637 startsh='$startsh'
16638 static_ext='$static_ext'
16639 stdchar='$stdchar'
16640 stdio_base='$stdio_base'
16641 stdio_bufsiz='$stdio_bufsiz'
16642 stdio_cnt='$stdio_cnt'
16643 stdio_filbuf='$stdio_filbuf'
16644 stdio_ptr='$stdio_ptr'
16645 stdio_stream_array='$stdio_stream_array'
16646 strings='$strings'
16647 submit='$submit'
16648 subversion='$subversion'
16649 sysman='$sysman'
16650 tail='$tail'
16651 tar='$tar'
16652 tbl='$tbl'
16653 tee='$tee'
16654 test='$test'
16655 timeincl='$timeincl'
16656 timetype='$timetype'
16657 touch='$touch'
16658 tr='$tr'
16659 trnl='$trnl'
16660 troff='$troff'
16661 u16size='$u16size'
16662 u16type='$u16type'
16663 u32size='$u32size'
16664 u32type='$u32type'
16665 u64size='$u64size'
16666 u64type='$u64type'
16667 u8size='$u8size'
16668 u8type='$u8type'
16669 uidformat='$uidformat'
16670 uidsign='$uidsign'
16671 uidsize='$uidsize'
16672 uidtype='$uidtype'
16673 uname='$uname'
16674 uniq='$uniq'
16675 uquadtype='$uquadtype'
16676 use5005threads='$use5005threads'
16677 use64bitall='$use64bitall'
16678 use64bitint='$use64bitint'
16679 usedl='$usedl'
16680 useithreads='$useithreads'
16681 uselargefiles='$uselargefiles'
16682 uselongdouble='$uselongdouble'
16683 usemorebits='$usemorebits'
16684 usemultiplicity='$usemultiplicity'
16685 usemymalloc='$usemymalloc'
16686 usenm='$usenm'
16687 useopcode='$useopcode'
16688 useperlio='$useperlio'
16689 useposix='$useposix'
16690 usesfio='$usesfio'
16691 useshrplib='$useshrplib'
16692 usesocks='$usesocks'
16693 usethreads='$usethreads'
16694 usevendorprefix='$usevendorprefix'
16695 usevfork='$usevfork'
16696 usrinc='$usrinc'
16697 uuname='$uuname'
16698 uvXUformat='$uvXUformat'
16699 uvoformat='$uvoformat'
16700 uvsize='$uvsize'
16701 uvtype='$uvtype'
16702 uvuformat='$uvuformat'
16703 uvxformat='$uvxformat'
16704 vendorarch='$vendorarch'
16705 vendorarchexp='$vendorarchexp'
16706 vendorbin='$vendorbin'
16707 vendorbinexp='$vendorbinexp'
16708 vendorlib='$vendorlib'
16709 vendorlib_stem='$vendorlib_stem'
16710 vendorlibexp='$vendorlibexp'
16711 vendorprefix='$vendorprefix'
16712 vendorprefixexp='$vendorprefixexp'
16713 version='$version'
16714 versiononly='$versiononly'
16715 vi='$vi'
16716 voidflags='$voidflags'
16717 xlibpth='$xlibpth'
16718 xs_apiversion='$xs_apiversion'
16719 yacc='$yacc'
16720 yaccflags='$yaccflags'
16721 zcat='$zcat'
16722 zip='$zip'
16723 EOT
16724
16725 : Add in command line options if available
16726 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
16727
16728 : add special variables
16729 $test -f $src/patchlevel.h && \
16730 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
16731 echo "CONFIGDOTSH=true" >>config.sh
16732
16733 : propagate old symbols
16734 if $test -f UU/config.sh; then
16735         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
16736         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
16737         $sort | $uniq -u >UU/oldsyms
16738         set X `cat UU/oldsyms`
16739         shift
16740         case $# in
16741         0) ;;
16742         *)
16743                 cat <<EOM
16744 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
16745 EOM
16746                 echo "# Variables propagated from previous config.sh file." >>config.sh
16747                 for sym in `cat UU/oldsyms`; do
16748                         echo "    Propagating $hint variable "'$'"$sym..."
16749                         eval 'tmp="$'"${sym}"'"'
16750                         echo "$tmp" | \
16751                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
16752                 done
16753                 ;;
16754         esac
16755 fi
16756
16757 : Finish up by extracting the .SH files
16758 case "$alldone" in
16759 exit)
16760         $rm -rf UU
16761         echo "Done."
16762         exit 0
16763         ;;
16764 cont)
16765         ;;
16766 '')
16767         dflt=''
16768         nostick=true
16769         $cat <<EOM
16770
16771 If you'd like to make any changes to the config.sh file before I begin
16772 to configure things, do it as a shell escape now (e.g. !vi config.sh).
16773
16774 EOM
16775         rp="Press return or use a shell escape to edit config.sh:"
16776         . UU/myread
16777         nostick=''
16778         case "$ans" in
16779         '') ;;
16780         *) : in case they cannot read
16781                 sh 1>&4 -c "$ans";;
16782         esac
16783         ;;
16784 esac
16785
16786 : if this fails, just run all the .SH files by hand
16787 . ./config.sh
16788
16789 echo " "
16790 exec 1>&4
16791 . ./UU/extract
16792
16793 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
16794         dflt=y
16795         case "$silent" in
16796         true) ;;
16797         *)
16798                 $cat <<EOM
16799
16800 Now you need to generate make dependencies by running "$make depend".
16801 You might prefer to run it in background: "$make depend > makedepend.out &"
16802 It can take a while, so you might not want to run it right now.
16803
16804 EOM
16805                 ;;
16806         esac
16807         rp="Run $make depend now?"
16808         . UU/myread
16809         case "$ans" in
16810         y*)
16811                 $make depend && echo "Now you must run '$make'."
16812                 ;;
16813         *)
16814                 echo "You must run '$make depend' then '$make'."
16815                 ;;
16816         esac
16817 elif test -f [Mm]akefile; then
16818         echo " "
16819         echo "Now you must run a $make."
16820 else
16821         echo "Done."
16822 fi
16823
16824 if $test -f Policy.sh; then
16825     $cat <<EOM
16826
16827 If you compile $package on a different machine or from a different object
16828 directory, copy the Policy.sh file from this object directory to the
16829 new one before you run Configure -- this will help you with most of
16830 the policy defaults.
16831
16832 EOM
16833 fi
16834 if $test -f config.msg; then
16835     echo "Hmm.  I also noted the following information while running:"
16836     echo " "
16837     $cat config.msg >&4
16838     $rm -f config.msg
16839 fi
16840 $rm -f kit*isdone ark*isdone
16841 $rm -rf UU
16842
16843 : End of Configure
16844